Problem 660

L^2 = x^2 + y^2 + x*y, enumerate primitive 120-degree triangles and check pandigital property for bases 9..18.

Answer474766783
Output474766783
StatusPASS
Native helperno
Runtime850 ms
Peak memory2976 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^2)
ApproachFlow solutionBottom-up DP
VerdictOptimal

Flow source

# Project Euler 660: Pandigital triangles with a 120 degree angle
# L^2 = x^2 + y^2 + x*y, enumerate primitive 120-degree triangles
# and check pandigital property for bases 9..18.

import euler.nt { isqrt }

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

function mygcd(a: i64, b: i64) -> i64 {
    let mut x: i64 = a
    let mut y: i64 = b
    while y > 0 {
        let t: i64 = x % y
        x = y
        y = t
    }
    return x
}

function egcd(a: i64, b: i64) -> i64 {
    # Returns modular inverse of a mod b (assumes gcd=1)
    let mut x0: i64 = 1
    let mut x1: i64 = 0
    let mut aa: i64 = a
    let mut bb: i64 = b
    while bb > 0 {
        let q: i64 = aa / bb
        let t: i64 = aa - q * bb
        aa = bb
        bb = t
        let t2: i64 = x0 - q * x1
        x0 = x1
        x1 = t2
    }
    let mut r: i64 = x0 % b
    if r < 0 { r = r + b }
    return r
}

function ceil_div(a: i64, b: i64) -> i64 {
    return (a + b - 1) / b
}

# Digit mask tables per base
# t1[d], t2[v], t3[v], t3z[v]
# We store per-base in arrays indexed by base (9..18)

const MAX_BASE: i64 = 19
const MAX_B3: i64 = 5833  # 18^3 = 5832

let mut g_t1: ptr<i64> = null  # [MAX_BASE * MAX_BASE]
let mut g_t2: ptr<i64> = null  # [MAX_BASE * MAX_BASE * MAX_BASE]
let mut g_t3: ptr<i64> = null  # [MAX_BASE * MAX_B3]
let mut g_t3z: ptr<i64> = null  # [MAX_BASE * MAX_B3]

function init_tables() -> void {
    g_t1 = calloc(MAX_BASE * MAX_BASE, 8)
    g_t2 = calloc(MAX_BASE * MAX_BASE * MAX_BASE, 8)
    g_t3 = calloc(MAX_BASE * MAX_B3, 8)
    g_t3z = calloc(MAX_BASE * MAX_B3, 8)

    for base in 9..MAX_BASE {
        let b2: i64 = base * base
        let b3: i64 = b2 * base

        # t1
        for d in 0..base {
            g_t1[base * MAX_BASE + d] = 1 << d
        }

        # t2
        for v in 0..(base * base) {
            g_t2[base * MAX_BASE * MAX_BASE + v] = -1
        }
        for v in base..(base * base) {
            let d0: i64 = v / base
            let d1: i64 = v - d0 * base
            if d0 != d1 {
                g_t2[base * MAX_BASE * MAX_BASE + v] = (1 << d0) | (1 << d1)
            }
        }

        # t3
        for v in 0..b3 {
            g_t3[base * MAX_B3 + v] = -1
        }
        for v in b2..b3 {
            let d0: i64 = v / b2
            let r: i64 = v - d0 * b2
            let d1: i64 = r / base
            let d2: i64 = r - d1 * base
            if d0 != d1 && d0 != d2 && d1 != d2 {
                g_t3[base * MAX_B3 + v] = (1 << d0) | (1 << d1) | (1 << d2)
            }
        }

        # t3z
        for v in 0..b3 {
            g_t3z[base * MAX_B3 + v] = -1
        }
        for v in 0..b3 {
            let d0: i64 = v / b2
            let r: i64 = v - d0 * b2
            let d1: i64 = r / base
            let d2: i64 = r - d1 * base
            if d0 != d1 && d0 != d2 && d1 != d2 {
                g_t3z[base * MAX_B3 + v] = (1 << d0) | (1 << d1) | (1 << d2)
            }
        }
    }
}

