Problem 556

Squarefree Gaussian Integers f(n)=(1/4)*sum_m F(m)*A(n/m^2) with Gaussian Möbius F and lattice counts A.

Answer52126939292957
Output52126939292957
StatusPASS
Native helperno
Runtime410 ms
Peak memory219360 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n log log n)
Space complexityO(n^2)O(n)
ApproachFlow solutionMobius sieve
VerdictSuboptimal

Flow source

# Project Euler 556
# Squarefree Gaussian Integers
# f(n)=(1/4)*sum_m F(m)*A(n/m^2) with Gaussian Möbius F and lattice counts A.

import euler.nt { isqrt }

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

function lattice_points_nonzero(x: i64) -> i64 {
    if x <= 0 { return 0 }
    let R: i64 = isqrt(x)
    let mut b: i64 = R
    let mut bb: i64 = b * b
    let mut s: i64 = 0
    let mut a: i64 = 1
    while a <= R {
        let aa: i64 = a * a
        while aa + bb > x {
            b = b - 1
            bb = b * b
        }
        s = s + b
        a = a + 1
    }
    return (s << 2) + (R << 2)
}

function compute_f(n: i64) -> i64 {
    let limit: i64 = isqrt(n)
    let spf: ptr<i32> = calloc(limit + 1, 4)
    let F: ptr<i16> = calloc(limit + 1, 2)
    let prefixF: ptr<i64> = calloc(limit + 1, 8)
    let r2: ptr<i32> = calloc(limit + 1, 4)
    let A_small: ptr<i32> = calloc(limit + 1, 4)
    if spf == null || F == null || prefixF == null || r2 == null || A_small == null { return -1 }

    let mut i: i64 = 0
    while i <= limit {
        spf[i] = 0
        i = i + 1
    }
    if limit >= 0 { spf[0] = 1 }
    if limit >= 1 { spf[1] = 1 }
    let r: i64 = isqrt(limit)
    i = 2
    while i <= r {
        if spf[i] == 0 {
            spf[i] = i as i32
            let mut j: i64 = i * i
            while j <= limit {
                if spf[j] == 0 { spf[j] = i as i32 }
                j = j + i
            }
        }
        i = i + 1
    }
    i = 2
    while i <= limit {
        if spf[i] == 0 { spf[i] = i as i32 }
        i = i + 1
    }

    F[1] = 1
    let mut nn: i64 = 2
    while nn <= limit {
        let p: i64 = spf[nn] as i64
        let mut rest: i64 = nn / p
        let mut e: i64 = 1
        while rest % p == 0 {
            rest = rest / p
            e = e + 1
        }
        let mut coef: i64 = 0
        if p == 2 {
            if e == 1 { coef = -1 }
        } elif (p & 3) == 1 {
            if e == 1 { coef = -2 } elif e == 2 { coef = 1 }
        } else {
            if e == 2 { coef = -1 }
        }
        if coef == 0 {
            F[nn] = 0
        } else {
            F[nn] = (F[rest] as i64 * coef) as i16
        }
        nn = nn + 1
    }

    let mut s: i64 = 0
    i = 1
    while i <= limit {
        s = s + (F[i] as i64)
        prefixF[i] = s
        i = i + 1
    }

    if limit >= 1 { r2[1] = 4 }
    nn = 2
    while nn <= limit {
        let p: i64 = spf[nn] as i64
        let mut rest: i64 = nn / p
        let mut e: i64 = 1
        while rest % p == 0 {
            rest = rest / p
            e = e + 1
        }
        let base: i64 = r2[rest] as i64
        if base == 0 {
            r2[nn] = 0
        } elif p == 2 {
            r2[nn] = base as i32
        } elif (p & 3) == 1 {
            r2[nn] = (base * (e + 1)) as i32
        } else {
            if (e & 1) != 0 { r2[nn] = 0 } else { r2[nn] = base as i32 }
        }
        nn = nn + 1
    }

    let mut acc: i64 = 0
    i = 1
    while i <= limit {
        acc = acc + (r2[i] as i64)
        A_small[i] = acc as i32
        i = i + 1
    }

    # Cache for large A(x): open addressing on x
    let CACHE_N: i64 = 200003
    let ckey: ptr<i64> = calloc(CACHE_N, 8)
    let cval: ptr<i64> = calloc(CACHE_N, 8)
    let cused: ptr<i8> = calloc(CACHE_N, 1)
    if ckey == null || cval == null || cused == null { return -1 }

    let mut total: i64 = 0
    let mut m: i64 = 1
    let M: i64 = limit
    while m <= M {
        let x: i64 = n / (m * m)
        if x == 0 { break }
        let mut m2: i64 = isqrt(n / x)
        if m2 > M { m2 = M }
        let sumF: i64 = prefixF[m2] - prefixF[m - 1]
        if sumF != 0 {
            let mut A: i64 = 0
            if x <= limit {
                A = A_small[x] as i64
            } else {
                let mut h: i64 = x % CACHE_N
                if h < 0 { h = -h }
                let mut found: i32 = 0
                let mut probes: i64 = 0
                while probes < 10000 {
                    if cused[h] == 0 {
                        A = lattice_points_nonzero(x)
                        cused[h] = 1
                        ckey[h] = x
                        cval[h] = A
                        found = 1
                        break
                    }
                    if ckey[h] == x {
                        A = cval[h]
                        found = 1
                        break
                    }
                    h = h + 1
                    if h >= CACHE_N { h = 0 }
                    probes = probes + 1
                }
                if found == 0 { A = lattice_points_nonzero(x) }
            }
            total = total + sumF * A
        }
        m = m2 + 1
    }

    free(spf)
    free(F)
    free(prefixF)
    free(r2)
    free(A_small)
    free(ckey)
    free(cval)
    free(cused)
    return total / 4
}

