Problem 536

Modulo Power Identity — S(10^12).

Answer3557005261906288
Output3557005261906288
StatusPASS
Native helperno
Runtime2550 ms
Peak memory4016 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

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

Flow source

# Project Euler 536
# Modulo Power Identity — S(10^12).

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

const N_LIMIT: i64 = 1000000000000

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

function isqrt(n: i64) -> i64 {
    if n < 2 { return n }
    let mut x: i64 = n
    let mut y: i64 = (x + 1) / 2
    while y < x {
        x = y
        y = (x + n / x) / 2
    }
    return x
}

function modinv(a0: i64, m: i64) -> i64 {
    let mut old_r: i64 = a0 % m
    if old_r < 0 { old_r = old_r + m }
    let mut r: i64 = m
    let mut old_s: i64 = 1
    let mut s: i64 = 0
    while r != 0 {
        let q: i64 = old_r / r
        let nr: i64 = old_r - q * r
        old_r = r
        r = nr
        let ns: i64 = old_s - q * s
        old_s = s
        s = ns
    }
    let mut x: i64 = old_s % m
    if x < 0 { x = x + m }
    return x
}

function floordiv(a: i64, b: i64) -> i64 {
    let q: i64 = a / b
    let r: i64 = a % b
    if r != 0 && ((r > 0) != (b > 0)) { return q - 1 }
    return q
}

function leaf_count(
    x: i64, lam: i64, plist: ptr<i64>, pn: i64, idx: i64, q_low: i64,
    step: i64, r0: i64, N: i64, pmax: i64, isp: ptr<i8>, total: ptr<i64>
) -> void {
    let mut ql: i64 = q_low
    if ql < plist[idx] { ql = plist[idx] }
    let mut max_q: i64 = N / x
    if max_q > pmax { max_q = pmax }
    if ql > max_q { return }
    if step == 1 {
        let mut lo: i64 = idx
        let mut hi: i64 = pn
        while lo < hi {
            let mid: i64 = (lo + hi) / 2
            if plist[mid] < ql { lo = mid + 1 } else { hi = mid }
        }
        let mut j: i64 = lo
        while j < pn {
            let q: i64 = plist[j]
            if q > max_q { break }
            if (x + 3) % (q - 1) == 0 { total[0] = total[0] + x * q }
            j = j + 1
        }
        return
    }
    if step <= 2 {
        let mut lo2: i64 = idx
        let mut hi2: i64 = pn
        while lo2 < hi2 {
            let mid: i64 = (lo2 + hi2) / 2
            if plist[mid] < ql { lo2 = mid + 1 } else { hi2 = mid }
        }
        let mut j2: i64 = lo2
        while j2 < pn {
            let q2: i64 = plist[j2]
            if q2 > max_q { break }
            if (q2 - r0) % step == 0 && (x + 3) % (q2 - 1) == 0 {
                total[0] = total[0] + x * q2
            }
            j2 = j2 + 1
        }
        return
    }
    let mut q3: i64 = r0
    if q3 < ql { q3 = q3 + ((ql - q3 + step - 1) / step) * step }
    while q3 <= max_q {
        if isp[q3] == 1 && (x + 3) % (q3 - 1) == 0 {
            total[0] = total[0] + x * q3
        }
        q3 = q3 + step
    }
}

function dfs(
    x: i64, lam: i64, plist: ptr<i64>, pn: i64, idx: i64,
    N: i64, pmax: i64, isp: ptr<i8>, total: ptr<i64>
) -> void {
    if (x + 3) % lam == 0 { total[0] = total[0] + x }
    if idx >= pn { return }
    let bound: i64 = isqrt(N / x)
    let q_low: i64 = bound + 1
    let gx: i64 = gcd(x, lam)
    if 3 % gx != 0 { return }
    let step: i64 = lam / gx
    let mut r0: i64 = 0
    if step > 1 {
        let a: i64 = x / gx
        let inv: i64 = modinv(a, step)
        r0 = (floordiv(-3, gx) % step + step) % step
        r0 = (r0 * inv) % step
    }
    let mut q0: i64 = r0
    if q0 < plist[idx] { q0 = plist[idx] }
    if x * q0 > N { return }
    if q_low <= pmax {
        leaf_count(x, lam, plist, pn, idx, q_low, step, r0, N, pmax, isp, total)
    }
    let mut j: i64 = idx
    while j < pn {
        let p: i64 = plist[j]
        if p > bound { break }
        let xp: i64 = x * p
        let pm1: i64 = p - 1
        let d: i64 = gcd(lam, pm1)
        let lam2: i64 = (lam / d) * pm1
        let gp: i64 = gcd(xp, lam2)
        if gp == 1 || gp == 3 {
            dfs(xp, lam2, plist, pn, j + 1, N, pmax, isp, total)
        }
        j = j + 1
    }
}

