Problem 553

Power Sets of Power Sets — EGF log/exp via NTT. Ported from C to pure Flow. MOD = 10^9+7.

Answer57717170
Output57717170
StatusPASS
Native helperno
Runtime830 ms
Peak memory5968 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 553
# Power Sets of Power Sets — EGF log/exp via NTT.
# Ported from C to pure Flow. MOD = 10^9+7.

import euler.nt { mod_pow }

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

const MOD: i64 = 1000000007
const P1: i64 = 998244353
const P2: i64 = 1004535809
const P3: i64 = 469762049

let mut g_inv_p1_mod_p2: i64 = -1
let mut g_inv_p12_mod_p3: i64 = -1
let mut g_P12_hi: i64 = 0
let mut g_P12_lo: i64 = 0

function mod_inv(a: i64, mod: i64) -> i64 {
    return mod_pow(a, mod - 2, mod)
}

function ntt(a: ptr<i64>, n: i64, invert: i32, mod: i64, root: i64) -> void {
    let mut j: i64 = 0
    let mut i: i64 = 1
    while i < n {
        let mut bit: i64 = n >> 1
        while (j & bit) != 0 {
            j = j ^ bit
            bit = bit >> 1
        }
        j = j ^ bit
        if i < j {
            let tmp: i64 = a[i]
            a[i] = a[j]
            a[j] = tmp
        }
        i = i + 1
    }
    let mut length: i64 = 2
    while length <= n {
        let wlen: i64 = mod_pow(root, (mod - 1) / length, mod)
        let mut wl: i64 = wlen
        if invert == 1 { wl = mod_pow(wlen, mod - 2, mod) }
        let half: i64 = length >> 1
        i = 0
        while i < n {
            let mut w: i64 = 1
            let mut jj: i64 = 0
            while jj < half {
                let u: i64 = a[i + jj]
                let v: i64 = ((a[i + jj + half] as i128) * (w as i128) % (mod as i128)) as i64
                let mut x: i64 = u + v
                if x >= mod { x = x - mod }
                let mut y: i64 = u - v
                if y < 0 { y = y + mod }
                a[i + jj] = x
                a[i + jj + half] = y
                w = ((w as i128) * (wl as i128) % (mod as i128)) as i64
                jj = jj + 1
            }
            i = i + length
        }
        length = length << 1
    }
    if invert == 1 {
        let inv_n: i64 = mod_pow(n, mod - 2, mod)
        i = 0
        while i < n {
            a[i] = ((a[i] as i128) * (inv_n as i128) % (mod as i128)) as i64
            i = i + 1
        }
    }
}

function convolve_one(a: ptr<i64>, n1: i64, b: ptr<i64>, n2: i64, mod: i64, root: i64, out_n: ptr<i64>) -> ptr<i64> {
    let need: i64 = n1 + n2 - 1
    let mut n: i64 = 1
    while n < need { n = n << 1 }
    let fa: ptr<i64> = calloc(n, 8) as ptr<i64>
    let fb: ptr<i64> = calloc(n, 8) as ptr<i64>
    let mut i: i64 = 0
    while i < n1 { fa[i] = a[i] % mod; i = i + 1 }
    i = 0
    while i < n2 { fb[i] = b[i] % mod; i = i + 1 }
    ntt(fa, n, 0, mod, root)
    ntt(fb, n, 0, mod, root)
    i = 0
    while i < n {
        fa[i] = ((fa[i] as i128) * (fb[i] as i128) % (mod as i128)) as i64
        i = i + 1
    }
    ntt(fa, n, 1, mod, root)
    out_n[0] = need
    let res: ptr<i64> = malloc(need * 8) as ptr<i64>
    i = 0
    while i < need { res[i] = fa[i]; i = i + 1 }
    free(fa as ptr<void>)
    free(fb as ptr<void>)
    return res
}

function crt3(a1: i64, a2: i64, a3: i64) -> i64 {
    if g_inv_p1_mod_p2 < 0 {
        g_inv_p1_mod_p2 = mod_inv(P1 % P2, P2)
        let p12: i128 = (P1 as i128) * (P2 as i128)
        g_P12_lo = (p12 & ((1 as i128) << 63) - 1) as i64
        g_P12_hi = (p12 >> 63) as i64
        g_inv_p12_mod_p3 = mod_inv((p12 % (P3 as i128)) as i64, P3)
    }
    let mut t1: i64 = ((a2 - a1) % P2)
    if t1 < 0 { t1 = t1 + P2 }
    t1 = ((t1 as i128) * (g_inv_p1_mod_p2 as i128) % (P2 as i128)) as i64
    let x2: i128 = (a1 as i128) + (P1 as i128) * (t1 as i128)
    let mut t2: i64 = ((a3 - (x2 % (P3 as i128)) as i64) % P3)
    if t2 < 0 { t2 = t2 + P3 }
    t2 = ((t2 as i128) * (g_inv_p12_mod_p3 as i128) % (P3 as i128)) as i64
    let p12: i128 = ((g_P12_hi as i128) << 63) + (g_P12_lo as i128)
    let x: i128 = x2 + p12 * (t2 as i128)
    let mut r: i64 = (x % (MOD as i128)) as i64
    if r < 0 { r = r + MOD }
    return r
}

function convolve_mod(a: ptr<i64>, n1: i64, b: ptr<i64>, n2: i64, out_n: ptr<i64>) -> ptr<i64> {
    if n1 == 0 || n2 == 0 { out_n[0] = 0; return null as ptr<i64> }
    let o1p: ptr<i64> = calloc(1, 8) as ptr<i64>
    let o2p: ptr<i64> = calloc(1, 8) as ptr<i64>
    let o3p: ptr<i64> = calloc(1, 8) as ptr<i64>
    let c1: ptr<i64> = convolve_one(a, n1, b, n2, P1, 3, o1p)
    let c2: ptr<i64> = convolve_one(a, n1, b, n2, P2, 3, o2p)
    let c3: ptr<i64> = convolve_one(a, n1, b, n2, P3, 3, o3p)
    let need: i64 = n1 + n2 - 1
    let res: ptr<i64> = malloc(need * 8) as ptr<i64>
    let mut i: i64 = 0
    while i < need { res[i] = crt3(c1[i], c2[i], c3[i]); i = i + 1 }
    free(c1 as ptr<void>)
    free(c2 as ptr<void>)
    free(c3 as ptr<void>)
    free(o1p as ptr<void>)
    free(o2p as ptr<void>)
    free(o3p as ptr<void>)
    out_n[0] = need
    return res
}

function poly_inv(f: ptr<i64>, deg: i64) -> ptr<i64> {
    let mut g: ptr<i64> = calloc(deg, 8) as ptr<i64>
    g[0] = mod_inv(f[0], MOD)
    let mut m: i64 = 1
    while m < deg {
        let m2: i64 = m * 2
        let mut m2c: i64 = m2
        if m2c > deg { m2c = deg }
        let onp: ptr<i64> = calloc(1, 8) as ptr<i64>
        let fg: ptr<i64> = convolve_mod(f, m2c, g, m, onp)
        let on: i64 = onp[0]
        if on > m2c { on = m2c }
        free(onp as ptr<void>)
        let h: ptr<i64> = calloc(m2c, 8) as ptr<i64>
        let mut i: i64 = 0
        while i < on && i < m2c {
            h[i] = (MOD - fg[i]) % MOD
            i = i + 1
        }
        h[0] = (h[0] + 2) % MOD
        free(fg as ptr<void>)
        let onp2: ptr<i64> = calloc(1, 8) as ptr<i64>
        let ng: ptr<i64> = convolve_mod(g, m, h, m2c, onp2)
        free(onp2 as ptr<void>)
        free(g as ptr<void>)
        free(h as ptr<void>)
        let gnew: ptr<i64> = calloc(m2c, 8) as ptr<i64>
        i = 0
        while i < m2c { gnew[i] = ng[i]; i = i + 1 }
        free(ng as ptr<void>)
        g = gnew
        m = m2c
    }
    return g
}

function poly_log(f: ptr<i64>, deg: i64, inv_int: ptr<i64>) -> ptr<i64> {
    let df: ptr<i64> = malloc((deg - 1) * 8) as ptr<i64>
    let mut i: i64 = 1
    while i < deg {
        df[i - 1] = ((i as i128) * (f[i] as i128) % (MOD as i128)) as i64
        i = i + 1
    }
    let invf: ptr<i64> = poly_inv(f, deg)
    let onp: ptr<i64> = calloc(1, 8) as ptr<i64>
    let prod: ptr<i64> = convolve_mod(df, deg - 1, invf, deg, onp)
    let on: i64 = onp[0]
    free(onp as ptr<void>)
    let res: ptr<i64> = calloc(deg, 8) as ptr<i64>
    i = 1
    while i < deg {
        if i - 1 < on {
            res[i] = ((prod[i - 1] as i128) * (inv_int[i] as i128) % (MOD as i128)) as i64
        }
        i = i + 1
    }
    free(df as ptr<void>)
    free(invf as ptr<void>)
    free(prod as ptr<void>)
    return res
}

function poly_pow(a: ptr<i64>, deg: i64, exp0: i64) -> ptr<i64> {
    let mut res: ptr<i64> = calloc(deg, 8) as ptr<i64>
    res[0] = 1
    let mut base: ptr<i64> = malloc(deg * 8) as ptr<i64>
    let mut i: i64 = 0
    while i < deg { base[i] = a[i]; i = i + 1 }
    let mut e: i64 = exp0
    while e > 0 {
        if e % 2 == 1 {
            let onp: ptr<i64> = calloc(1, 8) as ptr<i64>
            let tmp: ptr<i64> = convolve_mod(res, deg, base, deg, onp)
            let on: i64 = onp[0]
            free(onp as ptr<void>)
            i = 0
            while i < deg { res[i] = 0; i = i + 1 }
            i = 0
            while i < deg && i < on { res[i] = tmp[i]; i = i + 1 }
            free(tmp as ptr<void>)
        }
        e = e / 2
        if e > 0 {
            let onp2: ptr<i64> = calloc(1, 8) as ptr<i64>
            let tmp2: ptr<i64> = convolve_mod(base, deg, base, deg, onp2)
            let on2: i64 = onp2[0]
            free(onp2 as ptr<void>)
            i = 0
            while i < deg { base[i] = 0; i = i + 1 }
            i = 0
            while i < deg && i < on2 { base[i] = tmp2[i]; i = i + 1 }
            free(tmp2 as ptr<void>)
        }
    }
    free(base as ptr<void>)
    return res
}

function precompute(n: i64, fact: ptr<i64>, inv_fact: ptr<i64>, inv_int: ptr<i64>) -> void {
    fact[0] = 1
    let mut i: i64 = 1
    while i <= n {
        fact[i] = ((fact[i - 1] as i128) * (i as i128) % (MOD as i128)) as i64
        i = i + 1
    }
    inv_fact[n] = mod_inv(fact[n], MOD)
    i = n
    while i > 0 {
        inv_fact[i - 1] = ((inv_fact[i] as i128) * (i as i128) % (MOD as i128)) as i64
        i = i - 1
    }
    inv_int[0] = 0
    if n >= 1 { inv_int[1] = 1 }
    i = 2
    while i <= n {
        inv_int[i] = MOD - ((MOD / i) as i128 * (inv_int[MOD % i] as i128) % (MOD as i128)) as i64
        i = i + 1
    }
}

function compute_A(max_n: i64, inv_fact: ptr<i64>, inv_int: ptr<i64>) -> ptr<i64> {
    let modm1: i64 = MOD - 1
    let exp2: ptr<i64> = malloc((max_n + 1) * 8) as ptr<i64>
    exp2[0] = 1
    let mut i: i64 = 1
    while i <= max_n {
        exp2[i] = (exp2[i - 1] * 2) % modm1
        i = i + 1
    }
    let A0: ptr<i64> = malloc((max_n + 1) * 8) as ptr<i64>
    i = 0
    while i <= max_n {
        A0[i] = mod_pow(2, (exp2[i] - 1) % modm1, MOD)
        i = i + 1
    }
    let p: ptr<i64> = malloc((max_n + 1) * 8) as ptr<i64>
    let q: ptr<i64> = malloc((max_n + 1) * 8) as ptr<i64>
    i = 0
    while i <= max_n {
        p[i] = ((A0[i] as i128) * (inv_fact[i] as i128) % (MOD as i128)) as i64
        if i % 2 == 1 {
            q[i] = (MOD - inv_fact[i]) % MOD
        } else {
            q[i] = inv_fact[i]
        }
        i = i + 1
    }
    let onp: ptr<i64> = calloc(1, 8) as ptr<i64>
    let H: ptr<i64> = convolve_mod(p, max_n + 1, q, max_n + 1, onp)
    let on: i64 = onp[0]
    free(onp as ptr<void>)
    let H2: ptr<i64> = calloc((max_n + 1), 8) as ptr<i64>
    i = 0
    while i <= max_n && i < on { H2[i] = H[i]; i = i + 1 }
    H2[0] = 1
    free(H as ptr<void>)
    let A: ptr<i64> = poly_log(H2, max_n + 1, inv_int)
    free(exp2 as ptr<void>)
    free(A0 as ptr<void>)
    free(p as ptr<void>)
    free(q as ptr<void>)
    free(H2 as ptr<void>)
    return A
}

function C_nk(n: i64, k: i64, A_series: ptr<i64>, fact: ptr<i64>, inv_fact: ptr<i64>) -> i64 {
    let deg: i64 = n + 1
    let Ak: ptr<i64> = poly_pow(A_series, deg, k)
    let onp: ptr<i64> = calloc(1, 8) as ptr<i64>
    let prod: ptr<i64> = convolve_mod(Ak, deg, inv_fact, deg, onp)
    let on: i64 = onp[0]
    free(onp as ptr<void>)
    let pn: i64 = if n < on { prod[n] } else { 0 }
    let ans: i64 = ((fact[n] as i128) * (pn as i128) % (MOD as i128) * (inv_fact[k] as i128) % (MOD as i128)) as i64
    free(Ak as ptr<void>)
    free(prod as ptr<void>)
    return ans
}

function main() -> i32 {
    let N: i64 = 10000
    let K: i64 = 10
    let fact: ptr<i64> = malloc((N + 1) * 8) as ptr<i64>
    let inv_fact: ptr<i64> = malloc((N + 1) * 8) as ptr<i64>
    let inv_int: ptr<i64> = malloc((N + 1) * 8) as ptr<i64>
    precompute(N, fact, inv_fact, inv_int)
    let A: ptr<i64> = compute_A(N, inv_fact, inv_int)
    let ans: i64 = C_nk(N, K, A, fact, inv_fact)
    free(fact as ptr<void>)
    free(inv_fact as ptr<void>)
    free(inv_int as ptr<void>)
    free(A as ptr<void>)
    printf("%lld\n", ans)
    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 mod_inv_i64_i64(int64_t a, int64_t mod);
void ntt_ptr_i64_i64_i32_i64_i64(int64_t* a, int64_t n, int32_t invert, int64_t mod, int64_t root);
int64_t* convolve_one_ptr_i64_i64_ptr_i64_i64_i64_i64_ptr_i64(int64_t* a, int64_t n1, int64_t* b, int64_t n2, int64_t mod, int64_t root, int64_t* out_n);
int64_t crt3_i64_i64_i64(int64_t a1, int64_t a2, int64_t a3);
int64_t* convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(int64_t* a, int64_t n1, int64_t* b, int64_t n2, int64_t* out_n);
int64_t* poly_inv_ptr_i64_i64(int64_t* f, int64_t deg);
int64_t* poly_log_ptr_i64_i64_ptr_i64(int64_t* f, int64_t deg, int64_t* inv_int);
int64_t* poly_pow_ptr_i64_i64_i64(int64_t* a, int64_t deg, int64_t exp0);
void precompute_i64_ptr_i64_ptr_i64_ptr_i64(int64_t n, int64_t* fact, int64_t* inv_fact, int64_t* inv_int);
int64_t* compute_A_i64_ptr_i64_ptr_i64(int64_t max_n, int64_t* inv_fact, int64_t* inv_int);
int64_t C_nk_i64_i64_ptr_i64_ptr_i64_ptr_i64(int64_t n, int64_t k, int64_t* A_series, int64_t* fact, int64_t* inv_fact);
int32_t main(void);

static const int64_t MOD = 1000000007;
static const int64_t P1 = 998244353;
static const int64_t P2 = 1004535809;
static const int64_t P3 = 469762049;

/* Module statics */
static int64_t g_inv_p1_mod_p2 = (-1);
static int64_t g_inv_p12_mod_p3 = (-1);
static int64_t g_P12_hi = 0;
static int64_t g_P12_lo = 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 mod_inv_i64_i64(int64_t a, int64_t mod) {
    return mod_pow_i64_i64_i64(a, (mod - 2), mod);
}

void ntt_ptr_i64_i64_i32_i64_i64(int64_t* a, int64_t n, int32_t invert, int64_t mod, int64_t root) {
    int64_t j = 0;
    int64_t i = 1;
    while (i < n) {
        int64_t bit = FLOW_CHECKED_SHR((n), (1));
        while ((j & bit) != 0) {
            j = (j ^ bit);
            bit = FLOW_CHECKED_SHR((bit), (1));
        }
        j = (j ^ bit);
        if (i < j) {
            int64_t tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
        i = (i + 1);
    }
    int64_t length = 2;
    while (length <= n) {
        int64_t wlen = mod_pow_i64_i64_i64(root, FLOW_CHECKED_DIV(((mod - 1)), (length)), mod);
        int64_t wl = wlen;
        if (invert == 1) {
            wl = mod_pow_i64_i64_i64(wlen, (mod - 2), mod);
        }
        int64_t half = FLOW_CHECKED_SHR((length), (1));
        i = 0;
        while (i < n) {
            int64_t w = 1;
            int64_t jj = 0;
            while (jj < half) {
                int64_t u = a[(i + jj)];
                int64_t v = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(a[((i + jj) + half)])) * ((__int128)(w)))), (((__int128)(mod))))));
                int64_t x = (u + v);
                if (x >= mod) {
                    x = (x - mod);
                }
                int64_t y = (u - v);
                if (y < 0) {
                    y = (y + mod);
                }
                a[(i + jj)] = x;
                a[((i + jj) + half)] = y;
                w = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(w)) * ((__int128)(wl)))), (((__int128)(mod))))));
                jj = (jj + 1);
            }
            i = (i + length);
        }
        length = FLOW_CHECKED_SHL((length), (1));
    }
    if (invert == 1) {
        int64_t inv_n = mod_pow_i64_i64_i64(n, (mod - 2), mod);
        i = 0;
        while (i < n) {
            a[i] = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(a[i])) * ((__int128)(inv_n)))), (((__int128)(mod))))));
            i = (i + 1);
        }
    }
}

