Problem 682

5-Smooth Pairs: f(10^7) mod 1e9+7. Uses generating function + Bostan-Mori coefficient extraction.

Answer290872710
Output290872710
StatusPASS
Native helperno
Runtime0 ms
Peak memory1120 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n^2)
Space complexityO(n^2)O(n)
ApproachFlow solutionPolynomial interpolation
VerdictOptimal

Flow source

# Project Euler 682
# 5-Smooth Pairs: f(10^7) mod 1e9+7.
# Uses generating function + Bostan-Mori coefficient extraction.

import euler.nt { mod_pow }

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

const MOD: i64 = 1000000007

# Max polynomial degree
const MAXDEG: i64 = 200

# Poly multiply: res = a * b mod MOD, degrees da, db -> result degree da+db
function poly_mul(a: ptr<i64>, da: i64, b: ptr<i64>, db: i64, res: ptr<i64>) -> i64 {
    let dr: i64 = da + db
    for i in 0..(dr + 1) { res[i] = 0 }
    for i in 0..(da + 1) {
        if a[i] == 0 { continue }
        for j in 0..(db + 1) {
            if b[j] == 0 { continue }
            let t: i128 = (res[i + j] as i128) + (a[i] as i128) * (b[j] as i128)
            res[i + j] = (t % (MOD as i128)) as i64
        }
    }
    return dr
}

# Negate odd coefficients: q[i] = p[i] for even i, MOD - p[i] for odd i
function negate_odd(p: ptr<i64>, dp: i64, q: ptr<i64>) -> i64 {
    for i in 0..(dp + 1) {
        if i % 2 == 0 { q[i] = p[i] }
        else { q[i] = (MOD - p[i]) % MOD }
    }
    return dp
}

# Even part: q[i] = p[2i]
function even_part(p: ptr<i64>, dp: i64, q: ptr<i64>) -> i64 {
    let mut dq: i64 = 0
    let mut i: i64 = 0
    while 2 * i <= dp {
        q[i] = p[2 * i]
        dq = i
        i = i + 1
    }
    return dq
}

# Odd part: q[i] = p[2i+1]
function odd_part(p: ptr<i64>, dp: i64, q: ptr<i64>) -> i64 {
    if dp < 1 {
        q[0] = 0
        return 0
    }
    let mut dq: i64 = 0
    let mut i: i64 = 0
    while 2 * i + 1 <= dp {
        q[i] = p[2 * i + 1]
        dq = i
        i = i + 1
    }
    return dq
}

