Problem 462
Permutation of 3-smooth Numbers — hook-length SYT via log-summation.
View problem on Project Euler
Performance comparison
| Metric | Our solution | Best known |
| Time complexity | O(n^2) | O(n!) |
| Space complexity | O(n) | O(n) |
| Approach | Flow solution | Permutation enumeration or constraint search |
| Verdict | Optimal |
Flow source
# Project Euler 462
# Permutation of 3-smooth Numbers — hook-length SYT via log-summation.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function log(x: f64) -> f64
function log10(x: f64) -> f64
function exp(x: f64) -> f64
function floor(x: f64) -> f64
function pow(x: f64, y: f64) -> f64
}
function main() -> i32 {
let N: i64 = 1000000000000000000
let rows: ptr<i32> = calloc(64, 4)
if rows == null { return 1 }
let mut rc: i32 = 0
let mut pow3: i64 = 1
while pow3 <= N {
let limit: i64 = N / pow3
# bit_length(limit) = floor(log2(limit))+1
let mut bits: i32 = 0
let mut t: i64 = limit
while t > 0 {
bits = bits + 1
t = t / 2
}
rows[rc] = bits
rc = rc + 1
if pow3 > N / 3 { break }
pow3 = pow3 * 3
}
let mut ncells: i64 = 0
let mut i: i32 = 0
while i < rc {
ncells = ncells + (rows[i] as i64)
i = i + 1
}
let max_len: i32 = rows[0]
let col_h: ptr<i32> = calloc((max_len as i64) + 1, 4)
if col_h == null { return 1 }
let mut h: i32 = rc
let mut j: i32 = 0
while j < max_len {
while h > 0 && rows[h - 1] <= j {
h = h - 1
}
col_h[j] = h
j = j + 1
}
# log(F) = sum log(k) - sum log(hook)
let mut logf: f64 = 0.0
let mut k: i64 = 2
while k <= ncells {
logf = logf + log(k as f64)
k = k + 1
}
i = 0
while i < rc {
let row_len: i32 = rows[i]
j = 0
while j < row_len {
let hook: i32 = row_len - j + col_h[j] - i - 1
logf = logf - log(hook as f64)
j = j + 1
}
i = i + 1
}
let log10e: f64 = log10(exp(1.0))
let log10x: f64 = logf * log10e
let expv: i64 = floor(log10x) as i64
let frac: f64 = log10x - (expv as f64)
let mut mant: f64 = pow(10.0, frac)
let mut mant_r: f64 = floor(mant * 10000000000.0 + 0.5) / 10000000000.0
let mut exp_out: i64 = expv
if mant_r >= 10.0 {
mant_r = mant_r / 10.0
exp_out = exp_out + 1
}
printf("%.10fe%lld\n", mant_r, exp_out)
free(col_h)
free(rows)
return 0
}
Generated C
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
while (flow_temp_head) {
flow_temp_node* n = flow_temp_head;
flow_temp_head = n->next;
free(n);
}
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
if (!node) return NULL;
node->next = flow_temp_head;
flow_temp_head = node;
if (!flow_temp_atexit_set) {
flow_temp_atexit_set = 1;
atexit(flow_temp_free_all);
}
return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
char* r = (char*)flow_temp_alloc(la + lb + 1);
if (!r) return NULL;
if (la) memcpy(r, a, la);
if (lb) memcpy(r + la, b, lb);
r[la + lb] = '\0';
return r;
}
#define __flow_in_arr(arr, val) __extension__ ({ \
int _found = 0; \
size_t _n = sizeof(arr)/sizeof((arr)[0]); \
for (size_t _i = 0; _i < _n; _i++) { \
if ((arr)[_i] == (val)) { _found = 1; break; } \
} _found; })
/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
abort();
#if defined(__GNUC__) || defined(__clang__)
__builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")
#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#include <math.h>
void* _ui_state = NULL;
static inline float i32_to_f32(int32_t v) { return (float)v; }
/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }
int32_t main(void);
int32_t main(void) {
int64_t N = 1000000000000000000;
int32_t* rows = (int32_t*)(calloc(64, 4));
if (rows == NULL) {
return 1;
}
int32_t rc = 0;
int64_t pow3 = 1;
while (pow3 <= N) {
int64_t limit = FLOW_CHECKED_DIV((N), (pow3));
int32_t bits = 0;
int64_t t = limit;
while (t > 0) {
bits = (bits + 1);
t = FLOW_CHECKED_DIV((t), (2));
}
rows[rc] = bits;
rc = (rc + 1);
if (pow3 > FLOW_CHECKED_DIV((N), (3))) {
break;
}
pow3 = (pow3 * 3);
}
int64_t ncells = 0;
int32_t i = 0;
while (i < rc) {
ncells = (ncells + ((int64_t)(rows[i])));
i = (i + 1);
}
int32_t max_len = rows[0];
int32_t* col_h = (int32_t*)(calloc((((int64_t)(max_len)) + 1), 4));
if (col_h == NULL) {
return 1;
}
int32_t h = rc;
int32_t j = 0;
while (j < max_len) {
while ((h > 0 && rows[(h - 1)] <= j)) {
h = (h - 1);
}
col_h[j] = h;
j = (j + 1);
}
double logf = 0.0;
int64_t k = 2;
while (k <= ncells) {
logf = (logf + log(((double)(k))));
k = (k + 1);
}
i = 0;
while (i < rc) {
int32_t row_len = rows[i];
j = 0;
while (j < row_len) {
int32_t hook = ((((row_len - j) + col_h[j]) - i) - 1);
logf = (logf - log(((double)(hook))));
j = (j + 1);
}
i = (i + 1);
}
double log10e = log10(exp(1.0));
double log10x = (logf * log10e);
int64_t expv = ((int64_t)(floor(log10x)));
double frac = (log10x - ((double)(expv)));
double mant = pow(10.0, frac);
double mant_r = (floor(((mant * 10000000000.0) + 0.5)) / 10000000000.0);
int64_t exp_out = expv;
if (mant_r >= 10.0) {
mant_r = (mant_r / 10.0);
exp_out = (exp_out + 1);
}
printf("%.10fe%lld\n", mant_r, exp_out);
free(col_h);
free(rows);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.10fe%lld\n\00") {addr_space = 0 : i32} : !llvm.array<12 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
func.func private @log(f64) -> f64
func.func private @log10(f64) -> f64
func.func private @exp(f64) -> f64
func.func private @floor(f64) -> f64
func.func private @pow(f64, f64) -> f64
func.func @main() -> i32 {
%0 = arith.constant 999999995705032704 : i32
%1 = arith.extsi %0 : i32 to i64
%3 = arith.constant 64 : i32
%4 = arith.constant 4 : i32
%5 = arith.extsi %3 : i32 to i64
%6 = arith.extsi %4 : i32 to i64
%2 = func.call @calloc(%5, %6) : (i64, i64) -> !llvm.ptr
%7 = llvm.mlir.zero : !llvm.ptr
%8 = llvm.icmp "eq" %2, %7 : !llvm.ptr
cf.cond_br %8, ^bb0, ^bb1
^bb0:
%9 = arith.constant 1 : i32
func.return %9 : i32
^bb1:
cf.br ^bb2
^bb2:
%10 = arith.constant 0 : i32
%11 = llvm.mlir.constant(1 : i64) : i64
%12 = llvm.alloca %11 x i32 : (i64) -> !llvm.ptr
llvm.store %10, %12 : i32, !llvm.ptr
%13 = arith.constant 1 : i32
%14 = arith.extsi %13 : i32 to i64
%15 = llvm.mlir.constant(1 : i64) : i64
%16 = llvm.alloca %15 x i64 : (i64) -> !llvm.ptr
llvm.store %14, %16 : i64, !llvm.ptr
cf.br ^bb3
^bb3:
%17 = llvm.load %16 : !llvm.ptr -> i64
%18 = arith.cmpi sle, %17, %1 : i64
cf.cond_br %18, ^bb4, ^bb5
^bb4:
%19 = llvm.load %16 : !llvm.ptr -> i64
%20 = arith.divsi %1, %19 : i64
%21 = arith.constant 0 : i32
%22 = llvm.mlir.constant(1 : i64) : i64
%23 = llvm.alloca %22 x i32 : (i64) -> !llvm.ptr
llvm.store %21, %23 : i32, !llvm.ptr
%24 = llvm.mlir.constant(1 : i64) : i64
%25 = llvm.alloca %24 x i64 : (i64) -> !llvm.ptr
llvm.store %20, %25 : i64, !llvm.ptr
cf.br ^bb6
^bb6:
%26 = llvm.load %25 : !llvm.ptr -> i64
%27 = arith.constant 0 : i32
%29 = arith.extsi %27 : i32 to i64
%28 = arith.cmpi sgt, %26, %29 : i64
cf.cond_br %28, ^bb7, ^bb8
^bb7:
%30 = llvm.load %23 : !llvm.ptr -> i32
%31 = arith.constant 1 : i32
%32 = arith.addi %30, %31 : i32
llvm.store %32, %23 : i32, !llvm.ptr
%33 = llvm.load %25 : !llvm.ptr -> i64
%34 = arith.constant 2 : i32
%36 = arith.extsi %34 : i32 to i64
%35 = arith.divsi %33, %36 : i64
llvm.store %35, %25 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
%37 = llvm.load %23 : !llvm.ptr -> i32
%38 = llvm.load %12 : !llvm.ptr -> i32
%39 = arith.extsi %38 : i32 to i64
%40 = llvm.getelementptr %2[%39] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %37, %40 : i32, !llvm.ptr
%41 = llvm.load %12 : !llvm.ptr -> i32
%42 = arith.constant 1 : i32
%43 = arith.addi %41, %42 : i32
llvm.store %43, %12 : i32, !llvm.ptr
%44 = llvm.load %16 : !llvm.ptr -> i64
%45 = arith.constant 3 : i32
%47 = arith.extsi %45 : i32 to i64
%46 = arith.divsi %1, %47 : i64
%48 = arith.cmpi sgt, %44, %46 : i64
cf.cond_br %48, ^bb9, ^bb10
^bb9:
cf.br ^bb5
^bb10:
cf.br ^bb11
^bb11:
%49 = llvm.load %16 : !llvm.ptr -> i64
%50 = arith.constant 3 : i32
%52 = arith.extsi %50 : i32 to i64
%51 = arith.muli %49, %52 : i64
llvm.store %51, %16 : i64, !llvm.ptr
cf.br ^bb3
^bb5:
%53 = arith.constant 0 : i32
%54 = arith.extsi %53 : i32 to i64
%55 = llvm.mlir.constant(1 : i64) : i64
%56 = llvm.alloca %55 x i64 : (i64) -> !llvm.ptr
llvm.store %54, %56 : i64, !llvm.ptr
%57 = arith.constant 0 : i32
%58 = llvm.mlir.constant(1 : i64) : i64
%59 = llvm.alloca %58 x i32 : (i64) -> !llvm.ptr
llvm.store %57, %59 : i32, !llvm.ptr
cf.br ^bb12
^bb12:
%60 = llvm.load %59 : !llvm.ptr -> i32
%61 = llvm.load %12 : !llvm.ptr -> i32
%62 = arith.cmpi slt, %60, %61 : i32
cf.cond_br %62, ^bb13, ^bb14
^bb13:
%63 = llvm.load %56 : !llvm.ptr -> i64
%65 = llvm.load %59 : !llvm.ptr -> i32
%66 = arith.extsi %65 : i32 to i64
%67 = llvm.getelementptr %2[%66] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%64 = llvm.load %67 : !llvm.ptr -> i32
%68 = arith.extsi %64 : i32 to i64
%69 = arith.addi %63, %68 : i64
llvm.store %69, %56 : i64, !llvm.ptr
%70 = llvm.load %59 : !llvm.ptr -> i32
%71 = arith.constant 1 : i32
%72 = arith.addi %70, %71 : i32
llvm.store %72, %59 : i32, !llvm.ptr
cf.br ^bb12
^bb14:
%74 = arith.constant 0 : i32
%75 = arith.extsi %74 : i32 to i64
%76 = llvm.getelementptr %2[%75] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%73 = llvm.load %76 : !llvm.ptr -> i32
%78 = arith.extsi %73 : i32 to i64
%79 = arith.constant 1 : i32
%81 = arith.extsi %79 : i32 to i64
%80 = arith.addi %78, %81 : i64
%82 = arith.constant 4 : i32
%83 = arith.extsi %82 : i32 to i64
%77 = func.call @calloc(%80, %83) : (i64, i64) -> !llvm.ptr
%84 = llvm.mlir.zero : !llvm.ptr
%85 = llvm.icmp "eq" %77, %84 : !llvm.ptr
cf.cond_br %85, ^bb15, ^bb16
^bb15:
%86 = arith.constant 1 : i32
func.return %86 : i32
^bb16:
cf.br ^bb17
^bb17:
%87 = llvm.load %12 : !llvm.ptr -> i32
%88 = llvm.mlir.constant(1 : i64) : i64
%89 = llvm.alloca %88 x i32 : (i64) -> !llvm.ptr
llvm.store %87, %89 : i32, !llvm.ptr
%90 = arith.constant 0 : i32
%91 = llvm.mlir.constant(1 : i64) : i64
%92 = llvm.alloca %91 x i32 : (i64) -> !llvm.ptr
llvm.store %90, %92 : i32, !llvm.ptr
cf.br ^bb18
^bb18:
%93 = llvm.load %92 : !llvm.ptr -> i32
%94 = arith.cmpi slt, %93, %73 : i32
cf.cond_br %94, ^bb19, ^bb20
^bb19:
cf.br ^bb21
^bb21:
%95 = llvm.load %89 : !llvm.ptr -> i32
%96 = arith.constant 0 : i32
%97 = arith.cmpi sgt, %95, %96 : i32
%98 = scf.if %97 -> (i1) {
%100 = llvm.load %89 : !llvm.ptr -> i32
%101 = arith.constant 1 : i32
%102 = arith.subi %100, %101 : i32
%103 = arith.extsi %102 : i32 to i64
%104 = llvm.getelementptr %2[%103] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%99 = llvm.load %104 : !llvm.ptr -> i32
%105 = llvm.load %92 : !llvm.ptr -> i32
%106 = arith.cmpi sle, %99, %105 : i32
scf.yield %106 : i1
} else {
%107 = arith.constant false
scf.yield %107 : i1
}
cf.cond_br %98, ^bb22, ^bb23
^bb22:
%108 = llvm.load %89 : !llvm.ptr -> i32
%109 = arith.constant 1 : i32
%110 = arith.subi %108, %109 : i32
llvm.store %110, %89 : i32, !llvm.ptr
cf.br ^bb21
^bb23:
%111 = llvm.load %89 : !llvm.ptr -> i32
%112 = llvm.load %92 : !llvm.ptr -> i32
%113 = arith.extsi %112 : i32 to i64
%114 = llvm.getelementptr %77[%113] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %111, %114 : i32, !llvm.ptr
%115 = llvm.load %92 : !llvm.ptr -> i32
%116 = arith.constant 1 : i32
%117 = arith.addi %115, %116 : i32
llvm.store %117, %92 : i32, !llvm.ptr
cf.br ^bb18
^bb20:
%118 = arith.constant 0.0 : f32
%119 = arith.extf %118 : f32 to f64
%120 = llvm.mlir.constant(1 : i64) : i64
%121 = llvm.alloca %120 x f64 : (i64) -> !llvm.ptr
llvm.store %119, %121 : f64, !llvm.ptr
%122 = arith.constant 2 : i32
%123 = arith.extsi %122 : i32 to i64
%124 = llvm.mlir.constant(1 : i64) : i64
%125 = llvm.alloca %124 x i64 : (i64) -> !llvm.ptr
llvm.store %123, %125 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%126 = llvm.load %125 : !llvm.ptr -> i64
%127 = llvm.load %56 : !llvm.ptr -> i64
%128 = arith.cmpi sle, %126, %127 : i64
cf.cond_br %128, ^bb25, ^bb26
^bb25:
%129 = llvm.load %121 : !llvm.ptr -> f64
%130 = llvm.load %125 : !llvm.ptr -> i64
%131 = arith.sitofp %130 : i64 to f64
%132 = math.log %131 : f64
%133 = arith.addf %129, %132 : f64
llvm.store %133, %121 : f64, !llvm.ptr
%134 = llvm.load %125 : !llvm.ptr -> i64
%135 = arith.constant 1 : i32
%137 = arith.extsi %135 : i32 to i64
%136 = arith.addi %134, %137 : i64
llvm.store %136, %125 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
%138 = arith.constant 0 : i32
llvm.store %138, %59 : i32, !llvm.ptr
cf.br ^bb27
^bb27:
%139 = llvm.load %59 : !llvm.ptr -> i32
%140 = llvm.load %12 : !llvm.ptr -> i32
%141 = arith.cmpi slt, %139, %140 : i32
cf.cond_br %141, ^bb28, ^bb29
^bb28:
%143 = llvm.load %59 : !llvm.ptr -> i32
%144 = arith.extsi %143 : i32 to i64
%145 = llvm.getelementptr %2[%144] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%142 = llvm.load %145 : !llvm.ptr -> i32
%146 = arith.constant 0 : i32
llvm.store %146, %92 : i32, !llvm.ptr
cf.br ^bb30
^bb30:
%147 = llvm.load %92 : !llvm.ptr -> i32
%148 = arith.cmpi slt, %147, %142 : i32
cf.cond_br %148, ^bb31, ^bb32
^bb31:
%149 = llvm.load %92 : !llvm.ptr -> i32
%150 = arith.subi %142, %149 : i32
%152 = llvm.load %92 : !llvm.ptr -> i32
%153 = arith.extsi %152 : i32 to i64
%154 = llvm.getelementptr %77[%153] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%151 = llvm.load %154 : !llvm.ptr -> i32
%155 = arith.addi %150, %151 : i32
%156 = llvm.load %59 : !llvm.ptr -> i32
%157 = arith.subi %155, %156 : i32
%158 = arith.constant 1 : i32
%159 = arith.subi %157, %158 : i32
%160 = llvm.load %121 : !llvm.ptr -> f64
%161 = arith.sitofp %159 : i32 to f64
%162 = math.log %161 : f64
%163 = arith.subf %160, %162 : f64
llvm.store %163, %121 : f64, !llvm.ptr
%164 = llvm.load %92 : !llvm.ptr -> i32
%165 = arith.constant 1 : i32
%166 = arith.addi %164, %165 : i32
llvm.store %166, %92 : i32, !llvm.ptr
cf.br ^bb30
^bb32:
%167 = llvm.load %59 : !llvm.ptr -> i32
%168 = arith.constant 1 : i32
%169 = arith.addi %167, %168 : i32
llvm.store %169, %59 : i32, !llvm.ptr
cf.br ^bb27
^bb29:
%171 = arith.constant 1.0 : f32
%172 = math.exp %171 : f32
%173 = arith.extf %172 : f32 to f64
%170 = func.call @log10(%173) : (f64) -> f64
%174 = llvm.load %121 : !llvm.ptr -> f64
%175 = arith.mulf %174, %170 : f64
%176 = func.call @floor(%175) : (f64) -> f64
%177 = arith.fptosi %176 : f64 to i64
%178 = arith.sitofp %177 : i64 to f64
%179 = arith.subf %175, %178 : f64
%181 = arith.constant 10.0 : f32
%182 = arith.extf %181 : f32 to f64
%180 = func.call @pow(%182, %179) : (f64, f64) -> f64
%183 = llvm.mlir.constant(1 : i64) : i64
%184 = llvm.alloca %183 x f64 : (i64) -> !llvm.ptr
llvm.store %180, %184 : f64, !llvm.ptr
%186 = llvm.load %184 : !llvm.ptr -> f64
%187 = arith.constant 10000000000.0 : f32
%189 = arith.extf %187 : f32 to f64
%188 = arith.mulf %186, %189 : f64
%190 = arith.constant 0.5 : f32
%192 = arith.extf %190 : f32 to f64
%191 = arith.addf %188, %192 : f64
%185 = func.call @floor(%191) : (f64) -> f64
%193 = arith.constant 10000000000.0 : f32
%195 = arith.extf %193 : f32 to f64
%194 = arith.divf %185, %195 : f64
%196 = llvm.mlir.constant(1 : i64) : i64
%197 = llvm.alloca %196 x f64 : (i64) -> !llvm.ptr
llvm.store %194, %197 : f64, !llvm.ptr
%198 = llvm.mlir.constant(1 : i64) : i64
%199 = llvm.alloca %198 x i64 : (i64) -> !llvm.ptr
llvm.store %177, %199 : i64, !llvm.ptr
%200 = llvm.load %197 : !llvm.ptr -> f64
%201 = arith.constant 10.0 : f32
%203 = arith.extf %201 : f32 to f64
%202 = arith.cmpf oge, %200, %203 : f64
cf.cond_br %202, ^bb33, ^bb34
^bb33:
%204 = llvm.load %197 : !llvm.ptr -> f64
%205 = arith.constant 10.0 : f32
%207 = arith.extf %205 : f32 to f64
%206 = arith.divf %204, %207 : f64
llvm.store %206, %197 : f64, !llvm.ptr
%208 = llvm.load %199 : !llvm.ptr -> i64
%209 = arith.constant 1 : i32
%211 = arith.extsi %209 : i32 to i64
%210 = arith.addi %208, %211 : i64
llvm.store %210, %199 : i64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%212 = llvm.mlir.addressof @str_0 : !llvm.ptr
%213 = llvm.load %197 : !llvm.ptr -> f64
%214 = llvm.load %199 : !llvm.ptr -> i64
%215 = llvm.call @printf(%212, %213, %214) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64, i64) -> i32
func.call @free(%77) : (!llvm.ptr) -> ()
func.call @free(%2) : (!llvm.ptr) -> ()
%218 = arith.constant 0 : i32
func.return %218 : i32
}
}