Problem 475

Music Festival — f(600) mod 1_000_000_007.

Answer75780067
Output75780067
StatusPASS
Native helperno
Runtime0 ms
Peak memory1088 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)?
Space complexityO(n^2)?
ApproachFlow solutionNot curated
VerdictUnknown

Flow source

# Project Euler 475
# Music Festival — f(600) mod 1_000_000_007.

extern {
    function calloc(n: i64, size: i64) -> ptr<void>
    function free(p: ptr<void>) -> void
}

let mut MOD: i64 = 1000000007

function modpow(base0: i64, exp0: i64, mod: i64) -> i64 {
    let mut r: i64 = 1
    let mut b: i64 = base0 % mod
    let mut e: i64 = exp0
    if b < 0 { b = b + mod }
    while e > 0 {
        if e % 2 == 1 {
            r = (r * b) % mod
        }
        b = (b * b) % mod
        e = e / 2
    }
    return r
}

function main() -> i32 {
    # f(12n) with n = 50 => f(600)
    let n: i64 = 50
    let E: i64 = 4 * n
    let m: i64 = 3 * n
    let limit: i64 = 16 * n + 10

    let fact: ptr<i64> = calloc(limit + 1, 8)
    let invfact: ptr<i64> = calloc(limit + 1, 8)
    let pow2: ptr<i64> = calloc(E + 1, 8)
    let pow_neg3: ptr<i64> = calloc(E + 1, 8)
    let inv24pow: ptr<i64> = calloc(m + 1, 8)
    let inv2pow: ptr<i64> = calloc(E + 1, 8)
    if fact == null || invfact == null || pow2 == null || pow_neg3 == null || inv24pow == null || inv2pow == null {
        return 1
    }

    fact[0] = 1
    let mut i: i64 = 1
    while i <= limit {
        fact[i] = (fact[i - 1] * i) % MOD
        i = i + 1
    }
    invfact[limit] = modpow(fact[limit], MOD - 2, MOD)
    i = limit
    while i > 0 {
        invfact[i - 1] = (invfact[i] * i) % MOD
        i = i - 1
    }

    pow2[0] = 1
    i = 1
    while i <= E {
        pow2[i] = (pow2[i - 1] * 2) % MOD
        i = i + 1
    }

    let neg3: i64 = MOD - 3
    pow_neg3[0] = 1
    i = 1
    while i <= E {
        pow_neg3[i] = (pow_neg3[i - 1] * neg3) % MOD
        i = i + 1
    }

    let inv2: i64 = (MOD + 1) / 2
    let inv24: i64 = modpow(24, MOD - 2, MOD)
    inv24pow[0] = 1
    i = 1
    while i <= m {
        inv24pow[i] = (inv24pow[i - 1] * inv24) % MOD
        i = i + 1
    }
    inv2pow[0] = 1
    i = 1
    while i <= E {
        inv2pow[i] = (inv2pow[i - 1] * inv2) % MOD
        i = i + 1
    }

    let mut sigma: i64 = 0
    i = 0
    while i <= E {
        let max_j: i64 = E - i
        let mut j: i64 = 0
        while j <= max_j {
            let k: i64 = E - i - j
            let A: i64 = 3 * i + j
            let mut base: i64 = (fact[A] * invfact[i]) % MOD
            base = (base * pow_neg3[j]) % MOD
            base = (base * pow2[k]) % MOD

            let mut dmin: i64 = 0
            if i < n {
                dmin = n - i
            }
            let dmax: i64 = j / 2
            if dmin <= dmax {
                let invfact_c: i64 = invfact[k]
                let mut sumd: i64 = 0
                let mut d: i64 = dmin
                while d <= dmax {
                    let a: i64 = i - n + d
                    let b: i64 = j - 2 * d
                    let mut term: i64 = invfact[a]
                    term = (term * invfact[b]) % MOD
                    term = (term * invfact_c) % MOD
                    term = (term * invfact[d]) % MOD
                    term = (term * inv24pow[a]) % MOD
                    term = (term * inv2pow[b + d]) % MOD
                    sumd = (sumd + term) % MOD
                    d = d + 1
                }
                sigma = (sigma + base * sumd) % MOD
            }
            j = j + 1
        }
        i = i + 1
    }

    let pow24m: i64 = modpow(24, m, MOD)
    let inv6E: i64 = modpow(modpow(6, E, MOD), MOD - 2, MOD)
    let mut ans: i64 = (pow24m * fact[m]) % MOD
    ans = (ans * sigma) % MOD
    ans = (ans * inv6E) % MOD
    printf("%lld\n", ans)

    free(fact)
    free(invfact)
    free(pow2)
    free(pow_neg3)
    free(inv24pow)
    free(inv2pow)
    return 0
}

Generated C

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
    while (flow_temp_head) {
        flow_temp_node* n = flow_temp_head;
        flow_temp_head = n->next;
        free(n);
    }
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
    flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
    if (!node) return NULL;
    node->next = flow_temp_head;
    flow_temp_head = node;
    if (!flow_temp_atexit_set) {
        flow_temp_atexit_set = 1;
        atexit(flow_temp_free_all);
    }
    return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
    size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
    char* r = (char*)flow_temp_alloc(la + lb + 1);
    if (!r) return NULL;
    if (la) memcpy(r, a, la);
    if (lb) memcpy(r + la, b, lb);
    r[la + lb] = '\0';
    return r;
}

#define __flow_in_arr(arr, val) __extension__ ({ \
    int _found = 0; \
    size_t _n = sizeof(arr)/sizeof((arr)[0]); \
    for (size_t _i = 0; _i < _n; _i++) { \
        if ((arr)[_i] == (val)) { _found = 1; break; } \
    } _found; })

/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
    fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
    abort();
#if defined(__GNUC__) || defined(__clang__)
    __builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")

#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif

#include <math.h>

void* _ui_state = NULL;

