Problem 851

SOP and POS - R_6(10000!) mod 1e9+7. Ported from native C to pure Flow.

Answer726358482
Output726358482
StatusPASS
Native helperno
Runtime440 ms
Peak memory1488 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

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

Flow source

# Project Euler 851
# SOP and POS - R_6(10000!) mod 1e9+7.
# Ported from native C to pure Flow.

import euler.nt { mod_pow }

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

const MOD: i64 = 1000000007
const LIMIT: i64 = 10000

# Sieve state
let mut g_is_prime: ptr<i8> = null
let mut g_primes: ptr<i32> = null
let mut g_num_primes: i32 = 0

# Prime exponents for factorial
let mut g_prime_exps_p: ptr<i32> = null
let mut g_prime_exps_e: ptr<i32> = null
let mut g_num_exps: i32 = 0

# Modular inverses
let mut g_inv_table: ptr<i64> = null

# sigma1 and tau arrays
let mut g_sigma1: ptr<i64> = null
let mut g_tau_arr: ptr<i64> = null

# Eisenstein coefficients indexed by k=2,4,6,8,10,12
let mut g_E_coeff: ptr<i64> = null

# sigma values indexed by s=1,3,5,7,9,11
let mut g_sig: ptr<i64> = null

# Inverse constants
let mut g_inv2: i64 = 0
let mut g_inv5: i64 = 0
let mut g_inv7: i64 = 0
let mut g_inv24185: i64 = 0

function mm(a: i64, b: i64) -> i64 {
    return ((a as i128) * (b as i128) % (MOD as i128)) as i64
}

function sieve() -> void {
    g_is_prime = calloc(LIMIT + 1, 1)
    let mut i: i32 = 0
    while i <= LIMIT {
        g_is_prime[i] = 1
        i = i + 1
    }
    g_is_prime[0] = 0
    g_is_prime[1] = 0
    let mut p: i32 = 2
    while p * p <= LIMIT {
        if g_is_prime[p] != 0 {
            let mut m: i32 = p * p
            while m <= LIMIT {
                g_is_prime[m] = 0
                m = m + p
            }
        }
        p = p + 1
    }
    g_primes = calloc(2000, 4)
    g_num_primes = 0
    i = 2
    while i <= LIMIT {
        if g_is_prime[i] != 0 {
            g_primes[g_num_primes] = i
            g_num_primes = g_num_primes + 1
        }
        i = i + 1
    }
}

function factorial_prime_exponents(n: i32) -> void {
    g_num_exps = 0
    let mut pi: i32 = 0
    while pi < g_num_primes {
        let p: i32 = g_primes[pi]
        if p > n { break }
        let e: i32 = 0
        let mut t: i32 = n
        while t > 0 {
            t = t / p
            e = e + t
        }
        if e != 0 {
            g_prime_exps_p[g_num_exps] = p
            g_prime_exps_e[g_num_exps] = e
            g_num_exps = g_num_exps + 1
        }
        pi = pi + 1
    }
}

function compute_inv_table(n: i32, mod: i64) -> void {
    g_inv_table[1] = 1
    let mut i: i32 = 2
    while i <= n {
        g_inv_table[i] = (mod - (mod / (i as i64)) * g_inv_table[mod % (i as i64)] % mod) % mod
        i = i + 1
    }
}

function sigma_power_from_exps(s: i64, mod: i64) -> i64 {
    let mut res: i64 = 1
    let mut i: i32 = 0
    while i < g_num_exps {
        let p: i32 = g_prime_exps_p[i]
        let e: i32 = g_prime_exps_e[i]
        let ps: i64 = mod_pow(p as i64, s, mod)
        let term: i64 = 0
        if ps == 1 {
            term = ((e + 1) as i64) % mod
        } else {
            let num: i64 = (mod_pow(ps, (e + 1) as i64, mod) - 1 + mod) % mod
            let den_inv: i64 = mod_pow((ps - 1 + mod) % mod, mod - 2, mod)
            term = mm(num, den_inv)
        }
        res = mm(res, term)
        i = i + 1
    }
    return res
}

function n_mod_from_exps(mod: i64) -> i64 {
    let mut res: i64 = 1
    let mut i: i32 = 0
    while i < g_num_exps {
        res = mm(res, mod_pow(g_prime_exps_p[i] as i64, g_prime_exps_e[i] as i64, mod))
        i = i + 1
    }
    return res
}

function precompute_sigma1(n: i32) -> void {
    let mut i: i32 = 0
    while i <= n {
        g_sigma1[i] = 0
        i = i + 1
    }
    let mut d: i32 = 1
    while d <= n {
        let mut m: i32 = d
        while m <= n {
            g_sigma1[m] = g_sigma1[m] + (d as i64)
            m = m + d
        }
        d = d + 1
    }
    i = 0
    while i <= n {
        g_sigma1[i] = g_sigma1[i] % MOD
        i = i + 1
    }
}

function precompute_tau(n: i32, mod: i64) -> void {
    precompute_sigma1(n)
    compute_inv_table(n, mod)

    let mut i: i32 = 0
    while i <= n {
        g_tau_arr[i] = 0
        i = i + 1
    }
    g_tau_arr[1] = 1

    let mut k: i32 = 2
    while k <= n {
        let mut total: i64 = 0
        let mut m: i32 = 1
        while m < k {
            total = (total + mm(g_sigma1[m], g_tau_arr[k - m])) % mod
            m = m + 1
        }
        let val0: i64 = mm((MOD - 24) % mod, total)
        g_tau_arr[k] = mm(val0, g_inv_table[k - 1])
        k = k + 1
    }
}

# 2x2 matrix multiply mod
function mat_mul(a0: i64, a1: i64, a2: i64, a3: i64, b0: i64, b1: i64, b2: i64, b3: i64, mod: i64) -> i64 {
    # We return R[0] only; caller needs R[1] too. Use globals.
    let r0: i64 = (mm(a0, b0) + mm(a1, b2)) % mod
    let r1: i64 = (mm(a0, b1) + mm(a1, b3)) % mod
    let r2: i64 = (mm(a2, b0) + mm(a3, b2)) % mod
    let r3: i64 = (mm(a2, b1) + mm(a3, b3)) % mod
    g_mat_r0 = r0
    g_mat_r1 = r1
    g_mat_r2 = r2
    g_mat_r3 = r3
    return 0
}

let mut g_mat_r0: i64 = 0
let mut g_mat_r1: i64 = 0
let mut g_mat_r2: i64 = 0
let mut g_mat_r3: i64 = 0

# tau(p^e) mod mod using matrix power
function tau_prime_power(p: i32, e: i32, tau_p: i64, mod: i64) -> i64 {
    if e == 0 { return 1 }
    if e == 1 { return tau_p % mod }

    let p11: i64 = mod_pow(p as i64, 11, mod)
    # M = {tau_p % mod, (mod - p11) % mod, 1, 0}
    let mut m0: i64 = tau_p % mod
    let mut m1: i64 = (mod - p11) % mod
    let mut m2: i64 = 1
    let mut m3: i64 = 0
    # R = identity
    let mut r0: i64 = 1
    let mut r1: i64 = 0
    let mut r2: i64 = 0
    let mut r3: i64 = 1
    let mut exp: i32 = e - 1
    while exp > 0 {
        if (exp & 1) == 1 {
            mat_mul(r0, r1, r2, r3, m0, m1, m2, m3, mod)
            r0 = g_mat_r0
            r1 = g_mat_r1
            r2 = g_mat_r2
            r3 = g_mat_r3
        }
        mat_mul(m0, m1, m2, m3, m0, m1, m2, m3, mod)
        m0 = g_mat_r0
        m1 = g_mat_r1
        m2 = g_mat_r2
        m3 = g_mat_r3
        exp = exp >> 1
    }
    return (mm(r0, tau_p % mod) + r1) % mod
}

function tau_from_exps(mod: i64) -> i64 {
    let mut res: i64 = 1
    let mut i: i32 = 0
    while i < g_num_exps {
        let p: i32 = g_prime_exps_p[i]
        let e: i32 = g_prime_exps_e[i]
        res = mm(res, tau_prime_power(p, e, g_tau_arr[p], mod))
        i = i + 1
    }
    return res
}

function init_e_coeff(mod: i64) -> void {
    let inv_691: i64 = mod_pow(691, mod - 2, mod)
    g_E_coeff[2] = (mod - 24) % mod
    g_E_coeff[4] = 240 % mod
    g_E_coeff[6] = (mod - 504) % mod
    g_E_coeff[8] = 480 % mod
    g_E_coeff[10] = (mod - 264) % mod
    g_E_coeff[12] = mm(65520 % mod, inv_691)
}

function build_sigma_data(mod: i64) -> void {
    let mut s: i32 = 1
    while s <= 11 {
        g_sig[s] = sigma_power_from_exps(s as i64, mod)
        s = s + 2
    }
}

function coeff_Ek(k: i32, mod: i64) -> i64 {
    if k == 2 { return mm(g_E_coeff[2], g_sig[1]) }
    return mm(g_E_coeff[k], g_sig[k - 1])
}

# n_pows is ptr<i64> with indices 0..5
function coeff_D_Ek(k: i32, r: i32, n_pows: ptr<i64>, mod: i64) -> i64 {
    return mm(n_pows[r], coeff_Ek(k, mod))
}

function coeff_E2_pow(k: i32, n_pows: ptr<i64>, tau_n: i64, mod: i64) -> i64 {
    if k == 1 { return coeff_Ek(2, mod) }

    if k == 2 {
        let t1: i64 = coeff_Ek(4, mod)
        let t2: i64 = mm(12, coeff_D_Ek(2, 1, n_pows, mod))
        return (t1 + t2) % mod
    }

    if k == 3 {
        let t1: i64 = coeff_Ek(6, mod)
        let t2: i64 = mm(9, coeff_D_Ek(4, 1, n_pows, mod))
        let t3: i64 = mm(72, coeff_D_Ek(2, 2, n_pows, mod))
        return (t1 + t2 + t3) % mod
    }

    if k == 4 {
        let c216_5: i64 = mm(216, g_inv5)
        let t1: i64 = coeff_Ek(8, mod)
        let t2: i64 = mm(8, coeff_D_Ek(6, 1, n_pows, mod))
        let t3: i64 = mm(c216_5, coeff_D_Ek(4, 2, n_pows, mod))
        let t4: i64 = mm(288, coeff_D_Ek(2, 3, n_pows, mod))
        return (t1 + t2 + t3 + t4) % mod
    }

    if k == 5 {
        let c15_2: i64 = mm(15, g_inv2)
        let c240_7: i64 = mm(240, g_inv7)
        let t1: i64 = coeff_Ek(10, mod)
        let t2: i64 = mm(c15_2, coeff_D_Ek(8, 1, n_pows, mod))
        let t3: i64 = mm(c240_7, coeff_D_Ek(6, 2, n_pows, mod))
        let t4: i64 = mm(144, coeff_D_Ek(4, 3, n_pows, mod))
        let t5: i64 = mm(864, coeff_D_Ek(2, 4, n_pows, mod))
        return (t1 + t2 + t3 + t4 + t5) % mod
    }

    # k == 6
    let c36_5: i64 = mm(36, g_inv5)
    let c720_7: i64 = mm(720, g_inv7)
    let c2592_7: i64 = mm(2592, g_inv7)
    let c10368_5: i64 = mm(10368, g_inv5)
    let cDelta: i64 = mm((mod - 4608) % mod, g_inv24185)
    let t1: i64 = coeff_Ek(12, mod)
    let t2: i64 = mm(cDelta, tau_n % mod)
    let t3: i64 = mm(c36_5, coeff_D_Ek(10, 1, n_pows, mod))
    let t4: i64 = mm(30, coeff_D_Ek(8, 2, n_pows, mod))
    let t5: i64 = mm(c720_7, coeff_D_Ek(6, 3, n_pows, mod))
    let t6: i64 = mm(c2592_7, coeff_D_Ek(4, 4, n_pows, mod))
    let t7: i64 = mm(c10368_5, coeff_D_Ek(2, 5, n_pows, mod))
    return (t1 + t2 + t3 + t4 + t5 + t6 + t7) % mod
}

function comb_small(n: i32, k: i32) -> i64 {
    if k < 0 || k > n { return 0 }
    let kk: i32 = k
    if k > n - k { return comb_small(n, n - k) }
    let mut num: i64 = 1
    let mut den: i64 = 1
    let mut i: i32 = 1
    while i <= kk {
        num = num * ((n - (kk - i)) as i64)
        den = den * (i as i64)
        i = i + 1
    }
    return num / den
}

function R_dim_at_n(dim: i32, n_pows: ptr<i64>, tau_n: i64, mod: i64) -> i64 {
    let inv12: i64 = mod_pow(12, mod - 2, mod)
    let scale: i64 = mod_pow(inv12, dim as i64, mod)

    let mut s: i64 = 0
    let mut k: i32 = 1
    while k <= dim {
        let ck: i64 = comb_small(dim, k)
        let term: i64 = mm(ck, coeff_E2_pow(k, n_pows, tau_n, mod))
        if k % 2 == 1 {
            s = (s - term % mod + mod) % mod
        } else {
            s = (s + term) % mod
        }
        k = k + 1
    }
    return mm(s, scale)
}

function main() -> i32 {
    let mod: i64 = MOD

    # Allocate global arrays
    g_prime_exps_p = calloc(2000, 4)
    g_prime_exps_e = calloc(2000, 4)
    g_inv_table = calloc(LIMIT + 1, 8)
    g_sigma1 = calloc(LIMIT + 1, 8)
    g_tau_arr = calloc(LIMIT + 1, 8)
    g_E_coeff = calloc(13, 8)
    g_sig = calloc(13, 8)

    sieve()

    # Initialize constants
    g_inv2 = (mod + 1) / 2
    g_inv5 = mod_pow(5, mod - 2, mod)
    g_inv7 = mod_pow(7, mod - 2, mod)
    g_inv24185 = mod_pow(24185, mod - 2, mod)
    init_e_coeff(mod)

    # Precompute tau(p) for primes p <= 10000
    precompute_tau(LIMIT as i32, mod)

    # Main computation: R_6(10000!) mod MOD
    factorial_prime_exponents(LIMIT as i32)
    build_sigma_data(mod)

    let nmod: i64 = n_mod_from_exps(mod)
    let n_pows: ptr<i64> = calloc(6, 8)
    n_pows[0] = 1
    let mut i: i32 = 1
    while i <= 5 {
        n_pows[i] = mm(n_pows[i - 1], nmod)
        i = i + 1
    }

    let tau_fact: i64 = tau_from_exps(mod)

    let result: i64 = R_dim_at_n(6, n_pows, tau_fact, mod)
    printf("%lld\n", result)

    free(n_pows)
    free(g_is_prime)
    free(g_primes)
    free(g_prime_exps_p)
    free(g_prime_exps_e)
    free(g_inv_table)
    free(g_sigma1)
    free(g_tau_arr)
    free(g_E_coeff)
    free(g_sig)
    return 0
}

Generated C

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
    while (flow_temp_head) {
        flow_temp_node* n = flow_temp_head;
        flow_temp_head = n->next;
        free(n);
    }
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
    flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
    if (!node) return NULL;
    node->next = flow_temp_head;
    flow_temp_head = node;
    if (!flow_temp_atexit_set) {
        flow_temp_atexit_set = 1;
        atexit(flow_temp_free_all);
    }
    return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
    size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
    char* r = (char*)flow_temp_alloc(la + lb + 1);
    if (!r) return NULL;
    if (la) memcpy(r, a, la);
    if (lb) memcpy(r + la, b, lb);
    r[la + lb] = '\0';
    return r;
}

