← All problems
Problem 564
Maximal Polygons — S(50) expected maximal cyclic polygon area.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^2)O(n * s^2)
Space complexity O(n^2)O(s^2)
Approach Flow solution Markov chain or DP over states
Verdict Unknown
Flow source
# Project Euler 564
# Maximal Polygons — S(50) expected maximal cyclic polygon area.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function sqrt(x: f64) -> f64
function asin(x: f64) -> f64
function fabs(x: f64) -> f64
}
const PI: f64 = 3.14159265358979323846
function maximal_area(lens: ptr<i64>, cnts: ptr<i64>, g: i64) -> f64 {
let mut maxL: i64 = 0
let mut sum_len: f64 = 0.0
let mut i: i64 = 0
while i < g {
if lens[i] > maxL { maxL = lens[i] }
sum_len = sum_len + (lens[i] as f64) * (cnts[i] as f64)
i = i + 1
}
let inv0: f64 = 1.0 / (maxL as f64)
let mut sum_asin_at_min: f64 = 0.0
i = 0
while i < g {
let mut u: f64 = (lens[i] as f64) * inv0
if u > 1.0 { u = 1.0 }
sum_asin_at_min = sum_asin_at_min + (cnts[i] as f64) * asin(u)
i = i + 1
}
let all_minor: i64 = 0
if sum_asin_at_min >= PI - 1e-15 {
# all-minor case
let f_at_lo: f64 = sum_asin_at_min - PI
let mut r: f64 = maxL as f64
if fabs(f_at_lo) >= 1e-15 {
let eps: f64 = 1e-15
let mut lo: f64 = (maxL as f64) * (1.0 + eps)
let mut hi: f64 = lo * 2.0
# expand hi until f(hi)<0
let mut guard: i64 = 0
while guard < 60 {
let inv: f64 = 1.0 / hi
let r2: f64 = hi * hi
let mut f: f64 = 0.0 - PI
i = 0
while i < g {
let u: f64 = (lens[i] as f64) * inv
let mut t: f64 = 1.0 - u * u
if t < 0.0 { t = 0.0 }
let mut s: f64 = sqrt(t)
if s < 1e-18 { s = 1e-18 }
f = f + (cnts[i] as f64) * asin(u)
i = i + 1
}
if f <= 0.0 { break }
hi = hi * 2.0
guard = guard + 1
}
r = sum_len / PI
if r <= lo || r >= hi { r = 0.5 * (lo + hi) }
let mut it: i64 = 0
while it < 24 {
let inv: f64 = 1.0 / r
let r2: f64 = r * r
let mut f: f64 = 0.0 - PI
let mut df: f64 = 0.0
i = 0
while i < g {
let l: f64 = lens[i] as f64
let c: f64 = cnts[i] as f64
let u: f64 = l * inv
let mut t: f64 = 1.0 - u * u
if t < 0.0 { t = 0.0 }
let mut s: f64 = sqrt(t)
if s < 1e-18 { s = 1e-18 }
f = f + c * asin(u)
df = df - c * l / (r2 * s)
i = i + 1
}
if fabs(f) < 1e-15 { break }
if f > 0.0 { lo = r } else { hi = r }
let mut rn: f64 = r - f / df
if rn <= lo || rn >= hi || rn != rn {
rn = 0.5 * (lo + hi)
}
r = rn
if hi - lo < 1e-14 * hi { break }
it = it + 1
}
}
let inv: f64 = 1.0 / r
let mut area_sum: f64 = 0.0
i = 0
while i < g {
let l: f64 = lens[i] as f64
let c: f64 = cnts[i] as f64
let u: f64 = l * inv
let t: f64 = 1.0 - u * u
if t > 0.0 {
area_sum = area_sum + c * l * (r * sqrt(t))
}
i = i + 1
}
return 0.25 * area_sum
}
# one-major case
let L: i64 = maxL
let eps: f64 = 1e-15
let mut lo: f64 = (L as f64) * (1.0 + eps)
let mut hi: f64 = lo * 2.0
let mut guard: i64 = 0
while guard < 60 {
let inv: f64 = 1.0 / hi
let r2: f64 = hi * hi
let mut f: f64 = 0.0
i = 0
while i < g {
let u: f64 = (lens[i] as f64) * inv
let mut t: f64 = 1.0 - u * u
if t < 0.0 { t = 0.0 }
f = f + (cnts[i] as f64) * asin(u)
i = i + 1
}
f = f - 2.0 * asin((L as f64) * inv)
if f >= 0.0 { break }
hi = hi * 2.0
guard = guard + 1
}
let mut r: f64 = lo * 1.1
if r >= hi { r = 0.5 * (lo + hi) }
let mut it: i64 = 0
while it < 24 {
let inv: f64 = 1.0 / r
let r2: f64 = r * r
let mut f: f64 = 0.0
let mut df: f64 = 0.0
i = 0
while i < g {
let l: f64 = lens[i] as f64
let c: f64 = cnts[i] as f64
let u: f64 = l * inv
let mut t: f64 = 1.0 - u * u
if t < 0.0 { t = 0.0 }
let mut s: f64 = sqrt(t)
if s < 1e-18 { s = 1e-18 }
f = f + c * asin(u)
df = df - c * l / (r2 * s)
i = i + 1
}
let uL: f64 = (L as f64) * inv
let mut tL: f64 = 1.0 - uL * uL
if tL < 0.0 { tL = 0.0 }
let mut sL: f64 = sqrt(tL)
if sL < 1e-18 { sL = 1e-18 }
f = f - 2.0 * asin(uL)
df = df + 2.0 * (L as f64) / (r2 * sL)
if fabs(f) < 1e-15 { break }
if f > 0.0 { hi = r } else { lo = r }
let mut rn: f64 = r - f / df
if rn <= lo || rn >= hi || rn != rn {
rn = 0.5 * (lo + hi)
}
r = rn
if hi - lo < 1e-14 * hi { break }
it = it + 1
}
let inv: f64 = 1.0 / r
let mut area_sum: f64 = 0.0
let mut max_term: f64 = 0.0
i = 0
while i < g {
let l: f64 = lens[i] as f64
let c: f64 = cnts[i] as f64
let u: f64 = l * inv
let t: f64 = 1.0 - u * u
if t > 0.0 {
let term: f64 = c * l * (r * sqrt(t))
area_sum = area_sum + term
if lens[i] == L {
max_term = l * (r * sqrt(t))
}
}
i = i + 1
}
area_sum = area_sum - 2.0 * max_term
return 0.25 * area_sum
}
let mut PARTS: ptr<i64> = null
let mut NP: i64 = 0
let mut FACT: ptr<f64> = null
let mut NN: i64 = 0
let mut SUM: f64 = 0.0
let mut COMP: f64 = 0.0
function dfs(rem: i64, max_p: i64) -> void {
if rem == 0 {
let t: i64 = NP
let m0: i64 = NN - t
let mut denom: f64 = FACT[m0]
let lens: ptr<i64> = calloc(t + 2, 8)
let cnts: ptr<i64> = calloc(t + 2, 8)
lens[0] = 1
cnts[0] = m0
let mut g: i64 = 1
let mut i: i64 = 0
while i < t {
let v: i64 = PARTS[i]
let mut j: i64 = i + 1
while j < t && PARTS[j] == v { j = j + 1 }
let cnt: i64 = j - i
lens[g] = v + 1
cnts[g] = cnt
denom = denom * FACT[cnt]
g = g + 1
i = j
}
let weight: f64 = FACT[NN] / denom
let area: f64 = maximal_area(lens, cnts, g)
let total: f64 = FACT[2 * NN - 4] / (FACT[NN - 1] * FACT[NN - 3])
let contrib: f64 = area * (weight / total)
let y: f64 = contrib - COMP
let tt: f64 = SUM + y
COMP = (tt - SUM) - y
SUM = tt
free(lens); free(cnts)
return
}
let mut p: i64 = rem
if max_p < p { p = max_p }
while p >= 1 {
PARTS[NP] = p
NP = NP + 1
dfs(rem - p, p)
NP = NP - 1
p = p - 1
}
}
function main() -> i32 {
FACT = calloc(120, 8)
PARTS = calloc(80, 8)
FACT[0] = 1.0
FACT[1] = 1.0
let mut i: i64 = 2
while i <= 110 {
FACT[i] = FACT[i - 1] * (i as f64)
i = i + 1
}
let mut S: f64 = 0.0
let mut n: i64 = 3
while n <= 50 {
NN = n
NP = 0
SUM = 0.0
COMP = 0.0
dfs(n - 3, n - 3)
S = S + SUM
n = n + 1
}
printf("%.6f\n", S)
free(FACT); free(PARTS)
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 asin(double x);
double maximal_area_ptr_i64_ptr_i64_i64(int64_t* lens, int64_t* cnts, int64_t g);
void dfs_i64_i64(int64_t rem, int64_t max_p);
int32_t main(void);
static const double PI = 3.14159265358979323846;
/* Module statics */
static int64_t* PARTS = NULL;
static int64_t NP = 0;
static double* FACT = NULL;
static int64_t NN = 0;
static double SUM = 0.0;
static double COMP = 0.0;
double maximal_area_ptr_i64_ptr_i64_i64(int64_t* lens, int64_t* cnts, int64_t g) {
int64_t maxL = 0;
double sum_len = 0.0;
int64_t i = 0;
while (i < g) {
if (lens[i] > maxL) {
maxL = lens[i];
}
sum_len = (sum_len + (((double)(lens[i])) * ((double)(cnts[i]))));
i = (i + 1);
}
double inv0 = (1.0 / ((double)(maxL)));
double sum_asin_at_min = 0.0;
i = 0;
while (i < g) {
double u = (((double)(lens[i])) * inv0);
if (u > 1.0) {
u = 1.0;
}
sum_asin_at_min = (sum_asin_at_min + (((double)(cnts[i])) * asin(u)));
i = (i + 1);
}
int64_t all_minor = 0;
if (sum_asin_at_min >= (PI - 1e-15)) {
double f_at_lo = (sum_asin_at_min - PI);
double r = ((double)(maxL));
if (fabs(f_at_lo) >= 1e-15) {
double eps = 1e-15;
double lo = (((double)(maxL)) * (1.0 + eps));
double hi = (lo * 2.0);
int64_t guard = 0;
while (guard < 60) {
double inv = (1.0 / hi);
double r2 = (hi * hi);
double f = (0.0 - PI);
i = 0;
while (i < g) {
double u = (((double)(lens[i])) * inv);
double t = (1.0 - (u * u));
if (t < 0.0) {
t = 0.0;
}
double s = sqrt(t);
if (s < 1e-18) {
s = 1e-18;
}
f = (f + (((double)(cnts[i])) * asin(u)));
i = (i + 1);
}
if (f <= 0.0) {
break;
}
hi = (hi * 2.0);
guard = (guard + 1);
}
r = (sum_len / PI);
if ((r <= lo || r >= hi)) {
r = (0.5 * (lo + hi));
}
int64_t it = 0;
while (it < 24) {
double inv = (1.0 / r);
double r2 = (r * r);
double f = (0.0 - PI);
double df = 0.0;
i = 0;
while (i < g) {
double l = ((double)(lens[i]));
double c = ((double)(cnts[i]));
double u = (l * inv);
double t = (1.0 - (u * u));
if (t < 0.0) {
t = 0.0;
}
double s = sqrt(t);
if (s < 1e-18) {
s = 1e-18;
}
f = (f + (c * asin(u)));
df = (df - ((c * l) / (r2 * s)));
i = (i + 1);
}
if (fabs(f) < 1e-15) {
break;
}
if (f > 0.0) {
lo = r;
} else {
hi = r;
}
double rn = (r - (f / df));
if (((rn <= lo || rn >= hi) || rn != rn)) {
rn = (0.5 * (lo + hi));
}
r = rn;
if ((hi - lo) < (1e-14 * hi)) {
break;
}
it = (it + 1);
}
}
double inv = (1.0 / r);
double area_sum = 0.0;
i = 0;
while (i < g) {
double l = ((double)(lens[i]));
double c = ((double)(cnts[i]));
double u = (l * inv);
double t = (1.0 - (u * u));
if (t > 0.0) {
area_sum = (area_sum + ((c * l) * (r * sqrt(t))));
}
i = (i + 1);
}
return (0.25 * area_sum);
}
int64_t L = maxL;
double eps = 1e-15;
double lo = (((double)(L)) * (1.0 + eps));
double hi = (lo * 2.0);
int64_t guard = 0;
while (guard < 60) {
double inv = (1.0 / hi);
double r2 = (hi * hi);
double f = 0.0;
i = 0;
while (i < g) {
double u = (((double)(lens[i])) * inv);
double t = (1.0 - (u * u));
if (t < 0.0) {
t = 0.0;
}
f = (f + (((double)(cnts[i])) * asin(u)));
i = (i + 1);
}
f = (f - (2.0 * asin((((double)(L)) * inv))));
if (f >= 0.0) {
break;
}
hi = (hi * 2.0);
guard = (guard + 1);
}
double r = (lo * 1.1);
if (r >= hi) {
r = (0.5 * (lo + hi));
}
int64_t it = 0;
while (it < 24) {
double inv = (1.0 / r);
double r2 = (r * r);
double f = 0.0;
double df = 0.0;
i = 0;
while (i < g) {
double l = ((double)(lens[i]));
double c = ((double)(cnts[i]));
double u = (l * inv);
double t = (1.0 - (u * u));
if (t < 0.0) {
t = 0.0;
}
double s = sqrt(t);
if (s < 1e-18) {
s = 1e-18;
}
f = (f + (c * asin(u)));
df = (df - ((c * l) / (r2 * s)));
i = (i + 1);
}
double uL = (((double)(L)) * inv);
double tL = (1.0 - (uL * uL));
if (tL < 0.0) {
tL = 0.0;
}
double sL = sqrt(tL);
if (sL < 1e-18) {
sL = 1e-18;
}
f = (f - (2.0 * asin(uL)));
df = (df + ((2.0 * ((double)(L))) / (r2 * sL)));
if (fabs(f) < 1e-15) {
break;
}
if (f > 0.0) {
hi = r;
} else {
lo = r;
}
double rn = (r - (f / df));
if (((rn <= lo || rn >= hi) || rn != rn)) {
rn = (0.5 * (lo + hi));
}
r = rn;
if ((hi - lo) < (1e-14 * hi)) {
break;
}
it = (it + 1);
}
double inv = (1.0 / r);
double area_sum = 0.0;
double max_term = 0.0;
i = 0;
while (i < g) {
double l = ((double)(lens[i]));
double c = ((double)(cnts[i]));
double u = (l * inv);
double t = (1.0 - (u * u));
if (t > 0.0) {
double term = ((c * l) * (r * sqrt(t)));
area_sum = (area_sum + term);
if (lens[i] == L) {
max_term = (l * (r * sqrt(t)));
}
}
i = (i + 1);
}
area_sum = (area_sum - (2.0 * max_term));
return (0.25 * area_sum);
}
void dfs_i64_i64(int64_t rem, int64_t max_p) {
if (rem == 0) {
int64_t t = NP;
int64_t m0 = (NN - t);
double denom = FACT[m0];
int64_t* lens = (int64_t*)(calloc((t + 2), 8));
int64_t* cnts = (int64_t*)(calloc((t + 2), 8));
lens[0] = 1;
cnts[0] = m0;
int64_t g = 1;
int64_t i = 0;
while (i < t) {
int64_t v = PARTS[i];
int64_t j = (i + 1);
while ((j < t && PARTS[j] == v)) {
j = (j + 1);
}
int64_t cnt = (j - i);
lens[g] = (v + 1);
cnts[g] = cnt;
denom = (denom * FACT[cnt]);
g = (g + 1);
i = j;
}
double weight = (FACT[NN] / denom);
double area = maximal_area_ptr_i64_ptr_i64_i64(lens, cnts, g);
double total = (FACT[((2 * NN) - 4)] / (FACT[(NN - 1)] * FACT[(NN - 3)]));
double contrib = (area * (weight / total));
double y = (contrib - COMP);
double tt = (SUM + y);
COMP = ((tt - SUM) - y);
SUM = tt;
free(lens);
free(cnts);
return;
}
int64_t p = rem;
if (max_p < p) {
p = max_p;
}
while (p >= 1) {
PARTS[NP] = p;
NP = (NP + 1);
dfs_i64_i64((rem - p), p);
NP = (NP - 1);
p = (p - 1);
}
}
int32_t main(void) {
FACT = calloc(120, 8);
PARTS = calloc(80, 8);
FACT[0] = 1.0;
FACT[1] = 1.0;
int64_t i = 2;
while (i <= 110) {
FACT[i] = (FACT[(i - 1)] * ((double)(i)));
i = (i + 1);
}
double S = 0.0;
int64_t n = 3;
while (n <= 50) {
NN = n;
NP = 0;
SUM = 0.0;
COMP = 0.0;
dfs_i64_i64((n - 3), (n - 3));
S = (S + SUM);
n = (n + 1);
}
printf("%.6f\n", S);
free(FACT);
free(PARTS);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.6f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
func.func private @sqrt(f64) -> f64
func.func private @asin(f64) -> f64
func.func private @fabs(f64) -> f64
// Constant: PI
llvm.mlir.global internal constant @PI(3.14159265358979323846 : f64) : f64
func.func @maximal_area(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64) -> f64 {
%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
%4 = arith.constant 0.0 : f32
%5 = arith.extf %4 : f32 to f64
%6 = llvm.mlir.constant(1 : i64) : i64
%7 = llvm.alloca %6 x f64 : (i64) -> !llvm.ptr
llvm.store %5, %7 : f64, !llvm.ptr
%8 = arith.constant 0 : i32
%9 = arith.extsi %8 : i32 to i64
%10 = llvm.mlir.constant(1 : i64) : i64
%11 = llvm.alloca %10 x i64 : (i64) -> !llvm.ptr
llvm.store %9, %11 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%12 = llvm.load %11 : !llvm.ptr -> i64
%13 = arith.cmpi slt, %12, %arg2 : i64
cf.cond_br %13, ^bb1, ^bb2
^bb1:
%15 = llvm.load %11 : !llvm.ptr -> i64
%16 = llvm.getelementptr %arg0[%15] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%14 = llvm.load %16 : !llvm.ptr -> i64
%17 = llvm.load %3 : !llvm.ptr -> i64
%18 = arith.cmpi sgt, %14, %17 : i64
cf.cond_br %18, ^bb3, ^bb4
^bb3:
%20 = llvm.load %11 : !llvm.ptr -> i64
%21 = llvm.getelementptr %arg0[%20] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%19 = llvm.load %21 : !llvm.ptr -> i64
llvm.store %19, %3 : i64, !llvm.ptr
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
%22 = llvm.load %7 : !llvm.ptr -> f64
%24 = llvm.load %11 : !llvm.ptr -> i64
%25 = llvm.getelementptr %arg0[%24] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%23 = llvm.load %25 : !llvm.ptr -> i64
%26 = arith.sitofp %23 : i64 to f64
%28 = llvm.load %11 : !llvm.ptr -> i64
%29 = llvm.getelementptr %arg1[%28] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%27 = llvm.load %29 : !llvm.ptr -> i64
%30 = arith.sitofp %27 : i64 to f64
%31 = arith.mulf %26, %30 : f64
%32 = arith.addf %22, %31 : f64
llvm.store %32, %7 : f64, !llvm.ptr
%33 = llvm.load %11 : !llvm.ptr -> i64
%34 = arith.constant 1 : i32
%36 = arith.extsi %34 : i32 to i64
%35 = arith.addi %33, %36 : i64
llvm.store %35, %11 : i64, !llvm.ptr
cf.br ^bb0
^bb2:
%37 = arith.constant 1.0 : f32
%38 = llvm.load %3 : !llvm.ptr -> i64
%39 = arith.sitofp %38 : i64 to f64
%41 = arith.extf %37 : f32 to f64
%40 = arith.divf %41, %39 : f64
%42 = arith.constant 0.0 : f32
%43 = arith.extf %42 : f32 to f64
%44 = llvm.mlir.constant(1 : i64) : i64
%45 = llvm.alloca %44 x f64 : (i64) -> !llvm.ptr
llvm.store %43, %45 : f64, !llvm.ptr
%46 = arith.constant 0 : i32
%47 = arith.extsi %46 : i32 to i64
llvm.store %47, %11 : i64, !llvm.ptr
cf.br ^bb6
^bb6:
%48 = llvm.load %11 : !llvm.ptr -> i64
%49 = arith.cmpi slt, %48, %arg2 : i64
cf.cond_br %49, ^bb7, ^bb8
^bb7:
%51 = llvm.load %11 : !llvm.ptr -> i64
%52 = llvm.getelementptr %arg0[%51] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%50 = llvm.load %52 : !llvm.ptr -> i64
%53 = arith.sitofp %50 : i64 to f64
%54 = arith.mulf %53, %40 : f64
%55 = llvm.mlir.constant(1 : i64) : i64
%56 = llvm.alloca %55 x f64 : (i64) -> !llvm.ptr
llvm.store %54, %56 : f64, !llvm.ptr
%57 = llvm.load %56 : !llvm.ptr -> f64
%58 = arith.constant 1.0 : f32
%60 = arith.extf %58 : f32 to f64
%59 = arith.cmpf ogt, %57, %60 : f64
cf.cond_br %59, ^bb9, ^bb10
^bb9:
%61 = arith.constant 1.0 : f32
%62 = arith.extf %61 : f32 to f64
llvm.store %62, %56 : f64, !llvm.ptr
cf.br ^bb11
^bb10:
cf.br ^bb11
^bb11:
%63 = llvm.load %45 : !llvm.ptr -> f64
%65 = llvm.load %11 : !llvm.ptr -> i64
%66 = llvm.getelementptr %arg1[%65] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%64 = llvm.load %66 : !llvm.ptr -> i64
%67 = arith.sitofp %64 : i64 to f64
%69 = llvm.load %56 : !llvm.ptr -> f64
%68 = func.call @asin(%69) : (f64) -> f64
%70 = arith.mulf %67, %68 : f64
%71 = arith.addf %63, %70 : f64
llvm.store %71, %45 : f64, !llvm.ptr
%72 = llvm.load %11 : !llvm.ptr -> i64
%73 = arith.constant 1 : i32
%75 = arith.extsi %73 : i32 to i64
%74 = arith.addi %72, %75 : i64
llvm.store %74, %11 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
%76 = arith.constant 0 : i32
%77 = arith.extsi %76 : i32 to i64
%78 = llvm.load %45 : !llvm.ptr -> f64
%79 = llvm.mlir.addressof @PI : !llvm.ptr
%80 = llvm.load %79 : !llvm.ptr -> f64
%81 = arith.constant 0 : f32
%83 = arith.extf %81 : f32 to f64
%82 = arith.subf %80, %83 : f64
%84 = arith.cmpf oge, %78, %82 : f64
cf.cond_br %84, ^bb12, ^bb13
^bb12:
%85 = llvm.load %45 : !llvm.ptr -> f64
%86 = llvm.mlir.addressof @PI : !llvm.ptr
%87 = llvm.load %86 : !llvm.ptr -> f64
%88 = arith.subf %85, %87 : f64
%89 = llvm.load %3 : !llvm.ptr -> i64
%90 = arith.sitofp %89 : i64 to f64
%91 = llvm.mlir.constant(1 : i64) : i64
%92 = llvm.alloca %91 x f64 : (i64) -> !llvm.ptr
llvm.store %90, %92 : f64, !llvm.ptr
%93 = math.absf %88 : f64
%94 = arith.constant 0 : f32
%96 = arith.extf %94 : f32 to f64
%95 = arith.cmpf oge, %93, %96 : f64
cf.cond_br %95, ^bb15, ^bb16
^bb15:
%97 = arith.constant 0 : f32
%98 = arith.extf %97 : f32 to f64
%99 = llvm.load %3 : !llvm.ptr -> i64
%100 = arith.sitofp %99 : i64 to f64
%101 = arith.constant 1.0 : f32
%103 = arith.extf %101 : f32 to f64
%102 = arith.addf %103, %98 : f64
%104 = arith.mulf %100, %102 : f64
%105 = llvm.mlir.constant(1 : i64) : i64
%106 = llvm.alloca %105 x f64 : (i64) -> !llvm.ptr
llvm.store %104, %106 : f64, !llvm.ptr
%107 = llvm.load %106 : !llvm.ptr -> f64
%108 = arith.constant 2.0 : f32
%110 = arith.extf %108 : f32 to f64
%109 = arith.mulf %107, %110 : f64
%111 = llvm.mlir.constant(1 : i64) : i64
%112 = llvm.alloca %111 x f64 : (i64) -> !llvm.ptr
llvm.store %109, %112 : f64, !llvm.ptr
%113 = arith.constant 0 : i32
%114 = arith.extsi %113 : i32 to i64
%115 = llvm.mlir.constant(1 : i64) : i64
%116 = llvm.alloca %115 x i64 : (i64) -> !llvm.ptr
llvm.store %114, %116 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%117 = llvm.load %116 : !llvm.ptr -> i64
%118 = arith.constant 60 : i32
%120 = arith.extsi %118 : i32 to i64
%119 = arith.cmpi slt, %117, %120 : i64
cf.cond_br %119, ^bb19, ^bb20
^bb19:
%121 = arith.constant 1.0 : f32
%122 = llvm.load %112 : !llvm.ptr -> f64
%124 = arith.extf %121 : f32 to f64
%123 = arith.divf %124, %122 : f64
%125 = llvm.load %112 : !llvm.ptr -> f64
%126 = llvm.load %112 : !llvm.ptr -> f64
%127 = arith.mulf %125, %126 : f64
%128 = arith.constant 0.0 : f32
%129 = llvm.mlir.addressof @PI : !llvm.ptr
%130 = llvm.load %129 : !llvm.ptr -> f64
%132 = arith.extf %128 : f32 to f64
%131 = arith.subf %132, %130 : f64
%133 = llvm.mlir.constant(1 : i64) : i64
%134 = llvm.alloca %133 x f64 : (i64) -> !llvm.ptr
llvm.store %131, %134 : f64, !llvm.ptr
%135 = arith.constant 0 : i32
%136 = arith.extsi %135 : i32 to i64
llvm.store %136, %11 : i64, !llvm.ptr
cf.br ^bb21
^bb21:
%137 = llvm.load %11 : !llvm.ptr -> i64
%138 = arith.cmpi slt, %137, %arg2 : i64
cf.cond_br %138, ^bb22, ^bb23
^bb22:
%140 = llvm.load %11 : !llvm.ptr -> i64
%141 = llvm.getelementptr %arg0[%140] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%139 = llvm.load %141 : !llvm.ptr -> i64
%142 = arith.sitofp %139 : i64 to f64
%143 = arith.mulf %142, %123 : f64
%144 = arith.constant 1.0 : f32
%145 = arith.mulf %143, %143 : f64
%147 = arith.extf %144 : f32 to f64
%146 = arith.subf %147, %145 : f64
%148 = llvm.mlir.constant(1 : i64) : i64
%149 = llvm.alloca %148 x f64 : (i64) -> !llvm.ptr
llvm.store %146, %149 : f64, !llvm.ptr
%150 = llvm.load %149 : !llvm.ptr -> f64
%151 = arith.constant 0.0 : f32
%153 = arith.extf %151 : f32 to f64
%152 = arith.cmpf olt, %150, %153 : f64
cf.cond_br %152, ^bb24, ^bb25
^bb24:
%154 = arith.constant 0.0 : f32
%155 = arith.extf %154 : f32 to f64
llvm.store %155, %149 : f64, !llvm.ptr
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
%156 = llvm.load %149 : !llvm.ptr -> f64
%157 = math.sqrt %156 : f64
%158 = llvm.mlir.constant(1 : i64) : i64
%159 = llvm.alloca %158 x f64 : (i64) -> !llvm.ptr
llvm.store %157, %159 : f64, !llvm.ptr
%160 = llvm.load %159 : !llvm.ptr -> f64
%161 = arith.constant 0 : f32
%163 = arith.extf %161 : f32 to f64
%162 = arith.cmpf olt, %160, %163 : f64
cf.cond_br %162, ^bb27, ^bb28
^bb27:
%164 = arith.constant 0 : f32
%165 = arith.extf %164 : f32 to f64
llvm.store %165, %159 : f64, !llvm.ptr
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
%166 = llvm.load %134 : !llvm.ptr -> f64
%168 = llvm.load %11 : !llvm.ptr -> i64
%169 = llvm.getelementptr %arg1[%168] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%167 = llvm.load %169 : !llvm.ptr -> i64
%170 = arith.sitofp %167 : i64 to f64
%171 = func.call @asin(%143) : (f64) -> f64
%172 = arith.mulf %170, %171 : f64
%173 = arith.addf %166, %172 : f64
llvm.store %173, %134 : f64, !llvm.ptr
%174 = llvm.load %11 : !llvm.ptr -> i64
%175 = arith.constant 1 : i32
%177 = arith.extsi %175 : i32 to i64
%176 = arith.addi %174, %177 : i64
llvm.store %176, %11 : i64, !llvm.ptr
cf.br ^bb21
^bb23:
%178 = llvm.load %134 : !llvm.ptr -> f64
%179 = arith.constant 0.0 : f32
%181 = arith.extf %179 : f32 to f64
%180 = arith.cmpf ole, %178, %181 : f64
cf.cond_br %180, ^bb30, ^bb31
^bb30:
cf.br ^bb20
^bb31:
cf.br ^bb32
^bb32:
%182 = llvm.load %112 : !llvm.ptr -> f64
%183 = arith.constant 2.0 : f32
%185 = arith.extf %183 : f32 to f64
%184 = arith.mulf %182, %185 : f64
llvm.store %184, %112 : f64, !llvm.ptr
%186 = llvm.load %116 : !llvm.ptr -> i64
%187 = arith.constant 1 : i32
%189 = arith.extsi %187 : i32 to i64
%188 = arith.addi %186, %189 : i64
llvm.store %188, %116 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
%190 = llvm.load %7 : !llvm.ptr -> f64
%191 = llvm.mlir.addressof @PI : !llvm.ptr
%192 = llvm.load %191 : !llvm.ptr -> f64
%193 = arith.divf %190, %192 : f64
llvm.store %193, %92 : f64, !llvm.ptr
%194 = llvm.load %92 : !llvm.ptr -> f64
%195 = llvm.load %106 : !llvm.ptr -> f64
%196 = arith.cmpf ole, %194, %195 : f64
%197 = scf.if %196 -> (i1) {
%198 = arith.constant true
scf.yield %198 : i1
} else {
%199 = llvm.load %92 : !llvm.ptr -> f64
%200 = llvm.load %112 : !llvm.ptr -> f64
%201 = arith.cmpf oge, %199, %200 : f64
scf.yield %201 : i1
}
cf.cond_br %197, ^bb33, ^bb34
^bb33:
%202 = arith.constant 0.5 : f32
%203 = llvm.load %106 : !llvm.ptr -> f64
%204 = llvm.load %112 : !llvm.ptr -> f64
%205 = arith.addf %203, %204 : f64
%207 = arith.extf %202 : f32 to f64
%206 = arith.mulf %207, %205 : f64
llvm.store %206, %92 : f64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%208 = arith.constant 0 : i32
%209 = arith.extsi %208 : i32 to i64
%210 = llvm.mlir.constant(1 : i64) : i64
%211 = llvm.alloca %210 x i64 : (i64) -> !llvm.ptr
llvm.store %209, %211 : i64, !llvm.ptr
cf.br ^bb36
^bb36:
%212 = llvm.load %211 : !llvm.ptr -> i64
%213 = arith.constant 24 : i32
%215 = arith.extsi %213 : i32 to i64
%214 = arith.cmpi slt, %212, %215 : i64
cf.cond_br %214, ^bb37, ^bb38
^bb37:
%216 = arith.constant 1.0 : f32
%217 = llvm.load %92 : !llvm.ptr -> f64
%219 = arith.extf %216 : f32 to f64
%218 = arith.divf %219, %217 : f64
%220 = llvm.load %92 : !llvm.ptr -> f64
%221 = llvm.load %92 : !llvm.ptr -> f64
%222 = arith.mulf %220, %221 : f64
%223 = arith.constant 0.0 : f32
%224 = llvm.mlir.addressof @PI : !llvm.ptr
%225 = llvm.load %224 : !llvm.ptr -> f64
%227 = arith.extf %223 : f32 to f64
%226 = arith.subf %227, %225 : f64
%228 = llvm.mlir.constant(1 : i64) : i64
%229 = llvm.alloca %228 x f64 : (i64) -> !llvm.ptr
llvm.store %226, %229 : f64, !llvm.ptr
%230 = arith.constant 0.0 : f32
%231 = arith.extf %230 : f32 to f64
%232 = llvm.mlir.constant(1 : i64) : i64
%233 = llvm.alloca %232 x f64 : (i64) -> !llvm.ptr
llvm.store %231, %233 : f64, !llvm.ptr
%234 = arith.constant 0 : i32
%235 = arith.extsi %234 : i32 to i64
llvm.store %235, %11 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%236 = llvm.load %11 : !llvm.ptr -> i64
%237 = arith.cmpi slt, %236, %arg2 : i64
cf.cond_br %237, ^bb40, ^bb41
^bb40:
%239 = llvm.load %11 : !llvm.ptr -> i64
%240 = llvm.getelementptr %arg0[%239] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%238 = llvm.load %240 : !llvm.ptr -> i64
%241 = arith.sitofp %238 : i64 to f64
%243 = llvm.load %11 : !llvm.ptr -> i64
%244 = llvm.getelementptr %arg1[%243] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%242 = llvm.load %244 : !llvm.ptr -> i64
%245 = arith.sitofp %242 : i64 to f64
%246 = arith.mulf %241, %218 : f64
%247 = arith.constant 1.0 : f32
%248 = arith.mulf %246, %246 : f64
%250 = arith.extf %247 : f32 to f64
%249 = arith.subf %250, %248 : f64
%251 = llvm.mlir.constant(1 : i64) : i64
%252 = llvm.alloca %251 x f64 : (i64) -> !llvm.ptr
llvm.store %249, %252 : f64, !llvm.ptr
%253 = llvm.load %252 : !llvm.ptr -> f64
%254 = arith.constant 0.0 : f32
%256 = arith.extf %254 : f32 to f64
%255 = arith.cmpf olt, %253, %256 : f64
cf.cond_br %255, ^bb42, ^bb43
^bb42:
%257 = arith.constant 0.0 : f32
%258 = arith.extf %257 : f32 to f64
llvm.store %258, %252 : f64, !llvm.ptr
cf.br ^bb44
^bb43:
cf.br ^bb44
^bb44:
%259 = llvm.load %252 : !llvm.ptr -> f64
%260 = math.sqrt %259 : f64
%261 = llvm.mlir.constant(1 : i64) : i64
%262 = llvm.alloca %261 x f64 : (i64) -> !llvm.ptr
llvm.store %260, %262 : f64, !llvm.ptr
%263 = llvm.load %262 : !llvm.ptr -> f64
%264 = arith.constant 0 : f32
%266 = arith.extf %264 : f32 to f64
%265 = arith.cmpf olt, %263, %266 : f64
cf.cond_br %265, ^bb45, ^bb46
^bb45:
%267 = arith.constant 0 : f32
%268 = arith.extf %267 : f32 to f64
llvm.store %268, %262 : f64, !llvm.ptr
cf.br ^bb47
^bb46:
cf.br ^bb47
^bb47:
%269 = llvm.load %229 : !llvm.ptr -> f64
%270 = func.call @asin(%246) : (f64) -> f64
%271 = arith.mulf %245, %270 : f64
%272 = arith.addf %269, %271 : f64
llvm.store %272, %229 : f64, !llvm.ptr
%273 = llvm.load %233 : !llvm.ptr -> f64
%274 = arith.mulf %245, %241 : f64
%275 = llvm.load %262 : !llvm.ptr -> f64
%276 = arith.mulf %222, %275 : f64
%277 = arith.divf %274, %276 : f64
%278 = arith.subf %273, %277 : f64
llvm.store %278, %233 : f64, !llvm.ptr
%279 = llvm.load %11 : !llvm.ptr -> i64
%280 = arith.constant 1 : i32
%282 = arith.extsi %280 : i32 to i64
%281 = arith.addi %279, %282 : i64
llvm.store %281, %11 : i64, !llvm.ptr
cf.br ^bb39
^bb41:
%283 = llvm.load %229 : !llvm.ptr -> f64
%284 = math.absf %283 : f64
%285 = arith.constant 0 : f32
%287 = arith.extf %285 : f32 to f64
%286 = arith.cmpf olt, %284, %287 : f64
cf.cond_br %286, ^bb48, ^bb49
^bb48:
cf.br ^bb38
^bb49:
cf.br ^bb50
^bb50:
%288 = llvm.load %229 : !llvm.ptr -> f64
%289 = arith.constant 0.0 : f32
%291 = arith.extf %289 : f32 to f64
%290 = arith.cmpf ogt, %288, %291 : f64
cf.cond_br %290, ^bb51, ^bb52
^bb51:
%292 = llvm.load %92 : !llvm.ptr -> f64
llvm.store %292, %106 : f64, !llvm.ptr
cf.br ^bb53
^bb52:
%293 = llvm.load %92 : !llvm.ptr -> f64
llvm.store %293, %112 : f64, !llvm.ptr
cf.br ^bb53
^bb53:
%294 = llvm.load %92 : !llvm.ptr -> f64
%295 = llvm.load %229 : !llvm.ptr -> f64
%296 = llvm.load %233 : !llvm.ptr -> f64
%297 = arith.divf %295, %296 : f64
%298 = arith.subf %294, %297 : f64
%299 = llvm.mlir.constant(1 : i64) : i64
%300 = llvm.alloca %299 x f64 : (i64) -> !llvm.ptr
llvm.store %298, %300 : f64, !llvm.ptr
%301 = llvm.load %300 : !llvm.ptr -> f64
%302 = llvm.load %106 : !llvm.ptr -> f64
%303 = arith.cmpf ole, %301, %302 : f64
%304 = scf.if %303 -> (i1) {
%305 = arith.constant true
scf.yield %305 : i1
} else {
%306 = llvm.load %300 : !llvm.ptr -> f64
%307 = llvm.load %112 : !llvm.ptr -> f64
%308 = arith.cmpf oge, %306, %307 : f64
scf.yield %308 : i1
}
%309 = scf.if %304 -> (i1) {
%310 = arith.constant true
scf.yield %310 : i1
} else {
%311 = llvm.load %300 : !llvm.ptr -> f64
%312 = llvm.load %300 : !llvm.ptr -> f64
%313 = arith.cmpf one, %311, %312 : f64
scf.yield %313 : i1
}
cf.cond_br %309, ^bb54, ^bb55
^bb54:
%314 = arith.constant 0.5 : f32
%315 = llvm.load %106 : !llvm.ptr -> f64
%316 = llvm.load %112 : !llvm.ptr -> f64
%317 = arith.addf %315, %316 : f64
%319 = arith.extf %314 : f32 to f64
%318 = arith.mulf %319, %317 : f64
llvm.store %318, %300 : f64, !llvm.ptr
cf.br ^bb56
^bb55:
cf.br ^bb56
^bb56:
%320 = llvm.load %300 : !llvm.ptr -> f64
llvm.store %320, %92 : f64, !llvm.ptr
%321 = llvm.load %112 : !llvm.ptr -> f64
%322 = llvm.load %106 : !llvm.ptr -> f64
%323 = arith.subf %321, %322 : f64
%324 = arith.constant 0 : f32
%325 = llvm.load %112 : !llvm.ptr -> f64
%327 = arith.extf %324 : f32 to f64
%326 = arith.mulf %327, %325 : f64
%328 = arith.cmpf olt, %323, %326 : f64
cf.cond_br %328, ^bb57, ^bb58
^bb57:
cf.br ^bb38
^bb58:
cf.br ^bb59
^bb59:
%329 = llvm.load %211 : !llvm.ptr -> i64
%330 = arith.constant 1 : i32
%332 = arith.extsi %330 : i32 to i64
%331 = arith.addi %329, %332 : i64
llvm.store %331, %211 : i64, !llvm.ptr
cf.br ^bb36
^bb38:
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%333 = arith.constant 1.0 : f32
%334 = llvm.load %92 : !llvm.ptr -> f64
%336 = arith.extf %333 : f32 to f64
%335 = arith.divf %336, %334 : f64
%337 = arith.constant 0.0 : f32
%338 = arith.extf %337 : f32 to f64
%339 = llvm.mlir.constant(1 : i64) : i64
%340 = llvm.alloca %339 x f64 : (i64) -> !llvm.ptr
llvm.store %338, %340 : f64, !llvm.ptr
%341 = arith.constant 0 : i32
%342 = arith.extsi %341 : i32 to i64
llvm.store %342, %11 : i64, !llvm.ptr
cf.br ^bb60
^bb60:
%343 = llvm.load %11 : !llvm.ptr -> i64
%344 = arith.cmpi slt, %343, %arg2 : i64
cf.cond_br %344, ^bb61, ^bb62
^bb61:
%346 = llvm.load %11 : !llvm.ptr -> i64
%347 = llvm.getelementptr %arg0[%346] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%345 = llvm.load %347 : !llvm.ptr -> i64
%348 = arith.sitofp %345 : i64 to f64
%350 = llvm.load %11 : !llvm.ptr -> i64
%351 = llvm.getelementptr %arg1[%350] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%349 = llvm.load %351 : !llvm.ptr -> i64
%352 = arith.sitofp %349 : i64 to f64
%353 = arith.mulf %348, %335 : f64
%354 = arith.constant 1.0 : f32
%355 = arith.mulf %353, %353 : f64
%357 = arith.extf %354 : f32 to f64
%356 = arith.subf %357, %355 : f64
%358 = arith.constant 0.0 : f32
%360 = arith.extf %358 : f32 to f64
%359 = arith.cmpf ogt, %356, %360 : f64
cf.cond_br %359, ^bb63, ^bb64
^bb63:
%361 = llvm.load %340 : !llvm.ptr -> f64
%362 = arith.mulf %352, %348 : f64
%363 = llvm.load %92 : !llvm.ptr -> f64
%364 = math.sqrt %356 : f64
%365 = arith.mulf %363, %364 : f64
%366 = arith.mulf %362, %365 : f64
%367 = arith.addf %361, %366 : f64
llvm.store %367, %340 : f64, !llvm.ptr
cf.br ^bb65
^bb64:
cf.br ^bb65
^bb65:
%368 = llvm.load %11 : !llvm.ptr -> i64
%369 = arith.constant 1 : i32
%371 = arith.extsi %369 : i32 to i64
%370 = arith.addi %368, %371 : i64
llvm.store %370, %11 : i64, !llvm.ptr
cf.br ^bb60
^bb62:
%372 = arith.constant 0.25 : f32
%373 = llvm.load %340 : !llvm.ptr -> f64
%375 = arith.extf %372 : f32 to f64
%374 = arith.mulf %375, %373 : f64
func.return %374 : f64
^bb13:
cf.br ^bb14
^bb14:
%376 = llvm.load %3 : !llvm.ptr -> i64
%377 = arith.constant 0 : f32
%378 = arith.extf %377 : f32 to f64
%379 = arith.sitofp %376 : i64 to f64
%380 = arith.constant 1.0 : f32
%382 = arith.extf %380 : f32 to f64
%381 = arith.addf %382, %378 : f64
%383 = arith.mulf %379, %381 : f64
%384 = llvm.mlir.constant(1 : i64) : i64
%385 = llvm.alloca %384 x f64 : (i64) -> !llvm.ptr
llvm.store %383, %385 : f64, !llvm.ptr
%386 = llvm.load %385 : !llvm.ptr -> f64
%387 = arith.constant 2.0 : f32
%389 = arith.extf %387 : f32 to f64
%388 = arith.mulf %386, %389 : f64
%390 = llvm.mlir.constant(1 : i64) : i64
%391 = llvm.alloca %390 x f64 : (i64) -> !llvm.ptr
llvm.store %388, %391 : f64, !llvm.ptr
%392 = arith.constant 0 : i32
%393 = arith.extsi %392 : i32 to i64
%394 = llvm.mlir.constant(1 : i64) : i64
%395 = llvm.alloca %394 x i64 : (i64) -> !llvm.ptr
llvm.store %393, %395 : i64, !llvm.ptr
cf.br ^bb66
^bb66:
%396 = llvm.load %395 : !llvm.ptr -> i64
%397 = arith.constant 60 : i32
%399 = arith.extsi %397 : i32 to i64
%398 = arith.cmpi slt, %396, %399 : i64
cf.cond_br %398, ^bb67, ^bb68
^bb67:
%400 = arith.constant 1.0 : f32
%401 = llvm.load %391 : !llvm.ptr -> f64
%403 = arith.extf %400 : f32 to f64
%402 = arith.divf %403, %401 : f64
%404 = llvm.load %391 : !llvm.ptr -> f64
%405 = llvm.load %391 : !llvm.ptr -> f64
%406 = arith.mulf %404, %405 : f64
%407 = arith.constant 0.0 : f32
%408 = arith.extf %407 : f32 to f64
%409 = llvm.mlir.constant(1 : i64) : i64
%410 = llvm.alloca %409 x f64 : (i64) -> !llvm.ptr
llvm.store %408, %410 : f64, !llvm.ptr
%411 = arith.constant 0 : i32
%412 = arith.extsi %411 : i32 to i64
llvm.store %412, %11 : i64, !llvm.ptr
cf.br ^bb69
^bb69:
%413 = llvm.load %11 : !llvm.ptr -> i64
%414 = arith.cmpi slt, %413, %arg2 : i64
cf.cond_br %414, ^bb70, ^bb71
^bb70:
%416 = llvm.load %11 : !llvm.ptr -> i64
%417 = llvm.getelementptr %arg0[%416] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%415 = llvm.load %417 : !llvm.ptr -> i64
%418 = arith.sitofp %415 : i64 to f64
%419 = arith.mulf %418, %402 : f64
%420 = arith.constant 1.0 : f32
%421 = arith.mulf %419, %419 : f64
%423 = arith.extf %420 : f32 to f64
%422 = arith.subf %423, %421 : f64
%424 = llvm.mlir.constant(1 : i64) : i64
%425 = llvm.alloca %424 x f64 : (i64) -> !llvm.ptr
llvm.store %422, %425 : f64, !llvm.ptr
%426 = llvm.load %425 : !llvm.ptr -> f64
%427 = arith.constant 0.0 : f32
%429 = arith.extf %427 : f32 to f64
%428 = arith.cmpf olt, %426, %429 : f64
cf.cond_br %428, ^bb72, ^bb73
^bb72:
%430 = arith.constant 0.0 : f32
%431 = arith.extf %430 : f32 to f64
llvm.store %431, %425 : f64, !llvm.ptr
cf.br ^bb74
^bb73:
cf.br ^bb74
^bb74:
%432 = llvm.load %410 : !llvm.ptr -> f64
%434 = llvm.load %11 : !llvm.ptr -> i64
%435 = llvm.getelementptr %arg1[%434] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%433 = llvm.load %435 : !llvm.ptr -> i64
%436 = arith.sitofp %433 : i64 to f64
%437 = func.call @asin(%419) : (f64) -> f64
%438 = arith.mulf %436, %437 : f64
%439 = arith.addf %432, %438 : f64
llvm.store %439, %410 : f64, !llvm.ptr
%440 = llvm.load %11 : !llvm.ptr -> i64
%441 = arith.constant 1 : i32
%443 = arith.extsi %441 : i32 to i64
%442 = arith.addi %440, %443 : i64
llvm.store %442, %11 : i64, !llvm.ptr
cf.br ^bb69
^bb71:
%444 = llvm.load %410 : !llvm.ptr -> f64
%445 = arith.constant 2.0 : f32
%447 = arith.sitofp %376 : i64 to f64
%448 = arith.mulf %447, %402 : f64
%446 = func.call @asin(%448) : (f64) -> f64
%450 = arith.extf %445 : f32 to f64
%449 = arith.mulf %450, %446 : f64
%451 = arith.subf %444, %449 : f64
llvm.store %451, %410 : f64, !llvm.ptr
%452 = llvm.load %410 : !llvm.ptr -> f64
%453 = arith.constant 0.0 : f32
%455 = arith.extf %453 : f32 to f64
%454 = arith.cmpf oge, %452, %455 : f64
cf.cond_br %454, ^bb75, ^bb76
^bb75:
cf.br ^bb68
^bb76:
cf.br ^bb77
^bb77:
%456 = llvm.load %391 : !llvm.ptr -> f64
%457 = arith.constant 2.0 : f32
%459 = arith.extf %457 : f32 to f64
%458 = arith.mulf %456, %459 : f64
llvm.store %458, %391 : f64, !llvm.ptr
%460 = llvm.load %395 : !llvm.ptr -> i64
%461 = arith.constant 1 : i32
%463 = arith.extsi %461 : i32 to i64
%462 = arith.addi %460, %463 : i64
llvm.store %462, %395 : i64, !llvm.ptr
cf.br ^bb66
^bb68:
%464 = llvm.load %385 : !llvm.ptr -> f64
%465 = arith.constant 1.1 : f32
%467 = arith.extf %465 : f32 to f64
%466 = arith.mulf %464, %467 : f64
%468 = llvm.mlir.constant(1 : i64) : i64
%469 = llvm.alloca %468 x f64 : (i64) -> !llvm.ptr
llvm.store %466, %469 : f64, !llvm.ptr
%470 = llvm.load %469 : !llvm.ptr -> f64
%471 = llvm.load %391 : !llvm.ptr -> f64
%472 = arith.cmpf oge, %470, %471 : f64
cf.cond_br %472, ^bb78, ^bb79
^bb78:
%473 = arith.constant 0.5 : f32
%474 = llvm.load %385 : !llvm.ptr -> f64
%475 = llvm.load %391 : !llvm.ptr -> f64
%476 = arith.addf %474, %475 : f64
%478 = arith.extf %473 : f32 to f64
%477 = arith.mulf %478, %476 : f64
llvm.store %477, %469 : f64, !llvm.ptr
cf.br ^bb80
^bb79:
cf.br ^bb80
^bb80:
%479 = arith.constant 0 : i32
%480 = arith.extsi %479 : i32 to i64
%481 = llvm.mlir.constant(1 : i64) : i64
%482 = llvm.alloca %481 x i64 : (i64) -> !llvm.ptr
llvm.store %480, %482 : i64, !llvm.ptr
cf.br ^bb81
^bb81:
%483 = llvm.load %482 : !llvm.ptr -> i64
%484 = arith.constant 24 : i32
%486 = arith.extsi %484 : i32 to i64
%485 = arith.cmpi slt, %483, %486 : i64
cf.cond_br %485, ^bb82, ^bb83
^bb82:
%487 = arith.constant 1.0 : f32
%488 = llvm.load %469 : !llvm.ptr -> f64
%490 = arith.extf %487 : f32 to f64
%489 = arith.divf %490, %488 : f64
%491 = llvm.load %469 : !llvm.ptr -> f64
%492 = llvm.load %469 : !llvm.ptr -> f64
%493 = arith.mulf %491, %492 : f64
%494 = arith.constant 0.0 : f32
%495 = arith.extf %494 : f32 to f64
%496 = llvm.mlir.constant(1 : i64) : i64
%497 = llvm.alloca %496 x f64 : (i64) -> !llvm.ptr
llvm.store %495, %497 : f64, !llvm.ptr
%498 = arith.constant 0.0 : f32
%499 = arith.extf %498 : f32 to f64
%500 = llvm.mlir.constant(1 : i64) : i64
%501 = llvm.alloca %500 x f64 : (i64) -> !llvm.ptr
llvm.store %499, %501 : f64, !llvm.ptr
%502 = arith.constant 0 : i32
%503 = arith.extsi %502 : i32 to i64
llvm.store %503, %11 : i64, !llvm.ptr
cf.br ^bb84
^bb84:
%504 = llvm.load %11 : !llvm.ptr -> i64
%505 = arith.cmpi slt, %504, %arg2 : i64
cf.cond_br %505, ^bb85, ^bb86
^bb85:
%507 = llvm.load %11 : !llvm.ptr -> i64
%508 = llvm.getelementptr %arg0[%507] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%506 = llvm.load %508 : !llvm.ptr -> i64
%509 = arith.sitofp %506 : i64 to f64
%511 = llvm.load %11 : !llvm.ptr -> i64
%512 = llvm.getelementptr %arg1[%511] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%510 = llvm.load %512 : !llvm.ptr -> i64
%513 = arith.sitofp %510 : i64 to f64
%514 = arith.mulf %509, %489 : f64
%515 = arith.constant 1.0 : f32
%516 = arith.mulf %514, %514 : f64
%518 = arith.extf %515 : f32 to f64
%517 = arith.subf %518, %516 : f64
%519 = llvm.mlir.constant(1 : i64) : i64
%520 = llvm.alloca %519 x f64 : (i64) -> !llvm.ptr
llvm.store %517, %520 : f64, !llvm.ptr
%521 = llvm.load %520 : !llvm.ptr -> f64
%522 = arith.constant 0.0 : f32
%524 = arith.extf %522 : f32 to f64
%523 = arith.cmpf olt, %521, %524 : f64
cf.cond_br %523, ^bb87, ^bb88
^bb87:
%525 = arith.constant 0.0 : f32
%526 = arith.extf %525 : f32 to f64
llvm.store %526, %520 : f64, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
%527 = llvm.load %520 : !llvm.ptr -> f64
%528 = math.sqrt %527 : f64
%529 = llvm.mlir.constant(1 : i64) : i64
%530 = llvm.alloca %529 x f64 : (i64) -> !llvm.ptr
llvm.store %528, %530 : f64, !llvm.ptr
%531 = llvm.load %530 : !llvm.ptr -> f64
%532 = arith.constant 0 : f32
%534 = arith.extf %532 : f32 to f64
%533 = arith.cmpf olt, %531, %534 : f64
cf.cond_br %533, ^bb90, ^bb91
^bb90:
%535 = arith.constant 0 : f32
%536 = arith.extf %535 : f32 to f64
llvm.store %536, %530 : f64, !llvm.ptr
cf.br ^bb92
^bb91:
cf.br ^bb92
^bb92:
%537 = llvm.load %497 : !llvm.ptr -> f64
%538 = func.call @asin(%514) : (f64) -> f64
%539 = arith.mulf %513, %538 : f64
%540 = arith.addf %537, %539 : f64
llvm.store %540, %497 : f64, !llvm.ptr
%541 = llvm.load %501 : !llvm.ptr -> f64
%542 = arith.mulf %513, %509 : f64
%543 = llvm.load %530 : !llvm.ptr -> f64
%544 = arith.mulf %493, %543 : f64
%545 = arith.divf %542, %544 : f64
%546 = arith.subf %541, %545 : f64
llvm.store %546, %501 : f64, !llvm.ptr
%547 = llvm.load %11 : !llvm.ptr -> i64
%548 = arith.constant 1 : i32
%550 = arith.extsi %548 : i32 to i64
%549 = arith.addi %547, %550 : i64
llvm.store %549, %11 : i64, !llvm.ptr
cf.br ^bb84
^bb86:
%551 = arith.sitofp %376 : i64 to f64
%552 = arith.mulf %551, %489 : f64
%553 = arith.constant 1.0 : f32
%554 = arith.mulf %552, %552 : f64
%556 = arith.extf %553 : f32 to f64
%555 = arith.subf %556, %554 : f64
%557 = llvm.mlir.constant(1 : i64) : i64
%558 = llvm.alloca %557 x f64 : (i64) -> !llvm.ptr
llvm.store %555, %558 : f64, !llvm.ptr
%559 = llvm.load %558 : !llvm.ptr -> f64
%560 = arith.constant 0.0 : f32
%562 = arith.extf %560 : f32 to f64
%561 = arith.cmpf olt, %559, %562 : f64
cf.cond_br %561, ^bb93, ^bb94
^bb93:
%563 = arith.constant 0.0 : f32
%564 = arith.extf %563 : f32 to f64
llvm.store %564, %558 : f64, !llvm.ptr
cf.br ^bb95
^bb94:
cf.br ^bb95
^bb95:
%565 = llvm.load %558 : !llvm.ptr -> f64
%566 = math.sqrt %565 : f64
%567 = llvm.mlir.constant(1 : i64) : i64
%568 = llvm.alloca %567 x f64 : (i64) -> !llvm.ptr
llvm.store %566, %568 : f64, !llvm.ptr
%569 = llvm.load %568 : !llvm.ptr -> f64
%570 = arith.constant 0 : f32
%572 = arith.extf %570 : f32 to f64
%571 = arith.cmpf olt, %569, %572 : f64
cf.cond_br %571, ^bb96, ^bb97
^bb96:
%573 = arith.constant 0 : f32
%574 = arith.extf %573 : f32 to f64
llvm.store %574, %568 : f64, !llvm.ptr
cf.br ^bb98
^bb97:
cf.br ^bb98
^bb98:
%575 = llvm.load %497 : !llvm.ptr -> f64
%576 = arith.constant 2.0 : f32
%577 = func.call @asin(%552) : (f64) -> f64
%579 = arith.extf %576 : f32 to f64
%578 = arith.mulf %579, %577 : f64
%580 = arith.subf %575, %578 : f64
llvm.store %580, %497 : f64, !llvm.ptr
%581 = llvm.load %501 : !llvm.ptr -> f64
%582 = arith.constant 2.0 : f32
%583 = arith.sitofp %376 : i64 to f64
%585 = arith.extf %582 : f32 to f64
%584 = arith.mulf %585, %583 : f64
%586 = llvm.load %568 : !llvm.ptr -> f64
%587 = arith.mulf %493, %586 : f64
%588 = arith.divf %584, %587 : f64
%589 = arith.addf %581, %588 : f64
llvm.store %589, %501 : f64, !llvm.ptr
%590 = llvm.load %497 : !llvm.ptr -> f64
%591 = math.absf %590 : f64
%592 = arith.constant 0 : f32
%594 = arith.extf %592 : f32 to f64
%593 = arith.cmpf olt, %591, %594 : f64
cf.cond_br %593, ^bb99, ^bb100
^bb99:
cf.br ^bb83
^bb100:
cf.br ^bb101
^bb101:
%595 = llvm.load %497 : !llvm.ptr -> f64
%596 = arith.constant 0.0 : f32
%598 = arith.extf %596 : f32 to f64
%597 = arith.cmpf ogt, %595, %598 : f64
cf.cond_br %597, ^bb102, ^bb103
^bb102:
%599 = llvm.load %469 : !llvm.ptr -> f64
llvm.store %599, %391 : f64, !llvm.ptr
cf.br ^bb104
^bb103:
%600 = llvm.load %469 : !llvm.ptr -> f64
llvm.store %600, %385 : f64, !llvm.ptr
cf.br ^bb104
^bb104:
%601 = llvm.load %469 : !llvm.ptr -> f64
%602 = llvm.load %497 : !llvm.ptr -> f64
%603 = llvm.load %501 : !llvm.ptr -> f64
%604 = arith.divf %602, %603 : f64
%605 = arith.subf %601, %604 : f64
%606 = llvm.mlir.constant(1 : i64) : i64
%607 = llvm.alloca %606 x f64 : (i64) -> !llvm.ptr
llvm.store %605, %607 : f64, !llvm.ptr
%608 = llvm.load %607 : !llvm.ptr -> f64
%609 = llvm.load %385 : !llvm.ptr -> f64
%610 = arith.cmpf ole, %608, %609 : f64
%611 = scf.if %610 -> (i1) {
%612 = arith.constant true
scf.yield %612 : i1
} else {
%613 = llvm.load %607 : !llvm.ptr -> f64
%614 = llvm.load %391 : !llvm.ptr -> f64
%615 = arith.cmpf oge, %613, %614 : f64
scf.yield %615 : i1
}
%616 = scf.if %611 -> (i1) {
%617 = arith.constant true
scf.yield %617 : i1
} else {
%618 = llvm.load %607 : !llvm.ptr -> f64
%619 = llvm.load %607 : !llvm.ptr -> f64
%620 = arith.cmpf one, %618, %619 : f64
scf.yield %620 : i1
}
cf.cond_br %616, ^bb105, ^bb106
^bb105:
%621 = arith.constant 0.5 : f32
%622 = llvm.load %385 : !llvm.ptr -> f64
%623 = llvm.load %391 : !llvm.ptr -> f64
%624 = arith.addf %622, %623 : f64
%626 = arith.extf %621 : f32 to f64
%625 = arith.mulf %626, %624 : f64
llvm.store %625, %607 : f64, !llvm.ptr
cf.br ^bb107
^bb106:
cf.br ^bb107
^bb107:
%627 = llvm.load %607 : !llvm.ptr -> f64
llvm.store %627, %469 : f64, !llvm.ptr
%628 = llvm.load %391 : !llvm.ptr -> f64
%629 = llvm.load %385 : !llvm.ptr -> f64
%630 = arith.subf %628, %629 : f64
%631 = arith.constant 0 : f32
%632 = llvm.load %391 : !llvm.ptr -> f64
%634 = arith.extf %631 : f32 to f64
%633 = arith.mulf %634, %632 : f64
%635 = arith.cmpf olt, %630, %633 : f64
cf.cond_br %635, ^bb108, ^bb109
^bb108:
cf.br ^bb83
^bb109:
cf.br ^bb110
^bb110:
%636 = llvm.load %482 : !llvm.ptr -> i64
%637 = arith.constant 1 : i32
%639 = arith.extsi %637 : i32 to i64
%638 = arith.addi %636, %639 : i64
llvm.store %638, %482 : i64, !llvm.ptr
cf.br ^bb81
^bb83:
%640 = arith.constant 1.0 : f32
%641 = llvm.load %469 : !llvm.ptr -> f64
%643 = arith.extf %640 : f32 to f64
%642 = arith.divf %643, %641 : f64
%644 = arith.constant 0.0 : f32
%645 = arith.extf %644 : f32 to f64
%646 = llvm.mlir.constant(1 : i64) : i64
%647 = llvm.alloca %646 x f64 : (i64) -> !llvm.ptr
llvm.store %645, %647 : f64, !llvm.ptr
%648 = arith.constant 0.0 : f32
%649 = arith.extf %648 : f32 to f64
%650 = llvm.mlir.constant(1 : i64) : i64
%651 = llvm.alloca %650 x f64 : (i64) -> !llvm.ptr
llvm.store %649, %651 : f64, !llvm.ptr
%652 = arith.constant 0 : i32
%653 = arith.extsi %652 : i32 to i64
llvm.store %653, %11 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%654 = llvm.load %11 : !llvm.ptr -> i64
%655 = arith.cmpi slt, %654, %arg2 : i64
cf.cond_br %655, ^bb112, ^bb113
^bb112:
%657 = llvm.load %11 : !llvm.ptr -> i64
%658 = llvm.getelementptr %arg0[%657] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%656 = llvm.load %658 : !llvm.ptr -> i64
%659 = arith.sitofp %656 : i64 to f64
%661 = llvm.load %11 : !llvm.ptr -> i64
%662 = llvm.getelementptr %arg1[%661] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%660 = llvm.load %662 : !llvm.ptr -> i64
%663 = arith.sitofp %660 : i64 to f64
%664 = arith.mulf %659, %642 : f64
%665 = arith.constant 1.0 : f32
%666 = arith.mulf %664, %664 : f64
%668 = arith.extf %665 : f32 to f64
%667 = arith.subf %668, %666 : f64
%669 = arith.constant 0.0 : f32
%671 = arith.extf %669 : f32 to f64
%670 = arith.cmpf ogt, %667, %671 : f64
cf.cond_br %670, ^bb114, ^bb115
^bb114:
%672 = arith.mulf %663, %659 : f64
%673 = llvm.load %469 : !llvm.ptr -> f64
%674 = math.sqrt %667 : f64
%675 = arith.mulf %673, %674 : f64
%676 = arith.mulf %672, %675 : f64
%677 = llvm.load %647 : !llvm.ptr -> f64
%678 = arith.addf %677, %676 : f64
llvm.store %678, %647 : f64, !llvm.ptr
%680 = llvm.load %11 : !llvm.ptr -> i64
%681 = llvm.getelementptr %arg0[%680] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%679 = llvm.load %681 : !llvm.ptr -> i64
%682 = arith.cmpi eq, %679, %376 : i64
cf.cond_br %682, ^bb117, ^bb118
^bb117:
%683 = llvm.load %469 : !llvm.ptr -> f64
%684 = math.sqrt %667 : f64
%685 = arith.mulf %683, %684 : f64
%686 = arith.mulf %659, %685 : f64
llvm.store %686, %651 : f64, !llvm.ptr
cf.br ^bb119
^bb118:
cf.br ^bb119
^bb119:
cf.br ^bb116
^bb115:
cf.br ^bb116
^bb116:
%687 = llvm.load %11 : !llvm.ptr -> i64
%688 = arith.constant 1 : i32
%690 = arith.extsi %688 : i32 to i64
%689 = arith.addi %687, %690 : i64
llvm.store %689, %11 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
%691 = llvm.load %647 : !llvm.ptr -> f64
%692 = arith.constant 2.0 : f32
%693 = llvm.load %651 : !llvm.ptr -> f64
%695 = arith.extf %692 : f32 to f64
%694 = arith.mulf %695, %693 : f64
%696 = arith.subf %691, %694 : f64
llvm.store %696, %647 : f64, !llvm.ptr
%697 = arith.constant 0.25 : f32
%698 = llvm.load %647 : !llvm.ptr -> f64
%700 = arith.extf %697 : f32 to f64
%699 = arith.mulf %700, %698 : f64
func.return %699 : f64
}
// Module static: PARTS
llvm.mlir.global internal @PARTS() {addr_space = 0 : i32} : !llvm.ptr {
%701 = llvm.mlir.zero : !llvm.ptr
llvm.return %701 : !llvm.ptr
}
// Module static: NP
llvm.mlir.global internal @NP(0 : i64) : i64
// Module static: FACT
llvm.mlir.global internal @FACT() {addr_space = 0 : i32} : !llvm.ptr {
%702 = llvm.mlir.zero : !llvm.ptr
llvm.return %702 : !llvm.ptr
}
// Module static: NN
llvm.mlir.global internal @NN(0 : i64) : i64
// Module static: SUM
llvm.mlir.global internal @SUM(0.0 : f64) : f64
// Module static: COMP
llvm.mlir.global internal @COMP(0.0 : f64) : f64
func.func @dfs(%arg0: i64, %arg1: i64) -> () {
%703 = arith.constant 0 : i32
%705 = arith.extsi %703 : i32 to i64
%704 = arith.cmpi eq, %arg0, %705 : i64
cf.cond_br %704, ^bb120, ^bb121
^bb120:
%706 = llvm.mlir.addressof @NP : !llvm.ptr
%707 = llvm.load %706 : !llvm.ptr -> i64
%708 = llvm.mlir.addressof @NN : !llvm.ptr
%709 = llvm.load %708 : !llvm.ptr -> i64
%710 = arith.subi %709, %707 : i64
%712 = llvm.mlir.addressof @FACT : !llvm.ptr
%713 = llvm.load %712 : !llvm.ptr -> !llvm.ptr
%714 = llvm.getelementptr %713[%710] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%711 = llvm.load %714 : !llvm.ptr -> f64
%715 = llvm.mlir.constant(1 : i64) : i64
%716 = llvm.alloca %715 x f64 : (i64) -> !llvm.ptr
llvm.store %711, %716 : f64, !llvm.ptr
%718 = arith.constant 2 : i32
%720 = arith.extsi %718 : i32 to i64
%719 = arith.addi %707, %720 : i64
%721 = arith.constant 8 : i32
%722 = arith.extsi %721 : i32 to i64
%717 = func.call @calloc(%719, %722) : (i64, i64) -> !llvm.ptr
%724 = arith.constant 2 : i32
%726 = arith.extsi %724 : i32 to i64
%725 = arith.addi %707, %726 : i64
%727 = arith.constant 8 : i32
%728 = arith.extsi %727 : i32 to i64
%723 = func.call @calloc(%725, %728) : (i64, i64) -> !llvm.ptr
%729 = arith.constant 1 : i32
%730 = arith.constant 0 : i32
%731 = arith.extsi %729 : i32 to i64
%732 = arith.extsi %730 : i32 to i64
%733 = llvm.getelementptr %717[%732] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %731, %733 : i64, !llvm.ptr
%734 = arith.constant 0 : i32
%735 = arith.extsi %734 : i32 to i64
%736 = llvm.getelementptr %723[%735] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %710, %736 : i64, !llvm.ptr
%737 = arith.constant 1 : i32
%738 = arith.extsi %737 : i32 to i64
%739 = llvm.mlir.constant(1 : i64) : i64
%740 = llvm.alloca %739 x i64 : (i64) -> !llvm.ptr
llvm.store %738, %740 : i64, !llvm.ptr
%741 = arith.constant 0 : i32
%742 = arith.extsi %741 : i32 to i64
%743 = llvm.mlir.constant(1 : i64) : i64
%744 = llvm.alloca %743 x i64 : (i64) -> !llvm.ptr
llvm.store %742, %744 : i64, !llvm.ptr
cf.br ^bb123
^bb123:
%745 = llvm.load %744 : !llvm.ptr -> i64
%746 = arith.cmpi slt, %745, %707 : i64
cf.cond_br %746, ^bb124, ^bb125
^bb124:
%748 = llvm.mlir.addressof @PARTS : !llvm.ptr
%749 = llvm.load %748 : !llvm.ptr -> !llvm.ptr
%750 = llvm.load %744 : !llvm.ptr -> i64
%751 = llvm.getelementptr %749[%750] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%747 = llvm.load %751 : !llvm.ptr -> i64
%752 = llvm.load %744 : !llvm.ptr -> i64
%753 = arith.constant 1 : i32
%755 = arith.extsi %753 : i32 to i64
%754 = arith.addi %752, %755 : i64
%756 = llvm.mlir.constant(1 : i64) : i64
%757 = llvm.alloca %756 x i64 : (i64) -> !llvm.ptr
llvm.store %754, %757 : i64, !llvm.ptr
cf.br ^bb126
^bb126:
%758 = llvm.load %757 : !llvm.ptr -> i64
%759 = arith.cmpi slt, %758, %707 : i64
%760 = scf.if %759 -> (i1) {
%762 = llvm.mlir.addressof @PARTS : !llvm.ptr
%763 = llvm.load %762 : !llvm.ptr -> !llvm.ptr
%764 = llvm.load %757 : !llvm.ptr -> i64
%765 = llvm.getelementptr %763[%764] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%761 = llvm.load %765 : !llvm.ptr -> i64
%766 = arith.cmpi eq, %761, %747 : i64
scf.yield %766 : i1
} else {
%767 = arith.constant false
scf.yield %767 : i1
}
cf.cond_br %760, ^bb127, ^bb128
^bb127:
%768 = llvm.load %757 : !llvm.ptr -> i64
%769 = arith.constant 1 : i32
%771 = arith.extsi %769 : i32 to i64
%770 = arith.addi %768, %771 : i64
llvm.store %770, %757 : i64, !llvm.ptr
cf.br ^bb126
^bb128:
%772 = llvm.load %757 : !llvm.ptr -> i64
%773 = llvm.load %744 : !llvm.ptr -> i64
%774 = arith.subi %772, %773 : i64
%775 = arith.constant 1 : i32
%777 = arith.extsi %775 : i32 to i64
%776 = arith.addi %747, %777 : i64
%778 = llvm.load %740 : !llvm.ptr -> i64
%779 = llvm.getelementptr %717[%778] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %776, %779 : i64, !llvm.ptr
%780 = llvm.load %740 : !llvm.ptr -> i64
%781 = llvm.getelementptr %723[%780] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %774, %781 : i64, !llvm.ptr
%782 = llvm.load %716 : !llvm.ptr -> f64
%784 = llvm.mlir.addressof @FACT : !llvm.ptr
%785 = llvm.load %784 : !llvm.ptr -> !llvm.ptr
%786 = llvm.getelementptr %785[%774] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%783 = llvm.load %786 : !llvm.ptr -> f64
%787 = arith.mulf %782, %783 : f64
llvm.store %787, %716 : f64, !llvm.ptr
%788 = llvm.load %740 : !llvm.ptr -> i64
%789 = arith.constant 1 : i32
%791 = arith.extsi %789 : i32 to i64
%790 = arith.addi %788, %791 : i64
llvm.store %790, %740 : i64, !llvm.ptr
%792 = llvm.load %757 : !llvm.ptr -> i64
llvm.store %792, %744 : i64, !llvm.ptr
cf.br ^bb123
^bb125:
%794 = llvm.mlir.addressof @FACT : !llvm.ptr
%795 = llvm.load %794 : !llvm.ptr -> !llvm.ptr
%796 = llvm.mlir.addressof @NN : !llvm.ptr
%797 = llvm.load %796 : !llvm.ptr -> i64
%798 = llvm.getelementptr %795[%797] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%793 = llvm.load %798 : !llvm.ptr -> f64
%799 = llvm.load %716 : !llvm.ptr -> f64
%800 = arith.divf %793, %799 : f64
%802 = llvm.load %740 : !llvm.ptr -> i64
%801 = func.call @maximal_area(%717, %723, %802) : (!llvm.ptr, !llvm.ptr, i64) -> f64
%804 = llvm.mlir.addressof @FACT : !llvm.ptr
%805 = llvm.load %804 : !llvm.ptr -> !llvm.ptr
%806 = arith.constant 2 : i32
%807 = llvm.mlir.addressof @NN : !llvm.ptr
%808 = llvm.load %807 : !llvm.ptr -> i64
%810 = arith.extsi %806 : i32 to i64
%809 = arith.muli %810, %808 : i64
%811 = arith.constant 4 : i32
%813 = arith.extsi %811 : i32 to i64
%812 = arith.subi %809, %813 : i64
%814 = llvm.getelementptr %805[%812] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%803 = llvm.load %814 : !llvm.ptr -> f64
%816 = llvm.mlir.addressof @FACT : !llvm.ptr
%817 = llvm.load %816 : !llvm.ptr -> !llvm.ptr
%818 = llvm.mlir.addressof @NN : !llvm.ptr
%819 = llvm.load %818 : !llvm.ptr -> i64
%820 = arith.constant 1 : i32
%822 = arith.extsi %820 : i32 to i64
%821 = arith.subi %819, %822 : i64
%823 = llvm.getelementptr %817[%821] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%815 = llvm.load %823 : !llvm.ptr -> f64
%825 = llvm.mlir.addressof @FACT : !llvm.ptr
%826 = llvm.load %825 : !llvm.ptr -> !llvm.ptr
%827 = llvm.mlir.addressof @NN : !llvm.ptr
%828 = llvm.load %827 : !llvm.ptr -> i64
%829 = arith.constant 3 : i32
%831 = arith.extsi %829 : i32 to i64
%830 = arith.subi %828, %831 : i64
%832 = llvm.getelementptr %826[%830] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%824 = llvm.load %832 : !llvm.ptr -> f64
%833 = arith.mulf %815, %824 : f64
%834 = arith.divf %803, %833 : f64
%835 = arith.divf %800, %834 : f64
%836 = arith.mulf %801, %835 : f64
%837 = llvm.mlir.addressof @COMP : !llvm.ptr
%838 = llvm.load %837 : !llvm.ptr -> f64
%839 = arith.subf %836, %838 : f64
%840 = llvm.mlir.addressof @SUM : !llvm.ptr
%841 = llvm.load %840 : !llvm.ptr -> f64
%842 = arith.addf %841, %839 : f64
%843 = llvm.mlir.addressof @SUM : !llvm.ptr
%844 = llvm.load %843 : !llvm.ptr -> f64
%845 = arith.subf %842, %844 : f64
%846 = arith.subf %845, %839 : f64
%847 = llvm.mlir.addressof @COMP : !llvm.ptr
llvm.store %846, %847 : f64, !llvm.ptr
%848 = llvm.mlir.addressof @SUM : !llvm.ptr
llvm.store %842, %848 : f64, !llvm.ptr
func.call @free(%717) : (!llvm.ptr) -> ()
func.call @free(%723) : (!llvm.ptr) -> ()
func.return
^bb121:
cf.br ^bb122
^bb122:
%851 = llvm.mlir.constant(1 : i64) : i64
%852 = llvm.alloca %851 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %852 : i64, !llvm.ptr
%853 = llvm.load %852 : !llvm.ptr -> i64
%854 = arith.cmpi slt, %arg1, %853 : i64
cf.cond_br %854, ^bb129, ^bb130
^bb129:
llvm.store %arg1, %852 : i64, !llvm.ptr
cf.br ^bb131
^bb130:
cf.br ^bb131
^bb131:
cf.br ^bb132
^bb132:
%855 = llvm.load %852 : !llvm.ptr -> i64
%856 = arith.constant 1 : i32
%858 = arith.extsi %856 : i32 to i64
%857 = arith.cmpi sge, %855, %858 : i64
cf.cond_br %857, ^bb133, ^bb134
^bb133:
%859 = llvm.load %852 : !llvm.ptr -> i64
%860 = llvm.mlir.addressof @PARTS : !llvm.ptr
%861 = llvm.load %860 : !llvm.ptr -> !llvm.ptr
%862 = llvm.mlir.addressof @NP : !llvm.ptr
%863 = llvm.load %862 : !llvm.ptr -> i64
%864 = llvm.getelementptr %861[%863] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %859, %864 : i64, !llvm.ptr
%865 = llvm.mlir.addressof @NP : !llvm.ptr
%866 = llvm.load %865 : !llvm.ptr -> i64
%867 = arith.constant 1 : i32
%869 = arith.extsi %867 : i32 to i64
%868 = arith.addi %866, %869 : i64
%870 = llvm.mlir.addressof @NP : !llvm.ptr
llvm.store %868, %870 : i64, !llvm.ptr
%872 = llvm.load %852 : !llvm.ptr -> i64
%873 = arith.subi %arg0, %872 : i64
%874 = llvm.load %852 : !llvm.ptr -> i64
func.call @dfs(%873, %874) : (i64, i64) -> ()
%875 = llvm.mlir.addressof @NP : !llvm.ptr
%876 = llvm.load %875 : !llvm.ptr -> i64
%877 = arith.constant 1 : i32
%879 = arith.extsi %877 : i32 to i64
%878 = arith.subi %876, %879 : i64
%880 = llvm.mlir.addressof @NP : !llvm.ptr
llvm.store %878, %880 : i64, !llvm.ptr
%881 = llvm.load %852 : !llvm.ptr -> i64
%882 = arith.constant 1 : i32
%884 = arith.extsi %882 : i32 to i64
%883 = arith.subi %881, %884 : i64
llvm.store %883, %852 : i64, !llvm.ptr
cf.br ^bb132
^bb134:
func.return
}
func.func @main() -> i32 {
%886 = arith.constant 120 : i32
%887 = arith.constant 8 : i32
%888 = arith.extsi %886 : i32 to i64
%889 = arith.extsi %887 : i32 to i64
%885 = func.call @calloc(%888, %889) : (i64, i64) -> !llvm.ptr
%890 = llvm.mlir.addressof @FACT : !llvm.ptr
llvm.store %885, %890 : !llvm.ptr, !llvm.ptr
%892 = arith.constant 80 : i32
%893 = arith.constant 8 : i32
%894 = arith.extsi %892 : i32 to i64
%895 = arith.extsi %893 : i32 to i64
%891 = func.call @calloc(%894, %895) : (i64, i64) -> !llvm.ptr
%896 = llvm.mlir.addressof @PARTS : !llvm.ptr
llvm.store %891, %896 : !llvm.ptr, !llvm.ptr
%897 = arith.constant 1.0 : f32
%898 = llvm.mlir.addressof @FACT : !llvm.ptr
%899 = llvm.load %898 : !llvm.ptr -> !llvm.ptr
%900 = arith.constant 0 : i32
%901 = arith.extf %897 : f32 to f64
%902 = arith.extsi %900 : i32 to i64
%903 = llvm.getelementptr %899[%902] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %901, %903 : f64, !llvm.ptr
%904 = arith.constant 1.0 : f32
%905 = llvm.mlir.addressof @FACT : !llvm.ptr
%906 = llvm.load %905 : !llvm.ptr -> !llvm.ptr
%907 = arith.constant 1 : i32
%908 = arith.extf %904 : f32 to f64
%909 = arith.extsi %907 : i32 to i64
%910 = llvm.getelementptr %906[%909] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %908, %910 : f64, !llvm.ptr
%911 = arith.constant 2 : i32
%912 = arith.extsi %911 : i32 to i64
%913 = llvm.mlir.constant(1 : i64) : i64
%914 = llvm.alloca %913 x i64 : (i64) -> !llvm.ptr
llvm.store %912, %914 : i64, !llvm.ptr
cf.br ^bb135
^bb135:
%915 = llvm.load %914 : !llvm.ptr -> i64
%916 = arith.constant 110 : i32
%918 = arith.extsi %916 : i32 to i64
%917 = arith.cmpi sle, %915, %918 : i64
cf.cond_br %917, ^bb136, ^bb137
^bb136:
%920 = llvm.mlir.addressof @FACT : !llvm.ptr
%921 = llvm.load %920 : !llvm.ptr -> !llvm.ptr
%922 = llvm.load %914 : !llvm.ptr -> i64
%923 = arith.constant 1 : i32
%925 = arith.extsi %923 : i32 to i64
%924 = arith.subi %922, %925 : i64
%926 = llvm.getelementptr %921[%924] : (!llvm.ptr, i64) -> !llvm.ptr, f64
%919 = llvm.load %926 : !llvm.ptr -> f64
%927 = llvm.load %914 : !llvm.ptr -> i64
%928 = arith.sitofp %927 : i64 to f64
%929 = arith.mulf %919, %928 : f64
%930 = llvm.mlir.addressof @FACT : !llvm.ptr
%931 = llvm.load %930 : !llvm.ptr -> !llvm.ptr
%932 = llvm.load %914 : !llvm.ptr -> i64
%933 = llvm.getelementptr %931[%932] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %929, %933 : f64, !llvm.ptr
%934 = llvm.load %914 : !llvm.ptr -> i64
%935 = arith.constant 1 : i32
%937 = arith.extsi %935 : i32 to i64
%936 = arith.addi %934, %937 : i64
llvm.store %936, %914 : i64, !llvm.ptr
cf.br ^bb135
^bb137:
%938 = arith.constant 0.0 : f32
%939 = arith.extf %938 : f32 to f64
%940 = llvm.mlir.constant(1 : i64) : i64
%941 = llvm.alloca %940 x f64 : (i64) -> !llvm.ptr
llvm.store %939, %941 : f64, !llvm.ptr
%942 = arith.constant 3 : i32
%943 = arith.extsi %942 : i32 to i64
%944 = llvm.mlir.constant(1 : i64) : i64
%945 = llvm.alloca %944 x i64 : (i64) -> !llvm.ptr
llvm.store %943, %945 : i64, !llvm.ptr
cf.br ^bb138
^bb138:
%946 = llvm.load %945 : !llvm.ptr -> i64
%947 = arith.constant 50 : i32
%949 = arith.extsi %947 : i32 to i64
%948 = arith.cmpi sle, %946, %949 : i64
cf.cond_br %948, ^bb139, ^bb140
^bb139:
%950 = llvm.load %945 : !llvm.ptr -> i64
%951 = llvm.mlir.addressof @NN : !llvm.ptr
llvm.store %950, %951 : i64, !llvm.ptr
%952 = arith.constant 0 : i32
%953 = arith.extsi %952 : i32 to i64
%954 = llvm.mlir.addressof @NP : !llvm.ptr
llvm.store %953, %954 : i64, !llvm.ptr
%955 = arith.constant 0.0 : f32
%956 = arith.extf %955 : f32 to f64
%957 = llvm.mlir.addressof @SUM : !llvm.ptr
llvm.store %956, %957 : f64, !llvm.ptr
%958 = arith.constant 0.0 : f32
%959 = arith.extf %958 : f32 to f64
%960 = llvm.mlir.addressof @COMP : !llvm.ptr
llvm.store %959, %960 : f64, !llvm.ptr
%962 = llvm.load %945 : !llvm.ptr -> i64
%963 = arith.constant 3 : i32
%965 = arith.extsi %963 : i32 to i64
%964 = arith.subi %962, %965 : i64
%966 = llvm.load %945 : !llvm.ptr -> i64
%967 = arith.constant 3 : i32
%969 = arith.extsi %967 : i32 to i64
%968 = arith.subi %966, %969 : i64
func.call @dfs(%964, %968) : (i64, i64) -> ()
%970 = llvm.load %941 : !llvm.ptr -> f64
%971 = llvm.mlir.addressof @SUM : !llvm.ptr
%972 = llvm.load %971 : !llvm.ptr -> f64
%973 = arith.addf %970, %972 : f64
llvm.store %973, %941 : f64, !llvm.ptr
%974 = llvm.load %945 : !llvm.ptr -> i64
%975 = arith.constant 1 : i32
%977 = arith.extsi %975 : i32 to i64
%976 = arith.addi %974, %977 : i64
llvm.store %976, %945 : i64, !llvm.ptr
cf.br ^bb138
^bb140:
%978 = llvm.mlir.addressof @str_0 : !llvm.ptr
%979 = llvm.load %941 : !llvm.ptr -> f64
%980 = llvm.call @printf(%978, %979) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
%982 = llvm.mlir.addressof @FACT : !llvm.ptr
%983 = llvm.load %982 : !llvm.ptr -> !llvm.ptr
func.call @free(%983) : (!llvm.ptr) -> ()
%985 = llvm.mlir.addressof @PARTS : !llvm.ptr
%986 = llvm.load %985 : !llvm.ptr -> !llvm.ptr
func.call @free(%986) : (!llvm.ptr) -> ()
%987 = arith.constant 0 : i32
func.return %987 : i32
}
}