Problem 292

Pythagorean polygons P(120).

Answer3600060866
Output3600060866
StatusPASS
Native helperno
Runtime550 ms
Peak memory81712 KB
Time complexityO(n^4) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^4)O(n)
Space complexityO(n^2)O(1)
ApproachFlow solutionEuclid parametrisation
VerdictSuboptimal

Flow source

# Project Euler 292
# Pythagorean polygons P(120).

import euler.nt { isqrt }

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

function gcd_abs(a0: i64, b0: i64) -> i64 {
    let mut a: i64 = a0
    let mut b: i64 = b0
    if a < 0 { a = -a }
    if b < 0 { b = -b }
    while b != 0 {
        let t: i64 = a % b
        a = b
        b = t
    }
    return a
}

function main() -> i32 {
    let n: i64 = 120
    let max_perim: i64 = n
    let O: i64 = max_perim
    let W: i64 = 2 * max_perim + 1
    let origin: i64 = O * W + O
    let CAP: i64 = 20011
    let P: i64 = max_perim + 1

    let gdx: ptr<i64> = calloc(5000, 8)
    let gdy: ptr<i64> = calloc(5000, 8)
    let gc: ptr<i64> = calloc(5000, 8)
    let mut ng: i64 = 0
    gdx[ng] = 1; gdy[ng] = 0; gc[ng] = 1; ng = ng + 1
    gdx[ng] = 0; gdy[ng] = 1; gc[ng] = 1; ng = ng + 1
    let max_m: i64 = isqrt(max_perim - 1) + 2
    let mut m: i64 = 2
    while m <= max_m {
        let mm: i64 = m * m
        let mut nn: i64 = 1
        while nn < m {
            if ((m - nn) % 2) != 0 && gcd_abs(m, nn) == 1 {
                let a: i64 = mm - nn * nn
                let b: i64 = 2 * m * nn
                let c: i64 = mm + nn * nn
                if c <= max_perim {
                    gdx[ng] = a; gdy[ng] = b; gc[ng] = c; ng = ng + 1
                    gdx[ng] = 0 - a; gdy[ng] = b; gc[ng] = c; ng = ng + 1
                    gdx[ng] = b; gdy[ng] = a; gc[ng] = c; ng = ng + 1
                    gdx[ng] = 0 - b; gdy[ng] = a; gc[ng] = c; ng = ng + 1
                }
            }
            nn = nn + 1
        }
        m = m + 1
    }

    let keys: ptr<i64> = calloc(P * CAP, 8)
    let vals: ptr<i64> = calloc(P * CAP, 8)
    let used: ptr<i8> = calloc(P * CAP, 1)
    let bkeys: ptr<i64> = calloc(P * CAP, 8)
    let bvals: ptr<i64> = calloc(P * CAP, 8)
    let bused: ptr<i8> = calloc(P * CAP, 1)

    # insert origin into dp[0]
    let mut h: i64 = origin % CAP
    if h < 0 { h = -h }
    used[0 * CAP + h] = 1
    keys[0 * CAP + h] = origin
    vals[0 * CAP + h] = 1

    let mut gi: i64 = 0
    while gi < ng {
        let dx: i64 = gdx[gi]
        let dy: i64 = gdy[gi]
        let c: i64 = gc[gi]
        let mut p: i64 = 0
        while p <= max_perim {
            h = 0
            while h < CAP {
                bused[p * CAP + h] = used[p * CAP + h]
                bkeys[p * CAP + h] = keys[p * CAP + h]
                bvals[p * CAP + h] = vals[p * CAP + h]
                h = h + 1
            }
            p = p + 1
        }
        let max_scale: i64 = max_perim / c
        let mut s: i64 = 1
        while s <= max_scale {
            let length: i64 = c * s
            let delta: i64 = dx * s * W + dy * s
            p = 0
            while p + length <= max_perim {
                h = 0
                while h < CAP {
                    if bused[p * CAP + h] != 0 {
                        let key: i64 = bkeys[p * CAP + h]
                        let cnt: i64 = bvals[p * CAP + h]
                        let dest: i64 = p + length
                        let k2: i64 = key + delta
                        let mut hh: i64 = k2 % CAP
                        if hh < 0 { hh = -hh }
                        while used[dest * CAP + hh] != 0 {
                            if keys[dest * CAP + hh] == k2 {
                                vals[dest * CAP + hh] = vals[dest * CAP + hh] + cnt
                                break
                            }
                            hh = hh + 1
                            if hh == CAP { hh = 0 }
                        }
                        if used[dest * CAP + hh] == 0 {
                            used[dest * CAP + hh] = 1
                            keys[dest * CAP + hh] = k2
                            vals[dest * CAP + hh] = cnt
                        }
                    }
                    h = h + 1
                }
                p = p + 1
            }
            s = s + 1
        }
        gi = gi + 1
    }

    let mut total: i64 = 0
    let mut p1: i64 = 0
    while p1 <= n {
        let mut p2: i64 = 0
        while p2 <= n - p1 {
            h = 0
            while h < CAP {
                if used[p1 * CAP + h] != 0 {
                    let key: i64 = keys[p1 * CAP + h]
                    let c1: i64 = vals[p1 * CAP + h]
                    let c2: i64 = 0
                    let mut hh: i64 = key % CAP
                    if hh < 0 { hh = -hh }
                    while used[p2 * CAP + hh] != 0 {
                        if keys[p2 * CAP + hh] == key {
                            c2 = vals[p2 * CAP + hh]
                            break
                        }
                        hh = hh + 1
                        if hh == CAP { hh = 0 }
                    }
                    if c2 != 0 {
                        total = total + c1 * c2
                    }
                }
                h = h + 1
            }
            p2 = p2 + 1
        }
        p1 = p1 + 1
    }
    total = total - 1
    gi = 0
    while gi < ng {
        total = total - (n / (2 * gc[gi]))
        gi = gi + 1
    }
    printf("%lld\n", total)
    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 gcd_i64_i64(int64_t a0, int64_t b0);
int64_t lcm_i64_i64(int64_t a, int64_t b);
int64_t isqrt_i64(int64_t n);
int64_t mulmod_i64_i64_i64(int64_t a0, int64_t b0, int64_t mod);
int64_t mod_pow_i64_i64_i64(int64_t base, int64_t exp, int64_t mod);
bool is_prime_i64(int64_t n);
int64_t gcd_abs_i64_i64(int64_t a0, int64_t b0);
int32_t main(void);

int64_t gcd_i64_i64(int64_t a0, int64_t b0) {
    int64_t a = a0;
    int64_t b = b0;
    while (b != 0) {
        int64_t t = FLOW_CHECKED_MOD((a), (b));
        a = b;
        b = t;
    }
    return a;
}

int64_t lcm_i64_i64(int64_t a, int64_t b) {
    if ((a == 0 || b == 0)) {
        return 0;
    }
    return (FLOW_CHECKED_DIV((a), (gcd_i64_i64(a, b))) * b);
}

int64_t isqrt_i64(int64_t n) {
    if (n < 2) {
        return n;
    }
    int64_t x = n;
    int64_t y = FLOW_CHECKED_DIV(((x + 1)), (2));
    while (y < x) {
        x = y;
        y = FLOW_CHECKED_DIV(((x + FLOW_CHECKED_DIV((n), (x)))), (2));
    }
    return x;
}

int64_t mulmod_i64_i64_i64(int64_t a0, int64_t b0, int64_t mod) {
    int64_t a = FLOW_CHECKED_MOD((a0), (mod));
    int64_t b = FLOW_CHECKED_MOD((b0), (mod));
    int64_t result = 0;
    while (b > 0) {
        if (FLOW_CHECKED_MOD((b), (2)) == 1) {
            result = FLOW_CHECKED_MOD(((result + a)), (mod));
        }
        a = FLOW_CHECKED_MOD(((a * 2)), (mod));
        b = FLOW_CHECKED_DIV((b), (2));
    }
    return result;
}

int64_t mod_pow_i64_i64_i64(int64_t base, int64_t exp, int64_t mod) {
    if (mod == 1) {
        return 0;
    }
    int64_t result = 1;
    int64_t b = FLOW_CHECKED_MOD((base), (mod));
    int64_t e = exp;
    while (e > 0) {
        if (FLOW_CHECKED_MOD((e), (2)) == 1) {
            result = mulmod_i64_i64_i64(result, b, mod);
        }
        b = mulmod_i64_i64_i64(b, b, mod);
        e = FLOW_CHECKED_DIV((e), (2));
    }
    return result;
}

bool is_prime_i64(int64_t n) {
    if (n < 2) {
        return 0;
    }
    if (n < 4) {
        return 1;
    }
    if ((FLOW_CHECKED_MOD((n), (2)) == 0 || FLOW_CHECKED_MOD((n), (3)) == 0)) {
        return 0;
    }
    int64_t i = 5;
    while ((i * i) <= n) {
        if ((FLOW_CHECKED_MOD((n), (i)) == 0 || FLOW_CHECKED_MOD((n), ((i + 2))) == 0)) {
            return 0;
        }
        i = (i + 6);
    }
    return 1;
}



int64_t gcd_abs_i64_i64(int64_t a0, int64_t b0) {
    int64_t a = a0;
    int64_t b = b0;
    if (a < 0) {
        a = (-a);
    }
    if (b < 0) {
        b = (-b);
    }
    while (b != 0) {
        int64_t t = FLOW_CHECKED_MOD((a), (b));
        a = b;
        b = t;
    }
    return a;
}

int32_t main(void) {
    int64_t n = 120;
    int64_t max_perim = n;
    int64_t O = max_perim;
    int64_t W = ((2 * max_perim) + 1);
    int64_t origin = ((O * W) + O);
    int64_t CAP = 20011;
    int64_t P = (max_perim + 1);
    int64_t* gdx = (int64_t*)(calloc(5000, 8));
    int64_t* gdy = (int64_t*)(calloc(5000, 8));
    int64_t* gc = (int64_t*)(calloc(5000, 8));
    int64_t ng = 0;
    gdx[ng] = 1;
    gdy[ng] = 0;
    gc[ng] = 1;
    ng = (ng + 1);
    gdx[ng] = 0;
    gdy[ng] = 1;
    gc[ng] = 1;
    ng = (ng + 1);
    int64_t max_m = (isqrt_i64((max_perim - 1)) + 2);
    int64_t m = 2;
    while (m <= max_m) {
        int64_t mm = (m * m);
        int64_t nn = 1;
        while (nn < m) {
            if ((FLOW_CHECKED_MOD(((m - nn)), (2)) != 0 && gcd_abs_i64_i64(m, nn) == 1)) {
                int64_t a = (mm - (nn * nn));
                int64_t b = ((2 * m) * nn);
                int64_t c = (mm + (nn * nn));
                if (c <= max_perim) {
                    gdx[ng] = a;
                    gdy[ng] = b;
                    gc[ng] = c;
                    ng = (ng + 1);
                    gdx[ng] = (0 - a);
                    gdy[ng] = b;
                    gc[ng] = c;
                    ng = (ng + 1);
                    gdx[ng] = b;
                    gdy[ng] = a;
                    gc[ng] = c;
                    ng = (ng + 1);
                    gdx[ng] = (0 - b);
                    gdy[ng] = a;
                    gc[ng] = c;
                    ng = (ng + 1);
                }
            }
            nn = (nn + 1);
        }
        m = (m + 1);
    }
    int64_t* keys = (int64_t*)(calloc((P * CAP), 8));
    int64_t* vals = (int64_t*)(calloc((P * CAP), 8));
    int8_t* used = (int8_t*)(calloc((P * CAP), 1));
    int64_t* bkeys = (int64_t*)(calloc((P * CAP), 8));
    int64_t* bvals = (int64_t*)(calloc((P * CAP), 8));
    int8_t* bused = (int8_t*)(calloc((P * CAP), 1));
    int64_t h = FLOW_CHECKED_MOD((origin), (CAP));
    if (h < 0) {
        h = (-h);
    }
    used[((0 * CAP) + h)] = 1;
    keys[((0 * CAP) + h)] = origin;
    vals[((0 * CAP) + h)] = 1;
    int64_t gi = 0;
    while (gi < ng) {
        int64_t dx = gdx[gi];
        int64_t dy = gdy[gi];
        int64_t c = gc[gi];
        int64_t p = 0;
        while (p <= max_perim) {
            h = 0;
            while (h < CAP) {
                bused[((p * CAP) + h)] = used[((p * CAP) + h)];
                bkeys[((p * CAP) + h)] = keys[((p * CAP) + h)];
                bvals[((p * CAP) + h)] = vals[((p * CAP) + h)];
                h = (h + 1);
            }
            p = (p + 1);
        }
        int64_t max_scale = FLOW_CHECKED_DIV((max_perim), (c));
        int64_t s = 1;
        while (s <= max_scale) {
            int64_t length = (c * s);
            int64_t delta = (((dx * s) * W) + (dy * s));
            p = 0;
            while ((p + length) <= max_perim) {
                h = 0;
                while (h < CAP) {
                    if (bused[((p * CAP) + h)] != 0) {
                        int64_t key = bkeys[((p * CAP) + h)];
                        int64_t cnt = bvals[((p * CAP) + h)];
                        int64_t dest = (p + length);
                        int64_t k2 = (key + delta);
                        int64_t hh = FLOW_CHECKED_MOD((k2), (CAP));
                        if (hh < 0) {
                            hh = (-hh);
                        }
                        while (used[((dest * CAP) + hh)] != 0) {
                            if (keys[((dest * CAP) + hh)] == k2) {
                                vals[((dest * CAP) + hh)] = (vals[((dest * CAP) + hh)] + cnt);
                                break;
                            }
                            hh = (hh + 1);
                            if (hh == CAP) {
                                hh = 0;
                            }
                        }
                        if (used[((dest * CAP) + hh)] == 0) {
                            used[((dest * CAP) + hh)] = 1;
                            keys[((dest * CAP) + hh)] = k2;
                            vals[((dest * CAP) + hh)] = cnt;
                        }
                    }
                    h = (h + 1);
                }
                p = (p + 1);
            }
            s = (s + 1);
        }
        gi = (gi + 1);
    }
    int64_t total = 0;
    int64_t p1 = 0;
    while (p1 <= n) {
        int64_t p2 = 0;
        while (p2 <= (n - p1)) {
            h = 0;
            while (h < CAP) {
                if (used[((p1 * CAP) + h)] != 0) {
                    int64_t key = keys[((p1 * CAP) + h)];
                    int64_t c1 = vals[((p1 * CAP) + h)];
                    int64_t c2 = 0;
                    int64_t hh = FLOW_CHECKED_MOD((key), (CAP));
                    if (hh < 0) {
                        hh = (-hh);
                    }
                    while (used[((p2 * CAP) + hh)] != 0) {
                        if (keys[((p2 * CAP) + hh)] == key) {
                            c2 = vals[((p2 * CAP) + hh)];
                            break;
                        }
                        hh = (hh + 1);
                        if (hh == CAP) {
                            hh = 0;
                        }
                    }
                    if (c2 != 0) {
                        total = (total + (c1 * c2));
                    }
                }
                h = (h + 1);
            }
            p2 = (p2 + 1);
        }
        p1 = (p1 + 1);
    }
    total = (total - 1);
    gi = 0;
    while (gi < ng) {
        total = (total - FLOW_CHECKED_DIV((n), ((2 * gc[gi]))));
        gi = (gi + 1);
    }
    printf("%lld\n", total);
    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 @gcd(%arg0: i64, %arg1: i64) -> i64 {
    %0 = llvm.mlir.constant(1 : i64) : i64
    %1 = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %1 : i64, !llvm.ptr
    %2 = llvm.mlir.constant(1 : i64) : i64
    %3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %3 : i64, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %4 = llvm.load %3 : !llvm.ptr -> i64
    %5 = arith.constant 0 : i32
    %7 = arith.extsi %5 : i32 to i64
    %6 = arith.cmpi ne, %4, %7 : i64
    cf.cond_br %6, ^bb1, ^bb2
    ^bb1:
      %8 = llvm.load %1 : !llvm.ptr -> i64
      %9 = llvm.load %3 : !llvm.ptr -> i64
      %10 = arith.remsi %8, %9 : i64
      %11 = llvm.load %3 : !llvm.ptr -> i64
      llvm.store %11, %1 : i64, !llvm.ptr
      llvm.store %10, %3 : i64, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    %12 = llvm.load %1 : !llvm.ptr -> i64
    func.return %12 : i64
  }
  func.func @lcm(%arg0: i64, %arg1: i64) -> i64 {
    %13 = arith.constant 0 : i32
    %15 = arith.extsi %13 : i32 to i64
    %14 = arith.cmpi eq, %arg0, %15 : i64
    %16 = scf.if %14 -> (i1) {
      %17 = arith.constant true
      scf.yield %17 : i1
    } else {
      %18 = arith.constant 0 : i32
      %20 = arith.extsi %18 : i32 to i64
      %19 = arith.cmpi eq, %arg1, %20 : i64
      scf.yield %19 : i1
    }
    cf.cond_br %16, ^bb3, ^bb4
    ^bb3:
      %21 = arith.constant 0 : i32
      %22 = arith.extsi %21 : i32 to i64
      func.return %22 : i64
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %23 = func.call @gcd(%arg0, %arg1) : (i64, i64) -> i64
    %24 = arith.divsi %arg0, %23 : i64
    %25 = arith.muli %24, %arg1 : i64
    func.return %25 : i64
  }
  func.func @isqrt(%arg0: i64) -> i64 {
    %26 = arith.constant 2 : i32
    %28 = arith.extsi %26 : i32 to i64
    %27 = arith.cmpi slt, %arg0, %28 : i64
    cf.cond_br %27, ^bb6, ^bb7
    ^bb6:
      func.return %arg0 : i64
    ^bb7:
      cf.br ^bb8
    ^bb8:
    %29 = llvm.mlir.constant(1 : i64) : i64
    %30 = llvm.alloca %29 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %30 : i64, !llvm.ptr
    %31 = llvm.load %30 : !llvm.ptr -> i64
    %32 = arith.constant 1 : i32
    %34 = arith.extsi %32 : i32 to i64
    %33 = arith.addi %31, %34 : i64
    %35 = arith.constant 2 : i32
    %37 = arith.extsi %35 : i32 to i64
    %36 = arith.divsi %33, %37 : i64
    %38 = llvm.mlir.constant(1 : i64) : i64
    %39 = llvm.alloca %38 x i64 : (i64) -> !llvm.ptr
    llvm.store %36, %39 : i64, !llvm.ptr
    cf.br ^bb9
    ^bb9:
    %40 = llvm.load %39 : !llvm.ptr -> i64
    %41 = llvm.load %30 : !llvm.ptr -> i64
    %42 = arith.cmpi slt, %40, %41 : i64
    cf.cond_br %42, ^bb10, ^bb11
    ^bb10:
      %43 = llvm.load %39 : !llvm.ptr -> i64
      llvm.store %43, %30 : i64, !llvm.ptr
      %44 = llvm.load %30 : !llvm.ptr -> i64
      %45 = llvm.load %30 : !llvm.ptr -> i64
      %46 = arith.divsi %arg0, %45 : i64
      %47 = arith.addi %44, %46 : i64
      %48 = arith.constant 2 : i32
      %50 = arith.extsi %48 : i32 to i64
      %49 = arith.divsi %47, %50 : i64
      llvm.store %49, %39 : i64, !llvm.ptr
      cf.br ^bb9
    ^bb11:
    %51 = llvm.load %30 : !llvm.ptr -> i64
    func.return %51 : i64
  }
  func.func @mulmod(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %52 = arith.remsi %arg0, %arg2 : i64
    %53 = llvm.mlir.constant(1 : i64) : i64
    %54 = llvm.alloca %53 x i64 : (i64) -> !llvm.ptr
    llvm.store %52, %54 : i64, !llvm.ptr
    %55 = arith.remsi %arg1, %arg2 : i64
    %56 = llvm.mlir.constant(1 : i64) : i64
    %57 = llvm.alloca %56 x i64 : (i64) -> !llvm.ptr
    llvm.store %55, %57 : i64, !llvm.ptr
    %58 = arith.constant 0 : i32
    %59 = arith.extsi %58 : i32 to i64
    %60 = llvm.mlir.constant(1 : i64) : i64
    %61 = llvm.alloca %60 x i64 : (i64) -> !llvm.ptr
    llvm.store %59, %61 : i64, !llvm.ptr
    cf.br ^bb12
    ^bb12:
    %62 = llvm.load %57 : !llvm.ptr -> i64
    %63 = arith.constant 0 : i32
    %65 = arith.extsi %63 : i32 to i64
    %64 = arith.cmpi sgt, %62, %65 : i64
    cf.cond_br %64, ^bb13, ^bb14
    ^bb13:
      %66 = llvm.load %57 : !llvm.ptr -> i64
      %67 = arith.constant 2 : i32
      %69 = arith.extsi %67 : i32 to i64
      %68 = arith.remsi %66, %69 : i64
      %70 = arith.constant 1 : i32
      %72 = arith.extsi %70 : i32 to i64
      %71 = arith.cmpi eq, %68, %72 : i64
      cf.cond_br %71, ^bb15, ^bb16
      ^bb15:
        %73 = llvm.load %61 : !llvm.ptr -> i64
        %74 = llvm.load %54 : !llvm.ptr -> i64
        %75 = arith.addi %73, %74 : i64
        %76 = arith.remsi %75, %arg2 : i64
        llvm.store %76, %61 : i64, !llvm.ptr
        cf.br ^bb17
      ^bb16:
        cf.br ^bb17
      ^bb17:
      %77 = llvm.load %54 : !llvm.ptr -> i64
      %78 = arith.constant 2 : i32
      %80 = arith.extsi %78 : i32 to i64
      %79 = arith.muli %77, %80 : i64
      %81 = arith.remsi %79, %arg2 : i64
      llvm.store %81, %54 : i64, !llvm.ptr
      %82 = llvm.load %57 : !llvm.ptr -> i64
      %83 = arith.constant 2 : i32
      %85 = arith.extsi %83 : i32 to i64
      %84 = arith.divsi %82, %85 : i64
      llvm.store %84, %57 : i64, !llvm.ptr
      cf.br ^bb12
    ^bb14:
    %86 = llvm.load %61 : !llvm.ptr -> i64
    func.return %86 : i64
  }
  func.func @mod_pow(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %87 = arith.constant 1 : i32
    %89 = arith.extsi %87 : i32 to i64
    %88 = arith.cmpi eq, %arg2, %89 : i64
    cf.cond_br %88, ^bb18, ^bb19
    ^bb18:
      %90 = arith.constant 0 : i32
      %91 = arith.extsi %90 : i32 to i64
      func.return %91 : i64
    ^bb19:
      cf.br ^bb20
    ^bb20:
    %92 = arith.constant 1 : i32
    %93 = arith.extsi %92 : i32 to i64
    %94 = llvm.mlir.constant(1 : i64) : i64
    %95 = llvm.alloca %94 x i64 : (i64) -> !llvm.ptr
    llvm.store %93, %95 : i64, !llvm.ptr
    %96 = arith.remsi %arg0, %arg2 : i64
    %97 = llvm.mlir.constant(1 : i64) : i64
    %98 = llvm.alloca %97 x i64 : (i64) -> !llvm.ptr
    llvm.store %96, %98 : i64, !llvm.ptr
    %99 = llvm.mlir.constant(1 : i64) : i64
    %100 = llvm.alloca %99 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %100 : i64, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %101 = llvm.load %100 : !llvm.ptr -> i64
    %102 = arith.constant 0 : i32
    %104 = arith.extsi %102 : i32 to i64
    %103 = arith.cmpi sgt, %101, %104 : i64
    cf.cond_br %103, ^bb22, ^bb23
    ^bb22:
      %105 = llvm.load %100 : !llvm.ptr -> i64
      %106 = arith.constant 2 : i32
      %108 = arith.extsi %106 : i32 to i64
      %107 = arith.remsi %105, %108 : i64
      %109 = arith.constant 1 : i32
      %111 = arith.extsi %109 : i32 to i64
      %110 = arith.cmpi eq, %107, %111 : i64
      cf.cond_br %110, ^bb24, ^bb25
      ^bb24:
        %113 = llvm.load %95 : !llvm.ptr -> i64
        %114 = llvm.load %98 : !llvm.ptr -> i64
        %112 = func.call @mulmod(%113, %114, %arg2) : (i64, i64, i64) -> i64
        llvm.store %112, %95 : i64, !llvm.ptr
        cf.br ^bb26
      ^bb25:
        cf.br ^bb26
      ^bb26:
      %116 = llvm.load %98 : !llvm.ptr -> i64
      %117 = llvm.load %98 : !llvm.ptr -> i64
      %115 = func.call @mulmod(%116, %117, %arg2) : (i64, i64, i64) -> i64
      llvm.store %115, %98 : i64, !llvm.ptr
      %118 = llvm.load %100 : !llvm.ptr -> i64
      %119 = arith.constant 2 : i32
      %121 = arith.extsi %119 : i32 to i64
      %120 = arith.divsi %118, %121 : i64
      llvm.store %120, %100 : i64, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %122 = llvm.load %95 : !llvm.ptr -> i64
    func.return %122 : i64
  }
  func.func @is_prime(%arg0: i64) -> i1 {
    %123 = arith.constant 2 : i32
    %125 = arith.extsi %123 : i32 to i64
    %124 = arith.cmpi slt, %arg0, %125 : i64
    cf.cond_br %124, ^bb27, ^bb28
    ^bb27:
      %126 = arith.constant 0 : i1
      func.return %126 : i1
    ^bb28:
      cf.br ^bb29
    ^bb29:
    %127 = arith.constant 4 : i32
    %129 = arith.extsi %127 : i32 to i64
    %128 = arith.cmpi slt, %arg0, %129 : i64
    cf.cond_br %128, ^bb30, ^bb31
    ^bb30:
      %130 = arith.constant 1 : i1
      func.return %130 : i1
    ^bb31:
      cf.br ^bb32
    ^bb32:
    %131 = arith.constant 2 : i32
    %133 = arith.extsi %131 : i32 to i64
    %132 = arith.remsi %arg0, %133 : i64
    %134 = arith.constant 0 : i32
    %136 = arith.extsi %134 : i32 to i64
    %135 = arith.cmpi eq, %132, %136 : i64
    %137 = scf.if %135 -> (i1) {
      %138 = arith.constant true
      scf.yield %138 : i1
    } else {
      %139 = arith.constant 3 : i32
      %141 = arith.extsi %139 : i32 to i64
      %140 = arith.remsi %arg0, %141 : i64
      %142 = arith.constant 0 : i32
      %144 = arith.extsi %142 : i32 to i64
      %143 = arith.cmpi eq, %140, %144 : i64
      scf.yield %143 : i1
    }
    cf.cond_br %137, ^bb33, ^bb34
    ^bb33:
      %145 = arith.constant 0 : i1
      func.return %145 : i1
    ^bb34:
      cf.br ^bb35
    ^bb35:
    %146 = arith.constant 5 : i32
    %147 = arith.extsi %146 : i32 to i64
    %148 = llvm.mlir.constant(1 : i64) : i64
    %149 = llvm.alloca %148 x i64 : (i64) -> !llvm.ptr
    llvm.store %147, %149 : i64, !llvm.ptr
    cf.br ^bb36
    ^bb36:
    %150 = llvm.load %149 : !llvm.ptr -> i64
    %151 = llvm.load %149 : !llvm.ptr -> i64
    %152 = arith.muli %150, %151 : i64
    %153 = arith.cmpi sle, %152, %arg0 : i64
    cf.cond_br %153, ^bb37, ^bb38
    ^bb37:
      %154 = llvm.load %149 : !llvm.ptr -> i64
      %155 = arith.remsi %arg0, %154 : i64
      %156 = arith.constant 0 : i32
      %158 = arith.extsi %156 : i32 to i64
      %157 = arith.cmpi eq, %155, %158 : i64
      %159 = scf.if %157 -> (i1) {
        %160 = arith.constant true
        scf.yield %160 : i1
      } else {
        %161 = llvm.load %149 : !llvm.ptr -> i64
        %162 = arith.constant 2 : i32
        %164 = arith.extsi %162 : i32 to i64
        %163 = arith.addi %161, %164 : i64
        %165 = arith.remsi %arg0, %163 : i64
        %166 = arith.constant 0 : i32
        %168 = arith.extsi %166 : i32 to i64
        %167 = arith.cmpi eq, %165, %168 : i64
        scf.yield %167 : i1
      }
      cf.cond_br %159, ^bb39, ^bb40
      ^bb39:
        %169 = arith.constant 0 : i1
        func.return %169 : i1
      ^bb40:
        cf.br ^bb41
      ^bb41:
      %170 = llvm.load %149 : !llvm.ptr -> i64
      %171 = arith.constant 6 : i32
      %173 = arith.extsi %171 : i32 to i64
      %172 = arith.addi %170, %173 : i64
      llvm.store %172, %149 : i64, !llvm.ptr
      cf.br ^bb36
    ^bb38:
    %174 = arith.constant 1 : i1
    func.return %174 : i1
  }
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  func.func @gcd_abs(%arg0: i64, %arg1: i64) -> i64 {
    %175 = llvm.mlir.constant(1 : i64) : i64
    %176 = llvm.alloca %175 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %176 : i64, !llvm.ptr
    %177 = llvm.mlir.constant(1 : i64) : i64
    %178 = llvm.alloca %177 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %178 : i64, !llvm.ptr
    %179 = llvm.load %176 : !llvm.ptr -> i64
    %180 = arith.constant 0 : i32
    %182 = arith.extsi %180 : i32 to i64
    %181 = arith.cmpi slt, %179, %182 : i64
    cf.cond_br %181, ^bb42, ^bb43
    ^bb42:
      %183 = llvm.load %176 : !llvm.ptr -> i64
      %185 = arith.constant 0 : i64
      %184 = arith.subi %185, %183 : i64
      llvm.store %184, %176 : i64, !llvm.ptr
      cf.br ^bb44
    ^bb43:
      cf.br ^bb44
    ^bb44:
    %186 = llvm.load %178 : !llvm.ptr -> i64
    %187 = arith.constant 0 : i32
    %189 = arith.extsi %187 : i32 to i64
    %188 = arith.cmpi slt, %186, %189 : i64
    cf.cond_br %188, ^bb45, ^bb46
    ^bb45:
      %190 = llvm.load %178 : !llvm.ptr -> i64
      %192 = arith.constant 0 : i64
      %191 = arith.subi %192, %190 : i64
      llvm.store %191, %178 : i64, !llvm.ptr
      cf.br ^bb47
    ^bb46:
      cf.br ^bb47
    ^bb47:
    cf.br ^bb48
    ^bb48:
    %193 = llvm.load %178 : !llvm.ptr -> i64
    %194 = arith.constant 0 : i32
    %196 = arith.extsi %194 : i32 to i64
    %195 = arith.cmpi ne, %193, %196 : i64
    cf.cond_br %195, ^bb49, ^bb50
    ^bb49:
      %197 = llvm.load %176 : !llvm.ptr -> i64
      %198 = llvm.load %178 : !llvm.ptr -> i64
      %199 = arith.remsi %197, %198 : i64
      %200 = llvm.load %178 : !llvm.ptr -> i64
      llvm.store %200, %176 : i64, !llvm.ptr
      llvm.store %199, %178 : i64, !llvm.ptr
      cf.br ^bb48
    ^bb50:
    %201 = llvm.load %176 : !llvm.ptr -> i64
    func.return %201 : i64
  }
  func.func @main() -> i32 {
    %202 = arith.constant 120 : i32
    %203 = arith.extsi %202 : i32 to i64
    %204 = arith.constant 2 : i32
    %206 = arith.extsi %204 : i32 to i64
    %205 = arith.muli %206, %203 : i64
    %207 = arith.constant 1 : i32
    %209 = arith.extsi %207 : i32 to i64
    %208 = arith.addi %205, %209 : i64
    %210 = arith.muli %203, %208 : i64
    %211 = arith.addi %210, %203 : i64
    %212 = arith.constant 20011 : i32
    %213 = arith.extsi %212 : i32 to i64
    %214 = arith.constant 1 : i32
    %216 = arith.extsi %214 : i32 to i64
    %215 = arith.addi %203, %216 : i64
    %218 = arith.constant 5000 : i32
    %219 = arith.constant 8 : i32
    %220 = arith.extsi %218 : i32 to i64
    %221 = arith.extsi %219 : i32 to i64
    %217 = func.call @calloc(%220, %221) : (i64, i64) -> !llvm.ptr
    %223 = arith.constant 5000 : i32
    %224 = arith.constant 8 : i32
    %225 = arith.extsi %223 : i32 to i64
    %226 = arith.extsi %224 : i32 to i64
    %222 = func.call @calloc(%225, %226) : (i64, i64) -> !llvm.ptr
    %228 = arith.constant 5000 : i32
    %229 = arith.constant 8 : i32
    %230 = arith.extsi %228 : i32 to i64
    %231 = arith.extsi %229 : i32 to i64
    %227 = func.call @calloc(%230, %231) : (i64, i64) -> !llvm.ptr
    %232 = arith.constant 0 : i32
    %233 = arith.extsi %232 : i32 to i64
    %234 = llvm.mlir.constant(1 : i64) : i64
    %235 = llvm.alloca %234 x i64 : (i64) -> !llvm.ptr
    llvm.store %233, %235 : i64, !llvm.ptr
    %236 = arith.constant 1 : i32
    %237 = llvm.load %235 : !llvm.ptr -> i64
    %238 = arith.extsi %236 : i32 to i64
    %239 = llvm.getelementptr %217[%237] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %238, %239 : i64, !llvm.ptr
    %240 = arith.constant 0 : i32
    %241 = llvm.load %235 : !llvm.ptr -> i64
    %242 = arith.extsi %240 : i32 to i64
    %243 = llvm.getelementptr %222[%241] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %242, %243 : i64, !llvm.ptr
    %244 = arith.constant 1 : i32
    %245 = llvm.load %235 : !llvm.ptr -> i64
    %246 = arith.extsi %244 : i32 to i64
    %247 = llvm.getelementptr %227[%245] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %246, %247 : i64, !llvm.ptr
    %248 = llvm.load %235 : !llvm.ptr -> i64
    %249 = arith.constant 1 : i32
    %251 = arith.extsi %249 : i32 to i64
    %250 = arith.addi %248, %251 : i64
    llvm.store %250, %235 : i64, !llvm.ptr
    %252 = arith.constant 0 : i32
    %253 = llvm.load %235 : !llvm.ptr -> i64
    %254 = arith.extsi %252 : i32 to i64
    %255 = llvm.getelementptr %217[%253] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %254, %255 : i64, !llvm.ptr
    %256 = arith.constant 1 : i32
    %257 = llvm.load %235 : !llvm.ptr -> i64
    %258 = arith.extsi %256 : i32 to i64
    %259 = llvm.getelementptr %222[%257] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %258, %259 : i64, !llvm.ptr
    %260 = arith.constant 1 : i32
    %261 = llvm.load %235 : !llvm.ptr -> i64
    %262 = arith.extsi %260 : i32 to i64
    %263 = llvm.getelementptr %227[%261] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %262, %263 : i64, !llvm.ptr
    %264 = llvm.load %235 : !llvm.ptr -> i64
    %265 = arith.constant 1 : i32
    %267 = arith.extsi %265 : i32 to i64
    %266 = arith.addi %264, %267 : i64
    llvm.store %266, %235 : i64, !llvm.ptr
    %269 = arith.constant 1 : i32
    %271 = arith.extsi %269 : i32 to i64
    %270 = arith.subi %203, %271 : i64
    %268 = func.call @isqrt(%270) : (i64) -> i64
    %272 = arith.constant 2 : i32
    %274 = arith.extsi %272 : i32 to i64
    %273 = arith.addi %268, %274 : i64
    %275 = arith.constant 2 : i32
    %276 = arith.extsi %275 : i32 to i64
    %277 = llvm.mlir.constant(1 : i64) : i64
    %278 = llvm.alloca %277 x i64 : (i64) -> !llvm.ptr
    llvm.store %276, %278 : i64, !llvm.ptr
    cf.br ^bb51
    ^bb51:
    %279 = llvm.load %278 : !llvm.ptr -> i64
    %280 = arith.cmpi sle, %279, %273 : i64
    cf.cond_br %280, ^bb52, ^bb53
    ^bb52:
      %281 = llvm.load %278 : !llvm.ptr -> i64
      %282 = llvm.load %278 : !llvm.ptr -> i64
      %283 = arith.muli %281, %282 : i64
      %284 = arith.constant 1 : i32
      %285 = arith.extsi %284 : i32 to i64
      %286 = llvm.mlir.constant(1 : i64) : i64
      %287 = llvm.alloca %286 x i64 : (i64) -> !llvm.ptr
      llvm.store %285, %287 : i64, !llvm.ptr
      cf.br ^bb54
      ^bb54:
      %288 = llvm.load %287 : !llvm.ptr -> i64
      %289 = llvm.load %278 : !llvm.ptr -> i64
      %290 = arith.cmpi slt, %288, %289 : i64
      cf.cond_br %290, ^bb55, ^bb56
      ^bb55:
        %291 = llvm.load %278 : !llvm.ptr -> i64
        %292 = llvm.load %287 : !llvm.ptr -> i64
        %293 = arith.subi %291, %292 : i64
        %294 = arith.constant 2 : i32
        %296 = arith.extsi %294 : i32 to i64
        %295 = arith.remsi %293, %296 : i64
        %297 = arith.constant 0 : i32
        %299 = arith.extsi %297 : i32 to i64
        %298 = arith.cmpi ne, %295, %299 : i64
        %300 = scf.if %298 -> (i1) {
          %302 = llvm.load %278 : !llvm.ptr -> i64
          %303 = llvm.load %287 : !llvm.ptr -> i64
          %301 = func.call @gcd_abs(%302, %303) : (i64, i64) -> i64
          %304 = arith.constant 1 : i32
          %306 = arith.extsi %304 : i32 to i64
          %305 = arith.cmpi eq, %301, %306 : i64
          scf.yield %305 : i1
        } else {
          %307 = arith.constant false
          scf.yield %307 : i1
        }
        cf.cond_br %300, ^bb57, ^bb58
        ^bb57:
          %308 = llvm.load %287 : !llvm.ptr -> i64
          %309 = llvm.load %287 : !llvm.ptr -> i64
          %310 = arith.muli %308, %309 : i64
          %311 = arith.subi %283, %310 : i64
          %312 = arith.constant 2 : i32
          %313 = llvm.load %278 : !llvm.ptr -> i64
          %315 = arith.extsi %312 : i32 to i64
          %314 = arith.muli %315, %313 : i64
          %316 = llvm.load %287 : !llvm.ptr -> i64
          %317 = arith.muli %314, %316 : i64
          %318 = llvm.load %287 : !llvm.ptr -> i64
          %319 = llvm.load %287 : !llvm.ptr -> i64
          %320 = arith.muli %318, %319 : i64
          %321 = arith.addi %283, %320 : i64
          %322 = arith.cmpi sle, %321, %203 : i64
          cf.cond_br %322, ^bb60, ^bb61
          ^bb60:
            %323 = llvm.load %235 : !llvm.ptr -> i64
            %324 = llvm.getelementptr %217[%323] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %311, %324 : i64, !llvm.ptr
            %325 = llvm.load %235 : !llvm.ptr -> i64
            %326 = llvm.getelementptr %222[%325] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %317, %326 : i64, !llvm.ptr
            %327 = llvm.load %235 : !llvm.ptr -> i64
            %328 = llvm.getelementptr %227[%327] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %321, %328 : i64, !llvm.ptr
            %329 = llvm.load %235 : !llvm.ptr -> i64
            %330 = arith.constant 1 : i32
            %332 = arith.extsi %330 : i32 to i64
            %331 = arith.addi %329, %332 : i64
            llvm.store %331, %235 : i64, !llvm.ptr
            %333 = arith.constant 0 : i32
            %335 = arith.extsi %333 : i32 to i64
            %334 = arith.subi %335, %311 : i64
            %336 = llvm.load %235 : !llvm.ptr -> i64
            %337 = llvm.getelementptr %217[%336] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %334, %337 : i64, !llvm.ptr
            %338 = llvm.load %235 : !llvm.ptr -> i64
            %339 = llvm.getelementptr %222[%338] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %317, %339 : i64, !llvm.ptr
            %340 = llvm.load %235 : !llvm.ptr -> i64
            %341 = llvm.getelementptr %227[%340] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %321, %341 : i64, !llvm.ptr
            %342 = llvm.load %235 : !llvm.ptr -> i64
            %343 = arith.constant 1 : i32
            %345 = arith.extsi %343 : i32 to i64
            %344 = arith.addi %342, %345 : i64
            llvm.store %344, %235 : i64, !llvm.ptr
            %346 = llvm.load %235 : !llvm.ptr -> i64
            %347 = llvm.getelementptr %217[%346] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %317, %347 : i64, !llvm.ptr
            %348 = llvm.load %235 : !llvm.ptr -> i64
            %349 = llvm.getelementptr %222[%348] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %311, %349 : i64, !llvm.ptr
            %350 = llvm.load %235 : !llvm.ptr -> i64
            %351 = llvm.getelementptr %227[%350] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %321, %351 : i64, !llvm.ptr
            %352 = llvm.load %235 : !llvm.ptr -> i64
            %353 = arith.constant 1 : i32
            %355 = arith.extsi %353 : i32 to i64
            %354 = arith.addi %352, %355 : i64
            llvm.store %354, %235 : i64, !llvm.ptr
            %356 = arith.constant 0 : i32
            %358 = arith.extsi %356 : i32 to i64
            %357 = arith.subi %358, %317 : i64
            %359 = llvm.load %235 : !llvm.ptr -> i64
            %360 = llvm.getelementptr %217[%359] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %357, %360 : i64, !llvm.ptr
            %361 = llvm.load %235 : !llvm.ptr -> i64
            %362 = llvm.getelementptr %222[%361] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %311, %362 : i64, !llvm.ptr
            %363 = llvm.load %235 : !llvm.ptr -> i64
            %364 = llvm.getelementptr %227[%363] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %321, %364 : i64, !llvm.ptr
            %365 = llvm.load %235 : !llvm.ptr -> i64
            %366 = arith.constant 1 : i32
            %368 = arith.extsi %366 : i32 to i64
            %367 = arith.addi %365, %368 : i64
            llvm.store %367, %235 : i64, !llvm.ptr
            cf.br ^bb62
          ^bb61:
            cf.br ^bb62
          ^bb62:
          cf.br ^bb59
        ^bb58:
          cf.br ^bb59
        ^bb59:
        %369 = llvm.load %287 : !llvm.ptr -> i64
        %370 = arith.constant 1 : i32
        %372 = arith.extsi %370 : i32 to i64
        %371 = arith.addi %369, %372 : i64
        llvm.store %371, %287 : i64, !llvm.ptr
        cf.br ^bb54
      ^bb56:
      %373 = llvm.load %278 : !llvm.ptr -> i64
      %374 = arith.constant 1 : i32
      %376 = arith.extsi %374 : i32 to i64
      %375 = arith.addi %373, %376 : i64
      llvm.store %375, %278 : i64, !llvm.ptr
      cf.br ^bb51
    ^bb53:
    %378 = arith.muli %215, %213 : i64
    %379 = arith.constant 8 : i32
    %380 = arith.extsi %379 : i32 to i64
    %377 = func.call @calloc(%378, %380) : (i64, i64) -> !llvm.ptr
    %382 = arith.muli %215, %213 : i64
    %383 = arith.constant 8 : i32
    %384 = arith.extsi %383 : i32 to i64
    %381 = func.call @calloc(%382, %384) : (i64, i64) -> !llvm.ptr
    %386 = arith.muli %215, %213 : i64
    %387 = arith.constant 1 : i32
    %388 = arith.extsi %387 : i32 to i64
    %385 = func.call @calloc(%386, %388) : (i64, i64) -> !llvm.ptr
    %390 = arith.muli %215, %213 : i64
    %391 = arith.constant 8 : i32
    %392 = arith.extsi %391 : i32 to i64
    %389 = func.call @calloc(%390, %392) : (i64, i64) -> !llvm.ptr
    %394 = arith.muli %215, %213 : i64
    %395 = arith.constant 8 : i32
    %396 = arith.extsi %395 : i32 to i64
    %393 = func.call @calloc(%394, %396) : (i64, i64) -> !llvm.ptr
    %398 = arith.muli %215, %213 : i64
    %399 = arith.constant 1 : i32
    %400 = arith.extsi %399 : i32 to i64
    %397 = func.call @calloc(%398, %400) : (i64, i64) -> !llvm.ptr
    %401 = arith.remsi %211, %213 : i64
    %402 = llvm.mlir.constant(1 : i64) : i64
    %403 = llvm.alloca %402 x i64 : (i64) -> !llvm.ptr
    llvm.store %401, %403 : i64, !llvm.ptr
    %404 = llvm.load %403 : !llvm.ptr -> i64
    %405 = arith.constant 0 : i32
    %407 = arith.extsi %405 : i32 to i64
    %406 = arith.cmpi slt, %404, %407 : i64
    cf.cond_br %406, ^bb63, ^bb64
    ^bb63:
      %408 = llvm.load %403 : !llvm.ptr -> i64
      %410 = arith.constant 0 : i64
      %409 = arith.subi %410, %408 : i64
      llvm.store %409, %403 : i64, !llvm.ptr
      cf.br ^bb65
    ^bb64:
      cf.br ^bb65
    ^bb65:
    %411 = arith.constant 1 : i32
    %412 = arith.constant 0 : i32
    %414 = arith.extsi %412 : i32 to i64
    %413 = arith.muli %414, %213 : i64
    %415 = llvm.load %403 : !llvm.ptr -> i64
    %416 = arith.addi %413, %415 : i64
    %417 = arith.trunci %411 : i32 to i8
    %418 = llvm.getelementptr %385[%416] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %417, %418 : i8, !llvm.ptr
    %419 = arith.constant 0 : i32
    %421 = arith.extsi %419 : i32 to i64
    %420 = arith.muli %421, %213 : i64
    %422 = llvm.load %403 : !llvm.ptr -> i64
    %423 = arith.addi %420, %422 : i64
    %424 = llvm.getelementptr %377[%423] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %211, %424 : i64, !llvm.ptr
    %425 = arith.constant 1 : i32
    %426 = arith.constant 0 : i32
    %428 = arith.extsi %426 : i32 to i64
    %427 = arith.muli %428, %213 : i64
    %429 = llvm.load %403 : !llvm.ptr -> i64
    %430 = arith.addi %427, %429 : i64
    %431 = arith.extsi %425 : i32 to i64
    %432 = llvm.getelementptr %381[%430] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %431, %432 : i64, !llvm.ptr
    %433 = arith.constant 0 : i32
    %434 = arith.extsi %433 : i32 to i64
    %435 = llvm.mlir.constant(1 : i64) : i64
    %436 = llvm.alloca %435 x i64 : (i64) -> !llvm.ptr
    llvm.store %434, %436 : i64, !llvm.ptr
    cf.br ^bb66
    ^bb66:
    %437 = llvm.load %436 : !llvm.ptr -> i64
    %438 = llvm.load %235 : !llvm.ptr -> i64
    %439 = arith.cmpi slt, %437, %438 : i64
    cf.cond_br %439, ^bb67, ^bb68
    ^bb67:
      %441 = llvm.load %436 : !llvm.ptr -> i64
      %442 = llvm.getelementptr %217[%441] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %440 = llvm.load %442 : !llvm.ptr -> i64
      %444 = llvm.load %436 : !llvm.ptr -> i64
      %445 = llvm.getelementptr %222[%444] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %443 = llvm.load %445 : !llvm.ptr -> i64
      %447 = llvm.load %436 : !llvm.ptr -> i64
      %448 = llvm.getelementptr %227[%447] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %446 = llvm.load %448 : !llvm.ptr -> i64
      %449 = arith.constant 0 : i32
      %450 = arith.extsi %449 : i32 to i64
      %451 = llvm.mlir.constant(1 : i64) : i64
      %452 = llvm.alloca %451 x i64 : (i64) -> !llvm.ptr
      llvm.store %450, %452 : i64, !llvm.ptr
      cf.br ^bb69
      ^bb69:
      %453 = llvm.load %452 : !llvm.ptr -> i64
      %454 = arith.cmpi sle, %453, %203 : i64
      cf.cond_br %454, ^bb70, ^bb71
      ^bb70:
        %455 = arith.constant 0 : i32
        %456 = arith.extsi %455 : i32 to i64
        llvm.store %456, %403 : i64, !llvm.ptr
        cf.br ^bb72
        ^bb72:
        %457 = llvm.load %403 : !llvm.ptr -> i64
        %458 = arith.cmpi slt, %457, %213 : i64
        cf.cond_br %458, ^bb73, ^bb74
        ^bb73:
          %460 = llvm.load %452 : !llvm.ptr -> i64
          %461 = arith.muli %460, %213 : i64
          %462 = llvm.load %403 : !llvm.ptr -> i64
          %463 = arith.addi %461, %462 : i64
          %464 = llvm.getelementptr %385[%463] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %459 = llvm.load %464 : !llvm.ptr -> i8
          %465 = llvm.load %452 : !llvm.ptr -> i64
          %466 = arith.muli %465, %213 : i64
          %467 = llvm.load %403 : !llvm.ptr -> i64
          %468 = arith.addi %466, %467 : i64
          %469 = llvm.getelementptr %397[%468] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %459, %469 : i8, !llvm.ptr
          %471 = llvm.load %452 : !llvm.ptr -> i64
          %472 = arith.muli %471, %213 : i64
          %473 = llvm.load %403 : !llvm.ptr -> i64
          %474 = arith.addi %472, %473 : i64
          %475 = llvm.getelementptr %377[%474] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %470 = llvm.load %475 : !llvm.ptr -> i64
          %476 = llvm.load %452 : !llvm.ptr -> i64
          %477 = arith.muli %476, %213 : i64
          %478 = llvm.load %403 : !llvm.ptr -> i64
          %479 = arith.addi %477, %478 : i64
          %480 = llvm.getelementptr %389[%479] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %470, %480 : i64, !llvm.ptr
          %482 = llvm.load %452 : !llvm.ptr -> i64
          %483 = arith.muli %482, %213 : i64
          %484 = llvm.load %403 : !llvm.ptr -> i64
          %485 = arith.addi %483, %484 : i64
          %486 = llvm.getelementptr %381[%485] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %481 = llvm.load %486 : !llvm.ptr -> i64
          %487 = llvm.load %452 : !llvm.ptr -> i64
          %488 = arith.muli %487, %213 : i64
          %489 = llvm.load %403 : !llvm.ptr -> i64
          %490 = arith.addi %488, %489 : i64
          %491 = llvm.getelementptr %393[%490] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %481, %491 : i64, !llvm.ptr
          %492 = llvm.load %403 : !llvm.ptr -> i64
          %493 = arith.constant 1 : i32
          %495 = arith.extsi %493 : i32 to i64
          %494 = arith.addi %492, %495 : i64
          llvm.store %494, %403 : i64, !llvm.ptr
          cf.br ^bb72
        ^bb74:
        %496 = llvm.load %452 : !llvm.ptr -> i64
        %497 = arith.constant 1 : i32
        %499 = arith.extsi %497 : i32 to i64
        %498 = arith.addi %496, %499 : i64
        llvm.store %498, %452 : i64, !llvm.ptr
        cf.br ^bb69
      ^bb71:
      %500 = arith.divsi %203, %446 : i64
      %501 = arith.constant 1 : i32
      %502 = arith.extsi %501 : i32 to i64
      %503 = llvm.mlir.constant(1 : i64) : i64
      %504 = llvm.alloca %503 x i64 : (i64) -> !llvm.ptr
      llvm.store %502, %504 : i64, !llvm.ptr
      cf.br ^bb75
      ^bb75:
      %505 = llvm.load %504 : !llvm.ptr -> i64
      %506 = arith.cmpi sle, %505, %500 : i64
      cf.cond_br %506, ^bb76, ^bb77
      ^bb76:
        %507 = llvm.load %504 : !llvm.ptr -> i64
        %508 = arith.muli %446, %507 : i64
        %509 = llvm.load %504 : !llvm.ptr -> i64
        %510 = arith.muli %440, %509 : i64
        %511 = arith.muli %510, %208 : i64
        %512 = llvm.load %504 : !llvm.ptr -> i64
        %513 = arith.muli %443, %512 : i64
        %514 = arith.addi %511, %513 : i64
        %515 = arith.constant 0 : i32
        %516 = arith.extsi %515 : i32 to i64
        llvm.store %516, %452 : i64, !llvm.ptr
        cf.br ^bb78
        ^bb78:
        %517 = llvm.load %452 : !llvm.ptr -> i64
        %518 = arith.addi %517, %508 : i64
        %519 = arith.cmpi sle, %518, %203 : i64
        cf.cond_br %519, ^bb79, ^bb80
        ^bb79:
          %520 = arith.constant 0 : i32
          %521 = arith.extsi %520 : i32 to i64
          llvm.store %521, %403 : i64, !llvm.ptr
          cf.br ^bb81
          ^bb81:
          %522 = llvm.load %403 : !llvm.ptr -> i64
          %523 = arith.cmpi slt, %522, %213 : i64
          cf.cond_br %523, ^bb82, ^bb83
          ^bb82:
            %525 = llvm.load %452 : !llvm.ptr -> i64
            %526 = arith.muli %525, %213 : i64
            %527 = llvm.load %403 : !llvm.ptr -> i64
            %528 = arith.addi %526, %527 : i64
            %529 = llvm.getelementptr %397[%528] : (!llvm.ptr, i64) -> !llvm.ptr, i8
            %524 = llvm.load %529 : !llvm.ptr -> i8
            %530 = arith.constant 0 : i32
            %532 = arith.extsi %524 : i8 to i32
            %531 = arith.cmpi ne, %532, %530 : i32
            cf.cond_br %531, ^bb84, ^bb85
            ^bb84:
              %534 = llvm.load %452 : !llvm.ptr -> i64
              %535 = arith.muli %534, %213 : i64
              %536 = llvm.load %403 : !llvm.ptr -> i64
              %537 = arith.addi %535, %536 : i64
              %538 = llvm.getelementptr %389[%537] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %533 = llvm.load %538 : !llvm.ptr -> i64
              %540 = llvm.load %452 : !llvm.ptr -> i64
              %541 = arith.muli %540, %213 : i64
              %542 = llvm.load %403 : !llvm.ptr -> i64
              %543 = arith.addi %541, %542 : i64
              %544 = llvm.getelementptr %393[%543] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %539 = llvm.load %544 : !llvm.ptr -> i64
              %545 = llvm.load %452 : !llvm.ptr -> i64
              %546 = arith.addi %545, %508 : i64
              %547 = arith.addi %533, %514 : i64
              %548 = arith.remsi %547, %213 : i64
              %549 = llvm.mlir.constant(1 : i64) : i64
              %550 = llvm.alloca %549 x i64 : (i64) -> !llvm.ptr
              llvm.store %548, %550 : i64, !llvm.ptr
              %551 = llvm.load %550 : !llvm.ptr -> i64
              %552 = arith.constant 0 : i32
              %554 = arith.extsi %552 : i32 to i64
              %553 = arith.cmpi slt, %551, %554 : i64
              cf.cond_br %553, ^bb87, ^bb88
              ^bb87:
                %555 = llvm.load %550 : !llvm.ptr -> i64
                %557 = arith.constant 0 : i64
                %556 = arith.subi %557, %555 : i64
                llvm.store %556, %550 : i64, !llvm.ptr
                cf.br ^bb89
              ^bb88:
                cf.br ^bb89
              ^bb89:
              cf.br ^bb90
              ^bb90:
              %559 = arith.muli %546, %213 : i64
              %560 = llvm.load %550 : !llvm.ptr -> i64
              %561 = arith.addi %559, %560 : i64
              %562 = llvm.getelementptr %385[%561] : (!llvm.ptr, i64) -> !llvm.ptr, i8
              %558 = llvm.load %562 : !llvm.ptr -> i8
              %563 = arith.constant 0 : i32
              %565 = arith.extsi %558 : i8 to i32
              %564 = arith.cmpi ne, %565, %563 : i32
              cf.cond_br %564, ^bb91, ^bb92
              ^bb91:
                %567 = arith.muli %546, %213 : i64
                %568 = llvm.load %550 : !llvm.ptr -> i64
                %569 = arith.addi %567, %568 : i64
                %570 = llvm.getelementptr %377[%569] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                %566 = llvm.load %570 : !llvm.ptr -> i64
                %571 = arith.cmpi eq, %566, %547 : i64
                cf.cond_br %571, ^bb93, ^bb94
                ^bb93:
                  %573 = arith.muli %546, %213 : i64
                  %574 = llvm.load %550 : !llvm.ptr -> i64
                  %575 = arith.addi %573, %574 : i64
                  %576 = llvm.getelementptr %381[%575] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                  %572 = llvm.load %576 : !llvm.ptr -> i64
                  %577 = arith.addi %572, %539 : i64
                  %578 = arith.muli %546, %213 : i64
                  %579 = llvm.load %550 : !llvm.ptr -> i64
                  %580 = arith.addi %578, %579 : i64
                  %581 = llvm.getelementptr %381[%580] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                  llvm.store %577, %581 : i64, !llvm.ptr
                  cf.br ^bb92
                ^bb94:
                  cf.br ^bb95
                ^bb95:
                %582 = llvm.load %550 : !llvm.ptr -> i64
                %583 = arith.constant 1 : i32
                %585 = arith.extsi %583 : i32 to i64
                %584 = arith.addi %582, %585 : i64
                llvm.store %584, %550 : i64, !llvm.ptr
                %586 = llvm.load %550 : !llvm.ptr -> i64
                %587 = arith.cmpi eq, %586, %213 : i64
                cf.cond_br %587, ^bb96, ^bb97
                ^bb96:
                  %588 = arith.constant 0 : i32
                  %589 = arith.extsi %588 : i32 to i64
                  llvm.store %589, %550 : i64, !llvm.ptr
                  cf.br ^bb98
                ^bb97:
                  cf.br ^bb98
                ^bb98:
                cf.br ^bb90
              ^bb92:
              %591 = arith.muli %546, %213 : i64
              %592 = llvm.load %550 : !llvm.ptr -> i64
              %593 = arith.addi %591, %592 : i64
              %594 = llvm.getelementptr %385[%593] : (!llvm.ptr, i64) -> !llvm.ptr, i8
              %590 = llvm.load %594 : !llvm.ptr -> i8
              %595 = arith.constant 0 : i32
              %597 = arith.extsi %590 : i8 to i32
              %596 = arith.cmpi eq, %597, %595 : i32
              cf.cond_br %596, ^bb99, ^bb100
              ^bb99:
                %598 = arith.constant 1 : i32
                %599 = arith.muli %546, %213 : i64
                %600 = llvm.load %550 : !llvm.ptr -> i64
                %601 = arith.addi %599, %600 : i64
                %602 = arith.trunci %598 : i32 to i8
                %603 = llvm.getelementptr %385[%601] : (!llvm.ptr, i64) -> !llvm.ptr, i8
                llvm.store %602, %603 : i8, !llvm.ptr
                %604 = arith.muli %546, %213 : i64
                %605 = llvm.load %550 : !llvm.ptr -> i64
                %606 = arith.addi %604, %605 : i64
                %607 = llvm.getelementptr %377[%606] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                llvm.store %547, %607 : i64, !llvm.ptr
                %608 = arith.muli %546, %213 : i64
                %609 = llvm.load %550 : !llvm.ptr -> i64
                %610 = arith.addi %608, %609 : i64
                %611 = llvm.getelementptr %381[%610] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                llvm.store %539, %611 : i64, !llvm.ptr
                cf.br ^bb101
              ^bb100:
                cf.br ^bb101
              ^bb101:
              cf.br ^bb86
            ^bb85:
              cf.br ^bb86
            ^bb86:
            %612 = llvm.load %403 : !llvm.ptr -> i64
            %613 = arith.constant 1 : i32
            %615 = arith.extsi %613 : i32 to i64
            %614 = arith.addi %612, %615 : i64
            llvm.store %614, %403 : i64, !llvm.ptr
            cf.br ^bb81
          ^bb83:
          %616 = llvm.load %452 : !llvm.ptr -> i64
          %617 = arith.constant 1 : i32
          %619 = arith.extsi %617 : i32 to i64
          %618 = arith.addi %616, %619 : i64
          llvm.store %618, %452 : i64, !llvm.ptr
          cf.br ^bb78
        ^bb80:
        %620 = llvm.load %504 : !llvm.ptr -> i64
        %621 = arith.constant 1 : i32
        %623 = arith.extsi %621 : i32 to i64
        %622 = arith.addi %620, %623 : i64
        llvm.store %622, %504 : i64, !llvm.ptr
        cf.br ^bb75
      ^bb77:
      %624 = llvm.load %436 : !llvm.ptr -> i64
      %625 = arith.constant 1 : i32
      %627 = arith.extsi %625 : i32 to i64
      %626 = arith.addi %624, %627 : i64
      llvm.store %626, %436 : i64, !llvm.ptr
      cf.br ^bb66
    ^bb68:
    %628 = arith.constant 0 : i32
    %629 = arith.extsi %628 : i32 to i64
    %630 = llvm.mlir.constant(1 : i64) : i64
    %631 = llvm.alloca %630 x i64 : (i64) -> !llvm.ptr
    llvm.store %629, %631 : i64, !llvm.ptr
    %632 = arith.constant 0 : i32
    %633 = arith.extsi %632 : i32 to i64
    %634 = llvm.mlir.constant(1 : i64) : i64
    %635 = llvm.alloca %634 x i64 : (i64) -> !llvm.ptr
    llvm.store %633, %635 : i64, !llvm.ptr
    cf.br ^bb102
    ^bb102:
    %636 = llvm.load %635 : !llvm.ptr -> i64
    %637 = arith.cmpi sle, %636, %203 : i64
    cf.cond_br %637, ^bb103, ^bb104
    ^bb103:
      %638 = arith.constant 0 : i32
      %639 = arith.extsi %638 : i32 to i64
      %640 = llvm.mlir.constant(1 : i64) : i64
      %641 = llvm.alloca %640 x i64 : (i64) -> !llvm.ptr
      llvm.store %639, %641 : i64, !llvm.ptr
      cf.br ^bb105
      ^bb105:
      %642 = llvm.load %641 : !llvm.ptr -> i64
      %643 = llvm.load %635 : !llvm.ptr -> i64
      %644 = arith.subi %203, %643 : i64
      %645 = arith.cmpi sle, %642, %644 : i64
      cf.cond_br %645, ^bb106, ^bb107
      ^bb106:
        %646 = arith.constant 0 : i32
        %647 = arith.extsi %646 : i32 to i64
        llvm.store %647, %403 : i64, !llvm.ptr
        cf.br ^bb108
        ^bb108:
        %648 = llvm.load %403 : !llvm.ptr -> i64
        %649 = arith.cmpi slt, %648, %213 : i64
        cf.cond_br %649, ^bb109, ^bb110
        ^bb109:
          %651 = llvm.load %635 : !llvm.ptr -> i64
          %652 = arith.muli %651, %213 : i64
          %653 = llvm.load %403 : !llvm.ptr -> i64
          %654 = arith.addi %652, %653 : i64
          %655 = llvm.getelementptr %385[%654] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %650 = llvm.load %655 : !llvm.ptr -> i8
          %656 = arith.constant 0 : i32
          %658 = arith.extsi %650 : i8 to i32
          %657 = arith.cmpi ne, %658, %656 : i32
          cf.cond_br %657, ^bb111, ^bb112
          ^bb111:
            %660 = llvm.load %635 : !llvm.ptr -> i64
            %661 = arith.muli %660, %213 : i64
            %662 = llvm.load %403 : !llvm.ptr -> i64
            %663 = arith.addi %661, %662 : i64
            %664 = llvm.getelementptr %377[%663] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %659 = llvm.load %664 : !llvm.ptr -> i64
            %666 = llvm.load %635 : !llvm.ptr -> i64
            %667 = arith.muli %666, %213 : i64
            %668 = llvm.load %403 : !llvm.ptr -> i64
            %669 = arith.addi %667, %668 : i64
            %670 = llvm.getelementptr %381[%669] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %665 = llvm.load %670 : !llvm.ptr -> i64
            %671 = arith.constant 0 : i32
            %672 = arith.extsi %671 : i32 to i64
            %673 = arith.remsi %659, %213 : i64
            %674 = llvm.mlir.constant(1 : i64) : i64
            %675 = llvm.alloca %674 x i64 : (i64) -> !llvm.ptr
            llvm.store %673, %675 : i64, !llvm.ptr
            %676 = llvm.load %675 : !llvm.ptr -> i64
            %677 = arith.constant 0 : i32
            %679 = arith.extsi %677 : i32 to i64
            %678 = arith.cmpi slt, %676, %679 : i64
            cf.cond_br %678, ^bb114, ^bb115
            ^bb114:
              %680 = llvm.load %675 : !llvm.ptr -> i64
              %682 = arith.constant 0 : i64
              %681 = arith.subi %682, %680 : i64
              llvm.store %681, %675 : i64, !llvm.ptr
              cf.br ^bb116
            ^bb115:
              cf.br ^bb116
            ^bb116:
            cf.br ^bb117(%672 : i64)
            ^bb117(%683: i64):
            %685 = llvm.load %641 : !llvm.ptr -> i64
            %686 = arith.muli %685, %213 : i64
            %687 = llvm.load %675 : !llvm.ptr -> i64
            %688 = arith.addi %686, %687 : i64
            %689 = llvm.getelementptr %385[%688] : (!llvm.ptr, i64) -> !llvm.ptr, i8
            %684 = llvm.load %689 : !llvm.ptr -> i8
            %690 = arith.constant 0 : i32
            %692 = arith.extsi %684 : i8 to i32
            %691 = arith.cmpi ne, %692, %690 : i32
            cf.cond_br %691, ^bb118(%683 : i64), ^bb119(%683 : i64)
            ^bb118(%693: i64):
              %695 = llvm.load %641 : !llvm.ptr -> i64
              %696 = arith.muli %695, %213 : i64
              %697 = llvm.load %675 : !llvm.ptr -> i64
              %698 = arith.addi %696, %697 : i64
              %699 = llvm.getelementptr %377[%698] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %694 = llvm.load %699 : !llvm.ptr -> i64
              %700 = arith.cmpi eq, %694, %659 : i64
              cf.cond_br %700, ^bb120, ^bb121
              ^bb120:
                %702 = llvm.load %641 : !llvm.ptr -> i64
                %703 = arith.muli %702, %213 : i64
                %704 = llvm.load %675 : !llvm.ptr -> i64
                %705 = arith.addi %703, %704 : i64
                %706 = llvm.getelementptr %381[%705] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                %701 = llvm.load %706 : !llvm.ptr -> i64
                cf.br ^bb119(%701 : i64)
              ^bb121:
                cf.br ^bb122(%693 : i64)
              ^bb122(%707: i64):
              %708 = llvm.load %675 : !llvm.ptr -> i64
              %709 = arith.constant 1 : i32
              %711 = arith.extsi %709 : i32 to i64
              %710 = arith.addi %708, %711 : i64
              llvm.store %710, %675 : i64, !llvm.ptr
              %712 = llvm.load %675 : !llvm.ptr -> i64
              %713 = arith.cmpi eq, %712, %213 : i64
              cf.cond_br %713, ^bb123, ^bb124
              ^bb123:
                %714 = arith.constant 0 : i32
                %715 = arith.extsi %714 : i32 to i64
                llvm.store %715, %675 : i64, !llvm.ptr
                cf.br ^bb125
              ^bb124:
                cf.br ^bb125
              ^bb125:
              cf.br ^bb117(%707 : i64)
            ^bb119(%716: i64):
            %717 = arith.constant 0 : i32
            %719 = arith.extsi %717 : i32 to i64
            %718 = arith.cmpi ne, %716, %719 : i64
            cf.cond_br %718, ^bb126, ^bb127
            ^bb126:
              %720 = llvm.load %631 : !llvm.ptr -> i64
              %721 = arith.muli %665, %716 : i64
              %722 = arith.addi %720, %721 : i64
              llvm.store %722, %631 : i64, !llvm.ptr
              cf.br ^bb128
            ^bb127:
              cf.br ^bb128
            ^bb128:
            cf.br ^bb113
          ^bb112:
            cf.br ^bb113
          ^bb113:
          %723 = llvm.load %403 : !llvm.ptr -> i64
          %724 = arith.constant 1 : i32
          %726 = arith.extsi %724 : i32 to i64
          %725 = arith.addi %723, %726 : i64
          llvm.store %725, %403 : i64, !llvm.ptr
          cf.br ^bb108
        ^bb110:
        %727 = llvm.load %641 : !llvm.ptr -> i64
        %728 = arith.constant 1 : i32
        %730 = arith.extsi %728 : i32 to i64
        %729 = arith.addi %727, %730 : i64
        llvm.store %729, %641 : i64, !llvm.ptr
        cf.br ^bb105
      ^bb107:
      %731 = llvm.load %635 : !llvm.ptr -> i64
      %732 = arith.constant 1 : i32
      %734 = arith.extsi %732 : i32 to i64
      %733 = arith.addi %731, %734 : i64
      llvm.store %733, %635 : i64, !llvm.ptr
      cf.br ^bb102
    ^bb104:
    %735 = llvm.load %631 : !llvm.ptr -> i64
    %736 = arith.constant 1 : i32
    %738 = arith.extsi %736 : i32 to i64
    %737 = arith.subi %735, %738 : i64
    llvm.store %737, %631 : i64, !llvm.ptr
    %739 = arith.constant 0 : i32
    %740 = arith.extsi %739 : i32 to i64
    llvm.store %740, %436 : i64, !llvm.ptr
    cf.br ^bb129
    ^bb129:
    %741 = llvm.load %436 : !llvm.ptr -> i64
    %742 = llvm.load %235 : !llvm.ptr -> i64
    %743 = arith.cmpi slt, %741, %742 : i64
    cf.cond_br %743, ^bb130, ^bb131
    ^bb130:
      %744 = llvm.load %631 : !llvm.ptr -> i64
      %745 = arith.constant 2 : i32
      %747 = llvm.load %436 : !llvm.ptr -> i64
      %748 = llvm.getelementptr %227[%747] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %746 = llvm.load %748 : !llvm.ptr -> i64
      %750 = arith.extsi %745 : i32 to i64
      %749 = arith.muli %750, %746 : i64
      %751 = arith.divsi %203, %749 : i64
      %752 = arith.subi %744, %751 : i64
      llvm.store %752, %631 : i64, !llvm.ptr
      %753 = llvm.load %436 : !llvm.ptr -> i64
      %754 = arith.constant 1 : i32
      %756 = arith.extsi %754 : i32 to i64
      %755 = arith.addi %753, %756 : i64
      llvm.store %755, %436 : i64, !llvm.ptr
      cf.br ^bb129
    ^bb131:
    %757 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %758 = llvm.load %631 : !llvm.ptr -> i64
    %759 = llvm.call @printf(%757, %758) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %760 = arith.constant 0 : i32
    func.return %760 : i32
  }
}