Problem 376

Nontransitive dice: count sets for face values 1..30.

Answer973059630185670
Output973059630185670
StatusPASS
Native helperno
Runtime40 ms
Peak memory6256 KB
Time complexityO(n^6) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^6)O(n * s)
Space complexityO(n^2)O(s)
ApproachFlow solutionDice distribution DP
VerdictUnknown

Flow source

# Project Euler 376
# Nontransitive dice: count sets for face values 1..30.

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

function main() -> i32 {
    let WIN: i64 = 20
    let WIN_SPACE: i64 = 8000
    let THRESH: i64 = 19
    let NABC: i64 = 343
    let MAX_OPT: i64 = 343
    let STATE_SPACE: i64 = NABC * WIN_SPACE

    let tr_count: ptr<i32> = calloc(NABC, 4)
    let tr_next: ptr<i32> = calloc(NABC * MAX_OPT, 4)
    let tr_na: ptr<i8> = calloc(NABC * MAX_OPT, 1)
    let tr_nb: ptr<i8> = calloc(NABC * MAX_OPT, 1)
    let tr_nc: ptr<i8> = calloc(NABC * MAX_OPT, 1)
    let tr_dba: ptr<i8> = calloc(NABC * MAX_OPT, 1)
    let tr_dcb: ptr<i8> = calloc(NABC * MAX_OPT, 1)
    let tr_dac: ptr<i8> = calloc(NABC * MAX_OPT, 1)
    if tr_count == null || tr_next == null || tr_na == null || tr_nb == null || tr_nc == null {
        return 1
    }
    if tr_dba == null || tr_dcb == null || tr_dac == null { return 1 }

    let mut a_used: i64 = 0
    while a_used <= 6 {
        let mut b_used: i64 = 0
        while b_used <= 6 {
            let mut c_used: i64 = 0
            while c_used <= 6 {
                let abc: i64 = (a_used * 7 + b_used) * 7 + c_used
                let mut cnt: i64 = 0
                let mut da: i64 = 0
                while da <= 6 - a_used {
                    let mut db: i64 = 0
                    while db <= 6 - b_used {
                        let mut dc: i64 = 0
                        while dc <= 6 - c_used {
                            let na: i64 = a_used + da
                            let nb: i64 = b_used + db
                            let nc: i64 = c_used + dc
                            let next_base: i64 = ((na * 7 + nb) * 7 + nc) * WIN_SPACE
                            let idx: i64 = abc * MAX_OPT + cnt
                            tr_next[idx] = next_base as i32
                            tr_na[idx] = na as i8
                            tr_nb[idx] = nb as i8
                            tr_nc[idx] = nc as i8
                            tr_dba[idx] = (db * a_used) as i8
                            tr_dcb[idx] = (dc * b_used) as i8
                            tr_dac[idx] = (da * c_used) as i8
                            cnt = cnt + 1
                            dc = dc + 1
                        }
                        db = db + 1
                    }
                    da = da + 1
                }
                tr_count[abc] = cnt as i32
                c_used = c_used + 1
            }
            b_used = b_used + 1
        }
        a_used = a_used + 1
    }

    let acc: ptr<i64> = calloc(STATE_SPACE, 8)
    let cur_keys: ptr<i32> = calloc(20000, 4)
    let cur_vals: ptr<i64> = calloc(20000, 8)
    let nxt_keys: ptr<i32> = calloc(20000, 4)
    if acc == null || cur_keys == null || cur_vals == null || nxt_keys == null { return 1 }

    let mut n_cur: i64 = 1
    cur_keys[0] = 0
    cur_vals[0] = 1

    let N: i64 = 30
    let mut value: i64 = 1
    while value <= N {
        let mut n_next: i64 = 0
        let mut is_last: i64 = 0
        if value == N { is_last = 1 }

        let mut si: i64 = 0
        while si < n_cur {
            let state: i64 = cur_keys[si] as i64
            let ways: i64 = cur_vals[si]
            let ac: i64 = state % WIN
            let mut tmp: i64 = state / WIN
            let cb: i64 = tmp % WIN
            tmp = tmp / WIN
            let ba: i64 = tmp % WIN
            let abc: i64 = tmp / WIN
            let opts: i64 = tr_count[abc] as i64
            let mut oi: i64 = 0
            while oi < opts {
                let idx: i64 = abc * MAX_OPT + oi
                let na: i64 = tr_na[idx] as i64
                let nb: i64 = tr_nb[idx] as i64
                let nc: i64 = tr_nc[idx] as i64
                let mut nba: i64 = ba + (tr_dba[idx] as i64)
                if nba > 19 { nba = 19 }
                let mut ncb: i64 = cb + (tr_dcb[idx] as i64)
                if ncb > 19 { ncb = 19 }
                let mut nac: i64 = ac + (tr_dac[idx] as i64)
                if nac > 19 { nac = 19 }

                let mut ok: i64 = 1
                if nba + 6 * (6 - nb) < THRESH { ok = 0 }
                if ncb + 6 * (6 - nc) < THRESH { ok = 0 }
                if nac + 6 * (6 - na) < THRESH { ok = 0 }
                if is_last == 1 {
                    if na != 6 { ok = 0 }
                    if nb != 6 { ok = 0 }
                    if nc != 6 { ok = 0 }
                }
                if ok == 1 {
                    let key: i64 = (tr_next[idx] as i64) + nba * 400 + ncb * 20 + nac
                    if acc[key] == 0 {
                        nxt_keys[n_next] = key as i32
                        n_next = n_next + 1
                    }
                    acc[key] = acc[key] + ways
                }
                oi = oi + 1
            }
            si = si + 1
        }

        let mut j: i64 = 0
        while j < n_next {
            let k: i64 = nxt_keys[j] as i64
            cur_keys[j] = k as i32
            cur_vals[j] = acc[k]
            acc[k] = 0
            j = j + 1
        }
        n_cur = n_next
        value = value + 1
    }

    let goal_abc: i64 = (6 * 7 + 6) * 7 + 6
    let goal: i64 = ((goal_abc * WIN + 19) * WIN + 19) * WIN + 19
    let mut ans: i64 = 0
    let mut gi: i64 = 0
    while gi < n_cur {
        if (cur_keys[gi] as i64) == goal {
            ans = cur_vals[gi] / 3
            break
        }
        gi = gi + 1
    }

    printf("%lld\n", ans)

    free(nxt_keys)
    free(cur_vals)
    free(cur_keys)
    free(acc)
    free(tr_dac)
    free(tr_dcb)
    free(tr_dba)
    free(tr_nc)
    free(tr_nb)
    free(tr_na)
    free(tr_next)
    free(tr_count)
    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 WIN = 20;
    int64_t WIN_SPACE = 8000;
    int64_t THRESH = 19;
    int64_t NABC = 343;
    int64_t MAX_OPT = 343;
    int64_t STATE_SPACE = (NABC * WIN_SPACE);
    int32_t* tr_count = (int32_t*)(calloc(NABC, 4));
    int32_t* tr_next = (int32_t*)(calloc((NABC * MAX_OPT), 4));
    int8_t* tr_na = (int8_t*)(calloc((NABC * MAX_OPT), 1));
    int8_t* tr_nb = (int8_t*)(calloc((NABC * MAX_OPT), 1));
    int8_t* tr_nc = (int8_t*)(calloc((NABC * MAX_OPT), 1));
    int8_t* tr_dba = (int8_t*)(calloc((NABC * MAX_OPT), 1));
    int8_t* tr_dcb = (int8_t*)(calloc((NABC * MAX_OPT), 1));
    int8_t* tr_dac = (int8_t*)(calloc((NABC * MAX_OPT), 1));
    if (((((tr_count == NULL || tr_next == NULL) || tr_na == NULL) || tr_nb == NULL) || tr_nc == NULL)) {
        return 1;
    }
    if (((tr_dba == NULL || tr_dcb == NULL) || tr_dac == NULL)) {
        return 1;
    }
    int64_t a_used = 0;
    while (a_used <= 6) {
        int64_t b_used = 0;
        while (b_used <= 6) {
            int64_t c_used = 0;
            while (c_used <= 6) {
                int64_t abc = ((((a_used * 7) + b_used) * 7) + c_used);
                int64_t cnt = 0;
                int64_t da = 0;
                while (da <= (6 - a_used)) {
                    int64_t db = 0;
                    while (db <= (6 - b_used)) {
                        int64_t dc = 0;
                        while (dc <= (6 - c_used)) {
                            int64_t na = (a_used + da);
                            int64_t nb = (b_used + db);
                            int64_t nc = (c_used + dc);
                            int64_t next_base = (((((na * 7) + nb) * 7) + nc) * WIN_SPACE);
                            int64_t idx = ((abc * MAX_OPT) + cnt);
                            tr_next[idx] = ((int32_t)(next_base));
                            tr_na[idx] = ((int8_t)(na));
                            tr_nb[idx] = ((int8_t)(nb));
                            tr_nc[idx] = ((int8_t)(nc));
                            tr_dba[idx] = ((int8_t)((db * a_used)));
                            tr_dcb[idx] = ((int8_t)((dc * b_used)));
                            tr_dac[idx] = ((int8_t)((da * c_used)));
                            cnt = (cnt + 1);
                            dc = (dc + 1);
                        }
                        db = (db + 1);
                    }
                    da = (da + 1);
                }
                tr_count[abc] = ((int32_t)(cnt));
                c_used = (c_used + 1);
            }
            b_used = (b_used + 1);
        }
        a_used = (a_used + 1);
    }
    int64_t* acc = (int64_t*)(calloc(STATE_SPACE, 8));
    int32_t* cur_keys = (int32_t*)(calloc(20000, 4));
    int64_t* cur_vals = (int64_t*)(calloc(20000, 8));
    int32_t* nxt_keys = (int32_t*)(calloc(20000, 4));
    if ((((acc == NULL || cur_keys == NULL) || cur_vals == NULL) || nxt_keys == NULL)) {
        return 1;
    }
    int64_t n_cur = 1;
    cur_keys[0] = 0;
    cur_vals[0] = 1;
    int64_t N = 30;
    int64_t value = 1;
    while (value <= N) {
        int64_t n_next = 0;
        int64_t is_last = 0;
        if (value == N) {
            is_last = 1;
        }
        int64_t si = 0;
        while (si < n_cur) {
            int64_t state = ((int64_t)(cur_keys[si]));
            int64_t ways = cur_vals[si];
            int64_t ac = FLOW_CHECKED_MOD((state), (WIN));
            int64_t tmp = FLOW_CHECKED_DIV((state), (WIN));
            int64_t cb = FLOW_CHECKED_MOD((tmp), (WIN));
            tmp = FLOW_CHECKED_DIV((tmp), (WIN));
            int64_t ba = FLOW_CHECKED_MOD((tmp), (WIN));
            int64_t abc = FLOW_CHECKED_DIV((tmp), (WIN));
            int64_t opts = ((int64_t)(tr_count[abc]));
            int64_t oi = 0;
            while (oi < opts) {
                int64_t idx = ((abc * MAX_OPT) + oi);
                int64_t na = ((int64_t)(tr_na[idx]));
                int64_t nb = ((int64_t)(tr_nb[idx]));
                int64_t nc = ((int64_t)(tr_nc[idx]));
                int64_t nba = (ba + ((int64_t)(tr_dba[idx])));
                if (nba > 19) {
                    nba = 19;
                }
                int64_t ncb = (cb + ((int64_t)(tr_dcb[idx])));
                if (ncb > 19) {
                    ncb = 19;
                }
                int64_t nac = (ac + ((int64_t)(tr_dac[idx])));
                if (nac > 19) {
                    nac = 19;
                }
                int64_t ok = 1;
                if ((nba + (6 * (6 - nb))) < THRESH) {
                    ok = 0;
                }
                if ((ncb + (6 * (6 - nc))) < THRESH) {
                    ok = 0;
                }
                if ((nac + (6 * (6 - na))) < THRESH) {
                    ok = 0;
                }
                if (is_last == 1) {
                    if (na != 6) {
                        ok = 0;
                    }
                    if (nb != 6) {
                        ok = 0;
                    }
                    if (nc != 6) {
                        ok = 0;
                    }
                }
                if (ok == 1) {
                    int64_t key = (((((int64_t)(tr_next[idx])) + (nba * 400)) + (ncb * 20)) + nac);
                    if (acc[key] == 0) {
                        nxt_keys[n_next] = ((int32_t)(key));
                        n_next = (n_next + 1);
                    }
                    acc[key] = (acc[key] + ways);
                }
                oi = (oi + 1);
            }
            si = (si + 1);
        }
        int64_t j = 0;
        while (j < n_next) {
            int64_t k = ((int64_t)(nxt_keys[j]));
            cur_keys[j] = ((int32_t)(k));
            cur_vals[j] = acc[k];
            acc[k] = 0;
            j = (j + 1);
        }
        n_cur = n_next;
        value = (value + 1);
    }
    int64_t goal_abc = ((((6 * 7) + 6) * 7) + 6);
    int64_t goal = ((((((goal_abc * WIN) + 19) * WIN) + 19) * WIN) + 19);
    int64_t ans = 0;
    int64_t gi = 0;
    while (gi < n_cur) {
        if (((int64_t)(cur_keys[gi])) == goal) {
            ans = FLOW_CHECKED_DIV((cur_vals[gi]), (3));
            break;
        }
        gi = (gi + 1);
    }
    printf("%lld\n", ans);
    free(nxt_keys);
    free(cur_vals);
    free(cur_keys);
    free(acc);
    free(tr_dac);
    free(tr_dcb);
    free(tr_dba);
    free(tr_nc);
    free(tr_nb);
    free(tr_na);
    free(tr_next);
    free(tr_count);
    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 20 : i32
    %1 = arith.extsi %0 : i32 to i64
    %2 = arith.constant 8000 : i32
    %3 = arith.extsi %2 : i32 to i64
    %4 = arith.constant 19 : i32
    %5 = arith.extsi %4 : i32 to i64
    %6 = arith.constant 343 : i32
    %7 = arith.extsi %6 : i32 to i64
    %8 = arith.constant 343 : i32
    %9 = arith.extsi %8 : i32 to i64
    %10 = arith.muli %7, %3 : i64
    %12 = arith.constant 4 : i32
    %13 = arith.extsi %12 : i32 to i64
    %11 = func.call @calloc(%7, %13) : (i64, i64) -> !llvm.ptr
    %15 = arith.muli %7, %9 : i64
    %16 = arith.constant 4 : i32
    %17 = arith.extsi %16 : i32 to i64
    %14 = func.call @calloc(%15, %17) : (i64, i64) -> !llvm.ptr
    %19 = arith.muli %7, %9 : i64
    %20 = arith.constant 1 : i32
    %21 = arith.extsi %20 : i32 to i64
    %18 = func.call @calloc(%19, %21) : (i64, i64) -> !llvm.ptr
    %23 = arith.muli %7, %9 : i64
    %24 = arith.constant 1 : i32
    %25 = arith.extsi %24 : i32 to i64
    %22 = func.call @calloc(%23, %25) : (i64, i64) -> !llvm.ptr
    %27 = arith.muli %7, %9 : i64
    %28 = arith.constant 1 : i32
    %29 = arith.extsi %28 : i32 to i64
    %26 = func.call @calloc(%27, %29) : (i64, i64) -> !llvm.ptr
    %31 = arith.muli %7, %9 : i64
    %32 = arith.constant 1 : i32
    %33 = arith.extsi %32 : i32 to i64
    %30 = func.call @calloc(%31, %33) : (i64, i64) -> !llvm.ptr
    %35 = arith.muli %7, %9 : i64
    %36 = arith.constant 1 : i32
    %37 = arith.extsi %36 : i32 to i64
    %34 = func.call @calloc(%35, %37) : (i64, i64) -> !llvm.ptr
    %39 = arith.muli %7, %9 : i64
    %40 = arith.constant 1 : i32
    %41 = arith.extsi %40 : i32 to i64
    %38 = func.call @calloc(%39, %41) : (i64, i64) -> !llvm.ptr
    %42 = llvm.mlir.zero : !llvm.ptr
    %43 = llvm.icmp "eq" %11, %42 : !llvm.ptr
    %44 = scf.if %43 -> (i1) {
      %45 = arith.constant true
      scf.yield %45 : i1
    } else {
      %46 = llvm.mlir.zero : !llvm.ptr
      %47 = llvm.icmp "eq" %14, %46 : !llvm.ptr
      scf.yield %47 : i1
    }
    %48 = scf.if %44 -> (i1) {
      %49 = arith.constant true
      scf.yield %49 : i1
    } else {
      %50 = llvm.mlir.zero : !llvm.ptr
      %51 = llvm.icmp "eq" %18, %50 : !llvm.ptr
      scf.yield %51 : i1
    }
    %52 = scf.if %48 -> (i1) {
      %53 = arith.constant true
      scf.yield %53 : i1
    } else {
      %54 = llvm.mlir.zero : !llvm.ptr
      %55 = llvm.icmp "eq" %22, %54 : !llvm.ptr
      scf.yield %55 : i1
    }
    %56 = scf.if %52 -> (i1) {
      %57 = arith.constant true
      scf.yield %57 : i1
    } else {
      %58 = llvm.mlir.zero : !llvm.ptr
      %59 = llvm.icmp "eq" %26, %58 : !llvm.ptr
      scf.yield %59 : i1
    }
    cf.cond_br %56, ^bb0, ^bb1
    ^bb0:
      %60 = arith.constant 1 : i32
      func.return %60 : i32
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %61 = llvm.mlir.zero : !llvm.ptr
    %62 = llvm.icmp "eq" %30, %61 : !llvm.ptr
    %63 = scf.if %62 -> (i1) {
      %64 = arith.constant true
      scf.yield %64 : i1
    } else {
      %65 = llvm.mlir.zero : !llvm.ptr
      %66 = llvm.icmp "eq" %34, %65 : !llvm.ptr
      scf.yield %66 : i1
    }
    %67 = scf.if %63 -> (i1) {
      %68 = arith.constant true
      scf.yield %68 : i1
    } else {
      %69 = llvm.mlir.zero : !llvm.ptr
      %70 = llvm.icmp "eq" %38, %69 : !llvm.ptr
      scf.yield %70 : i1
    }
    cf.cond_br %67, ^bb3, ^bb4
    ^bb3:
      %71 = arith.constant 1 : i32
      func.return %71 : i32
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %72 = arith.constant 0 : i32
    %73 = arith.extsi %72 : i32 to i64
    %74 = llvm.mlir.constant(1 : i64) : i64
    %75 = llvm.alloca %74 x i64 : (i64) -> !llvm.ptr
    llvm.store %73, %75 : i64, !llvm.ptr
    cf.br ^bb6
    ^bb6:
    %76 = llvm.load %75 : !llvm.ptr -> i64
    %77 = arith.constant 6 : i32
    %79 = arith.extsi %77 : i32 to i64
    %78 = arith.cmpi sle, %76, %79 : i64
    cf.cond_br %78, ^bb7, ^bb8
    ^bb7:
      %80 = arith.constant 0 : i32
      %81 = arith.extsi %80 : i32 to i64
      %82 = llvm.mlir.constant(1 : i64) : i64
      %83 = llvm.alloca %82 x i64 : (i64) -> !llvm.ptr
      llvm.store %81, %83 : i64, !llvm.ptr
      cf.br ^bb9
      ^bb9:
      %84 = llvm.load %83 : !llvm.ptr -> i64
      %85 = arith.constant 6 : i32
      %87 = arith.extsi %85 : i32 to i64
      %86 = arith.cmpi sle, %84, %87 : i64
      cf.cond_br %86, ^bb10, ^bb11
      ^bb10:
        %88 = arith.constant 0 : i32
        %89 = arith.extsi %88 : i32 to i64
        %90 = llvm.mlir.constant(1 : i64) : i64
        %91 = llvm.alloca %90 x i64 : (i64) -> !llvm.ptr
        llvm.store %89, %91 : i64, !llvm.ptr
        cf.br ^bb12
        ^bb12:
        %92 = llvm.load %91 : !llvm.ptr -> i64
        %93 = arith.constant 6 : i32
        %95 = arith.extsi %93 : i32 to i64
        %94 = arith.cmpi sle, %92, %95 : i64
        cf.cond_br %94, ^bb13, ^bb14
        ^bb13:
          %96 = llvm.load %75 : !llvm.ptr -> i64
          %97 = arith.constant 7 : i32
          %99 = arith.extsi %97 : i32 to i64
          %98 = arith.muli %96, %99 : i64
          %100 = llvm.load %83 : !llvm.ptr -> i64
          %101 = arith.addi %98, %100 : i64
          %102 = arith.constant 7 : i32
          %104 = arith.extsi %102 : i32 to i64
          %103 = arith.muli %101, %104 : i64
          %105 = llvm.load %91 : !llvm.ptr -> i64
          %106 = arith.addi %103, %105 : i64
          %107 = arith.constant 0 : i32
          %108 = arith.extsi %107 : i32 to i64
          %109 = llvm.mlir.constant(1 : i64) : i64
          %110 = llvm.alloca %109 x i64 : (i64) -> !llvm.ptr
          llvm.store %108, %110 : i64, !llvm.ptr
          %111 = arith.constant 0 : i32
          %112 = arith.extsi %111 : i32 to i64
          %113 = llvm.mlir.constant(1 : i64) : i64
          %114 = llvm.alloca %113 x i64 : (i64) -> !llvm.ptr
          llvm.store %112, %114 : i64, !llvm.ptr
          cf.br ^bb15
          ^bb15:
          %115 = llvm.load %114 : !llvm.ptr -> i64
          %116 = arith.constant 6 : i32
          %117 = llvm.load %75 : !llvm.ptr -> i64
          %119 = arith.extsi %116 : i32 to i64
          %118 = arith.subi %119, %117 : i64
          %120 = arith.cmpi sle, %115, %118 : i64
          cf.cond_br %120, ^bb16, ^bb17
          ^bb16:
            %121 = arith.constant 0 : i32
            %122 = arith.extsi %121 : i32 to i64
            %123 = llvm.mlir.constant(1 : i64) : i64
            %124 = llvm.alloca %123 x i64 : (i64) -> !llvm.ptr
            llvm.store %122, %124 : i64, !llvm.ptr
            cf.br ^bb18
            ^bb18:
            %125 = llvm.load %124 : !llvm.ptr -> i64
            %126 = arith.constant 6 : i32
            %127 = llvm.load %83 : !llvm.ptr -> i64
            %129 = arith.extsi %126 : i32 to i64
            %128 = arith.subi %129, %127 : i64
            %130 = arith.cmpi sle, %125, %128 : i64
            cf.cond_br %130, ^bb19, ^bb20
            ^bb19:
              %131 = arith.constant 0 : i32
              %132 = arith.extsi %131 : i32 to i64
              %133 = llvm.mlir.constant(1 : i64) : i64
              %134 = llvm.alloca %133 x i64 : (i64) -> !llvm.ptr
              llvm.store %132, %134 : i64, !llvm.ptr
              cf.br ^bb21
              ^bb21:
              %135 = llvm.load %134 : !llvm.ptr -> i64
              %136 = arith.constant 6 : i32
              %137 = llvm.load %91 : !llvm.ptr -> i64
              %139 = arith.extsi %136 : i32 to i64
              %138 = arith.subi %139, %137 : i64
              %140 = arith.cmpi sle, %135, %138 : i64
              cf.cond_br %140, ^bb22, ^bb23
              ^bb22:
                %141 = llvm.load %75 : !llvm.ptr -> i64
                %142 = llvm.load %114 : !llvm.ptr -> i64
                %143 = arith.addi %141, %142 : i64
                %144 = llvm.load %83 : !llvm.ptr -> i64
                %145 = llvm.load %124 : !llvm.ptr -> i64
                %146 = arith.addi %144, %145 : i64
                %147 = llvm.load %91 : !llvm.ptr -> i64
                %148 = llvm.load %134 : !llvm.ptr -> i64
                %149 = arith.addi %147, %148 : i64
                %150 = arith.constant 7 : i32
                %152 = arith.extsi %150 : i32 to i64
                %151 = arith.muli %143, %152 : i64
                %153 = arith.addi %151, %146 : i64
                %154 = arith.constant 7 : i32
                %156 = arith.extsi %154 : i32 to i64
                %155 = arith.muli %153, %156 : i64
                %157 = arith.addi %155, %149 : i64
                %158 = arith.muli %157, %3 : i64
                %159 = arith.muli %106, %9 : i64
                %160 = llvm.load %110 : !llvm.ptr -> i64
                %161 = arith.addi %159, %160 : i64
                %162 = arith.trunci %158 : i64 to i32
                %163 = llvm.getelementptr %14[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                llvm.store %162, %163 : i32, !llvm.ptr
                %164 = arith.trunci %143 : i64 to i8
                %165 = llvm.getelementptr %18[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i8
                llvm.store %164, %165 : i8, !llvm.ptr
                %166 = arith.trunci %146 : i64 to i8
                %167 = llvm.getelementptr %22[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i8
                llvm.store %166, %167 : i8, !llvm.ptr
                %168 = arith.trunci %149 : i64 to i8
                %169 = llvm.getelementptr %26[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i8
                llvm.store %168, %169 : i8, !llvm.ptr
                %170 = llvm.load %124 : !llvm.ptr -> i64
                %171 = llvm.load %75 : !llvm.ptr -> i64
                %172 = arith.muli %170, %171 : i64
                %173 = arith.trunci %172 : i64 to i8
                %174 = llvm.getelementptr %30[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i8
                llvm.store %173, %174 : i8, !llvm.ptr
                %175 = llvm.load %134 : !llvm.ptr -> i64
                %176 = llvm.load %83 : !llvm.ptr -> i64
                %177 = arith.muli %175, %176 : i64
                %178 = arith.trunci %177 : i64 to i8
                %179 = llvm.getelementptr %34[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i8
                llvm.store %178, %179 : i8, !llvm.ptr
                %180 = llvm.load %114 : !llvm.ptr -> i64
                %181 = llvm.load %91 : !llvm.ptr -> i64
                %182 = arith.muli %180, %181 : i64
                %183 = arith.trunci %182 : i64 to i8
                %184 = llvm.getelementptr %38[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i8
                llvm.store %183, %184 : i8, !llvm.ptr
                %185 = llvm.load %110 : !llvm.ptr -> i64
                %186 = arith.constant 1 : i32
                %188 = arith.extsi %186 : i32 to i64
                %187 = arith.addi %185, %188 : i64
                llvm.store %187, %110 : i64, !llvm.ptr
                %189 = llvm.load %134 : !llvm.ptr -> i64
                %190 = arith.constant 1 : i32
                %192 = arith.extsi %190 : i32 to i64
                %191 = arith.addi %189, %192 : i64
                llvm.store %191, %134 : i64, !llvm.ptr
                cf.br ^bb21
              ^bb23:
              %193 = llvm.load %124 : !llvm.ptr -> i64
              %194 = arith.constant 1 : i32
              %196 = arith.extsi %194 : i32 to i64
              %195 = arith.addi %193, %196 : i64
              llvm.store %195, %124 : i64, !llvm.ptr
              cf.br ^bb18
            ^bb20:
            %197 = llvm.load %114 : !llvm.ptr -> i64
            %198 = arith.constant 1 : i32
            %200 = arith.extsi %198 : i32 to i64
            %199 = arith.addi %197, %200 : i64
            llvm.store %199, %114 : i64, !llvm.ptr
            cf.br ^bb15
          ^bb17:
          %201 = llvm.load %110 : !llvm.ptr -> i64
          %202 = arith.trunci %201 : i64 to i32
          %203 = llvm.getelementptr %11[%106] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %202, %203 : i32, !llvm.ptr
          %204 = llvm.load %91 : !llvm.ptr -> i64
          %205 = arith.constant 1 : i32
          %207 = arith.extsi %205 : i32 to i64
          %206 = arith.addi %204, %207 : i64
          llvm.store %206, %91 : i64, !llvm.ptr
          cf.br ^bb12
        ^bb14:
        %208 = llvm.load %83 : !llvm.ptr -> i64
        %209 = arith.constant 1 : i32
        %211 = arith.extsi %209 : i32 to i64
        %210 = arith.addi %208, %211 : i64
        llvm.store %210, %83 : i64, !llvm.ptr
        cf.br ^bb9
      ^bb11:
      %212 = llvm.load %75 : !llvm.ptr -> i64
      %213 = arith.constant 1 : i32
      %215 = arith.extsi %213 : i32 to i64
      %214 = arith.addi %212, %215 : i64
      llvm.store %214, %75 : i64, !llvm.ptr
      cf.br ^bb6
    ^bb8:
    %217 = arith.constant 8 : i32
    %218 = arith.extsi %217 : i32 to i64
    %216 = func.call @calloc(%10, %218) : (i64, i64) -> !llvm.ptr
    %220 = arith.constant 20000 : i32
    %221 = arith.constant 4 : i32
    %222 = arith.extsi %220 : i32 to i64
    %223 = arith.extsi %221 : i32 to i64
    %219 = func.call @calloc(%222, %223) : (i64, i64) -> !llvm.ptr
    %225 = arith.constant 20000 : i32
    %226 = arith.constant 8 : i32
    %227 = arith.extsi %225 : i32 to i64
    %228 = arith.extsi %226 : i32 to i64
    %224 = func.call @calloc(%227, %228) : (i64, i64) -> !llvm.ptr
    %230 = arith.constant 20000 : i32
    %231 = arith.constant 4 : i32
    %232 = arith.extsi %230 : i32 to i64
    %233 = arith.extsi %231 : i32 to i64
    %229 = func.call @calloc(%232, %233) : (i64, i64) -> !llvm.ptr
    %234 = llvm.mlir.zero : !llvm.ptr
    %235 = llvm.icmp "eq" %216, %234 : !llvm.ptr
    %236 = scf.if %235 -> (i1) {
      %237 = arith.constant true
      scf.yield %237 : i1
    } else {
      %238 = llvm.mlir.zero : !llvm.ptr
      %239 = llvm.icmp "eq" %219, %238 : !llvm.ptr
      scf.yield %239 : i1
    }
    %240 = scf.if %236 -> (i1) {
      %241 = arith.constant true
      scf.yield %241 : i1
    } else {
      %242 = llvm.mlir.zero : !llvm.ptr
      %243 = llvm.icmp "eq" %224, %242 : !llvm.ptr
      scf.yield %243 : i1
    }
    %244 = scf.if %240 -> (i1) {
      %245 = arith.constant true
      scf.yield %245 : i1
    } else {
      %246 = llvm.mlir.zero : !llvm.ptr
      %247 = llvm.icmp "eq" %229, %246 : !llvm.ptr
      scf.yield %247 : i1
    }
    cf.cond_br %244, ^bb24, ^bb25
    ^bb24:
      %248 = arith.constant 1 : i32
      func.return %248 : i32
    ^bb25:
      cf.br ^bb26
    ^bb26:
    %249 = arith.constant 1 : i32
    %250 = arith.extsi %249 : i32 to i64
    %251 = llvm.mlir.constant(1 : i64) : i64
    %252 = llvm.alloca %251 x i64 : (i64) -> !llvm.ptr
    llvm.store %250, %252 : i64, !llvm.ptr
    %253 = arith.constant 0 : i32
    %254 = arith.constant 0 : i32
    %255 = arith.extsi %254 : i32 to i64
    %256 = llvm.getelementptr %219[%255] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %253, %256 : i32, !llvm.ptr
    %257 = arith.constant 1 : i32
    %258 = arith.constant 0 : i32
    %259 = arith.extsi %257 : i32 to i64
    %260 = arith.extsi %258 : i32 to i64
    %261 = llvm.getelementptr %224[%260] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %259, %261 : i64, !llvm.ptr
    %262 = arith.constant 30 : i32
    %263 = arith.extsi %262 : i32 to i64
    %264 = arith.constant 1 : i32
    %265 = arith.extsi %264 : i32 to i64
    %266 = llvm.mlir.constant(1 : i64) : i64
    %267 = llvm.alloca %266 x i64 : (i64) -> !llvm.ptr
    llvm.store %265, %267 : i64, !llvm.ptr
    cf.br ^bb27
    ^bb27:
    %268 = llvm.load %267 : !llvm.ptr -> i64
    %269 = arith.cmpi sle, %268, %263 : i64
    cf.cond_br %269, ^bb28, ^bb29
    ^bb28:
      %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 = llvm.load %267 : !llvm.ptr -> i64
      %279 = arith.cmpi eq, %278, %263 : i64
      cf.cond_br %279, ^bb30, ^bb31
      ^bb30:
        %280 = arith.constant 1 : i32
        %281 = arith.extsi %280 : i32 to i64
        llvm.store %281, %277 : i64, !llvm.ptr
        cf.br ^bb32
      ^bb31:
        cf.br ^bb32
      ^bb32:
      %282 = arith.constant 0 : i32
      %283 = arith.extsi %282 : i32 to i64
      %284 = llvm.mlir.constant(1 : i64) : i64
      %285 = llvm.alloca %284 x i64 : (i64) -> !llvm.ptr
      llvm.store %283, %285 : i64, !llvm.ptr
      cf.br ^bb33
      ^bb33:
      %286 = llvm.load %285 : !llvm.ptr -> i64
      %287 = llvm.load %252 : !llvm.ptr -> i64
      %288 = arith.cmpi slt, %286, %287 : i64
      cf.cond_br %288, ^bb34, ^bb35
      ^bb34:
        %290 = llvm.load %285 : !llvm.ptr -> i64
        %291 = llvm.getelementptr %219[%290] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %289 = llvm.load %291 : !llvm.ptr -> i32
        %292 = arith.extsi %289 : i32 to i64
        %294 = llvm.load %285 : !llvm.ptr -> i64
        %295 = llvm.getelementptr %224[%294] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %293 = llvm.load %295 : !llvm.ptr -> i64
        %296 = arith.remsi %292, %1 : i64
        %297 = arith.divsi %292, %1 : 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 %299 : !llvm.ptr -> i64
        %301 = arith.remsi %300, %1 : i64
        %302 = llvm.load %299 : !llvm.ptr -> i64
        %303 = arith.divsi %302, %1 : i64
        llvm.store %303, %299 : i64, !llvm.ptr
        %304 = llvm.load %299 : !llvm.ptr -> i64
        %305 = arith.remsi %304, %1 : i64
        %306 = llvm.load %299 : !llvm.ptr -> i64
        %307 = arith.divsi %306, %1 : i64
        %309 = llvm.getelementptr %11[%307] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %308 = llvm.load %309 : !llvm.ptr -> i32
        %310 = arith.extsi %308 : i32 to i64
        %311 = arith.constant 0 : i32
        %312 = arith.extsi %311 : i32 to i64
        %313 = llvm.mlir.constant(1 : i64) : i64
        %314 = llvm.alloca %313 x i64 : (i64) -> !llvm.ptr
        llvm.store %312, %314 : i64, !llvm.ptr
        cf.br ^bb36
        ^bb36:
        %315 = llvm.load %314 : !llvm.ptr -> i64
        %316 = arith.cmpi slt, %315, %310 : i64
        cf.cond_br %316, ^bb37, ^bb38
        ^bb37:
          %317 = arith.muli %307, %9 : i64
          %318 = llvm.load %314 : !llvm.ptr -> i64
          %319 = arith.addi %317, %318 : i64
          %321 = llvm.getelementptr %18[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %320 = llvm.load %321 : !llvm.ptr -> i8
          %322 = arith.extsi %320 : i8 to i64
          %324 = llvm.getelementptr %22[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %323 = llvm.load %324 : !llvm.ptr -> i8
          %325 = arith.extsi %323 : i8 to i64
          %327 = llvm.getelementptr %26[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %326 = llvm.load %327 : !llvm.ptr -> i8
          %328 = arith.extsi %326 : i8 to i64
          %330 = llvm.getelementptr %30[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %329 = llvm.load %330 : !llvm.ptr -> i8
          %331 = arith.extsi %329 : i8 to i64
          %332 = arith.addi %305, %331 : i64
          %333 = llvm.mlir.constant(1 : i64) : i64
          %334 = llvm.alloca %333 x i64 : (i64) -> !llvm.ptr
          llvm.store %332, %334 : i64, !llvm.ptr
          %335 = llvm.load %334 : !llvm.ptr -> i64
          %336 = arith.constant 19 : i32
          %338 = arith.extsi %336 : i32 to i64
          %337 = arith.cmpi sgt, %335, %338 : i64
          cf.cond_br %337, ^bb39, ^bb40
          ^bb39:
            %339 = arith.constant 19 : i32
            %340 = arith.extsi %339 : i32 to i64
            llvm.store %340, %334 : i64, !llvm.ptr
            cf.br ^bb41
          ^bb40:
            cf.br ^bb41
          ^bb41:
          %342 = llvm.getelementptr %34[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %341 = llvm.load %342 : !llvm.ptr -> i8
          %343 = arith.extsi %341 : i8 to i64
          %344 = arith.addi %301, %343 : i64
          %345 = llvm.mlir.constant(1 : i64) : i64
          %346 = llvm.alloca %345 x i64 : (i64) -> !llvm.ptr
          llvm.store %344, %346 : i64, !llvm.ptr
          %347 = llvm.load %346 : !llvm.ptr -> i64
          %348 = arith.constant 19 : i32
          %350 = arith.extsi %348 : i32 to i64
          %349 = arith.cmpi sgt, %347, %350 : i64
          cf.cond_br %349, ^bb42, ^bb43
          ^bb42:
            %351 = arith.constant 19 : i32
            %352 = arith.extsi %351 : i32 to i64
            llvm.store %352, %346 : i64, !llvm.ptr
            cf.br ^bb44
          ^bb43:
            cf.br ^bb44
          ^bb44:
          %354 = llvm.getelementptr %38[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %353 = llvm.load %354 : !llvm.ptr -> i8
          %355 = arith.extsi %353 : i8 to i64
          %356 = arith.addi %296, %355 : i64
          %357 = llvm.mlir.constant(1 : i64) : i64
          %358 = llvm.alloca %357 x i64 : (i64) -> !llvm.ptr
          llvm.store %356, %358 : i64, !llvm.ptr
          %359 = llvm.load %358 : !llvm.ptr -> i64
          %360 = arith.constant 19 : i32
          %362 = arith.extsi %360 : i32 to i64
          %361 = arith.cmpi sgt, %359, %362 : i64
          cf.cond_br %361, ^bb45, ^bb46
          ^bb45:
            %363 = arith.constant 19 : i32
            %364 = arith.extsi %363 : i32 to i64
            llvm.store %364, %358 : i64, !llvm.ptr
            cf.br ^bb47
          ^bb46:
            cf.br ^bb47
          ^bb47:
          %365 = arith.constant 1 : i32
          %366 = arith.extsi %365 : i32 to i64
          %367 = llvm.mlir.constant(1 : i64) : i64
          %368 = llvm.alloca %367 x i64 : (i64) -> !llvm.ptr
          llvm.store %366, %368 : i64, !llvm.ptr
          %369 = llvm.load %334 : !llvm.ptr -> i64
          %370 = arith.constant 6 : i32
          %371 = arith.constant 6 : i32
          %373 = arith.extsi %371 : i32 to i64
          %372 = arith.subi %373, %325 : i64
          %375 = arith.extsi %370 : i32 to i64
          %374 = arith.muli %375, %372 : i64
          %376 = arith.addi %369, %374 : i64
          %377 = arith.cmpi slt, %376, %5 : i64
          cf.cond_br %377, ^bb48, ^bb49
          ^bb48:
            %378 = arith.constant 0 : i32
            %379 = arith.extsi %378 : i32 to i64
            llvm.store %379, %368 : i64, !llvm.ptr
            cf.br ^bb50
          ^bb49:
            cf.br ^bb50
          ^bb50:
          %380 = llvm.load %346 : !llvm.ptr -> i64
          %381 = arith.constant 6 : i32
          %382 = arith.constant 6 : i32
          %384 = arith.extsi %382 : i32 to i64
          %383 = arith.subi %384, %328 : i64
          %386 = arith.extsi %381 : i32 to i64
          %385 = arith.muli %386, %383 : i64
          %387 = arith.addi %380, %385 : i64
          %388 = arith.cmpi slt, %387, %5 : i64
          cf.cond_br %388, ^bb51, ^bb52
          ^bb51:
            %389 = arith.constant 0 : i32
            %390 = arith.extsi %389 : i32 to i64
            llvm.store %390, %368 : i64, !llvm.ptr
            cf.br ^bb53
          ^bb52:
            cf.br ^bb53
          ^bb53:
          %391 = llvm.load %358 : !llvm.ptr -> i64
          %392 = arith.constant 6 : i32
          %393 = arith.constant 6 : i32
          %395 = arith.extsi %393 : i32 to i64
          %394 = arith.subi %395, %322 : i64
          %397 = arith.extsi %392 : i32 to i64
          %396 = arith.muli %397, %394 : i64
          %398 = arith.addi %391, %396 : i64
          %399 = arith.cmpi slt, %398, %5 : i64
          cf.cond_br %399, ^bb54, ^bb55
          ^bb54:
            %400 = arith.constant 0 : i32
            %401 = arith.extsi %400 : i32 to i64
            llvm.store %401, %368 : i64, !llvm.ptr
            cf.br ^bb56
          ^bb55:
            cf.br ^bb56
          ^bb56:
          %402 = llvm.load %277 : !llvm.ptr -> i64
          %403 = arith.constant 1 : i32
          %405 = arith.extsi %403 : i32 to i64
          %404 = arith.cmpi eq, %402, %405 : i64
          cf.cond_br %404, ^bb57, ^bb58
          ^bb57:
            %406 = arith.constant 6 : i32
            %408 = arith.extsi %406 : i32 to i64
            %407 = arith.cmpi ne, %322, %408 : i64
            cf.cond_br %407, ^bb60, ^bb61
            ^bb60:
              %409 = arith.constant 0 : i32
              %410 = arith.extsi %409 : i32 to i64
              llvm.store %410, %368 : i64, !llvm.ptr
              cf.br ^bb62
            ^bb61:
              cf.br ^bb62
            ^bb62:
            %411 = arith.constant 6 : i32
            %413 = arith.extsi %411 : i32 to i64
            %412 = arith.cmpi ne, %325, %413 : i64
            cf.cond_br %412, ^bb63, ^bb64
            ^bb63:
              %414 = arith.constant 0 : i32
              %415 = arith.extsi %414 : i32 to i64
              llvm.store %415, %368 : i64, !llvm.ptr
              cf.br ^bb65
            ^bb64:
              cf.br ^bb65
            ^bb65:
            %416 = arith.constant 6 : i32
            %418 = arith.extsi %416 : i32 to i64
            %417 = arith.cmpi ne, %328, %418 : i64
            cf.cond_br %417, ^bb66, ^bb67
            ^bb66:
              %419 = arith.constant 0 : i32
              %420 = arith.extsi %419 : i32 to i64
              llvm.store %420, %368 : i64, !llvm.ptr
              cf.br ^bb68
            ^bb67:
              cf.br ^bb68
            ^bb68:
            cf.br ^bb59
          ^bb58:
            cf.br ^bb59
          ^bb59:
          %421 = llvm.load %368 : !llvm.ptr -> i64
          %422 = arith.constant 1 : i32
          %424 = arith.extsi %422 : i32 to i64
          %423 = arith.cmpi eq, %421, %424 : i64
          cf.cond_br %423, ^bb69, ^bb70
          ^bb69:
            %426 = llvm.getelementptr %14[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %425 = llvm.load %426 : !llvm.ptr -> i32
            %427 = arith.extsi %425 : i32 to i64
            %428 = llvm.load %334 : !llvm.ptr -> i64
            %429 = arith.constant 400 : i32
            %431 = arith.extsi %429 : i32 to i64
            %430 = arith.muli %428, %431 : i64
            %432 = arith.addi %427, %430 : i64
            %433 = llvm.load %346 : !llvm.ptr -> i64
            %434 = arith.constant 20 : i32
            %436 = arith.extsi %434 : i32 to i64
            %435 = arith.muli %433, %436 : i64
            %437 = arith.addi %432, %435 : i64
            %438 = llvm.load %358 : !llvm.ptr -> i64
            %439 = arith.addi %437, %438 : i64
            %441 = llvm.getelementptr %216[%439] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %440 = llvm.load %441 : !llvm.ptr -> i64
            %442 = arith.constant 0 : i32
            %444 = arith.extsi %442 : i32 to i64
            %443 = arith.cmpi eq, %440, %444 : i64
            cf.cond_br %443, ^bb72, ^bb73
            ^bb72:
              %445 = arith.trunci %439 : i64 to i32
              %446 = llvm.load %273 : !llvm.ptr -> i64
              %447 = llvm.getelementptr %229[%446] : (!llvm.ptr, i64) -> !llvm.ptr, i32
              llvm.store %445, %447 : i32, !llvm.ptr
              %448 = llvm.load %273 : !llvm.ptr -> i64
              %449 = arith.constant 1 : i32
              %451 = arith.extsi %449 : i32 to i64
              %450 = arith.addi %448, %451 : i64
              llvm.store %450, %273 : i64, !llvm.ptr
              cf.br ^bb74
            ^bb73:
              cf.br ^bb74
            ^bb74:
            %453 = llvm.getelementptr %216[%439] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %452 = llvm.load %453 : !llvm.ptr -> i64
            %454 = arith.addi %452, %293 : i64
            %455 = llvm.getelementptr %216[%439] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %454, %455 : i64, !llvm.ptr
            cf.br ^bb71
          ^bb70:
            cf.br ^bb71
          ^bb71:
          %456 = llvm.load %314 : !llvm.ptr -> i64
          %457 = arith.constant 1 : i32
          %459 = arith.extsi %457 : i32 to i64
          %458 = arith.addi %456, %459 : i64
          llvm.store %458, %314 : i64, !llvm.ptr
          cf.br ^bb36
        ^bb38:
        %460 = llvm.load %285 : !llvm.ptr -> i64
        %461 = arith.constant 1 : i32
        %463 = arith.extsi %461 : i32 to i64
        %462 = arith.addi %460, %463 : i64
        llvm.store %462, %285 : i64, !llvm.ptr
        cf.br ^bb33
      ^bb35:
      %464 = arith.constant 0 : i32
      %465 = arith.extsi %464 : i32 to i64
      %466 = llvm.mlir.constant(1 : i64) : i64
      %467 = llvm.alloca %466 x i64 : (i64) -> !llvm.ptr
      llvm.store %465, %467 : i64, !llvm.ptr
      cf.br ^bb75
      ^bb75:
      %468 = llvm.load %467 : !llvm.ptr -> i64
      %469 = llvm.load %273 : !llvm.ptr -> i64
      %470 = arith.cmpi slt, %468, %469 : i64
      cf.cond_br %470, ^bb76, ^bb77
      ^bb76:
        %472 = llvm.load %467 : !llvm.ptr -> i64
        %473 = llvm.getelementptr %229[%472] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %471 = llvm.load %473 : !llvm.ptr -> i32
        %474 = arith.extsi %471 : i32 to i64
        %475 = arith.trunci %474 : i64 to i32
        %476 = llvm.load %467 : !llvm.ptr -> i64
        %477 = llvm.getelementptr %219[%476] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %475, %477 : i32, !llvm.ptr
        %479 = llvm.getelementptr %216[%474] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %478 = llvm.load %479 : !llvm.ptr -> i64
        %480 = llvm.load %467 : !llvm.ptr -> i64
        %481 = llvm.getelementptr %224[%480] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %478, %481 : i64, !llvm.ptr
        %482 = arith.constant 0 : i32
        %483 = arith.extsi %482 : i32 to i64
        %484 = llvm.getelementptr %216[%474] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %483, %484 : i64, !llvm.ptr
        %485 = llvm.load %467 : !llvm.ptr -> i64
        %486 = arith.constant 1 : i32
        %488 = arith.extsi %486 : i32 to i64
        %487 = arith.addi %485, %488 : i64
        llvm.store %487, %467 : i64, !llvm.ptr
        cf.br ^bb75
      ^bb77:
      %489 = llvm.load %273 : !llvm.ptr -> i64
      llvm.store %489, %252 : i64, !llvm.ptr
      %490 = llvm.load %267 : !llvm.ptr -> i64
      %491 = arith.constant 1 : i32
      %493 = arith.extsi %491 : i32 to i64
      %492 = arith.addi %490, %493 : i64
      llvm.store %492, %267 : i64, !llvm.ptr
      cf.br ^bb27
    ^bb29:
    %494 = arith.constant 6 : i32
    %495 = arith.constant 7 : i32
    %496 = arith.muli %494, %495 : i32
    %497 = arith.constant 6 : i32
    %498 = arith.addi %496, %497 : i32
    %499 = arith.constant 7 : i32
    %500 = arith.muli %498, %499 : i32
    %501 = arith.constant 6 : i32
    %502 = arith.addi %500, %501 : i32
    %503 = arith.extsi %502 : i32 to i64
    %504 = arith.muli %503, %1 : i64
    %505 = arith.constant 19 : i32
    %507 = arith.extsi %505 : i32 to i64
    %506 = arith.addi %504, %507 : i64
    %508 = arith.muli %506, %1 : i64
    %509 = arith.constant 19 : i32
    %511 = arith.extsi %509 : i32 to i64
    %510 = arith.addi %508, %511 : i64
    %512 = arith.muli %510, %1 : i64
    %513 = arith.constant 19 : i32
    %515 = arith.extsi %513 : i32 to i64
    %514 = arith.addi %512, %515 : i64
    %516 = arith.constant 0 : i32
    %517 = arith.extsi %516 : i32 to i64
    %518 = llvm.mlir.constant(1 : i64) : i64
    %519 = llvm.alloca %518 x i64 : (i64) -> !llvm.ptr
    llvm.store %517, %519 : i64, !llvm.ptr
    %520 = arith.constant 0 : i32
    %521 = arith.extsi %520 : i32 to i64
    %522 = llvm.mlir.constant(1 : i64) : i64
    %523 = llvm.alloca %522 x i64 : (i64) -> !llvm.ptr
    llvm.store %521, %523 : i64, !llvm.ptr
    cf.br ^bb78
    ^bb78:
    %524 = llvm.load %523 : !llvm.ptr -> i64
    %525 = llvm.load %252 : !llvm.ptr -> i64
    %526 = arith.cmpi slt, %524, %525 : i64
    cf.cond_br %526, ^bb79, ^bb80
    ^bb79:
      %528 = llvm.load %523 : !llvm.ptr -> i64
      %529 = llvm.getelementptr %219[%528] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %527 = llvm.load %529 : !llvm.ptr -> i32
      %530 = arith.extsi %527 : i32 to i64
      %531 = arith.cmpi eq, %530, %514 : i64
      cf.cond_br %531, ^bb81, ^bb82
      ^bb81:
        %533 = llvm.load %523 : !llvm.ptr -> i64
        %534 = llvm.getelementptr %224[%533] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %532 = llvm.load %534 : !llvm.ptr -> i64
        %535 = arith.constant 3 : i32
        %537 = arith.extsi %535 : i32 to i64
        %536 = arith.divsi %532, %537 : i64
        llvm.store %536, %519 : i64, !llvm.ptr
        cf.br ^bb80
      ^bb82:
        cf.br ^bb83
      ^bb83:
      %538 = llvm.load %523 : !llvm.ptr -> i64
      %539 = arith.constant 1 : i32
      %541 = arith.extsi %539 : i32 to i64
      %540 = arith.addi %538, %541 : i64
      llvm.store %540, %523 : i64, !llvm.ptr
      cf.br ^bb78
    ^bb80:
    %542 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %543 = llvm.load %519 : !llvm.ptr -> i64
    %544 = llvm.call @printf(%542, %543) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%229) : (!llvm.ptr) -> ()
    func.call @free(%224) : (!llvm.ptr) -> ()
    func.call @free(%219) : (!llvm.ptr) -> ()
    func.call @free(%216) : (!llvm.ptr) -> ()
    func.call @free(%38) : (!llvm.ptr) -> ()
    func.call @free(%34) : (!llvm.ptr) -> ()
    func.call @free(%30) : (!llvm.ptr) -> ()
    func.call @free(%26) : (!llvm.ptr) -> ()
    func.call @free(%22) : (!llvm.ptr) -> ()
    func.call @free(%18) : (!llvm.ptr) -> ()
    func.call @free(%14) : (!llvm.ptr) -> ()
    func.call @free(%11) : (!llvm.ptr) -> ()
    %557 = arith.constant 0 : i32
    func.return %557 : i32
  }
}