function main() -> i32 {
    printf("%lld\n", compute_f(100000000000000))
    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 lattice_points_nonzero_i64(int64_t x);
int64_t compute_f_i64(int64_t n);
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 lattice_points_nonzero_i64(int64_t x) {
    if (x <= 0) {
        return 0;
    }
    int64_t R = isqrt_i64(x);
    int64_t b = R;
    int64_t bb = (b * b);
    int64_t s = 0;
    int64_t a = 1;
    while (a <= R) {
        int64_t aa = (a * a);
        while ((aa + bb) > x) {
            b = (b - 1);
            bb = (b * b);
        }
        s = (s + b);
        a = (a + 1);
    }
    return (FLOW_CHECKED_SHL((s), (2)) + FLOW_CHECKED_SHL((R), (2)));
}

int64_t compute_f_i64(int64_t n) {
    int64_t limit = isqrt_i64(n);
    int32_t* spf = (int32_t*)(calloc((limit + 1), 4));
    int16_t* F = (int16_t*)(calloc((limit + 1), 2));
    int64_t* prefixF = (int64_t*)(calloc((limit + 1), 8));
    int32_t* r2 = (int32_t*)(calloc((limit + 1), 4));
    int32_t* A_small = (int32_t*)(calloc((limit + 1), 4));
    if (((((spf == NULL || F == NULL) || prefixF == NULL) || r2 == NULL) || A_small == NULL)) {
        return (-1);
    }
    int64_t i = 0;
    while (i <= limit) {
        spf[i] = 0;
        i = (i + 1);
    }
    if (limit >= 0) {
        spf[0] = 1;
    }
    if (limit >= 1) {
        spf[1] = 1;
    }
    int64_t r = isqrt_i64(limit);
    i = 2;
    while (i <= r) {
        if (spf[i] == 0) {
            spf[i] = ((int32_t)(i));
            int64_t j = (i * i);
            while (j <= limit) {
                if (spf[j] == 0) {
                    spf[j] = ((int32_t)(i));
                }
                j = (j + i);
            }
        }
        i = (i + 1);
    }
    i = 2;
    while (i <= limit) {
        if (spf[i] == 0) {
            spf[i] = ((int32_t)(i));
        }
        i = (i + 1);
    }
    F[1] = 1;
    int64_t nn = 2;
    while (nn <= limit) {
        int64_t p = ((int64_t)(spf[nn]));
        int64_t rest = FLOW_CHECKED_DIV((nn), (p));
        int64_t e = 1;
        while (FLOW_CHECKED_MOD((rest), (p)) == 0) {
            rest = FLOW_CHECKED_DIV((rest), (p));
            e = (e + 1);
        }
        int64_t coef = 0;
        if (p == 2) {
            if (e == 1) {
                coef = (-1);
            }
        } else if ((p & 3) == 1) {
            if (e == 1) {
                coef = (-2);
            } else if (e == 2) {
                coef = 1;
            }
        } else {
            if (e == 2) {
                coef = (-1);
            }
        }
        if (coef == 0) {
            F[nn] = 0;
        } else {
            F[nn] = ((int16_t)((((int64_t)(F[rest])) * coef)));
        }
        nn = (nn + 1);
    }
    int64_t s = 0;
    i = 1;
    while (i <= limit) {
        s = (s + ((int64_t)(F[i])));
        prefixF[i] = s;
        i = (i + 1);
    }
    if (limit >= 1) {
        r2[1] = 4;
    }
    nn = 2;
    while (nn <= limit) {
        int64_t p = ((int64_t)(spf[nn]));
        int64_t rest = FLOW_CHECKED_DIV((nn), (p));
        int64_t e = 1;
        while (FLOW_CHECKED_MOD((rest), (p)) == 0) {
            rest = FLOW_CHECKED_DIV((rest), (p));
            e = (e + 1);
        }
        int64_t base = ((int64_t)(r2[rest]));
        if (base == 0) {
            r2[nn] = 0;
        } else if (p == 2) {
            r2[nn] = ((int32_t)(base));
        } else if ((p & 3) == 1) {
            r2[nn] = ((int32_t)((base * (e + 1))));
        } else {
            if ((e & 1) != 0) {
                r2[nn] = 0;
            } else {
                r2[nn] = ((int32_t)(base));
            }
        }
        nn = (nn + 1);
    }
    int64_t acc = 0;
    i = 1;
    while (i <= limit) {
        acc = (acc + ((int64_t)(r2[i])));
        A_small[i] = ((int32_t)(acc));
        i = (i + 1);
    }
    int64_t CACHE_N = 200003;
    int64_t* ckey = (int64_t*)(calloc(CACHE_N, 8));
    int64_t* cval = (int64_t*)(calloc(CACHE_N, 8));
    int8_t* cused = (int8_t*)(calloc(CACHE_N, 1));
    if (((ckey == NULL || cval == NULL) || cused == NULL)) {
        return (-1);
    }
    int64_t total = 0;
    int64_t m = 1;
    int64_t M = limit;
    while (m <= M) {
        int64_t x = FLOW_CHECKED_DIV((n), ((m * m)));
        if (x == 0) {
            break;
        }
        int64_t m2 = isqrt_i64(FLOW_CHECKED_DIV((n), (x)));
        if (m2 > M) {
            m2 = M;
        }
        int64_t sumF = (prefixF[m2] - prefixF[(m - 1)]);
        if (sumF != 0) {
            int64_t A = 0;
            if (x <= limit) {
                A = ((int64_t)(A_small[x]));
            } else {
                int64_t h = FLOW_CHECKED_MOD((x), (CACHE_N));
                if (h < 0) {
                    h = (-h);
                }
                int32_t found = 0;
                int64_t probes = 0;
                while (probes < 10000) {
                    if (cused[h] == 0) {
                        A = lattice_points_nonzero_i64(x);
                        cused[h] = 1;
                        ckey[h] = x;
                        cval[h] = A;
                        found = 1;
                        break;
                    }
                    if (ckey[h] == x) {
                        A = cval[h];
                        found = 1;
                        break;
                    }
                    h = (h + 1);
                    if (h >= CACHE_N) {
                        h = 0;
                    }
                    probes = (probes + 1);
                }
                if (found == 0) {
                    A = lattice_points_nonzero_i64(x);
                }
            }
            total = (total + (sumF * A));
        }
        m = (m2 + 1);
    }
    free(spf);
    free(F);
    free(prefixF);
    free(r2);
    free(A_small);
    free(ckey);
    free(cval);
    free(cused);
    return FLOW_CHECKED_DIV((total), (4));
}

int32_t main(void) {
    printf("%lld\n", compute_f_i64(100000000000000));
    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 @lattice_points_nonzero(%arg0: i64) -> i64 {
    %175 = arith.constant 0 : i32
    %177 = arith.extsi %175 : i32 to i64
    %176 = arith.cmpi sle, %arg0, %177 : i64
    cf.cond_br %176, ^bb42, ^bb43
    ^bb42:
      %178 = arith.constant 0 : i32
      %179 = arith.extsi %178 : i32 to i64
      func.return %179 : i64
    ^bb43:
      cf.br ^bb44
    ^bb44:
    %180 = func.call @isqrt(%arg0) : (i64) -> i64
    %181 = llvm.mlir.constant(1 : i64) : i64
    %182 = llvm.alloca %181 x i64 : (i64) -> !llvm.ptr
    llvm.store %180, %182 : i64, !llvm.ptr
    %183 = llvm.load %182 : !llvm.ptr -> i64
    %184 = llvm.load %182 : !llvm.ptr -> i64
    %185 = arith.muli %183, %184 : i64
    %186 = llvm.mlir.constant(1 : i64) : i64
    %187 = llvm.alloca %186 x i64 : (i64) -> !llvm.ptr
    llvm.store %185, %187 : i64, !llvm.ptr
    %188 = arith.constant 0 : i32
    %189 = arith.extsi %188 : i32 to i64
    %190 = llvm.mlir.constant(1 : i64) : i64
    %191 = llvm.alloca %190 x i64 : (i64) -> !llvm.ptr
    llvm.store %189, %191 : i64, !llvm.ptr
    %192 = arith.constant 1 : i32
    %193 = arith.extsi %192 : i32 to i64
    %194 = llvm.mlir.constant(1 : i64) : i64
    %195 = llvm.alloca %194 x i64 : (i64) -> !llvm.ptr
    llvm.store %193, %195 : i64, !llvm.ptr
    cf.br ^bb45
    ^bb45:
    %196 = llvm.load %195 : !llvm.ptr -> i64
    %197 = arith.cmpi sle, %196, %180 : i64
    cf.cond_br %197, ^bb46, ^bb47
    ^bb46:
      %198 = llvm.load %195 : !llvm.ptr -> i64
      %199 = llvm.load %195 : !llvm.ptr -> i64
      %200 = arith.muli %198, %199 : i64
      cf.br ^bb48
      ^bb48:
      %201 = llvm.load %187 : !llvm.ptr -> i64
      %202 = arith.addi %200, %201 : i64
      %203 = arith.cmpi sgt, %202, %arg0 : i64
      cf.cond_br %203, ^bb49, ^bb50
      ^bb49:
        %204 = llvm.load %182 : !llvm.ptr -> i64
        %205 = arith.constant 1 : i32
        %207 = arith.extsi %205 : i32 to i64
        %206 = arith.subi %204, %207 : i64
        llvm.store %206, %182 : i64, !llvm.ptr
        %208 = llvm.load %182 : !llvm.ptr -> i64
        %209 = llvm.load %182 : !llvm.ptr -> i64
        %210 = arith.muli %208, %209 : i64
        llvm.store %210, %187 : i64, !llvm.ptr
        cf.br ^bb48
      ^bb50:
      %211 = llvm.load %191 : !llvm.ptr -> i64
      %212 = llvm.load %182 : !llvm.ptr -> i64
      %213 = arith.addi %211, %212 : i64
      llvm.store %213, %191 : i64, !llvm.ptr
      %214 = llvm.load %195 : !llvm.ptr -> i64
      %215 = arith.constant 1 : i32
      %217 = arith.extsi %215 : i32 to i64
      %216 = arith.addi %214, %217 : i64
      llvm.store %216, %195 : i64, !llvm.ptr
      cf.br ^bb45
    ^bb47:
    %218 = llvm.load %191 : !llvm.ptr -> i64
    %219 = arith.constant 2 : i32
    %221 = arith.extsi %219 : i32 to i64
    %220 = arith.shli %218, %221 : i64
    %222 = arith.constant 2 : i32
    %224 = arith.extsi %222 : i32 to i64
    %223 = arith.shli %180, %224 : i64
    %225 = arith.addi %220, %223 : i64
    func.return %225 : i64
  }
  func.func @compute_f(%arg0: i64) -> i64 {
    %226 = func.call @isqrt(%arg0) : (i64) -> i64
    %228 = arith.constant 1 : i32
    %230 = arith.extsi %228 : i32 to i64
    %229 = arith.addi %226, %230 : i64
    %231 = arith.constant 4 : i32
    %232 = arith.extsi %231 : i32 to i64
    %227 = func.call @calloc(%229, %232) : (i64, i64) -> !llvm.ptr
    %234 = arith.constant 1 : i32
    %236 = arith.extsi %234 : i32 to i64
    %235 = arith.addi %226, %236 : i64
    %237 = arith.constant 2 : i32
    %238 = arith.extsi %237 : i32 to i64
    %233 = func.call @calloc(%235, %238) : (i64, i64) -> !llvm.ptr
    %240 = arith.constant 1 : i32
    %242 = arith.extsi %240 : i32 to i64
    %241 = arith.addi %226, %242 : i64
    %243 = arith.constant 8 : i32
    %244 = arith.extsi %243 : i32 to i64
    %239 = func.call @calloc(%241, %244) : (i64, i64) -> !llvm.ptr
    %246 = arith.constant 1 : i32
    %248 = arith.extsi %246 : i32 to i64
    %247 = arith.addi %226, %248 : i64
    %249 = arith.constant 4 : i32
    %250 = arith.extsi %249 : i32 to i64
    %245 = func.call @calloc(%247, %250) : (i64, i64) -> !llvm.ptr
    %252 = arith.constant 1 : i32
    %254 = arith.extsi %252 : i32 to i64
    %253 = arith.addi %226, %254 : i64
    %255 = arith.constant 4 : i32
    %256 = arith.extsi %255 : i32 to i64
    %251 = func.call @calloc(%253, %256) : (i64, i64) -> !llvm.ptr
    %257 = llvm.mlir.zero : !llvm.ptr
    %258 = llvm.icmp "eq" %227, %257 : !llvm.ptr
    %259 = scf.if %258 -> (i1) {
      %260 = arith.constant true
      scf.yield %260 : i1
    } else {
      %261 = llvm.mlir.zero : !llvm.ptr
      %262 = llvm.icmp "eq" %233, %261 : !llvm.ptr
      scf.yield %262 : i1
    }
    %263 = scf.if %259 -> (i1) {
      %264 = arith.constant true
      scf.yield %264 : i1
    } else {
      %265 = llvm.mlir.zero : !llvm.ptr
      %266 = llvm.icmp "eq" %239, %265 : !llvm.ptr
      scf.yield %266 : i1
    }
    %267 = scf.if %263 -> (i1) {
      %268 = arith.constant true
      scf.yield %268 : i1
    } else {
      %269 = llvm.mlir.zero : !llvm.ptr
      %270 = llvm.icmp "eq" %245, %269 : !llvm.ptr
      scf.yield %270 : i1
    }
    %271 = scf.if %267 -> (i1) {
      %272 = arith.constant true
      scf.yield %272 : i1
    } else {
      %273 = llvm.mlir.zero : !llvm.ptr
      %274 = llvm.icmp "eq" %251, %273 : !llvm.ptr
      scf.yield %274 : i1
    }
    cf.cond_br %271, ^bb51, ^bb52
    ^bb51:
      %275 = arith.constant 1 : i32
      %277 = arith.constant 0 : i32
      %276 = arith.subi %277, %275 : i32
      %278 = arith.extsi %276 : i32 to i64
      func.return %278 : i64
    ^bb52:
      cf.br ^bb53
    ^bb53:
    %279 = arith.constant 0 : i32
    %280 = arith.extsi %279 : i32 to i64
    %281 = llvm.mlir.constant(1 : i64) : i64
    %282 = llvm.alloca %281 x i64 : (i64) -> !llvm.ptr
    llvm.store %280, %282 : i64, !llvm.ptr
    cf.br ^bb54
    ^bb54:
    %283 = llvm.load %282 : !llvm.ptr -> i64
    %284 = arith.cmpi sle, %283, %226 : i64
    cf.cond_br %284, ^bb55, ^bb56
    ^bb55:
      %285 = arith.constant 0 : i32
      %286 = llvm.load %282 : !llvm.ptr -> i64
      %287 = llvm.getelementptr %227[%286] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %285, %287 : i32, !llvm.ptr
      %288 = llvm.load %282 : !llvm.ptr -> i64
      %289 = arith.constant 1 : i32
      %291 = arith.extsi %289 : i32 to i64
      %290 = arith.addi %288, %291 : i64
      llvm.store %290, %282 : i64, !llvm.ptr
      cf.br ^bb54
    ^bb56:
    %292 = arith.constant 0 : i32
    %294 = arith.extsi %292 : i32 to i64
    %293 = arith.cmpi sge, %226, %294 : i64
    cf.cond_br %293, ^bb57, ^bb58
    ^bb57:
      %295 = arith.constant 1 : i32
      %296 = arith.constant 0 : i32
      %297 = arith.extsi %296 : i32 to i64
      %298 = llvm.getelementptr %227[%297] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %295, %298 : i32, !llvm.ptr
      cf.br ^bb59
    ^bb58:
      cf.br ^bb59
    ^bb59:
    %299 = arith.constant 1 : i32
    %301 = arith.extsi %299 : i32 to i64
    %300 = arith.cmpi sge, %226, %301 : i64
    cf.cond_br %300, ^bb60, ^bb61
    ^bb60:
      %302 = arith.constant 1 : i32
      %303 = arith.constant 1 : i32
      %304 = arith.extsi %303 : i32 to i64
      %305 = llvm.getelementptr %227[%304] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %302, %305 : i32, !llvm.ptr
      cf.br ^bb62
    ^bb61:
      cf.br ^bb62
    ^bb62:
    %306 = func.call @isqrt(%226) : (i64) -> i64
    %307 = arith.constant 2 : i32
    %308 = arith.extsi %307 : i32 to i64
    llvm.store %308, %282 : i64, !llvm.ptr
    cf.br ^bb63
    ^bb63:
    %309 = llvm.load %282 : !llvm.ptr -> i64
    %310 = arith.cmpi sle, %309, %306 : i64
    cf.cond_br %310, ^bb64, ^bb65
    ^bb64:
      %312 = llvm.load %282 : !llvm.ptr -> i64
      %313 = llvm.getelementptr %227[%312] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %311 = llvm.load %313 : !llvm.ptr -> i32
      %314 = arith.constant 0 : i32
      %315 = arith.cmpi eq, %311, %314 : i32
      cf.cond_br %315, ^bb66, ^bb67
      ^bb66:
        %316 = llvm.load %282 : !llvm.ptr -> i64
        %317 = arith.trunci %316 : i64 to i32
        %318 = llvm.load %282 : !llvm.ptr -> i64
        %319 = llvm.getelementptr %227[%318] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %317, %319 : i32, !llvm.ptr
        %320 = llvm.load %282 : !llvm.ptr -> i64
        %321 = llvm.load %282 : !llvm.ptr -> i64
        %322 = arith.muli %320, %321 : i64
        %323 = llvm.mlir.constant(1 : i64) : i64
        %324 = llvm.alloca %323 x i64 : (i64) -> !llvm.ptr
        llvm.store %322, %324 : i64, !llvm.ptr
        cf.br ^bb69
        ^bb69:
        %325 = llvm.load %324 : !llvm.ptr -> i64
        %326 = arith.cmpi sle, %325, %226 : i64
        cf.cond_br %326, ^bb70, ^bb71
        ^bb70:
          %328 = llvm.load %324 : !llvm.ptr -> i64
          %329 = llvm.getelementptr %227[%328] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %327 = llvm.load %329 : !llvm.ptr -> i32
          %330 = arith.constant 0 : i32
          %331 = arith.cmpi eq, %327, %330 : i32
          cf.cond_br %331, ^bb72, ^bb73
          ^bb72:
            %332 = llvm.load %282 : !llvm.ptr -> i64
            %333 = arith.trunci %332 : i64 to i32
            %334 = llvm.load %324 : !llvm.ptr -> i64
            %335 = llvm.getelementptr %227[%334] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %333, %335 : i32, !llvm.ptr
            cf.br ^bb74
          ^bb73:
            cf.br ^bb74
          ^bb74:
          %336 = llvm.load %324 : !llvm.ptr -> i64
          %337 = llvm.load %282 : !llvm.ptr -> i64
          %338 = arith.addi %336, %337 : i64
          llvm.store %338, %324 : i64, !llvm.ptr
          cf.br ^bb69
        ^bb71:
        cf.br ^bb68
      ^bb67:
        cf.br ^bb68
      ^bb68:
      %339 = llvm.load %282 : !llvm.ptr -> i64
      %340 = arith.constant 1 : i32
      %342 = arith.extsi %340 : i32 to i64
      %341 = arith.addi %339, %342 : i64
      llvm.store %341, %282 : i64, !llvm.ptr
      cf.br ^bb63
    ^bb65:
    %343 = arith.constant 2 : i32
    %344 = arith.extsi %343 : i32 to i64
    llvm.store %344, %282 : i64, !llvm.ptr
    cf.br ^bb75
    ^bb75:
    %345 = llvm.load %282 : !llvm.ptr -> i64
    %346 = arith.cmpi sle, %345, %226 : i64
    cf.cond_br %346, ^bb76, ^bb77
    ^bb76:
      %348 = llvm.load %282 : !llvm.ptr -> i64
      %349 = llvm.getelementptr %227[%348] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %347 = llvm.load %349 : !llvm.ptr -> i32
      %350 = arith.constant 0 : i32
      %351 = arith.cmpi eq, %347, %350 : i32
      cf.cond_br %351, ^bb78, ^bb79
      ^bb78:
        %352 = llvm.load %282 : !llvm.ptr -> i64
        %353 = arith.trunci %352 : i64 to i32
        %354 = llvm.load %282 : !llvm.ptr -> i64
        %355 = llvm.getelementptr %227[%354] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %353, %355 : i32, !llvm.ptr
        cf.br ^bb80
      ^bb79:
        cf.br ^bb80
      ^bb80:
      %356 = llvm.load %282 : !llvm.ptr -> i64
      %357 = arith.constant 1 : i32
      %359 = arith.extsi %357 : i32 to i64
      %358 = arith.addi %356, %359 : i64
      llvm.store %358, %282 : i64, !llvm.ptr
      cf.br ^bb75
    ^bb77:
    %360 = arith.constant 1 : i32
    %361 = arith.constant 1 : i32
    %362 = arith.trunci %360 : i32 to i16
    %363 = arith.extsi %361 : i32 to i64
    %364 = llvm.getelementptr %233[%363] : (!llvm.ptr, i64) -> !llvm.ptr, i16
    llvm.store %362, %364 : i16, !llvm.ptr
    %365 = arith.constant 2 : i32
    %366 = arith.extsi %365 : i32 to i64
    %367 = llvm.mlir.constant(1 : i64) : i64
    %368 = llvm.alloca %367 x i64 : (i64) -> !llvm.ptr
    llvm.store %366, %368 : i64, !llvm.ptr
    cf.br ^bb81
    ^bb81:
    %369 = llvm.load %368 : !llvm.ptr -> i64
    %370 = arith.cmpi sle, %369, %226 : i64
    cf.cond_br %370, ^bb82, ^bb83
    ^bb82:
      %372 = llvm.load %368 : !llvm.ptr -> i64
      %373 = llvm.getelementptr %227[%372] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %371 = llvm.load %373 : !llvm.ptr -> i32
      %374 = arith.extsi %371 : i32 to i64
      %375 = llvm.load %368 : !llvm.ptr -> i64
      %376 = arith.divsi %375, %374 : i64
      %377 = llvm.mlir.constant(1 : i64) : i64
      %378 = llvm.alloca %377 x i64 : (i64) -> !llvm.ptr
      llvm.store %376, %378 : i64, !llvm.ptr
      %379 = arith.constant 1 : i32
      %380 = arith.extsi %379 : i32 to i64
      %381 = llvm.mlir.constant(1 : i64) : i64
      %382 = llvm.alloca %381 x i64 : (i64) -> !llvm.ptr
      llvm.store %380, %382 : i64, !llvm.ptr
      cf.br ^bb84
      ^bb84:
      %383 = llvm.load %378 : !llvm.ptr -> i64
      %384 = arith.remsi %383, %374 : i64
      %385 = arith.constant 0 : i32
      %387 = arith.extsi %385 : i32 to i64
      %386 = arith.cmpi eq, %384, %387 : i64
      cf.cond_br %386, ^bb85, ^bb86
      ^bb85:
        %388 = llvm.load %378 : !llvm.ptr -> i64
        %389 = arith.divsi %388, %374 : i64
        llvm.store %389, %378 : i64, !llvm.ptr
        %390 = llvm.load %382 : !llvm.ptr -> i64
        %391 = arith.constant 1 : i32
        %393 = arith.extsi %391 : i32 to i64
        %392 = arith.addi %390, %393 : i64
        llvm.store %392, %382 : i64, !llvm.ptr
        cf.br ^bb84
      ^bb86:
      %394 = arith.constant 0 : i32
      %395 = arith.extsi %394 : i32 to i64
      %396 = llvm.mlir.constant(1 : i64) : i64
      %397 = llvm.alloca %396 x i64 : (i64) -> !llvm.ptr
      llvm.store %395, %397 : i64, !llvm.ptr
      %398 = arith.constant 2 : i32
      %400 = arith.extsi %398 : i32 to i64
      %399 = arith.cmpi eq, %374, %400 : i64
      cf.cond_br %399, ^bb87, ^bb88
      ^bb87:
        %401 = llvm.load %382 : !llvm.ptr -> i64
        %402 = arith.constant 1 : i32
        %404 = arith.extsi %402 : i32 to i64
        %403 = arith.cmpi eq, %401, %404 : i64
        cf.cond_br %403, ^bb90, ^bb91
        ^bb90:
          %405 = arith.constant 1 : i32
          %407 = arith.constant 0 : i32
          %406 = arith.subi %407, %405 : i32
          %408 = arith.extsi %406 : i32 to i64
          llvm.store %408, %397 : i64, !llvm.ptr
          cf.br ^bb92
        ^bb91:
          cf.br ^bb92
        ^bb92:
        cf.br ^bb89
      ^bb88:
        %409 = arith.constant 3 : i32
        %411 = arith.extsi %409 : i32 to i64
        %410 = arith.andi %374, %411 : i64
        %412 = arith.constant 1 : i32
        %414 = arith.extsi %412 : i32 to i64
        %413 = arith.cmpi eq, %410, %414 : i64
        cf.cond_br %413, ^bb94, ^bb93
      ^bb94:
        %415 = llvm.load %382 : !llvm.ptr -> i64
        %416 = arith.constant 1 : i32
        %418 = arith.extsi %416 : i32 to i64
        %417 = arith.cmpi eq, %415, %418 : i64
        cf.cond_br %417, ^bb95, ^bb96
        ^bb95:
          %419 = arith.constant 2 : i32
          %421 = arith.constant 0 : i32
          %420 = arith.subi %421, %419 : i32
          %422 = arith.extsi %420 : i32 to i64
          llvm.store %422, %397 : i64, !llvm.ptr
          cf.br ^bb97
        ^bb96:
          %423 = llvm.load %382 : !llvm.ptr -> i64
          %424 = arith.constant 2 : i32
          %426 = arith.extsi %424 : i32 to i64
          %425 = arith.cmpi eq, %423, %426 : i64
          cf.cond_br %425, ^bb98, ^bb97
        ^bb98:
          %427 = arith.constant 1 : i32
          %428 = arith.extsi %427 : i32 to i64
          llvm.store %428, %397 : i64, !llvm.ptr
          cf.br ^bb97
        ^bb97:
        cf.br ^bb89
      ^bb93:
        %429 = llvm.load %382 : !llvm.ptr -> i64
        %430 = arith.constant 2 : i32
        %432 = arith.extsi %430 : i32 to i64
        %431 = arith.cmpi eq, %429, %432 : i64
        cf.cond_br %431, ^bb99, ^bb100
        ^bb99:
          %433 = arith.constant 1 : i32
          %435 = arith.constant 0 : i32
          %434 = arith.subi %435, %433 : i32
          %436 = arith.extsi %434 : i32 to i64
          llvm.store %436, %397 : i64, !llvm.ptr
          cf.br ^bb101
        ^bb100:
          cf.br ^bb101
        ^bb101:
        cf.br ^bb89
      ^bb89:
      %437 = llvm.load %397 : !llvm.ptr -> i64
      %438 = arith.constant 0 : i32
      %440 = arith.extsi %438 : i32 to i64
      %439 = arith.cmpi eq, %437, %440 : i64
      cf.cond_br %439, ^bb102, ^bb103
      ^bb102:
        %441 = arith.constant 0 : i32
        %442 = llvm.load %368 : !llvm.ptr -> i64
        %443 = arith.trunci %441 : i32 to i16
        %444 = llvm.getelementptr %233[%442] : (!llvm.ptr, i64) -> !llvm.ptr, i16
        llvm.store %443, %444 : i16, !llvm.ptr
        cf.br ^bb104
      ^bb103:
        %446 = llvm.load %378 : !llvm.ptr -> i64
        %447 = llvm.getelementptr %233[%446] : (!llvm.ptr, i64) -> !llvm.ptr, i16
        %445 = llvm.load %447 : !llvm.ptr -> i16
        %448 = arith.extsi %445 : i16 to i64
        %449 = llvm.load %397 : !llvm.ptr -> i64
        %450 = arith.muli %448, %449 : i64
        %451 = arith.trunci %450 : i64 to i16
        %452 = llvm.load %368 : !llvm.ptr -> i64
        %453 = llvm.getelementptr %233[%452] : (!llvm.ptr, i64) -> !llvm.ptr, i16
        llvm.store %451, %453 : i16, !llvm.ptr
        cf.br ^bb104
      ^bb104:
      %454 = llvm.load %368 : !llvm.ptr -> i64
      %455 = arith.constant 1 : i32
      %457 = arith.extsi %455 : i32 to i64
      %456 = arith.addi %454, %457 : i64
      llvm.store %456, %368 : i64, !llvm.ptr
      cf.br ^bb81
    ^bb83:
    %458 = arith.constant 0 : i32
    %459 = arith.extsi %458 : i32 to i64
    %460 = llvm.mlir.constant(1 : i64) : i64
    %461 = llvm.alloca %460 x i64 : (i64) -> !llvm.ptr
    llvm.store %459, %461 : i64, !llvm.ptr
    %462 = arith.constant 1 : i32
    %463 = arith.extsi %462 : i32 to i64
    llvm.store %463, %282 : i64, !llvm.ptr
    cf.br ^bb105
    ^bb105:
    %464 = llvm.load %282 : !llvm.ptr -> i64
    %465 = arith.cmpi sle, %464, %226 : i64
    cf.cond_br %465, ^bb106, ^bb107
    ^bb106:
      %466 = llvm.load %461 : !llvm.ptr -> i64
      %468 = llvm.load %282 : !llvm.ptr -> i64
      %469 = llvm.getelementptr %233[%468] : (!llvm.ptr, i64) -> !llvm.ptr, i16
      %467 = llvm.load %469 : !llvm.ptr -> i16
      %470 = arith.extsi %467 : i16 to i64
      %471 = arith.addi %466, %470 : i64
      llvm.store %471, %461 : i64, !llvm.ptr
      %472 = llvm.load %461 : !llvm.ptr -> i64
      %473 = llvm.load %282 : !llvm.ptr -> i64
      %474 = llvm.getelementptr %239[%473] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %472, %474 : i64, !llvm.ptr
      %475 = llvm.load %282 : !llvm.ptr -> i64
      %476 = arith.constant 1 : i32
      %478 = arith.extsi %476 : i32 to i64
      %477 = arith.addi %475, %478 : i64
      llvm.store %477, %282 : i64, !llvm.ptr
      cf.br ^bb105
    ^bb107:
    %479 = arith.constant 1 : i32
    %481 = arith.extsi %479 : i32 to i64
    %480 = arith.cmpi sge, %226, %481 : i64
    cf.cond_br %480, ^bb108, ^bb109
    ^bb108:
      %482 = arith.constant 4 : i32
      %483 = arith.constant 1 : i32
      %484 = arith.extsi %483 : i32 to i64
      %485 = llvm.getelementptr %245[%484] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %482, %485 : i32, !llvm.ptr
      cf.br ^bb110
    ^bb109:
      cf.br ^bb110
    ^bb110:
    %486 = arith.constant 2 : i32
    %487 = arith.extsi %486 : i32 to i64
    llvm.store %487, %368 : i64, !llvm.ptr
    cf.br ^bb111
    ^bb111:
    %488 = llvm.load %368 : !llvm.ptr -> i64
    %489 = arith.cmpi sle, %488, %226 : i64
    cf.cond_br %489, ^bb112, ^bb113
    ^bb112:
      %491 = llvm.load %368 : !llvm.ptr -> i64
      %492 = llvm.getelementptr %227[%491] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %490 = llvm.load %492 : !llvm.ptr -> i32
      %493 = arith.extsi %490 : i32 to i64
      %494 = llvm.load %368 : !llvm.ptr -> i64
      %495 = arith.divsi %494, %493 : i64
      %496 = llvm.mlir.constant(1 : i64) : i64
      %497 = llvm.alloca %496 x i64 : (i64) -> !llvm.ptr
      llvm.store %495, %497 : i64, !llvm.ptr
      %498 = arith.constant 1 : i32
      %499 = arith.extsi %498 : i32 to i64
      %500 = llvm.mlir.constant(1 : i64) : i64
      %501 = llvm.alloca %500 x i64 : (i64) -> !llvm.ptr
      llvm.store %499, %501 : i64, !llvm.ptr
      cf.br ^bb114
      ^bb114:
      %502 = llvm.load %497 : !llvm.ptr -> i64
      %503 = arith.remsi %502, %493 : i64
      %504 = arith.constant 0 : i32
      %506 = arith.extsi %504 : i32 to i64
      %505 = arith.cmpi eq, %503, %506 : i64
      cf.cond_br %505, ^bb115, ^bb116
      ^bb115:
        %507 = llvm.load %497 : !llvm.ptr -> i64
        %508 = arith.divsi %507, %493 : i64
        llvm.store %508, %497 : i64, !llvm.ptr
        %509 = llvm.load %501 : !llvm.ptr -> i64
        %510 = arith.constant 1 : i32
        %512 = arith.extsi %510 : i32 to i64
        %511 = arith.addi %509, %512 : i64
        llvm.store %511, %501 : i64, !llvm.ptr
        cf.br ^bb114
      ^bb116:
      %514 = llvm.load %497 : !llvm.ptr -> i64
      %515 = llvm.getelementptr %245[%514] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %513 = llvm.load %515 : !llvm.ptr -> i32
      %516 = arith.extsi %513 : i32 to i64
      %517 = arith.constant 0 : i32
      %519 = arith.extsi %517 : i32 to i64
      %518 = arith.cmpi eq, %516, %519 : i64
      cf.cond_br %518, ^bb117, ^bb118
      ^bb117:
        %520 = arith.constant 0 : i32
        %521 = llvm.load %368 : !llvm.ptr -> i64
        %522 = llvm.getelementptr %245[%521] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %520, %522 : i32, !llvm.ptr
        cf.br ^bb119
      ^bb118:
        %523 = arith.constant 2 : i32
        %525 = arith.extsi %523 : i32 to i64
        %524 = arith.cmpi eq, %493, %525 : i64
        cf.cond_br %524, ^bb121, ^bb120
      ^bb121:
        %526 = arith.trunci %516 : i64 to i32
        %527 = llvm.load %368 : !llvm.ptr -> i64
        %528 = llvm.getelementptr %245[%527] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %526, %528 : i32, !llvm.ptr
        cf.br ^bb119
      ^bb120:
        %529 = arith.constant 3 : i32
        %531 = arith.extsi %529 : i32 to i64
        %530 = arith.andi %493, %531 : i64
        %532 = arith.constant 1 : i32
        %534 = arith.extsi %532 : i32 to i64
        %533 = arith.cmpi eq, %530, %534 : i64
        cf.cond_br %533, ^bb123, ^bb122
      ^bb123:
        %535 = llvm.load %501 : !llvm.ptr -> i64
        %536 = arith.constant 1 : i32
        %538 = arith.extsi %536 : i32 to i64
        %537 = arith.addi %535, %538 : i64
        %539 = arith.muli %516, %537 : i64
        %540 = arith.trunci %539 : i64 to i32
        %541 = llvm.load %368 : !llvm.ptr -> i64
        %542 = llvm.getelementptr %245[%541] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %540, %542 : i32, !llvm.ptr
        cf.br ^bb119
      ^bb122:
        %543 = llvm.load %501 : !llvm.ptr -> i64
        %544 = arith.constant 1 : i32
        %546 = arith.extsi %544 : i32 to i64
        %545 = arith.andi %543, %546 : i64
        %547 = arith.constant 0 : i32
        %549 = arith.extsi %547 : i32 to i64
        %548 = arith.cmpi ne, %545, %549 : i64
        cf.cond_br %548, ^bb124, ^bb125
        ^bb124:
          %550 = arith.constant 0 : i32
          %551 = llvm.load %368 : !llvm.ptr -> i64
          %552 = llvm.getelementptr %245[%551] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %550, %552 : i32, !llvm.ptr
          cf.br ^bb126
        ^bb125:
          %553 = arith.trunci %516 : i64 to i32
          %554 = llvm.load %368 : !llvm.ptr -> i64
          %555 = llvm.getelementptr %245[%554] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %553, %555 : i32, !llvm.ptr
          cf.br ^bb126
        ^bb126:
        cf.br ^bb119
      ^bb119:
      %556 = llvm.load %368 : !llvm.ptr -> i64
      %557 = arith.constant 1 : i32
      %559 = arith.extsi %557 : i32 to i64
      %558 = arith.addi %556, %559 : i64
      llvm.store %558, %368 : i64, !llvm.ptr
      cf.br ^bb111
    ^bb113:
    %560 = arith.constant 0 : i32
    %561 = arith.extsi %560 : i32 to i64
    %562 = llvm.mlir.constant(1 : i64) : i64
    %563 = llvm.alloca %562 x i64 : (i64) -> !llvm.ptr
    llvm.store %561, %563 : i64, !llvm.ptr
    %564 = arith.constant 1 : i32
    %565 = arith.extsi %564 : i32 to i64
    llvm.store %565, %282 : i64, !llvm.ptr
    cf.br ^bb127
    ^bb127:
    %566 = llvm.load %282 : !llvm.ptr -> i64
    %567 = arith.cmpi sle, %566, %226 : i64
    cf.cond_br %567, ^bb128, ^bb129
    ^bb128:
      %568 = llvm.load %563 : !llvm.ptr -> i64
      %570 = llvm.load %282 : !llvm.ptr -> i64
      %571 = llvm.getelementptr %245[%570] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %569 = llvm.load %571 : !llvm.ptr -> i32
      %572 = arith.extsi %569 : i32 to i64
      %573 = arith.addi %568, %572 : i64
      llvm.store %573, %563 : i64, !llvm.ptr
      %574 = llvm.load %563 : !llvm.ptr -> i64
      %575 = arith.trunci %574 : i64 to i32
      %576 = llvm.load %282 : !llvm.ptr -> i64
      %577 = llvm.getelementptr %251[%576] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %575, %577 : i32, !llvm.ptr
      %578 = llvm.load %282 : !llvm.ptr -> i64
      %579 = arith.constant 1 : i32
      %581 = arith.extsi %579 : i32 to i64
      %580 = arith.addi %578, %581 : i64
      llvm.store %580, %282 : i64, !llvm.ptr
      cf.br ^bb127
    ^bb129:
    %582 = arith.constant 200003 : i32
    %583 = arith.extsi %582 : i32 to i64
    %585 = arith.constant 8 : i32
    %586 = arith.extsi %585 : i32 to i64
    %584 = func.call @calloc(%583, %586) : (i64, i64) -> !llvm.ptr
    %588 = arith.constant 8 : i32
    %589 = arith.extsi %588 : i32 to i64
    %587 = func.call @calloc(%583, %589) : (i64, i64) -> !llvm.ptr
    %591 = arith.constant 1 : i32
    %592 = arith.extsi %591 : i32 to i64
    %590 = func.call @calloc(%583, %592) : (i64, i64) -> !llvm.ptr
    %593 = llvm.mlir.zero : !llvm.ptr
    %594 = llvm.icmp "eq" %584, %593 : !llvm.ptr
    %595 = scf.if %594 -> (i1) {
      %596 = arith.constant true
      scf.yield %596 : i1
    } else {
      %597 = llvm.mlir.zero : !llvm.ptr
      %598 = llvm.icmp "eq" %587, %597 : !llvm.ptr
      scf.yield %598 : i1
    }
    %599 = scf.if %595 -> (i1) {
      %600 = arith.constant true
      scf.yield %600 : i1
    } else {
      %601 = llvm.mlir.zero : !llvm.ptr
      %602 = llvm.icmp "eq" %590, %601 : !llvm.ptr
      scf.yield %602 : i1
    }
    cf.cond_br %599, ^bb130, ^bb131
    ^bb130:
      %603 = arith.constant 1 : i32
      %605 = arith.constant 0 : i32
      %604 = arith.subi %605, %603 : i32
      %606 = arith.extsi %604 : i32 to i64
      func.return %606 : i64
    ^bb131:
      cf.br ^bb132
    ^bb132:
    %607 = arith.constant 0 : i32
    %608 = arith.extsi %607 : i32 to i64
    %609 = llvm.mlir.constant(1 : i64) : i64
    %610 = llvm.alloca %609 x i64 : (i64) -> !llvm.ptr
    llvm.store %608, %610 : i64, !llvm.ptr
    %611 = arith.constant 1 : i32
    %612 = arith.extsi %611 : i32 to i64
    %613 = llvm.mlir.constant(1 : i64) : i64
    %614 = llvm.alloca %613 x i64 : (i64) -> !llvm.ptr
    llvm.store %612, %614 : i64, !llvm.ptr
    cf.br ^bb133
    ^bb133:
    %615 = llvm.load %614 : !llvm.ptr -> i64
    %616 = arith.cmpi sle, %615, %226 : i64
    cf.cond_br %616, ^bb134, ^bb135
    ^bb134:
      %617 = llvm.load %614 : !llvm.ptr -> i64
      %618 = llvm.load %614 : !llvm.ptr -> i64
      %619 = arith.muli %617, %618 : i64
      %620 = arith.divsi %arg0, %619 : i64
      %621 = arith.constant 0 : i32
      %623 = arith.extsi %621 : i32 to i64
      %622 = arith.cmpi eq, %620, %623 : i64
      cf.cond_br %622, ^bb136, ^bb137
      ^bb136:
        cf.br ^bb135
      ^bb137:
        cf.br ^bb138
      ^bb138:
      %625 = arith.divsi %arg0, %620 : i64
      %624 = func.call @isqrt(%625) : (i64) -> i64
      %626 = llvm.mlir.constant(1 : i64) : i64
      %627 = llvm.alloca %626 x i64 : (i64) -> !llvm.ptr
      llvm.store %624, %627 : i64, !llvm.ptr
      %628 = llvm.load %627 : !llvm.ptr -> i64
      %629 = arith.cmpi sgt, %628, %226 : i64
      cf.cond_br %629, ^bb139, ^bb140
      ^bb139:
        llvm.store %226, %627 : i64, !llvm.ptr
        cf.br ^bb141
      ^bb140:
        cf.br ^bb141
      ^bb141:
      %631 = llvm.load %627 : !llvm.ptr -> i64
      %632 = llvm.getelementptr %239[%631] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %630 = llvm.load %632 : !llvm.ptr -> i64
      %634 = llvm.load %614 : !llvm.ptr -> i64
      %635 = arith.constant 1 : i32
      %637 = arith.extsi %635 : i32 to i64
      %636 = arith.subi %634, %637 : i64
      %638 = llvm.getelementptr %239[%636] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %633 = llvm.load %638 : !llvm.ptr -> i64
      %639 = arith.subi %630, %633 : i64
      %640 = arith.constant 0 : i32
      %642 = arith.extsi %640 : i32 to i64
      %641 = arith.cmpi ne, %639, %642 : i64
      cf.cond_br %641, ^bb142, ^bb143
      ^bb142:
        %643 = arith.constant 0 : i32
        %644 = arith.extsi %643 : i32 to i64
        %645 = llvm.mlir.constant(1 : i64) : i64
        %646 = llvm.alloca %645 x i64 : (i64) -> !llvm.ptr
        llvm.store %644, %646 : i64, !llvm.ptr
        %647 = arith.cmpi sle, %620, %226 : i64
        cf.cond_br %647, ^bb145, ^bb146
        ^bb145:
          %649 = llvm.getelementptr %251[%620] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %648 = llvm.load %649 : !llvm.ptr -> i32
          %650 = arith.extsi %648 : i32 to i64
          llvm.store %650, %646 : i64, !llvm.ptr
          cf.br ^bb147
        ^bb146:
          %651 = arith.remsi %620, %583 : i64
          %652 = llvm.mlir.constant(1 : i64) : i64
          %653 = llvm.alloca %652 x i64 : (i64) -> !llvm.ptr
          llvm.store %651, %653 : i64, !llvm.ptr
          %654 = llvm.load %653 : !llvm.ptr -> i64
          %655 = arith.constant 0 : i32
          %657 = arith.extsi %655 : i32 to i64
          %656 = arith.cmpi slt, %654, %657 : i64
          cf.cond_br %656, ^bb148, ^bb149
          ^bb148:
            %658 = llvm.load %653 : !llvm.ptr -> i64
            %660 = arith.constant 0 : i64
            %659 = arith.subi %660, %658 : i64
            llvm.store %659, %653 : i64, !llvm.ptr
            cf.br ^bb150
          ^bb149:
            cf.br ^bb150
          ^bb150:
          %661 = arith.constant 0 : i32
          %662 = llvm.mlir.constant(1 : i64) : i64
          %663 = llvm.alloca %662 x i32 : (i64) -> !llvm.ptr
          llvm.store %661, %663 : i32, !llvm.ptr
          %664 = arith.constant 0 : i32
          %665 = arith.extsi %664 : i32 to i64
          %666 = llvm.mlir.constant(1 : i64) : i64
          %667 = llvm.alloca %666 x i64 : (i64) -> !llvm.ptr
          llvm.store %665, %667 : i64, !llvm.ptr
          cf.br ^bb151
          ^bb151:
          %668 = llvm.load %667 : !llvm.ptr -> i64
          %669 = arith.constant 10000 : i32
          %671 = arith.extsi %669 : i32 to i64
          %670 = arith.cmpi slt, %668, %671 : i64
          cf.cond_br %670, ^bb152, ^bb153
          ^bb152:
            %673 = llvm.load %653 : !llvm.ptr -> i64
            %674 = llvm.getelementptr %590[%673] : (!llvm.ptr, i64) -> !llvm.ptr, i8
            %672 = llvm.load %674 : !llvm.ptr -> i8
            %675 = arith.constant 0 : i32
            %677 = arith.extsi %672 : i8 to i32
            %676 = arith.cmpi eq, %677, %675 : i32
            cf.cond_br %676, ^bb154, ^bb155
            ^bb154:
              %678 = func.call @lattice_points_nonzero(%620) : (i64) -> i64
              llvm.store %678, %646 : i64, !llvm.ptr
              %679 = arith.constant 1 : i32
              %680 = llvm.load %653 : !llvm.ptr -> i64
              %681 = arith.trunci %679 : i32 to i8
              %682 = llvm.getelementptr %590[%680] : (!llvm.ptr, i64) -> !llvm.ptr, i8
              llvm.store %681, %682 : i8, !llvm.ptr
              %683 = llvm.load %653 : !llvm.ptr -> i64
              %684 = llvm.getelementptr %584[%683] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %620, %684 : i64, !llvm.ptr
              %685 = llvm.load %646 : !llvm.ptr -> i64
              %686 = llvm.load %653 : !llvm.ptr -> i64
              %687 = llvm.getelementptr %587[%686] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %685, %687 : i64, !llvm.ptr
              %688 = arith.constant 1 : i32
              llvm.store %688, %663 : i32, !llvm.ptr
              cf.br ^bb153
            ^bb155:
              cf.br ^bb156
            ^bb156:
            %690 = llvm.load %653 : !llvm.ptr -> i64
            %691 = llvm.getelementptr %584[%690] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %689 = llvm.load %691 : !llvm.ptr -> i64
            %692 = arith.cmpi eq, %689, %620 : i64
            cf.cond_br %692, ^bb157, ^bb158
            ^bb157:
              %694 = llvm.load %653 : !llvm.ptr -> i64
              %695 = llvm.getelementptr %587[%694] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %693 = llvm.load %695 : !llvm.ptr -> i64
              llvm.store %693, %646 : i64, !llvm.ptr
              %696 = arith.constant 1 : i32
              llvm.store %696, %663 : i32, !llvm.ptr
              cf.br ^bb153
            ^bb158:
              cf.br ^bb159
            ^bb159:
            %697 = llvm.load %653 : !llvm.ptr -> i64
            %698 = arith.constant 1 : i32
            %700 = arith.extsi %698 : i32 to i64
            %699 = arith.addi %697, %700 : i64
            llvm.store %699, %653 : i64, !llvm.ptr
            %701 = llvm.load %653 : !llvm.ptr -> i64
            %702 = arith.cmpi sge, %701, %583 : i64
            cf.cond_br %702, ^bb160, ^bb161
            ^bb160:
              %703 = arith.constant 0 : i32
              %704 = arith.extsi %703 : i32 to i64
              llvm.store %704, %653 : i64, !llvm.ptr
              cf.br ^bb162
            ^bb161:
              cf.br ^bb162
            ^bb162:
            %705 = llvm.load %667 : !llvm.ptr -> i64
            %706 = arith.constant 1 : i32
            %708 = arith.extsi %706 : i32 to i64
            %707 = arith.addi %705, %708 : i64
            llvm.store %707, %667 : i64, !llvm.ptr
            cf.br ^bb151
          ^bb153:
          %709 = llvm.load %663 : !llvm.ptr -> i32
          %710 = arith.constant 0 : i32
          %711 = arith.cmpi eq, %709, %710 : i32
          cf.cond_br %711, ^bb163, ^bb164
          ^bb163:
            %712 = func.call @lattice_points_nonzero(%620) : (i64) -> i64
            llvm.store %712, %646 : i64, !llvm.ptr
            cf.br ^bb165
          ^bb164:
            cf.br ^bb165
          ^bb165:
          cf.br ^bb147
        ^bb147:
        %713 = llvm.load %610 : !llvm.ptr -> i64
        %714 = llvm.load %646 : !llvm.ptr -> i64
        %715 = arith.muli %639, %714 : i64
        %716 = arith.addi %713, %715 : i64
        llvm.store %716, %610 : i64, !llvm.ptr
        cf.br ^bb144
      ^bb143:
        cf.br ^bb144
      ^bb144:
      %717 = llvm.load %627 : !llvm.ptr -> i64
      %718 = arith.constant 1 : i32
      %720 = arith.extsi %718 : i32 to i64
      %719 = arith.addi %717, %720 : i64
      llvm.store %719, %614 : i64, !llvm.ptr
      cf.br ^bb133
    ^bb135:
    func.call @free(%227) : (!llvm.ptr) -> ()
    func.call @free(%233) : (!llvm.ptr) -> ()
    func.call @free(%239) : (!llvm.ptr) -> ()
    func.call @free(%245) : (!llvm.ptr) -> ()
    func.call @free(%251) : (!llvm.ptr) -> ()
    func.call @free(%584) : (!llvm.ptr) -> ()
    func.call @free(%587) : (!llvm.ptr) -> ()
    func.call @free(%590) : (!llvm.ptr) -> ()
    %729 = llvm.load %610 : !llvm.ptr -> i64
    %730 = arith.constant 4 : i32
    %732 = arith.extsi %730 : i32 to i64
    %731 = arith.divsi %729, %732 : i64
    func.return %731 : i64
  }
  func.func @main() -> i32 {
    %733 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %735 = arith.constant 99995705032704 : i32
    %736 = arith.extsi %735 : i32 to i64
    %734 = func.call @compute_f(%736) : (i64) -> i64
    %737 = llvm.call @printf(%733, %734) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %738 = arith.constant 0 : i32
    func.return %738 : i32
  }
}