function main() -> i32 {
    # Build generating function P/Q
    # D1 = (1-x)(1-x^3)(1-x^4)(1-x^5)(1-x^7)
    # D2 = (1-x)^2(1+x)(1-x^5)(1-x^6)(1-x^8)
    # D3 = (1-x)^2(1+x)(x^2+x+1)(1-x^7)(1-x^8)(1-x^10)
    # Q = D1*D2*D3
    # P = Q/D1 - x*Q/D2 + x^5*Q/D3

    let tmp1: ptr<i64> = calloc(MAXDEG, 8)
    let tmp2: ptr<i64> = calloc(MAXDEG, 8)
    let tmp3: ptr<i64> = calloc(MAXDEG, 8)
    let D1: ptr<i64> = calloc(MAXDEG, 8)
    let D2: ptr<i64> = calloc(MAXDEG, 8)
    let D3: ptr<i64> = calloc(MAXDEG, 8)
    let Q: ptr<i64> = calloc(MAXDEG, 8)
    let P: ptr<i64> = calloc(MAXDEG, 8)
    let Qneg: ptr<i64> = calloc(MAXDEG, 8)
    let Pnew: ptr<i64> = calloc(MAXDEG, 8)
    let Qnew: ptr<i64> = calloc(MAXDEG, 8)
    let factor: ptr<i64> = calloc(MAXDEG, 8)

    if D1 == null || Q == null { return 1 }

    # Helper: multiply accumulator by (1 - x^k)
    # D1 = product of (1-x^k) for k in {1,3,4,5,7}
    D1[0] = 1
    let mut d1_deg: i64 = 0
    for ki in 0..5 {
        let k: i64 = 7
        if ki == 0 { k = 1 }
        if ki == 1 { k = 3 }
        if ki == 2 { k = 4 }
        if ki == 3 { k = 5 }

        for i in 0..MAXDEG { factor[i] = 0 }
        factor[0] = 1
        factor[k] = MOD - 1
        d1_deg = poly_mul(D1, d1_deg, factor, k, tmp1)
        for i in 0..(d1_deg + 1) { D1[i] = tmp1[i] }
    }

    # D2 = (1-x)^2 * (1+x) * (1-x^5) * (1-x^6) * (1-x^8)
    D2[0] = 1
    let mut d2_deg: i64 = 0
    # (1-x)
    for i in 0..MAXDEG { factor[i] = 0 }
    factor[0] = 1; factor[1] = MOD - 1
    d2_deg = poly_mul(D2, d2_deg, factor, 1, tmp1)
    for i in 0..(d2_deg + 1) { D2[i] = tmp1[i] }
    # (1-x) again
    d2_deg = poly_mul(D2, d2_deg, factor, 1, tmp1)
    for i in 0..(d2_deg + 1) { D2[i] = tmp1[i] }
    # (1+x)
    factor[1] = 1
    d2_deg = poly_mul(D2, d2_deg, factor, 1, tmp1)
    for i in 0..(d2_deg + 1) { D2[i] = tmp1[i] }
    # (1-x^5)
    for i in 0..MAXDEG { factor[i] = 0 }
    factor[0] = 1; factor[5] = MOD - 1
    d2_deg = poly_mul(D2, d2_deg, factor, 5, tmp1)
    for i in 0..(d2_deg + 1) { D2[i] = tmp1[i] }
    # (1-x^6)
    factor[6] = MOD - 1; factor[5] = 0
    d2_deg = poly_mul(D2, d2_deg, factor, 6, tmp1)
    for i in 0..(d2_deg + 1) { D2[i] = tmp1[i] }
    # (1-x^8)
    for i in 0..MAXDEG { factor[i] = 0 }
    factor[0] = 1; factor[8] = MOD - 1
    d2_deg = poly_mul(D2, d2_deg, factor, 8, tmp1)
    for i in 0..(d2_deg + 1) { D2[i] = tmp1[i] }

    # D3 = (1-x)^2 * (1+x) * (1+x+x^2) * (1-x^7) * (1-x^8) * (1-x^10)
    D3[0] = 1
    let mut d3_deg: i64 = 0
    # (1-x)
    for i in 0..MAXDEG { factor[i] = 0 }
    factor[0] = 1; factor[1] = MOD - 1
    d3_deg = poly_mul(D3, d3_deg, factor, 1, tmp1)
    for i in 0..(d3_deg + 1) { D3[i] = tmp1[i] }
    # (1-x) again
    d3_deg = poly_mul(D3, d3_deg, factor, 1, tmp1)
    for i in 0..(d3_deg + 1) { D3[i] = tmp1[i] }
    # (1+x)
    factor[1] = 1
    d3_deg = poly_mul(D3, d3_deg, factor, 1, tmp1)
    for i in 0..(d3_deg + 1) { D3[i] = tmp1[i] }
    # (1+x+x^2)
    factor[2] = 1
    d3_deg = poly_mul(D3, d3_deg, factor, 2, tmp1)
    for i in 0..(d3_deg + 1) { D3[i] = tmp1[i] }
    # (1-x^7)
    for i in 0..MAXDEG { factor[i] = 0 }
    factor[0] = 1; factor[7] = MOD - 1
    d3_deg = poly_mul(D3, d3_deg, factor, 7, tmp1)
    for i in 0..(d3_deg + 1) { D3[i] = tmp1[i] }
    # (1-x^8)
    factor[8] = MOD - 1; factor[7] = 0
    d3_deg = poly_mul(D3, d3_deg, factor, 8, tmp1)
    for i in 0..(d3_deg + 1) { D3[i] = tmp1[i] }
    # (1-x^10)
    for i in 0..MAXDEG { factor[i] = 0 }
    factor[0] = 1; factor[10] = MOD - 1
    d3_deg = poly_mul(D3, d3_deg, factor, 10, tmp1)
    for i in 0..(d3_deg + 1) { D3[i] = tmp1[i] }

    # Q = D1 * D2 * D3
    let q_deg1: i64 = poly_mul(D1, d1_deg, D2, d2_deg, tmp1)
    let q_deg: i64 = poly_mul(tmp1, q_deg1, D3, d3_deg, Q)

    # Q_over_D1 = D2 * D3
    let qd1_deg: i64 = poly_mul(D2, d2_deg, D3, d3_deg, tmp1)
    # Q_over_D2 = D1 * D3
    let qd2_deg: i64 = poly_mul(D1, d1_deg, D3, d3_deg, tmp2)
    # Q_over_D3 = D1 * D2
    let qd3_deg: i64 = poly_mul(D1, d1_deg, D2, d2_deg, tmp3)

    # P = Q_over_D1 - x*Q_over_D2 + x^5*Q_over_D3
    let max_len: i64 = qd1_deg
    if qd2_deg + 1 > max_len { max_len = qd2_deg + 1 }
    if qd3_deg + 5 > max_len { max_len = qd3_deg + 5 }

    for i in 0..(max_len + 1) { P[i] = 0 }
    for i in 0..(qd1_deg + 1) { P[i] = tmp1[i] }
    for i in 0..(qd2_deg + 1) {
        P[i + 1] = (P[i + 1] - tmp2[i] + MOD) % MOD
    }
    for i in 0..(qd3_deg + 1) {
        P[i + 5] = (P[i + 5] + tmp3[i]) % MOD
    }

    let mut p_deg: i64 = max_len
    let mut q_deg_cur: i64 = q_deg

    # Bostan-Mori: extract [x^n] P/Q
    let mut n: i64 = 10000000

    while n > 0 {
        # Qneg = Q(-x)
        let qn_deg: i64 = negate_odd(Q, q_deg_cur, Qneg)

        # P = P * Qneg
        let p_deg2: i64 = poly_mul(P, p_deg, Qneg, qn_deg, Pnew)
        for i in 0..(p_deg2 + 1) { P[i] = Pnew[i] }
        p_deg = p_deg2

        # Q = Q * Qneg
        let q_deg2: i64 = poly_mul(Q, q_deg_cur, Qneg, qn_deg, Qnew)
        for i in 0..(q_deg2 + 1) { Q[i] = Qnew[i] }
        q_deg_cur = q_deg2

        # Extract even or odd part of P
        if n % 2 == 1 {
            p_deg = odd_part(P, p_deg, Pnew)
        } else {
            p_deg = even_part(P, p_deg, Pnew)
        }
        for i in 0..(p_deg + 1) { P[i] = Pnew[i] }

        # Q = even_part(Q)
        q_deg_cur = even_part(Q, q_deg_cur, Qnew)
        for i in 0..(q_deg_cur + 1) { Q[i] = Qnew[i] }

        n = n / 2
    }

    # Answer = P[0] * Q[0]^(-1) mod MOD
    let qinv: i64 = mod_pow(Q[0], MOD - 2, MOD)
    let ans: i128 = (P[0] as i128) * (qinv as i128) % (MOD as i128)
    printf("%lld\n", ans as i64)

    free(factor); free(Qnew); free(Pnew); free(Qneg)
    free(P); free(Q); free(D3); free(D2); free(D1)
    free(tmp3); free(tmp2); free(tmp1)
    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 poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(int64_t* a, int64_t da, int64_t* b, int64_t db, int64_t* res);
int64_t negate_odd_ptr_i64_i64_ptr_i64(int64_t* p, int64_t dp, int64_t* q);
int64_t even_part_ptr_i64_i64_ptr_i64(int64_t* p, int64_t dp, int64_t* q);
int64_t odd_part_ptr_i64_i64_ptr_i64(int64_t* p, int64_t dp, int64_t* q);
int32_t main(void);

static const int64_t MOD = 1000000007;
static const int64_t MAXDEG = 200;

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 poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(int64_t* a, int64_t da, int64_t* b, int64_t db, int64_t* res) {
    int64_t dr = (da + db);
    int32_t __flow_step_1 = 1;
    for (int32_t i = 0; (0 <= (dr + 1)) ? i < (dr + 1) : i > (dr + 1); i += (0 <= (dr + 1)) ? 1 : -1) {
        res[i] = 0;
    }
    int32_t __flow_step_2 = 1;
    for (int32_t i = 0; (0 <= (da + 1)) ? i < (da + 1) : i > (da + 1); i += (0 <= (da + 1)) ? 1 : -1) {
        if (a[i] == 0) {
            continue;
        }
        int32_t __flow_step_3 = 1;
        for (int32_t j = 0; (0 <= (db + 1)) ? j < (db + 1) : j > (db + 1); j += (0 <= (db + 1)) ? 1 : -1) {
            if (b[j] == 0) {
                continue;
            }
            __int128 t = (((__int128)(res[(i + j)])) + (((__int128)(a[i])) * ((__int128)(b[j]))));
            res[(i + j)] = ((int64_t)(FLOW_CHECKED_MOD((t), (((__int128)(MOD))))));
        }
    }
    return dr;
}

int64_t negate_odd_ptr_i64_i64_ptr_i64(int64_t* p, int64_t dp, int64_t* q) {
    int32_t __flow_step_4 = 1;
    for (int32_t i = 0; (0 <= (dp + 1)) ? i < (dp + 1) : i > (dp + 1); i += (0 <= (dp + 1)) ? 1 : -1) {
        if (FLOW_CHECKED_MOD((i), (2)) == 0) {
            q[i] = p[i];
        } else {
            q[i] = FLOW_CHECKED_MOD(((MOD - p[i])), (MOD));
        }
    }
    return dp;
}

int64_t even_part_ptr_i64_i64_ptr_i64(int64_t* p, int64_t dp, int64_t* q) {
    int64_t dq = 0;
    int64_t i = 0;
    while ((2 * i) <= dp) {
        q[i] = p[(2 * i)];
        dq = i;
        i = (i + 1);
    }
    return dq;
}

int64_t odd_part_ptr_i64_i64_ptr_i64(int64_t* p, int64_t dp, int64_t* q) {
    if (dp < 1) {
        q[0] = 0;
        return 0;
    }
    int64_t dq = 0;
    int64_t i = 0;
    while (((2 * i) + 1) <= dp) {
        q[i] = p[((2 * i) + 1)];
        dq = i;
        i = (i + 1);
    }
    return dq;
}

int32_t main(void) {
    int64_t* tmp1 = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* tmp2 = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* tmp3 = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* D1 = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* D2 = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* D3 = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* Q = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* P = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* Qneg = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* Pnew = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* Qnew = (int64_t*)(calloc(MAXDEG, 8));
    int64_t* factor = (int64_t*)(calloc(MAXDEG, 8));
    if ((D1 == NULL || Q == NULL)) {
        return 1;
    }
    D1[0] = 1;
    int64_t d1_deg = 0;
    int32_t __flow_step_5 = 1;
    for (int32_t ki = 0; (0 <= 5) ? ki < 5 : ki > 5; ki += (0 <= 5) ? 1 : -1) {
        int64_t k = 7;
        if (ki == 0) {
            k = 1;
        }
        if (ki == 1) {
            k = 3;
        }
        if (ki == 2) {
            k = 4;
        }
        if (ki == 3) {
            k = 5;
        }
        int32_t __flow_step_6 = 1;
        for (int32_t i = 0; (0 <= MAXDEG) ? i < MAXDEG : i > MAXDEG; i += (0 <= MAXDEG) ? 1 : -1) {
            factor[i] = 0;
        }
        factor[0] = 1;
        factor[k] = (MOD - 1);
        d1_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D1, d1_deg, factor, k, tmp1);
        int32_t __flow_step_7 = 1;
        for (int32_t i = 0; (0 <= (d1_deg + 1)) ? i < (d1_deg + 1) : i > (d1_deg + 1); i += (0 <= (d1_deg + 1)) ? 1 : -1) {
            D1[i] = tmp1[i];
        }
    }
    D2[0] = 1;
    int64_t d2_deg = 0;
    int32_t __flow_step_8 = 1;
    for (int32_t i = 0; (0 <= MAXDEG) ? i < MAXDEG : i > MAXDEG; i += (0 <= MAXDEG) ? 1 : -1) {
        factor[i] = 0;
    }
    factor[0] = 1;
    factor[1] = (MOD - 1);
    d2_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D2, d2_deg, factor, 1, tmp1);
    int32_t __flow_step_9 = 1;
    for (int32_t i = 0; (0 <= (d2_deg + 1)) ? i < (d2_deg + 1) : i > (d2_deg + 1); i += (0 <= (d2_deg + 1)) ? 1 : -1) {
        D2[i] = tmp1[i];
    }
    d2_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D2, d2_deg, factor, 1, tmp1);
    int32_t __flow_step_10 = 1;
    for (int32_t i = 0; (0 <= (d2_deg + 1)) ? i < (d2_deg + 1) : i > (d2_deg + 1); i += (0 <= (d2_deg + 1)) ? 1 : -1) {
        D2[i] = tmp1[i];
    }
    factor[1] = 1;
    d2_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D2, d2_deg, factor, 1, tmp1);
    int32_t __flow_step_11 = 1;
    for (int32_t i = 0; (0 <= (d2_deg + 1)) ? i < (d2_deg + 1) : i > (d2_deg + 1); i += (0 <= (d2_deg + 1)) ? 1 : -1) {
        D2[i] = tmp1[i];
    }
    int32_t __flow_step_12 = 1;
    for (int32_t i = 0; (0 <= MAXDEG) ? i < MAXDEG : i > MAXDEG; i += (0 <= MAXDEG) ? 1 : -1) {
        factor[i] = 0;
    }
    factor[0] = 1;
    factor[5] = (MOD - 1);
    d2_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D2, d2_deg, factor, 5, tmp1);
    int32_t __flow_step_13 = 1;
    for (int32_t i = 0; (0 <= (d2_deg + 1)) ? i < (d2_deg + 1) : i > (d2_deg + 1); i += (0 <= (d2_deg + 1)) ? 1 : -1) {
        D2[i] = tmp1[i];
    }
    factor[6] = (MOD - 1);
    factor[5] = 0;
    d2_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D2, d2_deg, factor, 6, tmp1);
    int32_t __flow_step_14 = 1;
    for (int32_t i = 0; (0 <= (d2_deg + 1)) ? i < (d2_deg + 1) : i > (d2_deg + 1); i += (0 <= (d2_deg + 1)) ? 1 : -1) {
        D2[i] = tmp1[i];
    }
    int32_t __flow_step_15 = 1;
    for (int32_t i = 0; (0 <= MAXDEG) ? i < MAXDEG : i > MAXDEG; i += (0 <= MAXDEG) ? 1 : -1) {
        factor[i] = 0;
    }
    factor[0] = 1;
    factor[8] = (MOD - 1);
    d2_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D2, d2_deg, factor, 8, tmp1);
    int32_t __flow_step_16 = 1;
    for (int32_t i = 0; (0 <= (d2_deg + 1)) ? i < (d2_deg + 1) : i > (d2_deg + 1); i += (0 <= (d2_deg + 1)) ? 1 : -1) {
        D2[i] = tmp1[i];
    }
    D3[0] = 1;
    int64_t d3_deg = 0;
    int32_t __flow_step_17 = 1;
    for (int32_t i = 0; (0 <= MAXDEG) ? i < MAXDEG : i > MAXDEG; i += (0 <= MAXDEG) ? 1 : -1) {
        factor[i] = 0;
    }
    factor[0] = 1;
    factor[1] = (MOD - 1);
    d3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D3, d3_deg, factor, 1, tmp1);
    int32_t __flow_step_18 = 1;
    for (int32_t i = 0; (0 <= (d3_deg + 1)) ? i < (d3_deg + 1) : i > (d3_deg + 1); i += (0 <= (d3_deg + 1)) ? 1 : -1) {
        D3[i] = tmp1[i];
    }
    d3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D3, d3_deg, factor, 1, tmp1);
    int32_t __flow_step_19 = 1;
    for (int32_t i = 0; (0 <= (d3_deg + 1)) ? i < (d3_deg + 1) : i > (d3_deg + 1); i += (0 <= (d3_deg + 1)) ? 1 : -1) {
        D3[i] = tmp1[i];
    }
    factor[1] = 1;
    d3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D3, d3_deg, factor, 1, tmp1);
    int32_t __flow_step_20 = 1;
    for (int32_t i = 0; (0 <= (d3_deg + 1)) ? i < (d3_deg + 1) : i > (d3_deg + 1); i += (0 <= (d3_deg + 1)) ? 1 : -1) {
        D3[i] = tmp1[i];
    }
    factor[2] = 1;
    d3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D3, d3_deg, factor, 2, tmp1);
    int32_t __flow_step_21 = 1;
    for (int32_t i = 0; (0 <= (d3_deg + 1)) ? i < (d3_deg + 1) : i > (d3_deg + 1); i += (0 <= (d3_deg + 1)) ? 1 : -1) {
        D3[i] = tmp1[i];
    }
    int32_t __flow_step_22 = 1;
    for (int32_t i = 0; (0 <= MAXDEG) ? i < MAXDEG : i > MAXDEG; i += (0 <= MAXDEG) ? 1 : -1) {
        factor[i] = 0;
    }
    factor[0] = 1;
    factor[7] = (MOD - 1);
    d3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D3, d3_deg, factor, 7, tmp1);
    int32_t __flow_step_23 = 1;
    for (int32_t i = 0; (0 <= (d3_deg + 1)) ? i < (d3_deg + 1) : i > (d3_deg + 1); i += (0 <= (d3_deg + 1)) ? 1 : -1) {
        D3[i] = tmp1[i];
    }
    factor[8] = (MOD - 1);
    factor[7] = 0;
    d3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D3, d3_deg, factor, 8, tmp1);
    int32_t __flow_step_24 = 1;
    for (int32_t i = 0; (0 <= (d3_deg + 1)) ? i < (d3_deg + 1) : i > (d3_deg + 1); i += (0 <= (d3_deg + 1)) ? 1 : -1) {
        D3[i] = tmp1[i];
    }
    int32_t __flow_step_25 = 1;
    for (int32_t i = 0; (0 <= MAXDEG) ? i < MAXDEG : i > MAXDEG; i += (0 <= MAXDEG) ? 1 : -1) {
        factor[i] = 0;
    }
    factor[0] = 1;
    factor[10] = (MOD - 1);
    d3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D3, d3_deg, factor, 10, tmp1);
    int32_t __flow_step_26 = 1;
    for (int32_t i = 0; (0 <= (d3_deg + 1)) ? i < (d3_deg + 1) : i > (d3_deg + 1); i += (0 <= (d3_deg + 1)) ? 1 : -1) {
        D3[i] = tmp1[i];
    }
    int64_t q_deg1 = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D1, d1_deg, D2, d2_deg, tmp1);
    int64_t q_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(tmp1, q_deg1, D3, d3_deg, Q);
    int64_t qd1_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D2, d2_deg, D3, d3_deg, tmp1);
    int64_t qd2_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D1, d1_deg, D3, d3_deg, tmp2);
    int64_t qd3_deg = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(D1, d1_deg, D2, d2_deg, tmp3);
    int64_t max_len = qd1_deg;
    if ((qd2_deg + 1) > max_len) {
        max_len = (qd2_deg + 1);
    }
    if ((qd3_deg + 5) > max_len) {
        max_len = (qd3_deg + 5);
    }
    int32_t __flow_step_27 = 1;
    for (int32_t i = 0; (0 <= (max_len + 1)) ? i < (max_len + 1) : i > (max_len + 1); i += (0 <= (max_len + 1)) ? 1 : -1) {
        P[i] = 0;
    }
    int32_t __flow_step_28 = 1;
    for (int32_t i = 0; (0 <= (qd1_deg + 1)) ? i < (qd1_deg + 1) : i > (qd1_deg + 1); i += (0 <= (qd1_deg + 1)) ? 1 : -1) {
        P[i] = tmp1[i];
    }
    int32_t __flow_step_29 = 1;
    for (int32_t i = 0; (0 <= (qd2_deg + 1)) ? i < (qd2_deg + 1) : i > (qd2_deg + 1); i += (0 <= (qd2_deg + 1)) ? 1 : -1) {
        P[(i + 1)] = FLOW_CHECKED_MOD((((P[(i + 1)] - tmp2[i]) + MOD)), (MOD));
    }
    int32_t __flow_step_30 = 1;
    for (int32_t i = 0; (0 <= (qd3_deg + 1)) ? i < (qd3_deg + 1) : i > (qd3_deg + 1); i += (0 <= (qd3_deg + 1)) ? 1 : -1) {
        P[(i + 5)] = FLOW_CHECKED_MOD(((P[(i + 5)] + tmp3[i])), (MOD));
    }
    int64_t p_deg = max_len;
    int64_t q_deg_cur = q_deg;
    int64_t n = 10000000;
    while (n > 0) {
        int64_t qn_deg = negate_odd_ptr_i64_i64_ptr_i64(Q, q_deg_cur, Qneg);
        int64_t p_deg2 = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(P, p_deg, Qneg, qn_deg, Pnew);
        int32_t __flow_step_31 = 1;
        for (int32_t i = 0; (0 <= (p_deg2 + 1)) ? i < (p_deg2 + 1) : i > (p_deg2 + 1); i += (0 <= (p_deg2 + 1)) ? 1 : -1) {
            P[i] = Pnew[i];
        }
        p_deg = p_deg2;
        int64_t q_deg2 = poly_mul_ptr_i64_i64_ptr_i64_i64_ptr_i64(Q, q_deg_cur, Qneg, qn_deg, Qnew);
        int32_t __flow_step_32 = 1;
        for (int32_t i = 0; (0 <= (q_deg2 + 1)) ? i < (q_deg2 + 1) : i > (q_deg2 + 1); i += (0 <= (q_deg2 + 1)) ? 1 : -1) {
            Q[i] = Qnew[i];
        }
        q_deg_cur = q_deg2;
        if (FLOW_CHECKED_MOD((n), (2)) == 1) {
            p_deg = odd_part_ptr_i64_i64_ptr_i64(P, p_deg, Pnew);
        } else {
            p_deg = even_part_ptr_i64_i64_ptr_i64(P, p_deg, Pnew);
        }
        int32_t __flow_step_33 = 1;
        for (int32_t i = 0; (0 <= (p_deg + 1)) ? i < (p_deg + 1) : i > (p_deg + 1); i += (0 <= (p_deg + 1)) ? 1 : -1) {
            P[i] = Pnew[i];
        }
        q_deg_cur = even_part_ptr_i64_i64_ptr_i64(Q, q_deg_cur, Qnew);
        int32_t __flow_step_34 = 1;
        for (int32_t i = 0; (0 <= (q_deg_cur + 1)) ? i < (q_deg_cur + 1) : i > (q_deg_cur + 1); i += (0 <= (q_deg_cur + 1)) ? 1 : -1) {
            Q[i] = Qnew[i];
        }
        n = FLOW_CHECKED_DIV((n), (2));
    }
    int64_t qinv = mod_pow_i64_i64_i64(Q[0], (MOD - 2), MOD);
    __int128 ans = FLOW_CHECKED_MOD(((((__int128)(P[0])) * ((__int128)(qinv)))), (((__int128)(MOD))));
    printf("%lld\n", ((int64_t)(ans)));
    free(factor);
    free(Qnew);
    free(Pnew);
    free(Qneg);
    free(P);
    free(Q);
    free(D3);
    free(D2);
    free(D1);
    free(tmp3);
    free(tmp2);
    free(tmp1);
    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 @memcpy(!llvm.ptr, !llvm.ptr, i64) -> ()
  // Constant: MOD
  llvm.mlir.global internal constant @MOD(1000000007 : i64) : i64
  // Constant: MAXDEG
  llvm.mlir.global internal constant @MAXDEG(200 : i64) : i64
  func.func @poly_mul(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: !llvm.ptr) -> i64 {
    %175 = arith.addi %arg1, %arg3 : i64
    %176 = arith.constant 0 : i32
    %177 = arith.constant 1 : i32
    %179 = arith.extsi %177 : i32 to i64
    %178 = arith.addi %175, %179 : i64
    %180 = arith.index_cast %176 : i32 to index
    %181 = arith.index_cast %178 : i32 to index
    %183 = arith.constant 1 : index
    %184 = arith.constant -1 : index
    %185 = arith.cmpi sle, %180, %181 : index
    %182 = arith.select %185, %183, %184 : index
    cf.br ^bb42(%180 : index)
    ^bb42(%186: index):
    %187 = arith.cmpi slt, %186, %181 : index
    %188 = arith.cmpi sgt, %186, %181 : index
    %189 = arith.select %185, %187, %188 : i1
    cf.cond_br %189, ^bb43(%186 : index), ^bb44(%186 : index)
    ^bb43(%190: index):
      %191 = arith.constant 0 : i32
      %192 = arith.extsi %191 : i32 to i64
      %193 = arith.index_cast %190 : index to i64
      %194 = llvm.getelementptr %arg4[%193] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %192, %194 : i64, !llvm.ptr
      %195 = arith.addi %190, %182 : index
      cf.br ^bb42(%195 : index)
    ^bb44(%196: index):
    %197 = arith.constant 0 : i32
    %198 = arith.constant 1 : i32
    %200 = arith.extsi %198 : i32 to i64
    %199 = arith.addi %arg1, %200 : i64
    %201 = arith.index_cast %197 : i32 to index
    %202 = arith.index_cast %199 : i32 to index
    %204 = arith.constant 1 : index
    %205 = arith.constant -1 : index
    %206 = arith.cmpi sle, %201, %202 : index
    %203 = arith.select %206, %204, %205 : index
    cf.br ^bb45(%201 : index)
    ^bb45(%207: index):
    %208 = arith.cmpi slt, %207, %202 : index
    %209 = arith.cmpi sgt, %207, %202 : index
    %210 = arith.select %206, %208, %209 : i1
    cf.cond_br %210, ^bb46(%207 : index), ^bb47(%207 : index)
    ^bb46(%211: index):
      %213 = arith.index_cast %211 : index to i64
      %214 = llvm.getelementptr %arg0[%213] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %212 = llvm.load %214 : !llvm.ptr -> i64
      %215 = arith.constant 0 : i32
      %217 = arith.extsi %215 : i32 to i64
      %216 = arith.cmpi eq, %212, %217 : i64
      cf.cond_br %216, ^bb48, ^bb49
      ^bb48:
        %218 = arith.addi %211, %203 : index
        cf.br ^bb45(%218 : index)
      ^bb49:
        cf.br ^bb50
      ^bb50:
      %219 = arith.constant 0 : i32
      %220 = arith.constant 1 : i32
      %222 = arith.extsi %220 : i32 to i64
      %221 = arith.addi %arg3, %222 : i64
      %223 = arith.index_cast %219 : i32 to index
      %224 = arith.index_cast %221 : i32 to index
      %226 = arith.constant 1 : index
      %227 = arith.constant -1 : index
      %228 = arith.cmpi sle, %223, %224 : index
      %225 = arith.select %228, %226, %227 : index
      cf.br ^bb51(%223 : index)
      ^bb51(%229: index):
      %230 = arith.cmpi slt, %229, %224 : index
      %231 = arith.cmpi sgt, %229, %224 : index
      %232 = arith.select %228, %230, %231 : i1
      cf.cond_br %232, ^bb52(%229 : index), ^bb53(%229 : index)
      ^bb52(%233: index):
        %235 = arith.index_cast %233 : index to i64
        %236 = llvm.getelementptr %arg2[%235] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %234 = llvm.load %236 : !llvm.ptr -> i64
        %237 = arith.constant 0 : i32
        %239 = arith.extsi %237 : i32 to i64
        %238 = arith.cmpi eq, %234, %239 : i64
        cf.cond_br %238, ^bb54, ^bb55
        ^bb54:
          %240 = arith.addi %233, %225 : index
          cf.br ^bb51(%240 : index)
        ^bb55:
          cf.br ^bb56
        ^bb56:
        %242 = arith.addi %211, %233 : index
        %243 = arith.index_cast %242 : index to i64
        %244 = llvm.getelementptr %arg4[%243] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %241 = llvm.load %244 : !llvm.ptr -> i64
        %245 = arith.extsi %241 : i64 to i128
        %247 = arith.index_cast %211 : index to i64
        %248 = llvm.getelementptr %arg0[%247] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %246 = llvm.load %248 : !llvm.ptr -> i64
        %249 = arith.extsi %246 : i64 to i128
        %251 = arith.index_cast %233 : index to i64
        %252 = llvm.getelementptr %arg2[%251] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %250 = llvm.load %252 : !llvm.ptr -> i64
        %253 = arith.extsi %250 : i64 to i128
        %255 = arith.trunci %249 : i128 to i64
        %256 = arith.trunci %253 : i128 to i64
        %254 = arith.muli %255, %256 : i64
        %258 = arith.trunci %245 : i128 to i64
        %257 = arith.addi %258, %254 : i64
        %259 = arith.extsi %257 : i64 to i128
        %260 = llvm.mlir.addressof @MOD : !llvm.ptr
        %261 = llvm.load %260 : !llvm.ptr -> i64
        %262 = arith.extsi %261 : i64 to i128
        %264 = arith.trunci %259 : i128 to i64
        %265 = arith.trunci %262 : i128 to i64
        %263 = arith.remsi %264, %265 : i64
        %266 = arith.addi %211, %233 : index
        %267 = arith.index_cast %266 : index to i64
        %268 = llvm.getelementptr %arg4[%267] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %263, %268 : i64, !llvm.ptr
        %269 = arith.addi %233, %225 : index
        cf.br ^bb51(%269 : index)
      ^bb53(%270: index):
      %271 = arith.addi %211, %203 : index
      cf.br ^bb45(%271 : index)
    ^bb47(%272: index):
    func.return %175 : i64
  }
  func.func @negate_odd(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr) -> i64 {
    %273 = arith.constant 0 : i32
    %274 = arith.constant 1 : i32
    %276 = arith.extsi %274 : i32 to i64
    %275 = arith.addi %arg1, %276 : i64
    %277 = arith.index_cast %273 : i32 to index
    %278 = arith.index_cast %275 : i32 to index
    %280 = arith.constant 1 : index
    %281 = arith.constant -1 : index
    %282 = arith.cmpi sle, %277, %278 : index
    %279 = arith.select %282, %280, %281 : index
    cf.br ^bb57(%277 : index)
    ^bb57(%283: index):
    %284 = arith.cmpi slt, %283, %278 : index
    %285 = arith.cmpi sgt, %283, %278 : index
    %286 = arith.select %282, %284, %285 : i1
    cf.cond_br %286, ^bb58(%283 : index), ^bb59(%283 : index)
    ^bb58(%287: index):
      %288 = arith.constant 2 : i32
      %290 = arith.index_cast %287 : index to i32
      %289 = arith.remsi %290, %288 : i32
      %291 = arith.constant 0 : i32
      %292 = arith.cmpi eq, %289, %291 : i32
      cf.cond_br %292, ^bb60, ^bb61
      ^bb60:
        %294 = arith.index_cast %287 : index to i64
        %295 = llvm.getelementptr %arg0[%294] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %293 = llvm.load %295 : !llvm.ptr -> i64
        %296 = arith.index_cast %287 : index to i64
        %297 = llvm.getelementptr %arg2[%296] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %293, %297 : i64, !llvm.ptr
        cf.br ^bb62
      ^bb61:
        %298 = llvm.mlir.addressof @MOD : !llvm.ptr
        %299 = llvm.load %298 : !llvm.ptr -> i64
        %301 = arith.index_cast %287 : index to i64
        %302 = llvm.getelementptr %arg0[%301] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %300 = llvm.load %302 : !llvm.ptr -> i64
        %303 = arith.subi %299, %300 : i64
        %304 = llvm.mlir.addressof @MOD : !llvm.ptr
        %305 = llvm.load %304 : !llvm.ptr -> i64
        %306 = arith.remsi %303, %305 : i64
        %307 = arith.index_cast %287 : index to i64
        %308 = llvm.getelementptr %arg2[%307] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %306, %308 : i64, !llvm.ptr
        cf.br ^bb62
      ^bb62:
      %309 = arith.addi %287, %279 : index
      cf.br ^bb57(%309 : index)
    ^bb59(%310: index):
    func.return %arg1 : i64
  }
  func.func @even_part(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr) -> i64 {
    %311 = arith.constant 0 : i32
    %312 = arith.extsi %311 : i32 to i64
    %313 = llvm.mlir.constant(1 : i64) : i64
    %314 = llvm.alloca %313 x i64 : (i64) -> !llvm.ptr
    llvm.store %312, %314 : i64, !llvm.ptr
    %315 = arith.constant 0 : i32
    %316 = arith.extsi %315 : i32 to i64
    %317 = llvm.mlir.constant(1 : i64) : i64
    %318 = llvm.alloca %317 x i64 : (i64) -> !llvm.ptr
    llvm.store %316, %318 : i64, !llvm.ptr
    cf.br ^bb63
    ^bb63:
    %319 = arith.constant 2 : i32
    %320 = llvm.load %318 : !llvm.ptr -> i64
    %322 = arith.extsi %319 : i32 to i64
    %321 = arith.muli %322, %320 : i64
    %323 = arith.cmpi sle, %321, %arg1 : i64
    cf.cond_br %323, ^bb64, ^bb65
    ^bb64:
      %325 = arith.constant 2 : i32
      %326 = llvm.load %318 : !llvm.ptr -> i64
      %328 = arith.extsi %325 : i32 to i64
      %327 = arith.muli %328, %326 : i64
      %329 = llvm.getelementptr %arg0[%327] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %324 = llvm.load %329 : !llvm.ptr -> i64
      %330 = llvm.load %318 : !llvm.ptr -> i64
      %331 = llvm.getelementptr %arg2[%330] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %324, %331 : i64, !llvm.ptr
      %332 = llvm.load %318 : !llvm.ptr -> i64
      llvm.store %332, %314 : i64, !llvm.ptr
      %333 = llvm.load %318 : !llvm.ptr -> i64
      %334 = arith.constant 1 : i32
      %336 = arith.extsi %334 : i32 to i64
      %335 = arith.addi %333, %336 : i64
      llvm.store %335, %318 : i64, !llvm.ptr
      cf.br ^bb63
    ^bb65:
    %337 = llvm.load %314 : !llvm.ptr -> i64
    func.return %337 : i64
  }
  func.func @odd_part(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr) -> i64 {
    %338 = arith.constant 1 : i32
    %340 = arith.extsi %338 : i32 to i64
    %339 = arith.cmpi slt, %arg1, %340 : i64
    cf.cond_br %339, ^bb66, ^bb67
    ^bb66:
      %341 = arith.constant 0 : i32
      %342 = arith.constant 0 : i32
      %343 = arith.extsi %341 : i32 to i64
      %344 = arith.extsi %342 : i32 to i64
      %345 = llvm.getelementptr %arg2[%344] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %343, %345 : i64, !llvm.ptr
      %346 = arith.constant 0 : i32
      %347 = arith.extsi %346 : i32 to i64
      func.return %347 : i64
    ^bb67:
      cf.br ^bb68
    ^bb68:
    %348 = arith.constant 0 : i32
    %349 = arith.extsi %348 : i32 to i64
    %350 = llvm.mlir.constant(1 : i64) : i64
    %351 = llvm.alloca %350 x i64 : (i64) -> !llvm.ptr
    llvm.store %349, %351 : i64, !llvm.ptr
    %352 = arith.constant 0 : i32
    %353 = arith.extsi %352 : i32 to i64
    %354 = llvm.mlir.constant(1 : i64) : i64
    %355 = llvm.alloca %354 x i64 : (i64) -> !llvm.ptr
    llvm.store %353, %355 : i64, !llvm.ptr
    cf.br ^bb69
    ^bb69:
    %356 = arith.constant 2 : i32
    %357 = llvm.load %355 : !llvm.ptr -> i64
    %359 = arith.extsi %356 : i32 to i64
    %358 = arith.muli %359, %357 : i64
    %360 = arith.constant 1 : i32
    %362 = arith.extsi %360 : i32 to i64
    %361 = arith.addi %358, %362 : i64
    %363 = arith.cmpi sle, %361, %arg1 : i64
    cf.cond_br %363, ^bb70, ^bb71
    ^bb70:
      %365 = arith.constant 2 : i32
      %366 = llvm.load %355 : !llvm.ptr -> i64
      %368 = arith.extsi %365 : i32 to i64
      %367 = arith.muli %368, %366 : i64
      %369 = arith.constant 1 : i32
      %371 = arith.extsi %369 : i32 to i64
      %370 = arith.addi %367, %371 : i64
      %372 = llvm.getelementptr %arg0[%370] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %364 = llvm.load %372 : !llvm.ptr -> i64
      %373 = llvm.load %355 : !llvm.ptr -> i64
      %374 = llvm.getelementptr %arg2[%373] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %364, %374 : i64, !llvm.ptr
      %375 = llvm.load %355 : !llvm.ptr -> i64
      llvm.store %375, %351 : i64, !llvm.ptr
      %376 = llvm.load %355 : !llvm.ptr -> i64
      %377 = arith.constant 1 : i32
      %379 = arith.extsi %377 : i32 to i64
      %378 = arith.addi %376, %379 : i64
      llvm.store %378, %355 : i64, !llvm.ptr
      cf.br ^bb69
    ^bb71:
    %380 = llvm.load %351 : !llvm.ptr -> i64
    func.return %380 : i64
  }
  func.func @main() -> i32 {
    %382 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %383 = llvm.load %382 : !llvm.ptr -> i64
    %384 = arith.constant 8 : i32
    %385 = arith.extsi %384 : i32 to i64
    %381 = func.call @calloc(%383, %385) : (i64, i64) -> !llvm.ptr
    %387 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %388 = llvm.load %387 : !llvm.ptr -> i64
    %389 = arith.constant 8 : i32
    %390 = arith.extsi %389 : i32 to i64
    %386 = func.call @calloc(%388, %390) : (i64, i64) -> !llvm.ptr
    %392 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %393 = llvm.load %392 : !llvm.ptr -> i64
    %394 = arith.constant 8 : i32
    %395 = arith.extsi %394 : i32 to i64
    %391 = func.call @calloc(%393, %395) : (i64, i64) -> !llvm.ptr
    %397 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %398 = llvm.load %397 : !llvm.ptr -> i64
    %399 = arith.constant 8 : i32
    %400 = arith.extsi %399 : i32 to i64
    %396 = func.call @calloc(%398, %400) : (i64, i64) -> !llvm.ptr
    %402 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %403 = llvm.load %402 : !llvm.ptr -> i64
    %404 = arith.constant 8 : i32
    %405 = arith.extsi %404 : i32 to i64
    %401 = func.call @calloc(%403, %405) : (i64, i64) -> !llvm.ptr
    %407 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %408 = llvm.load %407 : !llvm.ptr -> i64
    %409 = arith.constant 8 : i32
    %410 = arith.extsi %409 : i32 to i64
    %406 = func.call @calloc(%408, %410) : (i64, i64) -> !llvm.ptr
    %412 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %413 = llvm.load %412 : !llvm.ptr -> i64
    %414 = arith.constant 8 : i32
    %415 = arith.extsi %414 : i32 to i64
    %411 = func.call @calloc(%413, %415) : (i64, i64) -> !llvm.ptr
    %417 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %418 = llvm.load %417 : !llvm.ptr -> i64
    %419 = arith.constant 8 : i32
    %420 = arith.extsi %419 : i32 to i64
    %416 = func.call @calloc(%418, %420) : (i64, i64) -> !llvm.ptr
    %422 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %423 = llvm.load %422 : !llvm.ptr -> i64
    %424 = arith.constant 8 : i32
    %425 = arith.extsi %424 : i32 to i64
    %421 = func.call @calloc(%423, %425) : (i64, i64) -> !llvm.ptr
    %427 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %428 = llvm.load %427 : !llvm.ptr -> i64
    %429 = arith.constant 8 : i32
    %430 = arith.extsi %429 : i32 to i64
    %426 = func.call @calloc(%428, %430) : (i64, i64) -> !llvm.ptr
    %432 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %433 = llvm.load %432 : !llvm.ptr -> i64
    %434 = arith.constant 8 : i32
    %435 = arith.extsi %434 : i32 to i64
    %431 = func.call @calloc(%433, %435) : (i64, i64) -> !llvm.ptr
    %437 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %438 = llvm.load %437 : !llvm.ptr -> i64
    %439 = arith.constant 8 : i32
    %440 = arith.extsi %439 : i32 to i64
    %436 = func.call @calloc(%438, %440) : (i64, i64) -> !llvm.ptr
    %441 = llvm.mlir.zero : !llvm.ptr
    %442 = llvm.icmp "eq" %396, %441 : !llvm.ptr
    %443 = scf.if %442 -> (i1) {
      %444 = arith.constant true
      scf.yield %444 : i1
    } else {
      %445 = llvm.mlir.zero : !llvm.ptr
      %446 = llvm.icmp "eq" %411, %445 : !llvm.ptr
      scf.yield %446 : i1
    }
    cf.cond_br %443, ^bb72, ^bb73
    ^bb72:
      %447 = arith.constant 1 : i32
      func.return %447 : i32
    ^bb73:
      cf.br ^bb74
    ^bb74:
    %448 = arith.constant 1 : i32
    %449 = arith.constant 0 : i32
    %450 = arith.extsi %448 : i32 to i64
    %451 = arith.extsi %449 : i32 to i64
    %452 = llvm.getelementptr %396[%451] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %450, %452 : i64, !llvm.ptr
    %453 = arith.constant 0 : i32
    %454 = arith.extsi %453 : i32 to i64
    %455 = llvm.mlir.constant(1 : i64) : i64
    %456 = llvm.alloca %455 x i64 : (i64) -> !llvm.ptr
    llvm.store %454, %456 : i64, !llvm.ptr
    %457 = arith.constant 0 : i32
    %458 = arith.constant 5 : i32
    %459 = arith.index_cast %457 : i32 to index
    %460 = arith.index_cast %458 : i32 to index
    %462 = arith.constant 1 : index
    %463 = arith.constant -1 : index
    %464 = arith.cmpi sle, %459, %460 : index
    %461 = arith.select %464, %462, %463 : index
    cf.br ^bb75(%459 : index)
    ^bb75(%465: index):
    %466 = arith.cmpi slt, %465, %460 : index
    %467 = arith.cmpi sgt, %465, %460 : index
    %468 = arith.select %464, %466, %467 : i1
    cf.cond_br %468, ^bb76(%465 : index), ^bb77(%465 : index)
    ^bb76(%469: index):
      %470 = arith.constant 7 : i32
      %471 = arith.extsi %470 : i32 to i64
      %472 = arith.constant 0 : i32
      %474 = arith.index_cast %469 : index to i32
      %473 = arith.cmpi eq, %474, %472 : i32
      %475 = scf.if %473 -> (i64) {
        %476 = arith.constant 1 : i32
        %477 = arith.extsi %476 : i32 to i64
        scf.yield %477 : i64
      } else {
        scf.yield %471 : i64
      }
      %478 = arith.constant 1 : i32
      %480 = arith.index_cast %469 : index to i32
      %479 = arith.cmpi eq, %480, %478 : i32
      %481 = scf.if %479 -> (i64) {
        %482 = arith.constant 3 : i32
        %483 = arith.extsi %482 : i32 to i64
        scf.yield %483 : i64
      } else {
        scf.yield %475 : i64
      }
      %484 = arith.constant 2 : i32
      %486 = arith.index_cast %469 : index to i32
      %485 = arith.cmpi eq, %486, %484 : i32
      %487 = scf.if %485 -> (i64) {
        %488 = arith.constant 4 : i32
        %489 = arith.extsi %488 : i32 to i64
        scf.yield %489 : i64
      } else {
        scf.yield %481 : i64
      }
      %490 = arith.constant 3 : i32
      %492 = arith.index_cast %469 : index to i32
      %491 = arith.cmpi eq, %492, %490 : i32
      %493 = scf.if %491 -> (i64) {
        %494 = arith.constant 5 : i32
        %495 = arith.extsi %494 : i32 to i64
        scf.yield %495 : i64
      } else {
        scf.yield %487 : i64
      }
      %496 = arith.constant 0 : i32
      %497 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
      %498 = llvm.load %497 : !llvm.ptr -> i64
      %499 = arith.index_cast %496 : i32 to index
      %500 = arith.index_cast %498 : i32 to index
      %502 = arith.constant 1 : index
      %503 = arith.constant -1 : index
      %504 = arith.cmpi sle, %499, %500 : index
      %501 = arith.select %504, %502, %503 : index
      cf.br ^bb78(%499 : index)
      ^bb78(%505: index):
      %506 = arith.cmpi slt, %505, %500 : index
      %507 = arith.cmpi sgt, %505, %500 : index
      %508 = arith.select %504, %506, %507 : i1
      cf.cond_br %508, ^bb79(%505 : index), ^bb80(%505 : index)
      ^bb79(%509: index):
        %510 = arith.constant 0 : i32
        %511 = arith.extsi %510 : i32 to i64
        %512 = arith.index_cast %509 : index to i64
        %513 = llvm.getelementptr %436[%512] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %511, %513 : i64, !llvm.ptr
        %514 = arith.addi %509, %501 : index
        cf.br ^bb78(%514 : index)
      ^bb80(%515: index):
      %516 = arith.constant 1 : i32
      %517 = arith.constant 0 : i32
      %518 = arith.extsi %516 : i32 to i64
      %519 = arith.extsi %517 : i32 to i64
      %520 = llvm.getelementptr %436[%519] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %518, %520 : i64, !llvm.ptr
      %521 = llvm.mlir.addressof @MOD : !llvm.ptr
      %522 = llvm.load %521 : !llvm.ptr -> i64
      %523 = arith.constant 1 : i32
      %525 = arith.extsi %523 : i32 to i64
      %524 = arith.subi %522, %525 : i64
      %526 = llvm.getelementptr %436[%493] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %524, %526 : i64, !llvm.ptr
      %528 = llvm.load %456 : !llvm.ptr -> i64
      %527 = func.call @poly_mul(%396, %528, %436, %493, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
      llvm.store %527, %456 : i64, !llvm.ptr
      %529 = arith.constant 0 : i32
      %530 = llvm.load %456 : !llvm.ptr -> i64
      %531 = arith.constant 1 : i32
      %533 = arith.extsi %531 : i32 to i64
      %532 = arith.addi %530, %533 : i64
      %534 = arith.index_cast %529 : i32 to index
      %535 = arith.index_cast %532 : i32 to index
      %537 = arith.constant 1 : index
      %538 = arith.constant -1 : index
      %539 = arith.cmpi sle, %534, %535 : index
      %536 = arith.select %539, %537, %538 : index
      cf.br ^bb81(%534 : index)
      ^bb81(%540: index):
      %541 = arith.cmpi slt, %540, %535 : index
      %542 = arith.cmpi sgt, %540, %535 : index
      %543 = arith.select %539, %541, %542 : i1
      cf.cond_br %543, ^bb82(%540 : index), ^bb83(%540 : index)
      ^bb82(%544: index):
        %546 = arith.index_cast %544 : index to i64
        %547 = llvm.getelementptr %381[%546] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %545 = llvm.load %547 : !llvm.ptr -> i64
        %548 = arith.index_cast %544 : index to i64
        %549 = llvm.getelementptr %396[%548] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %545, %549 : i64, !llvm.ptr
        %550 = arith.addi %544, %536 : index
        cf.br ^bb81(%550 : index)
      ^bb83(%551: index):
      %552 = arith.addi %469, %461 : index
      cf.br ^bb75(%552 : index)
    ^bb77(%553: index):
    %554 = arith.constant 1 : i32
    %555 = arith.constant 0 : i32
    %556 = arith.extsi %554 : i32 to i64
    %557 = arith.extsi %555 : i32 to i64
    %558 = llvm.getelementptr %401[%557] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %556, %558 : i64, !llvm.ptr
    %559 = arith.constant 0 : i32
    %560 = arith.extsi %559 : i32 to i64
    %561 = llvm.mlir.constant(1 : i64) : i64
    %562 = llvm.alloca %561 x i64 : (i64) -> !llvm.ptr
    llvm.store %560, %562 : i64, !llvm.ptr
    %563 = arith.constant 0 : i32
    %564 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %565 = llvm.load %564 : !llvm.ptr -> i64
    %566 = arith.index_cast %563 : i32 to index
    %567 = arith.index_cast %565 : i32 to index
    %569 = arith.constant 1 : index
    %570 = arith.constant -1 : index
    %571 = arith.cmpi sle, %566, %567 : index
    %568 = arith.select %571, %569, %570 : index
    cf.br ^bb84(%566 : index)
    ^bb84(%572: index):
    %573 = arith.cmpi slt, %572, %567 : index
    %574 = arith.cmpi sgt, %572, %567 : index
    %575 = arith.select %571, %573, %574 : i1
    cf.cond_br %575, ^bb85(%572 : index), ^bb86(%572 : index)
    ^bb85(%576: index):
      %577 = arith.constant 0 : i32
      %578 = arith.extsi %577 : i32 to i64
      %579 = arith.index_cast %576 : index to i64
      %580 = llvm.getelementptr %436[%579] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %578, %580 : i64, !llvm.ptr
      %581 = arith.addi %576, %568 : index
      cf.br ^bb84(%581 : index)
    ^bb86(%582: index):
    %583 = arith.constant 1 : i32
    %584 = arith.constant 0 : i32
    %585 = arith.extsi %583 : i32 to i64
    %586 = arith.extsi %584 : i32 to i64
    %587 = llvm.getelementptr %436[%586] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %585, %587 : i64, !llvm.ptr
    %588 = llvm.mlir.addressof @MOD : !llvm.ptr
    %589 = llvm.load %588 : !llvm.ptr -> i64
    %590 = arith.constant 1 : i32
    %592 = arith.extsi %590 : i32 to i64
    %591 = arith.subi %589, %592 : i64
    %593 = arith.constant 1 : i32
    %594 = arith.extsi %593 : i32 to i64
    %595 = llvm.getelementptr %436[%594] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %591, %595 : i64, !llvm.ptr
    %597 = llvm.load %562 : !llvm.ptr -> i64
    %598 = arith.constant 1 : i32
    %599 = arith.extsi %598 : i32 to i64
    %596 = func.call @poly_mul(%401, %597, %436, %599, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %596, %562 : i64, !llvm.ptr
    %600 = arith.constant 0 : i32
    %601 = llvm.load %562 : !llvm.ptr -> i64
    %602 = arith.constant 1 : i32
    %604 = arith.extsi %602 : i32 to i64
    %603 = arith.addi %601, %604 : i64
    %605 = arith.index_cast %600 : i32 to index
    %606 = arith.index_cast %603 : i32 to index
    %608 = arith.constant 1 : index
    %609 = arith.constant -1 : index
    %610 = arith.cmpi sle, %605, %606 : index
    %607 = arith.select %610, %608, %609 : index
    cf.br ^bb87(%605 : index)
    ^bb87(%611: index):
    %612 = arith.cmpi slt, %611, %606 : index
    %613 = arith.cmpi sgt, %611, %606 : index
    %614 = arith.select %610, %612, %613 : i1
    cf.cond_br %614, ^bb88(%611 : index), ^bb89(%611 : index)
    ^bb88(%615: index):
      %617 = arith.index_cast %615 : index to i64
      %618 = llvm.getelementptr %381[%617] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %616 = llvm.load %618 : !llvm.ptr -> i64
      %619 = arith.index_cast %615 : index to i64
      %620 = llvm.getelementptr %401[%619] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %616, %620 : i64, !llvm.ptr
      %621 = arith.addi %615, %607 : index
      cf.br ^bb87(%621 : index)
    ^bb89(%622: index):
    %624 = llvm.load %562 : !llvm.ptr -> i64
    %625 = arith.constant 1 : i32
    %626 = arith.extsi %625 : i32 to i64
    %623 = func.call @poly_mul(%401, %624, %436, %626, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %623, %562 : i64, !llvm.ptr
    %627 = arith.constant 0 : i32
    %628 = llvm.load %562 : !llvm.ptr -> i64
    %629 = arith.constant 1 : i32
    %631 = arith.extsi %629 : i32 to i64
    %630 = arith.addi %628, %631 : i64
    %632 = arith.index_cast %627 : i32 to index
    %633 = arith.index_cast %630 : i32 to index
    %635 = arith.constant 1 : index
    %636 = arith.constant -1 : index
    %637 = arith.cmpi sle, %632, %633 : index
    %634 = arith.select %637, %635, %636 : index
    cf.br ^bb90(%632 : index)
    ^bb90(%638: index):
    %639 = arith.cmpi slt, %638, %633 : index
    %640 = arith.cmpi sgt, %638, %633 : index
    %641 = arith.select %637, %639, %640 : i1
    cf.cond_br %641, ^bb91(%638 : index), ^bb92(%638 : index)
    ^bb91(%642: index):
      %644 = arith.index_cast %642 : index to i64
      %645 = llvm.getelementptr %381[%644] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %643 = llvm.load %645 : !llvm.ptr -> i64
      %646 = arith.index_cast %642 : index to i64
      %647 = llvm.getelementptr %401[%646] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %643, %647 : i64, !llvm.ptr
      %648 = arith.addi %642, %634 : index
      cf.br ^bb90(%648 : index)
    ^bb92(%649: index):
    %650 = arith.constant 1 : i32
    %651 = arith.constant 1 : i32
    %652 = arith.extsi %650 : i32 to i64
    %653 = arith.extsi %651 : i32 to i64
    %654 = llvm.getelementptr %436[%653] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %652, %654 : i64, !llvm.ptr
    %656 = llvm.load %562 : !llvm.ptr -> i64
    %657 = arith.constant 1 : i32
    %658 = arith.extsi %657 : i32 to i64
    %655 = func.call @poly_mul(%401, %656, %436, %658, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %655, %562 : i64, !llvm.ptr
    %659 = arith.constant 0 : i32
    %660 = llvm.load %562 : !llvm.ptr -> i64
    %661 = arith.constant 1 : i32
    %663 = arith.extsi %661 : i32 to i64
    %662 = arith.addi %660, %663 : i64
    %664 = arith.index_cast %659 : i32 to index
    %665 = arith.index_cast %662 : i32 to index
    %667 = arith.constant 1 : index
    %668 = arith.constant -1 : index
    %669 = arith.cmpi sle, %664, %665 : index
    %666 = arith.select %669, %667, %668 : index
    cf.br ^bb93(%664 : index)
    ^bb93(%670: index):
    %671 = arith.cmpi slt, %670, %665 : index
    %672 = arith.cmpi sgt, %670, %665 : index
    %673 = arith.select %669, %671, %672 : i1
    cf.cond_br %673, ^bb94(%670 : index), ^bb95(%670 : index)
    ^bb94(%674: index):
      %676 = arith.index_cast %674 : index to i64
      %677 = llvm.getelementptr %381[%676] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %675 = llvm.load %677 : !llvm.ptr -> i64
      %678 = arith.index_cast %674 : index to i64
      %679 = llvm.getelementptr %401[%678] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %675, %679 : i64, !llvm.ptr
      %680 = arith.addi %674, %666 : index
      cf.br ^bb93(%680 : index)
    ^bb95(%681: index):
    %682 = arith.constant 0 : i32
    %683 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %684 = llvm.load %683 : !llvm.ptr -> i64
    %685 = arith.index_cast %682 : i32 to index
    %686 = arith.index_cast %684 : i32 to index
    %688 = arith.constant 1 : index
    %689 = arith.constant -1 : index
    %690 = arith.cmpi sle, %685, %686 : index
    %687 = arith.select %690, %688, %689 : index
    cf.br ^bb96(%685 : index)
    ^bb96(%691: index):
    %692 = arith.cmpi slt, %691, %686 : index
    %693 = arith.cmpi sgt, %691, %686 : index
    %694 = arith.select %690, %692, %693 : i1
    cf.cond_br %694, ^bb97(%691 : index), ^bb98(%691 : index)
    ^bb97(%695: index):
      %696 = arith.constant 0 : i32
      %697 = arith.extsi %696 : i32 to i64
      %698 = arith.index_cast %695 : index to i64
      %699 = llvm.getelementptr %436[%698] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %697, %699 : i64, !llvm.ptr
      %700 = arith.addi %695, %687 : index
      cf.br ^bb96(%700 : index)
    ^bb98(%701: index):
    %702 = arith.constant 1 : i32
    %703 = arith.constant 0 : i32
    %704 = arith.extsi %702 : i32 to i64
    %705 = arith.extsi %703 : i32 to i64
    %706 = llvm.getelementptr %436[%705] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %704, %706 : i64, !llvm.ptr
    %707 = llvm.mlir.addressof @MOD : !llvm.ptr
    %708 = llvm.load %707 : !llvm.ptr -> i64
    %709 = arith.constant 1 : i32
    %711 = arith.extsi %709 : i32 to i64
    %710 = arith.subi %708, %711 : i64
    %712 = arith.constant 5 : i32
    %713 = arith.extsi %712 : i32 to i64
    %714 = llvm.getelementptr %436[%713] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %710, %714 : i64, !llvm.ptr
    %716 = llvm.load %562 : !llvm.ptr -> i64
    %717 = arith.constant 5 : i32
    %718 = arith.extsi %717 : i32 to i64
    %715 = func.call @poly_mul(%401, %716, %436, %718, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %715, %562 : i64, !llvm.ptr
    %719 = arith.constant 0 : i32
    %720 = llvm.load %562 : !llvm.ptr -> i64
    %721 = arith.constant 1 : i32
    %723 = arith.extsi %721 : i32 to i64
    %722 = arith.addi %720, %723 : i64
    %724 = arith.index_cast %719 : i32 to index
    %725 = arith.index_cast %722 : i32 to index
    %727 = arith.constant 1 : index
    %728 = arith.constant -1 : index
    %729 = arith.cmpi sle, %724, %725 : index
    %726 = arith.select %729, %727, %728 : index
    cf.br ^bb99(%724 : index)
    ^bb99(%730: index):
    %731 = arith.cmpi slt, %730, %725 : index
    %732 = arith.cmpi sgt, %730, %725 : index
    %733 = arith.select %729, %731, %732 : i1
    cf.cond_br %733, ^bb100(%730 : index), ^bb101(%730 : index)
    ^bb100(%734: index):
      %736 = arith.index_cast %734 : index to i64
      %737 = llvm.getelementptr %381[%736] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %735 = llvm.load %737 : !llvm.ptr -> i64
      %738 = arith.index_cast %734 : index to i64
      %739 = llvm.getelementptr %401[%738] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %735, %739 : i64, !llvm.ptr
      %740 = arith.addi %734, %726 : index
      cf.br ^bb99(%740 : index)
    ^bb101(%741: index):
    %742 = llvm.mlir.addressof @MOD : !llvm.ptr
    %743 = llvm.load %742 : !llvm.ptr -> i64
    %744 = arith.constant 1 : i32
    %746 = arith.extsi %744 : i32 to i64
    %745 = arith.subi %743, %746 : i64
    %747 = arith.constant 6 : i32
    %748 = arith.extsi %747 : i32 to i64
    %749 = llvm.getelementptr %436[%748] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %745, %749 : i64, !llvm.ptr
    %750 = arith.constant 0 : i32
    %751 = arith.constant 5 : i32
    %752 = arith.extsi %750 : i32 to i64
    %753 = arith.extsi %751 : i32 to i64
    %754 = llvm.getelementptr %436[%753] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %752, %754 : i64, !llvm.ptr
    %756 = llvm.load %562 : !llvm.ptr -> i64
    %757 = arith.constant 6 : i32
    %758 = arith.extsi %757 : i32 to i64
    %755 = func.call @poly_mul(%401, %756, %436, %758, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %755, %562 : i64, !llvm.ptr
    %759 = arith.constant 0 : i32
    %760 = llvm.load %562 : !llvm.ptr -> i64
    %761 = arith.constant 1 : i32
    %763 = arith.extsi %761 : i32 to i64
    %762 = arith.addi %760, %763 : i64
    %764 = arith.index_cast %759 : i32 to index
    %765 = arith.index_cast %762 : i32 to index
    %767 = arith.constant 1 : index
    %768 = arith.constant -1 : index
    %769 = arith.cmpi sle, %764, %765 : index
    %766 = arith.select %769, %767, %768 : index
    cf.br ^bb102(%764 : index)
    ^bb102(%770: index):
    %771 = arith.cmpi slt, %770, %765 : index
    %772 = arith.cmpi sgt, %770, %765 : index
    %773 = arith.select %769, %771, %772 : i1
    cf.cond_br %773, ^bb103(%770 : index), ^bb104(%770 : index)
    ^bb103(%774: index):
      %776 = arith.index_cast %774 : index to i64
      %777 = llvm.getelementptr %381[%776] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %775 = llvm.load %777 : !llvm.ptr -> i64
      %778 = arith.index_cast %774 : index to i64
      %779 = llvm.getelementptr %401[%778] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %775, %779 : i64, !llvm.ptr
      %780 = arith.addi %774, %766 : index
      cf.br ^bb102(%780 : index)
    ^bb104(%781: index):
    %782 = arith.constant 0 : i32
    %783 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %784 = llvm.load %783 : !llvm.ptr -> i64
    %785 = arith.index_cast %782 : i32 to index
    %786 = arith.index_cast %784 : i32 to index
    %788 = arith.constant 1 : index
    %789 = arith.constant -1 : index
    %790 = arith.cmpi sle, %785, %786 : index
    %787 = arith.select %790, %788, %789 : index
    cf.br ^bb105(%785 : index)
    ^bb105(%791: index):
    %792 = arith.cmpi slt, %791, %786 : index
    %793 = arith.cmpi sgt, %791, %786 : index
    %794 = arith.select %790, %792, %793 : i1
    cf.cond_br %794, ^bb106(%791 : index), ^bb107(%791 : index)
    ^bb106(%795: index):
      %796 = arith.constant 0 : i32
      %797 = arith.extsi %796 : i32 to i64
      %798 = arith.index_cast %795 : index to i64
      %799 = llvm.getelementptr %436[%798] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %797, %799 : i64, !llvm.ptr
      %800 = arith.addi %795, %787 : index
      cf.br ^bb105(%800 : index)
    ^bb107(%801: index):
    %802 = arith.constant 1 : i32
    %803 = arith.constant 0 : i32
    %804 = arith.extsi %802 : i32 to i64
    %805 = arith.extsi %803 : i32 to i64
    %806 = llvm.getelementptr %436[%805] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %804, %806 : i64, !llvm.ptr
    %807 = llvm.mlir.addressof @MOD : !llvm.ptr
    %808 = llvm.load %807 : !llvm.ptr -> i64
    %809 = arith.constant 1 : i32
    %811 = arith.extsi %809 : i32 to i64
    %810 = arith.subi %808, %811 : i64
    %812 = arith.constant 8 : i32
    %813 = arith.extsi %812 : i32 to i64
    %814 = llvm.getelementptr %436[%813] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %810, %814 : i64, !llvm.ptr
    %816 = llvm.load %562 : !llvm.ptr -> i64
    %817 = arith.constant 8 : i32
    %818 = arith.extsi %817 : i32 to i64
    %815 = func.call @poly_mul(%401, %816, %436, %818, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %815, %562 : i64, !llvm.ptr
    %819 = arith.constant 0 : i32
    %820 = llvm.load %562 : !llvm.ptr -> i64
    %821 = arith.constant 1 : i32
    %823 = arith.extsi %821 : i32 to i64
    %822 = arith.addi %820, %823 : i64
    %824 = arith.index_cast %819 : i32 to index
    %825 = arith.index_cast %822 : i32 to index
    %827 = arith.constant 1 : index
    %828 = arith.constant -1 : index
    %829 = arith.cmpi sle, %824, %825 : index
    %826 = arith.select %829, %827, %828 : index
    cf.br ^bb108(%824 : index)
    ^bb108(%830: index):
    %831 = arith.cmpi slt, %830, %825 : index
    %832 = arith.cmpi sgt, %830, %825 : index
    %833 = arith.select %829, %831, %832 : i1
    cf.cond_br %833, ^bb109(%830 : index), ^bb110(%830 : index)
    ^bb109(%834: index):
      %836 = arith.index_cast %834 : index to i64
      %837 = llvm.getelementptr %381[%836] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %835 = llvm.load %837 : !llvm.ptr -> i64
      %838 = arith.index_cast %834 : index to i64
      %839 = llvm.getelementptr %401[%838] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %835, %839 : i64, !llvm.ptr
      %840 = arith.addi %834, %826 : index
      cf.br ^bb108(%840 : index)
    ^bb110(%841: index):
    %842 = arith.constant 1 : i32
    %843 = arith.constant 0 : i32
    %844 = arith.extsi %842 : i32 to i64
    %845 = arith.extsi %843 : i32 to i64
    %846 = llvm.getelementptr %406[%845] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %844, %846 : i64, !llvm.ptr
    %847 = arith.constant 0 : i32
    %848 = arith.extsi %847 : i32 to i64
    %849 = llvm.mlir.constant(1 : i64) : i64
    %850 = llvm.alloca %849 x i64 : (i64) -> !llvm.ptr
    llvm.store %848, %850 : i64, !llvm.ptr
    %851 = arith.constant 0 : i32
    %852 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %853 = llvm.load %852 : !llvm.ptr -> i64
    %854 = arith.index_cast %851 : i32 to index
    %855 = arith.index_cast %853 : i32 to index
    %857 = arith.constant 1 : index
    %858 = arith.constant -1 : index
    %859 = arith.cmpi sle, %854, %855 : index
    %856 = arith.select %859, %857, %858 : index
    cf.br ^bb111(%854 : index)
    ^bb111(%860: index):
    %861 = arith.cmpi slt, %860, %855 : index
    %862 = arith.cmpi sgt, %860, %855 : index
    %863 = arith.select %859, %861, %862 : i1
    cf.cond_br %863, ^bb112(%860 : index), ^bb113(%860 : index)
    ^bb112(%864: index):
      %865 = arith.constant 0 : i32
      %866 = arith.extsi %865 : i32 to i64
      %867 = arith.index_cast %864 : index to i64
      %868 = llvm.getelementptr %436[%867] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %866, %868 : i64, !llvm.ptr
      %869 = arith.addi %864, %856 : index
      cf.br ^bb111(%869 : index)
    ^bb113(%870: index):
    %871 = arith.constant 1 : i32
    %872 = arith.constant 0 : i32
    %873 = arith.extsi %871 : i32 to i64
    %874 = arith.extsi %872 : i32 to i64
    %875 = llvm.getelementptr %436[%874] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %873, %875 : i64, !llvm.ptr
    %876 = llvm.mlir.addressof @MOD : !llvm.ptr
    %877 = llvm.load %876 : !llvm.ptr -> i64
    %878 = arith.constant 1 : i32
    %880 = arith.extsi %878 : i32 to i64
    %879 = arith.subi %877, %880 : i64
    %881 = arith.constant 1 : i32
    %882 = arith.extsi %881 : i32 to i64
    %883 = llvm.getelementptr %436[%882] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %879, %883 : i64, !llvm.ptr
    %885 = llvm.load %850 : !llvm.ptr -> i64
    %886 = arith.constant 1 : i32
    %887 = arith.extsi %886 : i32 to i64
    %884 = func.call @poly_mul(%406, %885, %436, %887, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %884, %850 : i64, !llvm.ptr
    %888 = arith.constant 0 : i32
    %889 = llvm.load %850 : !llvm.ptr -> i64
    %890 = arith.constant 1 : i32
    %892 = arith.extsi %890 : i32 to i64
    %891 = arith.addi %889, %892 : i64
    %893 = arith.index_cast %888 : i32 to index
    %894 = arith.index_cast %891 : i32 to index
    %896 = arith.constant 1 : index
    %897 = arith.constant -1 : index
    %898 = arith.cmpi sle, %893, %894 : index
    %895 = arith.select %898, %896, %897 : index
    cf.br ^bb114(%893 : index)
    ^bb114(%899: index):
    %900 = arith.cmpi slt, %899, %894 : index
    %901 = arith.cmpi sgt, %899, %894 : index
    %902 = arith.select %898, %900, %901 : i1
    cf.cond_br %902, ^bb115(%899 : index), ^bb116(%899 : index)
    ^bb115(%903: index):
      %905 = arith.index_cast %903 : index to i64
      %906 = llvm.getelementptr %381[%905] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %904 = llvm.load %906 : !llvm.ptr -> i64
      %907 = arith.index_cast %903 : index to i64
      %908 = llvm.getelementptr %406[%907] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %904, %908 : i64, !llvm.ptr
      %909 = arith.addi %903, %895 : index
      cf.br ^bb114(%909 : index)
    ^bb116(%910: index):
    %912 = llvm.load %850 : !llvm.ptr -> i64
    %913 = arith.constant 1 : i32
    %914 = arith.extsi %913 : i32 to i64
    %911 = func.call @poly_mul(%406, %912, %436, %914, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %911, %850 : i64, !llvm.ptr
    %915 = arith.constant 0 : i32
    %916 = llvm.load %850 : !llvm.ptr -> i64
    %917 = arith.constant 1 : i32
    %919 = arith.extsi %917 : i32 to i64
    %918 = arith.addi %916, %919 : i64
    %920 = arith.index_cast %915 : i32 to index
    %921 = arith.index_cast %918 : i32 to index
    %923 = arith.constant 1 : index
    %924 = arith.constant -1 : index
    %925 = arith.cmpi sle, %920, %921 : index
    %922 = arith.select %925, %923, %924 : index
    cf.br ^bb117(%920 : index)
    ^bb117(%926: index):
    %927 = arith.cmpi slt, %926, %921 : index
    %928 = arith.cmpi sgt, %926, %921 : index
    %929 = arith.select %925, %927, %928 : i1
    cf.cond_br %929, ^bb118(%926 : index), ^bb119(%926 : index)
    ^bb118(%930: index):
      %932 = arith.index_cast %930 : index to i64
      %933 = llvm.getelementptr %381[%932] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %931 = llvm.load %933 : !llvm.ptr -> i64
      %934 = arith.index_cast %930 : index to i64
      %935 = llvm.getelementptr %406[%934] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %931, %935 : i64, !llvm.ptr
      %936 = arith.addi %930, %922 : index
      cf.br ^bb117(%936 : index)
    ^bb119(%937: index):
    %938 = arith.constant 1 : i32
    %939 = arith.constant 1 : i32
    %940 = arith.extsi %938 : i32 to i64
    %941 = arith.extsi %939 : i32 to i64
    %942 = llvm.getelementptr %436[%941] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %940, %942 : i64, !llvm.ptr
    %944 = llvm.load %850 : !llvm.ptr -> i64
    %945 = arith.constant 1 : i32
    %946 = arith.extsi %945 : i32 to i64
    %943 = func.call @poly_mul(%406, %944, %436, %946, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %943, %850 : i64, !llvm.ptr
    %947 = arith.constant 0 : i32
    %948 = llvm.load %850 : !llvm.ptr -> i64
    %949 = arith.constant 1 : i32
    %951 = arith.extsi %949 : i32 to i64
    %950 = arith.addi %948, %951 : i64
    %952 = arith.index_cast %947 : i32 to index
    %953 = arith.index_cast %950 : i32 to index
    %955 = arith.constant 1 : index
    %956 = arith.constant -1 : index
    %957 = arith.cmpi sle, %952, %953 : index
    %954 = arith.select %957, %955, %956 : index
    cf.br ^bb120(%952 : index)
    ^bb120(%958: index):
    %959 = arith.cmpi slt, %958, %953 : index
    %960 = arith.cmpi sgt, %958, %953 : index
    %961 = arith.select %957, %959, %960 : i1
    cf.cond_br %961, ^bb121(%958 : index), ^bb122(%958 : index)
    ^bb121(%962: index):
      %964 = arith.index_cast %962 : index to i64
      %965 = llvm.getelementptr %381[%964] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %963 = llvm.load %965 : !llvm.ptr -> i64
      %966 = arith.index_cast %962 : index to i64
      %967 = llvm.getelementptr %406[%966] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %963, %967 : i64, !llvm.ptr
      %968 = arith.addi %962, %954 : index
      cf.br ^bb120(%968 : index)
    ^bb122(%969: index):
    %970 = arith.constant 1 : i32
    %971 = arith.constant 2 : i32
    %972 = arith.extsi %970 : i32 to i64
    %973 = arith.extsi %971 : i32 to i64
    %974 = llvm.getelementptr %436[%973] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %972, %974 : i64, !llvm.ptr
    %976 = llvm.load %850 : !llvm.ptr -> i64
    %977 = arith.constant 2 : i32
    %978 = arith.extsi %977 : i32 to i64
    %975 = func.call @poly_mul(%406, %976, %436, %978, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %975, %850 : i64, !llvm.ptr
    %979 = arith.constant 0 : i32
    %980 = llvm.load %850 : !llvm.ptr -> i64
    %981 = arith.constant 1 : i32
    %983 = arith.extsi %981 : i32 to i64
    %982 = arith.addi %980, %983 : i64
    %984 = arith.index_cast %979 : i32 to index
    %985 = arith.index_cast %982 : i32 to index
    %987 = arith.constant 1 : index
    %988 = arith.constant -1 : index
    %989 = arith.cmpi sle, %984, %985 : index
    %986 = arith.select %989, %987, %988 : index
    cf.br ^bb123(%984 : index)
    ^bb123(%990: index):
    %991 = arith.cmpi slt, %990, %985 : index
    %992 = arith.cmpi sgt, %990, %985 : index
    %993 = arith.select %989, %991, %992 : i1
    cf.cond_br %993, ^bb124(%990 : index), ^bb125(%990 : index)
    ^bb124(%994: index):
      %996 = arith.index_cast %994 : index to i64
      %997 = llvm.getelementptr %381[%996] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %995 = llvm.load %997 : !llvm.ptr -> i64
      %998 = arith.index_cast %994 : index to i64
      %999 = llvm.getelementptr %406[%998] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %995, %999 : i64, !llvm.ptr
      %1000 = arith.addi %994, %986 : index
      cf.br ^bb123(%1000 : index)
    ^bb125(%1001: index):
    %1002 = arith.constant 0 : i32
    %1003 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %1004 = llvm.load %1003 : !llvm.ptr -> i64
    %1005 = arith.index_cast %1002 : i32 to index
    %1006 = arith.index_cast %1004 : i32 to index
    %1008 = arith.constant 1 : index
    %1009 = arith.constant -1 : index
    %1010 = arith.cmpi sle, %1005, %1006 : index
    %1007 = arith.select %1010, %1008, %1009 : index
    cf.br ^bb126(%1005 : index)
    ^bb126(%1011: index):
    %1012 = arith.cmpi slt, %1011, %1006 : index
    %1013 = arith.cmpi sgt, %1011, %1006 : index
    %1014 = arith.select %1010, %1012, %1013 : i1
    cf.cond_br %1014, ^bb127(%1011 : index), ^bb128(%1011 : index)
    ^bb127(%1015: index):
      %1016 = arith.constant 0 : i32
      %1017 = arith.extsi %1016 : i32 to i64
      %1018 = arith.index_cast %1015 : index to i64
      %1019 = llvm.getelementptr %436[%1018] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1017, %1019 : i64, !llvm.ptr
      %1020 = arith.addi %1015, %1007 : index
      cf.br ^bb126(%1020 : index)
    ^bb128(%1021: index):
    %1022 = arith.constant 1 : i32
    %1023 = arith.constant 0 : i32
    %1024 = arith.extsi %1022 : i32 to i64
    %1025 = arith.extsi %1023 : i32 to i64
    %1026 = llvm.getelementptr %436[%1025] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1024, %1026 : i64, !llvm.ptr
    %1027 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1028 = llvm.load %1027 : !llvm.ptr -> i64
    %1029 = arith.constant 1 : i32
    %1031 = arith.extsi %1029 : i32 to i64
    %1030 = arith.subi %1028, %1031 : i64
    %1032 = arith.constant 7 : i32
    %1033 = arith.extsi %1032 : i32 to i64
    %1034 = llvm.getelementptr %436[%1033] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1030, %1034 : i64, !llvm.ptr
    %1036 = llvm.load %850 : !llvm.ptr -> i64
    %1037 = arith.constant 7 : i32
    %1038 = arith.extsi %1037 : i32 to i64
    %1035 = func.call @poly_mul(%406, %1036, %436, %1038, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %1035, %850 : i64, !llvm.ptr
    %1039 = arith.constant 0 : i32
    %1040 = llvm.load %850 : !llvm.ptr -> i64
    %1041 = arith.constant 1 : i32
    %1043 = arith.extsi %1041 : i32 to i64
    %1042 = arith.addi %1040, %1043 : i64
    %1044 = arith.index_cast %1039 : i32 to index
    %1045 = arith.index_cast %1042 : i32 to index
    %1047 = arith.constant 1 : index
    %1048 = arith.constant -1 : index
    %1049 = arith.cmpi sle, %1044, %1045 : index
    %1046 = arith.select %1049, %1047, %1048 : index
    cf.br ^bb129(%1044 : index)
    ^bb129(%1050: index):
    %1051 = arith.cmpi slt, %1050, %1045 : index
    %1052 = arith.cmpi sgt, %1050, %1045 : index
    %1053 = arith.select %1049, %1051, %1052 : i1
    cf.cond_br %1053, ^bb130(%1050 : index), ^bb131(%1050 : index)
    ^bb130(%1054: index):
      %1056 = arith.index_cast %1054 : index to i64
      %1057 = llvm.getelementptr %381[%1056] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1055 = llvm.load %1057 : !llvm.ptr -> i64
      %1058 = arith.index_cast %1054 : index to i64
      %1059 = llvm.getelementptr %406[%1058] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1055, %1059 : i64, !llvm.ptr
      %1060 = arith.addi %1054, %1046 : index
      cf.br ^bb129(%1060 : index)
    ^bb131(%1061: index):
    %1062 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1063 = llvm.load %1062 : !llvm.ptr -> i64
    %1064 = arith.constant 1 : i32
    %1066 = arith.extsi %1064 : i32 to i64
    %1065 = arith.subi %1063, %1066 : i64
    %1067 = arith.constant 8 : i32
    %1068 = arith.extsi %1067 : i32 to i64
    %1069 = llvm.getelementptr %436[%1068] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1065, %1069 : i64, !llvm.ptr
    %1070 = arith.constant 0 : i32
    %1071 = arith.constant 7 : i32
    %1072 = arith.extsi %1070 : i32 to i64
    %1073 = arith.extsi %1071 : i32 to i64
    %1074 = llvm.getelementptr %436[%1073] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1072, %1074 : i64, !llvm.ptr
    %1076 = llvm.load %850 : !llvm.ptr -> i64
    %1077 = arith.constant 8 : i32
    %1078 = arith.extsi %1077 : i32 to i64
    %1075 = func.call @poly_mul(%406, %1076, %436, %1078, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %1075, %850 : i64, !llvm.ptr
    %1079 = arith.constant 0 : i32
    %1080 = llvm.load %850 : !llvm.ptr -> i64
    %1081 = arith.constant 1 : i32
    %1083 = arith.extsi %1081 : i32 to i64
    %1082 = arith.addi %1080, %1083 : i64
    %1084 = arith.index_cast %1079 : i32 to index
    %1085 = arith.index_cast %1082 : i32 to index
    %1087 = arith.constant 1 : index
    %1088 = arith.constant -1 : index
    %1089 = arith.cmpi sle, %1084, %1085 : index
    %1086 = arith.select %1089, %1087, %1088 : index
    cf.br ^bb132(%1084 : index)
    ^bb132(%1090: index):
    %1091 = arith.cmpi slt, %1090, %1085 : index
    %1092 = arith.cmpi sgt, %1090, %1085 : index
    %1093 = arith.select %1089, %1091, %1092 : i1
    cf.cond_br %1093, ^bb133(%1090 : index), ^bb134(%1090 : index)
    ^bb133(%1094: index):
      %1096 = arith.index_cast %1094 : index to i64
      %1097 = llvm.getelementptr %381[%1096] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1095 = llvm.load %1097 : !llvm.ptr -> i64
      %1098 = arith.index_cast %1094 : index to i64
      %1099 = llvm.getelementptr %406[%1098] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1095, %1099 : i64, !llvm.ptr
      %1100 = arith.addi %1094, %1086 : index
      cf.br ^bb132(%1100 : index)
    ^bb134(%1101: index):
    %1102 = arith.constant 0 : i32
    %1103 = llvm.mlir.addressof @MAXDEG : !llvm.ptr
    %1104 = llvm.load %1103 : !llvm.ptr -> i64
    %1105 = arith.index_cast %1102 : i32 to index
    %1106 = arith.index_cast %1104 : i32 to index
    %1108 = arith.constant 1 : index
    %1109 = arith.constant -1 : index
    %1110 = arith.cmpi sle, %1105, %1106 : index
    %1107 = arith.select %1110, %1108, %1109 : index
    cf.br ^bb135(%1105 : index)
    ^bb135(%1111: index):
    %1112 = arith.cmpi slt, %1111, %1106 : index
    %1113 = arith.cmpi sgt, %1111, %1106 : index
    %1114 = arith.select %1110, %1112, %1113 : i1
    cf.cond_br %1114, ^bb136(%1111 : index), ^bb137(%1111 : index)
    ^bb136(%1115: index):
      %1116 = arith.constant 0 : i32
      %1117 = arith.extsi %1116 : i32 to i64
      %1118 = arith.index_cast %1115 : index to i64
      %1119 = llvm.getelementptr %436[%1118] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1117, %1119 : i64, !llvm.ptr
      %1120 = arith.addi %1115, %1107 : index
      cf.br ^bb135(%1120 : index)
    ^bb137(%1121: index):
    %1122 = arith.constant 1 : i32
    %1123 = arith.constant 0 : i32
    %1124 = arith.extsi %1122 : i32 to i64
    %1125 = arith.extsi %1123 : i32 to i64
    %1126 = llvm.getelementptr %436[%1125] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1124, %1126 : i64, !llvm.ptr
    %1127 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1128 = llvm.load %1127 : !llvm.ptr -> i64
    %1129 = arith.constant 1 : i32
    %1131 = arith.extsi %1129 : i32 to i64
    %1130 = arith.subi %1128, %1131 : i64
    %1132 = arith.constant 10 : i32
    %1133 = arith.extsi %1132 : i32 to i64
    %1134 = llvm.getelementptr %436[%1133] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1130, %1134 : i64, !llvm.ptr
    %1136 = llvm.load %850 : !llvm.ptr -> i64
    %1137 = arith.constant 10 : i32
    %1138 = arith.extsi %1137 : i32 to i64
    %1135 = func.call @poly_mul(%406, %1136, %436, %1138, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    llvm.store %1135, %850 : i64, !llvm.ptr
    %1139 = arith.constant 0 : i32
    %1140 = llvm.load %850 : !llvm.ptr -> i64
    %1141 = arith.constant 1 : i32
    %1143 = arith.extsi %1141 : i32 to i64
    %1142 = arith.addi %1140, %1143 : i64
    %1144 = arith.index_cast %1139 : i32 to index
    %1145 = arith.index_cast %1142 : i32 to index
    %1147 = arith.constant 1 : index
    %1148 = arith.constant -1 : index
    %1149 = arith.cmpi sle, %1144, %1145 : index
    %1146 = arith.select %1149, %1147, %1148 : index
    cf.br ^bb138(%1144 : index)
    ^bb138(%1150: index):
    %1151 = arith.cmpi slt, %1150, %1145 : index
    %1152 = arith.cmpi sgt, %1150, %1145 : index
    %1153 = arith.select %1149, %1151, %1152 : i1
    cf.cond_br %1153, ^bb139(%1150 : index), ^bb140(%1150 : index)
    ^bb139(%1154: index):
      %1156 = arith.index_cast %1154 : index to i64
      %1157 = llvm.getelementptr %381[%1156] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1155 = llvm.load %1157 : !llvm.ptr -> i64
      %1158 = arith.index_cast %1154 : index to i64
      %1159 = llvm.getelementptr %406[%1158] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1155, %1159 : i64, !llvm.ptr
      %1160 = arith.addi %1154, %1146 : index
      cf.br ^bb138(%1160 : index)
    ^bb140(%1161: index):
    %1163 = llvm.load %456 : !llvm.ptr -> i64
    %1164 = llvm.load %562 : !llvm.ptr -> i64
    %1162 = func.call @poly_mul(%396, %1163, %401, %1164, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    %1166 = llvm.load %850 : !llvm.ptr -> i64
    %1165 = func.call @poly_mul(%381, %1162, %406, %1166, %411) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    %1168 = llvm.load %562 : !llvm.ptr -> i64
    %1169 = llvm.load %850 : !llvm.ptr -> i64
    %1167 = func.call @poly_mul(%401, %1168, %406, %1169, %381) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    %1171 = llvm.load %456 : !llvm.ptr -> i64
    %1172 = llvm.load %850 : !llvm.ptr -> i64
    %1170 = func.call @poly_mul(%396, %1171, %406, %1172, %386) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    %1174 = llvm.load %456 : !llvm.ptr -> i64
    %1175 = llvm.load %562 : !llvm.ptr -> i64
    %1173 = func.call @poly_mul(%396, %1174, %401, %1175, %391) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
    %1176 = arith.constant 1 : i32
    %1178 = arith.extsi %1176 : i32 to i64
    %1177 = arith.addi %1170, %1178 : i64
    %1179 = arith.cmpi sgt, %1177, %1167 : i64
    %1180 = scf.if %1179 -> (i64) {
      %1181 = arith.constant 1 : i32
      %1183 = arith.extsi %1181 : i32 to i64
      %1182 = arith.addi %1170, %1183 : i64
      scf.yield %1182 : i64
    } else {
      scf.yield %1167 : i64
    }
    %1184 = arith.constant 5 : i32
    %1186 = arith.extsi %1184 : i32 to i64
    %1185 = arith.addi %1173, %1186 : i64
    %1187 = arith.cmpi sgt, %1185, %1180 : i64
    %1188 = scf.if %1187 -> (i64) {
      %1189 = arith.constant 5 : i32
      %1191 = arith.extsi %1189 : i32 to i64
      %1190 = arith.addi %1173, %1191 : i64
      scf.yield %1190 : i64
    } else {
      scf.yield %1180 : i64
    }
    %1192 = arith.constant 0 : i32
    %1193 = arith.constant 1 : i32
    %1195 = arith.extsi %1193 : i32 to i64
    %1194 = arith.addi %1188, %1195 : i64
    %1196 = arith.index_cast %1192 : i32 to index
    %1197 = arith.index_cast %1194 : i32 to index
    %1199 = arith.constant 1 : index
    %1200 = arith.constant -1 : index
    %1201 = arith.cmpi sle, %1196, %1197 : index
    %1198 = arith.select %1201, %1199, %1200 : index
    cf.br ^bb141(%1196 : index)
    ^bb141(%1202: index):
    %1203 = arith.cmpi slt, %1202, %1197 : index
    %1204 = arith.cmpi sgt, %1202, %1197 : index
    %1205 = arith.select %1201, %1203, %1204 : i1
    cf.cond_br %1205, ^bb142(%1202 : index), ^bb143(%1202 : index)
    ^bb142(%1206: index):
      %1207 = arith.constant 0 : i32
      %1208 = arith.extsi %1207 : i32 to i64
      %1209 = arith.index_cast %1206 : index to i64
      %1210 = llvm.getelementptr %416[%1209] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1208, %1210 : i64, !llvm.ptr
      %1211 = arith.addi %1206, %1198 : index
      cf.br ^bb141(%1211 : index)
    ^bb143(%1212: index):
    %1213 = arith.constant 0 : i32
    %1214 = arith.constant 1 : i32
    %1216 = arith.extsi %1214 : i32 to i64
    %1215 = arith.addi %1167, %1216 : i64
    %1217 = arith.index_cast %1213 : i32 to index
    %1218 = arith.index_cast %1215 : i32 to index
    %1220 = arith.constant 1 : index
    %1221 = arith.constant -1 : index
    %1222 = arith.cmpi sle, %1217, %1218 : index
    %1219 = arith.select %1222, %1220, %1221 : index
    cf.br ^bb144(%1217 : index)
    ^bb144(%1223: index):
    %1224 = arith.cmpi slt, %1223, %1218 : index
    %1225 = arith.cmpi sgt, %1223, %1218 : index
    %1226 = arith.select %1222, %1224, %1225 : i1
    cf.cond_br %1226, ^bb145(%1223 : index), ^bb146(%1223 : index)
    ^bb145(%1227: index):
      %1229 = arith.index_cast %1227 : index to i64
      %1230 = llvm.getelementptr %381[%1229] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1228 = llvm.load %1230 : !llvm.ptr -> i64
      %1231 = arith.index_cast %1227 : index to i64
      %1232 = llvm.getelementptr %416[%1231] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1228, %1232 : i64, !llvm.ptr
      %1233 = arith.addi %1227, %1219 : index
      cf.br ^bb144(%1233 : index)
    ^bb146(%1234: index):
    %1235 = arith.constant 0 : i32
    %1236 = arith.constant 1 : i32
    %1238 = arith.extsi %1236 : i32 to i64
    %1237 = arith.addi %1170, %1238 : i64
    %1239 = arith.index_cast %1235 : i32 to index
    %1240 = arith.index_cast %1237 : i32 to index
    %1242 = arith.constant 1 : index
    %1243 = arith.constant -1 : index
    %1244 = arith.cmpi sle, %1239, %1240 : index
    %1241 = arith.select %1244, %1242, %1243 : index
    cf.br ^bb147(%1239 : index)
    ^bb147(%1245: index):
    %1246 = arith.cmpi slt, %1245, %1240 : index
    %1247 = arith.cmpi sgt, %1245, %1240 : index
    %1248 = arith.select %1244, %1246, %1247 : i1
    cf.cond_br %1248, ^bb148(%1245 : index), ^bb149(%1245 : index)
    ^bb148(%1249: index):
      %1251 = arith.constant 1 : i32
      %1253 = arith.index_cast %1249 : index to i32
      %1252 = arith.addi %1253, %1251 : i32
      %1254 = arith.extsi %1252 : i32 to i64
      %1255 = llvm.getelementptr %416[%1254] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1250 = llvm.load %1255 : !llvm.ptr -> i64
      %1257 = arith.index_cast %1249 : index to i64
      %1258 = llvm.getelementptr %386[%1257] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1256 = llvm.load %1258 : !llvm.ptr -> i64
      %1259 = arith.subi %1250, %1256 : i64
      %1260 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1261 = llvm.load %1260 : !llvm.ptr -> i64
      %1262 = arith.addi %1259, %1261 : i64
      %1263 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1264 = llvm.load %1263 : !llvm.ptr -> i64
      %1265 = arith.remsi %1262, %1264 : i64
      %1266 = arith.constant 1 : i32
      %1268 = arith.index_cast %1249 : index to i32
      %1267 = arith.addi %1268, %1266 : i32
      %1269 = arith.extsi %1267 : i32 to i64
      %1270 = llvm.getelementptr %416[%1269] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1265, %1270 : i64, !llvm.ptr
      %1271 = arith.addi %1249, %1241 : index
      cf.br ^bb147(%1271 : index)
    ^bb149(%1272: index):
    %1273 = arith.constant 0 : i32
    %1274 = arith.constant 1 : i32
    %1276 = arith.extsi %1274 : i32 to i64
    %1275 = arith.addi %1173, %1276 : i64
    %1277 = arith.index_cast %1273 : i32 to index
    %1278 = arith.index_cast %1275 : i32 to index
    %1280 = arith.constant 1 : index
    %1281 = arith.constant -1 : index
    %1282 = arith.cmpi sle, %1277, %1278 : index
    %1279 = arith.select %1282, %1280, %1281 : index
    cf.br ^bb150(%1277 : index)
    ^bb150(%1283: index):
    %1284 = arith.cmpi slt, %1283, %1278 : index
    %1285 = arith.cmpi sgt, %1283, %1278 : index
    %1286 = arith.select %1282, %1284, %1285 : i1
    cf.cond_br %1286, ^bb151(%1283 : index), ^bb152(%1283 : index)
    ^bb151(%1287: index):
      %1289 = arith.constant 5 : i32
      %1291 = arith.index_cast %1287 : index to i32
      %1290 = arith.addi %1291, %1289 : i32
      %1292 = arith.extsi %1290 : i32 to i64
      %1293 = llvm.getelementptr %416[%1292] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1288 = llvm.load %1293 : !llvm.ptr -> i64
      %1295 = arith.index_cast %1287 : index to i64
      %1296 = llvm.getelementptr %391[%1295] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1294 = llvm.load %1296 : !llvm.ptr -> i64
      %1297 = arith.addi %1288, %1294 : i64
      %1298 = llvm.mlir.addressof @MOD : !llvm.ptr
      %1299 = llvm.load %1298 : !llvm.ptr -> i64
      %1300 = arith.remsi %1297, %1299 : i64
      %1301 = arith.constant 5 : i32
      %1303 = arith.index_cast %1287 : index to i32
      %1302 = arith.addi %1303, %1301 : i32
      %1304 = arith.extsi %1302 : i32 to i64
      %1305 = llvm.getelementptr %416[%1304] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1300, %1305 : i64, !llvm.ptr
      %1306 = arith.addi %1287, %1279 : index
      cf.br ^bb150(%1306 : index)
    ^bb152(%1307: index):
    %1308 = llvm.mlir.constant(1 : i64) : i64
    %1309 = llvm.alloca %1308 x i64 : (i64) -> !llvm.ptr
    llvm.store %1188, %1309 : i64, !llvm.ptr
    %1310 = llvm.mlir.constant(1 : i64) : i64
    %1311 = llvm.alloca %1310 x i64 : (i64) -> !llvm.ptr
    llvm.store %1165, %1311 : i64, !llvm.ptr
    %1312 = arith.constant 10000000 : i32
    %1313 = arith.extsi %1312 : i32 to i64
    %1314 = llvm.mlir.constant(1 : i64) : i64
    %1315 = llvm.alloca %1314 x i64 : (i64) -> !llvm.ptr
    llvm.store %1313, %1315 : i64, !llvm.ptr
    cf.br ^bb153
    ^bb153:
    %1316 = llvm.load %1315 : !llvm.ptr -> i64
    %1317 = arith.constant 0 : i32
    %1319 = arith.extsi %1317 : i32 to i64
    %1318 = arith.cmpi sgt, %1316, %1319 : i64
    cf.cond_br %1318, ^bb154, ^bb155
    ^bb154:
      %1321 = llvm.load %1311 : !llvm.ptr -> i64
      %1320 = func.call @negate_odd(%411, %1321, %421) : (!llvm.ptr, i64, !llvm.ptr) -> i64
      %1323 = llvm.load %1309 : !llvm.ptr -> i64
      %1322 = func.call @poly_mul(%416, %1323, %421, %1320, %426) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
      %1324 = arith.constant 0 : i32
      %1325 = arith.constant 1 : i32
      %1327 = arith.extsi %1325 : i32 to i64
      %1326 = arith.addi %1322, %1327 : i64
      %1328 = arith.index_cast %1324 : i32 to index
      %1329 = arith.index_cast %1326 : i32 to index
      %1331 = arith.constant 1 : index
      %1332 = arith.constant -1 : index
      %1333 = arith.cmpi sle, %1328, %1329 : index
      %1330 = arith.select %1333, %1331, %1332 : index
      cf.br ^bb156(%1328 : index)
      ^bb156(%1334: index):
      %1335 = arith.cmpi slt, %1334, %1329 : index
      %1336 = arith.cmpi sgt, %1334, %1329 : index
      %1337 = arith.select %1333, %1335, %1336 : i1
      cf.cond_br %1337, ^bb157(%1334 : index), ^bb158(%1334 : index)
      ^bb157(%1338: index):
        %1340 = arith.index_cast %1338 : index to i64
        %1341 = llvm.getelementptr %426[%1340] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1339 = llvm.load %1341 : !llvm.ptr -> i64
        %1342 = arith.index_cast %1338 : index to i64
        %1343 = llvm.getelementptr %416[%1342] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1339, %1343 : i64, !llvm.ptr
        %1344 = arith.addi %1338, %1330 : index
        cf.br ^bb156(%1344 : index)
      ^bb158(%1345: index):
      llvm.store %1322, %1309 : i64, !llvm.ptr
      %1347 = llvm.load %1311 : !llvm.ptr -> i64
      %1346 = func.call @poly_mul(%411, %1347, %421, %1320, %431) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr) -> i64
      %1348 = arith.constant 0 : i32
      %1349 = arith.constant 1 : i32
      %1351 = arith.extsi %1349 : i32 to i64
      %1350 = arith.addi %1346, %1351 : i64
      %1352 = arith.index_cast %1348 : i32 to index
      %1353 = arith.index_cast %1350 : i32 to index
      %1355 = arith.constant 1 : index
      %1356 = arith.constant -1 : index
      %1357 = arith.cmpi sle, %1352, %1353 : index
      %1354 = arith.select %1357, %1355, %1356 : index
      cf.br ^bb159(%1352 : index)
      ^bb159(%1358: index):
      %1359 = arith.cmpi slt, %1358, %1353 : index
      %1360 = arith.cmpi sgt, %1358, %1353 : index
      %1361 = arith.select %1357, %1359, %1360 : i1
      cf.cond_br %1361, ^bb160(%1358 : index), ^bb161(%1358 : index)
      ^bb160(%1362: index):
        %1364 = arith.index_cast %1362 : index to i64
        %1365 = llvm.getelementptr %431[%1364] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1363 = llvm.load %1365 : !llvm.ptr -> i64
        %1366 = arith.index_cast %1362 : index to i64
        %1367 = llvm.getelementptr %411[%1366] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1363, %1367 : i64, !llvm.ptr
        %1368 = arith.addi %1362, %1354 : index
        cf.br ^bb159(%1368 : index)
      ^bb161(%1369: index):
      llvm.store %1346, %1311 : i64, !llvm.ptr
      %1370 = llvm.load %1315 : !llvm.ptr -> i64
      %1371 = arith.constant 2 : i32
      %1373 = arith.extsi %1371 : i32 to i64
      %1372 = arith.remsi %1370, %1373 : i64
      %1374 = arith.constant 1 : i32
      %1376 = arith.extsi %1374 : i32 to i64
      %1375 = arith.cmpi eq, %1372, %1376 : i64
      cf.cond_br %1375, ^bb162, ^bb163
      ^bb162:
        %1378 = llvm.load %1309 : !llvm.ptr -> i64
        %1377 = func.call @odd_part(%416, %1378, %426) : (!llvm.ptr, i64, !llvm.ptr) -> i64
        llvm.store %1377, %1309 : i64, !llvm.ptr
        cf.br ^bb164
      ^bb163:
        %1380 = llvm.load %1309 : !llvm.ptr -> i64
        %1379 = func.call @even_part(%416, %1380, %426) : (!llvm.ptr, i64, !llvm.ptr) -> i64
        llvm.store %1379, %1309 : i64, !llvm.ptr
        cf.br ^bb164
      ^bb164:
      %1381 = arith.constant 0 : i32
      %1382 = llvm.load %1309 : !llvm.ptr -> i64
      %1383 = arith.constant 1 : i32
      %1385 = arith.extsi %1383 : i32 to i64
      %1384 = arith.addi %1382, %1385 : i64
      %1386 = arith.index_cast %1381 : i32 to index
      %1387 = arith.index_cast %1384 : i32 to index
      %1389 = arith.constant 1 : index
      %1390 = arith.constant -1 : index
      %1391 = arith.cmpi sle, %1386, %1387 : index
      %1388 = arith.select %1391, %1389, %1390 : index
      cf.br ^bb165(%1386 : index)
      ^bb165(%1392: index):
      %1393 = arith.cmpi slt, %1392, %1387 : index
      %1394 = arith.cmpi sgt, %1392, %1387 : index
      %1395 = arith.select %1391, %1393, %1394 : i1
      cf.cond_br %1395, ^bb166(%1392 : index), ^bb167(%1392 : index)
      ^bb166(%1396: index):
        %1398 = arith.index_cast %1396 : index to i64
        %1399 = llvm.getelementptr %426[%1398] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1397 = llvm.load %1399 : !llvm.ptr -> i64
        %1400 = arith.index_cast %1396 : index to i64
        %1401 = llvm.getelementptr %416[%1400] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1397, %1401 : i64, !llvm.ptr
        %1402 = arith.addi %1396, %1388 : index
        cf.br ^bb165(%1402 : index)
      ^bb167(%1403: index):
      %1405 = llvm.load %1311 : !llvm.ptr -> i64
      %1404 = func.call @even_part(%411, %1405, %431) : (!llvm.ptr, i64, !llvm.ptr) -> i64
      llvm.store %1404, %1311 : i64, !llvm.ptr
      %1406 = arith.constant 0 : i32
      %1407 = llvm.load %1311 : !llvm.ptr -> i64
      %1408 = arith.constant 1 : i32
      %1410 = arith.extsi %1408 : i32 to i64
      %1409 = arith.addi %1407, %1410 : i64
      %1411 = arith.index_cast %1406 : i32 to index
      %1412 = arith.index_cast %1409 : i32 to index
      %1414 = arith.constant 1 : index
      %1415 = arith.constant -1 : index
      %1416 = arith.cmpi sle, %1411, %1412 : index
      %1413 = arith.select %1416, %1414, %1415 : index
      cf.br ^bb168(%1411 : index)
      ^bb168(%1417: index):
      %1418 = arith.cmpi slt, %1417, %1412 : index
      %1419 = arith.cmpi sgt, %1417, %1412 : index
      %1420 = arith.select %1416, %1418, %1419 : i1
      cf.cond_br %1420, ^bb169(%1417 : index), ^bb170(%1417 : index)
      ^bb169(%1421: index):
        %1423 = arith.index_cast %1421 : index to i64
        %1424 = llvm.getelementptr %431[%1423] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1422 = llvm.load %1424 : !llvm.ptr -> i64
        %1425 = arith.index_cast %1421 : index to i64
        %1426 = llvm.getelementptr %411[%1425] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1422, %1426 : i64, !llvm.ptr
        %1427 = arith.addi %1421, %1413 : index
        cf.br ^bb168(%1427 : index)
      ^bb170(%1428: index):
      %1429 = llvm.load %1315 : !llvm.ptr -> i64
      %1430 = arith.constant 2 : i32
      %1432 = arith.extsi %1430 : i32 to i64
      %1431 = arith.divsi %1429, %1432 : i64
      llvm.store %1431, %1315 : i64, !llvm.ptr
      cf.br ^bb153
    ^bb155:
    %1435 = arith.constant 0 : i32
    %1436 = arith.extsi %1435 : i32 to i64
    %1437 = llvm.getelementptr %411[%1436] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %1434 = llvm.load %1437 : !llvm.ptr -> i64
    %1438 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1439 = llvm.load %1438 : !llvm.ptr -> i64
    %1440 = arith.constant 2 : i32
    %1442 = arith.extsi %1440 : i32 to i64
    %1441 = arith.subi %1439, %1442 : i64
    %1443 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1444 = llvm.load %1443 : !llvm.ptr -> i64
    %1433 = func.call @mod_pow(%1434, %1441, %1444) : (i64, i64, i64) -> i64
    %1446 = arith.constant 0 : i32
    %1447 = arith.extsi %1446 : i32 to i64
    %1448 = llvm.getelementptr %416[%1447] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %1445 = llvm.load %1448 : !llvm.ptr -> i64
    %1449 = arith.extsi %1445 : i64 to i128
    %1450 = arith.extsi %1433 : i64 to i128
    %1452 = arith.trunci %1449 : i128 to i64
    %1453 = arith.trunci %1450 : i128 to i64
    %1451 = arith.muli %1452, %1453 : i64
    %1454 = llvm.mlir.addressof @MOD : !llvm.ptr
    %1455 = llvm.load %1454 : !llvm.ptr -> i64
    %1456 = arith.extsi %1455 : i64 to i128
    %1458 = arith.trunci %1456 : i128 to i64
    %1457 = arith.remsi %1451, %1458 : i64
    %1459 = arith.extsi %1457 : i64 to i128
    %1460 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %1461 = arith.trunci %1459 : i128 to i64
    %1462 = llvm.call @printf(%1460, %1461) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%436) : (!llvm.ptr) -> ()
    func.call @free(%431) : (!llvm.ptr) -> ()
    func.call @free(%426) : (!llvm.ptr) -> ()
    func.call @free(%421) : (!llvm.ptr) -> ()
    func.call @free(%416) : (!llvm.ptr) -> ()
    func.call @free(%411) : (!llvm.ptr) -> ()
    func.call @free(%406) : (!llvm.ptr) -> ()
    func.call @free(%401) : (!llvm.ptr) -> ()
    func.call @free(%396) : (!llvm.ptr) -> ()
    func.call @free(%391) : (!llvm.ptr) -> ()
    func.call @free(%386) : (!llvm.ptr) -> ()
    func.call @free(%381) : (!llvm.ptr) -> ()
    %1475 = arith.constant 0 : i32
    func.return %1475 : i32
  }
}