static inline float i32_to_f32(int32_t v) { return (float)v; }

/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }

int64_t modpow_i64_i64_i64(int64_t base0, int64_t exp0, int64_t mod);
int32_t main(void);

/* Module statics */
static int64_t MOD = 1000000007;



int64_t modpow_i64_i64_i64(int64_t base0, int64_t exp0, int64_t mod) {
    int64_t r = 1;
    int64_t b = FLOW_CHECKED_MOD((base0), (mod));
    int64_t e = exp0;
    if (b < 0) {
        b = (b + mod);
    }
    while (e > 0) {
        if (FLOW_CHECKED_MOD((e), (2)) == 1) {
            r = FLOW_CHECKED_MOD(((r * b)), (mod));
        }
        b = FLOW_CHECKED_MOD(((b * b)), (mod));
        e = FLOW_CHECKED_DIV((e), (2));
    }
    return r;
}

int32_t main(void) {
    int64_t n = 50;
    int64_t E = (4 * n);
    int64_t m = (3 * n);
    int64_t limit = ((16 * n) + 10);
    int64_t* fact = (int64_t*)(calloc((limit + 1), 8));
    int64_t* invfact = (int64_t*)(calloc((limit + 1), 8));
    int64_t* pow2 = (int64_t*)(calloc((E + 1), 8));
    int64_t* pow_neg3 = (int64_t*)(calloc((E + 1), 8));
    int64_t* inv24pow = (int64_t*)(calloc((m + 1), 8));
    int64_t* inv2pow = (int64_t*)(calloc((E + 1), 8));
    if ((((((fact == NULL || invfact == NULL) || pow2 == NULL) || pow_neg3 == NULL) || inv24pow == NULL) || inv2pow == NULL)) {
        return 1;
    }
    fact[0] = 1;
    int64_t i = 1;
    while (i <= limit) {
        fact[i] = FLOW_CHECKED_MOD(((fact[(i - 1)] * i)), (MOD));
        i = (i + 1);
    }
    invfact[limit] = modpow_i64_i64_i64(fact[limit], (MOD - 2), MOD);
    i = limit;
    while (i > 0) {
        invfact[(i - 1)] = FLOW_CHECKED_MOD(((invfact[i] * i)), (MOD));
        i = (i - 1);
    }
    pow2[0] = 1;
    i = 1;
    while (i <= E) {
        pow2[i] = FLOW_CHECKED_MOD(((pow2[(i - 1)] * 2)), (MOD));
        i = (i + 1);
    }
    int64_t neg3 = (MOD - 3);
    pow_neg3[0] = 1;
    i = 1;
    while (i <= E) {
        pow_neg3[i] = FLOW_CHECKED_MOD(((pow_neg3[(i - 1)] * neg3)), (MOD));
        i = (i + 1);
    }
    int64_t inv2 = FLOW_CHECKED_DIV(((MOD + 1)), (2));
    int64_t inv24 = modpow_i64_i64_i64(24, (MOD - 2), MOD);
    inv24pow[0] = 1;
    i = 1;
    while (i <= m) {
        inv24pow[i] = FLOW_CHECKED_MOD(((inv24pow[(i - 1)] * inv24)), (MOD));
        i = (i + 1);
    }
    inv2pow[0] = 1;
    i = 1;
    while (i <= E) {
        inv2pow[i] = FLOW_CHECKED_MOD(((inv2pow[(i - 1)] * inv2)), (MOD));
        i = (i + 1);
    }
    int64_t sigma = 0;
    i = 0;
    while (i <= E) {
        int64_t max_j = (E - i);
        int64_t j = 0;
        while (j <= max_j) {
            int64_t k = ((E - i) - j);
            int64_t A = ((3 * i) + j);
            int64_t base = FLOW_CHECKED_MOD(((fact[A] * invfact[i])), (MOD));
            base = FLOW_CHECKED_MOD(((base * pow_neg3[j])), (MOD));
            base = FLOW_CHECKED_MOD(((base * pow2[k])), (MOD));
            int64_t dmin = 0;
            if (i < n) {
                dmin = (n - i);
            }
            int64_t dmax = FLOW_CHECKED_DIV((j), (2));
            if (dmin <= dmax) {
                int64_t invfact_c = invfact[k];
                int64_t sumd = 0;
                int64_t d = dmin;
                while (d <= dmax) {
                    int64_t a = ((i - n) + d);
                    int64_t b = (j - (2 * d));
                    int64_t term = invfact[a];
                    term = FLOW_CHECKED_MOD(((term * invfact[b])), (MOD));
                    term = FLOW_CHECKED_MOD(((term * invfact_c)), (MOD));
                    term = FLOW_CHECKED_MOD(((term * invfact[d])), (MOD));
                    term = FLOW_CHECKED_MOD(((term * inv24pow[a])), (MOD));
                    term = FLOW_CHECKED_MOD(((term * inv2pow[(b + d)])), (MOD));
                    sumd = FLOW_CHECKED_MOD(((sumd + term)), (MOD));
                    d = (d + 1);
                }
                sigma = FLOW_CHECKED_MOD(((sigma + (base * sumd))), (MOD));
            }
            j = (j + 1);
        }
        i = (i + 1);
    }
    int64_t pow24m = modpow_i64_i64_i64(24, m, MOD);
    int64_t inv6E = modpow_i64_i64_i64(modpow_i64_i64_i64(6, E, MOD), (MOD - 2), MOD);
    int64_t ans = FLOW_CHECKED_MOD(((pow24m * fact[m])), (MOD));
    ans = FLOW_CHECKED_MOD(((ans * sigma)), (MOD));
    ans = FLOW_CHECKED_MOD(((ans * inv6E)), (MOD));
    printf("%lld\n", ans);
    free(fact);
    free(invfact);
    free(pow2);
    free(pow_neg3);
    free(inv24pow);
    free(inv2pow);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%lld\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  // Module static: MOD
  llvm.mlir.global internal @MOD(1000000007 : i64) : i64
  func.func @modpow(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %0 = arith.constant 1 : i32
    %1 = arith.extsi %0 : i32 to i64
    %2 = llvm.mlir.constant(1 : i64) : i64
    %3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
    llvm.store %1, %3 : i64, !llvm.ptr
    %4 = arith.remsi %arg0, %arg2 : i64
    %5 = llvm.mlir.constant(1 : i64) : i64
    %6 = llvm.alloca %5 x i64 : (i64) -> !llvm.ptr
    llvm.store %4, %6 : i64, !llvm.ptr
    %7 = llvm.mlir.constant(1 : i64) : i64
    %8 = llvm.alloca %7 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %8 : i64, !llvm.ptr
    %9 = llvm.load %6 : !llvm.ptr -> i64
    %10 = arith.constant 0 : i32
    %12 = arith.extsi %10 : i32 to i64
    %11 = arith.cmpi slt, %9, %12 : i64
    cf.cond_br %11, ^bb0, ^bb1
    ^bb0:
      %13 = llvm.load %6 : !llvm.ptr -> i64
      %14 = arith.addi %13, %arg2 : i64
      llvm.store %14, %6 : i64, !llvm.ptr
      cf.br ^bb2
    ^bb1:
      cf.br ^bb2
    ^bb2:
    cf.br ^bb3
    ^bb3:
    %15 = llvm.load %8 : !llvm.ptr -> i64
    %16 = arith.constant 0 : i32
    %18 = arith.extsi %16 : i32 to i64
    %17 = arith.cmpi sgt, %15, %18 : i64
    cf.cond_br %17, ^bb4, ^bb5
    ^bb4:
      %19 = llvm.load %8 : !llvm.ptr -> i64
      %20 = arith.constant 2 : i32
      %22 = arith.extsi %20 : i32 to i64
      %21 = arith.remsi %19, %22 : i64
      %23 = arith.constant 1 : i32
      %25 = arith.extsi %23 : i32 to i64
      %24 = arith.cmpi eq, %21, %25 : i64
      cf.cond_br %24, ^bb6, ^bb7
      ^bb6:
        %26 = llvm.load %3 : !llvm.ptr -> i64
        %27 = llvm.load %6 : !llvm.ptr -> i64
        %28 = arith.muli %26, %27 : i64
        %29 = arith.remsi %28, %arg2 : i64
        llvm.store %29, %3 : i64, !llvm.ptr
        cf.br ^bb8
      ^bb7:
        cf.br ^bb8
      ^bb8:
      %30 = llvm.load %6 : !llvm.ptr -> i64
      %31 = llvm.load %6 : !llvm.ptr -> i64
      %32 = arith.muli %30, %31 : i64
      %33 = arith.remsi %32, %arg2 : i64
      llvm.store %33, %6 : i64, !llvm.ptr
      %34 = llvm.load %8 : !llvm.ptr -> i64
      %35 = arith.constant 2 : i32
      %37 = arith.extsi %35 : i32 to i64
      %36 = arith.divsi %34, %37 : i64
      llvm.store %36, %8 : i64, !llvm.ptr
      cf.br ^bb3
    ^bb5:
    %38 = llvm.load %3 : !llvm.ptr -> i64
    func.return %38 : i64
  }
  func.func @main() -> i32 {
    %39 = arith.constant 50 : i32
    %40 = arith.extsi %39 : i32 to i64
    %41 = arith.constant 4 : i32
    %43 = arith.extsi %41 : i32 to i64
    %42 = arith.muli %43, %40 : i64
    %44 = arith.constant 3 : i32
    %46 = arith.extsi %44 : i32 to i64
    %45 = arith.muli %46, %40 : i64
    %47 = arith.constant 16 : i32
    %49 = arith.extsi %47 : i32 to i64
    %48 = arith.muli %49, %40 : i64
    %50 = arith.constant 10 : i32
    %52 = arith.extsi %50 : i32 to i64
    %51 = arith.addi %48, %52 : i64
    %54 = arith.constant 1 : i32
    %56 = arith.extsi %54 : i32 to i64
    %55 = arith.addi %51, %56 : i64
    %57 = arith.constant 8 : i32
    %58 = arith.extsi %57 : i32 to i64
    %53 = func.call @calloc(%55, %58) : (i64, i64) -> !llvm.ptr
    %60 = arith.constant 1 : i32
    %62 = arith.extsi %60 : i32 to i64
    %61 = arith.addi %51, %62 : i64
    %63 = arith.constant 8 : i32
    %64 = arith.extsi %63 : i32 to i64
    %59 = func.call @calloc(%61, %64) : (i64, i64) -> !llvm.ptr
    %66 = arith.constant 1 : i32
    %68 = arith.extsi %66 : i32 to i64
    %67 = arith.addi %42, %68 : i64
    %69 = arith.constant 8 : i32
    %70 = arith.extsi %69 : i32 to i64
    %65 = func.call @calloc(%67, %70) : (i64, i64) -> !llvm.ptr
    %72 = arith.constant 1 : i32
    %74 = arith.extsi %72 : i32 to i64
    %73 = arith.addi %42, %74 : i64
    %75 = arith.constant 8 : i32
    %76 = arith.extsi %75 : i32 to i64
    %71 = func.call @calloc(%73, %76) : (i64, i64) -> !llvm.ptr
    %78 = arith.constant 1 : i32
    %80 = arith.extsi %78 : i32 to i64
    %79 = arith.addi %45, %80 : i64
    %81 = arith.constant 8 : i32
    %82 = arith.extsi %81 : i32 to i64
    %77 = func.call @calloc(%79, %82) : (i64, i64) -> !llvm.ptr
    %84 = arith.constant 1 : i32
    %86 = arith.extsi %84 : i32 to i64
    %85 = arith.addi %42, %86 : i64
    %87 = arith.constant 8 : i32
    %88 = arith.extsi %87 : i32 to i64
    %83 = func.call @calloc(%85, %88) : (i64, i64) -> !llvm.ptr
    %89 = llvm.mlir.zero : !llvm.ptr
    %90 = llvm.icmp "eq" %53, %89 : !llvm.ptr
    %91 = scf.if %90 -> (i1) {
      %92 = arith.constant true
      scf.yield %92 : i1
    } else {
      %93 = llvm.mlir.zero : !llvm.ptr
      %94 = llvm.icmp "eq" %59, %93 : !llvm.ptr
      scf.yield %94 : i1
    }
    %95 = scf.if %91 -> (i1) {
      %96 = arith.constant true
      scf.yield %96 : i1
    } else {
      %97 = llvm.mlir.zero : !llvm.ptr
      %98 = llvm.icmp "eq" %65, %97 : !llvm.ptr
      scf.yield %98 : i1
    }
    %99 = scf.if %95 -> (i1) {
      %100 = arith.constant true
      scf.yield %100 : i1
    } else {
      %101 = llvm.mlir.zero : !llvm.ptr
      %102 = llvm.icmp "eq" %71, %101 : !llvm.ptr
      scf.yield %102 : i1
    }
    %103 = scf.if %99 -> (i1) {
      %104 = arith.constant true
      scf.yield %104 : i1
    } else {
      %105 = llvm.mlir.zero : !llvm.ptr
      %106 = llvm.icmp "eq" %77, %105 : !llvm.ptr
      scf.yield %106 : i1
    }
    %107 = scf.if %103 -> (i1) {
      %108 = arith.constant true
      scf.yield %108 : i1
    } else {
      %109 = llvm.mlir.zero : !llvm.ptr
      %110 = llvm.icmp "eq" %83, %109 : !llvm.ptr
      scf.yield %110 : i1
    }
    cf.cond_br %107, ^bb9, ^bb10
    ^bb9:
      %111 = arith.constant 1 : i32
      func.return %111 : i32
    ^bb10:
      cf.br ^bb11
    ^bb11:
    %112 = arith.constant 1 : i32
    %113 = arith.constant 0 : i32
    %114 = arith.extsi %112 : i32 to i64
    %115 = arith.extsi %113 : i32 to i64
    %116 = llvm.getelementptr %53[%115] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %114, %116 : i64, !llvm.ptr
    %117 = arith.constant 1 : i32
    %118 = arith.extsi %117 : i32 to i64
    %119 = llvm.mlir.constant(1 : i64) : i64
    %120 = llvm.alloca %119 x i64 : (i64) -> !llvm.ptr
    llvm.store %118, %120 : i64, !llvm.ptr
    cf.br ^bb12
    ^bb12:
    %121 = llvm.load %120 : !llvm.ptr -> i64
    %122 = arith.cmpi sle, %121, %51 : i64
    cf.cond_br %122, ^bb13, ^bb14
    ^bb13:
      %124 = llvm.load %120 : !llvm.ptr -> i64
      %125 = arith.constant 1 : i32
      %127 = arith.extsi %125 : i32 to i64
      %126 = arith.subi %124, %127 : i64
      %128 = llvm.getelementptr %53[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %123 = llvm.load %128 : !llvm.ptr -> i64
      %129 = llvm.load %120 : !llvm.ptr -> i64
      %130 = arith.muli %123, %129 : i64
      %131 = llvm.mlir.addressof @MOD : !llvm.ptr
      %132 = llvm.load %131 : !llvm.ptr -> i64
      %133 = arith.remsi %130, %132 : i64
      %134 = llvm.load %120 : !llvm.ptr -> i64
      %135 = llvm.getelementptr %53[%134] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %133, %135 : i64, !llvm.ptr
      %136 = llvm.load %120 : !llvm.ptr -> i64
      %137 = arith.constant 1 : i32
      %139 = arith.extsi %137 : i32 to i64
      %138 = arith.addi %136, %139 : i64
      llvm.store %138, %120 : i64, !llvm.ptr
      cf.br ^bb12
    ^bb14:
    %142 = llvm.getelementptr %53[%51] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %141 = llvm.load %142 : !llvm.ptr -> i64
    %143 = llvm.mlir.addressof @MOD : !llvm.ptr
    %144 = llvm.load %143 : !llvm.ptr -> i64
    %145 = arith.constant 2 : i32
    %147 = arith.extsi %145 : i32 to i64
    %146 = arith.subi %144, %147 : i64
    %148 = llvm.mlir.addressof @MOD : !llvm.ptr
    %149 = llvm.load %148 : !llvm.ptr -> i64
    %140 = func.call @modpow(%141, %146, %149) : (i64, i64, i64) -> i64
    %150 = llvm.getelementptr %59[%51] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %140, %150 : i64, !llvm.ptr
    llvm.store %51, %120 : i64, !llvm.ptr
    cf.br ^bb15
    ^bb15:
    %151 = llvm.load %120 : !llvm.ptr -> i64
    %152 = arith.constant 0 : i32
    %154 = arith.extsi %152 : i32 to i64
    %153 = arith.cmpi sgt, %151, %154 : i64
    cf.cond_br %153, ^bb16, ^bb17
    ^bb16:
      %156 = llvm.load %120 : !llvm.ptr -> i64
      %157 = llvm.getelementptr %59[%156] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %155 = llvm.load %157 : !llvm.ptr -> i64
      %158 = llvm.load %120 : !llvm.ptr -> i64
      %159 = arith.muli %155, %158 : i64
      %160 = llvm.mlir.addressof @MOD : !llvm.ptr
      %161 = llvm.load %160 : !llvm.ptr -> i64
      %162 = arith.remsi %159, %161 : i64
      %163 = llvm.load %120 : !llvm.ptr -> i64
      %164 = arith.constant 1 : i32
      %166 = arith.extsi %164 : i32 to i64
      %165 = arith.subi %163, %166 : i64
      %167 = llvm.getelementptr %59[%165] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %162, %167 : i64, !llvm.ptr
      %168 = llvm.load %120 : !llvm.ptr -> i64
      %169 = arith.constant 1 : i32
      %171 = arith.extsi %169 : i32 to i64
      %170 = arith.subi %168, %171 : i64
      llvm.store %170, %120 : i64, !llvm.ptr
      cf.br ^bb15
    ^bb17:
    %172 = arith.constant 1 : i32
    %173 = arith.constant 0 : i32
    %174 = arith.extsi %172 : i32 to i64
    %175 = arith.extsi %173 : i32 to i64
    %176 = llvm.getelementptr %65[%175] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %174, %176 : i64, !llvm.ptr
    %177 = arith.constant 1 : i32
    %178 = arith.extsi %177 : i32 to i64
    llvm.store %178, %120 : i64, !llvm.ptr
    cf.br ^bb18
    ^bb18:
    %179 = llvm.load %120 : !llvm.ptr -> i64
    %180 = arith.cmpi sle, %179, %42 : i64
    cf.cond_br %180, ^bb19, ^bb20
    ^bb19:
      %182 = llvm.load %120 : !llvm.ptr -> i64
      %183 = arith.constant 1 : i32
      %185 = arith.extsi %183 : i32 to i64
      %184 = arith.subi %182, %185 : i64
      %186 = llvm.getelementptr %65[%184] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %181 = llvm.load %186 : !llvm.ptr -> i64
      %187 = arith.constant 2 : i32
      %189 = arith.extsi %187 : i32 to i64
      %188 = arith.muli %181, %189 : i64
      %190 = llvm.mlir.addressof @MOD : !llvm.ptr
      %191 = llvm.load %190 : !llvm.ptr -> i64
      %192 = arith.remsi %188, %191 : i64
      %193 = llvm.load %120 : !llvm.ptr -> i64
      %194 = llvm.getelementptr %65[%193] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %192, %194 : i64, !llvm.ptr
      %195 = llvm.load %120 : !llvm.ptr -> i64
      %196 = arith.constant 1 : i32
      %198 = arith.extsi %196 : i32 to i64
      %197 = arith.addi %195, %198 : i64
      llvm.store %197, %120 : i64, !llvm.ptr
      cf.br ^bb18
    ^bb20:
    %199 = llvm.mlir.addressof @MOD : !llvm.ptr
    %200 = llvm.load %199 : !llvm.ptr -> i64
    %201 = arith.constant 3 : i32
    %203 = arith.extsi %201 : i32 to i64
    %202 = arith.subi %200, %203 : i64
    %204 = arith.constant 1 : i32
    %205 = arith.constant 0 : i32
    %206 = arith.extsi %204 : i32 to i64
    %207 = arith.extsi %205 : i32 to i64
    %208 = llvm.getelementptr %71[%207] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %206, %208 : i64, !llvm.ptr
    %209 = arith.constant 1 : i32
    %210 = arith.extsi %209 : i32 to i64
    llvm.store %210, %120 : i64, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %211 = llvm.load %120 : !llvm.ptr -> i64
    %212 = arith.cmpi sle, %211, %42 : i64
    cf.cond_br %212, ^bb22, ^bb23
    ^bb22:
      %214 = llvm.load %120 : !llvm.ptr -> i64
      %215 = arith.constant 1 : i32
      %217 = arith.extsi %215 : i32 to i64
      %216 = arith.subi %214, %217 : i64
      %218 = llvm.getelementptr %71[%216] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %213 = llvm.load %218 : !llvm.ptr -> i64
      %219 = arith.muli %213, %202 : i64
      %220 = llvm.mlir.addressof @MOD : !llvm.ptr
      %221 = llvm.load %220 : !llvm.ptr -> i64
      %222 = arith.remsi %219, %221 : i64
      %223 = llvm.load %120 : !llvm.ptr -> i64
      %224 = llvm.getelementptr %71[%223] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %222, %224 : i64, !llvm.ptr
      %225 = llvm.load %120 : !llvm.ptr -> i64
      %226 = arith.constant 1 : i32
      %228 = arith.extsi %226 : i32 to i64
      %227 = arith.addi %225, %228 : i64
      llvm.store %227, %120 : i64, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %229 = llvm.mlir.addressof @MOD : !llvm.ptr
    %230 = llvm.load %229 : !llvm.ptr -> i64
    %231 = arith.constant 1 : i32
    %233 = arith.extsi %231 : i32 to i64
    %232 = arith.addi %230, %233 : i64
    %234 = arith.constant 2 : i32
    %236 = arith.extsi %234 : i32 to i64
    %235 = arith.divsi %232, %236 : i64
    %238 = arith.constant 24 : i32
    %239 = llvm.mlir.addressof @MOD : !llvm.ptr
    %240 = llvm.load %239 : !llvm.ptr -> i64
    %241 = arith.constant 2 : i32
    %243 = arith.extsi %241 : i32 to i64
    %242 = arith.subi %240, %243 : i64
    %244 = llvm.mlir.addressof @MOD : !llvm.ptr
    %245 = llvm.load %244 : !llvm.ptr -> i64
    %246 = arith.extsi %238 : i32 to i64
    %237 = func.call @modpow(%246, %242, %245) : (i64, i64, i64) -> i64
    %247 = arith.constant 1 : i32
    %248 = arith.constant 0 : i32
    %249 = arith.extsi %247 : i32 to i64
    %250 = arith.extsi %248 : i32 to i64
    %251 = llvm.getelementptr %77[%250] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %249, %251 : i64, !llvm.ptr
    %252 = arith.constant 1 : i32
    %253 = arith.extsi %252 : i32 to i64
    llvm.store %253, %120 : i64, !llvm.ptr
    cf.br ^bb24
    ^bb24:
    %254 = llvm.load %120 : !llvm.ptr -> i64
    %255 = arith.cmpi sle, %254, %45 : i64
    cf.cond_br %255, ^bb25, ^bb26
    ^bb25:
      %257 = llvm.load %120 : !llvm.ptr -> i64
      %258 = arith.constant 1 : i32
      %260 = arith.extsi %258 : i32 to i64
      %259 = arith.subi %257, %260 : i64
      %261 = llvm.getelementptr %77[%259] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %256 = llvm.load %261 : !llvm.ptr -> i64
      %262 = arith.muli %256, %237 : i64
      %263 = llvm.mlir.addressof @MOD : !llvm.ptr
      %264 = llvm.load %263 : !llvm.ptr -> i64
      %265 = arith.remsi %262, %264 : i64
      %266 = llvm.load %120 : !llvm.ptr -> i64
      %267 = llvm.getelementptr %77[%266] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %265, %267 : i64, !llvm.ptr
      %268 = llvm.load %120 : !llvm.ptr -> i64
      %269 = arith.constant 1 : i32
      %271 = arith.extsi %269 : i32 to i64
      %270 = arith.addi %268, %271 : i64
      llvm.store %270, %120 : i64, !llvm.ptr
      cf.br ^bb24
    ^bb26:
    %272 = arith.constant 1 : i32
    %273 = arith.constant 0 : i32
    %274 = arith.extsi %272 : i32 to i64
    %275 = arith.extsi %273 : i32 to i64
    %276 = llvm.getelementptr %83[%275] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %274, %276 : i64, !llvm.ptr
    %277 = arith.constant 1 : i32
    %278 = arith.extsi %277 : i32 to i64
    llvm.store %278, %120 : i64, !llvm.ptr
    cf.br ^bb27
    ^bb27:
    %279 = llvm.load %120 : !llvm.ptr -> i64
    %280 = arith.cmpi sle, %279, %42 : i64
    cf.cond_br %280, ^bb28, ^bb29
    ^bb28:
      %282 = llvm.load %120 : !llvm.ptr -> i64
      %283 = arith.constant 1 : i32
      %285 = arith.extsi %283 : i32 to i64
      %284 = arith.subi %282, %285 : i64
      %286 = llvm.getelementptr %83[%284] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %281 = llvm.load %286 : !llvm.ptr -> i64
      %287 = arith.muli %281, %235 : i64
      %288 = llvm.mlir.addressof @MOD : !llvm.ptr
      %289 = llvm.load %288 : !llvm.ptr -> i64
      %290 = arith.remsi %287, %289 : i64
      %291 = llvm.load %120 : !llvm.ptr -> i64
      %292 = llvm.getelementptr %83[%291] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %290, %292 : i64, !llvm.ptr
      %293 = llvm.load %120 : !llvm.ptr -> i64
      %294 = arith.constant 1 : i32
      %296 = arith.extsi %294 : i32 to i64
      %295 = arith.addi %293, %296 : i64
      llvm.store %295, %120 : i64, !llvm.ptr
      cf.br ^bb27
    ^bb29:
    %297 = arith.constant 0 : i32
    %298 = arith.extsi %297 : i32 to i64
    %299 = llvm.mlir.constant(1 : i64) : i64
    %300 = llvm.alloca %299 x i64 : (i64) -> !llvm.ptr
    llvm.store %298, %300 : i64, !llvm.ptr
    %301 = arith.constant 0 : i32
    %302 = arith.extsi %301 : i32 to i64
    llvm.store %302, %120 : i64, !llvm.ptr
    cf.br ^bb30
    ^bb30:
    %303 = llvm.load %120 : !llvm.ptr -> i64
    %304 = arith.cmpi sle, %303, %42 : i64
    cf.cond_br %304, ^bb31, ^bb32
    ^bb31:
      %305 = llvm.load %120 : !llvm.ptr -> i64
      %306 = arith.subi %42, %305 : i64
      %307 = arith.constant 0 : i32
      %308 = arith.extsi %307 : i32 to i64
      %309 = llvm.mlir.constant(1 : i64) : i64
      %310 = llvm.alloca %309 x i64 : (i64) -> !llvm.ptr
      llvm.store %308, %310 : i64, !llvm.ptr
      cf.br ^bb33
      ^bb33:
      %311 = llvm.load %310 : !llvm.ptr -> i64
      %312 = arith.cmpi sle, %311, %306 : i64
      cf.cond_br %312, ^bb34, ^bb35
      ^bb34:
        %313 = llvm.load %120 : !llvm.ptr -> i64
        %314 = arith.subi %42, %313 : i64
        %315 = llvm.load %310 : !llvm.ptr -> i64
        %316 = arith.subi %314, %315 : i64
        %317 = arith.constant 3 : i32
        %318 = llvm.load %120 : !llvm.ptr -> i64
        %320 = arith.extsi %317 : i32 to i64
        %319 = arith.muli %320, %318 : i64
        %321 = llvm.load %310 : !llvm.ptr -> i64
        %322 = arith.addi %319, %321 : i64
        %324 = llvm.getelementptr %53[%322] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %323 = llvm.load %324 : !llvm.ptr -> i64
        %326 = llvm.load %120 : !llvm.ptr -> i64
        %327 = llvm.getelementptr %59[%326] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %325 = llvm.load %327 : !llvm.ptr -> i64
        %328 = arith.muli %323, %325 : i64
        %329 = llvm.mlir.addressof @MOD : !llvm.ptr
        %330 = llvm.load %329 : !llvm.ptr -> i64
        %331 = arith.remsi %328, %330 : i64
        %332 = llvm.mlir.constant(1 : i64) : i64
        %333 = llvm.alloca %332 x i64 : (i64) -> !llvm.ptr
        llvm.store %331, %333 : i64, !llvm.ptr
        %334 = llvm.load %333 : !llvm.ptr -> i64
        %336 = llvm.load %310 : !llvm.ptr -> i64
        %337 = llvm.getelementptr %71[%336] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %335 = llvm.load %337 : !llvm.ptr -> i64
        %338 = arith.muli %334, %335 : i64
        %339 = llvm.mlir.addressof @MOD : !llvm.ptr
        %340 = llvm.load %339 : !llvm.ptr -> i64
        %341 = arith.remsi %338, %340 : i64
        llvm.store %341, %333 : i64, !llvm.ptr
        %342 = llvm.load %333 : !llvm.ptr -> i64
        %344 = llvm.getelementptr %65[%316] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %343 = llvm.load %344 : !llvm.ptr -> i64
        %345 = arith.muli %342, %343 : i64
        %346 = llvm.mlir.addressof @MOD : !llvm.ptr
        %347 = llvm.load %346 : !llvm.ptr -> i64
        %348 = arith.remsi %345, %347 : i64
        llvm.store %348, %333 : i64, !llvm.ptr
        %349 = arith.constant 0 : i32
        %350 = arith.extsi %349 : i32 to i64
        %351 = llvm.mlir.constant(1 : i64) : i64
        %352 = llvm.alloca %351 x i64 : (i64) -> !llvm.ptr
        llvm.store %350, %352 : i64, !llvm.ptr
        %353 = llvm.load %120 : !llvm.ptr -> i64
        %354 = arith.cmpi slt, %353, %40 : i64
        cf.cond_br %354, ^bb36, ^bb37
        ^bb36:
          %355 = llvm.load %120 : !llvm.ptr -> i64
          %356 = arith.subi %40, %355 : i64
          llvm.store %356, %352 : i64, !llvm.ptr
          cf.br ^bb38
        ^bb37:
          cf.br ^bb38
        ^bb38:
        %357 = llvm.load %310 : !llvm.ptr -> i64
        %358 = arith.constant 2 : i32
        %360 = arith.extsi %358 : i32 to i64
        %359 = arith.divsi %357, %360 : i64
        %361 = llvm.load %352 : !llvm.ptr -> i64
        %362 = arith.cmpi sle, %361, %359 : i64
        cf.cond_br %362, ^bb39, ^bb40
        ^bb39:
          %364 = llvm.getelementptr %59[%316] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %363 = llvm.load %364 : !llvm.ptr -> i64
          %365 = arith.constant 0 : i32
          %366 = arith.extsi %365 : i32 to i64
          %367 = llvm.mlir.constant(1 : i64) : i64
          %368 = llvm.alloca %367 x i64 : (i64) -> !llvm.ptr
          llvm.store %366, %368 : i64, !llvm.ptr
          %369 = llvm.load %352 : !llvm.ptr -> i64
          %370 = llvm.mlir.constant(1 : i64) : i64
          %371 = llvm.alloca %370 x i64 : (i64) -> !llvm.ptr
          llvm.store %369, %371 : i64, !llvm.ptr
          cf.br ^bb42
          ^bb42:
          %372 = llvm.load %371 : !llvm.ptr -> i64
          %373 = arith.cmpi sle, %372, %359 : i64
          cf.cond_br %373, ^bb43, ^bb44
          ^bb43:
            %374 = llvm.load %120 : !llvm.ptr -> i64
            %375 = arith.subi %374, %40 : i64
            %376 = llvm.load %371 : !llvm.ptr -> i64
            %377 = arith.addi %375, %376 : i64
            %378 = llvm.load %310 : !llvm.ptr -> i64
            %379 = arith.constant 2 : i32
            %380 = llvm.load %371 : !llvm.ptr -> i64
            %382 = arith.extsi %379 : i32 to i64
            %381 = arith.muli %382, %380 : i64
            %383 = arith.subi %378, %381 : i64
            %385 = llvm.getelementptr %59[%377] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %384 = llvm.load %385 : !llvm.ptr -> i64
            %386 = llvm.mlir.constant(1 : i64) : i64
            %387 = llvm.alloca %386 x i64 : (i64) -> !llvm.ptr
            llvm.store %384, %387 : i64, !llvm.ptr
            %388 = llvm.load %387 : !llvm.ptr -> i64
            %390 = llvm.getelementptr %59[%383] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %389 = llvm.load %390 : !llvm.ptr -> i64
            %391 = arith.muli %388, %389 : i64
            %392 = llvm.mlir.addressof @MOD : !llvm.ptr
            %393 = llvm.load %392 : !llvm.ptr -> i64
            %394 = arith.remsi %391, %393 : i64
            llvm.store %394, %387 : i64, !llvm.ptr
            %395 = llvm.load %387 : !llvm.ptr -> i64
            %396 = arith.muli %395, %363 : i64
            %397 = llvm.mlir.addressof @MOD : !llvm.ptr
            %398 = llvm.load %397 : !llvm.ptr -> i64
            %399 = arith.remsi %396, %398 : i64
            llvm.store %399, %387 : i64, !llvm.ptr
            %400 = llvm.load %387 : !llvm.ptr -> i64
            %402 = llvm.load %371 : !llvm.ptr -> i64
            %403 = llvm.getelementptr %59[%402] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %401 = llvm.load %403 : !llvm.ptr -> i64
            %404 = arith.muli %400, %401 : i64
            %405 = llvm.mlir.addressof @MOD : !llvm.ptr
            %406 = llvm.load %405 : !llvm.ptr -> i64
            %407 = arith.remsi %404, %406 : i64
            llvm.store %407, %387 : i64, !llvm.ptr
            %408 = llvm.load %387 : !llvm.ptr -> i64
            %410 = llvm.getelementptr %77[%377] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %409 = llvm.load %410 : !llvm.ptr -> i64
            %411 = arith.muli %408, %409 : i64
            %412 = llvm.mlir.addressof @MOD : !llvm.ptr
            %413 = llvm.load %412 : !llvm.ptr -> i64
            %414 = arith.remsi %411, %413 : i64
            llvm.store %414, %387 : i64, !llvm.ptr
            %415 = llvm.load %387 : !llvm.ptr -> i64
            %417 = llvm.load %371 : !llvm.ptr -> i64
            %418 = arith.addi %383, %417 : i64
            %419 = llvm.getelementptr %83[%418] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %416 = llvm.load %419 : !llvm.ptr -> i64
            %420 = arith.muli %415, %416 : i64
            %421 = llvm.mlir.addressof @MOD : !llvm.ptr
            %422 = llvm.load %421 : !llvm.ptr -> i64
            %423 = arith.remsi %420, %422 : i64
            llvm.store %423, %387 : i64, !llvm.ptr
            %424 = llvm.load %368 : !llvm.ptr -> i64
            %425 = llvm.load %387 : !llvm.ptr -> i64
            %426 = arith.addi %424, %425 : i64
            %427 = llvm.mlir.addressof @MOD : !llvm.ptr
            %428 = llvm.load %427 : !llvm.ptr -> i64
            %429 = arith.remsi %426, %428 : i64
            llvm.store %429, %368 : i64, !llvm.ptr
            %430 = llvm.load %371 : !llvm.ptr -> i64
            %431 = arith.constant 1 : i32
            %433 = arith.extsi %431 : i32 to i64
            %432 = arith.addi %430, %433 : i64
            llvm.store %432, %371 : i64, !llvm.ptr
            cf.br ^bb42
          ^bb44:
          %434 = llvm.load %300 : !llvm.ptr -> i64
          %435 = llvm.load %333 : !llvm.ptr -> i64
          %436 = llvm.load %368 : !llvm.ptr -> i64
          %437 = arith.muli %435, %436 : i64
          %438 = arith.addi %434, %437 : i64
          %439 = llvm.mlir.addressof @MOD : !llvm.ptr
          %440 = llvm.load %439 : !llvm.ptr -> i64
          %441 = arith.remsi %438, %440 : i64
          llvm.store %441, %300 : i64, !llvm.ptr
          cf.br ^bb41
        ^bb40:
          cf.br ^bb41
        ^bb41:
        %442 = llvm.load %310 : !llvm.ptr -> i64
        %443 = arith.constant 1 : i32
        %445 = arith.extsi %443 : i32 to i64
        %444 = arith.addi %442, %445 : i64
        llvm.store %444, %310 : i64, !llvm.ptr
        cf.br ^bb33
      ^bb35:
      %446 = llvm.load %120 : !llvm.ptr -> i64
      %447 = arith.constant 1 : i32
      %449 = arith.extsi %447 : i32 to i64
      %448 = arith.addi %446, %449 : i64
      llvm.store %448, %120 : i64, !llvm.ptr
      cf.br ^bb30
    ^bb32:
    %451 = arith.constant 24 : i32
    %452 = llvm.mlir.addressof @MOD : !llvm.ptr
    %453 = llvm.load %452 : !llvm.ptr -> i64
    %454 = arith.extsi %451 : i32 to i64
    %450 = func.call @modpow(%454, %45, %453) : (i64, i64, i64) -> i64
    %457 = arith.constant 6 : i32
    %458 = llvm.mlir.addressof @MOD : !llvm.ptr
    %459 = llvm.load %458 : !llvm.ptr -> i64
    %460 = arith.extsi %457 : i32 to i64
    %456 = func.call @modpow(%460, %42, %459) : (i64, i64, i64) -> i64
    %461 = llvm.mlir.addressof @MOD : !llvm.ptr
    %462 = llvm.load %461 : !llvm.ptr -> i64
    %463 = arith.constant 2 : i32
    %465 = arith.extsi %463 : i32 to i64
    %464 = arith.subi %462, %465 : i64
    %466 = llvm.mlir.addressof @MOD : !llvm.ptr
    %467 = llvm.load %466 : !llvm.ptr -> i64
    %455 = func.call @modpow(%456, %464, %467) : (i64, i64, i64) -> i64
    %469 = llvm.getelementptr %53[%45] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %468 = llvm.load %469 : !llvm.ptr -> i64
    %470 = arith.muli %450, %468 : i64
    %471 = llvm.mlir.addressof @MOD : !llvm.ptr
    %472 = llvm.load %471 : !llvm.ptr -> i64
    %473 = arith.remsi %470, %472 : i64
    %474 = llvm.mlir.constant(1 : i64) : i64
    %475 = llvm.alloca %474 x i64 : (i64) -> !llvm.ptr
    llvm.store %473, %475 : i64, !llvm.ptr
    %476 = llvm.load %475 : !llvm.ptr -> i64
    %477 = llvm.load %300 : !llvm.ptr -> i64
    %478 = arith.muli %476, %477 : i64
    %479 = llvm.mlir.addressof @MOD : !llvm.ptr
    %480 = llvm.load %479 : !llvm.ptr -> i64
    %481 = arith.remsi %478, %480 : i64
    llvm.store %481, %475 : i64, !llvm.ptr
    %482 = llvm.load %475 : !llvm.ptr -> i64
    %483 = arith.muli %482, %455 : i64
    %484 = llvm.mlir.addressof @MOD : !llvm.ptr
    %485 = llvm.load %484 : !llvm.ptr -> i64
    %486 = arith.remsi %483, %485 : i64
    llvm.store %486, %475 : i64, !llvm.ptr
    %487 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %488 = llvm.load %475 : !llvm.ptr -> i64
    %489 = llvm.call @printf(%487, %488) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%53) : (!llvm.ptr) -> ()
    func.call @free(%59) : (!llvm.ptr) -> ()
    func.call @free(%65) : (!llvm.ptr) -> ()
    func.call @free(%71) : (!llvm.ptr) -> ()
    func.call @free(%77) : (!llvm.ptr) -> ()
    func.call @free(%83) : (!llvm.ptr) -> ()
    %496 = arith.constant 0 : i32
    func.return %496 : i32
  }
}