← All problems
Problem 481
Chef Showdown — expected remaining dishes E(14) with Fibonacci skills.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^3)O(log n)
Space complexity O(n^2)O(1)
Approach Flow solution Matrix exponentiation
Verdict Suboptimal
Flow source
# Project Euler 481
# Chef Showdown — expected remaining dishes E(14) with Fibonacci skills.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
let mut G_n: i64 = 14
let mut G_S: ptr<f64> = null
let mut G_W: ptr<f64> = null
let mut G_E: ptr<f64> = null
function w_at(mask: i64, turn: i64, chef: i64) -> f64 {
return G_W[((mask * G_n + turn) * G_n + chef)]
}
function w_set(mask: i64, turn: i64, chef: i64, v: f64) -> void {
G_W[((mask * G_n + turn) * G_n + chef)] = v
}
function e_at(mask: i64, turn: i64) -> f64 {
return G_E[mask * G_n + turn]
}
function e_set(mask: i64, turn: i64, v: f64) -> void {
G_E[mask * G_n + turn] = v
}
function next_alive(i: i64, mask: i64) -> i64 {
let mut j: i64 = i + 1
while j < G_n {
if ((mask >> j) & 1) != 0 { return j }
j = j + 1
}
j = 0
while j <= i {
if ((mask >> j) & 1) != 0 { return j }
j = j + 1
}
return i
}
function popcount(x0: i64) -> i64 {
let mut x: i64 = x0
let mut c: i64 = 0
while x != 0 {
c = c + (x & 1)
x = x / 2
}
return c
}
function absf(x: f64) -> f64 {
if x < 0.0 { return 0.0 - x }
return x
}
function solve() -> f64 {
let n: i64 = G_n
let nmask: i64 = 1 << n
let mut i: i64 = 0
while i < n {
w_set(1 << i, i, i, 1.0)
e_set(1 << i, i, 0.0)
i = i + 1
}
let chefs: ptr<i64> = calloc(n, 8)
let a: ptr<f64> = calloc(n, 8)
let b: ptr<f64> = calloc(n * n, 8)
let c: ptr<f64> = calloc(n, 8)
let A: ptr<f64> = calloc(n, 8)
let B: ptr<f64> = calloc(n * n, 8)
let Ae: ptr<f64> = calloc(n, 8)
let Be: ptr<f64> = calloc(n, 8)
let W0: ptr<f64> = calloc(n, 8)
let pos: ptr<i64> = calloc(n, 8)
let tied: ptr<i64> = calloc(n, 8)
let B_next: ptr<f64> = calloc(n, 8)
let mut size: i64 = 2
while size <= n {
let mut mask: i64 = 1
while mask < nmask {
if popcount(mask) == size {
let mut m: i64 = 0
i = 0
while i < n {
if ((mask >> i) & 1) != 0 {
chefs[m] = i
pos[i] = m
m = m + 1
}
i = i + 1
}
let mut t: i64 = 0
while t < m {
let ci: i64 = chefs[t]
let p: f64 = G_S[ci]
a[t] = 1.0 - p
let mut best: f64 = 0.0 - 1.0
let mut ntied: i64 = 0
let mut jj: i64 = 0
while jj < m {
let cj: i64 = chefs[jj]
if cj != ci {
let mask2b: i64 = mask - (1 << cj)
let turn2: i64 = next_alive(ci, mask2b)
let val: f64 = w_at(mask2b, turn2, ci)
if val > best {
let mut is_new: i64 = 0
if best < 0.0 {
is_new = 1
} else {
if val - best > 0.000000000000001 {
is_new = 1
}
}
if is_new != 0 {
best = val
ntied = 1
tied[0] = cj
} else {
if absf(val - best) <= 0.000000000000001 {
tied[ntied] = cj
ntied = ntied + 1
}
}
} else {
if absf(val - best) <= 0.000000000000001 {
tied[ntied] = cj
ntied = ntied + 1
}
}
}
jj = jj + 1
}
let mut jstar: i64 = tied[0]
if ntied > 1 {
let pi: i64 = pos[ci]
let mut bestd: i64 = n + 1
let mut ti: i64 = 0
while ti < ntied {
let pj: i64 = pos[tied[ti]]
let mut d: i64 = pj - pi
if d <= 0 { d = d + m }
if d < bestd {
bestd = d
jstar = tied[ti]
}
ti = ti + 1
}
}
let mask2: i64 = mask - (1 << jstar)
let turn2: i64 = next_alive(ci, mask2)
let mut k: i64 = 0
while k < n {
b[t * n + k] = p * w_at(mask2, turn2, k)
k = k + 1
}
c[t] = p * e_at(mask2, turn2)
t = t + 1
}
let mut A_next: f64 = 1.0
let mut k: i64 = 0
while k < n {
B_next[k] = 0.0
k = k + 1
}
t = m - 1
while t >= 0 {
A[t] = a[t] * A_next
k = 0
while k < n {
B[t * n + k] = a[t] * B_next[k] + b[t * n + k]
k = k + 1
}
A_next = A[t]
k = 0
while k < n {
B_next[k] = B[t * n + k]
k = k + 1
}
t = t - 1
}
let denom: f64 = 1.0 - A[0]
k = 0
while k < n {
W0[k] = B[k] / denom
k = k + 1
}
t = 0
while t < m {
let chef: i64 = chefs[t]
k = 0
while k < n {
w_set(mask, chef, k, A[t] * W0[k] + B[t * n + k])
k = k + 1
}
t = t + 1
}
let mut Ae_next: f64 = 1.0
let mut Be_next: f64 = 0.0
t = m - 1
while t >= 0 {
Ae[t] = a[t] * Ae_next
Be[t] = 1.0 + a[t] * Be_next + c[t]
Ae_next = Ae[t]
Be_next = Be[t]
t = t - 1
}
let denom_e: f64 = 1.0 - Ae[0]
let E0: f64 = Be[0] / denom_e
t = 0
while t < m {
e_set(mask, chefs[t], Ae[t] * E0 + Be[t])
t = t + 1
}
}
mask = mask + 1
}
size = size + 1
}
let ans: f64 = e_at(nmask - 1, 0)
free(B_next)
free(tied)
free(pos)
free(W0)
free(Be)
free(Ae)
free(B)
free(A)
free(c)
free(b)
free(a)
free(chefs)
return ans
}
function main() -> i32 {
let n: i64 = 14
G_n = n
G_S = calloc(n, 8)
G_W = calloc((1 << n) * n * n, 8)
G_E = calloc((1 << n) * n, 8)
if G_S == null || G_W == null || G_E == null { return 1 }
let fib: ptr<i64> = calloc(n + 2, 8)
fib[1] = 1
fib[2] = 1
let mut i: i64 = 3
while i <= n + 1 {
fib[i] = fib[i - 1] + fib[i - 2]
i = i + 1
}
let denom: f64 = fib[n + 1] as f64
i = 0
while i < n {
G_S[i] = (fib[i + 1] as f64) / denom
i = i + 1
}
free(fib)
let ans: f64 = solve()
printf("%.8f\n", ans)
free(G_E)
free(G_W)
free(G_S)
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 w_at_i64_i64_i64(int64_t mask, int64_t turn, int64_t chef);
void w_set_i64_i64_i64_f64(int64_t mask, int64_t turn, int64_t chef, double v);
double e_at_i64_i64(int64_t mask, int64_t turn);
void e_set_i64_i64_f64(int64_t mask, int64_t turn, double v);
int64_t next_alive_i64_i64(int64_t i, int64_t mask);
int64_t popcount_i64(int64_t x0);
double absf_f64(double x);
double solve(void);
int32_t main(void);
/* Module statics */
static int64_t G_n = 14;
static double* G_S = NULL;
static double* G_W = NULL;
static double* G_E = NULL;
double w_at_i64_i64_i64(int64_t mask, int64_t turn, int64_t chef) {
return G_W[((((mask * G_n) + turn) * G_n) + chef)];
}
void w_set_i64_i64_i64_f64(int64_t mask, int64_t turn, int64_t chef, double v) {
G_W[((((mask * G_n) + turn) * G_n) + chef)] = v;
}
double e_at_i64_i64(int64_t mask, int64_t turn) {
return G_E[((mask * G_n) + turn)];
}
void e_set_i64_i64_f64(int64_t mask, int64_t turn, double v) {
G_E[((mask * G_n) + turn)] = v;
}
int64_t next_alive_i64_i64(int64_t i, int64_t mask) {
int64_t j = (i + 1);
while (j < G_n) {
if ((FLOW_CHECKED_SHR((mask), (j)) & 1) != 0) {
return j;
}
j = (j + 1);
}
j = 0;
while (j <= i) {
if ((FLOW_CHECKED_SHR((mask), (j)) & 1) != 0) {
return j;
}
j = (j + 1);
}
return i;
}
int64_t popcount_i64(int64_t x0) {
int64_t x = x0;
int64_t c = 0;
while (x != 0) {
c = (c + (x & 1));
x = FLOW_CHECKED_DIV((x), (2));
}
return c;
}
double absf_f64(double x) {
if (x < 0.0) {
return (0.0 - x);
}
return x;
}
double solve(void) {
int64_t n = G_n;
int64_t nmask = FLOW_CHECKED_SHL((1), (n));
int64_t i = 0;
while (i < n) {
w_set_i64_i64_i64_f64(FLOW_CHECKED_SHL((1), (i)), i, i, 1.0);
e_set_i64_i64_f64(FLOW_CHECKED_SHL((1), (i)), i, 0.0);
i = (i + 1);
}
int64_t* chefs = (int64_t*)(calloc(n, 8));
double* a = (double*)(calloc(n, 8));
double* b = (double*)(calloc((n * n), 8));
double* c = (double*)(calloc(n, 8));
double* A = (double*)(calloc(n, 8));
double* B = (double*)(calloc((n * n), 8));
double* Ae = (double*)(calloc(n, 8));
double* Be = (double*)(calloc(n, 8));
double* W0 = (double*)(calloc(n, 8));
int64_t* pos = (int64_t*)(calloc(n, 8));
int64_t* tied = (int64_t*)(calloc(n, 8));
double* B_next = (double*)(calloc(n, 8));
int64_t size = 2;
while (size <= n) {
int64_t mask = 1;
while (mask < nmask) {
if (popcount_i64(mask) == size) {
int64_t m = 0;
i = 0;
while (i < n) {
if ((FLOW_CHECKED_SHR((mask), (i)) & 1) != 0) {
chefs[m] = i;
pos[i] = m;
m = (m + 1);
}
i = (i + 1);
}
int64_t t = 0;
while (t < m) {
int64_t ci = chefs[t];
double p = G_S[ci];
a[t] = (1.0 - p);
double best = (0.0 - 1.0);
int64_t ntied = 0;
int64_t jj = 0;
while (jj < m) {
int64_t cj = chefs[jj];
if (cj != ci) {
int64_t mask2b = (mask - FLOW_CHECKED_SHL((1), (cj)));
int64_t turn2 = next_alive_i64_i64(ci, mask2b);
double val = w_at_i64_i64_i64(mask2b, turn2, ci);
if (val > best) {
int64_t is_new = 0;
if (best < 0.0) {
is_new = 1;
} else {
if ((val - best) > 0.000000000000001) {
is_new = 1;
}
}
if (is_new != 0) {
best = val;
ntied = 1;
tied[0] = cj;
} else {
if (absf_f64((val - best)) <= 0.000000000000001) {
tied[ntied] = cj;
ntied = (ntied + 1);
}
}
} else {
if (absf_f64((val - best)) <= 0.000000000000001) {
tied[ntied] = cj;
ntied = (ntied + 1);
}
}
}
jj = (jj + 1);
}
int64_t jstar = tied[0];
if (ntied > 1) {
int64_t pi = pos[ci];
int64_t bestd = (n + 1);
int64_t ti = 0;
while (ti < ntied) {
int64_t pj = pos[tied[ti]];
int64_t d = (pj - pi);
if (d <= 0) {
d = (d + m);
}
if (d < bestd) {
bestd = d;
jstar = tied[ti];
}
ti = (ti + 1);
}
}
int64_t mask2 = (mask - FLOW_CHECKED_SHL((1), (jstar)));
int64_t turn2 = next_alive_i64_i64(ci, mask2);
int64_t k = 0;
while (k < n) {
b[((t * n) + k)] = (p * w_at_i64_i64_i64(mask2, turn2, k));
k = (k + 1);
}
c[t] = (p * e_at_i64_i64(mask2, turn2));
t = (t + 1);
}
double A_next = 1.0;
int64_t k = 0;
while (k < n) {
B_next[k] = 0.0;
k = (k + 1);
}
t = (m - 1);
while (t >= 0) {
A[t] = (a[t] * A_next);
k = 0;
while (k < n) {
B[((t * n) + k)] = ((a[t] * B_next[k]) + b[((t * n) + k)]);
k = (k + 1);
}
A_next = A[t];
k = 0;
while (k < n) {
B_next[k] = B[((t * n) + k)];
k = (k + 1);
}
t = (t - 1);
}
double denom = (1.0 - A[0]);
k = 0;
while (k < n) {
W0[k] = (B[k] / denom);
k = (k + 1);
}
t = 0;
while (t < m) {
int64_t chef = chefs[t];
k = 0;
while (k < n) {
w_set_i64_i64_i64_f64(mask, chef, k, ((A[t] * W0[k]) + B[((t * n) + k)]));
k = (k + 1);
}
t = (t + 1);
}
double Ae_next = 1.0;
double Be_next = 0.0;
t = (m - 1);
while (t >= 0) {
Ae[t] = (a[t] * Ae_next);
Be[t] = ((1.0 + (a[t] * Be_next)) + c[t]);
Ae_next = Ae[t];
Be_next = Be[t];
t = (t - 1);
}
double denom_e = (1.0 - Ae[0]);
double E0 = (Be[0] / denom_e);
t = 0;
while (t < m) {
e_set_i64_i64_f64(mask, chefs[t], ((Ae[t] * E0) + Be[t]));
t = (t + 1);
}
}
mask = (mask + 1);
}
size = (size + 1);
}
double ans = e_at_i64_i64((nmask - 1), 0);
free(B_next);
free(tied);
free(pos);
free(W0);
free(Be);
free(Ae);
free(B);
free(A);
free(c);
free(b);
free(a);
free(chefs);
return ans;
}
int32_t main(void) {
int64_t n = 14;
G_n = n;
G_S = calloc(n, 8);
G_W = calloc(((FLOW_CHECKED_SHL((1), (n)) * n) * n), 8);
G_E = calloc((FLOW_CHECKED_SHL((1), (n)) * n), 8);
if (((G_S == NULL || G_W == NULL) || G_E == NULL)) {
return 1;
}
int64_t* fib = (int64_t*)(calloc((n + 2), 8));
fib[1] = 1;
fib[2] = 1;
int64_t i = 3;
while (i <= (n + 1)) {
fib[i] = (fib[(i - 1)] + fib[(i - 2)]);
i = (i + 1);
}
double denom = ((double)(fib[(n + 1)]));
i = 0;
while (i < n) {
G_S[i] = (((double)(fib[(i + 1)])) / denom);
i = (i + 1);
}
free(fib);
double ans = solve();
printf("%.8f\n", ans);
free(G_E);
free(G_W);
free(G_S);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.8f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
// Module static: G_n
llvm.mlir.global internal @G_n(14 : i64) : i64
// Module static: G_S
llvm.mlir.global internal @G_S() {addr_space = 0 : i32} : !llvm.ptr {
%0 = llvm.mlir.zero : !llvm.ptr
llvm.return %0 : !llvm.ptr
}
// Module static: G_W
llvm.mlir.global internal @G_W() {addr_space = 0 : i32} : !llvm.ptr {
%1 = llvm.mlir.zero : !llvm.ptr
llvm.return %1 : !llvm.ptr
}
// Module static: G_E
llvm.mlir.global internal @G_E() {addr_space = 0 : i32} : !llvm.ptr {
%2 = llvm.mlir.zero : !llvm.ptr
llvm.return %2 : !llvm.ptr
}
func.func @w_at(%arg0: i64, %arg1: i64, %arg2: i64) -> f64 {
%4 = llvm.mlir.addressof @G_W : !llvm.ptr
%5 = llvm.load %4 : !llvm.ptr -> !llvm.ptr
%6 = llvm.mlir.addressof @G_n : !llvm.ptr
%7 = llvm.load %6 : !llvm.ptr -> i64
%8 = arith.muli %arg0, %7 : i64
%9 = arith.addi %8, %arg1 : i64
%10 = llvm.mlir.addressof @G_n : !llvm.ptr
%11 = llvm.load %10 : !llvm.ptr -> i64
%12 = arith.muli %9, %11 : i64
%13 = arith.addi %12, %arg2 : i64
%14 = llvm.getelementptr %5[%13] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%3 = llvm.load %14 : !llvm.ptr -> f64
func.return %3 : f64
}
func.func @w_set(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: f64) -> () {
%15 = llvm.mlir.addressof @G_W : !llvm.ptr
%16 = llvm.load %15 : !llvm.ptr -> !llvm.ptr
%17 = llvm.mlir.addressof @G_n : !llvm.ptr
%18 = llvm.load %17 : !llvm.ptr -> i64
%19 = arith.muli %arg0, %18 : i64
%20 = arith.addi %19, %arg1 : i64
%21 = llvm.mlir.addressof @G_n : !llvm.ptr
%22 = llvm.load %21 : !llvm.ptr -> i64
%23 = arith.muli %20, %22 : i64
%24 = arith.addi %23, %arg2 : i64
%25 = llvm.getelementptr %16[%24] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg3, %25 : f64, !llvm.ptr
func.return
}
func.func @e_at(%arg0: i64, %arg1: i64) -> f64 {
%27 = llvm.mlir.addressof @G_E : !llvm.ptr
%28 = llvm.load %27 : !llvm.ptr -> !llvm.ptr
%29 = llvm.mlir.addressof @G_n : !llvm.ptr
%30 = llvm.load %29 : !llvm.ptr -> i64
%31 = arith.muli %arg0, %30 : i64
%32 = arith.addi %31, %arg1 : i64
%33 = llvm.getelementptr %28[%32] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%26 = llvm.load %33 : !llvm.ptr -> f64
func.return %26 : f64
}
func.func @e_set(%arg0: i64, %arg1: i64, %arg2: f64) -> () {
%34 = llvm.mlir.addressof @G_E : !llvm.ptr
%35 = llvm.load %34 : !llvm.ptr -> !llvm.ptr
%36 = llvm.mlir.addressof @G_n : !llvm.ptr
%37 = llvm.load %36 : !llvm.ptr -> i64
%38 = arith.muli %arg0, %37 : i64
%39 = arith.addi %38, %arg1 : i64
%40 = llvm.getelementptr %35[%39] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg2, %40 : f64, !llvm.ptr
func.return
}
func.func @next_alive(%arg0: i64, %arg1: i64) -> i64 {
%41 = arith.constant 1 : i32
%43 = arith.extsi %41 : i32 to i64
%42 = arith.addi %arg0, %43 : i64
%44 = llvm.mlir.constant(1 : i64) : i64
%45 = llvm.alloca %44 x i64 : (i64) -> !llvm.ptr
llvm.store %42, %45 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%46 = llvm.load %45 : !llvm.ptr -> i64
%47 = llvm.mlir.addressof @G_n : !llvm.ptr
%48 = llvm.load %47 : !llvm.ptr -> i64
%49 = arith.cmpi slt, %46, %48 : i64
cf.cond_br %49, ^bb1, ^bb2
^bb1:
%50 = llvm.load %45 : !llvm.ptr -> i64
%51 = arith.shrsi %arg1, %50 : i64
%52 = arith.constant 1 : i32
%54 = arith.extsi %52 : i32 to i64
%53 = arith.andi %51, %54 : i64
%55 = arith.constant 0 : i32
%57 = arith.extsi %55 : i32 to i64
%56 = arith.cmpi ne, %53, %57 : i64
cf.cond_br %56, ^bb3, ^bb4
^bb3:
%58 = llvm.load %45 : !llvm.ptr -> i64
func.return %58 : i64
^bb4:
cf.br ^bb5
^bb5:
%59 = llvm.load %45 : !llvm.ptr -> i64
%60 = arith.constant 1 : i32
%62 = arith.extsi %60 : i32 to i64
%61 = arith.addi %59, %62 : i64
llvm.store %61, %45 : i64, !llvm.ptr
cf.br ^bb0
^bb2:
%63 = arith.constant 0 : i32
%64 = arith.extsi %63 : i32 to i64
llvm.store %64, %45 : i64, !llvm.ptr
cf.br ^bb6
^bb6:
%65 = llvm.load %45 : !llvm.ptr -> i64
%66 = arith.cmpi sle, %65, %arg0 : i64
cf.cond_br %66, ^bb7, ^bb8
^bb7:
%67 = llvm.load %45 : !llvm.ptr -> i64
%68 = arith.shrsi %arg1, %67 : i64
%69 = arith.constant 1 : i32
%71 = arith.extsi %69 : i32 to i64
%70 = arith.andi %68, %71 : i64
%72 = arith.constant 0 : i32
%74 = arith.extsi %72 : i32 to i64
%73 = arith.cmpi ne, %70, %74 : i64
cf.cond_br %73, ^bb9, ^bb10
^bb9:
%75 = llvm.load %45 : !llvm.ptr -> i64
func.return %75 : i64
^bb10:
cf.br ^bb11
^bb11:
%76 = llvm.load %45 : !llvm.ptr -> i64
%77 = arith.constant 1 : i32
%79 = arith.extsi %77 : i32 to i64
%78 = arith.addi %76, %79 : i64
llvm.store %78, %45 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
func.return %arg0 : i64
}
func.func @popcount(%arg0: i64) -> i64 {
%80 = llvm.mlir.constant(1 : i64) : i64
%81 = llvm.alloca %80 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %81 : i64, !llvm.ptr
%82 = arith.constant 0 : i32
%83 = arith.extsi %82 : i32 to i64
%84 = llvm.mlir.constant(1 : i64) : i64
%85 = llvm.alloca %84 x i64 : (i64) -> !llvm.ptr
llvm.store %83, %85 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%86 = llvm.load %81 : !llvm.ptr -> i64
%87 = arith.constant 0 : i32
%89 = arith.extsi %87 : i32 to i64
%88 = arith.cmpi ne, %86, %89 : i64
cf.cond_br %88, ^bb13, ^bb14
^bb13:
%90 = llvm.load %85 : !llvm.ptr -> i64
%91 = llvm.load %81 : !llvm.ptr -> i64
%92 = arith.constant 1 : i32
%94 = arith.extsi %92 : i32 to i64
%93 = arith.andi %91, %94 : i64
%95 = arith.addi %90, %93 : i64
llvm.store %95, %85 : i64, !llvm.ptr
%96 = llvm.load %81 : !llvm.ptr -> i64
%97 = arith.constant 2 : i32
%99 = arith.extsi %97 : i32 to i64
%98 = arith.divsi %96, %99 : i64
llvm.store %98, %81 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%100 = llvm.load %85 : !llvm.ptr -> i64
func.return %100 : i64
}
func.func @absf(%arg0: f64) -> f64 {
%101 = arith.constant 0.0 : f32
%103 = arith.extf %101 : f32 to f64
%102 = arith.cmpf olt, %arg0, %103 : f64
cf.cond_br %102, ^bb15, ^bb16
^bb15:
%104 = arith.constant 0.0 : f32
%106 = arith.extf %104 : f32 to f64
%105 = arith.subf %106, %arg0 : f64
func.return %105 : f64
^bb16:
cf.br ^bb17
^bb17:
func.return %arg0 : f64
}
func.func @solve() -> f64 {
%107 = llvm.mlir.addressof @G_n : !llvm.ptr
%108 = llvm.load %107 : !llvm.ptr -> i64
%109 = arith.constant 1 : i32
%111 = arith.extsi %109 : i32 to i64
%110 = arith.shli %111, %108 : i64
%112 = arith.constant 0 : i32
%113 = arith.extsi %112 : i32 to i64
%114 = llvm.mlir.constant(1 : i64) : i64
%115 = llvm.alloca %114 x i64 : (i64) -> !llvm.ptr
llvm.store %113, %115 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%116 = llvm.load %115 : !llvm.ptr -> i64
%117 = arith.cmpi slt, %116, %108 : i64
cf.cond_br %117, ^bb19, ^bb20
^bb19:
%119 = arith.constant 1 : i32
%120 = llvm.load %115 : !llvm.ptr -> i64
%122 = arith.extsi %119 : i32 to i64
%121 = arith.shli %122, %120 : i64
%123 = llvm.load %115 : !llvm.ptr -> i64
%124 = llvm.load %115 : !llvm.ptr -> i64
%125 = arith.constant 1.0 : f32
%126 = arith.extf %125 : f32 to f64
func.call @w_set(%121, %123, %124, %126) : (i64, i64, i64, f64) -> ()
%128 = arith.constant 1 : i32
%129 = llvm.load %115 : !llvm.ptr -> i64
%131 = arith.extsi %128 : i32 to i64
%130 = arith.shli %131, %129 : i64
%132 = llvm.load %115 : !llvm.ptr -> i64
%133 = arith.constant 0.0 : f32
%134 = arith.extf %133 : f32 to f64
func.call @e_set(%130, %132, %134) : (i64, i64, f64) -> ()
%135 = llvm.load %115 : !llvm.ptr -> i64
%136 = arith.constant 1 : i32
%138 = arith.extsi %136 : i32 to i64
%137 = arith.addi %135, %138 : i64
llvm.store %137, %115 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
%140 = arith.constant 8 : i32
%141 = arith.extsi %140 : i32 to i64
%139 = func.call @calloc(%108, %141) : (i64, i64) -> !llvm.ptr
%143 = arith.constant 8 : i32
%144 = arith.extsi %143 : i32 to i64
%142 = func.call @calloc(%108, %144) : (i64, i64) -> !llvm.ptr
%146 = arith.muli %108, %108 : i64
%147 = arith.constant 8 : i32
%148 = arith.extsi %147 : i32 to i64
%145 = func.call @calloc(%146, %148) : (i64, i64) -> !llvm.ptr
%150 = arith.constant 8 : i32
%151 = arith.extsi %150 : i32 to i64
%149 = func.call @calloc(%108, %151) : (i64, i64) -> !llvm.ptr
%153 = arith.constant 8 : i32
%154 = arith.extsi %153 : i32 to i64
%152 = func.call @calloc(%108, %154) : (i64, i64) -> !llvm.ptr
%156 = arith.muli %108, %108 : i64
%157 = arith.constant 8 : i32
%158 = arith.extsi %157 : i32 to i64
%155 = func.call @calloc(%156, %158) : (i64, i64) -> !llvm.ptr
%160 = arith.constant 8 : i32
%161 = arith.extsi %160 : i32 to i64
%159 = func.call @calloc(%108, %161) : (i64, i64) -> !llvm.ptr
%163 = arith.constant 8 : i32
%164 = arith.extsi %163 : i32 to i64
%162 = func.call @calloc(%108, %164) : (i64, i64) -> !llvm.ptr
%166 = arith.constant 8 : i32
%167 = arith.extsi %166 : i32 to i64
%165 = func.call @calloc(%108, %167) : (i64, i64) -> !llvm.ptr
%169 = arith.constant 8 : i32
%170 = arith.extsi %169 : i32 to i64
%168 = func.call @calloc(%108, %170) : (i64, i64) -> !llvm.ptr
%172 = arith.constant 8 : i32
%173 = arith.extsi %172 : i32 to i64
%171 = func.call @calloc(%108, %173) : (i64, i64) -> !llvm.ptr
%175 = arith.constant 8 : i32
%176 = arith.extsi %175 : i32 to i64
%174 = func.call @calloc(%108, %176) : (i64, i64) -> !llvm.ptr
%177 = arith.constant 2 : i32
%178 = arith.extsi %177 : i32 to i64
%179 = llvm.mlir.constant(1 : i64) : i64
%180 = llvm.alloca %179 x i64 : (i64) -> !llvm.ptr
llvm.store %178, %180 : i64, !llvm.ptr
cf.br ^bb21
^bb21:
%181 = llvm.load %180 : !llvm.ptr -> i64
%182 = arith.cmpi sle, %181, %108 : i64
cf.cond_br %182, ^bb22, ^bb23
^bb22:
%183 = arith.constant 1 : i32
%184 = arith.extsi %183 : i32 to i64
%185 = llvm.mlir.constant(1 : i64) : i64
%186 = llvm.alloca %185 x i64 : (i64) -> !llvm.ptr
llvm.store %184, %186 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%187 = llvm.load %186 : !llvm.ptr -> i64
%188 = arith.cmpi slt, %187, %110 : i64
cf.cond_br %188, ^bb25, ^bb26
^bb25:
%190 = llvm.load %186 : !llvm.ptr -> i64
%189 = func.call @popcount(%190) : (i64) -> i64
%191 = llvm.load %180 : !llvm.ptr -> i64
%192 = arith.cmpi eq, %189, %191 : i64
cf.cond_br %192, ^bb27, ^bb28
^bb27:
%193 = arith.constant 0 : i32
%194 = arith.extsi %193 : i32 to i64
%195 = llvm.mlir.constant(1 : i64) : i64
%196 = llvm.alloca %195 x i64 : (i64) -> !llvm.ptr
llvm.store %194, %196 : i64, !llvm.ptr
%197 = arith.constant 0 : i32
%198 = arith.extsi %197 : i32 to i64
llvm.store %198, %115 : i64, !llvm.ptr
cf.br ^bb30
^bb30:
%199 = llvm.load %115 : !llvm.ptr -> i64
%200 = arith.cmpi slt, %199, %108 : i64
cf.cond_br %200, ^bb31, ^bb32
^bb31:
%201 = llvm.load %186 : !llvm.ptr -> i64
%202 = llvm.load %115 : !llvm.ptr -> i64
%203 = arith.shrsi %201, %202 : i64
%204 = arith.constant 1 : i32
%206 = arith.extsi %204 : i32 to i64
%205 = arith.andi %203, %206 : i64
%207 = arith.constant 0 : i32
%209 = arith.extsi %207 : i32 to i64
%208 = arith.cmpi ne, %205, %209 : i64
cf.cond_br %208, ^bb33, ^bb34
^bb33:
%210 = llvm.load %115 : !llvm.ptr -> i64
%211 = llvm.load %196 : !llvm.ptr -> i64
%212 = llvm.getelementptr %139[%211] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %210, %212 : i64, !llvm.ptr
%213 = llvm.load %196 : !llvm.ptr -> i64
%214 = llvm.load %115 : !llvm.ptr -> i64
%215 = llvm.getelementptr %168[%214] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %213, %215 : i64, !llvm.ptr
%216 = llvm.load %196 : !llvm.ptr -> i64
%217 = arith.constant 1 : i32
%219 = arith.extsi %217 : i32 to i64
%218 = arith.addi %216, %219 : i64
llvm.store %218, %196 : i64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%220 = llvm.load %115 : !llvm.ptr -> i64
%221 = arith.constant 1 : i32
%223 = arith.extsi %221 : i32 to i64
%222 = arith.addi %220, %223 : i64
llvm.store %222, %115 : i64, !llvm.ptr
cf.br ^bb30
^bb32:
%224 = arith.constant 0 : i32
%225 = arith.extsi %224 : i32 to i64
%226 = llvm.mlir.constant(1 : i64) : i64
%227 = llvm.alloca %226 x i64 : (i64) -> !llvm.ptr
llvm.store %225, %227 : i64, !llvm.ptr
cf.br ^bb36
^bb36:
%228 = llvm.load %227 : !llvm.ptr -> i64
%229 = llvm.load %196 : !llvm.ptr -> i64
%230 = arith.cmpi slt, %228, %229 : i64
cf.cond_br %230, ^bb37, ^bb38
^bb37:
%232 = llvm.load %227 : !llvm.ptr -> i64
%233 = llvm.getelementptr %139[%232] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%231 = llvm.load %233 : !llvm.ptr -> i64
%235 = llvm.mlir.addressof @G_S : !llvm.ptr
%236 = llvm.load %235 : !llvm.ptr -> !llvm.ptr
%237 = llvm.getelementptr %236[%231] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%234 = llvm.load %237 : !llvm.ptr -> f64
%238 = arith.constant 1.0 : f32
%240 = arith.extf %238 : f32 to f64
%239 = arith.subf %240, %234 : f64
%241 = llvm.load %227 : !llvm.ptr -> i64
%242 = llvm.getelementptr %142[%241] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %239, %242 : f64, !llvm.ptr
%243 = arith.constant 0.0 : f32
%244 = arith.constant 1.0 : f32
%245 = arith.subf %243, %244 : f32
%246 = arith.extf %245 : f32 to f64
%247 = llvm.mlir.constant(1 : i64) : i64
%248 = llvm.alloca %247 x f64 : (i64) -> !llvm.ptr
llvm.store %246, %248 : f64, !llvm.ptr
%249 = arith.constant 0 : i32
%250 = arith.extsi %249 : i32 to i64
%251 = llvm.mlir.constant(1 : i64) : i64
%252 = llvm.alloca %251 x i64 : (i64) -> !llvm.ptr
llvm.store %250, %252 : i64, !llvm.ptr
%253 = arith.constant 0 : i32
%254 = arith.extsi %253 : i32 to i64
%255 = llvm.mlir.constant(1 : i64) : i64
%256 = llvm.alloca %255 x i64 : (i64) -> !llvm.ptr
llvm.store %254, %256 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%257 = llvm.load %256 : !llvm.ptr -> i64
%258 = llvm.load %196 : !llvm.ptr -> i64
%259 = arith.cmpi slt, %257, %258 : i64
cf.cond_br %259, ^bb40, ^bb41
^bb40:
%261 = llvm.load %256 : !llvm.ptr -> i64
%262 = llvm.getelementptr %139[%261] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%260 = llvm.load %262 : !llvm.ptr -> i64
%263 = arith.cmpi ne, %260, %231 : i64
cf.cond_br %263, ^bb42, ^bb43
^bb42:
%264 = llvm.load %186 : !llvm.ptr -> i64
%265 = arith.constant 1 : i32
%267 = arith.extsi %265 : i32 to i64
%266 = arith.shli %267, %260 : i64
%268 = arith.subi %264, %266 : i64
%269 = func.call @next_alive(%231, %268) : (i64, i64) -> i64
%270 = func.call @w_at(%268, %269, %231) : (i64, i64, i64) -> f64
%271 = llvm.load %248 : !llvm.ptr -> f64
%272 = arith.cmpf ogt, %270, %271 : f64
cf.cond_br %272, ^bb45, ^bb46
^bb45:
%273 = arith.constant 0 : i32
%274 = arith.extsi %273 : i32 to i64
%275 = llvm.mlir.constant(1 : i64) : i64
%276 = llvm.alloca %275 x i64 : (i64) -> !llvm.ptr
llvm.store %274, %276 : i64, !llvm.ptr
%277 = llvm.load %248 : !llvm.ptr -> f64
%278 = arith.constant 0.0 : f32
%280 = arith.extf %278 : f32 to f64
%279 = arith.cmpf olt, %277, %280 : f64
cf.cond_br %279, ^bb48, ^bb49
^bb48:
%281 = arith.constant 1 : i32
%282 = arith.extsi %281 : i32 to i64
llvm.store %282, %276 : i64, !llvm.ptr
cf.br ^bb50
^bb49:
%283 = llvm.load %248 : !llvm.ptr -> f64
%284 = arith.subf %270, %283 : f64
%285 = arith.constant 0.000000000000001 : f32
%287 = arith.extf %285 : f32 to f64
%286 = arith.cmpf ogt, %284, %287 : f64
cf.cond_br %286, ^bb51, ^bb52
^bb51:
%288 = arith.constant 1 : i32
%289 = arith.extsi %288 : i32 to i64
llvm.store %289, %276 : i64, !llvm.ptr
cf.br ^bb53
^bb52:
cf.br ^bb53
^bb53:
cf.br ^bb50
^bb50:
%290 = llvm.load %276 : !llvm.ptr -> i64
%291 = arith.constant 0 : i32
%293 = arith.extsi %291 : i32 to i64
%292 = arith.cmpi ne, %290, %293 : i64
cf.cond_br %292, ^bb54, ^bb55
^bb54:
llvm.store %270, %248 : f64, !llvm.ptr
%294 = arith.constant 1 : i32
%295 = arith.extsi %294 : i32 to i64
llvm.store %295, %252 : i64, !llvm.ptr
%296 = arith.constant 0 : i32
%297 = arith.extsi %296 : i32 to i64
%298 = llvm.getelementptr %171[%297] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %260, %298 : i64, !llvm.ptr
cf.br ^bb56
^bb55:
%300 = llvm.load %248 : !llvm.ptr -> f64
%301 = arith.subf %270, %300 : f64
%299 = func.call @absf(%301) : (f64) -> f64
%302 = arith.constant 0.000000000000001 : f32
%304 = arith.extf %302 : f32 to f64
%303 = arith.cmpf ole, %299, %304 : f64
cf.cond_br %303, ^bb57, ^bb58
^bb57:
%305 = llvm.load %252 : !llvm.ptr -> i64
%306 = llvm.getelementptr %171[%305] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %260, %306 : i64, !llvm.ptr
%307 = llvm.load %252 : !llvm.ptr -> i64
%308 = arith.constant 1 : i32
%310 = arith.extsi %308 : i32 to i64
%309 = arith.addi %307, %310 : i64
llvm.store %309, %252 : i64, !llvm.ptr
cf.br ^bb59
^bb58:
cf.br ^bb59
^bb59:
cf.br ^bb56
^bb56:
cf.br ^bb47
^bb46:
%312 = llvm.load %248 : !llvm.ptr -> f64
%313 = arith.subf %270, %312 : f64
%311 = func.call @absf(%313) : (f64) -> f64
%314 = arith.constant 0.000000000000001 : f32
%316 = arith.extf %314 : f32 to f64
%315 = arith.cmpf ole, %311, %316 : f64
cf.cond_br %315, ^bb60, ^bb61
^bb60:
%317 = llvm.load %252 : !llvm.ptr -> i64
%318 = llvm.getelementptr %171[%317] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %260, %318 : i64, !llvm.ptr
%319 = llvm.load %252 : !llvm.ptr -> i64
%320 = arith.constant 1 : i32
%322 = arith.extsi %320 : i32 to i64
%321 = arith.addi %319, %322 : i64
llvm.store %321, %252 : i64, !llvm.ptr
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
cf.br ^bb47
^bb47:
cf.br ^bb44
^bb43:
cf.br ^bb44
^bb44:
%323 = llvm.load %256 : !llvm.ptr -> i64
%324 = arith.constant 1 : i32
%326 = arith.extsi %324 : i32 to i64
%325 = arith.addi %323, %326 : i64
llvm.store %325, %256 : i64, !llvm.ptr
cf.br ^bb39
^bb41:
%328 = arith.constant 0 : i32
%329 = arith.extsi %328 : i32 to i64
%330 = llvm.getelementptr %171[%329] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%327 = llvm.load %330 : !llvm.ptr -> i64
%331 = llvm.mlir.constant(1 : i64) : i64
%332 = llvm.alloca %331 x i64 : (i64) -> !llvm.ptr
llvm.store %327, %332 : i64, !llvm.ptr
%333 = llvm.load %252 : !llvm.ptr -> i64
%334 = arith.constant 1 : i32
%336 = arith.extsi %334 : i32 to i64
%335 = arith.cmpi sgt, %333, %336 : i64
cf.cond_br %335, ^bb63, ^bb64
^bb63:
%338 = llvm.getelementptr %168[%231] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%337 = llvm.load %338 : !llvm.ptr -> i64
%339 = arith.constant 1 : i32
%341 = arith.extsi %339 : i32 to i64
%340 = arith.addi %108, %341 : i64
%342 = llvm.mlir.constant(1 : i64) : i64
%343 = llvm.alloca %342 x i64 : (i64) -> !llvm.ptr
llvm.store %340, %343 : i64, !llvm.ptr
%344 = arith.constant 0 : i32
%345 = arith.extsi %344 : i32 to i64
%346 = llvm.mlir.constant(1 : i64) : i64
%347 = llvm.alloca %346 x i64 : (i64) -> !llvm.ptr
llvm.store %345, %347 : i64, !llvm.ptr
cf.br ^bb66
^bb66:
%348 = llvm.load %347 : !llvm.ptr -> i64
%349 = llvm.load %252 : !llvm.ptr -> i64
%350 = arith.cmpi slt, %348, %349 : i64
cf.cond_br %350, ^bb67, ^bb68
^bb67:
%353 = llvm.load %347 : !llvm.ptr -> i64
%354 = llvm.getelementptr %171[%353] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%352 = llvm.load %354 : !llvm.ptr -> i64
%355 = llvm.getelementptr %168[%352] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%351 = llvm.load %355 : !llvm.ptr -> i64
%356 = arith.subi %351, %337 : i64
%357 = llvm.mlir.constant(1 : i64) : i64
%358 = llvm.alloca %357 x i64 : (i64) -> !llvm.ptr
llvm.store %356, %358 : i64, !llvm.ptr
%359 = llvm.load %358 : !llvm.ptr -> i64
%360 = arith.constant 0 : i32
%362 = arith.extsi %360 : i32 to i64
%361 = arith.cmpi sle, %359, %362 : i64
cf.cond_br %361, ^bb69, ^bb70
^bb69:
%363 = llvm.load %358 : !llvm.ptr -> i64
%364 = llvm.load %196 : !llvm.ptr -> i64
%365 = arith.addi %363, %364 : i64
llvm.store %365, %358 : i64, !llvm.ptr
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%366 = llvm.load %358 : !llvm.ptr -> i64
%367 = llvm.load %343 : !llvm.ptr -> i64
%368 = arith.cmpi slt, %366, %367 : i64
cf.cond_br %368, ^bb72, ^bb73
^bb72:
%369 = llvm.load %358 : !llvm.ptr -> i64
llvm.store %369, %343 : i64, !llvm.ptr
%371 = llvm.load %347 : !llvm.ptr -> i64
%372 = llvm.getelementptr %171[%371] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%370 = llvm.load %372 : !llvm.ptr -> i64
llvm.store %370, %332 : i64, !llvm.ptr
cf.br ^bb74
^bb73:
cf.br ^bb74
^bb74:
%373 = llvm.load %347 : !llvm.ptr -> i64
%374 = arith.constant 1 : i32
%376 = arith.extsi %374 : i32 to i64
%375 = arith.addi %373, %376 : i64
llvm.store %375, %347 : i64, !llvm.ptr
cf.br ^bb66
^bb68:
cf.br ^bb65
^bb64:
cf.br ^bb65
^bb65:
%377 = llvm.load %186 : !llvm.ptr -> i64
%378 = arith.constant 1 : i32
%379 = llvm.load %332 : !llvm.ptr -> i64
%381 = arith.extsi %378 : i32 to i64
%380 = arith.shli %381, %379 : i64
%382 = arith.subi %377, %380 : i64
%383 = func.call @next_alive(%231, %382) : (i64, i64) -> i64
%384 = arith.constant 0 : i32
%385 = arith.extsi %384 : i32 to i64
%386 = llvm.mlir.constant(1 : i64) : i64
%387 = llvm.alloca %386 x i64 : (i64) -> !llvm.ptr
llvm.store %385, %387 : i64, !llvm.ptr
cf.br ^bb75
^bb75:
%388 = llvm.load %387 : !llvm.ptr -> i64
%389 = arith.cmpi slt, %388, %108 : i64
cf.cond_br %389, ^bb76, ^bb77
^bb76:
%391 = llvm.load %387 : !llvm.ptr -> i64
%390 = func.call @w_at(%382, %383, %391) : (i64, i64, i64) -> f64
%392 = arith.mulf %234, %390 : f64
%393 = llvm.load %227 : !llvm.ptr -> i64
%394 = arith.muli %393, %108 : i64
%395 = llvm.load %387 : !llvm.ptr -> i64
%396 = arith.addi %394, %395 : i64
%397 = llvm.getelementptr %145[%396] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %392, %397 : f64, !llvm.ptr
%398 = llvm.load %387 : !llvm.ptr -> i64
%399 = arith.constant 1 : i32
%401 = arith.extsi %399 : i32 to i64
%400 = arith.addi %398, %401 : i64
llvm.store %400, %387 : i64, !llvm.ptr
cf.br ^bb75
^bb77:
%402 = func.call @e_at(%382, %383) : (i64, i64) -> f64
%403 = arith.mulf %234, %402 : f64
%404 = llvm.load %227 : !llvm.ptr -> i64
%405 = llvm.getelementptr %149[%404] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %403, %405 : f64, !llvm.ptr
%406 = llvm.load %227 : !llvm.ptr -> i64
%407 = arith.constant 1 : i32
%409 = arith.extsi %407 : i32 to i64
%408 = arith.addi %406, %409 : i64
llvm.store %408, %227 : i64, !llvm.ptr
cf.br ^bb36
^bb38:
%410 = arith.constant 1.0 : f32
%411 = arith.extf %410 : f32 to f64
%412 = llvm.mlir.constant(1 : i64) : i64
%413 = llvm.alloca %412 x f64 : (i64) -> !llvm.ptr
llvm.store %411, %413 : f64, !llvm.ptr
%414 = arith.constant 0 : i32
%415 = arith.extsi %414 : i32 to i64
%416 = llvm.mlir.constant(1 : i64) : i64
%417 = llvm.alloca %416 x i64 : (i64) -> !llvm.ptr
llvm.store %415, %417 : i64, !llvm.ptr
cf.br ^bb78
^bb78:
%418 = llvm.load %417 : !llvm.ptr -> i64
%419 = arith.cmpi slt, %418, %108 : i64
cf.cond_br %419, ^bb79, ^bb80
^bb79:
%420 = arith.constant 0.0 : f32
%421 = llvm.load %417 : !llvm.ptr -> i64
%422 = arith.extf %420 : f32 to f64
%423 = llvm.getelementptr %174[%421] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %422, %423 : f64, !llvm.ptr
%424 = llvm.load %417 : !llvm.ptr -> i64
%425 = arith.constant 1 : i32
%427 = arith.extsi %425 : i32 to i64
%426 = arith.addi %424, %427 : i64
llvm.store %426, %417 : i64, !llvm.ptr
cf.br ^bb78
^bb80:
%428 = llvm.load %196 : !llvm.ptr -> i64
%429 = arith.constant 1 : i32
%431 = arith.extsi %429 : i32 to i64
%430 = arith.subi %428, %431 : i64
llvm.store %430, %227 : i64, !llvm.ptr
cf.br ^bb81
^bb81:
%432 = llvm.load %227 : !llvm.ptr -> i64
%433 = arith.constant 0 : i32
%435 = arith.extsi %433 : i32 to i64
%434 = arith.cmpi sge, %432, %435 : i64
cf.cond_br %434, ^bb82, ^bb83
^bb82:
%437 = llvm.load %227 : !llvm.ptr -> i64
%438 = llvm.getelementptr %142[%437] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%436 = llvm.load %438 : !llvm.ptr -> f64
%439 = llvm.load %413 : !llvm.ptr -> f64
%440 = arith.mulf %436, %439 : f64
%441 = llvm.load %227 : !llvm.ptr -> i64
%442 = llvm.getelementptr %152[%441] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %440, %442 : f64, !llvm.ptr
%443 = arith.constant 0 : i32
%444 = arith.extsi %443 : i32 to i64
llvm.store %444, %417 : i64, !llvm.ptr
cf.br ^bb84
^bb84:
%445 = llvm.load %417 : !llvm.ptr -> i64
%446 = arith.cmpi slt, %445, %108 : i64
cf.cond_br %446, ^bb85, ^bb86
^bb85:
%448 = llvm.load %227 : !llvm.ptr -> i64
%449 = llvm.getelementptr %142[%448] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%447 = llvm.load %449 : !llvm.ptr -> f64
%451 = llvm.load %417 : !llvm.ptr -> i64
%452 = llvm.getelementptr %174[%451] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%450 = llvm.load %452 : !llvm.ptr -> f64
%453 = arith.mulf %447, %450 : f64
%455 = llvm.load %227 : !llvm.ptr -> i64
%456 = arith.muli %455, %108 : i64
%457 = llvm.load %417 : !llvm.ptr -> i64
%458 = arith.addi %456, %457 : i64
%459 = llvm.getelementptr %145[%458] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%454 = llvm.load %459 : !llvm.ptr -> f64
%460 = arith.addf %453, %454 : f64
%461 = llvm.load %227 : !llvm.ptr -> i64
%462 = arith.muli %461, %108 : i64
%463 = llvm.load %417 : !llvm.ptr -> i64
%464 = arith.addi %462, %463 : i64
%465 = llvm.getelementptr %155[%464] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %460, %465 : f64, !llvm.ptr
%466 = llvm.load %417 : !llvm.ptr -> i64
%467 = arith.constant 1 : i32
%469 = arith.extsi %467 : i32 to i64
%468 = arith.addi %466, %469 : i64
llvm.store %468, %417 : i64, !llvm.ptr
cf.br ^bb84
^bb86:
%471 = llvm.load %227 : !llvm.ptr -> i64
%472 = llvm.getelementptr %152[%471] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%470 = llvm.load %472 : !llvm.ptr -> f64
llvm.store %470, %413 : f64, !llvm.ptr
%473 = arith.constant 0 : i32
%474 = arith.extsi %473 : i32 to i64
llvm.store %474, %417 : i64, !llvm.ptr
cf.br ^bb87
^bb87:
%475 = llvm.load %417 : !llvm.ptr -> i64
%476 = arith.cmpi slt, %475, %108 : i64
cf.cond_br %476, ^bb88, ^bb89
^bb88:
%478 = llvm.load %227 : !llvm.ptr -> i64
%479 = arith.muli %478, %108 : i64
%480 = llvm.load %417 : !llvm.ptr -> i64
%481 = arith.addi %479, %480 : i64
%482 = llvm.getelementptr %155[%481] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%477 = llvm.load %482 : !llvm.ptr -> f64
%483 = llvm.load %417 : !llvm.ptr -> i64
%484 = llvm.getelementptr %174[%483] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %477, %484 : f64, !llvm.ptr
%485 = llvm.load %417 : !llvm.ptr -> i64
%486 = arith.constant 1 : i32
%488 = arith.extsi %486 : i32 to i64
%487 = arith.addi %485, %488 : i64
llvm.store %487, %417 : i64, !llvm.ptr
cf.br ^bb87
^bb89:
%489 = llvm.load %227 : !llvm.ptr -> i64
%490 = arith.constant 1 : i32
%492 = arith.extsi %490 : i32 to i64
%491 = arith.subi %489, %492 : i64
llvm.store %491, %227 : i64, !llvm.ptr
cf.br ^bb81
^bb83:
%493 = arith.constant 1.0 : f32
%495 = arith.constant 0 : i32
%496 = arith.extsi %495 : i32 to i64
%497 = llvm.getelementptr %152[%496] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%494 = llvm.load %497 : !llvm.ptr -> f64
%499 = arith.extf %493 : f32 to f64
%498 = arith.subf %499, %494 : f64
%500 = arith.constant 0 : i32
%501 = arith.extsi %500 : i32 to i64
llvm.store %501, %417 : i64, !llvm.ptr
cf.br ^bb90
^bb90:
%502 = llvm.load %417 : !llvm.ptr -> i64
%503 = arith.cmpi slt, %502, %108 : i64
cf.cond_br %503, ^bb91, ^bb92
^bb91:
%505 = llvm.load %417 : !llvm.ptr -> i64
%506 = llvm.getelementptr %155[%505] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%504 = llvm.load %506 : !llvm.ptr -> f64
%507 = arith.divf %504, %498 : f64
%508 = llvm.load %417 : !llvm.ptr -> i64
%509 = llvm.getelementptr %165[%508] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %507, %509 : f64, !llvm.ptr
%510 = llvm.load %417 : !llvm.ptr -> i64
%511 = arith.constant 1 : i32
%513 = arith.extsi %511 : i32 to i64
%512 = arith.addi %510, %513 : i64
llvm.store %512, %417 : i64, !llvm.ptr
cf.br ^bb90
^bb92:
%514 = arith.constant 0 : i32
%515 = arith.extsi %514 : i32 to i64
llvm.store %515, %227 : i64, !llvm.ptr
cf.br ^bb93
^bb93:
%516 = llvm.load %227 : !llvm.ptr -> i64
%517 = llvm.load %196 : !llvm.ptr -> i64
%518 = arith.cmpi slt, %516, %517 : i64
cf.cond_br %518, ^bb94, ^bb95
^bb94:
%520 = llvm.load %227 : !llvm.ptr -> i64
%521 = llvm.getelementptr %139[%520] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%519 = llvm.load %521 : !llvm.ptr -> i64
%522 = arith.constant 0 : i32
%523 = arith.extsi %522 : i32 to i64
llvm.store %523, %417 : i64, !llvm.ptr
cf.br ^bb96
^bb96:
%524 = llvm.load %417 : !llvm.ptr -> i64
%525 = arith.cmpi slt, %524, %108 : i64
cf.cond_br %525, ^bb97, ^bb98
^bb97:
%527 = llvm.load %186 : !llvm.ptr -> i64
%528 = llvm.load %417 : !llvm.ptr -> i64
%530 = llvm.load %227 : !llvm.ptr -> i64
%531 = llvm.getelementptr %152[%530] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%529 = llvm.load %531 : !llvm.ptr -> f64
%533 = llvm.load %417 : !llvm.ptr -> i64
%534 = llvm.getelementptr %165[%533] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%532 = llvm.load %534 : !llvm.ptr -> f64
%535 = arith.mulf %529, %532 : f64
%537 = llvm.load %227 : !llvm.ptr -> i64
%538 = arith.muli %537, %108 : i64
%539 = llvm.load %417 : !llvm.ptr -> i64
%540 = arith.addi %538, %539 : i64
%541 = llvm.getelementptr %155[%540] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%536 = llvm.load %541 : !llvm.ptr -> f64
%542 = arith.addf %535, %536 : f64
func.call @w_set(%527, %519, %528, %542) : (i64, i64, i64, f64) -> ()
%543 = llvm.load %417 : !llvm.ptr -> i64
%544 = arith.constant 1 : i32
%546 = arith.extsi %544 : i32 to i64
%545 = arith.addi %543, %546 : i64
llvm.store %545, %417 : i64, !llvm.ptr
cf.br ^bb96
^bb98:
%547 = llvm.load %227 : !llvm.ptr -> i64
%548 = arith.constant 1 : i32
%550 = arith.extsi %548 : i32 to i64
%549 = arith.addi %547, %550 : i64
llvm.store %549, %227 : i64, !llvm.ptr
cf.br ^bb93
^bb95:
%551 = arith.constant 1.0 : f32
%552 = arith.extf %551 : f32 to f64
%553 = llvm.mlir.constant(1 : i64) : i64
%554 = llvm.alloca %553 x f64 : (i64) -> !llvm.ptr
llvm.store %552, %554 : f64, !llvm.ptr
%555 = arith.constant 0.0 : f32
%556 = arith.extf %555 : f32 to f64
%557 = llvm.mlir.constant(1 : i64) : i64
%558 = llvm.alloca %557 x f64 : (i64) -> !llvm.ptr
llvm.store %556, %558 : f64, !llvm.ptr
%559 = llvm.load %196 : !llvm.ptr -> i64
%560 = arith.constant 1 : i32
%562 = arith.extsi %560 : i32 to i64
%561 = arith.subi %559, %562 : i64
llvm.store %561, %227 : i64, !llvm.ptr
cf.br ^bb99
^bb99:
%563 = llvm.load %227 : !llvm.ptr -> i64
%564 = arith.constant 0 : i32
%566 = arith.extsi %564 : i32 to i64
%565 = arith.cmpi sge, %563, %566 : i64
cf.cond_br %565, ^bb100, ^bb101
^bb100:
%568 = llvm.load %227 : !llvm.ptr -> i64
%569 = llvm.getelementptr %142[%568] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%567 = llvm.load %569 : !llvm.ptr -> f64
%570 = llvm.load %554 : !llvm.ptr -> f64
%571 = arith.mulf %567, %570 : f64
%572 = llvm.load %227 : !llvm.ptr -> i64
%573 = llvm.getelementptr %159[%572] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %571, %573 : f64, !llvm.ptr
%574 = arith.constant 1.0 : f32
%576 = llvm.load %227 : !llvm.ptr -> i64
%577 = llvm.getelementptr %142[%576] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%575 = llvm.load %577 : !llvm.ptr -> f64
%578 = llvm.load %558 : !llvm.ptr -> f64
%579 = arith.mulf %575, %578 : f64
%581 = arith.extf %574 : f32 to f64
%580 = arith.addf %581, %579 : f64
%583 = llvm.load %227 : !llvm.ptr -> i64
%584 = llvm.getelementptr %149[%583] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%582 = llvm.load %584 : !llvm.ptr -> f64
%585 = arith.addf %580, %582 : f64
%586 = llvm.load %227 : !llvm.ptr -> i64
%587 = llvm.getelementptr %162[%586] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %585, %587 : f64, !llvm.ptr
%589 = llvm.load %227 : !llvm.ptr -> i64
%590 = llvm.getelementptr %159[%589] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%588 = llvm.load %590 : !llvm.ptr -> f64
llvm.store %588, %554 : f64, !llvm.ptr
%592 = llvm.load %227 : !llvm.ptr -> i64
%593 = llvm.getelementptr %162[%592] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%591 = llvm.load %593 : !llvm.ptr -> f64
llvm.store %591, %558 : f64, !llvm.ptr
%594 = llvm.load %227 : !llvm.ptr -> i64
%595 = arith.constant 1 : i32
%597 = arith.extsi %595 : i32 to i64
%596 = arith.subi %594, %597 : i64
llvm.store %596, %227 : i64, !llvm.ptr
cf.br ^bb99
^bb101:
%598 = arith.constant 1.0 : f32
%600 = arith.constant 0 : i32
%601 = arith.extsi %600 : i32 to i64
%602 = llvm.getelementptr %159[%601] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%599 = llvm.load %602 : !llvm.ptr -> f64
%604 = arith.extf %598 : f32 to f64
%603 = arith.subf %604, %599 : f64
%606 = arith.constant 0 : i32
%607 = arith.extsi %606 : i32 to i64
%608 = llvm.getelementptr %162[%607] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%605 = llvm.load %608 : !llvm.ptr -> f64
%609 = arith.divf %605, %603 : f64
%610 = arith.constant 0 : i32
%611 = arith.extsi %610 : i32 to i64
llvm.store %611, %227 : i64, !llvm.ptr
cf.br ^bb102
^bb102:
%612 = llvm.load %227 : !llvm.ptr -> i64
%613 = llvm.load %196 : !llvm.ptr -> i64
%614 = arith.cmpi slt, %612, %613 : i64
cf.cond_br %614, ^bb103, ^bb104
^bb103:
%616 = llvm.load %186 : !llvm.ptr -> i64
%618 = llvm.load %227 : !llvm.ptr -> i64
%619 = llvm.getelementptr %139[%618] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%617 = llvm.load %619 : !llvm.ptr -> i64
%621 = llvm.load %227 : !llvm.ptr -> i64
%622 = llvm.getelementptr %159[%621] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%620 = llvm.load %622 : !llvm.ptr -> f64
%623 = arith.mulf %620, %609 : f64
%625 = llvm.load %227 : !llvm.ptr -> i64
%626 = llvm.getelementptr %162[%625] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%624 = llvm.load %626 : !llvm.ptr -> f64
%627 = arith.addf %623, %624 : f64
func.call @e_set(%616, %617, %627) : (i64, i64, f64) -> ()
%628 = llvm.load %227 : !llvm.ptr -> i64
%629 = arith.constant 1 : i32
%631 = arith.extsi %629 : i32 to i64
%630 = arith.addi %628, %631 : i64
llvm.store %630, %227 : i64, !llvm.ptr
cf.br ^bb102
^bb104:
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
%632 = llvm.load %186 : !llvm.ptr -> i64
%633 = arith.constant 1 : i32
%635 = arith.extsi %633 : i32 to i64
%634 = arith.addi %632, %635 : i64
llvm.store %634, %186 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
%636 = llvm.load %180 : !llvm.ptr -> i64
%637 = arith.constant 1 : i32
%639 = arith.extsi %637 : i32 to i64
%638 = arith.addi %636, %639 : i64
llvm.store %638, %180 : i64, !llvm.ptr
cf.br ^bb21
^bb23:
%641 = arith.constant 1 : i32
%643 = arith.extsi %641 : i32 to i64
%642 = arith.subi %110, %643 : i64
%644 = arith.constant 0 : i32
%645 = arith.extsi %644 : i32 to i64
%640 = func.call @e_at(%642, %645) : (i64, i64) -> f64
func.call @free(%174) : (!llvm.ptr) -> ()
func.call @free(%171) : (!llvm.ptr) -> ()
func.call @free(%168) : (!llvm.ptr) -> ()
func.call @free(%165) : (!llvm.ptr) -> ()
func.call @free(%162) : (!llvm.ptr) -> ()
func.call @free(%159) : (!llvm.ptr) -> ()
func.call @free(%155) : (!llvm.ptr) -> ()
func.call @free(%152) : (!llvm.ptr) -> ()
func.call @free(%149) : (!llvm.ptr) -> ()
func.call @free(%145) : (!llvm.ptr) -> ()
func.call @free(%142) : (!llvm.ptr) -> ()
func.call @free(%139) : (!llvm.ptr) -> ()
func.return %640 : f64
}
func.func @main() -> i32 {
%658 = arith.constant 14 : i32
%659 = arith.extsi %658 : i32 to i64
%660 = llvm.mlir.addressof @G_n : !llvm.ptr
llvm.store %659, %660 : i64, !llvm.ptr
%662 = arith.constant 8 : i32
%663 = arith.extsi %662 : i32 to i64
%661 = func.call @calloc(%659, %663) : (i64, i64) -> !llvm.ptr
%664 = llvm.mlir.addressof @G_S : !llvm.ptr
llvm.store %661, %664 : !llvm.ptr, !llvm.ptr
%666 = arith.constant 1 : i32
%668 = arith.extsi %666 : i32 to i64
%667 = arith.shli %668, %659 : i64
%669 = arith.muli %667, %659 : i64
%670 = arith.muli %669, %659 : i64
%671 = arith.constant 8 : i32
%672 = arith.extsi %671 : i32 to i64
%665 = func.call @calloc(%670, %672) : (i64, i64) -> !llvm.ptr
%673 = llvm.mlir.addressof @G_W : !llvm.ptr
llvm.store %665, %673 : !llvm.ptr, !llvm.ptr
%675 = arith.constant 1 : i32
%677 = arith.extsi %675 : i32 to i64
%676 = arith.shli %677, %659 : i64
%678 = arith.muli %676, %659 : i64
%679 = arith.constant 8 : i32
%680 = arith.extsi %679 : i32 to i64
%674 = func.call @calloc(%678, %680) : (i64, i64) -> !llvm.ptr
%681 = llvm.mlir.addressof @G_E : !llvm.ptr
llvm.store %674, %681 : !llvm.ptr, !llvm.ptr
%682 = llvm.mlir.addressof @G_S : !llvm.ptr
%683 = llvm.load %682 : !llvm.ptr -> !llvm.ptr
%684 = llvm.mlir.zero : !llvm.ptr
%685 = llvm.icmp "eq" %683, %684 : !llvm.ptr
%686 = scf.if %685 -> (i1) {
%687 = arith.constant true
scf.yield %687 : i1
} else {
%688 = llvm.mlir.addressof @G_W : !llvm.ptr
%689 = llvm.load %688 : !llvm.ptr -> !llvm.ptr
%690 = llvm.mlir.zero : !llvm.ptr
%691 = llvm.icmp "eq" %689, %690 : !llvm.ptr
scf.yield %691 : i1
}
%692 = scf.if %686 -> (i1) {
%693 = arith.constant true
scf.yield %693 : i1
} else {
%694 = llvm.mlir.addressof @G_E : !llvm.ptr
%695 = llvm.load %694 : !llvm.ptr -> !llvm.ptr
%696 = llvm.mlir.zero : !llvm.ptr
%697 = llvm.icmp "eq" %695, %696 : !llvm.ptr
scf.yield %697 : i1
}
cf.cond_br %692, ^bb105, ^bb106
^bb105:
%698 = arith.constant 1 : i32
func.return %698 : i32
^bb106:
cf.br ^bb107
^bb107:
%700 = arith.constant 2 : i32
%702 = arith.extsi %700 : i32 to i64
%701 = arith.addi %659, %702 : i64
%703 = arith.constant 8 : i32
%704 = arith.extsi %703 : i32 to i64
%699 = func.call @calloc(%701, %704) : (i64, i64) -> !llvm.ptr
%705 = arith.constant 1 : i32
%706 = arith.constant 1 : i32
%707 = arith.extsi %705 : i32 to i64
%708 = arith.extsi %706 : i32 to i64
%709 = llvm.getelementptr %699[%708] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %707, %709 : i64, !llvm.ptr
%710 = arith.constant 1 : i32
%711 = arith.constant 2 : i32
%712 = arith.extsi %710 : i32 to i64
%713 = arith.extsi %711 : i32 to i64
%714 = llvm.getelementptr %699[%713] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %712, %714 : i64, !llvm.ptr
%715 = arith.constant 3 : i32
%716 = arith.extsi %715 : i32 to i64
%717 = llvm.mlir.constant(1 : i64) : i64
%718 = llvm.alloca %717 x i64 : (i64) -> !llvm.ptr
llvm.store %716, %718 : i64, !llvm.ptr
cf.br ^bb108
^bb108:
%719 = llvm.load %718 : !llvm.ptr -> i64
%720 = arith.constant 1 : i32
%722 = arith.extsi %720 : i32 to i64
%721 = arith.addi %659, %722 : i64
%723 = arith.cmpi sle, %719, %721 : i64
cf.cond_br %723, ^bb109, ^bb110
^bb109:
%725 = llvm.load %718 : !llvm.ptr -> i64
%726 = arith.constant 1 : i32
%728 = arith.extsi %726 : i32 to i64
%727 = arith.subi %725, %728 : i64
%729 = llvm.getelementptr %699[%727] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%724 = llvm.load %729 : !llvm.ptr -> i64
%731 = llvm.load %718 : !llvm.ptr -> i64
%732 = arith.constant 2 : i32
%734 = arith.extsi %732 : i32 to i64
%733 = arith.subi %731, %734 : i64
%735 = llvm.getelementptr %699[%733] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%730 = llvm.load %735 : !llvm.ptr -> i64
%736 = arith.addi %724, %730 : i64
%737 = llvm.load %718 : !llvm.ptr -> i64
%738 = llvm.getelementptr %699[%737] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %736, %738 : i64, !llvm.ptr
%739 = llvm.load %718 : !llvm.ptr -> i64
%740 = arith.constant 1 : i32
%742 = arith.extsi %740 : i32 to i64
%741 = arith.addi %739, %742 : i64
llvm.store %741, %718 : i64, !llvm.ptr
cf.br ^bb108
^bb110:
%744 = arith.constant 1 : i32
%746 = arith.extsi %744 : i32 to i64
%745 = arith.addi %659, %746 : i64
%747 = llvm.getelementptr %699[%745] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%743 = llvm.load %747 : !llvm.ptr -> i64
%748 = arith.sitofp %743 : i64 to f64
%749 = arith.constant 0 : i32
%750 = arith.extsi %749 : i32 to i64
llvm.store %750, %718 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%751 = llvm.load %718 : !llvm.ptr -> i64
%752 = arith.cmpi slt, %751, %659 : i64
cf.cond_br %752, ^bb112, ^bb113
^bb112:
%754 = llvm.load %718 : !llvm.ptr -> i64
%755 = arith.constant 1 : i32
%757 = arith.extsi %755 : i32 to i64
%756 = arith.addi %754, %757 : i64
%758 = llvm.getelementptr %699[%756] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%753 = llvm.load %758 : !llvm.ptr -> i64
%759 = arith.sitofp %753 : i64 to f64
%760 = arith.divf %759, %748 : f64
%761 = llvm.mlir.addressof @G_S : !llvm.ptr
%762 = llvm.load %761 : !llvm.ptr -> !llvm.ptr
%763 = llvm.load %718 : !llvm.ptr -> i64
%764 = llvm.getelementptr %762[%763] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %760, %764 : f64, !llvm.ptr
%765 = llvm.load %718 : !llvm.ptr -> i64
%766 = arith.constant 1 : i32
%768 = arith.extsi %766 : i32 to i64
%767 = arith.addi %765, %768 : i64
llvm.store %767, %718 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
func.call @free(%699) : (!llvm.ptr) -> ()
%770 = func.call @solve() : () -> f64
%771 = llvm.mlir.addressof @str_0 : !llvm.ptr
%772 = llvm.call @printf(%771, %770) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
%774 = llvm.mlir.addressof @G_E : !llvm.ptr
%775 = llvm.load %774 : !llvm.ptr -> !llvm.ptr
func.call @free(%775) : (!llvm.ptr) -> ()
%777 = llvm.mlir.addressof @G_W : !llvm.ptr
%778 = llvm.load %777 : !llvm.ptr -> !llvm.ptr
func.call @free(%778) : (!llvm.ptr) -> ()
%780 = llvm.mlir.addressof @G_S : !llvm.ptr
%781 = llvm.load %780 : !llvm.ptr -> !llvm.ptr
func.call @free(%781) : (!llvm.ptr) -> ()
%782 = arith.constant 0 : i32
func.return %782 : i32
}
}