function main() -> i32 {
    let N: i64 = N_LIMIT
    let pmax: i64 = isqrt(N + 4) + 5
    let isp: ptr<i8> = calloc(pmax + 1, 1)
    let plist: ptr<i64> = calloc(80000, 8)
    let plist32: ptr<i64> = calloc(80000, 8)
    let total: ptr<i64> = calloc(1, 8)
    if isp == null || plist == null || total == null { return 1 }
    let mut i: i64 = 0
    while i <= pmax {
        isp[i] = 1
        i = i + 1
    }
    isp[0] = 0; isp[1] = 0
    if pmax >= 4 {
        i = 4
        while i <= pmax {
            isp[i] = 0
            i = i + 2
        }
    }
    let r: i64 = isqrt(pmax)
    let mut p: i64 = 3
    while p <= r {
        if isp[p] == 1 {
            let mut j: i64 = p * p
            let step: i64 = p << 1
            while j <= pmax {
                isp[j] = 0
                j = j + step
            }
        }
        p = p + 2
    }
    let mut pn: i64 = 0
    let mut pn32: i64 = 0
    plist[pn] = 2; pn = pn + 1
    p = 3
    while p <= pmax {
        if isp[p] == 1 {
            plist[pn] = p
            pn = pn + 1
            if p >= 5 && p != 3 && (p % 3) == 2 {
                plist32[pn32] = p
                pn32 = pn32 + 1
            }
        }
        p = p + 2
    }
    # plist_after3: odd primes >=5
    let pa3: ptr<i64> = calloc(pn, 8)
    let mut pa3n: i64 = 0
    i = 0
    while i < pn {
        if plist[i] >= 5 {
            pa3[pa3n] = plist[i]
            pa3n = pa3n + 1
        }
        i = i + 1
    }
    if N >= 2 { total[0] = 2 }
    if N >= 3 { dfs(3, 2, pa3, pa3n, 0, N, pmax, isp, total) }
    dfs(1, 1, plist32, pn32, 0, N, pmax, isp, total)
    printf("%lld\n", total[0])
    free(isp); free(plist); free(plist32); free(pa3); free(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 isqrt_i64(int64_t n);
int64_t modinv_i64_i64(int64_t a0, int64_t m);
int64_t floordiv_i64_i64(int64_t a, int64_t b);
void leaf_count_i64_i64_ptr_i64_i64_i64_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(int64_t x, int64_t lam, int64_t* plist, int64_t pn, int64_t idx, int64_t q_low, int64_t step, int64_t r0, int64_t N, int64_t pmax, int8_t* isp, int64_t* total);
void dfs_i64_i64_ptr_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(int64_t x, int64_t lam, int64_t* plist, int64_t pn, int64_t idx, int64_t N, int64_t pmax, int8_t* isp, int64_t* total);
int32_t main(void);

static const int64_t N_LIMIT = 1000000000000;



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 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 modinv_i64_i64(int64_t a0, int64_t m) {
    int64_t old_r = FLOW_CHECKED_MOD((a0), (m));
    if (old_r < 0) {
        old_r = (old_r + m);
    }
    int64_t r = m;
    int64_t old_s = 1;
    int64_t s = 0;
    while (r != 0) {
        int64_t q = FLOW_CHECKED_DIV((old_r), (r));
        int64_t nr = (old_r - (q * r));
        old_r = r;
        r = nr;
        int64_t ns = (old_s - (q * s));
        old_s = s;
        s = ns;
    }
    int64_t x = FLOW_CHECKED_MOD((old_s), (m));
    if (x < 0) {
        x = (x + m);
    }
    return x;
}

int64_t floordiv_i64_i64(int64_t a, int64_t b) {
    int64_t q = FLOW_CHECKED_DIV((a), (b));
    int64_t r = FLOW_CHECKED_MOD((a), (b));
    if ((r != 0 && r > 0 != b > 0)) {
        return (q - 1);
    }
    return q;
}

void leaf_count_i64_i64_ptr_i64_i64_i64_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(int64_t x, int64_t lam, int64_t* plist, int64_t pn, int64_t idx, int64_t q_low, int64_t step, int64_t r0, int64_t N, int64_t pmax, int8_t* isp, int64_t* total) {
    int64_t ql = q_low;
    if (ql < plist[idx]) {
        ql = plist[idx];
    }
    int64_t max_q = FLOW_CHECKED_DIV((N), (x));
    if (max_q > pmax) {
        max_q = pmax;
    }
    if (ql > max_q) {
        return;
    }
    if (step == 1) {
        int64_t lo = idx;
        int64_t hi = pn;
        while (lo < hi) {
            int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
            if (plist[mid] < ql) {
                lo = (mid + 1);
            } else {
                hi = mid;
            }
        }
        int64_t j = lo;
        while (j < pn) {
            int64_t q = plist[j];
            if (q > max_q) {
                break;
            }
            if (FLOW_CHECKED_MOD(((x + 3)), ((q - 1))) == 0) {
                total[0] = (total[0] + (x * q));
            }
            j = (j + 1);
        }
        return;
    }
    if (step <= 2) {
        int64_t lo2 = idx;
        int64_t hi2 = pn;
        while (lo2 < hi2) {
            int64_t mid = FLOW_CHECKED_DIV(((lo2 + hi2)), (2));
            if (plist[mid] < ql) {
                lo2 = (mid + 1);
            } else {
                hi2 = mid;
            }
        }
        int64_t j2 = lo2;
        while (j2 < pn) {
            int64_t q2 = plist[j2];
            if (q2 > max_q) {
                break;
            }
            if ((FLOW_CHECKED_MOD(((q2 - r0)), (step)) == 0 && FLOW_CHECKED_MOD(((x + 3)), ((q2 - 1))) == 0)) {
                total[0] = (total[0] + (x * q2));
            }
            j2 = (j2 + 1);
        }
        return;
    }
    int64_t q3 = r0;
    if (q3 < ql) {
        q3 = (q3 + (FLOW_CHECKED_DIV(((((ql - q3) + step) - 1)), (step)) * step));
    }
    while (q3 <= max_q) {
        if ((isp[q3] == 1 && FLOW_CHECKED_MOD(((x + 3)), ((q3 - 1))) == 0)) {
            total[0] = (total[0] + (x * q3));
        }
        q3 = (q3 + step);
    }
}

void dfs_i64_i64_ptr_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(int64_t x, int64_t lam, int64_t* plist, int64_t pn, int64_t idx, int64_t N, int64_t pmax, int8_t* isp, int64_t* total) {
    if (FLOW_CHECKED_MOD(((x + 3)), (lam)) == 0) {
        total[0] = (total[0] + x);
    }
    if (idx >= pn) {
        return;
    }
    int64_t bound = isqrt_i64(FLOW_CHECKED_DIV((N), (x)));
    int64_t q_low = (bound + 1);
    int64_t gx = gcd_i64_i64(x, lam);
    if (FLOW_CHECKED_MOD((3), (gx)) != 0) {
        return;
    }
    int64_t step = FLOW_CHECKED_DIV((lam), (gx));
    int64_t r0 = 0;
    if (step > 1) {
        int64_t a = FLOW_CHECKED_DIV((x), (gx));
        int64_t inv = modinv_i64_i64(a, step);
        r0 = FLOW_CHECKED_MOD(((FLOW_CHECKED_MOD((floordiv_i64_i64((-3), gx)), (step)) + step)), (step));
        r0 = FLOW_CHECKED_MOD(((r0 * inv)), (step));
    }
    int64_t q0 = r0;
    if (q0 < plist[idx]) {
        q0 = plist[idx];
    }
    if ((x * q0) > N) {
        return;
    }
    if (q_low <= pmax) {
        leaf_count_i64_i64_ptr_i64_i64_i64_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(x, lam, plist, pn, idx, q_low, step, r0, N, pmax, isp, total);
    }
    int64_t j = idx;
    while (j < pn) {
        int64_t p = plist[j];
        if (p > bound) {
            break;
        }
        int64_t xp = (x * p);
        int64_t pm1 = (p - 1);
        int64_t d = gcd_i64_i64(lam, pm1);
        int64_t lam2 = (FLOW_CHECKED_DIV((lam), (d)) * pm1);
        int64_t gp = gcd_i64_i64(xp, lam2);
        if ((gp == 1 || gp == 3)) {
            dfs_i64_i64_ptr_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(xp, lam2, plist, pn, (j + 1), N, pmax, isp, total);
        }
        j = (j + 1);
    }
}

int32_t main(void) {
    int64_t N = N_LIMIT;
    int64_t pmax = (isqrt_i64((N + 4)) + 5);
    int8_t* isp = (int8_t*)(calloc((pmax + 1), 1));
    int64_t* plist = (int64_t*)(calloc(80000, 8));
    int64_t* plist32 = (int64_t*)(calloc(80000, 8));
    int64_t* total = (int64_t*)(calloc(1, 8));
    if (((isp == NULL || plist == NULL) || total == NULL)) {
        return 1;
    }
    int64_t i = 0;
    while (i <= pmax) {
        isp[i] = 1;
        i = (i + 1);
    }
    isp[0] = 0;
    isp[1] = 0;
    if (pmax >= 4) {
        i = 4;
        while (i <= pmax) {
            isp[i] = 0;
            i = (i + 2);
        }
    }
    int64_t r = isqrt_i64(pmax);
    int64_t p = 3;
    while (p <= r) {
        if (isp[p] == 1) {
            int64_t j = (p * p);
            int64_t step = FLOW_CHECKED_SHL((p), (1));
            while (j <= pmax) {
                isp[j] = 0;
                j = (j + step);
            }
        }
        p = (p + 2);
    }
    int64_t pn = 0;
    int64_t pn32 = 0;
    plist[pn] = 2;
    pn = (pn + 1);
    p = 3;
    while (p <= pmax) {
        if (isp[p] == 1) {
            plist[pn] = p;
            pn = (pn + 1);
            if (((p >= 5 && p != 3) && FLOW_CHECKED_MOD((p), (3)) == 2)) {
                plist32[pn32] = p;
                pn32 = (pn32 + 1);
            }
        }
        p = (p + 2);
    }
    int64_t* pa3 = (int64_t*)(calloc(pn, 8));
    int64_t pa3n = 0;
    i = 0;
    while (i < pn) {
        if (plist[i] >= 5) {
            pa3[pa3n] = plist[i];
            pa3n = (pa3n + 1);
        }
        i = (i + 1);
    }
    if (N >= 2) {
        total[0] = 2;
    }
    if (N >= 3) {
        dfs_i64_i64_ptr_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(3, 2, pa3, pa3n, 0, N, pmax, isp, total);
    }
    dfs_i64_i64_ptr_i64_i64_i64_i64_i64_ptr_i8_ptr_i64(1, 1, plist32, pn32, 0, N, pmax, isp, total);
    printf("%lld\n", total[0]);
    free(isp);
    free(plist);
    free(plist32);
    free(pa3);
    free(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 private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  // Constant: N_LIMIT
  llvm.mlir.global internal constant @N_LIMIT(1000000000000 : i64) : i64
  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 @isqrt(%arg0: i64) -> i64 {
    %13 = arith.constant 2 : i32
    %15 = arith.extsi %13 : i32 to i64
    %14 = arith.cmpi slt, %arg0, %15 : i64
    cf.cond_br %14, ^bb3, ^bb4
    ^bb3:
      func.return %arg0 : i64
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %16 = llvm.mlir.constant(1 : i64) : i64
    %17 = llvm.alloca %16 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %17 : i64, !llvm.ptr
    %18 = llvm.load %17 : !llvm.ptr -> i64
    %19 = arith.constant 1 : i32
    %21 = arith.extsi %19 : i32 to i64
    %20 = arith.addi %18, %21 : i64
    %22 = arith.constant 2 : i32
    %24 = arith.extsi %22 : i32 to i64
    %23 = arith.divsi %20, %24 : i64
    %25 = llvm.mlir.constant(1 : i64) : i64
    %26 = llvm.alloca %25 x i64 : (i64) -> !llvm.ptr
    llvm.store %23, %26 : i64, !llvm.ptr
    cf.br ^bb6
    ^bb6:
    %27 = llvm.load %26 : !llvm.ptr -> i64
    %28 = llvm.load %17 : !llvm.ptr -> i64
    %29 = arith.cmpi slt, %27, %28 : i64
    cf.cond_br %29, ^bb7, ^bb8
    ^bb7:
      %30 = llvm.load %26 : !llvm.ptr -> i64
      llvm.store %30, %17 : i64, !llvm.ptr
      %31 = llvm.load %17 : !llvm.ptr -> i64
      %32 = llvm.load %17 : !llvm.ptr -> i64
      %33 = arith.divsi %arg0, %32 : i64
      %34 = arith.addi %31, %33 : i64
      %35 = arith.constant 2 : i32
      %37 = arith.extsi %35 : i32 to i64
      %36 = arith.divsi %34, %37 : i64
      llvm.store %36, %26 : i64, !llvm.ptr
      cf.br ^bb6
    ^bb8:
    %38 = llvm.load %17 : !llvm.ptr -> i64
    func.return %38 : i64
  }
  func.func @modinv(%arg0: i64, %arg1: i64) -> i64 {
    %39 = arith.remsi %arg0, %arg1 : i64
    %40 = llvm.mlir.constant(1 : i64) : i64
    %41 = llvm.alloca %40 x i64 : (i64) -> !llvm.ptr
    llvm.store %39, %41 : i64, !llvm.ptr
    %42 = llvm.load %41 : !llvm.ptr -> i64
    %43 = arith.constant 0 : i32
    %45 = arith.extsi %43 : i32 to i64
    %44 = arith.cmpi slt, %42, %45 : i64
    cf.cond_br %44, ^bb9, ^bb10
    ^bb9:
      %46 = llvm.load %41 : !llvm.ptr -> i64
      %47 = arith.addi %46, %arg1 : i64
      llvm.store %47, %41 : i64, !llvm.ptr
      cf.br ^bb11
    ^bb10:
      cf.br ^bb11
    ^bb11:
    %48 = llvm.mlir.constant(1 : i64) : i64
    %49 = llvm.alloca %48 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %49 : i64, !llvm.ptr
    %50 = arith.constant 1 : i32
    %51 = arith.extsi %50 : i32 to i64
    %52 = llvm.mlir.constant(1 : i64) : i64
    %53 = llvm.alloca %52 x i64 : (i64) -> !llvm.ptr
    llvm.store %51, %53 : i64, !llvm.ptr
    %54 = arith.constant 0 : i32
    %55 = arith.extsi %54 : i32 to i64
    %56 = llvm.mlir.constant(1 : i64) : i64
    %57 = llvm.alloca %56 x i64 : (i64) -> !llvm.ptr
    llvm.store %55, %57 : i64, !llvm.ptr
    cf.br ^bb12
    ^bb12:
    %58 = llvm.load %49 : !llvm.ptr -> i64
    %59 = arith.constant 0 : i32
    %61 = arith.extsi %59 : i32 to i64
    %60 = arith.cmpi ne, %58, %61 : i64
    cf.cond_br %60, ^bb13, ^bb14
    ^bb13:
      %62 = llvm.load %41 : !llvm.ptr -> i64
      %63 = llvm.load %49 : !llvm.ptr -> i64
      %64 = arith.divsi %62, %63 : i64
      %65 = llvm.load %41 : !llvm.ptr -> i64
      %66 = llvm.load %49 : !llvm.ptr -> i64
      %67 = arith.muli %64, %66 : i64
      %68 = arith.subi %65, %67 : i64
      %69 = llvm.load %49 : !llvm.ptr -> i64
      llvm.store %69, %41 : i64, !llvm.ptr
      llvm.store %68, %49 : i64, !llvm.ptr
      %70 = llvm.load %53 : !llvm.ptr -> i64
      %71 = llvm.load %57 : !llvm.ptr -> i64
      %72 = arith.muli %64, %71 : i64
      %73 = arith.subi %70, %72 : i64
      %74 = llvm.load %57 : !llvm.ptr -> i64
      llvm.store %74, %53 : i64, !llvm.ptr
      llvm.store %73, %57 : i64, !llvm.ptr
      cf.br ^bb12
    ^bb14:
    %75 = llvm.load %53 : !llvm.ptr -> i64
    %76 = arith.remsi %75, %arg1 : i64
    %77 = llvm.mlir.constant(1 : i64) : i64
    %78 = llvm.alloca %77 x i64 : (i64) -> !llvm.ptr
    llvm.store %76, %78 : i64, !llvm.ptr
    %79 = llvm.load %78 : !llvm.ptr -> i64
    %80 = arith.constant 0 : i32
    %82 = arith.extsi %80 : i32 to i64
    %81 = arith.cmpi slt, %79, %82 : i64
    cf.cond_br %81, ^bb15, ^bb16
    ^bb15:
      %83 = llvm.load %78 : !llvm.ptr -> i64
      %84 = arith.addi %83, %arg1 : i64
      llvm.store %84, %78 : i64, !llvm.ptr
      cf.br ^bb17
    ^bb16:
      cf.br ^bb17
    ^bb17:
    %85 = llvm.load %78 : !llvm.ptr -> i64
    func.return %85 : i64
  }
  func.func @floordiv(%arg0: i64, %arg1: i64) -> i64 {
    %86 = arith.divsi %arg0, %arg1 : i64
    %87 = arith.remsi %arg0, %arg1 : i64
    %88 = arith.constant 0 : i32
    %90 = arith.extsi %88 : i32 to i64
    %89 = arith.cmpi ne, %87, %90 : i64
    %91 = scf.if %89 -> (i1) {
      %92 = arith.constant 0 : i32
      %94 = arith.extsi %92 : i32 to i64
      %93 = arith.cmpi sgt, %87, %94 : i64
      %95 = arith.constant 0 : i32
      %97 = arith.extsi %95 : i32 to i64
      %96 = arith.cmpi sgt, %arg1, %97 : i64
      %98 = arith.cmpi ne, %93, %96 : i1
      scf.yield %98 : i1
    } else {
      %99 = arith.constant false
      scf.yield %99 : i1
    }
    cf.cond_br %91, ^bb18, ^bb19
    ^bb18:
      %100 = arith.constant 1 : i32
      %102 = arith.extsi %100 : i32 to i64
      %101 = arith.subi %86, %102 : i64
      func.return %101 : i64
    ^bb19:
      cf.br ^bb20
    ^bb20:
    func.return %86 : i64
  }
  func.func @leaf_count(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: i64, %arg8: i64, %arg9: i64, %arg10: !llvm.ptr, %arg11: !llvm.ptr) -> () {
    %103 = llvm.mlir.constant(1 : i64) : i64
    %104 = llvm.alloca %103 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg5, %104 : i64, !llvm.ptr
    %105 = llvm.load %104 : !llvm.ptr -> i64
    %107 = llvm.getelementptr %arg2[%arg4] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %106 = llvm.load %107 : !llvm.ptr -> i64
    %108 = arith.cmpi slt, %105, %106 : i64
    cf.cond_br %108, ^bb21, ^bb22
    ^bb21:
      %110 = llvm.getelementptr %arg2[%arg4] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %109 = llvm.load %110 : !llvm.ptr -> i64
      llvm.store %109, %104 : i64, !llvm.ptr
      cf.br ^bb23
    ^bb22:
      cf.br ^bb23
    ^bb23:
    %111 = arith.divsi %arg8, %arg0 : i64
    %112 = llvm.mlir.constant(1 : i64) : i64
    %113 = llvm.alloca %112 x i64 : (i64) -> !llvm.ptr
    llvm.store %111, %113 : i64, !llvm.ptr
    %114 = llvm.load %113 : !llvm.ptr -> i64
    %115 = arith.cmpi sgt, %114, %arg9 : i64
    cf.cond_br %115, ^bb24, ^bb25
    ^bb24:
      llvm.store %arg9, %113 : i64, !llvm.ptr
      cf.br ^bb26
    ^bb25:
      cf.br ^bb26
    ^bb26:
    %116 = llvm.load %104 : !llvm.ptr -> i64
    %117 = llvm.load %113 : !llvm.ptr -> i64
    %118 = arith.cmpi sgt, %116, %117 : i64
    cf.cond_br %118, ^bb27, ^bb28
    ^bb27:
      func.return
    ^bb28:
      cf.br ^bb29
    ^bb29:
    %119 = arith.constant 1 : i32
    %121 = arith.extsi %119 : i32 to i64
    %120 = arith.cmpi eq, %arg6, %121 : i64
    cf.cond_br %120, ^bb30, ^bb31
    ^bb30:
      %122 = llvm.mlir.constant(1 : i64) : i64
      %123 = llvm.alloca %122 x i64 : (i64) -> !llvm.ptr
      llvm.store %arg4, %123 : i64, !llvm.ptr
      %124 = llvm.mlir.constant(1 : i64) : i64
      %125 = llvm.alloca %124 x i64 : (i64) -> !llvm.ptr
      llvm.store %arg3, %125 : i64, !llvm.ptr
      cf.br ^bb33
      ^bb33:
      %126 = llvm.load %123 : !llvm.ptr -> i64
      %127 = llvm.load %125 : !llvm.ptr -> i64
      %128 = arith.cmpi slt, %126, %127 : i64
      cf.cond_br %128, ^bb34, ^bb35
      ^bb34:
        %129 = llvm.load %123 : !llvm.ptr -> i64
        %130 = llvm.load %125 : !llvm.ptr -> i64
        %131 = arith.addi %129, %130 : i64
        %132 = arith.constant 2 : i32
        %134 = arith.extsi %132 : i32 to i64
        %133 = arith.divsi %131, %134 : i64
        %136 = llvm.getelementptr %arg2[%133] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %135 = llvm.load %136 : !llvm.ptr -> i64
        %137 = llvm.load %104 : !llvm.ptr -> i64
        %138 = arith.cmpi slt, %135, %137 : i64
        cf.cond_br %138, ^bb36, ^bb37
        ^bb36:
          %139 = arith.constant 1 : i32
          %141 = arith.extsi %139 : i32 to i64
          %140 = arith.addi %133, %141 : i64
          llvm.store %140, %123 : i64, !llvm.ptr
          cf.br ^bb38
        ^bb37:
          llvm.store %133, %125 : i64, !llvm.ptr
          cf.br ^bb38
        ^bb38:
        cf.br ^bb33
      ^bb35:
      %142 = llvm.load %123 : !llvm.ptr -> i64
      %143 = llvm.mlir.constant(1 : i64) : i64
      %144 = llvm.alloca %143 x i64 : (i64) -> !llvm.ptr
      llvm.store %142, %144 : i64, !llvm.ptr
      cf.br ^bb39
      ^bb39:
      %145 = llvm.load %144 : !llvm.ptr -> i64
      %146 = arith.cmpi slt, %145, %arg3 : i64
      cf.cond_br %146, ^bb40, ^bb41
      ^bb40:
        %148 = llvm.load %144 : !llvm.ptr -> i64
        %149 = llvm.getelementptr %arg2[%148] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %147 = llvm.load %149 : !llvm.ptr -> i64
        %150 = llvm.load %113 : !llvm.ptr -> i64
        %151 = arith.cmpi sgt, %147, %150 : i64
        cf.cond_br %151, ^bb42, ^bb43
        ^bb42:
          cf.br ^bb41
        ^bb43:
          cf.br ^bb44
        ^bb44:
        %152 = arith.constant 3 : i32
        %154 = arith.extsi %152 : i32 to i64
        %153 = arith.addi %arg0, %154 : i64
        %155 = arith.constant 1 : i32
        %157 = arith.extsi %155 : i32 to i64
        %156 = arith.subi %147, %157 : i64
        %158 = arith.remsi %153, %156 : i64
        %159 = arith.constant 0 : i32
        %161 = arith.extsi %159 : i32 to i64
        %160 = arith.cmpi eq, %158, %161 : i64
        cf.cond_br %160, ^bb45, ^bb46
        ^bb45:
          %163 = arith.constant 0 : i32
          %164 = arith.extsi %163 : i32 to i64
          %165 = llvm.getelementptr %arg11[%164] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %162 = llvm.load %165 : !llvm.ptr -> i64
          %166 = arith.muli %arg0, %147 : i64
          %167 = arith.addi %162, %166 : i64
          %168 = arith.constant 0 : i32
          %169 = arith.extsi %168 : i32 to i64
          %170 = llvm.getelementptr %arg11[%169] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %167, %170 : i64, !llvm.ptr
          cf.br ^bb47
        ^bb46:
          cf.br ^bb47
        ^bb47:
        %171 = llvm.load %144 : !llvm.ptr -> i64
        %172 = arith.constant 1 : i32
        %174 = arith.extsi %172 : i32 to i64
        %173 = arith.addi %171, %174 : i64
        llvm.store %173, %144 : i64, !llvm.ptr
        cf.br ^bb39
      ^bb41:
      func.return
    ^bb31:
      cf.br ^bb32
    ^bb32:
    %175 = arith.constant 2 : i32
    %177 = arith.extsi %175 : i32 to i64
    %176 = arith.cmpi sle, %arg6, %177 : i64
    cf.cond_br %176, ^bb48, ^bb49
    ^bb48:
      %178 = llvm.mlir.constant(1 : i64) : i64
      %179 = llvm.alloca %178 x i64 : (i64) -> !llvm.ptr
      llvm.store %arg4, %179 : i64, !llvm.ptr
      %180 = llvm.mlir.constant(1 : i64) : i64
      %181 = llvm.alloca %180 x i64 : (i64) -> !llvm.ptr
      llvm.store %arg3, %181 : i64, !llvm.ptr
      cf.br ^bb51
      ^bb51:
      %182 = llvm.load %179 : !llvm.ptr -> i64
      %183 = llvm.load %181 : !llvm.ptr -> i64
      %184 = arith.cmpi slt, %182, %183 : i64
      cf.cond_br %184, ^bb52, ^bb53
      ^bb52:
        %185 = llvm.load %179 : !llvm.ptr -> i64
        %186 = llvm.load %181 : !llvm.ptr -> i64
        %187 = arith.addi %185, %186 : i64
        %188 = arith.constant 2 : i32
        %190 = arith.extsi %188 : i32 to i64
        %189 = arith.divsi %187, %190 : i64
        %192 = llvm.getelementptr %arg2[%189] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %191 = llvm.load %192 : !llvm.ptr -> i64
        %193 = llvm.load %104 : !llvm.ptr -> i64
        %194 = arith.cmpi slt, %191, %193 : i64
        cf.cond_br %194, ^bb54, ^bb55
        ^bb54:
          %195 = arith.constant 1 : i32
          %197 = arith.extsi %195 : i32 to i64
          %196 = arith.addi %189, %197 : i64
          llvm.store %196, %179 : i64, !llvm.ptr
          cf.br ^bb56
        ^bb55:
          llvm.store %189, %181 : i64, !llvm.ptr
          cf.br ^bb56
        ^bb56:
        cf.br ^bb51
      ^bb53:
      %198 = llvm.load %179 : !llvm.ptr -> i64
      %199 = llvm.mlir.constant(1 : i64) : i64
      %200 = llvm.alloca %199 x i64 : (i64) -> !llvm.ptr
      llvm.store %198, %200 : i64, !llvm.ptr
      cf.br ^bb57
      ^bb57:
      %201 = llvm.load %200 : !llvm.ptr -> i64
      %202 = arith.cmpi slt, %201, %arg3 : i64
      cf.cond_br %202, ^bb58, ^bb59
      ^bb58:
        %204 = llvm.load %200 : !llvm.ptr -> i64
        %205 = llvm.getelementptr %arg2[%204] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %203 = llvm.load %205 : !llvm.ptr -> i64
        %206 = llvm.load %113 : !llvm.ptr -> i64
        %207 = arith.cmpi sgt, %203, %206 : i64
        cf.cond_br %207, ^bb60, ^bb61
        ^bb60:
          cf.br ^bb59
        ^bb61:
          cf.br ^bb62
        ^bb62:
        %208 = arith.subi %203, %arg7 : i64
        %209 = arith.remsi %208, %arg6 : i64
        %210 = arith.constant 0 : i32
        %212 = arith.extsi %210 : i32 to i64
        %211 = arith.cmpi eq, %209, %212 : i64
        %213 = scf.if %211 -> (i1) {
          %214 = arith.constant 3 : i32
          %216 = arith.extsi %214 : i32 to i64
          %215 = arith.addi %arg0, %216 : i64
          %217 = arith.constant 1 : i32
          %219 = arith.extsi %217 : i32 to i64
          %218 = arith.subi %203, %219 : i64
          %220 = arith.remsi %215, %218 : i64
          %221 = arith.constant 0 : i32
          %223 = arith.extsi %221 : i32 to i64
          %222 = arith.cmpi eq, %220, %223 : i64
          scf.yield %222 : i1
        } else {
          %224 = arith.constant false
          scf.yield %224 : i1
        }
        cf.cond_br %213, ^bb63, ^bb64
        ^bb63:
          %226 = arith.constant 0 : i32
          %227 = arith.extsi %226 : i32 to i64
          %228 = llvm.getelementptr %arg11[%227] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %225 = llvm.load %228 : !llvm.ptr -> i64
          %229 = arith.muli %arg0, %203 : i64
          %230 = arith.addi %225, %229 : i64
          %231 = arith.constant 0 : i32
          %232 = arith.extsi %231 : i32 to i64
          %233 = llvm.getelementptr %arg11[%232] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %230, %233 : i64, !llvm.ptr
          cf.br ^bb65
        ^bb64:
          cf.br ^bb65
        ^bb65:
        %234 = llvm.load %200 : !llvm.ptr -> i64
        %235 = arith.constant 1 : i32
        %237 = arith.extsi %235 : i32 to i64
        %236 = arith.addi %234, %237 : i64
        llvm.store %236, %200 : i64, !llvm.ptr
        cf.br ^bb57
      ^bb59:
      func.return
    ^bb49:
      cf.br ^bb50
    ^bb50:
    %238 = llvm.mlir.constant(1 : i64) : i64
    %239 = llvm.alloca %238 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg7, %239 : i64, !llvm.ptr
    %240 = llvm.load %239 : !llvm.ptr -> i64
    %241 = llvm.load %104 : !llvm.ptr -> i64
    %242 = arith.cmpi slt, %240, %241 : i64
    cf.cond_br %242, ^bb66, ^bb67
    ^bb66:
      %243 = llvm.load %239 : !llvm.ptr -> i64
      %244 = llvm.load %104 : !llvm.ptr -> i64
      %245 = llvm.load %239 : !llvm.ptr -> i64
      %246 = arith.subi %244, %245 : i64
      %247 = arith.addi %246, %arg6 : i64
      %248 = arith.constant 1 : i32
      %250 = arith.extsi %248 : i32 to i64
      %249 = arith.subi %247, %250 : i64
      %251 = arith.divsi %249, %arg6 : i64
      %252 = arith.muli %251, %arg6 : i64
      %253 = arith.addi %243, %252 : i64
      llvm.store %253, %239 : i64, !llvm.ptr
      cf.br ^bb68
    ^bb67:
      cf.br ^bb68
    ^bb68:
    cf.br ^bb69
    ^bb69:
    %254 = llvm.load %239 : !llvm.ptr -> i64
    %255 = llvm.load %113 : !llvm.ptr -> i64
    %256 = arith.cmpi sle, %254, %255 : i64
    cf.cond_br %256, ^bb70, ^bb71
    ^bb70:
      %258 = llvm.load %239 : !llvm.ptr -> i64
      %259 = llvm.getelementptr %arg10[%258] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %257 = llvm.load %259 : !llvm.ptr -> i8
      %260 = arith.constant 1 : i32
      %262 = arith.extsi %257 : i8 to i32
      %261 = arith.cmpi eq, %262, %260 : i32
      %263 = scf.if %261 -> (i1) {
        %264 = arith.constant 3 : i32
        %266 = arith.extsi %264 : i32 to i64
        %265 = arith.addi %arg0, %266 : i64
        %267 = llvm.load %239 : !llvm.ptr -> i64
        %268 = arith.constant 1 : i32
        %270 = arith.extsi %268 : i32 to i64
        %269 = arith.subi %267, %270 : i64
        %271 = arith.remsi %265, %269 : i64
        %272 = arith.constant 0 : i32
        %274 = arith.extsi %272 : i32 to i64
        %273 = arith.cmpi eq, %271, %274 : i64
        scf.yield %273 : i1
      } else {
        %275 = arith.constant false
        scf.yield %275 : i1
      }
      cf.cond_br %263, ^bb72, ^bb73
      ^bb72:
        %277 = arith.constant 0 : i32
        %278 = arith.extsi %277 : i32 to i64
        %279 = llvm.getelementptr %arg11[%278] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %276 = llvm.load %279 : !llvm.ptr -> i64
        %280 = llvm.load %239 : !llvm.ptr -> i64
        %281 = arith.muli %arg0, %280 : i64
        %282 = arith.addi %276, %281 : i64
        %283 = arith.constant 0 : i32
        %284 = arith.extsi %283 : i32 to i64
        %285 = llvm.getelementptr %arg11[%284] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %282, %285 : i64, !llvm.ptr
        cf.br ^bb74
      ^bb73:
        cf.br ^bb74
      ^bb74:
      %286 = llvm.load %239 : !llvm.ptr -> i64
      %287 = arith.addi %286, %arg6 : i64
      llvm.store %287, %239 : i64, !llvm.ptr
      cf.br ^bb69
    ^bb71:
    func.return
  }
  func.func @dfs(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: !llvm.ptr, %arg8: !llvm.ptr) -> () {
    %288 = arith.constant 3 : i32
    %290 = arith.extsi %288 : i32 to i64
    %289 = arith.addi %arg0, %290 : i64
    %291 = arith.remsi %289, %arg1 : i64
    %292 = arith.constant 0 : i32
    %294 = arith.extsi %292 : i32 to i64
    %293 = arith.cmpi eq, %291, %294 : i64
    cf.cond_br %293, ^bb75, ^bb76
    ^bb75:
      %296 = arith.constant 0 : i32
      %297 = arith.extsi %296 : i32 to i64
      %298 = llvm.getelementptr %arg8[%297] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %295 = llvm.load %298 : !llvm.ptr -> i64
      %299 = arith.addi %295, %arg0 : i64
      %300 = arith.constant 0 : i32
      %301 = arith.extsi %300 : i32 to i64
      %302 = llvm.getelementptr %arg8[%301] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %299, %302 : i64, !llvm.ptr
      cf.br ^bb77
    ^bb76:
      cf.br ^bb77
    ^bb77:
    %303 = arith.cmpi sge, %arg4, %arg3 : i64
    cf.cond_br %303, ^bb78, ^bb79
    ^bb78:
      func.return
    ^bb79:
      cf.br ^bb80
    ^bb80:
    %305 = arith.divsi %arg5, %arg0 : i64
    %304 = func.call @isqrt(%305) : (i64) -> i64
    %306 = arith.constant 1 : i32
    %308 = arith.extsi %306 : i32 to i64
    %307 = arith.addi %304, %308 : i64
    %309 = func.call @gcd(%arg0, %arg1) : (i64, i64) -> i64
    %310 = arith.constant 3 : i32
    %312 = arith.extsi %310 : i32 to i64
    %311 = arith.remsi %312, %309 : i64
    %313 = arith.constant 0 : i32
    %315 = arith.extsi %313 : i32 to i64
    %314 = arith.cmpi ne, %311, %315 : i64
    cf.cond_br %314, ^bb81, ^bb82
    ^bb81:
      func.return
    ^bb82:
      cf.br ^bb83
    ^bb83:
    %316 = arith.divsi %arg1, %309 : i64
    %317 = arith.constant 0 : i32
    %318 = arith.extsi %317 : i32 to i64
    %319 = llvm.mlir.constant(1 : i64) : i64
    %320 = llvm.alloca %319 x i64 : (i64) -> !llvm.ptr
    llvm.store %318, %320 : i64, !llvm.ptr
    %321 = arith.constant 1 : i32
    %323 = arith.extsi %321 : i32 to i64
    %322 = arith.cmpi sgt, %316, %323 : i64
    cf.cond_br %322, ^bb84, ^bb85
    ^bb84:
      %324 = arith.divsi %arg0, %309 : i64
      %325 = func.call @modinv(%324, %316) : (i64, i64) -> i64
      %327 = arith.constant 3 : i32
      %329 = arith.constant 0 : i32
      %328 = arith.subi %329, %327 : i32
      %330 = arith.extsi %328 : i32 to i64
      %326 = func.call @floordiv(%330, %309) : (i64, i64) -> i64
      %331 = arith.remsi %326, %316 : i64
      %332 = arith.addi %331, %316 : i64
      %333 = arith.remsi %332, %316 : i64
      llvm.store %333, %320 : i64, !llvm.ptr
      %334 = llvm.load %320 : !llvm.ptr -> i64
      %335 = arith.muli %334, %325 : i64
      %336 = arith.remsi %335, %316 : i64
      llvm.store %336, %320 : i64, !llvm.ptr
      cf.br ^bb86
    ^bb85:
      cf.br ^bb86
    ^bb86:
    %337 = llvm.load %320 : !llvm.ptr -> i64
    %338 = llvm.mlir.constant(1 : i64) : i64
    %339 = llvm.alloca %338 x i64 : (i64) -> !llvm.ptr
    llvm.store %337, %339 : i64, !llvm.ptr
    %340 = llvm.load %339 : !llvm.ptr -> i64
    %342 = llvm.getelementptr %arg2[%arg4] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %341 = llvm.load %342 : !llvm.ptr -> i64
    %343 = arith.cmpi slt, %340, %341 : i64
    cf.cond_br %343, ^bb87, ^bb88
    ^bb87:
      %345 = llvm.getelementptr %arg2[%arg4] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %344 = llvm.load %345 : !llvm.ptr -> i64
      llvm.store %344, %339 : i64, !llvm.ptr
      cf.br ^bb89
    ^bb88:
      cf.br ^bb89
    ^bb89:
    %346 = llvm.load %339 : !llvm.ptr -> i64
    %347 = arith.muli %arg0, %346 : i64
    %348 = arith.cmpi sgt, %347, %arg5 : i64
    cf.cond_br %348, ^bb90, ^bb91
    ^bb90:
      func.return
    ^bb91:
      cf.br ^bb92
    ^bb92:
    %349 = arith.cmpi sle, %307, %arg6 : i64
    cf.cond_br %349, ^bb93, ^bb94
    ^bb93:
      %351 = llvm.load %320 : !llvm.ptr -> i64
      func.call @leaf_count(%arg0, %arg1, %arg2, %arg3, %arg4, %307, %316, %351, %arg5, %arg6, %arg7, %arg8) : (i64, i64, !llvm.ptr, i64, i64, i64, i64, i64, i64, i64, !llvm.ptr, !llvm.ptr) -> ()
      cf.br ^bb95
    ^bb94:
      cf.br ^bb95
    ^bb95:
    %352 = llvm.mlir.constant(1 : i64) : i64
    %353 = llvm.alloca %352 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg4, %353 : i64, !llvm.ptr
    cf.br ^bb96
    ^bb96:
    %354 = llvm.load %353 : !llvm.ptr -> i64
    %355 = arith.cmpi slt, %354, %arg3 : i64
    cf.cond_br %355, ^bb97, ^bb98
    ^bb97:
      %357 = llvm.load %353 : !llvm.ptr -> i64
      %358 = llvm.getelementptr %arg2[%357] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %356 = llvm.load %358 : !llvm.ptr -> i64
      %359 = arith.cmpi sgt, %356, %304 : i64
      cf.cond_br %359, ^bb99, ^bb100
      ^bb99:
        cf.br ^bb98
      ^bb100:
        cf.br ^bb101
      ^bb101:
      %360 = arith.muli %arg0, %356 : i64
      %361 = arith.constant 1 : i32
      %363 = arith.extsi %361 : i32 to i64
      %362 = arith.subi %356, %363 : i64
      %364 = func.call @gcd(%arg1, %362) : (i64, i64) -> i64
      %365 = arith.divsi %arg1, %364 : i64
      %366 = arith.muli %365, %362 : i64
      %367 = func.call @gcd(%360, %366) : (i64, i64) -> i64
      %368 = arith.constant 1 : i32
      %370 = arith.extsi %368 : i32 to i64
      %369 = arith.cmpi eq, %367, %370 : i64
      %371 = scf.if %369 -> (i1) {
        %372 = arith.constant true
        scf.yield %372 : i1
      } else {
        %373 = arith.constant 3 : i32
        %375 = arith.extsi %373 : i32 to i64
        %374 = arith.cmpi eq, %367, %375 : i64
        scf.yield %374 : i1
      }
      cf.cond_br %371, ^bb102, ^bb103
      ^bb102:
        %377 = llvm.load %353 : !llvm.ptr -> i64
        %378 = arith.constant 1 : i32
        %380 = arith.extsi %378 : i32 to i64
        %379 = arith.addi %377, %380 : i64
        func.call @dfs(%360, %366, %arg2, %arg3, %379, %arg5, %arg6, %arg7, %arg8) : (i64, i64, !llvm.ptr, i64, i64, i64, i64, !llvm.ptr, !llvm.ptr) -> ()
        cf.br ^bb104
      ^bb103:
        cf.br ^bb104
      ^bb104:
      %381 = llvm.load %353 : !llvm.ptr -> i64
      %382 = arith.constant 1 : i32
      %384 = arith.extsi %382 : i32 to i64
      %383 = arith.addi %381, %384 : i64
      llvm.store %383, %353 : i64, !llvm.ptr
      cf.br ^bb96
    ^bb98:
    func.return
  }
  func.func @main() -> i32 {
    %385 = llvm.mlir.addressof @N_LIMIT : !llvm.ptr
    %386 = llvm.load %385 : !llvm.ptr -> i64
    %388 = arith.constant 4 : i32
    %390 = arith.extsi %388 : i32 to i64
    %389 = arith.addi %386, %390 : i64
    %387 = func.call @isqrt(%389) : (i64) -> i64
    %391 = arith.constant 5 : i32
    %393 = arith.extsi %391 : i32 to i64
    %392 = arith.addi %387, %393 : i64
    %395 = arith.constant 1 : i32
    %397 = arith.extsi %395 : i32 to i64
    %396 = arith.addi %392, %397 : i64
    %398 = arith.constant 1 : i32
    %399 = arith.extsi %398 : i32 to i64
    %394 = func.call @calloc(%396, %399) : (i64, i64) -> !llvm.ptr
    %401 = arith.constant 80000 : i32
    %402 = arith.constant 8 : i32
    %403 = arith.extsi %401 : i32 to i64
    %404 = arith.extsi %402 : i32 to i64
    %400 = func.call @calloc(%403, %404) : (i64, i64) -> !llvm.ptr
    %406 = arith.constant 80000 : i32
    %407 = arith.constant 8 : i32
    %408 = arith.extsi %406 : i32 to i64
    %409 = arith.extsi %407 : i32 to i64
    %405 = func.call @calloc(%408, %409) : (i64, i64) -> !llvm.ptr
    %411 = arith.constant 1 : i32
    %412 = arith.constant 8 : i32
    %413 = arith.extsi %411 : i32 to i64
    %414 = arith.extsi %412 : i32 to i64
    %410 = func.call @calloc(%413, %414) : (i64, i64) -> !llvm.ptr
    %415 = llvm.mlir.zero : !llvm.ptr
    %416 = llvm.icmp "eq" %394, %415 : !llvm.ptr
    %417 = scf.if %416 -> (i1) {
      %418 = arith.constant true
      scf.yield %418 : i1
    } else {
      %419 = llvm.mlir.zero : !llvm.ptr
      %420 = llvm.icmp "eq" %400, %419 : !llvm.ptr
      scf.yield %420 : i1
    }
    %421 = scf.if %417 -> (i1) {
      %422 = arith.constant true
      scf.yield %422 : i1
    } else {
      %423 = llvm.mlir.zero : !llvm.ptr
      %424 = llvm.icmp "eq" %410, %423 : !llvm.ptr
      scf.yield %424 : i1
    }
    cf.cond_br %421, ^bb105, ^bb106
    ^bb105:
      %425 = arith.constant 1 : i32
      func.return %425 : i32
    ^bb106:
      cf.br ^bb107
    ^bb107:
    %426 = arith.constant 0 : i32
    %427 = arith.extsi %426 : i32 to i64
    %428 = llvm.mlir.constant(1 : i64) : i64
    %429 = llvm.alloca %428 x i64 : (i64) -> !llvm.ptr
    llvm.store %427, %429 : i64, !llvm.ptr
    cf.br ^bb108
    ^bb108:
    %430 = llvm.load %429 : !llvm.ptr -> i64
    %431 = arith.cmpi sle, %430, %392 : i64
    cf.cond_br %431, ^bb109, ^bb110
    ^bb109:
      %432 = arith.constant 1 : i32
      %433 = llvm.load %429 : !llvm.ptr -> i64
      %434 = arith.trunci %432 : i32 to i8
      %435 = llvm.getelementptr %394[%433] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %434, %435 : i8, !llvm.ptr
      %436 = llvm.load %429 : !llvm.ptr -> i64
      %437 = arith.constant 1 : i32
      %439 = arith.extsi %437 : i32 to i64
      %438 = arith.addi %436, %439 : i64
      llvm.store %438, %429 : i64, !llvm.ptr
      cf.br ^bb108
    ^bb110:
    %440 = arith.constant 0 : i32
    %441 = arith.constant 0 : i32
    %442 = arith.trunci %440 : i32 to i8
    %443 = arith.extsi %441 : i32 to i64
    %444 = llvm.getelementptr %394[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %442, %444 : i8, !llvm.ptr
    %445 = arith.constant 0 : i32
    %446 = arith.constant 1 : i32
    %447 = arith.trunci %445 : i32 to i8
    %448 = arith.extsi %446 : i32 to i64
    %449 = llvm.getelementptr %394[%448] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %447, %449 : i8, !llvm.ptr
    %450 = arith.constant 4 : i32
    %452 = arith.extsi %450 : i32 to i64
    %451 = arith.cmpi sge, %392, %452 : i64
    cf.cond_br %451, ^bb111, ^bb112
    ^bb111:
      %453 = arith.constant 4 : i32
      %454 = arith.extsi %453 : i32 to i64
      llvm.store %454, %429 : i64, !llvm.ptr
      cf.br ^bb114
      ^bb114:
      %455 = llvm.load %429 : !llvm.ptr -> i64
      %456 = arith.cmpi sle, %455, %392 : i64
      cf.cond_br %456, ^bb115, ^bb116
      ^bb115:
        %457 = arith.constant 0 : i32
        %458 = llvm.load %429 : !llvm.ptr -> i64
        %459 = arith.trunci %457 : i32 to i8
        %460 = llvm.getelementptr %394[%458] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %459, %460 : i8, !llvm.ptr
        %461 = llvm.load %429 : !llvm.ptr -> i64
        %462 = arith.constant 2 : i32
        %464 = arith.extsi %462 : i32 to i64
        %463 = arith.addi %461, %464 : i64
        llvm.store %463, %429 : i64, !llvm.ptr
        cf.br ^bb114
      ^bb116:
      cf.br ^bb113
    ^bb112:
      cf.br ^bb113
    ^bb113:
    %465 = func.call @isqrt(%392) : (i64) -> i64
    %466 = arith.constant 3 : i32
    %467 = arith.extsi %466 : i32 to i64
    %468 = llvm.mlir.constant(1 : i64) : i64
    %469 = llvm.alloca %468 x i64 : (i64) -> !llvm.ptr
    llvm.store %467, %469 : i64, !llvm.ptr
    cf.br ^bb117
    ^bb117:
    %470 = llvm.load %469 : !llvm.ptr -> i64
    %471 = arith.cmpi sle, %470, %465 : i64
    cf.cond_br %471, ^bb118, ^bb119
    ^bb118:
      %473 = llvm.load %469 : !llvm.ptr -> i64
      %474 = llvm.getelementptr %394[%473] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %472 = llvm.load %474 : !llvm.ptr -> i8
      %475 = arith.constant 1 : i32
      %477 = arith.extsi %472 : i8 to i32
      %476 = arith.cmpi eq, %477, %475 : i32
      cf.cond_br %476, ^bb120, ^bb121
      ^bb120:
        %478 = llvm.load %469 : !llvm.ptr -> i64
        %479 = llvm.load %469 : !llvm.ptr -> i64
        %480 = arith.muli %478, %479 : i64
        %481 = llvm.mlir.constant(1 : i64) : i64
        %482 = llvm.alloca %481 x i64 : (i64) -> !llvm.ptr
        llvm.store %480, %482 : i64, !llvm.ptr
        %483 = llvm.load %469 : !llvm.ptr -> i64
        %484 = arith.constant 1 : i32
        %486 = arith.extsi %484 : i32 to i64
        %485 = arith.shli %483, %486 : i64
        cf.br ^bb123
        ^bb123:
        %487 = llvm.load %482 : !llvm.ptr -> i64
        %488 = arith.cmpi sle, %487, %392 : i64
        cf.cond_br %488, ^bb124, ^bb125
        ^bb124:
          %489 = arith.constant 0 : i32
          %490 = llvm.load %482 : !llvm.ptr -> i64
          %491 = arith.trunci %489 : i32 to i8
          %492 = llvm.getelementptr %394[%490] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %491, %492 : i8, !llvm.ptr
          %493 = llvm.load %482 : !llvm.ptr -> i64
          %494 = arith.addi %493, %485 : i64
          llvm.store %494, %482 : i64, !llvm.ptr
          cf.br ^bb123
        ^bb125:
        cf.br ^bb122
      ^bb121:
        cf.br ^bb122
      ^bb122:
      %495 = llvm.load %469 : !llvm.ptr -> i64
      %496 = arith.constant 2 : i32
      %498 = arith.extsi %496 : i32 to i64
      %497 = arith.addi %495, %498 : i64
      llvm.store %497, %469 : i64, !llvm.ptr
      cf.br ^bb117
    ^bb119:
    %499 = arith.constant 0 : i32
    %500 = arith.extsi %499 : i32 to i64
    %501 = llvm.mlir.constant(1 : i64) : i64
    %502 = llvm.alloca %501 x i64 : (i64) -> !llvm.ptr
    llvm.store %500, %502 : i64, !llvm.ptr
    %503 = arith.constant 0 : i32
    %504 = arith.extsi %503 : i32 to i64
    %505 = llvm.mlir.constant(1 : i64) : i64
    %506 = llvm.alloca %505 x i64 : (i64) -> !llvm.ptr
    llvm.store %504, %506 : i64, !llvm.ptr
    %507 = arith.constant 2 : i32
    %508 = llvm.load %502 : !llvm.ptr -> i64
    %509 = arith.extsi %507 : i32 to i64
    %510 = llvm.getelementptr %400[%508] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %509, %510 : i64, !llvm.ptr
    %511 = llvm.load %502 : !llvm.ptr -> i64
    %512 = arith.constant 1 : i32
    %514 = arith.extsi %512 : i32 to i64
    %513 = arith.addi %511, %514 : i64
    llvm.store %513, %502 : i64, !llvm.ptr
    %515 = arith.constant 3 : i32
    %516 = arith.extsi %515 : i32 to i64
    llvm.store %516, %469 : i64, !llvm.ptr
    cf.br ^bb126
    ^bb126:
    %517 = llvm.load %469 : !llvm.ptr -> i64
    %518 = arith.cmpi sle, %517, %392 : i64
    cf.cond_br %518, ^bb127, ^bb128
    ^bb127:
      %520 = llvm.load %469 : !llvm.ptr -> i64
      %521 = llvm.getelementptr %394[%520] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %519 = llvm.load %521 : !llvm.ptr -> i8
      %522 = arith.constant 1 : i32
      %524 = arith.extsi %519 : i8 to i32
      %523 = arith.cmpi eq, %524, %522 : i32
      cf.cond_br %523, ^bb129, ^bb130
      ^bb129:
        %525 = llvm.load %469 : !llvm.ptr -> i64
        %526 = llvm.load %502 : !llvm.ptr -> i64
        %527 = llvm.getelementptr %400[%526] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %525, %527 : i64, !llvm.ptr
        %528 = llvm.load %502 : !llvm.ptr -> i64
        %529 = arith.constant 1 : i32
        %531 = arith.extsi %529 : i32 to i64
        %530 = arith.addi %528, %531 : i64
        llvm.store %530, %502 : i64, !llvm.ptr
        %532 = llvm.load %469 : !llvm.ptr -> i64
        %533 = arith.constant 5 : i32
        %535 = arith.extsi %533 : i32 to i64
        %534 = arith.cmpi sge, %532, %535 : i64
        %536 = scf.if %534 -> (i1) {
          %537 = llvm.load %469 : !llvm.ptr -> i64
          %538 = arith.constant 3 : i32
          %540 = arith.extsi %538 : i32 to i64
          %539 = arith.cmpi ne, %537, %540 : i64
          scf.yield %539 : i1
        } else {
          %541 = arith.constant false
          scf.yield %541 : i1
        }
        %542 = scf.if %536 -> (i1) {
          %543 = llvm.load %469 : !llvm.ptr -> i64
          %544 = arith.constant 3 : i32
          %546 = arith.extsi %544 : i32 to i64
          %545 = arith.remsi %543, %546 : i64
          %547 = arith.constant 2 : i32
          %549 = arith.extsi %547 : i32 to i64
          %548 = arith.cmpi eq, %545, %549 : i64
          scf.yield %548 : i1
        } else {
          %550 = arith.constant false
          scf.yield %550 : i1
        }
        cf.cond_br %542, ^bb132, ^bb133
        ^bb132:
          %551 = llvm.load %469 : !llvm.ptr -> i64
          %552 = llvm.load %506 : !llvm.ptr -> i64
          %553 = llvm.getelementptr %405[%552] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %551, %553 : i64, !llvm.ptr
          %554 = llvm.load %506 : !llvm.ptr -> i64
          %555 = arith.constant 1 : i32
          %557 = arith.extsi %555 : i32 to i64
          %556 = arith.addi %554, %557 : i64
          llvm.store %556, %506 : i64, !llvm.ptr
          cf.br ^bb134
        ^bb133:
          cf.br ^bb134
        ^bb134:
        cf.br ^bb131
      ^bb130:
        cf.br ^bb131
      ^bb131:
      %558 = llvm.load %469 : !llvm.ptr -> i64
      %559 = arith.constant 2 : i32
      %561 = arith.extsi %559 : i32 to i64
      %560 = arith.addi %558, %561 : i64
      llvm.store %560, %469 : i64, !llvm.ptr
      cf.br ^bb126
    ^bb128:
    %563 = llvm.load %502 : !llvm.ptr -> i64
    %564 = arith.constant 8 : i32
    %565 = arith.extsi %564 : i32 to i64
    %562 = func.call @calloc(%563, %565) : (i64, i64) -> !llvm.ptr
    %566 = arith.constant 0 : i32
    %567 = arith.extsi %566 : i32 to i64
    %568 = llvm.mlir.constant(1 : i64) : i64
    %569 = llvm.alloca %568 x i64 : (i64) -> !llvm.ptr
    llvm.store %567, %569 : i64, !llvm.ptr
    %570 = arith.constant 0 : i32
    %571 = arith.extsi %570 : i32 to i64
    llvm.store %571, %429 : i64, !llvm.ptr
    cf.br ^bb135
    ^bb135:
    %572 = llvm.load %429 : !llvm.ptr -> i64
    %573 = llvm.load %502 : !llvm.ptr -> i64
    %574 = arith.cmpi slt, %572, %573 : i64
    cf.cond_br %574, ^bb136, ^bb137
    ^bb136:
      %576 = llvm.load %429 : !llvm.ptr -> i64
      %577 = llvm.getelementptr %400[%576] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %575 = llvm.load %577 : !llvm.ptr -> i64
      %578 = arith.constant 5 : i32
      %580 = arith.extsi %578 : i32 to i64
      %579 = arith.cmpi sge, %575, %580 : i64
      cf.cond_br %579, ^bb138, ^bb139
      ^bb138:
        %582 = llvm.load %429 : !llvm.ptr -> i64
        %583 = llvm.getelementptr %400[%582] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %581 = llvm.load %583 : !llvm.ptr -> i64
        %584 = llvm.load %569 : !llvm.ptr -> i64
        %585 = llvm.getelementptr %562[%584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %581, %585 : i64, !llvm.ptr
        %586 = llvm.load %569 : !llvm.ptr -> i64
        %587 = arith.constant 1 : i32
        %589 = arith.extsi %587 : i32 to i64
        %588 = arith.addi %586, %589 : i64
        llvm.store %588, %569 : i64, !llvm.ptr
        cf.br ^bb140
      ^bb139:
        cf.br ^bb140
      ^bb140:
      %590 = llvm.load %429 : !llvm.ptr -> i64
      %591 = arith.constant 1 : i32
      %593 = arith.extsi %591 : i32 to i64
      %592 = arith.addi %590, %593 : i64
      llvm.store %592, %429 : i64, !llvm.ptr
      cf.br ^bb135
    ^bb137:
    %594 = arith.constant 2 : i32
    %596 = arith.extsi %594 : i32 to i64
    %595 = arith.cmpi sge, %386, %596 : i64
    cf.cond_br %595, ^bb141, ^bb142
    ^bb141:
      %597 = arith.constant 2 : i32
      %598 = arith.constant 0 : i32
      %599 = arith.extsi %597 : i32 to i64
      %600 = arith.extsi %598 : i32 to i64
      %601 = llvm.getelementptr %410[%600] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %599, %601 : i64, !llvm.ptr
      cf.br ^bb143
    ^bb142:
      cf.br ^bb143
    ^bb143:
    %602 = arith.constant 3 : i32
    %604 = arith.extsi %602 : i32 to i64
    %603 = arith.cmpi sge, %386, %604 : i64
    cf.cond_br %603, ^bb144, ^bb145
    ^bb144:
      %606 = arith.constant 3 : i32
      %607 = arith.constant 2 : i32
      %608 = llvm.load %569 : !llvm.ptr -> i64
      %609 = arith.constant 0 : i32
      %610 = arith.extsi %606 : i32 to i64
      %611 = arith.extsi %607 : i32 to i64
      %612 = arith.extsi %609 : i32 to i64
      func.call @dfs(%610, %611, %562, %608, %612, %386, %392, %394, %410) : (i64, i64, !llvm.ptr, i64, i64, i64, i64, !llvm.ptr, !llvm.ptr) -> ()
      cf.br ^bb146
    ^bb145:
      cf.br ^bb146
    ^bb146:
    %614 = arith.constant 1 : i32
    %615 = arith.constant 1 : i32
    %616 = llvm.load %506 : !llvm.ptr -> i64
    %617 = arith.constant 0 : i32
    %618 = arith.extsi %614 : i32 to i64
    %619 = arith.extsi %615 : i32 to i64
    %620 = arith.extsi %617 : i32 to i64
    func.call @dfs(%618, %619, %405, %616, %620, %386, %392, %394, %410) : (i64, i64, !llvm.ptr, i64, i64, i64, i64, !llvm.ptr, !llvm.ptr) -> ()
    %621 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %623 = arith.constant 0 : i32
    %624 = arith.extsi %623 : i32 to i64
    %625 = llvm.getelementptr %410[%624] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %622 = llvm.load %625 : !llvm.ptr -> i64
    %626 = llvm.call @printf(%621, %622) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%394) : (!llvm.ptr) -> ()
    func.call @free(%400) : (!llvm.ptr) -> ()
    func.call @free(%405) : (!llvm.ptr) -> ()
    func.call @free(%562) : (!llvm.ptr) -> ()
    func.call @free(%410) : (!llvm.ptr) -> ()
    %632 = arith.constant 0 : i32
    func.return %632 : i32
  }
}