Problem 416

f(10, 10^12) mod 10^9: frog jumps of length 1..20 with miss tracking.

Answer898082747
Output898082747
StatusPASS
Native helperno
Runtime1080 ms
Peak memory4704 KB
Time complexityO(n^4) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^4)O(n log n)
Space complexityO(n^2)O(n)
ApproachFlow solutionModular DP or matrix exponentiation
VerdictSuboptimal

Flow source

# Project Euler 416
# f(10, 10^12) mod 10^9: frog jumps of length 1..20 with miss tracking.

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

function main() -> i32 {
    let MOD: i64 = 1000000000
    let M: i64 = 10
    let N: i64 = 1000000000000
    let K: i64 = 2 * M
    # states (a,c) a+c<=K
    let SIZE: i64 = (K + 1) * (K + 2) / 2
    let idx: ptr<i32> = calloc((K + 1) * (K + 1), 4)
    let sa: ptr<i32> = calloc(SIZE, 4)
    let sc: ptr<i32> = calloc(SIZE, 4)
    if idx == null || sa == null || sc == null { return 1 }
    let mut nstates: i64 = 0
    let mut a: i64 = 0
    while a <= K {
        let mut c: i64 = 0
        while c <= K - a {
            idx[a * (K + 1) + c] = nstates as i32
            sa[nstates] = a as i32
            sc[nstates] = c as i32
            nstates = nstates + 1
            c = c + 1
        }
        a = a + 1
    }

    let comb: ptr<i64> = calloc((K + 1) * (K + 1), 8)
    let mut n: i64 = 0
    while n <= K {
        comb[n * (K + 1) + 0] = 1
        comb[n * (K + 1) + n] = 1
        let mut r: i64 = 1
        while r < n {
            comb[n * (K + 1) + r] = comb[(n - 1) * (K + 1) + (r - 1)] + comb[(n - 1) * (K + 1) + r]
            r = r + 1
        }
        n = n + 1
    }

    let A: ptr<i64> = calloc(SIZE * SIZE, 8)
    let B: ptr<i64> = calloc(SIZE * SIZE, 8)
    if A == null || B == null { return 1 }

    let mut s: i64 = 0
    while s < SIZE {
        let aa: i64 = sa[s] as i64
        let cc: i64 = sc[s] as i64
        let bb: i64 = K - aa - cc
        let mut a0: i64 = 0
        while a0 <= aa {
            let mut a1: i64 = 0
            while a1 <= aa - a0 {
                let a2: i64 = aa - a0 - a1
                let coeff: i64 = comb[aa * (K + 1) + a0] * comb[(aa - a0) * (K + 1) + a1] % MOD
                let a_new: i64 = a0 + bb
                let c_new: i64 = a2
                let j: i64 = idx[a_new * (K + 1) + c_new] as i64
                if a_new == 0 {
                    B[s * SIZE + j] = (B[s * SIZE + j] + coeff) % MOD
                } else {
                    A[s * SIZE + j] = (A[s * SIZE + j] + coeff) % MOD
                }
                a1 = a1 + 1
            }
            a0 = a0 + 1
        }
        s = s + 1
    }

    let target: i64 = idx[K * (K + 1) + 0] as i64
    # Matrix expo of pair (A,B): (ra,rb) = (ra,rb)*(ba,bb)
    let RA: ptr<i64> = calloc(SIZE * SIZE, 8)
    let RB: ptr<i64> = calloc(SIZE * SIZE, 8)
    let BA: ptr<i64> = calloc(SIZE * SIZE, 8)
    let BB: ptr<i64> = calloc(SIZE * SIZE, 8)
    let T1: ptr<i64> = calloc(SIZE * SIZE, 8)
    let T2: ptr<i64> = calloc(SIZE * SIZE, 8)
    let mut i: i64 = 0
    while i < SIZE {
        RA[i * SIZE + i] = 1
        i = i + 1
    }
    i = 0
    while i < SIZE * SIZE {
        BA[i] = A[i]
        BB[i] = B[i]
        i = i + 1
    }

    # matmul helpers inline
    let mut exp: i64 = N - 1
    while exp > 0 {
        if (exp & 1) == 1 {
            # (RA,RB) = (RA,RB)*(BA,BB)
            # ra' = RA*BA; rb' = RB*BA + RA*BB
            let mut ii: i64 = 0
            while ii < SIZE {
                let mut jj: i64 = 0
                while jj < SIZE {
                    let mut sa1: i128 = 0
                    let mut sb1: i128 = 0
                    let mut kk: i64 = 0
                    while kk < SIZE {
                        sa1 = sa1 + (RA[ii * SIZE + kk] as i128) * (BA[kk * SIZE + jj] as i128)
                        sb1 = sb1 + (RB[ii * SIZE + kk] as i128) * (BA[kk * SIZE + jj] as i128) + (RA[ii * SIZE + kk] as i128) * (BB[kk * SIZE + jj] as i128)
                        kk = kk + 1
                    }
                    T1[ii * SIZE + jj] = (sa1 % (MOD as i128)) as i64
                    T2[ii * SIZE + jj] = (sb1 % (MOD as i128)) as i64
                    jj = jj + 1
                }
                ii = ii + 1
            }
            ii = 0
            while ii < SIZE * SIZE {
                RA[ii] = T1[ii]
                RB[ii] = T2[ii]
                ii = ii + 1
            }
        }
        # square (BA,BB)
        let mut ii2: i64 = 0
        while ii2 < SIZE {
            let mut jj2: i64 = 0
            while jj2 < SIZE {
                let mut sa2: i128 = 0
                let mut sb2: i128 = 0
                let mut kk2: i64 = 0
                while kk2 < SIZE {
                    sa2 = sa2 + (BA[ii2 * SIZE + kk2] as i128) * (BA[kk2 * SIZE + jj2] as i128)
                    sb2 = sb2 + (BB[ii2 * SIZE + kk2] as i128) * (BA[kk2 * SIZE + jj2] as i128) + (BA[ii2 * SIZE + kk2] as i128) * (BB[kk2 * SIZE + jj2] as i128)
                    kk2 = kk2 + 1
                }
                T1[ii2 * SIZE + jj2] = (sa2 % (MOD as i128)) as i64
                T2[ii2 * SIZE + jj2] = (sb2 % (MOD as i128)) as i64
                jj2 = jj2 + 1
            }
            ii2 = ii2 + 1
        }
        ii2 = 0
        while ii2 < SIZE * SIZE {
            BA[ii2] = T1[ii2]
            BB[ii2] = T2[ii2]
            ii2 = ii2 + 1
        }
        exp = exp >> 1
    }

    # start vector e_target * (RA,RB)
    let mut ans: i64 = (RA[target * SIZE + target] + RB[target * SIZE + target]) % MOD
    printf("%09lld\n", ans)
    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; }

int32_t main(void);



