Problem 848

Guessing with Sets - sum of p(7^i, 5^j) for i,j=0..20, rounded to 8 decimals. Uses i128 for exact fraction arithmetic, converts to double at the end. next_pow2_times3: returns (T, p) where p is smallest power of 2 with 3*p >= x, T = 3*p

Answer188.45503259
Output188.45503259
StatusPASS
Native helperno
Runtime0 ms
Peak memory1072 KB
Time complexityO(n^2) (estimated)
Space complexityO(1) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n log log n)
Space complexityO(1)O(n)
ApproachFlow solutionSieve or enumeration
VerdictSuboptimal

Flow source

# Project Euler 848
# Guessing with Sets - sum of p(7^i, 5^j) for i,j=0..20, rounded to 8 decimals.
# Uses i128 for exact fraction arithmetic, converts to double at the end.

# next_pow2_times3: returns (T, p) where p is smallest power of 2 with 3*p >= x, T = 3*p
function next_pow2_times3(x: i64, T_out: ptr<i64>, p_out: ptr<i64>) -> void {
    let mut p: i64 = 1
    while 3 * p < x {
        p = p << 1
    }
    T_out[0] = 3 * p
    p_out[0] = p
}

# Compute p(m, n) as an exact fraction (num/den) using i128.
# Returns 1 if a closed form applies, 0 if the recurrence would be needed.
# For the target (7^i, 5^j), closed forms always apply.
function p_fraction(m: i64, n: i64, num_out: ptr<i128>, den_out: ptr<i128>) -> i32 {
    if m == 1 {
        num_out[0] = (1 as i128)
        den_out[0] = (1 as i128)
        return 1
    }
    if n == 1 {
        num_out[0] = (1 as i128)
        den_out[0] = (m as i128)
        return 1
    }
    if n == 2 {
        num_out[0] = (3 as i128)
        den_out[0] = (2 as i128) * (m as i128)
        return 1
    }
    if m == 2 {
        num_out[0] = (2 * n - 1) as i128
        den_out[0] = (2 * n) as i128
        return 1
    }
    if m == 3 {
        num_out[0] = (n - 1) as i128
        den_out[0] = (n as i128)
        return 1
    }

    # High-n region
    let Tm: i64 = 0
    let pm: i64 = 0
    next_pow2_times3(m, &Tm, &pm)
    if pm >= 2 {
        let L: i64 = 3 * (pm >> 1)
        if n >= L {
            # p = 1 - L*(m - pm) / (m*n) = (m*n - L*(m - pm)) / (m*n)
            let mn: i128 = (m as i128) * (n as i128)
            let sub: i128 = (L as i128) * ((m - pm) as i128)
            num_out[0] = mn - sub
            den_out[0] = mn
            return 1
        }
    }

    # High-m region
    let Tn: i64 = 0
    let pn: i64 = 0
    next_pow2_times3(n, &Tn, &pn)
    if n >= 3 && m >= Tn {
        # p = Tn * (n - pn) / (n * m)
        num_out[0] = (Tn as i128) * ((n - pn) as i128)
        den_out[0] = (n as i128) * (m as i128)
        return 1
    }

    # Recurrence would be needed - but for (7^i, 5^j) this never happens.
    return 0
}

function main() -> i32 {
    # Precompute powers of 7 and 5
    let pow7: array<i64, 21> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    let pow5: array<i64, 21> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    pow7[0] = 1
    let mut i: i32 = 1
    while i <= 20 {
        pow7[i] = pow7[i - 1] * 7
        i = i + 1
    }
    pow5[0] = 1
    let mut j: i32 = 1
    while j <= 20 {
        pow5[j] = pow5[j - 1] * 5
        j = j + 1
    }

    let mut total: f64 = 0.0

    let mut ii: i32 = 0
    while ii <= 20 {
        let mut jj: i32 = 0
        while jj <= 20 {
            let m: i64 = pow7[ii]
            let n: i64 = pow5[jj]

            let num: i128 = (0 as i128)
            let den: i128 = (0 as i128)
            let ok: i32 = p_fraction(m, n, &num, &den)
            if ok != 0 {
                total = total + (num as f64) / (den as f64)
            }
            jj = jj + 1
        }
        ii = ii + 1
    }

    printf("%.8f\n", total)
    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; }

void next_pow2_times3_i64_ptr_i64_ptr_i64(int64_t x, int64_t* T_out, int64_t* p_out);
int32_t p_fraction_i64_i64_ptr_i128_ptr_i128(int64_t m, int64_t n, __int128* num_out, __int128* den_out);
int32_t main(void);

void next_pow2_times3_i64_ptr_i64_ptr_i64(int64_t x, int64_t* T_out, int64_t* p_out) {
    int64_t p = 1;
    while ((3 * p) < x) {
        p = FLOW_CHECKED_SHL((p), (1));
    }
    T_out[0] = (3 * p);
    p_out[0] = p;
}

