Problem 084

Monopoly modal string for 4-sided dice via Markov steady state.

Answer101524
Output101524
StatusPASS
Native helperno
Runtime0 ms
Peak memory1072 KB
Time complexityO(n^4) (estimated)
Space complexityO(n) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^4)O(n * s^2)
Space complexityO(n)O(s^2)
ApproachFlow solutionMarkov chain or DP over states
VerdictUnknown

Flow source

# Project Euler 084
# Monopoly modal string for 4-sided dice via Markov steady state.

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

function next_rail(pos: i32) -> i32 {
    if pos < 5 { return 5 }
    if pos < 15 { return 15 }
    if pos < 25 { return 25 }
    if pos < 35 { return 35 }
    return 5
}

function next_util(pos: i32) -> i32 {
    if pos < 12 { return 12 }
    if pos < 28 { return 28 }
    return 12
}

function main() -> i32 {
    # State: (square, doubles_in_a_row 0..2) → 120 states
    let NS: i32 = 120
    let p: ptr<f64> = calloc(NS as i64, 8)
    let q: ptr<f64> = calloc(NS as i64, 8)
    if p == null || q == null { return 1 }
    p[0] = 1.0  # GO, 0 doubles

    let sides: i32 = 4
    let die_n: f64 = (sides * sides) as f64
    let mut iter: i32 = 0
    while iter < 200 {
        let mut s: i32 = 0
        while s < NS {
            q[s] = 0.0
            s = s + 1
        }
        s = 0
        while s < NS {
            let prob: f64 = p[s]
            if prob > 0.0 {
                let sq: i32 = s / 3
                let dbl: i32 = s % 3
                let mut d1: i32 = 1
                while d1 <= sides {
                    let mut d2: i32 = 1
                    while d2 <= sides {
                        let pr: f64 = prob / die_n
                        let is_dbl: bool = d1 == d2
                        if is_dbl && dbl == 2 {
                            # third double → JAIL
                            q[10 * 3 + 0] = q[10 * 3 + 0] + pr
                        } else {
                            let mut nd: i32 = 0
                            if is_dbl {
                                nd = dbl + 1
                            }
                            let mut pos: i32 = (sq + d1 + d2) % 40
                            # resolve Chance / CC / G2J (one card draw each, 16 cards)
                            if pos == 30 {
                                pos = 10
                                nd = 0
                            } elif pos == 7 || pos == 22 || pos == 36 {
                                # Chance: 16 equally likely
                                let mut card: i32 = 0
                                while card < 16 {
                                    let mut np: i32 = pos
                                    let mut nd2: i32 = nd
                                    match card {
                                        0 => { np = 0 }
                                        1 => { np = 10; nd2 = 0 }
                                        2 => { np = 11 }
                                        3 => { np = 24 }
                                        4 => { np = 39 }
                                        5 => { np = 5 }
                                        6 | 7 => { np = next_rail(pos) }
                                        8 => { np = next_util(pos) }
                                        9 => {
                                            np = (pos + 37) % 40
                                            # back 3 may land on CC
                                            if np == 33 || np == 2 || np == 17 {
                                                # nested CC
                                                let mut c2: i32 = 0
                                                while c2 < 16 {
                                                    let mut npp: i32 = np
                                                    let mut nd3: i32 = nd2
                                                    match c2 {
                                                        0 => { npp = 0 }
                                                        1 => { npp = 10; nd3 = 0 }
                                                        _ => { }
                                                    }
                                                    if npp == 30 { npp = 10; nd3 = 0 }
                                                    q[npp * 3 + nd3] = q[npp * 3 + nd3] + pr / 16.0 / 16.0
                                                    c2 = c2 + 1
                                                }
                                                card = card + 1
                                                continue
                                            }
                                        }
                                        _ => { }
                                    }
                                    if np == 30 { np = 10; nd2 = 0 }
                                    q[np * 3 + nd2] = q[np * 3 + nd2] + pr / 16.0
                                    card = card + 1
                                }
                                d2 = d2 + 1
                                continue
                            } elif pos == 2 || pos == 17 || pos == 33 {
                                let mut card: i32 = 0
                                while card < 16 {
                                    let mut np: i32 = pos
                                    let mut nd2: i32 = nd
                                    match card {
                                        0 => { np = 0 }
                                        1 => { np = 10; nd2 = 0 }
                                        _ => { }
                                    }
                                    if np == 30 { np = 10; nd2 = 0 }
                                    q[np * 3 + nd2] = q[np * 3 + nd2] + pr / 16.0
                                    card = card + 1
                                }
                                d2 = d2 + 1
                                continue
                            }
                            q[pos * 3 + nd] = q[pos * 3 + nd] + pr
                        }
                        d2 = d2 + 1
                    }
                    d1 = d1 + 1
                }
            }
            s = s + 1
        }
        memcpy(p, q, (NS as i64) * 8)
        iter = iter + 1
    }

    let visits: ptr<f64> = calloc(40, 8)
    if visits == null { return 1 }
    let mut i: i32 = 0
    while i < 40 {
        visits[i] = p[i * 3] + p[i * 3 + 1] + p[i * 3 + 2]
        i = i + 1
    }
    let mut a: i32 = 0
    let mut b: i32 = 1
    let mut c: i32 = 2
    if visits[b] > visits[a] {
        let t: i32 = a
        a = b
        b = t
    }
    if visits[c] > visits[a] {
        let t: i32 = a
        a = c
        c = t
    }
    if visits[c] > visits[b] {
        let t: i32 = b
        b = c
        c = t
    }
    i = 3
    while i < 40 {
        if visits[i] > visits[a] {
            c = b
            b = a
            a = i
        } elif visits[i] > visits[b] {
            c = b
            b = i
        } elif visits[i] > visits[c] {
            c = i
        }
        i = i + 1
    }
    printf("%lld\n", (a as i64) * 10000 + (b as i64) * 100 + (c as i64))
    free(p)
    free(q)
    free(visits)
    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 next_rail_i32(int32_t pos);
int32_t next_util_i32(int32_t pos);
int32_t main(void);




int32_t next_rail_i32(int32_t pos) {
    if (pos < 5) {
        return 5;
    }
    if (pos < 15) {
        return 15;
    }
    if (pos < 25) {
        return 25;
    }
    if (pos < 35) {
        return 35;
    }
    return 5;
}

int32_t next_util_i32(int32_t pos) {
    if (pos < 12) {
        return 12;
    }
    if (pos < 28) {
        return 28;
    }
    return 12;
}

int32_t main(void) {
    int32_t NS = 120;
    double* p = (double*)(calloc(((int64_t)(NS)), 8));
    double* q = (double*)(calloc(((int64_t)(NS)), 8));
    if ((p == NULL || q == NULL)) {
        return 1;
    }
    p[0] = 1.0;
    int32_t sides = 4;
    double die_n = ((double)((sides * sides)));
    int32_t iter = 0;
    while (iter < 200) {
        int32_t s = 0;
        while (s < NS) {
            q[s] = 0.0;
            s = (s + 1);
        }
        s = 0;
        while (s < NS) {
            double prob = p[s];
            if (prob > 0.0) {
                int32_t sq = FLOW_CHECKED_DIV((s), (3));
                int32_t dbl = FLOW_CHECKED_MOD((s), (3));
                int32_t d1 = 1;
                while (d1 <= sides) {
                    int32_t d2 = 1;
                    while (d2 <= sides) {
                        double pr = (prob / die_n);
                        bool is_dbl = d1 == d2;
                        if ((is_dbl && dbl == 2)) {
                            q[((10 * 3) + 0)] = (q[((10 * 3) + 0)] + pr);
                        } else {
                            int32_t nd = 0;
                            if (is_dbl) {
                                nd = (dbl + 1);
                            }
                            int32_t pos = FLOW_CHECKED_MOD((((sq + d1) + d2)), (40));
                            if (pos == 30) {
                                pos = 10;
                                nd = 0;
                            } else if (((pos == 7 || pos == 22) || pos == 36)) {
                                int32_t card = 0;
                                while (card < 16) {
                                    int32_t np = pos;
                                    int32_t nd2 = nd;
                                    { // match block
                                        if ((card) == 0) {
                                            np = 0;
                                        } else if ((card) == 1) {
                                            np = 10;
                                            nd2 = 0;
                                        } else if ((card) == 2) {
                                            np = 11;
                                        } else if ((card) == 3) {
                                            np = 24;
                                        } else if ((card) == 4) {
                                            np = 39;
                                        } else if ((card) == 5) {
                                            np = 5;
                                        } else if ((card) == 6 || (card) == 7) {
                                            np = next_rail_i32(pos);
                                        } else if ((card) == 8) {
                                            np = next_util_i32(pos);
                                        } else if ((card) == 9) {
                                            np = FLOW_CHECKED_MOD(((pos + 37)), (40));
                                            if (((np == 33 || np == 2) || np == 17)) {
                                                int32_t c2 = 0;
                                                while (c2 < 16) {
                                                    int32_t npp = np;
                                                    int32_t nd3 = nd2;
                                                    { // match block
                                                        if ((c2) == 0) {
                                                            npp = 0;
                                                        } else if ((c2) == 1) {
                                                            npp = 10;
                                                            nd3 = 0;
                                                        } else { // exhaustive
                                                        }
                                                    } // end match
                                                    if (npp == 30) {
                                                        npp = 10;
                                                        nd3 = 0;
                                                    }
                                                    q[((npp * 3) + nd3)] = (q[((npp * 3) + nd3)] + ((pr / 16.0) / 16.0));
                                                    c2 = (c2 + 1);
                                                }
                                                card = (card + 1);
                                                continue;
                                            }
                                        } else { // exhaustive
                                        }
                                    } // end match
                                    if (np == 30) {
                                        np = 10;
                                        nd2 = 0;
                                    }
                                    q[((np * 3) + nd2)] = (q[((np * 3) + nd2)] + (pr / 16.0));
                                    card = (card + 1);
                                }
                                d2 = (d2 + 1);
                                continue;
                            } else if (((pos == 2 || pos == 17) || pos == 33)) {
                                int32_t card = 0;
                                while (card < 16) {
                                    int32_t np = pos;
                                    int32_t nd2 = nd;
                                    { // match block
                                        if ((card) == 0) {
                                            np = 0;
                                        } else if ((card) == 1) {
                                            np = 10;
                                            nd2 = 0;
                                        } else { // exhaustive
                                        }
                                    } // end match
                                    if (np == 30) {
                                        np = 10;
                                        nd2 = 0;
                                    }
                                    q[((np * 3) + nd2)] = (q[((np * 3) + nd2)] + (pr / 16.0));
                                    card = (card + 1);
                                }
                                d2 = (d2 + 1);
                                continue;
                            }
                            q[((pos * 3) + nd)] = (q[((pos * 3) + nd)] + pr);
                        }
                        d2 = (d2 + 1);
                    }
                    d1 = (d1 + 1);
                }
            }
            s = (s + 1);
        }
        memcpy(p, q, (((int64_t)(NS)) * 8));
        iter = (iter + 1);
    }
    double* visits = (double*)(calloc(40, 8));
    if (visits == NULL) {
        return 1;
    }
    int32_t i = 0;
    while (i < 40) {
        visits[i] = ((p[(i * 3)] + p[((i * 3) + 1)]) + p[((i * 3) + 2)]);
        i = (i + 1);
    }
    int32_t a = 0;
    int32_t b = 1;
    int32_t c = 2;
    if (visits[b] > visits[a]) {
        int32_t t = a;
        a = b;
        b = t;
    }
    if (visits[c] > visits[a]) {
        int32_t t = a;
        a = c;
        c = t;
    }
    if (visits[c] > visits[b]) {
        int32_t t = b;
        b = c;
        c = t;
    }
    i = 3;
    while (i < 40) {
        if (visits[i] > visits[a]) {
            c = b;
            b = a;
            a = i;
        } else if (visits[i] > visits[b]) {
            c = b;
            b = i;
        } else if (visits[i] > visits[c]) {
            c = i;
        }
        i = (i + 1);
    }
    printf("%lld\n", (((((int64_t)(a)) * 10000) + (((int64_t)(b)) * 100)) + ((int64_t)(c))));
    free(p);
    free(q);
    free(visits);
    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 private @memcpy(!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
  func.func @next_rail(%arg0: i32) -> i32 {
    %0 = arith.constant 5 : i32
    %1 = arith.cmpi slt, %arg0, %0 : i32
    cf.cond_br %1, ^bb0, ^bb1
    ^bb0:
      %2 = arith.constant 5 : i32
      func.return %2 : i32
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %3 = arith.constant 15 : i32
    %4 = arith.cmpi slt, %arg0, %3 : i32
    cf.cond_br %4, ^bb3, ^bb4
    ^bb3:
      %5 = arith.constant 15 : i32
      func.return %5 : i32
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %6 = arith.constant 25 : i32
    %7 = arith.cmpi slt, %arg0, %6 : i32
    cf.cond_br %7, ^bb6, ^bb7
    ^bb6:
      %8 = arith.constant 25 : i32
      func.return %8 : i32
    ^bb7:
      cf.br ^bb8
    ^bb8:
    %9 = arith.constant 35 : i32
    %10 = arith.cmpi slt, %arg0, %9 : i32
    cf.cond_br %10, ^bb9, ^bb10
    ^bb9:
      %11 = arith.constant 35 : i32
      func.return %11 : i32
    ^bb10:
      cf.br ^bb11
    ^bb11:
    %12 = arith.constant 5 : i32
    func.return %12 : i32
  }
  func.func @next_util(%arg0: i32) -> i32 {
    %13 = arith.constant 12 : i32
    %14 = arith.cmpi slt, %arg0, %13 : i32
    cf.cond_br %14, ^bb12, ^bb13
    ^bb12:
      %15 = arith.constant 12 : i32
      func.return %15 : i32
    ^bb13:
      cf.br ^bb14
    ^bb14:
    %16 = arith.constant 28 : i32
    %17 = arith.cmpi slt, %arg0, %16 : i32
    cf.cond_br %17, ^bb15, ^bb16
    ^bb15:
      %18 = arith.constant 28 : i32
      func.return %18 : i32
    ^bb16:
      cf.br ^bb17
    ^bb17:
    %19 = arith.constant 12 : i32
    func.return %19 : i32
  }
  func.func @main() -> i32 {
    %20 = arith.constant 120 : i32
    %22 = arith.extsi %20 : i32 to i64
    %23 = arith.constant 8 : i32
    %24 = arith.extsi %23 : i32 to i64
    %21 = func.call @calloc(%22, %24) : (i64, i64) -> !llvm.ptr
    %26 = arith.extsi %20 : i32 to i64
    %27 = arith.constant 8 : i32
    %28 = arith.extsi %27 : i32 to i64
    %25 = func.call @calloc(%26, %28) : (i64, i64) -> !llvm.ptr
    %29 = llvm.mlir.zero : !llvm.ptr
    %30 = llvm.icmp "eq" %21, %29 : !llvm.ptr
    %31 = scf.if %30 -> (i1) {
      %32 = arith.constant true
      scf.yield %32 : i1
    } else {
      %33 = llvm.mlir.zero : !llvm.ptr
      %34 = llvm.icmp "eq" %25, %33 : !llvm.ptr
      scf.yield %34 : i1
    }
    cf.cond_br %31, ^bb18, ^bb19
    ^bb18:
      %35 = arith.constant 1 : i32
      func.return %35 : i32
    ^bb19:
      cf.br ^bb20
    ^bb20:
    %36 = arith.constant 1.0 : f32
    %37 = arith.constant 0 : i32
    %38 = arith.extf %36 : f32 to f64
    %39 = arith.extsi %37 : i32 to i64
    %40 = llvm.getelementptr %21[%39] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    llvm.store %38, %40 : f64, !llvm.ptr
    %41 = arith.constant 4 : i32
    %42 = arith.muli %41, %41 : i32
    %43 = arith.sitofp %42 : i32 to f64
    %44 = arith.constant 0 : i32
    %45 = llvm.mlir.constant(1 : i64) : i64
    %46 = llvm.alloca %45 x i32 : (i64) -> !llvm.ptr
    llvm.store %44, %46 : i32, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %47 = llvm.load %46 : !llvm.ptr -> i32
    %48 = arith.constant 200 : i32
    %49 = arith.cmpi slt, %47, %48 : i32
    cf.cond_br %49, ^bb22, ^bb23
    ^bb22:
      %50 = arith.constant 0 : i32
      %51 = llvm.mlir.constant(1 : i64) : i64
      %52 = llvm.alloca %51 x i32 : (i64) -> !llvm.ptr
      llvm.store %50, %52 : i32, !llvm.ptr
      cf.br ^bb24
      ^bb24:
      %53 = llvm.load %52 : !llvm.ptr -> i32
      %54 = arith.cmpi slt, %53, %20 : i32
      cf.cond_br %54, ^bb25, ^bb26
      ^bb25:
        %55 = arith.constant 0.0 : f32
        %56 = llvm.load %52 : !llvm.ptr -> i32
        %57 = arith.extf %55 : f32 to f64
        %58 = arith.extsi %56 : i32 to i64
        %59 = llvm.getelementptr %25[%58] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        llvm.store %57, %59 : f64, !llvm.ptr
        %60 = llvm.load %52 : !llvm.ptr -> i32
        %61 = arith.constant 1 : i32
        %62 = arith.addi %60, %61 : i32
        llvm.store %62, %52 : i32, !llvm.ptr
        cf.br ^bb24
      ^bb26:
      %63 = arith.constant 0 : i32
      llvm.store %63, %52 : i32, !llvm.ptr
      cf.br ^bb27
      ^bb27:
      %64 = llvm.load %52 : !llvm.ptr -> i32
      %65 = arith.cmpi slt, %64, %20 : i32
      cf.cond_br %65, ^bb28, ^bb29
      ^bb28:
        %67 = llvm.load %52 : !llvm.ptr -> i32
        %68 = arith.extsi %67 : i32 to i64
        %69 = llvm.getelementptr %21[%68] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        %66 = llvm.load %69 : !llvm.ptr -> f64
        %70 = arith.constant 0.0 : f32
        %72 = arith.extf %70 : f32 to f64
        %71 = arith.cmpf ogt, %66, %72 : f64
        cf.cond_br %71, ^bb30, ^bb31
        ^bb30:
          %73 = llvm.load %52 : !llvm.ptr -> i32
          %74 = arith.constant 3 : i32
          %75 = arith.divsi %73, %74 : i32
          %76 = llvm.load %52 : !llvm.ptr -> i32
          %77 = arith.constant 3 : i32
          %78 = arith.remsi %76, %77 : i32
          %79 = arith.constant 1 : i32
          %80 = llvm.mlir.constant(1 : i64) : i64
          %81 = llvm.alloca %80 x i32 : (i64) -> !llvm.ptr
          llvm.store %79, %81 : i32, !llvm.ptr
          cf.br ^bb33
          ^bb33:
          %82 = llvm.load %81 : !llvm.ptr -> i32
          %83 = arith.cmpi sle, %82, %41 : i32
          cf.cond_br %83, ^bb34, ^bb35
          ^bb34:
            %84 = arith.constant 1 : i32
            %85 = llvm.mlir.constant(1 : i64) : i64
            %86 = llvm.alloca %85 x i32 : (i64) -> !llvm.ptr
            llvm.store %84, %86 : i32, !llvm.ptr
            cf.br ^bb36
            ^bb36:
            %87 = llvm.load %86 : !llvm.ptr -> i32
            %88 = arith.cmpi sle, %87, %41 : i32
            cf.cond_br %88, ^bb37, ^bb38
            ^bb37:
              %89 = arith.divf %66, %43 : f64
              %90 = llvm.load %81 : !llvm.ptr -> i32
              %91 = llvm.load %86 : !llvm.ptr -> i32
              %92 = arith.cmpi eq, %90, %91 : i32
              %93 = scf.if %92 -> (i1) {
                %94 = arith.constant 2 : i32
                %95 = arith.cmpi eq, %78, %94 : i32
                scf.yield %95 : i1
              } else {
                %96 = arith.constant false
                scf.yield %96 : i1
              }
              cf.cond_br %93, ^bb39, ^bb40
              ^bb39:
                %98 = arith.constant 10 : i32
                %99 = arith.constant 3 : i32
                %100 = arith.muli %98, %99 : i32
                %101 = arith.constant 0 : i32
                %102 = arith.addi %100, %101 : i32
                %103 = arith.extsi %102 : i32 to i64
                %104 = llvm.getelementptr %25[%103] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                %97 = llvm.load %104 : !llvm.ptr -> f64
                %105 = arith.addf %97, %89 : f64
                %106 = arith.constant 10 : i32
                %107 = arith.constant 3 : i32
                %108 = arith.muli %106, %107 : i32
                %109 = arith.constant 0 : i32
                %110 = arith.addi %108, %109 : i32
                %111 = arith.extsi %110 : i32 to i64
                %112 = llvm.getelementptr %25[%111] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                llvm.store %105, %112 : f64, !llvm.ptr
                cf.br ^bb41
              ^bb40:
                %113 = arith.constant 0 : i32
                %114 = llvm.mlir.constant(1 : i64) : i64
                %115 = llvm.alloca %114 x i32 : (i64) -> !llvm.ptr
                llvm.store %113, %115 : i32, !llvm.ptr
                cf.cond_br %92, ^bb42, ^bb43
                ^bb42:
                  %116 = arith.constant 1 : i32
                  %117 = arith.addi %78, %116 : i32
                  llvm.store %117, %115 : i32, !llvm.ptr
                  cf.br ^bb44
                ^bb43:
                  cf.br ^bb44
                ^bb44:
                %118 = llvm.load %81 : !llvm.ptr -> i32
                %119 = arith.addi %75, %118 : i32
                %120 = llvm.load %86 : !llvm.ptr -> i32
                %121 = arith.addi %119, %120 : i32
                %122 = arith.constant 40 : i32
                %123 = arith.remsi %121, %122 : i32
                %124 = llvm.mlir.constant(1 : i64) : i64
                %125 = llvm.alloca %124 x i32 : (i64) -> !llvm.ptr
                llvm.store %123, %125 : i32, !llvm.ptr
                %126 = llvm.load %125 : !llvm.ptr -> i32
                %127 = arith.constant 30 : i32
                %128 = arith.cmpi eq, %126, %127 : i32
                cf.cond_br %128, ^bb45, ^bb46
                ^bb45:
                  %129 = arith.constant 10 : i32
                  llvm.store %129, %125 : i32, !llvm.ptr
                  %130 = arith.constant 0 : i32
                  llvm.store %130, %115 : i32, !llvm.ptr
                  cf.br ^bb47
                ^bb46:
                  %131 = llvm.load %125 : !llvm.ptr -> i32
                  %132 = arith.constant 7 : i32
                  %133 = arith.cmpi eq, %131, %132 : i32
                  %134 = scf.if %133 -> (i1) {
                    %135 = arith.constant true
                    scf.yield %135 : i1
                  } else {
                    %136 = llvm.load %125 : !llvm.ptr -> i32
                    %137 = arith.constant 22 : i32
                    %138 = arith.cmpi eq, %136, %137 : i32
                    scf.yield %138 : i1
                  }
                  %139 = scf.if %134 -> (i1) {
                    %140 = arith.constant true
                    scf.yield %140 : i1
                  } else {
                    %141 = llvm.load %125 : !llvm.ptr -> i32
                    %142 = arith.constant 36 : i32
                    %143 = arith.cmpi eq, %141, %142 : i32
                    scf.yield %143 : i1
                  }
                  cf.cond_br %139, ^bb49, ^bb48
                ^bb49:
                  %144 = arith.constant 0 : i32
                  %145 = llvm.mlir.constant(1 : i64) : i64
                  %146 = llvm.alloca %145 x i32 : (i64) -> !llvm.ptr
                  llvm.store %144, %146 : i32, !llvm.ptr
                  cf.br ^bb50
                  ^bb50:
                  %147 = llvm.load %146 : !llvm.ptr -> i32
                  %148 = arith.constant 16 : i32
                  %149 = arith.cmpi slt, %147, %148 : i32
                  cf.cond_br %149, ^bb51, ^bb52
                  ^bb51:
                    %150 = llvm.load %125 : !llvm.ptr -> i32
                    %151 = llvm.mlir.constant(1 : i64) : i64
                    %152 = llvm.alloca %151 x i32 : (i64) -> !llvm.ptr
                    llvm.store %150, %152 : i32, !llvm.ptr
                    %153 = llvm.load %115 : !llvm.ptr -> i32
                    %154 = llvm.mlir.constant(1 : i64) : i64
                    %155 = llvm.alloca %154 x i32 : (i64) -> !llvm.ptr
                    llvm.store %153, %155 : i32, !llvm.ptr
                    %156 = llvm.load %146 : !llvm.ptr -> i32
                    %157 = arith.constant 0 : i32
                    %158 = arith.cmpi eq, %156, %157 : i32
                    cf.cond_br %158, ^bb53, ^bb54
^bb53:
                      %159 = arith.constant 0 : i32
                      llvm.store %159, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb54:
                    %160 = arith.constant 1 : i32
                    %161 = arith.cmpi eq, %156, %160 : i32
                    cf.cond_br %161, ^bb55, ^bb56
^bb55:
                      %162 = arith.constant 10 : i32
                      llvm.store %162, %152 : i32, !llvm.ptr
                      %163 = arith.constant 0 : i32
                      llvm.store %163, %155 : i32, !llvm.ptr
                      cf.br ^bb75
^bb56:
                    %164 = arith.constant 2 : i32
                    %165 = arith.cmpi eq, %156, %164 : i32
                    cf.cond_br %165, ^bb57, ^bb58
^bb57:
                      %166 = arith.constant 11 : i32
                      llvm.store %166, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb58:
                    %167 = arith.constant 3 : i32
                    %168 = arith.cmpi eq, %156, %167 : i32
                    cf.cond_br %168, ^bb59, ^bb60
^bb59:
                      %169 = arith.constant 24 : i32
                      llvm.store %169, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb60:
                    %170 = arith.constant 4 : i32
                    %171 = arith.cmpi eq, %156, %170 : i32
                    cf.cond_br %171, ^bb61, ^bb62
^bb61:
                      %172 = arith.constant 39 : i32
                      llvm.store %172, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb62:
                    %173 = arith.constant 5 : i32
                    %174 = arith.cmpi eq, %156, %173 : i32
                    cf.cond_br %174, ^bb63, ^bb64
^bb63:
                      %175 = arith.constant 5 : i32
                      llvm.store %175, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb64:
                    %176 = arith.constant 6 : i32
                    %177 = arith.cmpi eq, %156, %176 : i32
                    cf.cond_br %177, ^bb65, ^bb66
^bb65:
                      %179 = llvm.load %125 : !llvm.ptr -> i32
                      %178 = func.call @next_rail(%179) : (i32) -> i32
                      llvm.store %178, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb66:
                    %180 = arith.constant 7 : i32
                    %181 = arith.cmpi eq, %156, %180 : i32
                    cf.cond_br %181, ^bb67, ^bb68
^bb67:
                      %183 = llvm.load %125 : !llvm.ptr -> i32
                      %182 = func.call @next_rail(%183) : (i32) -> i32
                      llvm.store %182, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb68:
                    %184 = arith.constant 8 : i32
                    %185 = arith.cmpi eq, %156, %184 : i32
                    cf.cond_br %185, ^bb69, ^bb70
^bb69:
                      %187 = llvm.load %125 : !llvm.ptr -> i32
                      %186 = func.call @next_util(%187) : (i32) -> i32
                      llvm.store %186, %152 : i32, !llvm.ptr
                      cf.br ^bb75
^bb70:
                    %188 = arith.constant 9 : i32
                    %189 = arith.cmpi eq, %156, %188 : i32
                    cf.cond_br %189, ^bb71, ^bb72
^bb71:
                      %190 = llvm.load %125 : !llvm.ptr -> i32
                      %191 = arith.constant 37 : i32
                      %192 = arith.addi %190, %191 : i32
                      %193 = arith.constant 40 : i32
                      %194 = arith.remsi %192, %193 : i32
                      llvm.store %194, %152 : i32, !llvm.ptr
                      %195 = llvm.load %152 : !llvm.ptr -> i32
                      %196 = arith.constant 33 : i32
                      %197 = arith.cmpi eq, %195, %196 : i32
                      %198 = scf.if %197 -> (i1) {
                        %199 = arith.constant true
                        scf.yield %199 : i1
                      } else {
                        %200 = llvm.load %152 : !llvm.ptr -> i32
                        %201 = arith.constant 2 : i32
                        %202 = arith.cmpi eq, %200, %201 : i32
                        scf.yield %202 : i1
                      }
                      %203 = scf.if %198 -> (i1) {
                        %204 = arith.constant true
                        scf.yield %204 : i1
                      } else {
                        %205 = llvm.load %152 : !llvm.ptr -> i32
                        %206 = arith.constant 17 : i32
                        %207 = arith.cmpi eq, %205, %206 : i32
                        scf.yield %207 : i1
                      }
                      cf.cond_br %203, ^bb76, ^bb77
                      ^bb76:
                        %208 = arith.constant 0 : i32
                        %209 = llvm.mlir.constant(1 : i64) : i64
                        %210 = llvm.alloca %209 x i32 : (i64) -> !llvm.ptr
                        llvm.store %208, %210 : i32, !llvm.ptr
                        cf.br ^bb79
                        ^bb79:
                        %211 = llvm.load %210 : !llvm.ptr -> i32
                        %212 = arith.constant 16 : i32
                        %213 = arith.cmpi slt, %211, %212 : i32
                        cf.cond_br %213, ^bb80, ^bb81
                        ^bb80:
                          %214 = llvm.load %152 : !llvm.ptr -> i32
                          %215 = llvm.mlir.constant(1 : i64) : i64
                          %216 = llvm.alloca %215 x i32 : (i64) -> !llvm.ptr
                          llvm.store %214, %216 : i32, !llvm.ptr
                          %217 = llvm.load %155 : !llvm.ptr -> i32
                          %218 = llvm.mlir.constant(1 : i64) : i64
                          %219 = llvm.alloca %218 x i32 : (i64) -> !llvm.ptr
                          llvm.store %217, %219 : i32, !llvm.ptr
                          %220 = llvm.load %210 : !llvm.ptr -> i32
                          %221 = arith.constant 0 : i32
                          %222 = arith.cmpi eq, %220, %221 : i32
                          cf.cond_br %222, ^bb82, ^bb83
^bb82:
                            %223 = arith.constant 0 : i32
                            llvm.store %223, %216 : i32, !llvm.ptr
                            cf.br ^bb88
^bb83:
                          %224 = arith.constant 1 : i32
                          %225 = arith.cmpi eq, %220, %224 : i32
                          cf.cond_br %225, ^bb84, ^bb85
^bb84:
                            %226 = arith.constant 10 : i32
                            llvm.store %226, %216 : i32, !llvm.ptr
                            %227 = arith.constant 0 : i32
                            llvm.store %227, %219 : i32, !llvm.ptr
                            cf.br ^bb88
^bb85:
                          %228 = arith.constant 1 : i1
                          cf.cond_br %228, ^bb86, ^bb87
^bb86:
                            cf.br ^bb88
^bb87:
                          cf.br ^bb88
^bb88:
                          %229 = llvm.load %216 : !llvm.ptr -> i32
                          %230 = arith.constant 30 : i32
                          %231 = arith.cmpi eq, %229, %230 : i32
                          cf.cond_br %231, ^bb89, ^bb90
                          ^bb89:
                            %232 = arith.constant 10 : i32
                            llvm.store %232, %216 : i32, !llvm.ptr
                            %233 = arith.constant 0 : i32
                            llvm.store %233, %219 : i32, !llvm.ptr
                            cf.br ^bb91
                          ^bb90:
                            cf.br ^bb91
                          ^bb91:
                          %235 = llvm.load %216 : !llvm.ptr -> i32
                          %236 = arith.constant 3 : i32
                          %237 = arith.muli %235, %236 : i32
                          %238 = llvm.load %219 : !llvm.ptr -> i32
                          %239 = arith.addi %237, %238 : i32
                          %240 = arith.extsi %239 : i32 to i64
                          %241 = llvm.getelementptr %25[%240] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                          %234 = llvm.load %241 : !llvm.ptr -> f64
                          %242 = arith.constant 16.0 : f32
                          %244 = arith.extf %242 : f32 to f64
                          %243 = arith.divf %89, %244 : f64
                          %245 = arith.constant 16.0 : f32
                          %247 = arith.extf %245 : f32 to f64
                          %246 = arith.divf %243, %247 : f64
                          %248 = arith.addf %234, %246 : f64
                          %249 = llvm.load %216 : !llvm.ptr -> i32
                          %250 = arith.constant 3 : i32
                          %251 = arith.muli %249, %250 : i32
                          %252 = llvm.load %219 : !llvm.ptr -> i32
                          %253 = arith.addi %251, %252 : i32
                          %254 = arith.extsi %253 : i32 to i64
                          %255 = llvm.getelementptr %25[%254] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                          llvm.store %248, %255 : f64, !llvm.ptr
                          %256 = llvm.load %210 : !llvm.ptr -> i32
                          %257 = arith.constant 1 : i32
                          %258 = arith.addi %256, %257 : i32
                          llvm.store %258, %210 : i32, !llvm.ptr
                          cf.br ^bb79
                        ^bb81:
                        %259 = llvm.load %146 : !llvm.ptr -> i32
                        %260 = arith.constant 1 : i32
                        %261 = arith.addi %259, %260 : i32
                        llvm.store %261, %146 : i32, !llvm.ptr
                        cf.br ^bb50
                      ^bb77:
                        cf.br ^bb78
                      ^bb78:
                      cf.br ^bb75
^bb72:
                    %262 = arith.constant 1 : i1
                    cf.cond_br %262, ^bb73, ^bb74
^bb73:
                      cf.br ^bb75
^bb74:
                    cf.br ^bb75
^bb75:
                    %263 = llvm.load %152 : !llvm.ptr -> i32
                    %264 = arith.constant 30 : i32
                    %265 = arith.cmpi eq, %263, %264 : i32
                    cf.cond_br %265, ^bb92, ^bb93
                    ^bb92:
                      %266 = arith.constant 10 : i32
                      llvm.store %266, %152 : i32, !llvm.ptr
                      %267 = arith.constant 0 : i32
                      llvm.store %267, %155 : i32, !llvm.ptr
                      cf.br ^bb94
                    ^bb93:
                      cf.br ^bb94
                    ^bb94:
                    %269 = llvm.load %152 : !llvm.ptr -> i32
                    %270 = arith.constant 3 : i32
                    %271 = arith.muli %269, %270 : i32
                    %272 = llvm.load %155 : !llvm.ptr -> i32
                    %273 = arith.addi %271, %272 : i32
                    %274 = arith.extsi %273 : i32 to i64
                    %275 = llvm.getelementptr %25[%274] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                    %268 = llvm.load %275 : !llvm.ptr -> f64
                    %276 = arith.constant 16.0 : f32
                    %278 = arith.extf %276 : f32 to f64
                    %277 = arith.divf %89, %278 : f64
                    %279 = arith.addf %268, %277 : f64
                    %280 = llvm.load %152 : !llvm.ptr -> i32
                    %281 = arith.constant 3 : i32
                    %282 = arith.muli %280, %281 : i32
                    %283 = llvm.load %155 : !llvm.ptr -> i32
                    %284 = arith.addi %282, %283 : i32
                    %285 = arith.extsi %284 : i32 to i64
                    %286 = llvm.getelementptr %25[%285] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                    llvm.store %279, %286 : f64, !llvm.ptr
                    %287 = llvm.load %146 : !llvm.ptr -> i32
                    %288 = arith.constant 1 : i32
                    %289 = arith.addi %287, %288 : i32
                    llvm.store %289, %146 : i32, !llvm.ptr
                    cf.br ^bb50
                  ^bb52:
                  %290 = llvm.load %86 : !llvm.ptr -> i32
                  %291 = arith.constant 1 : i32
                  %292 = arith.addi %290, %291 : i32
                  llvm.store %292, %86 : i32, !llvm.ptr
                  cf.br ^bb36
                ^bb48:
                  %293 = llvm.load %125 : !llvm.ptr -> i32
                  %294 = arith.constant 2 : i32
                  %295 = arith.cmpi eq, %293, %294 : i32
                  %296 = scf.if %295 -> (i1) {
                    %297 = arith.constant true
                    scf.yield %297 : i1
                  } else {
                    %298 = llvm.load %125 : !llvm.ptr -> i32
                    %299 = arith.constant 17 : i32
                    %300 = arith.cmpi eq, %298, %299 : i32
                    scf.yield %300 : i1
                  }
                  %301 = scf.if %296 -> (i1) {
                    %302 = arith.constant true
                    scf.yield %302 : i1
                  } else {
                    %303 = llvm.load %125 : !llvm.ptr -> i32
                    %304 = arith.constant 33 : i32
                    %305 = arith.cmpi eq, %303, %304 : i32
                    scf.yield %305 : i1
                  }
                  cf.cond_br %301, ^bb95, ^bb47
                ^bb95:
                  %306 = arith.constant 0 : i32
                  %307 = llvm.mlir.constant(1 : i64) : i64
                  %308 = llvm.alloca %307 x i32 : (i64) -> !llvm.ptr
                  llvm.store %306, %308 : i32, !llvm.ptr
                  cf.br ^bb96
                  ^bb96:
                  %309 = llvm.load %308 : !llvm.ptr -> i32
                  %310 = arith.constant 16 : i32
                  %311 = arith.cmpi slt, %309, %310 : i32
                  cf.cond_br %311, ^bb97, ^bb98
                  ^bb97:
                    %312 = llvm.load %125 : !llvm.ptr -> i32
                    %313 = llvm.mlir.constant(1 : i64) : i64
                    %314 = llvm.alloca %313 x i32 : (i64) -> !llvm.ptr
                    llvm.store %312, %314 : i32, !llvm.ptr
                    %315 = llvm.load %115 : !llvm.ptr -> i32
                    %316 = llvm.mlir.constant(1 : i64) : i64
                    %317 = llvm.alloca %316 x i32 : (i64) -> !llvm.ptr
                    llvm.store %315, %317 : i32, !llvm.ptr
                    %318 = llvm.load %308 : !llvm.ptr -> i32
                    %319 = arith.constant 0 : i32
                    %320 = arith.cmpi eq, %318, %319 : i32
                    cf.cond_br %320, ^bb99, ^bb100
^bb99:
                      %321 = arith.constant 0 : i32
                      llvm.store %321, %314 : i32, !llvm.ptr
                      cf.br ^bb105
^bb100:
                    %322 = arith.constant 1 : i32
                    %323 = arith.cmpi eq, %318, %322 : i32
                    cf.cond_br %323, ^bb101, ^bb102
^bb101:
                      %324 = arith.constant 10 : i32
                      llvm.store %324, %314 : i32, !llvm.ptr
                      %325 = arith.constant 0 : i32
                      llvm.store %325, %317 : i32, !llvm.ptr
                      cf.br ^bb105
^bb102:
                    %326 = arith.constant 1 : i1
                    cf.cond_br %326, ^bb103, ^bb104
^bb103:
                      cf.br ^bb105
^bb104:
                    cf.br ^bb105
^bb105:
                    %327 = llvm.load %314 : !llvm.ptr -> i32
                    %328 = arith.constant 30 : i32
                    %329 = arith.cmpi eq, %327, %328 : i32
                    cf.cond_br %329, ^bb106, ^bb107
                    ^bb106:
                      %330 = arith.constant 10 : i32
                      llvm.store %330, %314 : i32, !llvm.ptr
                      %331 = arith.constant 0 : i32
                      llvm.store %331, %317 : i32, !llvm.ptr
                      cf.br ^bb108
                    ^bb107:
                      cf.br ^bb108
                    ^bb108:
                    %333 = llvm.load %314 : !llvm.ptr -> i32
                    %334 = arith.constant 3 : i32
                    %335 = arith.muli %333, %334 : i32
                    %336 = llvm.load %317 : !llvm.ptr -> i32
                    %337 = arith.addi %335, %336 : i32
                    %338 = arith.extsi %337 : i32 to i64
                    %339 = llvm.getelementptr %25[%338] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                    %332 = llvm.load %339 : !llvm.ptr -> f64
                    %340 = arith.constant 16.0 : f32
                    %342 = arith.extf %340 : f32 to f64
                    %341 = arith.divf %89, %342 : f64
                    %343 = arith.addf %332, %341 : f64
                    %344 = llvm.load %314 : !llvm.ptr -> i32
                    %345 = arith.constant 3 : i32
                    %346 = arith.muli %344, %345 : i32
                    %347 = llvm.load %317 : !llvm.ptr -> i32
                    %348 = arith.addi %346, %347 : i32
                    %349 = arith.extsi %348 : i32 to i64
                    %350 = llvm.getelementptr %25[%349] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                    llvm.store %343, %350 : f64, !llvm.ptr
                    %351 = llvm.load %308 : !llvm.ptr -> i32
                    %352 = arith.constant 1 : i32
                    %353 = arith.addi %351, %352 : i32
                    llvm.store %353, %308 : i32, !llvm.ptr
                    cf.br ^bb96
                  ^bb98:
                  %354 = llvm.load %86 : !llvm.ptr -> i32
                  %355 = arith.constant 1 : i32
                  %356 = arith.addi %354, %355 : i32
                  llvm.store %356, %86 : i32, !llvm.ptr
                  cf.br ^bb36
                ^bb47:
                %358 = llvm.load %125 : !llvm.ptr -> i32
                %359 = arith.constant 3 : i32
                %360 = arith.muli %358, %359 : i32
                %361 = llvm.load %115 : !llvm.ptr -> i32
                %362 = arith.addi %360, %361 : i32
                %363 = arith.extsi %362 : i32 to i64
                %364 = llvm.getelementptr %25[%363] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                %357 = llvm.load %364 : !llvm.ptr -> f64
                %365 = arith.addf %357, %89 : f64
                %366 = llvm.load %125 : !llvm.ptr -> i32
                %367 = arith.constant 3 : i32
                %368 = arith.muli %366, %367 : i32
                %369 = llvm.load %115 : !llvm.ptr -> i32
                %370 = arith.addi %368, %369 : i32
                %371 = arith.extsi %370 : i32 to i64
                %372 = llvm.getelementptr %25[%371] : (!llvm.ptr, i64) -> !llvm.ptr, f64
                llvm.store %365, %372 : f64, !llvm.ptr
                cf.br ^bb41
              ^bb41:
              %373 = llvm.load %86 : !llvm.ptr -> i32
              %374 = arith.constant 1 : i32
              %375 = arith.addi %373, %374 : i32
              llvm.store %375, %86 : i32, !llvm.ptr
              cf.br ^bb36
            ^bb38:
            %376 = llvm.load %81 : !llvm.ptr -> i32
            %377 = arith.constant 1 : i32
            %378 = arith.addi %376, %377 : i32
            llvm.store %378, %81 : i32, !llvm.ptr
            cf.br ^bb33
          ^bb35:
          cf.br ^bb32
        ^bb31:
          cf.br ^bb32
        ^bb32:
        %379 = llvm.load %52 : !llvm.ptr -> i32
        %380 = arith.constant 1 : i32
        %381 = arith.addi %379, %380 : i32
        llvm.store %381, %52 : i32, !llvm.ptr
        cf.br ^bb27
      ^bb29:
      %383 = arith.extsi %20 : i32 to i64
      %384 = arith.constant 8 : i32
      %386 = arith.extsi %384 : i32 to i64
      %385 = arith.muli %383, %386 : i64
      %382 = func.call @memcpy(%21, %25, %385) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
      %387 = llvm.load %46 : !llvm.ptr -> i32
      %388 = arith.constant 1 : i32
      %389 = arith.addi %387, %388 : i32
      llvm.store %389, %46 : i32, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %391 = arith.constant 40 : i32
    %392 = arith.constant 8 : i32
    %393 = arith.extsi %391 : i32 to i64
    %394 = arith.extsi %392 : i32 to i64
    %390 = func.call @calloc(%393, %394) : (i64, i64) -> !llvm.ptr
    %395 = llvm.mlir.zero : !llvm.ptr
    %396 = llvm.icmp "eq" %390, %395 : !llvm.ptr
    cf.cond_br %396, ^bb109, ^bb110
    ^bb109:
      %397 = arith.constant 1 : i32
      func.return %397 : i32
    ^bb110:
      cf.br ^bb111
    ^bb111:
    %398 = arith.constant 0 : i32
    %399 = llvm.mlir.constant(1 : i64) : i64
    %400 = llvm.alloca %399 x i32 : (i64) -> !llvm.ptr
    llvm.store %398, %400 : i32, !llvm.ptr
    cf.br ^bb112
    ^bb112:
    %401 = llvm.load %400 : !llvm.ptr -> i32
    %402 = arith.constant 40 : i32
    %403 = arith.cmpi slt, %401, %402 : i32
    cf.cond_br %403, ^bb113, ^bb114
    ^bb113:
      %405 = llvm.load %400 : !llvm.ptr -> i32
      %406 = arith.constant 3 : i32
      %407 = arith.muli %405, %406 : i32
      %408 = arith.extsi %407 : i32 to i64
      %409 = llvm.getelementptr %21[%408] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %404 = llvm.load %409 : !llvm.ptr -> f64
      %411 = llvm.load %400 : !llvm.ptr -> i32
      %412 = arith.constant 3 : i32
      %413 = arith.muli %411, %412 : i32
      %414 = arith.constant 1 : i32
      %415 = arith.addi %413, %414 : i32
      %416 = arith.extsi %415 : i32 to i64
      %417 = llvm.getelementptr %21[%416] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %410 = llvm.load %417 : !llvm.ptr -> f64
      %418 = arith.addf %404, %410 : f64
      %420 = llvm.load %400 : !llvm.ptr -> i32
      %421 = arith.constant 3 : i32
      %422 = arith.muli %420, %421 : i32
      %423 = arith.constant 2 : i32
      %424 = arith.addi %422, %423 : i32
      %425 = arith.extsi %424 : i32 to i64
      %426 = llvm.getelementptr %21[%425] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %419 = llvm.load %426 : !llvm.ptr -> f64
      %427 = arith.addf %418, %419 : f64
      %428 = llvm.load %400 : !llvm.ptr -> i32
      %429 = arith.extsi %428 : i32 to i64
      %430 = llvm.getelementptr %390[%429] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %427, %430 : f64, !llvm.ptr
      %431 = llvm.load %400 : !llvm.ptr -> i32
      %432 = arith.constant 1 : i32
      %433 = arith.addi %431, %432 : i32
      llvm.store %433, %400 : i32, !llvm.ptr
      cf.br ^bb112
    ^bb114:
    %434 = arith.constant 0 : i32
    %435 = llvm.mlir.constant(1 : i64) : i64
    %436 = llvm.alloca %435 x i32 : (i64) -> !llvm.ptr
    llvm.store %434, %436 : i32, !llvm.ptr
    %437 = arith.constant 1 : i32
    %438 = llvm.mlir.constant(1 : i64) : i64
    %439 = llvm.alloca %438 x i32 : (i64) -> !llvm.ptr
    llvm.store %437, %439 : i32, !llvm.ptr
    %440 = arith.constant 2 : i32
    %441 = llvm.mlir.constant(1 : i64) : i64
    %442 = llvm.alloca %441 x i32 : (i64) -> !llvm.ptr
    llvm.store %440, %442 : i32, !llvm.ptr
    %444 = llvm.load %439 : !llvm.ptr -> i32
    %445 = arith.extsi %444 : i32 to i64
    %446 = llvm.getelementptr %390[%445] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %443 = llvm.load %446 : !llvm.ptr -> f64
    %448 = llvm.load %436 : !llvm.ptr -> i32
    %449 = arith.extsi %448 : i32 to i64
    %450 = llvm.getelementptr %390[%449] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %447 = llvm.load %450 : !llvm.ptr -> f64
    %451 = arith.cmpf ogt, %443, %447 : f64
    cf.cond_br %451, ^bb115, ^bb116
    ^bb115:
      %452 = llvm.load %436 : !llvm.ptr -> i32
      %453 = llvm.load %439 : !llvm.ptr -> i32
      llvm.store %453, %436 : i32, !llvm.ptr
      llvm.store %452, %439 : i32, !llvm.ptr
      cf.br ^bb117
    ^bb116:
      cf.br ^bb117
    ^bb117:
    %455 = llvm.load %442 : !llvm.ptr -> i32
    %456 = arith.extsi %455 : i32 to i64
    %457 = llvm.getelementptr %390[%456] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %454 = llvm.load %457 : !llvm.ptr -> f64
    %459 = llvm.load %436 : !llvm.ptr -> i32
    %460 = arith.extsi %459 : i32 to i64
    %461 = llvm.getelementptr %390[%460] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %458 = llvm.load %461 : !llvm.ptr -> f64
    %462 = arith.cmpf ogt, %454, %458 : f64
    cf.cond_br %462, ^bb118, ^bb119
    ^bb118:
      %463 = llvm.load %436 : !llvm.ptr -> i32
      %464 = llvm.load %442 : !llvm.ptr -> i32
      llvm.store %464, %436 : i32, !llvm.ptr
      llvm.store %463, %442 : i32, !llvm.ptr
      cf.br ^bb120
    ^bb119:
      cf.br ^bb120
    ^bb120:
    %466 = llvm.load %442 : !llvm.ptr -> i32
    %467 = arith.extsi %466 : i32 to i64
    %468 = llvm.getelementptr %390[%467] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %465 = llvm.load %468 : !llvm.ptr -> f64
    %470 = llvm.load %439 : !llvm.ptr -> i32
    %471 = arith.extsi %470 : i32 to i64
    %472 = llvm.getelementptr %390[%471] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %469 = llvm.load %472 : !llvm.ptr -> f64
    %473 = arith.cmpf ogt, %465, %469 : f64
    cf.cond_br %473, ^bb121, ^bb122
    ^bb121:
      %474 = llvm.load %439 : !llvm.ptr -> i32
      %475 = llvm.load %442 : !llvm.ptr -> i32
      llvm.store %475, %439 : i32, !llvm.ptr
      llvm.store %474, %442 : i32, !llvm.ptr
      cf.br ^bb123
    ^bb122:
      cf.br ^bb123
    ^bb123:
    %476 = arith.constant 3 : i32
    llvm.store %476, %400 : i32, !llvm.ptr
    cf.br ^bb124
    ^bb124:
    %477 = llvm.load %400 : !llvm.ptr -> i32
    %478 = arith.constant 40 : i32
    %479 = arith.cmpi slt, %477, %478 : i32
    cf.cond_br %479, ^bb125, ^bb126
    ^bb125:
      %481 = llvm.load %400 : !llvm.ptr -> i32
      %482 = arith.extsi %481 : i32 to i64
      %483 = llvm.getelementptr %390[%482] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %480 = llvm.load %483 : !llvm.ptr -> f64
      %485 = llvm.load %436 : !llvm.ptr -> i32
      %486 = arith.extsi %485 : i32 to i64
      %487 = llvm.getelementptr %390[%486] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %484 = llvm.load %487 : !llvm.ptr -> f64
      %488 = arith.cmpf ogt, %480, %484 : f64
      cf.cond_br %488, ^bb127, ^bb128
      ^bb127:
        %489 = llvm.load %439 : !llvm.ptr -> i32
        llvm.store %489, %442 : i32, !llvm.ptr
        %490 = llvm.load %436 : !llvm.ptr -> i32
        llvm.store %490, %439 : i32, !llvm.ptr
        %491 = llvm.load %400 : !llvm.ptr -> i32
        llvm.store %491, %436 : i32, !llvm.ptr
        cf.br ^bb129
      ^bb128:
        %493 = llvm.load %400 : !llvm.ptr -> i32
        %494 = arith.extsi %493 : i32 to i64
        %495 = llvm.getelementptr %390[%494] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        %492 = llvm.load %495 : !llvm.ptr -> f64
        %497 = llvm.load %439 : !llvm.ptr -> i32
        %498 = arith.extsi %497 : i32 to i64
        %499 = llvm.getelementptr %390[%498] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        %496 = llvm.load %499 : !llvm.ptr -> f64
        %500 = arith.cmpf ogt, %492, %496 : f64
        cf.cond_br %500, ^bb131, ^bb130
      ^bb131:
        %501 = llvm.load %439 : !llvm.ptr -> i32
        llvm.store %501, %442 : i32, !llvm.ptr
        %502 = llvm.load %400 : !llvm.ptr -> i32
        llvm.store %502, %439 : i32, !llvm.ptr
        cf.br ^bb129
      ^bb130:
        %504 = llvm.load %400 : !llvm.ptr -> i32
        %505 = arith.extsi %504 : i32 to i64
        %506 = llvm.getelementptr %390[%505] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        %503 = llvm.load %506 : !llvm.ptr -> f64
        %508 = llvm.load %442 : !llvm.ptr -> i32
        %509 = arith.extsi %508 : i32 to i64
        %510 = llvm.getelementptr %390[%509] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        %507 = llvm.load %510 : !llvm.ptr -> f64
        %511 = arith.cmpf ogt, %503, %507 : f64
        cf.cond_br %511, ^bb132, ^bb129
      ^bb132:
        %512 = llvm.load %400 : !llvm.ptr -> i32
        llvm.store %512, %442 : i32, !llvm.ptr
        cf.br ^bb129
      ^bb129:
      %513 = llvm.load %400 : !llvm.ptr -> i32
      %514 = arith.constant 1 : i32
      %515 = arith.addi %513, %514 : i32
      llvm.store %515, %400 : i32, !llvm.ptr
      cf.br ^bb124
    ^bb126:
    %516 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %517 = llvm.load %436 : !llvm.ptr -> i32
    %518 = arith.extsi %517 : i32 to i64
    %519 = arith.constant 10000 : i32
    %521 = arith.extsi %519 : i32 to i64
    %520 = arith.muli %518, %521 : i64
    %522 = llvm.load %439 : !llvm.ptr -> i32
    %523 = arith.extsi %522 : i32 to i64
    %524 = arith.constant 100 : i32
    %526 = arith.extsi %524 : i32 to i64
    %525 = arith.muli %523, %526 : i64
    %527 = arith.addi %520, %525 : i64
    %528 = llvm.load %442 : !llvm.ptr -> i32
    %529 = arith.extsi %528 : i32 to i64
    %530 = arith.addi %527, %529 : i64
    %531 = llvm.call @printf(%516, %530) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%21) : (!llvm.ptr) -> ()
    func.call @free(%25) : (!llvm.ptr) -> ()
    func.call @free(%390) : (!llvm.ptr) -> ()
    %535 = arith.constant 0 : i32
    func.return %535 : i32
  }
}