int32_t main(void) {
    int64_t MOD = 1000000000;
    int64_t M = 10;
    int64_t N = 1000000000000;
    int64_t K = (2 * M);
    int64_t SIZE = FLOW_CHECKED_DIV((((K + 1) * (K + 2))), (2));
    int32_t* idx = (int32_t*)(calloc(((K + 1) * (K + 1)), 4));
    int32_t* sa = (int32_t*)(calloc(SIZE, 4));
    int32_t* sc = (int32_t*)(calloc(SIZE, 4));
    if (((idx == NULL || sa == NULL) || sc == NULL)) {
        return 1;
    }
    int64_t nstates = 0;
    int64_t a = 0;
    while (a <= K) {
        int64_t c = 0;
        while (c <= (K - a)) {
            idx[((a * (K + 1)) + c)] = ((int32_t)(nstates));
            sa[nstates] = ((int32_t)(a));
            sc[nstates] = ((int32_t)(c));
            nstates = (nstates + 1);
            c = (c + 1);
        }
        a = (a + 1);
    }
    int64_t* comb = (int64_t*)(calloc(((K + 1) * (K + 1)), 8));
    int64_t n = 0;
    while (n <= K) {
        comb[((n * (K + 1)) + 0)] = 1;
        comb[((n * (K + 1)) + n)] = 1;
        int64_t r = 1;
        while (r < n) {
            comb[((n * (K + 1)) + r)] = (comb[(((n - 1) * (K + 1)) + (r - 1))] + comb[(((n - 1) * (K + 1)) + r)]);
            r = (r + 1);
        }
        n = (n + 1);
    }
    int64_t* A = (int64_t*)(calloc((SIZE * SIZE), 8));
    int64_t* B = (int64_t*)(calloc((SIZE * SIZE), 8));
    if ((A == NULL || B == NULL)) {
        return 1;
    }
    int64_t s = 0;
    while (s < SIZE) {
        int64_t aa = ((int64_t)(sa[s]));
        int64_t cc = ((int64_t)(sc[s]));
        int64_t bb = ((K - aa) - cc);
        int64_t a0 = 0;
        while (a0 <= aa) {
            int64_t a1 = 0;
            while (a1 <= (aa - a0)) {
                int64_t a2 = ((aa - a0) - a1);
                int64_t coeff = FLOW_CHECKED_MOD(((comb[((aa * (K + 1)) + a0)] * comb[(((aa - a0) * (K + 1)) + a1)])), (MOD));
                int64_t a_new = (a0 + bb);
                int64_t c_new = a2;
                int64_t j = ((int64_t)(idx[((a_new * (K + 1)) + c_new)]));
                if (a_new == 0) {
                    B[((s * SIZE) + j)] = FLOW_CHECKED_MOD(((B[((s * SIZE) + j)] + coeff)), (MOD));
                } else {
                    A[((s * SIZE) + j)] = FLOW_CHECKED_MOD(((A[((s * SIZE) + j)] + coeff)), (MOD));
                }
                a1 = (a1 + 1);
            }
            a0 = (a0 + 1);
        }
        s = (s + 1);
    }
    int64_t target = ((int64_t)(idx[((K * (K + 1)) + 0)]));
    int64_t* RA = (int64_t*)(calloc((SIZE * SIZE), 8));
    int64_t* RB = (int64_t*)(calloc((SIZE * SIZE), 8));
    int64_t* BA = (int64_t*)(calloc((SIZE * SIZE), 8));
    int64_t* BB = (int64_t*)(calloc((SIZE * SIZE), 8));
    int64_t* T1 = (int64_t*)(calloc((SIZE * SIZE), 8));
    int64_t* T2 = (int64_t*)(calloc((SIZE * SIZE), 8));
    int64_t i = 0;
    while (i < SIZE) {
        RA[((i * SIZE) + i)] = 1;
        i = (i + 1);
    }
    i = 0;
    while (i < (SIZE * SIZE)) {
        BA[i] = A[i];
        BB[i] = B[i];
        i = (i + 1);
    }
    int64_t exp = (N - 1);
    while (exp > 0) {
        if ((exp & 1) == 1) {
            int64_t ii = 0;
            while (ii < SIZE) {
                int64_t jj = 0;
                while (jj < SIZE) {
                    __int128 sa1 = 0;
                    __int128 sb1 = 0;
                    int64_t kk = 0;
                    while (kk < SIZE) {
                        sa1 = (sa1 + (((__int128)(RA[((ii * SIZE) + kk)])) * ((__int128)(BA[((kk * SIZE) + jj)]))));
                        sb1 = ((sb1 + (((__int128)(RB[((ii * SIZE) + kk)])) * ((__int128)(BA[((kk * SIZE) + jj)])))) + (((__int128)(RA[((ii * SIZE) + kk)])) * ((__int128)(BB[((kk * SIZE) + jj)]))));
                        kk = (kk + 1);
                    }
                    T1[((ii * SIZE) + jj)] = ((int64_t)(FLOW_CHECKED_MOD((sa1), (((__int128)(MOD))))));
                    T2[((ii * SIZE) + jj)] = ((int64_t)(FLOW_CHECKED_MOD((sb1), (((__int128)(MOD))))));
                    jj = (jj + 1);
                }
                ii = (ii + 1);
            }
            ii = 0;
            while (ii < (SIZE * SIZE)) {
                RA[ii] = T1[ii];
                RB[ii] = T2[ii];
                ii = (ii + 1);
            }
        }
        int64_t ii2 = 0;
        while (ii2 < SIZE) {
            int64_t jj2 = 0;
            while (jj2 < SIZE) {
                __int128 sa2 = 0;
                __int128 sb2 = 0;
                int64_t kk2 = 0;
                while (kk2 < SIZE) {
                    sa2 = (sa2 + (((__int128)(BA[((ii2 * SIZE) + kk2)])) * ((__int128)(BA[((kk2 * SIZE) + jj2)]))));
                    sb2 = ((sb2 + (((__int128)(BB[((ii2 * SIZE) + kk2)])) * ((__int128)(BA[((kk2 * SIZE) + jj2)])))) + (((__int128)(BA[((ii2 * SIZE) + kk2)])) * ((__int128)(BB[((kk2 * SIZE) + jj2)]))));
                    kk2 = (kk2 + 1);
                }
                T1[((ii2 * SIZE) + jj2)] = ((int64_t)(FLOW_CHECKED_MOD((sa2), (((__int128)(MOD))))));
                T2[((ii2 * SIZE) + jj2)] = ((int64_t)(FLOW_CHECKED_MOD((sb2), (((__int128)(MOD))))));
                jj2 = (jj2 + 1);
            }
            ii2 = (ii2 + 1);
        }
        ii2 = 0;
        while (ii2 < (SIZE * SIZE)) {
            BA[ii2] = T1[ii2];
            BB[ii2] = T2[ii2];
            ii2 = (ii2 + 1);
        }
        exp = FLOW_CHECKED_SHR((exp), (1));
    }
    int64_t ans = FLOW_CHECKED_MOD(((RA[((target * SIZE) + target)] + RB[((target * SIZE) + target)])), (MOD));
    printf("%09lld\n", ans);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%09lld\n\00") {addr_space = 0 : i32} : !llvm.array<8 x i8>
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  func.func @main() -> i32 {
    %0 = arith.constant 1000000000 : i32
    %1 = arith.extsi %0 : i32 to i64
    %2 = arith.constant 10 : i32
    %3 = arith.extsi %2 : i32 to i64
    %4 = arith.constant 995705032704 : i32
    %5 = arith.extsi %4 : i32 to i64
    %6 = arith.constant 2 : i32
    %8 = arith.extsi %6 : i32 to i64
    %7 = arith.muli %8, %3 : i64
    %9 = arith.constant 1 : i32
    %11 = arith.extsi %9 : i32 to i64
    %10 = arith.addi %7, %11 : i64
    %12 = arith.constant 2 : i32
    %14 = arith.extsi %12 : i32 to i64
    %13 = arith.addi %7, %14 : i64
    %15 = arith.muli %10, %13 : i64
    %16 = arith.constant 2 : i32
    %18 = arith.extsi %16 : i32 to i64
    %17 = arith.divsi %15, %18 : i64
    %20 = arith.constant 1 : i32
    %22 = arith.extsi %20 : i32 to i64
    %21 = arith.addi %7, %22 : i64
    %23 = arith.constant 1 : i32
    %25 = arith.extsi %23 : i32 to i64
    %24 = arith.addi %7, %25 : i64
    %26 = arith.muli %21, %24 : i64
    %27 = arith.constant 4 : i32
    %28 = arith.extsi %27 : i32 to i64
    %19 = func.call @calloc(%26, %28) : (i64, i64) -> !llvm.ptr
    %30 = arith.constant 4 : i32
    %31 = arith.extsi %30 : i32 to i64
    %29 = func.call @calloc(%17, %31) : (i64, i64) -> !llvm.ptr
    %33 = arith.constant 4 : i32
    %34 = arith.extsi %33 : i32 to i64
    %32 = func.call @calloc(%17, %34) : (i64, i64) -> !llvm.ptr
    %35 = llvm.mlir.zero : !llvm.ptr
    %36 = llvm.icmp "eq" %19, %35 : !llvm.ptr
    %37 = scf.if %36 -> (i1) {
      %38 = arith.constant true
      scf.yield %38 : i1
    } else {
      %39 = llvm.mlir.zero : !llvm.ptr
      %40 = llvm.icmp "eq" %29, %39 : !llvm.ptr
      scf.yield %40 : i1
    }
    %41 = scf.if %37 -> (i1) {
      %42 = arith.constant true
      scf.yield %42 : i1
    } else {
      %43 = llvm.mlir.zero : !llvm.ptr
      %44 = llvm.icmp "eq" %32, %43 : !llvm.ptr
      scf.yield %44 : i1
    }
    cf.cond_br %41, ^bb0, ^bb1
    ^bb0:
      %45 = arith.constant 1 : i32
      func.return %45 : i32
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %46 = arith.constant 0 : i32
    %47 = arith.extsi %46 : i32 to i64
    %48 = llvm.mlir.constant(1 : i64) : i64
    %49 = llvm.alloca %48 x i64 : (i64) -> !llvm.ptr
    llvm.store %47, %49 : i64, !llvm.ptr
    %50 = arith.constant 0 : i32
    %51 = arith.extsi %50 : i32 to i64
    %52 = llvm.mlir.constant(1 : i64) : i64
    %53 = llvm.alloca %52 x i64 : (i64) -> !llvm.ptr
    llvm.store %51, %53 : i64, !llvm.ptr
    cf.br ^bb3
    ^bb3:
    %54 = llvm.load %53 : !llvm.ptr -> i64
    %55 = arith.cmpi sle, %54, %7 : i64
    cf.cond_br %55, ^bb4, ^bb5
    ^bb4:
      %56 = arith.constant 0 : i32
      %57 = arith.extsi %56 : i32 to i64
      %58 = llvm.mlir.constant(1 : i64) : i64
      %59 = llvm.alloca %58 x i64 : (i64) -> !llvm.ptr
      llvm.store %57, %59 : i64, !llvm.ptr
      cf.br ^bb6
      ^bb6:
      %60 = llvm.load %59 : !llvm.ptr -> i64
      %61 = llvm.load %53 : !llvm.ptr -> i64
      %62 = arith.subi %7, %61 : i64
      %63 = arith.cmpi sle, %60, %62 : i64
      cf.cond_br %63, ^bb7, ^bb8
      ^bb7:
        %64 = llvm.load %49 : !llvm.ptr -> i64
        %65 = arith.trunci %64 : i64 to i32
        %66 = llvm.load %53 : !llvm.ptr -> i64
        %67 = arith.constant 1 : i32
        %69 = arith.extsi %67 : i32 to i64
        %68 = arith.addi %7, %69 : i64
        %70 = arith.muli %66, %68 : i64
        %71 = llvm.load %59 : !llvm.ptr -> i64
        %72 = arith.addi %70, %71 : i64
        %73 = llvm.getelementptr %19[%72] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %65, %73 : i32, !llvm.ptr
        %74 = llvm.load %53 : !llvm.ptr -> i64
        %75 = arith.trunci %74 : i64 to i32
        %76 = llvm.load %49 : !llvm.ptr -> i64
        %77 = llvm.getelementptr %29[%76] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %75, %77 : i32, !llvm.ptr
        %78 = llvm.load %59 : !llvm.ptr -> i64
        %79 = arith.trunci %78 : i64 to i32
        %80 = llvm.load %49 : !llvm.ptr -> i64
        %81 = llvm.getelementptr %32[%80] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %79, %81 : i32, !llvm.ptr
        %82 = llvm.load %49 : !llvm.ptr -> i64
        %83 = arith.constant 1 : i32
        %85 = arith.extsi %83 : i32 to i64
        %84 = arith.addi %82, %85 : i64
        llvm.store %84, %49 : i64, !llvm.ptr
        %86 = llvm.load %59 : !llvm.ptr -> i64
        %87 = arith.constant 1 : i32
        %89 = arith.extsi %87 : i32 to i64
        %88 = arith.addi %86, %89 : i64
        llvm.store %88, %59 : i64, !llvm.ptr
        cf.br ^bb6
      ^bb8:
      %90 = llvm.load %53 : !llvm.ptr -> i64
      %91 = arith.constant 1 : i32
      %93 = arith.extsi %91 : i32 to i64
      %92 = arith.addi %90, %93 : i64
      llvm.store %92, %53 : i64, !llvm.ptr
      cf.br ^bb3
    ^bb5:
    %95 = arith.constant 1 : i32
    %97 = arith.extsi %95 : i32 to i64
    %96 = arith.addi %7, %97 : i64
    %98 = arith.constant 1 : i32
    %100 = arith.extsi %98 : i32 to i64
    %99 = arith.addi %7, %100 : i64
    %101 = arith.muli %96, %99 : i64
    %102 = arith.constant 8 : i32
    %103 = arith.extsi %102 : i32 to i64
    %94 = func.call @calloc(%101, %103) : (i64, i64) -> !llvm.ptr
    %104 = arith.constant 0 : i32
    %105 = arith.extsi %104 : i32 to i64
    %106 = llvm.mlir.constant(1 : i64) : i64
    %107 = llvm.alloca %106 x i64 : (i64) -> !llvm.ptr
    llvm.store %105, %107 : i64, !llvm.ptr
    cf.br ^bb9
    ^bb9:
    %108 = llvm.load %107 : !llvm.ptr -> i64
    %109 = arith.cmpi sle, %108, %7 : i64
    cf.cond_br %109, ^bb10, ^bb11
    ^bb10:
      %110 = arith.constant 1 : i32
      %111 = llvm.load %107 : !llvm.ptr -> i64
      %112 = arith.constant 1 : i32
      %114 = arith.extsi %112 : i32 to i64
      %113 = arith.addi %7, %114 : i64
      %115 = arith.muli %111, %113 : i64
      %116 = arith.constant 0 : i32
      %118 = arith.extsi %116 : i32 to i64
      %117 = arith.addi %115, %118 : i64
      %119 = arith.extsi %110 : i32 to i64
      %120 = llvm.getelementptr %94[%117] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %119, %120 : i64, !llvm.ptr
      %121 = arith.constant 1 : i32
      %122 = llvm.load %107 : !llvm.ptr -> i64
      %123 = arith.constant 1 : i32
      %125 = arith.extsi %123 : i32 to i64
      %124 = arith.addi %7, %125 : i64
      %126 = arith.muli %122, %124 : i64
      %127 = llvm.load %107 : !llvm.ptr -> i64
      %128 = arith.addi %126, %127 : i64
      %129 = arith.extsi %121 : i32 to i64
      %130 = llvm.getelementptr %94[%128] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %129, %130 : i64, !llvm.ptr
      %131 = arith.constant 1 : i32
      %132 = arith.extsi %131 : i32 to i64
      %133 = llvm.mlir.constant(1 : i64) : i64
      %134 = llvm.alloca %133 x i64 : (i64) -> !llvm.ptr
      llvm.store %132, %134 : i64, !llvm.ptr
      cf.br ^bb12
      ^bb12:
      %135 = llvm.load %134 : !llvm.ptr -> i64
      %136 = llvm.load %107 : !llvm.ptr -> i64
      %137 = arith.cmpi slt, %135, %136 : i64
      cf.cond_br %137, ^bb13, ^bb14
      ^bb13:
        %139 = llvm.load %107 : !llvm.ptr -> i64
        %140 = arith.constant 1 : i32
        %142 = arith.extsi %140 : i32 to i64
        %141 = arith.subi %139, %142 : i64
        %143 = arith.constant 1 : i32
        %145 = arith.extsi %143 : i32 to i64
        %144 = arith.addi %7, %145 : i64
        %146 = arith.muli %141, %144 : i64
        %147 = llvm.load %134 : !llvm.ptr -> i64
        %148 = arith.constant 1 : i32
        %150 = arith.extsi %148 : i32 to i64
        %149 = arith.subi %147, %150 : i64
        %151 = arith.addi %146, %149 : i64
        %152 = llvm.getelementptr %94[%151] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %138 = llvm.load %152 : !llvm.ptr -> i64
        %154 = llvm.load %107 : !llvm.ptr -> i64
        %155 = arith.constant 1 : i32
        %157 = arith.extsi %155 : i32 to i64
        %156 = arith.subi %154, %157 : i64
        %158 = arith.constant 1 : i32
        %160 = arith.extsi %158 : i32 to i64
        %159 = arith.addi %7, %160 : i64
        %161 = arith.muli %156, %159 : i64
        %162 = llvm.load %134 : !llvm.ptr -> i64
        %163 = arith.addi %161, %162 : i64
        %164 = llvm.getelementptr %94[%163] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %153 = llvm.load %164 : !llvm.ptr -> i64
        %165 = arith.addi %138, %153 : i64
        %166 = llvm.load %107 : !llvm.ptr -> i64
        %167 = arith.constant 1 : i32
        %169 = arith.extsi %167 : i32 to i64
        %168 = arith.addi %7, %169 : i64
        %170 = arith.muli %166, %168 : i64
        %171 = llvm.load %134 : !llvm.ptr -> i64
        %172 = arith.addi %170, %171 : i64
        %173 = llvm.getelementptr %94[%172] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %165, %173 : i64, !llvm.ptr
        %174 = llvm.load %134 : !llvm.ptr -> i64
        %175 = arith.constant 1 : i32
        %177 = arith.extsi %175 : i32 to i64
        %176 = arith.addi %174, %177 : i64
        llvm.store %176, %134 : i64, !llvm.ptr
        cf.br ^bb12
      ^bb14:
      %178 = llvm.load %107 : !llvm.ptr -> i64
      %179 = arith.constant 1 : i32
      %181 = arith.extsi %179 : i32 to i64
      %180 = arith.addi %178, %181 : i64
      llvm.store %180, %107 : i64, !llvm.ptr
      cf.br ^bb9
    ^bb11:
    %183 = arith.muli %17, %17 : i64
    %184 = arith.constant 8 : i32
    %185 = arith.extsi %184 : i32 to i64
    %182 = func.call @calloc(%183, %185) : (i64, i64) -> !llvm.ptr
    %187 = arith.muli %17, %17 : i64
    %188 = arith.constant 8 : i32
    %189 = arith.extsi %188 : i32 to i64
    %186 = func.call @calloc(%187, %189) : (i64, i64) -> !llvm.ptr
    %190 = llvm.mlir.zero : !llvm.ptr
    %191 = llvm.icmp "eq" %182, %190 : !llvm.ptr
    %192 = scf.if %191 -> (i1) {
      %193 = arith.constant true
      scf.yield %193 : i1
    } else {
      %194 = llvm.mlir.zero : !llvm.ptr
      %195 = llvm.icmp "eq" %186, %194 : !llvm.ptr
      scf.yield %195 : i1
    }
    cf.cond_br %192, ^bb15, ^bb16
    ^bb15:
      %196 = arith.constant 1 : i32
      func.return %196 : i32
    ^bb16:
      cf.br ^bb17
    ^bb17:
    %197 = arith.constant 0 : i32
    %198 = arith.extsi %197 : i32 to i64
    %199 = llvm.mlir.constant(1 : i64) : i64
    %200 = llvm.alloca %199 x i64 : (i64) -> !llvm.ptr
    llvm.store %198, %200 : i64, !llvm.ptr
    cf.br ^bb18
    ^bb18:
    %201 = llvm.load %200 : !llvm.ptr -> i64
    %202 = arith.cmpi slt, %201, %17 : i64
    cf.cond_br %202, ^bb19, ^bb20
    ^bb19:
      %204 = llvm.load %200 : !llvm.ptr -> i64
      %205 = llvm.getelementptr %29[%204] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %203 = llvm.load %205 : !llvm.ptr -> i32
      %206 = arith.extsi %203 : i32 to i64
      %208 = llvm.load %200 : !llvm.ptr -> i64
      %209 = llvm.getelementptr %32[%208] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %207 = llvm.load %209 : !llvm.ptr -> i32
      %210 = arith.extsi %207 : i32 to i64
      %211 = arith.subi %7, %206 : i64
      %212 = arith.subi %211, %210 : i64
      %213 = arith.constant 0 : i32
      %214 = arith.extsi %213 : i32 to i64
      %215 = llvm.mlir.constant(1 : i64) : i64
      %216 = llvm.alloca %215 x i64 : (i64) -> !llvm.ptr
      llvm.store %214, %216 : i64, !llvm.ptr
      cf.br ^bb21
      ^bb21:
      %217 = llvm.load %216 : !llvm.ptr -> i64
      %218 = arith.cmpi sle, %217, %206 : i64
      cf.cond_br %218, ^bb22, ^bb23
      ^bb22:
        %219 = arith.constant 0 : i32
        %220 = arith.extsi %219 : i32 to i64
        %221 = llvm.mlir.constant(1 : i64) : i64
        %222 = llvm.alloca %221 x i64 : (i64) -> !llvm.ptr
        llvm.store %220, %222 : i64, !llvm.ptr
        cf.br ^bb24
        ^bb24:
        %223 = llvm.load %222 : !llvm.ptr -> i64
        %224 = llvm.load %216 : !llvm.ptr -> i64
        %225 = arith.subi %206, %224 : i64
        %226 = arith.cmpi sle, %223, %225 : i64
        cf.cond_br %226, ^bb25, ^bb26
        ^bb25:
          %227 = llvm.load %216 : !llvm.ptr -> i64
          %228 = arith.subi %206, %227 : i64
          %229 = llvm.load %222 : !llvm.ptr -> i64
          %230 = arith.subi %228, %229 : i64
          %232 = arith.constant 1 : i32
          %234 = arith.extsi %232 : i32 to i64
          %233 = arith.addi %7, %234 : i64
          %235 = arith.muli %206, %233 : i64
          %236 = llvm.load %216 : !llvm.ptr -> i64
          %237 = arith.addi %235, %236 : i64
          %238 = llvm.getelementptr %94[%237] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %231 = llvm.load %238 : !llvm.ptr -> i64
          %240 = llvm.load %216 : !llvm.ptr -> i64
          %241 = arith.subi %206, %240 : i64
          %242 = arith.constant 1 : i32
          %244 = arith.extsi %242 : i32 to i64
          %243 = arith.addi %7, %244 : i64
          %245 = arith.muli %241, %243 : i64
          %246 = llvm.load %222 : !llvm.ptr -> i64
          %247 = arith.addi %245, %246 : i64
          %248 = llvm.getelementptr %94[%247] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %239 = llvm.load %248 : !llvm.ptr -> i64
          %249 = arith.muli %231, %239 : i64
          %250 = arith.remsi %249, %1 : i64
          %251 = llvm.load %216 : !llvm.ptr -> i64
          %252 = arith.addi %251, %212 : i64
          %254 = arith.constant 1 : i32
          %256 = arith.extsi %254 : i32 to i64
          %255 = arith.addi %7, %256 : i64
          %257 = arith.muli %252, %255 : i64
          %258 = arith.addi %257, %230 : i64
          %259 = llvm.getelementptr %19[%258] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %253 = llvm.load %259 : !llvm.ptr -> i32
          %260 = arith.extsi %253 : i32 to i64
          %261 = arith.constant 0 : i32
          %263 = arith.extsi %261 : i32 to i64
          %262 = arith.cmpi eq, %252, %263 : i64
          cf.cond_br %262, ^bb27, ^bb28
          ^bb27:
            %265 = llvm.load %200 : !llvm.ptr -> i64
            %266 = arith.muli %265, %17 : i64
            %267 = arith.addi %266, %260 : i64
            %268 = llvm.getelementptr %186[%267] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %264 = llvm.load %268 : !llvm.ptr -> i64
            %269 = arith.addi %264, %250 : i64
            %270 = arith.remsi %269, %1 : i64
            %271 = llvm.load %200 : !llvm.ptr -> i64
            %272 = arith.muli %271, %17 : i64
            %273 = arith.addi %272, %260 : i64
            %274 = llvm.getelementptr %186[%273] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %270, %274 : i64, !llvm.ptr
            cf.br ^bb29
          ^bb28:
            %276 = llvm.load %200 : !llvm.ptr -> i64
            %277 = arith.muli %276, %17 : i64
            %278 = arith.addi %277, %260 : i64
            %279 = llvm.getelementptr %182[%278] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %275 = llvm.load %279 : !llvm.ptr -> i64
            %280 = arith.addi %275, %250 : i64
            %281 = arith.remsi %280, %1 : i64
            %282 = llvm.load %200 : !llvm.ptr -> i64
            %283 = arith.muli %282, %17 : i64
            %284 = arith.addi %283, %260 : i64
            %285 = llvm.getelementptr %182[%284] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %281, %285 : i64, !llvm.ptr
            cf.br ^bb29
          ^bb29:
          %286 = llvm.load %222 : !llvm.ptr -> i64
          %287 = arith.constant 1 : i32
          %289 = arith.extsi %287 : i32 to i64
          %288 = arith.addi %286, %289 : i64
          llvm.store %288, %222 : i64, !llvm.ptr
          cf.br ^bb24
        ^bb26:
        %290 = llvm.load %216 : !llvm.ptr -> i64
        %291 = arith.constant 1 : i32
        %293 = arith.extsi %291 : i32 to i64
        %292 = arith.addi %290, %293 : i64
        llvm.store %292, %216 : i64, !llvm.ptr
        cf.br ^bb21
      ^bb23:
      %294 = llvm.load %200 : !llvm.ptr -> i64
      %295 = arith.constant 1 : i32
      %297 = arith.extsi %295 : i32 to i64
      %296 = arith.addi %294, %297 : i64
      llvm.store %296, %200 : i64, !llvm.ptr
      cf.br ^bb18
    ^bb20:
    %299 = arith.constant 1 : i32
    %301 = arith.extsi %299 : i32 to i64
    %300 = arith.addi %7, %301 : i64
    %302 = arith.muli %7, %300 : i64
    %303 = arith.constant 0 : i32
    %305 = arith.extsi %303 : i32 to i64
    %304 = arith.addi %302, %305 : i64
    %306 = llvm.getelementptr %19[%304] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %298 = llvm.load %306 : !llvm.ptr -> i32
    %307 = arith.extsi %298 : i32 to i64
    %309 = arith.muli %17, %17 : i64
    %310 = arith.constant 8 : i32
    %311 = arith.extsi %310 : i32 to i64
    %308 = func.call @calloc(%309, %311) : (i64, i64) -> !llvm.ptr
    %313 = arith.muli %17, %17 : i64
    %314 = arith.constant 8 : i32
    %315 = arith.extsi %314 : i32 to i64
    %312 = func.call @calloc(%313, %315) : (i64, i64) -> !llvm.ptr
    %317 = arith.muli %17, %17 : i64
    %318 = arith.constant 8 : i32
    %319 = arith.extsi %318 : i32 to i64
    %316 = func.call @calloc(%317, %319) : (i64, i64) -> !llvm.ptr
    %321 = arith.muli %17, %17 : i64
    %322 = arith.constant 8 : i32
    %323 = arith.extsi %322 : i32 to i64
    %320 = func.call @calloc(%321, %323) : (i64, i64) -> !llvm.ptr
    %325 = arith.muli %17, %17 : i64
    %326 = arith.constant 8 : i32
    %327 = arith.extsi %326 : i32 to i64
    %324 = func.call @calloc(%325, %327) : (i64, i64) -> !llvm.ptr
    %329 = arith.muli %17, %17 : i64
    %330 = arith.constant 8 : i32
    %331 = arith.extsi %330 : i32 to i64
    %328 = func.call @calloc(%329, %331) : (i64, i64) -> !llvm.ptr
    %332 = arith.constant 0 : i32
    %333 = arith.extsi %332 : i32 to i64
    %334 = llvm.mlir.constant(1 : i64) : i64
    %335 = llvm.alloca %334 x i64 : (i64) -> !llvm.ptr
    llvm.store %333, %335 : i64, !llvm.ptr
    cf.br ^bb30
    ^bb30:
    %336 = llvm.load %335 : !llvm.ptr -> i64
    %337 = arith.cmpi slt, %336, %17 : i64
    cf.cond_br %337, ^bb31, ^bb32
    ^bb31:
      %338 = arith.constant 1 : i32
      %339 = llvm.load %335 : !llvm.ptr -> i64
      %340 = arith.muli %339, %17 : i64
      %341 = llvm.load %335 : !llvm.ptr -> i64
      %342 = arith.addi %340, %341 : i64
      %343 = arith.extsi %338 : i32 to i64
      %344 = llvm.getelementptr %308[%342] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %343, %344 : i64, !llvm.ptr
      %345 = llvm.load %335 : !llvm.ptr -> i64
      %346 = arith.constant 1 : i32
      %348 = arith.extsi %346 : i32 to i64
      %347 = arith.addi %345, %348 : i64
      llvm.store %347, %335 : i64, !llvm.ptr
      cf.br ^bb30
    ^bb32:
    %349 = arith.constant 0 : i32
    %350 = arith.extsi %349 : i32 to i64
    llvm.store %350, %335 : i64, !llvm.ptr
    cf.br ^bb33
    ^bb33:
    %351 = llvm.load %335 : !llvm.ptr -> i64
    %352 = arith.muli %17, %17 : i64
    %353 = arith.cmpi slt, %351, %352 : i64
    cf.cond_br %353, ^bb34, ^bb35
    ^bb34:
      %355 = llvm.load %335 : !llvm.ptr -> i64
      %356 = llvm.getelementptr %182[%355] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %354 = llvm.load %356 : !llvm.ptr -> i64
      %357 = llvm.load %335 : !llvm.ptr -> i64
      %358 = llvm.getelementptr %316[%357] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %354, %358 : i64, !llvm.ptr
      %360 = llvm.load %335 : !llvm.ptr -> i64
      %361 = llvm.getelementptr %186[%360] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %359 = llvm.load %361 : !llvm.ptr -> i64
      %362 = llvm.load %335 : !llvm.ptr -> i64
      %363 = llvm.getelementptr %320[%362] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %359, %363 : i64, !llvm.ptr
      %364 = llvm.load %335 : !llvm.ptr -> i64
      %365 = arith.constant 1 : i32
      %367 = arith.extsi %365 : i32 to i64
      %366 = arith.addi %364, %367 : i64
      llvm.store %366, %335 : i64, !llvm.ptr
      cf.br ^bb33
    ^bb35:
    %368 = arith.constant 1 : i32
    %370 = arith.extsi %368 : i32 to i64
    %369 = arith.subi %5, %370 : i64
    %371 = llvm.mlir.constant(1 : i64) : i64
    %372 = llvm.alloca %371 x i64 : (i64) -> !llvm.ptr
    llvm.store %369, %372 : i64, !llvm.ptr
    cf.br ^bb36
    ^bb36:
    %373 = llvm.load %372 : !llvm.ptr -> i64
    %374 = arith.constant 0 : i32
    %376 = arith.extsi %374 : i32 to i64
    %375 = arith.cmpi sgt, %373, %376 : i64
    cf.cond_br %375, ^bb37, ^bb38
    ^bb37:
      %377 = llvm.load %372 : !llvm.ptr -> i64
      %378 = arith.constant 1 : i32
      %380 = arith.extsi %378 : i32 to i64
      %379 = arith.andi %377, %380 : i64
      %381 = arith.constant 1 : i32
      %383 = arith.extsi %381 : i32 to i64
      %382 = arith.cmpi eq, %379, %383 : i64
      cf.cond_br %382, ^bb39, ^bb40
      ^bb39:
        %384 = arith.constant 0 : i32
        %385 = arith.extsi %384 : i32 to i64
        %386 = llvm.mlir.constant(1 : i64) : i64
        %387 = llvm.alloca %386 x i64 : (i64) -> !llvm.ptr
        llvm.store %385, %387 : i64, !llvm.ptr
        cf.br ^bb42
        ^bb42:
        %388 = llvm.load %387 : !llvm.ptr -> i64
        %389 = arith.cmpi slt, %388, %17 : i64
        cf.cond_br %389, ^bb43, ^bb44
        ^bb43:
          %390 = arith.constant 0 : i32
          %391 = arith.extsi %390 : i32 to i64
          %392 = llvm.mlir.constant(1 : i64) : i64
          %393 = llvm.alloca %392 x i64 : (i64) -> !llvm.ptr
          llvm.store %391, %393 : i64, !llvm.ptr
          cf.br ^bb45
          ^bb45:
          %394 = llvm.load %393 : !llvm.ptr -> i64
          %395 = arith.cmpi slt, %394, %17 : i64
          cf.cond_br %395, ^bb46, ^bb47
          ^bb46:
            %396 = arith.constant 0 : i32
            %397 = arith.extsi %396 : i32 to i128
            %398 = llvm.mlir.constant(1 : i64) : i64
            %399 = llvm.alloca %398 x i128 : (i64) -> !llvm.ptr
            llvm.store %397, %399 : i128, !llvm.ptr
            %400 = arith.constant 0 : i32
            %401 = arith.extsi %400 : i32 to i128
            %402 = llvm.mlir.constant(1 : i64) : i64
            %403 = llvm.alloca %402 x i128 : (i64) -> !llvm.ptr
            llvm.store %401, %403 : i128, !llvm.ptr
            %404 = arith.constant 0 : i32
            %405 = arith.extsi %404 : i32 to i64
            %406 = llvm.mlir.constant(1 : i64) : i64
            %407 = llvm.alloca %406 x i64 : (i64) -> !llvm.ptr
            llvm.store %405, %407 : i64, !llvm.ptr
            cf.br ^bb48
            ^bb48:
            %408 = llvm.load %407 : !llvm.ptr -> i64
            %409 = arith.cmpi slt, %408, %17 : i64
            cf.cond_br %409, ^bb49, ^bb50
            ^bb49:
              %410 = llvm.load %399 : !llvm.ptr -> i128
              %412 = llvm.load %387 : !llvm.ptr -> i64
              %413 = arith.muli %412, %17 : i64
              %414 = llvm.load %407 : !llvm.ptr -> i64
              %415 = arith.addi %413, %414 : i64
              %416 = llvm.getelementptr %308[%415] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %411 = llvm.load %416 : !llvm.ptr -> i64
              %417 = arith.extsi %411 : i64 to i128
              %419 = llvm.load %407 : !llvm.ptr -> i64
              %420 = arith.muli %419, %17 : i64
              %421 = llvm.load %393 : !llvm.ptr -> i64
              %422 = arith.addi %420, %421 : i64
              %423 = llvm.getelementptr %316[%422] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %418 = llvm.load %423 : !llvm.ptr -> i64
              %424 = arith.extsi %418 : i64 to i128
              %426 = arith.trunci %417 : i128 to i64
              %427 = arith.trunci %424 : i128 to i64
              %425 = arith.muli %426, %427 : i64
              %429 = arith.trunci %410 : i128 to i64
              %428 = arith.addi %429, %425 : i64
              %430 = arith.extsi %428 : i64 to i128
              llvm.store %430, %399 : i128, !llvm.ptr
              %431 = llvm.load %403 : !llvm.ptr -> i128
              %433 = llvm.load %387 : !llvm.ptr -> i64
              %434 = arith.muli %433, %17 : i64
              %435 = llvm.load %407 : !llvm.ptr -> i64
              %436 = arith.addi %434, %435 : i64
              %437 = llvm.getelementptr %312[%436] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %432 = llvm.load %437 : !llvm.ptr -> i64
              %438 = arith.extsi %432 : i64 to i128
              %440 = llvm.load %407 : !llvm.ptr -> i64
              %441 = arith.muli %440, %17 : i64
              %442 = llvm.load %393 : !llvm.ptr -> i64
              %443 = arith.addi %441, %442 : i64
              %444 = llvm.getelementptr %316[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %439 = llvm.load %444 : !llvm.ptr -> i64
              %445 = arith.extsi %439 : i64 to i128
              %447 = arith.trunci %438 : i128 to i64
              %448 = arith.trunci %445 : i128 to i64
              %446 = arith.muli %447, %448 : i64
              %450 = arith.trunci %431 : i128 to i64
              %449 = arith.addi %450, %446 : i64
              %452 = llvm.load %387 : !llvm.ptr -> i64
              %453 = arith.muli %452, %17 : i64
              %454 = llvm.load %407 : !llvm.ptr -> i64
              %455 = arith.addi %453, %454 : i64
              %456 = llvm.getelementptr %308[%455] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %451 = llvm.load %456 : !llvm.ptr -> i64
              %457 = arith.extsi %451 : i64 to i128
              %459 = llvm.load %407 : !llvm.ptr -> i64
              %460 = arith.muli %459, %17 : i64
              %461 = llvm.load %393 : !llvm.ptr -> i64
              %462 = arith.addi %460, %461 : i64
              %463 = llvm.getelementptr %320[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %458 = llvm.load %463 : !llvm.ptr -> i64
              %464 = arith.extsi %458 : i64 to i128
              %466 = arith.trunci %457 : i128 to i64
              %467 = arith.trunci %464 : i128 to i64
              %465 = arith.muli %466, %467 : i64
              %468 = arith.addi %449, %465 : i64
              %469 = arith.extsi %468 : i64 to i128
              llvm.store %469, %403 : i128, !llvm.ptr
              %470 = llvm.load %407 : !llvm.ptr -> i64
              %471 = arith.constant 1 : i32
              %473 = arith.extsi %471 : i32 to i64
              %472 = arith.addi %470, %473 : i64
              llvm.store %472, %407 : i64, !llvm.ptr
              cf.br ^bb48
            ^bb50:
            %474 = llvm.load %399 : !llvm.ptr -> i128
            %475 = arith.extsi %1 : i64 to i128
            %477 = arith.trunci %474 : i128 to i64
            %478 = arith.trunci %475 : i128 to i64
            %476 = arith.remsi %477, %478 : i64
            %479 = llvm.load %387 : !llvm.ptr -> i64
            %480 = arith.muli %479, %17 : i64
            %481 = llvm.load %393 : !llvm.ptr -> i64
            %482 = arith.addi %480, %481 : i64
            %483 = llvm.getelementptr %324[%482] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %476, %483 : i64, !llvm.ptr
            %484 = llvm.load %403 : !llvm.ptr -> i128
            %485 = arith.extsi %1 : i64 to i128
            %487 = arith.trunci %484 : i128 to i64
            %488 = arith.trunci %485 : i128 to i64
            %486 = arith.remsi %487, %488 : i64
            %489 = llvm.load %387 : !llvm.ptr -> i64
            %490 = arith.muli %489, %17 : i64
            %491 = llvm.load %393 : !llvm.ptr -> i64
            %492 = arith.addi %490, %491 : i64
            %493 = llvm.getelementptr %328[%492] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %486, %493 : i64, !llvm.ptr
            %494 = llvm.load %393 : !llvm.ptr -> i64
            %495 = arith.constant 1 : i32
            %497 = arith.extsi %495 : i32 to i64
            %496 = arith.addi %494, %497 : i64
            llvm.store %496, %393 : i64, !llvm.ptr
            cf.br ^bb45
          ^bb47:
          %498 = llvm.load %387 : !llvm.ptr -> i64
          %499 = arith.constant 1 : i32
          %501 = arith.extsi %499 : i32 to i64
          %500 = arith.addi %498, %501 : i64
          llvm.store %500, %387 : i64, !llvm.ptr
          cf.br ^bb42
        ^bb44:
        %502 = arith.constant 0 : i32
        %503 = arith.extsi %502 : i32 to i64
        llvm.store %503, %387 : i64, !llvm.ptr
        cf.br ^bb51
        ^bb51:
        %504 = llvm.load %387 : !llvm.ptr -> i64
        %505 = arith.muli %17, %17 : i64
        %506 = arith.cmpi slt, %504, %505 : i64
        cf.cond_br %506, ^bb52, ^bb53
        ^bb52:
          %508 = llvm.load %387 : !llvm.ptr -> i64
          %509 = llvm.getelementptr %324[%508] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %507 = llvm.load %509 : !llvm.ptr -> i64
          %510 = llvm.load %387 : !llvm.ptr -> i64
          %511 = llvm.getelementptr %308[%510] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %507, %511 : i64, !llvm.ptr
          %513 = llvm.load %387 : !llvm.ptr -> i64
          %514 = llvm.getelementptr %328[%513] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %512 = llvm.load %514 : !llvm.ptr -> i64
          %515 = llvm.load %387 : !llvm.ptr -> i64
          %516 = llvm.getelementptr %312[%515] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %512, %516 : i64, !llvm.ptr
          %517 = llvm.load %387 : !llvm.ptr -> i64
          %518 = arith.constant 1 : i32
          %520 = arith.extsi %518 : i32 to i64
          %519 = arith.addi %517, %520 : i64
          llvm.store %519, %387 : i64, !llvm.ptr
          cf.br ^bb51
        ^bb53:
        cf.br ^bb41
      ^bb40:
        cf.br ^bb41
      ^bb41:
      %521 = arith.constant 0 : i32
      %522 = arith.extsi %521 : i32 to i64
      %523 = llvm.mlir.constant(1 : i64) : i64
      %524 = llvm.alloca %523 x i64 : (i64) -> !llvm.ptr
      llvm.store %522, %524 : i64, !llvm.ptr
      cf.br ^bb54
      ^bb54:
      %525 = llvm.load %524 : !llvm.ptr -> i64
      %526 = arith.cmpi slt, %525, %17 : i64
      cf.cond_br %526, ^bb55, ^bb56
      ^bb55:
        %527 = arith.constant 0 : i32
        %528 = arith.extsi %527 : i32 to i64
        %529 = llvm.mlir.constant(1 : i64) : i64
        %530 = llvm.alloca %529 x i64 : (i64) -> !llvm.ptr
        llvm.store %528, %530 : i64, !llvm.ptr
        cf.br ^bb57
        ^bb57:
        %531 = llvm.load %530 : !llvm.ptr -> i64
        %532 = arith.cmpi slt, %531, %17 : i64
        cf.cond_br %532, ^bb58, ^bb59
        ^bb58:
          %533 = arith.constant 0 : i32
          %534 = arith.extsi %533 : i32 to i128
          %535 = llvm.mlir.constant(1 : i64) : i64
          %536 = llvm.alloca %535 x i128 : (i64) -> !llvm.ptr
          llvm.store %534, %536 : i128, !llvm.ptr
          %537 = arith.constant 0 : i32
          %538 = arith.extsi %537 : i32 to i128
          %539 = llvm.mlir.constant(1 : i64) : i64
          %540 = llvm.alloca %539 x i128 : (i64) -> !llvm.ptr
          llvm.store %538, %540 : i128, !llvm.ptr
          %541 = arith.constant 0 : i32
          %542 = arith.extsi %541 : i32 to i64
          %543 = llvm.mlir.constant(1 : i64) : i64
          %544 = llvm.alloca %543 x i64 : (i64) -> !llvm.ptr
          llvm.store %542, %544 : i64, !llvm.ptr
          cf.br ^bb60
          ^bb60:
          %545 = llvm.load %544 : !llvm.ptr -> i64
          %546 = arith.cmpi slt, %545, %17 : i64
          cf.cond_br %546, ^bb61, ^bb62
          ^bb61:
            %547 = llvm.load %536 : !llvm.ptr -> i128
            %549 = llvm.load %524 : !llvm.ptr -> i64
            %550 = arith.muli %549, %17 : i64
            %551 = llvm.load %544 : !llvm.ptr -> i64
            %552 = arith.addi %550, %551 : i64
            %553 = llvm.getelementptr %316[%552] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %548 = llvm.load %553 : !llvm.ptr -> i64
            %554 = arith.extsi %548 : i64 to i128
            %556 = llvm.load %544 : !llvm.ptr -> i64
            %557 = arith.muli %556, %17 : i64
            %558 = llvm.load %530 : !llvm.ptr -> i64
            %559 = arith.addi %557, %558 : i64
            %560 = llvm.getelementptr %316[%559] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %555 = llvm.load %560 : !llvm.ptr -> i64
            %561 = arith.extsi %555 : i64 to i128
            %563 = arith.trunci %554 : i128 to i64
            %564 = arith.trunci %561 : i128 to i64
            %562 = arith.muli %563, %564 : i64
            %566 = arith.trunci %547 : i128 to i64
            %565 = arith.addi %566, %562 : i64
            %567 = arith.extsi %565 : i64 to i128
            llvm.store %567, %536 : i128, !llvm.ptr
            %568 = llvm.load %540 : !llvm.ptr -> i128
            %570 = llvm.load %524 : !llvm.ptr -> i64
            %571 = arith.muli %570, %17 : i64
            %572 = llvm.load %544 : !llvm.ptr -> i64
            %573 = arith.addi %571, %572 : i64
            %574 = llvm.getelementptr %320[%573] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %569 = llvm.load %574 : !llvm.ptr -> i64
            %575 = arith.extsi %569 : i64 to i128
            %577 = llvm.load %544 : !llvm.ptr -> i64
            %578 = arith.muli %577, %17 : i64
            %579 = llvm.load %530 : !llvm.ptr -> i64
            %580 = arith.addi %578, %579 : i64
            %581 = llvm.getelementptr %316[%580] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %576 = llvm.load %581 : !llvm.ptr -> i64
            %582 = arith.extsi %576 : i64 to i128
            %584 = arith.trunci %575 : i128 to i64
            %585 = arith.trunci %582 : i128 to i64
            %583 = arith.muli %584, %585 : i64
            %587 = arith.trunci %568 : i128 to i64
            %586 = arith.addi %587, %583 : i64
            %589 = llvm.load %524 : !llvm.ptr -> i64
            %590 = arith.muli %589, %17 : i64
            %591 = llvm.load %544 : !llvm.ptr -> i64
            %592 = arith.addi %590, %591 : i64
            %593 = llvm.getelementptr %316[%592] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %588 = llvm.load %593 : !llvm.ptr -> i64
            %594 = arith.extsi %588 : i64 to i128
            %596 = llvm.load %544 : !llvm.ptr -> i64
            %597 = arith.muli %596, %17 : i64
            %598 = llvm.load %530 : !llvm.ptr -> i64
            %599 = arith.addi %597, %598 : i64
            %600 = llvm.getelementptr %320[%599] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %595 = llvm.load %600 : !llvm.ptr -> i64
            %601 = arith.extsi %595 : i64 to i128
            %603 = arith.trunci %594 : i128 to i64
            %604 = arith.trunci %601 : i128 to i64
            %602 = arith.muli %603, %604 : i64
            %605 = arith.addi %586, %602 : i64
            %606 = arith.extsi %605 : i64 to i128
            llvm.store %606, %540 : i128, !llvm.ptr
            %607 = llvm.load %544 : !llvm.ptr -> i64
            %608 = arith.constant 1 : i32
            %610 = arith.extsi %608 : i32 to i64
            %609 = arith.addi %607, %610 : i64
            llvm.store %609, %544 : i64, !llvm.ptr
            cf.br ^bb60
          ^bb62:
          %611 = llvm.load %536 : !llvm.ptr -> i128
          %612 = arith.extsi %1 : i64 to i128
          %614 = arith.trunci %611 : i128 to i64
          %615 = arith.trunci %612 : i128 to i64
          %613 = arith.remsi %614, %615 : i64
          %616 = llvm.load %524 : !llvm.ptr -> i64
          %617 = arith.muli %616, %17 : i64
          %618 = llvm.load %530 : !llvm.ptr -> i64
          %619 = arith.addi %617, %618 : i64
          %620 = llvm.getelementptr %324[%619] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %613, %620 : i64, !llvm.ptr
          %621 = llvm.load %540 : !llvm.ptr -> i128
          %622 = arith.extsi %1 : i64 to i128
          %624 = arith.trunci %621 : i128 to i64
          %625 = arith.trunci %622 : i128 to i64
          %623 = arith.remsi %624, %625 : i64
          %626 = llvm.load %524 : !llvm.ptr -> i64
          %627 = arith.muli %626, %17 : i64
          %628 = llvm.load %530 : !llvm.ptr -> i64
          %629 = arith.addi %627, %628 : i64
          %630 = llvm.getelementptr %328[%629] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %623, %630 : i64, !llvm.ptr
          %631 = llvm.load %530 : !llvm.ptr -> i64
          %632 = arith.constant 1 : i32
          %634 = arith.extsi %632 : i32 to i64
          %633 = arith.addi %631, %634 : i64
          llvm.store %633, %530 : i64, !llvm.ptr
          cf.br ^bb57
        ^bb59:
        %635 = llvm.load %524 : !llvm.ptr -> i64
        %636 = arith.constant 1 : i32
        %638 = arith.extsi %636 : i32 to i64
        %637 = arith.addi %635, %638 : i64
        llvm.store %637, %524 : i64, !llvm.ptr
        cf.br ^bb54
      ^bb56:
      %639 = arith.constant 0 : i32
      %640 = arith.extsi %639 : i32 to i64
      llvm.store %640, %524 : i64, !llvm.ptr
      cf.br ^bb63
      ^bb63:
      %641 = llvm.load %524 : !llvm.ptr -> i64
      %642 = arith.muli %17, %17 : i64
      %643 = arith.cmpi slt, %641, %642 : i64
      cf.cond_br %643, ^bb64, ^bb65
      ^bb64:
        %645 = llvm.load %524 : !llvm.ptr -> i64
        %646 = llvm.getelementptr %324[%645] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %644 = llvm.load %646 : !llvm.ptr -> i64
        %647 = llvm.load %524 : !llvm.ptr -> i64
        %648 = llvm.getelementptr %316[%647] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %644, %648 : i64, !llvm.ptr
        %650 = llvm.load %524 : !llvm.ptr -> i64
        %651 = llvm.getelementptr %328[%650] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %649 = llvm.load %651 : !llvm.ptr -> i64
        %652 = llvm.load %524 : !llvm.ptr -> i64
        %653 = llvm.getelementptr %320[%652] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %649, %653 : i64, !llvm.ptr
        %654 = llvm.load %524 : !llvm.ptr -> i64
        %655 = arith.constant 1 : i32
        %657 = arith.extsi %655 : i32 to i64
        %656 = arith.addi %654, %657 : i64
        llvm.store %656, %524 : i64, !llvm.ptr
        cf.br ^bb63
      ^bb65:
      %658 = llvm.load %372 : !llvm.ptr -> i64
      %659 = arith.constant 1 : i32
      %661 = arith.extsi %659 : i32 to i64
      %660 = arith.shrsi %658, %661 : i64
      llvm.store %660, %372 : i64, !llvm.ptr
      cf.br ^bb36
    ^bb38:
    %663 = arith.muli %307, %17 : i64
    %664 = arith.addi %663, %307 : i64
    %665 = llvm.getelementptr %308[%664] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %662 = llvm.load %665 : !llvm.ptr -> i64
    %667 = arith.muli %307, %17 : i64
    %668 = arith.addi %667, %307 : i64
    %669 = llvm.getelementptr %312[%668] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %666 = llvm.load %669 : !llvm.ptr -> i64
    %670 = arith.addi %662, %666 : i64
    %671 = arith.remsi %670, %1 : i64
    %672 = llvm.mlir.constant(1 : i64) : i64
    %673 = llvm.alloca %672 x i64 : (i64) -> !llvm.ptr
    llvm.store %671, %673 : i64, !llvm.ptr
    %674 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %675 = llvm.load %673 : !llvm.ptr -> i64
    %676 = llvm.call @printf(%674, %675) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %677 = arith.constant 0 : i32
    func.return %677 : i32
  }
}