← All problems
Problem 645
Every Day Is a Holiday: E(10000) to 4 decimal places. All days become holidays once no two adjacent days are both unmarked, so T is the number of uniform birthday draws until the marked set dominates every adjacent pair. Bonferroni over the adjacent-pair events gives E(D) = -D * sum_u N_u / u = -D * Int_0^1 (G(t) - 1) / t dt, where N_u is the signed count of domino unions of size u and G(t) their generating function. Unions are disjoint arcs whose signed weight f(L) obeys f(L) = -f(L-1) - f(L-2) (f = -1, +1, 0 cyclically), so G(t) is the trace of a 5-state transfer matrix power, minus the spurious all-arc trace, plus the true full-circle weight (2 if 3|D else -1). Verified against exact E(2), E(5), E(8) and E(365) = 1174.3501. Integration: composite 16-point Gauss-Legendre on 40 panels.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^3)O(log n)
Space complexity O(1)O(n^2)
Approach Flow solution Matrix exponentiation
Verdict Suboptimal
Flow source
# Project Euler 645
# Every Day Is a Holiday: E(10000) to 4 decimal places.
#
# All days become holidays once no two adjacent days are both unmarked, so
# T is the number of uniform birthday draws until the marked set dominates
# every adjacent pair. Bonferroni over the adjacent-pair events gives
# E(D) = -D * sum_u N_u / u = -D * Int_0^1 (G(t) - 1) / t dt,
# where N_u is the signed count of domino unions of size u and G(t) their
# generating function. Unions are disjoint arcs whose signed weight f(L)
# obeys f(L) = -f(L-1) - f(L-2) (f = -1, +1, 0 cyclically), so G(t) is
# the trace of a 5-state transfer matrix power, minus the spurious
# all-arc trace, plus the true full-circle weight (2 if 3|D else -1).
# Verified against exact E(2), E(5), E(8) and E(365) = 1174.3501.
# Integration: composite 16-point Gauss-Legendre on 40 panels.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
const D: i64 = 10000
# 5x5 matrix helpers (row-major)
function mat5_mul(a: ptr<f64>, b: ptr<f64>, c: ptr<f64>, n: i64) -> void {
let mut i: i64 = 0
while i < n {
let mut j: i64 = 0
while j < n {
let mut s: f64 = 0.0
let mut k: i64 = 0
while k < n {
s = s + a[i * n + k] * b[k * n + j]
k = k + 1
}
c[i * n + j] = s
j = j + 1
}
i = i + 1
}
}
function mat_pow_trace(m: ptr<f64>, n: i64, e0: i64, work: ptr<f64>) -> f64 {
# work: 3 matrices of n*n
let r: ptr<f64> = work
let b: ptr<f64> = work + n * n
let t: ptr<f64> = work + 2 * n * n
let mut i: i64 = 0
while i < n * n {
r[i] = 0.0
b[i] = m[i]
i = i + 1
}
i = 0
while i < n {
r[i * n + i] = 1.0
i = i + 1
}
let mut e: i64 = e0
while e > 0 {
if (e & 1) == 1 {
mat5_mul(r, b, t, n)
i = 0
while i < n * n {
r[i] = t[i]
i = i + 1
}
}
e = e >> 1
if e > 0 {
mat5_mul(b, b, t, n)
i = 0
while i < n * n {
b[i] = t[i]
i = i + 1
}
}
}
let mut tr: f64 = 0.0
i = 0
while i < n {
tr = tr + r[i * n + i]
i = i + 1
}
return tr
}
# G(t) - 1 + fcyc * t^D (configurations with at least one arc)
function g_of_t(t: f64, fcyc: f64, work: ptr<f64>, m5: ptr<f64>, m4: ptr<f64>) -> f64 {
# states: 0 gap, 1 arc len 1, 2 arc mod3=2, 3 arc mod3=0, 4 arc mod3=1
let mut i: i64 = 0
while i < 25 {
m5[i] = 0.0
i = i + 1
}
m5[0 * 5 + 0] = 1.0
m5[0 * 5 + 1] = t
m5[1 * 5 + 2] = t
m5[2 * 5 + 3] = t
m5[3 * 5 + 4] = t
m5[4 * 5 + 2] = t
m5[2 * 5 + 0] = 0.0 - 1.0 # arc ends after L = 2 mod 3: f = -1
m5[3 * 5 + 0] = 1.0 # L = 0 mod 3: f = +1
m5[4 * 5 + 0] = 0.0 # L = 1 mod 3: f = 0
let tr5: f64 = mat_pow_trace(m5, 5, D, work)
# spurious all-arc block (states 1..4)
i = 0
while i < 16 {
m4[i] = 0.0
i = i + 1
}
m4[0 * 4 + 1] = t
m4[1 * 4 + 2] = t
m4[2 * 4 + 3] = t
m4[3 * 4 + 1] = t
let tr4: f64 = mat_pow_trace(m4, 4, D, work)
# t^D
let mut tp: f64 = 1.0
let mut bb: f64 = t
let mut e: i64 = D
while e > 0 {
if (e & 1) == 1 {
tp = tp * bb
}
bb = bb * bb
e = e >> 1
}
return tr5 - tr4 - 1.0 + fcyc * tp
}
function main() -> i32 {
let gx: ptr<f64> = calloc(16, 8)
let gw: ptr<f64> = calloc(16, 8)
gx[0] = -0.98940093499164994; gx[1] = -0.9445750230732326
gx[2] = -0.86563120238783164; gx[3] = -0.75540440835500311
gx[4] = -0.61787624440264377; gx[5] = -0.45801677765722737
gx[6] = -0.28160355077925892; gx[7] = -0.095012509837637441
gx[8] = 0.095012509837637441; gx[9] = 0.28160355077925892
gx[10] = 0.45801677765722737; gx[11] = 0.61787624440264377
gx[12] = 0.75540440835500311; gx[13] = 0.86563120238783164
gx[14] = 0.9445750230732326; gx[15] = 0.98940093499164994
gw[0] = 0.027152459411754055; gw[1] = 0.062253523938647609
gw[2] = 0.095158511682492994; gw[3] = 0.12462897125553395
gw[4] = 0.14959598881657665; gw[5] = 0.16915651939500262
gw[6] = 0.18260341504492361; gw[7] = 0.18945061045506859
gw[8] = 0.18945061045506859; gw[9] = 0.18260341504492361
gw[10] = 0.16915651939500262; gw[11] = 0.14959598881657665
gw[12] = 0.12462897125553395; gw[13] = 0.095158511682492994
gw[14] = 0.062253523938647609; gw[15] = 0.027152459411754055
let work: ptr<f64> = calloc(75, 8)
let m5: ptr<f64> = calloc(25, 8)
let m4: ptr<f64> = calloc(16, 8)
let mut fcyc: f64 = 0.0 - 1.0
if D % 3 == 0 {
fcyc = 2.0
}
let panels: i64 = 40
let h: f64 = 1.0 / (panels as f64)
let mut tot: f64 = 0.0
let mut pnl: i64 = 0
while pnl < panels {
let a: f64 = (pnl as f64) * h
let mut q: i64 = 0
while q < 16 {
let t: f64 = a + h * 0.5 * (gx[q] + 1.0)
let g: f64 = g_of_t(t, fcyc, work, m5, m4)
tot = tot + h * 0.5 * gw[q] * g / t
q = q + 1
}
pnl = pnl + 1
}
let E: f64 = 0.0 - (D as f64) * tot
printf("%.4f\n", E)
free(gx)
free(gw)
free(work)
free(m5)
free(m4)
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; }
void mat5_mul_ptr_f64_ptr_f64_ptr_f64_i64(double* a, double* b, double* c, int64_t n);
double mat_pow_trace_ptr_f64_i64_i64_ptr_f64(double* m, int64_t n, int64_t e0, double* work);
double g_of_t_f64_f64_ptr_f64_ptr_f64_ptr_f64(double t, double fcyc, double* work, double* m5, double* m4);
int32_t main(void);
static const int64_t D = 10000;
void mat5_mul_ptr_f64_ptr_f64_ptr_f64_i64(double* a, double* b, double* c, int64_t n) {
int64_t i = 0;
while (i < n) {
int64_t j = 0;
while (j < n) {
double s = 0.0;
int64_t k = 0;
while (k < n) {
s = (s + (a[((i * n) + k)] * b[((k * n) + j)]));
k = (k + 1);
}
c[((i * n) + j)] = s;
j = (j + 1);
}
i = (i + 1);
}
}
double mat_pow_trace_ptr_f64_i64_i64_ptr_f64(double* m, int64_t n, int64_t e0, double* work) {
double* r = (double*)(work);
double* b = (double*)((work + (n * n)));
double* t = (double*)((work + ((2 * n) * n)));
int64_t i = 0;
while (i < (n * n)) {
r[i] = 0.0;
b[i] = m[i];
i = (i + 1);
}
i = 0;
while (i < n) {
r[((i * n) + i)] = 1.0;
i = (i + 1);
}
int64_t e = e0;
while (e > 0) {
if ((e & 1) == 1) {
mat5_mul_ptr_f64_ptr_f64_ptr_f64_i64(r, b, t, n);
i = 0;
while (i < (n * n)) {
r[i] = t[i];
i = (i + 1);
}
}
e = FLOW_CHECKED_SHR((e), (1));
if (e > 0) {
mat5_mul_ptr_f64_ptr_f64_ptr_f64_i64(b, b, t, n);
i = 0;
while (i < (n * n)) {
b[i] = t[i];
i = (i + 1);
}
}
}
double tr = 0.0;
i = 0;
while (i < n) {
tr = (tr + r[((i * n) + i)]);
i = (i + 1);
}
return tr;
}
double g_of_t_f64_f64_ptr_f64_ptr_f64_ptr_f64(double t, double fcyc, double* work, double* m5, double* m4) {
int64_t i = 0;
while (i < 25) {
m5[i] = 0.0;
i = (i + 1);
}
m5[((0 * 5) + 0)] = 1.0;
m5[((0 * 5) + 1)] = t;
m5[((1 * 5) + 2)] = t;
m5[((2 * 5) + 3)] = t;
m5[((3 * 5) + 4)] = t;
m5[((4 * 5) + 2)] = t;
m5[((2 * 5) + 0)] = (0.0 - 1.0);
m5[((3 * 5) + 0)] = 1.0;
m5[((4 * 5) + 0)] = 0.0;
double tr5 = mat_pow_trace_ptr_f64_i64_i64_ptr_f64(m5, 5, D, work);
i = 0;
while (i < 16) {
m4[i] = 0.0;
i = (i + 1);
}
m4[((0 * 4) + 1)] = t;
m4[((1 * 4) + 2)] = t;
m4[((2 * 4) + 3)] = t;
m4[((3 * 4) + 1)] = t;
double tr4 = mat_pow_trace_ptr_f64_i64_i64_ptr_f64(m4, 4, D, work);
double tp = 1.0;
double bb = t;
int64_t e = D;
while (e > 0) {
if ((e & 1) == 1) {
tp = (tp * bb);
}
bb = (bb * bb);
e = FLOW_CHECKED_SHR((e), (1));
}
return (((tr5 - tr4) - 1.0) + (fcyc * tp));
}
int32_t main(void) {
double* gx = (double*)(calloc(16, 8));
double* gw = (double*)(calloc(16, 8));
gx[0] = (-0.98940093499164994);
gx[1] = (-0.9445750230732326);
gx[2] = (-0.86563120238783164);
gx[3] = (-0.75540440835500311);
gx[4] = (-0.61787624440264377);
gx[5] = (-0.45801677765722737);
gx[6] = (-0.28160355077925892);
gx[7] = (-0.095012509837637441);
gx[8] = 0.095012509837637441;
gx[9] = 0.28160355077925892;
gx[10] = 0.45801677765722737;
gx[11] = 0.61787624440264377;
gx[12] = 0.75540440835500311;
gx[13] = 0.86563120238783164;
gx[14] = 0.9445750230732326;
gx[15] = 0.98940093499164994;
gw[0] = 0.027152459411754055;
gw[1] = 0.062253523938647609;
gw[2] = 0.095158511682492994;
gw[3] = 0.12462897125553395;
gw[4] = 0.14959598881657665;
gw[5] = 0.16915651939500262;
gw[6] = 0.18260341504492361;
gw[7] = 0.18945061045506859;
gw[8] = 0.18945061045506859;
gw[9] = 0.18260341504492361;
gw[10] = 0.16915651939500262;
gw[11] = 0.14959598881657665;
gw[12] = 0.12462897125553395;
gw[13] = 0.095158511682492994;
gw[14] = 0.062253523938647609;
gw[15] = 0.027152459411754055;
double* work = (double*)(calloc(75, 8));
double* m5 = (double*)(calloc(25, 8));
double* m4 = (double*)(calloc(16, 8));
double fcyc = (0.0 - 1.0);
if (FLOW_CHECKED_MOD((D), (3)) == 0) {
fcyc = 2.0;
}
int64_t panels = 40;
double h = (1.0 / ((double)(panels)));
double tot = 0.0;
int64_t pnl = 0;
while (pnl < panels) {
double a = (((double)(pnl)) * h);
int64_t q = 0;
while (q < 16) {
double t = (a + ((h * 0.5) * (gx[q] + 1.0)));
double g = g_of_t_f64_f64_ptr_f64_ptr_f64_ptr_f64(t, fcyc, work, m5, m4);
tot = (tot + ((((h * 0.5) * gw[q]) * g) / t));
q = (q + 1);
}
pnl = (pnl + 1);
}
double E = (0.0 - (((double)(D)) * tot));
printf("%.4f\n", E);
free(gx);
free(gw);
free(work);
free(m5);
free(m4);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.4f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
// Constant: D
llvm.mlir.global internal constant @D(10000 : i64) : i64
func.func @mat5_mul(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i64) -> () {
%0 = arith.constant 0 : i32
%1 = arith.extsi %0 : i32 to i64
%2 = llvm.mlir.constant(1 : i64) : i64
%3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
llvm.store %1, %3 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%4 = llvm.load %3 : !llvm.ptr -> i64
%5 = arith.cmpi slt, %4, %arg3 : i64
cf.cond_br %5, ^bb1, ^bb2
^bb1:
%6 = arith.constant 0 : i32
%7 = arith.extsi %6 : i32 to i64
%8 = llvm.mlir.constant(1 : i64) : i64
%9 = llvm.alloca %8 x i64 : (i64) -> !llvm.ptr
llvm.store %7, %9 : i64, !llvm.ptr
cf.br ^bb3
^bb3:
%10 = llvm.load %9 : !llvm.ptr -> i64
%11 = arith.cmpi slt, %10, %arg3 : i64
cf.cond_br %11, ^bb4, ^bb5
^bb4:
%12 = arith.constant 0.0 : f32
%13 = arith.extf %12 : f32 to f64
%14 = llvm.mlir.constant(1 : i64) : i64
%15 = llvm.alloca %14 x f64 : (i64) -> !llvm.ptr
llvm.store %13, %15 : f64, !llvm.ptr
%16 = arith.constant 0 : i32
%17 = arith.extsi %16 : i32 to i64
%18 = llvm.mlir.constant(1 : i64) : i64
%19 = llvm.alloca %18 x i64 : (i64) -> !llvm.ptr
llvm.store %17, %19 : i64, !llvm.ptr
cf.br ^bb6
^bb6:
%20 = llvm.load %19 : !llvm.ptr -> i64
%21 = arith.cmpi slt, %20, %arg3 : i64
cf.cond_br %21, ^bb7, ^bb8
^bb7:
%22 = llvm.load %15 : !llvm.ptr -> f64
%24 = llvm.load %3 : !llvm.ptr -> i64
%25 = arith.muli %24, %arg3 : i64
%26 = llvm.load %19 : !llvm.ptr -> i64
%27 = arith.addi %25, %26 : i64
%28 = llvm.getelementptr %arg0[%27] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%23 = llvm.load %28 : !llvm.ptr -> f64
%30 = llvm.load %19 : !llvm.ptr -> i64
%31 = arith.muli %30, %arg3 : i64
%32 = llvm.load %9 : !llvm.ptr -> i64
%33 = arith.addi %31, %32 : i64
%34 = llvm.getelementptr %arg1[%33] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%29 = llvm.load %34 : !llvm.ptr -> f64
%35 = arith.mulf %23, %29 : f64
%36 = arith.addf %22, %35 : f64
llvm.store %36, %15 : f64, !llvm.ptr
%37 = llvm.load %19 : !llvm.ptr -> i64
%38 = arith.constant 1 : i32
%40 = arith.extsi %38 : i32 to i64
%39 = arith.addi %37, %40 : i64
llvm.store %39, %19 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
%41 = llvm.load %15 : !llvm.ptr -> f64
%42 = llvm.load %3 : !llvm.ptr -> i64
%43 = arith.muli %42, %arg3 : i64
%44 = llvm.load %9 : !llvm.ptr -> i64
%45 = arith.addi %43, %44 : i64
%46 = llvm.getelementptr %arg2[%45] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %41, %46 : f64, !llvm.ptr
%47 = llvm.load %9 : !llvm.ptr -> i64
%48 = arith.constant 1 : i32
%50 = arith.extsi %48 : i32 to i64
%49 = arith.addi %47, %50 : i64
llvm.store %49, %9 : i64, !llvm.ptr
cf.br ^bb3
^bb5:
%51 = llvm.load %3 : !llvm.ptr -> i64
%52 = arith.constant 1 : i32
%54 = arith.extsi %52 : i32 to i64
%53 = arith.addi %51, %54 : i64
llvm.store %53, %3 : i64, !llvm.ptr
cf.br ^bb0
^bb2:
func.return
}
func.func @mat_pow_trace(%arg0: !llvm.ptr, %arg1: i64, %arg2: i64, %arg3: !llvm.ptr) -> f64 {
# String concatenation: !llvm.ptr + i64
# String concatenation: !llvm.ptr + i64
%57 = arith.constant 0 : i32
%58 = arith.extsi %57 : i32 to i64
%59 = llvm.mlir.constant(1 : i64) : i64
%60 = llvm.alloca %59 x i64 : (i64) -> !llvm.ptr
llvm.store %58, %60 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%61 = llvm.load %60 : !llvm.ptr -> i64
%62 = arith.muli %arg1, %arg1 : i64
%63 = arith.cmpi slt, %61, %62 : i64
cf.cond_br %63, ^bb10, ^bb11
^bb10:
%64 = arith.constant 0.0 : f32
%65 = llvm.load %60 : !llvm.ptr -> i64
%66 = arith.extf %64 : f32 to f64
%67 = llvm.getelementptr %arg3[%65] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %66, %67 : f64, !llvm.ptr
%69 = llvm.load %60 : !llvm.ptr -> i64
%70 = llvm.getelementptr %arg0[%69] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%68 = llvm.load %70 : !llvm.ptr -> f64
%71 = llvm.load %60 : !llvm.ptr -> i64
%72 = llvm.getelementptr %55[%71] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %68, %72 : f64, !llvm.ptr
%73 = llvm.load %60 : !llvm.ptr -> i64
%74 = arith.constant 1 : i32
%76 = arith.extsi %74 : i32 to i64
%75 = arith.addi %73, %76 : i64
llvm.store %75, %60 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
%77 = arith.constant 0 : i32
%78 = arith.extsi %77 : i32 to i64
llvm.store %78, %60 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%79 = llvm.load %60 : !llvm.ptr -> i64
%80 = arith.cmpi slt, %79, %arg1 : i64
cf.cond_br %80, ^bb13, ^bb14
^bb13:
%81 = arith.constant 1.0 : f32
%82 = llvm.load %60 : !llvm.ptr -> i64
%83 = arith.muli %82, %arg1 : i64
%84 = llvm.load %60 : !llvm.ptr -> i64
%85 = arith.addi %83, %84 : i64
%86 = arith.extf %81 : f32 to f64
%87 = llvm.getelementptr %arg3[%85] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %86, %87 : f64, !llvm.ptr
%88 = llvm.load %60 : !llvm.ptr -> i64
%89 = arith.constant 1 : i32
%91 = arith.extsi %89 : i32 to i64
%90 = arith.addi %88, %91 : i64
llvm.store %90, %60 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%92 = llvm.mlir.constant(1 : i64) : i64
%93 = llvm.alloca %92 x i64 : (i64) -> !llvm.ptr
llvm.store %arg2, %93 : i64, !llvm.ptr
cf.br ^bb15
^bb15:
%94 = llvm.load %93 : !llvm.ptr -> i64
%95 = arith.constant 0 : i32
%97 = arith.extsi %95 : i32 to i64
%96 = arith.cmpi sgt, %94, %97 : i64
cf.cond_br %96, ^bb16, ^bb17
^bb16:
%98 = llvm.load %93 : !llvm.ptr -> i64
%99 = arith.constant 1 : i32
%101 = arith.extsi %99 : i32 to i64
%100 = arith.andi %98, %101 : i64
%102 = arith.constant 1 : i32
%104 = arith.extsi %102 : i32 to i64
%103 = arith.cmpi eq, %100, %104 : i64
cf.cond_br %103, ^bb18, ^bb19
^bb18:
func.call @mat5_mul(%arg3, %55, %56, %arg1) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> ()
%106 = arith.constant 0 : i32
%107 = arith.extsi %106 : i32 to i64
llvm.store %107, %60 : i64, !llvm.ptr
cf.br ^bb21
^bb21:
%108 = llvm.load %60 : !llvm.ptr -> i64
%109 = arith.muli %arg1, %arg1 : i64
%110 = arith.cmpi slt, %108, %109 : i64
cf.cond_br %110, ^bb22, ^bb23
^bb22:
%112 = llvm.load %60 : !llvm.ptr -> i64
%113 = llvm.getelementptr %56[%112] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%111 = llvm.load %113 : !llvm.ptr -> f64
%114 = llvm.load %60 : !llvm.ptr -> i64
%115 = llvm.getelementptr %arg3[%114] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %111, %115 : f64, !llvm.ptr
%116 = llvm.load %60 : !llvm.ptr -> i64
%117 = arith.constant 1 : i32
%119 = arith.extsi %117 : i32 to i64
%118 = arith.addi %116, %119 : i64
llvm.store %118, %60 : i64, !llvm.ptr
cf.br ^bb21
^bb23:
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
%120 = llvm.load %93 : !llvm.ptr -> i64
%121 = arith.constant 1 : i32
%123 = arith.extsi %121 : i32 to i64
%122 = arith.shrsi %120, %123 : i64
llvm.store %122, %93 : i64, !llvm.ptr
%124 = llvm.load %93 : !llvm.ptr -> i64
%125 = arith.constant 0 : i32
%127 = arith.extsi %125 : i32 to i64
%126 = arith.cmpi sgt, %124, %127 : i64
cf.cond_br %126, ^bb24, ^bb25
^bb24:
func.call @mat5_mul(%55, %55, %56, %arg1) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> ()
%129 = arith.constant 0 : i32
%130 = arith.extsi %129 : i32 to i64
llvm.store %130, %60 : i64, !llvm.ptr
cf.br ^bb27
^bb27:
%131 = llvm.load %60 : !llvm.ptr -> i64
%132 = arith.muli %arg1, %arg1 : i64
%133 = arith.cmpi slt, %131, %132 : i64
cf.cond_br %133, ^bb28, ^bb29
^bb28:
%135 = llvm.load %60 : !llvm.ptr -> i64
%136 = llvm.getelementptr %56[%135] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%134 = llvm.load %136 : !llvm.ptr -> f64
%137 = llvm.load %60 : !llvm.ptr -> i64
%138 = llvm.getelementptr %55[%137] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %134, %138 : f64, !llvm.ptr
%139 = llvm.load %60 : !llvm.ptr -> i64
%140 = arith.constant 1 : i32
%142 = arith.extsi %140 : i32 to i64
%141 = arith.addi %139, %142 : i64
llvm.store %141, %60 : i64, !llvm.ptr
cf.br ^bb27
^bb29:
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
cf.br ^bb15
^bb17:
%143 = arith.constant 0.0 : f32
%144 = arith.extf %143 : f32 to f64
%145 = llvm.mlir.constant(1 : i64) : i64
%146 = llvm.alloca %145 x f64 : (i64) -> !llvm.ptr
llvm.store %144, %146 : f64, !llvm.ptr
%147 = arith.constant 0 : i32
%148 = arith.extsi %147 : i32 to i64
llvm.store %148, %60 : i64, !llvm.ptr
cf.br ^bb30
^bb30:
%149 = llvm.load %60 : !llvm.ptr -> i64
%150 = arith.cmpi slt, %149, %arg1 : i64
cf.cond_br %150, ^bb31, ^bb32
^bb31:
%151 = llvm.load %146 : !llvm.ptr -> f64
%153 = llvm.load %60 : !llvm.ptr -> i64
%154 = arith.muli %153, %arg1 : i64
%155 = llvm.load %60 : !llvm.ptr -> i64
%156 = arith.addi %154, %155 : i64
%157 = llvm.getelementptr %arg3[%156] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%152 = llvm.load %157 : !llvm.ptr -> f64
%158 = arith.addf %151, %152 : f64
llvm.store %158, %146 : f64, !llvm.ptr
%159 = llvm.load %60 : !llvm.ptr -> i64
%160 = arith.constant 1 : i32
%162 = arith.extsi %160 : i32 to i64
%161 = arith.addi %159, %162 : i64
llvm.store %161, %60 : i64, !llvm.ptr
cf.br ^bb30
^bb32:
%163 = llvm.load %146 : !llvm.ptr -> f64
func.return %163 : f64
}
func.func @g_of_t(%arg0: f64, %arg1: f64, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr) -> f64 {
%164 = arith.constant 0 : i32
%165 = arith.extsi %164 : i32 to i64
%166 = llvm.mlir.constant(1 : i64) : i64
%167 = llvm.alloca %166 x i64 : (i64) -> !llvm.ptr
llvm.store %165, %167 : i64, !llvm.ptr
cf.br ^bb33
^bb33:
%168 = llvm.load %167 : !llvm.ptr -> i64
%169 = arith.constant 25 : i32
%171 = arith.extsi %169 : i32 to i64
%170 = arith.cmpi slt, %168, %171 : i64
cf.cond_br %170, ^bb34, ^bb35
^bb34:
%172 = arith.constant 0.0 : f32
%173 = llvm.load %167 : !llvm.ptr -> i64
%174 = arith.extf %172 : f32 to f64
%175 = llvm.getelementptr %arg3[%173] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %174, %175 : f64, !llvm.ptr
%176 = llvm.load %167 : !llvm.ptr -> i64
%177 = arith.constant 1 : i32
%179 = arith.extsi %177 : i32 to i64
%178 = arith.addi %176, %179 : i64
llvm.store %178, %167 : i64, !llvm.ptr
cf.br ^bb33
^bb35:
%180 = arith.constant 1.0 : f32
%181 = arith.constant 0 : i32
%182 = arith.constant 5 : i32
%183 = arith.muli %181, %182 : i32
%184 = arith.constant 0 : i32
%185 = arith.addi %183, %184 : i32
%186 = arith.extf %180 : f32 to f64
%187 = arith.extsi %185 : i32 to i64
%188 = llvm.getelementptr %arg3[%187] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %186, %188 : f64, !llvm.ptr
%189 = arith.constant 0 : i32
%190 = arith.constant 5 : i32
%191 = arith.muli %189, %190 : i32
%192 = arith.constant 1 : i32
%193 = arith.addi %191, %192 : i32
%194 = arith.extsi %193 : i32 to i64
%195 = llvm.getelementptr %arg3[%194] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %195 : f64, !llvm.ptr
%196 = arith.constant 1 : i32
%197 = arith.constant 5 : i32
%198 = arith.muli %196, %197 : i32
%199 = arith.constant 2 : i32
%200 = arith.addi %198, %199 : i32
%201 = arith.extsi %200 : i32 to i64
%202 = llvm.getelementptr %arg3[%201] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %202 : f64, !llvm.ptr
%203 = arith.constant 2 : i32
%204 = arith.constant 5 : i32
%205 = arith.muli %203, %204 : i32
%206 = arith.constant 3 : i32
%207 = arith.addi %205, %206 : i32
%208 = arith.extsi %207 : i32 to i64
%209 = llvm.getelementptr %arg3[%208] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %209 : f64, !llvm.ptr
%210 = arith.constant 3 : i32
%211 = arith.constant 5 : i32
%212 = arith.muli %210, %211 : i32
%213 = arith.constant 4 : i32
%214 = arith.addi %212, %213 : i32
%215 = arith.extsi %214 : i32 to i64
%216 = llvm.getelementptr %arg3[%215] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %216 : f64, !llvm.ptr
%217 = arith.constant 4 : i32
%218 = arith.constant 5 : i32
%219 = arith.muli %217, %218 : i32
%220 = arith.constant 2 : i32
%221 = arith.addi %219, %220 : i32
%222 = arith.extsi %221 : i32 to i64
%223 = llvm.getelementptr %arg3[%222] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %223 : f64, !llvm.ptr
%224 = arith.constant 0.0 : f32
%225 = arith.constant 1.0 : f32
%226 = arith.subf %224, %225 : f32
%227 = arith.constant 2 : i32
%228 = arith.constant 5 : i32
%229 = arith.muli %227, %228 : i32
%230 = arith.constant 0 : i32
%231 = arith.addi %229, %230 : i32
%232 = arith.extf %226 : f32 to f64
%233 = arith.extsi %231 : i32 to i64
%234 = llvm.getelementptr %arg3[%233] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %232, %234 : f64, !llvm.ptr
%235 = arith.constant 1.0 : f32
%236 = arith.constant 3 : i32
%237 = arith.constant 5 : i32
%238 = arith.muli %236, %237 : i32
%239 = arith.constant 0 : i32
%240 = arith.addi %238, %239 : i32
%241 = arith.extf %235 : f32 to f64
%242 = arith.extsi %240 : i32 to i64
%243 = llvm.getelementptr %arg3[%242] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %241, %243 : f64, !llvm.ptr
%244 = arith.constant 0.0 : f32
%245 = arith.constant 4 : i32
%246 = arith.constant 5 : i32
%247 = arith.muli %245, %246 : i32
%248 = arith.constant 0 : i32
%249 = arith.addi %247, %248 : i32
%250 = arith.extf %244 : f32 to f64
%251 = arith.extsi %249 : i32 to i64
%252 = llvm.getelementptr %arg3[%251] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %250, %252 : f64, !llvm.ptr
%254 = arith.constant 5 : i32
%255 = llvm.mlir.addressof @D : !llvm.ptr
%256 = llvm.load %255 : !llvm.ptr -> i64
%257 = arith.extsi %254 : i32 to i64
%253 = func.call @mat_pow_trace(%arg3, %257, %256, %arg2) : (!llvm.ptr, i64, i64, !llvm.ptr) -> f64
%258 = arith.constant 0 : i32
%259 = arith.extsi %258 : i32 to i64
llvm.store %259, %167 : i64, !llvm.ptr
cf.br ^bb36
^bb36:
%260 = llvm.load %167 : !llvm.ptr -> i64
%261 = arith.constant 16 : i32
%263 = arith.extsi %261 : i32 to i64
%262 = arith.cmpi slt, %260, %263 : i64
cf.cond_br %262, ^bb37, ^bb38
^bb37:
%264 = arith.constant 0.0 : f32
%265 = llvm.load %167 : !llvm.ptr -> i64
%266 = arith.extf %264 : f32 to f64
%267 = llvm.getelementptr %arg4[%265] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %266, %267 : f64, !llvm.ptr
%268 = llvm.load %167 : !llvm.ptr -> i64
%269 = arith.constant 1 : i32
%271 = arith.extsi %269 : i32 to i64
%270 = arith.addi %268, %271 : i64
llvm.store %270, %167 : i64, !llvm.ptr
cf.br ^bb36
^bb38:
%272 = arith.constant 0 : i32
%273 = arith.constant 4 : i32
%274 = arith.muli %272, %273 : i32
%275 = arith.constant 1 : i32
%276 = arith.addi %274, %275 : i32
%277 = arith.extsi %276 : i32 to i64
%278 = llvm.getelementptr %arg4[%277] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %278 : f64, !llvm.ptr
%279 = arith.constant 1 : i32
%280 = arith.constant 4 : i32
%281 = arith.muli %279, %280 : i32
%282 = arith.constant 2 : i32
%283 = arith.addi %281, %282 : i32
%284 = arith.extsi %283 : i32 to i64
%285 = llvm.getelementptr %arg4[%284] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %285 : f64, !llvm.ptr
%286 = arith.constant 2 : i32
%287 = arith.constant 4 : i32
%288 = arith.muli %286, %287 : i32
%289 = arith.constant 3 : i32
%290 = arith.addi %288, %289 : i32
%291 = arith.extsi %290 : i32 to i64
%292 = llvm.getelementptr %arg4[%291] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %292 : f64, !llvm.ptr
%293 = arith.constant 3 : i32
%294 = arith.constant 4 : i32
%295 = arith.muli %293, %294 : i32
%296 = arith.constant 1 : i32
%297 = arith.addi %295, %296 : i32
%298 = arith.extsi %297 : i32 to i64
%299 = llvm.getelementptr %arg4[%298] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %299 : f64, !llvm.ptr
%301 = arith.constant 4 : i32
%302 = llvm.mlir.addressof @D : !llvm.ptr
%303 = llvm.load %302 : !llvm.ptr -> i64
%304 = arith.extsi %301 : i32 to i64
%300 = func.call @mat_pow_trace(%arg4, %304, %303, %arg2) : (!llvm.ptr, i64, i64, !llvm.ptr) -> f64
%305 = arith.constant 1.0 : f32
%306 = arith.extf %305 : f32 to f64
%307 = llvm.mlir.constant(1 : i64) : i64
%308 = llvm.alloca %307 x f64 : (i64) -> !llvm.ptr
llvm.store %306, %308 : f64, !llvm.ptr
%309 = llvm.mlir.constant(1 : i64) : i64
%310 = llvm.alloca %309 x f64 : (i64) -> !llvm.ptr
llvm.store %arg0, %310 : f64, !llvm.ptr
%311 = llvm.mlir.addressof @D : !llvm.ptr
%312 = llvm.load %311 : !llvm.ptr -> i64
%313 = llvm.mlir.constant(1 : i64) : i64
%314 = llvm.alloca %313 x i64 : (i64) -> !llvm.ptr
llvm.store %312, %314 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%315 = llvm.load %314 : !llvm.ptr -> i64
%316 = arith.constant 0 : i32
%318 = arith.extsi %316 : i32 to i64
%317 = arith.cmpi sgt, %315, %318 : i64
cf.cond_br %317, ^bb40, ^bb41
^bb40:
%319 = llvm.load %314 : !llvm.ptr -> i64
%320 = arith.constant 1 : i32
%322 = arith.extsi %320 : i32 to i64
%321 = arith.andi %319, %322 : i64
%323 = arith.constant 1 : i32
%325 = arith.extsi %323 : i32 to i64
%324 = arith.cmpi eq, %321, %325 : i64
cf.cond_br %324, ^bb42, ^bb43
^bb42:
%326 = llvm.load %308 : !llvm.ptr -> f64
%327 = llvm.load %310 : !llvm.ptr -> f64
%328 = arith.mulf %326, %327 : f64
llvm.store %328, %308 : f64, !llvm.ptr
cf.br ^bb44
^bb43:
cf.br ^bb44
^bb44:
%329 = llvm.load %310 : !llvm.ptr -> f64
%330 = llvm.load %310 : !llvm.ptr -> f64
%331 = arith.mulf %329, %330 : f64
llvm.store %331, %310 : f64, !llvm.ptr
%332 = llvm.load %314 : !llvm.ptr -> i64
%333 = arith.constant 1 : i32
%335 = arith.extsi %333 : i32 to i64
%334 = arith.shrsi %332, %335 : i64
llvm.store %334, %314 : i64, !llvm.ptr
cf.br ^bb39
^bb41:
%336 = arith.subf %253, %300 : f64
%337 = arith.constant 1.0 : f32
%339 = arith.extf %337 : f32 to f64
%338 = arith.subf %336, %339 : f64
%340 = llvm.load %308 : !llvm.ptr -> f64
%341 = arith.mulf %arg1, %340 : f64
%342 = arith.addf %338, %341 : f64
func.return %342 : f64
}
func.func @main() -> i32 {
%344 = arith.constant 16 : i32
%345 = arith.constant 8 : i32
%346 = arith.extsi %344 : i32 to i64
%347 = arith.extsi %345 : i32 to i64
%343 = func.call @calloc(%346, %347) : (i64, i64) -> !llvm.ptr
%349 = arith.constant 16 : i32
%350 = arith.constant 8 : i32
%351 = arith.extsi %349 : i32 to i64
%352 = arith.extsi %350 : i32 to i64
%348 = func.call @calloc(%351, %352) : (i64, i64) -> !llvm.ptr
%353 = arith.constant 0.98940093499164994 : f32
%354 = arith.negf %353 : f32
%355 = arith.constant 0 : i32
%356 = arith.extf %354 : f32 to f64
%357 = arith.extsi %355 : i32 to i64
%358 = llvm.getelementptr %343[%357] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %356, %358 : f64, !llvm.ptr
%359 = arith.constant 0.9445750230732326 : f32
%360 = arith.negf %359 : f32
%361 = arith.constant 1 : i32
%362 = arith.extf %360 : f32 to f64
%363 = arith.extsi %361 : i32 to i64
%364 = llvm.getelementptr %343[%363] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %362, %364 : f64, !llvm.ptr
%365 = arith.constant 0.86563120238783164 : f32
%366 = arith.negf %365 : f32
%367 = arith.constant 2 : i32
%368 = arith.extf %366 : f32 to f64
%369 = arith.extsi %367 : i32 to i64
%370 = llvm.getelementptr %343[%369] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %368, %370 : f64, !llvm.ptr
%371 = arith.constant 0.75540440835500311 : f32
%372 = arith.negf %371 : f32
%373 = arith.constant 3 : i32
%374 = arith.extf %372 : f32 to f64
%375 = arith.extsi %373 : i32 to i64
%376 = llvm.getelementptr %343[%375] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %374, %376 : f64, !llvm.ptr
%377 = arith.constant 0.61787624440264377 : f32
%378 = arith.negf %377 : f32
%379 = arith.constant 4 : i32
%380 = arith.extf %378 : f32 to f64
%381 = arith.extsi %379 : i32 to i64
%382 = llvm.getelementptr %343[%381] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %380, %382 : f64, !llvm.ptr
%383 = arith.constant 0.45801677765722737 : f32
%384 = arith.negf %383 : f32
%385 = arith.constant 5 : i32
%386 = arith.extf %384 : f32 to f64
%387 = arith.extsi %385 : i32 to i64
%388 = llvm.getelementptr %343[%387] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %386, %388 : f64, !llvm.ptr
%389 = arith.constant 0.28160355077925892 : f32
%390 = arith.negf %389 : f32
%391 = arith.constant 6 : i32
%392 = arith.extf %390 : f32 to f64
%393 = arith.extsi %391 : i32 to i64
%394 = llvm.getelementptr %343[%393] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %392, %394 : f64, !llvm.ptr
%395 = arith.constant 0.095012509837637441 : f32
%396 = arith.negf %395 : f32
%397 = arith.constant 7 : i32
%398 = arith.extf %396 : f32 to f64
%399 = arith.extsi %397 : i32 to i64
%400 = llvm.getelementptr %343[%399] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %398, %400 : f64, !llvm.ptr
%401 = arith.constant 0.095012509837637441 : f32
%402 = arith.constant 8 : i32
%403 = arith.extf %401 : f32 to f64
%404 = arith.extsi %402 : i32 to i64
%405 = llvm.getelementptr %343[%404] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %403, %405 : f64, !llvm.ptr
%406 = arith.constant 0.28160355077925892 : f32
%407 = arith.constant 9 : i32
%408 = arith.extf %406 : f32 to f64
%409 = arith.extsi %407 : i32 to i64
%410 = llvm.getelementptr %343[%409] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %408, %410 : f64, !llvm.ptr
%411 = arith.constant 0.45801677765722737 : f32
%412 = arith.constant 10 : i32
%413 = arith.extf %411 : f32 to f64
%414 = arith.extsi %412 : i32 to i64
%415 = llvm.getelementptr %343[%414] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %413, %415 : f64, !llvm.ptr
%416 = arith.constant 0.61787624440264377 : f32
%417 = arith.constant 11 : i32
%418 = arith.extf %416 : f32 to f64
%419 = arith.extsi %417 : i32 to i64
%420 = llvm.getelementptr %343[%419] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %418, %420 : f64, !llvm.ptr
%421 = arith.constant 0.75540440835500311 : f32
%422 = arith.constant 12 : i32
%423 = arith.extf %421 : f32 to f64
%424 = arith.extsi %422 : i32 to i64
%425 = llvm.getelementptr %343[%424] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %423, %425 : f64, !llvm.ptr
%426 = arith.constant 0.86563120238783164 : f32
%427 = arith.constant 13 : i32
%428 = arith.extf %426 : f32 to f64
%429 = arith.extsi %427 : i32 to i64
%430 = llvm.getelementptr %343[%429] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %428, %430 : f64, !llvm.ptr
%431 = arith.constant 0.9445750230732326 : f32
%432 = arith.constant 14 : i32
%433 = arith.extf %431 : f32 to f64
%434 = arith.extsi %432 : i32 to i64
%435 = llvm.getelementptr %343[%434] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %433, %435 : f64, !llvm.ptr
%436 = arith.constant 0.98940093499164994 : f32
%437 = arith.constant 15 : i32
%438 = arith.extf %436 : f32 to f64
%439 = arith.extsi %437 : i32 to i64
%440 = llvm.getelementptr %343[%439] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %438, %440 : f64, !llvm.ptr
%441 = arith.constant 0.027152459411754055 : f32
%442 = arith.constant 0 : i32
%443 = arith.extf %441 : f32 to f64
%444 = arith.extsi %442 : i32 to i64
%445 = llvm.getelementptr %348[%444] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %443, %445 : f64, !llvm.ptr
%446 = arith.constant 0.062253523938647609 : f32
%447 = arith.constant 1 : i32
%448 = arith.extf %446 : f32 to f64
%449 = arith.extsi %447 : i32 to i64
%450 = llvm.getelementptr %348[%449] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %448, %450 : f64, !llvm.ptr
%451 = arith.constant 0.095158511682492994 : f32
%452 = arith.constant 2 : i32
%453 = arith.extf %451 : f32 to f64
%454 = arith.extsi %452 : i32 to i64
%455 = llvm.getelementptr %348[%454] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %453, %455 : f64, !llvm.ptr
%456 = arith.constant 0.12462897125553395 : f32
%457 = arith.constant 3 : i32
%458 = arith.extf %456 : f32 to f64
%459 = arith.extsi %457 : i32 to i64
%460 = llvm.getelementptr %348[%459] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %458, %460 : f64, !llvm.ptr
%461 = arith.constant 0.14959598881657665 : f32
%462 = arith.constant 4 : i32
%463 = arith.extf %461 : f32 to f64
%464 = arith.extsi %462 : i32 to i64
%465 = llvm.getelementptr %348[%464] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %463, %465 : f64, !llvm.ptr
%466 = arith.constant 0.16915651939500262 : f32
%467 = arith.constant 5 : i32
%468 = arith.extf %466 : f32 to f64
%469 = arith.extsi %467 : i32 to i64
%470 = llvm.getelementptr %348[%469] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %468, %470 : f64, !llvm.ptr
%471 = arith.constant 0.18260341504492361 : f32
%472 = arith.constant 6 : i32
%473 = arith.extf %471 : f32 to f64
%474 = arith.extsi %472 : i32 to i64
%475 = llvm.getelementptr %348[%474] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %473, %475 : f64, !llvm.ptr
%476 = arith.constant 0.18945061045506859 : f32
%477 = arith.constant 7 : i32
%478 = arith.extf %476 : f32 to f64
%479 = arith.extsi %477 : i32 to i64
%480 = llvm.getelementptr %348[%479] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %478, %480 : f64, !llvm.ptr
%481 = arith.constant 0.18945061045506859 : f32
%482 = arith.constant 8 : i32
%483 = arith.extf %481 : f32 to f64
%484 = arith.extsi %482 : i32 to i64
%485 = llvm.getelementptr %348[%484] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %483, %485 : f64, !llvm.ptr
%486 = arith.constant 0.18260341504492361 : f32
%487 = arith.constant 9 : i32
%488 = arith.extf %486 : f32 to f64
%489 = arith.extsi %487 : i32 to i64
%490 = llvm.getelementptr %348[%489] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %488, %490 : f64, !llvm.ptr
%491 = arith.constant 0.16915651939500262 : f32
%492 = arith.constant 10 : i32
%493 = arith.extf %491 : f32 to f64
%494 = arith.extsi %492 : i32 to i64
%495 = llvm.getelementptr %348[%494] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %493, %495 : f64, !llvm.ptr
%496 = arith.constant 0.14959598881657665 : f32
%497 = arith.constant 11 : i32
%498 = arith.extf %496 : f32 to f64
%499 = arith.extsi %497 : i32 to i64
%500 = llvm.getelementptr %348[%499] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %498, %500 : f64, !llvm.ptr
%501 = arith.constant 0.12462897125553395 : f32
%502 = arith.constant 12 : i32
%503 = arith.extf %501 : f32 to f64
%504 = arith.extsi %502 : i32 to i64
%505 = llvm.getelementptr %348[%504] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %503, %505 : f64, !llvm.ptr
%506 = arith.constant 0.095158511682492994 : f32
%507 = arith.constant 13 : i32
%508 = arith.extf %506 : f32 to f64
%509 = arith.extsi %507 : i32 to i64
%510 = llvm.getelementptr %348[%509] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %508, %510 : f64, !llvm.ptr
%511 = arith.constant 0.062253523938647609 : f32
%512 = arith.constant 14 : i32
%513 = arith.extf %511 : f32 to f64
%514 = arith.extsi %512 : i32 to i64
%515 = llvm.getelementptr %348[%514] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %513, %515 : f64, !llvm.ptr
%516 = arith.constant 0.027152459411754055 : f32
%517 = arith.constant 15 : i32
%518 = arith.extf %516 : f32 to f64
%519 = arith.extsi %517 : i32 to i64
%520 = llvm.getelementptr %348[%519] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %518, %520 : f64, !llvm.ptr
%522 = arith.constant 75 : i32
%523 = arith.constant 8 : i32
%524 = arith.extsi %522 : i32 to i64
%525 = arith.extsi %523 : i32 to i64
%521 = func.call @calloc(%524, %525) : (i64, i64) -> !llvm.ptr
%527 = arith.constant 25 : i32
%528 = arith.constant 8 : i32
%529 = arith.extsi %527 : i32 to i64
%530 = arith.extsi %528 : i32 to i64
%526 = func.call @calloc(%529, %530) : (i64, i64) -> !llvm.ptr
%532 = arith.constant 16 : i32
%533 = arith.constant 8 : i32
%534 = arith.extsi %532 : i32 to i64
%535 = arith.extsi %533 : i32 to i64
%531 = func.call @calloc(%534, %535) : (i64, i64) -> !llvm.ptr
%536 = arith.constant 0.0 : f32
%537 = arith.constant 1.0 : f32
%538 = arith.subf %536, %537 : f32
%539 = arith.extf %538 : f32 to f64
%540 = llvm.mlir.constant(1 : i64) : i64
%541 = llvm.alloca %540 x f64 : (i64) -> !llvm.ptr
llvm.store %539, %541 : f64, !llvm.ptr
%542 = llvm.mlir.addressof @D : !llvm.ptr
%543 = llvm.load %542 : !llvm.ptr -> i64
%544 = arith.constant 3 : i32
%546 = arith.extsi %544 : i32 to i64
%545 = arith.remsi %543, %546 : i64
%547 = arith.constant 0 : i32
%549 = arith.extsi %547 : i32 to i64
%548 = arith.cmpi eq, %545, %549 : i64
cf.cond_br %548, ^bb45, ^bb46
^bb45:
%550 = arith.constant 2.0 : f32
%551 = arith.extf %550 : f32 to f64
llvm.store %551, %541 : f64, !llvm.ptr
cf.br ^bb47
^bb46:
cf.br ^bb47
^bb47:
%552 = arith.constant 40 : i32
%553 = arith.extsi %552 : i32 to i64
%554 = arith.constant 1.0 : f32
%555 = arith.sitofp %553 : i64 to f64
%557 = arith.extf %554 : f32 to f64
%556 = arith.divf %557, %555 : f64
%558 = arith.constant 0.0 : f32
%559 = arith.extf %558 : f32 to f64
%560 = llvm.mlir.constant(1 : i64) : i64
%561 = llvm.alloca %560 x f64 : (i64) -> !llvm.ptr
llvm.store %559, %561 : f64, !llvm.ptr
%562 = arith.constant 0 : i32
%563 = arith.extsi %562 : i32 to i64
%564 = llvm.mlir.constant(1 : i64) : i64
%565 = llvm.alloca %564 x i64 : (i64) -> !llvm.ptr
llvm.store %563, %565 : i64, !llvm.ptr
cf.br ^bb48
^bb48:
%566 = llvm.load %565 : !llvm.ptr -> i64
%567 = arith.cmpi slt, %566, %553 : i64
cf.cond_br %567, ^bb49, ^bb50
^bb49:
%568 = llvm.load %565 : !llvm.ptr -> i64
%569 = arith.sitofp %568 : i64 to f64
%570 = arith.mulf %569, %556 : f64
%571 = arith.constant 0 : i32
%572 = arith.extsi %571 : i32 to i64
%573 = llvm.mlir.constant(1 : i64) : i64
%574 = llvm.alloca %573 x i64 : (i64) -> !llvm.ptr
llvm.store %572, %574 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%575 = llvm.load %574 : !llvm.ptr -> i64
%576 = arith.constant 16 : i32
%578 = arith.extsi %576 : i32 to i64
%577 = arith.cmpi slt, %575, %578 : i64
cf.cond_br %577, ^bb52, ^bb53
^bb52:
%579 = arith.constant 0.5 : f32
%581 = arith.extf %579 : f32 to f64
%580 = arith.mulf %556, %581 : f64
%583 = llvm.load %574 : !llvm.ptr -> i64
%584 = llvm.getelementptr %343[%583] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%582 = llvm.load %584 : !llvm.ptr -> f64
%585 = arith.constant 1.0 : f32
%587 = arith.extf %585 : f32 to f64
%586 = arith.addf %582, %587 : f64
%588 = arith.mulf %580, %586 : f64
%589 = arith.addf %570, %588 : f64
%591 = llvm.load %541 : !llvm.ptr -> f64
%590 = func.call @g_of_t(%589, %591, %521, %526, %531) : (f64, f64, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> f64
%592 = llvm.load %561 : !llvm.ptr -> f64
%593 = arith.constant 0.5 : f32
%595 = arith.extf %593 : f32 to f64
%594 = arith.mulf %556, %595 : f64
%597 = llvm.load %574 : !llvm.ptr -> i64
%598 = llvm.getelementptr %348[%597] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%596 = llvm.load %598 : !llvm.ptr -> f64
%599 = arith.mulf %594, %596 : f64
%600 = arith.mulf %599, %590 : f64
%601 = arith.divf %600, %589 : f64
%602 = arith.addf %592, %601 : f64
llvm.store %602, %561 : f64, !llvm.ptr
%603 = llvm.load %574 : !llvm.ptr -> i64
%604 = arith.constant 1 : i32
%606 = arith.extsi %604 : i32 to i64
%605 = arith.addi %603, %606 : i64
llvm.store %605, %574 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
%607 = llvm.load %565 : !llvm.ptr -> i64
%608 = arith.constant 1 : i32
%610 = arith.extsi %608 : i32 to i64
%609 = arith.addi %607, %610 : i64
llvm.store %609, %565 : i64, !llvm.ptr
cf.br ^bb48
^bb50:
%611 = arith.constant 0.0 : f32
%612 = llvm.mlir.addressof @D : !llvm.ptr
%613 = llvm.load %612 : !llvm.ptr -> i64
%614 = arith.sitofp %613 : i64 to f64
%615 = llvm.load %561 : !llvm.ptr -> f64
%616 = arith.mulf %614, %615 : f64
%618 = arith.extf %611 : f32 to f64
%617 = arith.subf %618, %616 : f64
%619 = llvm.mlir.addressof @str_0 : !llvm.ptr
%620 = llvm.call @printf(%619, %617) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
func.call @free(%343) : (!llvm.ptr) -> ()
func.call @free(%348) : (!llvm.ptr) -> ()
func.call @free(%521) : (!llvm.ptr) -> ()
func.call @free(%526) : (!llvm.ptr) -> ()
func.call @free(%531) : (!llvm.ptr) -> ()
%626 = arith.constant 0 : i32
func.return %626 : i32
}
}