Problem 663

Segment tree with block decomposition for maximum subarray sum. S(n, 10^7) to S(n, 10^7+200000) difference, n=10000003.

Answer1884138010064752
Output1884138010064752
StatusPASS
Native helperno
Runtime450 ms
Peak memory83456 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n log n)
Space complexityO(n^2)O(n)
ApproachFlow solutionSearch with pruning or sieve
VerdictSuboptimal

Flow source

# Project Euler 663: Sums of Subarrays
# Segment tree with block decomposition for maximum subarray sum.
# S(n, 10^7) to S(n, 10^7+200000) difference, n=10000003.

import euler.nt { isqrt }

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

const NEG_INF: i64 = -1000000000000000000

function max3(a: i64, b: i64, c: i64) -> i64 {
    let mut m: i64 = a
    if b > m { m = b }
    if c > m { m = c }
    return m
}

function max2(a: i64, b: i64) -> i64 {
    if a >= b { return a }
    return b
}

function main() -> i32 {
    let n: i64 = 10000003
    let start_step: i64 = 10000000
    let end_step: i64 = 10200000
    let B: i64 = 256

    # Allocate array A
    let A: ptr<i64> = calloc(n, 8)
    if A == null { return 1 }

    # Segment tree arrays
    let m: i64 = (n + B - 1) / B
    let mut size: i64 = 1
    while size < m { size = size * 2 }

    let tree_total: ptr<i64> = calloc(2 * size, 8)
    let tree_pref: ptr<i64> = calloc(2 * size, 8)
    let tree_suff: ptr<i64> = calloc(2 * size, 8)
    let tree_best: ptr<i64> = calloc(2 * size, 8)

    # Initialize tree_pref and tree_best to NEG_INF
    for i in 0..(2 * size) {
        tree_pref[i] = NEG_INF
        tree_suff[i] = NEG_INF
        tree_best[i] = NEG_INF
    }

    # Tribonacci mod n window: u0, u1, u2 for k=2i-2, 2i-1, 2i
    let mut u0: i64 = 0
    let mut u1: i64 = 0
    let mut u2: i64 = 1 % n

    let mut ans: i64 = 0
    let mut tree_built: i64 = 0

    for i in 1..(end_step + 1) {
        let idx: i64 = u0
        let delta: i64 = (u1 << 1) - n + 1
        A[idx] = A[idx] + delta

        if i == start_step {
            # Build segment tree
            # Compute block summaries for leaves
            for b in 0..m {
                let s: i64 = b * B
                let e: i64 = n
                if s + B < e { e = s + B }
                if s >= n { e = s }

                # block_summary(A, s, e)
                let mut r: i64 = 0
                let mut max_pref: i64 = NEG_INF
                let mut min_pref_best: i64 = 0
                let mut best: i64 = NEG_INF
                let mut min_pref_suff: i64 = 0
                let last: i64 = e - 1

                for k in s..e {
                    r = r + A[k]
                    if r > max_pref { max_pref = r }
                    let cand: i64 = r - min_pref_best
                    if cand > best { best = cand }
                    if r < min_pref_best { min_pref_best = r }
                    if k != last {
                        if r < min_pref_suff { min_pref_suff = r }
                    }
                }

                let total_val: i64 = r
                let max_suff: i64 = total_val - min_pref_suff

                let pos: i64 = size + b
                tree_total[pos] = total_val
                tree_pref[pos] = max_pref
                tree_suff[pos] = max_suff
                tree_best[pos] = best
            }

            # Build internal nodes
            for pos in 1..size {
                let rev_pos: i64 = size - pos
                let l: i64 = rev_pos * 2
                let r_child: i64 = l + 1

                tree_total[rev_pos] = tree_total[l] + tree_total[r_child]

                let v1p: i64 = tree_pref[l]
                let v2p: i64 = tree_total[l] + tree_pref[r_child]
                tree_pref[rev_pos] = max2(v1p, v2p)

                let v1s: i64 = tree_suff[r_child]
                let v2s: i64 = tree_total[r_child] + tree_suff[l]
                tree_suff[rev_pos] = max2(v1s, v2s)

                tree_best[rev_pos] = max3(tree_best[l], tree_best[r_child], tree_suff[l] + tree_pref[r_child])
            }

            tree_built = 1
        } else {
            if i > start_step && tree_built == 1 {
                # Update block containing idx
                let b: i64 = idx / B
                let s: i64 = b * B
                let e: i64 = n
                if s + B < e { e = s + B }
                if s >= n { e = s }

                # Recompute block summary
                let mut r: i64 = 0
                let mut max_pref: i64 = NEG_INF
                let mut min_pref_best: i64 = 0
                let mut best: i64 = NEG_INF
                let mut min_pref_suff: i64 = 0
                let last: i64 = e - 1

                for k in s..e {
                    r = r + A[k]
                    if r > max_pref { max_pref = r }
                    let cand: i64 = r - min_pref_best
                    if cand > best { best = cand }
                    if r < min_pref_best { min_pref_best = r }
                    if k != last {
                        if r < min_pref_suff { min_pref_suff = r }
                    }
                }

                let total_val: i64 = r
                let max_suff: i64 = total_val - min_pref_suff

                let pos: i64 = size + b
                tree_total[pos] = total_val
                tree_pref[pos] = max_pref
                tree_suff[pos] = max_suff
                tree_best[pos] = best

                # Update path to root
                let mut p: i64 = pos / 2
                while p >= 1 {
                    let l: i64 = p * 2
                    let r_child: i64 = l + 1

                    tree_total[p] = tree_total[l] + tree_total[r_child]

                    let v1p: i64 = tree_pref[l]
                    let v2p: i64 = tree_total[l] + tree_pref[r_child]
                    tree_pref[p] = max2(v1p, v2p)

                    let v1s: i64 = tree_suff[r_child]
                    let v2s: i64 = tree_total[r_child] + tree_suff[l]
                    tree_suff[p] = max2(v1s, v2s)

                    tree_best[p] = max3(tree_best[l], tree_best[r_child], tree_suff[l] + tree_pref[r_child])

                    p = p / 2
                }

                # Root best is at index 1
                ans = ans + tree_best[1]
            }
        }

        # Advance tribonacci by two steps (mod n)
        let mut t3: i64 = u0 + u1 + u2
        if t3 >= n { t3 = t3 - n }
        if t3 >= n { t3 = t3 - n }
        let mut t4: i64 = u1 + u2 + t3
        if t4 >= n { t4 = t4 - n }
        if t4 >= n { t4 = t4 - n }
        u0 = u2
        u1 = t3
        u2 = t4
    }

    printf("%lld\n", ans)

    free(tree_best)
    free(tree_suff)
    free(tree_pref)
    free(tree_total)
    free(A)
    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 max3_i64_i64_i64(int64_t a, int64_t b, int64_t c);
int64_t max2_i64_i64(int64_t a, int64_t b);
int32_t main(void);

static const int64_t NEG_INF = (-1000000000000000000);

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 max3_i64_i64_i64(int64_t a, int64_t b, int64_t c) {
    int64_t m = a;
    if (b > m) {
        m = b;
    }
    if (c > m) {
        m = c;
    }
    return m;
}

int64_t max2_i64_i64(int64_t a, int64_t b) {
    if (a >= b) {
        return a;
    }
    return b;
}

int32_t main(void) {
    int64_t n = 10000003;
    int64_t start_step = 10000000;
    int64_t end_step = 10200000;
    int64_t B = 256;
    int64_t* A = (int64_t*)(calloc(n, 8));
    if (A == NULL) {
        return 1;
    }
    int64_t m = FLOW_CHECKED_DIV((((n + B) - 1)), (B));
    int64_t size = 1;
    while (size < m) {
        size = (size * 2);
    }
    int64_t* tree_total = (int64_t*)(calloc((2 * size), 8));
    int64_t* tree_pref = (int64_t*)(calloc((2 * size), 8));
    int64_t* tree_suff = (int64_t*)(calloc((2 * size), 8));
    int64_t* tree_best = (int64_t*)(calloc((2 * size), 8));
    int32_t __flow_step_1 = 1;
    for (int32_t i = 0; (0 <= (2 * size)) ? i < (2 * size) : i > (2 * size); i += (0 <= (2 * size)) ? 1 : -1) {
        tree_pref[i] = NEG_INF;
        tree_suff[i] = NEG_INF;
        tree_best[i] = NEG_INF;
    }
    int64_t u0 = 0;
    int64_t u1 = 0;
    int64_t u2 = FLOW_CHECKED_MOD((1), (n));
    int64_t ans = 0;
    int64_t tree_built = 0;
    int32_t __flow_step_2 = 1;
    for (int32_t i = 1; (1 <= (end_step + 1)) ? i < (end_step + 1) : i > (end_step + 1); i += (1 <= (end_step + 1)) ? 1 : -1) {
        int64_t idx = u0;
        int64_t delta = ((FLOW_CHECKED_SHL((u1), (1)) - n) + 1);
        A[idx] = (A[idx] + delta);
        if (i == start_step) {
            int32_t __flow_step_3 = 1;
            for (int32_t b = 0; (0 <= m) ? b < m : b > m; b += (0 <= m) ? 1 : -1) {
                int64_t s = (b * B);
                int64_t e = n;
                if ((s + B) < e) {
                    e = (s + B);
                }
                if (s >= n) {
                    e = s;
                }
                int64_t r = 0;
                int64_t max_pref = NEG_INF;
                int64_t min_pref_best = 0;
                int64_t best = NEG_INF;
                int64_t min_pref_suff = 0;
                int64_t last = (e - 1);
                int32_t __flow_step_4 = 1;
                for (int32_t k = s; (s <= e) ? k < e : k > e; k += (s <= e) ? 1 : -1) {
                    r = (r + A[k]);
                    if (r > max_pref) {
                        max_pref = r;
                    }
                    int64_t cand = (r - min_pref_best);
                    if (cand > best) {
                        best = cand;
                    }
                    if (r < min_pref_best) {
                        min_pref_best = r;
                    }
                    if (k != last) {
                        if (r < min_pref_suff) {
                            min_pref_suff = r;
                        }
                    }
                }
                int64_t total_val = r;
                int64_t max_suff = (total_val - min_pref_suff);
                int64_t pos = (size + b);
                tree_total[pos] = total_val;
                tree_pref[pos] = max_pref;
                tree_suff[pos] = max_suff;
                tree_best[pos] = best;
            }
            int32_t __flow_step_5 = 1;
            for (int32_t pos = 1; (1 <= size) ? pos < size : pos > size; pos += (1 <= size) ? 1 : -1) {
                int64_t rev_pos = (size - pos);
                int64_t l = (rev_pos * 2);
                int64_t r_child = (l + 1);
                tree_total[rev_pos] = (tree_total[l] + tree_total[r_child]);
                int64_t v1p = tree_pref[l];
                int64_t v2p = (tree_total[l] + tree_pref[r_child]);
                tree_pref[rev_pos] = max2_i64_i64(v1p, v2p);
                int64_t v1s = tree_suff[r_child];
                int64_t v2s = (tree_total[r_child] + tree_suff[l]);
                tree_suff[rev_pos] = max2_i64_i64(v1s, v2s);
                tree_best[rev_pos] = max3_i64_i64_i64(tree_best[l], tree_best[r_child], (tree_suff[l] + tree_pref[r_child]));
            }
            tree_built = 1;
        } else {
            if ((i > start_step && tree_built == 1)) {
                int64_t b = FLOW_CHECKED_DIV((idx), (B));
                int64_t s = (b * B);
                int64_t e = n;
                if ((s + B) < e) {
                    e = (s + B);
                }
                if (s >= n) {
                    e = s;
                }
                int64_t r = 0;
                int64_t max_pref = NEG_INF;
                int64_t min_pref_best = 0;
                int64_t best = NEG_INF;
                int64_t min_pref_suff = 0;
                int64_t last = (e - 1);
                int32_t __flow_step_6 = 1;
                for (int32_t k = s; (s <= e) ? k < e : k > e; k += (s <= e) ? 1 : -1) {
                    r = (r + A[k]);
                    if (r > max_pref) {
                        max_pref = r;
                    }
                    int64_t cand = (r - min_pref_best);
                    if (cand > best) {
                        best = cand;
                    }
                    if (r < min_pref_best) {
                        min_pref_best = r;
                    }
                    if (k != last) {
                        if (r < min_pref_suff) {
                            min_pref_suff = r;
                        }
                    }
                }
                int64_t total_val = r;
                int64_t max_suff = (total_val - min_pref_suff);
                int64_t pos = (size + b);
                tree_total[pos] = total_val;
                tree_pref[pos] = max_pref;
                tree_suff[pos] = max_suff;
                tree_best[pos] = best;
                int64_t p = FLOW_CHECKED_DIV((pos), (2));
                while (p >= 1) {
                    int64_t l = (p * 2);
                    int64_t r_child = (l + 1);
                    tree_total[p] = (tree_total[l] + tree_total[r_child]);
                    int64_t v1p = tree_pref[l];
                    int64_t v2p = (tree_total[l] + tree_pref[r_child]);
                    tree_pref[p] = max2_i64_i64(v1p, v2p);
                    int64_t v1s = tree_suff[r_child];
                    int64_t v2s = (tree_total[r_child] + tree_suff[l]);
                    tree_suff[p] = max2_i64_i64(v1s, v2s);
                    tree_best[p] = max3_i64_i64_i64(tree_best[l], tree_best[r_child], (tree_suff[l] + tree_pref[r_child]));
                    p = FLOW_CHECKED_DIV((p), (2));
                }
                ans = (ans + tree_best[1]);
            }
        }
        int64_t t3 = ((u0 + u1) + u2);
        if (t3 >= n) {
            t3 = (t3 - n);
        }
        if (t3 >= n) {
            t3 = (t3 - n);
        }
        int64_t t4 = ((u1 + u2) + t3);
        if (t4 >= n) {
            t4 = (t4 - n);
        }
        if (t4 >= n) {
            t4 = (t4 - n);
        }
        u0 = u2;
        u1 = t3;
        u2 = t4;
    }
    printf("%lld\n", ans);
    free(tree_best);
    free(tree_suff);
    free(tree_pref);
    free(tree_total);
    free(A);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%lld\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func @gcd(%arg0: i64, %arg1: i64) -> i64 {
    %0 = llvm.mlir.constant(1 : i64) : i64
    %1 = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %1 : i64, !llvm.ptr
    %2 = llvm.mlir.constant(1 : i64) : i64
    %3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %3 : i64, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %4 = llvm.load %3 : !llvm.ptr -> i64
    %5 = arith.constant 0 : i32
    %7 = arith.extsi %5 : i32 to i64
    %6 = arith.cmpi ne, %4, %7 : i64
    cf.cond_br %6, ^bb1, ^bb2
    ^bb1:
      %8 = llvm.load %1 : !llvm.ptr -> i64
      %9 = llvm.load %3 : !llvm.ptr -> i64
      %10 = arith.remsi %8, %9 : i64
      %11 = llvm.load %3 : !llvm.ptr -> i64
      llvm.store %11, %1 : i64, !llvm.ptr
      llvm.store %10, %3 : i64, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    %12 = llvm.load %1 : !llvm.ptr -> i64
    func.return %12 : i64
  }
  func.func @lcm(%arg0: i64, %arg1: i64) -> i64 {
    %13 = arith.constant 0 : i32
    %15 = arith.extsi %13 : i32 to i64
    %14 = arith.cmpi eq, %arg0, %15 : i64
    %16 = scf.if %14 -> (i1) {
      %17 = arith.constant true
      scf.yield %17 : i1
    } else {
      %18 = arith.constant 0 : i32
      %20 = arith.extsi %18 : i32 to i64
      %19 = arith.cmpi eq, %arg1, %20 : i64
      scf.yield %19 : i1
    }
    cf.cond_br %16, ^bb3, ^bb4
    ^bb3:
      %21 = arith.constant 0 : i32
      %22 = arith.extsi %21 : i32 to i64
      func.return %22 : i64
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %23 = func.call @gcd(%arg0, %arg1) : (i64, i64) -> i64
    %24 = arith.divsi %arg0, %23 : i64
    %25 = arith.muli %24, %arg1 : i64
    func.return %25 : i64
  }
  func.func @isqrt(%arg0: i64) -> i64 {
    %26 = arith.constant 2 : i32
    %28 = arith.extsi %26 : i32 to i64
    %27 = arith.cmpi slt, %arg0, %28 : i64
    cf.cond_br %27, ^bb6, ^bb7
    ^bb6:
      func.return %arg0 : i64
    ^bb7:
      cf.br ^bb8
    ^bb8:
    %29 = llvm.mlir.constant(1 : i64) : i64
    %30 = llvm.alloca %29 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %30 : i64, !llvm.ptr
    %31 = llvm.load %30 : !llvm.ptr -> i64
    %32 = arith.constant 1 : i32
    %34 = arith.extsi %32 : i32 to i64
    %33 = arith.addi %31, %34 : i64
    %35 = arith.constant 2 : i32
    %37 = arith.extsi %35 : i32 to i64
    %36 = arith.divsi %33, %37 : i64
    %38 = llvm.mlir.constant(1 : i64) : i64
    %39 = llvm.alloca %38 x i64 : (i64) -> !llvm.ptr
    llvm.store %36, %39 : i64, !llvm.ptr
    cf.br ^bb9
    ^bb9:
    %40 = llvm.load %39 : !llvm.ptr -> i64
    %41 = llvm.load %30 : !llvm.ptr -> i64
    %42 = arith.cmpi slt, %40, %41 : i64
    cf.cond_br %42, ^bb10, ^bb11
    ^bb10:
      %43 = llvm.load %39 : !llvm.ptr -> i64
      llvm.store %43, %30 : i64, !llvm.ptr
      %44 = llvm.load %30 : !llvm.ptr -> i64
      %45 = llvm.load %30 : !llvm.ptr -> i64
      %46 = arith.divsi %arg0, %45 : i64
      %47 = arith.addi %44, %46 : i64
      %48 = arith.constant 2 : i32
      %50 = arith.extsi %48 : i32 to i64
      %49 = arith.divsi %47, %50 : i64
      llvm.store %49, %39 : i64, !llvm.ptr
      cf.br ^bb9
    ^bb11:
    %51 = llvm.load %30 : !llvm.ptr -> i64
    func.return %51 : i64
  }
  func.func @mulmod(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %52 = arith.remsi %arg0, %arg2 : i64
    %53 = llvm.mlir.constant(1 : i64) : i64
    %54 = llvm.alloca %53 x i64 : (i64) -> !llvm.ptr
    llvm.store %52, %54 : i64, !llvm.ptr
    %55 = arith.remsi %arg1, %arg2 : i64
    %56 = llvm.mlir.constant(1 : i64) : i64
    %57 = llvm.alloca %56 x i64 : (i64) -> !llvm.ptr
    llvm.store %55, %57 : i64, !llvm.ptr
    %58 = arith.constant 0 : i32
    %59 = arith.extsi %58 : i32 to i64
    %60 = llvm.mlir.constant(1 : i64) : i64
    %61 = llvm.alloca %60 x i64 : (i64) -> !llvm.ptr
    llvm.store %59, %61 : i64, !llvm.ptr
    cf.br ^bb12
    ^bb12:
    %62 = llvm.load %57 : !llvm.ptr -> i64
    %63 = arith.constant 0 : i32
    %65 = arith.extsi %63 : i32 to i64
    %64 = arith.cmpi sgt, %62, %65 : i64
    cf.cond_br %64, ^bb13, ^bb14
    ^bb13:
      %66 = llvm.load %57 : !llvm.ptr -> i64
      %67 = arith.constant 2 : i32
      %69 = arith.extsi %67 : i32 to i64
      %68 = arith.remsi %66, %69 : i64
      %70 = arith.constant 1 : i32
      %72 = arith.extsi %70 : i32 to i64
      %71 = arith.cmpi eq, %68, %72 : i64
      cf.cond_br %71, ^bb15, ^bb16
      ^bb15:
        %73 = llvm.load %61 : !llvm.ptr -> i64
        %74 = llvm.load %54 : !llvm.ptr -> i64
        %75 = arith.addi %73, %74 : i64
        %76 = arith.remsi %75, %arg2 : i64
        llvm.store %76, %61 : i64, !llvm.ptr
        cf.br ^bb17
      ^bb16:
        cf.br ^bb17
      ^bb17:
      %77 = llvm.load %54 : !llvm.ptr -> i64
      %78 = arith.constant 2 : i32
      %80 = arith.extsi %78 : i32 to i64
      %79 = arith.muli %77, %80 : i64
      %81 = arith.remsi %79, %arg2 : i64
      llvm.store %81, %54 : i64, !llvm.ptr
      %82 = llvm.load %57 : !llvm.ptr -> i64
      %83 = arith.constant 2 : i32
      %85 = arith.extsi %83 : i32 to i64
      %84 = arith.divsi %82, %85 : i64
      llvm.store %84, %57 : i64, !llvm.ptr
      cf.br ^bb12
    ^bb14:
    %86 = llvm.load %61 : !llvm.ptr -> i64
    func.return %86 : i64
  }
  func.func @mod_pow(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %87 = arith.constant 1 : i32
    %89 = arith.extsi %87 : i32 to i64
    %88 = arith.cmpi eq, %arg2, %89 : i64
    cf.cond_br %88, ^bb18, ^bb19
    ^bb18:
      %90 = arith.constant 0 : i32
      %91 = arith.extsi %90 : i32 to i64
      func.return %91 : i64
    ^bb19:
      cf.br ^bb20
    ^bb20:
    %92 = arith.constant 1 : i32
    %93 = arith.extsi %92 : i32 to i64
    %94 = llvm.mlir.constant(1 : i64) : i64
    %95 = llvm.alloca %94 x i64 : (i64) -> !llvm.ptr
    llvm.store %93, %95 : i64, !llvm.ptr
    %96 = arith.remsi %arg0, %arg2 : i64
    %97 = llvm.mlir.constant(1 : i64) : i64
    %98 = llvm.alloca %97 x i64 : (i64) -> !llvm.ptr
    llvm.store %96, %98 : i64, !llvm.ptr
    %99 = llvm.mlir.constant(1 : i64) : i64
    %100 = llvm.alloca %99 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %100 : i64, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %101 = llvm.load %100 : !llvm.ptr -> i64
    %102 = arith.constant 0 : i32
    %104 = arith.extsi %102 : i32 to i64
    %103 = arith.cmpi sgt, %101, %104 : i64
    cf.cond_br %103, ^bb22, ^bb23
    ^bb22:
      %105 = llvm.load %100 : !llvm.ptr -> i64
      %106 = arith.constant 2 : i32
      %108 = arith.extsi %106 : i32 to i64
      %107 = arith.remsi %105, %108 : i64
      %109 = arith.constant 1 : i32
      %111 = arith.extsi %109 : i32 to i64
      %110 = arith.cmpi eq, %107, %111 : i64
      cf.cond_br %110, ^bb24, ^bb25
      ^bb24:
        %113 = llvm.load %95 : !llvm.ptr -> i64
        %114 = llvm.load %98 : !llvm.ptr -> i64
        %112 = func.call @mulmod(%113, %114, %arg2) : (i64, i64, i64) -> i64
        llvm.store %112, %95 : i64, !llvm.ptr
        cf.br ^bb26
      ^bb25:
        cf.br ^bb26
      ^bb26:
      %116 = llvm.load %98 : !llvm.ptr -> i64
      %117 = llvm.load %98 : !llvm.ptr -> i64
      %115 = func.call @mulmod(%116, %117, %arg2) : (i64, i64, i64) -> i64
      llvm.store %115, %98 : i64, !llvm.ptr
      %118 = llvm.load %100 : !llvm.ptr -> i64
      %119 = arith.constant 2 : i32
      %121 = arith.extsi %119 : i32 to i64
      %120 = arith.divsi %118, %121 : i64
      llvm.store %120, %100 : i64, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %122 = llvm.load %95 : !llvm.ptr -> i64
    func.return %122 : i64
  }
  func.func @is_prime(%arg0: i64) -> i1 {
    %123 = arith.constant 2 : i32
    %125 = arith.extsi %123 : i32 to i64
    %124 = arith.cmpi slt, %arg0, %125 : i64
    cf.cond_br %124, ^bb27, ^bb28
    ^bb27:
      %126 = arith.constant 0 : i1
      func.return %126 : i1
    ^bb28:
      cf.br ^bb29
    ^bb29:
    %127 = arith.constant 4 : i32
    %129 = arith.extsi %127 : i32 to i64
    %128 = arith.cmpi slt, %arg0, %129 : i64
    cf.cond_br %128, ^bb30, ^bb31
    ^bb30:
      %130 = arith.constant 1 : i1
      func.return %130 : i1
    ^bb31:
      cf.br ^bb32
    ^bb32:
    %131 = arith.constant 2 : i32
    %133 = arith.extsi %131 : i32 to i64
    %132 = arith.remsi %arg0, %133 : i64
    %134 = arith.constant 0 : i32
    %136 = arith.extsi %134 : i32 to i64
    %135 = arith.cmpi eq, %132, %136 : i64
    %137 = scf.if %135 -> (i1) {
      %138 = arith.constant true
      scf.yield %138 : i1
    } else {
      %139 = arith.constant 3 : i32
      %141 = arith.extsi %139 : i32 to i64
      %140 = arith.remsi %arg0, %141 : i64
      %142 = arith.constant 0 : i32
      %144 = arith.extsi %142 : i32 to i64
      %143 = arith.cmpi eq, %140, %144 : i64
      scf.yield %143 : i1
    }
    cf.cond_br %137, ^bb33, ^bb34
    ^bb33:
      %145 = arith.constant 0 : i1
      func.return %145 : i1
    ^bb34:
      cf.br ^bb35
    ^bb35:
    %146 = arith.constant 5 : i32
    %147 = arith.extsi %146 : i32 to i64
    %148 = llvm.mlir.constant(1 : i64) : i64
    %149 = llvm.alloca %148 x i64 : (i64) -> !llvm.ptr
    llvm.store %147, %149 : i64, !llvm.ptr
    cf.br ^bb36
    ^bb36:
    %150 = llvm.load %149 : !llvm.ptr -> i64
    %151 = llvm.load %149 : !llvm.ptr -> i64
    %152 = arith.muli %150, %151 : i64
    %153 = arith.cmpi sle, %152, %arg0 : i64
    cf.cond_br %153, ^bb37, ^bb38
    ^bb37:
      %154 = llvm.load %149 : !llvm.ptr -> i64
      %155 = arith.remsi %arg0, %154 : i64
      %156 = arith.constant 0 : i32
      %158 = arith.extsi %156 : i32 to i64
      %157 = arith.cmpi eq, %155, %158 : i64
      %159 = scf.if %157 -> (i1) {
        %160 = arith.constant true
        scf.yield %160 : i1
      } else {
        %161 = llvm.load %149 : !llvm.ptr -> i64
        %162 = arith.constant 2 : i32
        %164 = arith.extsi %162 : i32 to i64
        %163 = arith.addi %161, %164 : i64
        %165 = arith.remsi %arg0, %163 : i64
        %166 = arith.constant 0 : i32
        %168 = arith.extsi %166 : i32 to i64
        %167 = arith.cmpi eq, %165, %168 : i64
        scf.yield %167 : i1
      }
      cf.cond_br %159, ^bb39, ^bb40
      ^bb39:
        %169 = arith.constant 0 : i1
        func.return %169 : i1
      ^bb40:
        cf.br ^bb41
      ^bb41:
      %170 = llvm.load %149 : !llvm.ptr -> i64
      %171 = arith.constant 6 : i32
      %173 = arith.extsi %171 : i32 to i64
      %172 = arith.addi %170, %173 : i64
      llvm.store %172, %149 : i64, !llvm.ptr
      cf.br ^bb36
    ^bb38:
    %174 = arith.constant 1 : i1
    func.return %174 : i1
  }
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  // Constant: NEG_INF
  llvm.mlir.global internal constant @NEG_INF(-1000000000000000000 : i64) : i64
  func.func @max3(%arg0: i64, %arg1: i64, %arg2: 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.load %176 : !llvm.ptr -> i64
    %178 = arith.cmpi sgt, %arg1, %177 : i64
    cf.cond_br %178, ^bb42, ^bb43
    ^bb42:
      llvm.store %arg1, %176 : i64, !llvm.ptr
      cf.br ^bb44
    ^bb43:
      cf.br ^bb44
    ^bb44:
    %179 = llvm.load %176 : !llvm.ptr -> i64
    %180 = arith.cmpi sgt, %arg2, %179 : i64
    cf.cond_br %180, ^bb45, ^bb46
    ^bb45:
      llvm.store %arg2, %176 : i64, !llvm.ptr
      cf.br ^bb47
    ^bb46:
      cf.br ^bb47
    ^bb47:
    %181 = llvm.load %176 : !llvm.ptr -> i64
    func.return %181 : i64
  }
  func.func @max2(%arg0: i64, %arg1: i64) -> i64 {
    %182 = arith.cmpi sge, %arg0, %arg1 : i64
    cf.cond_br %182, ^bb48, ^bb49
    ^bb48:
      func.return %arg0 : i64
    ^bb49:
      cf.br ^bb50
    ^bb50:
    func.return %arg1 : i64
  }
  func.func @main() -> i32 {
    %183 = arith.constant 10000003 : i32
    %184 = arith.extsi %183 : i32 to i64
    %185 = arith.constant 10000000 : i32
    %186 = arith.extsi %185 : i32 to i64
    %187 = arith.constant 10200000 : i32
    %188 = arith.extsi %187 : i32 to i64
    %189 = arith.constant 256 : i32
    %190 = arith.extsi %189 : i32 to i64
    %192 = arith.constant 8 : i32
    %193 = arith.extsi %192 : i32 to i64
    %191 = func.call @calloc(%184, %193) : (i64, i64) -> !llvm.ptr
    %194 = llvm.mlir.zero : !llvm.ptr
    %195 = llvm.icmp "eq" %191, %194 : !llvm.ptr
    cf.cond_br %195, ^bb51, ^bb52
    ^bb51:
      %196 = arith.constant 1 : i32
      func.return %196 : i32
    ^bb52:
      cf.br ^bb53
    ^bb53:
    %197 = arith.addi %184, %190 : i64
    %198 = arith.constant 1 : i32
    %200 = arith.extsi %198 : i32 to i64
    %199 = arith.subi %197, %200 : i64
    %201 = arith.divsi %199, %190 : i64
    %202 = arith.constant 1 : i32
    %203 = arith.extsi %202 : i32 to i64
    %204 = llvm.mlir.constant(1 : i64) : i64
    %205 = llvm.alloca %204 x i64 : (i64) -> !llvm.ptr
    llvm.store %203, %205 : i64, !llvm.ptr
    cf.br ^bb54
    ^bb54:
    %206 = llvm.load %205 : !llvm.ptr -> i64
    %207 = arith.cmpi slt, %206, %201 : i64
    cf.cond_br %207, ^bb55, ^bb56
    ^bb55:
      %208 = llvm.load %205 : !llvm.ptr -> i64
      %209 = arith.constant 2 : i32
      %211 = arith.extsi %209 : i32 to i64
      %210 = arith.muli %208, %211 : i64
      llvm.store %210, %205 : i64, !llvm.ptr
      cf.br ^bb54
    ^bb56:
    %213 = arith.constant 2 : i32
    %214 = llvm.load %205 : !llvm.ptr -> i64
    %216 = arith.extsi %213 : i32 to i64
    %215 = arith.muli %216, %214 : i64
    %217 = arith.constant 8 : i32
    %218 = arith.extsi %217 : i32 to i64
    %212 = func.call @calloc(%215, %218) : (i64, i64) -> !llvm.ptr
    %220 = arith.constant 2 : i32
    %221 = llvm.load %205 : !llvm.ptr -> i64
    %223 = arith.extsi %220 : i32 to i64
    %222 = arith.muli %223, %221 : i64
    %224 = arith.constant 8 : i32
    %225 = arith.extsi %224 : i32 to i64
    %219 = func.call @calloc(%222, %225) : (i64, i64) -> !llvm.ptr
    %227 = arith.constant 2 : i32
    %228 = llvm.load %205 : !llvm.ptr -> i64
    %230 = arith.extsi %227 : i32 to i64
    %229 = arith.muli %230, %228 : i64
    %231 = arith.constant 8 : i32
    %232 = arith.extsi %231 : i32 to i64
    %226 = func.call @calloc(%229, %232) : (i64, i64) -> !llvm.ptr
    %234 = arith.constant 2 : i32
    %235 = llvm.load %205 : !llvm.ptr -> i64
    %237 = arith.extsi %234 : i32 to i64
    %236 = arith.muli %237, %235 : i64
    %238 = arith.constant 8 : i32
    %239 = arith.extsi %238 : i32 to i64
    %233 = func.call @calloc(%236, %239) : (i64, i64) -> !llvm.ptr
    %240 = arith.constant 0 : i32
    %241 = arith.constant 2 : i32
    %242 = llvm.load %205 : !llvm.ptr -> i64
    %244 = arith.extsi %241 : i32 to i64
    %243 = arith.muli %244, %242 : i64
    %245 = arith.index_cast %240 : i32 to index
    %246 = arith.index_cast %243 : i32 to index
    %248 = arith.constant 1 : index
    %249 = arith.constant -1 : index
    %250 = arith.cmpi sle, %245, %246 : index
    %247 = arith.select %250, %248, %249 : index
    cf.br ^bb57(%245 : index)
    ^bb57(%251: index):
    %252 = arith.cmpi slt, %251, %246 : index
    %253 = arith.cmpi sgt, %251, %246 : index
    %254 = arith.select %250, %252, %253 : i1
    cf.cond_br %254, ^bb58(%251 : index), ^bb59(%251 : index)
    ^bb58(%255: index):
      %256 = llvm.mlir.addressof @NEG_INF : !llvm.ptr
      %257 = llvm.load %256 : !llvm.ptr -> i64
      %258 = arith.index_cast %255 : index to i64
      %259 = llvm.getelementptr %219[%258] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %257, %259 : i64, !llvm.ptr
      %260 = llvm.mlir.addressof @NEG_INF : !llvm.ptr
      %261 = llvm.load %260 : !llvm.ptr -> i64
      %262 = arith.index_cast %255 : index to i64
      %263 = llvm.getelementptr %226[%262] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %261, %263 : i64, !llvm.ptr
      %264 = llvm.mlir.addressof @NEG_INF : !llvm.ptr
      %265 = llvm.load %264 : !llvm.ptr -> i64
      %266 = arith.index_cast %255 : index to i64
      %267 = llvm.getelementptr %233[%266] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %265, %267 : i64, !llvm.ptr
      %268 = arith.addi %255, %247 : index
      cf.br ^bb57(%268 : index)
    ^bb59(%269: index):
    %270 = arith.constant 0 : i32
    %271 = arith.extsi %270 : i32 to i64
    %272 = llvm.mlir.constant(1 : i64) : i64
    %273 = llvm.alloca %272 x i64 : (i64) -> !llvm.ptr
    llvm.store %271, %273 : i64, !llvm.ptr
    %274 = arith.constant 0 : i32
    %275 = arith.extsi %274 : i32 to i64
    %276 = llvm.mlir.constant(1 : i64) : i64
    %277 = llvm.alloca %276 x i64 : (i64) -> !llvm.ptr
    llvm.store %275, %277 : i64, !llvm.ptr
    %278 = arith.constant 1 : i32
    %280 = arith.extsi %278 : i32 to i64
    %279 = arith.remsi %280, %184 : i64
    %281 = llvm.mlir.constant(1 : i64) : i64
    %282 = llvm.alloca %281 x i64 : (i64) -> !llvm.ptr
    llvm.store %279, %282 : i64, !llvm.ptr
    %283 = arith.constant 0 : i32
    %284 = arith.extsi %283 : i32 to i64
    %285 = llvm.mlir.constant(1 : i64) : i64
    %286 = llvm.alloca %285 x i64 : (i64) -> !llvm.ptr
    llvm.store %284, %286 : i64, !llvm.ptr
    %287 = arith.constant 0 : i32
    %288 = arith.extsi %287 : i32 to i64
    %289 = llvm.mlir.constant(1 : i64) : i64
    %290 = llvm.alloca %289 x i64 : (i64) -> !llvm.ptr
    llvm.store %288, %290 : i64, !llvm.ptr
    %291 = arith.constant 1 : i32
    %292 = arith.constant 1 : i32
    %294 = arith.extsi %292 : i32 to i64
    %293 = arith.addi %188, %294 : i64
    %295 = arith.index_cast %291 : i32 to index
    %296 = arith.index_cast %293 : i32 to index
    %298 = arith.constant 1 : index
    %299 = arith.constant -1 : index
    %300 = arith.cmpi sle, %295, %296 : index
    %297 = arith.select %300, %298, %299 : index
    cf.br ^bb60(%295 : index)
    ^bb60(%301: index):
    %302 = arith.cmpi slt, %301, %296 : index
    %303 = arith.cmpi sgt, %301, %296 : index
    %304 = arith.select %300, %302, %303 : i1
    cf.cond_br %304, ^bb61(%301 : index), ^bb62(%301 : index)
    ^bb61(%305: index):
      %306 = llvm.load %273 : !llvm.ptr -> i64
      %307 = llvm.load %277 : !llvm.ptr -> i64
      %308 = arith.constant 1 : i32
      %310 = arith.extsi %308 : i32 to i64
      %309 = arith.shli %307, %310 : i64
      %311 = arith.subi %309, %184 : i64
      %312 = arith.constant 1 : i32
      %314 = arith.extsi %312 : i32 to i64
      %313 = arith.addi %311, %314 : i64
      %316 = llvm.getelementptr %191[%306] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %315 = llvm.load %316 : !llvm.ptr -> i64
      %317 = arith.addi %315, %313 : i64
      %318 = llvm.getelementptr %191[%306] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %317, %318 : i64, !llvm.ptr
      %320 = arith.index_cast %305 : index to i32
      %321 = arith.trunci %186 : i64 to i32
      %319 = arith.cmpi eq, %320, %321 : i32
      cf.cond_br %319, ^bb63, ^bb64
      ^bb63:
        %322 = arith.constant 0 : i32
        %323 = arith.index_cast %322 : i32 to index
        %324 = arith.index_cast %201 : i32 to index
        %326 = arith.constant 1 : index
        %327 = arith.constant -1 : index
        %328 = arith.cmpi sle, %323, %324 : index
        %325 = arith.select %328, %326, %327 : index
        cf.br ^bb66(%323 : index)
        ^bb66(%329: index):
        %330 = arith.cmpi slt, %329, %324 : index
        %331 = arith.cmpi sgt, %329, %324 : index
        %332 = arith.select %328, %330, %331 : i1
        cf.cond_br %332, ^bb67(%329 : index), ^bb68(%329 : index)
        ^bb67(%333: index):
          %335 = arith.index_cast %333 : index to i32
          %336 = arith.trunci %190 : i64 to i32
          %334 = arith.muli %335, %336 : i32
          %337 = arith.extsi %334 : i32 to i64
          %338 = arith.addi %337, %190 : i64
          %339 = arith.cmpi slt, %338, %184 : i64
          %340 = scf.if %339 -> (i64) {
            %341 = arith.addi %337, %190 : i64
            scf.yield %341 : i64
          } else {
            scf.yield %184 : i64
          }
          %342 = arith.cmpi sge, %337, %184 : i64
          %343 = scf.if %342 -> (i64) {
            scf.yield %337 : i64
          } else {
            scf.yield %340 : i64
          }
          %344 = arith.constant 0 : i32
          %345 = arith.extsi %344 : i32 to i64
          %346 = llvm.mlir.constant(1 : i64) : i64
          %347 = llvm.alloca %346 x i64 : (i64) -> !llvm.ptr
          llvm.store %345, %347 : i64, !llvm.ptr
          %348 = llvm.mlir.addressof @NEG_INF : !llvm.ptr
          %349 = llvm.load %348 : !llvm.ptr -> i64
          %350 = llvm.mlir.constant(1 : i64) : i64
          %351 = llvm.alloca %350 x i64 : (i64) -> !llvm.ptr
          llvm.store %349, %351 : i64, !llvm.ptr
          %352 = arith.constant 0 : i32
          %353 = arith.extsi %352 : i32 to i64
          %354 = llvm.mlir.constant(1 : i64) : i64
          %355 = llvm.alloca %354 x i64 : (i64) -> !llvm.ptr
          llvm.store %353, %355 : i64, !llvm.ptr
          %356 = llvm.mlir.addressof @NEG_INF : !llvm.ptr
          %357 = llvm.load %356 : !llvm.ptr -> i64
          %358 = llvm.mlir.constant(1 : i64) : i64
          %359 = llvm.alloca %358 x i64 : (i64) -> !llvm.ptr
          llvm.store %357, %359 : i64, !llvm.ptr
          %360 = arith.constant 0 : i32
          %361 = arith.extsi %360 : i32 to i64
          %362 = llvm.mlir.constant(1 : i64) : i64
          %363 = llvm.alloca %362 x i64 : (i64) -> !llvm.ptr
          llvm.store %361, %363 : i64, !llvm.ptr
          %364 = arith.constant 1 : i32
          %366 = arith.extsi %364 : i32 to i64
          %365 = arith.subi %343, %366 : i64
          %367 = arith.index_cast %337 : i32 to index
          %368 = arith.index_cast %343 : i32 to index
          %370 = arith.constant 1 : index
          %371 = arith.constant -1 : index
          %372 = arith.cmpi sle, %367, %368 : index
          %369 = arith.select %372, %370, %371 : index
          cf.br ^bb69(%367 : index)
          ^bb69(%373: index):
          %374 = arith.cmpi slt, %373, %368 : index
          %375 = arith.cmpi sgt, %373, %368 : index
          %376 = arith.select %372, %374, %375 : i1
          cf.cond_br %376, ^bb70(%373 : index), ^bb71(%373 : index)
          ^bb70(%377: index):
            %378 = llvm.load %347 : !llvm.ptr -> i64
            %380 = arith.index_cast %377 : index to i64
            %381 = llvm.getelementptr %191[%380] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %379 = llvm.load %381 : !llvm.ptr -> i64
            %382 = arith.addi %378, %379 : i64
            llvm.store %382, %347 : i64, !llvm.ptr
            %383 = llvm.load %347 : !llvm.ptr -> i64
            %384 = llvm.load %351 : !llvm.ptr -> i64
            %385 = arith.cmpi sgt, %383, %384 : i64
            cf.cond_br %385, ^bb72, ^bb73
            ^bb72:
              %386 = llvm.load %347 : !llvm.ptr -> i64
              llvm.store %386, %351 : i64, !llvm.ptr
              cf.br ^bb74
            ^bb73:
              cf.br ^bb74
            ^bb74:
            %387 = llvm.load %347 : !llvm.ptr -> i64
            %388 = llvm.load %355 : !llvm.ptr -> i64
            %389 = arith.subi %387, %388 : i64
            %390 = llvm.load %359 : !llvm.ptr -> i64
            %391 = arith.cmpi sgt, %389, %390 : i64
            cf.cond_br %391, ^bb75, ^bb76
            ^bb75:
              llvm.store %389, %359 : i64, !llvm.ptr
              cf.br ^bb77
            ^bb76:
              cf.br ^bb77
            ^bb77:
            %392 = llvm.load %347 : !llvm.ptr -> i64
            %393 = llvm.load %355 : !llvm.ptr -> i64
            %394 = arith.cmpi slt, %392, %393 : i64
            cf.cond_br %394, ^bb78, ^bb79
            ^bb78:
              %395 = llvm.load %347 : !llvm.ptr -> i64
              llvm.store %395, %355 : i64, !llvm.ptr
              cf.br ^bb80
            ^bb79:
              cf.br ^bb80
            ^bb80:
            %397 = arith.index_cast %377 : index to i32
            %398 = arith.trunci %365 : i64 to i32
            %396 = arith.cmpi ne, %397, %398 : i32
            cf.cond_br %396, ^bb81, ^bb82
            ^bb81:
              %399 = llvm.load %347 : !llvm.ptr -> i64
              %400 = llvm.load %363 : !llvm.ptr -> i64
              %401 = arith.cmpi slt, %399, %400 : i64
              cf.cond_br %401, ^bb84, ^bb85
              ^bb84:
                %402 = llvm.load %347 : !llvm.ptr -> i64
                llvm.store %402, %363 : i64, !llvm.ptr
                cf.br ^bb86
              ^bb85:
                cf.br ^bb86
              ^bb86:
              cf.br ^bb83
            ^bb82:
              cf.br ^bb83
            ^bb83:
            %403 = arith.addi %377, %369 : index
            cf.br ^bb69(%403 : index)
          ^bb71(%404: index):
          %405 = llvm.load %347 : !llvm.ptr -> i64
          %406 = llvm.load %363 : !llvm.ptr -> i64
          %407 = arith.subi %405, %406 : i64
          %408 = llvm.load %205 : !llvm.ptr -> i64
          %410 = arith.trunci %408 : i64 to i32
          %411 = arith.index_cast %333 : index to i32
          %409 = arith.addi %410, %411 : i32
          %412 = arith.extsi %409 : i32 to i64
          %413 = llvm.getelementptr %212[%412] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %405, %413 : i64, !llvm.ptr
          %414 = llvm.load %351 : !llvm.ptr -> i64
          %415 = llvm.getelementptr %219[%412] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %414, %415 : i64, !llvm.ptr
          %416 = llvm.getelementptr %226[%412] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %407, %416 : i64, !llvm.ptr
          %417 = llvm.load %359 : !llvm.ptr -> i64
          %418 = llvm.getelementptr %233[%412] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %417, %418 : i64, !llvm.ptr
          %419 = arith.addi %333, %325 : index
          cf.br ^bb66(%419 : index)
        ^bb68(%420: index):
        %421 = arith.constant 1 : i32
        %422 = llvm.load %205 : !llvm.ptr -> i64
        %423 = arith.index_cast %421 : i32 to index
        %424 = arith.index_cast %422 : i32 to index
        %426 = arith.constant 1 : index
        %427 = arith.constant -1 : index
        %428 = arith.cmpi sle, %423, %424 : index
        %425 = arith.select %428, %426, %427 : index
        cf.br ^bb87(%423 : index)
        ^bb87(%429: index):
        %430 = arith.cmpi slt, %429, %424 : index
        %431 = arith.cmpi sgt, %429, %424 : index
        %432 = arith.select %428, %430, %431 : i1
        cf.cond_br %432, ^bb88(%429 : index), ^bb89(%429 : index)
        ^bb88(%433: index):
          %434 = llvm.load %205 : !llvm.ptr -> i64
          %436 = arith.trunci %434 : i64 to i32
          %437 = arith.index_cast %433 : index to i32
          %435 = arith.subi %436, %437 : i32
          %438 = arith.extsi %435 : i32 to i64
          %439 = arith.constant 2 : i32
          %441 = arith.extsi %439 : i32 to i64
          %440 = arith.muli %438, %441 : i64
          %442 = arith.constant 1 : i32
          %444 = arith.extsi %442 : i32 to i64
          %443 = arith.addi %440, %444 : i64
          %446 = llvm.getelementptr %212[%440] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %445 = llvm.load %446 : !llvm.ptr -> i64
          %448 = llvm.getelementptr %212[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %447 = llvm.load %448 : !llvm.ptr -> i64
          %449 = arith.addi %445, %447 : i64
          %450 = llvm.getelementptr %212[%438] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %449, %450 : i64, !llvm.ptr
          %452 = llvm.getelementptr %219[%440] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %451 = llvm.load %452 : !llvm.ptr -> i64
          %454 = llvm.getelementptr %212[%440] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %453 = llvm.load %454 : !llvm.ptr -> i64
          %456 = llvm.getelementptr %219[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %455 = llvm.load %456 : !llvm.ptr -> i64
          %457 = arith.addi %453, %455 : i64
          %458 = func.call @max2(%451, %457) : (i64, i64) -> i64
          %459 = llvm.getelementptr %219[%438] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %458, %459 : i64, !llvm.ptr
          %461 = llvm.getelementptr %226[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %460 = llvm.load %461 : !llvm.ptr -> i64
          %463 = llvm.getelementptr %212[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %462 = llvm.load %463 : !llvm.ptr -> i64
          %465 = llvm.getelementptr %226[%440] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %464 = llvm.load %465 : !llvm.ptr -> i64
          %466 = arith.addi %462, %464 : i64
          %467 = func.call @max2(%460, %466) : (i64, i64) -> i64
          %468 = llvm.getelementptr %226[%438] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %467, %468 : i64, !llvm.ptr
          %471 = llvm.getelementptr %233[%440] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %470 = llvm.load %471 : !llvm.ptr -> i64
          %473 = llvm.getelementptr %233[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %472 = llvm.load %473 : !llvm.ptr -> i64
          %475 = llvm.getelementptr %226[%440] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %474 = llvm.load %475 : !llvm.ptr -> i64
          %477 = llvm.getelementptr %219[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %476 = llvm.load %477 : !llvm.ptr -> i64
          %478 = arith.addi %474, %476 : i64
          %469 = func.call @max3(%470, %472, %478) : (i64, i64, i64) -> i64
          %479 = llvm.getelementptr %233[%438] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %469, %479 : i64, !llvm.ptr
          %480 = arith.addi %433, %425 : index
          cf.br ^bb87(%480 : index)
        ^bb89(%481: index):
        %482 = arith.constant 1 : i32
        %483 = arith.extsi %482 : i32 to i64
        llvm.store %483, %290 : i64, !llvm.ptr
        cf.br ^bb65
      ^bb64:
        %485 = arith.index_cast %305 : index to i32
        %486 = arith.trunci %186 : i64 to i32
        %484 = arith.cmpi sgt, %485, %486 : i32
        %487 = scf.if %484 -> (i1) {
          %488 = llvm.load %290 : !llvm.ptr -> i64
          %489 = arith.constant 1 : i32
          %491 = arith.extsi %489 : i32 to i64
          %490 = arith.cmpi eq, %488, %491 : i64
          scf.yield %490 : i1
        } else {
          %492 = arith.constant false
          scf.yield %492 : i1
        }
        cf.cond_br %487, ^bb90, ^bb91
        ^bb90:
          %493 = arith.divsi %306, %190 : i64
          %494 = arith.muli %493, %190 : i64
          %495 = arith.addi %494, %190 : i64
          %496 = arith.cmpi slt, %495, %184 : i64
          %497 = scf.if %496 -> (i64) {
            %498 = arith.addi %494, %190 : i64
            scf.yield %498 : i64
          } else {
            scf.yield %184 : i64
          }
          %499 = arith.cmpi sge, %494, %184 : i64
          %500 = scf.if %499 -> (i64) {
            scf.yield %494 : i64
          } else {
            scf.yield %497 : i64
          }
          %501 = arith.constant 0 : i32
          %502 = arith.extsi %501 : i32 to i64
          %503 = llvm.mlir.constant(1 : i64) : i64
          %504 = llvm.alloca %503 x i64 : (i64) -> !llvm.ptr
          llvm.store %502, %504 : i64, !llvm.ptr
          %505 = llvm.mlir.addressof @NEG_INF : !llvm.ptr
          %506 = llvm.load %505 : !llvm.ptr -> i64
          %507 = llvm.mlir.constant(1 : i64) : i64
          %508 = llvm.alloca %507 x i64 : (i64) -> !llvm.ptr
          llvm.store %506, %508 : i64, !llvm.ptr
          %509 = arith.constant 0 : i32
          %510 = arith.extsi %509 : i32 to i64
          %511 = llvm.mlir.constant(1 : i64) : i64
          %512 = llvm.alloca %511 x i64 : (i64) -> !llvm.ptr
          llvm.store %510, %512 : i64, !llvm.ptr
          %513 = llvm.mlir.addressof @NEG_INF : !llvm.ptr
          %514 = llvm.load %513 : !llvm.ptr -> i64
          %515 = llvm.mlir.constant(1 : i64) : i64
          %516 = llvm.alloca %515 x i64 : (i64) -> !llvm.ptr
          llvm.store %514, %516 : i64, !llvm.ptr
          %517 = arith.constant 0 : i32
          %518 = arith.extsi %517 : i32 to i64
          %519 = llvm.mlir.constant(1 : i64) : i64
          %520 = llvm.alloca %519 x i64 : (i64) -> !llvm.ptr
          llvm.store %518, %520 : i64, !llvm.ptr
          %521 = arith.constant 1 : i32
          %523 = arith.extsi %521 : i32 to i64
          %522 = arith.subi %500, %523 : i64
          %524 = arith.index_cast %494 : i32 to index
          %525 = arith.index_cast %500 : i32 to index
          %527 = arith.constant 1 : index
          %528 = arith.constant -1 : index
          %529 = arith.cmpi sle, %524, %525 : index
          %526 = arith.select %529, %527, %528 : index
          cf.br ^bb93(%524 : index)
          ^bb93(%530: index):
          %531 = arith.cmpi slt, %530, %525 : index
          %532 = arith.cmpi sgt, %530, %525 : index
          %533 = arith.select %529, %531, %532 : i1
          cf.cond_br %533, ^bb94(%530 : index), ^bb95(%530 : index)
          ^bb94(%534: index):
            %535 = llvm.load %504 : !llvm.ptr -> i64
            %537 = arith.index_cast %534 : index to i64
            %538 = llvm.getelementptr %191[%537] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %536 = llvm.load %538 : !llvm.ptr -> i64
            %539 = arith.addi %535, %536 : i64
            llvm.store %539, %504 : i64, !llvm.ptr
            %540 = llvm.load %504 : !llvm.ptr -> i64
            %541 = llvm.load %508 : !llvm.ptr -> i64
            %542 = arith.cmpi sgt, %540, %541 : i64
            cf.cond_br %542, ^bb96, ^bb97
            ^bb96:
              %543 = llvm.load %504 : !llvm.ptr -> i64
              llvm.store %543, %508 : i64, !llvm.ptr
              cf.br ^bb98
            ^bb97:
              cf.br ^bb98
            ^bb98:
            %544 = llvm.load %504 : !llvm.ptr -> i64
            %545 = llvm.load %512 : !llvm.ptr -> i64
            %546 = arith.subi %544, %545 : i64
            %547 = llvm.load %516 : !llvm.ptr -> i64
            %548 = arith.cmpi sgt, %546, %547 : i64
            cf.cond_br %548, ^bb99, ^bb100
            ^bb99:
              llvm.store %546, %516 : i64, !llvm.ptr
              cf.br ^bb101
            ^bb100:
              cf.br ^bb101
            ^bb101:
            %549 = llvm.load %504 : !llvm.ptr -> i64
            %550 = llvm.load %512 : !llvm.ptr -> i64
            %551 = arith.cmpi slt, %549, %550 : i64
            cf.cond_br %551, ^bb102, ^bb103
            ^bb102:
              %552 = llvm.load %504 : !llvm.ptr -> i64
              llvm.store %552, %512 : i64, !llvm.ptr
              cf.br ^bb104
            ^bb103:
              cf.br ^bb104
            ^bb104:
            %554 = arith.index_cast %534 : index to i32
            %555 = arith.trunci %522 : i64 to i32
            %553 = arith.cmpi ne, %554, %555 : i32
            cf.cond_br %553, ^bb105, ^bb106
            ^bb105:
              %556 = llvm.load %504 : !llvm.ptr -> i64
              %557 = llvm.load %520 : !llvm.ptr -> i64
              %558 = arith.cmpi slt, %556, %557 : i64
              cf.cond_br %558, ^bb108, ^bb109
              ^bb108:
                %559 = llvm.load %504 : !llvm.ptr -> i64
                llvm.store %559, %520 : i64, !llvm.ptr
                cf.br ^bb110
              ^bb109:
                cf.br ^bb110
              ^bb110:
              cf.br ^bb107
            ^bb106:
              cf.br ^bb107
            ^bb107:
            %560 = arith.addi %534, %526 : index
            cf.br ^bb93(%560 : index)
          ^bb95(%561: index):
          %562 = llvm.load %504 : !llvm.ptr -> i64
          %563 = llvm.load %520 : !llvm.ptr -> i64
          %564 = arith.subi %562, %563 : i64
          %565 = llvm.load %205 : !llvm.ptr -> i64
          %566 = arith.addi %565, %493 : i64
          %567 = llvm.getelementptr %212[%566] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %562, %567 : i64, !llvm.ptr
          %568 = llvm.load %508 : !llvm.ptr -> i64
          %569 = llvm.getelementptr %219[%566] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %568, %569 : i64, !llvm.ptr
          %570 = llvm.getelementptr %226[%566] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %564, %570 : i64, !llvm.ptr
          %571 = llvm.load %516 : !llvm.ptr -> i64
          %572 = llvm.getelementptr %233[%566] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %571, %572 : i64, !llvm.ptr
          %573 = arith.constant 2 : i32
          %575 = arith.extsi %573 : i32 to i64
          %574 = arith.divsi %566, %575 : i64
          %576 = llvm.mlir.constant(1 : i64) : i64
          %577 = llvm.alloca %576 x i64 : (i64) -> !llvm.ptr
          llvm.store %574, %577 : i64, !llvm.ptr
          cf.br ^bb111
          ^bb111:
          %578 = llvm.load %577 : !llvm.ptr -> i64
          %579 = arith.constant 1 : i32
          %581 = arith.extsi %579 : i32 to i64
          %580 = arith.cmpi sge, %578, %581 : i64
          cf.cond_br %580, ^bb112, ^bb113
          ^bb112:
            %582 = llvm.load %577 : !llvm.ptr -> i64
            %583 = arith.constant 2 : i32
            %585 = arith.extsi %583 : i32 to i64
            %584 = arith.muli %582, %585 : i64
            %586 = arith.constant 1 : i32
            %588 = arith.extsi %586 : i32 to i64
            %587 = arith.addi %584, %588 : i64
            %590 = llvm.getelementptr %212[%584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %589 = llvm.load %590 : !llvm.ptr -> i64
            %592 = llvm.getelementptr %212[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %591 = llvm.load %592 : !llvm.ptr -> i64
            %593 = arith.addi %589, %591 : i64
            %594 = llvm.load %577 : !llvm.ptr -> i64
            %595 = llvm.getelementptr %212[%594] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %593, %595 : i64, !llvm.ptr
            %597 = llvm.getelementptr %219[%584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %596 = llvm.load %597 : !llvm.ptr -> i64
            %599 = llvm.getelementptr %212[%584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %598 = llvm.load %599 : !llvm.ptr -> i64
            %601 = llvm.getelementptr %219[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %600 = llvm.load %601 : !llvm.ptr -> i64
            %602 = arith.addi %598, %600 : i64
            %603 = func.call @max2(%596, %602) : (i64, i64) -> i64
            %604 = llvm.load %577 : !llvm.ptr -> i64
            %605 = llvm.getelementptr %219[%604] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %603, %605 : i64, !llvm.ptr
            %607 = llvm.getelementptr %226[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %606 = llvm.load %607 : !llvm.ptr -> i64
            %609 = llvm.getelementptr %212[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %608 = llvm.load %609 : !llvm.ptr -> i64
            %611 = llvm.getelementptr %226[%584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %610 = llvm.load %611 : !llvm.ptr -> i64
            %612 = arith.addi %608, %610 : i64
            %613 = func.call @max2(%606, %612) : (i64, i64) -> i64
            %614 = llvm.load %577 : !llvm.ptr -> i64
            %615 = llvm.getelementptr %226[%614] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %613, %615 : i64, !llvm.ptr
            %618 = llvm.getelementptr %233[%584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %617 = llvm.load %618 : !llvm.ptr -> i64
            %620 = llvm.getelementptr %233[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %619 = llvm.load %620 : !llvm.ptr -> i64
            %622 = llvm.getelementptr %226[%584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %621 = llvm.load %622 : !llvm.ptr -> i64
            %624 = llvm.getelementptr %219[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %623 = llvm.load %624 : !llvm.ptr -> i64
            %625 = arith.addi %621, %623 : i64
            %616 = func.call @max3(%617, %619, %625) : (i64, i64, i64) -> i64
            %626 = llvm.load %577 : !llvm.ptr -> i64
            %627 = llvm.getelementptr %233[%626] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %616, %627 : i64, !llvm.ptr
            %628 = llvm.load %577 : !llvm.ptr -> i64
            %629 = arith.constant 2 : i32
            %631 = arith.extsi %629 : i32 to i64
            %630 = arith.divsi %628, %631 : i64
            llvm.store %630, %577 : i64, !llvm.ptr
            cf.br ^bb111
          ^bb113:
          %632 = llvm.load %286 : !llvm.ptr -> i64
          %634 = arith.constant 1 : i32
          %635 = arith.extsi %634 : i32 to i64
          %636 = llvm.getelementptr %233[%635] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %633 = llvm.load %636 : !llvm.ptr -> i64
          %637 = arith.addi %632, %633 : i64
          llvm.store %637, %286 : i64, !llvm.ptr
          cf.br ^bb92
        ^bb91:
          cf.br ^bb92
        ^bb92:
        cf.br ^bb65
      ^bb65:
      %638 = llvm.load %273 : !llvm.ptr -> i64
      %639 = llvm.load %277 : !llvm.ptr -> i64
      %640 = arith.addi %638, %639 : i64
      %641 = llvm.load %282 : !llvm.ptr -> i64
      %642 = arith.addi %640, %641 : i64
      %643 = llvm.mlir.constant(1 : i64) : i64
      %644 = llvm.alloca %643 x i64 : (i64) -> !llvm.ptr
      llvm.store %642, %644 : i64, !llvm.ptr
      %645 = llvm.load %644 : !llvm.ptr -> i64
      %646 = arith.cmpi sge, %645, %184 : i64
      cf.cond_br %646, ^bb114, ^bb115
      ^bb114:
        %647 = llvm.load %644 : !llvm.ptr -> i64
        %648 = arith.subi %647, %184 : i64
        llvm.store %648, %644 : i64, !llvm.ptr
        cf.br ^bb116
      ^bb115:
        cf.br ^bb116
      ^bb116:
      %649 = llvm.load %644 : !llvm.ptr -> i64
      %650 = arith.cmpi sge, %649, %184 : i64
      cf.cond_br %650, ^bb117, ^bb118
      ^bb117:
        %651 = llvm.load %644 : !llvm.ptr -> i64
        %652 = arith.subi %651, %184 : i64
        llvm.store %652, %644 : i64, !llvm.ptr
        cf.br ^bb119
      ^bb118:
        cf.br ^bb119
      ^bb119:
      %653 = llvm.load %277 : !llvm.ptr -> i64
      %654 = llvm.load %282 : !llvm.ptr -> i64
      %655 = arith.addi %653, %654 : i64
      %656 = llvm.load %644 : !llvm.ptr -> i64
      %657 = arith.addi %655, %656 : i64
      %658 = llvm.mlir.constant(1 : i64) : i64
      %659 = llvm.alloca %658 x i64 : (i64) -> !llvm.ptr
      llvm.store %657, %659 : i64, !llvm.ptr
      %660 = llvm.load %659 : !llvm.ptr -> i64
      %661 = arith.cmpi sge, %660, %184 : i64
      cf.cond_br %661, ^bb120, ^bb121
      ^bb120:
        %662 = llvm.load %659 : !llvm.ptr -> i64
        %663 = arith.subi %662, %184 : i64
        llvm.store %663, %659 : i64, !llvm.ptr
        cf.br ^bb122
      ^bb121:
        cf.br ^bb122
      ^bb122:
      %664 = llvm.load %659 : !llvm.ptr -> i64
      %665 = arith.cmpi sge, %664, %184 : i64
      cf.cond_br %665, ^bb123, ^bb124
      ^bb123:
        %666 = llvm.load %659 : !llvm.ptr -> i64
        %667 = arith.subi %666, %184 : i64
        llvm.store %667, %659 : i64, !llvm.ptr
        cf.br ^bb125
      ^bb124:
        cf.br ^bb125
      ^bb125:
      %668 = llvm.load %282 : !llvm.ptr -> i64
      llvm.store %668, %273 : i64, !llvm.ptr
      %669 = llvm.load %644 : !llvm.ptr -> i64
      llvm.store %669, %277 : i64, !llvm.ptr
      %670 = llvm.load %659 : !llvm.ptr -> i64
      llvm.store %670, %282 : i64, !llvm.ptr
      %671 = arith.addi %305, %297 : index
      cf.br ^bb60(%671 : index)
    ^bb62(%672: index):
    %673 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %674 = llvm.load %286 : !llvm.ptr -> i64
    %675 = llvm.call @printf(%673, %674) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%233) : (!llvm.ptr) -> ()
    func.call @free(%226) : (!llvm.ptr) -> ()
    func.call @free(%219) : (!llvm.ptr) -> ()
    func.call @free(%212) : (!llvm.ptr) -> ()
    func.call @free(%191) : (!llvm.ptr) -> ()
    %681 = arith.constant 0 : i32
    func.return %681 : i32
  }
}