Problem 428

Necklace of Circles T(10^9) via Min_25-style summatory F,G over (m,6)=1.

Answer747215561862
Output(timeout)
StatusSKIP
Native helperno
Runtimen/a
Peak memoryn/a
Time complexityO(n log n) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

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

Flow source

# Project Euler 428
# Necklace of Circles T(10^9) via Min_25-style summatory F,G over (m,6)=1.

import euler.nt { isqrt }

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

# ---- PrimeTables (Min_25 style) ----

let mut PT_N: i64 = 0
let mut PT_V: i32 = 0
let mut PT_vals: ptr<i64> = null
let mut PT_vals_len: i64 = 0
let mut PT_id1: ptr<i32> = null
let mut PT_id2: ptr<i32> = null
let mut PT_pi_tbl: ptr<i64> = null
let mut PT_chi_tbl: ptr<i64> = null
let mut PT_primes: ptr<i32> = null
let mut PT_primes_len: i64 = 0

# ---- Summatory ----
let mut S_rec_primes: ptr<i32> = null
let mut S_rec_len: i64 = 0

# cacheF / cacheG: open-addressing hash tables
let mut cF_keys: ptr<i64> = null
let mut cF_vals: ptr<i64> = null
let mut cF_used: ptr<i8> = null
let mut cF_cap: i64 = 0

let mut cG_keys: ptr<i64> = null
let mut cG_vals: ptr<i64> = null
let mut cG_used: ptr<i8> = null
let mut cG_cap: i64 = 0

# F_cache / G_cache for T()
let mut FC_keys: ptr<i64> = null
let mut FC_vals: ptr<i64> = null
let mut FC_used: ptr<i8> = null
let mut FC_cap: i64 = 0

let mut GC_keys: ptr<i64> = null
let mut GC_vals: ptr<i64> = null
let mut GC_used: ptr<i8> = null
let mut GC_cap: i64 = 0

function chi_mod3(n: i64) -> i32 {
    let r: i32 = (n % 3) as i32
    if r == 0 { return 0 }
    if r == 1 { return 1 }
    return 0 - 1
}

function chi_prefix_integers(x: i64) -> i64 {
    return (x + 2) / 3 - (x + 1) / 3
}

function pt_idx_of(x: i64) -> i64 {
    if x <= (PT_V as i64) {
        return (PT_id1[x as i32]) as i64
    }
    return (PT_id2[(PT_N / x) as i32]) as i64
}

function pt_pi(x: i64) -> i64 {
    return PT_pi_tbl[pt_idx_of(x)]
}

function pt_chi_prime_sum(x: i64) -> i64 {
    return PT_chi_tbl[pt_idx_of(x)]
}

function build_prime_tables(N: i64) -> void {
    PT_N = N
    PT_V = isqrt(N) as i32

    # Collect distinct values of N/i
    let mut vals_buf: ptr<i64> = calloc(70000, 8)
    let mut vlen: i64 = 0
    let mut i: i64 = 1
    while i <= N {
        let v: i64 = N / i
        vals_buf[vlen] = v
        vlen = vlen + 1
        i = N / v + 1
    }
    PT_vals = vals_buf
    PT_vals_len = vlen

    let V: i32 = PT_V
    PT_id1 = calloc((V + 1) as i64, 4)
    PT_id2 = calloc((V + 1) as i64, 4)

    let mut idx: i64 = 0
    while idx < vlen {
        let v: i64 = vals_buf[idx]
        if v <= (V as i64) {
            PT_id1[v as i32] = idx as i32
        } else {
            PT_id2[(N / v) as i32] = idx as i32
        }
        idx = idx + 1
    }

    PT_pi_tbl = calloc(vlen, 8)
    PT_chi_tbl = calloc(vlen, 8)

    let mut j: i64 = 0
    while j < vlen {
        PT_pi_tbl[j] = vals_buf[j] - 1
        PT_chi_tbl[j] = chi_prefix_integers(vals_buf[j]) - 1
        j = j + 1
    }

    # Sieve primes up to V
    let sieve: ptr<i8> = calloc((V + 1) as i64, 1)
    let mut k: i32 = 0
    while k <= V {
        sieve[k] = 1
        k = k + 1
    }
    if V >= 0 { sieve[0] = 0 }
    if V >= 1 { sieve[1] = 0 }
    let lim: i32 = isqrt(V as i64) as i32
    let mut p: i32 = 2
    while p <= lim {
        if sieve[p] != 0 {
            let mut j2: i32 = p * p
            while j2 <= V {
                sieve[j2] = 0
                j2 = j2 + p
            }
        }
        p = p + 1
    }

    # Count and collect primes
    let mut pcount: i64 = 0
    let mut p2: i32 = 2
    while p2 <= V {
        if sieve[p2] != 0 { pcount = pcount + 1 }
        p2 = p2 + 1
    }
    PT_primes = calloc(pcount, 4)
    PT_primes_len = pcount
    let mut pi: i64 = 0
    let mut p3: i32 = 2
    while p3 <= V {
        if sieve[p3] != 0 {
            PT_primes[pi] = p3
            pi = pi + 1
        }
        p3 = p3 + 1
    }

    # chi_prime_pref
    let chi_pref: ptr<i64> = calloc(pcount + 1, 8)
    let mut s: i64 = 0
    let mut ci: i64 = 0
    while ci < pcount {
        s = s + (chi_mod3(PT_primes[ci] as i64) as i64)
        chi_pref[ci + 1] = s
        ci = ci + 1
    }

    # Min_25 sieve for pi and chi
    let mut pi_idx: i64 = 0
    while pi_idx < pcount {
        let pr: i32 = PT_primes[pi_idx]
        let p2v: i64 = (pr as i64) * (pr as i64)
        if p2v > N { break }
        let pi_before: i64 = pi_idx
        let chi_before: i64 = chi_pref[pi_idx]
        let cp: i32 = chi_mod3(pr as i64)

        let mut idx2: i64 = 0
        while idx2 < vlen {
            if vals_buf[idx2] < p2v { break }
            let t: i64 = vals_buf[idx2] / (pr as i64)
            let j3: i64 = pt_idx_of(t)
            PT_pi_tbl[idx2] = PT_pi_tbl[idx2] - (PT_pi_tbl[j3] - pi_before)
            PT_chi_tbl[idx2] = PT_chi_tbl[idx2] - (cp as i64) * (PT_chi_tbl[j3] - chi_before)
            idx2 = idx2 + 1
        }
        pi_idx = pi_idx + 1
    }

    free(sieve as ptr<void>)
    free(chi_pref as ptr<void>)
}

function build_summatory(N: i64) -> void {
    build_prime_tables(N)

    # rec_primes = primes >= 5
    let mut rlen: i64 = 0
    let mut i: i64 = 0
    while i < PT_primes_len {
        if PT_primes[i] >= 5 { rlen = rlen + 1 }
        i = i + 1
    }
    S_rec_primes = calloc(rlen, 4)
    S_rec_len = rlen
    let mut j: i64 = 0
    let mut k: i64 = 0
    while j < PT_primes_len {
        if PT_primes[j] >= 5 {
            S_rec_primes[k] = PT_primes[j]
            k = k + 1
        }
        j = j + 1
    }

    # Init hash tables for cacheF and cacheG
    cF_cap = 1 << 21
    cF_keys = calloc(cF_cap, 8)
    cF_vals = calloc(cF_cap, 8)
    cF_used = calloc(cF_cap, 1)

    cG_cap = 1 << 21
    cG_keys = calloc(cG_cap, 8)
    cG_vals = calloc(cG_cap, 8)
    cG_used = calloc(cG_cap, 1)
}

function hkey(n: i64, idx: i64) -> i64 {
    return (n << 20) | idx
}

function hf_get(n: i64, idx: i64) -> i64 {
    let key: i64 = hkey(n, idx)
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (cF_cap - 1)
    while cF_used[slot] != 0 {
        if cF_keys[slot] == key { return cF_vals[slot] }
        slot = (slot + 1) & (cF_cap - 1)
    }
    return 0 - 1
}

function hf_put(n: i64, idx: i64, val: i64) -> void {
    let key: i64 = hkey(n, idx)
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (cF_cap - 1)
    while cF_used[slot] != 0 && cF_keys[slot] != key {
        slot = (slot + 1) & (cF_cap - 1)
    }
    cF_used[slot] = 1
    cF_keys[slot] = key
    cF_vals[slot] = val
}

function hg_get(n: i64, idx: i64) -> i64 {
    let key: i64 = hkey(n, idx)
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (cG_cap - 1)
    while cG_used[slot] != 0 {
        if cG_keys[slot] == key { return cG_vals[slot] }
        slot = (slot + 1) & (cG_cap - 1)
    }
    return 0 - 1
}

function hg_put(n: i64, idx: i64, val: i64) -> void {
    let key: i64 = hkey(n, idx)
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (cG_cap - 1)
    while cG_used[slot] != 0 && cG_keys[slot] != key {
        slot = (slot + 1) & (cG_cap - 1)
    }
    cG_used[slot] = 1
    cG_keys[slot] = key
    cG_vals[slot] = val
}

function prime_sum_F(x: i64) -> i64 {
    let pi: i64 = pt_pi(x)
    let c23: i64 = 0
    if x >= 2 { c23 = c23 + 1 }
    if x >= 3 { c23 = c23 + 1 }
    return 3 * (pi - c23)
}

function prime_sum_G(x: i64) -> i64 {
    let pi: i64 = pt_pi(x)
    let c23: i64 = 0
    if x >= 2 { c23 = c23 + 1 }
    if x >= 3 { c23 = c23 + 1 }
    let chi_p: i64 = pt_chi_prime_sum(x)
    let chi_excl: i64 = chi_p
    if x >= 2 { chi_excl = chi_excl + 1 }
    return (pi - c23) + 2 * chi_excl
}

function val_F(p: i32, e: i32) -> i64 {
    return 2 * (e as i64) + 1
}

function val_G(p: i32, e: i32) -> i64 {
    if p % 3 == 1 { return 2 * (e as i64) + 1 }
    if (e & 1) == 1 { return 0 - 1 }
    return 1
}

function H_F(n: i64, idx: i64) -> i64 {
    let cached: i64 = hf_get(n, idx)
    if cached >= 0 { return cached }

    let prev: i64 = 0
    if idx > 0 { prev = S_rec_primes[idx - 1] as i64 } else { prev = 1 }

    if idx >= S_rec_len {
        let r: i64 = prime_sum_F(n) - prime_sum_F(prev)
        hf_put(n, idx, r)
        return r
    }
    if (S_rec_primes[idx] as i64) * (S_rec_primes[idx] as i64) > n {
        let r: i64 = prime_sum_F(n) - prime_sum_F(prev)
        hf_put(n, idx, r)
        return r
    }

    let mut res: i64 = prime_sum_F(n) - prime_sum_F(prev)
    let mut k: i64 = idx
    while k < S_rec_len {
        let p: i32 = S_rec_primes[k]
        if (p as i64) * (p as i64) > n { break }
        let mut pe: i64 = p as i64
        let mut e: i32 = 1
        while pe * (p as i64) <= n {
            res = res + val_F(p, e) * H_F(n / pe, k + 1)
            res = res + val_F(p, e + 1)
            pe = pe * (p as i64)
            e = e + 1
        }
        k = k + 1
    }
    hf_put(n, idx, res)
    return res
}

function H_G(n: i64, idx: i64) -> i64 {
    let cached: i64 = hg_get(n, idx)
    if cached >= 0 { return cached }

    let prev: i64 = 0
    if idx > 0 { prev = S_rec_primes[idx - 1] as i64 } else { prev = 1 }

    if idx >= S_rec_len {
        let r: i64 = prime_sum_G(n) - prime_sum_G(prev)
        hg_put(n, idx, r)
        return r
    }
    if (S_rec_primes[idx] as i64) * (S_rec_primes[idx] as i64) > n {
        let r: i64 = prime_sum_G(n) - prime_sum_G(prev)
        hg_put(n, idx, r)
        return r
    }

    let mut res: i64 = prime_sum_G(n) - prime_sum_G(prev)
    let mut k: i64 = idx
    while k < S_rec_len {
        let p: i32 = S_rec_primes[k]
        if (p as i64) * (p as i64) > n { break }
        let mut pe: i64 = p as i64
        let mut e: i32 = 1
        while pe * (p as i64) <= n {
            res = res + val_G(p, e) * H_G(n / pe, k + 1)
            res = res + val_G(p, e + 1)
            pe = pe * (p as i64)
            e = e + 1
        }
        k = k + 1
    }
    hg_put(n, idx, res)
    return res
}

function sum_F(x: i64) -> i64 {
    if x <= 0 { return 0 }
    return 1 + H_F(x, 0)
}

function sum_G(x: i64) -> i64 {
    if x <= 0 { return 0 }
    return 1 + H_G(x, 0)
}

# ---- F_cache / G_cache for T() ----

function fc_init(cap: i64) -> void {
    FC_cap = cap
    FC_keys = calloc(cap, 8)
    FC_vals = calloc(cap, 8)
    FC_used = calloc(cap, 1)
}

function fc_get(key: i64) -> i64 {
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (FC_cap - 1)
    while FC_used[slot] != 0 {
        if FC_keys[slot] == key { return FC_vals[slot] }
        slot = (slot + 1) & (FC_cap - 1)
    }
    return 0 - 1
}

function fc_put(key: i64, val: i64) -> void {
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (FC_cap - 1)
    while FC_used[slot] != 0 && FC_keys[slot] != key {
        slot = (slot + 1) & (FC_cap - 1)
    }
    FC_used[slot] = 1
    FC_keys[slot] = key
    FC_vals[slot] = val
}

function gc_init(cap: i64) -> void {
    GC_cap = cap
    GC_keys = calloc(cap, 8)
    GC_vals = calloc(cap, 8)
    GC_used = calloc(cap, 1)
}

function gc_get(key: i64) -> i64 {
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (GC_cap - 1)
    while GC_used[slot] != 0 {
        if GC_keys[slot] == key { return GC_vals[slot] }
        slot = (slot + 1) & (GC_cap - 1)
    }
    return 0 - 1
}

function gc_put(key: i64, val: i64) -> void {
    let mut slot: i64 = key
    if slot < 0 { slot = 0 - slot }
    slot = slot & (GC_cap - 1)
    while GC_used[slot] != 0 && GC_keys[slot] != key {
        slot = (slot + 1) & (GC_cap - 1)
    }
    GC_used[slot] = 1
    GC_keys[slot] = key
    GC_vals[slot] = val
}

function F_cached(x: i64) -> i64 {
    let hit: i64 = fc_get(x)
    if hit >= 0 { return hit }
    let v: i64 = sum_F(x)
    fc_put(x, v)
    return v
}

function G_cached(x: i64) -> i64 {
    let hit: i64 = gc_get(x)
    if hit >= 0 { return hit }
    let v: i64 = sum_G(x)
    gc_put(x, v)
    return v
}

function T(n: i64) -> i64 {
    build_summatory(n)
    fc_init(1 << 16)
    gc_init(1 << 16)

    let mut total: i64 = 0
    let mut pow2: i64 = 1
    let mut i: i64 = 0
    while pow2 <= n {
        let mut pow3: i64 = 1
        let mut j: i64 = 0
        while pow2 * pow3 <= n {
            let x: i64 = n / (pow2 * pow3)
            let Fx: i64 = F_cached(x)
            total = total + (2 * i + 2) * (2 * j + 1) * Fx
            total = total + (2 * i + 3) * (2 * j + 2) * Fx
            if j >= 1 {
                total = total + (2 * j - 1) * (2 * i + 3) * Fx
            }
            pow3 = pow3 * 3
            j = j + 1
        }
        pow2 = pow2 * 2
        i = i + 1
    }

    pow2 = 1
    i = 0
    while pow2 <= n {
        let x: i64 = n / pow2
        let sign: i64 = 0
        if i % 2 == 0 { sign = 1 } else { sign = 0 - 1 }
        total = total + ((2 * i + 3) * F_cached(x) - sign * G_cached(x)) / 2
        pow2 = pow2 * 2
        i = i + 1
    }
    return total
}

function main() -> i32 {
    printf("%lld\n", T(1000000000))
    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);
int32_t chi_mod3_i64(int64_t n);
int64_t chi_prefix_integers_i64(int64_t x);
int64_t pt_idx_of_i64(int64_t x);
int64_t pt_pi_i64(int64_t x);
int64_t pt_chi_prime_sum_i64(int64_t x);
void build_prime_tables_i64(int64_t N);
void build_summatory_i64(int64_t N);
int64_t hkey_i64_i64(int64_t n, int64_t idx);
int64_t hf_get_i64_i64(int64_t n, int64_t idx);
void hf_put_i64_i64_i64(int64_t n, int64_t idx, int64_t val);
int64_t hg_get_i64_i64(int64_t n, int64_t idx);
void hg_put_i64_i64_i64(int64_t n, int64_t idx, int64_t val);
int64_t prime_sum_F_i64(int64_t x);
int64_t prime_sum_G_i64(int64_t x);
int64_t val_F_i32_i32(int32_t p, int32_t e);
int64_t val_G_i32_i32(int32_t p, int32_t e);
int64_t H_F_i64_i64(int64_t n, int64_t idx);
int64_t H_G_i64_i64(int64_t n, int64_t idx);
int64_t sum_F_i64(int64_t x);
int64_t sum_G_i64(int64_t x);
void fc_init_i64(int64_t cap);
int64_t fc_get_i64(int64_t key);
void fc_put_i64_i64(int64_t key, int64_t val);
void gc_init_i64(int64_t cap);
int64_t gc_get_i64(int64_t key);
void gc_put_i64_i64(int64_t key, int64_t val);
int64_t F_cached_i64(int64_t x);
int64_t G_cached_i64(int64_t x);
int64_t T_i64(int64_t n);
int32_t main(void);

/* Module statics */
static int64_t PT_N = 0;
static int32_t PT_V = 0;
static int64_t* PT_vals = NULL;
static int64_t PT_vals_len = 0;
static int32_t* PT_id1 = NULL;
static int32_t* PT_id2 = NULL;
static int64_t* PT_pi_tbl = NULL;
static int64_t* PT_chi_tbl = NULL;
static int32_t* PT_primes = NULL;
static int64_t PT_primes_len = 0;
static int32_t* S_rec_primes = NULL;
static int64_t S_rec_len = 0;
static int64_t* cF_keys = NULL;
static int64_t* cF_vals = NULL;
static int8_t* cF_used = NULL;
static int64_t cF_cap = 0;
static int64_t* cG_keys = NULL;
static int64_t* cG_vals = NULL;
static int8_t* cG_used = NULL;
static int64_t cG_cap = 0;
static int64_t* FC_keys = NULL;
static int64_t* FC_vals = NULL;
static int8_t* FC_used = NULL;
static int64_t FC_cap = 0;
static int64_t* GC_keys = NULL;
static int64_t* GC_vals = NULL;
static int8_t* GC_used = NULL;
static int64_t GC_cap = 0;

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;
}



int32_t chi_mod3_i64(int64_t n) {
    int32_t r = ((int32_t)(FLOW_CHECKED_MOD((n), (3))));
    if (r == 0) {
        return 0;
    }
    if (r == 1) {
        return 1;
    }
    return (0 - 1);
}

int64_t chi_prefix_integers_i64(int64_t x) {
    return (FLOW_CHECKED_DIV(((x + 2)), (3)) - FLOW_CHECKED_DIV(((x + 1)), (3)));
}

int64_t pt_idx_of_i64(int64_t x) {
    if (x <= ((int64_t)(PT_V))) {
        return ((int64_t)(PT_id1[((int32_t)(x))]));
    }
    return ((int64_t)(PT_id2[((int32_t)(FLOW_CHECKED_DIV((PT_N), (x))))]));
}

int64_t pt_pi_i64(int64_t x) {
    return PT_pi_tbl[pt_idx_of_i64(x)];
}