int64_t* convolve_one_ptr_i64_i64_ptr_i64_i64_i64_i64_ptr_i64(int64_t* a, int64_t n1, int64_t* b, int64_t n2, int64_t mod, int64_t root, int64_t* out_n) {
    int64_t need = ((n1 + n2) - 1);
    int64_t n = 1;
    while (n < need) {
        n = FLOW_CHECKED_SHL((n), (1));
    }
    int64_t* fa = (int64_t*)(((int64_t*)(calloc(n, 8))));
    int64_t* fb = (int64_t*)(((int64_t*)(calloc(n, 8))));
    int64_t i = 0;
    while (i < n1) {
        fa[i] = FLOW_CHECKED_MOD((a[i]), (mod));
        i = (i + 1);
    }
    i = 0;
    while (i < n2) {
        fb[i] = FLOW_CHECKED_MOD((b[i]), (mod));
        i = (i + 1);
    }
    ntt_ptr_i64_i64_i32_i64_i64(fa, n, 0, mod, root);
    ntt_ptr_i64_i64_i32_i64_i64(fb, n, 0, mod, root);
    i = 0;
    while (i < n) {
        fa[i] = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(fa[i])) * ((__int128)(fb[i])))), (((__int128)(mod))))));
        i = (i + 1);
    }
    ntt_ptr_i64_i64_i32_i64_i64(fa, n, 1, mod, root);
    out_n[0] = need;
    int64_t* res = (int64_t*)(((int64_t*)(malloc((need * 8)))));
    i = 0;
    while (i < need) {
        res[i] = fa[i];
        i = (i + 1);
    }
    free(((void*)(fa)));
    free(((void*)(fb)));
    return res;
}

int64_t crt3_i64_i64_i64(int64_t a1, int64_t a2, int64_t a3) {
    if (g_inv_p1_mod_p2 < 0) {
        g_inv_p1_mod_p2 = mod_inv_i64_i64(FLOW_CHECKED_MOD((P1), (P2)), P2);
        __int128 p12 = (((__int128)(P1)) * ((__int128)(P2)));
        g_P12_lo = ((int64_t)((p12 & (FLOW_CHECKED_SHL((((__int128)(1))), (63)) - 1))));
        g_P12_hi = ((int64_t)(FLOW_CHECKED_SHR((p12), (63))));
        g_inv_p12_mod_p3 = mod_inv_i64_i64(((int64_t)(FLOW_CHECKED_MOD((p12), (((__int128)(P3)))))), P3);
    }
    int64_t t1 = FLOW_CHECKED_MOD(((a2 - a1)), (P2));
    if (t1 < 0) {
        t1 = (t1 + P2);
    }
    t1 = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(t1)) * ((__int128)(g_inv_p1_mod_p2)))), (((__int128)(P2))))));
    __int128 x2 = (((__int128)(a1)) + (((__int128)(P1)) * ((__int128)(t1))));
    int64_t t2 = FLOW_CHECKED_MOD(((a3 - ((int64_t)(FLOW_CHECKED_MOD((x2), (((__int128)(P3)))))))), (P3));
    if (t2 < 0) {
        t2 = (t2 + P3);
    }
    t2 = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(t2)) * ((__int128)(g_inv_p12_mod_p3)))), (((__int128)(P3))))));
    __int128 p12 = (FLOW_CHECKED_SHL((((__int128)(g_P12_hi))), (63)) + ((__int128)(g_P12_lo)));
    __int128 x = (x2 + (p12 * ((__int128)(t2))));
    int64_t r = ((int64_t)(FLOW_CHECKED_MOD((x), (((__int128)(MOD))))));
    if (r < 0) {
        r = (r + MOD);
    }
    return r;
}

int64_t* convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(int64_t* a, int64_t n1, int64_t* b, int64_t n2, int64_t* out_n) {
    if ((n1 == 0 || n2 == 0)) {
        out_n[0] = 0;
        return ((int64_t*)(NULL));
    }
    int64_t* o1p = (int64_t*)(((int64_t*)(calloc(1, 8))));
    int64_t* o2p = (int64_t*)(((int64_t*)(calloc(1, 8))));
    int64_t* o3p = (int64_t*)(((int64_t*)(calloc(1, 8))));
    int64_t* c1 = (int64_t*)(convolve_one_ptr_i64_i64_ptr_i64_i64_i64_i64_ptr_i64(a, n1, b, n2, P1, 3, o1p));
    int64_t* c2 = (int64_t*)(convolve_one_ptr_i64_i64_ptr_i64_i64_i64_i64_ptr_i64(a, n1, b, n2, P2, 3, o2p));
    int64_t* c3 = (int64_t*)(convolve_one_ptr_i64_i64_ptr_i64_i64_i64_i64_ptr_i64(a, n1, b, n2, P3, 3, o3p));
    int64_t need = ((n1 + n2) - 1);
    int64_t* res = (int64_t*)(((int64_t*)(malloc((need * 8)))));
    int64_t i = 0;
    while (i < need) {
        res[i] = crt3_i64_i64_i64(c1[i], c2[i], c3[i]);
        i = (i + 1);
    }
    free(((void*)(c1)));
    free(((void*)(c2)));
    free(((void*)(c3)));
    free(((void*)(o1p)));
    free(((void*)(o2p)));
    free(((void*)(o3p)));
    out_n[0] = need;
    return res;
}

int64_t* poly_inv_ptr_i64_i64(int64_t* f, int64_t deg) {
    int64_t* g = (int64_t*)(((int64_t*)(calloc(deg, 8))));
    g[0] = mod_inv_i64_i64(f[0], MOD);
    int64_t m = 1;
    while (m < deg) {
        int64_t m2 = (m * 2);
        int64_t m2c = m2;
        if (m2c > deg) {
            m2c = deg;
        }
        int64_t* onp = (int64_t*)(((int64_t*)(calloc(1, 8))));
        int64_t* fg = (int64_t*)(convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(f, m2c, g, m, onp));
        int64_t on = onp[0];
        if (on > m2c) {
            on = m2c;
        }
        free(((void*)(onp)));
        int64_t* h = (int64_t*)(((int64_t*)(calloc(m2c, 8))));
        int64_t i = 0;
        while ((i < on && i < m2c)) {
            h[i] = FLOW_CHECKED_MOD(((MOD - fg[i])), (MOD));
            i = (i + 1);
        }
        h[0] = FLOW_CHECKED_MOD(((h[0] + 2)), (MOD));
        free(((void*)(fg)));
        int64_t* onp2 = (int64_t*)(((int64_t*)(calloc(1, 8))));
        int64_t* ng = (int64_t*)(convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(g, m, h, m2c, onp2));
        free(((void*)(onp2)));
        free(((void*)(g)));
        free(((void*)(h)));
        int64_t* gnew = (int64_t*)(((int64_t*)(calloc(m2c, 8))));
        i = 0;
        while (i < m2c) {
            gnew[i] = ng[i];
            i = (i + 1);
        }
        free(((void*)(ng)));
        g = gnew;
        m = m2c;
    }
    return g;
}

int64_t* poly_log_ptr_i64_i64_ptr_i64(int64_t* f, int64_t deg, int64_t* inv_int) {
    int64_t* df = (int64_t*)(((int64_t*)(malloc(((deg - 1) * 8)))));
    int64_t i = 1;
    while (i < deg) {
        df[(i - 1)] = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(i)) * ((__int128)(f[i])))), (((__int128)(MOD))))));
        i = (i + 1);
    }
    int64_t* invf = (int64_t*)(poly_inv_ptr_i64_i64(f, deg));
    int64_t* onp = (int64_t*)(((int64_t*)(calloc(1, 8))));
    int64_t* prod = (int64_t*)(convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(df, (deg - 1), invf, deg, onp));
    int64_t on = onp[0];
    free(((void*)(onp)));
    int64_t* res = (int64_t*)(((int64_t*)(calloc(deg, 8))));
    i = 1;
    while (i < deg) {
        if ((i - 1) < on) {
            res[i] = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(prod[(i - 1)])) * ((__int128)(inv_int[i])))), (((__int128)(MOD))))));
        }
        i = (i + 1);
    }
    free(((void*)(df)));
    free(((void*)(invf)));
    free(((void*)(prod)));
    return res;
}

int64_t* poly_pow_ptr_i64_i64_i64(int64_t* a, int64_t deg, int64_t exp0) {
    int64_t* res = (int64_t*)(((int64_t*)(calloc(deg, 8))));
    res[0] = 1;
    int64_t* base = (int64_t*)(((int64_t*)(malloc((deg * 8)))));
    int64_t i = 0;
    while (i < deg) {
        base[i] = a[i];
        i = (i + 1);
    }
    int64_t e = exp0;
    while (e > 0) {
        if (FLOW_CHECKED_MOD((e), (2)) == 1) {
            int64_t* onp = (int64_t*)(((int64_t*)(calloc(1, 8))));
            int64_t* tmp = (int64_t*)(convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(res, deg, base, deg, onp));
            int64_t on = onp[0];
            free(((void*)(onp)));
            i = 0;
            while (i < deg) {
                res[i] = 0;
                i = (i + 1);
            }
            i = 0;
            while ((i < deg && i < on)) {
                res[i] = tmp[i];
                i = (i + 1);
            }
            free(((void*)(tmp)));
        }
        e = FLOW_CHECKED_DIV((e), (2));
        if (e > 0) {
            int64_t* onp2 = (int64_t*)(((int64_t*)(calloc(1, 8))));
            int64_t* tmp2 = (int64_t*)(convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(base, deg, base, deg, onp2));
            int64_t on2 = onp2[0];
            free(((void*)(onp2)));
            i = 0;
            while (i < deg) {
                base[i] = 0;
                i = (i + 1);
            }
            i = 0;
            while ((i < deg && i < on2)) {
                base[i] = tmp2[i];
                i = (i + 1);
            }
            free(((void*)(tmp2)));
        }
    }
    free(((void*)(base)));
    return res;
}

void precompute_i64_ptr_i64_ptr_i64_ptr_i64(int64_t n, int64_t* fact, int64_t* inv_fact, int64_t* inv_int) {
    fact[0] = 1;
    int64_t i = 1;
    while (i <= n) {
        fact[i] = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(fact[(i - 1)])) * ((__int128)(i)))), (((__int128)(MOD))))));
        i = (i + 1);
    }
    inv_fact[n] = mod_inv_i64_i64(fact[n], MOD);
    i = n;
    while (i > 0) {
        inv_fact[(i - 1)] = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(inv_fact[i])) * ((__int128)(i)))), (((__int128)(MOD))))));
        i = (i - 1);
    }
    inv_int[0] = 0;
    if (n >= 1) {
        inv_int[1] = 1;
    }
    i = 2;
    while (i <= n) {
        inv_int[i] = (MOD - ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(FLOW_CHECKED_DIV((MOD), (i)))) * ((__int128)(inv_int[FLOW_CHECKED_MOD((MOD), (i))])))), (((__int128)(MOD)))))));
        i = (i + 1);
    }
}

int64_t* compute_A_i64_ptr_i64_ptr_i64(int64_t max_n, int64_t* inv_fact, int64_t* inv_int) {
    int64_t modm1 = (MOD - 1);
    int64_t* exp2 = (int64_t*)(((int64_t*)(malloc(((max_n + 1) * 8)))));
    exp2[0] = 1;
    int64_t i = 1;
    while (i <= max_n) {
        exp2[i] = FLOW_CHECKED_MOD(((exp2[(i - 1)] * 2)), (modm1));
        i = (i + 1);
    }
    int64_t* A0 = (int64_t*)(((int64_t*)(malloc(((max_n + 1) * 8)))));
    i = 0;
    while (i <= max_n) {
        A0[i] = mod_pow_i64_i64_i64(2, FLOW_CHECKED_MOD(((exp2[i] - 1)), (modm1)), MOD);
        i = (i + 1);
    }
    int64_t* p = (int64_t*)(((int64_t*)(malloc(((max_n + 1) * 8)))));
    int64_t* q = (int64_t*)(((int64_t*)(malloc(((max_n + 1) * 8)))));
    i = 0;
    while (i <= max_n) {
        p[i] = ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(A0[i])) * ((__int128)(inv_fact[i])))), (((__int128)(MOD))))));
        if (FLOW_CHECKED_MOD((i), (2)) == 1) {
            q[i] = FLOW_CHECKED_MOD(((MOD - inv_fact[i])), (MOD));
        } else {
            q[i] = inv_fact[i];
        }
        i = (i + 1);
    }
    int64_t* onp = (int64_t*)(((int64_t*)(calloc(1, 8))));
    int64_t* H = (int64_t*)(convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(p, (max_n + 1), q, (max_n + 1), onp));
    int64_t on = onp[0];
    free(((void*)(onp)));
    int64_t* H2 = (int64_t*)(((int64_t*)(calloc((max_n + 1), 8))));
    i = 0;
    while ((i <= max_n && i < on)) {
        H2[i] = H[i];
        i = (i + 1);
    }
    H2[0] = 1;
    free(((void*)(H)));
    int64_t* A = (int64_t*)(poly_log_ptr_i64_i64_ptr_i64(H2, (max_n + 1), inv_int));
    free(((void*)(exp2)));
    free(((void*)(A0)));
    free(((void*)(p)));
    free(((void*)(q)));
    free(((void*)(H2)));
    return A;
}

int64_t C_nk_i64_i64_ptr_i64_ptr_i64_ptr_i64(int64_t n, int64_t k, int64_t* A_series, int64_t* fact, int64_t* inv_fact) {
    int64_t deg = (n + 1);
    int64_t* Ak = (int64_t*)(poly_pow_ptr_i64_i64_i64(A_series, deg, k));
    int64_t* onp = (int64_t*)(((int64_t*)(calloc(1, 8))));
    int64_t* prod = (int64_t*)(convolve_mod_ptr_i64_i64_ptr_i64_i64_ptr_i64(Ak, deg, inv_fact, deg, onp));
    int64_t on = onp[0];
    free(((void*)(onp)));
    int64_t pn = ((n < on) ? (prod[n]) : (0));
    int64_t ans = ((int64_t)(FLOW_CHECKED_MOD(((FLOW_CHECKED_MOD(((((__int128)(fact[n])) * ((__int128)(pn)))), (((__int128)(MOD)))) * ((__int128)(inv_fact[k])))), (((__int128)(MOD))))));
    free(((void*)(Ak)));
    free(((void*)(prod)));
    return ans;
}

