Problem 691

Uses suffix automaton (SAM) on binary string c = a XOR b where a is Thue-Morse and b is Beatty sequence.

Answer11570761
Output11570761
StatusPASS
Native helperno
Runtime300 ms
Peak memory547936 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n * k)
Space complexityO(n^2)O(n)
ApproachFlow solutionKey search and XOR decryption
VerdictUnknown

Flow source

# Project Euler 691: Long substring with many repetitions
# Uses suffix automaton (SAM) on binary string c = a XOR b
# where a is Thue-Morse and b is Beatty sequence.

import euler.nt { isqrt }

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

function popcount(x: i64) -> i64 {
    let mut v: i64 = x
    let mut c: i64 = 0
    while v > 0 {
        c = c + 1
        v = v & (v - 1)
    }
    return c
}

function main() -> i32 {
    let n: i64 = 5000000

    # Fixed-point inverse phi
    # Use shift=40 with i128 intermediate for isqrt
    let shift: i64 = 50
    let scale: i64 = 1
    for _ in 0..shift { scale = scale * 2 }
    # sqrt5_scaled = isqrt(5 * scale^2) using i128
    # 5 * 2^80 = 6656196820966400 * 10^6 ~ 6.6*10^18, fits in i64
    # Actually 5 * 2^80 = 5 * 1208925819614629174706176, way too big
    # Use i128: 5 * (2^40)^2 = 5 * 2^80
    let scale_sq: i128 = (scale as i128) * (scale as i128)
    let val5: i128 = 5 * scale_sq
    # Integer sqrt of i128 with proper upper bound
    # sqrt(val5) where val5 = 5 * 2^80, so sqrt ~ 2.24 * 2^40 ~ 2.46e12
    let mut lo: i128 = 0
    let mut hi: i128 = (scale as i128) * 3  # upper bound: sqrt(5)*scale < 3*scale
    while lo + 1 < hi {
        let mid: i128 = (lo + hi) / 2
        if mid * mid <= val5 { lo = mid } else { hi = mid }
    }
    let sqrt5_scaled: i64 = lo as i64
    let inv_phi_scaled: i64 = ((sqrt5_scaled - scale) / 2) as i64

    # SAM arrays: max 2*n + 10 states
    let max_states: i64 = 2 * n + 10
    let nxt0: ptr<i64> = calloc(max_states, 8)
    let nxt1: ptr<i64> = calloc(max_states, 8)
    let link: ptr<i64> = calloc(max_states, 8)
    let maxlen: ptr<i64> = calloc(max_states, 8)
    let occ: ptr<i64> = calloc(max_states, 8)

    # State 0 = dummy, state 1 = root
    let mut last: i64 = 1
    let mut size: i64 = 2

    let mut acc: i128 = 0
    let mut prev_floor: i64 = 0

    for i in 0..n {
        # b_i = floor((i+1)/phi) - floor(i/phi)
        acc = acc + (inv_phi_scaled as i128)
        let cur_floor: i64 = (acc >> shift) as i64
        let b: i64 = cur_floor - prev_floor
        prev_floor = cur_floor

        # a_i = parity of popcount(i)
        let a: i64 = popcount(i) & 1
        let ch: i64 = a ^ b  # c_i

        let cur: i64 = size
        size = size + 1

        maxlen[cur] = maxlen[last] + 1
        occ[cur] = 1

        let mut p: i64 = last

        if ch == 0 {
            while p != 0 && nxt0[p] == 0 {
                nxt0[p] = cur
                p = link[p]
            }
            if p == 0 {
                link[cur] = 1
            } else {
                let q: i64 = nxt0[p]
                if maxlen[p] + 1 == maxlen[q] {
                    link[cur] = q
                } else {
                    let clone: i64 = size
                    size = size + 1
                    nxt0[clone] = nxt0[q]
                    nxt1[clone] = nxt1[q]
                    link[clone] = link[q]
                    maxlen[clone] = maxlen[p] + 1
                    occ[clone] = 0

                    while p != 0 && nxt0[p] == q {
                        nxt0[p] = clone
                        p = link[p]
                    }
                    link[q] = clone
                    link[cur] = clone
                }
            }
        } else {
            while p != 0 && nxt1[p] == 0 {
                nxt1[p] = cur
                p = link[p]
            }
            if p == 0 {
                link[cur] = 1
            } else {
                let q: i64 = nxt1[p]
                if maxlen[p] + 1 == maxlen[q] {
                    link[cur] = q
                } else {
                    let clone: i64 = size
                    size = size + 1
                    nxt0[clone] = nxt0[q]
                    nxt1[clone] = nxt1[q]
                    link[clone] = link[q]
                    maxlen[clone] = maxlen[p] + 1
                    occ[clone] = 0

                    while p != 0 && nxt1[p] == q {
                        nxt1[p] = clone
                        p = link[p]
                    }
                    link[q] = clone
                    link[cur] = clone
                }
            }
        }

        last = cur
    }

    # Counting sort states by maxlen
    let cnt: ptr<i64> = calloc(n + 1, 8)
    for v in 1..size {
        cnt[maxlen[v]] = cnt[maxlen[v]] + 1
    }
    for L in 1..(n + 1) {
        cnt[L] = cnt[L] + cnt[L - 1]
    }

    let order: ptr<i64> = calloc(size, 8)
    let mut v: i64 = size - 1
    while v >= 1 {
        let L: i64 = maxlen[v]
        cnt[L] = cnt[L] - 1
        order[cnt[L]] = v
        v = v - 1
    }

    # Propagate occurrences
    let mut idx: i64 = size - 2
    while idx >= 1 {
        let st: i64 = order[idx]
        occ[link[st]] = occ[link[st]] + occ[st]
        idx = idx - 1
    }

    # best[k] = max maxlen among states with occ == k
    let best: ptr<i64> = calloc(n + 1, 8)
    for v in 1..size {
        let k: i64 = occ[v]
        let L: i64 = maxlen[v]
        if L > best[k] {
            best[k] = L
        }
    }

    # Suffix maximum: best[k] = max(best[k], best[k+1])
    let mut k: i64 = n - 1
    while k >= 1 {
        if best[k] < best[k + 1] {
            best[k] = best[k + 1]
        }
        k = k - 1
    }

    # Sum non-zero best[k]
    let mut total: i64 = 0
    for k in 1..(n + 1) {
        let val: i64 = best[k]
        if val == 0 { break }
        total = total + val
    }

    printf("%lld\n", total)

    free(best)
    free(order)
    free(cnt)
    free(occ)
    free(maxlen)
    free(link)
    free(nxt1)
    free(nxt0)
    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 popcount_i64(int64_t x);
int32_t main(void);

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 popcount_i64(int64_t x) {
    int64_t v = x;
    int64_t c = 0;
    while (v > 0) {
        c = (c + 1);
        v = (v & (v - 1));
    }
    return c;
}

int32_t main(void) {
    int64_t n = 5000000;
    int64_t shift = 50;
    int64_t scale = 1;
    int32_t __flow_step_1 = 1;
    for (int32_t _ = 0; (0 <= shift) ? _ < shift : _ > shift; _ += (0 <= shift) ? 1 : -1) {
        scale = (scale * 2);
    }
    __int128 scale_sq = (((__int128)(scale)) * ((__int128)(scale)));
    __int128 val5 = (5 * scale_sq);
    __int128 lo = 0;
    __int128 hi = (((__int128)(scale)) * 3);
    while ((lo + 1) < hi) {
        __int128 mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
        if ((mid * mid) <= val5) {
            lo = mid;
        } else {
            hi = mid;
        }
    }
    int64_t sqrt5_scaled = ((int64_t)(lo));
    int64_t inv_phi_scaled = ((int64_t)(FLOW_CHECKED_DIV(((sqrt5_scaled - scale)), (2))));
    int64_t max_states = ((2 * n) + 10);
    int64_t* nxt0 = (int64_t*)(calloc(max_states, 8));
    int64_t* nxt1 = (int64_t*)(calloc(max_states, 8));
    int64_t* link = (int64_t*)(calloc(max_states, 8));
    int64_t* maxlen = (int64_t*)(calloc(max_states, 8));
    int64_t* occ = (int64_t*)(calloc(max_states, 8));
    int64_t last = 1;
    int64_t size = 2;
    __int128 acc = 0;
    int64_t prev_floor = 0;
    int32_t __flow_step_2 = 1;
    for (int32_t i = 0; (0 <= n) ? i < n : i > n; i += (0 <= n) ? 1 : -1) {
        acc = (acc + ((__int128)(inv_phi_scaled)));
        int64_t cur_floor = ((int64_t)(FLOW_CHECKED_SHR((acc), (shift))));
        int64_t b = (cur_floor - prev_floor);
        prev_floor = cur_floor;
        int64_t a = (popcount_i64(i) & 1);
        int64_t ch = (a ^ b);
        int64_t cur = size;
        size = (size + 1);
        maxlen[cur] = (maxlen[last] + 1);
        occ[cur] = 1;
        int64_t p = last;
        if (ch == 0) {
            while ((p != 0 && nxt0[p] == 0)) {
                nxt0[p] = cur;
                p = link[p];
            }
            if (p == 0) {
                link[cur] = 1;
            } else {
                int64_t q = nxt0[p];
                if ((maxlen[p] + 1) == maxlen[q]) {
                    link[cur] = q;
                } else {
                    int64_t clone = size;
                    size = (size + 1);
                    nxt0[clone] = nxt0[q];
                    nxt1[clone] = nxt1[q];
                    link[clone] = link[q];
                    maxlen[clone] = (maxlen[p] + 1);
                    occ[clone] = 0;
                    while ((p != 0 && nxt0[p] == q)) {
                        nxt0[p] = clone;
                        p = link[p];
                    }
                    link[q] = clone;
                    link[cur] = clone;
                }
            }
        } else {
            while ((p != 0 && nxt1[p] == 0)) {
                nxt1[p] = cur;
                p = link[p];
            }
            if (p == 0) {
                link[cur] = 1;
            } else {
                int64_t q = nxt1[p];
                if ((maxlen[p] + 1) == maxlen[q]) {
                    link[cur] = q;
                } else {
                    int64_t clone = size;
                    size = (size + 1);
                    nxt0[clone] = nxt0[q];
                    nxt1[clone] = nxt1[q];
                    link[clone] = link[q];
                    maxlen[clone] = (maxlen[p] + 1);
                    occ[clone] = 0;
                    while ((p != 0 && nxt1[p] == q)) {
                        nxt1[p] = clone;
                        p = link[p];
                    }
                    link[q] = clone;
                    link[cur] = clone;
                }
            }
        }
        last = cur;
    }
    int64_t* cnt = (int64_t*)(calloc((n + 1), 8));
    int32_t __flow_step_3 = 1;
    for (int32_t v = 1; (1 <= size) ? v < size : v > size; v += (1 <= size) ? 1 : -1) {
        cnt[maxlen[v]] = (cnt[maxlen[v]] + 1);
    }
    int32_t __flow_step_4 = 1;
    for (int32_t L = 1; (1 <= (n + 1)) ? L < (n + 1) : L > (n + 1); L += (1 <= (n + 1)) ? 1 : -1) {
        cnt[L] = (cnt[L] + cnt[(L - 1)]);
    }
    int64_t* order = (int64_t*)(calloc(size, 8));
    int64_t v = (size - 1);
    while (v >= 1) {
        int64_t L = maxlen[v];
        cnt[L] = (cnt[L] - 1);
        order[cnt[L]] = v;
        v = (v - 1);
    }
    int64_t idx = (size - 2);
    while (idx >= 1) {
        int64_t st = order[idx];
        occ[link[st]] = (occ[link[st]] + occ[st]);
        idx = (idx - 1);
    }
    int64_t* best = (int64_t*)(calloc((n + 1), 8));
    int32_t __flow_step_5 = 1;
    for (int32_t v = 1; (1 <= size) ? v < size : v > size; v += (1 <= size) ? 1 : -1) {
        int64_t k = occ[v];
        int64_t L = maxlen[v];
        if (L > best[k]) {
            best[k] = L;
        }
    }
    int64_t k = (n - 1);
    while (k >= 1) {
        if (best[k] < best[(k + 1)]) {
            best[k] = best[(k + 1)];
        }
        k = (k - 1);
    }
    int64_t total = 0;
    int32_t __flow_step_6 = 1;
    for (int32_t k = 1; (1 <= (n + 1)) ? k < (n + 1) : k > (n + 1); k += (1 <= (n + 1)) ? 1 : -1) {
        int64_t val = best[k];
        if (val == 0) {
            break;
        }
        total = (total + val);
    }
    printf("%lld\n", total);
    free(best);
    free(order);
    free(cnt);
    free(occ);
    free(maxlen);
    free(link);
    free(nxt1);
    free(nxt0);
    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 @popcount(%arg0: 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 = arith.constant 0 : i32
    %178 = arith.extsi %177 : i32 to i64
    %179 = llvm.mlir.constant(1 : i64) : i64
    %180 = llvm.alloca %179 x i64 : (i64) -> !llvm.ptr
    llvm.store %178, %180 : i64, !llvm.ptr
    cf.br ^bb42
    ^bb42:
    %181 = llvm.load %176 : !llvm.ptr -> i64
    %182 = arith.constant 0 : i32
    %184 = arith.extsi %182 : i32 to i64
    %183 = arith.cmpi sgt, %181, %184 : i64
    cf.cond_br %183, ^bb43, ^bb44
    ^bb43:
      %185 = llvm.load %180 : !llvm.ptr -> i64
      %186 = arith.constant 1 : i32
      %188 = arith.extsi %186 : i32 to i64
      %187 = arith.addi %185, %188 : i64
      llvm.store %187, %180 : i64, !llvm.ptr
      %189 = llvm.load %176 : !llvm.ptr -> i64
      %190 = llvm.load %176 : !llvm.ptr -> i64
      %191 = arith.constant 1 : i32
      %193 = arith.extsi %191 : i32 to i64
      %192 = arith.subi %190, %193 : i64
      %194 = arith.andi %189, %192 : i64
      llvm.store %194, %176 : i64, !llvm.ptr
      cf.br ^bb42
    ^bb44:
    %195 = llvm.load %180 : !llvm.ptr -> i64
    func.return %195 : i64
  }
  func.func @main() -> i32 {
    %196 = arith.constant 5000000 : i32
    %197 = arith.extsi %196 : i32 to i64
    %198 = arith.constant 50 : i32
    %199 = arith.extsi %198 : i32 to i64
    %200 = arith.constant 1 : i32
    %201 = arith.extsi %200 : i32 to i64
    %202 = arith.constant 0 : i32
    %203 = arith.index_cast %202 : i32 to index
    %204 = arith.index_cast %199 : i32 to index
    %206 = arith.constant 1 : index
    %207 = arith.constant -1 : index
    %208 = arith.cmpi sle, %203, %204 : index
    %205 = arith.select %208, %206, %207 : index
    cf.br ^bb45(%203, %201 : index, i64)
    ^bb45(%209: index, %210: i64):
    %211 = arith.cmpi slt, %209, %204 : index
    %212 = arith.cmpi sgt, %209, %204 : index
    %213 = arith.select %208, %211, %212 : i1
    cf.cond_br %213, ^bb46(%209, %210 : index, i64), ^bb47(%209, %210 : index, i64)
    ^bb46(%214: index, %215: i64):
      %216 = arith.constant 2 : i32
      %218 = arith.extsi %216 : i32 to i64
      %217 = arith.muli %215, %218 : i64
      %219 = arith.addi %214, %205 : index
      cf.br ^bb45(%219, %217 : index, i64)
    ^bb47(%220: index, %221: i64):
    %222 = arith.extsi %221 : i64 to i128
    %223 = arith.extsi %221 : i64 to i128
    %225 = arith.trunci %222 : i128 to i64
    %226 = arith.trunci %223 : i128 to i64
    %224 = arith.muli %225, %226 : i64
    %227 = arith.extsi %224 : i64 to i128
    %228 = arith.constant 5 : i32
    %230 = arith.extsi %228 : i32 to i64
    %231 = arith.trunci %227 : i128 to i64
    %229 = arith.muli %230, %231 : i64
    %232 = arith.extsi %229 : i64 to i128
    %233 = arith.constant 0 : i32
    %234 = arith.extsi %233 : i32 to i128
    %235 = llvm.mlir.constant(1 : i64) : i64
    %236 = llvm.alloca %235 x i128 : (i64) -> !llvm.ptr
    llvm.store %234, %236 : i128, !llvm.ptr
    %237 = arith.extsi %221 : i64 to i128
    %238 = arith.constant 3 : i32
    %240 = arith.trunci %237 : i128 to i64
    %241 = arith.extsi %238 : i32 to i64
    %239 = arith.muli %240, %241 : i64
    %242 = arith.extsi %239 : i64 to i128
    %243 = llvm.mlir.constant(1 : i64) : i64
    %244 = llvm.alloca %243 x i128 : (i64) -> !llvm.ptr
    llvm.store %242, %244 : i128, !llvm.ptr
    cf.br ^bb48
    ^bb48:
    %245 = llvm.load %236 : !llvm.ptr -> i128
    %246 = arith.constant 1 : i32
    %248 = arith.trunci %245 : i128 to i64
    %249 = arith.extsi %246 : i32 to i64
    %247 = arith.addi %248, %249 : i64
    %250 = llvm.load %244 : !llvm.ptr -> i128
    %252 = arith.trunci %250 : i128 to i64
    %251 = arith.cmpi slt, %247, %252 : i64
    cf.cond_br %251, ^bb49, ^bb50
    ^bb49:
      %253 = llvm.load %236 : !llvm.ptr -> i128
      %254 = llvm.load %244 : !llvm.ptr -> i128
      %256 = arith.trunci %253 : i128 to i64
      %257 = arith.trunci %254 : i128 to i64
      %255 = arith.addi %256, %257 : i64
      %258 = arith.constant 2 : i32
      %260 = arith.extsi %258 : i32 to i64
      %259 = arith.divsi %255, %260 : i64
      %261 = arith.extsi %259 : i64 to i128
      %263 = arith.trunci %261 : i128 to i64
      %264 = arith.trunci %261 : i128 to i64
      %262 = arith.muli %263, %264 : i64
      %266 = arith.trunci %232 : i128 to i64
      %265 = arith.cmpi sle, %262, %266 : i64
      cf.cond_br %265, ^bb51, ^bb52
      ^bb51:
        llvm.store %261, %236 : i128, !llvm.ptr
        cf.br ^bb53
      ^bb52:
        llvm.store %261, %244 : i128, !llvm.ptr
        cf.br ^bb53
      ^bb53:
      cf.br ^bb48
    ^bb50:
    %267 = llvm.load %236 : !llvm.ptr -> i128
    %268 = arith.trunci %267 : i128 to i64
    %269 = arith.subi %268, %221 : i64
    %270 = arith.constant 2 : i32
    %272 = arith.extsi %270 : i32 to i64
    %271 = arith.divsi %269, %272 : i64
    %273 = arith.constant 2 : i32
    %275 = arith.extsi %273 : i32 to i64
    %274 = arith.muli %275, %197 : i64
    %276 = arith.constant 10 : i32
    %278 = arith.extsi %276 : i32 to i64
    %277 = arith.addi %274, %278 : i64
    %280 = arith.constant 8 : i32
    %281 = arith.extsi %280 : i32 to i64
    %279 = func.call @calloc(%277, %281) : (i64, i64) -> !llvm.ptr
    %283 = arith.constant 8 : i32
    %284 = arith.extsi %283 : i32 to i64
    %282 = func.call @calloc(%277, %284) : (i64, i64) -> !llvm.ptr
    %286 = arith.constant 8 : i32
    %287 = arith.extsi %286 : i32 to i64
    %285 = func.call @calloc(%277, %287) : (i64, i64) -> !llvm.ptr
    %289 = arith.constant 8 : i32
    %290 = arith.extsi %289 : i32 to i64
    %288 = func.call @calloc(%277, %290) : (i64, i64) -> !llvm.ptr
    %292 = arith.constant 8 : i32
    %293 = arith.extsi %292 : i32 to i64
    %291 = func.call @calloc(%277, %293) : (i64, i64) -> !llvm.ptr
    %294 = arith.constant 1 : i32
    %295 = arith.extsi %294 : i32 to i64
    %296 = llvm.mlir.constant(1 : i64) : i64
    %297 = llvm.alloca %296 x i64 : (i64) -> !llvm.ptr
    llvm.store %295, %297 : i64, !llvm.ptr
    %298 = arith.constant 2 : i32
    %299 = arith.extsi %298 : i32 to i64
    %300 = llvm.mlir.constant(1 : i64) : i64
    %301 = llvm.alloca %300 x i64 : (i64) -> !llvm.ptr
    llvm.store %299, %301 : i64, !llvm.ptr
    %302 = arith.constant 0 : i32
    %303 = arith.extsi %302 : i32 to i128
    %304 = llvm.mlir.constant(1 : i64) : i64
    %305 = llvm.alloca %304 x i128 : (i64) -> !llvm.ptr
    llvm.store %303, %305 : i128, !llvm.ptr
    %306 = arith.constant 0 : i32
    %307 = arith.extsi %306 : i32 to i64
    %308 = llvm.mlir.constant(1 : i64) : i64
    %309 = llvm.alloca %308 x i64 : (i64) -> !llvm.ptr
    llvm.store %307, %309 : i64, !llvm.ptr
    %310 = arith.constant 0 : i32
    %311 = arith.index_cast %310 : i32 to index
    %312 = arith.index_cast %197 : i32 to index
    %314 = arith.constant 1 : index
    %315 = arith.constant -1 : index
    %316 = arith.cmpi sle, %311, %312 : index
    %313 = arith.select %316, %314, %315 : index
    cf.br ^bb54(%311 : index)
    ^bb54(%317: index):
    %318 = arith.cmpi slt, %317, %312 : index
    %319 = arith.cmpi sgt, %317, %312 : index
    %320 = arith.select %316, %318, %319 : i1
    cf.cond_br %320, ^bb55(%317 : index), ^bb56(%317 : index)
    ^bb55(%321: index):
      %322 = llvm.load %305 : !llvm.ptr -> i128
      %323 = arith.extsi %271 : i64 to i128
      %325 = arith.trunci %322 : i128 to i64
      %326 = arith.trunci %323 : i128 to i64
      %324 = arith.addi %325, %326 : i64
      %327 = arith.extsi %324 : i64 to i128
      llvm.store %327, %305 : i128, !llvm.ptr
      %328 = llvm.load %305 : !llvm.ptr -> i128
      %330 = arith.trunci %328 : i128 to i64
      %329 = arith.shrsi %330, %199 : i64
      %331 = llvm.load %309 : !llvm.ptr -> i64
      %332 = arith.subi %329, %331 : i64
      llvm.store %329, %309 : i64, !llvm.ptr
      %334 = arith.index_cast %321 : index to i64
      %333 = func.call @popcount(%334) : (i64) -> i64
      %335 = arith.constant 1 : i32
      %337 = arith.extsi %335 : i32 to i64
      %336 = arith.andi %333, %337 : i64
      %338 = arith.xori %336, %332 : i64
      %339 = llvm.load %301 : !llvm.ptr -> i64
      %340 = llvm.load %301 : !llvm.ptr -> i64
      %341 = arith.constant 1 : i32
      %343 = arith.extsi %341 : i32 to i64
      %342 = arith.addi %340, %343 : i64
      llvm.store %342, %301 : i64, !llvm.ptr
      %345 = llvm.load %297 : !llvm.ptr -> i64
      %346 = llvm.getelementptr %288[%345] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %344 = llvm.load %346 : !llvm.ptr -> i64
      %347 = arith.constant 1 : i32
      %349 = arith.extsi %347 : i32 to i64
      %348 = arith.addi %344, %349 : i64
      %350 = llvm.getelementptr %288[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %348, %350 : i64, !llvm.ptr
      %351 = arith.constant 1 : i32
      %352 = arith.extsi %351 : i32 to i64
      %353 = llvm.getelementptr %291[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %352, %353 : i64, !llvm.ptr
      %354 = llvm.load %297 : !llvm.ptr -> i64
      %355 = llvm.mlir.constant(1 : i64) : i64
      %356 = llvm.alloca %355 x i64 : (i64) -> !llvm.ptr
      llvm.store %354, %356 : i64, !llvm.ptr
      %357 = arith.constant 0 : i32
      %359 = arith.extsi %357 : i32 to i64
      %358 = arith.cmpi eq, %338, %359 : i64
      cf.cond_br %358, ^bb57, ^bb58
      ^bb57:
        cf.br ^bb60
        ^bb60:
        %360 = llvm.load %356 : !llvm.ptr -> i64
        %361 = arith.constant 0 : i32
        %363 = arith.extsi %361 : i32 to i64
        %362 = arith.cmpi ne, %360, %363 : i64
        %364 = scf.if %362 -> (i1) {
          %366 = llvm.load %356 : !llvm.ptr -> i64
          %367 = llvm.getelementptr %279[%366] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %365 = llvm.load %367 : !llvm.ptr -> i64
          %368 = arith.constant 0 : i32
          %370 = arith.extsi %368 : i32 to i64
          %369 = arith.cmpi eq, %365, %370 : i64
          scf.yield %369 : i1
        } else {
          %371 = arith.constant false
          scf.yield %371 : i1
        }
        cf.cond_br %364, ^bb61, ^bb62
        ^bb61:
          %372 = llvm.load %356 : !llvm.ptr -> i64
          %373 = llvm.getelementptr %279[%372] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %339, %373 : i64, !llvm.ptr
          %375 = llvm.load %356 : !llvm.ptr -> i64
          %376 = llvm.getelementptr %285[%375] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %374 = llvm.load %376 : !llvm.ptr -> i64
          llvm.store %374, %356 : i64, !llvm.ptr
          cf.br ^bb60
        ^bb62:
        %377 = llvm.load %356 : !llvm.ptr -> i64
        %378 = arith.constant 0 : i32
        %380 = arith.extsi %378 : i32 to i64
        %379 = arith.cmpi eq, %377, %380 : i64
        cf.cond_br %379, ^bb63, ^bb64
        ^bb63:
          %381 = arith.constant 1 : i32
          %382 = arith.extsi %381 : i32 to i64
          %383 = llvm.getelementptr %285[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %382, %383 : i64, !llvm.ptr
          cf.br ^bb65
        ^bb64:
          %385 = llvm.load %356 : !llvm.ptr -> i64
          %386 = llvm.getelementptr %279[%385] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %384 = llvm.load %386 : !llvm.ptr -> i64
          %388 = llvm.load %356 : !llvm.ptr -> i64
          %389 = llvm.getelementptr %288[%388] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %387 = llvm.load %389 : !llvm.ptr -> i64
          %390 = arith.constant 1 : i32
          %392 = arith.extsi %390 : i32 to i64
          %391 = arith.addi %387, %392 : i64
          %394 = llvm.getelementptr %288[%384] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %393 = llvm.load %394 : !llvm.ptr -> i64
          %395 = arith.cmpi eq, %391, %393 : i64
          cf.cond_br %395, ^bb66, ^bb67
          ^bb66:
            %396 = llvm.getelementptr %285[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %384, %396 : i64, !llvm.ptr
            cf.br ^bb68
          ^bb67:
            %397 = llvm.load %301 : !llvm.ptr -> i64
            %398 = llvm.load %301 : !llvm.ptr -> i64
            %399 = arith.constant 1 : i32
            %401 = arith.extsi %399 : i32 to i64
            %400 = arith.addi %398, %401 : i64
            llvm.store %400, %301 : i64, !llvm.ptr
            %403 = llvm.getelementptr %279[%384] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %402 = llvm.load %403 : !llvm.ptr -> i64
            %404 = llvm.getelementptr %279[%397] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %402, %404 : i64, !llvm.ptr
            %406 = llvm.getelementptr %282[%384] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %405 = llvm.load %406 : !llvm.ptr -> i64
            %407 = llvm.getelementptr %282[%397] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %405, %407 : i64, !llvm.ptr
            %409 = llvm.getelementptr %285[%384] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %408 = llvm.load %409 : !llvm.ptr -> i64
            %410 = llvm.getelementptr %285[%397] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %408, %410 : i64, !llvm.ptr
            %412 = llvm.load %356 : !llvm.ptr -> i64
            %413 = llvm.getelementptr %288[%412] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %411 = llvm.load %413 : !llvm.ptr -> i64
            %414 = arith.constant 1 : i32
            %416 = arith.extsi %414 : i32 to i64
            %415 = arith.addi %411, %416 : i64
            %417 = llvm.getelementptr %288[%397] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %415, %417 : i64, !llvm.ptr
            %418 = arith.constant 0 : i32
            %419 = arith.extsi %418 : i32 to i64
            %420 = llvm.getelementptr %291[%397] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %419, %420 : i64, !llvm.ptr
            cf.br ^bb69
            ^bb69:
            %421 = llvm.load %356 : !llvm.ptr -> i64
            %422 = arith.constant 0 : i32
            %424 = arith.extsi %422 : i32 to i64
            %423 = arith.cmpi ne, %421, %424 : i64
            %425 = scf.if %423 -> (i1) {
              %427 = llvm.load %356 : !llvm.ptr -> i64
              %428 = llvm.getelementptr %279[%427] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %426 = llvm.load %428 : !llvm.ptr -> i64
              %429 = arith.cmpi eq, %426, %384 : i64
              scf.yield %429 : i1
            } else {
              %430 = arith.constant false
              scf.yield %430 : i1
            }
            cf.cond_br %425, ^bb70, ^bb71
            ^bb70:
              %431 = llvm.load %356 : !llvm.ptr -> i64
              %432 = llvm.getelementptr %279[%431] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %397, %432 : i64, !llvm.ptr
              %434 = llvm.load %356 : !llvm.ptr -> i64
              %435 = llvm.getelementptr %285[%434] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %433 = llvm.load %435 : !llvm.ptr -> i64
              llvm.store %433, %356 : i64, !llvm.ptr
              cf.br ^bb69
            ^bb71:
            %436 = llvm.getelementptr %285[%384] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %397, %436 : i64, !llvm.ptr
            %437 = llvm.getelementptr %285[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %397, %437 : i64, !llvm.ptr
            cf.br ^bb68
          ^bb68:
          cf.br ^bb65
        ^bb65:
        cf.br ^bb59
      ^bb58:
        cf.br ^bb72
        ^bb72:
        %438 = llvm.load %356 : !llvm.ptr -> i64
        %439 = arith.constant 0 : i32
        %441 = arith.extsi %439 : i32 to i64
        %440 = arith.cmpi ne, %438, %441 : i64
        %442 = scf.if %440 -> (i1) {
          %444 = llvm.load %356 : !llvm.ptr -> i64
          %445 = llvm.getelementptr %282[%444] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %443 = llvm.load %445 : !llvm.ptr -> i64
          %446 = arith.constant 0 : i32
          %448 = arith.extsi %446 : i32 to i64
          %447 = arith.cmpi eq, %443, %448 : i64
          scf.yield %447 : i1
        } else {
          %449 = arith.constant false
          scf.yield %449 : i1
        }
        cf.cond_br %442, ^bb73, ^bb74
        ^bb73:
          %450 = llvm.load %356 : !llvm.ptr -> i64
          %451 = llvm.getelementptr %282[%450] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %339, %451 : i64, !llvm.ptr
          %453 = llvm.load %356 : !llvm.ptr -> i64
          %454 = llvm.getelementptr %285[%453] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %452 = llvm.load %454 : !llvm.ptr -> i64
          llvm.store %452, %356 : i64, !llvm.ptr
          cf.br ^bb72
        ^bb74:
        %455 = llvm.load %356 : !llvm.ptr -> i64
        %456 = arith.constant 0 : i32
        %458 = arith.extsi %456 : i32 to i64
        %457 = arith.cmpi eq, %455, %458 : i64
        cf.cond_br %457, ^bb75, ^bb76
        ^bb75:
          %459 = arith.constant 1 : i32
          %460 = arith.extsi %459 : i32 to i64
          %461 = llvm.getelementptr %285[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %460, %461 : i64, !llvm.ptr
          cf.br ^bb77
        ^bb76:
          %463 = llvm.load %356 : !llvm.ptr -> i64
          %464 = llvm.getelementptr %282[%463] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %462 = llvm.load %464 : !llvm.ptr -> i64
          %466 = llvm.load %356 : !llvm.ptr -> i64
          %467 = llvm.getelementptr %288[%466] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %465 = llvm.load %467 : !llvm.ptr -> i64
          %468 = arith.constant 1 : i32
          %470 = arith.extsi %468 : i32 to i64
          %469 = arith.addi %465, %470 : i64
          %472 = llvm.getelementptr %288[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %471 = llvm.load %472 : !llvm.ptr -> i64
          %473 = arith.cmpi eq, %469, %471 : i64
          cf.cond_br %473, ^bb78, ^bb79
          ^bb78:
            %474 = llvm.getelementptr %285[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %462, %474 : i64, !llvm.ptr
            cf.br ^bb80
          ^bb79:
            %475 = llvm.load %301 : !llvm.ptr -> i64
            %476 = llvm.load %301 : !llvm.ptr -> i64
            %477 = arith.constant 1 : i32
            %479 = arith.extsi %477 : i32 to i64
            %478 = arith.addi %476, %479 : i64
            llvm.store %478, %301 : i64, !llvm.ptr
            %481 = llvm.getelementptr %279[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %480 = llvm.load %481 : !llvm.ptr -> i64
            %482 = llvm.getelementptr %279[%475] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %480, %482 : i64, !llvm.ptr
            %484 = llvm.getelementptr %282[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %483 = llvm.load %484 : !llvm.ptr -> i64
            %485 = llvm.getelementptr %282[%475] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %483, %485 : i64, !llvm.ptr
            %487 = llvm.getelementptr %285[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %486 = llvm.load %487 : !llvm.ptr -> i64
            %488 = llvm.getelementptr %285[%475] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %486, %488 : i64, !llvm.ptr
            %490 = llvm.load %356 : !llvm.ptr -> i64
            %491 = llvm.getelementptr %288[%490] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %489 = llvm.load %491 : !llvm.ptr -> i64
            %492 = arith.constant 1 : i32
            %494 = arith.extsi %492 : i32 to i64
            %493 = arith.addi %489, %494 : i64
            %495 = llvm.getelementptr %288[%475] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %493, %495 : i64, !llvm.ptr
            %496 = arith.constant 0 : i32
            %497 = arith.extsi %496 : i32 to i64
            %498 = llvm.getelementptr %291[%475] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %497, %498 : i64, !llvm.ptr
            cf.br ^bb81
            ^bb81:
            %499 = llvm.load %356 : !llvm.ptr -> i64
            %500 = arith.constant 0 : i32
            %502 = arith.extsi %500 : i32 to i64
            %501 = arith.cmpi ne, %499, %502 : i64
            %503 = scf.if %501 -> (i1) {
              %505 = llvm.load %356 : !llvm.ptr -> i64
              %506 = llvm.getelementptr %282[%505] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %504 = llvm.load %506 : !llvm.ptr -> i64
              %507 = arith.cmpi eq, %504, %462 : i64
              scf.yield %507 : i1
            } else {
              %508 = arith.constant false
              scf.yield %508 : i1
            }
            cf.cond_br %503, ^bb82, ^bb83
            ^bb82:
              %509 = llvm.load %356 : !llvm.ptr -> i64
              %510 = llvm.getelementptr %282[%509] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %475, %510 : i64, !llvm.ptr
              %512 = llvm.load %356 : !llvm.ptr -> i64
              %513 = llvm.getelementptr %285[%512] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %511 = llvm.load %513 : !llvm.ptr -> i64
              llvm.store %511, %356 : i64, !llvm.ptr
              cf.br ^bb81
            ^bb83:
            %514 = llvm.getelementptr %285[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %475, %514 : i64, !llvm.ptr
            %515 = llvm.getelementptr %285[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %475, %515 : i64, !llvm.ptr
            cf.br ^bb80
          ^bb80:
          cf.br ^bb77
        ^bb77:
        cf.br ^bb59
      ^bb59:
      llvm.store %339, %297 : i64, !llvm.ptr
      %516 = arith.addi %321, %313 : index
      cf.br ^bb54(%516 : index)
    ^bb56(%517: index):
    %519 = arith.constant 1 : i32
    %521 = arith.extsi %519 : i32 to i64
    %520 = arith.addi %197, %521 : i64
    %522 = arith.constant 8 : i32
    %523 = arith.extsi %522 : i32 to i64
    %518 = func.call @calloc(%520, %523) : (i64, i64) -> !llvm.ptr
    %524 = arith.constant 1 : i32
    %525 = llvm.load %301 : !llvm.ptr -> i64
    %526 = arith.index_cast %524 : i32 to index
    %527 = arith.index_cast %525 : i32 to index
    %529 = arith.constant 1 : index
    %530 = arith.constant -1 : index
    %531 = arith.cmpi sle, %526, %527 : index
    %528 = arith.select %531, %529, %530 : index
    cf.br ^bb84(%526 : index)
    ^bb84(%532: index):
    %533 = arith.cmpi slt, %532, %527 : index
    %534 = arith.cmpi sgt, %532, %527 : index
    %535 = arith.select %531, %533, %534 : i1
    cf.cond_br %535, ^bb85(%532 : index), ^bb86(%532 : index)
    ^bb85(%536: index):
      %539 = arith.index_cast %536 : index to i64
      %540 = llvm.getelementptr %288[%539] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %538 = llvm.load %540 : !llvm.ptr -> i64
      %541 = llvm.getelementptr %518[%538] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %537 = llvm.load %541 : !llvm.ptr -> i64
      %542 = arith.constant 1 : i32
      %544 = arith.extsi %542 : i32 to i64
      %543 = arith.addi %537, %544 : i64
      %546 = arith.index_cast %536 : index to i64
      %547 = llvm.getelementptr %288[%546] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %545 = llvm.load %547 : !llvm.ptr -> i64
      %548 = llvm.getelementptr %518[%545] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %543, %548 : i64, !llvm.ptr
      %549 = arith.addi %536, %528 : index
      cf.br ^bb84(%549 : index)
    ^bb86(%550: index):
    %551 = arith.constant 1 : i32
    %552 = arith.constant 1 : i32
    %554 = arith.extsi %552 : i32 to i64
    %553 = arith.addi %197, %554 : i64
    %555 = arith.index_cast %551 : i32 to index
    %556 = arith.index_cast %553 : i32 to index
    %558 = arith.constant 1 : index
    %559 = arith.constant -1 : index
    %560 = arith.cmpi sle, %555, %556 : index
    %557 = arith.select %560, %558, %559 : index
    cf.br ^bb87(%555 : index)
    ^bb87(%561: index):
    %562 = arith.cmpi slt, %561, %556 : index
    %563 = arith.cmpi sgt, %561, %556 : index
    %564 = arith.select %560, %562, %563 : i1
    cf.cond_br %564, ^bb88(%561 : index), ^bb89(%561 : index)
    ^bb88(%565: index):
      %567 = arith.index_cast %565 : index to i64
      %568 = llvm.getelementptr %518[%567] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %566 = llvm.load %568 : !llvm.ptr -> i64
      %570 = arith.constant 1 : i32
      %572 = arith.index_cast %565 : index to i32
      %571 = arith.subi %572, %570 : i32
      %573 = arith.extsi %571 : i32 to i64
      %574 = llvm.getelementptr %518[%573] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %569 = llvm.load %574 : !llvm.ptr -> i64
      %575 = arith.addi %566, %569 : i64
      %576 = arith.index_cast %565 : index to i64
      %577 = llvm.getelementptr %518[%576] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %575, %577 : i64, !llvm.ptr
      %578 = arith.addi %565, %557 : index
      cf.br ^bb87(%578 : index)
    ^bb89(%579: index):
    %581 = llvm.load %301 : !llvm.ptr -> i64
    %582 = arith.constant 8 : i32
    %583 = arith.extsi %582 : i32 to i64
    %580 = func.call @calloc(%581, %583) : (i64, i64) -> !llvm.ptr
    %584 = llvm.load %301 : !llvm.ptr -> i64
    %585 = arith.constant 1 : i32
    %587 = arith.extsi %585 : i32 to i64
    %586 = arith.subi %584, %587 : i64
    %588 = llvm.mlir.constant(1 : i64) : i64
    %589 = llvm.alloca %588 x i64 : (i64) -> !llvm.ptr
    llvm.store %586, %589 : i64, !llvm.ptr
    cf.br ^bb90
    ^bb90:
    %590 = llvm.load %589 : !llvm.ptr -> i64
    %591 = arith.constant 1 : i32
    %593 = arith.extsi %591 : i32 to i64
    %592 = arith.cmpi sge, %590, %593 : i64
    cf.cond_br %592, ^bb91, ^bb92
    ^bb91:
      %595 = llvm.load %589 : !llvm.ptr -> i64
      %596 = llvm.getelementptr %288[%595] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %594 = llvm.load %596 : !llvm.ptr -> i64
      %598 = llvm.getelementptr %518[%594] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %597 = llvm.load %598 : !llvm.ptr -> i64
      %599 = arith.constant 1 : i32
      %601 = arith.extsi %599 : i32 to i64
      %600 = arith.subi %597, %601 : i64
      %602 = llvm.getelementptr %518[%594] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %600, %602 : i64, !llvm.ptr
      %603 = llvm.load %589 : !llvm.ptr -> i64
      %605 = llvm.getelementptr %518[%594] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %604 = llvm.load %605 : !llvm.ptr -> i64
      %606 = llvm.getelementptr %580[%604] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %603, %606 : i64, !llvm.ptr
      %607 = llvm.load %589 : !llvm.ptr -> i64
      %608 = arith.constant 1 : i32
      %610 = arith.extsi %608 : i32 to i64
      %609 = arith.subi %607, %610 : i64
      llvm.store %609, %589 : i64, !llvm.ptr
      cf.br ^bb90
    ^bb92:
    %611 = llvm.load %301 : !llvm.ptr -> i64
    %612 = arith.constant 2 : i32
    %614 = arith.extsi %612 : i32 to i64
    %613 = arith.subi %611, %614 : i64
    %615 = llvm.mlir.constant(1 : i64) : i64
    %616 = llvm.alloca %615 x i64 : (i64) -> !llvm.ptr
    llvm.store %613, %616 : i64, !llvm.ptr
    cf.br ^bb93
    ^bb93:
    %617 = llvm.load %616 : !llvm.ptr -> i64
    %618 = arith.constant 1 : i32
    %620 = arith.extsi %618 : i32 to i64
    %619 = arith.cmpi sge, %617, %620 : i64
    cf.cond_br %619, ^bb94, ^bb95
    ^bb94:
      %622 = llvm.load %616 : !llvm.ptr -> i64
      %623 = llvm.getelementptr %580[%622] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %621 = llvm.load %623 : !llvm.ptr -> i64
      %626 = llvm.getelementptr %285[%621] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %625 = llvm.load %626 : !llvm.ptr -> i64
      %627 = llvm.getelementptr %291[%625] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %624 = llvm.load %627 : !llvm.ptr -> i64
      %629 = llvm.getelementptr %291[%621] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %628 = llvm.load %629 : !llvm.ptr -> i64
      %630 = arith.addi %624, %628 : i64
      %632 = llvm.getelementptr %285[%621] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %631 = llvm.load %632 : !llvm.ptr -> i64
      %633 = llvm.getelementptr %291[%631] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %630, %633 : i64, !llvm.ptr
      %634 = llvm.load %616 : !llvm.ptr -> i64
      %635 = arith.constant 1 : i32
      %637 = arith.extsi %635 : i32 to i64
      %636 = arith.subi %634, %637 : i64
      llvm.store %636, %616 : i64, !llvm.ptr
      cf.br ^bb93
    ^bb95:
    %639 = arith.constant 1 : i32
    %641 = arith.extsi %639 : i32 to i64
    %640 = arith.addi %197, %641 : i64
    %642 = arith.constant 8 : i32
    %643 = arith.extsi %642 : i32 to i64
    %638 = func.call @calloc(%640, %643) : (i64, i64) -> !llvm.ptr
    %644 = arith.constant 1 : i32
    %645 = llvm.load %301 : !llvm.ptr -> i64
    %646 = arith.index_cast %644 : i32 to index
    %647 = arith.index_cast %645 : i32 to index
    %649 = arith.constant 1 : index
    %650 = arith.constant -1 : index
    %651 = arith.cmpi sle, %646, %647 : index
    %648 = arith.select %651, %649, %650 : index
    cf.br ^bb96(%646 : index)
    ^bb96(%652: index):
    %653 = arith.cmpi slt, %652, %647 : index
    %654 = arith.cmpi sgt, %652, %647 : index
    %655 = arith.select %651, %653, %654 : i1
    cf.cond_br %655, ^bb97(%652 : index), ^bb98(%652 : index)
    ^bb97(%656: index):
      %658 = arith.index_cast %656 : index to i64
      %659 = llvm.getelementptr %291[%658] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %657 = llvm.load %659 : !llvm.ptr -> i64
      %661 = arith.index_cast %656 : index to i64
      %662 = llvm.getelementptr %288[%661] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %660 = llvm.load %662 : !llvm.ptr -> i64
      %664 = llvm.getelementptr %638[%657] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %663 = llvm.load %664 : !llvm.ptr -> i64
      %665 = arith.cmpi sgt, %660, %663 : i64
      cf.cond_br %665, ^bb99, ^bb100
      ^bb99:
        %666 = llvm.getelementptr %638[%657] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %660, %666 : i64, !llvm.ptr
        cf.br ^bb101
      ^bb100:
        cf.br ^bb101
      ^bb101:
      %667 = arith.addi %656, %648 : index
      cf.br ^bb96(%667 : index)
    ^bb98(%668: index):
    %669 = arith.constant 1 : i32
    %671 = arith.extsi %669 : i32 to i64
    %670 = arith.subi %197, %671 : i64
    %672 = llvm.mlir.constant(1 : i64) : i64
    %673 = llvm.alloca %672 x i64 : (i64) -> !llvm.ptr
    llvm.store %670, %673 : i64, !llvm.ptr
    cf.br ^bb102
    ^bb102:
    %674 = llvm.load %673 : !llvm.ptr -> i64
    %675 = arith.constant 1 : i32
    %677 = arith.extsi %675 : i32 to i64
    %676 = arith.cmpi sge, %674, %677 : i64
    cf.cond_br %676, ^bb103, ^bb104
    ^bb103:
      %679 = llvm.load %673 : !llvm.ptr -> i64
      %680 = llvm.getelementptr %638[%679] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %678 = llvm.load %680 : !llvm.ptr -> i64
      %682 = llvm.load %673 : !llvm.ptr -> i64
      %683 = arith.constant 1 : i32
      %685 = arith.extsi %683 : i32 to i64
      %684 = arith.addi %682, %685 : i64
      %686 = llvm.getelementptr %638[%684] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %681 = llvm.load %686 : !llvm.ptr -> i64
      %687 = arith.cmpi slt, %678, %681 : i64
      cf.cond_br %687, ^bb105, ^bb106
      ^bb105:
        %689 = llvm.load %673 : !llvm.ptr -> i64
        %690 = arith.constant 1 : i32
        %692 = arith.extsi %690 : i32 to i64
        %691 = arith.addi %689, %692 : i64
        %693 = llvm.getelementptr %638[%691] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %688 = llvm.load %693 : !llvm.ptr -> i64
        %694 = llvm.load %673 : !llvm.ptr -> i64
        %695 = llvm.getelementptr %638[%694] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %688, %695 : i64, !llvm.ptr
        cf.br ^bb107
      ^bb106:
        cf.br ^bb107
      ^bb107:
      %696 = llvm.load %673 : !llvm.ptr -> i64
      %697 = arith.constant 1 : i32
      %699 = arith.extsi %697 : i32 to i64
      %698 = arith.subi %696, %699 : i64
      llvm.store %698, %673 : i64, !llvm.ptr
      cf.br ^bb102
    ^bb104:
    %700 = arith.constant 0 : i32
    %701 = arith.extsi %700 : i32 to i64
    %702 = llvm.mlir.constant(1 : i64) : i64
    %703 = llvm.alloca %702 x i64 : (i64) -> !llvm.ptr
    llvm.store %701, %703 : i64, !llvm.ptr
    %704 = arith.constant 1 : i32
    %705 = arith.constant 1 : i32
    %707 = arith.extsi %705 : i32 to i64
    %706 = arith.addi %197, %707 : i64
    %708 = arith.index_cast %704 : i32 to index
    %709 = arith.index_cast %706 : i32 to index
    %711 = arith.constant 1 : index
    %712 = arith.constant -1 : index
    %713 = arith.cmpi sle, %708, %709 : index
    %710 = arith.select %713, %711, %712 : index
    cf.br ^bb108(%708 : index)
    ^bb108(%714: index):
    %715 = arith.cmpi slt, %714, %709 : index
    %716 = arith.cmpi sgt, %714, %709 : index
    %717 = arith.select %713, %715, %716 : i1
    cf.cond_br %717, ^bb109(%714 : index), ^bb110(%714 : index)
    ^bb109(%718: index):
      %720 = arith.index_cast %718 : index to i64
      %721 = llvm.getelementptr %638[%720] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %719 = llvm.load %721 : !llvm.ptr -> i64
      %722 = arith.constant 0 : i32
      %724 = arith.extsi %722 : i32 to i64
      %723 = arith.cmpi eq, %719, %724 : i64
      cf.cond_br %723, ^bb111, ^bb112
      ^bb111:
        cf.br ^bb110(%718 : index)
      ^bb112:
        cf.br ^bb113
      ^bb113:
      %725 = llvm.load %703 : !llvm.ptr -> i64
      %726 = arith.addi %725, %719 : i64
      llvm.store %726, %703 : i64, !llvm.ptr
      %727 = arith.addi %718, %710 : index
      cf.br ^bb108(%727 : index)
    ^bb110(%728: index):
    %729 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %730 = llvm.load %703 : !llvm.ptr -> i64
    %731 = llvm.call @printf(%729, %730) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%638) : (!llvm.ptr) -> ()
    func.call @free(%580) : (!llvm.ptr) -> ()
    func.call @free(%518) : (!llvm.ptr) -> ()
    func.call @free(%291) : (!llvm.ptr) -> ()
    func.call @free(%288) : (!llvm.ptr) -> ()
    func.call @free(%285) : (!llvm.ptr) -> ()
    func.call @free(%282) : (!llvm.ptr) -> ()
    func.call @free(%279) : (!llvm.ptr) -> ()
    %740 = arith.constant 0 : i32
    func.return %740 : i32
  }
}