int64_t pt_chi_prime_sum_i64(int64_t x) {
    return PT_chi_tbl[pt_idx_of_i64(x)];
}

void build_prime_tables_i64(int64_t N) {
    PT_N = N;
    PT_V = ((int32_t)(isqrt_i64(N)));
    int64_t* vals_buf = (int64_t*)(calloc(70000, 8));
    int64_t vlen = 0;
    int64_t i = 1;
    while (i <= N) {
        int64_t v = FLOW_CHECKED_DIV((N), (i));
        vals_buf[vlen] = v;
        vlen = (vlen + 1);
        i = (FLOW_CHECKED_DIV((N), (v)) + 1);
    }
    PT_vals = vals_buf;
    PT_vals_len = vlen;
    int32_t V = PT_V;
    PT_id1 = calloc(((int64_t)((V + 1))), 4);
    PT_id2 = calloc(((int64_t)((V + 1))), 4);
    int64_t idx = 0;
    while (idx < vlen) {
        int64_t v = vals_buf[idx];
        if (v <= ((int64_t)(V))) {
            PT_id1[((int32_t)(v))] = ((int32_t)(idx));
        } else {
            PT_id2[((int32_t)(FLOW_CHECKED_DIV((N), (v))))] = ((int32_t)(idx));
        }
        idx = (idx + 1);
    }
    PT_pi_tbl = calloc(vlen, 8);
    PT_chi_tbl = calloc(vlen, 8);
    int64_t j = 0;
    while (j < vlen) {
        PT_pi_tbl[j] = (vals_buf[j] - 1);
        PT_chi_tbl[j] = (chi_prefix_integers_i64(vals_buf[j]) - 1);
        j = (j + 1);
    }
    int8_t* sieve = (int8_t*)(calloc(((int64_t)((V + 1))), 1));
    int32_t k = 0;
    while (k <= V) {
        sieve[k] = 1;
        k = (k + 1);
    }
    if (V >= 0) {
        sieve[0] = 0;
    }
    if (V >= 1) {
        sieve[1] = 0;
    }
    int32_t lim = ((int32_t)(isqrt_i64(((int64_t)(V)))));
    int32_t p = 2;
    while (p <= lim) {
        if (sieve[p] != 0) {
            int32_t j2 = (p * p);
            while (j2 <= V) {
                sieve[j2] = 0;
                j2 = (j2 + p);
            }
        }
        p = (p + 1);
    }
    int64_t pcount = 0;
    int32_t p2 = 2;
    while (p2 <= V) {
        if (sieve[p2] != 0) {
            pcount = (pcount + 1);
        }
        p2 = (p2 + 1);
    }
    PT_primes = calloc(pcount, 4);
    PT_primes_len = pcount;
    int64_t pi = 0;
    int32_t p3 = 2;
    while (p3 <= V) {
        if (sieve[p3] != 0) {
            PT_primes[pi] = p3;
            pi = (pi + 1);
        }
        p3 = (p3 + 1);
    }
    int64_t* chi_pref = (int64_t*)(calloc((pcount + 1), 8));
    int64_t s = 0;
    int64_t ci = 0;
    while (ci < pcount) {
        s = (s + ((int64_t)(chi_mod3_i64(((int64_t)(PT_primes[ci]))))));
        chi_pref[(ci + 1)] = s;
        ci = (ci + 1);
    }
    int64_t pi_idx = 0;
    while (pi_idx < pcount) {
        int32_t pr = PT_primes[pi_idx];
        int64_t p2v = (((int64_t)(pr)) * ((int64_t)(pr)));
        if (p2v > N) {
            break;
        }
        int64_t pi_before = pi_idx;
        int64_t chi_before = chi_pref[pi_idx];
        int32_t cp = chi_mod3_i64(((int64_t)(pr)));
        int64_t idx2 = 0;
        while (idx2 < vlen) {
            if (vals_buf[idx2] < p2v) {
                break;
            }
            int64_t t = FLOW_CHECKED_DIV((vals_buf[idx2]), (((int64_t)(pr))));
            int64_t j3 = pt_idx_of_i64(t);
            PT_pi_tbl[idx2] = (PT_pi_tbl[idx2] - (PT_pi_tbl[j3] - pi_before));
            PT_chi_tbl[idx2] = (PT_chi_tbl[idx2] - (((int64_t)(cp)) * (PT_chi_tbl[j3] - chi_before)));
            idx2 = (idx2 + 1);
        }
        pi_idx = (pi_idx + 1);
    }
    free(((void*)(sieve)));
    free(((void*)(chi_pref)));
}

void build_summatory_i64(int64_t N) {
    build_prime_tables_i64(N);
    int64_t rlen = 0;
    int64_t i = 0;
    while (i < PT_primes_len) {
        if (PT_primes[i] >= 5) {
            rlen = (rlen + 1);
        }
        i = (i + 1);
    }
    S_rec_primes = calloc(rlen, 4);
    S_rec_len = rlen;
    int64_t j = 0;
    int64_t k = 0;
    while (j < PT_primes_len) {
        if (PT_primes[j] >= 5) {
            S_rec_primes[k] = PT_primes[j];
            k = (k + 1);
        }
        j = (j + 1);
    }
    cF_cap = FLOW_CHECKED_SHL((1), (21));
    cF_keys = calloc(cF_cap, 8);
    cF_vals = calloc(cF_cap, 8);
    cF_used = calloc(cF_cap, 1);
    cG_cap = FLOW_CHECKED_SHL((1), (21));
    cG_keys = calloc(cG_cap, 8);
    cG_vals = calloc(cG_cap, 8);
    cG_used = calloc(cG_cap, 1);
}

int64_t hkey_i64_i64(int64_t n, int64_t idx) {
    return (FLOW_CHECKED_SHL((n), (20)) | idx);
}

int64_t hf_get_i64_i64(int64_t n, int64_t idx) {
    int64_t key = hkey_i64_i64(n, idx);
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (cF_cap - 1));
    while (cF_used[slot] != 0) {
        if (cF_keys[slot] == key) {
            return cF_vals[slot];
        }
        slot = ((slot + 1) & (cF_cap - 1));
    }
    return (0 - 1);
}

void hf_put_i64_i64_i64(int64_t n, int64_t idx, int64_t val) {
    int64_t key = hkey_i64_i64(n, idx);
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (cF_cap - 1));
    while ((cF_used[slot] != 0 && cF_keys[slot] != key)) {
        slot = ((slot + 1) & (cF_cap - 1));
    }
    cF_used[slot] = 1;
    cF_keys[slot] = key;
    cF_vals[slot] = val;
}

int64_t hg_get_i64_i64(int64_t n, int64_t idx) {
    int64_t key = hkey_i64_i64(n, idx);
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (cG_cap - 1));
    while (cG_used[slot] != 0) {
        if (cG_keys[slot] == key) {
            return cG_vals[slot];
        }
        slot = ((slot + 1) & (cG_cap - 1));
    }
    return (0 - 1);
}

void hg_put_i64_i64_i64(int64_t n, int64_t idx, int64_t val) {
    int64_t key = hkey_i64_i64(n, idx);
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (cG_cap - 1));
    while ((cG_used[slot] != 0 && cG_keys[slot] != key)) {
        slot = ((slot + 1) & (cG_cap - 1));
    }
    cG_used[slot] = 1;
    cG_keys[slot] = key;
    cG_vals[slot] = val;
}

int64_t prime_sum_F_i64(int64_t x) {
    int64_t pi = pt_pi_i64(x);
    int64_t c23 = 0;
    if (x >= 2) {
        c23 = (c23 + 1);
    }
    if (x >= 3) {
        c23 = (c23 + 1);
    }
    return (3 * (pi - c23));
}

int64_t prime_sum_G_i64(int64_t x) {
    int64_t pi = pt_pi_i64(x);
    int64_t c23 = 0;
    if (x >= 2) {
        c23 = (c23 + 1);
    }
    if (x >= 3) {
        c23 = (c23 + 1);
    }
    int64_t chi_p = pt_chi_prime_sum_i64(x);
    int64_t chi_excl = chi_p;
    if (x >= 2) {
        chi_excl = (chi_excl + 1);
    }
    return ((pi - c23) + (2 * chi_excl));
}

int64_t val_F_i32_i32(int32_t p, int32_t e) {
    return ((2 * ((int64_t)(e))) + 1);
}

int64_t val_G_i32_i32(int32_t p, int32_t e) {
    if (FLOW_CHECKED_MOD((p), (3)) == 1) {
        return ((2 * ((int64_t)(e))) + 1);
    }
    if ((e & 1) == 1) {
        return (0 - 1);
    }
    return 1;
}

int64_t H_F_i64_i64(int64_t n, int64_t idx) {
    int64_t cached = hf_get_i64_i64(n, idx);
    if (cached >= 0) {
        return cached;
    }
    int64_t prev = 0;
    if (idx > 0) {
        prev = ((int64_t)(S_rec_primes[(idx - 1)]));
    } else {
        prev = 1;
    }
    if (idx >= S_rec_len) {
        int64_t r = (prime_sum_F_i64(n) - prime_sum_F_i64(prev));
        hf_put_i64_i64_i64(n, idx, r);
        return r;
    }
    if ((((int64_t)(S_rec_primes[idx])) * ((int64_t)(S_rec_primes[idx]))) > n) {
        int64_t r = (prime_sum_F_i64(n) - prime_sum_F_i64(prev));
        hf_put_i64_i64_i64(n, idx, r);
        return r;
    }
    int64_t res = (prime_sum_F_i64(n) - prime_sum_F_i64(prev));
    int64_t k = idx;
    while (k < S_rec_len) {
        int32_t p = S_rec_primes[k];
        if ((((int64_t)(p)) * ((int64_t)(p))) > n) {
            break;
        }
        int64_t pe = ((int64_t)(p));
        int32_t e = 1;
        while ((pe * ((int64_t)(p))) <= n) {
            res = (res + (val_F_i32_i32(p, e) * H_F_i64_i64(FLOW_CHECKED_DIV((n), (pe)), (k + 1))));
            res = (res + val_F_i32_i32(p, (e + 1)));
            pe = (pe * ((int64_t)(p)));
            e = (e + 1);
        }
        k = (k + 1);
    }
    hf_put_i64_i64_i64(n, idx, res);
    return res;
}

int64_t H_G_i64_i64(int64_t n, int64_t idx) {
    int64_t cached = hg_get_i64_i64(n, idx);
    if (cached >= 0) {
        return cached;
    }
    int64_t prev = 0;
    if (idx > 0) {
        prev = ((int64_t)(S_rec_primes[(idx - 1)]));
    } else {
        prev = 1;
    }
    if (idx >= S_rec_len) {
        int64_t r = (prime_sum_G_i64(n) - prime_sum_G_i64(prev));
        hg_put_i64_i64_i64(n, idx, r);
        return r;
    }
    if ((((int64_t)(S_rec_primes[idx])) * ((int64_t)(S_rec_primes[idx]))) > n) {
        int64_t r = (prime_sum_G_i64(n) - prime_sum_G_i64(prev));
        hg_put_i64_i64_i64(n, idx, r);
        return r;
    }
    int64_t res = (prime_sum_G_i64(n) - prime_sum_G_i64(prev));
    int64_t k = idx;
    while (k < S_rec_len) {
        int32_t p = S_rec_primes[k];
        if ((((int64_t)(p)) * ((int64_t)(p))) > n) {
            break;
        }
        int64_t pe = ((int64_t)(p));
        int32_t e = 1;
        while ((pe * ((int64_t)(p))) <= n) {
            res = (res + (val_G_i32_i32(p, e) * H_G_i64_i64(FLOW_CHECKED_DIV((n), (pe)), (k + 1))));
            res = (res + val_G_i32_i32(p, (e + 1)));
            pe = (pe * ((int64_t)(p)));
            e = (e + 1);
        }
        k = (k + 1);
    }
    hg_put_i64_i64_i64(n, idx, res);
    return res;
}

int64_t sum_F_i64(int64_t x) {
    if (x <= 0) {
        return 0;
    }
    return (1 + H_F_i64_i64(x, 0));
}

int64_t sum_G_i64(int64_t x) {
    if (x <= 0) {
        return 0;
    }
    return (1 + H_G_i64_i64(x, 0));
}

void fc_init_i64(int64_t cap) {
    FC_cap = cap;
    FC_keys = calloc(cap, 8);
    FC_vals = calloc(cap, 8);
    FC_used = calloc(cap, 1);
}

int64_t fc_get_i64(int64_t key) {
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (FC_cap - 1));
    while (FC_used[slot] != 0) {
        if (FC_keys[slot] == key) {
            return FC_vals[slot];
        }
        slot = ((slot + 1) & (FC_cap - 1));
    }
    return (0 - 1);
}

void fc_put_i64_i64(int64_t key, int64_t val) {
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (FC_cap - 1));
    while ((FC_used[slot] != 0 && FC_keys[slot] != key)) {
        slot = ((slot + 1) & (FC_cap - 1));
    }
    FC_used[slot] = 1;
    FC_keys[slot] = key;
    FC_vals[slot] = val;
}

void gc_init_i64(int64_t cap) {
    GC_cap = cap;
    GC_keys = calloc(cap, 8);
    GC_vals = calloc(cap, 8);
    GC_used = calloc(cap, 1);
}

int64_t gc_get_i64(int64_t key) {
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (GC_cap - 1));
    while (GC_used[slot] != 0) {
        if (GC_keys[slot] == key) {
            return GC_vals[slot];
        }
        slot = ((slot + 1) & (GC_cap - 1));
    }
    return (0 - 1);
}

void gc_put_i64_i64(int64_t key, int64_t val) {
    int64_t slot = key;
    if (slot < 0) {
        slot = (0 - slot);
    }
    slot = (slot & (GC_cap - 1));
    while ((GC_used[slot] != 0 && GC_keys[slot] != key)) {
        slot = ((slot + 1) & (GC_cap - 1));
    }
    GC_used[slot] = 1;
    GC_keys[slot] = key;
    GC_vals[slot] = val;
}

int64_t F_cached_i64(int64_t x) {
    int64_t hit = fc_get_i64(x);
    if (hit >= 0) {
        return hit;
    }
    int64_t v = sum_F_i64(x);
    fc_put_i64_i64(x, v);
    return v;
}

int64_t G_cached_i64(int64_t x) {
    int64_t hit = gc_get_i64(x);
    if (hit >= 0) {
        return hit;
    }
    int64_t v = sum_G_i64(x);
    gc_put_i64_i64(x, v);
    return v;
}

int64_t T_i64(int64_t n) {
    build_summatory_i64(n);
    fc_init_i64(FLOW_CHECKED_SHL((1), (16)));
    gc_init_i64(FLOW_CHECKED_SHL((1), (16)));
    int64_t total = 0;
    int64_t pow2 = 1;
    int64_t i = 0;
    while (pow2 <= n) {
        int64_t pow3 = 1;
        int64_t j = 0;
        while ((pow2 * pow3) <= n) {
            int64_t x = FLOW_CHECKED_DIV((n), ((pow2 * pow3)));
            int64_t Fx = F_cached_i64(x);
            total = (total + ((((2 * i) + 2) * ((2 * j) + 1)) * Fx));
            total = (total + ((((2 * i) + 3) * ((2 * j) + 2)) * Fx));
            if (j >= 1) {
                total = (total + ((((2 * j) - 1) * ((2 * i) + 3)) * Fx));
            }
            pow3 = (pow3 * 3);
            j = (j + 1);
        }
        pow2 = (pow2 * 2);
        i = (i + 1);
    }
    pow2 = 1;
    i = 0;
    while (pow2 <= n) {
        int64_t x = FLOW_CHECKED_DIV((n), (pow2));
        int64_t sign = 0;
        if (FLOW_CHECKED_MOD((i), (2)) == 0) {
            sign = 1;
        } else {
            sign = (0 - 1);
        }
        total = (total + FLOW_CHECKED_DIV((((((2 * i) + 3) * F_cached_i64(x)) - (sign * G_cached_i64(x)))), (2)));
        pow2 = (pow2 * 2);
        i = (i + 1);
    }
    return total;
}