int32_t main(void) {
    int64_t N = 10000;
    int64_t K = 10;
    int64_t* fact = (int64_t*)(((int64_t*)(malloc(((N + 1) * 8)))));
    int64_t* inv_fact = (int64_t*)(((int64_t*)(malloc(((N + 1) * 8)))));
    int64_t* inv_int = (int64_t*)(((int64_t*)(malloc(((N + 1) * 8)))));
    precompute_i64_ptr_i64_ptr_i64_ptr_i64(N, fact, inv_fact, inv_int);
    int64_t* A = (int64_t*)(compute_A_i64_ptr_i64_ptr_i64(N, inv_fact, inv_int));
    int64_t ans = C_nk_i64_i64_ptr_i64_ptr_i64_ptr_i64(N, K, A, fact, inv_fact);
    free(((void*)(fact)));
    free(((void*)(inv_fact)));
    free(((void*)(inv_int)));
    free(((void*)(A)));
    printf("%lld\n", ans);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%lld\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func @gcd(%arg0: i64, %arg1: i64) -> i64 {
    %0 = llvm.mlir.constant(1 : i64) : i64
    %1 = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %1 : i64, !llvm.ptr
    %2 = llvm.mlir.constant(1 : i64) : i64
    %3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %3 : i64, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %4 = llvm.load %3 : !llvm.ptr -> i64
    %5 = arith.constant 0 : i32
    %7 = arith.extsi %5 : i32 to i64
    %6 = arith.cmpi ne, %4, %7 : i64
    cf.cond_br %6, ^bb1, ^bb2
    ^bb1:
      %8 = llvm.load %1 : !llvm.ptr -> i64
      %9 = llvm.load %3 : !llvm.ptr -> i64
      %10 = arith.remsi %8, %9 : i64
      %11 = llvm.load %3 : !llvm.ptr -> i64
      llvm.store %11, %1 : i64, !llvm.ptr
      llvm.store %10, %3 : i64, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    %12 = llvm.load %1 : !llvm.ptr -> i64
    func.return %12 : i64
  }
  func.func @lcm(%arg0: i64, %arg1: i64) -> i64 {
    %13 = arith.constant 0 : i32
    %15 = arith.extsi %13 : i32 to i64
    %14 = arith.cmpi eq, %arg0, %15 : i64
    %16 = scf.if %14 -> (i1) {
      %17 = arith.constant true
      scf.yield %17 : i1
    } else {
      %18 = arith.constant 0 : i32
      %20 = arith.extsi %18 : i32 to i64
      %19 = arith.cmpi eq, %arg1, %20 : i64
      scf.yield %19 : i1
    }
    cf.cond_br %16, ^bb3, ^bb4
    ^bb3:
      %21 = arith.constant 0 : i32
      %22 = arith.extsi %21 : i32 to i64
      func.return %22 : i64
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %23 = func.call @gcd(%arg0, %arg1) : (i64, i64) -> i64
    %24 = arith.divsi %arg0, %23 : i64
    %25 = arith.muli %24, %arg1 : i64
    func.return %25 : i64
  }
  func.func @isqrt(%arg0: i64) -> i64 {
    %26 = arith.constant 2 : i32
    %28 = arith.extsi %26 : i32 to i64
    %27 = arith.cmpi slt, %arg0, %28 : i64
    cf.cond_br %27, ^bb6, ^bb7
    ^bb6:
      func.return %arg0 : i64
    ^bb7:
      cf.br ^bb8
    ^bb8:
    %29 = llvm.mlir.constant(1 : i64) : i64
    %30 = llvm.alloca %29 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %30 : i64, !llvm.ptr
    %31 = llvm.load %30 : !llvm.ptr -> i64
    %32 = arith.constant 1 : i32
    %34 = arith.extsi %32 : i32 to i64
    %33 = arith.addi %31, %34 : i64
    %35 = arith.constant 2 : i32
    %37 = arith.extsi %35 : i32 to i64
    %36 = arith.divsi %33, %37 : i64
    %38 = llvm.mlir.constant(1 : i64) : i64
    %39 = llvm.alloca %38 x i64 : (i64) -> !llvm.ptr
    llvm.store %36, %39 : i64, !llvm.ptr
    cf.br ^bb9
    ^bb9:
    %40 = llvm.load %39 : !llvm.ptr -> i64
    %41 = llvm.load %30 : !llvm.ptr -> i64
    %42 = arith.cmpi slt, %40, %41 : i64
    cf.cond_br %42, ^bb10, ^bb11
    ^bb10:
      %43 = llvm.load %39 : !llvm.ptr -> i64
      llvm.store %43, %30 : i64, !llvm.ptr
      %44 = llvm.load %30 : !llvm.ptr -> i64
      %45 = llvm.load %30 : !llvm.ptr -> i64
      %46 = arith.divsi %arg0, %45 : i64
      %47 = arith.addi %44, %46 : i64
      %48 = arith.constant 2 : i32
      %50 = arith.extsi %48 : i32 to i64
      %49 = arith.divsi %47, %50 : i64
      llvm.store %49, %39 : i64, !llvm.ptr
      cf.br ^bb9
    ^bb11:
    %51 = llvm.load %30 : !llvm.ptr -> i64
    func.return %51 : i64
  }
  func.func @mulmod(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %52 = arith.remsi %arg0, %arg2 : i64
    %53 = llvm.mlir.constant(1 : i64) : i64
    %54 = llvm.alloca %53 x i64 : (i64) -> !llvm.ptr
    llvm.store %52, %54 : i64, !llvm.ptr
    %55 = arith.remsi %arg1, %arg2 : i64
    %56 = llvm.mlir.constant(1 : i64) : i64
    %57 = llvm.alloca %56 x i64 : (i64) -> !llvm.ptr
    llvm.store %55, %57 : i64, !llvm.ptr
    %58 = arith.constant 0 : i32
    %59 = arith.extsi %58 : i32 to i64
    %60 = llvm.mlir.constant(1 : i64) : i64
    %61 = llvm.alloca %60 x i64 : (i64) -> !llvm.ptr
    llvm.store %59, %61 : i64, !llvm.ptr
    cf.br ^bb12
    ^bb12:
    %62 = llvm.load %57 : !llvm.ptr -> i64
    %63 = arith.constant 0 : i32
    %65 = arith.extsi %63 : i32 to i64
    %64 = arith.cmpi sgt, %62, %65 : i64
    cf.cond_br %64, ^bb13, ^bb14
    ^bb13:
      %66 = llvm.load %57 : !llvm.ptr -> i64
      %67 = arith.constant 2 : i32
      %69 = arith.extsi %67 : i32 to i64
      %68 = arith.remsi %66, %69 : i64
      %70 = arith.constant 1 : i32
      %72 = arith.extsi %70 : i32 to i64
      %71 = arith.cmpi eq, %68, %72 : i64
      cf.cond_br %71, ^bb15, ^bb16
      ^bb15:
        %73 = llvm.load %61 : !llvm.ptr -> i64
        %74 = llvm.load %54 : !llvm.ptr -> i64
        %75 = arith.addi %73, %74 : i64
        %76 = arith.remsi %75, %arg2 : i64
        llvm.store %76, %61 : i64, !llvm.ptr
        cf.br ^bb17
      ^bb16:
        cf.br ^bb17
      ^bb17:
      %77 = llvm.load %54 : !llvm.ptr -> i64
      %78 = arith.constant 2 : i32
      %80 = arith.extsi %78 : i32 to i64
      %79 = arith.muli %77, %80 : i64
      %81 = arith.remsi %79, %arg2 : i64
      llvm.store %81, %54 : i64, !llvm.ptr
      %82 = llvm.load %57 : !llvm.ptr -> i64
      %83 = arith.constant 2 : i32
      %85 = arith.extsi %83 : i32 to i64
      %84 = arith.divsi %82, %85 : i64
      llvm.store %84, %57 : i64, !llvm.ptr
      cf.br ^bb12
    ^bb14:
    %86 = llvm.load %61 : !llvm.ptr -> i64
    func.return %86 : i64
  }
  func.func @mod_pow(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %87 = arith.constant 1 : i32
    %89 = arith.extsi %87 : i32 to i64
    %88 = arith.cmpi eq, %arg2, %89 : i64
    cf.cond_br %88, ^bb18, ^bb19
    ^bb18:
      %90 = arith.constant 0 : i32
      %91 = arith.extsi %90 : i32 to i64
      func.return %91 : i64
    ^bb19:
      cf.br ^bb20
    ^bb20:
    %92 = arith.constant 1 : i32
    %93 = arith.extsi %92 : i32 to i64
    %94 = llvm.mlir.constant(1 : i64) : i64
    %95 = llvm.alloca %94 x i64 : (i64) -> !llvm.ptr
    llvm.store %93, %95 : i64, !llvm.ptr
    %96 = arith.remsi %arg0, %arg2 : i64
    %97 = llvm.mlir.constant(1 : i64) : i64
    %98 = llvm.alloca %97 x i64 : (i64) -> !llvm.ptr
    llvm.store %96, %98 : i64, !llvm.ptr
    %99 = llvm.mlir.constant(1 : i64) : i64
    %100 = llvm.alloca %99 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %100 : i64, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %101 = llvm.load %100 : !llvm.ptr -> i64
    %102 = arith.constant 0 : i32
    %104 = arith.extsi %102 : i32 to i64
    %103 = arith.cmpi sgt, %101, %104 : i64
    cf.cond_br %103, ^bb22, ^bb23
    ^bb22:
      %105 = llvm.load %100 : !llvm.ptr -> i64
      %106 = arith.constant 2 : i32
      %108 = arith.extsi %106 : i32 to i64
      %107 = arith.remsi %105, %108 : i64
      %109 = arith.constant 1 : i32
      %111 = arith.extsi %109 : i32 to i64
      %110 = arith.cmpi eq, %107, %111 : i64
      cf.cond_br %110, ^bb24, ^bb25
      ^bb24:
        %113 = llvm.load %95 : !llvm.ptr -> i64
        %114 = llvm.load %98 : !llvm.ptr -> i64
        %112 = func.call @mulmod(%113, %114, %arg2) : (i64, i64, i64) -> i64
        llvm.store %112, %95 : i64, !llvm.ptr
        cf.br ^bb26
      ^bb25:
        cf.br ^bb26
      ^bb26:
      %116 = llvm.load %98 : !llvm.ptr -> i64
      %117 = llvm.load %98 : !llvm.ptr -> i64
      %115 = func.call @mulmod(%116, %117, %arg2) : (i64, i64, i64) -> i64
      llvm.store %115, %98 : i64, !llvm.ptr
      %118 = llvm.load %100 : !llvm.ptr -> i64
      %119 = arith.constant 2 : i32
      %121 = arith.extsi %119 : i32 to i64
      %120 = arith.divsi %118, %121 : i64
      llvm.store %120, %100 : i64, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %122 = llvm.load %95 : !llvm.ptr -> i64
    func.return %122 : i64
  }
  func.func @is_prime(%arg0: i64) -> i1 {
    %123 = arith.constant 2 : i32
    %125 = arith.extsi %123 : i32 to i64
    %124 = arith.cmpi slt, %arg0, %125 : i64
    cf.cond_br %124, ^bb27, ^bb28
    ^bb27:
      %126 = arith.constant 0 : i1
      func.return %126 : i1
    ^bb28:
      cf.br ^bb29
    ^bb29:
    %127 = arith.constant 4 : i32
    %129 = arith.extsi %127 : i32 to i64
    %128 = arith.cmpi slt, %arg0, %129 : i64
    cf.cond_br %128, ^bb30, ^bb31
    ^bb30:
      %130 = arith.constant 1 : i1
      func.return %130 : i1
    ^bb31:
      cf.br ^bb32
    ^bb32:
    %131 = arith.constant 2 : i32
    %133 = arith.extsi %131 : i32 to i64
    %132 = arith.remsi %arg0, %133 : i64
    %134 = arith.constant 0 : i32
    %136 = arith.extsi %134 : i32 to i64
    %135 = arith.cmpi eq, %132, %136 : i64
    %137 = scf.if %135 -> (i1) {
      %138 = arith.constant true
      scf.yield %138 : i1
    } else {
      %139 = arith.constant 3 : i32
      %141 = arith.extsi %139 : i32 to i64
      %140 = arith.remsi %arg0, %141 : i64
      %142 = arith.constant 0 : i32
      %144 = arith.extsi %142 : i32 to i64
      %143 = arith.cmpi eq, %140, %144 : i64
      scf.yield %143 : i1
    }
    cf.cond_br %137, ^bb33, ^bb34
    ^bb33:
      %145 = arith.constant 0 : i1
      func.return %145 : i1
    ^bb34:
      cf.br ^bb35
    ^bb35:
    %146 = arith.constant 5 : i32
    %147 = arith.extsi %146 : i32 to i64
    %148 = llvm.mlir.constant(1 : i64) : i64
    %149 = llvm.alloca %148 x i64 : (i64) -> !llvm.ptr
    llvm.store %147, %149 : i64, !llvm.ptr
    cf.br ^bb36
    ^bb36:
    %150 = llvm.load %149 : !llvm.ptr -> i64
    %151 = llvm.load %149 : !llvm.ptr -> i64
    %152 = arith.muli %150, %151 : i64
    %153 = arith.cmpi sle, %152, %arg0 : i64
    cf.cond_br %153, ^bb37, ^bb38
    ^bb37:
      %154 = llvm.load %149 : !llvm.ptr -> i64
      %155 = arith.remsi %arg0, %154 : i64
      %156 = arith.constant 0 : i32
      %158 = arith.extsi %156 : i32 to i64
      %157 = arith.cmpi eq, %155, %158 : i64
      %159 = scf.if %157 -> (i1) {
        %160 = arith.constant true
        scf.yield %160 : i1
      } else {
        %161 = llvm.load %149 : !llvm.ptr -> i64
        %162 = arith.constant 2 : i32
        %164 = arith.extsi %162 : i32 to i64
        %163 = arith.addi %161, %164 : i64
        %165 = arith.remsi %arg0, %163 : i64
        %166 = arith.constant 0 : i32
        %168 = arith.extsi %166 : i32 to i64
        %167 = arith.cmpi eq, %165, %168 : i64
        scf.yield %167 : i1
      }
      cf.cond_br %159, ^bb39, ^bb40
      ^bb39:
        %169 = arith.constant 0 : i1
        func.return %169 : i1
      ^bb40:
        cf.br ^bb41
      ^bb41:
      %170 = llvm.load %149 : !llvm.ptr -> i64
      %171 = arith.constant 6 : i32
      %173 = arith.extsi %171 : i32 to i64
      %172 = arith.addi %170, %173 : i64
      llvm.store %172, %149 : i64, !llvm.ptr
      cf.br ^bb36
    ^bb38:
    %174 = arith.constant 1 : i1
    func.return %174 : i1
  }
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  func.func private @malloc(i64) -> !llvm.ptr
  // Constant: MOD
  llvm.mlir.global internal constant @MOD(1000000007 : i64) : i64
  // Constant: P1
  llvm.mlir.global internal constant @P1(998244353 : i64) : i64
  // Constant: P2
  llvm.mlir.global internal constant @P2(1004535809 : i64) : i64
  // Constant: P3
  llvm.mlir.global internal constant @P3(469762049 : i64) : i64
  // Module static: g_inv_p1_mod_p2
  llvm.mlir.global internal @g_inv_p1_mod_p2(0 : i64) : i64
  // Module static: g_inv_p12_mod_p3
  llvm.mlir.global internal @g_inv_p12_mod_p3(0 : i64) : i64
  // Module static: g_P12_hi
  llvm.mlir.global internal @g_P12_hi(0 : i64) : i64
  // Module static: g_P12_lo
  llvm.mlir.global internal @g_P12_lo(0 : i64) : i64
  func.func @mod_inv(%arg0: i64, %arg1: i64) -> i64 {
    %176 = arith.constant 2 : i32
    %178 = arith.extsi %176 : i32 to i64
    %177 = arith.subi %arg1, %178 : i64
    %175 = func.call @mod_pow(%arg0, %177, %arg1) : (i64, i64, i64) -> i64
    func.return %175 : i64
  }
  func.func @ntt(%arg0: !llvm.ptr, %arg1: i64, %arg2: i32, %arg3: i64, %arg4: i64) -> () {
    %179 = arith.constant 0 : i32
    %180 = arith.extsi %179 : i32 to i64
    %181 = llvm.mlir.constant(1 : i64) : i64
    %182 = llvm.alloca %181 x i64 : (i64) -> !llvm.ptr
    llvm.store %180, %182 : i64, !llvm.ptr
    %183 = arith.constant 1 : i32
    %184 = arith.extsi %183 : i32 to i64
    %185 = llvm.mlir.constant(1 : i64) : i64
    %186 = llvm.alloca %185 x i64 : (i64) -> !llvm.ptr
    llvm.store %184, %186 : i64, !llvm.ptr
    cf.br ^bb42
    ^bb42:
    %187 = llvm.load %186 : !llvm.ptr -> i64
    %188 = arith.cmpi slt, %187, %arg1 : i64
    cf.cond_br %188, ^bb43, ^bb44
    ^bb43:
      %189 = arith.constant 1 : i32
      %191 = arith.extsi %189 : i32 to i64
      %190 = arith.shrsi %arg1, %191 : i64
      %192 = llvm.mlir.constant(1 : i64) : i64
      %193 = llvm.alloca %192 x i64 : (i64) -> !llvm.ptr
      llvm.store %190, %193 : i64, !llvm.ptr
      cf.br ^bb45
      ^bb45:
      %194 = llvm.load %182 : !llvm.ptr -> i64
      %195 = llvm.load %193 : !llvm.ptr -> i64
      %196 = arith.andi %194, %195 : i64
      %197 = arith.constant 0 : i32
      %199 = arith.extsi %197 : i32 to i64
      %198 = arith.cmpi ne, %196, %199 : i64
      cf.cond_br %198, ^bb46, ^bb47
      ^bb46:
        %200 = llvm.load %182 : !llvm.ptr -> i64
        %201 = llvm.load %193 : !llvm.ptr -> i64
        %202 = arith.xori %200, %201 : i64
        llvm.store %202, %182 : i64, !llvm.ptr
        %203 = llvm.load %193 : !llvm.ptr -> i64
        %204 = arith.constant 1 : i32
        %206 = arith.extsi %204 : i32 to i64
        %205 = arith.shrsi %203, %206 : i64
        llvm.store %205, %193 : i64, !llvm.ptr
        cf.br ^bb45
      ^bb47:
      %207 = llvm.load %182 : !llvm.ptr -> i64
      %208 = llvm.load %193 : !llvm.ptr -> i64
      %209 = arith.xori %207, %208 : i64
      llvm.store %209, %182 : i64, !llvm.ptr
      %210 = llvm.load %186 : !llvm.ptr -> i64
      %211 = llvm.load %182 : !llvm.ptr -> i64
      %212 = arith.cmpi slt, %210, %211 : i64
      cf.cond_br %212, ^bb48, ^bb49
      ^bb48:
        %214 = llvm.load %186 : !llvm.ptr -> i64
        %215 = llvm.getelementptr %arg0[%214] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %213 = llvm.load %215 : !llvm.ptr -> i64
        %217 = llvm.load %182 : !llvm.ptr -> i64
        %218 = llvm.getelementptr %arg0[%217] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %216 = llvm.load %218 : !llvm.ptr -> i64
        %219 = llvm.load %186 : !llvm.ptr -> i64
        %220 = llvm.getelementptr %arg0[%219] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %216, %220 : i64, !llvm.ptr
        %221 = llvm.load %182 : !llvm.ptr -> i64
        %222 = llvm.getelementptr %arg0[%221] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %213, %222 : i64, !llvm.ptr
        cf.br ^bb50
      ^bb49:
        cf.br ^bb50
      ^bb50:
      %223 = llvm.load %186 : !llvm.ptr -> i64
      %224 = arith.constant 1 : i32
      %226 = arith.extsi %224 : i32 to i64
      %225 = arith.addi %223, %226 : i64
      llvm.store %225, %186 : i64, !llvm.ptr
      cf.br ^bb42
    ^bb44:
    %227 = arith.constant 2 : i32
    %228 = arith.extsi %227 : i32 to i64
    %229 = llvm.mlir.constant(1 : i64) : i64
    %230 = llvm.alloca %229 x i64 : (i64) -> !llvm.ptr
    llvm.store %228, %230 : i64, !llvm.ptr
    cf.br ^bb51
    ^bb51:
    %231 = llvm.load %230 : !llvm.ptr -> i64
    %232 = arith.cmpi sle, %231, %arg1 : i64
    cf.cond_br %232, ^bb52, ^bb53
    ^bb52:
      %234 = arith.constant 1 : i32
      %236 = arith.extsi %234 : i32 to i64
      %235 = arith.subi %arg3, %236 : i64
      %237 = llvm.load %230 : !llvm.ptr -> i64
      %238 = arith.divsi %235, %237 : i64
      %233 = func.call @mod_pow(%arg4, %238, %arg3) : (i64, i64, i64) -> i64
      %239 = llvm.mlir.constant(1 : i64) : i64
      %240 = llvm.alloca %239 x i64 : (i64) -> !llvm.ptr
      llvm.store %233, %240 : i64, !llvm.ptr
      %241 = arith.constant 1 : i32
      %242 = arith.cmpi eq, %arg2, %241 : i32
      cf.cond_br %242, ^bb54, ^bb55
      ^bb54:
        %244 = arith.constant 2 : i32
        %246 = arith.extsi %244 : i32 to i64
        %245 = arith.subi %arg3, %246 : i64
        %243 = func.call @mod_pow(%233, %245, %arg3) : (i64, i64, i64) -> i64
        llvm.store %243, %240 : i64, !llvm.ptr
        cf.br ^bb56
      ^bb55:
        cf.br ^bb56
      ^bb56:
      %247 = llvm.load %230 : !llvm.ptr -> i64
      %248 = arith.constant 1 : i32
      %250 = arith.extsi %248 : i32 to i64
      %249 = arith.shrsi %247, %250 : i64
      %251 = arith.constant 0 : i32
      %252 = arith.extsi %251 : i32 to i64
      llvm.store %252, %186 : i64, !llvm.ptr
      cf.br ^bb57
      ^bb57:
      %253 = llvm.load %186 : !llvm.ptr -> i64
      %254 = arith.cmpi slt, %253, %arg1 : i64
      cf.cond_br %254, ^bb58, ^bb59
      ^bb58:
        %255 = arith.constant 1 : i32
        %256 = arith.extsi %255 : i32 to i64
        %257 = llvm.mlir.constant(1 : i64) : i64
        %258 = llvm.alloca %257 x i64 : (i64) -> !llvm.ptr
        llvm.store %256, %258 : i64, !llvm.ptr
        %259 = arith.constant 0 : i32
        %260 = arith.extsi %259 : i32 to i64
        %261 = llvm.mlir.constant(1 : i64) : i64
        %262 = llvm.alloca %261 x i64 : (i64) -> !llvm.ptr
        llvm.store %260, %262 : i64, !llvm.ptr
        cf.br ^bb60
        ^bb60:
        %263 = llvm.load %262 : !llvm.ptr -> i64
        %264 = arith.cmpi slt, %263, %249 : i64
        cf.cond_br %264, ^bb61, ^bb62
        ^bb61:
          %266 = llvm.load %186 : !llvm.ptr -> i64
          %267 = llvm.load %262 : !llvm.ptr -> i64
          %268 = arith.addi %266, %267 : i64
          %269 = llvm.getelementptr %arg0[%268] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %265 = llvm.load %269 : !llvm.ptr -> i64
          %271 = llvm.load %186 : !llvm.ptr -> i64
          %272 = llvm.load %262 : !llvm.ptr -> i64
          %273 = arith.addi %271, %272 : i64
          %274 = arith.addi %273, %249 : i64
          %275 = llvm.getelementptr %arg0[%274] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %270 = llvm.load %275 : !llvm.ptr -> i64
          %276 = arith.extsi %270 : i64 to i128
          %277 = llvm.load %258 : !llvm.ptr -> i64
          %278 = arith.extsi %277 : i64 to i128
          %280 = arith.trunci %276 : i128 to i64
          %281 = arith.trunci %278 : i128 to i64
          %279 = arith.muli %280, %281 : i64
          %282 = arith.extsi %arg3 : i64 to i128
          %284 = arith.trunci %282 : i128 to i64
          %283 = arith.remsi %279, %284 : i64
          %285 = arith.addi %265, %283 : i64
          %286 = llvm.mlir.constant(1 : i64) : i64
          %287 = llvm.alloca %286 x i64 : (i64) -> !llvm.ptr
          llvm.store %285, %287 : i64, !llvm.ptr
          %288 = llvm.load %287 : !llvm.ptr -> i64
          %289 = arith.cmpi sge, %288, %arg3 : i64
          cf.cond_br %289, ^bb63, ^bb64
          ^bb63:
            %290 = llvm.load %287 : !llvm.ptr -> i64
            %291 = arith.subi %290, %arg3 : i64
            llvm.store %291, %287 : i64, !llvm.ptr
            cf.br ^bb65
          ^bb64:
            cf.br ^bb65
          ^bb65:
          %292 = arith.subi %265, %283 : i64
          %293 = llvm.mlir.constant(1 : i64) : i64
          %294 = llvm.alloca %293 x i64 : (i64) -> !llvm.ptr
          llvm.store %292, %294 : i64, !llvm.ptr
          %295 = llvm.load %294 : !llvm.ptr -> i64
          %296 = arith.constant 0 : i32
          %298 = arith.extsi %296 : i32 to i64
          %297 = arith.cmpi slt, %295, %298 : i64
          cf.cond_br %297, ^bb66, ^bb67
          ^bb66:
            %299 = llvm.load %294 : !llvm.ptr -> i64
            %300 = arith.addi %299, %arg3 : i64
            llvm.store %300, %294 : i64, !llvm.ptr
            cf.br ^bb68
          ^bb67:
            cf.br ^bb68
          ^bb68:
          %301 = llvm.load %287 : !llvm.ptr -> i64
          %302 = llvm.load %186 : !llvm.ptr -> i64
          %303 = llvm.load %262 : !llvm.ptr -> i64
          %304 = arith.addi %302, %303 : i64
          %305 = llvm.getelementptr %arg0[%304] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %301, %305 : i64, !llvm.ptr
          %306 = llvm.load %294 : !llvm.ptr -> i64
          %307 = llvm.load %186 : !llvm.ptr -> i64
          %308 = llvm.load %262 : !llvm.ptr -> i64
          %309 = arith.addi %307, %308 : i64
          %310 = arith.addi %309, %249 : i64
          %311 = llvm.getelementptr %arg0[%310] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %306, %311 : i64, !llvm.ptr
          %312 = llvm.load %258 : !llvm.ptr -> i64
          %313 = arith.extsi %312 : i64 to i128
          %314 = llvm.load %240 : !llvm.ptr -> i64
          %315 = arith.extsi %314 : i64 to i128
          %317 = arith.trunci %313 : i128 to i64
          %318 = arith.trunci %315 : i128 to i64
          %316 = arith.muli %317, %318 : i64
          %319 = arith.extsi %arg3 : i64 to i128
          %321 = arith.trunci %319 : i128 to i64
          %320 = arith.remsi %316, %321 : i64
          llvm.store %320, %258 : i64, !llvm.ptr
          %322 = llvm.load %262 : !llvm.ptr -> i64
          %323 = arith.constant 1 : i32
          %325 = arith.extsi %323 : i32 to i64
          %324 = arith.addi %322, %325 : i64
          llvm.store %324, %262 : i64, !llvm.ptr
          cf.br ^bb60
        ^bb62:
        %326 = llvm.load %186 : !llvm.ptr -> i64
        %327 = llvm.load %230 : !llvm.ptr -> i64
        %328 = arith.addi %326, %327 : i64
        llvm.store %328, %186 : i64, !llvm.ptr
        cf.br ^bb57
      ^bb59:
      %329 = llvm.load %230 : !llvm.ptr -> i64
      %330 = arith.constant 1 : i32
      %332 = arith.extsi %330 : i32 to i64
      %331 = arith.shli %329, %332 : i64
      llvm.store %331, %230 : i64, !llvm.ptr
      cf.br ^bb51
    ^bb53:
    %333 = arith.constant 1 : i32
    %334 = arith.cmpi eq, %arg2, %333 : i32
    cf.cond_br %334, ^bb69, ^bb70
    ^bb69:
      %336 = arith.constant 2 : i32
      %338 = arith.extsi %336 : i32 to i64
      %337 = arith.subi %arg3, %338 : i64
      %335 = func.call @mod_pow(%arg1, %337, %arg3) : (i64, i64, i64) -> i64
      %339 = arith.constant 0 : i32
      %340 = arith.extsi %339 : i32 to i64
      llvm.store %340, %186 : i64, !llvm.ptr
      cf.br ^bb72
      ^bb72:
      %341 = llvm.load %186 : !llvm.ptr -> i64
      %342 = arith.cmpi slt, %341, %arg1 : i64
      cf.cond_br %342, ^bb73, ^bb74
      ^bb73:
        %344 = llvm.load %186 : !llvm.ptr -> i64
        %345 = llvm.getelementptr %arg0[%344] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %343 = llvm.load %345 : !llvm.ptr -> i64
        %346 = arith.extsi %343 : i64 to i128
        %347 = arith.extsi %335 : i64 to i128
        %349 = arith.trunci %346 : i128 to i64
        %350 = arith.trunci %347 : i128 to i64
        %348 = arith.muli %349, %350 : i64
        %351 = arith.extsi %arg3 : i64 to i128
        %353 = arith.trunci %351 : i128 to i64
        %352 = arith.remsi %348, %353 : i64
        %354 = llvm.load %186 : !llvm.ptr -> i64
        %355 = llvm.getelementptr %arg0[%354] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %352, %355 : i64, !llvm.ptr
        %356 = llvm.load %186 : !llvm.ptr -> i64
        %357 = arith.constant 1 : i32
        %359 = arith.extsi %357 : i32 to i64
        %358 = arith.addi %356, %359 : i64
        llvm.store %358, %186 : i64, !llvm.ptr
        cf.br ^bb72
      ^bb74:
      cf.br ^bb71
    ^bb70:
      cf.br ^bb71
    ^bb71:
    func.return
  }
  func.func @convolve_one(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: !llvm.ptr) -> !llvm.ptr {
    %360 = arith.addi %arg1, %arg3 : i64
    %361 = arith.constant 1 : i32
    %363 = arith.extsi %361 : i32 to i64
    %362 = arith.subi %360, %363 : i64
    %364 = arith.constant 1 : i32
    %365 = arith.extsi %364 : i32 to i64
    %366 = llvm.mlir.constant(1 : i64) : i64
    %367 = llvm.alloca %366 x i64 : (i64) -> !llvm.ptr
    llvm.store %365, %367 : i64, !llvm.ptr
    cf.br ^bb75
    ^bb75:
    %368 = llvm.load %367 : !llvm.ptr -> i64
    %369 = arith.cmpi slt, %368, %362 : i64
    cf.cond_br %369, ^bb76, ^bb77
    ^bb76:
      %370 = llvm.load %367 : !llvm.ptr -> i64
      %371 = arith.constant 1 : i32
      %373 = arith.extsi %371 : i32 to i64
      %372 = arith.shli %370, %373 : i64
      llvm.store %372, %367 : i64, !llvm.ptr
      cf.br ^bb75
    ^bb77:
    %375 = llvm.load %367 : !llvm.ptr -> i64
    %376 = arith.constant 8 : i32
    %377 = arith.extsi %376 : i32 to i64
    %374 = func.call @calloc(%375, %377) : (i64, i64) -> !llvm.ptr
    %379 = llvm.load %367 : !llvm.ptr -> i64
    %380 = arith.constant 8 : i32
    %381 = arith.extsi %380 : i32 to i64
    %378 = func.call @calloc(%379, %381) : (i64, i64) -> !llvm.ptr
    %382 = arith.constant 0 : i32
    %383 = arith.extsi %382 : i32 to i64
    %384 = llvm.mlir.constant(1 : i64) : i64
    %385 = llvm.alloca %384 x i64 : (i64) -> !llvm.ptr
    llvm.store %383, %385 : i64, !llvm.ptr
    cf.br ^bb78
    ^bb78:
    %386 = llvm.load %385 : !llvm.ptr -> i64
    %387 = arith.cmpi slt, %386, %arg1 : i64
    cf.cond_br %387, ^bb79, ^bb80
    ^bb79:
      %389 = llvm.load %385 : !llvm.ptr -> i64
      %390 = llvm.getelementptr %arg0[%389] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %388 = llvm.load %390 : !llvm.ptr -> i64
      %391 = arith.remsi %388, %arg4 : i64
      %392 = llvm.load %385 : !llvm.ptr -> i64
      %393 = llvm.getelementptr %374[%392] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %391, %393 : i64, !llvm.ptr
      %394 = llvm.load %385 : !llvm.ptr -> i64
      %395 = arith.constant 1 : i32
      %397 = arith.extsi %395 : i32 to i64
      %396 = arith.addi %394, %397 : i64
      llvm.store %396, %385 : i64, !llvm.ptr
      cf.br ^bb78
    ^bb80:
    %398 = arith.constant 0 : i32
    %399 = arith.extsi %398 : i32 to i64
    llvm.store %399, %385 : i64, !llvm.ptr
    cf.br ^bb81
    ^bb81:
    %400 = llvm.load %385 : !llvm.ptr -> i64
    %401 = arith.cmpi slt, %400, %arg3 : i64
    cf.cond_br %401, ^bb82, ^bb83
    ^bb82:
      %403 = llvm.load %385 : !llvm.ptr -> i64
      %404 = llvm.getelementptr %arg2[%403] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %402 = llvm.load %404 : !llvm.ptr -> i64
      %405 = arith.remsi %402, %arg4 : i64
      %406 = llvm.load %385 : !llvm.ptr -> i64
      %407 = llvm.getelementptr %378[%406] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %405, %407 : i64, !llvm.ptr
      %408 = llvm.load %385 : !llvm.ptr -> i64
      %409 = arith.constant 1 : i32
      %411 = arith.extsi %409 : i32 to i64
      %410 = arith.addi %408, %411 : i64
      llvm.store %410, %385 : i64, !llvm.ptr
      cf.br ^bb81
    ^bb83:
    %413 = llvm.load %367 : !llvm.ptr -> i64
    %414 = arith.constant 0 : i32
    func.call @ntt(%374, %413, %414, %arg4, %arg5) : (!llvm.ptr, i64, i32, i64, i64) -> ()
    %416 = llvm.load %367 : !llvm.ptr -> i64
    %417 = arith.constant 0 : i32
    func.call @ntt(%378, %416, %417, %arg4, %arg5) : (!llvm.ptr, i64, i32, i64, i64) -> ()
    %418 = arith.constant 0 : i32
    %419 = arith.extsi %418 : i32 to i64
    llvm.store %419, %385 : i64, !llvm.ptr
    cf.br ^bb84
    ^bb84:
    %420 = llvm.load %385 : !llvm.ptr -> i64
    %421 = llvm.load %367 : !llvm.ptr -> i64
    %422 = arith.cmpi slt, %420, %421 : i64
    cf.cond_br %422, ^bb85, ^bb86
    ^bb85:
      %424 = llvm.load %385 : !llvm.ptr -> i64
      %425 = llvm.getelementptr %374[%424] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %423 = llvm.load %425 : !llvm.ptr -> i64
      %426 = arith.extsi %423 : i64 to i128
      %428 = llvm.load %385 : !llvm.ptr -> i64
      %429 = llvm.getelementptr %378[%428] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %427 = llvm.load %429 : !llvm.ptr -> i64
      %430 = arith.extsi %427 : i64 to i128
      %432 = arith.trunci %426 : i128 to i64
      %433 = arith.trunci %430 : i128 to i64
      %431 = arith.muli %432, %433 : i64
      %434 = arith.extsi %arg4 : i64 to i128
      %436 = arith.trunci %434 : i128 to i64
      %435 = arith.remsi %431, %436 : i64
      %437 = llvm.load %385 : !llvm.ptr -> i64
      %438 = llvm.getelementptr %374[%437] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %435, %438 : i64, !llvm.ptr
      %439 = llvm.load %385 : !llvm.ptr -> i64
      %440 = arith.constant 1 : i32
      %442 = arith.extsi %440 : i32 to i64
      %441 = arith.addi %439, %442 : i64
      llvm.store %441, %385 : i64, !llvm.ptr
      cf.br ^bb84
    ^bb86:
    %444 = llvm.load %367 : !llvm.ptr -> i64
    %445 = arith.constant 1 : i32
    func.call @ntt(%374, %444, %445, %arg4, %arg5) : (!llvm.ptr, i64, i32, i64, i64) -> ()
    %446 = arith.constant 0 : i32
    %447 = arith.extsi %446 : i32 to i64
    %448 = llvm.getelementptr %arg6[%447] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %362, %448 : i64, !llvm.ptr
    %450 = arith.constant 8 : i32
    %452 = arith.extsi %450 : i32 to i64
    %451 = arith.muli %362, %452 : i64
    %449 = func.call @malloc(%451) : (i64) -> !llvm.ptr
    %453 = arith.constant 0 : i32
    %454 = arith.extsi %453 : i32 to i64
    llvm.store %454, %385 : i64, !llvm.ptr
    cf.br ^bb87
    ^bb87:
    %455 = llvm.load %385 : !llvm.ptr -> i64
    %456 = arith.cmpi slt, %455, %362 : i64
    cf.cond_br %456, ^bb88, ^bb89
    ^bb88:
      %458 = llvm.load %385 : !llvm.ptr -> i64
      %459 = llvm.getelementptr %374[%458] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %457 = llvm.load %459 : !llvm.ptr -> i64
      %460 = llvm.load %385 : !llvm.ptr -> i64
      %461 = llvm.getelementptr %449[%460] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %457, %461 : i64, !llvm.ptr
      %462 = llvm.load %385 : !llvm.ptr -> i64
      %463 = arith.constant 1 : i32
      %465 = arith.extsi %463 : i32 to i64
      %464 = arith.addi %462, %465 : i64
      llvm.store %464, %385 : i64, !llvm.ptr
      cf.br ^bb87
    ^bb89:
    func.call @free(%374) : (!llvm.ptr) -> ()
    func.call @free(%378) : (!llvm.ptr) -> ()
    func.return %449 : !llvm.ptr
  }
  func.func @crt3(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %468 = llvm.mlir.addressof @g_inv_p1_mod_p2 : !llvm.ptr
    %469 = llvm.load %468 : !llvm.ptr -> i64
    %470 = arith.constant 0 : i32
    %472 = arith.extsi %470 : i32 to i64
    %471 = arith.cmpi slt, %469, %472 : i64
    cf.cond_br %471, ^bb90, ^bb91
    ^bb90:
      %474 = llvm.mlir.addressof @P1 : !llvm.ptr
      %475 = llvm.load %474 : !llvm.ptr -> i64
      %476 = llvm.mlir.addressof @P2 : !llvm.ptr
      %477 = llvm.load %476 : !llvm.ptr -> i64
      %478 = arith.remsi %475, %477 : i64
      %479 = llvm.mlir.addressof @P2 : !llvm.ptr
      %480 = llvm.load %479 : !llvm.ptr -> i64
      %473 = func.call @mod_inv(%478, %480) : (i64, i64) -> i64
      %481 = llvm.mlir.addressof @g_inv_p1_mod_p2 : !llvm.ptr
      llvm.store %473, %481 : i64, !llvm.ptr
      %482 = llvm.mlir.addressof @P1 : !llvm.ptr
      %483 = llvm.load %482 : !llvm.ptr -> i64
      %484 = arith.extsi %483 : i64 to i128
      %485 = llvm.mlir.addressof @P2 : !llvm.ptr
      %486 = llvm.load %485 : !llvm.ptr -> i64
      %487 = arith.extsi %486 : i64 to i128
      %489 = arith.trunci %484 : i128 to i64
      %490 = arith.trunci %487 : i128 to i64
      %488 = arith.muli %489, %490 : i64
      %491 = arith.extsi %488 : i64 to i128
      %492 = arith.constant 1 : i32
      %493 = arith.extsi %492 : i32 to i128
      %494 = arith.constant 63 : i32
      %496 = arith.trunci %493 : i128 to i64
      %497 = arith.extsi %494 : i32 to i64
      %495 = arith.shli %496, %497 : i64
      %498 = arith.constant 1 : i32
      %500 = arith.extsi %498 : i32 to i64
      %499 = arith.subi %495, %500 : i64
      %502 = arith.trunci %491 : i128 to i64
      %501 = arith.andi %502, %499 : i64
      %503 = llvm.mlir.addressof @g_P12_lo : !llvm.ptr
      llvm.store %501, %503 : i64, !llvm.ptr
      %504 = arith.constant 63 : i32
      %506 = arith.trunci %491 : i128 to i64
      %507 = arith.extsi %504 : i32 to i64
      %505 = arith.shrsi %506, %507 : i64
      %508 = llvm.mlir.addressof @g_P12_hi : !llvm.ptr
      llvm.store %505, %508 : i64, !llvm.ptr
      %510 = llvm.mlir.addressof @P3 : !llvm.ptr
      %511 = llvm.load %510 : !llvm.ptr -> i64
      %512 = arith.extsi %511 : i64 to i128
      %514 = arith.trunci %491 : i128 to i64
      %515 = arith.trunci %512 : i128 to i64
      %513 = arith.remsi %514, %515 : i64
      %516 = llvm.mlir.addressof @P3 : !llvm.ptr
      %517 = llvm.load %516 : !llvm.ptr -> i64
      %509 = func.call @mod_inv(%513, %517) : (i64, i64) -> i64
      %518 = llvm.mlir.addressof @g_inv_p12_mod_p3 : !llvm.ptr
      llvm.store %509, %518 : i64, !llvm.ptr
      cf.br ^bb92
    ^bb91:
      cf.br ^bb92
    ^bb92:
    %519 = arith.subi %arg1, %arg0 : i64
    %520 = llvm.mlir.addressof @P2 : !llvm.ptr
    %521 = llvm.load %520 : !llvm.ptr -> i64
    %522 = arith.remsi %519, %521 : i64
    %523 = llvm.mlir.constant(1 : i64) : i64
    %524 = llvm.alloca %523 x i64 : (i64) -> !llvm.ptr
    llvm.store %522, %524 : i64, !llvm.ptr
    %525 = llvm.load %524 : !llvm.ptr -> i64
    %526 = arith.constant 0 : i32
    %528 = arith.extsi %526 : i32 to i64
    %527 = arith.cmpi slt, %525, %528 : i64
    cf.cond_br %527, ^bb93, ^bb94
    ^bb93:
      %529 = llvm.load %524 : !llvm.ptr -> i64
      %530 = llvm.mlir.addressof @P2 : !llvm.ptr
      %531 = llvm.load %530 : !llvm.ptr -> i64
      %532 = arith.addi %529, %531 : i64
      llvm.store %532, %524 : i64, !llvm.ptr
      cf.br ^bb95
    ^bb94:
      cf.br ^bb95
    ^bb95:
    %533 = llvm.load %524 : !llvm.ptr -> i64
    %534 = arith.extsi %533 : i64 to i128
    %535 = llvm.mlir.addressof @g_inv_p1_mod_p2 : !llvm.ptr
    %536 = llvm.load %535 : !llvm.ptr -> i64
    %537 = arith.extsi %536 : i64 to i128
    %539 = arith.trunci %534 : i128 to i64
    %540 = arith.trunci %537 : i128 to i64
    %538 = arith.muli %539, %540 : i64
    %541 = llvm.mlir.addressof @P2 : !llvm.ptr
    %542 = llvm.load %541 : !llvm.ptr -> i64
    %543 = arith.extsi %542 : i64 to i128
    %545 = arith.trunci %543 : i128 to i64
    %544 = arith.remsi %538, %545 : i64
    llvm.store %544, %524 : i64, !llvm.ptr
    %546 = arith.extsi %arg0 : i64 to i128
    %547 = llvm.mlir.addressof @P1 : !llvm.ptr
    %548 = llvm.load %547 : !llvm.ptr -> i64
    %549 = arith.extsi %548 : i64 to i128
    %550 = llvm.load %524 : !llvm.ptr -> i64
    %551 = arith.extsi %550 : i64 to i128
    %553 = arith.trunci %549 : i128 to i64
    %554 = arith.trunci %551 : i128 to i64
    %552 = arith.muli %553, %554 : i64
    %556 = arith.trunci %546 : i128 to i64
    %555 = arith.addi %556, %552 : i64
    %557 = arith.extsi %555 : i64 to i128
    %558 = llvm.mlir.addressof @P3 : !llvm.ptr
    %559 = llvm.load %558 : !llvm.ptr -> i64
    %560 = arith.extsi %559 : i64 to i128
    %562 = arith.trunci %557 : i128 to i64
    %563 = arith.trunci %560 : i128 to i64
    %561 = arith.remsi %562, %563 : i64
    %564 = arith.subi %arg2, %561 : i64
    %565 = llvm.mlir.addressof @P3 : !llvm.ptr
    %566 = llvm.load %565 : !llvm.ptr -> i64
    %567 = arith.remsi %564, %566 : i64
    %568 = llvm.mlir.constant(1 : i64) : i64
    %569 = llvm.alloca %568 x i64 : (i64) -> !llvm.ptr
    llvm.store %567, %569 : i64, !llvm.ptr
    %570 = llvm.load %569 : !llvm.ptr -> i64
    %571 = arith.constant 0 : i32
    %573 = arith.extsi %571 : i32 to i64
    %572 = arith.cmpi slt, %570, %573 : i64
    cf.cond_br %572, ^bb96, ^bb97
    ^bb96:
      %574 = llvm.load %569 : !llvm.ptr -> i64
      %575 = llvm.mlir.addressof @P3 : !llvm.ptr
      %576 = llvm.load %575 : !llvm.ptr -> i64
      %577 = arith.addi %574, %576 : i64
      llvm.store %577, %569 : i64, !llvm.ptr
      cf.br ^bb98
    ^bb97:
      cf.br ^bb98
    ^bb98:
    %578 = llvm.load %569 : !llvm.ptr -> i64
    %579 = arith.extsi %578 : i64 to i128
    %580 = llvm.mlir.addressof @g_inv_p12_mod_p3 : !llvm.ptr
    %581 = llvm.load %580 : !llvm.ptr -> i64
    %582 = arith.extsi %581 : i64 to i128
    %584 = arith.trunci %579 : i128 to i64
    %585 = arith.trunci %582 : i128 to i64
    %583 = arith.muli %584, %585 : i64
    %586 = llvm.mlir.addressof @P3 : !llvm.ptr
    %587 = llvm.load %586 : !llvm.ptr -> i64
    %588 = arith.extsi %587 : i64 to i128
    %590 = arith.trunci %588 : i128 to i64
    %589 = arith.remsi %583, %590 : i64
    llvm.store %589, %569 : i64, !llvm.ptr
    %591 = llvm.mlir.addressof @g_P12_hi : !llvm.ptr
    %592 = llvm.load %591 : !llvm.ptr -> i64
    %593 = arith.extsi %592 : i64 to i128
    %594 = arith.constant 63 : i32
    %596 = arith.trunci %593 : i128 to i64
    %597 = arith.extsi %594 : i32 to i64
    %595 = arith.shli %596, %597 : i64
    %598 = llvm.mlir.addressof @g_P12_lo : !llvm.ptr
    %599 = llvm.load %598 : !llvm.ptr -> i64
    %600 = arith.extsi %599 : i64 to i128
    %602 = arith.trunci %600 : i128 to i64
    %601 = arith.addi %595, %602 : i64
    %603 = arith.extsi %601 : i64 to i128
    %604 = llvm.load %569 : !llvm.ptr -> i64
    %605 = arith.extsi %604 : i64 to i128
    %607 = arith.trunci %603 : i128 to i64
    %608 = arith.trunci %605 : i128 to i64
    %606 = arith.muli %607, %608 : i64
    %610 = arith.trunci %557 : i128 to i64
    %609 = arith.addi %610, %606 : i64
    %611 = arith.extsi %609 : i64 to i128
    %612 = llvm.mlir.addressof @MOD : !llvm.ptr
    %613 = llvm.load %612 : !llvm.ptr -> i64
    %614 = arith.extsi %613 : i64 to i128
    %616 = arith.trunci %611 : i128 to i64
    %617 = arith.trunci %614 : i128 to i64
    %615 = arith.remsi %616, %617 : i64
    %618 = llvm.mlir.constant(1 : i64) : i64
    %619 = llvm.alloca %618 x i64 : (i64) -> !llvm.ptr
    llvm.store %615, %619 : i64, !llvm.ptr
    %620 = llvm.load %619 : !llvm.ptr -> i64
    %621 = arith.constant 0 : i32
    %623 = arith.extsi %621 : i32 to i64
    %622 = arith.cmpi slt, %620, %623 : i64
    cf.cond_br %622, ^bb99, ^bb100
    ^bb99:
      %624 = llvm.load %619 : !llvm.ptr -> i64
      %625 = llvm.mlir.addressof @MOD : !llvm.ptr
      %626 = llvm.load %625 : !llvm.ptr -> i64
      %627 = arith.addi %624, %626 : i64
      llvm.store %627, %619 : i64, !llvm.ptr
      cf.br ^bb101
    ^bb100:
      cf.br ^bb101
    ^bb101:
    %628 = llvm.load %619 : !llvm.ptr -> i64
    func.return %628 : i64
  }
  func.func @convolve_mod(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: !llvm.ptr) -> !llvm.ptr {
    %629 = arith.constant 0 : i32
    %631 = arith.extsi %629 : i32 to i64
    %630 = arith.cmpi eq, %arg1, %631 : i64
    %632 = scf.if %630 -> (i1) {
      %633 = arith.constant true
      scf.yield %633 : i1
    } else {
      %634 = arith.constant 0 : i32
      %636 = arith.extsi %634 : i32 to i64
      %635 = arith.cmpi eq, %arg3, %636 : i64
      scf.yield %635 : i1
    }
    cf.cond_br %632, ^bb102, ^bb103
    ^bb102:
      %637 = arith.constant 0 : i32
      %638 = arith.constant 0 : i32
      %639 = arith.extsi %637 : i32 to i64
      %640 = arith.extsi %638 : i32 to i64
      %641 = llvm.getelementptr %arg4[%640] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %639, %641 : i64, !llvm.ptr
      %642 = llvm.mlir.zero : !llvm.ptr
      func.return %642 : !llvm.ptr
    ^bb103:
      cf.br ^bb104
    ^bb104:
    %644 = arith.constant 1 : i32
    %645 = arith.constant 8 : i32
    %646 = arith.extsi %644 : i32 to i64
    %647 = arith.extsi %645 : i32 to i64
    %643 = func.call @calloc(%646, %647) : (i64, i64) -> !llvm.ptr
    %649 = arith.constant 1 : i32
    %650 = arith.constant 8 : i32
    %651 = arith.extsi %649 : i32 to i64
    %652 = arith.extsi %650 : i32 to i64
    %648 = func.call @calloc(%651, %652) : (i64, i64) -> !llvm.ptr
    %654 = arith.constant 1 : i32
    %655 = arith.constant 8 : i32
    %656 = arith.extsi %654 : i32 to i64
    %657 = arith.extsi %655 : i32 to i64
    %653 = func.call @calloc(%656, %657) : (i64, i64) -> !llvm.ptr
    %659 = llvm.mlir.addressof @P1 : !llvm.ptr
    %660 = llvm.load %659 : !llvm.ptr -> i64
    %661 = arith.constant 3 : i32
    %662 = arith.extsi %661 : i32 to i64
    %658 = func.call @convolve_one(%arg0, %arg1, %arg2, %arg3, %660, %662, %643) : (!llvm.ptr, i64, !llvm.ptr, i64, i64, i64, !llvm.ptr) -> !llvm.ptr
    %664 = llvm.mlir.addressof @P2 : !llvm.ptr
    %665 = llvm.load %664 : !llvm.ptr -> i64
    %666 = arith.constant 3 : i32
    %667 = arith.extsi %666 : i32 to i64
    %663 = func.call @convolve_one(%arg0, %arg1, %arg2, %arg3, %665, %667, %648) : (!llvm.ptr, i64, !llvm.ptr, i64, i64, i64, !llvm.ptr) -> !llvm.ptr
    %669 = llvm.mlir.addressof @P3 : !llvm.ptr
    %670 = llvm.load %669 : !llvm.ptr -> i64
    %671 = arith.constant 3 : i32
    %672 = arith.extsi %671 : i32 to i64
    %668 = func.call @convolve_one(%arg0, %arg1, %arg2, %arg3, %670, %672, %653) : (!llvm.ptr, i64, !llvm.ptr, i64, i64, i64, !llvm.ptr) -> !llvm.ptr
    %673 = arith.addi %arg1, %arg3 : i64
    %674 = arith.constant 1 : i32
    %676 = arith.extsi %674 : i32 to i64
    %675 = arith.subi %673, %676 : i64
    %678 = arith.constant 8 : i32
    %680 = arith.extsi %678 : i32 to i64
    %679 = arith.muli %675, %680 : i64
    %677 = func.call @malloc(%679) : (i64) -> !llvm.ptr
    %681 = arith.constant 0 : i32
    %682 = arith.extsi %681 : i32 to i64
    %683 = llvm.mlir.constant(1 : i64) : i64
    %684 = llvm.alloca %683 x i64 : (i64) -> !llvm.ptr
    llvm.store %682, %684 : i64, !llvm.ptr
    cf.br ^bb105
    ^bb105:
    %685 = llvm.load %684 : !llvm.ptr -> i64
    %686 = arith.cmpi slt, %685, %675 : i64
    cf.cond_br %686, ^bb106, ^bb107
    ^bb106:
      %689 = llvm.load %684 : !llvm.ptr -> i64
      %690 = llvm.getelementptr %658[%689] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %688 = llvm.load %690 : !llvm.ptr -> i64
      %692 = llvm.load %684 : !llvm.ptr -> i64
      %693 = llvm.getelementptr %663[%692] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %691 = llvm.load %693 : !llvm.ptr -> i64
      %695 = llvm.load %684 : !llvm.ptr -> i64
      %696 = llvm.getelementptr %668[%695] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %694 = llvm.load %696 : !llvm.ptr -> i64
      %687 = func.call @crt3(%688, %691, %694) : (i64, i64, i64) -> i64
      %697 = llvm.load %684 : !llvm.ptr -> i64
      %698 = llvm.getelementptr %677[%697] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %687, %698 : i64, !llvm.ptr
      %699 = llvm.load %684 : !llvm.ptr -> i64
      %700 = arith.constant 1 : i32
      %702 = arith.extsi %700 : i32 to i64
      %701 = arith.addi %699, %702 : i64
      llvm.store %701, %684 : i64, !llvm.ptr
      cf.br ^bb105
    ^bb107:
    func.call @free(%658) : (!llvm.ptr) -> ()
    func.call @free(%663) : (!llvm.ptr) -> ()
    func.call @free(%668) : (!llvm.ptr) -> ()
    func.call @free(%643) : (!llvm.ptr) -> ()
    func.call @free(%648) : (!llvm.ptr) -> ()
    func.call @free(%653) : (!llvm.ptr) -> ()
    %709 = arith.constant 0 : i32
    %710 = arith.extsi %709 : i32 to i64
    %711 = llvm.getelementptr %arg4[%710] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %675, %711 : i64, !llvm.ptr
    func.return %677 : !llvm.ptr
  }
  func.func @poly_inv(%arg0: !llvm.ptr, %arg1: i64) -> !llvm.ptr {
    %713 = arith.constant 8 : i32
    %714 = arith.extsi %713 : i32 to i64
    %712 = func.call @calloc(%arg1, %714) : (i64, i64) -> !llvm.ptr
    %715 = llvm.mlir.constant(1 : i64) : i64
    %716 = llvm.alloca %715 x !llvm.ptr : (i64) -> !llvm.ptr
    llvm.store %712, %716 : !llvm.ptr, !llvm.ptr
    %719 = arith.constant 0 : i32
    %720 = arith.extsi %719 : i32 to i64
    %721 = llvm.getelementptr %arg0[%720] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %718 = llvm.load %721 : !llvm.ptr -> i64
    %722 = llvm.mlir.addressof @MOD : !llvm.ptr
    %723 = llvm.load %722 : !llvm.ptr -> i64
    %717 = func.call @mod_inv(%718, %723) : (i64, i64) -> i64
    %724 = llvm.load %716 : !llvm.ptr -> !llvm.ptr
    %725 = arith.constant 0 : i32
    %726 = arith.extsi %725 : i32 to i64
    %727 = llvm.getelementptr %724[%726] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %717, %727 : i64, !llvm.ptr
    %728 = arith.constant 1 : i32
    %729 = arith.extsi %728 : i32 to i64
    %730 = llvm.mlir.constant(1 : i64) : i64
    %731 = llvm.alloca %730 x i64 : (i64) -> !llvm.ptr
    llvm.store %729, %731 : i64, !llvm.ptr
    cf.br ^bb108
    ^bb108:
    %732 = llvm.load %731 : !llvm.ptr -> i64
    %733 = arith.cmpi slt, %732, %arg1 : i64
    cf.cond_br %733, ^bb109, ^bb110
    ^bb109:
      %734 = llvm.load %731 : !llvm.ptr -> i64
      %735 = arith.constant 2 : i32
      %737 = arith.extsi %735 : i32 to i64
      %736 = arith.muli %734, %737 : i64
      %738 = llvm.mlir.constant(1 : i64) : i64
      %739 = llvm.alloca %738 x i64 : (i64) -> !llvm.ptr
      llvm.store %736, %739 : i64, !llvm.ptr
      %740 = llvm.load %739 : !llvm.ptr -> i64
      %741 = arith.cmpi sgt, %740, %arg1 : i64
      cf.cond_br %741, ^bb111, ^bb112
      ^bb111:
        llvm.store %arg1, %739 : i64, !llvm.ptr
        cf.br ^bb113
      ^bb112:
        cf.br ^bb113
      ^bb113:
      %743 = arith.constant 1 : i32
      %744 = arith.constant 8 : i32
      %745 = arith.extsi %743 : i32 to i64
      %746 = arith.extsi %744 : i32 to i64
      %742 = func.call @calloc(%745, %746) : (i64, i64) -> !llvm.ptr
      %748 = llvm.load %739 : !llvm.ptr -> i64
      %749 = llvm.load %716 : !llvm.ptr -> !llvm.ptr
      %750 = llvm.load %731 : !llvm.ptr -> i64
      %747 = func.call @convolve_mod(%arg0, %748, %749, %750, %742) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
      %752 = arith.constant 0 : i32
      %753 = arith.extsi %752 : i32 to i64
      %754 = llvm.getelementptr %742[%753] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %751 = llvm.load %754 : !llvm.ptr -> i64
      %755 = llvm.load %739 : !llvm.ptr -> i64
      %756 = arith.cmpi sgt, %751, %755 : i64
      %757 = scf.if %756 -> (i64) {
        %758 = llvm.load %739 : !llvm.ptr -> i64
        scf.yield %758 : i64
      } else {
        scf.yield %751 : i64
      }
      func.call @free(%742) : (!llvm.ptr) -> ()
      %761 = llvm.load %739 : !llvm.ptr -> i64
      %762 = arith.constant 8 : i32
      %763 = arith.extsi %762 : i32 to i64
      %760 = func.call @calloc(%761, %763) : (i64, i64) -> !llvm.ptr
      %764 = arith.constant 0 : i32
      %765 = arith.extsi %764 : i32 to i64
      %766 = llvm.mlir.constant(1 : i64) : i64
      %767 = llvm.alloca %766 x i64 : (i64) -> !llvm.ptr
      llvm.store %765, %767 : i64, !llvm.ptr
      cf.br ^bb114
      ^bb114:
      %768 = llvm.load %767 : !llvm.ptr -> i64
      %769 = arith.cmpi slt, %768, %757 : i64
      %770 = scf.if %769 -> (i1) {
        %771 = llvm.load %767 : !llvm.ptr -> i64
        %772 = llvm.load %739 : !llvm.ptr -> i64
        %773 = arith.cmpi slt, %771, %772 : i64
        scf.yield %773 : i1
      } else {
        %774 = arith.constant false
        scf.yield %774 : i1
      }
      cf.cond_br %770, ^bb115, ^bb116
      ^bb115:
        %775 = llvm.mlir.addressof @MOD : !llvm.ptr
        %776 = llvm.load %775 : !llvm.ptr -> i64
        %778 = llvm.load %767 : !llvm.ptr -> i64
        %779 = llvm.getelementptr %747[%778] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %777 = llvm.load %779 : !llvm.ptr -> i64
        %780 = arith.subi %776, %777 : i64
        %781 = llvm.mlir.addressof @MOD : !llvm.ptr
        %782 = llvm.load %781 : !llvm.ptr -> i64
        %783 = arith.remsi %780, %782 : i64
        %784 = llvm.load %767 : !llvm.ptr -> i64
        %785 = llvm.getelementptr %760[%784] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %783, %785 : i64, !llvm.ptr
        %786 = llvm.load %767 : !llvm.ptr -> i64
        %787 = arith.constant 1 : i32
        %789 = arith.extsi %787 : i32 to i64
        %788 = arith.addi %786, %789 : i64
        llvm.store %788, %767 : i64, !llvm.ptr
        cf.br ^bb114
      ^bb116:
      %791 = arith.constant 0 : i32
      %792 = arith.extsi %791 : i32 to i64
      %793 = llvm.getelementptr %760[%792] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %790 = llvm.load %793 : !llvm.ptr -> i64
      %794 = arith.constant 2 : i32
      %796 = arith.extsi %794 : i32 to i64
      %795 = arith.addi %790, %796 : i64
      %797 = llvm.mlir.addressof @MOD : !llvm.ptr
      %798 = llvm.load %797 : !llvm.ptr -> i64
      %799 = arith.remsi %795, %798 : i64
      %800 = arith.constant 0 : i32
      %801 = arith.extsi %800 : i32 to i64
      %802 = llvm.getelementptr %760[%801] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %799, %802 : i64, !llvm.ptr
      func.call @free(%747) : (!llvm.ptr) -> ()
      %805 = arith.constant 1 : i32
      %806 = arith.constant 8 : i32
      %807 = arith.extsi %805 : i32 to i64
      %808 = arith.extsi %806 : i32 to i64
      %804 = func.call @calloc(%807, %808) : (i64, i64) -> !llvm.ptr
      %810 = llvm.load %716 : !llvm.ptr -> !llvm.ptr
      %811 = llvm.load %731 : !llvm.ptr -> i64
      %812 = llvm.load %739 : !llvm.ptr -> i64
      %809 = func.call @convolve_mod(%810, %811, %760, %812, %804) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
      func.call @free(%804) : (!llvm.ptr) -> ()
      %815 = llvm.load %716 : !llvm.ptr -> !llvm.ptr
      func.call @free(%815) : (!llvm.ptr) -> ()
      func.call @free(%760) : (!llvm.ptr) -> ()
      %818 = llvm.load %739 : !llvm.ptr -> i64
      %819 = arith.constant 8 : i32
      %820 = arith.extsi %819 : i32 to i64
      %817 = func.call @calloc(%818, %820) : (i64, i64) -> !llvm.ptr
      %821 = arith.constant 0 : i32
      %822 = arith.extsi %821 : i32 to i64
      llvm.store %822, %767 : i64, !llvm.ptr
      cf.br ^bb117
      ^bb117:
      %823 = llvm.load %767 : !llvm.ptr -> i64
      %824 = llvm.load %739 : !llvm.ptr -> i64
      %825 = arith.cmpi slt, %823, %824 : i64
      cf.cond_br %825, ^bb118, ^bb119
      ^bb118:
        %827 = llvm.load %767 : !llvm.ptr -> i64
        %828 = llvm.getelementptr %809[%827] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %826 = llvm.load %828 : !llvm.ptr -> i64
        %829 = llvm.load %767 : !llvm.ptr -> i64
        %830 = llvm.getelementptr %817[%829] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %826, %830 : i64, !llvm.ptr
        %831 = llvm.load %767 : !llvm.ptr -> i64
        %832 = arith.constant 1 : i32
        %834 = arith.extsi %832 : i32 to i64
        %833 = arith.addi %831, %834 : i64
        llvm.store %833, %767 : i64, !llvm.ptr
        cf.br ^bb117
      ^bb119:
      func.call @free(%809) : (!llvm.ptr) -> ()
      llvm.store %817, %716 : !llvm.ptr, !llvm.ptr
      %836 = llvm.load %739 : !llvm.ptr -> i64
      llvm.store %836, %731 : i64, !llvm.ptr
      cf.br ^bb108
    ^bb110:
    %837 = llvm.load %716 : !llvm.ptr -> !llvm.ptr
    func.return %837 : !llvm.ptr
  }
  func.func @poly_log(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr) -> !llvm.ptr {
    %839 = arith.constant 1 : i32
    %841 = arith.extsi %839 : i32 to i64
    %840 = arith.subi %arg1, %841 : i64
    %842 = arith.constant 8 : i32
    %844 = arith.extsi %842 : i32 to i64
    %843 = arith.muli %840, %844 : i64
    %838 = func.call @malloc(%843) : (i64) -> !llvm.ptr
    %845 = arith.constant 1 : i32
    %846 = arith.extsi %845 : i32 to i64
    %847 = llvm.mlir.constant(1 : i64) : i64
    %848 = llvm.alloca %847 x i64 : (i64) -> !llvm.ptr
    llvm.store %846, %848 : i64, !llvm.ptr
    cf.br ^bb120
    ^bb120:
    %849 = llvm.load %848 : !llvm.ptr -> i64
    %850 = arith.cmpi slt, %849, %arg1 : i64
    cf.cond_br %850, ^bb121, ^bb122
    ^bb121:
      %851 = llvm.load %848 : !llvm.ptr -> i64
      %852 = arith.extsi %851 : i64 to i128
      %854 = llvm.load %848 : !llvm.ptr -> i64
      %855 = llvm.getelementptr %arg0[%854] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %853 = llvm.load %855 : !llvm.ptr -> i64
      %856 = arith.extsi %853 : i64 to i128
      %858 = arith.trunci %852 : i128 to i64
      %859 = arith.trunci %856 : i128 to i64
      %857 = arith.muli %858, %859 : i64
      %860 = llvm.mlir.addressof @MOD : !llvm.ptr
      %861 = llvm.load %860 : !llvm.ptr -> i64
      %862 = arith.extsi %861 : i64 to i128
      %864 = arith.trunci %862 : i128 to i64
      %863 = arith.remsi %857, %864 : i64
      %865 = llvm.load %848 : !llvm.ptr -> i64
      %866 = arith.constant 1 : i32
      %868 = arith.extsi %866 : i32 to i64
      %867 = arith.subi %865, %868 : i64
      %869 = llvm.getelementptr %838[%867] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %863, %869 : i64, !llvm.ptr
      %870 = llvm.load %848 : !llvm.ptr -> i64
      %871 = arith.constant 1 : i32
      %873 = arith.extsi %871 : i32 to i64
      %872 = arith.addi %870, %873 : i64
      llvm.store %872, %848 : i64, !llvm.ptr
      cf.br ^bb120
    ^bb122:
    %874 = func.call @poly_inv(%arg0, %arg1) : (!llvm.ptr, i64) -> !llvm.ptr
    %876 = arith.constant 1 : i32
    %877 = arith.constant 8 : i32
    %878 = arith.extsi %876 : i32 to i64
    %879 = arith.extsi %877 : i32 to i64
    %875 = func.call @calloc(%878, %879) : (i64, i64) -> !llvm.ptr
    %881 = arith.constant 1 : i32
    %883 = arith.extsi %881 : i32 to i64
    %882 = arith.subi %arg1, %883 : i64
    %880 = func.call @convolve_mod(%838, %882, %874, %arg1, %875) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
    %885 = arith.constant 0 : i32
    %886 = arith.extsi %885 : i32 to i64
    %887 = llvm.getelementptr %875[%886] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %884 = llvm.load %887 : !llvm.ptr -> i64
    func.call @free(%875) : (!llvm.ptr) -> ()
    %890 = arith.constant 8 : i32
    %891 = arith.extsi %890 : i32 to i64
    %889 = func.call @calloc(%arg1, %891) : (i64, i64) -> !llvm.ptr
    %892 = arith.constant 1 : i32
    %893 = arith.extsi %892 : i32 to i64
    llvm.store %893, %848 : i64, !llvm.ptr
    cf.br ^bb123
    ^bb123:
    %894 = llvm.load %848 : !llvm.ptr -> i64
    %895 = arith.cmpi slt, %894, %arg1 : i64
    cf.cond_br %895, ^bb124, ^bb125
    ^bb124:
      %896 = llvm.load %848 : !llvm.ptr -> i64
      %897 = arith.constant 1 : i32
      %899 = arith.extsi %897 : i32 to i64
      %898 = arith.subi %896, %899 : i64
      %900 = arith.cmpi slt, %898, %884 : i64
      cf.cond_br %900, ^bb126, ^bb127
      ^bb126:
        %902 = llvm.load %848 : !llvm.ptr -> i64
        %903 = arith.constant 1 : i32
        %905 = arith.extsi %903 : i32 to i64
        %904 = arith.subi %902, %905 : i64
        %906 = llvm.getelementptr %880[%904] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %901 = llvm.load %906 : !llvm.ptr -> i64
        %907 = arith.extsi %901 : i64 to i128
        %909 = llvm.load %848 : !llvm.ptr -> i64
        %910 = llvm.getelementptr %arg2[%909] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %908 = llvm.load %910 : !llvm.ptr -> i64
        %911 = arith.extsi %908 : i64 to i128
        %913 = arith.trunci %907 : i128 to i64
        %914 = arith.trunci %911 : i128 to i64
        %912 = arith.muli %913, %914 : i64
        %915 = llvm.mlir.addressof @MOD : !llvm.ptr
        %916 = llvm.load %915 : !llvm.ptr -> i64
        %917 = arith.extsi %916 : i64 to i128
        %919 = arith.trunci %917 : i128 to i64
        %918 = arith.remsi %912, %919 : i64
        %920 = llvm.load %848 : !llvm.ptr -> i64
        %921 = llvm.getelementptr %889[%920] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %918, %921 : i64, !llvm.ptr
        cf.br ^bb128
      ^bb127:
        cf.br ^bb128
      ^bb128:
      %922 = llvm.load %848 : !llvm.ptr -> i64
      %923 = arith.constant 1 : i32
      %925 = arith.extsi %923 : i32 to i64
      %924 = arith.addi %922, %925 : i64
      llvm.store %924, %848 : i64, !llvm.ptr
      cf.br ^bb123
    ^bb125:
    func.call @free(%838) : (!llvm.ptr) -> ()
    func.call @free(%874) : (!llvm.ptr) -> ()
    func.call @free(%880) : (!llvm.ptr) -> ()
    func.return %889 : !llvm.ptr
  }
  func.func @poly_pow(%arg0: !llvm.ptr, %arg1: i64, %arg2: i64) -> !llvm.ptr {
    %930 = arith.constant 8 : i32
    %931 = arith.extsi %930 : i32 to i64
    %929 = func.call @calloc(%arg1, %931) : (i64, i64) -> !llvm.ptr
    %932 = llvm.mlir.constant(1 : i64) : i64
    %933 = llvm.alloca %932 x !llvm.ptr : (i64) -> !llvm.ptr
    llvm.store %929, %933 : !llvm.ptr, !llvm.ptr
    %934 = arith.constant 1 : i32
    %935 = llvm.load %933 : !llvm.ptr -> !llvm.ptr
    %936 = arith.constant 0 : i32
    %937 = arith.extsi %934 : i32 to i64
    %938 = arith.extsi %936 : i32 to i64
    %939 = llvm.getelementptr %935[%938] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %937, %939 : i64, !llvm.ptr
    %941 = arith.constant 8 : i32
    %943 = arith.extsi %941 : i32 to i64
    %942 = arith.muli %arg1, %943 : i64
    %940 = func.call @malloc(%942) : (i64) -> !llvm.ptr
    %944 = llvm.mlir.constant(1 : i64) : i64
    %945 = llvm.alloca %944 x !llvm.ptr : (i64) -> !llvm.ptr
    llvm.store %940, %945 : !llvm.ptr, !llvm.ptr
    %946 = arith.constant 0 : i32
    %947 = arith.extsi %946 : i32 to i64
    %948 = llvm.mlir.constant(1 : i64) : i64
    %949 = llvm.alloca %948 x i64 : (i64) -> !llvm.ptr
    llvm.store %947, %949 : i64, !llvm.ptr
    cf.br ^bb129
    ^bb129:
    %950 = llvm.load %949 : !llvm.ptr -> i64
    %951 = arith.cmpi slt, %950, %arg1 : i64
    cf.cond_br %951, ^bb130, ^bb131
    ^bb130:
      %953 = llvm.load %949 : !llvm.ptr -> i64
      %954 = llvm.getelementptr %arg0[%953] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %952 = llvm.load %954 : !llvm.ptr -> i64
      %955 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
      %956 = llvm.load %949 : !llvm.ptr -> i64
      %957 = llvm.getelementptr %955[%956] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %952, %957 : i64, !llvm.ptr
      %958 = llvm.load %949 : !llvm.ptr -> i64
      %959 = arith.constant 1 : i32
      %961 = arith.extsi %959 : i32 to i64
      %960 = arith.addi %958, %961 : i64
      llvm.store %960, %949 : i64, !llvm.ptr
      cf.br ^bb129
    ^bb131:
    %962 = llvm.mlir.constant(1 : i64) : i64
    %963 = llvm.alloca %962 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg2, %963 : i64, !llvm.ptr
    cf.br ^bb132
    ^bb132:
    %964 = llvm.load %963 : !llvm.ptr -> i64
    %965 = arith.constant 0 : i32
    %967 = arith.extsi %965 : i32 to i64
    %966 = arith.cmpi sgt, %964, %967 : i64
    cf.cond_br %966, ^bb133, ^bb134
    ^bb133:
      %968 = llvm.load %963 : !llvm.ptr -> i64
      %969 = arith.constant 2 : i32
      %971 = arith.extsi %969 : i32 to i64
      %970 = arith.remsi %968, %971 : i64
      %972 = arith.constant 1 : i32
      %974 = arith.extsi %972 : i32 to i64
      %973 = arith.cmpi eq, %970, %974 : i64
      cf.cond_br %973, ^bb135, ^bb136
      ^bb135:
        %976 = arith.constant 1 : i32
        %977 = arith.constant 8 : i32
        %978 = arith.extsi %976 : i32 to i64
        %979 = arith.extsi %977 : i32 to i64
        %975 = func.call @calloc(%978, %979) : (i64, i64) -> !llvm.ptr
        %981 = llvm.load %933 : !llvm.ptr -> !llvm.ptr
        %982 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
        %980 = func.call @convolve_mod(%981, %arg1, %982, %arg1, %975) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
        %984 = arith.constant 0 : i32
        %985 = arith.extsi %984 : i32 to i64
        %986 = llvm.getelementptr %975[%985] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %983 = llvm.load %986 : !llvm.ptr -> i64
        func.call @free(%975) : (!llvm.ptr) -> ()
        %988 = arith.constant 0 : i32
        %989 = arith.extsi %988 : i32 to i64
        llvm.store %989, %949 : i64, !llvm.ptr
        cf.br ^bb138
        ^bb138:
        %990 = llvm.load %949 : !llvm.ptr -> i64
        %991 = arith.cmpi slt, %990, %arg1 : i64
        cf.cond_br %991, ^bb139, ^bb140
        ^bb139:
          %992 = arith.constant 0 : i32
          %993 = llvm.load %933 : !llvm.ptr -> !llvm.ptr
          %994 = llvm.load %949 : !llvm.ptr -> i64
          %995 = arith.extsi %992 : i32 to i64
          %996 = llvm.getelementptr %993[%994] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %995, %996 : i64, !llvm.ptr
          %997 = llvm.load %949 : !llvm.ptr -> i64
          %998 = arith.constant 1 : i32
          %1000 = arith.extsi %998 : i32 to i64
          %999 = arith.addi %997, %1000 : i64
          llvm.store %999, %949 : i64, !llvm.ptr
          cf.br ^bb138
        ^bb140:
        %1001 = arith.constant 0 : i32
        %1002 = arith.extsi %1001 : i32 to i64
        llvm.store %1002, %949 : i64, !llvm.ptr
        cf.br ^bb141
        ^bb141:
        %1003 = llvm.load %949 : !llvm.ptr -> i64
        %1004 = arith.cmpi slt, %1003, %arg1 : i64
        %1005 = scf.if %1004 -> (i1) {
          %1006 = llvm.load %949 : !llvm.ptr -> i64
          %1007 = arith.cmpi slt, %1006, %983 : i64
          scf.yield %1007 : i1
        } else {
          %1008 = arith.constant false
          scf.yield %1008 : i1
        }
        cf.cond_br %1005, ^bb142, ^bb143
        ^bb142:
          %1010 = llvm.load %949 : !llvm.ptr -> i64
          %1011 = llvm.getelementptr %980[%1010] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %1009 = llvm.load %1011 : !llvm.ptr -> i64
          %1012 = llvm.load %933 : !llvm.ptr -> !llvm.ptr
          %1013 = llvm.load %949 : !llvm.ptr -> i64
          %1014 = llvm.getelementptr %1012[%1013] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %1009, %1014 : i64, !llvm.ptr
          %1015 = llvm.load %949 : !llvm.ptr -> i64
          %1016 = arith.constant 1 : i32
          %1018 = arith.extsi %1016 : i32 to i64
          %1017 = arith.addi %1015, %1018 : i64
          llvm.store %1017, %949 : i64, !llvm.ptr
          cf.br ^bb141
        ^bb143:
        func.call @free(%980) : (!llvm.ptr) -> ()
        cf.br ^bb137
      ^bb136:
        cf.br ^bb137
      ^bb137:
      %1020 = llvm.load %963 : !llvm.ptr -> i64
      %1021 = arith.constant 2 : i32
      %1023 = arith.extsi %1021 : i32 to i64
      %1022 = arith.divsi %1020, %1023 : i64
      llvm.store %1022, %963 : i64, !llvm.ptr
      %1024 = llvm.load %963 : !llvm.ptr -> i64
      %1025 = arith.constant 0 : i32
      %1027 = arith.extsi %1025 : i32 to i64
      %1026 = arith.cmpi sgt, %1024, %1027 : i64
      cf.cond_br %1026, ^bb144, ^bb145
      ^bb144:
        %1029 = arith.constant 1 : i32
        %1030 = arith.constant 8 : i32
        %1031 = arith.extsi %1029 : i32 to i64
        %1032 = arith.extsi %1030 : i32 to i64
        %1028 = func.call @calloc(%1031, %1032) : (i64, i64) -> !llvm.ptr
        %1034 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
        %1035 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
        %1033 = func.call @convolve_mod(%1034, %arg1, %1035, %arg1, %1028) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
        %1037 = arith.constant 0 : i32
        %1038 = arith.extsi %1037 : i32 to i64
        %1039 = llvm.getelementptr %1028[%1038] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1036 = llvm.load %1039 : !llvm.ptr -> i64
        func.call @free(%1028) : (!llvm.ptr) -> ()
        %1041 = arith.constant 0 : i32
        %1042 = arith.extsi %1041 : i32 to i64
        llvm.store %1042, %949 : i64, !llvm.ptr
        cf.br ^bb147
        ^bb147:
        %1043 = llvm.load %949 : !llvm.ptr -> i64
        %1044 = arith.cmpi slt, %1043, %arg1 : i64
        cf.cond_br %1044, ^bb148, ^bb149
        ^bb148:
          %1045 = arith.constant 0 : i32
          %1046 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
          %1047 = llvm.load %949 : !llvm.ptr -> i64
          %1048 = arith.extsi %1045 : i32 to i64
          %1049 = llvm.getelementptr %1046[%1047] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %1048, %1049 : i64, !llvm.ptr
          %1050 = llvm.load %949 : !llvm.ptr -> i64
          %1051 = arith.constant 1 : i32
          %1053 = arith.extsi %1051 : i32 to i64
          %1052 = arith.addi %1050, %1053 : i64
          llvm.store %1052, %949 : i64, !llvm.ptr
          cf.br ^bb147
        ^bb149:
        %1054 = arith.constant 0 : i32
        %1055 = arith.extsi %1054 : i32 to i64
        llvm.store %1055, %949 : i64, !llvm.ptr
        cf.br ^bb150
        ^bb150:
        %1056 = llvm.load %949 : !llvm.ptr -> i64
        %1057 = arith.cmpi slt, %1056, %arg1 : i64
        %1058 = scf.if %1057 -> (i1) {
          %1059 = llvm.load %949 : !llvm.ptr -> i64
          %1060 = arith.cmpi slt, %1059, %1036 : i64
          scf.yield %1060 : i1
        } else {
          %1061 = arith.constant false
          scf.yield %1061 : i1
        }
        cf.cond_br %1058, ^bb151, ^bb152
        ^bb151:
          %1063 = llvm.load %949 : !llvm.ptr -> i64
          %1064 = llvm.getelementptr %1033[%1063] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %1062 = llvm.load %1064 : !llvm.ptr -> i64
          %1065 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
          %1066 = llvm.load %949 : !llvm.ptr -> i64
          %1067 = llvm.getelementptr %1065[%1066] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %1062, %1067 : i64, !llvm.ptr
          %1068 = llvm.load %949 : !llvm.ptr -> i64
          %1069 = arith.constant 1 : i32
          %1071 = arith.extsi %1069 : i32 to i64
          %1070 = arith.addi %1068, %1071 : i64
          llvm.store %1070, %949 : i64, !llvm.ptr
          cf.br ^bb150
        ^bb152:
        func.call @free(%1033) : (!llvm.ptr) -> ()
        cf.br ^bb146
      ^bb145:
        cf.br ^bb146
      ^bb146:
      cf.br ^bb132
    ^bb134:
    %1074 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1074) : (!llvm.ptr) -> ()
    %1075 = llvm.load %933 : !llvm.ptr -> !llvm.ptr
    func.return %1075 : !llvm.ptr
  }
  func.func @precompute(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr) -> () {
    %1076 = arith.constant 1 : i32
    %1077 = arith.constant 0 : i32
    %1078 = arith.extsi %1076 : i32 to i64
    %1079 = arith.extsi %1077 : i32 to i64
    %1080 = llvm.getelementptr %arg1[%1079] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1078, %1080 : i64, !llvm.ptr
    %1081 = arith.constant 1 : i32
    %1082 = arith.extsi %1081 : i32 to i64
    %1083 = llvm.mlir.constant(1 : i64) : i64
    %1084 = llvm.alloca %1083 x i64 : (i64) -> !llvm.ptr
    llvm.store %1082, %1084 : i64, !llvm.ptr
    cf.br ^bb153
    ^bb153:
    %1085 = llvm.load %1084 : !llvm.ptr -> i64
    %1086 = arith.cmpi sle, %1085, %arg0 : i64
    cf.cond_br %1086, ^bb154, ^bb155
    ^bb154:
      %1088 = llvm.load %1084 : !llvm.ptr -> i64
      %1089 = arith.constant 1 : i32
      %1091 = arith.extsi %1089 : i32 to i64
      %1090 = arith.subi %1088, %1091 : i64
      %1092 = llvm.getelementptr %arg1[%1090] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1087 = llvm.load %1092 : !llvm.ptr -> i64
      %1093 = arith.extsi %1087 : i64 to i128
      %1094 = llvm.load %1084 : !llvm.ptr -> i64
      %1095 = arith.extsi %1094 : i64 to i128
      %1097 = arith.trunci %1093 : i128 to i64
      %1098 = arith.trunci %1095 : i128 to i64
      %1096 = arith.muli %1097, %1098 : i64
      %1099 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1100 = llvm.load %1099 : !llvm.ptr -> i64
      %1101 = arith.extsi %1100 : i64 to i128
      %1103 = arith.trunci %1101 : i128 to i64
      %1102 = arith.remsi %1096, %1103 : i64
      %1104 = llvm.load %1084 : !llvm.ptr -> i64
      %1105 = llvm.getelementptr %arg1[%1104] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1102, %1105 : i64, !llvm.ptr
      %1106 = llvm.load %1084 : !llvm.ptr -> i64
      %1107 = arith.constant 1 : i32
      %1109 = arith.extsi %1107 : i32 to i64
      %1108 = arith.addi %1106, %1109 : i64
      llvm.store %1108, %1084 : i64, !llvm.ptr
      cf.br ^bb153
    ^bb155:
    %1112 = llvm.getelementptr %arg1[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %1111 = llvm.load %1112 : !llvm.ptr -> i64
    %1113 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1114 = llvm.load %1113 : !llvm.ptr -> i64
    %1110 = func.call @mod_inv(%1111, %1114) : (i64, i64) -> i64
    %1115 = llvm.getelementptr %arg2[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1110, %1115 : i64, !llvm.ptr
    llvm.store %arg0, %1084 : i64, !llvm.ptr
    cf.br ^bb156
    ^bb156:
    %1116 = llvm.load %1084 : !llvm.ptr -> i64
    %1117 = arith.constant 0 : i32
    %1119 = arith.extsi %1117 : i32 to i64
    %1118 = arith.cmpi sgt, %1116, %1119 : i64
    cf.cond_br %1118, ^bb157, ^bb158
    ^bb157:
      %1121 = llvm.load %1084 : !llvm.ptr -> i64
      %1122 = llvm.getelementptr %arg2[%1121] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1120 = llvm.load %1122 : !llvm.ptr -> i64
      %1123 = arith.extsi %1120 : i64 to i128
      %1124 = llvm.load %1084 : !llvm.ptr -> i64
      %1125 = arith.extsi %1124 : i64 to i128
      %1127 = arith.trunci %1123 : i128 to i64
      %1128 = arith.trunci %1125 : i128 to i64
      %1126 = arith.muli %1127, %1128 : i64
      %1129 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1130 = llvm.load %1129 : !llvm.ptr -> i64
      %1131 = arith.extsi %1130 : i64 to i128
      %1133 = arith.trunci %1131 : i128 to i64
      %1132 = arith.remsi %1126, %1133 : i64
      %1134 = llvm.load %1084 : !llvm.ptr -> i64
      %1135 = arith.constant 1 : i32
      %1137 = arith.extsi %1135 : i32 to i64
      %1136 = arith.subi %1134, %1137 : i64
      %1138 = llvm.getelementptr %arg2[%1136] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1132, %1138 : i64, !llvm.ptr
      %1139 = llvm.load %1084 : !llvm.ptr -> i64
      %1140 = arith.constant 1 : i32
      %1142 = arith.extsi %1140 : i32 to i64
      %1141 = arith.subi %1139, %1142 : i64
      llvm.store %1141, %1084 : i64, !llvm.ptr
      cf.br ^bb156
    ^bb158:
    %1143 = arith.constant 0 : i32
    %1144 = arith.constant 0 : i32
    %1145 = arith.extsi %1143 : i32 to i64
    %1146 = arith.extsi %1144 : i32 to i64
    %1147 = llvm.getelementptr %arg3[%1146] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1145, %1147 : i64, !llvm.ptr
    %1148 = arith.constant 1 : i32
    %1150 = arith.extsi %1148 : i32 to i64
    %1149 = arith.cmpi sge, %arg0, %1150 : i64
    cf.cond_br %1149, ^bb159, ^bb160
    ^bb159:
      %1151 = arith.constant 1 : i32
      %1152 = arith.constant 1 : i32
      %1153 = arith.extsi %1151 : i32 to i64
      %1154 = arith.extsi %1152 : i32 to i64
      %1155 = llvm.getelementptr %arg3[%1154] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1153, %1155 : i64, !llvm.ptr
      cf.br ^bb161
    ^bb160:
      cf.br ^bb161
    ^bb161:
    %1156 = arith.constant 2 : i32
    %1157 = arith.extsi %1156 : i32 to i64
    llvm.store %1157, %1084 : i64, !llvm.ptr
    cf.br ^bb162
    ^bb162:
    %1158 = llvm.load %1084 : !llvm.ptr -> i64
    %1159 = arith.cmpi sle, %1158, %arg0 : i64
    cf.cond_br %1159, ^bb163, ^bb164
    ^bb163:
      %1160 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1161 = llvm.load %1160 : !llvm.ptr -> i64
      %1162 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1163 = llvm.load %1162 : !llvm.ptr -> i64
      %1164 = llvm.load %1084 : !llvm.ptr -> i64
      %1165 = arith.divsi %1163, %1164 : i64
      %1166 = arith.extsi %1165 : i64 to i128
      %1168 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1169 = llvm.load %1168 : !llvm.ptr -> i64
      %1170 = llvm.load %1084 : !llvm.ptr -> i64
      %1171 = arith.remsi %1169, %1170 : i64
      %1172 = llvm.getelementptr %arg3[%1171] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1167 = llvm.load %1172 : !llvm.ptr -> i64
      %1173 = arith.extsi %1167 : i64 to i128
      %1175 = arith.trunci %1166 : i128 to i64
      %1176 = arith.trunci %1173 : i128 to i64
      %1174 = arith.muli %1175, %1176 : i64
      %1177 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1178 = llvm.load %1177 : !llvm.ptr -> i64
      %1179 = arith.extsi %1178 : i64 to i128
      %1181 = arith.trunci %1179 : i128 to i64
      %1180 = arith.remsi %1174, %1181 : i64
      %1182 = arith.subi %1161, %1180 : i64
      %1183 = llvm.load %1084 : !llvm.ptr -> i64
      %1184 = llvm.getelementptr %arg3[%1183] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1182, %1184 : i64, !llvm.ptr
      %1185 = llvm.load %1084 : !llvm.ptr -> i64
      %1186 = arith.constant 1 : i32
      %1188 = arith.extsi %1186 : i32 to i64
      %1187 = arith.addi %1185, %1188 : i64
      llvm.store %1187, %1084 : i64, !llvm.ptr
      cf.br ^bb162
    ^bb164:
    func.return
  }
  func.func @compute_A(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> !llvm.ptr {
    %1189 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1190 = llvm.load %1189 : !llvm.ptr -> i64
    %1191 = arith.constant 1 : i32
    %1193 = arith.extsi %1191 : i32 to i64
    %1192 = arith.subi %1190, %1193 : i64
    %1195 = arith.constant 1 : i32
    %1197 = arith.extsi %1195 : i32 to i64
    %1196 = arith.addi %arg0, %1197 : i64
    %1198 = arith.constant 8 : i32
    %1200 = arith.extsi %1198 : i32 to i64
    %1199 = arith.muli %1196, %1200 : i64
    %1194 = func.call @malloc(%1199) : (i64) -> !llvm.ptr
    %1201 = arith.constant 1 : i32
    %1202 = arith.constant 0 : i32
    %1203 = arith.extsi %1201 : i32 to i64
    %1204 = arith.extsi %1202 : i32 to i64
    %1205 = llvm.getelementptr %1194[%1204] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1203, %1205 : i64, !llvm.ptr
    %1206 = arith.constant 1 : i32
    %1207 = arith.extsi %1206 : i32 to i64
    %1208 = llvm.mlir.constant(1 : i64) : i64
    %1209 = llvm.alloca %1208 x i64 : (i64) -> !llvm.ptr
    llvm.store %1207, %1209 : i64, !llvm.ptr
    cf.br ^bb165
    ^bb165:
    %1210 = llvm.load %1209 : !llvm.ptr -> i64
    %1211 = arith.cmpi sle, %1210, %arg0 : i64
    cf.cond_br %1211, ^bb166, ^bb167
    ^bb166:
      %1213 = llvm.load %1209 : !llvm.ptr -> i64
      %1214 = arith.constant 1 : i32
      %1216 = arith.extsi %1214 : i32 to i64
      %1215 = arith.subi %1213, %1216 : i64
      %1217 = llvm.getelementptr %1194[%1215] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1212 = llvm.load %1217 : !llvm.ptr -> i64
      %1218 = arith.constant 2 : i32
      %1220 = arith.extsi %1218 : i32 to i64
      %1219 = arith.muli %1212, %1220 : i64
      %1221 = arith.remsi %1219, %1192 : i64
      %1222 = llvm.load %1209 : !llvm.ptr -> i64
      %1223 = llvm.getelementptr %1194[%1222] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1221, %1223 : i64, !llvm.ptr
      %1224 = llvm.load %1209 : !llvm.ptr -> i64
      %1225 = arith.constant 1 : i32
      %1227 = arith.extsi %1225 : i32 to i64
      %1226 = arith.addi %1224, %1227 : i64
      llvm.store %1226, %1209 : i64, !llvm.ptr
      cf.br ^bb165
    ^bb167:
    %1229 = arith.constant 1 : i32
    %1231 = arith.extsi %1229 : i32 to i64
    %1230 = arith.addi %arg0, %1231 : i64
    %1232 = arith.constant 8 : i32
    %1234 = arith.extsi %1232 : i32 to i64
    %1233 = arith.muli %1230, %1234 : i64
    %1228 = func.call @malloc(%1233) : (i64) -> !llvm.ptr
    %1235 = arith.constant 0 : i32
    %1236 = arith.extsi %1235 : i32 to i64
    llvm.store %1236, %1209 : i64, !llvm.ptr
    cf.br ^bb168
    ^bb168:
    %1237 = llvm.load %1209 : !llvm.ptr -> i64
    %1238 = arith.cmpi sle, %1237, %arg0 : i64
    cf.cond_br %1238, ^bb169, ^bb170
    ^bb169:
      %1240 = arith.constant 2 : i32
      %1242 = llvm.load %1209 : !llvm.ptr -> i64
      %1243 = llvm.getelementptr %1194[%1242] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1241 = llvm.load %1243 : !llvm.ptr -> i64
      %1244 = arith.constant 1 : i32
      %1246 = arith.extsi %1244 : i32 to i64
      %1245 = arith.subi %1241, %1246 : i64
      %1247 = arith.remsi %1245, %1192 : i64
      %1248 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1249 = llvm.load %1248 : !llvm.ptr -> i64
      %1250 = arith.extsi %1240 : i32 to i64
      %1239 = func.call @mod_pow(%1250, %1247, %1249) : (i64, i64, i64) -> i64
      %1251 = llvm.load %1209 : !llvm.ptr -> i64
      %1252 = llvm.getelementptr %1228[%1251] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1239, %1252 : i64, !llvm.ptr
      %1253 = llvm.load %1209 : !llvm.ptr -> i64
      %1254 = arith.constant 1 : i32
      %1256 = arith.extsi %1254 : i32 to i64
      %1255 = arith.addi %1253, %1256 : i64
      llvm.store %1255, %1209 : i64, !llvm.ptr
      cf.br ^bb168
    ^bb170:
    %1258 = arith.constant 1 : i32
    %1260 = arith.extsi %1258 : i32 to i64
    %1259 = arith.addi %arg0, %1260 : i64
    %1261 = arith.constant 8 : i32
    %1263 = arith.extsi %1261 : i32 to i64
    %1262 = arith.muli %1259, %1263 : i64
    %1257 = func.call @malloc(%1262) : (i64) -> !llvm.ptr
    %1265 = arith.constant 1 : i32
    %1267 = arith.extsi %1265 : i32 to i64
    %1266 = arith.addi %arg0, %1267 : i64
    %1268 = arith.constant 8 : i32
    %1270 = arith.extsi %1268 : i32 to i64
    %1269 = arith.muli %1266, %1270 : i64
    %1264 = func.call @malloc(%1269) : (i64) -> !llvm.ptr
    %1271 = arith.constant 0 : i32
    %1272 = arith.extsi %1271 : i32 to i64
    llvm.store %1272, %1209 : i64, !llvm.ptr
    cf.br ^bb171
    ^bb171:
    %1273 = llvm.load %1209 : !llvm.ptr -> i64
    %1274 = arith.cmpi sle, %1273, %arg0 : i64
    cf.cond_br %1274, ^bb172, ^bb173
    ^bb172:
      %1276 = llvm.load %1209 : !llvm.ptr -> i64
      %1277 = llvm.getelementptr %1228[%1276] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1275 = llvm.load %1277 : !llvm.ptr -> i64
      %1278 = arith.extsi %1275 : i64 to i128
      %1280 = llvm.load %1209 : !llvm.ptr -> i64
      %1281 = llvm.getelementptr %arg1[%1280] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1279 = llvm.load %1281 : !llvm.ptr -> i64
      %1282 = arith.extsi %1279 : i64 to i128
      %1284 = arith.trunci %1278 : i128 to i64
      %1285 = arith.trunci %1282 : i128 to i64
      %1283 = arith.muli %1284, %1285 : i64
      %1286 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1287 = llvm.load %1286 : !llvm.ptr -> i64
      %1288 = arith.extsi %1287 : i64 to i128
      %1290 = arith.trunci %1288 : i128 to i64
      %1289 = arith.remsi %1283, %1290 : i64
      %1291 = llvm.load %1209 : !llvm.ptr -> i64
      %1292 = llvm.getelementptr %1257[%1291] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1289, %1292 : i64, !llvm.ptr
      %1293 = llvm.load %1209 : !llvm.ptr -> i64
      %1294 = arith.constant 2 : i32
      %1296 = arith.extsi %1294 : i32 to i64
      %1295 = arith.remsi %1293, %1296 : i64
      %1297 = arith.constant 1 : i32
      %1299 = arith.extsi %1297 : i32 to i64
      %1298 = arith.cmpi eq, %1295, %1299 : i64
      cf.cond_br %1298, ^bb174, ^bb175
      ^bb174:
        %1300 = llvm.mlir.addressof @MOD : !llvm.ptr
        %1301 = llvm.load %1300 : !llvm.ptr -> i64
        %1303 = llvm.load %1209 : !llvm.ptr -> i64
        %1304 = llvm.getelementptr %arg1[%1303] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1302 = llvm.load %1304 : !llvm.ptr -> i64
        %1305 = arith.subi %1301, %1302 : i64
        %1306 = llvm.mlir.addressof @MOD : !llvm.ptr
        %1307 = llvm.load %1306 : !llvm.ptr -> i64
        %1308 = arith.remsi %1305, %1307 : i64
        %1309 = llvm.load %1209 : !llvm.ptr -> i64
        %1310 = llvm.getelementptr %1264[%1309] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1308, %1310 : i64, !llvm.ptr
        cf.br ^bb176
      ^bb175:
        %1312 = llvm.load %1209 : !llvm.ptr -> i64
        %1313 = llvm.getelementptr %arg1[%1312] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1311 = llvm.load %1313 : !llvm.ptr -> i64
        %1314 = llvm.load %1209 : !llvm.ptr -> i64
        %1315 = llvm.getelementptr %1264[%1314] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1311, %1315 : i64, !llvm.ptr
        cf.br ^bb176
      ^bb176:
      %1316 = llvm.load %1209 : !llvm.ptr -> i64
      %1317 = arith.constant 1 : i32
      %1319 = arith.extsi %1317 : i32 to i64
      %1318 = arith.addi %1316, %1319 : i64
      llvm.store %1318, %1209 : i64, !llvm.ptr
      cf.br ^bb171
    ^bb173:
    %1321 = arith.constant 1 : i32
    %1322 = arith.constant 8 : i32
    %1323 = arith.extsi %1321 : i32 to i64
    %1324 = arith.extsi %1322 : i32 to i64
    %1320 = func.call @calloc(%1323, %1324) : (i64, i64) -> !llvm.ptr
    %1326 = arith.constant 1 : i32
    %1328 = arith.extsi %1326 : i32 to i64
    %1327 = arith.addi %arg0, %1328 : i64
    %1329 = arith.constant 1 : i32
    %1331 = arith.extsi %1329 : i32 to i64
    %1330 = arith.addi %arg0, %1331 : i64
    %1325 = func.call @convolve_mod(%1257, %1327, %1264, %1330, %1320) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
    %1333 = arith.constant 0 : i32
    %1334 = arith.extsi %1333 : i32 to i64
    %1335 = llvm.getelementptr %1320[%1334] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %1332 = llvm.load %1335 : !llvm.ptr -> i64
    func.call @free(%1320) : (!llvm.ptr) -> ()
    %1338 = arith.constant 1 : i32
    %1340 = arith.extsi %1338 : i32 to i64
    %1339 = arith.addi %arg0, %1340 : i64
    %1341 = arith.constant 8 : i32
    %1342 = arith.extsi %1341 : i32 to i64
    %1337 = func.call @calloc(%1339, %1342) : (i64, i64) -> !llvm.ptr
    %1343 = arith.constant 0 : i32
    %1344 = arith.extsi %1343 : i32 to i64
    llvm.store %1344, %1209 : i64, !llvm.ptr
    cf.br ^bb177
    ^bb177:
    %1345 = llvm.load %1209 : !llvm.ptr -> i64
    %1346 = arith.cmpi sle, %1345, %arg0 : i64
    %1347 = scf.if %1346 -> (i1) {
      %1348 = llvm.load %1209 : !llvm.ptr -> i64
      %1349 = arith.cmpi slt, %1348, %1332 : i64
      scf.yield %1349 : i1
    } else {
      %1350 = arith.constant false
      scf.yield %1350 : i1
    }
    cf.cond_br %1347, ^bb178, ^bb179
    ^bb178:
      %1352 = llvm.load %1209 : !llvm.ptr -> i64
      %1353 = llvm.getelementptr %1325[%1352] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1351 = llvm.load %1353 : !llvm.ptr -> i64
      %1354 = llvm.load %1209 : !llvm.ptr -> i64
      %1355 = llvm.getelementptr %1337[%1354] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1351, %1355 : i64, !llvm.ptr
      %1356 = llvm.load %1209 : !llvm.ptr -> i64
      %1357 = arith.constant 1 : i32
      %1359 = arith.extsi %1357 : i32 to i64
      %1358 = arith.addi %1356, %1359 : i64
      llvm.store %1358, %1209 : i64, !llvm.ptr
      cf.br ^bb177
    ^bb179:
    %1360 = arith.constant 1 : i32
    %1361 = arith.constant 0 : i32
    %1362 = arith.extsi %1360 : i32 to i64
    %1363 = arith.extsi %1361 : i32 to i64
    %1364 = llvm.getelementptr %1337[%1363] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1362, %1364 : i64, !llvm.ptr
    func.call @free(%1325) : (!llvm.ptr) -> ()
    %1367 = arith.constant 1 : i32
    %1369 = arith.extsi %1367 : i32 to i64
    %1368 = arith.addi %arg0, %1369 : i64
    %1366 = func.call @poly_log(%1337, %1368, %arg2) : (!llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
    func.call @free(%1194) : (!llvm.ptr) -> ()
    func.call @free(%1228) : (!llvm.ptr) -> ()
    func.call @free(%1257) : (!llvm.ptr) -> ()
    func.call @free(%1264) : (!llvm.ptr) -> ()
    func.call @free(%1337) : (!llvm.ptr) -> ()
    func.return %1366 : !llvm.ptr
  }
  func.func @C_nk(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr) -> i64 {
    %1375 = arith.constant 1 : i32
    %1377 = arith.extsi %1375 : i32 to i64
    %1376 = arith.addi %arg0, %1377 : i64
    %1378 = func.call @poly_pow(%arg2, %1376, %arg1) : (!llvm.ptr, i64, i64) -> !llvm.ptr
    %1380 = arith.constant 1 : i32
    %1381 = arith.constant 8 : i32
    %1382 = arith.extsi %1380 : i32 to i64
    %1383 = arith.extsi %1381 : i32 to i64
    %1379 = func.call @calloc(%1382, %1383) : (i64, i64) -> !llvm.ptr
    %1384 = func.call @convolve_mod(%1378, %1376, %arg4, %1376, %1379) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> !llvm.ptr
    %1386 = arith.constant 0 : i32
    %1387 = arith.extsi %1386 : i32 to i64
    %1388 = llvm.getelementptr %1379[%1387] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %1385 = llvm.load %1388 : !llvm.ptr -> i64
    func.call @free(%1379) : (!llvm.ptr) -> ()
    %1390 = arith.cmpi slt, %arg0, %1385 : i64
    %1391 = scf.if %1390 -> (i64) {
      %1393 = llvm.getelementptr %1384[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1392 = llvm.load %1393 : !llvm.ptr -> i64
      scf.yield %1392 : i64
    } else {
      %1394 = arith.constant 0 : i32
      scf.yield %1394 : i32
    }
    %1396 = llvm.getelementptr %arg3[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %1395 = llvm.load %1396 : !llvm.ptr -> i64
    %1397 = arith.extsi %1395 : i64 to i128
    %1398 = arith.extsi %1391 : i64 to i128
    %1400 = arith.trunci %1397 : i128 to i64
    %1401 = arith.trunci %1398 : i128 to i64
    %1399 = arith.muli %1400, %1401 : i64
    %1402 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1403 = llvm.load %1402 : !llvm.ptr -> i64
    %1404 = arith.extsi %1403 : i64 to i128
    %1406 = arith.trunci %1404 : i128 to i64
    %1405 = arith.remsi %1399, %1406 : i64
    %1408 = llvm.getelementptr %arg4[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %1407 = llvm.load %1408 : !llvm.ptr -> i64
    %1409 = arith.extsi %1407 : i64 to i128
    %1411 = arith.trunci %1409 : i128 to i64
    %1410 = arith.muli %1405, %1411 : i64
    %1412 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1413 = llvm.load %1412 : !llvm.ptr -> i64
    %1414 = arith.extsi %1413 : i64 to i128
    %1416 = arith.trunci %1414 : i128 to i64
    %1415 = arith.remsi %1410, %1416 : i64
    func.call @free(%1378) : (!llvm.ptr) -> ()
    func.call @free(%1384) : (!llvm.ptr) -> ()
    func.return %1415 : i64
  }
  func.func @main() -> i32 {
    %1419 = arith.constant 10000 : i32
    %1420 = arith.extsi %1419 : i32 to i64
    %1421 = arith.constant 10 : i32
    %1422 = arith.extsi %1421 : i32 to i64
    %1424 = arith.constant 1 : i32
    %1426 = arith.extsi %1424 : i32 to i64
    %1425 = arith.addi %1420, %1426 : i64
    %1427 = arith.constant 8 : i32
    %1429 = arith.extsi %1427 : i32 to i64
    %1428 = arith.muli %1425, %1429 : i64
    %1423 = func.call @malloc(%1428) : (i64) -> !llvm.ptr
    %1431 = arith.constant 1 : i32
    %1433 = arith.extsi %1431 : i32 to i64
    %1432 = arith.addi %1420, %1433 : i64
    %1434 = arith.constant 8 : i32
    %1436 = arith.extsi %1434 : i32 to i64
    %1435 = arith.muli %1432, %1436 : i64
    %1430 = func.call @malloc(%1435) : (i64) -> !llvm.ptr
    %1438 = arith.constant 1 : i32
    %1440 = arith.extsi %1438 : i32 to i64
    %1439 = arith.addi %1420, %1440 : i64
    %1441 = arith.constant 8 : i32
    %1443 = arith.extsi %1441 : i32 to i64
    %1442 = arith.muli %1439, %1443 : i64
    %1437 = func.call @malloc(%1442) : (i64) -> !llvm.ptr
    func.call @precompute(%1420, %1423, %1430, %1437) : (i64, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
    %1445 = func.call @compute_A(%1420, %1430, %1437) : (i64, !llvm.ptr, !llvm.ptr) -> !llvm.ptr
    %1446 = func.call @C_nk(%1420, %1422, %1445, %1423, %1430) : (i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> i64
    func.call @free(%1423) : (!llvm.ptr) -> ()
    func.call @free(%1430) : (!llvm.ptr) -> ()
    func.call @free(%1437) : (!llvm.ptr) -> ()
    func.call @free(%1445) : (!llvm.ptr) -> ()
    %1451 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %1452 = llvm.call @printf(%1451, %1446) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %1453 = arith.constant 0 : i32
    func.return %1453 : i32
  }
}