#define __flow_in_arr(arr, val) __extension__ ({ \
    int _found = 0; \
    size_t _n = sizeof(arr)/sizeof((arr)[0]); \
    for (size_t _i = 0; _i < _n; _i++) { \
        if ((arr)[_i] == (val)) { _found = 1; break; } \
    } _found; })

/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
    fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
    abort();
#if defined(__GNUC__) || defined(__clang__)
    __builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")

#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif

#include <math.h>

void* _ui_state = NULL;

static inline float i32_to_f32(int32_t v) { return (float)v; }

/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }

int64_t gcd_i64_i64(int64_t a0, int64_t b0);
int64_t lcm_i64_i64(int64_t a, int64_t b);
int64_t isqrt_i64(int64_t n);
int64_t mulmod_i64_i64_i64(int64_t a0, int64_t b0, int64_t mod);
int64_t mod_pow_i64_i64_i64(int64_t base, int64_t exp, int64_t mod);
bool is_prime_i64(int64_t n);
int64_t mm_i64_i64(int64_t a, int64_t b);
void sieve(void);
void factorial_prime_exponents_i32(int32_t n);
void compute_inv_table_i32_i64(int32_t n, int64_t mod);
int64_t sigma_power_from_exps_i64_i64(int64_t s, int64_t mod);
int64_t n_mod_from_exps_i64(int64_t mod);
void precompute_sigma1_i32(int32_t n);
void precompute_tau_i32_i64(int32_t n, int64_t mod);
int64_t mat_mul_i64_i64_i64_i64_i64_i64_i64_i64_i64(int64_t a0, int64_t a1, int64_t a2, int64_t a3, int64_t b0, int64_t b1, int64_t b2, int64_t b3, int64_t mod);
int64_t tau_prime_power_i32_i32_i64_i64(int32_t p, int32_t e, int64_t tau_p, int64_t mod);
int64_t tau_from_exps_i64(int64_t mod);
void init_e_coeff_i64(int64_t mod);
void build_sigma_data_i64(int64_t mod);
int64_t coeff_Ek_i32_i64(int32_t k, int64_t mod);
int64_t coeff_D_Ek_i32_i32_ptr_i64_i64(int32_t k, int32_t r, int64_t* n_pows, int64_t mod);
int64_t coeff_E2_pow_i32_ptr_i64_i64_i64(int32_t k, int64_t* n_pows, int64_t tau_n, int64_t mod);
int64_t comb_small_i32_i32(int32_t n, int32_t k);
int64_t R_dim_at_n_i32_ptr_i64_i64_i64(int32_t dim, int64_t* n_pows, int64_t tau_n, int64_t mod);
int32_t main(void);

static const int64_t MOD = 1000000007;
static const int64_t LIMIT = 10000;

/* Module statics */
static int8_t* g_is_prime = NULL;
static int32_t* g_primes = NULL;
static int32_t g_num_primes = 0;
static int32_t* g_prime_exps_p = NULL;
static int32_t* g_prime_exps_e = NULL;
static int32_t g_num_exps = 0;
static int64_t* g_inv_table = NULL;
static int64_t* g_sigma1 = NULL;
static int64_t* g_tau_arr = NULL;
static int64_t* g_E_coeff = NULL;
static int64_t* g_sig = NULL;
static int64_t g_inv2 = 0;
static int64_t g_inv5 = 0;
static int64_t g_inv7 = 0;
static int64_t g_inv24185 = 0;
static int64_t g_mat_r0 = 0;
static int64_t g_mat_r1 = 0;
static int64_t g_mat_r2 = 0;
static int64_t g_mat_r3 = 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;
}



int64_t mm_i64_i64(int64_t a, int64_t b) {
    return ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(a)) * ((__int128)(b)))), (((__int128)(MOD))))));
}

void sieve(void) {
    g_is_prime = calloc((LIMIT + 1), 1);
    int32_t i = 0;
    while (i <= LIMIT) {
        g_is_prime[i] = 1;
        i = (i + 1);
    }
    g_is_prime[0] = 0;
    g_is_prime[1] = 0;
    int32_t p = 2;
    while ((p * p) <= LIMIT) {
        if (g_is_prime[p] != 0) {
            int32_t m = (p * p);
            while (m <= LIMIT) {
                g_is_prime[m] = 0;
                m = (m + p);
            }
        }
        p = (p + 1);
    }
    g_primes = calloc(2000, 4);
    g_num_primes = 0;
    i = 2;
    while (i <= LIMIT) {
        if (g_is_prime[i] != 0) {
            g_primes[g_num_primes] = i;
            g_num_primes = (g_num_primes + 1);
        }
        i = (i + 1);
    }
}

void factorial_prime_exponents_i32(int32_t n) {
    g_num_exps = 0;
    int32_t pi = 0;
    while (pi < g_num_primes) {
        int32_t p = g_primes[pi];
        if (p > n) {
            break;
        }
        int32_t e = 0;
        int32_t t = n;
        while (t > 0) {
            t = FLOW_CHECKED_DIV((t), (p));
            e = (e + t);
        }
        if (e != 0) {
            g_prime_exps_p[g_num_exps] = p;
            g_prime_exps_e[g_num_exps] = e;
            g_num_exps = (g_num_exps + 1);
        }
        pi = (pi + 1);
    }
}

void compute_inv_table_i32_i64(int32_t n, int64_t mod) {
    g_inv_table[1] = 1;
    int32_t i = 2;
    while (i <= n) {
        g_inv_table[i] = FLOW_CHECKED_MOD(((mod - FLOW_CHECKED_MOD(((FLOW_CHECKED_DIV((mod), (((int64_t)(i)))) * g_inv_table[FLOW_CHECKED_MOD((mod), (((int64_t)(i))))])), (mod)))), (mod));
        i = (i + 1);
    }
}

int64_t sigma_power_from_exps_i64_i64(int64_t s, int64_t mod) {
    int64_t res = 1;
    int32_t i = 0;
    while (i < g_num_exps) {
        int32_t p = g_prime_exps_p[i];
        int32_t e = g_prime_exps_e[i];
        int64_t ps = mod_pow_i64_i64_i64(((int64_t)(p)), s, mod);
        int64_t term = 0;
        if (ps == 1) {
            term = FLOW_CHECKED_MOD((((int64_t)((e + 1)))), (mod));
        } else {
            int64_t num = FLOW_CHECKED_MOD((((mod_pow_i64_i64_i64(ps, ((int64_t)((e + 1))), mod) - 1) + mod)), (mod));
            int64_t den_inv = mod_pow_i64_i64_i64(FLOW_CHECKED_MOD((((ps - 1) + mod)), (mod)), (mod - 2), mod);
            term = mm_i64_i64(num, den_inv);
        }
        res = mm_i64_i64(res, term);
        i = (i + 1);
    }
    return res;
}

int64_t n_mod_from_exps_i64(int64_t mod) {
    int64_t res = 1;
    int32_t i = 0;
    while (i < g_num_exps) {
        res = mm_i64_i64(res, mod_pow_i64_i64_i64(((int64_t)(g_prime_exps_p[i])), ((int64_t)(g_prime_exps_e[i])), mod));
        i = (i + 1);
    }
    return res;
}

void precompute_sigma1_i32(int32_t n) {
    int32_t i = 0;
    while (i <= n) {
        g_sigma1[i] = 0;
        i = (i + 1);
    }
    int32_t d = 1;
    while (d <= n) {
        int32_t m = d;
        while (m <= n) {
            g_sigma1[m] = (g_sigma1[m] + ((int64_t)(d)));
            m = (m + d);
        }
        d = (d + 1);
    }
    i = 0;
    while (i <= n) {
        g_sigma1[i] = FLOW_CHECKED_MOD((g_sigma1[i]), (MOD));
        i = (i + 1);
    }
}

void precompute_tau_i32_i64(int32_t n, int64_t mod) {
    precompute_sigma1_i32(n);
    compute_inv_table_i32_i64(n, mod);
    int32_t i = 0;
    while (i <= n) {
        g_tau_arr[i] = 0;
        i = (i + 1);
    }
    g_tau_arr[1] = 1;
    int32_t k = 2;
    while (k <= n) {
        int64_t total = 0;
        int32_t m = 1;
        while (m < k) {
            total = FLOW_CHECKED_MOD(((total + mm_i64_i64(g_sigma1[m], g_tau_arr[(k - m)]))), (mod));
            m = (m + 1);
        }
        int64_t val0 = mm_i64_i64(FLOW_CHECKED_MOD(((MOD - 24)), (mod)), total);
        g_tau_arr[k] = mm_i64_i64(val0, g_inv_table[(k - 1)]);
        k = (k + 1);
    }
}

int64_t mat_mul_i64_i64_i64_i64_i64_i64_i64_i64_i64(int64_t a0, int64_t a1, int64_t a2, int64_t a3, int64_t b0, int64_t b1, int64_t b2, int64_t b3, int64_t mod) {
    int64_t r0 = FLOW_CHECKED_MOD(((mm_i64_i64(a0, b0) + mm_i64_i64(a1, b2))), (mod));
    int64_t r1 = FLOW_CHECKED_MOD(((mm_i64_i64(a0, b1) + mm_i64_i64(a1, b3))), (mod));
    int64_t r2 = FLOW_CHECKED_MOD(((mm_i64_i64(a2, b0) + mm_i64_i64(a3, b2))), (mod));
    int64_t r3 = FLOW_CHECKED_MOD(((mm_i64_i64(a2, b1) + mm_i64_i64(a3, b3))), (mod));
    g_mat_r0 = r0;
    g_mat_r1 = r1;
    g_mat_r2 = r2;
    g_mat_r3 = r3;
    return 0;
}

int64_t tau_prime_power_i32_i32_i64_i64(int32_t p, int32_t e, int64_t tau_p, int64_t mod) {
    if (e == 0) {
        return 1;
    }
    if (e == 1) {
        return FLOW_CHECKED_MOD((tau_p), (mod));
    }
    int64_t p11 = mod_pow_i64_i64_i64(((int64_t)(p)), 11, mod);
    int64_t m0 = FLOW_CHECKED_MOD((tau_p), (mod));
    int64_t m1 = FLOW_CHECKED_MOD(((mod - p11)), (mod));
    int64_t m2 = 1;
    int64_t m3 = 0;
    int64_t r0 = 1;
    int64_t r1 = 0;
    int64_t r2 = 0;
    int64_t r3 = 1;
    int32_t exp = (e - 1);
    while (exp > 0) {
        if ((exp & 1) == 1) {
            mat_mul_i64_i64_i64_i64_i64_i64_i64_i64_i64(r0, r1, r2, r3, m0, m1, m2, m3, mod);
            r0 = g_mat_r0;
            r1 = g_mat_r1;
            r2 = g_mat_r2;
            r3 = g_mat_r3;
        }
        mat_mul_i64_i64_i64_i64_i64_i64_i64_i64_i64(m0, m1, m2, m3, m0, m1, m2, m3, mod);
        m0 = g_mat_r0;
        m1 = g_mat_r1;
        m2 = g_mat_r2;
        m3 = g_mat_r3;
        exp = FLOW_CHECKED_SHR((exp), (1));
    }
    return FLOW_CHECKED_MOD(((mm_i64_i64(r0, FLOW_CHECKED_MOD((tau_p), (mod))) + r1)), (mod));
}

int64_t tau_from_exps_i64(int64_t mod) {
    int64_t res = 1;
    int32_t i = 0;
    while (i < g_num_exps) {
        int32_t p = g_prime_exps_p[i];
        int32_t e = g_prime_exps_e[i];
        res = mm_i64_i64(res, tau_prime_power_i32_i32_i64_i64(p, e, g_tau_arr[p], mod));
        i = (i + 1);
    }
    return res;
}

void init_e_coeff_i64(int64_t mod) {
    int64_t inv_691 = mod_pow_i64_i64_i64(691, (mod - 2), mod);
    g_E_coeff[2] = FLOW_CHECKED_MOD(((mod - 24)), (mod));
    g_E_coeff[4] = FLOW_CHECKED_MOD((240), (mod));
    g_E_coeff[6] = FLOW_CHECKED_MOD(((mod - 504)), (mod));
    g_E_coeff[8] = FLOW_CHECKED_MOD((480), (mod));
    g_E_coeff[10] = FLOW_CHECKED_MOD(((mod - 264)), (mod));
    g_E_coeff[12] = mm_i64_i64(FLOW_CHECKED_MOD((65520), (mod)), inv_691);
}

void build_sigma_data_i64(int64_t mod) {
    int32_t s = 1;
    while (s <= 11) {
        g_sig[s] = sigma_power_from_exps_i64_i64(((int64_t)(s)), mod);
        s = (s + 2);
    }
}

int64_t coeff_Ek_i32_i64(int32_t k, int64_t mod) {
    if (k == 2) {
        return mm_i64_i64(g_E_coeff[2], g_sig[1]);
    }
    return mm_i64_i64(g_E_coeff[k], g_sig[(k - 1)]);
}

int64_t coeff_D_Ek_i32_i32_ptr_i64_i64(int32_t k, int32_t r, int64_t* n_pows, int64_t mod) {
    return mm_i64_i64(n_pows[r], coeff_Ek_i32_i64(k, mod));
}

