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