Problem 283

Sum perimeters of integer triangles with integral area/perimeter ratio <= 1000.

Answer28038042525570324
Output28038042525570324
StatusPASS
Native helperno
Runtime1520 ms
Peak memory63744 KB
Time complexityO(n^4) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^4)O(n^2)
Space complexityO(n^2)O(n^2)
ApproachFlow solutionBottom-up DP
VerdictSuboptimal

Flow source

# Project Euler 283
# Sum perimeters of integer triangles with integral area/perimeter ratio <= 1000.

import euler.nt { isqrt }

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

function factorize(num0: i64, spf: ptr<i32>, pr: ptr<i32>, ex: ptr<i32>) -> i64 {
    let mut num: i64 = num0
    let mut cnt: i64 = 0
    while num > 1 {
        let p: i64 = spf[num] as i64
        let mut e: i64 = 1
        num = num / p
        while num > 1 && (spf[num] as i64) == p {
            e = e + 1
            num = num / p
        }
        pr[cnt] = p as i32
        ex[cnt] = e as i32
        cnt = cnt + 1
    }
    return cnt
}

function merge_factors(ap: ptr<i32>, ae: ptr<i32>, ac: i64,
                       bp: ptr<i32>, be: ptr<i32>, bc: i64,
                       mp: ptr<i32>, me: ptr<i32>) -> i64 {
    let mut i: i64 = 0
    let mut j: i64 = 0
    let mut c: i64 = 0
    while i < ac && j < bc {
        let pa: i64 = ap[i] as i64
        let pb: i64 = bp[j] as i64
        if pa == pb {
            mp[c] = ap[i]
            me[c] = (ae[i] as i64 + be[j] as i64) as i32
            c = c + 1
            i = i + 1
            j = j + 1
        } elif pa < pb {
            mp[c] = ap[i]
            me[c] = ae[i]
            c = c + 1
            i = i + 1
        } else {
            mp[c] = bp[j]
            me[c] = be[j]
            c = c + 1
            j = j + 1
        }
    }
    while i < ac {
        mp[c] = ap[i]
        me[c] = ae[i]
        c = c + 1
        i = i + 1
    }
    while j < bc {
        mp[c] = bp[j]
        me[c] = be[j]
        c = c + 1
        j = j + 1
    }
    return c
}

