Problem 410

F(10^8,10^9)+F(10^9,10^8) lattice points on circles with integer radius constraints.

Answer799999783589946560
Output799999783589946560
StatusPASS
Native helperno
Runtime770 ms
Peak memory51520 KB
Time complexityO(n^2) (estimated)
Space complexityO(n) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n^2)
Space complexityO(n)O(n^2)
ApproachFlow solutionCombinatorial or DP counting
VerdictOptimal

Flow source

# Project Euler 410
# F(10^8,10^9)+F(10^9,10^8) lattice points on circles with integer radius constraints.

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

function main() -> i32 {
    let R1: i64 = 100000000
    let X1: i64 = 1000000000
    let R2: i64 = 1000000000
    let X2: i64 = 100000000
    let limit: i64 = R1
    if X2 < limit { limit = X2 }

    let n_odd: i64 = limit / 2 + 1
    let omega: ptr<i8> = calloc(n_odd, 1)
    if omega == null { return 1 }
    let mut p: i64 = 3
    while p <= limit {
        if omega[p >> 1] == 0 {
            let step: i64 = p << 1
            let mut m: i64 = p
            while m <= limit {
                omega[m >> 1] = (omega[m >> 1] as i64 + 1) as i8
                m = m + step
            }
        }
        p = p + 2
    }

    let B: i64 = 1024
    let num_blocks: i64 = limit / B + 1
    let even_pref: ptr<i64> = calloc(num_blocks + 1, 8)
    let odd_pref: ptr<i64> = calloc(num_blocks + 1, 8)
    if even_pref == null || odd_pref == null { return 1 }

    let mut s: i64 = 2
    while s <= limit {
        # oddpart = s / (s & -s)
        let mut ss: i64 = s
        while (ss & 1) == 0 { ss = ss >> 1 }
        even_pref[s / B + 1] = even_pref[s / B + 1] + (1 << (omega[ss >> 1] as i64))
        s = s + 2
    }
    s = 3
    while s <= limit {
        let om: i64 = omega[s >> 1] as i64
        if om > 0 {
            odd_pref[s / B + 1] = odd_pref[s / B + 1] + (1 << (om - 1))
        }
        s = s + 2
    }
    let mut i: i64 = 1
    while i <= num_blocks {
        even_pref[i] = even_pref[i] + even_pref[i - 1]
        odd_pref[i] = odd_pref[i] + odd_pref[i - 1]
        i = i + 1
    }

    # Inline F computation twice
    let mut total: i64 = 0
    let mut pass: i64 = 0
    while pass < 2 {
        let mut R: i64 = R1
        let mut X: i64 = X1
        if pass == 1 { R = R2; X = X2 }
        let M: i64 = R
        if X < M { M = X }
        let mut res: i64 = 0
        s = 1
        while s <= M {
            let T: i64 = R / s
            let D: i64 = X / s
            let mut end: i64 = M
            let a: i64 = R / T
            let b: i64 = X / D
            if a < end { end = a }
            if b < end { end = b }

            let t_even: i64 = T / 2
            let t_odd: i64 = (T + 1) / 2
            let odd_count: i64 = (D + 1) / 2
            let even_count: i64 = D / 2
            let per_a: i64 = 4 * (odd_count * t_odd + even_count * t_even)
            let per_b: i64 = 4 * T * D

            # sum_even(s,end)
            let mut se: i64 = 0
            let mut L: i64 = s
            let mut RR: i64 = end
            if (L & 1) == 1 { L = L + 1 }
            if L <= RR {
                let bL: i64 = L / B
                let bR: i64 = RR / B
                if bL == bR {
                    let mut u: i64 = L
                    while u <= RR {
                        let mut oddpart: i64 = u
                        while (oddpart & 1) == 0 { oddpart = oddpart >> 1 }
                        se = se + (1 << (omega[oddpart >> 1] as i64))
                        u = u + 2
                    }
                } else {
                    se = even_pref[bR] - even_pref[bL + 1]
                    let mut u2: i64 = L
                    let lim1: i64 = (bL + 1) * B - 1
                    while u2 <= lim1 {
                        let mut oddpart2: i64 = u2
                        while (oddpart2 & 1) == 0 { oddpart2 = oddpart2 >> 1 }
                        se = se + (1 << (omega[oddpart2 >> 1] as i64))
                        u2 = u2 + 2
                    }
                    let mut u3: i64 = bR * B
                    if (u3 & 1) == 1 { u3 = u3 + 1 }
                    while u3 <= RR {
                        let mut oddpart3: i64 = u3
                        while (oddpart3 & 1) == 0 { oddpart3 = oddpart3 >> 1 }
                        se = se + (1 << (omega[oddpart3 >> 1] as i64))
                        u3 = u3 + 2
                    }
                }
            }

            # sum_odd(s,end)
            let mut so: i64 = 0
            L = s
            RR = end
            if (L & 1) == 0 { L = L + 1 }
            if L <= RR {
                let bL2: i64 = L / B
                let bR2: i64 = RR / B
                if bL2 == bR2 {
                    let mut u4: i64 = L
                    while u4 <= RR {
                        let om4: i64 = omega[u4 >> 1] as i64
                        if om4 > 0 { so = so + (1 << (om4 - 1)) }
                        u4 = u4 + 2
                    }
                } else {
                    so = odd_pref[bR2] - odd_pref[bL2 + 1]
                    let mut u5: i64 = L
                    let lim2: i64 = (bL2 + 1) * B - 1
                    while u5 <= lim2 {
                        let om5: i64 = omega[u5 >> 1] as i64
                        if om5 > 0 { so = so + (1 << (om5 - 1)) }
                        u5 = u5 + 2
                    }
                    let mut u6: i64 = bR2 * B
                    if (u6 & 1) == 0 { u6 = u6 + 1 }
                    while u6 <= RR {
                        let om6: i64 = omega[u6 >> 1] as i64
                        if om6 > 0 { so = so + (1 << (om6 - 1)) }
                        u6 = u6 + 2
                    }
                }
            }

            res = res + per_a * se + per_b * so
            s = end + 1
        }
        res = res + 2 * R * X
        total = total + res
        pass = pass + 1
    }

    printf("%lld\n", total)
    free(odd_pref)
    free(even_pref)
    free(omega)
    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; }

int32_t main(void);



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