int64_t coeff_E2_pow_i32_ptr_i64_i64_i64(int32_t k, int64_t* n_pows, int64_t tau_n, int64_t mod) {
    if (k == 1) {
        return coeff_Ek_i32_i64(2, mod);
    }
    if (k == 2) {
        int64_t t1 = coeff_Ek_i32_i64(4, mod);
        int64_t t2 = mm_i64_i64(12, coeff_D_Ek_i32_i32_ptr_i64_i64(2, 1, n_pows, mod));
        return FLOW_CHECKED_MOD(((t1 + t2)), (mod));
    }
    if (k == 3) {
        int64_t t1 = coeff_Ek_i32_i64(6, mod);
        int64_t t2 = mm_i64_i64(9, coeff_D_Ek_i32_i32_ptr_i64_i64(4, 1, n_pows, mod));
        int64_t t3 = mm_i64_i64(72, coeff_D_Ek_i32_i32_ptr_i64_i64(2, 2, n_pows, mod));
        return FLOW_CHECKED_MOD((((t1 + t2) + t3)), (mod));
    }
    if (k == 4) {
        int64_t c216_5 = mm_i64_i64(216, g_inv5);
        int64_t t1 = coeff_Ek_i32_i64(8, mod);
        int64_t t2 = mm_i64_i64(8, coeff_D_Ek_i32_i32_ptr_i64_i64(6, 1, n_pows, mod));
        int64_t t3 = mm_i64_i64(c216_5, coeff_D_Ek_i32_i32_ptr_i64_i64(4, 2, n_pows, mod));
        int64_t t4 = mm_i64_i64(288, coeff_D_Ek_i32_i32_ptr_i64_i64(2, 3, n_pows, mod));
        return FLOW_CHECKED_MOD(((((t1 + t2) + t3) + t4)), (mod));
    }
    if (k == 5) {
        int64_t c15_2 = mm_i64_i64(15, g_inv2);
        int64_t c240_7 = mm_i64_i64(240, g_inv7);
        int64_t t1 = coeff_Ek_i32_i64(10, mod);
        int64_t t2 = mm_i64_i64(c15_2, coeff_D_Ek_i32_i32_ptr_i64_i64(8, 1, n_pows, mod));
        int64_t t3 = mm_i64_i64(c240_7, coeff_D_Ek_i32_i32_ptr_i64_i64(6, 2, n_pows, mod));
        int64_t t4 = mm_i64_i64(144, coeff_D_Ek_i32_i32_ptr_i64_i64(4, 3, n_pows, mod));
        int64_t t5 = mm_i64_i64(864, coeff_D_Ek_i32_i32_ptr_i64_i64(2, 4, n_pows, mod));
        return FLOW_CHECKED_MOD((((((t1 + t2) + t3) + t4) + t5)), (mod));
    }
    int64_t c36_5 = mm_i64_i64(36, g_inv5);
    int64_t c720_7 = mm_i64_i64(720, g_inv7);
    int64_t c2592_7 = mm_i64_i64(2592, g_inv7);
    int64_t c10368_5 = mm_i64_i64(10368, g_inv5);
    int64_t cDelta = mm_i64_i64(FLOW_CHECKED_MOD(((mod - 4608)), (mod)), g_inv24185);
    int64_t t1 = coeff_Ek_i32_i64(12, mod);
    int64_t t2 = mm_i64_i64(cDelta, FLOW_CHECKED_MOD((tau_n), (mod)));
    int64_t t3 = mm_i64_i64(c36_5, coeff_D_Ek_i32_i32_ptr_i64_i64(10, 1, n_pows, mod));
    int64_t t4 = mm_i64_i64(30, coeff_D_Ek_i32_i32_ptr_i64_i64(8, 2, n_pows, mod));
    int64_t t5 = mm_i64_i64(c720_7, coeff_D_Ek_i32_i32_ptr_i64_i64(6, 3, n_pows, mod));
    int64_t t6 = mm_i64_i64(c2592_7, coeff_D_Ek_i32_i32_ptr_i64_i64(4, 4, n_pows, mod));
    int64_t t7 = mm_i64_i64(c10368_5, coeff_D_Ek_i32_i32_ptr_i64_i64(2, 5, n_pows, mod));
    return FLOW_CHECKED_MOD((((((((t1 + t2) + t3) + t4) + t5) + t6) + t7)), (mod));
}

int64_t comb_small_i32_i32(int32_t n, int32_t k) {
    if ((k < 0 || k > n)) {
        return 0;
    }
    int32_t kk = k;
    if (k > (n - k)) {
        return comb_small_i32_i32(n, (n - k));
    }
    int64_t num = 1;
    int64_t den = 1;
    int32_t i = 1;
    while (i <= kk) {
        num = (num * ((int64_t)((n - (kk - i)))));
        den = (den * ((int64_t)(i)));
        i = (i + 1);
    }
    return FLOW_CHECKED_DIV((num), (den));
}

int64_t R_dim_at_n_i32_ptr_i64_i64_i64(int32_t dim, int64_t* n_pows, int64_t tau_n, int64_t mod) {
    int64_t inv12 = mod_pow_i64_i64_i64(12, (mod - 2), mod);
    int64_t scale = mod_pow_i64_i64_i64(inv12, ((int64_t)(dim)), mod);
    int64_t s = 0;
    int32_t k = 1;
    while (k <= dim) {
        int64_t ck = comb_small_i32_i32(dim, k);
        int64_t term = mm_i64_i64(ck, coeff_E2_pow_i32_ptr_i64_i64_i64(k, n_pows, tau_n, mod));
        if (FLOW_CHECKED_MOD((k), (2)) == 1) {
            s = FLOW_CHECKED_MOD((((s - FLOW_CHECKED_MOD((term), (mod))) + mod)), (mod));
        } else {
            s = FLOW_CHECKED_MOD(((s + term)), (mod));
        }
        k = (k + 1);
    }
    return mm_i64_i64(s, scale);
}

