← All problems
Problem 589
Poisson Games — iterative/direct C1 solver + Gaussian elimination.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^2)?
Space complexity O(n^2)?
Approach Flow solution Not curated
Verdict Unknown
Flow source
# Project Euler 589
# Poisson Games — iterative/direct C1 solver + Gaussian elimination.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function fabs(x: f64) -> f64
}
function arith_sum(a: i64, b: i64) -> f64 {
if a > b { return 0.0 }
let n: f64 = ((b - a + 1) as f64)
return ((a + b) as f64) * n * 0.5
}
function expected_min_consecutive(low: i64, high: i64) -> f64 {
let L: i64 = high - low + 1
let denom: f64 = ((L * L) as f64)
let mut total: f64 = 0.0
let mut i: i64 = 0
while i < L {
let v: f64 = (low + i) as f64
let w: f64 = ((2 * L - 2 * i - 1) as f64) / denom
total = total + v * w
i = i + 1
}
return total
}
function prefix_fill(arr: ptr<f64>, pref: ptr<f64>, M: i64) -> void {
let mut s: f64 = 0.0
pref[0] = 0.0
let mut i: i64 = 1
while i <= M {
s = s + arr[i]
pref[i] = s
i = i + 1
}
}
function compute_C1_iterative(n: i64, m: i64, C1: ptr<f64>, B0_out: ptr<f64>) -> i32 {
let L: i64 = m - n + 1
let A_low: i64 = n + 5
let A_high: i64 = m + 5
let M: i64 = A_high
let EminA: f64 = expected_min_consecutive(A_low, A_high)
let k: f64 = (L as f64) / ((L - 1) as f64)
let invL: f64 = 1.0 / (L as f64)
let meanA: f64 = 0.5 * ((A_low + A_high) as f64)
let C0: ptr<f64> = calloc(M + 1, 8)
let newC0: ptr<f64> = calloc(M + 1, 8)
let newC1: ptr<f64> = calloc(M + 1, 8)
let pref: ptr<f64> = calloc(M + 1, 8)
let mut x: i64 = 1
while x <= M {
let mut mx: f64 = meanA
if meanA >= (x as f64) {
mx = (x as f64)
}
C1[x] = meanA + mx
C0[x] = meanA + (x as f64)
x = x + 1
}
let w: f64 = 1.15
let mut ok: i32 = 0
let mut it: i32 = 0
while it < 2000 {
prefix_fill(C1, pref, M)
let mut ss: f64 = 0.0
let mut d: i64 = 1
while d < L {
ss = ss + ((L - d) as f64) * 2.0 * C1[d]
d = d + 1
}
let B0: f64 = k * (EminA + ss / ((L * L) as f64))
x = 1
while x <= M {
let mut lt_low: i64 = A_low
let mut lt_high: i64 = A_high
if lt_high > x - 1 {
lt_high = x - 1
}
let sum_lt_a: f64 = arith_sum(lt_low, lt_high)
let mut sum_lt_C: f64 = 0.0
if lt_low <= lt_high {
let y_lo: i64 = x - lt_high
let y_hi: i64 = x - lt_low
let mut sub: f64 = 0.0
if y_lo > 1 {
sub = pref[y_lo - 1]
}
sum_lt_C = pref[y_hi] - sub
}
let mut gt_low: i64 = A_low
if gt_low < x + 1 {
gt_low = x + 1
}
let gt_high: i64 = A_high
let mut count_gt: i64 = gt_high - gt_low + 1
if count_gt < 0 {
count_gt = 0
}
let base_gt: f64 = (count_gt as f64) * (x as f64)
let mut sum_gt_C: f64 = 0.0
if gt_low <= gt_high {
let y_lo: i64 = gt_low - x
let y_hi: i64 = gt_high - x
let mut sub: f64 = 0.0
if y_lo > 1 {
sub = pref[y_lo - 1]
}
sum_gt_C = pref[y_hi] - sub
}
let mut total: f64 = sum_lt_a + sum_lt_C + base_gt + sum_gt_C
if A_low <= x {
if x <= A_high {
total = total + (x as f64) + B0
}
}
newC0[x] = total * invL
x = x + 1
}
x = 1
while x <= M {
C0[x] = C0[x] + w * (newC0[x] - C0[x])
x = x + 1
}
prefix_fill(C0, pref, M)
ss = 0.0
d = 1
while d < L {
ss = ss + ((L - d) as f64) * C0[d]
d = d + 1
}
let B1: f64 = k * (EminA + ss / ((L * L) as f64))
let mut err: f64 = 0.0
let mut bad: i32 = 0
x = 1
while x <= M {
if bad == 0 {
let mut lt_low: i64 = A_low
let mut lt_high: i64 = A_high
if lt_high > x - 1 {
lt_high = x - 1
}
let sum_lt_a: f64 = arith_sum(lt_low, lt_high)
let mut gt_low: i64 = A_low
if gt_low < x + 1 {
gt_low = x + 1
}
let gt_high: i64 = A_high
let mut count_gt: i64 = gt_high - gt_low + 1
if count_gt < 0 {
count_gt = 0
}
let base_gt: f64 = (count_gt as f64) * (x as f64)
let mut sum_gt_C: f64 = 0.0
if gt_low <= gt_high {
let y_lo: i64 = gt_low - x
let y_hi: i64 = gt_high - x
let mut sub: f64 = 0.0
if y_lo > 1 {
sub = pref[y_lo - 1]
}
sum_gt_C = pref[y_hi] - sub
}
let mut total: f64 = sum_lt_a + base_gt + sum_gt_C
if A_low <= x {
if x <= A_high {
total = total + (x as f64) + B1
}
}
newC1[x] = total * invL
let v: f64 = C1[x] + w * (newC1[x] - C1[x])
if v != v {
bad = 1
}
if fabs(v) > 1e300 {
bad = 1
}
if bad == 0 {
let e: f64 = fabs(v - C1[x])
if e > err {
err = e
}
C1[x] = v
}
}
x = x + 1
}
if bad == 1 {
break
}
if err < 1e-12 {
ss = 0.0
d = 1
while d < L {
ss = ss + ((L - d) as f64) * 2.0 * C1[d]
d = d + 1
}
B0_out[0] = k * (EminA + ss / ((L * L) as f64))
ok = 1
break
}
it = it + 1
}
free(C0)
free(newC0)
free(newC1)
free(pref)
return ok
}
function gauss_solve(A: ptr<f64>, b: ptr<f64>, n: i64, xout: ptr<f64>) -> void {
let mut i: i64 = 0
while i < n {
A[i * (n + 1) + n] = b[i]
i = i + 1
}
let mut col: i64 = 0
while col < n {
let mut piv: i64 = col
let mut best: f64 = fabs(A[col * (n + 1) + col])
let mut r: i64 = col + 1
while r < n {
let v: f64 = fabs(A[r * (n + 1) + col])
if v > best {
best = v
piv = r
}
r = r + 1
}
if piv != col {
let mut j: i64 = col
while j <= n {
let tmp: f64 = A[col * (n + 1) + j]
A[col * (n + 1) + j] = A[piv * (n + 1) + j]
A[piv * (n + 1) + j] = tmp
j = j + 1
}
}
let inv: f64 = 1.0 / A[col * (n + 1) + col]
let mut j: i64 = col
while j <= n {
A[col * (n + 1) + j] = A[col * (n + 1) + j] * inv
j = j + 1
}
r = 0
while r < n {
if r != col {
let factor: f64 = A[r * (n + 1) + col]
if factor != 0.0 {
let mut j: i64 = col
while j <= n {
A[r * (n + 1) + j] = A[r * (n + 1) + j] - factor * A[col * (n + 1) + j]
j = j + 1
}
}
}
r = r + 1
}
col = col + 1
}
i = 0
while i < n {
xout[i] = A[i * (n + 1) + n]
i = i + 1
}
}
function compute_C1_direct(n: i64, m: i64, C1: ptr<f64>, B0_out: ptr<f64>) -> void {
let L: i64 = m - n + 1
let A_low: i64 = n + 5
let A_high: i64 = m + 5
let M: i64 = A_high
let EminA: f64 = expected_min_consecutive(A_low, A_high)
let k: f64 = (L as f64) / ((L - 1) as f64)
let invL: f64 = 1.0 / (L as f64)
let q0: ptr<f64> = calloc(M + 1, 8)
let p0: ptr<f64> = calloc((M + 1) * (M + 1), 8)
let pref_q: ptr<f64> = calloc(M + 1, 8)
let pref_p: ptr<f64> = calloc((M + 1) * (M + 1), 8)
let b1: ptr<f64> = calloc(M + 1, 8)
let b0_coeff: ptr<f64> = calloc(M + 1, 8)
let B0_const: f64 = k * EminA
let mut d: i64 = 1
while d < L {
if d <= M {
b0_coeff[d] = k * (2.0 / ((L * L) as f64)) * ((L - d) as f64)
}
d = d + 1
}
let mut y: i64 = 1
while y <= M {
let mut lt_low: i64 = A_low
let mut lt_high: i64 = A_high
if lt_high > y - 1 {
lt_high = y - 1
}
let sum_lt_a: f64 = arith_sum(lt_low, lt_high)
if lt_low <= lt_high {
let mut j: i64 = y - lt_high
while j <= y - lt_low {
if j >= 1 {
if j <= M {
p0[y * (M + 1) + j] = p0[y * (M + 1) + j] + invL
}
}
j = j + 1
}
}
let mut gt_low: i64 = A_low
if gt_low < y + 1 {
gt_low = y + 1
}
let gt_high: i64 = A_high
let mut count_gt: i64 = gt_high - gt_low + 1
if count_gt < 0 {
count_gt = 0
}
let base_gt: f64 = (count_gt as f64) * (y as f64)
if gt_low <= gt_high {
let mut j: i64 = gt_low - y
while j <= gt_high - y {
if j >= 1 {
if j <= M {
p0[y * (M + 1) + j] = p0[y * (M + 1) + j] + invL
}
}
j = j + 1
}
}
let mut q: f64 = (sum_lt_a + base_gt) * invL
if A_low <= y {
if y <= A_high {
q = q + (y as f64) * invL + B0_const * invL
let mut d2: i64 = 1
while d2 < L {
if d2 <= M {
p0[y * (M + 1) + d2] = p0[y * (M + 1) + d2] + b0_coeff[d2] * invL
}
d2 = d2 + 1
}
}
}
q0[y] = q
y = y + 1
}
prefix_fill(q0, pref_q, M)
let mut j: i64 = 1
while j <= M {
let mut s: f64 = 0.0
let mut yy: i64 = 1
while yy <= M {
s = s + p0[yy * (M + 1) + j]
pref_p[j * (M + 1) + yy] = s
yy = yy + 1
}
j = j + 1
}
let mut sum_w_q: f64 = 0.0
d = 1
while d < L {
if d <= M {
sum_w_q = sum_w_q + ((L - d) as f64) * q0[d]
}
d = d + 1
}
let constB1: f64 = k * EminA + k * (1.0 / ((L * L) as f64)) * sum_w_q
j = 1
while j <= M {
let mut ss: f64 = 0.0
d = 1
while d < L {
if d <= M {
ss = ss + ((L - d) as f64) * p0[d * (M + 1) + j]
}
d = d + 1
}
b1[j] = k * (1.0 / ((L * L) as f64)) * ss
j = j + 1
}
let A_mat: ptr<f64> = calloc(M * (M + 1), 8)
let b_vec: ptr<f64> = calloc(M, 8)
let sol: ptr<f64> = calloc(M, 8)
let mut t: i64 = 1
while t <= M {
let mut lt_low: i64 = A_low
let mut lt_high: i64 = A_high
if lt_high > t - 1 {
lt_high = t - 1
}
let sum_lt_a: f64 = arith_sum(lt_low, lt_high)
let mut gt_low: i64 = A_low
if gt_low < t + 1 {
gt_low = t + 1
}
let gt_high: i64 = A_high
let mut count_gt: i64 = gt_high - gt_low + 1
if count_gt < 0 {
count_gt = 0
}
let base_gt: f64 = (count_gt as f64) * (t as f64)
let mut const1: f64 = (sum_lt_a + base_gt) * invL
if A_low <= t {
if t <= A_high {
const1 = const1 + (t as f64) * invL
}
}
if gt_low <= gt_high {
let y_lo: i64 = gt_low - t
let y_hi: i64 = gt_high - t
let mut sub_q: f64 = 0.0
if y_lo > 1 {
sub_q = pref_q[y_lo - 1]
}
let Qgt: f64 = pref_q[y_hi] - sub_q
let mut j2: i64 = 1
while j2 <= M {
let mut sub_p: f64 = 0.0
if y_lo > 1 {
sub_p = pref_p[j2 * (M + 1) + (y_lo - 1)]
}
let Pgt: f64 = pref_p[j2 * (M + 1) + y_hi] - sub_p
A_mat[(t - 1) * (M + 1) + (j2 - 1)] = A_mat[(t - 1) * (M + 1) + (j2 - 1)] - invL * Pgt
j2 = j2 + 1
}
let rhs_part: f64 = const1 + invL * Qgt
if A_low <= t {
if t <= A_high {
let mut j3: i64 = 1
while j3 <= M {
A_mat[(t - 1) * (M + 1) + (j3 - 1)] = A_mat[(t - 1) * (M + 1) + (j3 - 1)] - invL * b1[j3]
j3 = j3 + 1
}
b_vec[t - 1] = rhs_part + invL * constB1
}
else {
b_vec[t - 1] = rhs_part
}
}
else {
b_vec[t - 1] = rhs_part
}
}
else {
let rhs_part: f64 = const1
if A_low <= t {
if t <= A_high {
let mut j3: i64 = 1
while j3 <= M {
A_mat[(t - 1) * (M + 1) + (j3 - 1)] = A_mat[(t - 1) * (M + 1) + (j3 - 1)] - invL * b1[j3]
j3 = j3 + 1
}
b_vec[t - 1] = rhs_part + invL * constB1
}
else {
b_vec[t - 1] = rhs_part
}
}
else {
b_vec[t - 1] = rhs_part
}
}
A_mat[(t - 1) * (M + 1) + (t - 1)] = A_mat[(t - 1) * (M + 1) + (t - 1)] + 1.0
t = t + 1
}
gauss_solve(A_mat, b_vec, M, sol)
let mut j4: i64 = 1
while j4 <= M {
C1[j4] = sol[j4 - 1]
j4 = j4 + 1
}
let mut ss2: f64 = 0.0
d = 1
while d < L {
ss2 = ss2 + ((L - d) as f64) * 2.0 * C1[d]
d = d + 1
}
B0_out[0] = k * (EminA + ss2 / ((L * L) as f64))
free(q0)
free(p0)
free(pref_q)
free(pref_p)
free(b1)
free(b0_coeff)
free(A_mat)
free(b_vec)
free(sol)
}
function expected_game(m: i64, n: i64) -> f64 {
let L: i64 = m - n + 1
let M: i64 = m + 5
let C1: ptr<f64> = calloc(M + 1, 8)
let B0_arr: ptr<f64> = calloc(1, 8)
B0_arr[0] = 0.0
let mut used: i32 = 0
if L >= 25 {
used = compute_C1_iterative(n, m, C1, B0_arr)
}
if used == 0 {
compute_C1_direct(n, m, C1, B0_arr)
}
let B0: f64 = B0_arr[0]
let Emin0: f64 = expected_min_consecutive(n, m)
let mut s: f64 = B0 * (1.0 / (L as f64))
let denom: f64 = ((L * L) as f64)
let mut d: i64 = 1
while d < L {
s = s + (2.0 * ((L - d) as f64) / denom) * C1[d]
d = d + 1
}
free(C1)
free(B0_arr)
return Emin0 + s
}
function main() -> i32 {
let mut total: f64 = 0.0
let mut m: i64 = 2
while m <= 100 {
let mut n: i64 = 1
while n < m {
total = total + expected_game(m, n)
n = n + 1
}
m = m + 1
}
printf("%.2f\n", total)
return 0
}
Generated C
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
while (flow_temp_head) {
flow_temp_node* n = flow_temp_head;
flow_temp_head = n->next;
free(n);
}
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
if (!node) return NULL;
node->next = flow_temp_head;
flow_temp_head = node;
if (!flow_temp_atexit_set) {
flow_temp_atexit_set = 1;
atexit(flow_temp_free_all);
}
return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
char* r = (char*)flow_temp_alloc(la + lb + 1);
if (!r) return NULL;
if (la) memcpy(r, a, la);
if (lb) memcpy(r + la, b, lb);
r[la + lb] = '\0';
return r;
}
#define __flow_in_arr(arr, val) __extension__ ({ \
int _found = 0; \
size_t _n = sizeof(arr)/sizeof((arr)[0]); \
for (size_t _i = 0; _i < _n; _i++) { \
if ((arr)[_i] == (val)) { _found = 1; break; } \
} _found; })
/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
abort();
#if defined(__GNUC__) || defined(__clang__)
__builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")
#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#include <math.h>
void* _ui_state = NULL;
static inline float i32_to_f32(int32_t v) { return (float)v; }
/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }
double arith_sum_i64_i64(int64_t a, int64_t b);
double expected_min_consecutive_i64_i64(int64_t low, int64_t high);
void prefix_fill_ptr_f64_ptr_f64_i64(double* arr, double* pref, int64_t M);
int32_t compute_C1_iterative_i64_i64_ptr_f64_ptr_f64(int64_t n, int64_t m, double* C1, double* B0_out);
void gauss_solve_ptr_f64_ptr_f64_i64_ptr_f64(double* A, double* b, int64_t n, double* xout);
void compute_C1_direct_i64_i64_ptr_f64_ptr_f64(int64_t n, int64_t m, double* C1, double* B0_out);
double expected_game_i64_i64(int64_t m, int64_t n);
int32_t main(void);
double arith_sum_i64_i64(int64_t a, int64_t b) {
if (a > b) {
return 0.0;
}
double n = ((double)(((b - a) + 1)));
return ((((double)((a + b))) * n) * 0.5);
}
double expected_min_consecutive_i64_i64(int64_t low, int64_t high) {
int64_t L = ((high - low) + 1);
double denom = ((double)((L * L)));
double total = 0.0;
int64_t i = 0;
while (i < L) {
double v = ((double)((low + i)));
double w = (((double)((((2 * L) - (2 * i)) - 1))) / denom);
total = (total + (v * w));
i = (i + 1);
}
return total;
}
void prefix_fill_ptr_f64_ptr_f64_i64(double* arr, double* pref, int64_t M) {
double s = 0.0;
pref[0] = 0.0;
int64_t i = 1;
while (i <= M) {
s = (s + arr[i]);
pref[i] = s;
i = (i + 1);
}
}
int32_t compute_C1_iterative_i64_i64_ptr_f64_ptr_f64(int64_t n, int64_t m, double* C1, double* B0_out) {
int64_t L = ((m - n) + 1);
int64_t A_low = (n + 5);
int64_t A_high = (m + 5);
int64_t M = A_high;
double EminA = expected_min_consecutive_i64_i64(A_low, A_high);
double k = (((double)(L)) / ((double)((L - 1))));
double invL = (1.0 / ((double)(L)));
double meanA = (0.5 * ((double)((A_low + A_high))));
double* C0 = (double*)(calloc((M + 1), 8));
double* newC0 = (double*)(calloc((M + 1), 8));
double* newC1 = (double*)(calloc((M + 1), 8));
double* pref = (double*)(calloc((M + 1), 8));
int64_t x = 1;
while (x <= M) {
double mx = meanA;
if (meanA >= ((double)(x))) {
mx = ((double)(x));
}
C1[x] = (meanA + mx);
C0[x] = (meanA + ((double)(x)));
x = (x + 1);
}
double w = 1.15;
int32_t ok = 0;
int32_t it = 0;
while (it < 2000) {
prefix_fill_ptr_f64_ptr_f64_i64(C1, pref, M);
double ss = 0.0;
int64_t d = 1;
while (d < L) {
ss = (ss + ((((double)((L - d))) * 2.0) * C1[d]));
d = (d + 1);
}
double B0 = (k * (EminA + (ss / ((double)((L * L))))));
x = 1;
while (x <= M) {
int64_t lt_low = A_low;
int64_t lt_high = A_high;
if (lt_high > (x - 1)) {
lt_high = (x - 1);
}
double sum_lt_a = arith_sum_i64_i64(lt_low, lt_high);
double sum_lt_C = 0.0;
if (lt_low <= lt_high) {
int64_t y_lo = (x - lt_high);
int64_t y_hi = (x - lt_low);
double sub = 0.0;
if (y_lo > 1) {
sub = pref[(y_lo - 1)];
}
sum_lt_C = (pref[y_hi] - sub);
}
int64_t gt_low = A_low;
if (gt_low < (x + 1)) {
gt_low = (x + 1);
}
int64_t gt_high = A_high;
int64_t count_gt = ((gt_high - gt_low) + 1);
if (count_gt < 0) {
count_gt = 0;
}
double base_gt = (((double)(count_gt)) * ((double)(x)));
double sum_gt_C = 0.0;
if (gt_low <= gt_high) {
int64_t y_lo = (gt_low - x);
int64_t y_hi = (gt_high - x);
double sub = 0.0;
if (y_lo > 1) {
sub = pref[(y_lo - 1)];
}
sum_gt_C = (pref[y_hi] - sub);
}
double total = (((sum_lt_a + sum_lt_C) + base_gt) + sum_gt_C);
if (A_low <= x) {
if (x <= A_high) {
total = ((total + ((double)(x))) + B0);
}
}
newC0[x] = (total * invL);
x = (x + 1);
}
x = 1;
while (x <= M) {
C0[x] = (C0[x] + (w * (newC0[x] - C0[x])));
x = (x + 1);
}
prefix_fill_ptr_f64_ptr_f64_i64(C0, pref, M);
ss = 0.0;
d = 1;
while (d < L) {
ss = (ss + (((double)((L - d))) * C0[d]));
d = (d + 1);
}
double B1 = (k * (EminA + (ss / ((double)((L * L))))));
double err = 0.0;
int32_t bad = 0;
x = 1;
while (x <= M) {
if (bad == 0) {
int64_t lt_low = A_low;
int64_t lt_high = A_high;
if (lt_high > (x - 1)) {
lt_high = (x - 1);
}
double sum_lt_a = arith_sum_i64_i64(lt_low, lt_high);
int64_t gt_low = A_low;
if (gt_low < (x + 1)) {
gt_low = (x + 1);
}
int64_t gt_high = A_high;
int64_t count_gt = ((gt_high - gt_low) + 1);
if (count_gt < 0) {
count_gt = 0;
}
double base_gt = (((double)(count_gt)) * ((double)(x)));
double sum_gt_C = 0.0;
if (gt_low <= gt_high) {
int64_t y_lo = (gt_low - x);
int64_t y_hi = (gt_high - x);
double sub = 0.0;
if (y_lo > 1) {
sub = pref[(y_lo - 1)];
}
sum_gt_C = (pref[y_hi] - sub);
}
double total = ((sum_lt_a + base_gt) + sum_gt_C);
if (A_low <= x) {
if (x <= A_high) {
total = ((total + ((double)(x))) + B1);
}
}
newC1[x] = (total * invL);
double v = (C1[x] + (w * (newC1[x] - C1[x])));
if (v != v) {
bad = 1;
}
if (fabs(v) > 1e300) {
bad = 1;
}
if (bad == 0) {
double e = fabs((v - C1[x]));
if (e > err) {
err = e;
}
C1[x] = v;
}
}
x = (x + 1);
}
if (bad == 1) {
break;
}
if (err < 1e-12) {
ss = 0.0;
d = 1;
while (d < L) {
ss = (ss + ((((double)((L - d))) * 2.0) * C1[d]));
d = (d + 1);
}
B0_out[0] = (k * (EminA + (ss / ((double)((L * L))))));
ok = 1;
break;
}
it = (it + 1);
}
free(C0);
free(newC0);
free(newC1);
free(pref);
return ok;
}
void gauss_solve_ptr_f64_ptr_f64_i64_ptr_f64(double* A, double* b, int64_t n, double* xout) {
int64_t i = 0;
while (i < n) {
A[((i * (n + 1)) + n)] = b[i];
i = (i + 1);
}
int64_t col = 0;
while (col < n) {
int64_t piv = col;
double best = fabs(A[((col * (n + 1)) + col)]);
int64_t r = (col + 1);
while (r < n) {
double v = fabs(A[((r * (n + 1)) + col)]);
if (v > best) {
best = v;
piv = r;
}
r = (r + 1);
}
if (piv != col) {
int64_t j = col;
while (j <= n) {
double tmp = A[((col * (n + 1)) + j)];
A[((col * (n + 1)) + j)] = A[((piv * (n + 1)) + j)];
A[((piv * (n + 1)) + j)] = tmp;
j = (j + 1);
}
}
double inv = (1.0 / A[((col * (n + 1)) + col)]);
int64_t j = col;
while (j <= n) {
A[((col * (n + 1)) + j)] = (A[((col * (n + 1)) + j)] * inv);
j = (j + 1);
}
r = 0;
while (r < n) {
if (r != col) {
double factor = A[((r * (n + 1)) + col)];
if (factor != 0.0) {
int64_t j = col;
while (j <= n) {
A[((r * (n + 1)) + j)] = (A[((r * (n + 1)) + j)] - (factor * A[((col * (n + 1)) + j)]));
j = (j + 1);
}
}
}
r = (r + 1);
}
col = (col + 1);
}
i = 0;
while (i < n) {
xout[i] = A[((i * (n + 1)) + n)];
i = (i + 1);
}
}
void compute_C1_direct_i64_i64_ptr_f64_ptr_f64(int64_t n, int64_t m, double* C1, double* B0_out) {
int64_t L = ((m - n) + 1);
int64_t A_low = (n + 5);
int64_t A_high = (m + 5);
int64_t M = A_high;
double EminA = expected_min_consecutive_i64_i64(A_low, A_high);
double k = (((double)(L)) / ((double)((L - 1))));
double invL = (1.0 / ((double)(L)));
double* q0 = (double*)(calloc((M + 1), 8));
double* p0 = (double*)(calloc(((M + 1) * (M + 1)), 8));
double* pref_q = (double*)(calloc((M + 1), 8));
double* pref_p = (double*)(calloc(((M + 1) * (M + 1)), 8));
double* b1 = (double*)(calloc((M + 1), 8));
double* b0_coeff = (double*)(calloc((M + 1), 8));
double B0_const = (k * EminA);
int64_t d = 1;
while (d < L) {
if (d <= M) {
b0_coeff[d] = ((k * (2.0 / ((double)((L * L))))) * ((double)((L - d))));
}
d = (d + 1);
}
int64_t y = 1;
while (y <= M) {
int64_t lt_low = A_low;
int64_t lt_high = A_high;
if (lt_high > (y - 1)) {
lt_high = (y - 1);
}
double sum_lt_a = arith_sum_i64_i64(lt_low, lt_high);
if (lt_low <= lt_high) {
int64_t j = (y - lt_high);
while (j <= (y - lt_low)) {
if (j >= 1) {
if (j <= M) {
p0[((y * (M + 1)) + j)] = (p0[((y * (M + 1)) + j)] + invL);
}
}
j = (j + 1);
}
}
int64_t gt_low = A_low;
if (gt_low < (y + 1)) {
gt_low = (y + 1);
}
int64_t gt_high = A_high;
int64_t count_gt = ((gt_high - gt_low) + 1);
if (count_gt < 0) {
count_gt = 0;
}
double base_gt = (((double)(count_gt)) * ((double)(y)));
if (gt_low <= gt_high) {
int64_t j = (gt_low - y);
while (j <= (gt_high - y)) {
if (j >= 1) {
if (j <= M) {
p0[((y * (M + 1)) + j)] = (p0[((y * (M + 1)) + j)] + invL);
}
}
j = (j + 1);
}
}
double q = ((sum_lt_a + base_gt) * invL);
if (A_low <= y) {
if (y <= A_high) {
q = ((q + (((double)(y)) * invL)) + (B0_const * invL));
int64_t d2 = 1;
while (d2 < L) {
if (d2 <= M) {
p0[((y * (M + 1)) + d2)] = (p0[((y * (M + 1)) + d2)] + (b0_coeff[d2] * invL));
}
d2 = (d2 + 1);
}
}
}
q0[y] = q;
y = (y + 1);
}
prefix_fill_ptr_f64_ptr_f64_i64(q0, pref_q, M);
int64_t j = 1;
while (j <= M) {
double s = 0.0;
int64_t yy = 1;
while (yy <= M) {
s = (s + p0[((yy * (M + 1)) + j)]);
pref_p[((j * (M + 1)) + yy)] = s;
yy = (yy + 1);
}
j = (j + 1);
}
double sum_w_q = 0.0;
d = 1;
while (d < L) {
if (d <= M) {
sum_w_q = (sum_w_q + (((double)((L - d))) * q0[d]));
}
d = (d + 1);
}
double constB1 = ((k * EminA) + ((k * (1.0 / ((double)((L * L))))) * sum_w_q));
j = 1;
while (j <= M) {
double ss = 0.0;
d = 1;
while (d < L) {
if (d <= M) {
ss = (ss + (((double)((L - d))) * p0[((d * (M + 1)) + j)]));
}
d = (d + 1);
}
b1[j] = ((k * (1.0 / ((double)((L * L))))) * ss);
j = (j + 1);
}
double* A_mat = (double*)(calloc((M * (M + 1)), 8));
double* b_vec = (double*)(calloc(M, 8));
double* sol = (double*)(calloc(M, 8));
int64_t t = 1;
while (t <= M) {
int64_t lt_low = A_low;
int64_t lt_high = A_high;
if (lt_high > (t - 1)) {
lt_high = (t - 1);
}
double sum_lt_a = arith_sum_i64_i64(lt_low, lt_high);
int64_t gt_low = A_low;
if (gt_low < (t + 1)) {
gt_low = (t + 1);
}
int64_t gt_high = A_high;
int64_t count_gt = ((gt_high - gt_low) + 1);
if (count_gt < 0) {
count_gt = 0;
}
double base_gt = (((double)(count_gt)) * ((double)(t)));
double const1 = ((sum_lt_a + base_gt) * invL);
if (A_low <= t) {
if (t <= A_high) {
const1 = (const1 + (((double)(t)) * invL));
}
}
if (gt_low <= gt_high) {
int64_t y_lo = (gt_low - t);
int64_t y_hi = (gt_high - t);
double sub_q = 0.0;
if (y_lo > 1) {
sub_q = pref_q[(y_lo - 1)];
}
double Qgt = (pref_q[y_hi] - sub_q);
int64_t j2 = 1;
while (j2 <= M) {
double sub_p = 0.0;
if (y_lo > 1) {
sub_p = pref_p[((j2 * (M + 1)) + (y_lo - 1))];
}
double Pgt = (pref_p[((j2 * (M + 1)) + y_hi)] - sub_p);
A_mat[(((t - 1) * (M + 1)) + (j2 - 1))] = (A_mat[(((t - 1) * (M + 1)) + (j2 - 1))] - (invL * Pgt));
j2 = (j2 + 1);
}
double rhs_part = (const1 + (invL * Qgt));
if (A_low <= t) {
if (t <= A_high) {
int64_t j3 = 1;
while (j3 <= M) {
A_mat[(((t - 1) * (M + 1)) + (j3 - 1))] = (A_mat[(((t - 1) * (M + 1)) + (j3 - 1))] - (invL * b1[j3]));
j3 = (j3 + 1);
}
b_vec[(t - 1)] = (rhs_part + (invL * constB1));
} else {
b_vec[(t - 1)] = rhs_part;
}
} else {
b_vec[(t - 1)] = rhs_part;
}
} else {
double rhs_part = const1;
if (A_low <= t) {
if (t <= A_high) {
int64_t j3 = 1;
while (j3 <= M) {
A_mat[(((t - 1) * (M + 1)) + (j3 - 1))] = (A_mat[(((t - 1) * (M + 1)) + (j3 - 1))] - (invL * b1[j3]));
j3 = (j3 + 1);
}
b_vec[(t - 1)] = (rhs_part + (invL * constB1));
} else {
b_vec[(t - 1)] = rhs_part;
}
} else {
b_vec[(t - 1)] = rhs_part;
}
}
A_mat[(((t - 1) * (M + 1)) + (t - 1))] = (A_mat[(((t - 1) * (M + 1)) + (t - 1))] + 1.0);
t = (t + 1);
}
gauss_solve_ptr_f64_ptr_f64_i64_ptr_f64(A_mat, b_vec, M, sol);
int64_t j4 = 1;
while (j4 <= M) {
C1[j4] = sol[(j4 - 1)];
j4 = (j4 + 1);
}
double ss2 = 0.0;
d = 1;
while (d < L) {
ss2 = (ss2 + ((((double)((L - d))) * 2.0) * C1[d]));
d = (d + 1);
}
B0_out[0] = (k * (EminA + (ss2 / ((double)((L * L))))));
free(q0);
free(p0);
free(pref_q);
free(pref_p);
free(b1);
free(b0_coeff);
free(A_mat);
free(b_vec);
free(sol);
}
double expected_game_i64_i64(int64_t m, int64_t n) {
int64_t L = ((m - n) + 1);
int64_t M = (m + 5);
double* C1 = (double*)(calloc((M + 1), 8));
double* B0_arr = (double*)(calloc(1, 8));
B0_arr[0] = 0.0;
int32_t used = 0;
if (L >= 25) {
used = compute_C1_iterative_i64_i64_ptr_f64_ptr_f64(n, m, C1, B0_arr);
}
if (used == 0) {
compute_C1_direct_i64_i64_ptr_f64_ptr_f64(n, m, C1, B0_arr);
}
double B0 = B0_arr[0];
double Emin0 = expected_min_consecutive_i64_i64(n, m);
double s = (B0 * (1.0 / ((double)(L))));
double denom = ((double)((L * L)));
int64_t d = 1;
while (d < L) {
s = (s + (((2.0 * ((double)((L - d)))) / denom) * C1[d]));
d = (d + 1);
}
free(C1);
free(B0_arr);
return (Emin0 + s);
}
int32_t main(void) {
double total = 0.0;
int64_t m = 2;
while (m <= 100) {
int64_t n = 1;
while (n < m) {
total = (total + expected_game_i64_i64(m, n));
n = (n + 1);
}
m = (m + 1);
}
printf("%.2f\n", total);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.2f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
func.func private @fabs(f64) -> f64
func.func @arith_sum(%arg0: i64, %arg1: i64) -> f64 {
%0 = arith.cmpi sgt, %arg0, %arg1 : i64
cf.cond_br %0, ^bb0, ^bb1
^bb0:
%1 = arith.constant 0.0 : f32
%2 = arith.extf %1 : f32 to f64
func.return %2 : f64
^bb1:
cf.br ^bb2
^bb2:
%3 = arith.subi %arg1, %arg0 : i64
%4 = arith.constant 1 : i32
%6 = arith.extsi %4 : i32 to i64
%5 = arith.addi %3, %6 : i64
%7 = arith.sitofp %5 : i64 to f64
%8 = arith.addi %arg0, %arg1 : i64
%9 = arith.sitofp %8 : i64 to f64
%10 = arith.mulf %9, %7 : f64
%11 = arith.constant 0.5 : f32
%13 = arith.extf %11 : f32 to f64
%12 = arith.mulf %10, %13 : f64
func.return %12 : f64
}
func.func @expected_min_consecutive(%arg0: i64, %arg1: i64) -> f64 {
%14 = arith.subi %arg1, %arg0 : i64
%15 = arith.constant 1 : i32
%17 = arith.extsi %15 : i32 to i64
%16 = arith.addi %14, %17 : i64
%18 = arith.muli %16, %16 : i64
%19 = arith.sitofp %18 : i64 to f64
%20 = arith.constant 0.0 : f32
%21 = arith.extf %20 : f32 to f64
%22 = llvm.mlir.constant(1 : i64) : i64
%23 = llvm.alloca %22 x f64 : (i64) -> !llvm.ptr
llvm.store %21, %23 : f64, !llvm.ptr
%24 = arith.constant 0 : i32
%25 = arith.extsi %24 : i32 to i64
%26 = llvm.mlir.constant(1 : i64) : i64
%27 = llvm.alloca %26 x i64 : (i64) -> !llvm.ptr
llvm.store %25, %27 : i64, !llvm.ptr
cf.br ^bb3
^bb3:
%28 = llvm.load %27 : !llvm.ptr -> i64
%29 = arith.cmpi slt, %28, %16 : i64
cf.cond_br %29, ^bb4, ^bb5
^bb4:
%30 = llvm.load %27 : !llvm.ptr -> i64
%31 = arith.addi %arg0, %30 : i64
%32 = arith.sitofp %31 : i64 to f64
%33 = arith.constant 2 : i32
%35 = arith.extsi %33 : i32 to i64
%34 = arith.muli %35, %16 : i64
%36 = arith.constant 2 : i32
%37 = llvm.load %27 : !llvm.ptr -> i64
%39 = arith.extsi %36 : i32 to i64
%38 = arith.muli %39, %37 : i64
%40 = arith.subi %34, %38 : i64
%41 = arith.constant 1 : i32
%43 = arith.extsi %41 : i32 to i64
%42 = arith.subi %40, %43 : i64
%44 = arith.sitofp %42 : i64 to f64
%45 = arith.divf %44, %19 : f64
%46 = llvm.load %23 : !llvm.ptr -> f64
%47 = arith.mulf %32, %45 : f64
%48 = arith.addf %46, %47 : f64
llvm.store %48, %23 : f64, !llvm.ptr
%49 = llvm.load %27 : !llvm.ptr -> i64
%50 = arith.constant 1 : i32
%52 = arith.extsi %50 : i32 to i64
%51 = arith.addi %49, %52 : i64
llvm.store %51, %27 : i64, !llvm.ptr
cf.br ^bb3
^bb5:
%53 = llvm.load %23 : !llvm.ptr -> f64
func.return %53 : f64
}
func.func @prefix_fill(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64) -> () {
%54 = arith.constant 0.0 : f32
%55 = arith.extf %54 : f32 to f64
%56 = llvm.mlir.constant(1 : i64) : i64
%57 = llvm.alloca %56 x f64 : (i64) -> !llvm.ptr
llvm.store %55, %57 : f64, !llvm.ptr
%58 = arith.constant 0.0 : f32
%59 = arith.constant 0 : i32
%60 = arith.extf %58 : f32 to f64
%61 = arith.extsi %59 : i32 to i64
%62 = llvm.getelementptr %arg1[%61] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %60, %62 : f64, !llvm.ptr
%63 = arith.constant 1 : i32
%64 = arith.extsi %63 : i32 to i64
%65 = llvm.mlir.constant(1 : i64) : i64
%66 = llvm.alloca %65 x i64 : (i64) -> !llvm.ptr
llvm.store %64, %66 : i64, !llvm.ptr
cf.br ^bb6
^bb6:
%67 = llvm.load %66 : !llvm.ptr -> i64
%68 = arith.cmpi sle, %67, %arg2 : i64
cf.cond_br %68, ^bb7, ^bb8
^bb7:
%69 = llvm.load %57 : !llvm.ptr -> f64
%71 = llvm.load %66 : !llvm.ptr -> i64
%72 = llvm.getelementptr %arg0[%71] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%70 = llvm.load %72 : !llvm.ptr -> f64
%73 = arith.addf %69, %70 : f64
llvm.store %73, %57 : f64, !llvm.ptr
%74 = llvm.load %57 : !llvm.ptr -> f64
%75 = llvm.load %66 : !llvm.ptr -> i64
%76 = llvm.getelementptr %arg1[%75] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %74, %76 : f64, !llvm.ptr
%77 = llvm.load %66 : !llvm.ptr -> i64
%78 = arith.constant 1 : i32
%80 = arith.extsi %78 : i32 to i64
%79 = arith.addi %77, %80 : i64
llvm.store %79, %66 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
func.return
}
func.func @compute_C1_iterative(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: !llvm.ptr) -> i32 {
%81 = arith.subi %arg1, %arg0 : i64
%82 = arith.constant 1 : i32
%84 = arith.extsi %82 : i32 to i64
%83 = arith.addi %81, %84 : i64
%85 = arith.constant 5 : i32
%87 = arith.extsi %85 : i32 to i64
%86 = arith.addi %arg0, %87 : i64
%88 = arith.constant 5 : i32
%90 = arith.extsi %88 : i32 to i64
%89 = arith.addi %arg1, %90 : i64
%91 = func.call @expected_min_consecutive(%86, %89) : (i64, i64) -> f64
%92 = arith.sitofp %83 : i64 to f64
%93 = arith.constant 1 : i32
%95 = arith.extsi %93 : i32 to i64
%94 = arith.subi %83, %95 : i64
%96 = arith.sitofp %94 : i64 to f64
%97 = arith.divf %92, %96 : f64
%98 = arith.constant 1.0 : f32
%99 = arith.sitofp %83 : i64 to f64
%101 = arith.extf %98 : f32 to f64
%100 = arith.divf %101, %99 : f64
%102 = arith.constant 0.5 : f32
%103 = arith.addi %86, %89 : i64
%104 = arith.sitofp %103 : i64 to f64
%106 = arith.extf %102 : f32 to f64
%105 = arith.mulf %106, %104 : f64
%108 = arith.constant 1 : i32
%110 = arith.extsi %108 : i32 to i64
%109 = arith.addi %89, %110 : i64
%111 = arith.constant 8 : i32
%112 = arith.extsi %111 : i32 to i64
%107 = func.call @calloc(%109, %112) : (i64, i64) -> !llvm.ptr
%114 = arith.constant 1 : i32
%116 = arith.extsi %114 : i32 to i64
%115 = arith.addi %89, %116 : i64
%117 = arith.constant 8 : i32
%118 = arith.extsi %117 : i32 to i64
%113 = func.call @calloc(%115, %118) : (i64, i64) -> !llvm.ptr
%120 = arith.constant 1 : i32
%122 = arith.extsi %120 : i32 to i64
%121 = arith.addi %89, %122 : i64
%123 = arith.constant 8 : i32
%124 = arith.extsi %123 : i32 to i64
%119 = func.call @calloc(%121, %124) : (i64, i64) -> !llvm.ptr
%126 = arith.constant 1 : i32
%128 = arith.extsi %126 : i32 to i64
%127 = arith.addi %89, %128 : i64
%129 = arith.constant 8 : i32
%130 = arith.extsi %129 : i32 to i64
%125 = func.call @calloc(%127, %130) : (i64, i64) -> !llvm.ptr
%131 = arith.constant 1 : i32
%132 = arith.extsi %131 : i32 to i64
%133 = llvm.mlir.constant(1 : i64) : i64
%134 = llvm.alloca %133 x i64 : (i64) -> !llvm.ptr
llvm.store %132, %134 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%135 = llvm.load %134 : !llvm.ptr -> i64
%136 = arith.cmpi sle, %135, %89 : i64
cf.cond_br %136, ^bb10, ^bb11
^bb10:
%137 = llvm.mlir.constant(1 : i64) : i64
%138 = llvm.alloca %137 x f64 : (i64) -> !llvm.ptr
llvm.store %105, %138 : f64, !llvm.ptr
%139 = llvm.load %134 : !llvm.ptr -> i64
%140 = arith.sitofp %139 : i64 to f64
%141 = arith.cmpf oge, %105, %140 : f64
cf.cond_br %141, ^bb12, ^bb13
^bb12:
%142 = llvm.load %134 : !llvm.ptr -> i64
%143 = arith.sitofp %142 : i64 to f64
llvm.store %143, %138 : f64, !llvm.ptr
cf.br ^bb14
^bb13:
cf.br ^bb14
^bb14:
%144 = llvm.load %138 : !llvm.ptr -> f64
%145 = arith.addf %105, %144 : f64
%146 = llvm.load %134 : !llvm.ptr -> i64
%147 = llvm.getelementptr %arg2[%146] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %145, %147 : f64, !llvm.ptr
%148 = llvm.load %134 : !llvm.ptr -> i64
%149 = arith.sitofp %148 : i64 to f64
%150 = arith.addf %105, %149 : f64
%151 = llvm.load %134 : !llvm.ptr -> i64
%152 = llvm.getelementptr %107[%151] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %150, %152 : f64, !llvm.ptr
%153 = llvm.load %134 : !llvm.ptr -> i64
%154 = arith.constant 1 : i32
%156 = arith.extsi %154 : i32 to i64
%155 = arith.addi %153, %156 : i64
llvm.store %155, %134 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
%157 = arith.constant 1.15 : f32
%158 = arith.extf %157 : f32 to f64
%159 = arith.constant 0 : i32
%160 = llvm.mlir.constant(1 : i64) : i64
%161 = llvm.alloca %160 x i32 : (i64) -> !llvm.ptr
llvm.store %159, %161 : i32, !llvm.ptr
%162 = arith.constant 0 : i32
%163 = llvm.mlir.constant(1 : i64) : i64
%164 = llvm.alloca %163 x i32 : (i64) -> !llvm.ptr
llvm.store %162, %164 : i32, !llvm.ptr
cf.br ^bb15
^bb15:
%165 = llvm.load %164 : !llvm.ptr -> i32
%166 = arith.constant 2000 : i32
%167 = arith.cmpi slt, %165, %166 : i32
cf.cond_br %167, ^bb16, ^bb17
^bb16:
func.call @prefix_fill(%arg2, %125, %89) : (!llvm.ptr, !llvm.ptr, i64) -> ()
%169 = arith.constant 0.0 : f32
%170 = arith.extf %169 : f32 to f64
%171 = llvm.mlir.constant(1 : i64) : i64
%172 = llvm.alloca %171 x f64 : (i64) -> !llvm.ptr
llvm.store %170, %172 : f64, !llvm.ptr
%173 = arith.constant 1 : i32
%174 = arith.extsi %173 : i32 to i64
%175 = llvm.mlir.constant(1 : i64) : i64
%176 = llvm.alloca %175 x i64 : (i64) -> !llvm.ptr
llvm.store %174, %176 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%177 = llvm.load %176 : !llvm.ptr -> i64
%178 = arith.cmpi slt, %177, %83 : i64
cf.cond_br %178, ^bb19, ^bb20
^bb19:
%179 = llvm.load %172 : !llvm.ptr -> f64
%180 = llvm.load %176 : !llvm.ptr -> i64
%181 = arith.subi %83, %180 : i64
%182 = arith.sitofp %181 : i64 to f64
%183 = arith.constant 2.0 : f32
%185 = arith.extf %183 : f32 to f64
%184 = arith.mulf %182, %185 : f64
%187 = llvm.load %176 : !llvm.ptr -> i64
%188 = llvm.getelementptr %arg2[%187] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%186 = llvm.load %188 : !llvm.ptr -> f64
%189 = arith.mulf %184, %186 : f64
%190 = arith.addf %179, %189 : f64
llvm.store %190, %172 : f64, !llvm.ptr
%191 = llvm.load %176 : !llvm.ptr -> i64
%192 = arith.constant 1 : i32
%194 = arith.extsi %192 : i32 to i64
%193 = arith.addi %191, %194 : i64
llvm.store %193, %176 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
%195 = llvm.load %172 : !llvm.ptr -> f64
%196 = arith.muli %83, %83 : i64
%197 = arith.sitofp %196 : i64 to f64
%198 = arith.divf %195, %197 : f64
%199 = arith.addf %91, %198 : f64
%200 = arith.mulf %97, %199 : f64
%201 = arith.constant 1 : i32
%202 = arith.extsi %201 : i32 to i64
llvm.store %202, %134 : i64, !llvm.ptr
cf.br ^bb21
^bb21:
%203 = llvm.load %134 : !llvm.ptr -> i64
%204 = arith.cmpi sle, %203, %89 : i64
cf.cond_br %204, ^bb22, ^bb23
^bb22:
%205 = llvm.mlir.constant(1 : i64) : i64
%206 = llvm.alloca %205 x i64 : (i64) -> !llvm.ptr
llvm.store %86, %206 : i64, !llvm.ptr
%207 = llvm.mlir.constant(1 : i64) : i64
%208 = llvm.alloca %207 x i64 : (i64) -> !llvm.ptr
llvm.store %89, %208 : i64, !llvm.ptr
%209 = llvm.load %208 : !llvm.ptr -> i64
%210 = llvm.load %134 : !llvm.ptr -> i64
%211 = arith.constant 1 : i32
%213 = arith.extsi %211 : i32 to i64
%212 = arith.subi %210, %213 : i64
%214 = arith.cmpi sgt, %209, %212 : i64
cf.cond_br %214, ^bb24, ^bb25
^bb24:
%215 = llvm.load %134 : !llvm.ptr -> i64
%216 = arith.constant 1 : i32
%218 = arith.extsi %216 : i32 to i64
%217 = arith.subi %215, %218 : i64
llvm.store %217, %208 : i64, !llvm.ptr
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
%220 = llvm.load %206 : !llvm.ptr -> i64
%221 = llvm.load %208 : !llvm.ptr -> i64
%219 = func.call @arith_sum(%220, %221) : (i64, i64) -> f64
%222 = arith.constant 0.0 : f32
%223 = arith.extf %222 : f32 to f64
%224 = llvm.mlir.constant(1 : i64) : i64
%225 = llvm.alloca %224 x f64 : (i64) -> !llvm.ptr
llvm.store %223, %225 : f64, !llvm.ptr
%226 = llvm.load %206 : !llvm.ptr -> i64
%227 = llvm.load %208 : !llvm.ptr -> i64
%228 = arith.cmpi sle, %226, %227 : i64
cf.cond_br %228, ^bb27, ^bb28
^bb27:
%229 = llvm.load %134 : !llvm.ptr -> i64
%230 = llvm.load %208 : !llvm.ptr -> i64
%231 = arith.subi %229, %230 : i64
%232 = llvm.load %134 : !llvm.ptr -> i64
%233 = llvm.load %206 : !llvm.ptr -> i64
%234 = arith.subi %232, %233 : i64
%235 = arith.constant 0.0 : f32
%236 = arith.extf %235 : f32 to f64
%237 = llvm.mlir.constant(1 : i64) : i64
%238 = llvm.alloca %237 x f64 : (i64) -> !llvm.ptr
llvm.store %236, %238 : f64, !llvm.ptr
%239 = arith.constant 1 : i32
%241 = arith.extsi %239 : i32 to i64
%240 = arith.cmpi sgt, %231, %241 : i64
cf.cond_br %240, ^bb30, ^bb31
^bb30:
%243 = arith.constant 1 : i32
%245 = arith.extsi %243 : i32 to i64
%244 = arith.subi %231, %245 : i64
%246 = llvm.getelementptr %125[%244] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%242 = llvm.load %246 : !llvm.ptr -> f64
llvm.store %242, %238 : f64, !llvm.ptr
cf.br ^bb32
^bb31:
cf.br ^bb32
^bb32:
%248 = llvm.getelementptr %125[%234] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%247 = llvm.load %248 : !llvm.ptr -> f64
%249 = llvm.load %238 : !llvm.ptr -> f64
%250 = arith.subf %247, %249 : f64
llvm.store %250, %225 : f64, !llvm.ptr
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
%251 = llvm.mlir.constant(1 : i64) : i64
%252 = llvm.alloca %251 x i64 : (i64) -> !llvm.ptr
llvm.store %86, %252 : i64, !llvm.ptr
%253 = llvm.load %252 : !llvm.ptr -> i64
%254 = llvm.load %134 : !llvm.ptr -> i64
%255 = arith.constant 1 : i32
%257 = arith.extsi %255 : i32 to i64
%256 = arith.addi %254, %257 : i64
%258 = arith.cmpi slt, %253, %256 : i64
cf.cond_br %258, ^bb33, ^bb34
^bb33:
%259 = llvm.load %134 : !llvm.ptr -> i64
%260 = arith.constant 1 : i32
%262 = arith.extsi %260 : i32 to i64
%261 = arith.addi %259, %262 : i64
llvm.store %261, %252 : i64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%263 = llvm.load %252 : !llvm.ptr -> i64
%264 = arith.subi %89, %263 : i64
%265 = arith.constant 1 : i32
%267 = arith.extsi %265 : i32 to i64
%266 = arith.addi %264, %267 : i64
%268 = llvm.mlir.constant(1 : i64) : i64
%269 = llvm.alloca %268 x i64 : (i64) -> !llvm.ptr
llvm.store %266, %269 : i64, !llvm.ptr
%270 = llvm.load %269 : !llvm.ptr -> i64
%271 = arith.constant 0 : i32
%273 = arith.extsi %271 : i32 to i64
%272 = arith.cmpi slt, %270, %273 : i64
cf.cond_br %272, ^bb36, ^bb37
^bb36:
%274 = arith.constant 0 : i32
%275 = arith.extsi %274 : i32 to i64
llvm.store %275, %269 : i64, !llvm.ptr
cf.br ^bb38
^bb37:
cf.br ^bb38
^bb38:
%276 = llvm.load %269 : !llvm.ptr -> i64
%277 = arith.sitofp %276 : i64 to f64
%278 = llvm.load %134 : !llvm.ptr -> i64
%279 = arith.sitofp %278 : i64 to f64
%280 = arith.mulf %277, %279 : f64
%281 = arith.constant 0.0 : f32
%282 = arith.extf %281 : f32 to f64
%283 = llvm.mlir.constant(1 : i64) : i64
%284 = llvm.alloca %283 x f64 : (i64) -> !llvm.ptr
llvm.store %282, %284 : f64, !llvm.ptr
%285 = llvm.load %252 : !llvm.ptr -> i64
%286 = arith.cmpi sle, %285, %89 : i64
cf.cond_br %286, ^bb39, ^bb40
^bb39:
%287 = llvm.load %252 : !llvm.ptr -> i64
%288 = llvm.load %134 : !llvm.ptr -> i64
%289 = arith.subi %287, %288 : i64
%290 = llvm.load %134 : !llvm.ptr -> i64
%291 = arith.subi %89, %290 : i64
%292 = arith.constant 0.0 : f32
%293 = arith.extf %292 : f32 to f64
%294 = llvm.mlir.constant(1 : i64) : i64
%295 = llvm.alloca %294 x f64 : (i64) -> !llvm.ptr
llvm.store %293, %295 : f64, !llvm.ptr
%296 = arith.constant 1 : i32
%298 = arith.extsi %296 : i32 to i64
%297 = arith.cmpi sgt, %289, %298 : i64
cf.cond_br %297, ^bb42, ^bb43
^bb42:
%300 = arith.constant 1 : i32
%302 = arith.extsi %300 : i32 to i64
%301 = arith.subi %289, %302 : i64
%303 = llvm.getelementptr %125[%301] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%299 = llvm.load %303 : !llvm.ptr -> f64
llvm.store %299, %295 : f64, !llvm.ptr
cf.br ^bb44
^bb43:
cf.br ^bb44
^bb44:
%305 = llvm.getelementptr %125[%291] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%304 = llvm.load %305 : !llvm.ptr -> f64
%306 = llvm.load %295 : !llvm.ptr -> f64
%307 = arith.subf %304, %306 : f64
llvm.store %307, %284 : f64, !llvm.ptr
cf.br ^bb41
^bb40:
cf.br ^bb41
^bb41:
%308 = llvm.load %225 : !llvm.ptr -> f64
%309 = arith.addf %219, %308 : f64
%310 = arith.addf %309, %280 : f64
%311 = llvm.load %284 : !llvm.ptr -> f64
%312 = arith.addf %310, %311 : f64
%313 = llvm.mlir.constant(1 : i64) : i64
%314 = llvm.alloca %313 x f64 : (i64) -> !llvm.ptr
llvm.store %312, %314 : f64, !llvm.ptr
%315 = llvm.load %134 : !llvm.ptr -> i64
%316 = arith.cmpi sle, %86, %315 : i64
cf.cond_br %316, ^bb45, ^bb46
^bb45:
%317 = llvm.load %134 : !llvm.ptr -> i64
%318 = arith.cmpi sle, %317, %89 : i64
cf.cond_br %318, ^bb48, ^bb49
^bb48:
%319 = llvm.load %314 : !llvm.ptr -> f64
%320 = llvm.load %134 : !llvm.ptr -> i64
%321 = arith.sitofp %320 : i64 to f64
%322 = arith.addf %319, %321 : f64
%323 = arith.addf %322, %200 : f64
llvm.store %323, %314 : f64, !llvm.ptr
cf.br ^bb50
^bb49:
cf.br ^bb50
^bb50:
cf.br ^bb47
^bb46:
cf.br ^bb47
^bb47:
%324 = llvm.load %314 : !llvm.ptr -> f64
%325 = arith.mulf %324, %100 : f64
%326 = llvm.load %134 : !llvm.ptr -> i64
%327 = llvm.getelementptr %113[%326] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %325, %327 : f64, !llvm.ptr
%328 = llvm.load %134 : !llvm.ptr -> i64
%329 = arith.constant 1 : i32
%331 = arith.extsi %329 : i32 to i64
%330 = arith.addi %328, %331 : i64
llvm.store %330, %134 : i64, !llvm.ptr
cf.br ^bb21
^bb23:
%332 = arith.constant 1 : i32
%333 = arith.extsi %332 : i32 to i64
llvm.store %333, %134 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%334 = llvm.load %134 : !llvm.ptr -> i64
%335 = arith.cmpi sle, %334, %89 : i64
cf.cond_br %335, ^bb52, ^bb53
^bb52:
%337 = llvm.load %134 : !llvm.ptr -> i64
%338 = llvm.getelementptr %107[%337] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%336 = llvm.load %338 : !llvm.ptr -> f64
%340 = llvm.load %134 : !llvm.ptr -> i64
%341 = llvm.getelementptr %113[%340] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%339 = llvm.load %341 : !llvm.ptr -> f64
%343 = llvm.load %134 : !llvm.ptr -> i64
%344 = llvm.getelementptr %107[%343] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%342 = llvm.load %344 : !llvm.ptr -> f64
%345 = arith.subf %339, %342 : f64
%346 = arith.mulf %158, %345 : f64
%347 = arith.addf %336, %346 : f64
%348 = llvm.load %134 : !llvm.ptr -> i64
%349 = llvm.getelementptr %107[%348] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %347, %349 : f64, !llvm.ptr
%350 = llvm.load %134 : !llvm.ptr -> i64
%351 = arith.constant 1 : i32
%353 = arith.extsi %351 : i32 to i64
%352 = arith.addi %350, %353 : i64
llvm.store %352, %134 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
func.call @prefix_fill(%107, %125, %89) : (!llvm.ptr, !llvm.ptr, i64) -> ()
%355 = arith.constant 0.0 : f32
%356 = arith.extf %355 : f32 to f64
llvm.store %356, %172 : f64, !llvm.ptr
%357 = arith.constant 1 : i32
%358 = arith.extsi %357 : i32 to i64
llvm.store %358, %176 : i64, !llvm.ptr
cf.br ^bb54
^bb54:
%359 = llvm.load %176 : !llvm.ptr -> i64
%360 = arith.cmpi slt, %359, %83 : i64
cf.cond_br %360, ^bb55, ^bb56
^bb55:
%361 = llvm.load %172 : !llvm.ptr -> f64
%362 = llvm.load %176 : !llvm.ptr -> i64
%363 = arith.subi %83, %362 : i64
%364 = arith.sitofp %363 : i64 to f64
%366 = llvm.load %176 : !llvm.ptr -> i64
%367 = llvm.getelementptr %107[%366] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%365 = llvm.load %367 : !llvm.ptr -> f64
%368 = arith.mulf %364, %365 : f64
%369 = arith.addf %361, %368 : f64
llvm.store %369, %172 : f64, !llvm.ptr
%370 = llvm.load %176 : !llvm.ptr -> i64
%371 = arith.constant 1 : i32
%373 = arith.extsi %371 : i32 to i64
%372 = arith.addi %370, %373 : i64
llvm.store %372, %176 : i64, !llvm.ptr
cf.br ^bb54
^bb56:
%374 = llvm.load %172 : !llvm.ptr -> f64
%375 = arith.muli %83, %83 : i64
%376 = arith.sitofp %375 : i64 to f64
%377 = arith.divf %374, %376 : f64
%378 = arith.addf %91, %377 : f64
%379 = arith.mulf %97, %378 : f64
%380 = arith.constant 0.0 : f32
%381 = arith.extf %380 : f32 to f64
%382 = llvm.mlir.constant(1 : i64) : i64
%383 = llvm.alloca %382 x f64 : (i64) -> !llvm.ptr
llvm.store %381, %383 : f64, !llvm.ptr
%384 = arith.constant 0 : i32
%385 = llvm.mlir.constant(1 : i64) : i64
%386 = llvm.alloca %385 x i32 : (i64) -> !llvm.ptr
llvm.store %384, %386 : i32, !llvm.ptr
%387 = arith.constant 1 : i32
%388 = arith.extsi %387 : i32 to i64
llvm.store %388, %134 : i64, !llvm.ptr
cf.br ^bb57
^bb57:
%389 = llvm.load %134 : !llvm.ptr -> i64
%390 = arith.cmpi sle, %389, %89 : i64
cf.cond_br %390, ^bb58, ^bb59
^bb58:
%391 = llvm.load %386 : !llvm.ptr -> i32
%392 = arith.constant 0 : i32
%393 = arith.cmpi eq, %391, %392 : i32
cf.cond_br %393, ^bb60, ^bb61
^bb60:
%394 = llvm.mlir.constant(1 : i64) : i64
%395 = llvm.alloca %394 x i64 : (i64) -> !llvm.ptr
llvm.store %86, %395 : i64, !llvm.ptr
%396 = llvm.mlir.constant(1 : i64) : i64
%397 = llvm.alloca %396 x i64 : (i64) -> !llvm.ptr
llvm.store %89, %397 : i64, !llvm.ptr
%398 = llvm.load %397 : !llvm.ptr -> i64
%399 = llvm.load %134 : !llvm.ptr -> i64
%400 = arith.constant 1 : i32
%402 = arith.extsi %400 : i32 to i64
%401 = arith.subi %399, %402 : i64
%403 = arith.cmpi sgt, %398, %401 : i64
cf.cond_br %403, ^bb63, ^bb64
^bb63:
%404 = llvm.load %134 : !llvm.ptr -> i64
%405 = arith.constant 1 : i32
%407 = arith.extsi %405 : i32 to i64
%406 = arith.subi %404, %407 : i64
llvm.store %406, %397 : i64, !llvm.ptr
cf.br ^bb65
^bb64:
cf.br ^bb65
^bb65:
%409 = llvm.load %395 : !llvm.ptr -> i64
%410 = llvm.load %397 : !llvm.ptr -> i64
%408 = func.call @arith_sum(%409, %410) : (i64, i64) -> f64
%411 = llvm.mlir.constant(1 : i64) : i64
%412 = llvm.alloca %411 x i64 : (i64) -> !llvm.ptr
llvm.store %86, %412 : i64, !llvm.ptr
%413 = llvm.load %412 : !llvm.ptr -> i64
%414 = llvm.load %134 : !llvm.ptr -> i64
%415 = arith.constant 1 : i32
%417 = arith.extsi %415 : i32 to i64
%416 = arith.addi %414, %417 : i64
%418 = arith.cmpi slt, %413, %416 : i64
cf.cond_br %418, ^bb66, ^bb67
^bb66:
%419 = llvm.load %134 : !llvm.ptr -> i64
%420 = arith.constant 1 : i32
%422 = arith.extsi %420 : i32 to i64
%421 = arith.addi %419, %422 : i64
llvm.store %421, %412 : i64, !llvm.ptr
cf.br ^bb68
^bb67:
cf.br ^bb68
^bb68:
%423 = llvm.load %412 : !llvm.ptr -> i64
%424 = arith.subi %89, %423 : i64
%425 = arith.constant 1 : i32
%427 = arith.extsi %425 : i32 to i64
%426 = arith.addi %424, %427 : i64
%428 = llvm.mlir.constant(1 : i64) : i64
%429 = llvm.alloca %428 x i64 : (i64) -> !llvm.ptr
llvm.store %426, %429 : i64, !llvm.ptr
%430 = llvm.load %429 : !llvm.ptr -> i64
%431 = arith.constant 0 : i32
%433 = arith.extsi %431 : i32 to i64
%432 = arith.cmpi slt, %430, %433 : i64
cf.cond_br %432, ^bb69, ^bb70
^bb69:
%434 = arith.constant 0 : i32
%435 = arith.extsi %434 : i32 to i64
llvm.store %435, %429 : i64, !llvm.ptr
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%436 = llvm.load %429 : !llvm.ptr -> i64
%437 = arith.sitofp %436 : i64 to f64
%438 = llvm.load %134 : !llvm.ptr -> i64
%439 = arith.sitofp %438 : i64 to f64
%440 = arith.mulf %437, %439 : f64
%441 = arith.constant 0.0 : f32
%442 = arith.extf %441 : f32 to f64
%443 = llvm.mlir.constant(1 : i64) : i64
%444 = llvm.alloca %443 x f64 : (i64) -> !llvm.ptr
llvm.store %442, %444 : f64, !llvm.ptr
%445 = llvm.load %412 : !llvm.ptr -> i64
%446 = arith.cmpi sle, %445, %89 : i64
cf.cond_br %446, ^bb72, ^bb73
^bb72:
%447 = llvm.load %412 : !llvm.ptr -> i64
%448 = llvm.load %134 : !llvm.ptr -> i64
%449 = arith.subi %447, %448 : i64
%450 = llvm.load %134 : !llvm.ptr -> i64
%451 = arith.subi %89, %450 : i64
%452 = arith.constant 0.0 : f32
%453 = arith.extf %452 : f32 to f64
%454 = llvm.mlir.constant(1 : i64) : i64
%455 = llvm.alloca %454 x f64 : (i64) -> !llvm.ptr
llvm.store %453, %455 : f64, !llvm.ptr
%456 = arith.constant 1 : i32
%458 = arith.extsi %456 : i32 to i64
%457 = arith.cmpi sgt, %449, %458 : i64
cf.cond_br %457, ^bb75, ^bb76
^bb75:
%460 = arith.constant 1 : i32
%462 = arith.extsi %460 : i32 to i64
%461 = arith.subi %449, %462 : i64
%463 = llvm.getelementptr %125[%461] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%459 = llvm.load %463 : !llvm.ptr -> f64
llvm.store %459, %455 : f64, !llvm.ptr
cf.br ^bb77
^bb76:
cf.br ^bb77
^bb77:
%465 = llvm.getelementptr %125[%451] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%464 = llvm.load %465 : !llvm.ptr -> f64
%466 = llvm.load %455 : !llvm.ptr -> f64
%467 = arith.subf %464, %466 : f64
llvm.store %467, %444 : f64, !llvm.ptr
cf.br ^bb74
^bb73:
cf.br ^bb74
^bb74:
%468 = arith.addf %408, %440 : f64
%469 = llvm.load %444 : !llvm.ptr -> f64
%470 = arith.addf %468, %469 : f64
%471 = llvm.mlir.constant(1 : i64) : i64
%472 = llvm.alloca %471 x f64 : (i64) -> !llvm.ptr
llvm.store %470, %472 : f64, !llvm.ptr
%473 = llvm.load %134 : !llvm.ptr -> i64
%474 = arith.cmpi sle, %86, %473 : i64
cf.cond_br %474, ^bb78, ^bb79
^bb78:
%475 = llvm.load %134 : !llvm.ptr -> i64
%476 = arith.cmpi sle, %475, %89 : i64
cf.cond_br %476, ^bb81, ^bb82
^bb81:
%477 = llvm.load %472 : !llvm.ptr -> f64
%478 = llvm.load %134 : !llvm.ptr -> i64
%479 = arith.sitofp %478 : i64 to f64
%480 = arith.addf %477, %479 : f64
%481 = arith.addf %480, %379 : f64
llvm.store %481, %472 : f64, !llvm.ptr
cf.br ^bb83
^bb82:
cf.br ^bb83
^bb83:
cf.br ^bb80
^bb79:
cf.br ^bb80
^bb80:
%482 = llvm.load %472 : !llvm.ptr -> f64
%483 = arith.mulf %482, %100 : f64
%484 = llvm.load %134 : !llvm.ptr -> i64
%485 = llvm.getelementptr %119[%484] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %483, %485 : f64, !llvm.ptr
%487 = llvm.load %134 : !llvm.ptr -> i64
%488 = llvm.getelementptr %arg2[%487] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%486 = llvm.load %488 : !llvm.ptr -> f64
%490 = llvm.load %134 : !llvm.ptr -> i64
%491 = llvm.getelementptr %119[%490] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%489 = llvm.load %491 : !llvm.ptr -> f64
%493 = llvm.load %134 : !llvm.ptr -> i64
%494 = llvm.getelementptr %arg2[%493] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%492 = llvm.load %494 : !llvm.ptr -> f64
%495 = arith.subf %489, %492 : f64
%496 = arith.mulf %158, %495 : f64
%497 = arith.addf %486, %496 : f64
%498 = arith.cmpf one, %497, %497 : f64
cf.cond_br %498, ^bb84, ^bb85
^bb84:
%499 = arith.constant 1 : i32
llvm.store %499, %386 : i32, !llvm.ptr
cf.br ^bb86
^bb85:
cf.br ^bb86
^bb86:
%500 = math.absf %497 : f64
%501 = arith.constant 1000000000000000052504760255204420248704468581108159154915854115511802457988908195786371375080447864043704443832883878176942523235360430575644792184786706982848387200926575803737830233794788090059368953234970799945081119038967640880074652742780142494579258788820056842838115669472196386865459400540160 : f32
%503 = arith.extf %501 : f32 to f64
%502 = arith.cmpf ogt, %500, %503 : f64
cf.cond_br %502, ^bb87, ^bb88
^bb87:
%504 = arith.constant 1 : i32
llvm.store %504, %386 : i32, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
%505 = llvm.load %386 : !llvm.ptr -> i32
%506 = arith.constant 0 : i32
%507 = arith.cmpi eq, %505, %506 : i32
cf.cond_br %507, ^bb90, ^bb91
^bb90:
%509 = llvm.load %134 : !llvm.ptr -> i64
%510 = llvm.getelementptr %arg2[%509] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%508 = llvm.load %510 : !llvm.ptr -> f64
%511 = arith.subf %497, %508 : f64
%512 = math.absf %511 : f64
%513 = llvm.load %383 : !llvm.ptr -> f64
%514 = arith.cmpf ogt, %512, %513 : f64
cf.cond_br %514, ^bb93, ^bb94
^bb93:
llvm.store %512, %383 : f64, !llvm.ptr
cf.br ^bb95
^bb94:
cf.br ^bb95
^bb95:
%515 = llvm.load %134 : !llvm.ptr -> i64
%516 = llvm.getelementptr %arg2[%515] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %497, %516 : f64, !llvm.ptr
cf.br ^bb92
^bb91:
cf.br ^bb92
^bb92:
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
%517 = llvm.load %134 : !llvm.ptr -> i64
%518 = arith.constant 1 : i32
%520 = arith.extsi %518 : i32 to i64
%519 = arith.addi %517, %520 : i64
llvm.store %519, %134 : i64, !llvm.ptr
cf.br ^bb57
^bb59:
%521 = llvm.load %386 : !llvm.ptr -> i32
%522 = arith.constant 1 : i32
%523 = arith.cmpi eq, %521, %522 : i32
cf.cond_br %523, ^bb96, ^bb97
^bb96:
cf.br ^bb17
^bb97:
cf.br ^bb98
^bb98:
%524 = llvm.load %383 : !llvm.ptr -> f64
%525 = arith.constant 0 : f32
%527 = arith.extf %525 : f32 to f64
%526 = arith.cmpf olt, %524, %527 : f64
cf.cond_br %526, ^bb99, ^bb100
^bb99:
%528 = arith.constant 0.0 : f32
%529 = arith.extf %528 : f32 to f64
llvm.store %529, %172 : f64, !llvm.ptr
%530 = arith.constant 1 : i32
%531 = arith.extsi %530 : i32 to i64
llvm.store %531, %176 : i64, !llvm.ptr
cf.br ^bb102
^bb102:
%532 = llvm.load %176 : !llvm.ptr -> i64
%533 = arith.cmpi slt, %532, %83 : i64
cf.cond_br %533, ^bb103, ^bb104
^bb103:
%534 = llvm.load %172 : !llvm.ptr -> f64
%535 = llvm.load %176 : !llvm.ptr -> i64
%536 = arith.subi %83, %535 : i64
%537 = arith.sitofp %536 : i64 to f64
%538 = arith.constant 2.0 : f32
%540 = arith.extf %538 : f32 to f64
%539 = arith.mulf %537, %540 : f64
%542 = llvm.load %176 : !llvm.ptr -> i64
%543 = llvm.getelementptr %arg2[%542] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%541 = llvm.load %543 : !llvm.ptr -> f64
%544 = arith.mulf %539, %541 : f64
%545 = arith.addf %534, %544 : f64
llvm.store %545, %172 : f64, !llvm.ptr
%546 = llvm.load %176 : !llvm.ptr -> i64
%547 = arith.constant 1 : i32
%549 = arith.extsi %547 : i32 to i64
%548 = arith.addi %546, %549 : i64
llvm.store %548, %176 : i64, !llvm.ptr
cf.br ^bb102
^bb104:
%550 = llvm.load %172 : !llvm.ptr -> f64
%551 = arith.muli %83, %83 : i64
%552 = arith.sitofp %551 : i64 to f64
%553 = arith.divf %550, %552 : f64
%554 = arith.addf %91, %553 : f64
%555 = arith.mulf %97, %554 : f64
%556 = arith.constant 0 : i32
%557 = arith.extsi %556 : i32 to i64
%558 = llvm.getelementptr %arg3[%557] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %555, %558 : f64, !llvm.ptr
%559 = arith.constant 1 : i32
llvm.store %559, %161 : i32, !llvm.ptr
cf.br ^bb17
^bb100:
cf.br ^bb101
^bb101:
%560 = llvm.load %164 : !llvm.ptr -> i32
%561 = arith.constant 1 : i32
%562 = arith.addi %560, %561 : i32
llvm.store %562, %164 : i32, !llvm.ptr
cf.br ^bb15
^bb17:
func.call @free(%107) : (!llvm.ptr) -> ()
func.call @free(%113) : (!llvm.ptr) -> ()
func.call @free(%119) : (!llvm.ptr) -> ()
func.call @free(%125) : (!llvm.ptr) -> ()
%567 = llvm.load %161 : !llvm.ptr -> i32
func.return %567 : i32
}
func.func @gauss_solve(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: !llvm.ptr) -> () {
%568 = arith.constant 0 : i32
%569 = arith.extsi %568 : i32 to i64
%570 = llvm.mlir.constant(1 : i64) : i64
%571 = llvm.alloca %570 x i64 : (i64) -> !llvm.ptr
llvm.store %569, %571 : i64, !llvm.ptr
cf.br ^bb105
^bb105:
%572 = llvm.load %571 : !llvm.ptr -> i64
%573 = arith.cmpi slt, %572, %arg2 : i64
cf.cond_br %573, ^bb106, ^bb107
^bb106:
%575 = llvm.load %571 : !llvm.ptr -> i64
%576 = llvm.getelementptr %arg1[%575] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%574 = llvm.load %576 : !llvm.ptr -> f64
%577 = llvm.load %571 : !llvm.ptr -> i64
%578 = arith.constant 1 : i32
%580 = arith.extsi %578 : i32 to i64
%579 = arith.addi %arg2, %580 : i64
%581 = arith.muli %577, %579 : i64
%582 = arith.addi %581, %arg2 : i64
%583 = llvm.getelementptr %arg0[%582] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %574, %583 : f64, !llvm.ptr
%584 = llvm.load %571 : !llvm.ptr -> i64
%585 = arith.constant 1 : i32
%587 = arith.extsi %585 : i32 to i64
%586 = arith.addi %584, %587 : i64
llvm.store %586, %571 : i64, !llvm.ptr
cf.br ^bb105
^bb107:
%588 = arith.constant 0 : i32
%589 = arith.extsi %588 : i32 to i64
%590 = llvm.mlir.constant(1 : i64) : i64
%591 = llvm.alloca %590 x i64 : (i64) -> !llvm.ptr
llvm.store %589, %591 : i64, !llvm.ptr
cf.br ^bb108
^bb108:
%592 = llvm.load %591 : !llvm.ptr -> i64
%593 = arith.cmpi slt, %592, %arg2 : i64
cf.cond_br %593, ^bb109, ^bb110
^bb109:
%594 = llvm.load %591 : !llvm.ptr -> i64
%595 = llvm.mlir.constant(1 : i64) : i64
%596 = llvm.alloca %595 x i64 : (i64) -> !llvm.ptr
llvm.store %594, %596 : i64, !llvm.ptr
%598 = llvm.load %591 : !llvm.ptr -> i64
%599 = arith.constant 1 : i32
%601 = arith.extsi %599 : i32 to i64
%600 = arith.addi %arg2, %601 : i64
%602 = arith.muli %598, %600 : i64
%603 = llvm.load %591 : !llvm.ptr -> i64
%604 = arith.addi %602, %603 : i64
%605 = llvm.getelementptr %arg0[%604] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%597 = llvm.load %605 : !llvm.ptr -> f64
%606 = math.absf %597 : f64
%607 = llvm.mlir.constant(1 : i64) : i64
%608 = llvm.alloca %607 x f64 : (i64) -> !llvm.ptr
llvm.store %606, %608 : f64, !llvm.ptr
%609 = llvm.load %591 : !llvm.ptr -> i64
%610 = arith.constant 1 : i32
%612 = arith.extsi %610 : i32 to i64
%611 = arith.addi %609, %612 : i64
%613 = llvm.mlir.constant(1 : i64) : i64
%614 = llvm.alloca %613 x i64 : (i64) -> !llvm.ptr
llvm.store %611, %614 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%615 = llvm.load %614 : !llvm.ptr -> i64
%616 = arith.cmpi slt, %615, %arg2 : i64
cf.cond_br %616, ^bb112, ^bb113
^bb112:
%618 = llvm.load %614 : !llvm.ptr -> i64
%619 = arith.constant 1 : i32
%621 = arith.extsi %619 : i32 to i64
%620 = arith.addi %arg2, %621 : i64
%622 = arith.muli %618, %620 : i64
%623 = llvm.load %591 : !llvm.ptr -> i64
%624 = arith.addi %622, %623 : i64
%625 = llvm.getelementptr %arg0[%624] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%617 = llvm.load %625 : !llvm.ptr -> f64
%626 = math.absf %617 : f64
%627 = llvm.load %608 : !llvm.ptr -> f64
%628 = arith.cmpf ogt, %626, %627 : f64
cf.cond_br %628, ^bb114, ^bb115
^bb114:
llvm.store %626, %608 : f64, !llvm.ptr
%629 = llvm.load %614 : !llvm.ptr -> i64
llvm.store %629, %596 : i64, !llvm.ptr
cf.br ^bb116
^bb115:
cf.br ^bb116
^bb116:
%630 = llvm.load %614 : !llvm.ptr -> i64
%631 = arith.constant 1 : i32
%633 = arith.extsi %631 : i32 to i64
%632 = arith.addi %630, %633 : i64
llvm.store %632, %614 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
%634 = llvm.load %596 : !llvm.ptr -> i64
%635 = llvm.load %591 : !llvm.ptr -> i64
%636 = arith.cmpi ne, %634, %635 : i64
cf.cond_br %636, ^bb117, ^bb118
^bb117:
%637 = llvm.load %591 : !llvm.ptr -> i64
%638 = llvm.mlir.constant(1 : i64) : i64
%639 = llvm.alloca %638 x i64 : (i64) -> !llvm.ptr
llvm.store %637, %639 : i64, !llvm.ptr
cf.br ^bb120
^bb120:
%640 = llvm.load %639 : !llvm.ptr -> i64
%641 = arith.cmpi sle, %640, %arg2 : i64
cf.cond_br %641, ^bb121, ^bb122
^bb121:
%643 = llvm.load %591 : !llvm.ptr -> i64
%644 = arith.constant 1 : i32
%646 = arith.extsi %644 : i32 to i64
%645 = arith.addi %arg2, %646 : i64
%647 = arith.muli %643, %645 : i64
%648 = llvm.load %639 : !llvm.ptr -> i64
%649 = arith.addi %647, %648 : i64
%650 = llvm.getelementptr %arg0[%649] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%642 = llvm.load %650 : !llvm.ptr -> f64
%652 = llvm.load %596 : !llvm.ptr -> i64
%653 = arith.constant 1 : i32
%655 = arith.extsi %653 : i32 to i64
%654 = arith.addi %arg2, %655 : i64
%656 = arith.muli %652, %654 : i64
%657 = llvm.load %639 : !llvm.ptr -> i64
%658 = arith.addi %656, %657 : i64
%659 = llvm.getelementptr %arg0[%658] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%651 = llvm.load %659 : !llvm.ptr -> f64
%660 = llvm.load %591 : !llvm.ptr -> i64
%661 = arith.constant 1 : i32
%663 = arith.extsi %661 : i32 to i64
%662 = arith.addi %arg2, %663 : i64
%664 = arith.muli %660, %662 : i64
%665 = llvm.load %639 : !llvm.ptr -> i64
%666 = arith.addi %664, %665 : i64
%667 = llvm.getelementptr %arg0[%666] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %651, %667 : f64, !llvm.ptr
%668 = llvm.load %596 : !llvm.ptr -> i64
%669 = arith.constant 1 : i32
%671 = arith.extsi %669 : i32 to i64
%670 = arith.addi %arg2, %671 : i64
%672 = arith.muli %668, %670 : i64
%673 = llvm.load %639 : !llvm.ptr -> i64
%674 = arith.addi %672, %673 : i64
%675 = llvm.getelementptr %arg0[%674] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %642, %675 : f64, !llvm.ptr
%676 = llvm.load %639 : !llvm.ptr -> i64
%677 = arith.constant 1 : i32
%679 = arith.extsi %677 : i32 to i64
%678 = arith.addi %676, %679 : i64
llvm.store %678, %639 : i64, !llvm.ptr
cf.br ^bb120
^bb122:
cf.br ^bb119
^bb118:
cf.br ^bb119
^bb119:
%680 = arith.constant 1.0 : f32
%682 = llvm.load %591 : !llvm.ptr -> i64
%683 = arith.constant 1 : i32
%685 = arith.extsi %683 : i32 to i64
%684 = arith.addi %arg2, %685 : i64
%686 = arith.muli %682, %684 : i64
%687 = llvm.load %591 : !llvm.ptr -> i64
%688 = arith.addi %686, %687 : i64
%689 = llvm.getelementptr %arg0[%688] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%681 = llvm.load %689 : !llvm.ptr -> f64
%691 = arith.extf %680 : f32 to f64
%690 = arith.divf %691, %681 : f64
%692 = llvm.load %591 : !llvm.ptr -> i64
%693 = llvm.mlir.constant(1 : i64) : i64
%694 = llvm.alloca %693 x i64 : (i64) -> !llvm.ptr
llvm.store %692, %694 : i64, !llvm.ptr
cf.br ^bb123
^bb123:
%695 = llvm.load %694 : !llvm.ptr -> i64
%696 = arith.cmpi sle, %695, %arg2 : i64
cf.cond_br %696, ^bb124, ^bb125
^bb124:
%698 = llvm.load %591 : !llvm.ptr -> i64
%699 = arith.constant 1 : i32
%701 = arith.extsi %699 : i32 to i64
%700 = arith.addi %arg2, %701 : i64
%702 = arith.muli %698, %700 : i64
%703 = llvm.load %694 : !llvm.ptr -> i64
%704 = arith.addi %702, %703 : i64
%705 = llvm.getelementptr %arg0[%704] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%697 = llvm.load %705 : !llvm.ptr -> f64
%706 = arith.mulf %697, %690 : f64
%707 = llvm.load %591 : !llvm.ptr -> i64
%708 = arith.constant 1 : i32
%710 = arith.extsi %708 : i32 to i64
%709 = arith.addi %arg2, %710 : i64
%711 = arith.muli %707, %709 : i64
%712 = llvm.load %694 : !llvm.ptr -> i64
%713 = arith.addi %711, %712 : i64
%714 = llvm.getelementptr %arg0[%713] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %706, %714 : f64, !llvm.ptr
%715 = llvm.load %694 : !llvm.ptr -> i64
%716 = arith.constant 1 : i32
%718 = arith.extsi %716 : i32 to i64
%717 = arith.addi %715, %718 : i64
llvm.store %717, %694 : i64, !llvm.ptr
cf.br ^bb123
^bb125:
%719 = arith.constant 0 : i32
%720 = arith.extsi %719 : i32 to i64
llvm.store %720, %614 : i64, !llvm.ptr
cf.br ^bb126
^bb126:
%721 = llvm.load %614 : !llvm.ptr -> i64
%722 = arith.cmpi slt, %721, %arg2 : i64
cf.cond_br %722, ^bb127, ^bb128
^bb127:
%723 = llvm.load %614 : !llvm.ptr -> i64
%724 = llvm.load %591 : !llvm.ptr -> i64
%725 = arith.cmpi ne, %723, %724 : i64
cf.cond_br %725, ^bb129, ^bb130
^bb129:
%727 = llvm.load %614 : !llvm.ptr -> i64
%728 = arith.constant 1 : i32
%730 = arith.extsi %728 : i32 to i64
%729 = arith.addi %arg2, %730 : i64
%731 = arith.muli %727, %729 : i64
%732 = llvm.load %591 : !llvm.ptr -> i64
%733 = arith.addi %731, %732 : i64
%734 = llvm.getelementptr %arg0[%733] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%726 = llvm.load %734 : !llvm.ptr -> f64
%735 = arith.constant 0.0 : f32
%737 = arith.extf %735 : f32 to f64
%736 = arith.cmpf one, %726, %737 : f64
cf.cond_br %736, ^bb132, ^bb133
^bb132:
%738 = llvm.load %591 : !llvm.ptr -> i64
%739 = llvm.mlir.constant(1 : i64) : i64
%740 = llvm.alloca %739 x i64 : (i64) -> !llvm.ptr
llvm.store %738, %740 : i64, !llvm.ptr
cf.br ^bb135
^bb135:
%741 = llvm.load %740 : !llvm.ptr -> i64
%742 = arith.cmpi sle, %741, %arg2 : i64
cf.cond_br %742, ^bb136, ^bb137
^bb136:
%744 = llvm.load %614 : !llvm.ptr -> i64
%745 = arith.constant 1 : i32
%747 = arith.extsi %745 : i32 to i64
%746 = arith.addi %arg2, %747 : i64
%748 = arith.muli %744, %746 : i64
%749 = llvm.load %740 : !llvm.ptr -> i64
%750 = arith.addi %748, %749 : i64
%751 = llvm.getelementptr %arg0[%750] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%743 = llvm.load %751 : !llvm.ptr -> f64
%753 = llvm.load %591 : !llvm.ptr -> i64
%754 = arith.constant 1 : i32
%756 = arith.extsi %754 : i32 to i64
%755 = arith.addi %arg2, %756 : i64
%757 = arith.muli %753, %755 : i64
%758 = llvm.load %740 : !llvm.ptr -> i64
%759 = arith.addi %757, %758 : i64
%760 = llvm.getelementptr %arg0[%759] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%752 = llvm.load %760 : !llvm.ptr -> f64
%761 = arith.mulf %726, %752 : f64
%762 = arith.subf %743, %761 : f64
%763 = llvm.load %614 : !llvm.ptr -> i64
%764 = arith.constant 1 : i32
%766 = arith.extsi %764 : i32 to i64
%765 = arith.addi %arg2, %766 : i64
%767 = arith.muli %763, %765 : i64
%768 = llvm.load %740 : !llvm.ptr -> i64
%769 = arith.addi %767, %768 : i64
%770 = llvm.getelementptr %arg0[%769] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %762, %770 : f64, !llvm.ptr
%771 = llvm.load %740 : !llvm.ptr -> i64
%772 = arith.constant 1 : i32
%774 = arith.extsi %772 : i32 to i64
%773 = arith.addi %771, %774 : i64
llvm.store %773, %740 : i64, !llvm.ptr
cf.br ^bb135
^bb137:
cf.br ^bb134
^bb133:
cf.br ^bb134
^bb134:
cf.br ^bb131
^bb130:
cf.br ^bb131
^bb131:
%775 = llvm.load %614 : !llvm.ptr -> i64
%776 = arith.constant 1 : i32
%778 = arith.extsi %776 : i32 to i64
%777 = arith.addi %775, %778 : i64
llvm.store %777, %614 : i64, !llvm.ptr
cf.br ^bb126
^bb128:
%779 = llvm.load %591 : !llvm.ptr -> i64
%780 = arith.constant 1 : i32
%782 = arith.extsi %780 : i32 to i64
%781 = arith.addi %779, %782 : i64
llvm.store %781, %591 : i64, !llvm.ptr
cf.br ^bb108
^bb110:
%783 = arith.constant 0 : i32
%784 = arith.extsi %783 : i32 to i64
llvm.store %784, %571 : i64, !llvm.ptr
cf.br ^bb138
^bb138:
%785 = llvm.load %571 : !llvm.ptr -> i64
%786 = arith.cmpi slt, %785, %arg2 : i64
cf.cond_br %786, ^bb139, ^bb140
^bb139:
%788 = llvm.load %571 : !llvm.ptr -> i64
%789 = arith.constant 1 : i32
%791 = arith.extsi %789 : i32 to i64
%790 = arith.addi %arg2, %791 : i64
%792 = arith.muli %788, %790 : i64
%793 = arith.addi %792, %arg2 : i64
%794 = llvm.getelementptr %arg0[%793] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%787 = llvm.load %794 : !llvm.ptr -> f64
%795 = llvm.load %571 : !llvm.ptr -> i64
%796 = llvm.getelementptr %arg3[%795] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %787, %796 : f64, !llvm.ptr
%797 = llvm.load %571 : !llvm.ptr -> i64
%798 = arith.constant 1 : i32
%800 = arith.extsi %798 : i32 to i64
%799 = arith.addi %797, %800 : i64
llvm.store %799, %571 : i64, !llvm.ptr
cf.br ^bb138
^bb140:
func.return
}
func.func @compute_C1_direct(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: !llvm.ptr) -> () {
%801 = arith.subi %arg1, %arg0 : i64
%802 = arith.constant 1 : i32
%804 = arith.extsi %802 : i32 to i64
%803 = arith.addi %801, %804 : i64
%805 = arith.constant 5 : i32
%807 = arith.extsi %805 : i32 to i64
%806 = arith.addi %arg0, %807 : i64
%808 = arith.constant 5 : i32
%810 = arith.extsi %808 : i32 to i64
%809 = arith.addi %arg1, %810 : i64
%811 = func.call @expected_min_consecutive(%806, %809) : (i64, i64) -> f64
%812 = arith.sitofp %803 : i64 to f64
%813 = arith.constant 1 : i32
%815 = arith.extsi %813 : i32 to i64
%814 = arith.subi %803, %815 : i64
%816 = arith.sitofp %814 : i64 to f64
%817 = arith.divf %812, %816 : f64
%818 = arith.constant 1.0 : f32
%819 = arith.sitofp %803 : i64 to f64
%821 = arith.extf %818 : f32 to f64
%820 = arith.divf %821, %819 : f64
%823 = arith.constant 1 : i32
%825 = arith.extsi %823 : i32 to i64
%824 = arith.addi %809, %825 : i64
%826 = arith.constant 8 : i32
%827 = arith.extsi %826 : i32 to i64
%822 = func.call @calloc(%824, %827) : (i64, i64) -> !llvm.ptr
%829 = arith.constant 1 : i32
%831 = arith.extsi %829 : i32 to i64
%830 = arith.addi %809, %831 : i64
%832 = arith.constant 1 : i32
%834 = arith.extsi %832 : i32 to i64
%833 = arith.addi %809, %834 : i64
%835 = arith.muli %830, %833 : i64
%836 = arith.constant 8 : i32
%837 = arith.extsi %836 : i32 to i64
%828 = func.call @calloc(%835, %837) : (i64, i64) -> !llvm.ptr
%839 = arith.constant 1 : i32
%841 = arith.extsi %839 : i32 to i64
%840 = arith.addi %809, %841 : i64
%842 = arith.constant 8 : i32
%843 = arith.extsi %842 : i32 to i64
%838 = func.call @calloc(%840, %843) : (i64, i64) -> !llvm.ptr
%845 = arith.constant 1 : i32
%847 = arith.extsi %845 : i32 to i64
%846 = arith.addi %809, %847 : i64
%848 = arith.constant 1 : i32
%850 = arith.extsi %848 : i32 to i64
%849 = arith.addi %809, %850 : i64
%851 = arith.muli %846, %849 : i64
%852 = arith.constant 8 : i32
%853 = arith.extsi %852 : i32 to i64
%844 = func.call @calloc(%851, %853) : (i64, i64) -> !llvm.ptr
%855 = arith.constant 1 : i32
%857 = arith.extsi %855 : i32 to i64
%856 = arith.addi %809, %857 : i64
%858 = arith.constant 8 : i32
%859 = arith.extsi %858 : i32 to i64
%854 = func.call @calloc(%856, %859) : (i64, i64) -> !llvm.ptr
%861 = arith.constant 1 : i32
%863 = arith.extsi %861 : i32 to i64
%862 = arith.addi %809, %863 : i64
%864 = arith.constant 8 : i32
%865 = arith.extsi %864 : i32 to i64
%860 = func.call @calloc(%862, %865) : (i64, i64) -> !llvm.ptr
%866 = arith.mulf %817, %811 : f64
%867 = arith.constant 1 : i32
%868 = arith.extsi %867 : i32 to i64
%869 = llvm.mlir.constant(1 : i64) : i64
%870 = llvm.alloca %869 x i64 : (i64) -> !llvm.ptr
llvm.store %868, %870 : i64, !llvm.ptr
cf.br ^bb141
^bb141:
%871 = llvm.load %870 : !llvm.ptr -> i64
%872 = arith.cmpi slt, %871, %803 : i64
cf.cond_br %872, ^bb142, ^bb143
^bb142:
%873 = llvm.load %870 : !llvm.ptr -> i64
%874 = arith.cmpi sle, %873, %809 : i64
cf.cond_br %874, ^bb144, ^bb145
^bb144:
%875 = arith.constant 2.0 : f32
%876 = arith.muli %803, %803 : i64
%877 = arith.sitofp %876 : i64 to f64
%879 = arith.extf %875 : f32 to f64
%878 = arith.divf %879, %877 : f64
%880 = arith.mulf %817, %878 : f64
%881 = llvm.load %870 : !llvm.ptr -> i64
%882 = arith.subi %803, %881 : i64
%883 = arith.sitofp %882 : i64 to f64
%884 = arith.mulf %880, %883 : f64
%885 = llvm.load %870 : !llvm.ptr -> i64
%886 = llvm.getelementptr %860[%885] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %884, %886 : f64, !llvm.ptr
cf.br ^bb146
^bb145:
cf.br ^bb146
^bb146:
%887 = llvm.load %870 : !llvm.ptr -> i64
%888 = arith.constant 1 : i32
%890 = arith.extsi %888 : i32 to i64
%889 = arith.addi %887, %890 : i64
llvm.store %889, %870 : i64, !llvm.ptr
cf.br ^bb141
^bb143:
%891 = arith.constant 1 : i32
%892 = arith.extsi %891 : i32 to i64
%893 = llvm.mlir.constant(1 : i64) : i64
%894 = llvm.alloca %893 x i64 : (i64) -> !llvm.ptr
llvm.store %892, %894 : i64, !llvm.ptr
cf.br ^bb147
^bb147:
%895 = llvm.load %894 : !llvm.ptr -> i64
%896 = arith.cmpi sle, %895, %809 : i64
cf.cond_br %896, ^bb148, ^bb149
^bb148:
%897 = llvm.mlir.constant(1 : i64) : i64
%898 = llvm.alloca %897 x i64 : (i64) -> !llvm.ptr
llvm.store %806, %898 : i64, !llvm.ptr
%899 = llvm.mlir.constant(1 : i64) : i64
%900 = llvm.alloca %899 x i64 : (i64) -> !llvm.ptr
llvm.store %809, %900 : i64, !llvm.ptr
%901 = llvm.load %900 : !llvm.ptr -> i64
%902 = llvm.load %894 : !llvm.ptr -> i64
%903 = arith.constant 1 : i32
%905 = arith.extsi %903 : i32 to i64
%904 = arith.subi %902, %905 : i64
%906 = arith.cmpi sgt, %901, %904 : i64
cf.cond_br %906, ^bb150, ^bb151
^bb150:
%907 = llvm.load %894 : !llvm.ptr -> i64
%908 = arith.constant 1 : i32
%910 = arith.extsi %908 : i32 to i64
%909 = arith.subi %907, %910 : i64
llvm.store %909, %900 : i64, !llvm.ptr
cf.br ^bb152
^bb151:
cf.br ^bb152
^bb152:
%912 = llvm.load %898 : !llvm.ptr -> i64
%913 = llvm.load %900 : !llvm.ptr -> i64
%911 = func.call @arith_sum(%912, %913) : (i64, i64) -> f64
%914 = llvm.load %898 : !llvm.ptr -> i64
%915 = llvm.load %900 : !llvm.ptr -> i64
%916 = arith.cmpi sle, %914, %915 : i64
cf.cond_br %916, ^bb153, ^bb154
^bb153:
%917 = llvm.load %894 : !llvm.ptr -> i64
%918 = llvm.load %900 : !llvm.ptr -> i64
%919 = arith.subi %917, %918 : i64
%920 = llvm.mlir.constant(1 : i64) : i64
%921 = llvm.alloca %920 x i64 : (i64) -> !llvm.ptr
llvm.store %919, %921 : i64, !llvm.ptr
cf.br ^bb156
^bb156:
%922 = llvm.load %921 : !llvm.ptr -> i64
%923 = llvm.load %894 : !llvm.ptr -> i64
%924 = llvm.load %898 : !llvm.ptr -> i64
%925 = arith.subi %923, %924 : i64
%926 = arith.cmpi sle, %922, %925 : i64
cf.cond_br %926, ^bb157, ^bb158
^bb157:
%927 = llvm.load %921 : !llvm.ptr -> i64
%928 = arith.constant 1 : i32
%930 = arith.extsi %928 : i32 to i64
%929 = arith.cmpi sge, %927, %930 : i64
cf.cond_br %929, ^bb159, ^bb160
^bb159:
%931 = llvm.load %921 : !llvm.ptr -> i64
%932 = arith.cmpi sle, %931, %809 : i64
cf.cond_br %932, ^bb162, ^bb163
^bb162:
%934 = llvm.load %894 : !llvm.ptr -> i64
%935 = arith.constant 1 : i32
%937 = arith.extsi %935 : i32 to i64
%936 = arith.addi %809, %937 : i64
%938 = arith.muli %934, %936 : i64
%939 = llvm.load %921 : !llvm.ptr -> i64
%940 = arith.addi %938, %939 : i64
%941 = llvm.getelementptr %828[%940] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%933 = llvm.load %941 : !llvm.ptr -> f64
%942 = arith.addf %933, %820 : f64
%943 = llvm.load %894 : !llvm.ptr -> i64
%944 = arith.constant 1 : i32
%946 = arith.extsi %944 : i32 to i64
%945 = arith.addi %809, %946 : i64
%947 = arith.muli %943, %945 : i64
%948 = llvm.load %921 : !llvm.ptr -> i64
%949 = arith.addi %947, %948 : i64
%950 = llvm.getelementptr %828[%949] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %942, %950 : f64, !llvm.ptr
cf.br ^bb164
^bb163:
cf.br ^bb164
^bb164:
cf.br ^bb161
^bb160:
cf.br ^bb161
^bb161:
%951 = llvm.load %921 : !llvm.ptr -> i64
%952 = arith.constant 1 : i32
%954 = arith.extsi %952 : i32 to i64
%953 = arith.addi %951, %954 : i64
llvm.store %953, %921 : i64, !llvm.ptr
cf.br ^bb156
^bb158:
cf.br ^bb155
^bb154:
cf.br ^bb155
^bb155:
%955 = llvm.mlir.constant(1 : i64) : i64
%956 = llvm.alloca %955 x i64 : (i64) -> !llvm.ptr
llvm.store %806, %956 : i64, !llvm.ptr
%957 = llvm.load %956 : !llvm.ptr -> i64
%958 = llvm.load %894 : !llvm.ptr -> i64
%959 = arith.constant 1 : i32
%961 = arith.extsi %959 : i32 to i64
%960 = arith.addi %958, %961 : i64
%962 = arith.cmpi slt, %957, %960 : i64
cf.cond_br %962, ^bb165, ^bb166
^bb165:
%963 = llvm.load %894 : !llvm.ptr -> i64
%964 = arith.constant 1 : i32
%966 = arith.extsi %964 : i32 to i64
%965 = arith.addi %963, %966 : i64
llvm.store %965, %956 : i64, !llvm.ptr
cf.br ^bb167
^bb166:
cf.br ^bb167
^bb167:
%967 = llvm.load %956 : !llvm.ptr -> i64
%968 = arith.subi %809, %967 : i64
%969 = arith.constant 1 : i32
%971 = arith.extsi %969 : i32 to i64
%970 = arith.addi %968, %971 : i64
%972 = llvm.mlir.constant(1 : i64) : i64
%973 = llvm.alloca %972 x i64 : (i64) -> !llvm.ptr
llvm.store %970, %973 : i64, !llvm.ptr
%974 = llvm.load %973 : !llvm.ptr -> i64
%975 = arith.constant 0 : i32
%977 = arith.extsi %975 : i32 to i64
%976 = arith.cmpi slt, %974, %977 : i64
cf.cond_br %976, ^bb168, ^bb169
^bb168:
%978 = arith.constant 0 : i32
%979 = arith.extsi %978 : i32 to i64
llvm.store %979, %973 : i64, !llvm.ptr
cf.br ^bb170
^bb169:
cf.br ^bb170
^bb170:
%980 = llvm.load %973 : !llvm.ptr -> i64
%981 = arith.sitofp %980 : i64 to f64
%982 = llvm.load %894 : !llvm.ptr -> i64
%983 = arith.sitofp %982 : i64 to f64
%984 = arith.mulf %981, %983 : f64
%985 = llvm.load %956 : !llvm.ptr -> i64
%986 = arith.cmpi sle, %985, %809 : i64
cf.cond_br %986, ^bb171, ^bb172
^bb171:
%987 = llvm.load %956 : !llvm.ptr -> i64
%988 = llvm.load %894 : !llvm.ptr -> i64
%989 = arith.subi %987, %988 : i64
%990 = llvm.mlir.constant(1 : i64) : i64
%991 = llvm.alloca %990 x i64 : (i64) -> !llvm.ptr
llvm.store %989, %991 : i64, !llvm.ptr
cf.br ^bb174
^bb174:
%992 = llvm.load %991 : !llvm.ptr -> i64
%993 = llvm.load %894 : !llvm.ptr -> i64
%994 = arith.subi %809, %993 : i64
%995 = arith.cmpi sle, %992, %994 : i64
cf.cond_br %995, ^bb175, ^bb176
^bb175:
%996 = llvm.load %991 : !llvm.ptr -> i64
%997 = arith.constant 1 : i32
%999 = arith.extsi %997 : i32 to i64
%998 = arith.cmpi sge, %996, %999 : i64
cf.cond_br %998, ^bb177, ^bb178
^bb177:
%1000 = llvm.load %991 : !llvm.ptr -> i64
%1001 = arith.cmpi sle, %1000, %809 : i64
cf.cond_br %1001, ^bb180, ^bb181
^bb180:
%1003 = llvm.load %894 : !llvm.ptr -> i64
%1004 = arith.constant 1 : i32
%1006 = arith.extsi %1004 : i32 to i64
%1005 = arith.addi %809, %1006 : i64
%1007 = arith.muli %1003, %1005 : i64
%1008 = llvm.load %991 : !llvm.ptr -> i64
%1009 = arith.addi %1007, %1008 : i64
%1010 = llvm.getelementptr %828[%1009] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1002 = llvm.load %1010 : !llvm.ptr -> f64
%1011 = arith.addf %1002, %820 : f64
%1012 = llvm.load %894 : !llvm.ptr -> i64
%1013 = arith.constant 1 : i32
%1015 = arith.extsi %1013 : i32 to i64
%1014 = arith.addi %809, %1015 : i64
%1016 = arith.muli %1012, %1014 : i64
%1017 = llvm.load %991 : !llvm.ptr -> i64
%1018 = arith.addi %1016, %1017 : i64
%1019 = llvm.getelementptr %828[%1018] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1011, %1019 : f64, !llvm.ptr
cf.br ^bb182
^bb181:
cf.br ^bb182
^bb182:
cf.br ^bb179
^bb178:
cf.br ^bb179
^bb179:
%1020 = llvm.load %991 : !llvm.ptr -> i64
%1021 = arith.constant 1 : i32
%1023 = arith.extsi %1021 : i32 to i64
%1022 = arith.addi %1020, %1023 : i64
llvm.store %1022, %991 : i64, !llvm.ptr
cf.br ^bb174
^bb176:
cf.br ^bb173
^bb172:
cf.br ^bb173
^bb173:
%1024 = arith.addf %911, %984 : f64
%1025 = arith.mulf %1024, %820 : f64
%1026 = llvm.mlir.constant(1 : i64) : i64
%1027 = llvm.alloca %1026 x f64 : (i64) -> !llvm.ptr
llvm.store %1025, %1027 : f64, !llvm.ptr
%1028 = llvm.load %894 : !llvm.ptr -> i64
%1029 = arith.cmpi sle, %806, %1028 : i64
cf.cond_br %1029, ^bb183, ^bb184
^bb183:
%1030 = llvm.load %894 : !llvm.ptr -> i64
%1031 = arith.cmpi sle, %1030, %809 : i64
cf.cond_br %1031, ^bb186, ^bb187
^bb186:
%1032 = llvm.load %1027 : !llvm.ptr -> f64
%1033 = llvm.load %894 : !llvm.ptr -> i64
%1034 = arith.sitofp %1033 : i64 to f64
%1035 = arith.mulf %1034, %820 : f64
%1036 = arith.addf %1032, %1035 : f64
%1037 = arith.mulf %866, %820 : f64
%1038 = arith.addf %1036, %1037 : f64
llvm.store %1038, %1027 : f64, !llvm.ptr
%1039 = arith.constant 1 : i32
%1040 = arith.extsi %1039 : i32 to i64
%1041 = llvm.mlir.constant(1 : i64) : i64
%1042 = llvm.alloca %1041 x i64 : (i64) -> !llvm.ptr
llvm.store %1040, %1042 : i64, !llvm.ptr
cf.br ^bb189
^bb189:
%1043 = llvm.load %1042 : !llvm.ptr -> i64
%1044 = arith.cmpi slt, %1043, %803 : i64
cf.cond_br %1044, ^bb190, ^bb191
^bb190:
%1045 = llvm.load %1042 : !llvm.ptr -> i64
%1046 = arith.cmpi sle, %1045, %809 : i64
cf.cond_br %1046, ^bb192, ^bb193
^bb192:
%1048 = llvm.load %894 : !llvm.ptr -> i64
%1049 = arith.constant 1 : i32
%1051 = arith.extsi %1049 : i32 to i64
%1050 = arith.addi %809, %1051 : i64
%1052 = arith.muli %1048, %1050 : i64
%1053 = llvm.load %1042 : !llvm.ptr -> i64
%1054 = arith.addi %1052, %1053 : i64
%1055 = llvm.getelementptr %828[%1054] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1047 = llvm.load %1055 : !llvm.ptr -> f64
%1057 = llvm.load %1042 : !llvm.ptr -> i64
%1058 = llvm.getelementptr %860[%1057] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1056 = llvm.load %1058 : !llvm.ptr -> f64
%1059 = arith.mulf %1056, %820 : f64
%1060 = arith.addf %1047, %1059 : f64
%1061 = llvm.load %894 : !llvm.ptr -> i64
%1062 = arith.constant 1 : i32
%1064 = arith.extsi %1062 : i32 to i64
%1063 = arith.addi %809, %1064 : i64
%1065 = arith.muli %1061, %1063 : i64
%1066 = llvm.load %1042 : !llvm.ptr -> i64
%1067 = arith.addi %1065, %1066 : i64
%1068 = llvm.getelementptr %828[%1067] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1060, %1068 : f64, !llvm.ptr
cf.br ^bb194
^bb193:
cf.br ^bb194
^bb194:
%1069 = llvm.load %1042 : !llvm.ptr -> i64
%1070 = arith.constant 1 : i32
%1072 = arith.extsi %1070 : i32 to i64
%1071 = arith.addi %1069, %1072 : i64
llvm.store %1071, %1042 : i64, !llvm.ptr
cf.br ^bb189
^bb191:
cf.br ^bb188
^bb187:
cf.br ^bb188
^bb188:
cf.br ^bb185
^bb184:
cf.br ^bb185
^bb185:
%1073 = llvm.load %1027 : !llvm.ptr -> f64
%1074 = llvm.load %894 : !llvm.ptr -> i64
%1075 = llvm.getelementptr %822[%1074] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1073, %1075 : f64, !llvm.ptr
%1076 = llvm.load %894 : !llvm.ptr -> i64
%1077 = arith.constant 1 : i32
%1079 = arith.extsi %1077 : i32 to i64
%1078 = arith.addi %1076, %1079 : i64
llvm.store %1078, %894 : i64, !llvm.ptr
cf.br ^bb147
^bb149:
func.call @prefix_fill(%822, %838, %809) : (!llvm.ptr, !llvm.ptr, i64) -> ()
%1081 = arith.constant 1 : i32
%1082 = arith.extsi %1081 : i32 to i64
%1083 = llvm.mlir.constant(1 : i64) : i64
%1084 = llvm.alloca %1083 x i64 : (i64) -> !llvm.ptr
llvm.store %1082, %1084 : i64, !llvm.ptr
cf.br ^bb195
^bb195:
%1085 = llvm.load %1084 : !llvm.ptr -> i64
%1086 = arith.cmpi sle, %1085, %809 : i64
cf.cond_br %1086, ^bb196, ^bb197
^bb196:
%1087 = arith.constant 0.0 : f32
%1088 = arith.extf %1087 : f32 to f64
%1089 = llvm.mlir.constant(1 : i64) : i64
%1090 = llvm.alloca %1089 x f64 : (i64) -> !llvm.ptr
llvm.store %1088, %1090 : f64, !llvm.ptr
%1091 = arith.constant 1 : i32
%1092 = arith.extsi %1091 : i32 to i64
%1093 = llvm.mlir.constant(1 : i64) : i64
%1094 = llvm.alloca %1093 x i64 : (i64) -> !llvm.ptr
llvm.store %1092, %1094 : i64, !llvm.ptr
cf.br ^bb198
^bb198:
%1095 = llvm.load %1094 : !llvm.ptr -> i64
%1096 = arith.cmpi sle, %1095, %809 : i64
cf.cond_br %1096, ^bb199, ^bb200
^bb199:
%1097 = llvm.load %1090 : !llvm.ptr -> f64
%1099 = llvm.load %1094 : !llvm.ptr -> i64
%1100 = arith.constant 1 : i32
%1102 = arith.extsi %1100 : i32 to i64
%1101 = arith.addi %809, %1102 : i64
%1103 = arith.muli %1099, %1101 : i64
%1104 = llvm.load %1084 : !llvm.ptr -> i64
%1105 = arith.addi %1103, %1104 : i64
%1106 = llvm.getelementptr %828[%1105] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1098 = llvm.load %1106 : !llvm.ptr -> f64
%1107 = arith.addf %1097, %1098 : f64
llvm.store %1107, %1090 : f64, !llvm.ptr
%1108 = llvm.load %1090 : !llvm.ptr -> f64
%1109 = llvm.load %1084 : !llvm.ptr -> i64
%1110 = arith.constant 1 : i32
%1112 = arith.extsi %1110 : i32 to i64
%1111 = arith.addi %809, %1112 : i64
%1113 = arith.muli %1109, %1111 : i64
%1114 = llvm.load %1094 : !llvm.ptr -> i64
%1115 = arith.addi %1113, %1114 : i64
%1116 = llvm.getelementptr %844[%1115] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1108, %1116 : f64, !llvm.ptr
%1117 = llvm.load %1094 : !llvm.ptr -> i64
%1118 = arith.constant 1 : i32
%1120 = arith.extsi %1118 : i32 to i64
%1119 = arith.addi %1117, %1120 : i64
llvm.store %1119, %1094 : i64, !llvm.ptr
cf.br ^bb198
^bb200:
%1121 = llvm.load %1084 : !llvm.ptr -> i64
%1122 = arith.constant 1 : i32
%1124 = arith.extsi %1122 : i32 to i64
%1123 = arith.addi %1121, %1124 : i64
llvm.store %1123, %1084 : i64, !llvm.ptr
cf.br ^bb195
^bb197:
%1125 = arith.constant 0.0 : f32
%1126 = arith.extf %1125 : f32 to f64
%1127 = llvm.mlir.constant(1 : i64) : i64
%1128 = llvm.alloca %1127 x f64 : (i64) -> !llvm.ptr
llvm.store %1126, %1128 : f64, !llvm.ptr
%1129 = arith.constant 1 : i32
%1130 = arith.extsi %1129 : i32 to i64
llvm.store %1130, %870 : i64, !llvm.ptr
cf.br ^bb201
^bb201:
%1131 = llvm.load %870 : !llvm.ptr -> i64
%1132 = arith.cmpi slt, %1131, %803 : i64
cf.cond_br %1132, ^bb202, ^bb203
^bb202:
%1133 = llvm.load %870 : !llvm.ptr -> i64
%1134 = arith.cmpi sle, %1133, %809 : i64
cf.cond_br %1134, ^bb204, ^bb205
^bb204:
%1135 = llvm.load %1128 : !llvm.ptr -> f64
%1136 = llvm.load %870 : !llvm.ptr -> i64
%1137 = arith.subi %803, %1136 : i64
%1138 = arith.sitofp %1137 : i64 to f64
%1140 = llvm.load %870 : !llvm.ptr -> i64
%1141 = llvm.getelementptr %822[%1140] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1139 = llvm.load %1141 : !llvm.ptr -> f64
%1142 = arith.mulf %1138, %1139 : f64
%1143 = arith.addf %1135, %1142 : f64
llvm.store %1143, %1128 : f64, !llvm.ptr
cf.br ^bb206
^bb205:
cf.br ^bb206
^bb206:
%1144 = llvm.load %870 : !llvm.ptr -> i64
%1145 = arith.constant 1 : i32
%1147 = arith.extsi %1145 : i32 to i64
%1146 = arith.addi %1144, %1147 : i64
llvm.store %1146, %870 : i64, !llvm.ptr
cf.br ^bb201
^bb203:
%1148 = arith.mulf %817, %811 : f64
%1149 = arith.constant 1.0 : f32
%1150 = arith.muli %803, %803 : i64
%1151 = arith.sitofp %1150 : i64 to f64
%1153 = arith.extf %1149 : f32 to f64
%1152 = arith.divf %1153, %1151 : f64
%1154 = arith.mulf %817, %1152 : f64
%1155 = llvm.load %1128 : !llvm.ptr -> f64
%1156 = arith.mulf %1154, %1155 : f64
%1157 = arith.addf %1148, %1156 : f64
%1158 = arith.constant 1 : i32
%1159 = arith.extsi %1158 : i32 to i64
llvm.store %1159, %1084 : i64, !llvm.ptr
cf.br ^bb207
^bb207:
%1160 = llvm.load %1084 : !llvm.ptr -> i64
%1161 = arith.cmpi sle, %1160, %809 : i64
cf.cond_br %1161, ^bb208, ^bb209
^bb208:
%1162 = arith.constant 0.0 : f32
%1163 = arith.extf %1162 : f32 to f64
%1164 = llvm.mlir.constant(1 : i64) : i64
%1165 = llvm.alloca %1164 x f64 : (i64) -> !llvm.ptr
llvm.store %1163, %1165 : f64, !llvm.ptr
%1166 = arith.constant 1 : i32
%1167 = arith.extsi %1166 : i32 to i64
llvm.store %1167, %870 : i64, !llvm.ptr
cf.br ^bb210
^bb210:
%1168 = llvm.load %870 : !llvm.ptr -> i64
%1169 = arith.cmpi slt, %1168, %803 : i64
cf.cond_br %1169, ^bb211, ^bb212
^bb211:
%1170 = llvm.load %870 : !llvm.ptr -> i64
%1171 = arith.cmpi sle, %1170, %809 : i64
cf.cond_br %1171, ^bb213, ^bb214
^bb213:
%1172 = llvm.load %1165 : !llvm.ptr -> f64
%1173 = llvm.load %870 : !llvm.ptr -> i64
%1174 = arith.subi %803, %1173 : i64
%1175 = arith.sitofp %1174 : i64 to f64
%1177 = llvm.load %870 : !llvm.ptr -> i64
%1178 = arith.constant 1 : i32
%1180 = arith.extsi %1178 : i32 to i64
%1179 = arith.addi %809, %1180 : i64
%1181 = arith.muli %1177, %1179 : i64
%1182 = llvm.load %1084 : !llvm.ptr -> i64
%1183 = arith.addi %1181, %1182 : i64
%1184 = llvm.getelementptr %828[%1183] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1176 = llvm.load %1184 : !llvm.ptr -> f64
%1185 = arith.mulf %1175, %1176 : f64
%1186 = arith.addf %1172, %1185 : f64
llvm.store %1186, %1165 : f64, !llvm.ptr
cf.br ^bb215
^bb214:
cf.br ^bb215
^bb215:
%1187 = llvm.load %870 : !llvm.ptr -> i64
%1188 = arith.constant 1 : i32
%1190 = arith.extsi %1188 : i32 to i64
%1189 = arith.addi %1187, %1190 : i64
llvm.store %1189, %870 : i64, !llvm.ptr
cf.br ^bb210
^bb212:
%1191 = arith.constant 1.0 : f32
%1192 = arith.muli %803, %803 : i64
%1193 = arith.sitofp %1192 : i64 to f64
%1195 = arith.extf %1191 : f32 to f64
%1194 = arith.divf %1195, %1193 : f64
%1196 = arith.mulf %817, %1194 : f64
%1197 = llvm.load %1165 : !llvm.ptr -> f64
%1198 = arith.mulf %1196, %1197 : f64
%1199 = llvm.load %1084 : !llvm.ptr -> i64
%1200 = llvm.getelementptr %854[%1199] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1198, %1200 : f64, !llvm.ptr
%1201 = llvm.load %1084 : !llvm.ptr -> i64
%1202 = arith.constant 1 : i32
%1204 = arith.extsi %1202 : i32 to i64
%1203 = arith.addi %1201, %1204 : i64
llvm.store %1203, %1084 : i64, !llvm.ptr
cf.br ^bb207
^bb209:
%1206 = arith.constant 1 : i32
%1208 = arith.extsi %1206 : i32 to i64
%1207 = arith.addi %809, %1208 : i64
%1209 = arith.muli %809, %1207 : i64
%1210 = arith.constant 8 : i32
%1211 = arith.extsi %1210 : i32 to i64
%1205 = func.call @calloc(%1209, %1211) : (i64, i64) -> !llvm.ptr
%1213 = arith.constant 8 : i32
%1214 = arith.extsi %1213 : i32 to i64
%1212 = func.call @calloc(%809, %1214) : (i64, i64) -> !llvm.ptr
%1216 = arith.constant 8 : i32
%1217 = arith.extsi %1216 : i32 to i64
%1215 = func.call @calloc(%809, %1217) : (i64, i64) -> !llvm.ptr
%1218 = arith.constant 1 : i32
%1219 = arith.extsi %1218 : i32 to i64
%1220 = llvm.mlir.constant(1 : i64) : i64
%1221 = llvm.alloca %1220 x i64 : (i64) -> !llvm.ptr
llvm.store %1219, %1221 : i64, !llvm.ptr
cf.br ^bb216
^bb216:
%1222 = llvm.load %1221 : !llvm.ptr -> i64
%1223 = arith.cmpi sle, %1222, %809 : i64
cf.cond_br %1223, ^bb217, ^bb218
^bb217:
%1224 = llvm.mlir.constant(1 : i64) : i64
%1225 = llvm.alloca %1224 x i64 : (i64) -> !llvm.ptr
llvm.store %806, %1225 : i64, !llvm.ptr
%1226 = llvm.mlir.constant(1 : i64) : i64
%1227 = llvm.alloca %1226 x i64 : (i64) -> !llvm.ptr
llvm.store %809, %1227 : i64, !llvm.ptr
%1228 = llvm.load %1227 : !llvm.ptr -> i64
%1229 = llvm.load %1221 : !llvm.ptr -> i64
%1230 = arith.constant 1 : i32
%1232 = arith.extsi %1230 : i32 to i64
%1231 = arith.subi %1229, %1232 : i64
%1233 = arith.cmpi sgt, %1228, %1231 : i64
cf.cond_br %1233, ^bb219, ^bb220
^bb219:
%1234 = llvm.load %1221 : !llvm.ptr -> i64
%1235 = arith.constant 1 : i32
%1237 = arith.extsi %1235 : i32 to i64
%1236 = arith.subi %1234, %1237 : i64
llvm.store %1236, %1227 : i64, !llvm.ptr
cf.br ^bb221
^bb220:
cf.br ^bb221
^bb221:
%1239 = llvm.load %1225 : !llvm.ptr -> i64
%1240 = llvm.load %1227 : !llvm.ptr -> i64
%1238 = func.call @arith_sum(%1239, %1240) : (i64, i64) -> f64
%1241 = llvm.mlir.constant(1 : i64) : i64
%1242 = llvm.alloca %1241 x i64 : (i64) -> !llvm.ptr
llvm.store %806, %1242 : i64, !llvm.ptr
%1243 = llvm.load %1242 : !llvm.ptr -> i64
%1244 = llvm.load %1221 : !llvm.ptr -> i64
%1245 = arith.constant 1 : i32
%1247 = arith.extsi %1245 : i32 to i64
%1246 = arith.addi %1244, %1247 : i64
%1248 = arith.cmpi slt, %1243, %1246 : i64
cf.cond_br %1248, ^bb222, ^bb223
^bb222:
%1249 = llvm.load %1221 : !llvm.ptr -> i64
%1250 = arith.constant 1 : i32
%1252 = arith.extsi %1250 : i32 to i64
%1251 = arith.addi %1249, %1252 : i64
llvm.store %1251, %1242 : i64, !llvm.ptr
cf.br ^bb224
^bb223:
cf.br ^bb224
^bb224:
%1253 = llvm.load %1242 : !llvm.ptr -> i64
%1254 = arith.subi %809, %1253 : i64
%1255 = arith.constant 1 : i32
%1257 = arith.extsi %1255 : i32 to i64
%1256 = arith.addi %1254, %1257 : i64
%1258 = llvm.mlir.constant(1 : i64) : i64
%1259 = llvm.alloca %1258 x i64 : (i64) -> !llvm.ptr
llvm.store %1256, %1259 : i64, !llvm.ptr
%1260 = llvm.load %1259 : !llvm.ptr -> i64
%1261 = arith.constant 0 : i32
%1263 = arith.extsi %1261 : i32 to i64
%1262 = arith.cmpi slt, %1260, %1263 : i64
cf.cond_br %1262, ^bb225, ^bb226
^bb225:
%1264 = arith.constant 0 : i32
%1265 = arith.extsi %1264 : i32 to i64
llvm.store %1265, %1259 : i64, !llvm.ptr
cf.br ^bb227
^bb226:
cf.br ^bb227
^bb227:
%1266 = llvm.load %1259 : !llvm.ptr -> i64
%1267 = arith.sitofp %1266 : i64 to f64
%1268 = llvm.load %1221 : !llvm.ptr -> i64
%1269 = arith.sitofp %1268 : i64 to f64
%1270 = arith.mulf %1267, %1269 : f64
%1271 = arith.addf %1238, %1270 : f64
%1272 = arith.mulf %1271, %820 : f64
%1273 = llvm.mlir.constant(1 : i64) : i64
%1274 = llvm.alloca %1273 x f64 : (i64) -> !llvm.ptr
llvm.store %1272, %1274 : f64, !llvm.ptr
%1275 = llvm.load %1221 : !llvm.ptr -> i64
%1276 = arith.cmpi sle, %806, %1275 : i64
cf.cond_br %1276, ^bb228, ^bb229
^bb228:
%1277 = llvm.load %1221 : !llvm.ptr -> i64
%1278 = arith.cmpi sle, %1277, %809 : i64
cf.cond_br %1278, ^bb231, ^bb232
^bb231:
%1279 = llvm.load %1274 : !llvm.ptr -> f64
%1280 = llvm.load %1221 : !llvm.ptr -> i64
%1281 = arith.sitofp %1280 : i64 to f64
%1282 = arith.mulf %1281, %820 : f64
%1283 = arith.addf %1279, %1282 : f64
llvm.store %1283, %1274 : f64, !llvm.ptr
cf.br ^bb233
^bb232:
cf.br ^bb233
^bb233:
cf.br ^bb230
^bb229:
cf.br ^bb230
^bb230:
%1284 = llvm.load %1242 : !llvm.ptr -> i64
%1285 = arith.cmpi sle, %1284, %809 : i64
cf.cond_br %1285, ^bb234, ^bb235
^bb234:
%1286 = llvm.load %1242 : !llvm.ptr -> i64
%1287 = llvm.load %1221 : !llvm.ptr -> i64
%1288 = arith.subi %1286, %1287 : i64
%1289 = llvm.load %1221 : !llvm.ptr -> i64
%1290 = arith.subi %809, %1289 : i64
%1291 = arith.constant 0.0 : f32
%1292 = arith.extf %1291 : f32 to f64
%1293 = llvm.mlir.constant(1 : i64) : i64
%1294 = llvm.alloca %1293 x f64 : (i64) -> !llvm.ptr
llvm.store %1292, %1294 : f64, !llvm.ptr
%1295 = arith.constant 1 : i32
%1297 = arith.extsi %1295 : i32 to i64
%1296 = arith.cmpi sgt, %1288, %1297 : i64
cf.cond_br %1296, ^bb237, ^bb238
^bb237:
%1299 = arith.constant 1 : i32
%1301 = arith.extsi %1299 : i32 to i64
%1300 = arith.subi %1288, %1301 : i64
%1302 = llvm.getelementptr %838[%1300] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1298 = llvm.load %1302 : !llvm.ptr -> f64
llvm.store %1298, %1294 : f64, !llvm.ptr
cf.br ^bb239
^bb238:
cf.br ^bb239
^bb239:
%1304 = llvm.getelementptr %838[%1290] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1303 = llvm.load %1304 : !llvm.ptr -> f64
%1305 = llvm.load %1294 : !llvm.ptr -> f64
%1306 = arith.subf %1303, %1305 : f64
%1307 = arith.constant 1 : i32
%1308 = arith.extsi %1307 : i32 to i64
%1309 = llvm.mlir.constant(1 : i64) : i64
%1310 = llvm.alloca %1309 x i64 : (i64) -> !llvm.ptr
llvm.store %1308, %1310 : i64, !llvm.ptr
cf.br ^bb240
^bb240:
%1311 = llvm.load %1310 : !llvm.ptr -> i64
%1312 = arith.cmpi sle, %1311, %809 : i64
cf.cond_br %1312, ^bb241, ^bb242
^bb241:
%1313 = arith.constant 0.0 : f32
%1314 = arith.extf %1313 : f32 to f64
%1315 = llvm.mlir.constant(1 : i64) : i64
%1316 = llvm.alloca %1315 x f64 : (i64) -> !llvm.ptr
llvm.store %1314, %1316 : f64, !llvm.ptr
%1317 = arith.constant 1 : i32
%1319 = arith.extsi %1317 : i32 to i64
%1318 = arith.cmpi sgt, %1288, %1319 : i64
cf.cond_br %1318, ^bb243, ^bb244
^bb243:
%1321 = llvm.load %1310 : !llvm.ptr -> i64
%1322 = arith.constant 1 : i32
%1324 = arith.extsi %1322 : i32 to i64
%1323 = arith.addi %809, %1324 : i64
%1325 = arith.muli %1321, %1323 : i64
%1326 = arith.constant 1 : i32
%1328 = arith.extsi %1326 : i32 to i64
%1327 = arith.subi %1288, %1328 : i64
%1329 = arith.addi %1325, %1327 : i64
%1330 = llvm.getelementptr %844[%1329] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1320 = llvm.load %1330 : !llvm.ptr -> f64
llvm.store %1320, %1316 : f64, !llvm.ptr
cf.br ^bb245
^bb244:
cf.br ^bb245
^bb245:
%1332 = llvm.load %1310 : !llvm.ptr -> i64
%1333 = arith.constant 1 : i32
%1335 = arith.extsi %1333 : i32 to i64
%1334 = arith.addi %809, %1335 : i64
%1336 = arith.muli %1332, %1334 : i64
%1337 = arith.addi %1336, %1290 : i64
%1338 = llvm.getelementptr %844[%1337] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1331 = llvm.load %1338 : !llvm.ptr -> f64
%1339 = llvm.load %1316 : !llvm.ptr -> f64
%1340 = arith.subf %1331, %1339 : f64
%1342 = llvm.load %1221 : !llvm.ptr -> i64
%1343 = arith.constant 1 : i32
%1345 = arith.extsi %1343 : i32 to i64
%1344 = arith.subi %1342, %1345 : i64
%1346 = arith.constant 1 : i32
%1348 = arith.extsi %1346 : i32 to i64
%1347 = arith.addi %809, %1348 : i64
%1349 = arith.muli %1344, %1347 : i64
%1350 = llvm.load %1310 : !llvm.ptr -> i64
%1351 = arith.constant 1 : i32
%1353 = arith.extsi %1351 : i32 to i64
%1352 = arith.subi %1350, %1353 : i64
%1354 = arith.addi %1349, %1352 : i64
%1355 = llvm.getelementptr %1205[%1354] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1341 = llvm.load %1355 : !llvm.ptr -> f64
%1356 = arith.mulf %820, %1340 : f64
%1357 = arith.subf %1341, %1356 : f64
%1358 = llvm.load %1221 : !llvm.ptr -> i64
%1359 = arith.constant 1 : i32
%1361 = arith.extsi %1359 : i32 to i64
%1360 = arith.subi %1358, %1361 : i64
%1362 = arith.constant 1 : i32
%1364 = arith.extsi %1362 : i32 to i64
%1363 = arith.addi %809, %1364 : i64
%1365 = arith.muli %1360, %1363 : i64
%1366 = llvm.load %1310 : !llvm.ptr -> i64
%1367 = arith.constant 1 : i32
%1369 = arith.extsi %1367 : i32 to i64
%1368 = arith.subi %1366, %1369 : i64
%1370 = arith.addi %1365, %1368 : i64
%1371 = llvm.getelementptr %1205[%1370] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1357, %1371 : f64, !llvm.ptr
%1372 = llvm.load %1310 : !llvm.ptr -> i64
%1373 = arith.constant 1 : i32
%1375 = arith.extsi %1373 : i32 to i64
%1374 = arith.addi %1372, %1375 : i64
llvm.store %1374, %1310 : i64, !llvm.ptr
cf.br ^bb240
^bb242:
%1376 = llvm.load %1274 : !llvm.ptr -> f64
%1377 = arith.mulf %820, %1306 : f64
%1378 = arith.addf %1376, %1377 : f64
%1379 = llvm.load %1221 : !llvm.ptr -> i64
%1380 = arith.cmpi sle, %806, %1379 : i64
cf.cond_br %1380, ^bb246, ^bb247
^bb246:
%1381 = llvm.load %1221 : !llvm.ptr -> i64
%1382 = arith.cmpi sle, %1381, %809 : i64
cf.cond_br %1382, ^bb249, ^bb250
^bb249:
%1383 = arith.constant 1 : i32
%1384 = arith.extsi %1383 : i32 to i64
%1385 = llvm.mlir.constant(1 : i64) : i64
%1386 = llvm.alloca %1385 x i64 : (i64) -> !llvm.ptr
llvm.store %1384, %1386 : i64, !llvm.ptr
cf.br ^bb252
^bb252:
%1387 = llvm.load %1386 : !llvm.ptr -> i64
%1388 = arith.cmpi sle, %1387, %809 : i64
cf.cond_br %1388, ^bb253, ^bb254
^bb253:
%1390 = llvm.load %1221 : !llvm.ptr -> i64
%1391 = arith.constant 1 : i32
%1393 = arith.extsi %1391 : i32 to i64
%1392 = arith.subi %1390, %1393 : i64
%1394 = arith.constant 1 : i32
%1396 = arith.extsi %1394 : i32 to i64
%1395 = arith.addi %809, %1396 : i64
%1397 = arith.muli %1392, %1395 : i64
%1398 = llvm.load %1386 : !llvm.ptr -> i64
%1399 = arith.constant 1 : i32
%1401 = arith.extsi %1399 : i32 to i64
%1400 = arith.subi %1398, %1401 : i64
%1402 = arith.addi %1397, %1400 : i64
%1403 = llvm.getelementptr %1205[%1402] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1389 = llvm.load %1403 : !llvm.ptr -> f64
%1405 = llvm.load %1386 : !llvm.ptr -> i64
%1406 = llvm.getelementptr %854[%1405] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1404 = llvm.load %1406 : !llvm.ptr -> f64
%1407 = arith.mulf %820, %1404 : f64
%1408 = arith.subf %1389, %1407 : f64
%1409 = llvm.load %1221 : !llvm.ptr -> i64
%1410 = arith.constant 1 : i32
%1412 = arith.extsi %1410 : i32 to i64
%1411 = arith.subi %1409, %1412 : i64
%1413 = arith.constant 1 : i32
%1415 = arith.extsi %1413 : i32 to i64
%1414 = arith.addi %809, %1415 : i64
%1416 = arith.muli %1411, %1414 : i64
%1417 = llvm.load %1386 : !llvm.ptr -> i64
%1418 = arith.constant 1 : i32
%1420 = arith.extsi %1418 : i32 to i64
%1419 = arith.subi %1417, %1420 : i64
%1421 = arith.addi %1416, %1419 : i64
%1422 = llvm.getelementptr %1205[%1421] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1408, %1422 : f64, !llvm.ptr
%1423 = llvm.load %1386 : !llvm.ptr -> i64
%1424 = arith.constant 1 : i32
%1426 = arith.extsi %1424 : i32 to i64
%1425 = arith.addi %1423, %1426 : i64
llvm.store %1425, %1386 : i64, !llvm.ptr
cf.br ^bb252
^bb254:
%1427 = arith.mulf %820, %1157 : f64
%1428 = arith.addf %1378, %1427 : f64
%1429 = llvm.load %1221 : !llvm.ptr -> i64
%1430 = arith.constant 1 : i32
%1432 = arith.extsi %1430 : i32 to i64
%1431 = arith.subi %1429, %1432 : i64
%1433 = llvm.getelementptr %1212[%1431] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1428, %1433 : f64, !llvm.ptr
cf.br ^bb251
^bb250:
%1434 = llvm.load %1221 : !llvm.ptr -> i64
%1435 = arith.constant 1 : i32
%1437 = arith.extsi %1435 : i32 to i64
%1436 = arith.subi %1434, %1437 : i64
%1438 = llvm.getelementptr %1212[%1436] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1378, %1438 : f64, !llvm.ptr
cf.br ^bb251
^bb251:
cf.br ^bb248
^bb247:
%1439 = llvm.load %1221 : !llvm.ptr -> i64
%1440 = arith.constant 1 : i32
%1442 = arith.extsi %1440 : i32 to i64
%1441 = arith.subi %1439, %1442 : i64
%1443 = llvm.getelementptr %1212[%1441] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1378, %1443 : f64, !llvm.ptr
cf.br ^bb248
^bb248:
cf.br ^bb236
^bb235:
%1444 = llvm.load %1274 : !llvm.ptr -> f64
%1445 = llvm.load %1221 : !llvm.ptr -> i64
%1446 = arith.cmpi sle, %806, %1445 : i64
cf.cond_br %1446, ^bb255, ^bb256
^bb255:
%1447 = llvm.load %1221 : !llvm.ptr -> i64
%1448 = arith.cmpi sle, %1447, %809 : i64
cf.cond_br %1448, ^bb258, ^bb259
^bb258:
%1449 = arith.constant 1 : i32
%1450 = arith.extsi %1449 : i32 to i64
%1451 = llvm.mlir.constant(1 : i64) : i64
%1452 = llvm.alloca %1451 x i64 : (i64) -> !llvm.ptr
llvm.store %1450, %1452 : i64, !llvm.ptr
cf.br ^bb261
^bb261:
%1453 = llvm.load %1452 : !llvm.ptr -> i64
%1454 = arith.cmpi sle, %1453, %809 : i64
cf.cond_br %1454, ^bb262, ^bb263
^bb262:
%1456 = llvm.load %1221 : !llvm.ptr -> i64
%1457 = arith.constant 1 : i32
%1459 = arith.extsi %1457 : i32 to i64
%1458 = arith.subi %1456, %1459 : i64
%1460 = arith.constant 1 : i32
%1462 = arith.extsi %1460 : i32 to i64
%1461 = arith.addi %809, %1462 : i64
%1463 = arith.muli %1458, %1461 : i64
%1464 = llvm.load %1452 : !llvm.ptr -> i64
%1465 = arith.constant 1 : i32
%1467 = arith.extsi %1465 : i32 to i64
%1466 = arith.subi %1464, %1467 : i64
%1468 = arith.addi %1463, %1466 : i64
%1469 = llvm.getelementptr %1205[%1468] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1455 = llvm.load %1469 : !llvm.ptr -> f64
%1471 = llvm.load %1452 : !llvm.ptr -> i64
%1472 = llvm.getelementptr %854[%1471] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1470 = llvm.load %1472 : !llvm.ptr -> f64
%1473 = arith.mulf %820, %1470 : f64
%1474 = arith.subf %1455, %1473 : f64
%1475 = llvm.load %1221 : !llvm.ptr -> i64
%1476 = arith.constant 1 : i32
%1478 = arith.extsi %1476 : i32 to i64
%1477 = arith.subi %1475, %1478 : i64
%1479 = arith.constant 1 : i32
%1481 = arith.extsi %1479 : i32 to i64
%1480 = arith.addi %809, %1481 : i64
%1482 = arith.muli %1477, %1480 : i64
%1483 = llvm.load %1452 : !llvm.ptr -> i64
%1484 = arith.constant 1 : i32
%1486 = arith.extsi %1484 : i32 to i64
%1485 = arith.subi %1483, %1486 : i64
%1487 = arith.addi %1482, %1485 : i64
%1488 = llvm.getelementptr %1205[%1487] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1474, %1488 : f64, !llvm.ptr
%1489 = llvm.load %1452 : !llvm.ptr -> i64
%1490 = arith.constant 1 : i32
%1492 = arith.extsi %1490 : i32 to i64
%1491 = arith.addi %1489, %1492 : i64
llvm.store %1491, %1452 : i64, !llvm.ptr
cf.br ^bb261
^bb263:
%1493 = arith.mulf %820, %1157 : f64
%1494 = arith.addf %1444, %1493 : f64
%1495 = llvm.load %1221 : !llvm.ptr -> i64
%1496 = arith.constant 1 : i32
%1498 = arith.extsi %1496 : i32 to i64
%1497 = arith.subi %1495, %1498 : i64
%1499 = llvm.getelementptr %1212[%1497] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1494, %1499 : f64, !llvm.ptr
cf.br ^bb260
^bb259:
%1500 = llvm.load %1221 : !llvm.ptr -> i64
%1501 = arith.constant 1 : i32
%1503 = arith.extsi %1501 : i32 to i64
%1502 = arith.subi %1500, %1503 : i64
%1504 = llvm.getelementptr %1212[%1502] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1444, %1504 : f64, !llvm.ptr
cf.br ^bb260
^bb260:
cf.br ^bb257
^bb256:
%1505 = llvm.load %1221 : !llvm.ptr -> i64
%1506 = arith.constant 1 : i32
%1508 = arith.extsi %1506 : i32 to i64
%1507 = arith.subi %1505, %1508 : i64
%1509 = llvm.getelementptr %1212[%1507] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1444, %1509 : f64, !llvm.ptr
cf.br ^bb257
^bb257:
cf.br ^bb236
^bb236:
%1511 = llvm.load %1221 : !llvm.ptr -> i64
%1512 = arith.constant 1 : i32
%1514 = arith.extsi %1512 : i32 to i64
%1513 = arith.subi %1511, %1514 : i64
%1515 = arith.constant 1 : i32
%1517 = arith.extsi %1515 : i32 to i64
%1516 = arith.addi %809, %1517 : i64
%1518 = arith.muli %1513, %1516 : i64
%1519 = llvm.load %1221 : !llvm.ptr -> i64
%1520 = arith.constant 1 : i32
%1522 = arith.extsi %1520 : i32 to i64
%1521 = arith.subi %1519, %1522 : i64
%1523 = arith.addi %1518, %1521 : i64
%1524 = llvm.getelementptr %1205[%1523] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1510 = llvm.load %1524 : !llvm.ptr -> f64
%1525 = arith.constant 1.0 : f32
%1527 = arith.extf %1525 : f32 to f64
%1526 = arith.addf %1510, %1527 : f64
%1528 = llvm.load %1221 : !llvm.ptr -> i64
%1529 = arith.constant 1 : i32
%1531 = arith.extsi %1529 : i32 to i64
%1530 = arith.subi %1528, %1531 : i64
%1532 = arith.constant 1 : i32
%1534 = arith.extsi %1532 : i32 to i64
%1533 = arith.addi %809, %1534 : i64
%1535 = arith.muli %1530, %1533 : i64
%1536 = llvm.load %1221 : !llvm.ptr -> i64
%1537 = arith.constant 1 : i32
%1539 = arith.extsi %1537 : i32 to i64
%1538 = arith.subi %1536, %1539 : i64
%1540 = arith.addi %1535, %1538 : i64
%1541 = llvm.getelementptr %1205[%1540] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1526, %1541 : f64, !llvm.ptr
%1542 = llvm.load %1221 : !llvm.ptr -> i64
%1543 = arith.constant 1 : i32
%1545 = arith.extsi %1543 : i32 to i64
%1544 = arith.addi %1542, %1545 : i64
llvm.store %1544, %1221 : i64, !llvm.ptr
cf.br ^bb216
^bb218:
func.call @gauss_solve(%1205, %1212, %809, %1215) : (!llvm.ptr, !llvm.ptr, i64, !llvm.ptr) -> ()
%1547 = arith.constant 1 : i32
%1548 = arith.extsi %1547 : i32 to i64
%1549 = llvm.mlir.constant(1 : i64) : i64
%1550 = llvm.alloca %1549 x i64 : (i64) -> !llvm.ptr
llvm.store %1548, %1550 : i64, !llvm.ptr
cf.br ^bb264
^bb264:
%1551 = llvm.load %1550 : !llvm.ptr -> i64
%1552 = arith.cmpi sle, %1551, %809 : i64
cf.cond_br %1552, ^bb265, ^bb266
^bb265:
%1554 = llvm.load %1550 : !llvm.ptr -> i64
%1555 = arith.constant 1 : i32
%1557 = arith.extsi %1555 : i32 to i64
%1556 = arith.subi %1554, %1557 : i64
%1558 = llvm.getelementptr %1215[%1556] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1553 = llvm.load %1558 : !llvm.ptr -> f64
%1559 = llvm.load %1550 : !llvm.ptr -> i64
%1560 = llvm.getelementptr %arg2[%1559] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1553, %1560 : f64, !llvm.ptr
%1561 = llvm.load %1550 : !llvm.ptr -> i64
%1562 = arith.constant 1 : i32
%1564 = arith.extsi %1562 : i32 to i64
%1563 = arith.addi %1561, %1564 : i64
llvm.store %1563, %1550 : i64, !llvm.ptr
cf.br ^bb264
^bb266:
%1565 = arith.constant 0.0 : f32
%1566 = arith.extf %1565 : f32 to f64
%1567 = llvm.mlir.constant(1 : i64) : i64
%1568 = llvm.alloca %1567 x f64 : (i64) -> !llvm.ptr
llvm.store %1566, %1568 : f64, !llvm.ptr
%1569 = arith.constant 1 : i32
%1570 = arith.extsi %1569 : i32 to i64
llvm.store %1570, %870 : i64, !llvm.ptr
cf.br ^bb267
^bb267:
%1571 = llvm.load %870 : !llvm.ptr -> i64
%1572 = arith.cmpi slt, %1571, %803 : i64
cf.cond_br %1572, ^bb268, ^bb269
^bb268:
%1573 = llvm.load %1568 : !llvm.ptr -> f64
%1574 = llvm.load %870 : !llvm.ptr -> i64
%1575 = arith.subi %803, %1574 : i64
%1576 = arith.sitofp %1575 : i64 to f64
%1577 = arith.constant 2.0 : f32
%1579 = arith.extf %1577 : f32 to f64
%1578 = arith.mulf %1576, %1579 : f64
%1581 = llvm.load %870 : !llvm.ptr -> i64
%1582 = llvm.getelementptr %arg2[%1581] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1580 = llvm.load %1582 : !llvm.ptr -> f64
%1583 = arith.mulf %1578, %1580 : f64
%1584 = arith.addf %1573, %1583 : f64
llvm.store %1584, %1568 : f64, !llvm.ptr
%1585 = llvm.load %870 : !llvm.ptr -> i64
%1586 = arith.constant 1 : i32
%1588 = arith.extsi %1586 : i32 to i64
%1587 = arith.addi %1585, %1588 : i64
llvm.store %1587, %870 : i64, !llvm.ptr
cf.br ^bb267
^bb269:
%1589 = llvm.load %1568 : !llvm.ptr -> f64
%1590 = arith.muli %803, %803 : i64
%1591 = arith.sitofp %1590 : i64 to f64
%1592 = arith.divf %1589, %1591 : f64
%1593 = arith.addf %811, %1592 : f64
%1594 = arith.mulf %817, %1593 : f64
%1595 = arith.constant 0 : i32
%1596 = arith.extsi %1595 : i32 to i64
%1597 = llvm.getelementptr %arg3[%1596] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1594, %1597 : f64, !llvm.ptr
func.call @free(%822) : (!llvm.ptr) -> ()
func.call @free(%828) : (!llvm.ptr) -> ()
func.call @free(%838) : (!llvm.ptr) -> ()
func.call @free(%844) : (!llvm.ptr) -> ()
func.call @free(%854) : (!llvm.ptr) -> ()
func.call @free(%860) : (!llvm.ptr) -> ()
func.call @free(%1205) : (!llvm.ptr) -> ()
func.call @free(%1212) : (!llvm.ptr) -> ()
func.call @free(%1215) : (!llvm.ptr) -> ()
func.return
}
func.func @expected_game(%arg0: i64, %arg1: i64) -> f64 {
%1607 = arith.subi %arg0, %arg1 : i64
%1608 = arith.constant 1 : i32
%1610 = arith.extsi %1608 : i32 to i64
%1609 = arith.addi %1607, %1610 : i64
%1611 = arith.constant 5 : i32
%1613 = arith.extsi %1611 : i32 to i64
%1612 = arith.addi %arg0, %1613 : i64
%1615 = arith.constant 1 : i32
%1617 = arith.extsi %1615 : i32 to i64
%1616 = arith.addi %1612, %1617 : i64
%1618 = arith.constant 8 : i32
%1619 = arith.extsi %1618 : i32 to i64
%1614 = func.call @calloc(%1616, %1619) : (i64, i64) -> !llvm.ptr
%1621 = arith.constant 1 : i32
%1622 = arith.constant 8 : i32
%1623 = arith.extsi %1621 : i32 to i64
%1624 = arith.extsi %1622 : i32 to i64
%1620 = func.call @calloc(%1623, %1624) : (i64, i64) -> !llvm.ptr
%1625 = arith.constant 0.0 : f32
%1626 = arith.constant 0 : i32
%1627 = arith.extf %1625 : f32 to f64
%1628 = arith.extsi %1626 : i32 to i64
%1629 = llvm.getelementptr %1620[%1628] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %1627, %1629 : f64, !llvm.ptr
%1630 = arith.constant 0 : i32
%1631 = llvm.mlir.constant(1 : i64) : i64
%1632 = llvm.alloca %1631 x i32 : (i64) -> !llvm.ptr
llvm.store %1630, %1632 : i32, !llvm.ptr
%1633 = arith.constant 25 : i32
%1635 = arith.extsi %1633 : i32 to i64
%1634 = arith.cmpi sge, %1609, %1635 : i64
cf.cond_br %1634, ^bb270, ^bb271
^bb270:
%1636 = func.call @compute_C1_iterative(%arg1, %arg0, %1614, %1620) : (i64, i64, !llvm.ptr, !llvm.ptr) -> i32
llvm.store %1636, %1632 : i32, !llvm.ptr
cf.br ^bb272
^bb271:
cf.br ^bb272
^bb272:
%1637 = llvm.load %1632 : !llvm.ptr -> i32
%1638 = arith.constant 0 : i32
%1639 = arith.cmpi eq, %1637, %1638 : i32
cf.cond_br %1639, ^bb273, ^bb274
^bb273:
func.call @compute_C1_direct(%arg1, %arg0, %1614, %1620) : (i64, i64, !llvm.ptr, !llvm.ptr) -> ()
cf.br ^bb275
^bb274:
cf.br ^bb275
^bb275:
%1642 = arith.constant 0 : i32
%1643 = arith.extsi %1642 : i32 to i64
%1644 = llvm.getelementptr %1620[%1643] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1641 = llvm.load %1644 : !llvm.ptr -> f64
%1645 = func.call @expected_min_consecutive(%arg1, %arg0) : (i64, i64) -> f64
%1646 = arith.constant 1.0 : f32
%1647 = arith.sitofp %1609 : i64 to f64
%1649 = arith.extf %1646 : f32 to f64
%1648 = arith.divf %1649, %1647 : f64
%1650 = arith.mulf %1641, %1648 : f64
%1651 = llvm.mlir.constant(1 : i64) : i64
%1652 = llvm.alloca %1651 x f64 : (i64) -> !llvm.ptr
llvm.store %1650, %1652 : f64, !llvm.ptr
%1653 = arith.muli %1609, %1609 : i64
%1654 = arith.sitofp %1653 : i64 to f64
%1655 = arith.constant 1 : i32
%1656 = arith.extsi %1655 : i32 to i64
%1657 = llvm.mlir.constant(1 : i64) : i64
%1658 = llvm.alloca %1657 x i64 : (i64) -> !llvm.ptr
llvm.store %1656, %1658 : i64, !llvm.ptr
cf.br ^bb276
^bb276:
%1659 = llvm.load %1658 : !llvm.ptr -> i64
%1660 = arith.cmpi slt, %1659, %1609 : i64
cf.cond_br %1660, ^bb277, ^bb278
^bb277:
%1661 = llvm.load %1652 : !llvm.ptr -> f64
%1662 = arith.constant 2.0 : f32
%1663 = llvm.load %1658 : !llvm.ptr -> i64
%1664 = arith.subi %1609, %1663 : i64
%1665 = arith.sitofp %1664 : i64 to f64
%1667 = arith.extf %1662 : f32 to f64
%1666 = arith.mulf %1667, %1665 : f64
%1668 = arith.divf %1666, %1654 : f64
%1670 = llvm.load %1658 : !llvm.ptr -> i64
%1671 = llvm.getelementptr %1614[%1670] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%1669 = llvm.load %1671 : !llvm.ptr -> f64
%1672 = arith.mulf %1668, %1669 : f64
%1673 = arith.addf %1661, %1672 : f64
llvm.store %1673, %1652 : f64, !llvm.ptr
%1674 = llvm.load %1658 : !llvm.ptr -> i64
%1675 = arith.constant 1 : i32
%1677 = arith.extsi %1675 : i32 to i64
%1676 = arith.addi %1674, %1677 : i64
llvm.store %1676, %1658 : i64, !llvm.ptr
cf.br ^bb276
^bb278:
func.call @free(%1614) : (!llvm.ptr) -> ()
func.call @free(%1620) : (!llvm.ptr) -> ()
%1680 = llvm.load %1652 : !llvm.ptr -> f64
%1681 = arith.addf %1645, %1680 : f64
func.return %1681 : f64
}
func.func @main() -> i32 {
%1682 = arith.constant 0.0 : f32
%1683 = arith.extf %1682 : f32 to f64
%1684 = llvm.mlir.constant(1 : i64) : i64
%1685 = llvm.alloca %1684 x f64 : (i64) -> !llvm.ptr
llvm.store %1683, %1685 : f64, !llvm.ptr
%1686 = arith.constant 2 : i32
%1687 = arith.extsi %1686 : i32 to i64
%1688 = llvm.mlir.constant(1 : i64) : i64
%1689 = llvm.alloca %1688 x i64 : (i64) -> !llvm.ptr
llvm.store %1687, %1689 : i64, !llvm.ptr
cf.br ^bb279
^bb279:
%1690 = llvm.load %1689 : !llvm.ptr -> i64
%1691 = arith.constant 100 : i32
%1693 = arith.extsi %1691 : i32 to i64
%1692 = arith.cmpi sle, %1690, %1693 : i64
cf.cond_br %1692, ^bb280, ^bb281
^bb280:
%1694 = arith.constant 1 : i32
%1695 = arith.extsi %1694 : i32 to i64
%1696 = llvm.mlir.constant(1 : i64) : i64
%1697 = llvm.alloca %1696 x i64 : (i64) -> !llvm.ptr
llvm.store %1695, %1697 : i64, !llvm.ptr
cf.br ^bb282
^bb282:
%1698 = llvm.load %1697 : !llvm.ptr -> i64
%1699 = llvm.load %1689 : !llvm.ptr -> i64
%1700 = arith.cmpi slt, %1698, %1699 : i64
cf.cond_br %1700, ^bb283, ^bb284
^bb283:
%1701 = llvm.load %1685 : !llvm.ptr -> f64
%1703 = llvm.load %1689 : !llvm.ptr -> i64
%1704 = llvm.load %1697 : !llvm.ptr -> i64
%1702 = func.call @expected_game(%1703, %1704) : (i64, i64) -> f64
%1705 = arith.addf %1701, %1702 : f64
llvm.store %1705, %1685 : f64, !llvm.ptr
%1706 = llvm.load %1697 : !llvm.ptr -> i64
%1707 = arith.constant 1 : i32
%1709 = arith.extsi %1707 : i32 to i64
%1708 = arith.addi %1706, %1709 : i64
llvm.store %1708, %1697 : i64, !llvm.ptr
cf.br ^bb282
^bb284:
%1710 = llvm.load %1689 : !llvm.ptr -> i64
%1711 = arith.constant 1 : i32
%1713 = arith.extsi %1711 : i32 to i64
%1712 = arith.addi %1710, %1713 : i64
llvm.store %1712, %1689 : i64, !llvm.ptr
cf.br ^bb279
^bb281:
%1714 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1715 = llvm.load %1685 : !llvm.ptr -> f64
%1716 = llvm.call @printf(%1714, %1715) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
%1717 = arith.constant 0 : i32
func.return %1717 : i32
}
}