Problem 368
Kempner-like sum over n without 3 equal consecutive digits; 10 decimals.
View problem on Project Euler
Performance comparison
| Metric | Our solution | Best known |
| Time complexity | O(n^4) | O(n * d * s) |
| Space complexity | O(n^2) | O(d * s) |
| Approach | Flow solution | Digit DP |
| Verdict | Unknown |
Flow source
# Project Euler 368
# Kempner-like sum over n without 3 equal consecutive digits; 10 decimals.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function pow(base: f64, exp: f64) -> f64
}
function main() -> i32 {
let K: i64 = 20
let TAIL_TOL: f64 = 0.0000000000005
let MAX_LEN: i64 = 10000
let R_BOUND: f64 = 0.991
let pow10inv: ptr<f64> = calloc(K + 1, 8)
let comb: ptr<f64> = calloc((K + 1) * (K + 1), 8)
let f1: ptr<f64> = calloc(10 * (K + 1), 8)
let f2: ptr<f64> = calloc(10 * (K + 1), 8)
let nf1: ptr<f64> = calloc(10 * (K + 1), 8)
let nf2: ptr<f64> = calloc(10 * (K + 1), 8)
let total: ptr<f64> = calloc(K + 1, 8)
if pow10inv == null || comb == null || f1 == null || f2 == null { return 1 }
if nf1 == null || nf2 == null || total == null { return 1 }
let mut j: i64 = 1
while j <= K {
pow10inv[j] = pow(10.0, 0.0 - (j as f64))
j = j + 1
}
j = 1
while j <= K {
let mut i: i64 = 0
while i <= K - j {
# C(j+i-1, i)
let mut c: f64 = 1.0
let mut t: i64 = 1
while t <= i {
c = c * (((j + i - t) as f64) / (t as f64))
t = t + 1
}
comb[j * (K + 1) + i] = c
i = i + 1
}
j = j + 1
}
let mut d: i64 = 0
while d <= 9 {
let mut pre: i64 = 10
while pre < 100 {
let a: i64 = pre / 10
let b: i64 = pre % 10
if a == b && b == d {
pre = pre + 1
continue
}
let x: i64 = pre * 10 + d
let inv: f64 = 1.0 / (x as f64)
let mut p: f64 = inv
let base: i64 = d * (K + 1)
j = 1
while j <= K {
if b == d {
f2[base + j] = f2[base + j] + p
} else {
f1[base + j] = f1[base + j] + p
}
p = p * inv
j = j + 1
}
pre = pre + 1
}
d = d + 1
}
let mut ans: f64 = 0.0
let mut n: i64 = 1
while n < 100 {
ans = ans + 1.0 / (n as f64)
n = n + 1
}
let mut delta: f64 = 0.0
d = 0
while d <= 9 {
delta = delta + f1[d * (K + 1) + 1] + f2[d * (K + 1) + 1]
d = d + 1
}
ans = ans + delta
let mut length: i64 = 4
while length <= MAX_LEN {
let mut p: i64 = 1
while p <= K {
let mut s: f64 = 0.0
d = 0
while d <= 9 {
s = s + f1[d * (K + 1) + p] + f2[d * (K + 1) + p]
d = d + 1
}
total[p] = s
p = p + 1
}
# clear nf1, nf2
let mut zi: i64 = 0
while zi < 10 * (K + 1) {
nf1[zi] = 0.0
nf2[zi] = 0.0
zi = zi + 1
}
d = 0
while d <= 9 {
let md: f64 = 0.0 - (d as f64) / 10.0
let base_d: i64 = d * (K + 1)
j = 1
while j <= K {
let base: f64 = pow10inv[j]
let mut pre_pow: f64 = 1.0
let mut i: i64 = 0
while i <= K - j {
let c: f64 = comb[j * (K + 1) + i] * pre_pow * base
let pwr: i64 = i + j
let f1dp: f64 = f1[base_d + pwr]
nf2[base_d + j] = nf2[base_d + j] + c * f1dp
let excl: f64 = f1dp + f2[base_d + pwr]
nf1[base_d + j] = nf1[base_d + j] + c * (total[pwr] - excl)
pre_pow = pre_pow * md
i = i + 1
}
j = j + 1
}
d = d + 1
}
# swap f1/f2 with nf1/nf2 via copy
zi = 0
while zi < 10 * (K + 1) {
f1[zi] = nf1[zi]
f2[zi] = nf2[zi]
zi = zi + 1
}
delta = 0.0
d = 0
while d <= 9 {
delta = delta + f1[d * (K + 1) + 1] + f2[d * (K + 1) + 1]
d = d + 1
}
ans = ans + delta
let tail_bound: f64 = delta * (R_BOUND / (1.0 - R_BOUND))
if tail_bound < TAIL_TOL { break }
length = length + 1
}
printf("%.10f\n", ans)
free(total)
free(nf2)
free(nf1)
free(f2)
free(f1)
free(comb)
free(pow10inv)
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 K = 20;
double TAIL_TOL = 0.0000000000005;
int64_t MAX_LEN = 10000;
double R_BOUND = 0.991;
double* pow10inv = (double*)(calloc((K + 1), 8));
double* comb = (double*)(calloc(((K + 1) * (K + 1)), 8));
double* f1 = (double*)(calloc((10 * (K + 1)), 8));
double* f2 = (double*)(calloc((10 * (K + 1)), 8));
double* nf1 = (double*)(calloc((10 * (K + 1)), 8));
double* nf2 = (double*)(calloc((10 * (K + 1)), 8));
double* total = (double*)(calloc((K + 1), 8));
if ((((pow10inv == NULL || comb == NULL) || f1 == NULL) || f2 == NULL)) {
return 1;
}
if (((nf1 == NULL || nf2 == NULL) || total == NULL)) {
return 1;
}
int64_t j = 1;
while (j <= K) {
pow10inv[j] = pow(10.0, (0.0 - ((double)(j))));
j = (j + 1);
}
j = 1;
while (j <= K) {
int64_t i = 0;
while (i <= (K - j)) {
double c = 1.0;
int64_t t = 1;
while (t <= i) {
c = (c * (((double)(((j + i) - t))) / ((double)(t))));
t = (t + 1);
}
comb[((j * (K + 1)) + i)] = c;
i = (i + 1);
}
j = (j + 1);
}
int64_t d = 0;
while (d <= 9) {
int64_t pre = 10;
while (pre < 100) {
int64_t a = FLOW_CHECKED_DIV((pre), (10));
int64_t b = FLOW_CHECKED_MOD((pre), (10));
if ((a == b && b == d)) {
pre = (pre + 1);
continue;
}
int64_t x = ((pre * 10) + d);
double inv = (1.0 / ((double)(x)));
double p = inv;
int64_t base = (d * (K + 1));
j = 1;
while (j <= K) {
if (b == d) {
f2[(base + j)] = (f2[(base + j)] + p);
} else {
f1[(base + j)] = (f1[(base + j)] + p);
}
p = (p * inv);
j = (j + 1);
}
pre = (pre + 1);
}
d = (d + 1);
}
double ans = 0.0;
int64_t n = 1;
while (n < 100) {
ans = (ans + (1.0 / ((double)(n))));
n = (n + 1);
}
double delta = 0.0;
d = 0;
while (d <= 9) {
delta = ((delta + f1[((d * (K + 1)) + 1)]) + f2[((d * (K + 1)) + 1)]);
d = (d + 1);
}
ans = (ans + delta);
int64_t length = 4;
while (length <= MAX_LEN) {
int64_t p = 1;
while (p <= K) {
double s = 0.0;
d = 0;
while (d <= 9) {
s = ((s + f1[((d * (K + 1)) + p)]) + f2[((d * (K + 1)) + p)]);
d = (d + 1);
}
total[p] = s;
p = (p + 1);
}
int64_t zi = 0;
while (zi < (10 * (K + 1))) {
nf1[zi] = 0.0;
nf2[zi] = 0.0;
zi = (zi + 1);
}
d = 0;
while (d <= 9) {
double md = (0.0 - (((double)(d)) / 10.0));
int64_t base_d = (d * (K + 1));
j = 1;
while (j <= K) {
double base = pow10inv[j];
double pre_pow = 1.0;
int64_t i = 0;
while (i <= (K - j)) {
double c = ((comb[((j * (K + 1)) + i)] * pre_pow) * base);
int64_t pwr = (i + j);
double f1dp = f1[(base_d + pwr)];
nf2[(base_d + j)] = (nf2[(base_d + j)] + (c * f1dp));
double excl = (f1dp + f2[(base_d + pwr)]);
nf1[(base_d + j)] = (nf1[(base_d + j)] + (c * (total[pwr] - excl)));
pre_pow = (pre_pow * md);
i = (i + 1);
}
j = (j + 1);
}
d = (d + 1);
}
zi = 0;
while (zi < (10 * (K + 1))) {
f1[zi] = nf1[zi];
f2[zi] = nf2[zi];
zi = (zi + 1);
}
delta = 0.0;
d = 0;
while (d <= 9) {
delta = ((delta + f1[((d * (K + 1)) + 1)]) + f2[((d * (K + 1)) + 1)]);
d = (d + 1);
}
ans = (ans + delta);
double tail_bound = (delta * (R_BOUND / (1.0 - R_BOUND)));
if (tail_bound < TAIL_TOL) {
break;
}
length = (length + 1);
}
printf("%.10f\n", ans);
free(total);
free(nf2);
free(nf1);
free(f2);
free(f1);
free(comb);
free(pow10inv);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.10f\n\00") {addr_space = 0 : i32} : !llvm.array<7 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
func.func private @pow(f64, f64) -> f64
func.func @main() -> i32 {
%0 = arith.constant 20 : i32
%1 = arith.extsi %0 : i32 to i64
%2 = arith.constant 0.0000000000005 : f32
%3 = arith.extf %2 : f32 to f64
%4 = arith.constant 10000 : i32
%5 = arith.extsi %4 : i32 to i64
%6 = arith.constant 0.991 : f32
%7 = arith.extf %6 : f32 to f64
%9 = arith.constant 1 : i32
%11 = arith.extsi %9 : i32 to i64
%10 = arith.addi %1, %11 : i64
%12 = arith.constant 8 : i32
%13 = arith.extsi %12 : i32 to i64
%8 = func.call @calloc(%10, %13) : (i64, i64) -> !llvm.ptr
%15 = arith.constant 1 : i32
%17 = arith.extsi %15 : i32 to i64
%16 = arith.addi %1, %17 : i64
%18 = arith.constant 1 : i32
%20 = arith.extsi %18 : i32 to i64
%19 = arith.addi %1, %20 : i64
%21 = arith.muli %16, %19 : i64
%22 = arith.constant 8 : i32
%23 = arith.extsi %22 : i32 to i64
%14 = func.call @calloc(%21, %23) : (i64, i64) -> !llvm.ptr
%25 = arith.constant 10 : i32
%26 = arith.constant 1 : i32
%28 = arith.extsi %26 : i32 to i64
%27 = arith.addi %1, %28 : i64
%30 = arith.extsi %25 : i32 to i64
%29 = arith.muli %30, %27 : i64
%31 = arith.constant 8 : i32
%32 = arith.extsi %31 : i32 to i64
%24 = func.call @calloc(%29, %32) : (i64, i64) -> !llvm.ptr
%34 = arith.constant 10 : i32
%35 = arith.constant 1 : i32
%37 = arith.extsi %35 : i32 to i64
%36 = arith.addi %1, %37 : i64
%39 = arith.extsi %34 : i32 to i64
%38 = arith.muli %39, %36 : i64
%40 = arith.constant 8 : i32
%41 = arith.extsi %40 : i32 to i64
%33 = func.call @calloc(%38, %41) : (i64, i64) -> !llvm.ptr
%43 = arith.constant 10 : i32
%44 = arith.constant 1 : i32
%46 = arith.extsi %44 : i32 to i64
%45 = arith.addi %1, %46 : i64
%48 = arith.extsi %43 : i32 to i64
%47 = arith.muli %48, %45 : i64
%49 = arith.constant 8 : i32
%50 = arith.extsi %49 : i32 to i64
%42 = func.call @calloc(%47, %50) : (i64, i64) -> !llvm.ptr
%52 = arith.constant 10 : i32
%53 = arith.constant 1 : i32
%55 = arith.extsi %53 : i32 to i64
%54 = arith.addi %1, %55 : i64
%57 = arith.extsi %52 : i32 to i64
%56 = arith.muli %57, %54 : i64
%58 = arith.constant 8 : i32
%59 = arith.extsi %58 : i32 to i64
%51 = func.call @calloc(%56, %59) : (i64, i64) -> !llvm.ptr
%61 = arith.constant 1 : i32
%63 = arith.extsi %61 : i32 to i64
%62 = arith.addi %1, %63 : i64
%64 = arith.constant 8 : i32
%65 = arith.extsi %64 : i32 to i64
%60 = func.call @calloc(%62, %65) : (i64, i64) -> !llvm.ptr
%66 = llvm.mlir.zero : !llvm.ptr
%67 = llvm.icmp "eq" %8, %66 : !llvm.ptr
%68 = scf.if %67 -> (i1) {
%69 = arith.constant true
scf.yield %69 : i1
} else {
%70 = llvm.mlir.zero : !llvm.ptr
%71 = llvm.icmp "eq" %14, %70 : !llvm.ptr
scf.yield %71 : i1
}
%72 = scf.if %68 -> (i1) {
%73 = arith.constant true
scf.yield %73 : i1
} else {
%74 = llvm.mlir.zero : !llvm.ptr
%75 = llvm.icmp "eq" %24, %74 : !llvm.ptr
scf.yield %75 : i1
}
%76 = scf.if %72 -> (i1) {
%77 = arith.constant true
scf.yield %77 : i1
} else {
%78 = llvm.mlir.zero : !llvm.ptr
%79 = llvm.icmp "eq" %33, %78 : !llvm.ptr
scf.yield %79 : i1
}
cf.cond_br %76, ^bb0, ^bb1
^bb0:
%80 = arith.constant 1 : i32
func.return %80 : i32
^bb1:
cf.br ^bb2
^bb2:
%81 = llvm.mlir.zero : !llvm.ptr
%82 = llvm.icmp "eq" %42, %81 : !llvm.ptr
%83 = scf.if %82 -> (i1) {
%84 = arith.constant true
scf.yield %84 : i1
} else {
%85 = llvm.mlir.zero : !llvm.ptr
%86 = llvm.icmp "eq" %51, %85 : !llvm.ptr
scf.yield %86 : i1
}
%87 = scf.if %83 -> (i1) {
%88 = arith.constant true
scf.yield %88 : i1
} else {
%89 = llvm.mlir.zero : !llvm.ptr
%90 = llvm.icmp "eq" %60, %89 : !llvm.ptr
scf.yield %90 : i1
}
cf.cond_br %87, ^bb3, ^bb4
^bb3:
%91 = arith.constant 1 : i32
func.return %91 : i32
^bb4:
cf.br ^bb5
^bb5:
%92 = arith.constant 1 : i32
%93 = arith.extsi %92 : i32 to i64
%94 = llvm.mlir.constant(1 : i64) : i64
%95 = llvm.alloca %94 x i64 : (i64) -> !llvm.ptr
llvm.store %93, %95 : i64, !llvm.ptr
cf.br ^bb6
^bb6:
%96 = llvm.load %95 : !llvm.ptr -> i64
%97 = arith.cmpi sle, %96, %1 : i64
cf.cond_br %97, ^bb7, ^bb8
^bb7:
%99 = arith.constant 10.0 : f32
%100 = arith.constant 0.0 : f32
%101 = llvm.load %95 : !llvm.ptr -> i64
%102 = arith.sitofp %101 : i64 to f64
%104 = arith.extf %100 : f32 to f64
%103 = arith.subf %104, %102 : f64
%105 = arith.extf %99 : f32 to f64
%98 = func.call @pow(%105, %103) : (f64, f64) -> f64
%106 = llvm.load %95 : !llvm.ptr -> i64
%107 = llvm.getelementptr %8[%106] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %98, %107 : f64, !llvm.ptr
%108 = llvm.load %95 : !llvm.ptr -> i64
%109 = arith.constant 1 : i32
%111 = arith.extsi %109 : i32 to i64
%110 = arith.addi %108, %111 : i64
llvm.store %110, %95 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
%112 = arith.constant 1 : i32
%113 = arith.extsi %112 : i32 to i64
llvm.store %113, %95 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%114 = llvm.load %95 : !llvm.ptr -> i64
%115 = arith.cmpi sle, %114, %1 : i64
cf.cond_br %115, ^bb10, ^bb11
^bb10:
%116 = arith.constant 0 : i32
%117 = arith.extsi %116 : i32 to i64
%118 = llvm.mlir.constant(1 : i64) : i64
%119 = llvm.alloca %118 x i64 : (i64) -> !llvm.ptr
llvm.store %117, %119 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%120 = llvm.load %119 : !llvm.ptr -> i64
%121 = llvm.load %95 : !llvm.ptr -> i64
%122 = arith.subi %1, %121 : i64
%123 = arith.cmpi sle, %120, %122 : i64
cf.cond_br %123, ^bb13, ^bb14
^bb13:
%124 = arith.constant 1.0 : f32
%125 = arith.extf %124 : f32 to f64
%126 = llvm.mlir.constant(1 : i64) : i64
%127 = llvm.alloca %126 x f64 : (i64) -> !llvm.ptr
llvm.store %125, %127 : f64, !llvm.ptr
%128 = arith.constant 1 : i32
%129 = arith.extsi %128 : i32 to i64
%130 = llvm.mlir.constant(1 : i64) : i64
%131 = llvm.alloca %130 x i64 : (i64) -> !llvm.ptr
llvm.store %129, %131 : i64, !llvm.ptr
cf.br ^bb15
^bb15:
%132 = llvm.load %131 : !llvm.ptr -> i64
%133 = llvm.load %119 : !llvm.ptr -> i64
%134 = arith.cmpi sle, %132, %133 : i64
cf.cond_br %134, ^bb16, ^bb17
^bb16:
%135 = llvm.load %127 : !llvm.ptr -> f64
%136 = llvm.load %95 : !llvm.ptr -> i64
%137 = llvm.load %119 : !llvm.ptr -> i64
%138 = arith.addi %136, %137 : i64
%139 = llvm.load %131 : !llvm.ptr -> i64
%140 = arith.subi %138, %139 : i64
%141 = arith.sitofp %140 : i64 to f64
%142 = llvm.load %131 : !llvm.ptr -> i64
%143 = arith.sitofp %142 : i64 to f64
%144 = arith.divf %141, %143 : f64
%145 = arith.mulf %135, %144 : f64
llvm.store %145, %127 : f64, !llvm.ptr
%146 = llvm.load %131 : !llvm.ptr -> i64
%147 = arith.constant 1 : i32
%149 = arith.extsi %147 : i32 to i64
%148 = arith.addi %146, %149 : i64
llvm.store %148, %131 : i64, !llvm.ptr
cf.br ^bb15
^bb17:
%150 = llvm.load %127 : !llvm.ptr -> f64
%151 = llvm.load %95 : !llvm.ptr -> i64
%152 = arith.constant 1 : i32
%154 = arith.extsi %152 : i32 to i64
%153 = arith.addi %1, %154 : i64
%155 = arith.muli %151, %153 : i64
%156 = llvm.load %119 : !llvm.ptr -> i64
%157 = arith.addi %155, %156 : i64
%158 = llvm.getelementptr %14[%157] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %150, %158 : f64, !llvm.ptr
%159 = llvm.load %119 : !llvm.ptr -> i64
%160 = arith.constant 1 : i32
%162 = arith.extsi %160 : i32 to i64
%161 = arith.addi %159, %162 : i64
llvm.store %161, %119 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%163 = llvm.load %95 : !llvm.ptr -> i64
%164 = arith.constant 1 : i32
%166 = arith.extsi %164 : i32 to i64
%165 = arith.addi %163, %166 : i64
llvm.store %165, %95 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
%167 = arith.constant 0 : i32
%168 = arith.extsi %167 : i32 to i64
%169 = llvm.mlir.constant(1 : i64) : i64
%170 = llvm.alloca %169 x i64 : (i64) -> !llvm.ptr
llvm.store %168, %170 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%171 = llvm.load %170 : !llvm.ptr -> i64
%172 = arith.constant 9 : i32
%174 = arith.extsi %172 : i32 to i64
%173 = arith.cmpi sle, %171, %174 : i64
cf.cond_br %173, ^bb19, ^bb20
^bb19:
%175 = arith.constant 10 : i32
%176 = arith.extsi %175 : i32 to i64
%177 = llvm.mlir.constant(1 : i64) : i64
%178 = llvm.alloca %177 x i64 : (i64) -> !llvm.ptr
llvm.store %176, %178 : i64, !llvm.ptr
cf.br ^bb21
^bb21:
%179 = llvm.load %178 : !llvm.ptr -> i64
%180 = arith.constant 100 : i32
%182 = arith.extsi %180 : i32 to i64
%181 = arith.cmpi slt, %179, %182 : i64
cf.cond_br %181, ^bb22, ^bb23
^bb22:
%183 = llvm.load %178 : !llvm.ptr -> i64
%184 = arith.constant 10 : i32
%186 = arith.extsi %184 : i32 to i64
%185 = arith.divsi %183, %186 : i64
%187 = llvm.load %178 : !llvm.ptr -> i64
%188 = arith.constant 10 : i32
%190 = arith.extsi %188 : i32 to i64
%189 = arith.remsi %187, %190 : i64
%191 = arith.cmpi eq, %185, %189 : i64
%192 = scf.if %191 -> (i1) {
%193 = llvm.load %170 : !llvm.ptr -> i64
%194 = arith.cmpi eq, %189, %193 : i64
scf.yield %194 : i1
} else {
%195 = arith.constant false
scf.yield %195 : i1
}
cf.cond_br %192, ^bb24, ^bb25
^bb24:
%196 = llvm.load %178 : !llvm.ptr -> i64
%197 = arith.constant 1 : i32
%199 = arith.extsi %197 : i32 to i64
%198 = arith.addi %196, %199 : i64
llvm.store %198, %178 : i64, !llvm.ptr
cf.br ^bb21
^bb25:
cf.br ^bb26
^bb26:
%200 = llvm.load %178 : !llvm.ptr -> i64
%201 = arith.constant 10 : i32
%203 = arith.extsi %201 : i32 to i64
%202 = arith.muli %200, %203 : i64
%204 = llvm.load %170 : !llvm.ptr -> i64
%205 = arith.addi %202, %204 : i64
%206 = arith.constant 1.0 : f32
%207 = arith.sitofp %205 : i64 to f64
%209 = arith.extf %206 : f32 to f64
%208 = arith.divf %209, %207 : f64
%210 = llvm.mlir.constant(1 : i64) : i64
%211 = llvm.alloca %210 x f64 : (i64) -> !llvm.ptr
llvm.store %208, %211 : f64, !llvm.ptr
%212 = llvm.load %170 : !llvm.ptr -> i64
%213 = arith.constant 1 : i32
%215 = arith.extsi %213 : i32 to i64
%214 = arith.addi %1, %215 : i64
%216 = arith.muli %212, %214 : i64
%217 = arith.constant 1 : i32
%218 = arith.extsi %217 : i32 to i64
llvm.store %218, %95 : i64, !llvm.ptr
cf.br ^bb27
^bb27:
%219 = llvm.load %95 : !llvm.ptr -> i64
%220 = arith.cmpi sle, %219, %1 : i64
cf.cond_br %220, ^bb28, ^bb29
^bb28:
%221 = llvm.load %170 : !llvm.ptr -> i64
%222 = arith.cmpi eq, %189, %221 : i64
cf.cond_br %222, ^bb30, ^bb31
^bb30:
%224 = llvm.load %95 : !llvm.ptr -> i64
%225 = arith.addi %216, %224 : i64
%226 = llvm.getelementptr %33[%225] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%223 = llvm.load %226 : !llvm.ptr -> f64
%227 = llvm.load %211 : !llvm.ptr -> f64
%228 = arith.addf %223, %227 : f64
%229 = llvm.load %95 : !llvm.ptr -> i64
%230 = arith.addi %216, %229 : i64
%231 = llvm.getelementptr %33[%230] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %228, %231 : f64, !llvm.ptr
cf.br ^bb32
^bb31:
%233 = llvm.load %95 : !llvm.ptr -> i64
%234 = arith.addi %216, %233 : i64
%235 = llvm.getelementptr %24[%234] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%232 = llvm.load %235 : !llvm.ptr -> f64
%236 = llvm.load %211 : !llvm.ptr -> f64
%237 = arith.addf %232, %236 : f64
%238 = llvm.load %95 : !llvm.ptr -> i64
%239 = arith.addi %216, %238 : i64
%240 = llvm.getelementptr %24[%239] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %237, %240 : f64, !llvm.ptr
cf.br ^bb32
^bb32:
%241 = llvm.load %211 : !llvm.ptr -> f64
%242 = arith.mulf %241, %208 : f64
llvm.store %242, %211 : f64, !llvm.ptr
%243 = llvm.load %95 : !llvm.ptr -> i64
%244 = arith.constant 1 : i32
%246 = arith.extsi %244 : i32 to i64
%245 = arith.addi %243, %246 : i64
llvm.store %245, %95 : i64, !llvm.ptr
cf.br ^bb27
^bb29:
%247 = llvm.load %178 : !llvm.ptr -> i64
%248 = arith.constant 1 : i32
%250 = arith.extsi %248 : i32 to i64
%249 = arith.addi %247, %250 : i64
llvm.store %249, %178 : i64, !llvm.ptr
cf.br ^bb21
^bb23:
%251 = llvm.load %170 : !llvm.ptr -> i64
%252 = arith.constant 1 : i32
%254 = arith.extsi %252 : i32 to i64
%253 = arith.addi %251, %254 : i64
llvm.store %253, %170 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
%255 = arith.constant 0.0 : f32
%256 = arith.extf %255 : f32 to f64
%257 = llvm.mlir.constant(1 : i64) : i64
%258 = llvm.alloca %257 x f64 : (i64) -> !llvm.ptr
llvm.store %256, %258 : f64, !llvm.ptr
%259 = arith.constant 1 : i32
%260 = arith.extsi %259 : i32 to i64
%261 = llvm.mlir.constant(1 : i64) : i64
%262 = llvm.alloca %261 x i64 : (i64) -> !llvm.ptr
llvm.store %260, %262 : i64, !llvm.ptr
cf.br ^bb33
^bb33:
%263 = llvm.load %262 : !llvm.ptr -> i64
%264 = arith.constant 100 : i32
%266 = arith.extsi %264 : i32 to i64
%265 = arith.cmpi slt, %263, %266 : i64
cf.cond_br %265, ^bb34, ^bb35
^bb34:
%267 = llvm.load %258 : !llvm.ptr -> f64
%268 = arith.constant 1.0 : f32
%269 = llvm.load %262 : !llvm.ptr -> i64
%270 = arith.sitofp %269 : i64 to f64
%272 = arith.extf %268 : f32 to f64
%271 = arith.divf %272, %270 : f64
%273 = arith.addf %267, %271 : f64
llvm.store %273, %258 : f64, !llvm.ptr
%274 = llvm.load %262 : !llvm.ptr -> i64
%275 = arith.constant 1 : i32
%277 = arith.extsi %275 : i32 to i64
%276 = arith.addi %274, %277 : i64
llvm.store %276, %262 : i64, !llvm.ptr
cf.br ^bb33
^bb35:
%278 = arith.constant 0.0 : f32
%279 = arith.extf %278 : f32 to f64
%280 = llvm.mlir.constant(1 : i64) : i64
%281 = llvm.alloca %280 x f64 : (i64) -> !llvm.ptr
llvm.store %279, %281 : f64, !llvm.ptr
%282 = arith.constant 0 : i32
%283 = arith.extsi %282 : i32 to i64
llvm.store %283, %170 : i64, !llvm.ptr
cf.br ^bb36
^bb36:
%284 = llvm.load %170 : !llvm.ptr -> i64
%285 = arith.constant 9 : i32
%287 = arith.extsi %285 : i32 to i64
%286 = arith.cmpi sle, %284, %287 : i64
cf.cond_br %286, ^bb37, ^bb38
^bb37:
%288 = llvm.load %281 : !llvm.ptr -> f64
%290 = llvm.load %170 : !llvm.ptr -> i64
%291 = arith.constant 1 : i32
%293 = arith.extsi %291 : i32 to i64
%292 = arith.addi %1, %293 : i64
%294 = arith.muli %290, %292 : i64
%295 = arith.constant 1 : i32
%297 = arith.extsi %295 : i32 to i64
%296 = arith.addi %294, %297 : i64
%298 = llvm.getelementptr %24[%296] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%289 = llvm.load %298 : !llvm.ptr -> f64
%299 = arith.addf %288, %289 : f64
%301 = llvm.load %170 : !llvm.ptr -> i64
%302 = arith.constant 1 : i32
%304 = arith.extsi %302 : i32 to i64
%303 = arith.addi %1, %304 : i64
%305 = arith.muli %301, %303 : i64
%306 = arith.constant 1 : i32
%308 = arith.extsi %306 : i32 to i64
%307 = arith.addi %305, %308 : i64
%309 = llvm.getelementptr %33[%307] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%300 = llvm.load %309 : !llvm.ptr -> f64
%310 = arith.addf %299, %300 : f64
llvm.store %310, %281 : f64, !llvm.ptr
%311 = llvm.load %170 : !llvm.ptr -> i64
%312 = arith.constant 1 : i32
%314 = arith.extsi %312 : i32 to i64
%313 = arith.addi %311, %314 : i64
llvm.store %313, %170 : i64, !llvm.ptr
cf.br ^bb36
^bb38:
%315 = llvm.load %258 : !llvm.ptr -> f64
%316 = llvm.load %281 : !llvm.ptr -> f64
%317 = arith.addf %315, %316 : f64
llvm.store %317, %258 : f64, !llvm.ptr
%318 = arith.constant 4 : i32
%319 = arith.extsi %318 : i32 to i64
%320 = llvm.mlir.constant(1 : i64) : i64
%321 = llvm.alloca %320 x i64 : (i64) -> !llvm.ptr
llvm.store %319, %321 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%322 = llvm.load %321 : !llvm.ptr -> i64
%323 = arith.cmpi sle, %322, %5 : i64
cf.cond_br %323, ^bb40, ^bb41
^bb40:
%324 = arith.constant 1 : i32
%325 = arith.extsi %324 : i32 to i64
%326 = llvm.mlir.constant(1 : i64) : i64
%327 = llvm.alloca %326 x i64 : (i64) -> !llvm.ptr
llvm.store %325, %327 : i64, !llvm.ptr
cf.br ^bb42
^bb42:
%328 = llvm.load %327 : !llvm.ptr -> i64
%329 = arith.cmpi sle, %328, %1 : i64
cf.cond_br %329, ^bb43, ^bb44
^bb43:
%330 = arith.constant 0.0 : f32
%331 = arith.extf %330 : f32 to f64
%332 = llvm.mlir.constant(1 : i64) : i64
%333 = llvm.alloca %332 x f64 : (i64) -> !llvm.ptr
llvm.store %331, %333 : f64, !llvm.ptr
%334 = arith.constant 0 : i32
%335 = arith.extsi %334 : i32 to i64
llvm.store %335, %170 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%336 = llvm.load %170 : !llvm.ptr -> i64
%337 = arith.constant 9 : i32
%339 = arith.extsi %337 : i32 to i64
%338 = arith.cmpi sle, %336, %339 : i64
cf.cond_br %338, ^bb46, ^bb47
^bb46:
%340 = llvm.load %333 : !llvm.ptr -> f64
%342 = llvm.load %170 : !llvm.ptr -> i64
%343 = arith.constant 1 : i32
%345 = arith.extsi %343 : i32 to i64
%344 = arith.addi %1, %345 : i64
%346 = arith.muli %342, %344 : i64
%347 = llvm.load %327 : !llvm.ptr -> i64
%348 = arith.addi %346, %347 : i64
%349 = llvm.getelementptr %24[%348] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%341 = llvm.load %349 : !llvm.ptr -> f64
%350 = arith.addf %340, %341 : f64
%352 = llvm.load %170 : !llvm.ptr -> i64
%353 = arith.constant 1 : i32
%355 = arith.extsi %353 : i32 to i64
%354 = arith.addi %1, %355 : i64
%356 = arith.muli %352, %354 : i64
%357 = llvm.load %327 : !llvm.ptr -> i64
%358 = arith.addi %356, %357 : i64
%359 = llvm.getelementptr %33[%358] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%351 = llvm.load %359 : !llvm.ptr -> f64
%360 = arith.addf %350, %351 : f64
llvm.store %360, %333 : f64, !llvm.ptr
%361 = llvm.load %170 : !llvm.ptr -> i64
%362 = arith.constant 1 : i32
%364 = arith.extsi %362 : i32 to i64
%363 = arith.addi %361, %364 : i64
llvm.store %363, %170 : i64, !llvm.ptr
cf.br ^bb45
^bb47:
%365 = llvm.load %333 : !llvm.ptr -> f64
%366 = llvm.load %327 : !llvm.ptr -> i64
%367 = llvm.getelementptr %60[%366] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %365, %367 : f64, !llvm.ptr
%368 = llvm.load %327 : !llvm.ptr -> i64
%369 = arith.constant 1 : i32
%371 = arith.extsi %369 : i32 to i64
%370 = arith.addi %368, %371 : i64
llvm.store %370, %327 : i64, !llvm.ptr
cf.br ^bb42
^bb44:
%372 = arith.constant 0 : i32
%373 = arith.extsi %372 : i32 to i64
%374 = llvm.mlir.constant(1 : i64) : i64
%375 = llvm.alloca %374 x i64 : (i64) -> !llvm.ptr
llvm.store %373, %375 : i64, !llvm.ptr
cf.br ^bb48
^bb48:
%376 = llvm.load %375 : !llvm.ptr -> i64
%377 = arith.constant 10 : i32
%378 = arith.constant 1 : i32
%380 = arith.extsi %378 : i32 to i64
%379 = arith.addi %1, %380 : i64
%382 = arith.extsi %377 : i32 to i64
%381 = arith.muli %382, %379 : i64
%383 = arith.cmpi slt, %376, %381 : i64
cf.cond_br %383, ^bb49, ^bb50
^bb49:
%384 = arith.constant 0.0 : f32
%385 = llvm.load %375 : !llvm.ptr -> i64
%386 = arith.extf %384 : f32 to f64
%387 = llvm.getelementptr %42[%385] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %386, %387 : f64, !llvm.ptr
%388 = arith.constant 0.0 : f32
%389 = llvm.load %375 : !llvm.ptr -> i64
%390 = arith.extf %388 : f32 to f64
%391 = llvm.getelementptr %51[%389] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %390, %391 : f64, !llvm.ptr
%392 = llvm.load %375 : !llvm.ptr -> i64
%393 = arith.constant 1 : i32
%395 = arith.extsi %393 : i32 to i64
%394 = arith.addi %392, %395 : i64
llvm.store %394, %375 : i64, !llvm.ptr
cf.br ^bb48
^bb50:
%396 = arith.constant 0 : i32
%397 = arith.extsi %396 : i32 to i64
llvm.store %397, %170 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%398 = llvm.load %170 : !llvm.ptr -> i64
%399 = arith.constant 9 : i32
%401 = arith.extsi %399 : i32 to i64
%400 = arith.cmpi sle, %398, %401 : i64
cf.cond_br %400, ^bb52, ^bb53
^bb52:
%402 = arith.constant 0.0 : f32
%403 = llvm.load %170 : !llvm.ptr -> i64
%404 = arith.sitofp %403 : i64 to f64
%405 = arith.constant 10.0 : f32
%407 = arith.extf %405 : f32 to f64
%406 = arith.divf %404, %407 : f64
%409 = arith.extf %402 : f32 to f64
%408 = arith.subf %409, %406 : f64
%410 = llvm.load %170 : !llvm.ptr -> i64
%411 = arith.constant 1 : i32
%413 = arith.extsi %411 : i32 to i64
%412 = arith.addi %1, %413 : i64
%414 = arith.muli %410, %412 : i64
%415 = arith.constant 1 : i32
%416 = arith.extsi %415 : i32 to i64
llvm.store %416, %95 : i64, !llvm.ptr
cf.br ^bb54
^bb54:
%417 = llvm.load %95 : !llvm.ptr -> i64
%418 = arith.cmpi sle, %417, %1 : i64
cf.cond_br %418, ^bb55, ^bb56
^bb55:
%420 = llvm.load %95 : !llvm.ptr -> i64
%421 = llvm.getelementptr %8[%420] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%419 = llvm.load %421 : !llvm.ptr -> f64
%422 = arith.constant 1.0 : f32
%423 = arith.extf %422 : f32 to f64
%424 = llvm.mlir.constant(1 : i64) : i64
%425 = llvm.alloca %424 x f64 : (i64) -> !llvm.ptr
llvm.store %423, %425 : f64, !llvm.ptr
%426 = arith.constant 0 : i32
%427 = arith.extsi %426 : i32 to i64
%428 = llvm.mlir.constant(1 : i64) : i64
%429 = llvm.alloca %428 x i64 : (i64) -> !llvm.ptr
llvm.store %427, %429 : i64, !llvm.ptr
cf.br ^bb57
^bb57:
%430 = llvm.load %429 : !llvm.ptr -> i64
%431 = llvm.load %95 : !llvm.ptr -> i64
%432 = arith.subi %1, %431 : i64
%433 = arith.cmpi sle, %430, %432 : i64
cf.cond_br %433, ^bb58, ^bb59
^bb58:
%435 = llvm.load %95 : !llvm.ptr -> i64
%436 = arith.constant 1 : i32
%438 = arith.extsi %436 : i32 to i64
%437 = arith.addi %1, %438 : i64
%439 = arith.muli %435, %437 : i64
%440 = llvm.load %429 : !llvm.ptr -> i64
%441 = arith.addi %439, %440 : i64
%442 = llvm.getelementptr %14[%441] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%434 = llvm.load %442 : !llvm.ptr -> f64
%443 = llvm.load %425 : !llvm.ptr -> f64
%444 = arith.mulf %434, %443 : f64
%445 = arith.mulf %444, %419 : f64
%446 = llvm.load %429 : !llvm.ptr -> i64
%447 = llvm.load %95 : !llvm.ptr -> i64
%448 = arith.addi %446, %447 : i64
%450 = arith.addi %414, %448 : i64
%451 = llvm.getelementptr %24[%450] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%449 = llvm.load %451 : !llvm.ptr -> f64
%453 = llvm.load %95 : !llvm.ptr -> i64
%454 = arith.addi %414, %453 : i64
%455 = llvm.getelementptr %51[%454] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%452 = llvm.load %455 : !llvm.ptr -> f64
%456 = arith.mulf %445, %449 : f64
%457 = arith.addf %452, %456 : f64
%458 = llvm.load %95 : !llvm.ptr -> i64
%459 = arith.addi %414, %458 : i64
%460 = llvm.getelementptr %51[%459] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %457, %460 : f64, !llvm.ptr
%462 = arith.addi %414, %448 : i64
%463 = llvm.getelementptr %33[%462] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%461 = llvm.load %463 : !llvm.ptr -> f64
%464 = arith.addf %449, %461 : f64
%466 = llvm.load %95 : !llvm.ptr -> i64
%467 = arith.addi %414, %466 : i64
%468 = llvm.getelementptr %42[%467] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%465 = llvm.load %468 : !llvm.ptr -> f64
%470 = llvm.getelementptr %60[%448] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%469 = llvm.load %470 : !llvm.ptr -> f64
%471 = arith.subf %469, %464 : f64
%472 = arith.mulf %445, %471 : f64
%473 = arith.addf %465, %472 : f64
%474 = llvm.load %95 : !llvm.ptr -> i64
%475 = arith.addi %414, %474 : i64
%476 = llvm.getelementptr %42[%475] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %473, %476 : f64, !llvm.ptr
%477 = llvm.load %425 : !llvm.ptr -> f64
%478 = arith.mulf %477, %408 : f64
llvm.store %478, %425 : f64, !llvm.ptr
%479 = llvm.load %429 : !llvm.ptr -> i64
%480 = arith.constant 1 : i32
%482 = arith.extsi %480 : i32 to i64
%481 = arith.addi %479, %482 : i64
llvm.store %481, %429 : i64, !llvm.ptr
cf.br ^bb57
^bb59:
%483 = llvm.load %95 : !llvm.ptr -> i64
%484 = arith.constant 1 : i32
%486 = arith.extsi %484 : i32 to i64
%485 = arith.addi %483, %486 : i64
llvm.store %485, %95 : i64, !llvm.ptr
cf.br ^bb54
^bb56:
%487 = llvm.load %170 : !llvm.ptr -> i64
%488 = arith.constant 1 : i32
%490 = arith.extsi %488 : i32 to i64
%489 = arith.addi %487, %490 : i64
llvm.store %489, %170 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
%491 = arith.constant 0 : i32
%492 = arith.extsi %491 : i32 to i64
llvm.store %492, %375 : i64, !llvm.ptr
cf.br ^bb60
^bb60:
%493 = llvm.load %375 : !llvm.ptr -> i64
%494 = arith.constant 10 : i32
%495 = arith.constant 1 : i32
%497 = arith.extsi %495 : i32 to i64
%496 = arith.addi %1, %497 : i64
%499 = arith.extsi %494 : i32 to i64
%498 = arith.muli %499, %496 : i64
%500 = arith.cmpi slt, %493, %498 : i64
cf.cond_br %500, ^bb61, ^bb62
^bb61:
%502 = llvm.load %375 : !llvm.ptr -> i64
%503 = llvm.getelementptr %42[%502] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%501 = llvm.load %503 : !llvm.ptr -> f64
%504 = llvm.load %375 : !llvm.ptr -> i64
%505 = llvm.getelementptr %24[%504] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %501, %505 : f64, !llvm.ptr
%507 = llvm.load %375 : !llvm.ptr -> i64
%508 = llvm.getelementptr %51[%507] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%506 = llvm.load %508 : !llvm.ptr -> f64
%509 = llvm.load %375 : !llvm.ptr -> i64
%510 = llvm.getelementptr %33[%509] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %506, %510 : f64, !llvm.ptr
%511 = llvm.load %375 : !llvm.ptr -> i64
%512 = arith.constant 1 : i32
%514 = arith.extsi %512 : i32 to i64
%513 = arith.addi %511, %514 : i64
llvm.store %513, %375 : i64, !llvm.ptr
cf.br ^bb60
^bb62:
%515 = arith.constant 0.0 : f32
%516 = arith.extf %515 : f32 to f64
llvm.store %516, %281 : f64, !llvm.ptr
%517 = arith.constant 0 : i32
%518 = arith.extsi %517 : i32 to i64
llvm.store %518, %170 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%519 = llvm.load %170 : !llvm.ptr -> i64
%520 = arith.constant 9 : i32
%522 = arith.extsi %520 : i32 to i64
%521 = arith.cmpi sle, %519, %522 : i64
cf.cond_br %521, ^bb64, ^bb65
^bb64:
%523 = llvm.load %281 : !llvm.ptr -> f64
%525 = llvm.load %170 : !llvm.ptr -> i64
%526 = arith.constant 1 : i32
%528 = arith.extsi %526 : i32 to i64
%527 = arith.addi %1, %528 : i64
%529 = arith.muli %525, %527 : i64
%530 = arith.constant 1 : i32
%532 = arith.extsi %530 : i32 to i64
%531 = arith.addi %529, %532 : i64
%533 = llvm.getelementptr %24[%531] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%524 = llvm.load %533 : !llvm.ptr -> f64
%534 = arith.addf %523, %524 : f64
%536 = llvm.load %170 : !llvm.ptr -> i64
%537 = arith.constant 1 : i32
%539 = arith.extsi %537 : i32 to i64
%538 = arith.addi %1, %539 : i64
%540 = arith.muli %536, %538 : i64
%541 = arith.constant 1 : i32
%543 = arith.extsi %541 : i32 to i64
%542 = arith.addi %540, %543 : i64
%544 = llvm.getelementptr %33[%542] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%535 = llvm.load %544 : !llvm.ptr -> f64
%545 = arith.addf %534, %535 : f64
llvm.store %545, %281 : f64, !llvm.ptr
%546 = llvm.load %170 : !llvm.ptr -> i64
%547 = arith.constant 1 : i32
%549 = arith.extsi %547 : i32 to i64
%548 = arith.addi %546, %549 : i64
llvm.store %548, %170 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
%550 = llvm.load %258 : !llvm.ptr -> f64
%551 = llvm.load %281 : !llvm.ptr -> f64
%552 = arith.addf %550, %551 : f64
llvm.store %552, %258 : f64, !llvm.ptr
%553 = llvm.load %281 : !llvm.ptr -> f64
%554 = arith.constant 1.0 : f32
%556 = arith.extf %554 : f32 to f64
%555 = arith.subf %556, %7 : f64
%557 = arith.divf %7, %555 : f64
%558 = arith.mulf %553, %557 : f64
%559 = arith.cmpf olt, %558, %3 : f64
cf.cond_br %559, ^bb66, ^bb67
^bb66:
cf.br ^bb41
^bb67:
cf.br ^bb68
^bb68:
%560 = llvm.load %321 : !llvm.ptr -> i64
%561 = arith.constant 1 : i32
%563 = arith.extsi %561 : i32 to i64
%562 = arith.addi %560, %563 : i64
llvm.store %562, %321 : i64, !llvm.ptr
cf.br ^bb39
^bb41:
%564 = llvm.mlir.addressof @str_0 : !llvm.ptr
%565 = llvm.load %258 : !llvm.ptr -> f64
%566 = llvm.call @printf(%564, %565) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
func.call @free(%60) : (!llvm.ptr) -> ()
func.call @free(%51) : (!llvm.ptr) -> ()
func.call @free(%42) : (!llvm.ptr) -> ()
func.call @free(%33) : (!llvm.ptr) -> ()
func.call @free(%24) : (!llvm.ptr) -> ()
func.call @free(%14) : (!llvm.ptr) -> ()
func.call @free(%8) : (!llvm.ptr) -> ()
%574 = arith.constant 0 : i32
func.return %574 : i32
}
}