function main() -> i32 {
    let limit_k: i64 = 1000
    let max_r: i64 = 2 * limit_k
    let max_n: i64 = max_r * max_r
    let max_x: i64 = isqrt(3 * max_n)
    let max_m: i64 = max_n + max_x * max_x

    let spf: ptr<i32> = calloc(max_m + 1, 4)
    let squares: ptr<i64> = calloc(max_x + 1, 8)
    let fn_p: ptr<i32> = calloc(32, 4)
    let fn_e: ptr<i32> = calloc(32, 4)
    let fm_p: ptr<i32> = calloc(32, 4)
    let fm_e: ptr<i32> = calloc(32, 4)
    let mg_p: ptr<i32> = calloc(64, 4)
    let mg_e: ptr<i32> = calloc(64, 4)
    let divs: ptr<i64> = calloc(8192, 8)
    if spf == null { return 1 }

    spf[1] = 1
    let mut i: i64 = 2
    while i <= max_m {
        spf[i] = 2
        i = i + 2
    }
    i = 3
    while i <= max_m {
        if spf[i] == 0 {
            spf[i] = i as i32
            let ii: i64 = i * i
            if ii <= max_m {
                let mut j: i64 = ii
                let step: i64 = i << 1
                while j <= max_m {
                    if spf[j] == 0 { spf[j] = i as i32 }
                    j = j + step
                }
            }
        }
        i = i + 2
    }
    i = 0
    while i <= max_x {
        squares[i] = i * i
        i = i + 1
    }

    let mut total: i64 = 0
    let mut r: i64 = 2
    while r <= max_r {
        let n: i64 = r * r
        let max_x_r: i64 = isqrt(3 * n)
        let limit_d: i64 = 2 * n
        let fn_cnt: i64 = factorize(n, spf, fn_p, fn_e)

        let mut x: i64 = 1
        while x <= max_x_r {
            let m: i64 = squares[x] + n
            let fm_cnt: i64 = factorize(m, spf, fm_p, fm_e)
            let mg_cnt: i64 = merge_factors(fn_p, fn_e, fn_cnt, fm_p, fm_e, fm_cnt, mg_p, mg_e)

            let mut nd: i64 = 0
            divs[0] = 1
            nd = 1
            let mut fi: i64 = 0
            while fi < mg_cnt {
                let p: i64 = mg_p[fi] as i64
                let e: i64 = mg_e[fi] as i64
                let old_nd: i64 = nd
                let mut mult: i64 = 1
                let mut ee: i64 = 0
                while ee <= e {
                    if mult > limit_d { break }
                    if ee > 0 {
                        let mut j: i64 = 0
                        while j < old_nd {
                            let v: i64 = divs[j] * mult
                            if v <= limit_d {
                                divs[nd] = v
                                nd = nd + 1
                            }
                            j = j + 1
                        }
                    }
                    mult = mult * p
                    ee = ee + 1
                }
                fi = fi + 1
            }

            let mut di: i64 = 0
            while di < nd {
                let d: i64 = divs[di]
                let nd_val: i64 = n + d
                if nd_val % x == 0 {
                    let y: i64 = nd_val / x
                    if y >= x {
                        let numz: i64 = n * (x + y)
                        if numz % d == 0 {
                            let z: i64 = numz / d
                            if z >= y {
                                total = total + 2 * (x + y + z)
                            }
                        }
                    }
                }
                di = di + 1
            }
            x = x + 1
        }
        r = r + 2
    }

    free(spf); free(squares); free(fn_p); free(fn_e); free(fm_p); free(fm_e)
    free(mg_p); free(mg_e); free(divs)
    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 factorize_i64_ptr_i32_ptr_i32_ptr_i32(int64_t num0, int32_t* spf, int32_t* pr, int32_t* ex);
int64_t merge_factors_ptr_i32_ptr_i32_i64_ptr_i32_ptr_i32_i64_ptr_i32_ptr_i32(int32_t* ap, int32_t* ae, int64_t ac, int32_t* bp, int32_t* be, int64_t bc, int32_t* mp, int32_t* me);
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 factorize_i64_ptr_i32_ptr_i32_ptr_i32(int64_t num0, int32_t* spf, int32_t* pr, int32_t* ex) {
    int64_t num = num0;
    int64_t cnt = 0;
    while (num > 1) {
        int64_t p = ((int64_t)(spf[num]));
        int64_t e = 1;
        num = FLOW_CHECKED_DIV((num), (p));
        while ((num > 1 && ((int64_t)(spf[num])) == p)) {
            e = (e + 1);
            num = FLOW_CHECKED_DIV((num), (p));
        }
        pr[cnt] = ((int32_t)(p));
        ex[cnt] = ((int32_t)(e));
        cnt = (cnt + 1);
    }
    return cnt;
}

int64_t merge_factors_ptr_i32_ptr_i32_i64_ptr_i32_ptr_i32_i64_ptr_i32_ptr_i32(int32_t* ap, int32_t* ae, int64_t ac, int32_t* bp, int32_t* be, int64_t bc, int32_t* mp, int32_t* me) {
    int64_t i = 0;
    int64_t j = 0;
    int64_t c = 0;
    while ((i < ac && j < bc)) {
        int64_t pa = ((int64_t)(ap[i]));
        int64_t pb = ((int64_t)(bp[j]));
        if (pa == pb) {
            mp[c] = ap[i];
            me[c] = ((int32_t)((((int64_t)(ae[i])) + ((int64_t)(be[j])))));
            c = (c + 1);
            i = (i + 1);
            j = (j + 1);
        } else if (pa < pb) {
            mp[c] = ap[i];
            me[c] = ae[i];
            c = (c + 1);
            i = (i + 1);
        } else {
            mp[c] = bp[j];
            me[c] = be[j];
            c = (c + 1);
            j = (j + 1);
        }
    }
    while (i < ac) {
        mp[c] = ap[i];
        me[c] = ae[i];
        c = (c + 1);
        i = (i + 1);
    }
    while (j < bc) {
        mp[c] = bp[j];
        me[c] = be[j];
        c = (c + 1);
        j = (j + 1);
    }
    return c;
}

int32_t main(void) {
    int64_t limit_k = 1000;
    int64_t max_r = (2 * limit_k);
    int64_t max_n = (max_r * max_r);
    int64_t max_x = isqrt_i64((3 * max_n));
    int64_t max_m = (max_n + (max_x * max_x));
    int32_t* spf = (int32_t*)(calloc((max_m + 1), 4));
    int64_t* squares = (int64_t*)(calloc((max_x + 1), 8));
    int32_t* fn_p = (int32_t*)(calloc(32, 4));
    int32_t* fn_e = (int32_t*)(calloc(32, 4));
    int32_t* fm_p = (int32_t*)(calloc(32, 4));
    int32_t* fm_e = (int32_t*)(calloc(32, 4));
    int32_t* mg_p = (int32_t*)(calloc(64, 4));
    int32_t* mg_e = (int32_t*)(calloc(64, 4));
    int64_t* divs = (int64_t*)(calloc(8192, 8));
    if (spf == NULL) {
        return 1;
    }
    spf[1] = 1;
    int64_t i = 2;
    while (i <= max_m) {
        spf[i] = 2;
        i = (i + 2);
    }
    i = 3;
    while (i <= max_m) {
        if (spf[i] == 0) {
            spf[i] = ((int32_t)(i));
            int64_t ii = (i * i);
            if (ii <= max_m) {
                int64_t j = ii;
                int64_t step = FLOW_CHECKED_SHL((i), (1));
                while (j <= max_m) {
                    if (spf[j] == 0) {
                        spf[j] = ((int32_t)(i));
                    }
                    j = (j + step);
                }
            }
        }
        i = (i + 2);
    }
    i = 0;
    while (i <= max_x) {
        squares[i] = (i * i);
        i = (i + 1);
    }
    int64_t total = 0;
    int64_t r = 2;
    while (r <= max_r) {
        int64_t n = (r * r);
        int64_t max_x_r = isqrt_i64((3 * n));
        int64_t limit_d = (2 * n);
        int64_t fn_cnt = factorize_i64_ptr_i32_ptr_i32_ptr_i32(n, spf, fn_p, fn_e);
        int64_t x = 1;
        while (x <= max_x_r) {
            int64_t m = (squares[x] + n);
            int64_t fm_cnt = factorize_i64_ptr_i32_ptr_i32_ptr_i32(m, spf, fm_p, fm_e);
            int64_t mg_cnt = merge_factors_ptr_i32_ptr_i32_i64_ptr_i32_ptr_i32_i64_ptr_i32_ptr_i32(fn_p, fn_e, fn_cnt, fm_p, fm_e, fm_cnt, mg_p, mg_e);
            int64_t nd = 0;
            divs[0] = 1;
            nd = 1;
            int64_t fi = 0;
            while (fi < mg_cnt) {
                int64_t p = ((int64_t)(mg_p[fi]));
                int64_t e = ((int64_t)(mg_e[fi]));
                int64_t old_nd = nd;
                int64_t mult = 1;
                int64_t ee = 0;
                while (ee <= e) {
                    if (mult > limit_d) {
                        break;
                    }
                    if (ee > 0) {
                        int64_t j = 0;
                        while (j < old_nd) {
                            int64_t v = (divs[j] * mult);
                            if (v <= limit_d) {
                                divs[nd] = v;
                                nd = (nd + 1);
                            }
                            j = (j + 1);
                        }
                    }
                    mult = (mult * p);
                    ee = (ee + 1);
                }
                fi = (fi + 1);
            }
            int64_t di = 0;
            while (di < nd) {
                int64_t d = divs[di];
                int64_t nd_val = (n + d);
                if (FLOW_CHECKED_MOD((nd_val), (x)) == 0) {
                    int64_t y = FLOW_CHECKED_DIV((nd_val), (x));
                    if (y >= x) {
                        int64_t numz = (n * (x + y));
                        if (FLOW_CHECKED_MOD((numz), (d)) == 0) {
                            int64_t z = FLOW_CHECKED_DIV((numz), (d));
                            if (z >= y) {
                                total = (total + (2 * ((x + y) + z)));
                            }
                        }
                    }
                }
                di = (di + 1);
            }
            x = (x + 1);
        }
        r = (r + 2);
    }
    free(spf);
    free(squares);
    free(fn_p);
    free(fn_e);
    free(fm_p);
    free(fm_e);
    free(mg_p);
    free(mg_e);
    free(divs);
    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 @factorize(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr) -> 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 = arith.constant 0 : i32
    %178 = arith.extsi %177 : i32 to i64
    %179 = llvm.mlir.constant(1 : i64) : i64
    %180 = llvm.alloca %179 x i64 : (i64) -> !llvm.ptr
    llvm.store %178, %180 : i64, !llvm.ptr
    cf.br ^bb42
    ^bb42:
    %181 = llvm.load %176 : !llvm.ptr -> i64
    %182 = arith.constant 1 : i32
    %184 = arith.extsi %182 : i32 to i64
    %183 = arith.cmpi sgt, %181, %184 : i64
    cf.cond_br %183, ^bb43, ^bb44
    ^bb43:
      %186 = llvm.load %176 : !llvm.ptr -> i64
      %187 = llvm.getelementptr %arg1[%186] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %185 = llvm.load %187 : !llvm.ptr -> i32
      %188 = arith.extsi %185 : i32 to i64
      %189 = arith.constant 1 : i32
      %190 = arith.extsi %189 : i32 to i64
      %191 = llvm.mlir.constant(1 : i64) : i64
      %192 = llvm.alloca %191 x i64 : (i64) -> !llvm.ptr
      llvm.store %190, %192 : i64, !llvm.ptr
      %193 = llvm.load %176 : !llvm.ptr -> i64
      %194 = arith.divsi %193, %188 : i64
      llvm.store %194, %176 : i64, !llvm.ptr
      cf.br ^bb45
      ^bb45:
      %195 = llvm.load %176 : !llvm.ptr -> i64
      %196 = arith.constant 1 : i32
      %198 = arith.extsi %196 : i32 to i64
      %197 = arith.cmpi sgt, %195, %198 : i64
      %199 = scf.if %197 -> (i1) {
        %201 = llvm.load %176 : !llvm.ptr -> i64
        %202 = llvm.getelementptr %arg1[%201] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %200 = llvm.load %202 : !llvm.ptr -> i32
        %203 = arith.extsi %200 : i32 to i64
        %204 = arith.cmpi eq, %203, %188 : i64
        scf.yield %204 : i1
      } else {
        %205 = arith.constant false
        scf.yield %205 : i1
      }
      cf.cond_br %199, ^bb46, ^bb47
      ^bb46:
        %206 = llvm.load %192 : !llvm.ptr -> i64
        %207 = arith.constant 1 : i32
        %209 = arith.extsi %207 : i32 to i64
        %208 = arith.addi %206, %209 : i64
        llvm.store %208, %192 : i64, !llvm.ptr
        %210 = llvm.load %176 : !llvm.ptr -> i64
        %211 = arith.divsi %210, %188 : i64
        llvm.store %211, %176 : i64, !llvm.ptr
        cf.br ^bb45
      ^bb47:
      %212 = arith.trunci %188 : i64 to i32
      %213 = llvm.load %180 : !llvm.ptr -> i64
      %214 = llvm.getelementptr %arg2[%213] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %212, %214 : i32, !llvm.ptr
      %215 = llvm.load %192 : !llvm.ptr -> i64
      %216 = arith.trunci %215 : i64 to i32
      %217 = llvm.load %180 : !llvm.ptr -> i64
      %218 = llvm.getelementptr %arg3[%217] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %216, %218 : i32, !llvm.ptr
      %219 = llvm.load %180 : !llvm.ptr -> i64
      %220 = arith.constant 1 : i32
      %222 = arith.extsi %220 : i32 to i64
      %221 = arith.addi %219, %222 : i64
      llvm.store %221, %180 : i64, !llvm.ptr
      cf.br ^bb42
    ^bb44:
    %223 = llvm.load %180 : !llvm.ptr -> i64
    func.return %223 : i64
  }
  func.func @merge_factors(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: i64, %arg6: !llvm.ptr, %arg7: !llvm.ptr) -> i64 {
    %224 = arith.constant 0 : i32
    %225 = arith.extsi %224 : i32 to i64
    %226 = llvm.mlir.constant(1 : i64) : i64
    %227 = llvm.alloca %226 x i64 : (i64) -> !llvm.ptr
    llvm.store %225, %227 : i64, !llvm.ptr
    %228 = arith.constant 0 : i32
    %229 = arith.extsi %228 : i32 to i64
    %230 = llvm.mlir.constant(1 : i64) : i64
    %231 = llvm.alloca %230 x i64 : (i64) -> !llvm.ptr
    llvm.store %229, %231 : 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
    cf.br ^bb48
    ^bb48:
    %236 = llvm.load %227 : !llvm.ptr -> i64
    %237 = arith.cmpi slt, %236, %arg2 : i64
    %238 = scf.if %237 -> (i1) {
      %239 = llvm.load %231 : !llvm.ptr -> i64
      %240 = arith.cmpi slt, %239, %arg5 : i64
      scf.yield %240 : i1
    } else {
      %241 = arith.constant false
      scf.yield %241 : i1
    }
    cf.cond_br %238, ^bb49, ^bb50
    ^bb49:
      %243 = llvm.load %227 : !llvm.ptr -> i64
      %244 = llvm.getelementptr %arg0[%243] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %242 = llvm.load %244 : !llvm.ptr -> i32
      %245 = arith.extsi %242 : i32 to i64
      %247 = llvm.load %231 : !llvm.ptr -> i64
      %248 = llvm.getelementptr %arg3[%247] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %246 = llvm.load %248 : !llvm.ptr -> i32
      %249 = arith.extsi %246 : i32 to i64
      %250 = arith.cmpi eq, %245, %249 : i64
      cf.cond_br %250, ^bb51, ^bb52
      ^bb51:
        %252 = llvm.load %227 : !llvm.ptr -> i64
        %253 = llvm.getelementptr %arg0[%252] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %251 = llvm.load %253 : !llvm.ptr -> i32
        %254 = llvm.load %235 : !llvm.ptr -> i64
        %255 = llvm.getelementptr %arg6[%254] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %251, %255 : i32, !llvm.ptr
        %257 = llvm.load %227 : !llvm.ptr -> i64
        %258 = llvm.getelementptr %arg1[%257] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %256 = llvm.load %258 : !llvm.ptr -> i32
        %259 = arith.extsi %256 : i32 to i64
        %261 = llvm.load %231 : !llvm.ptr -> i64
        %262 = llvm.getelementptr %arg4[%261] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %260 = llvm.load %262 : !llvm.ptr -> i32
        %263 = arith.extsi %260 : i32 to i64
        %264 = arith.addi %259, %263 : i64
        %265 = arith.trunci %264 : i64 to i32
        %266 = llvm.load %235 : !llvm.ptr -> i64
        %267 = llvm.getelementptr %arg7[%266] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %265, %267 : i32, !llvm.ptr
        %268 = llvm.load %235 : !llvm.ptr -> i64
        %269 = arith.constant 1 : i32
        %271 = arith.extsi %269 : i32 to i64
        %270 = arith.addi %268, %271 : i64
        llvm.store %270, %235 : i64, !llvm.ptr
        %272 = llvm.load %227 : !llvm.ptr -> i64
        %273 = arith.constant 1 : i32
        %275 = arith.extsi %273 : i32 to i64
        %274 = arith.addi %272, %275 : i64
        llvm.store %274, %227 : i64, !llvm.ptr
        %276 = llvm.load %231 : !llvm.ptr -> i64
        %277 = arith.constant 1 : i32
        %279 = arith.extsi %277 : i32 to i64
        %278 = arith.addi %276, %279 : i64
        llvm.store %278, %231 : i64, !llvm.ptr
        cf.br ^bb53
      ^bb52:
        %280 = arith.cmpi slt, %245, %249 : i64
        cf.cond_br %280, ^bb55, ^bb54
      ^bb55:
        %282 = llvm.load %227 : !llvm.ptr -> i64
        %283 = llvm.getelementptr %arg0[%282] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %281 = llvm.load %283 : !llvm.ptr -> i32
        %284 = llvm.load %235 : !llvm.ptr -> i64
        %285 = llvm.getelementptr %arg6[%284] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %281, %285 : i32, !llvm.ptr
        %287 = llvm.load %227 : !llvm.ptr -> i64
        %288 = llvm.getelementptr %arg1[%287] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %286 = llvm.load %288 : !llvm.ptr -> i32
        %289 = llvm.load %235 : !llvm.ptr -> i64
        %290 = llvm.getelementptr %arg7[%289] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %286, %290 : i32, !llvm.ptr
        %291 = llvm.load %235 : !llvm.ptr -> i64
        %292 = arith.constant 1 : i32
        %294 = arith.extsi %292 : i32 to i64
        %293 = arith.addi %291, %294 : i64
        llvm.store %293, %235 : i64, !llvm.ptr
        %295 = llvm.load %227 : !llvm.ptr -> i64
        %296 = arith.constant 1 : i32
        %298 = arith.extsi %296 : i32 to i64
        %297 = arith.addi %295, %298 : i64
        llvm.store %297, %227 : i64, !llvm.ptr
        cf.br ^bb53
      ^bb54:
        %300 = llvm.load %231 : !llvm.ptr -> i64
        %301 = llvm.getelementptr %arg3[%300] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %299 = llvm.load %301 : !llvm.ptr -> i32
        %302 = llvm.load %235 : !llvm.ptr -> i64
        %303 = llvm.getelementptr %arg6[%302] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %299, %303 : i32, !llvm.ptr
        %305 = llvm.load %231 : !llvm.ptr -> i64
        %306 = llvm.getelementptr %arg4[%305] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %304 = llvm.load %306 : !llvm.ptr -> i32
        %307 = llvm.load %235 : !llvm.ptr -> i64
        %308 = llvm.getelementptr %arg7[%307] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %304, %308 : i32, !llvm.ptr
        %309 = llvm.load %235 : !llvm.ptr -> i64
        %310 = arith.constant 1 : i32
        %312 = arith.extsi %310 : i32 to i64
        %311 = arith.addi %309, %312 : i64
        llvm.store %311, %235 : i64, !llvm.ptr
        %313 = llvm.load %231 : !llvm.ptr -> i64
        %314 = arith.constant 1 : i32
        %316 = arith.extsi %314 : i32 to i64
        %315 = arith.addi %313, %316 : i64
        llvm.store %315, %231 : i64, !llvm.ptr
        cf.br ^bb53
      ^bb53:
      cf.br ^bb48
    ^bb50:
    cf.br ^bb56
    ^bb56:
    %317 = llvm.load %227 : !llvm.ptr -> i64
    %318 = arith.cmpi slt, %317, %arg2 : i64
    cf.cond_br %318, ^bb57, ^bb58
    ^bb57:
      %320 = llvm.load %227 : !llvm.ptr -> i64
      %321 = llvm.getelementptr %arg0[%320] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %319 = llvm.load %321 : !llvm.ptr -> i32
      %322 = llvm.load %235 : !llvm.ptr -> i64
      %323 = llvm.getelementptr %arg6[%322] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %319, %323 : i32, !llvm.ptr
      %325 = llvm.load %227 : !llvm.ptr -> i64
      %326 = llvm.getelementptr %arg1[%325] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %324 = llvm.load %326 : !llvm.ptr -> i32
      %327 = llvm.load %235 : !llvm.ptr -> i64
      %328 = llvm.getelementptr %arg7[%327] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %324, %328 : i32, !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 = llvm.load %227 : !llvm.ptr -> i64
      %334 = arith.constant 1 : i32
      %336 = arith.extsi %334 : i32 to i64
      %335 = arith.addi %333, %336 : i64
      llvm.store %335, %227 : i64, !llvm.ptr
      cf.br ^bb56
    ^bb58:
    cf.br ^bb59
    ^bb59:
    %337 = llvm.load %231 : !llvm.ptr -> i64
    %338 = arith.cmpi slt, %337, %arg5 : i64
    cf.cond_br %338, ^bb60, ^bb61
    ^bb60:
      %340 = llvm.load %231 : !llvm.ptr -> i64
      %341 = llvm.getelementptr %arg3[%340] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %339 = llvm.load %341 : !llvm.ptr -> i32
      %342 = llvm.load %235 : !llvm.ptr -> i64
      %343 = llvm.getelementptr %arg6[%342] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %339, %343 : i32, !llvm.ptr
      %345 = llvm.load %231 : !llvm.ptr -> i64
      %346 = llvm.getelementptr %arg4[%345] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %344 = llvm.load %346 : !llvm.ptr -> i32
      %347 = llvm.load %235 : !llvm.ptr -> i64
      %348 = llvm.getelementptr %arg7[%347] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %344, %348 : i32, !llvm.ptr
      %349 = llvm.load %235 : !llvm.ptr -> i64
      %350 = arith.constant 1 : i32
      %352 = arith.extsi %350 : i32 to i64
      %351 = arith.addi %349, %352 : i64
      llvm.store %351, %235 : i64, !llvm.ptr
      %353 = llvm.load %231 : !llvm.ptr -> i64
      %354 = arith.constant 1 : i32
      %356 = arith.extsi %354 : i32 to i64
      %355 = arith.addi %353, %356 : i64
      llvm.store %355, %231 : i64, !llvm.ptr
      cf.br ^bb59
    ^bb61:
    %357 = llvm.load %235 : !llvm.ptr -> i64
    func.return %357 : i64
  }
  func.func @main() -> i32 {
    %358 = arith.constant 1000 : i32
    %359 = arith.extsi %358 : i32 to i64
    %360 = arith.constant 2 : i32
    %362 = arith.extsi %360 : i32 to i64
    %361 = arith.muli %362, %359 : i64
    %363 = arith.muli %361, %361 : i64
    %365 = arith.constant 3 : i32
    %367 = arith.extsi %365 : i32 to i64
    %366 = arith.muli %367, %363 : i64
    %364 = func.call @isqrt(%366) : (i64) -> i64
    %368 = arith.muli %364, %364 : i64
    %369 = arith.addi %363, %368 : i64
    %371 = arith.constant 1 : i32
    %373 = arith.extsi %371 : i32 to i64
    %372 = arith.addi %369, %373 : i64
    %374 = arith.constant 4 : i32
    %375 = arith.extsi %374 : i32 to i64
    %370 = func.call @calloc(%372, %375) : (i64, i64) -> !llvm.ptr
    %377 = arith.constant 1 : i32
    %379 = arith.extsi %377 : i32 to i64
    %378 = arith.addi %364, %379 : i64
    %380 = arith.constant 8 : i32
    %381 = arith.extsi %380 : i32 to i64
    %376 = func.call @calloc(%378, %381) : (i64, i64) -> !llvm.ptr
    %383 = arith.constant 32 : i32
    %384 = arith.constant 4 : i32
    %385 = arith.extsi %383 : i32 to i64
    %386 = arith.extsi %384 : i32 to i64
    %382 = func.call @calloc(%385, %386) : (i64, i64) -> !llvm.ptr
    %388 = arith.constant 32 : i32
    %389 = arith.constant 4 : i32
    %390 = arith.extsi %388 : i32 to i64
    %391 = arith.extsi %389 : i32 to i64
    %387 = func.call @calloc(%390, %391) : (i64, i64) -> !llvm.ptr
    %393 = arith.constant 32 : i32
    %394 = arith.constant 4 : i32
    %395 = arith.extsi %393 : i32 to i64
    %396 = arith.extsi %394 : i32 to i64
    %392 = func.call @calloc(%395, %396) : (i64, i64) -> !llvm.ptr
    %398 = arith.constant 32 : i32
    %399 = arith.constant 4 : i32
    %400 = arith.extsi %398 : i32 to i64
    %401 = arith.extsi %399 : i32 to i64
    %397 = func.call @calloc(%400, %401) : (i64, i64) -> !llvm.ptr
    %403 = arith.constant 64 : i32
    %404 = arith.constant 4 : i32
    %405 = arith.extsi %403 : i32 to i64
    %406 = arith.extsi %404 : i32 to i64
    %402 = func.call @calloc(%405, %406) : (i64, i64) -> !llvm.ptr
    %408 = arith.constant 64 : i32
    %409 = arith.constant 4 : i32
    %410 = arith.extsi %408 : i32 to i64
    %411 = arith.extsi %409 : i32 to i64
    %407 = func.call @calloc(%410, %411) : (i64, i64) -> !llvm.ptr
    %413 = arith.constant 8192 : i32
    %414 = arith.constant 8 : i32
    %415 = arith.extsi %413 : i32 to i64
    %416 = arith.extsi %414 : i32 to i64
    %412 = func.call @calloc(%415, %416) : (i64, i64) -> !llvm.ptr
    %417 = llvm.mlir.zero : !llvm.ptr
    %418 = llvm.icmp "eq" %370, %417 : !llvm.ptr
    cf.cond_br %418, ^bb62, ^bb63
    ^bb62:
      %419 = arith.constant 1 : i32
      func.return %419 : i32
    ^bb63:
      cf.br ^bb64
    ^bb64:
    %420 = arith.constant 1 : i32
    %421 = arith.constant 1 : i32
    %422 = arith.extsi %421 : i32 to i64
    %423 = llvm.getelementptr %370[%422] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %420, %423 : i32, !llvm.ptr
    %424 = arith.constant 2 : i32
    %425 = arith.extsi %424 : i32 to i64
    %426 = llvm.mlir.constant(1 : i64) : i64
    %427 = llvm.alloca %426 x i64 : (i64) -> !llvm.ptr
    llvm.store %425, %427 : i64, !llvm.ptr
    cf.br ^bb65
    ^bb65:
    %428 = llvm.load %427 : !llvm.ptr -> i64
    %429 = arith.cmpi sle, %428, %369 : i64
    cf.cond_br %429, ^bb66, ^bb67
    ^bb66:
      %430 = arith.constant 2 : i32
      %431 = llvm.load %427 : !llvm.ptr -> i64
      %432 = llvm.getelementptr %370[%431] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %430, %432 : i32, !llvm.ptr
      %433 = llvm.load %427 : !llvm.ptr -> i64
      %434 = arith.constant 2 : i32
      %436 = arith.extsi %434 : i32 to i64
      %435 = arith.addi %433, %436 : i64
      llvm.store %435, %427 : i64, !llvm.ptr
      cf.br ^bb65
    ^bb67:
    %437 = arith.constant 3 : i32
    %438 = arith.extsi %437 : i32 to i64
    llvm.store %438, %427 : i64, !llvm.ptr
    cf.br ^bb68
    ^bb68:
    %439 = llvm.load %427 : !llvm.ptr -> i64
    %440 = arith.cmpi sle, %439, %369 : i64
    cf.cond_br %440, ^bb69, ^bb70
    ^bb69:
      %442 = llvm.load %427 : !llvm.ptr -> i64
      %443 = llvm.getelementptr %370[%442] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %441 = llvm.load %443 : !llvm.ptr -> i32
      %444 = arith.constant 0 : i32
      %445 = arith.cmpi eq, %441, %444 : i32
      cf.cond_br %445, ^bb71, ^bb72
      ^bb71:
        %446 = llvm.load %427 : !llvm.ptr -> i64
        %447 = arith.trunci %446 : i64 to i32
        %448 = llvm.load %427 : !llvm.ptr -> i64
        %449 = llvm.getelementptr %370[%448] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %447, %449 : i32, !llvm.ptr
        %450 = llvm.load %427 : !llvm.ptr -> i64
        %451 = llvm.load %427 : !llvm.ptr -> i64
        %452 = arith.muli %450, %451 : i64
        %453 = arith.cmpi sle, %452, %369 : i64
        cf.cond_br %453, ^bb74, ^bb75
        ^bb74:
          %454 = llvm.mlir.constant(1 : i64) : i64
          %455 = llvm.alloca %454 x i64 : (i64) -> !llvm.ptr
          llvm.store %452, %455 : i64, !llvm.ptr
          %456 = llvm.load %427 : !llvm.ptr -> i64
          %457 = arith.constant 1 : i32
          %459 = arith.extsi %457 : i32 to i64
          %458 = arith.shli %456, %459 : i64
          cf.br ^bb77
          ^bb77:
          %460 = llvm.load %455 : !llvm.ptr -> i64
          %461 = arith.cmpi sle, %460, %369 : i64
          cf.cond_br %461, ^bb78, ^bb79
          ^bb78:
            %463 = llvm.load %455 : !llvm.ptr -> i64
            %464 = llvm.getelementptr %370[%463] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %462 = llvm.load %464 : !llvm.ptr -> i32
            %465 = arith.constant 0 : i32
            %466 = arith.cmpi eq, %462, %465 : i32
            cf.cond_br %466, ^bb80, ^bb81
            ^bb80:
              %467 = llvm.load %427 : !llvm.ptr -> i64
              %468 = arith.trunci %467 : i64 to i32
              %469 = llvm.load %455 : !llvm.ptr -> i64
              %470 = llvm.getelementptr %370[%469] : (!llvm.ptr, i64) -> !llvm.ptr, i32
              llvm.store %468, %470 : i32, !llvm.ptr
              cf.br ^bb82
            ^bb81:
              cf.br ^bb82
            ^bb82:
            %471 = llvm.load %455 : !llvm.ptr -> i64
            %472 = arith.addi %471, %458 : i64
            llvm.store %472, %455 : i64, !llvm.ptr
            cf.br ^bb77
          ^bb79:
          cf.br ^bb76
        ^bb75:
          cf.br ^bb76
        ^bb76:
        cf.br ^bb73
      ^bb72:
        cf.br ^bb73
      ^bb73:
      %473 = llvm.load %427 : !llvm.ptr -> i64
      %474 = arith.constant 2 : i32
      %476 = arith.extsi %474 : i32 to i64
      %475 = arith.addi %473, %476 : i64
      llvm.store %475, %427 : i64, !llvm.ptr
      cf.br ^bb68
    ^bb70:
    %477 = arith.constant 0 : i32
    %478 = arith.extsi %477 : i32 to i64
    llvm.store %478, %427 : i64, !llvm.ptr
    cf.br ^bb83
    ^bb83:
    %479 = llvm.load %427 : !llvm.ptr -> i64
    %480 = arith.cmpi sle, %479, %364 : i64
    cf.cond_br %480, ^bb84, ^bb85
    ^bb84:
      %481 = llvm.load %427 : !llvm.ptr -> i64
      %482 = llvm.load %427 : !llvm.ptr -> i64
      %483 = arith.muli %481, %482 : i64
      %484 = llvm.load %427 : !llvm.ptr -> i64
      %485 = llvm.getelementptr %376[%484] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %483, %485 : i64, !llvm.ptr
      %486 = llvm.load %427 : !llvm.ptr -> i64
      %487 = arith.constant 1 : i32
      %489 = arith.extsi %487 : i32 to i64
      %488 = arith.addi %486, %489 : i64
      llvm.store %488, %427 : i64, !llvm.ptr
      cf.br ^bb83
    ^bb85:
    %490 = arith.constant 0 : i32
    %491 = arith.extsi %490 : i32 to i64
    %492 = llvm.mlir.constant(1 : i64) : i64
    %493 = llvm.alloca %492 x i64 : (i64) -> !llvm.ptr
    llvm.store %491, %493 : i64, !llvm.ptr
    %494 = arith.constant 2 : i32
    %495 = arith.extsi %494 : i32 to i64
    %496 = llvm.mlir.constant(1 : i64) : i64
    %497 = llvm.alloca %496 x i64 : (i64) -> !llvm.ptr
    llvm.store %495, %497 : i64, !llvm.ptr
    cf.br ^bb86
    ^bb86:
    %498 = llvm.load %497 : !llvm.ptr -> i64
    %499 = arith.cmpi sle, %498, %361 : i64
    cf.cond_br %499, ^bb87, ^bb88
    ^bb87:
      %500 = llvm.load %497 : !llvm.ptr -> i64
      %501 = llvm.load %497 : !llvm.ptr -> i64
      %502 = arith.muli %500, %501 : i64
      %504 = arith.constant 3 : i32
      %506 = arith.extsi %504 : i32 to i64
      %505 = arith.muli %506, %502 : i64
      %503 = func.call @isqrt(%505) : (i64) -> i64
      %507 = arith.constant 2 : i32
      %509 = arith.extsi %507 : i32 to i64
      %508 = arith.muli %509, %502 : i64
      %510 = func.call @factorize(%502, %370, %382, %387) : (i64, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> i64
      %511 = arith.constant 1 : i32
      %512 = arith.extsi %511 : i32 to i64
      %513 = llvm.mlir.constant(1 : i64) : i64
      %514 = llvm.alloca %513 x i64 : (i64) -> !llvm.ptr
      llvm.store %512, %514 : i64, !llvm.ptr
      cf.br ^bb89
      ^bb89:
      %515 = llvm.load %514 : !llvm.ptr -> i64
      %516 = arith.cmpi sle, %515, %503 : i64
      cf.cond_br %516, ^bb90, ^bb91
      ^bb90:
        %518 = llvm.load %514 : !llvm.ptr -> i64
        %519 = llvm.getelementptr %376[%518] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %517 = llvm.load %519 : !llvm.ptr -> i64
        %520 = arith.addi %517, %502 : i64
        %521 = func.call @factorize(%520, %370, %392, %397) : (i64, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> i64
        %522 = func.call @merge_factors(%382, %387, %510, %392, %397, %521, %402, %407) : (!llvm.ptr, !llvm.ptr, i64, !llvm.ptr, !llvm.ptr, i64, !llvm.ptr, !llvm.ptr) -> i64
        %523 = arith.constant 0 : i32
        %524 = arith.extsi %523 : i32 to i64
        %525 = llvm.mlir.constant(1 : i64) : i64
        %526 = llvm.alloca %525 x i64 : (i64) -> !llvm.ptr
        llvm.store %524, %526 : i64, !llvm.ptr
        %527 = arith.constant 1 : i32
        %528 = arith.constant 0 : i32
        %529 = arith.extsi %527 : i32 to i64
        %530 = arith.extsi %528 : i32 to i64
        %531 = llvm.getelementptr %412[%530] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %529, %531 : i64, !llvm.ptr
        %532 = arith.constant 1 : i32
        %533 = arith.extsi %532 : i32 to i64
        llvm.store %533, %526 : i64, !llvm.ptr
        %534 = arith.constant 0 : i32
        %535 = arith.extsi %534 : i32 to i64
        %536 = llvm.mlir.constant(1 : i64) : i64
        %537 = llvm.alloca %536 x i64 : (i64) -> !llvm.ptr
        llvm.store %535, %537 : i64, !llvm.ptr
        cf.br ^bb92
        ^bb92:
        %538 = llvm.load %537 : !llvm.ptr -> i64
        %539 = arith.cmpi slt, %538, %522 : i64
        cf.cond_br %539, ^bb93, ^bb94
        ^bb93:
          %541 = llvm.load %537 : !llvm.ptr -> i64
          %542 = llvm.getelementptr %402[%541] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %540 = llvm.load %542 : !llvm.ptr -> i32
          %543 = arith.extsi %540 : i32 to i64
          %545 = llvm.load %537 : !llvm.ptr -> i64
          %546 = llvm.getelementptr %407[%545] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %544 = llvm.load %546 : !llvm.ptr -> i32
          %547 = arith.extsi %544 : i32 to i64
          %548 = llvm.load %526 : !llvm.ptr -> i64
          %549 = arith.constant 1 : i32
          %550 = arith.extsi %549 : i32 to i64
          %551 = llvm.mlir.constant(1 : i64) : i64
          %552 = llvm.alloca %551 x i64 : (i64) -> !llvm.ptr
          llvm.store %550, %552 : i64, !llvm.ptr
          %553 = arith.constant 0 : i32
          %554 = arith.extsi %553 : i32 to i64
          %555 = llvm.mlir.constant(1 : i64) : i64
          %556 = llvm.alloca %555 x i64 : (i64) -> !llvm.ptr
          llvm.store %554, %556 : i64, !llvm.ptr
          cf.br ^bb95
          ^bb95:
          %557 = llvm.load %556 : !llvm.ptr -> i64
          %558 = arith.cmpi sle, %557, %547 : i64
          cf.cond_br %558, ^bb96, ^bb97
          ^bb96:
            %559 = llvm.load %552 : !llvm.ptr -> i64
            %560 = arith.cmpi sgt, %559, %508 : i64
            cf.cond_br %560, ^bb98, ^bb99
            ^bb98:
              cf.br ^bb97
            ^bb99:
              cf.br ^bb100
            ^bb100:
            %561 = llvm.load %556 : !llvm.ptr -> i64
            %562 = arith.constant 0 : i32
            %564 = arith.extsi %562 : i32 to i64
            %563 = arith.cmpi sgt, %561, %564 : i64
            cf.cond_br %563, ^bb101, ^bb102
            ^bb101:
              %565 = arith.constant 0 : i32
              %566 = arith.extsi %565 : i32 to i64
              %567 = llvm.mlir.constant(1 : i64) : i64
              %568 = llvm.alloca %567 x i64 : (i64) -> !llvm.ptr
              llvm.store %566, %568 : i64, !llvm.ptr
              cf.br ^bb104
              ^bb104:
              %569 = llvm.load %568 : !llvm.ptr -> i64
              %570 = arith.cmpi slt, %569, %548 : i64
              cf.cond_br %570, ^bb105, ^bb106
              ^bb105:
                %572 = llvm.load %568 : !llvm.ptr -> i64
                %573 = llvm.getelementptr %412[%572] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                %571 = llvm.load %573 : !llvm.ptr -> i64
                %574 = llvm.load %552 : !llvm.ptr -> i64
                %575 = arith.muli %571, %574 : i64
                %576 = arith.cmpi sle, %575, %508 : i64
                cf.cond_br %576, ^bb107, ^bb108
                ^bb107:
                  %577 = llvm.load %526 : !llvm.ptr -> i64
                  %578 = llvm.getelementptr %412[%577] : (!llvm.ptr, i64) -> !llvm.ptr, i64
                  llvm.store %575, %578 : i64, !llvm.ptr
                  %579 = llvm.load %526 : !llvm.ptr -> i64
                  %580 = arith.constant 1 : i32
                  %582 = arith.extsi %580 : i32 to i64
                  %581 = arith.addi %579, %582 : i64
                  llvm.store %581, %526 : i64, !llvm.ptr
                  cf.br ^bb109
                ^bb108:
                  cf.br ^bb109
                ^bb109:
                %583 = llvm.load %568 : !llvm.ptr -> i64
                %584 = arith.constant 1 : i32
                %586 = arith.extsi %584 : i32 to i64
                %585 = arith.addi %583, %586 : i64
                llvm.store %585, %568 : i64, !llvm.ptr
                cf.br ^bb104
              ^bb106:
              cf.br ^bb103
            ^bb102:
              cf.br ^bb103
            ^bb103:
            %587 = llvm.load %552 : !llvm.ptr -> i64
            %588 = arith.muli %587, %543 : i64
            llvm.store %588, %552 : i64, !llvm.ptr
            %589 = llvm.load %556 : !llvm.ptr -> i64
            %590 = arith.constant 1 : i32
            %592 = arith.extsi %590 : i32 to i64
            %591 = arith.addi %589, %592 : i64
            llvm.store %591, %556 : i64, !llvm.ptr
            cf.br ^bb95
          ^bb97:
          %593 = llvm.load %537 : !llvm.ptr -> i64
          %594 = arith.constant 1 : i32
          %596 = arith.extsi %594 : i32 to i64
          %595 = arith.addi %593, %596 : i64
          llvm.store %595, %537 : i64, !llvm.ptr
          cf.br ^bb92
        ^bb94:
        %597 = arith.constant 0 : i32
        %598 = arith.extsi %597 : i32 to i64
        %599 = llvm.mlir.constant(1 : i64) : i64
        %600 = llvm.alloca %599 x i64 : (i64) -> !llvm.ptr
        llvm.store %598, %600 : i64, !llvm.ptr
        cf.br ^bb110
        ^bb110:
        %601 = llvm.load %600 : !llvm.ptr -> i64
        %602 = llvm.load %526 : !llvm.ptr -> i64
        %603 = arith.cmpi slt, %601, %602 : i64
        cf.cond_br %603, ^bb111, ^bb112
        ^bb111:
          %605 = llvm.load %600 : !llvm.ptr -> i64
          %606 = llvm.getelementptr %412[%605] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %604 = llvm.load %606 : !llvm.ptr -> i64
          %607 = arith.addi %502, %604 : i64
          %608 = llvm.load %514 : !llvm.ptr -> i64
          %609 = arith.remsi %607, %608 : i64
          %610 = arith.constant 0 : i32
          %612 = arith.extsi %610 : i32 to i64
          %611 = arith.cmpi eq, %609, %612 : i64
          cf.cond_br %611, ^bb113, ^bb114
          ^bb113:
            %613 = llvm.load %514 : !llvm.ptr -> i64
            %614 = arith.divsi %607, %613 : i64
            %615 = llvm.load %514 : !llvm.ptr -> i64
            %616 = arith.cmpi sge, %614, %615 : i64
            cf.cond_br %616, ^bb116, ^bb117
            ^bb116:
              %617 = llvm.load %514 : !llvm.ptr -> i64
              %618 = arith.addi %617, %614 : i64
              %619 = arith.muli %502, %618 : i64
              %620 = arith.remsi %619, %604 : i64
              %621 = arith.constant 0 : i32
              %623 = arith.extsi %621 : i32 to i64
              %622 = arith.cmpi eq, %620, %623 : i64
              cf.cond_br %622, ^bb119, ^bb120
              ^bb119:
                %624 = arith.divsi %619, %604 : i64
                %625 = arith.cmpi sge, %624, %614 : i64
                cf.cond_br %625, ^bb122, ^bb123
                ^bb122:
                  %626 = llvm.load %493 : !llvm.ptr -> i64
                  %627 = arith.constant 2 : i32
                  %628 = llvm.load %514 : !llvm.ptr -> i64
                  %629 = arith.addi %628, %614 : i64
                  %630 = arith.addi %629, %624 : i64
                  %632 = arith.extsi %627 : i32 to i64
                  %631 = arith.muli %632, %630 : i64
                  %633 = arith.addi %626, %631 : i64
                  llvm.store %633, %493 : i64, !llvm.ptr
                  cf.br ^bb124
                ^bb123:
                  cf.br ^bb124
                ^bb124:
                cf.br ^bb121
              ^bb120:
                cf.br ^bb121
              ^bb121:
              cf.br ^bb118
            ^bb117:
              cf.br ^bb118
            ^bb118:
            cf.br ^bb115
          ^bb114:
            cf.br ^bb115
          ^bb115:
          %634 = llvm.load %600 : !llvm.ptr -> i64
          %635 = arith.constant 1 : i32
          %637 = arith.extsi %635 : i32 to i64
          %636 = arith.addi %634, %637 : i64
          llvm.store %636, %600 : i64, !llvm.ptr
          cf.br ^bb110
        ^bb112:
        %638 = llvm.load %514 : !llvm.ptr -> i64
        %639 = arith.constant 1 : i32
        %641 = arith.extsi %639 : i32 to i64
        %640 = arith.addi %638, %641 : i64
        llvm.store %640, %514 : i64, !llvm.ptr
        cf.br ^bb89
      ^bb91:
      %642 = llvm.load %497 : !llvm.ptr -> i64
      %643 = arith.constant 2 : i32
      %645 = arith.extsi %643 : i32 to i64
      %644 = arith.addi %642, %645 : i64
      llvm.store %644, %497 : i64, !llvm.ptr
      cf.br ^bb86
    ^bb88:
    func.call @free(%370) : (!llvm.ptr) -> ()
    func.call @free(%376) : (!llvm.ptr) -> ()
    func.call @free(%382) : (!llvm.ptr) -> ()
    func.call @free(%387) : (!llvm.ptr) -> ()
    func.call @free(%392) : (!llvm.ptr) -> ()
    func.call @free(%397) : (!llvm.ptr) -> ()
    func.call @free(%402) : (!llvm.ptr) -> ()
    func.call @free(%407) : (!llvm.ptr) -> ()
    func.call @free(%412) : (!llvm.ptr) -> ()
    %655 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %656 = llvm.load %493 : !llvm.ptr -> i64
    %657 = llvm.call @printf(%655, %656) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %658 = arith.constant 0 : i32
    func.return %658 : i32
  }
}