int32_t p_fraction_i64_i64_ptr_i128_ptr_i128(int64_t m, int64_t n, __int128* num_out, __int128* den_out) {
    if (m == 1) {
        num_out[0] = ((__int128)(1));
        den_out[0] = ((__int128)(1));
        return 1;
    }
    if (n == 1) {
        num_out[0] = ((__int128)(1));
        den_out[0] = ((__int128)(m));
        return 1;
    }
    if (n == 2) {
        num_out[0] = ((__int128)(3));
        den_out[0] = (((__int128)(2)) * ((__int128)(m)));
        return 1;
    }
    if (m == 2) {
        num_out[0] = ((__int128)(((2 * n) - 1)));
        den_out[0] = ((__int128)((2 * n)));
        return 1;
    }
    if (m == 3) {
        num_out[0] = ((__int128)((n - 1)));
        den_out[0] = ((__int128)(n));
        return 1;
    }
    int64_t Tm = 0;
    int64_t pm = 0;
    next_pow2_times3_i64_ptr_i64_ptr_i64(m, (&(Tm)), (&(pm)));
    if (pm >= 2) {
        int64_t L = (3 * FLOW_CHECKED_SHR((pm), (1)));
        if (n >= L) {
            __int128 mn = (((__int128)(m)) * ((__int128)(n)));
            __int128 sub = (((__int128)(L)) * ((__int128)((m - pm))));
            num_out[0] = (mn - sub);
            den_out[0] = mn;
            return 1;
        }
    }
    int64_t Tn = 0;
    int64_t pn = 0;
    next_pow2_times3_i64_ptr_i64_ptr_i64(n, (&(Tn)), (&(pn)));
    if ((n >= 3 && m >= Tn)) {
        num_out[0] = (((__int128)(Tn)) * ((__int128)((n - pn))));
        den_out[0] = (((__int128)(n)) * ((__int128)(m)));
        return 1;
    }
    return 0;
}