function mask_fixed_len(x: i64, d: i64, base: i64) -> i64 {
    let b2: i64 = base * base
    let b3: i64 = b2 * base

    if d == 1 { return g_t1[base * MAX_BASE + x] }
    if d == 2 { return g_t2[base * MAX_BASE * MAX_BASE + x] }
    if d == 3 { return g_t3[base * MAX_B3 + x] }

    let hi: i64 = x / b3
    let lo: i64 = x - hi * b3

    let mh: i64
    let ml: i64

    if d == 4 {
        mh = g_t1[base * MAX_BASE + hi]
        ml = g_t3z[base * MAX_B3 + lo]
    } else { if d == 5 {
        mh = g_t2[base * MAX_BASE * MAX_BASE + hi]
        ml = g_t3z[base * MAX_B3 + lo]
    } else {
        # d == 6
        mh = g_t3[base * MAX_B3 + hi]
        ml = g_t3z[base * MAX_B3 + lo]
    } }

    if mh == -1 || ml == -1 { return -1 }
    if (mh & ml) != 0 { return -1 }
    return mh | ml
}

function main() -> i32 {
    init_tables()

    # Per-base settings
    let limit_arr: ptr<i64> = calloc(MAX_BASE, 8)
    let powb: ptr<i64> = calloc(MAX_BASE * 8, 8)  # [base * 8 + i]
    let full_mask: ptr<i64> = calloc(MAX_BASE, 8)
    let modM: ptr<i64> = calloc(MAX_BASE, 8)
    let target_arr: ptr<i64> = calloc(MAX_BASE, 8)

    for base in 9..MAX_BASE {
        let D: i64 = (base + 2) / 3
        let mut lim: i64 = 1
        for _ in 0..D { lim = lim * base }
        limit_arr[base] = lim - 1

        powb[base * 8 + 0] = 1
        for i in 0..7 { powb[base * 8 + i + 1] = powb[base * 8 + i] * base }

        full_mask[base] = (1 << base) - 1
        modM[base] = base - 1
        if base % 2 == 0 {
            target_arr[base] = 0
        } else {
            target_arr[base] = (base - 1) / 2
        }
    }

    let sums: ptr<i64> = calloc(MAX_BASE, 8)

    let max_a: i64 = limit_arr[18]
    let max_m: i64 = isqrt(max_a) + 2

    for m in 2..max_m {
        let disc: i64 = 4 * max_a - 3 * m * m
        if disc <= 0 { continue }
        let mut nmax: i64 = (-m + isqrt(disc)) / 2
        if nmax >= m { nmax = m - 1 }

        let mm: i64 = m * m

        for n in 1..(nmax + 1) {
            if (m - n) % 3 == 0 { continue }
            if mygcd(m, n) != 1 { continue }

            let a: i64 = mm + m * n + n * n
            if a > max_a { break }
            let b: i64 = 2 * m * n + n * n
            let c: i64 = mm - n * n

            let start_base: i64
            if a <= limit_arr[15] {
                start_base = 9
            } else { if a <= limit_arr[16] {
                start_base = 16
            } else { if a <= limit_arr[17] {
                start_base = 17
            } else {
                start_base = 18
            } } }

            # Base 18 fast path
            let s18: i64 = (a + b + c) % modM[18]
            let step18: i64
            if s18 == 0 { step18 = 1 } else { step18 = 17 }

            let p18_5: i64 = powb[18 * 8 + 5]
            let p18_6: i64 = powb[18 * 8 + 6]
            let b3_18: i64 = 5832
            let full18: i64 = full_mask[18]

            let mut L: i64 = ceil_div(p18_5, a)
            let mut R: i64 = (p18_6 - 1) / a
            let L2: i64 = ceil_div(p18_5, b)
            let R2: i64 = (p18_6 - 1) / b
            if L2 > L { L = L2 }
            if R2 < R { R = R2 }
            if L <= R {
                let L3: i64 = ceil_div(p18_5, c)
                let R3: i64 = (p18_6 - 1) / c
                if L3 > L { L = L3 }
                if R3 < R { R = R3 }
                if L <= R {
                    if L < 1 { L = 1 }
                    let mut k: i64
                    let mut A: i64
                    let mut B: i64
                    let mut C: i64
                    let incA: i64
                    let incB: i64
                    let incC: i64

                    if step18 == 1 {
                        k = L
                        A = a * k
                        B = b * k
                        C = c * k
                        incA = a
                        incB = b
                        incC = c
                    } else {
                        k = ((L + 16) / 17) * 17
                        A = a * k
                        B = b * k
                        C = c * k
                        incA = a * 17
                        incB = b * 17
                        incC = c * 17
                    }

                    while k <= R {
                        let hi_a: i64 = A / b3_18
                        let lo_a: i64 = A - hi_a * b3_18
                        let ma: i64 = g_t3[18 * MAX_B3 + hi_a]
                        if ma != -1 {
                            let ml_a: i64 = g_t3z[18 * MAX_B3 + lo_a]
                            if ml_a != -1 && (ma & ml_a) == 0 {
                                let ma2: i64 = ma | ml_a

                                let hi_b: i64 = B / b3_18
                                let lo_b: i64 = B - hi_b * b3_18
                                let mb: i64 = g_t3[18 * MAX_B3 + hi_b]
                                if mb != -1 {
                                    let ml_b: i64 = g_t3z[18 * MAX_B3 + lo_b]
                                    if ml_b != -1 && (mb & ml_b) == 0 {
                                        let mb2: i64 = mb | ml_b

                                        if (ma2 & mb2) == 0 {
                                            let hi_c: i64 = C / b3_18
                                            let lo_c: i64 = C - hi_c * b3_18
                                            let mc: i64 = g_t3[18 * MAX_B3 + hi_c]
                                            if mc != -1 {
                                                let ml_c: i64 = g_t3z[18 * MAX_B3 + lo_c]
                                                if ml_c != -1 && (mc & ml_c) == 0 {
                                                    let mc2: i64 = mc | ml_c
                                                    if (ma2 & mc2) == 0 && (mb2 & mc2) == 0 && (ma2 | mb2 | mc2) == full18 {
                                                        sums[18] = sums[18] + A
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        k = k + step18
                        A = A + incA
                        B = B + incB
                        C = C + incC
                    }
                }
            }

            # Other bases
            for base in start_base..18 {
                if a > limit_arr[base] { continue }

                let p_base: ptr<i64> = powb + base * 8
                let fm: i64 = full_mask[base]
                let M: i64 = modM[base]
                let targ: i64 = target_arr[base]

                let s: i64 = (a + b + c) % M

                let step: i64
                let residue: i64

                if base % 2 == 0 {
                    if s == 0 {
                        step = 1
                        residue = 0
                    } else {
                        let g: i64 = mygcd(s, M)
                        step = M / g
                        residue = 0
                    }
                } else {
                    if s == 0 {
                        if targ != 0 { continue }
                        step = 1
                        residue = 0
                    } else {
                        let g: i64 = mygcd(s, M)
                        if targ % g != 0 { continue }
                        step = M / g
                        let inv: i64 = egcd((s / g) % step, step)
                        residue = ((targ / g) * inv) % step
                    }
                }

                # Enumerate digit length combos
                let D: i64 = (base + 2) / 3
                for da in 1..(D + 1) {
                    for db in 1..(D + 1) {
                        let dc: i64 = base - da - db
                        if dc < 1 || dc > D { continue }

                        let mut L2: i64 = ceil_div(p_base[da - 1], a)
                        let mut R2: i64 = (p_base[da] - 1) / a
                        if L2 > R2 { continue }

                        let L2b: i64 = ceil_div(p_base[db - 1], b)
                        let R2b: i64 = (p_base[db] - 1) / b
                        if L2b > R2b { continue }
                        if L2b > L2 { L2 = L2b }
                        if R2b < R2 { R2 = R2b }
                        if L2 > R2 { continue }

                        let L3: i64 = ceil_div(p_base[dc - 1], c)
                        let R3: i64 = (p_base[dc] - 1) / c
                        if L3 > R3 { continue }
                        if L3 > L2 { L2 = L3 }
                        if R3 < R2 { R2 = R3 }
                        if L2 > R2 { continue }
                        if L2 < 1 { L2 = 1 }

                        let mut k: i64
                        if step == 1 {
                            k = L2
                        } else {
                            let rem: i64 = L2 % step
                            if rem <= residue {
                                k = L2 + (residue - rem)
                            } else {
                                k = L2 + (step - (rem - residue))
                            }
                        }

                        let mut A: i64 = a * k
                        let mut B: i64 = b * k
                        let mut C: i64 = c * k
                        let incA: i64 = a * step
                        let incB: i64 = b * step
                        let incC: i64 = c * step

                        while k <= R2 {
                            let ma: i64 = mask_fixed_len(A, da, base)
                            if ma != -1 {
                                let mb: i64 = mask_fixed_len(B, db, base)
                                if mb != -1 && (ma & mb) == 0 {
                                    let mc: i64 = mask_fixed_len(C, dc, base)
                                    if mc != -1 && (ma & mc) == 0 && (mb & mc) == 0 && (ma | mb | mc) == fm {
                                        sums[base] = sums[base] + A
                                    }
                                }
                            }

                            k = k + step
                            A = A + incA
                            B = B + incB
                            C = C + incC
                        }
                    }
                }
            }
        }
    }

    let mut ans: i64 = 0
    for base in 9..MAX_BASE {
        ans = ans + sums[base]
    }

    printf("%lld\n", ans)

    free(sums)
    free(target_arr)
    free(modM)
    free(full_mask)
    free(powb)
    free(limit_arr)
    free(g_t3z)
    free(g_t3)
    free(g_t2)
    free(g_t1)
    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 mygcd_i64_i64(int64_t a, int64_t b);
int64_t egcd_i64_i64(int64_t a, int64_t b);
int64_t ceil_div_i64_i64(int64_t a, int64_t b);
void init_tables(void);
int64_t mask_fixed_len_i64_i64_i64(int64_t x, int64_t d, int64_t base);
int32_t main(void);

static const int64_t MAX_BASE = 19;
static const int64_t MAX_B3 = 5833;

/* Module statics */
static int64_t* g_t1 = NULL;
static int64_t* g_t2 = NULL;
static int64_t* g_t3 = NULL;
static int64_t* g_t3z = NULL;

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 mygcd_i64_i64(int64_t a, int64_t b) {
    int64_t x = a;
    int64_t y = b;
    while (y > 0) {
        int64_t t = FLOW_CHECKED_MOD((x), (y));
        x = y;
        y = t;
    }
    return x;
}

int64_t egcd_i64_i64(int64_t a, int64_t b) {
    int64_t x0 = 1;
    int64_t x1 = 0;
    int64_t aa = a;
    int64_t bb = b;
    while (bb > 0) {
        int64_t q = FLOW_CHECKED_DIV((aa), (bb));
        int64_t t = (aa - (q * bb));
        aa = bb;
        bb = t;
        int64_t t2 = (x0 - (q * x1));
        x0 = x1;
        x1 = t2;
    }
    int64_t r = FLOW_CHECKED_MOD((x0), (b));
    if (r < 0) {
        r = (r + b);
    }
    return r;
}

int64_t ceil_div_i64_i64(int64_t a, int64_t b) {
    return FLOW_CHECKED_DIV((((a + b) - 1)), (b));
}

void init_tables(void) {
    g_t1 = calloc((MAX_BASE * MAX_BASE), 8);
    g_t2 = calloc(((MAX_BASE * MAX_BASE) * MAX_BASE), 8);
    g_t3 = calloc((MAX_BASE * MAX_B3), 8);
    g_t3z = calloc((MAX_BASE * MAX_B3), 8);
    int32_t __flow_step_1 = 1;
    for (int32_t base = 9; (9 <= MAX_BASE) ? base < MAX_BASE : base > MAX_BASE; base += (9 <= MAX_BASE) ? 1 : -1) {
        int64_t b2 = (base * base);
        int64_t b3 = (b2 * base);
        int32_t __flow_step_2 = 1;
        for (int32_t d = 0; (0 <= base) ? d < base : d > base; d += (0 <= base) ? 1 : -1) {
            g_t1[((base * MAX_BASE) + d)] = FLOW_CHECKED_SHL((1), (d));
        }
        int32_t __flow_step_3 = 1;
        for (int32_t v = 0; (0 <= (base * base)) ? v < (base * base) : v > (base * base); v += (0 <= (base * base)) ? 1 : -1) {
            g_t2[(((base * MAX_BASE) * MAX_BASE) + v)] = (-1);
        }
        int32_t __flow_step_4 = 1;
        for (int32_t v = base; (base <= (base * base)) ? v < (base * base) : v > (base * base); v += (base <= (base * base)) ? 1 : -1) {
            int64_t d0 = FLOW_CHECKED_DIV((v), (base));
            int64_t d1 = (v - (d0 * base));
            if (d0 != d1) {
                g_t2[(((base * MAX_BASE) * MAX_BASE) + v)] = (FLOW_CHECKED_SHL((1), (d0)) | FLOW_CHECKED_SHL((1), (d1)));
            }
        }
        int32_t __flow_step_5 = 1;
        for (int32_t v = 0; (0 <= b3) ? v < b3 : v > b3; v += (0 <= b3) ? 1 : -1) {
            g_t3[((base * MAX_B3) + v)] = (-1);
        }
        int32_t __flow_step_6 = 1;
        for (int32_t v = b2; (b2 <= b3) ? v < b3 : v > b3; v += (b2 <= b3) ? 1 : -1) {
            int64_t d0 = FLOW_CHECKED_DIV((v), (b2));
            int64_t r = (v - (d0 * b2));
            int64_t d1 = FLOW_CHECKED_DIV((r), (base));
            int64_t d2 = (r - (d1 * base));
            if (((d0 != d1 && d0 != d2) && d1 != d2)) {
                g_t3[((base * MAX_B3) + v)] = ((FLOW_CHECKED_SHL((1), (d0)) | FLOW_CHECKED_SHL((1), (d1))) | FLOW_CHECKED_SHL((1), (d2)));
            }
        }
        int32_t __flow_step_7 = 1;
        for (int32_t v = 0; (0 <= b3) ? v < b3 : v > b3; v += (0 <= b3) ? 1 : -1) {
            g_t3z[((base * MAX_B3) + v)] = (-1);
        }
        int32_t __flow_step_8 = 1;
        for (int32_t v = 0; (0 <= b3) ? v < b3 : v > b3; v += (0 <= b3) ? 1 : -1) {
            int64_t d0 = FLOW_CHECKED_DIV((v), (b2));
            int64_t r = (v - (d0 * b2));
            int64_t d1 = FLOW_CHECKED_DIV((r), (base));
            int64_t d2 = (r - (d1 * base));
            if (((d0 != d1 && d0 != d2) && d1 != d2)) {
                g_t3z[((base * MAX_B3) + v)] = ((FLOW_CHECKED_SHL((1), (d0)) | FLOW_CHECKED_SHL((1), (d1))) | FLOW_CHECKED_SHL((1), (d2)));
            }
        }
    }
}

int64_t mask_fixed_len_i64_i64_i64(int64_t x, int64_t d, int64_t base) {
    int64_t b2 = (base * base);
    int64_t b3 = (b2 * base);
    if (d == 1) {
        return g_t1[((base * MAX_BASE) + x)];
    }
    if (d == 2) {
        return g_t2[(((base * MAX_BASE) * MAX_BASE) + x)];
    }
    if (d == 3) {
        return g_t3[((base * MAX_B3) + x)];
    }
    int64_t hi = FLOW_CHECKED_DIV((x), (b3));
    int64_t lo = (x - (hi * b3));
    int64_t mh;
    int64_t ml;
    if (d == 4) {
        mh = g_t1[((base * MAX_BASE) + hi)];
        ml = g_t3z[((base * MAX_B3) + lo)];
    } else {
        if (d == 5) {
            mh = g_t2[(((base * MAX_BASE) * MAX_BASE) + hi)];
            ml = g_t3z[((base * MAX_B3) + lo)];
        } else {
            mh = g_t3[((base * MAX_B3) + hi)];
            ml = g_t3z[((base * MAX_B3) + lo)];
        }
    }
    if ((mh == (-1) || ml == (-1))) {
        return (-1);
    }
    if ((mh & ml) != 0) {
        return (-1);
    }
    return (mh | ml);
}

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