int32_t main(void) {
    printf("%lld\n", T_i64(1000000000));
    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) -> ()
  // Module static: PT_N
  llvm.mlir.global internal @PT_N(0 : i64) : i64
  // Module static: PT_V
  llvm.mlir.global internal @PT_V(0 : i32) : i32
  // Module static: PT_vals
  llvm.mlir.global internal @PT_vals() {addr_space = 0 : i32} : !llvm.ptr {
    %175 = llvm.mlir.zero : !llvm.ptr
    llvm.return %175 : !llvm.ptr
  }
  // Module static: PT_vals_len
  llvm.mlir.global internal @PT_vals_len(0 : i64) : i64
  // Module static: PT_id1
  llvm.mlir.global internal @PT_id1() {addr_space = 0 : i32} : !llvm.ptr {
    %176 = llvm.mlir.zero : !llvm.ptr
    llvm.return %176 : !llvm.ptr
  }
  // Module static: PT_id2
  llvm.mlir.global internal @PT_id2() {addr_space = 0 : i32} : !llvm.ptr {
    %177 = llvm.mlir.zero : !llvm.ptr
    llvm.return %177 : !llvm.ptr
  }
  // Module static: PT_pi_tbl
  llvm.mlir.global internal @PT_pi_tbl() {addr_space = 0 : i32} : !llvm.ptr {
    %178 = llvm.mlir.zero : !llvm.ptr
    llvm.return %178 : !llvm.ptr
  }
  // Module static: PT_chi_tbl
  llvm.mlir.global internal @PT_chi_tbl() {addr_space = 0 : i32} : !llvm.ptr {
    %179 = llvm.mlir.zero : !llvm.ptr
    llvm.return %179 : !llvm.ptr
  }
  // Module static: PT_primes
  llvm.mlir.global internal @PT_primes() {addr_space = 0 : i32} : !llvm.ptr {
    %180 = llvm.mlir.zero : !llvm.ptr
    llvm.return %180 : !llvm.ptr
  }
  // Module static: PT_primes_len
  llvm.mlir.global internal @PT_primes_len(0 : i64) : i64
  // Module static: S_rec_primes
  llvm.mlir.global internal @S_rec_primes() {addr_space = 0 : i32} : !llvm.ptr {
    %181 = llvm.mlir.zero : !llvm.ptr
    llvm.return %181 : !llvm.ptr
  }
  // Module static: S_rec_len
  llvm.mlir.global internal @S_rec_len(0 : i64) : i64
  // Module static: cF_keys
  llvm.mlir.global internal @cF_keys() {addr_space = 0 : i32} : !llvm.ptr {
    %182 = llvm.mlir.zero : !llvm.ptr
    llvm.return %182 : !llvm.ptr
  }
  // Module static: cF_vals
  llvm.mlir.global internal @cF_vals() {addr_space = 0 : i32} : !llvm.ptr {
    %183 = llvm.mlir.zero : !llvm.ptr
    llvm.return %183 : !llvm.ptr
  }
  // Module static: cF_used
  llvm.mlir.global internal @cF_used() {addr_space = 0 : i32} : !llvm.ptr {
    %184 = llvm.mlir.zero : !llvm.ptr
    llvm.return %184 : !llvm.ptr
  }
  // Module static: cF_cap
  llvm.mlir.global internal @cF_cap(0 : i64) : i64
  // Module static: cG_keys
  llvm.mlir.global internal @cG_keys() {addr_space = 0 : i32} : !llvm.ptr {
    %185 = llvm.mlir.zero : !llvm.ptr
    llvm.return %185 : !llvm.ptr
  }
  // Module static: cG_vals
  llvm.mlir.global internal @cG_vals() {addr_space = 0 : i32} : !llvm.ptr {
    %186 = llvm.mlir.zero : !llvm.ptr
    llvm.return %186 : !llvm.ptr
  }
  // Module static: cG_used
  llvm.mlir.global internal @cG_used() {addr_space = 0 : i32} : !llvm.ptr {
    %187 = llvm.mlir.zero : !llvm.ptr
    llvm.return %187 : !llvm.ptr
  }
  // Module static: cG_cap
  llvm.mlir.global internal @cG_cap(0 : i64) : i64
  // Module static: FC_keys
  llvm.mlir.global internal @FC_keys() {addr_space = 0 : i32} : !llvm.ptr {
    %188 = llvm.mlir.zero : !llvm.ptr
    llvm.return %188 : !llvm.ptr
  }
  // Module static: FC_vals
  llvm.mlir.global internal @FC_vals() {addr_space = 0 : i32} : !llvm.ptr {
    %189 = llvm.mlir.zero : !llvm.ptr
    llvm.return %189 : !llvm.ptr
  }
  // Module static: FC_used
  llvm.mlir.global internal @FC_used() {addr_space = 0 : i32} : !llvm.ptr {
    %190 = llvm.mlir.zero : !llvm.ptr
    llvm.return %190 : !llvm.ptr
  }
  // Module static: FC_cap
  llvm.mlir.global internal @FC_cap(0 : i64) : i64
  // Module static: GC_keys
  llvm.mlir.global internal @GC_keys() {addr_space = 0 : i32} : !llvm.ptr {
    %191 = llvm.mlir.zero : !llvm.ptr
    llvm.return %191 : !llvm.ptr
  }
  // Module static: GC_vals
  llvm.mlir.global internal @GC_vals() {addr_space = 0 : i32} : !llvm.ptr {
    %192 = llvm.mlir.zero : !llvm.ptr
    llvm.return %192 : !llvm.ptr
  }
  // Module static: GC_used
  llvm.mlir.global internal @GC_used() {addr_space = 0 : i32} : !llvm.ptr {
    %193 = llvm.mlir.zero : !llvm.ptr
    llvm.return %193 : !llvm.ptr
  }
  // Module static: GC_cap
  llvm.mlir.global internal @GC_cap(0 : i64) : i64
  func.func @chi_mod3(%arg0: i64) -> i32 {
    %194 = arith.constant 3 : i32
    %196 = arith.extsi %194 : i32 to i64
    %195 = arith.remsi %arg0, %196 : i64
    %197 = arith.trunci %195 : i64 to i32
    %198 = arith.constant 0 : i32
    %199 = arith.cmpi eq, %197, %198 : i32
    cf.cond_br %199, ^bb42, ^bb43
    ^bb42:
      %200 = arith.constant 0 : i32
      func.return %200 : i32
    ^bb43:
      cf.br ^bb44
    ^bb44:
    %201 = arith.constant 1 : i32
    %202 = arith.cmpi eq, %197, %201 : i32
    cf.cond_br %202, ^bb45, ^bb46
    ^bb45:
      %203 = arith.constant 1 : i32
      func.return %203 : i32
    ^bb46:
      cf.br ^bb47
    ^bb47:
    %204 = arith.constant 0 : i32
    %205 = arith.constant 1 : i32
    %206 = arith.subi %204, %205 : i32
    func.return %206 : i32
  }
  func.func @chi_prefix_integers(%arg0: i64) -> i64 {
    %207 = arith.constant 2 : i32
    %209 = arith.extsi %207 : i32 to i64
    %208 = arith.addi %arg0, %209 : i64
    %210 = arith.constant 3 : i32
    %212 = arith.extsi %210 : i32 to i64
    %211 = arith.divsi %208, %212 : i64
    %213 = arith.constant 1 : i32
    %215 = arith.extsi %213 : i32 to i64
    %214 = arith.addi %arg0, %215 : i64
    %216 = arith.constant 3 : i32
    %218 = arith.extsi %216 : i32 to i64
    %217 = arith.divsi %214, %218 : i64
    %219 = arith.subi %211, %217 : i64
    func.return %219 : i64
  }
  func.func @pt_idx_of(%arg0: i64) -> i64 {
    %220 = llvm.mlir.addressof @PT_V : !llvm.ptr
    %221 = llvm.load %220 : !llvm.ptr -> i32
    %222 = arith.extsi %221 : i32 to i64
    %223 = arith.cmpi sle, %arg0, %222 : i64
    cf.cond_br %223, ^bb48, ^bb49
    ^bb48:
      %225 = llvm.mlir.addressof @PT_id1 : !llvm.ptr
      %226 = llvm.load %225 : !llvm.ptr -> !llvm.ptr
      %227 = arith.trunci %arg0 : i64 to i32
      %228 = arith.extsi %227 : i32 to i64
      %229 = llvm.getelementptr %226[%228] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %224 = llvm.load %229 : !llvm.ptr -> i32
      %230 = arith.extsi %224 : i32 to i64
      func.return %230 : i64
    ^bb49:
      cf.br ^bb50
    ^bb50:
    %232 = llvm.mlir.addressof @PT_id2 : !llvm.ptr
    %233 = llvm.load %232 : !llvm.ptr -> !llvm.ptr
    %234 = llvm.mlir.addressof @PT_N : !llvm.ptr
    %235 = llvm.load %234 : !llvm.ptr -> i64
    %236 = arith.divsi %235, %arg0 : i64
    %237 = arith.trunci %236 : i64 to i32
    %238 = arith.extsi %237 : i32 to i64
    %239 = llvm.getelementptr %233[%238] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %231 = llvm.load %239 : !llvm.ptr -> i32
    %240 = arith.extsi %231 : i32 to i64
    func.return %240 : i64
  }
  func.func @pt_pi(%arg0: i64) -> i64 {
    %242 = llvm.mlir.addressof @PT_pi_tbl : !llvm.ptr
    %243 = llvm.load %242 : !llvm.ptr -> !llvm.ptr
    %244 = func.call @pt_idx_of(%arg0) : (i64) -> i64
    %245 = llvm.getelementptr %243[%244] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %241 = llvm.load %245 : !llvm.ptr -> i64
    func.return %241 : i64
  }
  func.func @pt_chi_prime_sum(%arg0: i64) -> i64 {
    %247 = llvm.mlir.addressof @PT_chi_tbl : !llvm.ptr
    %248 = llvm.load %247 : !llvm.ptr -> !llvm.ptr
    %249 = func.call @pt_idx_of(%arg0) : (i64) -> i64
    %250 = llvm.getelementptr %248[%249] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %246 = llvm.load %250 : !llvm.ptr -> i64
    func.return %246 : i64
  }
  func.func @build_prime_tables(%arg0: i64) -> () {
    %251 = llvm.mlir.addressof @PT_N : !llvm.ptr
    llvm.store %arg0, %251 : i64, !llvm.ptr
    %252 = func.call @isqrt(%arg0) : (i64) -> i64
    %253 = arith.trunci %252 : i64 to i32
    %254 = llvm.mlir.addressof @PT_V : !llvm.ptr
    llvm.store %253, %254 : i32, !llvm.ptr
    %256 = arith.constant 70000 : i32
    %257 = arith.constant 8 : i32
    %258 = arith.extsi %256 : i32 to i64
    %259 = arith.extsi %257 : i32 to i64
    %255 = func.call @calloc(%258, %259) : (i64, i64) -> !llvm.ptr
    %260 = llvm.mlir.constant(1 : i64) : i64
    %261 = llvm.alloca %260 x !llvm.ptr : (i64) -> !llvm.ptr
    llvm.store %255, %261 : !llvm.ptr, !llvm.ptr
    %262 = arith.constant 0 : i32
    %263 = arith.extsi %262 : i32 to i64
    %264 = llvm.mlir.constant(1 : i64) : i64
    %265 = llvm.alloca %264 x i64 : (i64) -> !llvm.ptr
    llvm.store %263, %265 : i64, !llvm.ptr
    %266 = arith.constant 1 : i32
    %267 = arith.extsi %266 : i32 to i64
    %268 = llvm.mlir.constant(1 : i64) : i64
    %269 = llvm.alloca %268 x i64 : (i64) -> !llvm.ptr
    llvm.store %267, %269 : i64, !llvm.ptr
    cf.br ^bb51
    ^bb51:
    %270 = llvm.load %269 : !llvm.ptr -> i64
    %271 = arith.cmpi sle, %270, %arg0 : i64
    cf.cond_br %271, ^bb52, ^bb53
    ^bb52:
      %272 = llvm.load %269 : !llvm.ptr -> i64
      %273 = arith.divsi %arg0, %272 : i64
      %274 = llvm.load %261 : !llvm.ptr -> !llvm.ptr
      %275 = llvm.load %265 : !llvm.ptr -> i64
      %276 = llvm.getelementptr %274[%275] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %273, %276 : i64, !llvm.ptr
      %277 = llvm.load %265 : !llvm.ptr -> i64
      %278 = arith.constant 1 : i32
      %280 = arith.extsi %278 : i32 to i64
      %279 = arith.addi %277, %280 : i64
      llvm.store %279, %265 : i64, !llvm.ptr
      %281 = arith.divsi %arg0, %273 : i64
      %282 = arith.constant 1 : i32
      %284 = arith.extsi %282 : i32 to i64
      %283 = arith.addi %281, %284 : i64
      llvm.store %283, %269 : i64, !llvm.ptr
      cf.br ^bb51
    ^bb53:
    %285 = llvm.load %261 : !llvm.ptr -> !llvm.ptr
    %286 = llvm.mlir.addressof @PT_vals : !llvm.ptr
    llvm.store %285, %286 : !llvm.ptr, !llvm.ptr
    %287 = llvm.load %265 : !llvm.ptr -> i64
    %288 = llvm.mlir.addressof @PT_vals_len : !llvm.ptr
    llvm.store %287, %288 : i64, !llvm.ptr
    %289 = llvm.mlir.addressof @PT_V : !llvm.ptr
    %290 = llvm.load %289 : !llvm.ptr -> i32
    %292 = arith.constant 1 : i32
    %293 = arith.addi %290, %292 : i32
    %294 = arith.extsi %293 : i32 to i64
    %295 = arith.constant 4 : i32
    %296 = arith.extsi %295 : i32 to i64
    %291 = func.call @calloc(%294, %296) : (i64, i64) -> !llvm.ptr
    %297 = llvm.mlir.addressof @PT_id1 : !llvm.ptr
    llvm.store %291, %297 : !llvm.ptr, !llvm.ptr
    %299 = arith.constant 1 : i32
    %300 = arith.addi %290, %299 : i32
    %301 = arith.extsi %300 : i32 to i64
    %302 = arith.constant 4 : i32
    %303 = arith.extsi %302 : i32 to i64
    %298 = func.call @calloc(%301, %303) : (i64, i64) -> !llvm.ptr
    %304 = llvm.mlir.addressof @PT_id2 : !llvm.ptr
    llvm.store %298, %304 : !llvm.ptr, !llvm.ptr
    %305 = arith.constant 0 : i32
    %306 = arith.extsi %305 : i32 to i64
    %307 = llvm.mlir.constant(1 : i64) : i64
    %308 = llvm.alloca %307 x i64 : (i64) -> !llvm.ptr
    llvm.store %306, %308 : i64, !llvm.ptr
    cf.br ^bb54
    ^bb54:
    %309 = llvm.load %308 : !llvm.ptr -> i64
    %310 = llvm.load %265 : !llvm.ptr -> i64
    %311 = arith.cmpi slt, %309, %310 : i64
    cf.cond_br %311, ^bb55, ^bb56
    ^bb55:
      %313 = llvm.load %261 : !llvm.ptr -> !llvm.ptr
      %314 = llvm.load %308 : !llvm.ptr -> i64
      %315 = llvm.getelementptr %313[%314] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %312 = llvm.load %315 : !llvm.ptr -> i64
      %316 = arith.extsi %290 : i32 to i64
      %317 = arith.cmpi sle, %312, %316 : i64
      cf.cond_br %317, ^bb57, ^bb58
      ^bb57:
        %318 = llvm.load %308 : !llvm.ptr -> i64
        %319 = arith.trunci %318 : i64 to i32
        %320 = llvm.mlir.addressof @PT_id1 : !llvm.ptr
        %321 = llvm.load %320 : !llvm.ptr -> !llvm.ptr
        %322 = arith.trunci %312 : i64 to i32
        %323 = arith.extsi %322 : i32 to i64
        %324 = llvm.getelementptr %321[%323] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %319, %324 : i32, !llvm.ptr
        cf.br ^bb59
      ^bb58:
        %325 = llvm.load %308 : !llvm.ptr -> i64
        %326 = arith.trunci %325 : i64 to i32
        %327 = llvm.mlir.addressof @PT_id2 : !llvm.ptr
        %328 = llvm.load %327 : !llvm.ptr -> !llvm.ptr
        %329 = arith.divsi %arg0, %312 : i64
        %330 = arith.trunci %329 : i64 to i32
        %331 = arith.extsi %330 : i32 to i64
        %332 = llvm.getelementptr %328[%331] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %326, %332 : i32, !llvm.ptr
        cf.br ^bb59
      ^bb59:
      %333 = llvm.load %308 : !llvm.ptr -> i64
      %334 = arith.constant 1 : i32
      %336 = arith.extsi %334 : i32 to i64
      %335 = arith.addi %333, %336 : i64
      llvm.store %335, %308 : i64, !llvm.ptr
      cf.br ^bb54
    ^bb56:
    %338 = llvm.load %265 : !llvm.ptr -> i64
    %339 = arith.constant 8 : i32
    %340 = arith.extsi %339 : i32 to i64
    %337 = func.call @calloc(%338, %340) : (i64, i64) -> !llvm.ptr
    %341 = llvm.mlir.addressof @PT_pi_tbl : !llvm.ptr
    llvm.store %337, %341 : !llvm.ptr, !llvm.ptr
    %343 = llvm.load %265 : !llvm.ptr -> i64
    %344 = arith.constant 8 : i32
    %345 = arith.extsi %344 : i32 to i64
    %342 = func.call @calloc(%343, %345) : (i64, i64) -> !llvm.ptr
    %346 = llvm.mlir.addressof @PT_chi_tbl : !llvm.ptr
    llvm.store %342, %346 : !llvm.ptr, !llvm.ptr
    %347 = arith.constant 0 : i32
    %348 = arith.extsi %347 : i32 to i64
    %349 = llvm.mlir.constant(1 : i64) : i64
    %350 = llvm.alloca %349 x i64 : (i64) -> !llvm.ptr
    llvm.store %348, %350 : i64, !llvm.ptr
    cf.br ^bb60
    ^bb60:
    %351 = llvm.load %350 : !llvm.ptr -> i64
    %352 = llvm.load %265 : !llvm.ptr -> i64
    %353 = arith.cmpi slt, %351, %352 : i64
    cf.cond_br %353, ^bb61, ^bb62
    ^bb61:
      %355 = llvm.load %261 : !llvm.ptr -> !llvm.ptr
      %356 = llvm.load %350 : !llvm.ptr -> i64
      %357 = llvm.getelementptr %355[%356] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %354 = llvm.load %357 : !llvm.ptr -> i64
      %358 = arith.constant 1 : i32
      %360 = arith.extsi %358 : i32 to i64
      %359 = arith.subi %354, %360 : i64
      %361 = llvm.mlir.addressof @PT_pi_tbl : !llvm.ptr
      %362 = llvm.load %361 : !llvm.ptr -> !llvm.ptr
      %363 = llvm.load %350 : !llvm.ptr -> i64
      %364 = llvm.getelementptr %362[%363] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %359, %364 : i64, !llvm.ptr
      %367 = llvm.load %261 : !llvm.ptr -> !llvm.ptr
      %368 = llvm.load %350 : !llvm.ptr -> i64
      %369 = llvm.getelementptr %367[%368] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %366 = llvm.load %369 : !llvm.ptr -> i64
      %365 = func.call @chi_prefix_integers(%366) : (i64) -> i64
      %370 = arith.constant 1 : i32
      %372 = arith.extsi %370 : i32 to i64
      %371 = arith.subi %365, %372 : i64
      %373 = llvm.mlir.addressof @PT_chi_tbl : !llvm.ptr
      %374 = llvm.load %373 : !llvm.ptr -> !llvm.ptr
      %375 = llvm.load %350 : !llvm.ptr -> i64
      %376 = llvm.getelementptr %374[%375] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %371, %376 : i64, !llvm.ptr
      %377 = llvm.load %350 : !llvm.ptr -> i64
      %378 = arith.constant 1 : i32
      %380 = arith.extsi %378 : i32 to i64
      %379 = arith.addi %377, %380 : i64
      llvm.store %379, %350 : i64, !llvm.ptr
      cf.br ^bb60
    ^bb62:
    %382 = arith.constant 1 : i32
    %383 = arith.addi %290, %382 : i32
    %384 = arith.extsi %383 : i32 to i64
    %385 = arith.constant 1 : i32
    %386 = arith.extsi %385 : i32 to i64
    %381 = func.call @calloc(%384, %386) : (i64, i64) -> !llvm.ptr
    %387 = arith.constant 0 : i32
    %388 = llvm.mlir.constant(1 : i64) : i64
    %389 = llvm.alloca %388 x i32 : (i64) -> !llvm.ptr
    llvm.store %387, %389 : i32, !llvm.ptr
    cf.br ^bb63
    ^bb63:
    %390 = llvm.load %389 : !llvm.ptr -> i32
    %391 = arith.cmpi sle, %390, %290 : i32
    cf.cond_br %391, ^bb64, ^bb65
    ^bb64:
      %392 = arith.constant 1 : i32
      %393 = llvm.load %389 : !llvm.ptr -> i32
      %394 = arith.trunci %392 : i32 to i8
      %395 = arith.extsi %393 : i32 to i64
      %396 = llvm.getelementptr %381[%395] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %394, %396 : i8, !llvm.ptr
      %397 = llvm.load %389 : !llvm.ptr -> i32
      %398 = arith.constant 1 : i32
      %399 = arith.addi %397, %398 : i32
      llvm.store %399, %389 : i32, !llvm.ptr
      cf.br ^bb63
    ^bb65:
    %400 = arith.constant 0 : i32
    %401 = arith.cmpi sge, %290, %400 : i32
    cf.cond_br %401, ^bb66, ^bb67
    ^bb66:
      %402 = arith.constant 0 : i32
      %403 = arith.constant 0 : i32
      %404 = arith.trunci %402 : i32 to i8
      %405 = arith.extsi %403 : i32 to i64
      %406 = llvm.getelementptr %381[%405] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %404, %406 : i8, !llvm.ptr
      cf.br ^bb68
    ^bb67:
      cf.br ^bb68
    ^bb68:
    %407 = arith.constant 1 : i32
    %408 = arith.cmpi sge, %290, %407 : i32
    cf.cond_br %408, ^bb69, ^bb70
    ^bb69:
      %409 = arith.constant 0 : i32
      %410 = arith.constant 1 : i32
      %411 = arith.trunci %409 : i32 to i8
      %412 = arith.extsi %410 : i32 to i64
      %413 = llvm.getelementptr %381[%412] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %411, %413 : i8, !llvm.ptr
      cf.br ^bb71
    ^bb70:
      cf.br ^bb71
    ^bb71:
    %415 = arith.extsi %290 : i32 to i64
    %414 = func.call @isqrt(%415) : (i64) -> i64
    %416 = arith.trunci %414 : i64 to i32
    %417 = arith.constant 2 : i32
    %418 = llvm.mlir.constant(1 : i64) : i64
    %419 = llvm.alloca %418 x i32 : (i64) -> !llvm.ptr
    llvm.store %417, %419 : i32, !llvm.ptr
    cf.br ^bb72
    ^bb72:
    %420 = llvm.load %419 : !llvm.ptr -> i32
    %421 = arith.cmpi sle, %420, %416 : i32
    cf.cond_br %421, ^bb73, ^bb74
    ^bb73:
      %423 = llvm.load %419 : !llvm.ptr -> i32
      %424 = arith.extsi %423 : i32 to i64
      %425 = llvm.getelementptr %381[%424] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %422 = llvm.load %425 : !llvm.ptr -> i8
      %426 = arith.constant 0 : i32
      %428 = arith.extsi %422 : i8 to i32
      %427 = arith.cmpi ne, %428, %426 : i32
      cf.cond_br %427, ^bb75, ^bb76
      ^bb75:
        %429 = llvm.load %419 : !llvm.ptr -> i32
        %430 = llvm.load %419 : !llvm.ptr -> i32
        %431 = arith.muli %429, %430 : i32
        %432 = llvm.mlir.constant(1 : i64) : i64
        %433 = llvm.alloca %432 x i32 : (i64) -> !llvm.ptr
        llvm.store %431, %433 : i32, !llvm.ptr
        cf.br ^bb78
        ^bb78:
        %434 = llvm.load %433 : !llvm.ptr -> i32
        %435 = arith.cmpi sle, %434, %290 : i32
        cf.cond_br %435, ^bb79, ^bb80
        ^bb79:
          %436 = arith.constant 0 : i32
          %437 = llvm.load %433 : !llvm.ptr -> i32
          %438 = arith.trunci %436 : i32 to i8
          %439 = arith.extsi %437 : i32 to i64
          %440 = llvm.getelementptr %381[%439] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %438, %440 : i8, !llvm.ptr
          %441 = llvm.load %433 : !llvm.ptr -> i32
          %442 = llvm.load %419 : !llvm.ptr -> i32
          %443 = arith.addi %441, %442 : i32
          llvm.store %443, %433 : i32, !llvm.ptr
          cf.br ^bb78
        ^bb80:
        cf.br ^bb77
      ^bb76:
        cf.br ^bb77
      ^bb77:
      %444 = llvm.load %419 : !llvm.ptr -> i32
      %445 = arith.constant 1 : i32
      %446 = arith.addi %444, %445 : i32
      llvm.store %446, %419 : i32, !llvm.ptr
      cf.br ^bb72
    ^bb74:
    %447 = arith.constant 0 : i32
    %448 = arith.extsi %447 : i32 to i64
    %449 = llvm.mlir.constant(1 : i64) : i64
    %450 = llvm.alloca %449 x i64 : (i64) -> !llvm.ptr
    llvm.store %448, %450 : i64, !llvm.ptr
    %451 = arith.constant 2 : i32
    %452 = llvm.mlir.constant(1 : i64) : i64
    %453 = llvm.alloca %452 x i32 : (i64) -> !llvm.ptr
    llvm.store %451, %453 : i32, !llvm.ptr
    cf.br ^bb81
    ^bb81:
    %454 = llvm.load %453 : !llvm.ptr -> i32
    %455 = arith.cmpi sle, %454, %290 : i32
    cf.cond_br %455, ^bb82, ^bb83
    ^bb82:
      %457 = llvm.load %453 : !llvm.ptr -> i32
      %458 = arith.extsi %457 : i32 to i64
      %459 = llvm.getelementptr %381[%458] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %456 = llvm.load %459 : !llvm.ptr -> i8
      %460 = arith.constant 0 : i32
      %462 = arith.extsi %456 : i8 to i32
      %461 = arith.cmpi ne, %462, %460 : i32
      cf.cond_br %461, ^bb84, ^bb85
      ^bb84:
        %463 = llvm.load %450 : !llvm.ptr -> i64
        %464 = arith.constant 1 : i32
        %466 = arith.extsi %464 : i32 to i64
        %465 = arith.addi %463, %466 : i64
        llvm.store %465, %450 : i64, !llvm.ptr
        cf.br ^bb86
      ^bb85:
        cf.br ^bb86
      ^bb86:
      %467 = llvm.load %453 : !llvm.ptr -> i32
      %468 = arith.constant 1 : i32
      %469 = arith.addi %467, %468 : i32
      llvm.store %469, %453 : i32, !llvm.ptr
      cf.br ^bb81
    ^bb83:
    %471 = llvm.load %450 : !llvm.ptr -> i64
    %472 = arith.constant 4 : i32
    %473 = arith.extsi %472 : i32 to i64
    %470 = func.call @calloc(%471, %473) : (i64, i64) -> !llvm.ptr
    %474 = llvm.mlir.addressof @PT_primes : !llvm.ptr
    llvm.store %470, %474 : !llvm.ptr, !llvm.ptr
    %475 = llvm.load %450 : !llvm.ptr -> i64
    %476 = llvm.mlir.addressof @PT_primes_len : !llvm.ptr
    llvm.store %475, %476 : i64, !llvm.ptr
    %477 = arith.constant 0 : i32
    %478 = arith.extsi %477 : i32 to i64
    %479 = llvm.mlir.constant(1 : i64) : i64
    %480 = llvm.alloca %479 x i64 : (i64) -> !llvm.ptr
    llvm.store %478, %480 : i64, !llvm.ptr
    %481 = arith.constant 2 : i32
    %482 = llvm.mlir.constant(1 : i64) : i64
    %483 = llvm.alloca %482 x i32 : (i64) -> !llvm.ptr
    llvm.store %481, %483 : i32, !llvm.ptr
    cf.br ^bb87
    ^bb87:
    %484 = llvm.load %483 : !llvm.ptr -> i32
    %485 = arith.cmpi sle, %484, %290 : i32
    cf.cond_br %485, ^bb88, ^bb89
    ^bb88:
      %487 = llvm.load %483 : !llvm.ptr -> i32
      %488 = arith.extsi %487 : i32 to i64
      %489 = llvm.getelementptr %381[%488] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %486 = llvm.load %489 : !llvm.ptr -> i8
      %490 = arith.constant 0 : i32
      %492 = arith.extsi %486 : i8 to i32
      %491 = arith.cmpi ne, %492, %490 : i32
      cf.cond_br %491, ^bb90, ^bb91
      ^bb90:
        %493 = llvm.load %483 : !llvm.ptr -> i32
        %494 = llvm.mlir.addressof @PT_primes : !llvm.ptr
        %495 = llvm.load %494 : !llvm.ptr -> !llvm.ptr
        %496 = llvm.load %480 : !llvm.ptr -> i64
        %497 = llvm.getelementptr %495[%496] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %493, %497 : i32, !llvm.ptr
        %498 = llvm.load %480 : !llvm.ptr -> i64
        %499 = arith.constant 1 : i32
        %501 = arith.extsi %499 : i32 to i64
        %500 = arith.addi %498, %501 : i64
        llvm.store %500, %480 : i64, !llvm.ptr
        cf.br ^bb92
      ^bb91:
        cf.br ^bb92
      ^bb92:
      %502 = llvm.load %483 : !llvm.ptr -> i32
      %503 = arith.constant 1 : i32
      %504 = arith.addi %502, %503 : i32
      llvm.store %504, %483 : i32, !llvm.ptr
      cf.br ^bb87
    ^bb89:
    %506 = llvm.load %450 : !llvm.ptr -> i64
    %507 = arith.constant 1 : i32
    %509 = arith.extsi %507 : i32 to i64
    %508 = arith.addi %506, %509 : i64
    %510 = arith.constant 8 : i32
    %511 = arith.extsi %510 : i32 to i64
    %505 = func.call @calloc(%508, %511) : (i64, i64) -> !llvm.ptr
    %512 = arith.constant 0 : i32
    %513 = arith.extsi %512 : i32 to i64
    %514 = llvm.mlir.constant(1 : i64) : i64
    %515 = llvm.alloca %514 x i64 : (i64) -> !llvm.ptr
    llvm.store %513, %515 : i64, !llvm.ptr
    %516 = arith.constant 0 : i32
    %517 = arith.extsi %516 : i32 to i64
    %518 = llvm.mlir.constant(1 : i64) : i64
    %519 = llvm.alloca %518 x i64 : (i64) -> !llvm.ptr
    llvm.store %517, %519 : i64, !llvm.ptr
    cf.br ^bb93
    ^bb93:
    %520 = llvm.load %519 : !llvm.ptr -> i64
    %521 = llvm.load %450 : !llvm.ptr -> i64
    %522 = arith.cmpi slt, %520, %521 : i64
    cf.cond_br %522, ^bb94, ^bb95
    ^bb94:
      %523 = llvm.load %515 : !llvm.ptr -> i64
      %526 = llvm.mlir.addressof @PT_primes : !llvm.ptr
      %527 = llvm.load %526 : !llvm.ptr -> !llvm.ptr
      %528 = llvm.load %519 : !llvm.ptr -> i64
      %529 = llvm.getelementptr %527[%528] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %525 = llvm.load %529 : !llvm.ptr -> i32
      %530 = arith.extsi %525 : i32 to i64
      %524 = func.call @chi_mod3(%530) : (i64) -> i32
      %531 = arith.extsi %524 : i32 to i64
      %532 = arith.addi %523, %531 : i64
      llvm.store %532, %515 : i64, !llvm.ptr
      %533 = llvm.load %515 : !llvm.ptr -> i64
      %534 = llvm.load %519 : !llvm.ptr -> i64
      %535 = arith.constant 1 : i32
      %537 = arith.extsi %535 : i32 to i64
      %536 = arith.addi %534, %537 : i64
      %538 = llvm.getelementptr %505[%536] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %533, %538 : i64, !llvm.ptr
      %539 = llvm.load %519 : !llvm.ptr -> i64
      %540 = arith.constant 1 : i32
      %542 = arith.extsi %540 : i32 to i64
      %541 = arith.addi %539, %542 : i64
      llvm.store %541, %519 : i64, !llvm.ptr
      cf.br ^bb93
    ^bb95:
    %543 = arith.constant 0 : i32
    %544 = arith.extsi %543 : i32 to i64
    %545 = llvm.mlir.constant(1 : i64) : i64
    %546 = llvm.alloca %545 x i64 : (i64) -> !llvm.ptr
    llvm.store %544, %546 : i64, !llvm.ptr
    cf.br ^bb96
    ^bb96:
    %547 = llvm.load %546 : !llvm.ptr -> i64
    %548 = llvm.load %450 : !llvm.ptr -> i64
    %549 = arith.cmpi slt, %547, %548 : i64
    cf.cond_br %549, ^bb97, ^bb98
    ^bb97:
      %551 = llvm.mlir.addressof @PT_primes : !llvm.ptr
      %552 = llvm.load %551 : !llvm.ptr -> !llvm.ptr
      %553 = llvm.load %546 : !llvm.ptr -> i64
      %554 = llvm.getelementptr %552[%553] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %550 = llvm.load %554 : !llvm.ptr -> i32
      %555 = arith.extsi %550 : i32 to i64
      %556 = arith.extsi %550 : i32 to i64
      %557 = arith.muli %555, %556 : i64
      %558 = arith.cmpi sgt, %557, %arg0 : i64
      cf.cond_br %558, ^bb99, ^bb100
      ^bb99:
        cf.br ^bb98
      ^bb100:
        cf.br ^bb101
      ^bb101:
      %559 = llvm.load %546 : !llvm.ptr -> i64
      %561 = llvm.load %546 : !llvm.ptr -> i64
      %562 = llvm.getelementptr %505[%561] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %560 = llvm.load %562 : !llvm.ptr -> i64
      %564 = arith.extsi %550 : i32 to i64
      %563 = func.call @chi_mod3(%564) : (i64) -> i32
      %565 = arith.constant 0 : i32
      %566 = arith.extsi %565 : i32 to i64
      %567 = llvm.mlir.constant(1 : i64) : i64
      %568 = llvm.alloca %567 x i64 : (i64) -> !llvm.ptr
      llvm.store %566, %568 : i64, !llvm.ptr
      cf.br ^bb102
      ^bb102:
      %569 = llvm.load %568 : !llvm.ptr -> i64
      %570 = llvm.load %265 : !llvm.ptr -> i64
      %571 = arith.cmpi slt, %569, %570 : i64
      cf.cond_br %571, ^bb103, ^bb104
      ^bb103:
        %573 = llvm.load %261 : !llvm.ptr -> !llvm.ptr
        %574 = llvm.load %568 : !llvm.ptr -> i64
        %575 = llvm.getelementptr %573[%574] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %572 = llvm.load %575 : !llvm.ptr -> i64
        %576 = arith.cmpi slt, %572, %557 : i64
        cf.cond_br %576, ^bb105, ^bb106
        ^bb105:
          cf.br ^bb104
        ^bb106:
          cf.br ^bb107
        ^bb107:
        %578 = llvm.load %261 : !llvm.ptr -> !llvm.ptr
        %579 = llvm.load %568 : !llvm.ptr -> i64
        %580 = llvm.getelementptr %578[%579] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %577 = llvm.load %580 : !llvm.ptr -> i64
        %581 = arith.extsi %550 : i32 to i64
        %582 = arith.divsi %577, %581 : i64
        %583 = func.call @pt_idx_of(%582) : (i64) -> i64
        %585 = llvm.mlir.addressof @PT_pi_tbl : !llvm.ptr
        %586 = llvm.load %585 : !llvm.ptr -> !llvm.ptr
        %587 = llvm.load %568 : !llvm.ptr -> i64
        %588 = llvm.getelementptr %586[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %584 = llvm.load %588 : !llvm.ptr -> i64
        %590 = llvm.mlir.addressof @PT_pi_tbl : !llvm.ptr
        %591 = llvm.load %590 : !llvm.ptr -> !llvm.ptr
        %592 = llvm.getelementptr %591[%583] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %589 = llvm.load %592 : !llvm.ptr -> i64
        %593 = arith.subi %589, %559 : i64
        %594 = arith.subi %584, %593 : i64
        %595 = llvm.mlir.addressof @PT_pi_tbl : !llvm.ptr
        %596 = llvm.load %595 : !llvm.ptr -> !llvm.ptr
        %597 = llvm.load %568 : !llvm.ptr -> i64
        %598 = llvm.getelementptr %596[%597] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %594, %598 : i64, !llvm.ptr
        %600 = llvm.mlir.addressof @PT_chi_tbl : !llvm.ptr
        %601 = llvm.load %600 : !llvm.ptr -> !llvm.ptr
        %602 = llvm.load %568 : !llvm.ptr -> i64
        %603 = llvm.getelementptr %601[%602] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %599 = llvm.load %603 : !llvm.ptr -> i64
        %604 = arith.extsi %563 : i32 to i64
        %606 = llvm.mlir.addressof @PT_chi_tbl : !llvm.ptr
        %607 = llvm.load %606 : !llvm.ptr -> !llvm.ptr
        %608 = llvm.getelementptr %607[%583] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %605 = llvm.load %608 : !llvm.ptr -> i64
        %609 = arith.subi %605, %560 : i64
        %610 = arith.muli %604, %609 : i64
        %611 = arith.subi %599, %610 : i64
        %612 = llvm.mlir.addressof @PT_chi_tbl : !llvm.ptr
        %613 = llvm.load %612 : !llvm.ptr -> !llvm.ptr
        %614 = llvm.load %568 : !llvm.ptr -> i64
        %615 = llvm.getelementptr %613[%614] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %611, %615 : i64, !llvm.ptr
        %616 = llvm.load %568 : !llvm.ptr -> i64
        %617 = arith.constant 1 : i32
        %619 = arith.extsi %617 : i32 to i64
        %618 = arith.addi %616, %619 : i64
        llvm.store %618, %568 : i64, !llvm.ptr
        cf.br ^bb102
      ^bb104:
      %620 = llvm.load %546 : !llvm.ptr -> i64
      %621 = arith.constant 1 : i32
      %623 = arith.extsi %621 : i32 to i64
      %622 = arith.addi %620, %623 : i64
      llvm.store %622, %546 : i64, !llvm.ptr
      cf.br ^bb96
    ^bb98:
    func.call @free(%381) : (!llvm.ptr) -> ()
    func.call @free(%505) : (!llvm.ptr) -> ()
    func.return
  }
  func.func @build_summatory(%arg0: i64) -> () {
    func.call @build_prime_tables(%arg0) : (i64) -> ()
    %627 = arith.constant 0 : i32
    %628 = arith.extsi %627 : i32 to i64
    %629 = llvm.mlir.constant(1 : i64) : i64
    %630 = llvm.alloca %629 x i64 : (i64) -> !llvm.ptr
    llvm.store %628, %630 : i64, !llvm.ptr
    %631 = arith.constant 0 : i32
    %632 = arith.extsi %631 : i32 to i64
    %633 = llvm.mlir.constant(1 : i64) : i64
    %634 = llvm.alloca %633 x i64 : (i64) -> !llvm.ptr
    llvm.store %632, %634 : i64, !llvm.ptr
    cf.br ^bb108
    ^bb108:
    %635 = llvm.load %634 : !llvm.ptr -> i64
    %636 = llvm.mlir.addressof @PT_primes_len : !llvm.ptr
    %637 = llvm.load %636 : !llvm.ptr -> i64
    %638 = arith.cmpi slt, %635, %637 : i64
    cf.cond_br %638, ^bb109, ^bb110
    ^bb109:
      %640 = llvm.mlir.addressof @PT_primes : !llvm.ptr
      %641 = llvm.load %640 : !llvm.ptr -> !llvm.ptr
      %642 = llvm.load %634 : !llvm.ptr -> i64
      %643 = llvm.getelementptr %641[%642] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %639 = llvm.load %643 : !llvm.ptr -> i32
      %644 = arith.constant 5 : i32
      %645 = arith.cmpi sge, %639, %644 : i32
      cf.cond_br %645, ^bb111, ^bb112
      ^bb111:
        %646 = llvm.load %630 : !llvm.ptr -> i64
        %647 = arith.constant 1 : i32
        %649 = arith.extsi %647 : i32 to i64
        %648 = arith.addi %646, %649 : i64
        llvm.store %648, %630 : i64, !llvm.ptr
        cf.br ^bb113
      ^bb112:
        cf.br ^bb113
      ^bb113:
      %650 = llvm.load %634 : !llvm.ptr -> i64
      %651 = arith.constant 1 : i32
      %653 = arith.extsi %651 : i32 to i64
      %652 = arith.addi %650, %653 : i64
      llvm.store %652, %634 : i64, !llvm.ptr
      cf.br ^bb108
    ^bb110:
    %655 = llvm.load %630 : !llvm.ptr -> i64
    %656 = arith.constant 4 : i32
    %657 = arith.extsi %656 : i32 to i64
    %654 = func.call @calloc(%655, %657) : (i64, i64) -> !llvm.ptr
    %658 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
    llvm.store %654, %658 : !llvm.ptr, !llvm.ptr
    %659 = llvm.load %630 : !llvm.ptr -> i64
    %660 = llvm.mlir.addressof @S_rec_len : !llvm.ptr
    llvm.store %659, %660 : i64, !llvm.ptr
    %661 = arith.constant 0 : i32
    %662 = arith.extsi %661 : i32 to i64
    %663 = llvm.mlir.constant(1 : i64) : i64
    %664 = llvm.alloca %663 x i64 : (i64) -> !llvm.ptr
    llvm.store %662, %664 : i64, !llvm.ptr
    %665 = arith.constant 0 : i32
    %666 = arith.extsi %665 : i32 to i64
    %667 = llvm.mlir.constant(1 : i64) : i64
    %668 = llvm.alloca %667 x i64 : (i64) -> !llvm.ptr
    llvm.store %666, %668 : i64, !llvm.ptr
    cf.br ^bb114
    ^bb114:
    %669 = llvm.load %664 : !llvm.ptr -> i64
    %670 = llvm.mlir.addressof @PT_primes_len : !llvm.ptr
    %671 = llvm.load %670 : !llvm.ptr -> i64
    %672 = arith.cmpi slt, %669, %671 : i64
    cf.cond_br %672, ^bb115, ^bb116
    ^bb115:
      %674 = llvm.mlir.addressof @PT_primes : !llvm.ptr
      %675 = llvm.load %674 : !llvm.ptr -> !llvm.ptr
      %676 = llvm.load %664 : !llvm.ptr -> i64
      %677 = llvm.getelementptr %675[%676] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %673 = llvm.load %677 : !llvm.ptr -> i32
      %678 = arith.constant 5 : i32
      %679 = arith.cmpi sge, %673, %678 : i32
      cf.cond_br %679, ^bb117, ^bb118
      ^bb117:
        %681 = llvm.mlir.addressof @PT_primes : !llvm.ptr
        %682 = llvm.load %681 : !llvm.ptr -> !llvm.ptr
        %683 = llvm.load %664 : !llvm.ptr -> i64
        %684 = llvm.getelementptr %682[%683] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %680 = llvm.load %684 : !llvm.ptr -> i32
        %685 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
        %686 = llvm.load %685 : !llvm.ptr -> !llvm.ptr
        %687 = llvm.load %668 : !llvm.ptr -> i64
        %688 = llvm.getelementptr %686[%687] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %680, %688 : i32, !llvm.ptr
        %689 = llvm.load %668 : !llvm.ptr -> i64
        %690 = arith.constant 1 : i32
        %692 = arith.extsi %690 : i32 to i64
        %691 = arith.addi %689, %692 : i64
        llvm.store %691, %668 : i64, !llvm.ptr
        cf.br ^bb119
      ^bb118:
        cf.br ^bb119
      ^bb119:
      %693 = llvm.load %664 : !llvm.ptr -> i64
      %694 = arith.constant 1 : i32
      %696 = arith.extsi %694 : i32 to i64
      %695 = arith.addi %693, %696 : i64
      llvm.store %695, %664 : i64, !llvm.ptr
      cf.br ^bb114
    ^bb116:
    %697 = arith.constant 1 : i32
    %698 = arith.constant 21 : i32
    %699 = arith.shli %697, %698 : i32
    %700 = arith.extsi %699 : i32 to i64
    %701 = llvm.mlir.addressof @cF_cap : !llvm.ptr
    llvm.store %700, %701 : i64, !llvm.ptr
    %703 = llvm.mlir.addressof @cF_cap : !llvm.ptr
    %704 = llvm.load %703 : !llvm.ptr -> i64
    %705 = arith.constant 8 : i32
    %706 = arith.extsi %705 : i32 to i64
    %702 = func.call @calloc(%704, %706) : (i64, i64) -> !llvm.ptr
    %707 = llvm.mlir.addressof @cF_keys : !llvm.ptr
    llvm.store %702, %707 : !llvm.ptr, !llvm.ptr
    %709 = llvm.mlir.addressof @cF_cap : !llvm.ptr
    %710 = llvm.load %709 : !llvm.ptr -> i64
    %711 = arith.constant 8 : i32
    %712 = arith.extsi %711 : i32 to i64
    %708 = func.call @calloc(%710, %712) : (i64, i64) -> !llvm.ptr
    %713 = llvm.mlir.addressof @cF_vals : !llvm.ptr
    llvm.store %708, %713 : !llvm.ptr, !llvm.ptr
    %715 = llvm.mlir.addressof @cF_cap : !llvm.ptr
    %716 = llvm.load %715 : !llvm.ptr -> i64
    %717 = arith.constant 1 : i32
    %718 = arith.extsi %717 : i32 to i64
    %714 = func.call @calloc(%716, %718) : (i64, i64) -> !llvm.ptr
    %719 = llvm.mlir.addressof @cF_used : !llvm.ptr
    llvm.store %714, %719 : !llvm.ptr, !llvm.ptr
    %720 = arith.constant 1 : i32
    %721 = arith.constant 21 : i32
    %722 = arith.shli %720, %721 : i32
    %723 = arith.extsi %722 : i32 to i64
    %724 = llvm.mlir.addressof @cG_cap : !llvm.ptr
    llvm.store %723, %724 : i64, !llvm.ptr
    %726 = llvm.mlir.addressof @cG_cap : !llvm.ptr
    %727 = llvm.load %726 : !llvm.ptr -> i64
    %728 = arith.constant 8 : i32
    %729 = arith.extsi %728 : i32 to i64
    %725 = func.call @calloc(%727, %729) : (i64, i64) -> !llvm.ptr
    %730 = llvm.mlir.addressof @cG_keys : !llvm.ptr
    llvm.store %725, %730 : !llvm.ptr, !llvm.ptr
    %732 = llvm.mlir.addressof @cG_cap : !llvm.ptr
    %733 = llvm.load %732 : !llvm.ptr -> i64
    %734 = arith.constant 8 : i32
    %735 = arith.extsi %734 : i32 to i64
    %731 = func.call @calloc(%733, %735) : (i64, i64) -> !llvm.ptr
    %736 = llvm.mlir.addressof @cG_vals : !llvm.ptr
    llvm.store %731, %736 : !llvm.ptr, !llvm.ptr
    %738 = llvm.mlir.addressof @cG_cap : !llvm.ptr
    %739 = llvm.load %738 : !llvm.ptr -> i64
    %740 = arith.constant 1 : i32
    %741 = arith.extsi %740 : i32 to i64
    %737 = func.call @calloc(%739, %741) : (i64, i64) -> !llvm.ptr
    %742 = llvm.mlir.addressof @cG_used : !llvm.ptr
    llvm.store %737, %742 : !llvm.ptr, !llvm.ptr
    func.return
  }
  func.func @hkey(%arg0: i64, %arg1: i64) -> i64 {
    %743 = arith.constant 20 : i32
    %745 = arith.extsi %743 : i32 to i64
    %744 = arith.shli %arg0, %745 : i64
    %746 = arith.ori %744, %arg1 : i64
    func.return %746 : i64
  }
  func.func @hf_get(%arg0: i64, %arg1: i64) -> i64 {
    %747 = func.call @hkey(%arg0, %arg1) : (i64, i64) -> i64
    %748 = llvm.mlir.constant(1 : i64) : i64
    %749 = llvm.alloca %748 x i64 : (i64) -> !llvm.ptr
    llvm.store %747, %749 : i64, !llvm.ptr
    %750 = llvm.load %749 : !llvm.ptr -> i64
    %751 = arith.constant 0 : i32
    %753 = arith.extsi %751 : i32 to i64
    %752 = arith.cmpi slt, %750, %753 : i64
    cf.cond_br %752, ^bb120, ^bb121
    ^bb120:
      %754 = arith.constant 0 : i32
      %755 = llvm.load %749 : !llvm.ptr -> i64
      %757 = arith.extsi %754 : i32 to i64
      %756 = arith.subi %757, %755 : i64
      llvm.store %756, %749 : i64, !llvm.ptr
      cf.br ^bb122
    ^bb121:
      cf.br ^bb122
    ^bb122:
    %758 = llvm.load %749 : !llvm.ptr -> i64
    %759 = llvm.mlir.addressof @cF_cap : !llvm.ptr
    %760 = llvm.load %759 : !llvm.ptr -> i64
    %761 = arith.constant 1 : i32
    %763 = arith.extsi %761 : i32 to i64
    %762 = arith.subi %760, %763 : i64
    %764 = arith.andi %758, %762 : i64
    llvm.store %764, %749 : i64, !llvm.ptr
    cf.br ^bb123
    ^bb123:
    %766 = llvm.mlir.addressof @cF_used : !llvm.ptr
    %767 = llvm.load %766 : !llvm.ptr -> !llvm.ptr
    %768 = llvm.load %749 : !llvm.ptr -> i64
    %769 = llvm.getelementptr %767[%768] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %765 = llvm.load %769 : !llvm.ptr -> i8
    %770 = arith.constant 0 : i32
    %772 = arith.extsi %765 : i8 to i32
    %771 = arith.cmpi ne, %772, %770 : i32
    cf.cond_br %771, ^bb124, ^bb125
    ^bb124:
      %774 = llvm.mlir.addressof @cF_keys : !llvm.ptr
      %775 = llvm.load %774 : !llvm.ptr -> !llvm.ptr
      %776 = llvm.load %749 : !llvm.ptr -> i64
      %777 = llvm.getelementptr %775[%776] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %773 = llvm.load %777 : !llvm.ptr -> i64
      %778 = arith.cmpi eq, %773, %747 : i64
      cf.cond_br %778, ^bb126, ^bb127
      ^bb126:
        %780 = llvm.mlir.addressof @cF_vals : !llvm.ptr
        %781 = llvm.load %780 : !llvm.ptr -> !llvm.ptr
        %782 = llvm.load %749 : !llvm.ptr -> i64
        %783 = llvm.getelementptr %781[%782] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %779 = llvm.load %783 : !llvm.ptr -> i64
        func.return %779 : i64
      ^bb127:
        cf.br ^bb128
      ^bb128:
      %784 = llvm.load %749 : !llvm.ptr -> i64
      %785 = arith.constant 1 : i32
      %787 = arith.extsi %785 : i32 to i64
      %786 = arith.addi %784, %787 : i64
      %788 = llvm.mlir.addressof @cF_cap : !llvm.ptr
      %789 = llvm.load %788 : !llvm.ptr -> i64
      %790 = arith.constant 1 : i32
      %792 = arith.extsi %790 : i32 to i64
      %791 = arith.subi %789, %792 : i64
      %793 = arith.andi %786, %791 : i64
      llvm.store %793, %749 : i64, !llvm.ptr
      cf.br ^bb123
    ^bb125:
    %794 = arith.constant 0 : i32
    %795 = arith.constant 1 : i32
    %796 = arith.subi %794, %795 : i32
    %797 = arith.extsi %796 : i32 to i64
    func.return %797 : i64
  }
  func.func @hf_put(%arg0: i64, %arg1: i64, %arg2: i64) -> () {
    %798 = func.call @hkey(%arg0, %arg1) : (i64, i64) -> i64
    %799 = llvm.mlir.constant(1 : i64) : i64
    %800 = llvm.alloca %799 x i64 : (i64) -> !llvm.ptr
    llvm.store %798, %800 : i64, !llvm.ptr
    %801 = llvm.load %800 : !llvm.ptr -> i64
    %802 = arith.constant 0 : i32
    %804 = arith.extsi %802 : i32 to i64
    %803 = arith.cmpi slt, %801, %804 : i64
    cf.cond_br %803, ^bb129, ^bb130
    ^bb129:
      %805 = arith.constant 0 : i32
      %806 = llvm.load %800 : !llvm.ptr -> i64
      %808 = arith.extsi %805 : i32 to i64
      %807 = arith.subi %808, %806 : i64
      llvm.store %807, %800 : i64, !llvm.ptr
      cf.br ^bb131
    ^bb130:
      cf.br ^bb131
    ^bb131:
    %809 = llvm.load %800 : !llvm.ptr -> i64
    %810 = llvm.mlir.addressof @cF_cap : !llvm.ptr
    %811 = llvm.load %810 : !llvm.ptr -> i64
    %812 = arith.constant 1 : i32
    %814 = arith.extsi %812 : i32 to i64
    %813 = arith.subi %811, %814 : i64
    %815 = arith.andi %809, %813 : i64
    llvm.store %815, %800 : i64, !llvm.ptr
    cf.br ^bb132
    ^bb132:
    %817 = llvm.mlir.addressof @cF_used : !llvm.ptr
    %818 = llvm.load %817 : !llvm.ptr -> !llvm.ptr
    %819 = llvm.load %800 : !llvm.ptr -> i64
    %820 = llvm.getelementptr %818[%819] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %816 = llvm.load %820 : !llvm.ptr -> i8
    %821 = arith.constant 0 : i32
    %823 = arith.extsi %816 : i8 to i32
    %822 = arith.cmpi ne, %823, %821 : i32
    %824 = scf.if %822 -> (i1) {
      %826 = llvm.mlir.addressof @cF_keys : !llvm.ptr
      %827 = llvm.load %826 : !llvm.ptr -> !llvm.ptr
      %828 = llvm.load %800 : !llvm.ptr -> i64
      %829 = llvm.getelementptr %827[%828] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %825 = llvm.load %829 : !llvm.ptr -> i64
      %830 = arith.cmpi ne, %825, %798 : i64
      scf.yield %830 : i1
    } else {
      %831 = arith.constant false
      scf.yield %831 : i1
    }
    cf.cond_br %824, ^bb133, ^bb134
    ^bb133:
      %832 = llvm.load %800 : !llvm.ptr -> i64
      %833 = arith.constant 1 : i32
      %835 = arith.extsi %833 : i32 to i64
      %834 = arith.addi %832, %835 : i64
      %836 = llvm.mlir.addressof @cF_cap : !llvm.ptr
      %837 = llvm.load %836 : !llvm.ptr -> i64
      %838 = arith.constant 1 : i32
      %840 = arith.extsi %838 : i32 to i64
      %839 = arith.subi %837, %840 : i64
      %841 = arith.andi %834, %839 : i64
      llvm.store %841, %800 : i64, !llvm.ptr
      cf.br ^bb132
    ^bb134:
    %842 = arith.constant 1 : i32
    %843 = llvm.mlir.addressof @cF_used : !llvm.ptr
    %844 = llvm.load %843 : !llvm.ptr -> !llvm.ptr
    %845 = llvm.load %800 : !llvm.ptr -> i64
    %846 = arith.trunci %842 : i32 to i8
    %847 = llvm.getelementptr %844[%845] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %846, %847 : i8, !llvm.ptr
    %848 = llvm.mlir.addressof @cF_keys : !llvm.ptr
    %849 = llvm.load %848 : !llvm.ptr -> !llvm.ptr
    %850 = llvm.load %800 : !llvm.ptr -> i64
    %851 = llvm.getelementptr %849[%850] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %798, %851 : i64, !llvm.ptr
    %852 = llvm.mlir.addressof @cF_vals : !llvm.ptr
    %853 = llvm.load %852 : !llvm.ptr -> !llvm.ptr
    %854 = llvm.load %800 : !llvm.ptr -> i64
    %855 = llvm.getelementptr %853[%854] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg2, %855 : i64, !llvm.ptr
    func.return
  }
  func.func @hg_get(%arg0: i64, %arg1: i64) -> i64 {
    %856 = func.call @hkey(%arg0, %arg1) : (i64, i64) -> i64
    %857 = llvm.mlir.constant(1 : i64) : i64
    %858 = llvm.alloca %857 x i64 : (i64) -> !llvm.ptr
    llvm.store %856, %858 : i64, !llvm.ptr
    %859 = llvm.load %858 : !llvm.ptr -> i64
    %860 = arith.constant 0 : i32
    %862 = arith.extsi %860 : i32 to i64
    %861 = arith.cmpi slt, %859, %862 : i64
    cf.cond_br %861, ^bb135, ^bb136
    ^bb135:
      %863 = arith.constant 0 : i32
      %864 = llvm.load %858 : !llvm.ptr -> i64
      %866 = arith.extsi %863 : i32 to i64
      %865 = arith.subi %866, %864 : i64
      llvm.store %865, %858 : i64, !llvm.ptr
      cf.br ^bb137
    ^bb136:
      cf.br ^bb137
    ^bb137:
    %867 = llvm.load %858 : !llvm.ptr -> i64
    %868 = llvm.mlir.addressof @cG_cap : !llvm.ptr
    %869 = llvm.load %868 : !llvm.ptr -> i64
    %870 = arith.constant 1 : i32
    %872 = arith.extsi %870 : i32 to i64
    %871 = arith.subi %869, %872 : i64
    %873 = arith.andi %867, %871 : i64
    llvm.store %873, %858 : i64, !llvm.ptr
    cf.br ^bb138
    ^bb138:
    %875 = llvm.mlir.addressof @cG_used : !llvm.ptr
    %876 = llvm.load %875 : !llvm.ptr -> !llvm.ptr
    %877 = llvm.load %858 : !llvm.ptr -> i64
    %878 = llvm.getelementptr %876[%877] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %874 = llvm.load %878 : !llvm.ptr -> i8
    %879 = arith.constant 0 : i32
    %881 = arith.extsi %874 : i8 to i32
    %880 = arith.cmpi ne, %881, %879 : i32
    cf.cond_br %880, ^bb139, ^bb140
    ^bb139:
      %883 = llvm.mlir.addressof @cG_keys : !llvm.ptr
      %884 = llvm.load %883 : !llvm.ptr -> !llvm.ptr
      %885 = llvm.load %858 : !llvm.ptr -> i64
      %886 = llvm.getelementptr %884[%885] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %882 = llvm.load %886 : !llvm.ptr -> i64
      %887 = arith.cmpi eq, %882, %856 : i64
      cf.cond_br %887, ^bb141, ^bb142
      ^bb141:
        %889 = llvm.mlir.addressof @cG_vals : !llvm.ptr
        %890 = llvm.load %889 : !llvm.ptr -> !llvm.ptr
        %891 = llvm.load %858 : !llvm.ptr -> i64
        %892 = llvm.getelementptr %890[%891] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %888 = llvm.load %892 : !llvm.ptr -> i64
        func.return %888 : i64
      ^bb142:
        cf.br ^bb143
      ^bb143:
      %893 = llvm.load %858 : !llvm.ptr -> i64
      %894 = arith.constant 1 : i32
      %896 = arith.extsi %894 : i32 to i64
      %895 = arith.addi %893, %896 : i64
      %897 = llvm.mlir.addressof @cG_cap : !llvm.ptr
      %898 = llvm.load %897 : !llvm.ptr -> i64
      %899 = arith.constant 1 : i32
      %901 = arith.extsi %899 : i32 to i64
      %900 = arith.subi %898, %901 : i64
      %902 = arith.andi %895, %900 : i64
      llvm.store %902, %858 : i64, !llvm.ptr
      cf.br ^bb138
    ^bb140:
    %903 = arith.constant 0 : i32
    %904 = arith.constant 1 : i32
    %905 = arith.subi %903, %904 : i32
    %906 = arith.extsi %905 : i32 to i64
    func.return %906 : i64
  }
  func.func @hg_put(%arg0: i64, %arg1: i64, %arg2: i64) -> () {
    %907 = func.call @hkey(%arg0, %arg1) : (i64, i64) -> i64
    %908 = llvm.mlir.constant(1 : i64) : i64
    %909 = llvm.alloca %908 x i64 : (i64) -> !llvm.ptr
    llvm.store %907, %909 : i64, !llvm.ptr
    %910 = llvm.load %909 : !llvm.ptr -> i64
    %911 = arith.constant 0 : i32
    %913 = arith.extsi %911 : i32 to i64
    %912 = arith.cmpi slt, %910, %913 : i64
    cf.cond_br %912, ^bb144, ^bb145
    ^bb144:
      %914 = arith.constant 0 : i32
      %915 = llvm.load %909 : !llvm.ptr -> i64
      %917 = arith.extsi %914 : i32 to i64
      %916 = arith.subi %917, %915 : i64
      llvm.store %916, %909 : i64, !llvm.ptr
      cf.br ^bb146
    ^bb145:
      cf.br ^bb146
    ^bb146:
    %918 = llvm.load %909 : !llvm.ptr -> i64
    %919 = llvm.mlir.addressof @cG_cap : !llvm.ptr
    %920 = llvm.load %919 : !llvm.ptr -> i64
    %921 = arith.constant 1 : i32
    %923 = arith.extsi %921 : i32 to i64
    %922 = arith.subi %920, %923 : i64
    %924 = arith.andi %918, %922 : i64
    llvm.store %924, %909 : i64, !llvm.ptr
    cf.br ^bb147
    ^bb147:
    %926 = llvm.mlir.addressof @cG_used : !llvm.ptr
    %927 = llvm.load %926 : !llvm.ptr -> !llvm.ptr
    %928 = llvm.load %909 : !llvm.ptr -> i64
    %929 = llvm.getelementptr %927[%928] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %925 = llvm.load %929 : !llvm.ptr -> i8
    %930 = arith.constant 0 : i32
    %932 = arith.extsi %925 : i8 to i32
    %931 = arith.cmpi ne, %932, %930 : i32
    %933 = scf.if %931 -> (i1) {
      %935 = llvm.mlir.addressof @cG_keys : !llvm.ptr
      %936 = llvm.load %935 : !llvm.ptr -> !llvm.ptr
      %937 = llvm.load %909 : !llvm.ptr -> i64
      %938 = llvm.getelementptr %936[%937] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %934 = llvm.load %938 : !llvm.ptr -> i64
      %939 = arith.cmpi ne, %934, %907 : i64
      scf.yield %939 : i1
    } else {
      %940 = arith.constant false
      scf.yield %940 : i1
    }
    cf.cond_br %933, ^bb148, ^bb149
    ^bb148:
      %941 = llvm.load %909 : !llvm.ptr -> i64
      %942 = arith.constant 1 : i32
      %944 = arith.extsi %942 : i32 to i64
      %943 = arith.addi %941, %944 : i64
      %945 = llvm.mlir.addressof @cG_cap : !llvm.ptr
      %946 = llvm.load %945 : !llvm.ptr -> i64
      %947 = arith.constant 1 : i32
      %949 = arith.extsi %947 : i32 to i64
      %948 = arith.subi %946, %949 : i64
      %950 = arith.andi %943, %948 : i64
      llvm.store %950, %909 : i64, !llvm.ptr
      cf.br ^bb147
    ^bb149:
    %951 = arith.constant 1 : i32
    %952 = llvm.mlir.addressof @cG_used : !llvm.ptr
    %953 = llvm.load %952 : !llvm.ptr -> !llvm.ptr
    %954 = llvm.load %909 : !llvm.ptr -> i64
    %955 = arith.trunci %951 : i32 to i8
    %956 = llvm.getelementptr %953[%954] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %955, %956 : i8, !llvm.ptr
    %957 = llvm.mlir.addressof @cG_keys : !llvm.ptr
    %958 = llvm.load %957 : !llvm.ptr -> !llvm.ptr
    %959 = llvm.load %909 : !llvm.ptr -> i64
    %960 = llvm.getelementptr %958[%959] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %907, %960 : i64, !llvm.ptr
    %961 = llvm.mlir.addressof @cG_vals : !llvm.ptr
    %962 = llvm.load %961 : !llvm.ptr -> !llvm.ptr
    %963 = llvm.load %909 : !llvm.ptr -> i64
    %964 = llvm.getelementptr %962[%963] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg2, %964 : i64, !llvm.ptr
    func.return
  }
  func.func @prime_sum_F(%arg0: i64) -> i64 {
    %965 = func.call @pt_pi(%arg0) : (i64) -> i64
    %966 = arith.constant 0 : i32
    %967 = arith.extsi %966 : i32 to i64
    %968 = arith.constant 2 : i32
    %970 = arith.extsi %968 : i32 to i64
    %969 = arith.cmpi sge, %arg0, %970 : i64
    %971 = scf.if %969 -> (i64) {
      %972 = arith.constant 1 : i32
      %974 = arith.extsi %972 : i32 to i64
      %973 = arith.addi %967, %974 : i64
      scf.yield %973 : i64
    } else {
      scf.yield %967 : i64
    }
    %975 = arith.constant 3 : i32
    %977 = arith.extsi %975 : i32 to i64
    %976 = arith.cmpi sge, %arg0, %977 : i64
    %978 = scf.if %976 -> (i64) {
      %979 = arith.constant 1 : i32
      %981 = arith.extsi %979 : i32 to i64
      %980 = arith.addi %971, %981 : i64
      scf.yield %980 : i64
    } else {
      scf.yield %971 : i64
    }
    %982 = arith.constant 3 : i32
    %983 = arith.subi %965, %978 : i64
    %985 = arith.extsi %982 : i32 to i64
    %984 = arith.muli %985, %983 : i64
    func.return %984 : i64
  }
  func.func @prime_sum_G(%arg0: i64) -> i64 {
    %986 = func.call @pt_pi(%arg0) : (i64) -> i64
    %987 = arith.constant 0 : i32
    %988 = arith.extsi %987 : i32 to i64
    %989 = arith.constant 2 : i32
    %991 = arith.extsi %989 : i32 to i64
    %990 = arith.cmpi sge, %arg0, %991 : i64
    %992 = scf.if %990 -> (i64) {
      %993 = arith.constant 1 : i32
      %995 = arith.extsi %993 : i32 to i64
      %994 = arith.addi %988, %995 : i64
      scf.yield %994 : i64
    } else {
      scf.yield %988 : i64
    }
    %996 = arith.constant 3 : i32
    %998 = arith.extsi %996 : i32 to i64
    %997 = arith.cmpi sge, %arg0, %998 : i64
    %999 = scf.if %997 -> (i64) {
      %1000 = arith.constant 1 : i32
      %1002 = arith.extsi %1000 : i32 to i64
      %1001 = arith.addi %992, %1002 : i64
      scf.yield %1001 : i64
    } else {
      scf.yield %992 : i64
    }
    %1003 = func.call @pt_chi_prime_sum(%arg0) : (i64) -> i64
    %1004 = arith.constant 2 : i32
    %1006 = arith.extsi %1004 : i32 to i64
    %1005 = arith.cmpi sge, %arg0, %1006 : i64
    %1007 = scf.if %1005 -> (i64) {
      %1008 = arith.constant 1 : i32
      %1010 = arith.extsi %1008 : i32 to i64
      %1009 = arith.addi %1003, %1010 : i64
      scf.yield %1009 : i64
    } else {
      scf.yield %1003 : i64
    }
    %1011 = arith.subi %986, %999 : i64
    %1012 = arith.constant 2 : i32
    %1014 = arith.extsi %1012 : i32 to i64
    %1013 = arith.muli %1014, %1007 : i64
    %1015 = arith.addi %1011, %1013 : i64
    func.return %1015 : i64
  }
  func.func @val_F(%arg0: i32, %arg1: i32) -> i64 {
    %1016 = arith.constant 2 : i32
    %1017 = arith.extsi %arg1 : i32 to i64
    %1019 = arith.extsi %1016 : i32 to i64
    %1018 = arith.muli %1019, %1017 : i64
    %1020 = arith.constant 1 : i32
    %1022 = arith.extsi %1020 : i32 to i64
    %1021 = arith.addi %1018, %1022 : i64
    func.return %1021 : i64
  }
  func.func @val_G(%arg0: i32, %arg1: i32) -> i64 {
    %1023 = arith.constant 3 : i32
    %1024 = arith.remsi %arg0, %1023 : i32
    %1025 = arith.constant 1 : i32
    %1026 = arith.cmpi eq, %1024, %1025 : i32
    cf.cond_br %1026, ^bb150, ^bb151
    ^bb150:
      %1027 = arith.constant 2 : i32
      %1028 = arith.extsi %arg1 : i32 to i64
      %1030 = arith.extsi %1027 : i32 to i64
      %1029 = arith.muli %1030, %1028 : i64
      %1031 = arith.constant 1 : i32
      %1033 = arith.extsi %1031 : i32 to i64
      %1032 = arith.addi %1029, %1033 : i64
      func.return %1032 : i64
    ^bb151:
      cf.br ^bb152
    ^bb152:
    %1034 = arith.constant 1 : i32
    %1035 = arith.andi %arg1, %1034 : i32
    %1036 = arith.constant 1 : i32
    %1037 = arith.cmpi eq, %1035, %1036 : i32
    cf.cond_br %1037, ^bb153, ^bb154
    ^bb153:
      %1038 = arith.constant 0 : i32
      %1039 = arith.constant 1 : i32
      %1040 = arith.subi %1038, %1039 : i32
      %1041 = arith.extsi %1040 : i32 to i64
      func.return %1041 : i64
    ^bb154:
      cf.br ^bb155
    ^bb155:
    %1042 = arith.constant 1 : i32
    %1043 = arith.extsi %1042 : i32 to i64
    func.return %1043 : i64
  }
  func.func @H_F(%arg0: i64, %arg1: i64) -> i64 {
    %1044 = func.call @hf_get(%arg0, %arg1) : (i64, i64) -> i64
    %1045 = arith.constant 0 : i32
    %1047 = arith.extsi %1045 : i32 to i64
    %1046 = arith.cmpi sge, %1044, %1047 : i64
    cf.cond_br %1046, ^bb156, ^bb157
    ^bb156:
      func.return %1044 : i64
    ^bb157:
      cf.br ^bb158
    ^bb158:
    %1048 = arith.constant 0 : i32
    %1049 = arith.extsi %1048 : i32 to i64
    %1050 = arith.constant 0 : i32
    %1052 = arith.extsi %1050 : i32 to i64
    %1051 = arith.cmpi sgt, %arg1, %1052 : i64
    %1053 = scf.if %1051 -> (i64) {
      %1055 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
      %1056 = llvm.load %1055 : !llvm.ptr -> !llvm.ptr
      %1057 = arith.constant 1 : i32
      %1059 = arith.extsi %1057 : i32 to i64
      %1058 = arith.subi %arg1, %1059 : i64
      %1060 = llvm.getelementptr %1056[%1058] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1054 = llvm.load %1060 : !llvm.ptr -> i32
      %1061 = arith.extsi %1054 : i32 to i64
      scf.yield %1061 : i64
    } else {
      %1062 = arith.constant 1 : i32
      %1063 = arith.extsi %1062 : i32 to i64
      scf.yield %1063 : i64
    }
    %1064 = llvm.mlir.addressof @S_rec_len : !llvm.ptr
    %1065 = llvm.load %1064 : !llvm.ptr -> i64
    %1066 = arith.cmpi sge, %arg1, %1065 : i64
    cf.cond_br %1066, ^bb159, ^bb160
    ^bb159:
      %1067 = func.call @prime_sum_F(%arg0) : (i64) -> i64
      %1068 = func.call @prime_sum_F(%1053) : (i64) -> i64
      %1069 = arith.subi %1067, %1068 : i64
      func.call @hf_put(%arg0, %arg1, %1069) : (i64, i64, i64) -> ()
      func.return %1069 : i64
    ^bb160:
      cf.br ^bb161
    ^bb161:
    %1072 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
    %1073 = llvm.load %1072 : !llvm.ptr -> !llvm.ptr
    %1074 = llvm.getelementptr %1073[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %1071 = llvm.load %1074 : !llvm.ptr -> i32
    %1075 = arith.extsi %1071 : i32 to i64
    %1077 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
    %1078 = llvm.load %1077 : !llvm.ptr -> !llvm.ptr
    %1079 = llvm.getelementptr %1078[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %1076 = llvm.load %1079 : !llvm.ptr -> i32
    %1080 = arith.extsi %1076 : i32 to i64
    %1081 = arith.muli %1075, %1080 : i64
    %1082 = arith.cmpi sgt, %1081, %arg0 : i64
    cf.cond_br %1082, ^bb162, ^bb163
    ^bb162:
      %1083 = func.call @prime_sum_F(%arg0) : (i64) -> i64
      %1084 = func.call @prime_sum_F(%1053) : (i64) -> i64
      %1085 = arith.subi %1083, %1084 : i64
      func.call @hf_put(%arg0, %arg1, %1085) : (i64, i64, i64) -> ()
      func.return %1085 : i64
    ^bb163:
      cf.br ^bb164
    ^bb164:
    %1087 = func.call @prime_sum_F(%arg0) : (i64) -> i64
    %1088 = func.call @prime_sum_F(%1053) : (i64) -> i64
    %1089 = arith.subi %1087, %1088 : i64
    %1090 = llvm.mlir.constant(1 : i64) : i64
    %1091 = llvm.alloca %1090 x i64 : (i64) -> !llvm.ptr
    llvm.store %1089, %1091 : i64, !llvm.ptr
    %1092 = llvm.mlir.constant(1 : i64) : i64
    %1093 = llvm.alloca %1092 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %1093 : i64, !llvm.ptr
    cf.br ^bb165
    ^bb165:
    %1094 = llvm.load %1093 : !llvm.ptr -> i64
    %1095 = llvm.mlir.addressof @S_rec_len : !llvm.ptr
    %1096 = llvm.load %1095 : !llvm.ptr -> i64
    %1097 = arith.cmpi slt, %1094, %1096 : i64
    cf.cond_br %1097, ^bb166, ^bb167
    ^bb166:
      %1099 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
      %1100 = llvm.load %1099 : !llvm.ptr -> !llvm.ptr
      %1101 = llvm.load %1093 : !llvm.ptr -> i64
      %1102 = llvm.getelementptr %1100[%1101] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1098 = llvm.load %1102 : !llvm.ptr -> i32
      %1103 = arith.extsi %1098 : i32 to i64
      %1104 = arith.extsi %1098 : i32 to i64
      %1105 = arith.muli %1103, %1104 : i64
      %1106 = arith.cmpi sgt, %1105, %arg0 : i64
      cf.cond_br %1106, ^bb168, ^bb169
      ^bb168:
        cf.br ^bb167
      ^bb169:
        cf.br ^bb170
      ^bb170:
      %1107 = arith.extsi %1098 : i32 to i64
      %1108 = llvm.mlir.constant(1 : i64) : i64
      %1109 = llvm.alloca %1108 x i64 : (i64) -> !llvm.ptr
      llvm.store %1107, %1109 : i64, !llvm.ptr
      %1110 = arith.constant 1 : i32
      %1111 = llvm.mlir.constant(1 : i64) : i64
      %1112 = llvm.alloca %1111 x i32 : (i64) -> !llvm.ptr
      llvm.store %1110, %1112 : i32, !llvm.ptr
      cf.br ^bb171
      ^bb171:
      %1113 = llvm.load %1109 : !llvm.ptr -> i64
      %1114 = arith.extsi %1098 : i32 to i64
      %1115 = arith.muli %1113, %1114 : i64
      %1116 = arith.cmpi sle, %1115, %arg0 : i64
      cf.cond_br %1116, ^bb172, ^bb173
      ^bb172:
        %1117 = llvm.load %1091 : !llvm.ptr -> i64
        %1119 = llvm.load %1112 : !llvm.ptr -> i32
        %1118 = func.call @val_F(%1098, %1119) : (i32, i32) -> i64
        %1121 = llvm.load %1109 : !llvm.ptr -> i64
        %1122 = arith.divsi %arg0, %1121 : i64
        %1123 = llvm.load %1093 : !llvm.ptr -> i64
        %1124 = arith.constant 1 : i32
        %1126 = arith.extsi %1124 : i32 to i64
        %1125 = arith.addi %1123, %1126 : i64
        %1120 = func.call @H_F(%1122, %1125) : (i64, i64) -> i64
        %1127 = arith.muli %1118, %1120 : i64
        %1128 = arith.addi %1117, %1127 : i64
        llvm.store %1128, %1091 : i64, !llvm.ptr
        %1129 = llvm.load %1091 : !llvm.ptr -> i64
        %1131 = llvm.load %1112 : !llvm.ptr -> i32
        %1132 = arith.constant 1 : i32
        %1133 = arith.addi %1131, %1132 : i32
        %1130 = func.call @val_F(%1098, %1133) : (i32, i32) -> i64
        %1134 = arith.addi %1129, %1130 : i64
        llvm.store %1134, %1091 : i64, !llvm.ptr
        %1135 = llvm.load %1109 : !llvm.ptr -> i64
        %1136 = arith.extsi %1098 : i32 to i64
        %1137 = arith.muli %1135, %1136 : i64
        llvm.store %1137, %1109 : i64, !llvm.ptr
        %1138 = llvm.load %1112 : !llvm.ptr -> i32
        %1139 = arith.constant 1 : i32
        %1140 = arith.addi %1138, %1139 : i32
        llvm.store %1140, %1112 : i32, !llvm.ptr
        cf.br ^bb171
      ^bb173:
      %1141 = llvm.load %1093 : !llvm.ptr -> i64
      %1142 = arith.constant 1 : i32
      %1144 = arith.extsi %1142 : i32 to i64
      %1143 = arith.addi %1141, %1144 : i64
      llvm.store %1143, %1093 : i64, !llvm.ptr
      cf.br ^bb165
    ^bb167:
    %1146 = llvm.load %1091 : !llvm.ptr -> i64
    func.call @hf_put(%arg0, %arg1, %1146) : (i64, i64, i64) -> ()
    %1147 = llvm.load %1091 : !llvm.ptr -> i64
    func.return %1147 : i64
  }
  func.func @H_G(%arg0: i64, %arg1: i64) -> i64 {
    %1148 = func.call @hg_get(%arg0, %arg1) : (i64, i64) -> i64
    %1149 = arith.constant 0 : i32
    %1151 = arith.extsi %1149 : i32 to i64
    %1150 = arith.cmpi sge, %1148, %1151 : i64
    cf.cond_br %1150, ^bb174, ^bb175
    ^bb174:
      func.return %1148 : i64
    ^bb175:
      cf.br ^bb176
    ^bb176:
    %1152 = arith.constant 0 : i32
    %1153 = arith.extsi %1152 : i32 to i64
    %1154 = arith.constant 0 : i32
    %1156 = arith.extsi %1154 : i32 to i64
    %1155 = arith.cmpi sgt, %arg1, %1156 : i64
    %1157 = scf.if %1155 -> (i64) {
      %1159 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
      %1160 = llvm.load %1159 : !llvm.ptr -> !llvm.ptr
      %1161 = arith.constant 1 : i32
      %1163 = arith.extsi %1161 : i32 to i64
      %1162 = arith.subi %arg1, %1163 : i64
      %1164 = llvm.getelementptr %1160[%1162] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1158 = llvm.load %1164 : !llvm.ptr -> i32
      %1165 = arith.extsi %1158 : i32 to i64
      scf.yield %1165 : i64
    } else {
      %1166 = arith.constant 1 : i32
      %1167 = arith.extsi %1166 : i32 to i64
      scf.yield %1167 : i64
    }
    %1168 = llvm.mlir.addressof @S_rec_len : !llvm.ptr
    %1169 = llvm.load %1168 : !llvm.ptr -> i64
    %1170 = arith.cmpi sge, %arg1, %1169 : i64
    cf.cond_br %1170, ^bb177, ^bb178
    ^bb177:
      %1171 = func.call @prime_sum_G(%arg0) : (i64) -> i64
      %1172 = func.call @prime_sum_G(%1157) : (i64) -> i64
      %1173 = arith.subi %1171, %1172 : i64
      func.call @hg_put(%arg0, %arg1, %1173) : (i64, i64, i64) -> ()
      func.return %1173 : i64
    ^bb178:
      cf.br ^bb179
    ^bb179:
    %1176 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
    %1177 = llvm.load %1176 : !llvm.ptr -> !llvm.ptr
    %1178 = llvm.getelementptr %1177[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %1175 = llvm.load %1178 : !llvm.ptr -> i32
    %1179 = arith.extsi %1175 : i32 to i64
    %1181 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
    %1182 = llvm.load %1181 : !llvm.ptr -> !llvm.ptr
    %1183 = llvm.getelementptr %1182[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %1180 = llvm.load %1183 : !llvm.ptr -> i32
    %1184 = arith.extsi %1180 : i32 to i64
    %1185 = arith.muli %1179, %1184 : i64
    %1186 = arith.cmpi sgt, %1185, %arg0 : i64
    cf.cond_br %1186, ^bb180, ^bb181
    ^bb180:
      %1187 = func.call @prime_sum_G(%arg0) : (i64) -> i64
      %1188 = func.call @prime_sum_G(%1157) : (i64) -> i64
      %1189 = arith.subi %1187, %1188 : i64
      func.call @hg_put(%arg0, %arg1, %1189) : (i64, i64, i64) -> ()
      func.return %1189 : i64
    ^bb181:
      cf.br ^bb182
    ^bb182:
    %1191 = func.call @prime_sum_G(%arg0) : (i64) -> i64
    %1192 = func.call @prime_sum_G(%1157) : (i64) -> i64
    %1193 = arith.subi %1191, %1192 : i64
    %1194 = llvm.mlir.constant(1 : i64) : i64
    %1195 = llvm.alloca %1194 x i64 : (i64) -> !llvm.ptr
    llvm.store %1193, %1195 : i64, !llvm.ptr
    %1196 = llvm.mlir.constant(1 : i64) : i64
    %1197 = llvm.alloca %1196 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %1197 : i64, !llvm.ptr
    cf.br ^bb183
    ^bb183:
    %1198 = llvm.load %1197 : !llvm.ptr -> i64
    %1199 = llvm.mlir.addressof @S_rec_len : !llvm.ptr
    %1200 = llvm.load %1199 : !llvm.ptr -> i64
    %1201 = arith.cmpi slt, %1198, %1200 : i64
    cf.cond_br %1201, ^bb184, ^bb185
    ^bb184:
      %1203 = llvm.mlir.addressof @S_rec_primes : !llvm.ptr
      %1204 = llvm.load %1203 : !llvm.ptr -> !llvm.ptr
      %1205 = llvm.load %1197 : !llvm.ptr -> i64
      %1206 = llvm.getelementptr %1204[%1205] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1202 = llvm.load %1206 : !llvm.ptr -> i32
      %1207 = arith.extsi %1202 : i32 to i64
      %1208 = arith.extsi %1202 : i32 to i64
      %1209 = arith.muli %1207, %1208 : i64
      %1210 = arith.cmpi sgt, %1209, %arg0 : i64
      cf.cond_br %1210, ^bb186, ^bb187
      ^bb186:
        cf.br ^bb185
      ^bb187:
        cf.br ^bb188
      ^bb188:
      %1211 = arith.extsi %1202 : i32 to i64
      %1212 = llvm.mlir.constant(1 : i64) : i64
      %1213 = llvm.alloca %1212 x i64 : (i64) -> !llvm.ptr
      llvm.store %1211, %1213 : i64, !llvm.ptr
      %1214 = arith.constant 1 : i32
      %1215 = llvm.mlir.constant(1 : i64) : i64
      %1216 = llvm.alloca %1215 x i32 : (i64) -> !llvm.ptr
      llvm.store %1214, %1216 : i32, !llvm.ptr
      cf.br ^bb189
      ^bb189:
      %1217 = llvm.load %1213 : !llvm.ptr -> i64
      %1218 = arith.extsi %1202 : i32 to i64
      %1219 = arith.muli %1217, %1218 : i64
      %1220 = arith.cmpi sle, %1219, %arg0 : i64
      cf.cond_br %1220, ^bb190, ^bb191
      ^bb190:
        %1221 = llvm.load %1195 : !llvm.ptr -> i64
        %1223 = llvm.load %1216 : !llvm.ptr -> i32
        %1222 = func.call @val_G(%1202, %1223) : (i32, i32) -> i64
        %1225 = llvm.load %1213 : !llvm.ptr -> i64
        %1226 = arith.divsi %arg0, %1225 : i64
        %1227 = llvm.load %1197 : !llvm.ptr -> i64
        %1228 = arith.constant 1 : i32
        %1230 = arith.extsi %1228 : i32 to i64
        %1229 = arith.addi %1227, %1230 : i64
        %1224 = func.call @H_G(%1226, %1229) : (i64, i64) -> i64
        %1231 = arith.muli %1222, %1224 : i64
        %1232 = arith.addi %1221, %1231 : i64
        llvm.store %1232, %1195 : i64, !llvm.ptr
        %1233 = llvm.load %1195 : !llvm.ptr -> i64
        %1235 = llvm.load %1216 : !llvm.ptr -> i32
        %1236 = arith.constant 1 : i32
        %1237 = arith.addi %1235, %1236 : i32
        %1234 = func.call @val_G(%1202, %1237) : (i32, i32) -> i64
        %1238 = arith.addi %1233, %1234 : i64
        llvm.store %1238, %1195 : i64, !llvm.ptr
        %1239 = llvm.load %1213 : !llvm.ptr -> i64
        %1240 = arith.extsi %1202 : i32 to i64
        %1241 = arith.muli %1239, %1240 : i64
        llvm.store %1241, %1213 : i64, !llvm.ptr
        %1242 = llvm.load %1216 : !llvm.ptr -> i32
        %1243 = arith.constant 1 : i32
        %1244 = arith.addi %1242, %1243 : i32
        llvm.store %1244, %1216 : i32, !llvm.ptr
        cf.br ^bb189
      ^bb191:
      %1245 = llvm.load %1197 : !llvm.ptr -> i64
      %1246 = arith.constant 1 : i32
      %1248 = arith.extsi %1246 : i32 to i64
      %1247 = arith.addi %1245, %1248 : i64
      llvm.store %1247, %1197 : i64, !llvm.ptr
      cf.br ^bb183
    ^bb185:
    %1250 = llvm.load %1195 : !llvm.ptr -> i64
    func.call @hg_put(%arg0, %arg1, %1250) : (i64, i64, i64) -> ()
    %1251 = llvm.load %1195 : !llvm.ptr -> i64
    func.return %1251 : i64
  }
  func.func @sum_F(%arg0: i64) -> i64 {
    %1252 = arith.constant 0 : i32
    %1254 = arith.extsi %1252 : i32 to i64
    %1253 = arith.cmpi sle, %arg0, %1254 : i64
    cf.cond_br %1253, ^bb192, ^bb193
    ^bb192:
      %1255 = arith.constant 0 : i32
      %1256 = arith.extsi %1255 : i32 to i64
      func.return %1256 : i64
    ^bb193:
      cf.br ^bb194
    ^bb194:
    %1257 = arith.constant 1 : i32
    %1259 = arith.constant 0 : i32
    %1260 = arith.extsi %1259 : i32 to i64
    %1258 = func.call @H_F(%arg0, %1260) : (i64, i64) -> i64
    %1262 = arith.extsi %1257 : i32 to i64
    %1261 = arith.addi %1262, %1258 : i64
    func.return %1261 : i64
  }
  func.func @sum_G(%arg0: i64) -> i64 {
    %1263 = arith.constant 0 : i32
    %1265 = arith.extsi %1263 : i32 to i64
    %1264 = arith.cmpi sle, %arg0, %1265 : i64
    cf.cond_br %1264, ^bb195, ^bb196
    ^bb195:
      %1266 = arith.constant 0 : i32
      %1267 = arith.extsi %1266 : i32 to i64
      func.return %1267 : i64
    ^bb196:
      cf.br ^bb197
    ^bb197:
    %1268 = arith.constant 1 : i32
    %1270 = arith.constant 0 : i32
    %1271 = arith.extsi %1270 : i32 to i64
    %1269 = func.call @H_G(%arg0, %1271) : (i64, i64) -> i64
    %1273 = arith.extsi %1268 : i32 to i64
    %1272 = arith.addi %1273, %1269 : i64
    func.return %1272 : i64
  }
  func.func @fc_init(%arg0: i64) -> () {
    %1274 = llvm.mlir.addressof @FC_cap : !llvm.ptr
    llvm.store %arg0, %1274 : i64, !llvm.ptr
    %1276 = arith.constant 8 : i32
    %1277 = arith.extsi %1276 : i32 to i64
    %1275 = func.call @calloc(%arg0, %1277) : (i64, i64) -> !llvm.ptr
    %1278 = llvm.mlir.addressof @FC_keys : !llvm.ptr
    llvm.store %1275, %1278 : !llvm.ptr, !llvm.ptr
    %1280 = arith.constant 8 : i32
    %1281 = arith.extsi %1280 : i32 to i64
    %1279 = func.call @calloc(%arg0, %1281) : (i64, i64) -> !llvm.ptr
    %1282 = llvm.mlir.addressof @FC_vals : !llvm.ptr
    llvm.store %1279, %1282 : !llvm.ptr, !llvm.ptr
    %1284 = arith.constant 1 : i32
    %1285 = arith.extsi %1284 : i32 to i64
    %1283 = func.call @calloc(%arg0, %1285) : (i64, i64) -> !llvm.ptr
    %1286 = llvm.mlir.addressof @FC_used : !llvm.ptr
    llvm.store %1283, %1286 : !llvm.ptr, !llvm.ptr
    func.return
  }
  func.func @fc_get(%arg0: i64) -> i64 {
    %1287 = llvm.mlir.constant(1 : i64) : i64
    %1288 = llvm.alloca %1287 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %1288 : i64, !llvm.ptr
    %1289 = llvm.load %1288 : !llvm.ptr -> i64
    %1290 = arith.constant 0 : i32
    %1292 = arith.extsi %1290 : i32 to i64
    %1291 = arith.cmpi slt, %1289, %1292 : i64
    cf.cond_br %1291, ^bb198, ^bb199
    ^bb198:
      %1293 = arith.constant 0 : i32
      %1294 = llvm.load %1288 : !llvm.ptr -> i64
      %1296 = arith.extsi %1293 : i32 to i64
      %1295 = arith.subi %1296, %1294 : i64
      llvm.store %1295, %1288 : i64, !llvm.ptr
      cf.br ^bb200
    ^bb199:
      cf.br ^bb200
    ^bb200:
    %1297 = llvm.load %1288 : !llvm.ptr -> i64
    %1298 = llvm.mlir.addressof @FC_cap : !llvm.ptr
    %1299 = llvm.load %1298 : !llvm.ptr -> i64
    %1300 = arith.constant 1 : i32
    %1302 = arith.extsi %1300 : i32 to i64
    %1301 = arith.subi %1299, %1302 : i64
    %1303 = arith.andi %1297, %1301 : i64
    llvm.store %1303, %1288 : i64, !llvm.ptr
    cf.br ^bb201
    ^bb201:
    %1305 = llvm.mlir.addressof @FC_used : !llvm.ptr
    %1306 = llvm.load %1305 : !llvm.ptr -> !llvm.ptr
    %1307 = llvm.load %1288 : !llvm.ptr -> i64
    %1308 = llvm.getelementptr %1306[%1307] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %1304 = llvm.load %1308 : !llvm.ptr -> i8
    %1309 = arith.constant 0 : i32
    %1311 = arith.extsi %1304 : i8 to i32
    %1310 = arith.cmpi ne, %1311, %1309 : i32
    cf.cond_br %1310, ^bb202, ^bb203
    ^bb202:
      %1313 = llvm.mlir.addressof @FC_keys : !llvm.ptr
      %1314 = llvm.load %1313 : !llvm.ptr -> !llvm.ptr
      %1315 = llvm.load %1288 : !llvm.ptr -> i64
      %1316 = llvm.getelementptr %1314[%1315] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1312 = llvm.load %1316 : !llvm.ptr -> i64
      %1317 = arith.cmpi eq, %1312, %arg0 : i64
      cf.cond_br %1317, ^bb204, ^bb205
      ^bb204:
        %1319 = llvm.mlir.addressof @FC_vals : !llvm.ptr
        %1320 = llvm.load %1319 : !llvm.ptr -> !llvm.ptr
        %1321 = llvm.load %1288 : !llvm.ptr -> i64
        %1322 = llvm.getelementptr %1320[%1321] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1318 = llvm.load %1322 : !llvm.ptr -> i64
        func.return %1318 : i64
      ^bb205:
        cf.br ^bb206
      ^bb206:
      %1323 = llvm.load %1288 : !llvm.ptr -> i64
      %1324 = arith.constant 1 : i32
      %1326 = arith.extsi %1324 : i32 to i64
      %1325 = arith.addi %1323, %1326 : i64
      %1327 = llvm.mlir.addressof @FC_cap : !llvm.ptr
      %1328 = llvm.load %1327 : !llvm.ptr -> i64
      %1329 = arith.constant 1 : i32
      %1331 = arith.extsi %1329 : i32 to i64
      %1330 = arith.subi %1328, %1331 : i64
      %1332 = arith.andi %1325, %1330 : i64
      llvm.store %1332, %1288 : i64, !llvm.ptr
      cf.br ^bb201
    ^bb203:
    %1333 = arith.constant 0 : i32
    %1334 = arith.constant 1 : i32
    %1335 = arith.subi %1333, %1334 : i32
    %1336 = arith.extsi %1335 : i32 to i64
    func.return %1336 : i64
  }
  func.func @fc_put(%arg0: i64, %arg1: i64) -> () {
    %1337 = llvm.mlir.constant(1 : i64) : i64
    %1338 = llvm.alloca %1337 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %1338 : i64, !llvm.ptr
    %1339 = llvm.load %1338 : !llvm.ptr -> i64
    %1340 = arith.constant 0 : i32
    %1342 = arith.extsi %1340 : i32 to i64
    %1341 = arith.cmpi slt, %1339, %1342 : i64
    cf.cond_br %1341, ^bb207, ^bb208
    ^bb207:
      %1343 = arith.constant 0 : i32
      %1344 = llvm.load %1338 : !llvm.ptr -> i64
      %1346 = arith.extsi %1343 : i32 to i64
      %1345 = arith.subi %1346, %1344 : i64
      llvm.store %1345, %1338 : i64, !llvm.ptr
      cf.br ^bb209
    ^bb208:
      cf.br ^bb209
    ^bb209:
    %1347 = llvm.load %1338 : !llvm.ptr -> i64
    %1348 = llvm.mlir.addressof @FC_cap : !llvm.ptr
    %1349 = llvm.load %1348 : !llvm.ptr -> i64
    %1350 = arith.constant 1 : i32
    %1352 = arith.extsi %1350 : i32 to i64
    %1351 = arith.subi %1349, %1352 : i64
    %1353 = arith.andi %1347, %1351 : i64
    llvm.store %1353, %1338 : i64, !llvm.ptr
    cf.br ^bb210
    ^bb210:
    %1355 = llvm.mlir.addressof @FC_used : !llvm.ptr
    %1356 = llvm.load %1355 : !llvm.ptr -> !llvm.ptr
    %1357 = llvm.load %1338 : !llvm.ptr -> i64
    %1358 = llvm.getelementptr %1356[%1357] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %1354 = llvm.load %1358 : !llvm.ptr -> i8
    %1359 = arith.constant 0 : i32
    %1361 = arith.extsi %1354 : i8 to i32
    %1360 = arith.cmpi ne, %1361, %1359 : i32
    %1362 = scf.if %1360 -> (i1) {
      %1364 = llvm.mlir.addressof @FC_keys : !llvm.ptr
      %1365 = llvm.load %1364 : !llvm.ptr -> !llvm.ptr
      %1366 = llvm.load %1338 : !llvm.ptr -> i64
      %1367 = llvm.getelementptr %1365[%1366] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1363 = llvm.load %1367 : !llvm.ptr -> i64
      %1368 = arith.cmpi ne, %1363, %arg0 : i64
      scf.yield %1368 : i1
    } else {
      %1369 = arith.constant false
      scf.yield %1369 : i1
    }
    cf.cond_br %1362, ^bb211, ^bb212
    ^bb211:
      %1370 = llvm.load %1338 : !llvm.ptr -> i64
      %1371 = arith.constant 1 : i32
      %1373 = arith.extsi %1371 : i32 to i64
      %1372 = arith.addi %1370, %1373 : i64
      %1374 = llvm.mlir.addressof @FC_cap : !llvm.ptr
      %1375 = llvm.load %1374 : !llvm.ptr -> i64
      %1376 = arith.constant 1 : i32
      %1378 = arith.extsi %1376 : i32 to i64
      %1377 = arith.subi %1375, %1378 : i64
      %1379 = arith.andi %1372, %1377 : i64
      llvm.store %1379, %1338 : i64, !llvm.ptr
      cf.br ^bb210
    ^bb212:
    %1380 = arith.constant 1 : i32
    %1381 = llvm.mlir.addressof @FC_used : !llvm.ptr
    %1382 = llvm.load %1381 : !llvm.ptr -> !llvm.ptr
    %1383 = llvm.load %1338 : !llvm.ptr -> i64
    %1384 = arith.trunci %1380 : i32 to i8
    %1385 = llvm.getelementptr %1382[%1383] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %1384, %1385 : i8, !llvm.ptr
    %1386 = llvm.mlir.addressof @FC_keys : !llvm.ptr
    %1387 = llvm.load %1386 : !llvm.ptr -> !llvm.ptr
    %1388 = llvm.load %1338 : !llvm.ptr -> i64
    %1389 = llvm.getelementptr %1387[%1388] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg0, %1389 : i64, !llvm.ptr
    %1390 = llvm.mlir.addressof @FC_vals : !llvm.ptr
    %1391 = llvm.load %1390 : !llvm.ptr -> !llvm.ptr
    %1392 = llvm.load %1338 : !llvm.ptr -> i64
    %1393 = llvm.getelementptr %1391[%1392] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg1, %1393 : i64, !llvm.ptr
    func.return
  }
  func.func @gc_init(%arg0: i64) -> () {
    %1394 = llvm.mlir.addressof @GC_cap : !llvm.ptr
    llvm.store %arg0, %1394 : i64, !llvm.ptr
    %1396 = arith.constant 8 : i32
    %1397 = arith.extsi %1396 : i32 to i64
    %1395 = func.call @calloc(%arg0, %1397) : (i64, i64) -> !llvm.ptr
    %1398 = llvm.mlir.addressof @GC_keys : !llvm.ptr
    llvm.store %1395, %1398 : !llvm.ptr, !llvm.ptr
    %1400 = arith.constant 8 : i32
    %1401 = arith.extsi %1400 : i32 to i64
    %1399 = func.call @calloc(%arg0, %1401) : (i64, i64) -> !llvm.ptr
    %1402 = llvm.mlir.addressof @GC_vals : !llvm.ptr
    llvm.store %1399, %1402 : !llvm.ptr, !llvm.ptr
    %1404 = arith.constant 1 : i32
    %1405 = arith.extsi %1404 : i32 to i64
    %1403 = func.call @calloc(%arg0, %1405) : (i64, i64) -> !llvm.ptr
    %1406 = llvm.mlir.addressof @GC_used : !llvm.ptr
    llvm.store %1403, %1406 : !llvm.ptr, !llvm.ptr
    func.return
  }
  func.func @gc_get(%arg0: i64) -> i64 {
    %1407 = llvm.mlir.constant(1 : i64) : i64
    %1408 = llvm.alloca %1407 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %1408 : i64, !llvm.ptr
    %1409 = llvm.load %1408 : !llvm.ptr -> i64
    %1410 = arith.constant 0 : i32
    %1412 = arith.extsi %1410 : i32 to i64
    %1411 = arith.cmpi slt, %1409, %1412 : i64
    cf.cond_br %1411, ^bb213, ^bb214
    ^bb213:
      %1413 = arith.constant 0 : i32
      %1414 = llvm.load %1408 : !llvm.ptr -> i64
      %1416 = arith.extsi %1413 : i32 to i64
      %1415 = arith.subi %1416, %1414 : i64
      llvm.store %1415, %1408 : i64, !llvm.ptr
      cf.br ^bb215
    ^bb214:
      cf.br ^bb215
    ^bb215:
    %1417 = llvm.load %1408 : !llvm.ptr -> i64
    %1418 = llvm.mlir.addressof @GC_cap : !llvm.ptr
    %1419 = llvm.load %1418 : !llvm.ptr -> i64
    %1420 = arith.constant 1 : i32
    %1422 = arith.extsi %1420 : i32 to i64
    %1421 = arith.subi %1419, %1422 : i64
    %1423 = arith.andi %1417, %1421 : i64
    llvm.store %1423, %1408 : i64, !llvm.ptr
    cf.br ^bb216
    ^bb216:
    %1425 = llvm.mlir.addressof @GC_used : !llvm.ptr
    %1426 = llvm.load %1425 : !llvm.ptr -> !llvm.ptr
    %1427 = llvm.load %1408 : !llvm.ptr -> i64
    %1428 = llvm.getelementptr %1426[%1427] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %1424 = llvm.load %1428 : !llvm.ptr -> i8
    %1429 = arith.constant 0 : i32
    %1431 = arith.extsi %1424 : i8 to i32
    %1430 = arith.cmpi ne, %1431, %1429 : i32
    cf.cond_br %1430, ^bb217, ^bb218
    ^bb217:
      %1433 = llvm.mlir.addressof @GC_keys : !llvm.ptr
      %1434 = llvm.load %1433 : !llvm.ptr -> !llvm.ptr
      %1435 = llvm.load %1408 : !llvm.ptr -> i64
      %1436 = llvm.getelementptr %1434[%1435] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1432 = llvm.load %1436 : !llvm.ptr -> i64
      %1437 = arith.cmpi eq, %1432, %arg0 : i64
      cf.cond_br %1437, ^bb219, ^bb220
      ^bb219:
        %1439 = llvm.mlir.addressof @GC_vals : !llvm.ptr
        %1440 = llvm.load %1439 : !llvm.ptr -> !llvm.ptr
        %1441 = llvm.load %1408 : !llvm.ptr -> i64
        %1442 = llvm.getelementptr %1440[%1441] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1438 = llvm.load %1442 : !llvm.ptr -> i64
        func.return %1438 : i64
      ^bb220:
        cf.br ^bb221
      ^bb221:
      %1443 = llvm.load %1408 : !llvm.ptr -> i64
      %1444 = arith.constant 1 : i32
      %1446 = arith.extsi %1444 : i32 to i64
      %1445 = arith.addi %1443, %1446 : i64
      %1447 = llvm.mlir.addressof @GC_cap : !llvm.ptr
      %1448 = llvm.load %1447 : !llvm.ptr -> i64
      %1449 = arith.constant 1 : i32
      %1451 = arith.extsi %1449 : i32 to i64
      %1450 = arith.subi %1448, %1451 : i64
      %1452 = arith.andi %1445, %1450 : i64
      llvm.store %1452, %1408 : i64, !llvm.ptr
      cf.br ^bb216
    ^bb218:
    %1453 = arith.constant 0 : i32
    %1454 = arith.constant 1 : i32
    %1455 = arith.subi %1453, %1454 : i32
    %1456 = arith.extsi %1455 : i32 to i64
    func.return %1456 : i64
  }
  func.func @gc_put(%arg0: i64, %arg1: i64) -> () {
    %1457 = llvm.mlir.constant(1 : i64) : i64
    %1458 = llvm.alloca %1457 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %1458 : i64, !llvm.ptr
    %1459 = llvm.load %1458 : !llvm.ptr -> i64
    %1460 = arith.constant 0 : i32
    %1462 = arith.extsi %1460 : i32 to i64
    %1461 = arith.cmpi slt, %1459, %1462 : i64
    cf.cond_br %1461, ^bb222, ^bb223
    ^bb222:
      %1463 = arith.constant 0 : i32
      %1464 = llvm.load %1458 : !llvm.ptr -> i64
      %1466 = arith.extsi %1463 : i32 to i64
      %1465 = arith.subi %1466, %1464 : i64
      llvm.store %1465, %1458 : i64, !llvm.ptr
      cf.br ^bb224
    ^bb223:
      cf.br ^bb224
    ^bb224:
    %1467 = llvm.load %1458 : !llvm.ptr -> i64
    %1468 = llvm.mlir.addressof @GC_cap : !llvm.ptr
    %1469 = llvm.load %1468 : !llvm.ptr -> i64
    %1470 = arith.constant 1 : i32
    %1472 = arith.extsi %1470 : i32 to i64
    %1471 = arith.subi %1469, %1472 : i64
    %1473 = arith.andi %1467, %1471 : i64
    llvm.store %1473, %1458 : i64, !llvm.ptr
    cf.br ^bb225
    ^bb225:
    %1475 = llvm.mlir.addressof @GC_used : !llvm.ptr
    %1476 = llvm.load %1475 : !llvm.ptr -> !llvm.ptr
    %1477 = llvm.load %1458 : !llvm.ptr -> i64
    %1478 = llvm.getelementptr %1476[%1477] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %1474 = llvm.load %1478 : !llvm.ptr -> i8
    %1479 = arith.constant 0 : i32
    %1481 = arith.extsi %1474 : i8 to i32
    %1480 = arith.cmpi ne, %1481, %1479 : i32
    %1482 = scf.if %1480 -> (i1) {
      %1484 = llvm.mlir.addressof @GC_keys : !llvm.ptr
      %1485 = llvm.load %1484 : !llvm.ptr -> !llvm.ptr
      %1486 = llvm.load %1458 : !llvm.ptr -> i64
      %1487 = llvm.getelementptr %1485[%1486] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1483 = llvm.load %1487 : !llvm.ptr -> i64
      %1488 = arith.cmpi ne, %1483, %arg0 : i64
      scf.yield %1488 : i1
    } else {
      %1489 = arith.constant false
      scf.yield %1489 : i1
    }
    cf.cond_br %1482, ^bb226, ^bb227
    ^bb226:
      %1490 = llvm.load %1458 : !llvm.ptr -> i64
      %1491 = arith.constant 1 : i32
      %1493 = arith.extsi %1491 : i32 to i64
      %1492 = arith.addi %1490, %1493 : i64
      %1494 = llvm.mlir.addressof @GC_cap : !llvm.ptr
      %1495 = llvm.load %1494 : !llvm.ptr -> i64
      %1496 = arith.constant 1 : i32
      %1498 = arith.extsi %1496 : i32 to i64
      %1497 = arith.subi %1495, %1498 : i64
      %1499 = arith.andi %1492, %1497 : i64
      llvm.store %1499, %1458 : i64, !llvm.ptr
      cf.br ^bb225
    ^bb227:
    %1500 = arith.constant 1 : i32
    %1501 = llvm.mlir.addressof @GC_used : !llvm.ptr
    %1502 = llvm.load %1501 : !llvm.ptr -> !llvm.ptr
    %1503 = llvm.load %1458 : !llvm.ptr -> i64
    %1504 = arith.trunci %1500 : i32 to i8
    %1505 = llvm.getelementptr %1502[%1503] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %1504, %1505 : i8, !llvm.ptr
    %1506 = llvm.mlir.addressof @GC_keys : !llvm.ptr
    %1507 = llvm.load %1506 : !llvm.ptr -> !llvm.ptr
    %1508 = llvm.load %1458 : !llvm.ptr -> i64
    %1509 = llvm.getelementptr %1507[%1508] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg0, %1509 : i64, !llvm.ptr
    %1510 = llvm.mlir.addressof @GC_vals : !llvm.ptr
    %1511 = llvm.load %1510 : !llvm.ptr -> !llvm.ptr
    %1512 = llvm.load %1458 : !llvm.ptr -> i64
    %1513 = llvm.getelementptr %1511[%1512] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg1, %1513 : i64, !llvm.ptr
    func.return
  }
  func.func @F_cached(%arg0: i64) -> i64 {
    %1514 = func.call @fc_get(%arg0) : (i64) -> i64
    %1515 = arith.constant 0 : i32
    %1517 = arith.extsi %1515 : i32 to i64
    %1516 = arith.cmpi sge, %1514, %1517 : i64
    cf.cond_br %1516, ^bb228, ^bb229
    ^bb228:
      func.return %1514 : i64
    ^bb229:
      cf.br ^bb230
    ^bb230:
    %1518 = func.call @sum_F(%arg0) : (i64) -> i64
    func.call @fc_put(%arg0, %1518) : (i64, i64) -> ()
    func.return %1518 : i64
  }
  func.func @G_cached(%arg0: i64) -> i64 {
    %1520 = func.call @gc_get(%arg0) : (i64) -> i64
    %1521 = arith.constant 0 : i32
    %1523 = arith.extsi %1521 : i32 to i64
    %1522 = arith.cmpi sge, %1520, %1523 : i64
    cf.cond_br %1522, ^bb231, ^bb232
    ^bb231:
      func.return %1520 : i64
    ^bb232:
      cf.br ^bb233
    ^bb233:
    %1524 = func.call @sum_G(%arg0) : (i64) -> i64
    func.call @gc_put(%arg0, %1524) : (i64, i64) -> ()
    func.return %1524 : i64
  }
  func.func @T(%arg0: i64) -> i64 {
    func.call @build_summatory(%arg0) : (i64) -> ()
    %1528 = arith.constant 1 : i32
    %1529 = arith.constant 16 : i32
    %1530 = arith.shli %1528, %1529 : i32
    %1531 = arith.extsi %1530 : i32 to i64
    func.call @fc_init(%1531) : (i64) -> ()
    %1533 = arith.constant 1 : i32
    %1534 = arith.constant 16 : i32
    %1535 = arith.shli %1533, %1534 : i32
    %1536 = arith.extsi %1535 : i32 to i64
    func.call @gc_init(%1536) : (i64) -> ()
    %1537 = arith.constant 0 : i32
    %1538 = arith.extsi %1537 : i32 to i64
    %1539 = llvm.mlir.constant(1 : i64) : i64
    %1540 = llvm.alloca %1539 x i64 : (i64) -> !llvm.ptr
    llvm.store %1538, %1540 : i64, !llvm.ptr
    %1541 = arith.constant 1 : i32
    %1542 = arith.extsi %1541 : i32 to i64
    %1543 = llvm.mlir.constant(1 : i64) : i64
    %1544 = llvm.alloca %1543 x i64 : (i64) -> !llvm.ptr
    llvm.store %1542, %1544 : i64, !llvm.ptr
    %1545 = arith.constant 0 : i32
    %1546 = arith.extsi %1545 : i32 to i64
    %1547 = llvm.mlir.constant(1 : i64) : i64
    %1548 = llvm.alloca %1547 x i64 : (i64) -> !llvm.ptr
    llvm.store %1546, %1548 : i64, !llvm.ptr
    cf.br ^bb234
    ^bb234:
    %1549 = llvm.load %1544 : !llvm.ptr -> i64
    %1550 = arith.cmpi sle, %1549, %arg0 : i64
    cf.cond_br %1550, ^bb235, ^bb236
    ^bb235:
      %1551 = arith.constant 1 : i32
      %1552 = arith.extsi %1551 : i32 to i64
      %1553 = llvm.mlir.constant(1 : i64) : i64
      %1554 = llvm.alloca %1553 x i64 : (i64) -> !llvm.ptr
      llvm.store %1552, %1554 : i64, !llvm.ptr
      %1555 = arith.constant 0 : i32
      %1556 = arith.extsi %1555 : i32 to i64
      %1557 = llvm.mlir.constant(1 : i64) : i64
      %1558 = llvm.alloca %1557 x i64 : (i64) -> !llvm.ptr
      llvm.store %1556, %1558 : i64, !llvm.ptr
      cf.br ^bb237
      ^bb237:
      %1559 = llvm.load %1544 : !llvm.ptr -> i64
      %1560 = llvm.load %1554 : !llvm.ptr -> i64
      %1561 = arith.muli %1559, %1560 : i64
      %1562 = arith.cmpi sle, %1561, %arg0 : i64
      cf.cond_br %1562, ^bb238, ^bb239
      ^bb238:
        %1563 = llvm.load %1544 : !llvm.ptr -> i64
        %1564 = llvm.load %1554 : !llvm.ptr -> i64
        %1565 = arith.muli %1563, %1564 : i64
        %1566 = arith.divsi %arg0, %1565 : i64
        %1567 = func.call @F_cached(%1566) : (i64) -> i64
        %1568 = llvm.load %1540 : !llvm.ptr -> i64
        %1569 = arith.constant 2 : i32
        %1570 = llvm.load %1548 : !llvm.ptr -> i64
        %1572 = arith.extsi %1569 : i32 to i64
        %1571 = arith.muli %1572, %1570 : i64
        %1573 = arith.constant 2 : i32
        %1575 = arith.extsi %1573 : i32 to i64
        %1574 = arith.addi %1571, %1575 : i64
        %1576 = arith.constant 2 : i32
        %1577 = llvm.load %1558 : !llvm.ptr -> i64
        %1579 = arith.extsi %1576 : i32 to i64
        %1578 = arith.muli %1579, %1577 : i64
        %1580 = arith.constant 1 : i32
        %1582 = arith.extsi %1580 : i32 to i64
        %1581 = arith.addi %1578, %1582 : i64
        %1583 = arith.muli %1574, %1581 : i64
        %1584 = arith.muli %1583, %1567 : i64
        %1585 = arith.addi %1568, %1584 : i64
        llvm.store %1585, %1540 : i64, !llvm.ptr
        %1586 = llvm.load %1540 : !llvm.ptr -> i64
        %1587 = arith.constant 2 : i32
        %1588 = llvm.load %1548 : !llvm.ptr -> i64
        %1590 = arith.extsi %1587 : i32 to i64
        %1589 = arith.muli %1590, %1588 : i64
        %1591 = arith.constant 3 : i32
        %1593 = arith.extsi %1591 : i32 to i64
        %1592 = arith.addi %1589, %1593 : i64
        %1594 = arith.constant 2 : i32
        %1595 = llvm.load %1558 : !llvm.ptr -> i64
        %1597 = arith.extsi %1594 : i32 to i64
        %1596 = arith.muli %1597, %1595 : i64
        %1598 = arith.constant 2 : i32
        %1600 = arith.extsi %1598 : i32 to i64
        %1599 = arith.addi %1596, %1600 : i64
        %1601 = arith.muli %1592, %1599 : i64
        %1602 = arith.muli %1601, %1567 : i64
        %1603 = arith.addi %1586, %1602 : i64
        llvm.store %1603, %1540 : i64, !llvm.ptr
        %1604 = llvm.load %1558 : !llvm.ptr -> i64
        %1605 = arith.constant 1 : i32
        %1607 = arith.extsi %1605 : i32 to i64
        %1606 = arith.cmpi sge, %1604, %1607 : i64
        cf.cond_br %1606, ^bb240, ^bb241
        ^bb240:
          %1608 = llvm.load %1540 : !llvm.ptr -> i64
          %1609 = arith.constant 2 : i32
          %1610 = llvm.load %1558 : !llvm.ptr -> i64
          %1612 = arith.extsi %1609 : i32 to i64
          %1611 = arith.muli %1612, %1610 : i64
          %1613 = arith.constant 1 : i32
          %1615 = arith.extsi %1613 : i32 to i64
          %1614 = arith.subi %1611, %1615 : i64
          %1616 = arith.constant 2 : i32
          %1617 = llvm.load %1548 : !llvm.ptr -> i64
          %1619 = arith.extsi %1616 : i32 to i64
          %1618 = arith.muli %1619, %1617 : i64
          %1620 = arith.constant 3 : i32
          %1622 = arith.extsi %1620 : i32 to i64
          %1621 = arith.addi %1618, %1622 : i64
          %1623 = arith.muli %1614, %1621 : i64
          %1624 = arith.muli %1623, %1567 : i64
          %1625 = arith.addi %1608, %1624 : i64
          llvm.store %1625, %1540 : i64, !llvm.ptr
          cf.br ^bb242
        ^bb241:
          cf.br ^bb242
        ^bb242:
        %1626 = llvm.load %1554 : !llvm.ptr -> i64
        %1627 = arith.constant 3 : i32
        %1629 = arith.extsi %1627 : i32 to i64
        %1628 = arith.muli %1626, %1629 : i64
        llvm.store %1628, %1554 : i64, !llvm.ptr
        %1630 = llvm.load %1558 : !llvm.ptr -> i64
        %1631 = arith.constant 1 : i32
        %1633 = arith.extsi %1631 : i32 to i64
        %1632 = arith.addi %1630, %1633 : i64
        llvm.store %1632, %1558 : i64, !llvm.ptr
        cf.br ^bb237
      ^bb239:
      %1634 = llvm.load %1544 : !llvm.ptr -> i64
      %1635 = arith.constant 2 : i32
      %1637 = arith.extsi %1635 : i32 to i64
      %1636 = arith.muli %1634, %1637 : i64
      llvm.store %1636, %1544 : i64, !llvm.ptr
      %1638 = llvm.load %1548 : !llvm.ptr -> i64
      %1639 = arith.constant 1 : i32
      %1641 = arith.extsi %1639 : i32 to i64
      %1640 = arith.addi %1638, %1641 : i64
      llvm.store %1640, %1548 : i64, !llvm.ptr
      cf.br ^bb234
    ^bb236:
    %1642 = arith.constant 1 : i32
    %1643 = arith.extsi %1642 : i32 to i64
    llvm.store %1643, %1544 : i64, !llvm.ptr
    %1644 = arith.constant 0 : i32
    %1645 = arith.extsi %1644 : i32 to i64
    llvm.store %1645, %1548 : i64, !llvm.ptr
    cf.br ^bb243
    ^bb243:
    %1646 = llvm.load %1544 : !llvm.ptr -> i64
    %1647 = arith.cmpi sle, %1646, %arg0 : i64
    cf.cond_br %1647, ^bb244, ^bb245
    ^bb244:
      %1648 = llvm.load %1544 : !llvm.ptr -> i64
      %1649 = arith.divsi %arg0, %1648 : i64
      %1650 = arith.constant 0 : i32
      %1651 = arith.extsi %1650 : i32 to i64
      %1652 = llvm.load %1548 : !llvm.ptr -> i64
      %1653 = arith.constant 2 : i32
      %1655 = arith.extsi %1653 : i32 to i64
      %1654 = arith.remsi %1652, %1655 : i64
      %1656 = arith.constant 0 : i32
      %1658 = arith.extsi %1656 : i32 to i64
      %1657 = arith.cmpi eq, %1654, %1658 : i64
      %1659 = scf.if %1657 -> (i64) {
        %1660 = arith.constant 1 : i32
        %1661 = arith.extsi %1660 : i32 to i64
        scf.yield %1661 : i64
      } else {
        %1662 = arith.constant 0 : i32
        %1663 = arith.constant 1 : i32
        %1664 = arith.subi %1662, %1663 : i32
        %1665 = arith.extsi %1664 : i32 to i64
        scf.yield %1665 : i64
      }
      %1666 = llvm.load %1540 : !llvm.ptr -> i64
      %1667 = arith.constant 2 : i32
      %1668 = llvm.load %1548 : !llvm.ptr -> i64
      %1670 = arith.extsi %1667 : i32 to i64
      %1669 = arith.muli %1670, %1668 : i64
      %1671 = arith.constant 3 : i32
      %1673 = arith.extsi %1671 : i32 to i64
      %1672 = arith.addi %1669, %1673 : i64
      %1674 = func.call @F_cached(%1649) : (i64) -> i64
      %1675 = arith.muli %1672, %1674 : i64
      %1676 = func.call @G_cached(%1649) : (i64) -> i64
      %1677 = arith.muli %1659, %1676 : i64
      %1678 = arith.subi %1675, %1677 : i64
      %1679 = arith.constant 2 : i32
      %1681 = arith.extsi %1679 : i32 to i64
      %1680 = arith.divsi %1678, %1681 : i64
      %1682 = arith.addi %1666, %1680 : i64
      llvm.store %1682, %1540 : i64, !llvm.ptr
      %1683 = llvm.load %1544 : !llvm.ptr -> i64
      %1684 = arith.constant 2 : i32
      %1686 = arith.extsi %1684 : i32 to i64
      %1685 = arith.muli %1683, %1686 : i64
      llvm.store %1685, %1544 : i64, !llvm.ptr
      %1687 = llvm.load %1548 : !llvm.ptr -> i64
      %1688 = arith.constant 1 : i32
      %1690 = arith.extsi %1688 : i32 to i64
      %1689 = arith.addi %1687, %1690 : i64
      llvm.store %1689, %1548 : i64, !llvm.ptr
      cf.br ^bb243
    ^bb245:
    %1691 = llvm.load %1540 : !llvm.ptr -> i64
    func.return %1691 : i64
  }
  func.func @main() -> i32 {
    %1692 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %1694 = arith.constant 1000000000 : i32
    %1695 = arith.extsi %1694 : i32 to i64
    %1693 = func.call @T(%1695) : (i64) -> i64
    %1696 = llvm.call @printf(%1692, %1693) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %1697 = arith.constant 0 : i32
    func.return %1697 : i32
  }
}