int32_t main(void) {
    int64_t pow7[21] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int64_t pow5[21] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    pow7[0] = 1;
    int32_t i = 1;
    while (i <= 20) {
        pow7[i] = ((((unsigned)((i - 1)) < 21) ? pow7[(i - 1)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)((i - 1)), 21), flow_fault_handler("array index out of bounds"), pow7[0])) * 7);
        i = (i + 1);
    }
    pow5[0] = 1;
    int32_t j = 1;
    while (j <= 20) {
        pow5[j] = ((((unsigned)((j - 1)) < 21) ? pow5[(j - 1)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)((j - 1)), 21), flow_fault_handler("array index out of bounds"), pow5[0])) * 5);
        j = (j + 1);
    }
    double total = 0.0;
    int32_t ii = 0;
    while (ii <= 20) {
        int32_t jj = 0;
        while (jj <= 20) {
            int64_t m = (((unsigned)(ii) < 21) ? pow7[ii] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(ii), 21), flow_fault_handler("array index out of bounds"), pow7[0]));
            int64_t n = (((unsigned)(jj) < 21) ? pow5[jj] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(jj), 21), flow_fault_handler("array index out of bounds"), pow5[0]));
            __int128 num = ((__int128)(0));
            __int128 den = ((__int128)(0));
            int32_t ok = p_fraction_i64_i64_ptr_i128_ptr_i128(m, n, (&(num)), (&(den)));
            if (ok != 0) {
                total = (total + (((double)(num)) / ((double)(den))));
            }
            jj = (jj + 1);
        }
        ii = (ii + 1);
    }
    printf("%.8f\n", total);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%.8f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func @next_pow2_times3(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> () {
    %0 = arith.constant 1 : i32
    %1 = arith.extsi %0 : i32 to i64
    %2 = llvm.mlir.constant(1 : i64) : i64
    %3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
    llvm.store %1, %3 : i64, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %4 = arith.constant 3 : i32
    %5 = llvm.load %3 : !llvm.ptr -> i64
    %7 = arith.extsi %4 : i32 to i64
    %6 = arith.muli %7, %5 : i64
    %8 = arith.cmpi slt, %6, %arg0 : i64
    cf.cond_br %8, ^bb1, ^bb2
    ^bb1:
      %9 = llvm.load %3 : !llvm.ptr -> i64
      %10 = arith.constant 1 : i32
      %12 = arith.extsi %10 : i32 to i64
      %11 = arith.shli %9, %12 : i64
      llvm.store %11, %3 : i64, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    %13 = arith.constant 3 : i32
    %14 = llvm.load %3 : !llvm.ptr -> i64
    %16 = arith.extsi %13 : i32 to i64
    %15 = arith.muli %16, %14 : i64
    %17 = arith.constant 0 : i32
    %18 = arith.extsi %17 : i32 to i64
    %19 = llvm.getelementptr %arg1[%18] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %15, %19 : i64, !llvm.ptr
    %20 = llvm.load %3 : !llvm.ptr -> i64
    %21 = arith.constant 0 : i32
    %22 = arith.extsi %21 : i32 to i64
    %23 = llvm.getelementptr %arg2[%22] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %20, %23 : i64, !llvm.ptr
    func.return
  }
  func.func @p_fraction(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: !llvm.ptr) -> i32 {
    %24 = arith.constant 1 : i32
    %26 = arith.extsi %24 : i32 to i64
    %25 = arith.cmpi eq, %arg0, %26 : i64
    cf.cond_br %25, ^bb3, ^bb4
    ^bb3:
      %27 = arith.constant 1 : i32
      %28 = arith.extsi %27 : i32 to i128
      %29 = arith.constant 0 : i32
      %30 = arith.extsi %29 : i32 to i64
      %31 = llvm.getelementptr %arg2[%30] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %28, %31 : i128, !llvm.ptr
      %32 = arith.constant 1 : i32
      %33 = arith.extsi %32 : i32 to i128
      %34 = arith.constant 0 : i32
      %35 = arith.extsi %34 : i32 to i64
      %36 = llvm.getelementptr %arg3[%35] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %33, %36 : i128, !llvm.ptr
      %37 = arith.constant 1 : i32
      func.return %37 : i32
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %38 = arith.constant 1 : i32
    %40 = arith.extsi %38 : i32 to i64
    %39 = arith.cmpi eq, %arg1, %40 : i64
    cf.cond_br %39, ^bb6, ^bb7
    ^bb6:
      %41 = arith.constant 1 : i32
      %42 = arith.extsi %41 : i32 to i128
      %43 = arith.constant 0 : i32
      %44 = arith.extsi %43 : i32 to i64
      %45 = llvm.getelementptr %arg2[%44] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %42, %45 : i128, !llvm.ptr
      %46 = arith.extsi %arg0 : i64 to i128
      %47 = arith.constant 0 : i32
      %48 = arith.extsi %47 : i32 to i64
      %49 = llvm.getelementptr %arg3[%48] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %46, %49 : i128, !llvm.ptr
      %50 = arith.constant 1 : i32
      func.return %50 : i32
    ^bb7:
      cf.br ^bb8
    ^bb8:
    %51 = arith.constant 2 : i32
    %53 = arith.extsi %51 : i32 to i64
    %52 = arith.cmpi eq, %arg1, %53 : i64
    cf.cond_br %52, ^bb9, ^bb10
    ^bb9:
      %54 = arith.constant 3 : i32
      %55 = arith.extsi %54 : i32 to i128
      %56 = arith.constant 0 : i32
      %57 = arith.extsi %56 : i32 to i64
      %58 = llvm.getelementptr %arg2[%57] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %55, %58 : i128, !llvm.ptr
      %59 = arith.constant 2 : i32
      %60 = arith.extsi %59 : i32 to i128
      %61 = arith.extsi %arg0 : i64 to i128
      %63 = arith.trunci %60 : i128 to i64
      %64 = arith.trunci %61 : i128 to i64
      %62 = arith.muli %63, %64 : i64
      %65 = arith.constant 0 : i32
      %66 = arith.extsi %62 : i64 to i128
      %67 = arith.extsi %65 : i32 to i64
      %68 = llvm.getelementptr %arg3[%67] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %66, %68 : i128, !llvm.ptr
      %69 = arith.constant 1 : i32
      func.return %69 : i32
    ^bb10:
      cf.br ^bb11
    ^bb11:
    %70 = arith.constant 2 : i32
    %72 = arith.extsi %70 : i32 to i64
    %71 = arith.cmpi eq, %arg0, %72 : i64
    cf.cond_br %71, ^bb12, ^bb13
    ^bb12:
      %73 = arith.constant 2 : i32
      %75 = arith.extsi %73 : i32 to i64
      %74 = arith.muli %75, %arg1 : i64
      %76 = arith.constant 1 : i32
      %78 = arith.extsi %76 : i32 to i64
      %77 = arith.subi %74, %78 : i64
      %79 = arith.extsi %77 : i64 to i128
      %80 = arith.constant 0 : i32
      %81 = arith.extsi %80 : i32 to i64
      %82 = llvm.getelementptr %arg2[%81] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %79, %82 : i128, !llvm.ptr
      %83 = arith.constant 2 : i32
      %85 = arith.extsi %83 : i32 to i64
      %84 = arith.muli %85, %arg1 : i64
      %86 = arith.extsi %84 : i64 to i128
      %87 = arith.constant 0 : i32
      %88 = arith.extsi %87 : i32 to i64
      %89 = llvm.getelementptr %arg3[%88] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %86, %89 : i128, !llvm.ptr
      %90 = arith.constant 1 : i32
      func.return %90 : i32
    ^bb13:
      cf.br ^bb14
    ^bb14:
    %91 = arith.constant 3 : i32
    %93 = arith.extsi %91 : i32 to i64
    %92 = arith.cmpi eq, %arg0, %93 : i64
    cf.cond_br %92, ^bb15, ^bb16
    ^bb15:
      %94 = arith.constant 1 : i32
      %96 = arith.extsi %94 : i32 to i64
      %95 = arith.subi %arg1, %96 : i64
      %97 = arith.extsi %95 : i64 to i128
      %98 = arith.constant 0 : i32
      %99 = arith.extsi %98 : i32 to i64
      %100 = llvm.getelementptr %arg2[%99] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %97, %100 : i128, !llvm.ptr
      %101 = arith.extsi %arg1 : i64 to i128
      %102 = arith.constant 0 : i32
      %103 = arith.extsi %102 : i32 to i64
      %104 = llvm.getelementptr %arg3[%103] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %101, %104 : i128, !llvm.ptr
      %105 = arith.constant 1 : i32
      func.return %105 : i32
    ^bb16:
      cf.br ^bb17
    ^bb17:
    %106 = arith.constant 0 : i32
    %107 = arith.extsi %106 : i32 to i64
    %108 = arith.constant 0 : i32
    %109 = arith.extsi %108 : i32 to i64
    %111 = llvm.mlir.constant(1 : i64) : i64
    %112 = llvm.alloca %111 x i64 : (i64) -> !llvm.ptr
    llvm.store %107, %112 : i64, !llvm.ptr
    %113 = llvm.mlir.constant(1 : i64) : i64
    %114 = llvm.alloca %113 x i64 : (i64) -> !llvm.ptr
    llvm.store %109, %114 : i64, !llvm.ptr
    func.call @next_pow2_times3(%arg0, %112, %114) : (i64, !llvm.ptr, !llvm.ptr) -> ()
    %115 = llvm.load %114 : !llvm.ptr -> i64
    %116 = arith.constant 2 : i32
    %118 = arith.extsi %116 : i32 to i64
    %117 = arith.cmpi sge, %115, %118 : i64
    cf.cond_br %117, ^bb18, ^bb19
    ^bb18:
      %119 = arith.constant 3 : i32
      %120 = llvm.load %114 : !llvm.ptr -> i64
      %121 = arith.constant 1 : i32
      %123 = arith.extsi %121 : i32 to i64
      %122 = arith.shrsi %120, %123 : i64
      %125 = arith.extsi %119 : i32 to i64
      %124 = arith.muli %125, %122 : i64
      %126 = arith.cmpi sge, %arg1, %124 : i64
      cf.cond_br %126, ^bb21, ^bb22
      ^bb21:
        %127 = arith.extsi %arg0 : i64 to i128
        %128 = arith.extsi %arg1 : i64 to i128
        %130 = arith.trunci %127 : i128 to i64
        %131 = arith.trunci %128 : i128 to i64
        %129 = arith.muli %130, %131 : i64
        %132 = arith.extsi %129 : i64 to i128
        %133 = arith.extsi %124 : i64 to i128
        %134 = llvm.load %114 : !llvm.ptr -> i64
        %135 = arith.subi %arg0, %134 : i64
        %136 = arith.extsi %135 : i64 to i128
        %138 = arith.trunci %133 : i128 to i64
        %139 = arith.trunci %136 : i128 to i64
        %137 = arith.muli %138, %139 : i64
        %140 = arith.extsi %137 : i64 to i128
        %142 = arith.trunci %132 : i128 to i64
        %143 = arith.trunci %140 : i128 to i64
        %141 = arith.subi %142, %143 : i64
        %144 = arith.constant 0 : i32
        %145 = arith.extsi %141 : i64 to i128
        %146 = arith.extsi %144 : i32 to i64
        %147 = llvm.getelementptr %arg2[%146] : (!llvm.ptr, i64) -> !llvm.ptr, i128
        llvm.store %145, %147 : i128, !llvm.ptr
        %148 = arith.constant 0 : i32
        %149 = arith.extsi %148 : i32 to i64
        %150 = llvm.getelementptr %arg3[%149] : (!llvm.ptr, i64) -> !llvm.ptr, i128
        llvm.store %132, %150 : i128, !llvm.ptr
        %151 = arith.constant 1 : i32
        func.return %151 : i32
      ^bb22:
        cf.br ^bb23
      ^bb23:
      cf.br ^bb20
    ^bb19:
      cf.br ^bb20
    ^bb20:
    %152 = arith.constant 0 : i32
    %153 = arith.extsi %152 : i32 to i64
    %154 = arith.constant 0 : i32
    %155 = arith.extsi %154 : i32 to i64
    %157 = llvm.mlir.constant(1 : i64) : i64
    %158 = llvm.alloca %157 x i64 : (i64) -> !llvm.ptr
    llvm.store %153, %158 : i64, !llvm.ptr
    %159 = llvm.mlir.constant(1 : i64) : i64
    %160 = llvm.alloca %159 x i64 : (i64) -> !llvm.ptr
    llvm.store %155, %160 : i64, !llvm.ptr
    func.call @next_pow2_times3(%arg1, %158, %160) : (i64, !llvm.ptr, !llvm.ptr) -> ()
    %161 = arith.constant 3 : i32
    %163 = arith.extsi %161 : i32 to i64
    %162 = arith.cmpi sge, %arg1, %163 : i64
    %164 = scf.if %162 -> (i1) {
      %165 = llvm.load %158 : !llvm.ptr -> i64
      %166 = arith.cmpi sge, %arg0, %165 : i64
      scf.yield %166 : i1
    } else {
      %167 = arith.constant false
      scf.yield %167 : i1
    }
    cf.cond_br %164, ^bb24, ^bb25
    ^bb24:
      %168 = llvm.load %158 : !llvm.ptr -> i64
      %169 = arith.extsi %168 : i64 to i128
      %170 = llvm.load %160 : !llvm.ptr -> i64
      %171 = arith.subi %arg1, %170 : i64
      %172 = arith.extsi %171 : i64 to i128
      %174 = arith.trunci %169 : i128 to i64
      %175 = arith.trunci %172 : i128 to i64
      %173 = arith.muli %174, %175 : i64
      %176 = arith.constant 0 : i32
      %177 = arith.extsi %173 : i64 to i128
      %178 = arith.extsi %176 : i32 to i64
      %179 = llvm.getelementptr %arg2[%178] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %177, %179 : i128, !llvm.ptr
      %180 = arith.extsi %arg1 : i64 to i128
      %181 = arith.extsi %arg0 : i64 to i128
      %183 = arith.trunci %180 : i128 to i64
      %184 = arith.trunci %181 : i128 to i64
      %182 = arith.muli %183, %184 : i64
      %185 = arith.constant 0 : i32
      %186 = arith.extsi %182 : i64 to i128
      %187 = arith.extsi %185 : i32 to i64
      %188 = llvm.getelementptr %arg3[%187] : (!llvm.ptr, i64) -> !llvm.ptr, i128
      llvm.store %186, %188 : i128, !llvm.ptr
      %189 = arith.constant 1 : i32
      func.return %189 : i32
    ^bb25:
      cf.br ^bb26
    ^bb26:
    %190 = arith.constant 0 : i32
    func.return %190 : i32
  }
  func.func @main() -> i32 {
    %192 = arith.constant 0 : i32
    %193 = arith.constant 0 : i32
    %194 = arith.constant 0 : i32
    %195 = arith.constant 0 : i32
    %196 = arith.constant 0 : i32
    %197 = arith.constant 0 : i32
    %198 = arith.constant 0 : i32
    %199 = arith.constant 0 : i32
    %200 = arith.constant 0 : i32
    %201 = arith.constant 0 : i32
    %202 = arith.constant 0 : i32
    %203 = arith.constant 0 : i32
    %204 = arith.constant 0 : i32
    %205 = arith.constant 0 : i32
    %206 = arith.constant 0 : i32
    %207 = arith.constant 0 : i32
    %208 = arith.constant 0 : i32
    %209 = arith.constant 0 : i32
    %210 = arith.constant 0 : i32
    %211 = arith.constant 0 : i32
    %212 = arith.constant 0 : i32
    %213 = llvm.mlir.constant(1 : i64) : i64
    %214 = llvm.alloca %213 x !llvm.array<21 x i64> : (i64) -> !llvm.ptr
    %215 = llvm.mlir.zero : !llvm.array<21 x i64>
    llvm.store %215, %214 : !llvm.array<21 x i64>, !llvm.ptr
    %216 = arith.extsi %192 : i32 to i64
    %217 = arith.extsi %193 : i32 to i64
    %218 = arith.extsi %194 : i32 to i64
    %219 = arith.extsi %195 : i32 to i64
    %220 = arith.extsi %196 : i32 to i64
    %221 = arith.extsi %197 : i32 to i64
    %222 = arith.extsi %198 : i32 to i64
    %223 = arith.extsi %199 : i32 to i64
    %224 = arith.extsi %200 : i32 to i64
    %225 = arith.extsi %201 : i32 to i64
    %226 = arith.extsi %202 : i32 to i64
    %227 = arith.extsi %203 : i32 to i64
    %228 = arith.extsi %204 : i32 to i64
    %229 = arith.extsi %205 : i32 to i64
    %230 = arith.extsi %206 : i32 to i64
    %231 = arith.extsi %207 : i32 to i64
    %232 = arith.extsi %208 : i32 to i64
    %233 = arith.extsi %209 : i32 to i64
    %234 = arith.extsi %210 : i32 to i64
    %235 = arith.extsi %211 : i32 to i64
    %236 = arith.extsi %212 : i32 to i64
    %237 = llvm.mlir.constant(0 : i64) : i64
    %238 = llvm.getelementptr %214[0, %237] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %216, %238 : i64, !llvm.ptr
    %239 = llvm.mlir.constant(1 : i64) : i64
    %240 = llvm.getelementptr %214[0, %239] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %217, %240 : i64, !llvm.ptr
    %241 = llvm.mlir.constant(2 : i64) : i64
    %242 = llvm.getelementptr %214[0, %241] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %218, %242 : i64, !llvm.ptr
    %243 = llvm.mlir.constant(3 : i64) : i64
    %244 = llvm.getelementptr %214[0, %243] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %219, %244 : i64, !llvm.ptr
    %245 = llvm.mlir.constant(4 : i64) : i64
    %246 = llvm.getelementptr %214[0, %245] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %220, %246 : i64, !llvm.ptr
    %247 = llvm.mlir.constant(5 : i64) : i64
    %248 = llvm.getelementptr %214[0, %247] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %221, %248 : i64, !llvm.ptr
    %249 = llvm.mlir.constant(6 : i64) : i64
    %250 = llvm.getelementptr %214[0, %249] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %222, %250 : i64, !llvm.ptr
    %251 = llvm.mlir.constant(7 : i64) : i64
    %252 = llvm.getelementptr %214[0, %251] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %223, %252 : i64, !llvm.ptr
    %253 = llvm.mlir.constant(8 : i64) : i64
    %254 = llvm.getelementptr %214[0, %253] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %224, %254 : i64, !llvm.ptr
    %255 = llvm.mlir.constant(9 : i64) : i64
    %256 = llvm.getelementptr %214[0, %255] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %225, %256 : i64, !llvm.ptr
    %257 = llvm.mlir.constant(10 : i64) : i64
    %258 = llvm.getelementptr %214[0, %257] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %226, %258 : i64, !llvm.ptr
    %259 = llvm.mlir.constant(11 : i64) : i64
    %260 = llvm.getelementptr %214[0, %259] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %227, %260 : i64, !llvm.ptr
    %261 = llvm.mlir.constant(12 : i64) : i64
    %262 = llvm.getelementptr %214[0, %261] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %228, %262 : i64, !llvm.ptr
    %263 = llvm.mlir.constant(13 : i64) : i64
    %264 = llvm.getelementptr %214[0, %263] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %229, %264 : i64, !llvm.ptr
    %265 = llvm.mlir.constant(14 : i64) : i64
    %266 = llvm.getelementptr %214[0, %265] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %230, %266 : i64, !llvm.ptr
    %267 = llvm.mlir.constant(15 : i64) : i64
    %268 = llvm.getelementptr %214[0, %267] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %231, %268 : i64, !llvm.ptr
    %269 = llvm.mlir.constant(16 : i64) : i64
    %270 = llvm.getelementptr %214[0, %269] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %232, %270 : i64, !llvm.ptr
    %271 = llvm.mlir.constant(17 : i64) : i64
    %272 = llvm.getelementptr %214[0, %271] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %233, %272 : i64, !llvm.ptr
    %273 = llvm.mlir.constant(18 : i64) : i64
    %274 = llvm.getelementptr %214[0, %273] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %234, %274 : i64, !llvm.ptr
    %275 = llvm.mlir.constant(19 : i64) : i64
    %276 = llvm.getelementptr %214[0, %275] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %235, %276 : i64, !llvm.ptr
    %277 = llvm.mlir.constant(20 : i64) : i64
    %278 = llvm.getelementptr %214[0, %277] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %236, %278 : i64, !llvm.ptr
    %280 = arith.constant 0 : i32
    %281 = arith.constant 0 : i32
    %282 = arith.constant 0 : i32
    %283 = arith.constant 0 : i32
    %284 = arith.constant 0 : i32
    %285 = arith.constant 0 : i32
    %286 = arith.constant 0 : i32
    %287 = arith.constant 0 : i32
    %288 = arith.constant 0 : i32
    %289 = arith.constant 0 : i32
    %290 = arith.constant 0 : i32
    %291 = arith.constant 0 : i32
    %292 = arith.constant 0 : i32
    %293 = arith.constant 0 : i32
    %294 = arith.constant 0 : i32
    %295 = arith.constant 0 : i32
    %296 = arith.constant 0 : i32
    %297 = arith.constant 0 : i32
    %298 = arith.constant 0 : i32
    %299 = arith.constant 0 : i32
    %300 = arith.constant 0 : i32
    %301 = llvm.mlir.constant(1 : i64) : i64
    %302 = llvm.alloca %301 x !llvm.array<21 x i64> : (i64) -> !llvm.ptr
    %303 = llvm.mlir.zero : !llvm.array<21 x i64>
    llvm.store %303, %302 : !llvm.array<21 x i64>, !llvm.ptr
    %304 = arith.extsi %280 : i32 to i64
    %305 = arith.extsi %281 : i32 to i64
    %306 = arith.extsi %282 : i32 to i64
    %307 = arith.extsi %283 : i32 to i64
    %308 = arith.extsi %284 : i32 to i64
    %309 = arith.extsi %285 : i32 to i64
    %310 = arith.extsi %286 : i32 to i64
    %311 = arith.extsi %287 : i32 to i64
    %312 = arith.extsi %288 : i32 to i64
    %313 = arith.extsi %289 : i32 to i64
    %314 = arith.extsi %290 : i32 to i64
    %315 = arith.extsi %291 : i32 to i64
    %316 = arith.extsi %292 : i32 to i64
    %317 = arith.extsi %293 : i32 to i64
    %318 = arith.extsi %294 : i32 to i64
    %319 = arith.extsi %295 : i32 to i64
    %320 = arith.extsi %296 : i32 to i64
    %321 = arith.extsi %297 : i32 to i64
    %322 = arith.extsi %298 : i32 to i64
    %323 = arith.extsi %299 : i32 to i64
    %324 = arith.extsi %300 : i32 to i64
    %325 = llvm.mlir.constant(0 : i64) : i64
    %326 = llvm.getelementptr %302[0, %325] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %304, %326 : i64, !llvm.ptr
    %327 = llvm.mlir.constant(1 : i64) : i64
    %328 = llvm.getelementptr %302[0, %327] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %305, %328 : i64, !llvm.ptr
    %329 = llvm.mlir.constant(2 : i64) : i64
    %330 = llvm.getelementptr %302[0, %329] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %306, %330 : i64, !llvm.ptr
    %331 = llvm.mlir.constant(3 : i64) : i64
    %332 = llvm.getelementptr %302[0, %331] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %307, %332 : i64, !llvm.ptr
    %333 = llvm.mlir.constant(4 : i64) : i64
    %334 = llvm.getelementptr %302[0, %333] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %308, %334 : i64, !llvm.ptr
    %335 = llvm.mlir.constant(5 : i64) : i64
    %336 = llvm.getelementptr %302[0, %335] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %309, %336 : i64, !llvm.ptr
    %337 = llvm.mlir.constant(6 : i64) : i64
    %338 = llvm.getelementptr %302[0, %337] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %310, %338 : i64, !llvm.ptr
    %339 = llvm.mlir.constant(7 : i64) : i64
    %340 = llvm.getelementptr %302[0, %339] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %311, %340 : i64, !llvm.ptr
    %341 = llvm.mlir.constant(8 : i64) : i64
    %342 = llvm.getelementptr %302[0, %341] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %312, %342 : i64, !llvm.ptr
    %343 = llvm.mlir.constant(9 : i64) : i64
    %344 = llvm.getelementptr %302[0, %343] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %313, %344 : i64, !llvm.ptr
    %345 = llvm.mlir.constant(10 : i64) : i64
    %346 = llvm.getelementptr %302[0, %345] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %314, %346 : i64, !llvm.ptr
    %347 = llvm.mlir.constant(11 : i64) : i64
    %348 = llvm.getelementptr %302[0, %347] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %315, %348 : i64, !llvm.ptr
    %349 = llvm.mlir.constant(12 : i64) : i64
    %350 = llvm.getelementptr %302[0, %349] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %316, %350 : i64, !llvm.ptr
    %351 = llvm.mlir.constant(13 : i64) : i64
    %352 = llvm.getelementptr %302[0, %351] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %317, %352 : i64, !llvm.ptr
    %353 = llvm.mlir.constant(14 : i64) : i64
    %354 = llvm.getelementptr %302[0, %353] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %318, %354 : i64, !llvm.ptr
    %355 = llvm.mlir.constant(15 : i64) : i64
    %356 = llvm.getelementptr %302[0, %355] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %319, %356 : i64, !llvm.ptr
    %357 = llvm.mlir.constant(16 : i64) : i64
    %358 = llvm.getelementptr %302[0, %357] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %320, %358 : i64, !llvm.ptr
    %359 = llvm.mlir.constant(17 : i64) : i64
    %360 = llvm.getelementptr %302[0, %359] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %321, %360 : i64, !llvm.ptr
    %361 = llvm.mlir.constant(18 : i64) : i64
    %362 = llvm.getelementptr %302[0, %361] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %322, %362 : i64, !llvm.ptr
    %363 = llvm.mlir.constant(19 : i64) : i64
    %364 = llvm.getelementptr %302[0, %363] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %323, %364 : i64, !llvm.ptr
    %365 = llvm.mlir.constant(20 : i64) : i64
    %366 = llvm.getelementptr %302[0, %365] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %324, %366 : i64, !llvm.ptr
    %367 = arith.constant 1 : i32
    %368 = arith.constant 0 : i32
    %369 = arith.extsi %367 : i32 to i64
    %370 = arith.extsi %368 : i32 to i64
    %371 = llvm.getelementptr %214[0, %370] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %369, %371 : i64, !llvm.ptr
    %372 = arith.constant 1 : i32
    %373 = llvm.mlir.constant(1 : i64) : i64
    %374 = llvm.alloca %373 x i32 : (i64) -> !llvm.ptr
    llvm.store %372, %374 : i32, !llvm.ptr
    cf.br ^bb27
    ^bb27:
    %375 = llvm.load %374 : !llvm.ptr -> i32
    %376 = arith.constant 20 : i32
    %377 = arith.cmpi sle, %375, %376 : i32
    cf.cond_br %377, ^bb28, ^bb29
    ^bb28:
      %379 = llvm.load %374 : !llvm.ptr -> i32
      %380 = arith.constant 1 : i32
      %381 = arith.subi %379, %380 : i32
      %382 = arith.extsi %381 : i32 to i64
      %383 = llvm.getelementptr %214[0, %382] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
      %378 = llvm.load %383 : !llvm.ptr -> i64
      %384 = arith.constant 7 : i32
      %386 = arith.extsi %384 : i32 to i64
      %385 = arith.muli %378, %386 : i64
      %387 = llvm.load %374 : !llvm.ptr -> i32
      %388 = arith.extsi %387 : i32 to i64
      %389 = llvm.getelementptr %214[0, %388] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
      llvm.store %385, %389 : i64, !llvm.ptr
      %390 = llvm.load %374 : !llvm.ptr -> i32
      %391 = arith.constant 1 : i32
      %392 = arith.addi %390, %391 : i32
      llvm.store %392, %374 : i32, !llvm.ptr
      cf.br ^bb27
    ^bb29:
    %393 = arith.constant 1 : i32
    %394 = arith.constant 0 : i32
    %395 = arith.extsi %393 : i32 to i64
    %396 = arith.extsi %394 : i32 to i64
    %397 = llvm.getelementptr %302[0, %396] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
    llvm.store %395, %397 : i64, !llvm.ptr
    %398 = arith.constant 1 : 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 ^bb30
    ^bb30:
    %401 = llvm.load %400 : !llvm.ptr -> i32
    %402 = arith.constant 20 : i32
    %403 = arith.cmpi sle, %401, %402 : i32
    cf.cond_br %403, ^bb31, ^bb32
    ^bb31:
      %405 = llvm.load %400 : !llvm.ptr -> i32
      %406 = arith.constant 1 : i32
      %407 = arith.subi %405, %406 : i32
      %408 = arith.extsi %407 : i32 to i64
      %409 = llvm.getelementptr %302[0, %408] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
      %404 = llvm.load %409 : !llvm.ptr -> i64
      %410 = arith.constant 5 : i32
      %412 = arith.extsi %410 : i32 to i64
      %411 = arith.muli %404, %412 : i64
      %413 = llvm.load %400 : !llvm.ptr -> i32
      %414 = arith.extsi %413 : i32 to i64
      %415 = llvm.getelementptr %302[0, %414] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
      llvm.store %411, %415 : i64, !llvm.ptr
      %416 = llvm.load %400 : !llvm.ptr -> i32
      %417 = arith.constant 1 : i32
      %418 = arith.addi %416, %417 : i32
      llvm.store %418, %400 : i32, !llvm.ptr
      cf.br ^bb30
    ^bb32:
    %419 = arith.constant 0.0 : f32
    %420 = arith.extf %419 : f32 to f64
    %421 = llvm.mlir.constant(1 : i64) : i64
    %422 = llvm.alloca %421 x f64 : (i64) -> !llvm.ptr
    llvm.store %420, %422 : f64, !llvm.ptr
    %423 = arith.constant 0 : i32
    %424 = llvm.mlir.constant(1 : i64) : i64
    %425 = llvm.alloca %424 x i32 : (i64) -> !llvm.ptr
    llvm.store %423, %425 : i32, !llvm.ptr
    cf.br ^bb33
    ^bb33:
    %426 = llvm.load %425 : !llvm.ptr -> i32
    %427 = arith.constant 20 : i32
    %428 = arith.cmpi sle, %426, %427 : i32
    cf.cond_br %428, ^bb34, ^bb35
    ^bb34:
      %429 = arith.constant 0 : i32
      %430 = llvm.mlir.constant(1 : i64) : i64
      %431 = llvm.alloca %430 x i32 : (i64) -> !llvm.ptr
      llvm.store %429, %431 : i32, !llvm.ptr
      cf.br ^bb36
      ^bb36:
      %432 = llvm.load %431 : !llvm.ptr -> i32
      %433 = arith.constant 20 : i32
      %434 = arith.cmpi sle, %432, %433 : i32
      cf.cond_br %434, ^bb37, ^bb38
      ^bb37:
        %436 = llvm.load %425 : !llvm.ptr -> i32
        %437 = arith.extsi %436 : i32 to i64
        %438 = llvm.getelementptr %214[0, %437] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
        %435 = llvm.load %438 : !llvm.ptr -> i64
        %440 = llvm.load %431 : !llvm.ptr -> i32
        %441 = arith.extsi %440 : i32 to i64
        %442 = llvm.getelementptr %302[0, %441] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<21 x i64>
        %439 = llvm.load %442 : !llvm.ptr -> i64
        %443 = arith.constant 0 : i32
        %444 = arith.extsi %443 : i32 to i128
        %445 = arith.constant 0 : i32
        %446 = arith.extsi %445 : i32 to i128
        %448 = llvm.mlir.constant(1 : i64) : i64
        %449 = llvm.alloca %448 x i128 : (i64) -> !llvm.ptr
        llvm.store %444, %449 : i128, !llvm.ptr
        %450 = llvm.mlir.constant(1 : i64) : i64
        %451 = llvm.alloca %450 x i128 : (i64) -> !llvm.ptr
        llvm.store %446, %451 : i128, !llvm.ptr
        %447 = func.call @p_fraction(%435, %439, %449, %451) : (i64, i64, !llvm.ptr, !llvm.ptr) -> i32
        %452 = arith.constant 0 : i32
        %453 = arith.cmpi ne, %447, %452 : i32
        cf.cond_br %453, ^bb39, ^bb40
        ^bb39:
          %454 = llvm.load %422 : !llvm.ptr -> f64
          %455 = llvm.load %449 : !llvm.ptr -> i128
          %456 = arith.sitofp %455 : i128 to f64
          %457 = llvm.load %451 : !llvm.ptr -> i128
          %458 = arith.sitofp %457 : i128 to f64
          %459 = arith.divf %456, %458 : f64
          %460 = arith.addf %454, %459 : f64
          llvm.store %460, %422 : f64, !llvm.ptr
          cf.br ^bb41
        ^bb40:
          cf.br ^bb41
        ^bb41:
        %461 = llvm.load %431 : !llvm.ptr -> i32
        %462 = arith.constant 1 : i32
        %463 = arith.addi %461, %462 : i32
        llvm.store %463, %431 : i32, !llvm.ptr
        cf.br ^bb36
      ^bb38:
      %464 = llvm.load %425 : !llvm.ptr -> i32
      %465 = arith.constant 1 : i32
      %466 = arith.addi %464, %465 : i32
      llvm.store %466, %425 : i32, !llvm.ptr
      cf.br ^bb33
    ^bb35:
    %467 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %468 = llvm.load %422 : !llvm.ptr -> f64
    %469 = llvm.call @printf(%467, %468) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
    %470 = arith.constant 0 : i32
    func.return %470 : i32
  }
}