int32_t main(void) {
    int64_t mod = MOD;
    g_prime_exps_p = calloc(2000, 4);
    g_prime_exps_e = calloc(2000, 4);
    g_inv_table = calloc((LIMIT + 1), 8);
    g_sigma1 = calloc((LIMIT + 1), 8);
    g_tau_arr = calloc((LIMIT + 1), 8);
    g_E_coeff = calloc(13, 8);
    g_sig = calloc(13, 8);
    sieve();
    g_inv2 = FLOW_CHECKED_DIV(((mod + 1)), (2));
    g_inv5 = mod_pow_i64_i64_i64(5, (mod - 2), mod);
    g_inv7 = mod_pow_i64_i64_i64(7, (mod - 2), mod);
    g_inv24185 = mod_pow_i64_i64_i64(24185, (mod - 2), mod);
    init_e_coeff_i64(mod);
    precompute_tau_i32_i64(((int32_t)(LIMIT)), mod);
    factorial_prime_exponents_i32(((int32_t)(LIMIT)));
    build_sigma_data_i64(mod);
    int64_t nmod = n_mod_from_exps_i64(mod);
    int64_t* n_pows = (int64_t*)(calloc(6, 8));
    n_pows[0] = 1;
    int32_t i = 1;
    while (i <= 5) {
        n_pows[i] = mm_i64_i64(n_pows[(i - 1)], nmod);
        i = (i + 1);
    }
    int64_t tau_fact = tau_from_exps_i64(mod);
    int64_t result = R_dim_at_n_i32_ptr_i64_i64_i64(6, n_pows, tau_fact, mod);
    printf("%lld\n", result);
    free(n_pows);
    free(g_is_prime);
    free(g_primes);
    free(g_prime_exps_p);
    free(g_prime_exps_e);
    free(g_inv_table);
    free(g_sigma1);
    free(g_tau_arr);
    free(g_E_coeff);
    free(g_sig);
    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) -> ()
  // Constant: MOD
  llvm.mlir.global internal constant @MOD(1000000007 : i64) : i64
  // Constant: LIMIT
  llvm.mlir.global internal constant @LIMIT(10000 : i64) : i64
  // Module static: g_is_prime
  llvm.mlir.global internal @g_is_prime() {addr_space = 0 : i32} : !llvm.ptr {
    %175 = llvm.mlir.zero : !llvm.ptr
    llvm.return %175 : !llvm.ptr
  }
  // Module static: g_primes
  llvm.mlir.global internal @g_primes() {addr_space = 0 : i32} : !llvm.ptr {
    %176 = llvm.mlir.zero : !llvm.ptr
    llvm.return %176 : !llvm.ptr
  }
  // Module static: g_num_primes
  llvm.mlir.global internal @g_num_primes(0 : i32) : i32
  // Module static: g_prime_exps_p
  llvm.mlir.global internal @g_prime_exps_p() {addr_space = 0 : i32} : !llvm.ptr {
    %177 = llvm.mlir.zero : !llvm.ptr
    llvm.return %177 : !llvm.ptr
  }
  // Module static: g_prime_exps_e
  llvm.mlir.global internal @g_prime_exps_e() {addr_space = 0 : i32} : !llvm.ptr {
    %178 = llvm.mlir.zero : !llvm.ptr
    llvm.return %178 : !llvm.ptr
  }
  // Module static: g_num_exps
  llvm.mlir.global internal @g_num_exps(0 : i32) : i32
  // Module static: g_inv_table
  llvm.mlir.global internal @g_inv_table() {addr_space = 0 : i32} : !llvm.ptr {
    %179 = llvm.mlir.zero : !llvm.ptr
    llvm.return %179 : !llvm.ptr
  }
  // Module static: g_sigma1
  llvm.mlir.global internal @g_sigma1() {addr_space = 0 : i32} : !llvm.ptr {
    %180 = llvm.mlir.zero : !llvm.ptr
    llvm.return %180 : !llvm.ptr
  }
  // Module static: g_tau_arr
  llvm.mlir.global internal @g_tau_arr() {addr_space = 0 : i32} : !llvm.ptr {
    %181 = llvm.mlir.zero : !llvm.ptr
    llvm.return %181 : !llvm.ptr
  }
  // Module static: g_E_coeff
  llvm.mlir.global internal @g_E_coeff() {addr_space = 0 : i32} : !llvm.ptr {
    %182 = llvm.mlir.zero : !llvm.ptr
    llvm.return %182 : !llvm.ptr
  }
  // Module static: g_sig
  llvm.mlir.global internal @g_sig() {addr_space = 0 : i32} : !llvm.ptr {
    %183 = llvm.mlir.zero : !llvm.ptr
    llvm.return %183 : !llvm.ptr
  }
  // Module static: g_inv2
  llvm.mlir.global internal @g_inv2(0 : i64) : i64
  // Module static: g_inv5
  llvm.mlir.global internal @g_inv5(0 : i64) : i64
  // Module static: g_inv7
  llvm.mlir.global internal @g_inv7(0 : i64) : i64
  // Module static: g_inv24185
  llvm.mlir.global internal @g_inv24185(0 : i64) : i64
  func.func @mm(%arg0: i64, %arg1: i64) -> i64 {
    %184 = arith.extsi %arg0 : i64 to i128
    %185 = arith.extsi %arg1 : i64 to i128
    %187 = arith.trunci %184 : i128 to i64
    %188 = arith.trunci %185 : i128 to i64
    %186 = arith.muli %187, %188 : i64
    %189 = llvm.mlir.addressof @MOD : !llvm.ptr
    %190 = llvm.load %189 : !llvm.ptr -> i64
    %191 = arith.extsi %190 : i64 to i128
    %193 = arith.trunci %191 : i128 to i64
    %192 = arith.remsi %186, %193 : i64
    func.return %192 : i64
  }
  func.func @sieve() -> () {
    %195 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %196 = llvm.load %195 : !llvm.ptr -> i64
    %197 = arith.constant 1 : i32
    %199 = arith.extsi %197 : i32 to i64
    %198 = arith.addi %196, %199 : i64
    %200 = arith.constant 1 : i32
    %201 = arith.extsi %200 : i32 to i64
    %194 = func.call @calloc(%198, %201) : (i64, i64) -> !llvm.ptr
    %202 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
    llvm.store %194, %202 : !llvm.ptr, !llvm.ptr
    %203 = arith.constant 0 : i32
    %204 = llvm.mlir.constant(1 : i64) : i64
    %205 = llvm.alloca %204 x i32 : (i64) -> !llvm.ptr
    llvm.store %203, %205 : i32, !llvm.ptr
    cf.br ^bb42
    ^bb42:
    %206 = llvm.load %205 : !llvm.ptr -> i32
    %207 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %208 = llvm.load %207 : !llvm.ptr -> i64
    %210 = arith.extsi %206 : i32 to i64
    %209 = arith.cmpi sle, %210, %208 : i64
    cf.cond_br %209, ^bb43, ^bb44
    ^bb43:
      %211 = arith.constant 1 : i32
      %212 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
      %213 = llvm.load %212 : !llvm.ptr -> !llvm.ptr
      %214 = llvm.load %205 : !llvm.ptr -> i32
      %215 = arith.trunci %211 : i32 to i8
      %216 = arith.extsi %214 : i32 to i64
      %217 = llvm.getelementptr %213[%216] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %215, %217 : i8, !llvm.ptr
      %218 = llvm.load %205 : !llvm.ptr -> i32
      %219 = arith.constant 1 : i32
      %220 = arith.addi %218, %219 : i32
      llvm.store %220, %205 : i32, !llvm.ptr
      cf.br ^bb42
    ^bb44:
    %221 = arith.constant 0 : i32
    %222 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
    %223 = llvm.load %222 : !llvm.ptr -> !llvm.ptr
    %224 = arith.constant 0 : i32
    %225 = arith.trunci %221 : i32 to i8
    %226 = arith.extsi %224 : i32 to i64
    %227 = llvm.getelementptr %223[%226] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %225, %227 : i8, !llvm.ptr
    %228 = arith.constant 0 : i32
    %229 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
    %230 = llvm.load %229 : !llvm.ptr -> !llvm.ptr
    %231 = arith.constant 1 : i32
    %232 = arith.trunci %228 : i32 to i8
    %233 = arith.extsi %231 : i32 to i64
    %234 = llvm.getelementptr %230[%233] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %232, %234 : i8, !llvm.ptr
    %235 = arith.constant 2 : i32
    %236 = llvm.mlir.constant(1 : i64) : i64
    %237 = llvm.alloca %236 x i32 : (i64) -> !llvm.ptr
    llvm.store %235, %237 : i32, !llvm.ptr
    cf.br ^bb45
    ^bb45:
    %238 = llvm.load %237 : !llvm.ptr -> i32
    %239 = llvm.load %237 : !llvm.ptr -> i32
    %240 = arith.muli %238, %239 : i32
    %241 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %242 = llvm.load %241 : !llvm.ptr -> i64
    %244 = arith.extsi %240 : i32 to i64
    %243 = arith.cmpi sle, %244, %242 : i64
    cf.cond_br %243, ^bb46, ^bb47
    ^bb46:
      %246 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
      %247 = llvm.load %246 : !llvm.ptr -> !llvm.ptr
      %248 = llvm.load %237 : !llvm.ptr -> i32
      %249 = arith.extsi %248 : i32 to i64
      %250 = llvm.getelementptr %247[%249] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %245 = llvm.load %250 : !llvm.ptr -> i8
      %251 = arith.constant 0 : i32
      %253 = arith.extsi %245 : i8 to i32
      %252 = arith.cmpi ne, %253, %251 : i32
      cf.cond_br %252, ^bb48, ^bb49
      ^bb48:
        %254 = llvm.load %237 : !llvm.ptr -> i32
        %255 = llvm.load %237 : !llvm.ptr -> i32
        %256 = arith.muli %254, %255 : i32
        %257 = llvm.mlir.constant(1 : i64) : i64
        %258 = llvm.alloca %257 x i32 : (i64) -> !llvm.ptr
        llvm.store %256, %258 : i32, !llvm.ptr
        cf.br ^bb51
        ^bb51:
        %259 = llvm.load %258 : !llvm.ptr -> i32
        %260 = llvm.mlir.addressof @LIMIT : !llvm.ptr
        %261 = llvm.load %260 : !llvm.ptr -> i64
        %263 = arith.extsi %259 : i32 to i64
        %262 = arith.cmpi sle, %263, %261 : i64
        cf.cond_br %262, ^bb52, ^bb53
        ^bb52:
          %264 = arith.constant 0 : i32
          %265 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
          %266 = llvm.load %265 : !llvm.ptr -> !llvm.ptr
          %267 = llvm.load %258 : !llvm.ptr -> i32
          %268 = arith.trunci %264 : i32 to i8
          %269 = arith.extsi %267 : i32 to i64
          %270 = llvm.getelementptr %266[%269] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %268, %270 : i8, !llvm.ptr
          %271 = llvm.load %258 : !llvm.ptr -> i32
          %272 = llvm.load %237 : !llvm.ptr -> i32
          %273 = arith.addi %271, %272 : i32
          llvm.store %273, %258 : i32, !llvm.ptr
          cf.br ^bb51
        ^bb53:
        cf.br ^bb50
      ^bb49:
        cf.br ^bb50
      ^bb50:
      %274 = llvm.load %237 : !llvm.ptr -> i32
      %275 = arith.constant 1 : i32
      %276 = arith.addi %274, %275 : i32
      llvm.store %276, %237 : i32, !llvm.ptr
      cf.br ^bb45
    ^bb47:
    %278 = arith.constant 2000 : i32
    %279 = arith.constant 4 : i32
    %280 = arith.extsi %278 : i32 to i64
    %281 = arith.extsi %279 : i32 to i64
    %277 = func.call @calloc(%280, %281) : (i64, i64) -> !llvm.ptr
    %282 = llvm.mlir.addressof @g_primes : !llvm.ptr
    llvm.store %277, %282 : !llvm.ptr, !llvm.ptr
    %283 = arith.constant 0 : i32
    %284 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
    llvm.store %283, %284 : i32, !llvm.ptr
    %285 = arith.constant 2 : i32
    llvm.store %285, %205 : i32, !llvm.ptr
    cf.br ^bb54
    ^bb54:
    %286 = llvm.load %205 : !llvm.ptr -> i32
    %287 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %288 = llvm.load %287 : !llvm.ptr -> i64
    %290 = arith.extsi %286 : i32 to i64
    %289 = arith.cmpi sle, %290, %288 : i64
    cf.cond_br %289, ^bb55, ^bb56
    ^bb55:
      %292 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
      %293 = llvm.load %292 : !llvm.ptr -> !llvm.ptr
      %294 = llvm.load %205 : !llvm.ptr -> i32
      %295 = arith.extsi %294 : i32 to i64
      %296 = llvm.getelementptr %293[%295] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %291 = llvm.load %296 : !llvm.ptr -> i8
      %297 = arith.constant 0 : i32
      %299 = arith.extsi %291 : i8 to i32
      %298 = arith.cmpi ne, %299, %297 : i32
      cf.cond_br %298, ^bb57, ^bb58
      ^bb57:
        %300 = llvm.load %205 : !llvm.ptr -> i32
        %301 = llvm.mlir.addressof @g_primes : !llvm.ptr
        %302 = llvm.load %301 : !llvm.ptr -> !llvm.ptr
        %303 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
        %304 = llvm.load %303 : !llvm.ptr -> i32
        %305 = arith.extsi %304 : i32 to i64
        %306 = llvm.getelementptr %302[%305] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %300, %306 : i32, !llvm.ptr
        %307 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
        %308 = llvm.load %307 : !llvm.ptr -> i32
        %309 = arith.constant 1 : i32
        %310 = arith.addi %308, %309 : i32
        %311 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
        llvm.store %310, %311 : i32, !llvm.ptr
        cf.br ^bb59
      ^bb58:
        cf.br ^bb59
      ^bb59:
      %312 = llvm.load %205 : !llvm.ptr -> i32
      %313 = arith.constant 1 : i32
      %314 = arith.addi %312, %313 : i32
      llvm.store %314, %205 : i32, !llvm.ptr
      cf.br ^bb54
    ^bb56:
    func.return
  }
  func.func @factorial_prime_exponents(%arg0: i32) -> () {
    %315 = arith.constant 0 : i32
    %316 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
    llvm.store %315, %316 : i32, !llvm.ptr
    %317 = arith.constant 0 : i32
    %318 = llvm.mlir.constant(1 : i64) : i64
    %319 = llvm.alloca %318 x i32 : (i64) -> !llvm.ptr
    llvm.store %317, %319 : i32, !llvm.ptr
    cf.br ^bb60
    ^bb60:
    %320 = llvm.load %319 : !llvm.ptr -> i32
    %321 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
    %322 = llvm.load %321 : !llvm.ptr -> i32
    %323 = arith.cmpi slt, %320, %322 : i32
    cf.cond_br %323, ^bb61, ^bb62
    ^bb61:
      %325 = llvm.mlir.addressof @g_primes : !llvm.ptr
      %326 = llvm.load %325 : !llvm.ptr -> !llvm.ptr
      %327 = llvm.load %319 : !llvm.ptr -> i32
      %328 = arith.extsi %327 : i32 to i64
      %329 = llvm.getelementptr %326[%328] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %324 = llvm.load %329 : !llvm.ptr -> i32
      %330 = arith.cmpi sgt, %324, %arg0 : i32
      cf.cond_br %330, ^bb63, ^bb64
      ^bb63:
        cf.br ^bb62
      ^bb64:
        cf.br ^bb65
      ^bb65:
      %331 = arith.constant 0 : i32
      %332 = llvm.mlir.constant(1 : i64) : i64
      %333 = llvm.alloca %332 x i32 : (i64) -> !llvm.ptr
      llvm.store %arg0, %333 : i32, !llvm.ptr
      cf.br ^bb66(%331 : i32)
      ^bb66(%334: i32):
      %335 = llvm.load %333 : !llvm.ptr -> i32
      %336 = arith.constant 0 : i32
      %337 = arith.cmpi sgt, %335, %336 : i32
      cf.cond_br %337, ^bb67(%334 : i32), ^bb68(%334 : i32)
      ^bb67(%338: i32):
        %339 = llvm.load %333 : !llvm.ptr -> i32
        %340 = arith.divsi %339, %324 : i32
        llvm.store %340, %333 : i32, !llvm.ptr
        %341 = llvm.load %333 : !llvm.ptr -> i32
        %342 = arith.addi %338, %341 : i32
        cf.br ^bb66(%342 : i32)
      ^bb68(%343: i32):
      %344 = arith.constant 0 : i32
      %345 = arith.cmpi ne, %343, %344 : i32
      cf.cond_br %345, ^bb69, ^bb70
      ^bb69:
        %346 = llvm.mlir.addressof @g_prime_exps_p : !llvm.ptr
        %347 = llvm.load %346 : !llvm.ptr -> !llvm.ptr
        %348 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
        %349 = llvm.load %348 : !llvm.ptr -> i32
        %350 = arith.extsi %349 : i32 to i64
        %351 = llvm.getelementptr %347[%350] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %324, %351 : i32, !llvm.ptr
        %352 = llvm.mlir.addressof @g_prime_exps_e : !llvm.ptr
        %353 = llvm.load %352 : !llvm.ptr -> !llvm.ptr
        %354 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
        %355 = llvm.load %354 : !llvm.ptr -> i32
        %356 = arith.extsi %355 : i32 to i64
        %357 = llvm.getelementptr %353[%356] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %343, %357 : i32, !llvm.ptr
        %358 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
        %359 = llvm.load %358 : !llvm.ptr -> i32
        %360 = arith.constant 1 : i32
        %361 = arith.addi %359, %360 : i32
        %362 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
        llvm.store %361, %362 : i32, !llvm.ptr
        cf.br ^bb71
      ^bb70:
        cf.br ^bb71
      ^bb71:
      %363 = llvm.load %319 : !llvm.ptr -> i32
      %364 = arith.constant 1 : i32
      %365 = arith.addi %363, %364 : i32
      llvm.store %365, %319 : i32, !llvm.ptr
      cf.br ^bb60
    ^bb62:
    func.return
  }
  func.func @compute_inv_table(%arg0: i32, %arg1: i64) -> () {
    %366 = arith.constant 1 : i32
    %367 = llvm.mlir.addressof @g_inv_table : !llvm.ptr
    %368 = llvm.load %367 : !llvm.ptr -> !llvm.ptr
    %369 = arith.constant 1 : i32
    %370 = arith.extsi %366 : i32 to i64
    %371 = arith.extsi %369 : i32 to i64
    %372 = llvm.getelementptr %368[%371] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %370, %372 : i64, !llvm.ptr
    %373 = arith.constant 2 : i32
    %374 = llvm.mlir.constant(1 : i64) : i64
    %375 = llvm.alloca %374 x i32 : (i64) -> !llvm.ptr
    llvm.store %373, %375 : i32, !llvm.ptr
    cf.br ^bb72
    ^bb72:
    %376 = llvm.load %375 : !llvm.ptr -> i32
    %377 = arith.cmpi sle, %376, %arg0 : i32
    cf.cond_br %377, ^bb73, ^bb74
    ^bb73:
      %378 = llvm.load %375 : !llvm.ptr -> i32
      %379 = arith.extsi %378 : i32 to i64
      %380 = arith.divsi %arg1, %379 : i64
      %382 = llvm.mlir.addressof @g_inv_table : !llvm.ptr
      %383 = llvm.load %382 : !llvm.ptr -> !llvm.ptr
      %384 = llvm.load %375 : !llvm.ptr -> i32
      %385 = arith.extsi %384 : i32 to i64
      %386 = arith.remsi %arg1, %385 : i64
      %387 = llvm.getelementptr %383[%386] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %381 = llvm.load %387 : !llvm.ptr -> i64
      %388 = arith.muli %380, %381 : i64
      %389 = arith.remsi %388, %arg1 : i64
      %390 = arith.subi %arg1, %389 : i64
      %391 = arith.remsi %390, %arg1 : i64
      %392 = llvm.mlir.addressof @g_inv_table : !llvm.ptr
      %393 = llvm.load %392 : !llvm.ptr -> !llvm.ptr
      %394 = llvm.load %375 : !llvm.ptr -> i32
      %395 = arith.extsi %394 : i32 to i64
      %396 = llvm.getelementptr %393[%395] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %391, %396 : i64, !llvm.ptr
      %397 = llvm.load %375 : !llvm.ptr -> i32
      %398 = arith.constant 1 : i32
      %399 = arith.addi %397, %398 : i32
      llvm.store %399, %375 : i32, !llvm.ptr
      cf.br ^bb72
    ^bb74:
    func.return
  }
  func.func @sigma_power_from_exps(%arg0: i64, %arg1: i64) -> i64 {
    %400 = arith.constant 1 : i32
    %401 = arith.extsi %400 : i32 to i64
    %402 = llvm.mlir.constant(1 : i64) : i64
    %403 = llvm.alloca %402 x i64 : (i64) -> !llvm.ptr
    llvm.store %401, %403 : i64, !llvm.ptr
    %404 = arith.constant 0 : i32
    %405 = llvm.mlir.constant(1 : i64) : i64
    %406 = llvm.alloca %405 x i32 : (i64) -> !llvm.ptr
    llvm.store %404, %406 : i32, !llvm.ptr
    cf.br ^bb75
    ^bb75:
    %407 = llvm.load %406 : !llvm.ptr -> i32
    %408 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
    %409 = llvm.load %408 : !llvm.ptr -> i32
    %410 = arith.cmpi slt, %407, %409 : i32
    cf.cond_br %410, ^bb76, ^bb77
    ^bb76:
      %412 = llvm.mlir.addressof @g_prime_exps_p : !llvm.ptr
      %413 = llvm.load %412 : !llvm.ptr -> !llvm.ptr
      %414 = llvm.load %406 : !llvm.ptr -> i32
      %415 = arith.extsi %414 : i32 to i64
      %416 = llvm.getelementptr %413[%415] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %411 = llvm.load %416 : !llvm.ptr -> i32
      %418 = llvm.mlir.addressof @g_prime_exps_e : !llvm.ptr
      %419 = llvm.load %418 : !llvm.ptr -> !llvm.ptr
      %420 = llvm.load %406 : !llvm.ptr -> i32
      %421 = arith.extsi %420 : i32 to i64
      %422 = llvm.getelementptr %419[%421] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %417 = llvm.load %422 : !llvm.ptr -> i32
      %424 = arith.extsi %411 : i32 to i64
      %423 = func.call @mod_pow(%424, %arg0, %arg1) : (i64, i64, i64) -> i64
      %425 = arith.constant 0 : i32
      %426 = arith.extsi %425 : i32 to i64
      %427 = arith.constant 1 : i32
      %429 = arith.extsi %427 : i32 to i64
      %428 = arith.cmpi eq, %423, %429 : i64
      %430 = scf.if %428 -> (i64) {
        %431 = arith.constant 1 : i32
        %432 = arith.addi %417, %431 : i32
        %433 = arith.extsi %432 : i32 to i64
        %434 = arith.remsi %433, %arg1 : i64
        scf.yield %434 : i64
      } else {
        %436 = arith.constant 1 : i32
        %437 = arith.addi %417, %436 : i32
        %438 = arith.extsi %437 : i32 to i64
        %435 = func.call @mod_pow(%423, %438, %arg1) : (i64, i64, i64) -> i64
        %439 = arith.constant 1 : i32
        %441 = arith.extsi %439 : i32 to i64
        %440 = arith.subi %435, %441 : i64
        %442 = arith.addi %440, %arg1 : i64
        %443 = arith.remsi %442, %arg1 : i64
        %445 = arith.constant 1 : i32
        %447 = arith.extsi %445 : i32 to i64
        %446 = arith.subi %423, %447 : i64
        %448 = arith.addi %446, %arg1 : i64
        %449 = arith.remsi %448, %arg1 : i64
        %450 = arith.constant 2 : i32
        %452 = arith.extsi %450 : i32 to i64
        %451 = arith.subi %arg1, %452 : i64
        %444 = func.call @mod_pow(%449, %451, %arg1) : (i64, i64, i64) -> i64
        %453 = func.call @mm(%443, %444) : (i64, i64) -> i64
        scf.yield %453 : i64
      }
      %455 = llvm.load %403 : !llvm.ptr -> i64
      %454 = func.call @mm(%455, %430) : (i64, i64) -> i64
      llvm.store %454, %403 : i64, !llvm.ptr
      %456 = llvm.load %406 : !llvm.ptr -> i32
      %457 = arith.constant 1 : i32
      %458 = arith.addi %456, %457 : i32
      llvm.store %458, %406 : i32, !llvm.ptr
      cf.br ^bb75
    ^bb77:
    %459 = llvm.load %403 : !llvm.ptr -> i64
    func.return %459 : i64
  }
  func.func @n_mod_from_exps(%arg0: i64) -> i64 {
    %460 = arith.constant 1 : i32
    %461 = arith.extsi %460 : i32 to i64
    %462 = llvm.mlir.constant(1 : i64) : i64
    %463 = llvm.alloca %462 x i64 : (i64) -> !llvm.ptr
    llvm.store %461, %463 : i64, !llvm.ptr
    %464 = arith.constant 0 : i32
    %465 = llvm.mlir.constant(1 : i64) : i64
    %466 = llvm.alloca %465 x i32 : (i64) -> !llvm.ptr
    llvm.store %464, %466 : i32, !llvm.ptr
    cf.br ^bb78
    ^bb78:
    %467 = llvm.load %466 : !llvm.ptr -> i32
    %468 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
    %469 = llvm.load %468 : !llvm.ptr -> i32
    %470 = arith.cmpi slt, %467, %469 : i32
    cf.cond_br %470, ^bb79, ^bb80
    ^bb79:
      %472 = llvm.load %463 : !llvm.ptr -> i64
      %475 = llvm.mlir.addressof @g_prime_exps_p : !llvm.ptr
      %476 = llvm.load %475 : !llvm.ptr -> !llvm.ptr
      %477 = llvm.load %466 : !llvm.ptr -> i32
      %478 = arith.extsi %477 : i32 to i64
      %479 = llvm.getelementptr %476[%478] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %474 = llvm.load %479 : !llvm.ptr -> i32
      %480 = arith.extsi %474 : i32 to i64
      %482 = llvm.mlir.addressof @g_prime_exps_e : !llvm.ptr
      %483 = llvm.load %482 : !llvm.ptr -> !llvm.ptr
      %484 = llvm.load %466 : !llvm.ptr -> i32
      %485 = arith.extsi %484 : i32 to i64
      %486 = llvm.getelementptr %483[%485] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %481 = llvm.load %486 : !llvm.ptr -> i32
      %487 = arith.extsi %481 : i32 to i64
      %473 = func.call @mod_pow(%480, %487, %arg0) : (i64, i64, i64) -> i64
      %471 = func.call @mm(%472, %473) : (i64, i64) -> i64
      llvm.store %471, %463 : i64, !llvm.ptr
      %488 = llvm.load %466 : !llvm.ptr -> i32
      %489 = arith.constant 1 : i32
      %490 = arith.addi %488, %489 : i32
      llvm.store %490, %466 : i32, !llvm.ptr
      cf.br ^bb78
    ^bb80:
    %491 = llvm.load %463 : !llvm.ptr -> i64
    func.return %491 : i64
  }
  func.func @precompute_sigma1(%arg0: i32) -> () {
    %492 = arith.constant 0 : i32
    %493 = llvm.mlir.constant(1 : i64) : i64
    %494 = llvm.alloca %493 x i32 : (i64) -> !llvm.ptr
    llvm.store %492, %494 : i32, !llvm.ptr
    cf.br ^bb81
    ^bb81:
    %495 = llvm.load %494 : !llvm.ptr -> i32
    %496 = arith.cmpi sle, %495, %arg0 : i32
    cf.cond_br %496, ^bb82, ^bb83
    ^bb82:
      %497 = arith.constant 0 : i32
      %498 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
      %499 = llvm.load %498 : !llvm.ptr -> !llvm.ptr
      %500 = llvm.load %494 : !llvm.ptr -> i32
      %501 = arith.extsi %497 : i32 to i64
      %502 = arith.extsi %500 : i32 to i64
      %503 = llvm.getelementptr %499[%502] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %501, %503 : i64, !llvm.ptr
      %504 = llvm.load %494 : !llvm.ptr -> i32
      %505 = arith.constant 1 : i32
      %506 = arith.addi %504, %505 : i32
      llvm.store %506, %494 : i32, !llvm.ptr
      cf.br ^bb81
    ^bb83:
    %507 = arith.constant 1 : i32
    %508 = llvm.mlir.constant(1 : i64) : i64
    %509 = llvm.alloca %508 x i32 : (i64) -> !llvm.ptr
    llvm.store %507, %509 : i32, !llvm.ptr
    cf.br ^bb84
    ^bb84:
    %510 = llvm.load %509 : !llvm.ptr -> i32
    %511 = arith.cmpi sle, %510, %arg0 : i32
    cf.cond_br %511, ^bb85, ^bb86
    ^bb85:
      %512 = llvm.load %509 : !llvm.ptr -> i32
      %513 = llvm.mlir.constant(1 : i64) : i64
      %514 = llvm.alloca %513 x i32 : (i64) -> !llvm.ptr
      llvm.store %512, %514 : i32, !llvm.ptr
      cf.br ^bb87
      ^bb87:
      %515 = llvm.load %514 : !llvm.ptr -> i32
      %516 = arith.cmpi sle, %515, %arg0 : i32
      cf.cond_br %516, ^bb88, ^bb89
      ^bb88:
        %518 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
        %519 = llvm.load %518 : !llvm.ptr -> !llvm.ptr
        %520 = llvm.load %514 : !llvm.ptr -> i32
        %521 = arith.extsi %520 : i32 to i64
        %522 = llvm.getelementptr %519[%521] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %517 = llvm.load %522 : !llvm.ptr -> i64
        %523 = llvm.load %509 : !llvm.ptr -> i32
        %524 = arith.extsi %523 : i32 to i64
        %525 = arith.addi %517, %524 : i64
        %526 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
        %527 = llvm.load %526 : !llvm.ptr -> !llvm.ptr
        %528 = llvm.load %514 : !llvm.ptr -> i32
        %529 = arith.extsi %528 : i32 to i64
        %530 = llvm.getelementptr %527[%529] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %525, %530 : i64, !llvm.ptr
        %531 = llvm.load %514 : !llvm.ptr -> i32
        %532 = llvm.load %509 : !llvm.ptr -> i32
        %533 = arith.addi %531, %532 : i32
        llvm.store %533, %514 : i32, !llvm.ptr
        cf.br ^bb87
      ^bb89:
      %534 = llvm.load %509 : !llvm.ptr -> i32
      %535 = arith.constant 1 : i32
      %536 = arith.addi %534, %535 : i32
      llvm.store %536, %509 : i32, !llvm.ptr
      cf.br ^bb84
    ^bb86:
    %537 = arith.constant 0 : i32
    llvm.store %537, %494 : i32, !llvm.ptr
    cf.br ^bb90
    ^bb90:
    %538 = llvm.load %494 : !llvm.ptr -> i32
    %539 = arith.cmpi sle, %538, %arg0 : i32
    cf.cond_br %539, ^bb91, ^bb92
    ^bb91:
      %541 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
      %542 = llvm.load %541 : !llvm.ptr -> !llvm.ptr
      %543 = llvm.load %494 : !llvm.ptr -> i32
      %544 = arith.extsi %543 : i32 to i64
      %545 = llvm.getelementptr %542[%544] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %540 = llvm.load %545 : !llvm.ptr -> i64
      %546 = llvm.mlir.addressof @MOD : !llvm.ptr
      %547 = llvm.load %546 : !llvm.ptr -> i64
      %548 = arith.remsi %540, %547 : i64
      %549 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
      %550 = llvm.load %549 : !llvm.ptr -> !llvm.ptr
      %551 = llvm.load %494 : !llvm.ptr -> i32
      %552 = arith.extsi %551 : i32 to i64
      %553 = llvm.getelementptr %550[%552] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %548, %553 : i64, !llvm.ptr
      %554 = llvm.load %494 : !llvm.ptr -> i32
      %555 = arith.constant 1 : i32
      %556 = arith.addi %554, %555 : i32
      llvm.store %556, %494 : i32, !llvm.ptr
      cf.br ^bb90
    ^bb92:
    func.return
  }
  func.func @precompute_tau(%arg0: i32, %arg1: i64) -> () {
    func.call @precompute_sigma1(%arg0) : (i32) -> ()
    func.call @compute_inv_table(%arg0, %arg1) : (i32, i64) -> ()
    %559 = arith.constant 0 : i32
    %560 = llvm.mlir.constant(1 : i64) : i64
    %561 = llvm.alloca %560 x i32 : (i64) -> !llvm.ptr
    llvm.store %559, %561 : i32, !llvm.ptr
    cf.br ^bb93
    ^bb93:
    %562 = llvm.load %561 : !llvm.ptr -> i32
    %563 = arith.cmpi sle, %562, %arg0 : i32
    cf.cond_br %563, ^bb94, ^bb95
    ^bb94:
      %564 = arith.constant 0 : i32
      %565 = llvm.mlir.addressof @g_tau_arr : !llvm.ptr
      %566 = llvm.load %565 : !llvm.ptr -> !llvm.ptr
      %567 = llvm.load %561 : !llvm.ptr -> i32
      %568 = arith.extsi %564 : i32 to i64
      %569 = arith.extsi %567 : i32 to i64
      %570 = llvm.getelementptr %566[%569] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %568, %570 : i64, !llvm.ptr
      %571 = llvm.load %561 : !llvm.ptr -> i32
      %572 = arith.constant 1 : i32
      %573 = arith.addi %571, %572 : i32
      llvm.store %573, %561 : i32, !llvm.ptr
      cf.br ^bb93
    ^bb95:
    %574 = arith.constant 1 : i32
    %575 = llvm.mlir.addressof @g_tau_arr : !llvm.ptr
    %576 = llvm.load %575 : !llvm.ptr -> !llvm.ptr
    %577 = arith.constant 1 : i32
    %578 = arith.extsi %574 : i32 to i64
    %579 = arith.extsi %577 : i32 to i64
    %580 = llvm.getelementptr %576[%579] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %578, %580 : i64, !llvm.ptr
    %581 = arith.constant 2 : i32
    %582 = llvm.mlir.constant(1 : i64) : i64
    %583 = llvm.alloca %582 x i32 : (i64) -> !llvm.ptr
    llvm.store %581, %583 : i32, !llvm.ptr
    cf.br ^bb96
    ^bb96:
    %584 = llvm.load %583 : !llvm.ptr -> i32
    %585 = arith.cmpi sle, %584, %arg0 : i32
    cf.cond_br %585, ^bb97, ^bb98
    ^bb97:
      %586 = arith.constant 0 : i32
      %587 = arith.extsi %586 : i32 to i64
      %588 = llvm.mlir.constant(1 : i64) : i64
      %589 = llvm.alloca %588 x i64 : (i64) -> !llvm.ptr
      llvm.store %587, %589 : i64, !llvm.ptr
      %590 = arith.constant 1 : i32
      %591 = llvm.mlir.constant(1 : i64) : i64
      %592 = llvm.alloca %591 x i32 : (i64) -> !llvm.ptr
      llvm.store %590, %592 : i32, !llvm.ptr
      cf.br ^bb99
      ^bb99:
      %593 = llvm.load %592 : !llvm.ptr -> i32
      %594 = llvm.load %583 : !llvm.ptr -> i32
      %595 = arith.cmpi slt, %593, %594 : i32
      cf.cond_br %595, ^bb100, ^bb101
      ^bb100:
        %596 = llvm.load %589 : !llvm.ptr -> i64
        %599 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
        %600 = llvm.load %599 : !llvm.ptr -> !llvm.ptr
        %601 = llvm.load %592 : !llvm.ptr -> i32
        %602 = arith.extsi %601 : i32 to i64
        %603 = llvm.getelementptr %600[%602] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %598 = llvm.load %603 : !llvm.ptr -> i64
        %605 = llvm.mlir.addressof @g_tau_arr : !llvm.ptr
        %606 = llvm.load %605 : !llvm.ptr -> !llvm.ptr
        %607 = llvm.load %583 : !llvm.ptr -> i32
        %608 = llvm.load %592 : !llvm.ptr -> i32
        %609 = arith.subi %607, %608 : i32
        %610 = arith.extsi %609 : i32 to i64
        %611 = llvm.getelementptr %606[%610] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %604 = llvm.load %611 : !llvm.ptr -> i64
        %597 = func.call @mm(%598, %604) : (i64, i64) -> i64
        %612 = arith.addi %596, %597 : i64
        %613 = arith.remsi %612, %arg1 : i64
        llvm.store %613, %589 : i64, !llvm.ptr
        %614 = llvm.load %592 : !llvm.ptr -> i32
        %615 = arith.constant 1 : i32
        %616 = arith.addi %614, %615 : i32
        llvm.store %616, %592 : i32, !llvm.ptr
        cf.br ^bb99
      ^bb101:
      %618 = llvm.mlir.addressof @MOD : !llvm.ptr
      %619 = llvm.load %618 : !llvm.ptr -> i64
      %620 = arith.constant 24 : i32
      %622 = arith.extsi %620 : i32 to i64
      %621 = arith.subi %619, %622 : i64
      %623 = arith.remsi %621, %arg1 : i64
      %624 = llvm.load %589 : !llvm.ptr -> i64
      %617 = func.call @mm(%623, %624) : (i64, i64) -> i64
      %627 = llvm.mlir.addressof @g_inv_table : !llvm.ptr
      %628 = llvm.load %627 : !llvm.ptr -> !llvm.ptr
      %629 = llvm.load %583 : !llvm.ptr -> i32
      %630 = arith.constant 1 : i32
      %631 = arith.subi %629, %630 : i32
      %632 = arith.extsi %631 : i32 to i64
      %633 = llvm.getelementptr %628[%632] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %626 = llvm.load %633 : !llvm.ptr -> i64
      %625 = func.call @mm(%617, %626) : (i64, i64) -> i64
      %634 = llvm.mlir.addressof @g_tau_arr : !llvm.ptr
      %635 = llvm.load %634 : !llvm.ptr -> !llvm.ptr
      %636 = llvm.load %583 : !llvm.ptr -> i32
      %637 = arith.extsi %636 : i32 to i64
      %638 = llvm.getelementptr %635[%637] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %625, %638 : i64, !llvm.ptr
      %639 = llvm.load %583 : !llvm.ptr -> i32
      %640 = arith.constant 1 : i32
      %641 = arith.addi %639, %640 : i32
      llvm.store %641, %583 : i32, !llvm.ptr
      cf.br ^bb96
    ^bb98:
    func.return
  }
  func.func @mat_mul(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: i64, %arg8: i64) -> i64 {
    %642 = func.call @mm(%arg0, %arg4) : (i64, i64) -> i64
    %643 = func.call @mm(%arg1, %arg6) : (i64, i64) -> i64
    %644 = arith.addi %642, %643 : i64
    %645 = arith.remsi %644, %arg8 : i64
    %646 = func.call @mm(%arg0, %arg5) : (i64, i64) -> i64
    %647 = func.call @mm(%arg1, %arg7) : (i64, i64) -> i64
    %648 = arith.addi %646, %647 : i64
    %649 = arith.remsi %648, %arg8 : i64
    %650 = func.call @mm(%arg2, %arg4) : (i64, i64) -> i64
    %651 = func.call @mm(%arg3, %arg6) : (i64, i64) -> i64
    %652 = arith.addi %650, %651 : i64
    %653 = arith.remsi %652, %arg8 : i64
    %654 = func.call @mm(%arg2, %arg5) : (i64, i64) -> i64
    %655 = func.call @mm(%arg3, %arg7) : (i64, i64) -> i64
    %656 = arith.addi %654, %655 : i64
    %657 = arith.remsi %656, %arg8 : i64
    %658 = llvm.mlir.addressof @g_mat_r0 : !llvm.ptr
    llvm.store %645, %658 : i64, !llvm.ptr
    %659 = llvm.mlir.addressof @g_mat_r1 : !llvm.ptr
    llvm.store %649, %659 : i64, !llvm.ptr
    %660 = llvm.mlir.addressof @g_mat_r2 : !llvm.ptr
    llvm.store %653, %660 : i64, !llvm.ptr
    %661 = llvm.mlir.addressof @g_mat_r3 : !llvm.ptr
    llvm.store %657, %661 : i64, !llvm.ptr
    %662 = arith.constant 0 : i32
    %663 = arith.extsi %662 : i32 to i64
    func.return %663 : i64
  }
  // Module static: g_mat_r0
  llvm.mlir.global internal @g_mat_r0(0 : i64) : i64
  // Module static: g_mat_r1
  llvm.mlir.global internal @g_mat_r1(0 : i64) : i64
  // Module static: g_mat_r2
  llvm.mlir.global internal @g_mat_r2(0 : i64) : i64
  // Module static: g_mat_r3
  llvm.mlir.global internal @g_mat_r3(0 : i64) : i64
  func.func @tau_prime_power(%arg0: i32, %arg1: i32, %arg2: i64, %arg3: i64) -> i64 {
    %664 = arith.constant 0 : i32
    %665 = arith.cmpi eq, %arg1, %664 : i32
    cf.cond_br %665, ^bb102, ^bb103
    ^bb102:
      %666 = arith.constant 1 : i32
      %667 = arith.extsi %666 : i32 to i64
      func.return %667 : i64
    ^bb103:
      cf.br ^bb104
    ^bb104:
    %668 = arith.constant 1 : i32
    %669 = arith.cmpi eq, %arg1, %668 : i32
    cf.cond_br %669, ^bb105, ^bb106
    ^bb105:
      %670 = arith.remsi %arg2, %arg3 : i64
      func.return %670 : i64
    ^bb106:
      cf.br ^bb107
    ^bb107:
    %672 = arith.extsi %arg0 : i32 to i64
    %673 = arith.constant 11 : i32
    %674 = arith.extsi %673 : i32 to i64
    %671 = func.call @mod_pow(%672, %674, %arg3) : (i64, i64, i64) -> i64
    %675 = arith.remsi %arg2, %arg3 : i64
    %676 = llvm.mlir.constant(1 : i64) : i64
    %677 = llvm.alloca %676 x i64 : (i64) -> !llvm.ptr
    llvm.store %675, %677 : i64, !llvm.ptr
    %678 = arith.subi %arg3, %671 : i64
    %679 = arith.remsi %678, %arg3 : i64
    %680 = llvm.mlir.constant(1 : i64) : i64
    %681 = llvm.alloca %680 x i64 : (i64) -> !llvm.ptr
    llvm.store %679, %681 : i64, !llvm.ptr
    %682 = arith.constant 1 : i32
    %683 = arith.extsi %682 : i32 to i64
    %684 = llvm.mlir.constant(1 : i64) : i64
    %685 = llvm.alloca %684 x i64 : (i64) -> !llvm.ptr
    llvm.store %683, %685 : i64, !llvm.ptr
    %686 = arith.constant 0 : i32
    %687 = arith.extsi %686 : i32 to i64
    %688 = llvm.mlir.constant(1 : i64) : i64
    %689 = llvm.alloca %688 x i64 : (i64) -> !llvm.ptr
    llvm.store %687, %689 : i64, !llvm.ptr
    %690 = arith.constant 1 : i32
    %691 = arith.extsi %690 : i32 to i64
    %692 = llvm.mlir.constant(1 : i64) : i64
    %693 = llvm.alloca %692 x i64 : (i64) -> !llvm.ptr
    llvm.store %691, %693 : i64, !llvm.ptr
    %694 = arith.constant 0 : i32
    %695 = arith.extsi %694 : i32 to i64
    %696 = llvm.mlir.constant(1 : i64) : i64
    %697 = llvm.alloca %696 x i64 : (i64) -> !llvm.ptr
    llvm.store %695, %697 : i64, !llvm.ptr
    %698 = arith.constant 0 : i32
    %699 = arith.extsi %698 : i32 to i64
    %700 = llvm.mlir.constant(1 : i64) : i64
    %701 = llvm.alloca %700 x i64 : (i64) -> !llvm.ptr
    llvm.store %699, %701 : i64, !llvm.ptr
    %702 = arith.constant 1 : i32
    %703 = arith.extsi %702 : i32 to i64
    %704 = llvm.mlir.constant(1 : i64) : i64
    %705 = llvm.alloca %704 x i64 : (i64) -> !llvm.ptr
    llvm.store %703, %705 : i64, !llvm.ptr
    %706 = arith.constant 1 : i32
    %707 = arith.subi %arg1, %706 : i32
    %708 = llvm.mlir.constant(1 : i64) : i64
    %709 = llvm.alloca %708 x i32 : (i64) -> !llvm.ptr
    llvm.store %707, %709 : i32, !llvm.ptr
    cf.br ^bb108
    ^bb108:
    %710 = llvm.load %709 : !llvm.ptr -> i32
    %711 = arith.constant 0 : i32
    %712 = arith.cmpi sgt, %710, %711 : i32
    cf.cond_br %712, ^bb109, ^bb110
    ^bb109:
      %713 = llvm.load %709 : !llvm.ptr -> i32
      %714 = arith.constant 1 : i32
      %715 = arith.andi %713, %714 : i32
      %716 = arith.constant 1 : i32
      %717 = arith.cmpi eq, %715, %716 : i32
      cf.cond_br %717, ^bb111, ^bb112
      ^bb111:
        %719 = llvm.load %693 : !llvm.ptr -> i64
        %720 = llvm.load %697 : !llvm.ptr -> i64
        %721 = llvm.load %701 : !llvm.ptr -> i64
        %722 = llvm.load %705 : !llvm.ptr -> i64
        %723 = llvm.load %677 : !llvm.ptr -> i64
        %724 = llvm.load %681 : !llvm.ptr -> i64
        %725 = llvm.load %685 : !llvm.ptr -> i64
        %726 = llvm.load %689 : !llvm.ptr -> i64
        %718 = func.call @mat_mul(%719, %720, %721, %722, %723, %724, %725, %726, %arg3) : (i64, i64, i64, i64, i64, i64, i64, i64, i64) -> i64
        %727 = llvm.mlir.addressof @g_mat_r0 : !llvm.ptr
        %728 = llvm.load %727 : !llvm.ptr -> i64
        llvm.store %728, %693 : i64, !llvm.ptr
        %729 = llvm.mlir.addressof @g_mat_r1 : !llvm.ptr
        %730 = llvm.load %729 : !llvm.ptr -> i64
        llvm.store %730, %697 : i64, !llvm.ptr
        %731 = llvm.mlir.addressof @g_mat_r2 : !llvm.ptr
        %732 = llvm.load %731 : !llvm.ptr -> i64
        llvm.store %732, %701 : i64, !llvm.ptr
        %733 = llvm.mlir.addressof @g_mat_r3 : !llvm.ptr
        %734 = llvm.load %733 : !llvm.ptr -> i64
        llvm.store %734, %705 : i64, !llvm.ptr
        cf.br ^bb113
      ^bb112:
        cf.br ^bb113
      ^bb113:
      %736 = llvm.load %677 : !llvm.ptr -> i64
      %737 = llvm.load %681 : !llvm.ptr -> i64
      %738 = llvm.load %685 : !llvm.ptr -> i64
      %739 = llvm.load %689 : !llvm.ptr -> i64
      %740 = llvm.load %677 : !llvm.ptr -> i64
      %741 = llvm.load %681 : !llvm.ptr -> i64
      %742 = llvm.load %685 : !llvm.ptr -> i64
      %743 = llvm.load %689 : !llvm.ptr -> i64
      %735 = func.call @mat_mul(%736, %737, %738, %739, %740, %741, %742, %743, %arg3) : (i64, i64, i64, i64, i64, i64, i64, i64, i64) -> i64
      %744 = llvm.mlir.addressof @g_mat_r0 : !llvm.ptr
      %745 = llvm.load %744 : !llvm.ptr -> i64
      llvm.store %745, %677 : i64, !llvm.ptr
      %746 = llvm.mlir.addressof @g_mat_r1 : !llvm.ptr
      %747 = llvm.load %746 : !llvm.ptr -> i64
      llvm.store %747, %681 : i64, !llvm.ptr
      %748 = llvm.mlir.addressof @g_mat_r2 : !llvm.ptr
      %749 = llvm.load %748 : !llvm.ptr -> i64
      llvm.store %749, %685 : i64, !llvm.ptr
      %750 = llvm.mlir.addressof @g_mat_r3 : !llvm.ptr
      %751 = llvm.load %750 : !llvm.ptr -> i64
      llvm.store %751, %689 : i64, !llvm.ptr
      %752 = llvm.load %709 : !llvm.ptr -> i32
      %753 = arith.constant 1 : i32
      %754 = arith.shrsi %752, %753 : i32
      llvm.store %754, %709 : i32, !llvm.ptr
      cf.br ^bb108
    ^bb110:
    %756 = llvm.load %693 : !llvm.ptr -> i64
    %757 = arith.remsi %arg2, %arg3 : i64
    %755 = func.call @mm(%756, %757) : (i64, i64) -> i64
    %758 = llvm.load %697 : !llvm.ptr -> i64
    %759 = arith.addi %755, %758 : i64
    %760 = arith.remsi %759, %arg3 : i64
    func.return %760 : i64
  }
  func.func @tau_from_exps(%arg0: i64) -> i64 {
    %761 = arith.constant 1 : i32
    %762 = arith.extsi %761 : i32 to i64
    %763 = llvm.mlir.constant(1 : i64) : i64
    %764 = llvm.alloca %763 x i64 : (i64) -> !llvm.ptr
    llvm.store %762, %764 : i64, !llvm.ptr
    %765 = arith.constant 0 : i32
    %766 = llvm.mlir.constant(1 : i64) : i64
    %767 = llvm.alloca %766 x i32 : (i64) -> !llvm.ptr
    llvm.store %765, %767 : i32, !llvm.ptr
    cf.br ^bb114
    ^bb114:
    %768 = llvm.load %767 : !llvm.ptr -> i32
    %769 = llvm.mlir.addressof @g_num_exps : !llvm.ptr
    %770 = llvm.load %769 : !llvm.ptr -> i32
    %771 = arith.cmpi slt, %768, %770 : i32
    cf.cond_br %771, ^bb115, ^bb116
    ^bb115:
      %773 = llvm.mlir.addressof @g_prime_exps_p : !llvm.ptr
      %774 = llvm.load %773 : !llvm.ptr -> !llvm.ptr
      %775 = llvm.load %767 : !llvm.ptr -> i32
      %776 = arith.extsi %775 : i32 to i64
      %777 = llvm.getelementptr %774[%776] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %772 = llvm.load %777 : !llvm.ptr -> i32
      %779 = llvm.mlir.addressof @g_prime_exps_e : !llvm.ptr
      %780 = llvm.load %779 : !llvm.ptr -> !llvm.ptr
      %781 = llvm.load %767 : !llvm.ptr -> i32
      %782 = arith.extsi %781 : i32 to i64
      %783 = llvm.getelementptr %780[%782] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %778 = llvm.load %783 : !llvm.ptr -> i32
      %785 = llvm.load %764 : !llvm.ptr -> i64
      %788 = llvm.mlir.addressof @g_tau_arr : !llvm.ptr
      %789 = llvm.load %788 : !llvm.ptr -> !llvm.ptr
      %790 = arith.extsi %772 : i32 to i64
      %791 = llvm.getelementptr %789[%790] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %787 = llvm.load %791 : !llvm.ptr -> i64
      %786 = func.call @tau_prime_power(%772, %778, %787, %arg0) : (i32, i32, i64, i64) -> i64
      %784 = func.call @mm(%785, %786) : (i64, i64) -> i64
      llvm.store %784, %764 : i64, !llvm.ptr
      %792 = llvm.load %767 : !llvm.ptr -> i32
      %793 = arith.constant 1 : i32
      %794 = arith.addi %792, %793 : i32
      llvm.store %794, %767 : i32, !llvm.ptr
      cf.br ^bb114
    ^bb116:
    %795 = llvm.load %764 : !llvm.ptr -> i64
    func.return %795 : i64
  }
  func.func @init_e_coeff(%arg0: i64) -> () {
    %797 = arith.constant 691 : i32
    %798 = arith.constant 2 : i32
    %800 = arith.extsi %798 : i32 to i64
    %799 = arith.subi %arg0, %800 : i64
    %801 = arith.extsi %797 : i32 to i64
    %796 = func.call @mod_pow(%801, %799, %arg0) : (i64, i64, i64) -> i64
    %802 = arith.constant 24 : i32
    %804 = arith.extsi %802 : i32 to i64
    %803 = arith.subi %arg0, %804 : i64
    %805 = arith.remsi %803, %arg0 : i64
    %806 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %807 = llvm.load %806 : !llvm.ptr -> !llvm.ptr
    %808 = arith.constant 2 : i32
    %809 = arith.extsi %808 : i32 to i64
    %810 = llvm.getelementptr %807[%809] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %805, %810 : i64, !llvm.ptr
    %811 = arith.constant 240 : i32
    %813 = arith.extsi %811 : i32 to i64
    %812 = arith.remsi %813, %arg0 : i64
    %814 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %815 = llvm.load %814 : !llvm.ptr -> !llvm.ptr
    %816 = arith.constant 4 : i32
    %817 = arith.extsi %816 : i32 to i64
    %818 = llvm.getelementptr %815[%817] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %812, %818 : i64, !llvm.ptr
    %819 = arith.constant 504 : i32
    %821 = arith.extsi %819 : i32 to i64
    %820 = arith.subi %arg0, %821 : i64
    %822 = arith.remsi %820, %arg0 : i64
    %823 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %824 = llvm.load %823 : !llvm.ptr -> !llvm.ptr
    %825 = arith.constant 6 : i32
    %826 = arith.extsi %825 : i32 to i64
    %827 = llvm.getelementptr %824[%826] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %822, %827 : i64, !llvm.ptr
    %828 = arith.constant 480 : i32
    %830 = arith.extsi %828 : i32 to i64
    %829 = arith.remsi %830, %arg0 : i64
    %831 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %832 = llvm.load %831 : !llvm.ptr -> !llvm.ptr
    %833 = arith.constant 8 : i32
    %834 = arith.extsi %833 : i32 to i64
    %835 = llvm.getelementptr %832[%834] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %829, %835 : i64, !llvm.ptr
    %836 = arith.constant 264 : i32
    %838 = arith.extsi %836 : i32 to i64
    %837 = arith.subi %arg0, %838 : i64
    %839 = arith.remsi %837, %arg0 : i64
    %840 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %841 = llvm.load %840 : !llvm.ptr -> !llvm.ptr
    %842 = arith.constant 10 : i32
    %843 = arith.extsi %842 : i32 to i64
    %844 = llvm.getelementptr %841[%843] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %839, %844 : i64, !llvm.ptr
    %846 = arith.constant 65520 : i32
    %848 = arith.extsi %846 : i32 to i64
    %847 = arith.remsi %848, %arg0 : i64
    %845 = func.call @mm(%847, %796) : (i64, i64) -> i64
    %849 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %850 = llvm.load %849 : !llvm.ptr -> !llvm.ptr
    %851 = arith.constant 12 : i32
    %852 = arith.extsi %851 : i32 to i64
    %853 = llvm.getelementptr %850[%852] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %845, %853 : i64, !llvm.ptr
    func.return
  }
  func.func @build_sigma_data(%arg0: i64) -> () {
    %854 = arith.constant 1 : i32
    %855 = llvm.mlir.constant(1 : i64) : i64
    %856 = llvm.alloca %855 x i32 : (i64) -> !llvm.ptr
    llvm.store %854, %856 : i32, !llvm.ptr
    cf.br ^bb117
    ^bb117:
    %857 = llvm.load %856 : !llvm.ptr -> i32
    %858 = arith.constant 11 : i32
    %859 = arith.cmpi sle, %857, %858 : i32
    cf.cond_br %859, ^bb118, ^bb119
    ^bb118:
      %861 = llvm.load %856 : !llvm.ptr -> i32
      %862 = arith.extsi %861 : i32 to i64
      %860 = func.call @sigma_power_from_exps(%862, %arg0) : (i64, i64) -> i64
      %863 = llvm.mlir.addressof @g_sig : !llvm.ptr
      %864 = llvm.load %863 : !llvm.ptr -> !llvm.ptr
      %865 = llvm.load %856 : !llvm.ptr -> i32
      %866 = arith.extsi %865 : i32 to i64
      %867 = llvm.getelementptr %864[%866] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %860, %867 : i64, !llvm.ptr
      %868 = llvm.load %856 : !llvm.ptr -> i32
      %869 = arith.constant 2 : i32
      %870 = arith.addi %868, %869 : i32
      llvm.store %870, %856 : i32, !llvm.ptr
      cf.br ^bb117
    ^bb119:
    func.return
  }
  func.func @coeff_Ek(%arg0: i32, %arg1: i64) -> i64 {
    %871 = arith.constant 2 : i32
    %872 = arith.cmpi eq, %arg0, %871 : i32
    cf.cond_br %872, ^bb120, ^bb121
    ^bb120:
      %875 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
      %876 = llvm.load %875 : !llvm.ptr -> !llvm.ptr
      %877 = arith.constant 2 : i32
      %878 = arith.extsi %877 : i32 to i64
      %879 = llvm.getelementptr %876[%878] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %874 = llvm.load %879 : !llvm.ptr -> i64
      %881 = llvm.mlir.addressof @g_sig : !llvm.ptr
      %882 = llvm.load %881 : !llvm.ptr -> !llvm.ptr
      %883 = arith.constant 1 : i32
      %884 = arith.extsi %883 : i32 to i64
      %885 = llvm.getelementptr %882[%884] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %880 = llvm.load %885 : !llvm.ptr -> i64
      %873 = func.call @mm(%874, %880) : (i64, i64) -> i64
      func.return %873 : i64
    ^bb121:
      cf.br ^bb122
    ^bb122:
    %888 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %889 = llvm.load %888 : !llvm.ptr -> !llvm.ptr
    %890 = arith.extsi %arg0 : i32 to i64
    %891 = llvm.getelementptr %889[%890] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %887 = llvm.load %891 : !llvm.ptr -> i64
    %893 = llvm.mlir.addressof @g_sig : !llvm.ptr
    %894 = llvm.load %893 : !llvm.ptr -> !llvm.ptr
    %895 = arith.constant 1 : i32
    %896 = arith.subi %arg0, %895 : i32
    %897 = arith.extsi %896 : i32 to i64
    %898 = llvm.getelementptr %894[%897] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %892 = llvm.load %898 : !llvm.ptr -> i64
    %886 = func.call @mm(%887, %892) : (i64, i64) -> i64
    func.return %886 : i64
  }
  func.func @coeff_D_Ek(%arg0: i32, %arg1: i32, %arg2: !llvm.ptr, %arg3: i64) -> i64 {
    %901 = arith.extsi %arg1 : i32 to i64
    %902 = llvm.getelementptr %arg2[%901] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %900 = llvm.load %902 : !llvm.ptr -> i64
    %903 = func.call @coeff_Ek(%arg0, %arg3) : (i32, i64) -> i64
    %899 = func.call @mm(%900, %903) : (i64, i64) -> i64
    func.return %899 : i64
  }
  func.func @coeff_E2_pow(%arg0: i32, %arg1: !llvm.ptr, %arg2: i64, %arg3: i64) -> i64 {
    %904 = arith.constant 1 : i32
    %905 = arith.cmpi eq, %arg0, %904 : i32
    cf.cond_br %905, ^bb123, ^bb124
    ^bb123:
      %907 = arith.constant 2 : i32
      %906 = func.call @coeff_Ek(%907, %arg3) : (i32, i64) -> i64
      func.return %906 : i64
    ^bb124:
      cf.br ^bb125
    ^bb125:
    %908 = arith.constant 2 : i32
    %909 = arith.cmpi eq, %arg0, %908 : i32
    cf.cond_br %909, ^bb126, ^bb127
    ^bb126:
      %911 = arith.constant 4 : i32
      %910 = func.call @coeff_Ek(%911, %arg3) : (i32, i64) -> i64
      %913 = arith.constant 12 : i32
      %915 = arith.constant 2 : i32
      %916 = arith.constant 1 : i32
      %914 = func.call @coeff_D_Ek(%915, %916, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %917 = arith.extsi %913 : i32 to i64
      %912 = func.call @mm(%917, %914) : (i64, i64) -> i64
      %918 = arith.addi %910, %912 : i64
      %919 = arith.remsi %918, %arg3 : i64
      func.return %919 : i64
    ^bb127:
      cf.br ^bb128
    ^bb128:
    %920 = arith.constant 3 : i32
    %921 = arith.cmpi eq, %arg0, %920 : i32
    cf.cond_br %921, ^bb129, ^bb130
    ^bb129:
      %923 = arith.constant 6 : i32
      %922 = func.call @coeff_Ek(%923, %arg3) : (i32, i64) -> i64
      %925 = arith.constant 9 : i32
      %927 = arith.constant 4 : i32
      %928 = arith.constant 1 : i32
      %926 = func.call @coeff_D_Ek(%927, %928, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %929 = arith.extsi %925 : i32 to i64
      %924 = func.call @mm(%929, %926) : (i64, i64) -> i64
      %931 = arith.constant 72 : i32
      %933 = arith.constant 2 : i32
      %934 = arith.constant 2 : i32
      %932 = func.call @coeff_D_Ek(%933, %934, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %935 = arith.extsi %931 : i32 to i64
      %930 = func.call @mm(%935, %932) : (i64, i64) -> i64
      %936 = arith.addi %922, %924 : i64
      %937 = arith.addi %936, %930 : i64
      %938 = arith.remsi %937, %arg3 : i64
      func.return %938 : i64
    ^bb130:
      cf.br ^bb131
    ^bb131:
    %939 = arith.constant 4 : i32
    %940 = arith.cmpi eq, %arg0, %939 : i32
    cf.cond_br %940, ^bb132, ^bb133
    ^bb132:
      %942 = arith.constant 216 : i32
      %943 = llvm.mlir.addressof @g_inv5 : !llvm.ptr
      %944 = llvm.load %943 : !llvm.ptr -> i64
      %945 = arith.extsi %942 : i32 to i64
      %941 = func.call @mm(%945, %944) : (i64, i64) -> i64
      %947 = arith.constant 8 : i32
      %946 = func.call @coeff_Ek(%947, %arg3) : (i32, i64) -> i64
      %949 = arith.constant 8 : i32
      %951 = arith.constant 6 : i32
      %952 = arith.constant 1 : i32
      %950 = func.call @coeff_D_Ek(%951, %952, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %953 = arith.extsi %949 : i32 to i64
      %948 = func.call @mm(%953, %950) : (i64, i64) -> i64
      %956 = arith.constant 4 : i32
      %957 = arith.constant 2 : i32
      %955 = func.call @coeff_D_Ek(%956, %957, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %954 = func.call @mm(%941, %955) : (i64, i64) -> i64
      %959 = arith.constant 288 : i32
      %961 = arith.constant 2 : i32
      %962 = arith.constant 3 : i32
      %960 = func.call @coeff_D_Ek(%961, %962, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %963 = arith.extsi %959 : i32 to i64
      %958 = func.call @mm(%963, %960) : (i64, i64) -> i64
      %964 = arith.addi %946, %948 : i64
      %965 = arith.addi %964, %954 : i64
      %966 = arith.addi %965, %958 : i64
      %967 = arith.remsi %966, %arg3 : i64
      func.return %967 : i64
    ^bb133:
      cf.br ^bb134
    ^bb134:
    %968 = arith.constant 5 : i32
    %969 = arith.cmpi eq, %arg0, %968 : i32
    cf.cond_br %969, ^bb135, ^bb136
    ^bb135:
      %971 = arith.constant 15 : i32
      %972 = llvm.mlir.addressof @g_inv2 : !llvm.ptr
      %973 = llvm.load %972 : !llvm.ptr -> i64
      %974 = arith.extsi %971 : i32 to i64
      %970 = func.call @mm(%974, %973) : (i64, i64) -> i64
      %976 = arith.constant 240 : i32
      %977 = llvm.mlir.addressof @g_inv7 : !llvm.ptr
      %978 = llvm.load %977 : !llvm.ptr -> i64
      %979 = arith.extsi %976 : i32 to i64
      %975 = func.call @mm(%979, %978) : (i64, i64) -> i64
      %981 = arith.constant 10 : i32
      %980 = func.call @coeff_Ek(%981, %arg3) : (i32, i64) -> i64
      %984 = arith.constant 8 : i32
      %985 = arith.constant 1 : i32
      %983 = func.call @coeff_D_Ek(%984, %985, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %982 = func.call @mm(%970, %983) : (i64, i64) -> i64
      %988 = arith.constant 6 : i32
      %989 = arith.constant 2 : i32
      %987 = func.call @coeff_D_Ek(%988, %989, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %986 = func.call @mm(%975, %987) : (i64, i64) -> i64
      %991 = arith.constant 144 : i32
      %993 = arith.constant 4 : i32
      %994 = arith.constant 3 : i32
      %992 = func.call @coeff_D_Ek(%993, %994, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %995 = arith.extsi %991 : i32 to i64
      %990 = func.call @mm(%995, %992) : (i64, i64) -> i64
      %997 = arith.constant 864 : i32
      %999 = arith.constant 2 : i32
      %1000 = arith.constant 4 : i32
      %998 = func.call @coeff_D_Ek(%999, %1000, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
      %1001 = arith.extsi %997 : i32 to i64
      %996 = func.call @mm(%1001, %998) : (i64, i64) -> i64
      %1002 = arith.addi %980, %982 : i64
      %1003 = arith.addi %1002, %986 : i64
      %1004 = arith.addi %1003, %990 : i64
      %1005 = arith.addi %1004, %996 : i64
      %1006 = arith.remsi %1005, %arg3 : i64
      func.return %1006 : i64
    ^bb136:
      cf.br ^bb137
    ^bb137:
    %1008 = arith.constant 36 : i32
    %1009 = llvm.mlir.addressof @g_inv5 : !llvm.ptr
    %1010 = llvm.load %1009 : !llvm.ptr -> i64
    %1011 = arith.extsi %1008 : i32 to i64
    %1007 = func.call @mm(%1011, %1010) : (i64, i64) -> i64
    %1013 = arith.constant 720 : i32
    %1014 = llvm.mlir.addressof @g_inv7 : !llvm.ptr
    %1015 = llvm.load %1014 : !llvm.ptr -> i64
    %1016 = arith.extsi %1013 : i32 to i64
    %1012 = func.call @mm(%1016, %1015) : (i64, i64) -> i64
    %1018 = arith.constant 2592 : i32
    %1019 = llvm.mlir.addressof @g_inv7 : !llvm.ptr
    %1020 = llvm.load %1019 : !llvm.ptr -> i64
    %1021 = arith.extsi %1018 : i32 to i64
    %1017 = func.call @mm(%1021, %1020) : (i64, i64) -> i64
    %1023 = arith.constant 10368 : i32
    %1024 = llvm.mlir.addressof @g_inv5 : !llvm.ptr
    %1025 = llvm.load %1024 : !llvm.ptr -> i64
    %1026 = arith.extsi %1023 : i32 to i64
    %1022 = func.call @mm(%1026, %1025) : (i64, i64) -> i64
    %1028 = arith.constant 4608 : i32
    %1030 = arith.extsi %1028 : i32 to i64
    %1029 = arith.subi %arg3, %1030 : i64
    %1031 = arith.remsi %1029, %arg3 : i64
    %1032 = llvm.mlir.addressof @g_inv24185 : !llvm.ptr
    %1033 = llvm.load %1032 : !llvm.ptr -> i64
    %1027 = func.call @mm(%1031, %1033) : (i64, i64) -> i64
    %1035 = arith.constant 12 : i32
    %1034 = func.call @coeff_Ek(%1035, %arg3) : (i32, i64) -> i64
    %1037 = arith.remsi %arg2, %arg3 : i64
    %1036 = func.call @mm(%1027, %1037) : (i64, i64) -> i64
    %1040 = arith.constant 10 : i32
    %1041 = arith.constant 1 : i32
    %1039 = func.call @coeff_D_Ek(%1040, %1041, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
    %1038 = func.call @mm(%1007, %1039) : (i64, i64) -> i64
    %1043 = arith.constant 30 : i32
    %1045 = arith.constant 8 : i32
    %1046 = arith.constant 2 : i32
    %1044 = func.call @coeff_D_Ek(%1045, %1046, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
    %1047 = arith.extsi %1043 : i32 to i64
    %1042 = func.call @mm(%1047, %1044) : (i64, i64) -> i64
    %1050 = arith.constant 6 : i32
    %1051 = arith.constant 3 : i32
    %1049 = func.call @coeff_D_Ek(%1050, %1051, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
    %1048 = func.call @mm(%1012, %1049) : (i64, i64) -> i64
    %1054 = arith.constant 4 : i32
    %1055 = arith.constant 4 : i32
    %1053 = func.call @coeff_D_Ek(%1054, %1055, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
    %1052 = func.call @mm(%1017, %1053) : (i64, i64) -> i64
    %1058 = arith.constant 2 : i32
    %1059 = arith.constant 5 : i32
    %1057 = func.call @coeff_D_Ek(%1058, %1059, %arg1, %arg3) : (i32, i32, !llvm.ptr, i64) -> i64
    %1056 = func.call @mm(%1022, %1057) : (i64, i64) -> i64
    %1060 = arith.addi %1034, %1036 : i64
    %1061 = arith.addi %1060, %1038 : i64
    %1062 = arith.addi %1061, %1042 : i64
    %1063 = arith.addi %1062, %1048 : i64
    %1064 = arith.addi %1063, %1052 : i64
    %1065 = arith.addi %1064, %1056 : i64
    %1066 = arith.remsi %1065, %arg3 : i64
    func.return %1066 : i64
  }
  func.func @comb_small(%arg0: i32, %arg1: i32) -> i64 {
    %1067 = arith.constant 0 : i32
    %1068 = arith.cmpi slt, %arg1, %1067 : i32
    %1069 = scf.if %1068 -> (i1) {
      %1070 = arith.constant true
      scf.yield %1070 : i1
    } else {
      %1071 = arith.cmpi sgt, %arg1, %arg0 : i32
      scf.yield %1071 : i1
    }
    cf.cond_br %1069, ^bb138, ^bb139
    ^bb138:
      %1072 = arith.constant 0 : i32
      %1073 = arith.extsi %1072 : i32 to i64
      func.return %1073 : i64
    ^bb139:
      cf.br ^bb140
    ^bb140:
    %1074 = arith.subi %arg0, %arg1 : i32
    %1075 = arith.cmpi sgt, %arg1, %1074 : i32
    cf.cond_br %1075, ^bb141, ^bb142
    ^bb141:
      %1077 = arith.subi %arg0, %arg1 : i32
      %1076 = func.call @comb_small(%arg0, %1077) : (i32, i32) -> i64
      func.return %1076 : i64
    ^bb142:
      cf.br ^bb143
    ^bb143:
    %1078 = arith.constant 1 : i32
    %1079 = arith.extsi %1078 : i32 to i64
    %1080 = llvm.mlir.constant(1 : i64) : i64
    %1081 = llvm.alloca %1080 x i64 : (i64) -> !llvm.ptr
    llvm.store %1079, %1081 : i64, !llvm.ptr
    %1082 = arith.constant 1 : i32
    %1083 = arith.extsi %1082 : i32 to i64
    %1084 = llvm.mlir.constant(1 : i64) : i64
    %1085 = llvm.alloca %1084 x i64 : (i64) -> !llvm.ptr
    llvm.store %1083, %1085 : i64, !llvm.ptr
    %1086 = arith.constant 1 : i32
    %1087 = llvm.mlir.constant(1 : i64) : i64
    %1088 = llvm.alloca %1087 x i32 : (i64) -> !llvm.ptr
    llvm.store %1086, %1088 : i32, !llvm.ptr
    cf.br ^bb144
    ^bb144:
    %1089 = llvm.load %1088 : !llvm.ptr -> i32
    %1090 = arith.cmpi sle, %1089, %arg1 : i32
    cf.cond_br %1090, ^bb145, ^bb146
    ^bb145:
      %1091 = llvm.load %1081 : !llvm.ptr -> i64
      %1092 = llvm.load %1088 : !llvm.ptr -> i32
      %1093 = arith.subi %arg1, %1092 : i32
      %1094 = arith.subi %arg0, %1093 : i32
      %1095 = arith.extsi %1094 : i32 to i64
      %1096 = arith.muli %1091, %1095 : i64
      llvm.store %1096, %1081 : i64, !llvm.ptr
      %1097 = llvm.load %1085 : !llvm.ptr -> i64
      %1098 = llvm.load %1088 : !llvm.ptr -> i32
      %1099 = arith.extsi %1098 : i32 to i64
      %1100 = arith.muli %1097, %1099 : i64
      llvm.store %1100, %1085 : i64, !llvm.ptr
      %1101 = llvm.load %1088 : !llvm.ptr -> i32
      %1102 = arith.constant 1 : i32
      %1103 = arith.addi %1101, %1102 : i32
      llvm.store %1103, %1088 : i32, !llvm.ptr
      cf.br ^bb144
    ^bb146:
    %1104 = llvm.load %1081 : !llvm.ptr -> i64
    %1105 = llvm.load %1085 : !llvm.ptr -> i64
    %1106 = arith.divsi %1104, %1105 : i64
    func.return %1106 : i64
  }
  func.func @R_dim_at_n(%arg0: i32, %arg1: !llvm.ptr, %arg2: i64, %arg3: i64) -> i64 {
    %1108 = arith.constant 12 : i32
    %1109 = arith.constant 2 : i32
    %1111 = arith.extsi %1109 : i32 to i64
    %1110 = arith.subi %arg3, %1111 : i64
    %1112 = arith.extsi %1108 : i32 to i64
    %1107 = func.call @mod_pow(%1112, %1110, %arg3) : (i64, i64, i64) -> i64
    %1114 = arith.extsi %arg0 : i32 to i64
    %1113 = func.call @mod_pow(%1107, %1114, %arg3) : (i64, i64, i64) -> i64
    %1115 = arith.constant 0 : i32
    %1116 = arith.extsi %1115 : i32 to i64
    %1117 = llvm.mlir.constant(1 : i64) : i64
    %1118 = llvm.alloca %1117 x i64 : (i64) -> !llvm.ptr
    llvm.store %1116, %1118 : i64, !llvm.ptr
    %1119 = arith.constant 1 : i32
    %1120 = llvm.mlir.constant(1 : i64) : i64
    %1121 = llvm.alloca %1120 x i32 : (i64) -> !llvm.ptr
    llvm.store %1119, %1121 : i32, !llvm.ptr
    cf.br ^bb147
    ^bb147:
    %1122 = llvm.load %1121 : !llvm.ptr -> i32
    %1123 = arith.cmpi sle, %1122, %arg0 : i32
    cf.cond_br %1123, ^bb148, ^bb149
    ^bb148:
      %1125 = llvm.load %1121 : !llvm.ptr -> i32
      %1124 = func.call @comb_small(%arg0, %1125) : (i32, i32) -> i64
      %1128 = llvm.load %1121 : !llvm.ptr -> i32
      %1127 = func.call @coeff_E2_pow(%1128, %arg1, %arg2, %arg3) : (i32, !llvm.ptr, i64, i64) -> i64
      %1126 = func.call @mm(%1124, %1127) : (i64, i64) -> i64
      %1129 = llvm.load %1121 : !llvm.ptr -> i32
      %1130 = arith.constant 2 : i32
      %1131 = arith.remsi %1129, %1130 : i32
      %1132 = arith.constant 1 : i32
      %1133 = arith.cmpi eq, %1131, %1132 : i32
      cf.cond_br %1133, ^bb150, ^bb151
      ^bb150:
        %1134 = llvm.load %1118 : !llvm.ptr -> i64
        %1135 = arith.remsi %1126, %arg3 : i64
        %1136 = arith.subi %1134, %1135 : i64
        %1137 = arith.addi %1136, %arg3 : i64
        %1138 = arith.remsi %1137, %arg3 : i64
        llvm.store %1138, %1118 : i64, !llvm.ptr
        cf.br ^bb152
      ^bb151:
        %1139 = llvm.load %1118 : !llvm.ptr -> i64
        %1140 = arith.addi %1139, %1126 : i64
        %1141 = arith.remsi %1140, %arg3 : i64
        llvm.store %1141, %1118 : i64, !llvm.ptr
        cf.br ^bb152
      ^bb152:
      %1142 = llvm.load %1121 : !llvm.ptr -> i32
      %1143 = arith.constant 1 : i32
      %1144 = arith.addi %1142, %1143 : i32
      llvm.store %1144, %1121 : i32, !llvm.ptr
      cf.br ^bb147
    ^bb149:
    %1146 = llvm.load %1118 : !llvm.ptr -> i64
    %1145 = func.call @mm(%1146, %1113) : (i64, i64) -> i64
    func.return %1145 : i64
  }
  func.func @main() -> i32 {
    %1147 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1148 = llvm.load %1147 : !llvm.ptr -> i64
    %1150 = arith.constant 2000 : i32
    %1151 = arith.constant 4 : i32
    %1152 = arith.extsi %1150 : i32 to i64
    %1153 = arith.extsi %1151 : i32 to i64
    %1149 = func.call @calloc(%1152, %1153) : (i64, i64) -> !llvm.ptr
    %1154 = llvm.mlir.addressof @g_prime_exps_p : !llvm.ptr
    llvm.store %1149, %1154 : !llvm.ptr, !llvm.ptr
    %1156 = arith.constant 2000 : i32
    %1157 = arith.constant 4 : i32
    %1158 = arith.extsi %1156 : i32 to i64
    %1159 = arith.extsi %1157 : i32 to i64
    %1155 = func.call @calloc(%1158, %1159) : (i64, i64) -> !llvm.ptr
    %1160 = llvm.mlir.addressof @g_prime_exps_e : !llvm.ptr
    llvm.store %1155, %1160 : !llvm.ptr, !llvm.ptr
    %1162 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %1163 = llvm.load %1162 : !llvm.ptr -> i64
    %1164 = arith.constant 1 : i32
    %1166 = arith.extsi %1164 : i32 to i64
    %1165 = arith.addi %1163, %1166 : i64
    %1167 = arith.constant 8 : i32
    %1168 = arith.extsi %1167 : i32 to i64
    %1161 = func.call @calloc(%1165, %1168) : (i64, i64) -> !llvm.ptr
    %1169 = llvm.mlir.addressof @g_inv_table : !llvm.ptr
    llvm.store %1161, %1169 : !llvm.ptr, !llvm.ptr
    %1171 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %1172 = llvm.load %1171 : !llvm.ptr -> i64
    %1173 = arith.constant 1 : i32
    %1175 = arith.extsi %1173 : i32 to i64
    %1174 = arith.addi %1172, %1175 : i64
    %1176 = arith.constant 8 : i32
    %1177 = arith.extsi %1176 : i32 to i64
    %1170 = func.call @calloc(%1174, %1177) : (i64, i64) -> !llvm.ptr
    %1178 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
    llvm.store %1170, %1178 : !llvm.ptr, !llvm.ptr
    %1180 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %1181 = llvm.load %1180 : !llvm.ptr -> i64
    %1182 = arith.constant 1 : i32
    %1184 = arith.extsi %1182 : i32 to i64
    %1183 = arith.addi %1181, %1184 : i64
    %1185 = arith.constant 8 : i32
    %1186 = arith.extsi %1185 : i32 to i64
    %1179 = func.call @calloc(%1183, %1186) : (i64, i64) -> !llvm.ptr
    %1187 = llvm.mlir.addressof @g_tau_arr : !llvm.ptr
    llvm.store %1179, %1187 : !llvm.ptr, !llvm.ptr
    %1189 = arith.constant 13 : i32
    %1190 = arith.constant 8 : i32
    %1191 = arith.extsi %1189 : i32 to i64
    %1192 = arith.extsi %1190 : i32 to i64
    %1188 = func.call @calloc(%1191, %1192) : (i64, i64) -> !llvm.ptr
    %1193 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    llvm.store %1188, %1193 : !llvm.ptr, !llvm.ptr
    %1195 = arith.constant 13 : i32
    %1196 = arith.constant 8 : i32
    %1197 = arith.extsi %1195 : i32 to i64
    %1198 = arith.extsi %1196 : i32 to i64
    %1194 = func.call @calloc(%1197, %1198) : (i64, i64) -> !llvm.ptr
    %1199 = llvm.mlir.addressof @g_sig : !llvm.ptr
    llvm.store %1194, %1199 : !llvm.ptr, !llvm.ptr
    func.call @sieve() : () -> ()
    %1201 = arith.constant 1 : i32
    %1203 = arith.extsi %1201 : i32 to i64
    %1202 = arith.addi %1148, %1203 : i64
    %1204 = arith.constant 2 : i32
    %1206 = arith.extsi %1204 : i32 to i64
    %1205 = arith.divsi %1202, %1206 : i64
    %1207 = llvm.mlir.addressof @g_inv2 : !llvm.ptr
    llvm.store %1205, %1207 : i64, !llvm.ptr
    %1209 = arith.constant 5 : i32
    %1210 = arith.constant 2 : i32
    %1212 = arith.extsi %1210 : i32 to i64
    %1211 = arith.subi %1148, %1212 : i64
    %1213 = arith.extsi %1209 : i32 to i64
    %1208 = func.call @mod_pow(%1213, %1211, %1148) : (i64, i64, i64) -> i64
    %1214 = llvm.mlir.addressof @g_inv5 : !llvm.ptr
    llvm.store %1208, %1214 : i64, !llvm.ptr
    %1216 = arith.constant 7 : i32
    %1217 = arith.constant 2 : i32
    %1219 = arith.extsi %1217 : i32 to i64
    %1218 = arith.subi %1148, %1219 : i64
    %1220 = arith.extsi %1216 : i32 to i64
    %1215 = func.call @mod_pow(%1220, %1218, %1148) : (i64, i64, i64) -> i64
    %1221 = llvm.mlir.addressof @g_inv7 : !llvm.ptr
    llvm.store %1215, %1221 : i64, !llvm.ptr
    %1223 = arith.constant 24185 : i32
    %1224 = arith.constant 2 : i32
    %1226 = arith.extsi %1224 : i32 to i64
    %1225 = arith.subi %1148, %1226 : i64
    %1227 = arith.extsi %1223 : i32 to i64
    %1222 = func.call @mod_pow(%1227, %1225, %1148) : (i64, i64, i64) -> i64
    %1228 = llvm.mlir.addressof @g_inv24185 : !llvm.ptr
    llvm.store %1222, %1228 : i64, !llvm.ptr
    func.call @init_e_coeff(%1148) : (i64) -> ()
    %1231 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %1232 = llvm.load %1231 : !llvm.ptr -> i64
    %1233 = arith.trunci %1232 : i64 to i32
    func.call @precompute_tau(%1233, %1148) : (i32, i64) -> ()
    %1235 = llvm.mlir.addressof @LIMIT : !llvm.ptr
    %1236 = llvm.load %1235 : !llvm.ptr -> i64
    %1237 = arith.trunci %1236 : i64 to i32
    func.call @factorial_prime_exponents(%1237) : (i32) -> ()
    func.call @build_sigma_data(%1148) : (i64) -> ()
    %1239 = func.call @n_mod_from_exps(%1148) : (i64) -> i64
    %1241 = arith.constant 6 : i32
    %1242 = arith.constant 8 : i32
    %1243 = arith.extsi %1241 : i32 to i64
    %1244 = arith.extsi %1242 : i32 to i64
    %1240 = func.call @calloc(%1243, %1244) : (i64, i64) -> !llvm.ptr
    %1245 = arith.constant 1 : i32
    %1246 = arith.constant 0 : i32
    %1247 = arith.extsi %1245 : i32 to i64
    %1248 = arith.extsi %1246 : i32 to i64
    %1249 = llvm.getelementptr %1240[%1248] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1247, %1249 : i64, !llvm.ptr
    %1250 = arith.constant 1 : i32
    %1251 = llvm.mlir.constant(1 : i64) : i64
    %1252 = llvm.alloca %1251 x i32 : (i64) -> !llvm.ptr
    llvm.store %1250, %1252 : i32, !llvm.ptr
    cf.br ^bb153
    ^bb153:
    %1253 = llvm.load %1252 : !llvm.ptr -> i32
    %1254 = arith.constant 5 : i32
    %1255 = arith.cmpi sle, %1253, %1254 : i32
    cf.cond_br %1255, ^bb154, ^bb155
    ^bb154:
      %1258 = llvm.load %1252 : !llvm.ptr -> i32
      %1259 = arith.constant 1 : i32
      %1260 = arith.subi %1258, %1259 : i32
      %1261 = arith.extsi %1260 : i32 to i64
      %1262 = llvm.getelementptr %1240[%1261] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1257 = llvm.load %1262 : !llvm.ptr -> i64
      %1256 = func.call @mm(%1257, %1239) : (i64, i64) -> i64
      %1263 = llvm.load %1252 : !llvm.ptr -> i32
      %1264 = arith.extsi %1263 : i32 to i64
      %1265 = llvm.getelementptr %1240[%1264] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1256, %1265 : i64, !llvm.ptr
      %1266 = llvm.load %1252 : !llvm.ptr -> i32
      %1267 = arith.constant 1 : i32
      %1268 = arith.addi %1266, %1267 : i32
      llvm.store %1268, %1252 : i32, !llvm.ptr
      cf.br ^bb153
    ^bb155:
    %1269 = func.call @tau_from_exps(%1148) : (i64) -> i64
    %1271 = arith.constant 6 : i32
    %1270 = func.call @R_dim_at_n(%1271, %1240, %1269, %1148) : (i32, !llvm.ptr, i64, i64) -> i64
    %1272 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %1273 = llvm.call @printf(%1272, %1270) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%1240) : (!llvm.ptr) -> ()
    %1276 = llvm.mlir.addressof @g_is_prime : !llvm.ptr
    %1277 = llvm.load %1276 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1277) : (!llvm.ptr) -> ()
    %1279 = llvm.mlir.addressof @g_primes : !llvm.ptr
    %1280 = llvm.load %1279 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1280) : (!llvm.ptr) -> ()
    %1282 = llvm.mlir.addressof @g_prime_exps_p : !llvm.ptr
    %1283 = llvm.load %1282 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1283) : (!llvm.ptr) -> ()
    %1285 = llvm.mlir.addressof @g_prime_exps_e : !llvm.ptr
    %1286 = llvm.load %1285 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1286) : (!llvm.ptr) -> ()
    %1288 = llvm.mlir.addressof @g_inv_table : !llvm.ptr
    %1289 = llvm.load %1288 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1289) : (!llvm.ptr) -> ()
    %1291 = llvm.mlir.addressof @g_sigma1 : !llvm.ptr
    %1292 = llvm.load %1291 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1292) : (!llvm.ptr) -> ()
    %1294 = llvm.mlir.addressof @g_tau_arr : !llvm.ptr
    %1295 = llvm.load %1294 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1295) : (!llvm.ptr) -> ()
    %1297 = llvm.mlir.addressof @g_E_coeff : !llvm.ptr
    %1298 = llvm.load %1297 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1298) : (!llvm.ptr) -> ()
    %1300 = llvm.mlir.addressof @g_sig : !llvm.ptr
    %1301 = llvm.load %1300 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1301) : (!llvm.ptr) -> ()
    %1302 = arith.constant 0 : i32
    func.return %1302 : i32
  }
}