← All problems
Problem 418
f(43!)=a+b+c minimising c/a among a<=b<=c with abc=43!. Meet-in-the-middle near cube root; verify via prime-exponent vectors.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^3)?
Space complexity O(n^2)?
Approach Flow solution Not curated
Verdict Unknown
Flow source
# Project Euler 418
# f(43!)=a+b+c minimising c/a among a<=b<=c with abc=43!.
# Meet-in-the-middle near cube root; verify via prime-exponent vectors.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function log(x: f64) -> f64
function exp(x: f64) -> f64
}
function mul_fit(a: i64, b: i64) -> i64 {
if a <= 0 || b <= 0 { return -1 }
let lim: i64 = 9223372036854775807
if a > lim / b { return -1 }
return a * b
}
function sort_i64(a: ptr<i64>, n: i64) -> void {
if n <= 1 { return }
let mut i: i64 = n / 2
while i >= 0 {
let mut root: i64 = i
while true {
let mut child: i64 = 2 * root + 1
if child >= n { break }
if child + 1 < n && a[child] < a[child + 1] { child = child + 1 }
if a[root] >= a[child] { break }
let t: i64 = a[root]
a[root] = a[child]
a[child] = t
root = child
}
i = i - 1
}
let mut end: i64 = n - 1
while end > 0 {
let t: i64 = a[0]
a[0] = a[end]
a[end] = t
let mut root: i64 = 0
while true {
let mut child: i64 = 2 * root + 1
if child >= end { break }
if child + 1 < end && a[child] < a[child + 1] { child = child + 1 }
if a[root] >= a[child] { break }
let t2: i64 = a[root]
a[root] = a[child]
a[child] = t2
root = child
}
end = end - 1
}
}
function lower_bound(a: ptr<i64>, n: i64, x: i64) -> i64 {
let mut lo: i64 = 0
let mut hi: i64 = n
while lo < hi {
let mid: i64 = (lo + hi) / 2
if a[mid] < x { lo = mid + 1 } else { hi = mid }
}
return lo
}
function upper_bound(a: ptr<i64>, n: i64, x: i64) -> i64 {
let mut lo: i64 = 0
let mut hi: i64 = n
while lo < hi {
let mid: i64 = (lo + hi) / 2
if a[mid] <= x { lo = mid + 1 } else { hi = mid }
}
return lo
}
function factor_exps(v0: i64, P: ptr<i64>, np: i64, out: ptr<i32>) -> bool {
let mut v: i64 = v0
let mut i: i64 = 0
while i < np {
out[i] = 0
let p: i64 = P[i]
while v % p == 0 {
out[i] = out[i] + 1
v = v / p
}
i = i + 1
}
return v == 1
}
function main() -> i32 {
let K: i64 = 43
let P: array<i64, 14> = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43]
let Eneed: array<i64, 14> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let mut i: i64 = 0
while i < 14 {
let p: i64 = P[i]
let mut n: i64 = K
let mut s: i64 = 0
while n > 0 {
n = n / p
s = s + n
}
Eneed[i] = s
i = i + 1
}
let mut dcount: i64 = 1
let mut split: i64 = 0
i = 0
while i < 14 {
if i > 0 && dcount * (Eneed[i] + 1) > 1000000 { break }
dcount = dcount * (Eneed[i] + 1)
split = i + 1
i = i + 1
}
let max1: i64 = dcount + 10
let divs1: ptr<i64> = calloc(max1, 8)
let tmp: ptr<i64> = calloc(max1, 8)
if divs1 == null || tmp == null { return 1 }
divs1[0] = 1
let mut n1: i64 = 1
i = 0
while i < split {
let p: i64 = P[i]
let e: i64 = Eneed[i]
let mut pe: i64 = 1
let mut nnew: i64 = 0
let mut t: i64 = 0
while t <= e {
let mut j: i64 = 0
while j < n1 {
let v: i64 = mul_fit(divs1[j], pe)
if v >= 0 {
tmp[nnew] = v
nnew = nnew + 1
}
j = j + 1
}
let npe: i64 = mul_fit(pe, p)
if npe < 0 { break }
pe = npe
t = t + 1
}
let mut j: i64 = 0
while j < nnew {
divs1[j] = tmp[j]
j = j + 1
}
n1 = nnew
i = i + 1
}
sort_i64(divs1, n1)
let mut dcount2: i64 = 1
i = split
while i < 14 {
dcount2 = dcount2 * (Eneed[i] + 1)
i = i + 1
}
let divs2: ptr<i64> = calloc(dcount2 + 10, 8)
if divs2 == null { return 1 }
divs2[0] = 1
let mut n2: i64 = 1
i = split
while i < 14 {
let p: i64 = P[i]
let e: i64 = Eneed[i]
let mut pe: i64 = 1
let mut nnew: i64 = 0
let mut t: i64 = 0
while t <= e {
let mut j: i64 = 0
while j < n2 {
let v: i64 = mul_fit(divs2[j], pe)
if v >= 0 {
tmp[nnew] = v
nnew = nnew + 1
}
j = j + 1
}
let npe: i64 = mul_fit(pe, p)
if npe < 0 { break }
pe = npe
t = t + 1
}
let mut j: i64 = 0
while j < nnew {
divs2[j] = tmp[j]
j = j + 1
}
n2 = nnew
i = i + 1
}
let mut logn: f64 = 0.0
i = 0
while i < 14 {
logn = logn + (Eneed[i] as f64) * log(P[i] as f64)
i = i + 1
}
let cbrt: f64 = exp(logn / 3.0)
let ea: ptr<i32> = calloc(14, 4)
let ec: ptr<i32> = calloc(14, 4)
let Pp: ptr<i64> = calloc(14, 8)
i = 0
while i < 14 {
Pp[i] = P[i]
i = i + 1
}
let mut best_a: i64 = 0
let mut best_c: i64 = 0
let mut best_sum: i64 = 0
let mut found: i32 = 0
let mut delta: f64 = 0.00001
while delta <= 0.05 {
let mut aL: i64 = (cbrt / (1.0 + delta)) as i64 - 2
if aL < 1 { aL = 1 }
let aH: i64 = (cbrt as i64) + 2
let mut cL: i64 = (cbrt as i64) - 2
if cL < 1 { cL = 1 }
let cH: i64 = (cbrt * (1.0 + delta)) as i64 + 2
let acap: i64 = 500000
let alist: ptr<i64> = calloc(acap, 8)
let clist: ptr<i64> = calloc(acap, 8)
if alist == null || clist == null { return 1 }
let mut na: i64 = 0
let mut nc: i64 = 0
let mut j2: i64 = 0
while j2 < n2 {
let d2: i64 = divs2[j2]
if d2 > 0 {
let mut lo: i64 = aL / d2
if aL % d2 != 0 { lo = lo + 1 }
let mut hi: i64 = aH / d2
if lo <= hi {
let i0: i64 = lower_bound(divs1, n1, lo)
let i1: i64 = upper_bound(divs1, n1, hi)
let mut t: i64 = i0
while t < i1 {
let v: i64 = mul_fit(divs1[t], d2)
if v >= aL && v <= aH && na < acap {
alist[na] = v
na = na + 1
}
t = t + 1
}
}
lo = cL / d2
if cL % d2 != 0 { lo = lo + 1 }
hi = cH / d2
if lo <= hi {
let i0: i64 = lower_bound(divs1, n1, lo)
let i1: i64 = upper_bound(divs1, n1, hi)
let mut t: i64 = i0
while t < i1 {
let v: i64 = mul_fit(divs1[t], d2)
if v >= cL && v <= cH && nc < acap {
clist[nc] = v
nc = nc + 1
}
t = t + 1
}
}
}
j2 = j2 + 1
}
if na > 0 && nc > 0 {
let prod: i128 = (na as i128) * (nc as i128)
if prod <= (50000000 as i128) {
sort_i64(clist, nc)
let mut ia: i64 = 0
while ia < na {
let a: i64 = alist[ia]
if factor_exps(a, Pp, 14, ea) {
let mut ic: i64 = 0
while ic < nc {
let c: i64 = clist[ic]
if c >= a && factor_exps(c, Pp, 14, ec) {
let mut ok: bool = true
let mut bi: i64 = 0
while bi < 14 {
if (ea[bi] as i64) + (ec[bi] as i64) > Eneed[bi] {
ok = false
break
}
bi = bi + 1
}
if ok {
# build b from remaining exponents
let mut b: i64 = 1
bi = 0
while bi < 14 {
let rem: i64 = Eneed[bi] - (ea[bi] as i64) - (ec[bi] as i64)
let mut t: i64 = 0
while t < rem {
let nb: i64 = mul_fit(b, P[bi])
if nb < 0 { ok = false; break }
b = nb
t = t + 1
}
if !ok { break }
bi = bi + 1
}
if ok && a <= b && b <= c {
let better: bool = found == 0
if !better {
if (c as i128) * (best_a as i128) < (best_c as i128) * (a as i128) {
better = true
}
}
if better {
best_a = a
best_c = c
best_sum = a + b + c
found = 1
}
}
}
}
ic = ic + 1
}
}
ia = ia + 1
}
}
}
free(alist)
free(clist)
if found != 0 { break }
delta = delta * 2.0
}
printf("%lld\n", best_sum)
free(Pp)
free(ec)
free(ea)
free(divs2)
free(tmp)
free(divs1)
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; }
int64_t mul_fit_i64_i64(int64_t a, int64_t b);
void sort_i64_ptr_i64_i64(int64_t* a, int64_t n);
int64_t lower_bound_ptr_i64_i64_i64(int64_t* a, int64_t n, int64_t x);
int64_t upper_bound_ptr_i64_i64_i64(int64_t* a, int64_t n, int64_t x);
bool factor_exps_i64_ptr_i64_i64_ptr_i32(int64_t v0, int64_t* P, int64_t np, int32_t* out);
int32_t main(void);
int64_t mul_fit_i64_i64(int64_t a, int64_t b) {
if ((a <= 0 || b <= 0)) {
return (-1);
}
int64_t lim = 9223372036854775807;
if (a > FLOW_CHECKED_DIV((lim), (b))) {
return (-1);
}
return (a * b);
}
void sort_i64_ptr_i64_i64(int64_t* a, int64_t n) {
if (n <= 1) {
return;
}
int64_t i = FLOW_CHECKED_DIV((n), (2));
while (i >= 0) {
int64_t root = i;
while (1) {
int64_t child = ((2 * root) + 1);
if (child >= n) {
break;
}
if (((child + 1) < n && a[child] < a[(child + 1)])) {
child = (child + 1);
}
if (a[root] >= a[child]) {
break;
}
int64_t t = a[root];
a[root] = a[child];
a[child] = t;
root = child;
}
i = (i - 1);
}
int64_t end = (n - 1);
while (end > 0) {
int64_t t = a[0];
a[0] = a[end];
a[end] = t;
int64_t root = 0;
while (1) {
int64_t child = ((2 * root) + 1);
if (child >= end) {
break;
}
if (((child + 1) < end && a[child] < a[(child + 1)])) {
child = (child + 1);
}
if (a[root] >= a[child]) {
break;
}
int64_t t2 = a[root];
a[root] = a[child];
a[child] = t2;
root = child;
}
end = (end - 1);
}
}
int64_t lower_bound_ptr_i64_i64_i64(int64_t* a, int64_t n, int64_t x) {
int64_t lo = 0;
int64_t hi = n;
while (lo < hi) {
int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
if (a[mid] < x) {
lo = (mid + 1);
} else {
hi = mid;
}
}
return lo;
}
int64_t upper_bound_ptr_i64_i64_i64(int64_t* a, int64_t n, int64_t x) {
int64_t lo = 0;
int64_t hi = n;
while (lo < hi) {
int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
if (a[mid] <= x) {
lo = (mid + 1);
} else {
hi = mid;
}
}
return lo;
}
bool factor_exps_i64_ptr_i64_i64_ptr_i32(int64_t v0, int64_t* P, int64_t np, int32_t* out) {
int64_t v = v0;
int64_t i = 0;
while (i < np) {
out[i] = 0;
int64_t p = P[i];
while (FLOW_CHECKED_MOD((v), (p)) == 0) {
out[i] = (out[i] + 1);
v = FLOW_CHECKED_DIV((v), (p));
}
i = (i + 1);
}
return v == 1;
}
int32_t main(void) {
int64_t K = 43;
int64_t P[14] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 };
int64_t Eneed[14] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int64_t i = 0;
while (i < 14) {
int64_t p = (((unsigned)(i) < 14) ? P[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), P[0]));
int64_t n = K;
int64_t s = 0;
while (n > 0) {
n = FLOW_CHECKED_DIV((n), (p));
s = (s + n);
}
Eneed[i] = s;
i = (i + 1);
}
int64_t dcount = 1;
int64_t split = 0;
i = 0;
while (i < 14) {
if ((i > 0 && (dcount * ((((unsigned)(i) < 14) ? Eneed[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), Eneed[0])) + 1)) > 1000000)) {
break;
}
dcount = (dcount * ((((unsigned)(i) < 14) ? Eneed[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), Eneed[0])) + 1));
split = (i + 1);
i = (i + 1);
}
int64_t max1 = (dcount + 10);
int64_t* divs1 = (int64_t*)(calloc(max1, 8));
int64_t* tmp = (int64_t*)(calloc(max1, 8));
if ((divs1 == NULL || tmp == NULL)) {
return 1;
}
divs1[0] = 1;
int64_t n1 = 1;
i = 0;
while (i < split) {
int64_t p = (((unsigned)(i) < 14) ? P[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), P[0]));
int64_t e = (((unsigned)(i) < 14) ? Eneed[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), Eneed[0]));
int64_t pe = 1;
int64_t nnew = 0;
int64_t t = 0;
while (t <= e) {
int64_t j = 0;
while (j < n1) {
int64_t v = mul_fit_i64_i64(divs1[j], pe);
if (v >= 0) {
tmp[nnew] = v;
nnew = (nnew + 1);
}
j = (j + 1);
}
int64_t npe = mul_fit_i64_i64(pe, p);
if (npe < 0) {
break;
}
pe = npe;
t = (t + 1);
}
int64_t j = 0;
while (j < nnew) {
divs1[j] = tmp[j];
j = (j + 1);
}
n1 = nnew;
i = (i + 1);
}
sort_i64_ptr_i64_i64(divs1, n1);
int64_t dcount2 = 1;
i = split;
while (i < 14) {
dcount2 = (dcount2 * ((((unsigned)(i) < 14) ? Eneed[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), Eneed[0])) + 1));
i = (i + 1);
}
int64_t* divs2 = (int64_t*)(calloc((dcount2 + 10), 8));
if (divs2 == NULL) {
return 1;
}
divs2[0] = 1;
int64_t n2 = 1;
i = split;
while (i < 14) {
int64_t p = (((unsigned)(i) < 14) ? P[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), P[0]));
int64_t e = (((unsigned)(i) < 14) ? Eneed[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), Eneed[0]));
int64_t pe = 1;
int64_t nnew = 0;
int64_t t = 0;
while (t <= e) {
int64_t j = 0;
while (j < n2) {
int64_t v = mul_fit_i64_i64(divs2[j], pe);
if (v >= 0) {
tmp[nnew] = v;
nnew = (nnew + 1);
}
j = (j + 1);
}
int64_t npe = mul_fit_i64_i64(pe, p);
if (npe < 0) {
break;
}
pe = npe;
t = (t + 1);
}
int64_t j = 0;
while (j < nnew) {
divs2[j] = tmp[j];
j = (j + 1);
}
n2 = nnew;
i = (i + 1);
}
double logn = 0.0;
i = 0;
while (i < 14) {
logn = (logn + (((double)((((unsigned)(i) < 14) ? Eneed[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), Eneed[0])))) * log(((double)((((unsigned)(i) < 14) ? P[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), P[0])))))));
i = (i + 1);
}
double cbrt = exp((logn / 3.0));
int32_t* ea = (int32_t*)(calloc(14, 4));
int32_t* ec = (int32_t*)(calloc(14, 4));
int64_t* Pp = (int64_t*)(calloc(14, 8));
i = 0;
while (i < 14) {
Pp[i] = (((unsigned)(i) < 14) ? P[i] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i), 14), flow_fault_handler("array index out of bounds"), P[0]));
i = (i + 1);
}
int64_t best_a = 0;
int64_t best_c = 0;
int64_t best_sum = 0;
int32_t found = 0;
double delta = 0.00001;
while (delta <= 0.05) {
int64_t aL = (((int64_t)((cbrt / (1.0 + delta)))) - 2);
if (aL < 1) {
aL = 1;
}
int64_t aH = (((int64_t)(cbrt)) + 2);
int64_t cL = (((int64_t)(cbrt)) - 2);
if (cL < 1) {
cL = 1;
}
int64_t cH = (((int64_t)((cbrt * (1.0 + delta)))) + 2);
int64_t acap = 500000;
int64_t* alist = (int64_t*)(calloc(acap, 8));
int64_t* clist = (int64_t*)(calloc(acap, 8));
if ((alist == NULL || clist == NULL)) {
return 1;
}
int64_t na = 0;
int64_t nc = 0;
int64_t j2 = 0;
while (j2 < n2) {
int64_t d2 = divs2[j2];
if (d2 > 0) {
int64_t lo = FLOW_CHECKED_DIV((aL), (d2));
if (FLOW_CHECKED_MOD((aL), (d2)) != 0) {
lo = (lo + 1);
}
int64_t hi = FLOW_CHECKED_DIV((aH), (d2));
if (lo <= hi) {
int64_t i0 = lower_bound_ptr_i64_i64_i64(divs1, n1, lo);
int64_t i1 = upper_bound_ptr_i64_i64_i64(divs1, n1, hi);
int64_t t = i0;
while (t < i1) {
int64_t v = mul_fit_i64_i64(divs1[t], d2);
if (((v >= aL && v <= aH) && na < acap)) {
alist[na] = v;
na = (na + 1);
}
t = (t + 1);
}
}
lo = FLOW_CHECKED_DIV((cL), (d2));
if (FLOW_CHECKED_MOD((cL), (d2)) != 0) {
lo = (lo + 1);
}
hi = FLOW_CHECKED_DIV((cH), (d2));
if (lo <= hi) {
int64_t i0 = lower_bound_ptr_i64_i64_i64(divs1, n1, lo);
int64_t i1 = upper_bound_ptr_i64_i64_i64(divs1, n1, hi);
int64_t t = i0;
while (t < i1) {
int64_t v = mul_fit_i64_i64(divs1[t], d2);
if (((v >= cL && v <= cH) && nc < acap)) {
clist[nc] = v;
nc = (nc + 1);
}
t = (t + 1);
}
}
}
j2 = (j2 + 1);
}
if ((na > 0 && nc > 0)) {
__int128 prod = (((__int128)(na)) * ((__int128)(nc)));
if (prod <= ((__int128)(50000000))) {
sort_i64_ptr_i64_i64(clist, nc);
int64_t ia = 0;
while (ia < na) {
int64_t a = alist[ia];
if (factor_exps_i64_ptr_i64_i64_ptr_i32(a, Pp, 14, ea)) {
int64_t ic = 0;
while (ic < nc) {
int64_t c = clist[ic];
if ((c >= a && factor_exps_i64_ptr_i64_i64_ptr_i32(c, Pp, 14, ec))) {
bool ok = 1;
int64_t bi = 0;
while (bi < 14) {
if ((((int64_t)(ea[bi])) + ((int64_t)(ec[bi]))) > (((unsigned)(bi) < 14) ? Eneed[bi] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(bi), 14), flow_fault_handler("array index out of bounds"), Eneed[0]))) {
ok = 0;
break;
}
bi = (bi + 1);
}
if (ok) {
int64_t b = 1;
bi = 0;
while (bi < 14) {
int64_t rem = (((((unsigned)(bi) < 14) ? Eneed[bi] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(bi), 14), flow_fault_handler("array index out of bounds"), Eneed[0])) - ((int64_t)(ea[bi]))) - ((int64_t)(ec[bi])));
int64_t t = 0;
while (t < rem) {
int64_t nb = mul_fit_i64_i64(b, (((unsigned)(bi) < 14) ? P[bi] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(bi), 14), flow_fault_handler("array index out of bounds"), P[0])));
if (nb < 0) {
ok = 0;
break;
}
b = nb;
t = (t + 1);
}
if ((!(ok))) {
break;
}
bi = (bi + 1);
}
if (((ok && a <= b) && b <= c)) {
bool better = found == 0;
if ((!(better))) {
if ((((__int128)(c)) * ((__int128)(best_a))) < (((__int128)(best_c)) * ((__int128)(a)))) {
better = 1;
}
}
if (better) {
best_a = a;
best_c = c;
best_sum = ((a + b) + c);
found = 1;
}
}
}
}
ic = (ic + 1);
}
}
ia = (ia + 1);
}
}
}
free(alist);
free(clist);
if (found != 0) {
break;
}
delta = (delta * 2.0);
}
printf("%lld\n", best_sum);
free(Pp);
free(ec);
free(ea);
free(divs2);
free(tmp);
free(divs1);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%lld\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 @log(f64) -> f64
func.func private @exp(f64) -> f64
func.func @mul_fit(%arg0: i64, %arg1: i64) -> i64 {
%0 = arith.constant 0 : i32
%2 = arith.extsi %0 : i32 to i64
%1 = arith.cmpi sle, %arg0, %2 : i64
%3 = scf.if %1 -> (i1) {
%4 = arith.constant true
scf.yield %4 : i1
} else {
%5 = arith.constant 0 : i32
%7 = arith.extsi %5 : i32 to i64
%6 = arith.cmpi sle, %arg1, %7 : i64
scf.yield %6 : i1
}
cf.cond_br %3, ^bb0, ^bb1
^bb0:
%8 = arith.constant 1 : i32
%10 = arith.constant 0 : i32
%9 = arith.subi %10, %8 : i32
%11 = arith.extsi %9 : i32 to i64
func.return %11 : i64
^bb1:
cf.br ^bb2
^bb2:
%12 = arith.constant 9223372032559808511 : i32
%13 = arith.extsi %12 : i32 to i64
%14 = arith.divsi %13, %arg1 : i64
%15 = arith.cmpi sgt, %arg0, %14 : i64
cf.cond_br %15, ^bb3, ^bb4
^bb3:
%16 = arith.constant 1 : i32
%18 = arith.constant 0 : i32
%17 = arith.subi %18, %16 : i32
%19 = arith.extsi %17 : i32 to i64
func.return %19 : i64
^bb4:
cf.br ^bb5
^bb5:
%20 = arith.muli %arg0, %arg1 : i64
func.return %20 : i64
}
func.func @sort_i64(%arg0: !llvm.ptr, %arg1: i64) -> () {
%21 = arith.constant 1 : i32
%23 = arith.extsi %21 : i32 to i64
%22 = arith.cmpi sle, %arg1, %23 : i64
cf.cond_br %22, ^bb6, ^bb7
^bb6:
func.return
^bb7:
cf.br ^bb8
^bb8:
%24 = arith.constant 2 : i32
%26 = arith.extsi %24 : i32 to i64
%25 = arith.divsi %arg1, %26 : i64
%27 = llvm.mlir.constant(1 : i64) : i64
%28 = llvm.alloca %27 x i64 : (i64) -> !llvm.ptr
llvm.store %25, %28 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%29 = llvm.load %28 : !llvm.ptr -> i64
%30 = arith.constant 0 : i32
%32 = arith.extsi %30 : i32 to i64
%31 = arith.cmpi sge, %29, %32 : i64
cf.cond_br %31, ^bb10, ^bb11
^bb10:
%33 = llvm.load %28 : !llvm.ptr -> i64
%34 = llvm.mlir.constant(1 : i64) : i64
%35 = llvm.alloca %34 x i64 : (i64) -> !llvm.ptr
llvm.store %33, %35 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%36 = arith.constant 1 : i1
cf.cond_br %36, ^bb13, ^bb14
^bb13:
%37 = arith.constant 2 : i32
%38 = llvm.load %35 : !llvm.ptr -> i64
%40 = arith.extsi %37 : i32 to i64
%39 = arith.muli %40, %38 : i64
%41 = arith.constant 1 : i32
%43 = arith.extsi %41 : i32 to i64
%42 = arith.addi %39, %43 : i64
%44 = llvm.mlir.constant(1 : i64) : i64
%45 = llvm.alloca %44 x i64 : (i64) -> !llvm.ptr
llvm.store %42, %45 : i64, !llvm.ptr
%46 = llvm.load %45 : !llvm.ptr -> i64
%47 = arith.cmpi sge, %46, %arg1 : i64
cf.cond_br %47, ^bb15, ^bb16
^bb15:
cf.br ^bb14
^bb16:
cf.br ^bb17
^bb17:
%48 = llvm.load %45 : !llvm.ptr -> i64
%49 = arith.constant 1 : i32
%51 = arith.extsi %49 : i32 to i64
%50 = arith.addi %48, %51 : i64
%52 = arith.cmpi slt, %50, %arg1 : i64
%53 = scf.if %52 -> (i1) {
%55 = llvm.load %45 : !llvm.ptr -> i64
%56 = llvm.getelementptr %arg0[%55] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%54 = llvm.load %56 : !llvm.ptr -> i64
%58 = llvm.load %45 : !llvm.ptr -> i64
%59 = arith.constant 1 : i32
%61 = arith.extsi %59 : i32 to i64
%60 = arith.addi %58, %61 : i64
%62 = llvm.getelementptr %arg0[%60] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%57 = llvm.load %62 : !llvm.ptr -> i64
%63 = arith.cmpi slt, %54, %57 : i64
scf.yield %63 : i1
} else {
%64 = arith.constant false
scf.yield %64 : i1
}
cf.cond_br %53, ^bb18, ^bb19
^bb18:
%65 = llvm.load %45 : !llvm.ptr -> i64
%66 = arith.constant 1 : i32
%68 = arith.extsi %66 : i32 to i64
%67 = arith.addi %65, %68 : i64
llvm.store %67, %45 : i64, !llvm.ptr
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
%70 = llvm.load %35 : !llvm.ptr -> i64
%71 = llvm.getelementptr %arg0[%70] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%69 = llvm.load %71 : !llvm.ptr -> i64
%73 = llvm.load %45 : !llvm.ptr -> i64
%74 = llvm.getelementptr %arg0[%73] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%72 = llvm.load %74 : !llvm.ptr -> i64
%75 = arith.cmpi sge, %69, %72 : i64
cf.cond_br %75, ^bb21, ^bb22
^bb21:
cf.br ^bb14
^bb22:
cf.br ^bb23
^bb23:
%77 = llvm.load %35 : !llvm.ptr -> i64
%78 = llvm.getelementptr %arg0[%77] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%76 = llvm.load %78 : !llvm.ptr -> i64
%80 = llvm.load %45 : !llvm.ptr -> i64
%81 = llvm.getelementptr %arg0[%80] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%79 = llvm.load %81 : !llvm.ptr -> i64
%82 = llvm.load %35 : !llvm.ptr -> i64
%83 = llvm.getelementptr %arg0[%82] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %79, %83 : i64, !llvm.ptr
%84 = llvm.load %45 : !llvm.ptr -> i64
%85 = llvm.getelementptr %arg0[%84] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %76, %85 : i64, !llvm.ptr
%86 = llvm.load %45 : !llvm.ptr -> i64
llvm.store %86, %35 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%87 = llvm.load %28 : !llvm.ptr -> i64
%88 = arith.constant 1 : i32
%90 = arith.extsi %88 : i32 to i64
%89 = arith.subi %87, %90 : i64
llvm.store %89, %28 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
%91 = arith.constant 1 : i32
%93 = arith.extsi %91 : i32 to i64
%92 = arith.subi %arg1, %93 : i64
%94 = llvm.mlir.constant(1 : i64) : i64
%95 = llvm.alloca %94 x i64 : (i64) -> !llvm.ptr
llvm.store %92, %95 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%96 = llvm.load %95 : !llvm.ptr -> i64
%97 = arith.constant 0 : i32
%99 = arith.extsi %97 : i32 to i64
%98 = arith.cmpi sgt, %96, %99 : i64
cf.cond_br %98, ^bb25, ^bb26
^bb25:
%101 = arith.constant 0 : i32
%102 = arith.extsi %101 : i32 to i64
%103 = llvm.getelementptr %arg0[%102] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%100 = llvm.load %103 : !llvm.ptr -> i64
%105 = llvm.load %95 : !llvm.ptr -> i64
%106 = llvm.getelementptr %arg0[%105] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%104 = llvm.load %106 : !llvm.ptr -> i64
%107 = arith.constant 0 : i32
%108 = arith.extsi %107 : i32 to i64
%109 = llvm.getelementptr %arg0[%108] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %104, %109 : i64, !llvm.ptr
%110 = llvm.load %95 : !llvm.ptr -> i64
%111 = llvm.getelementptr %arg0[%110] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %100, %111 : i64, !llvm.ptr
%112 = arith.constant 0 : i32
%113 = arith.extsi %112 : i32 to i64
%114 = llvm.mlir.constant(1 : i64) : i64
%115 = llvm.alloca %114 x i64 : (i64) -> !llvm.ptr
llvm.store %113, %115 : i64, !llvm.ptr
cf.br ^bb27
^bb27:
%116 = arith.constant 1 : i1
cf.cond_br %116, ^bb28, ^bb29
^bb28:
%117 = arith.constant 2 : i32
%118 = llvm.load %115 : !llvm.ptr -> i64
%120 = arith.extsi %117 : i32 to i64
%119 = arith.muli %120, %118 : i64
%121 = arith.constant 1 : i32
%123 = arith.extsi %121 : i32 to i64
%122 = arith.addi %119, %123 : i64
%124 = llvm.mlir.constant(1 : i64) : i64
%125 = llvm.alloca %124 x i64 : (i64) -> !llvm.ptr
llvm.store %122, %125 : i64, !llvm.ptr
%126 = llvm.load %125 : !llvm.ptr -> i64
%127 = llvm.load %95 : !llvm.ptr -> i64
%128 = arith.cmpi sge, %126, %127 : i64
cf.cond_br %128, ^bb30, ^bb31
^bb30:
cf.br ^bb29
^bb31:
cf.br ^bb32
^bb32:
%129 = llvm.load %125 : !llvm.ptr -> i64
%130 = arith.constant 1 : i32
%132 = arith.extsi %130 : i32 to i64
%131 = arith.addi %129, %132 : i64
%133 = llvm.load %95 : !llvm.ptr -> i64
%134 = arith.cmpi slt, %131, %133 : i64
%135 = scf.if %134 -> (i1) {
%137 = llvm.load %125 : !llvm.ptr -> i64
%138 = llvm.getelementptr %arg0[%137] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%136 = llvm.load %138 : !llvm.ptr -> i64
%140 = llvm.load %125 : !llvm.ptr -> i64
%141 = arith.constant 1 : i32
%143 = arith.extsi %141 : i32 to i64
%142 = arith.addi %140, %143 : i64
%144 = llvm.getelementptr %arg0[%142] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%139 = llvm.load %144 : !llvm.ptr -> i64
%145 = arith.cmpi slt, %136, %139 : i64
scf.yield %145 : i1
} else {
%146 = arith.constant false
scf.yield %146 : i1
}
cf.cond_br %135, ^bb33, ^bb34
^bb33:
%147 = llvm.load %125 : !llvm.ptr -> i64
%148 = arith.constant 1 : i32
%150 = arith.extsi %148 : i32 to i64
%149 = arith.addi %147, %150 : i64
llvm.store %149, %125 : i64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%152 = llvm.load %115 : !llvm.ptr -> i64
%153 = llvm.getelementptr %arg0[%152] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%151 = llvm.load %153 : !llvm.ptr -> i64
%155 = llvm.load %125 : !llvm.ptr -> i64
%156 = llvm.getelementptr %arg0[%155] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%154 = llvm.load %156 : !llvm.ptr -> i64
%157 = arith.cmpi sge, %151, %154 : i64
cf.cond_br %157, ^bb36, ^bb37
^bb36:
cf.br ^bb29
^bb37:
cf.br ^bb38
^bb38:
%159 = llvm.load %115 : !llvm.ptr -> i64
%160 = llvm.getelementptr %arg0[%159] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%158 = llvm.load %160 : !llvm.ptr -> i64
%162 = llvm.load %125 : !llvm.ptr -> i64
%163 = llvm.getelementptr %arg0[%162] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%161 = llvm.load %163 : !llvm.ptr -> i64
%164 = llvm.load %115 : !llvm.ptr -> i64
%165 = llvm.getelementptr %arg0[%164] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %161, %165 : i64, !llvm.ptr
%166 = llvm.load %125 : !llvm.ptr -> i64
%167 = llvm.getelementptr %arg0[%166] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %158, %167 : i64, !llvm.ptr
%168 = llvm.load %125 : !llvm.ptr -> i64
llvm.store %168, %115 : i64, !llvm.ptr
cf.br ^bb27
^bb29:
%169 = llvm.load %95 : !llvm.ptr -> i64
%170 = arith.constant 1 : i32
%172 = arith.extsi %170 : i32 to i64
%171 = arith.subi %169, %172 : i64
llvm.store %171, %95 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
func.return
}
func.func @lower_bound(%arg0: !llvm.ptr, %arg1: i64, %arg2: i64) -> i64 {
%173 = arith.constant 0 : i32
%174 = arith.extsi %173 : i32 to i64
%175 = llvm.mlir.constant(1 : i64) : i64
%176 = llvm.alloca %175 x i64 : (i64) -> !llvm.ptr
llvm.store %174, %176 : i64, !llvm.ptr
%177 = llvm.mlir.constant(1 : i64) : i64
%178 = llvm.alloca %177 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %178 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%179 = llvm.load %176 : !llvm.ptr -> i64
%180 = llvm.load %178 : !llvm.ptr -> i64
%181 = arith.cmpi slt, %179, %180 : i64
cf.cond_br %181, ^bb40, ^bb41
^bb40:
%182 = llvm.load %176 : !llvm.ptr -> i64
%183 = llvm.load %178 : !llvm.ptr -> i64
%184 = arith.addi %182, %183 : i64
%185 = arith.constant 2 : i32
%187 = arith.extsi %185 : i32 to i64
%186 = arith.divsi %184, %187 : i64
%189 = llvm.getelementptr %arg0[%186] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%188 = llvm.load %189 : !llvm.ptr -> i64
%190 = arith.cmpi slt, %188, %arg2 : i64
cf.cond_br %190, ^bb42, ^bb43
^bb42:
%191 = arith.constant 1 : i32
%193 = arith.extsi %191 : i32 to i64
%192 = arith.addi %186, %193 : i64
llvm.store %192, %176 : i64, !llvm.ptr
cf.br ^bb44
^bb43:
llvm.store %186, %178 : i64, !llvm.ptr
cf.br ^bb44
^bb44:
cf.br ^bb39
^bb41:
%194 = llvm.load %176 : !llvm.ptr -> i64
func.return %194 : i64
}
func.func @upper_bound(%arg0: !llvm.ptr, %arg1: i64, %arg2: i64) -> i64 {
%195 = arith.constant 0 : i32
%196 = arith.extsi %195 : i32 to i64
%197 = llvm.mlir.constant(1 : i64) : i64
%198 = llvm.alloca %197 x i64 : (i64) -> !llvm.ptr
llvm.store %196, %198 : i64, !llvm.ptr
%199 = llvm.mlir.constant(1 : i64) : i64
%200 = llvm.alloca %199 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %200 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%201 = llvm.load %198 : !llvm.ptr -> i64
%202 = llvm.load %200 : !llvm.ptr -> i64
%203 = arith.cmpi slt, %201, %202 : i64
cf.cond_br %203, ^bb46, ^bb47
^bb46:
%204 = llvm.load %198 : !llvm.ptr -> i64
%205 = llvm.load %200 : !llvm.ptr -> i64
%206 = arith.addi %204, %205 : i64
%207 = arith.constant 2 : i32
%209 = arith.extsi %207 : i32 to i64
%208 = arith.divsi %206, %209 : i64
%211 = llvm.getelementptr %arg0[%208] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%210 = llvm.load %211 : !llvm.ptr -> i64
%212 = arith.cmpi sle, %210, %arg2 : i64
cf.cond_br %212, ^bb48, ^bb49
^bb48:
%213 = arith.constant 1 : i32
%215 = arith.extsi %213 : i32 to i64
%214 = arith.addi %208, %215 : i64
llvm.store %214, %198 : i64, !llvm.ptr
cf.br ^bb50
^bb49:
llvm.store %208, %200 : i64, !llvm.ptr
cf.br ^bb50
^bb50:
cf.br ^bb45
^bb47:
%216 = llvm.load %198 : !llvm.ptr -> i64
func.return %216 : i64
}
func.func @factor_exps(%arg0: i64, %arg1: !llvm.ptr, %arg2: i64, %arg3: !llvm.ptr) -> i1 {
%217 = llvm.mlir.constant(1 : i64) : i64
%218 = llvm.alloca %217 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %218 : i64, !llvm.ptr
%219 = arith.constant 0 : i32
%220 = arith.extsi %219 : i32 to i64
%221 = llvm.mlir.constant(1 : i64) : i64
%222 = llvm.alloca %221 x i64 : (i64) -> !llvm.ptr
llvm.store %220, %222 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%223 = llvm.load %222 : !llvm.ptr -> i64
%224 = arith.cmpi slt, %223, %arg2 : i64
cf.cond_br %224, ^bb52, ^bb53
^bb52:
%225 = arith.constant 0 : i32
%226 = llvm.load %222 : !llvm.ptr -> i64
%227 = llvm.getelementptr %arg3[%226] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %225, %227 : i32, !llvm.ptr
%229 = llvm.load %222 : !llvm.ptr -> i64
%230 = llvm.getelementptr %arg1[%229] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%228 = llvm.load %230 : !llvm.ptr -> i64
cf.br ^bb54
^bb54:
%231 = llvm.load %218 : !llvm.ptr -> i64
%232 = arith.remsi %231, %228 : i64
%233 = arith.constant 0 : i32
%235 = arith.extsi %233 : i32 to i64
%234 = arith.cmpi eq, %232, %235 : i64
cf.cond_br %234, ^bb55, ^bb56
^bb55:
%237 = llvm.load %222 : !llvm.ptr -> i64
%238 = llvm.getelementptr %arg3[%237] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%236 = llvm.load %238 : !llvm.ptr -> i32
%239 = arith.constant 1 : i32
%240 = arith.addi %236, %239 : i32
%241 = llvm.load %222 : !llvm.ptr -> i64
%242 = llvm.getelementptr %arg3[%241] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %240, %242 : i32, !llvm.ptr
%243 = llvm.load %218 : !llvm.ptr -> i64
%244 = arith.divsi %243, %228 : i64
llvm.store %244, %218 : i64, !llvm.ptr
cf.br ^bb54
^bb56:
%245 = llvm.load %222 : !llvm.ptr -> i64
%246 = arith.constant 1 : i32
%248 = arith.extsi %246 : i32 to i64
%247 = arith.addi %245, %248 : i64
llvm.store %247, %222 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
%249 = llvm.load %218 : !llvm.ptr -> i64
%250 = arith.constant 1 : i32
%252 = arith.extsi %250 : i32 to i64
%251 = arith.cmpi eq, %249, %252 : i64
func.return %251 : i1
}
func.func @main() -> i32 {
%253 = arith.constant 43 : i32
%254 = arith.extsi %253 : i32 to i64
%256 = arith.constant 2 : i32
%257 = arith.constant 3 : i32
%258 = arith.constant 5 : i32
%259 = arith.constant 7 : i32
%260 = arith.constant 11 : i32
%261 = arith.constant 13 : i32
%262 = arith.constant 17 : i32
%263 = arith.constant 19 : i32
%264 = arith.constant 23 : i32
%265 = arith.constant 29 : i32
%266 = arith.constant 31 : i32
%267 = arith.constant 37 : i32
%268 = arith.constant 41 : i32
%269 = arith.constant 43 : i32
%270 = llvm.mlir.constant(1 : i64) : i64
%271 = llvm.alloca %270 x !llvm.array<14 x i64> : (i64) -> !llvm.ptr
%272 = llvm.mlir.zero : !llvm.array<14 x i64>
llvm.store %272, %271 : !llvm.array<14 x i64>, !llvm.ptr
%273 = arith.extsi %256 : i32 to i64
%274 = arith.extsi %257 : i32 to i64
%275 = arith.extsi %258 : i32 to i64
%276 = arith.extsi %259 : i32 to i64
%277 = arith.extsi %260 : i32 to i64
%278 = arith.extsi %261 : i32 to i64
%279 = arith.extsi %262 : i32 to i64
%280 = arith.extsi %263 : i32 to i64
%281 = arith.extsi %264 : i32 to i64
%282 = arith.extsi %265 : i32 to i64
%283 = arith.extsi %266 : i32 to i64
%284 = arith.extsi %267 : i32 to i64
%285 = arith.extsi %268 : i32 to i64
%286 = arith.extsi %269 : i32 to i64
%287 = llvm.mlir.constant(0 : i64) : i64
%288 = llvm.getelementptr %271[0, %287] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %273, %288 : i64, !llvm.ptr
%289 = llvm.mlir.constant(1 : i64) : i64
%290 = llvm.getelementptr %271[0, %289] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %274, %290 : i64, !llvm.ptr
%291 = llvm.mlir.constant(2 : i64) : i64
%292 = llvm.getelementptr %271[0, %291] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %275, %292 : i64, !llvm.ptr
%293 = llvm.mlir.constant(3 : i64) : i64
%294 = llvm.getelementptr %271[0, %293] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %276, %294 : i64, !llvm.ptr
%295 = llvm.mlir.constant(4 : i64) : i64
%296 = llvm.getelementptr %271[0, %295] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %277, %296 : i64, !llvm.ptr
%297 = llvm.mlir.constant(5 : i64) : i64
%298 = llvm.getelementptr %271[0, %297] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %278, %298 : i64, !llvm.ptr
%299 = llvm.mlir.constant(6 : i64) : i64
%300 = llvm.getelementptr %271[0, %299] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %279, %300 : i64, !llvm.ptr
%301 = llvm.mlir.constant(7 : i64) : i64
%302 = llvm.getelementptr %271[0, %301] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %280, %302 : i64, !llvm.ptr
%303 = llvm.mlir.constant(8 : i64) : i64
%304 = llvm.getelementptr %271[0, %303] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %281, %304 : i64, !llvm.ptr
%305 = llvm.mlir.constant(9 : i64) : i64
%306 = llvm.getelementptr %271[0, %305] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %282, %306 : i64, !llvm.ptr
%307 = llvm.mlir.constant(10 : i64) : i64
%308 = llvm.getelementptr %271[0, %307] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %283, %308 : i64, !llvm.ptr
%309 = llvm.mlir.constant(11 : i64) : i64
%310 = llvm.getelementptr %271[0, %309] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %284, %310 : i64, !llvm.ptr
%311 = llvm.mlir.constant(12 : i64) : i64
%312 = llvm.getelementptr %271[0, %311] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %285, %312 : i64, !llvm.ptr
%313 = llvm.mlir.constant(13 : i64) : i64
%314 = llvm.getelementptr %271[0, %313] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %286, %314 : i64, !llvm.ptr
%316 = arith.constant 0 : i32
%317 = arith.constant 0 : i32
%318 = arith.constant 0 : i32
%319 = arith.constant 0 : i32
%320 = arith.constant 0 : i32
%321 = arith.constant 0 : i32
%322 = arith.constant 0 : i32
%323 = arith.constant 0 : i32
%324 = arith.constant 0 : i32
%325 = arith.constant 0 : i32
%326 = arith.constant 0 : i32
%327 = arith.constant 0 : i32
%328 = arith.constant 0 : i32
%329 = arith.constant 0 : i32
%330 = llvm.mlir.constant(1 : i64) : i64
%331 = llvm.alloca %330 x !llvm.array<14 x i64> : (i64) -> !llvm.ptr
%332 = llvm.mlir.zero : !llvm.array<14 x i64>
llvm.store %332, %331 : !llvm.array<14 x i64>, !llvm.ptr
%333 = arith.extsi %316 : i32 to i64
%334 = arith.extsi %317 : i32 to i64
%335 = arith.extsi %318 : i32 to i64
%336 = arith.extsi %319 : i32 to i64
%337 = arith.extsi %320 : i32 to i64
%338 = arith.extsi %321 : i32 to i64
%339 = arith.extsi %322 : i32 to i64
%340 = arith.extsi %323 : i32 to i64
%341 = arith.extsi %324 : i32 to i64
%342 = arith.extsi %325 : i32 to i64
%343 = arith.extsi %326 : i32 to i64
%344 = arith.extsi %327 : i32 to i64
%345 = arith.extsi %328 : i32 to i64
%346 = arith.extsi %329 : i32 to i64
%347 = llvm.mlir.constant(0 : i64) : i64
%348 = llvm.getelementptr %331[0, %347] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %333, %348 : i64, !llvm.ptr
%349 = llvm.mlir.constant(1 : i64) : i64
%350 = llvm.getelementptr %331[0, %349] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %334, %350 : i64, !llvm.ptr
%351 = llvm.mlir.constant(2 : i64) : i64
%352 = llvm.getelementptr %331[0, %351] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %335, %352 : i64, !llvm.ptr
%353 = llvm.mlir.constant(3 : i64) : i64
%354 = llvm.getelementptr %331[0, %353] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %336, %354 : i64, !llvm.ptr
%355 = llvm.mlir.constant(4 : i64) : i64
%356 = llvm.getelementptr %331[0, %355] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %337, %356 : i64, !llvm.ptr
%357 = llvm.mlir.constant(5 : i64) : i64
%358 = llvm.getelementptr %331[0, %357] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %338, %358 : i64, !llvm.ptr
%359 = llvm.mlir.constant(6 : i64) : i64
%360 = llvm.getelementptr %331[0, %359] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %339, %360 : i64, !llvm.ptr
%361 = llvm.mlir.constant(7 : i64) : i64
%362 = llvm.getelementptr %331[0, %361] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %340, %362 : i64, !llvm.ptr
%363 = llvm.mlir.constant(8 : i64) : i64
%364 = llvm.getelementptr %331[0, %363] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %341, %364 : i64, !llvm.ptr
%365 = llvm.mlir.constant(9 : i64) : i64
%366 = llvm.getelementptr %331[0, %365] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %342, %366 : i64, !llvm.ptr
%367 = llvm.mlir.constant(10 : i64) : i64
%368 = llvm.getelementptr %331[0, %367] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %343, %368 : i64, !llvm.ptr
%369 = llvm.mlir.constant(11 : i64) : i64
%370 = llvm.getelementptr %331[0, %369] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %344, %370 : i64, !llvm.ptr
%371 = llvm.mlir.constant(12 : i64) : i64
%372 = llvm.getelementptr %331[0, %371] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %345, %372 : i64, !llvm.ptr
%373 = llvm.mlir.constant(13 : i64) : i64
%374 = llvm.getelementptr %331[0, %373] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %346, %374 : i64, !llvm.ptr
%375 = arith.constant 0 : i32
%376 = arith.extsi %375 : i32 to i64
%377 = llvm.mlir.constant(1 : i64) : i64
%378 = llvm.alloca %377 x i64 : (i64) -> !llvm.ptr
llvm.store %376, %378 : i64, !llvm.ptr
cf.br ^bb57
^bb57:
%379 = llvm.load %378 : !llvm.ptr -> i64
%380 = arith.constant 14 : i32
%382 = arith.extsi %380 : i32 to i64
%381 = arith.cmpi slt, %379, %382 : i64
cf.cond_br %381, ^bb58, ^bb59
^bb58:
%384 = llvm.load %378 : !llvm.ptr -> i64
%385 = llvm.getelementptr %271[0, %384] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%383 = llvm.load %385 : !llvm.ptr -> i64
%386 = llvm.mlir.constant(1 : i64) : i64
%387 = llvm.alloca %386 x i64 : (i64) -> !llvm.ptr
llvm.store %254, %387 : i64, !llvm.ptr
%388 = arith.constant 0 : i32
%389 = arith.extsi %388 : i32 to i64
%390 = llvm.mlir.constant(1 : i64) : i64
%391 = llvm.alloca %390 x i64 : (i64) -> !llvm.ptr
llvm.store %389, %391 : i64, !llvm.ptr
cf.br ^bb60
^bb60:
%392 = llvm.load %387 : !llvm.ptr -> i64
%393 = arith.constant 0 : i32
%395 = arith.extsi %393 : i32 to i64
%394 = arith.cmpi sgt, %392, %395 : i64
cf.cond_br %394, ^bb61, ^bb62
^bb61:
%396 = llvm.load %387 : !llvm.ptr -> i64
%397 = arith.divsi %396, %383 : i64
llvm.store %397, %387 : i64, !llvm.ptr
%398 = llvm.load %391 : !llvm.ptr -> i64
%399 = llvm.load %387 : !llvm.ptr -> i64
%400 = arith.addi %398, %399 : i64
llvm.store %400, %391 : i64, !llvm.ptr
cf.br ^bb60
^bb62:
%401 = llvm.load %391 : !llvm.ptr -> i64
%402 = llvm.load %378 : !llvm.ptr -> i64
%403 = llvm.getelementptr %331[0, %402] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
llvm.store %401, %403 : i64, !llvm.ptr
%404 = llvm.load %378 : !llvm.ptr -> i64
%405 = arith.constant 1 : i32
%407 = arith.extsi %405 : i32 to i64
%406 = arith.addi %404, %407 : i64
llvm.store %406, %378 : i64, !llvm.ptr
cf.br ^bb57
^bb59:
%408 = arith.constant 1 : i32
%409 = arith.extsi %408 : i32 to i64
%410 = llvm.mlir.constant(1 : i64) : i64
%411 = llvm.alloca %410 x i64 : (i64) -> !llvm.ptr
llvm.store %409, %411 : i64, !llvm.ptr
%412 = arith.constant 0 : i32
%413 = arith.extsi %412 : i32 to i64
%414 = llvm.mlir.constant(1 : i64) : i64
%415 = llvm.alloca %414 x i64 : (i64) -> !llvm.ptr
llvm.store %413, %415 : i64, !llvm.ptr
%416 = arith.constant 0 : i32
%417 = arith.extsi %416 : i32 to i64
llvm.store %417, %378 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%418 = llvm.load %378 : !llvm.ptr -> i64
%419 = arith.constant 14 : i32
%421 = arith.extsi %419 : i32 to i64
%420 = arith.cmpi slt, %418, %421 : i64
cf.cond_br %420, ^bb64, ^bb65
^bb64:
%422 = llvm.load %378 : !llvm.ptr -> i64
%423 = arith.constant 0 : i32
%425 = arith.extsi %423 : i32 to i64
%424 = arith.cmpi sgt, %422, %425 : i64
%426 = scf.if %424 -> (i1) {
%427 = llvm.load %411 : !llvm.ptr -> i64
%429 = llvm.load %378 : !llvm.ptr -> i64
%430 = llvm.getelementptr %331[0, %429] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%428 = llvm.load %430 : !llvm.ptr -> i64
%431 = arith.constant 1 : i32
%433 = arith.extsi %431 : i32 to i64
%432 = arith.addi %428, %433 : i64
%434 = arith.muli %427, %432 : i64
%435 = arith.constant 1000000 : i32
%437 = arith.extsi %435 : i32 to i64
%436 = arith.cmpi sgt, %434, %437 : i64
scf.yield %436 : i1
} else {
%438 = arith.constant false
scf.yield %438 : i1
}
cf.cond_br %426, ^bb66, ^bb67
^bb66:
cf.br ^bb65
^bb67:
cf.br ^bb68
^bb68:
%439 = llvm.load %411 : !llvm.ptr -> i64
%441 = llvm.load %378 : !llvm.ptr -> i64
%442 = llvm.getelementptr %331[0, %441] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%440 = llvm.load %442 : !llvm.ptr -> i64
%443 = arith.constant 1 : i32
%445 = arith.extsi %443 : i32 to i64
%444 = arith.addi %440, %445 : i64
%446 = arith.muli %439, %444 : i64
llvm.store %446, %411 : i64, !llvm.ptr
%447 = llvm.load %378 : !llvm.ptr -> i64
%448 = arith.constant 1 : i32
%450 = arith.extsi %448 : i32 to i64
%449 = arith.addi %447, %450 : i64
llvm.store %449, %415 : i64, !llvm.ptr
%451 = llvm.load %378 : !llvm.ptr -> i64
%452 = arith.constant 1 : i32
%454 = arith.extsi %452 : i32 to i64
%453 = arith.addi %451, %454 : i64
llvm.store %453, %378 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
%455 = llvm.load %411 : !llvm.ptr -> i64
%456 = arith.constant 10 : i32
%458 = arith.extsi %456 : i32 to i64
%457 = arith.addi %455, %458 : i64
%460 = arith.constant 8 : i32
%461 = arith.extsi %460 : i32 to i64
%459 = func.call @calloc(%457, %461) : (i64, i64) -> !llvm.ptr
%463 = arith.constant 8 : i32
%464 = arith.extsi %463 : i32 to i64
%462 = func.call @calloc(%457, %464) : (i64, i64) -> !llvm.ptr
%465 = llvm.mlir.zero : !llvm.ptr
%466 = llvm.icmp "eq" %459, %465 : !llvm.ptr
%467 = scf.if %466 -> (i1) {
%468 = arith.constant true
scf.yield %468 : i1
} else {
%469 = llvm.mlir.zero : !llvm.ptr
%470 = llvm.icmp "eq" %462, %469 : !llvm.ptr
scf.yield %470 : i1
}
cf.cond_br %467, ^bb69, ^bb70
^bb69:
%471 = arith.constant 1 : i32
func.return %471 : i32
^bb70:
cf.br ^bb71
^bb71:
%472 = arith.constant 1 : i32
%473 = arith.constant 0 : i32
%474 = arith.extsi %472 : i32 to i64
%475 = arith.extsi %473 : i32 to i64
%476 = llvm.getelementptr %459[%475] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %474, %476 : i64, !llvm.ptr
%477 = arith.constant 1 : i32
%478 = arith.extsi %477 : i32 to i64
%479 = llvm.mlir.constant(1 : i64) : i64
%480 = llvm.alloca %479 x i64 : (i64) -> !llvm.ptr
llvm.store %478, %480 : i64, !llvm.ptr
%481 = arith.constant 0 : i32
%482 = arith.extsi %481 : i32 to i64
llvm.store %482, %378 : i64, !llvm.ptr
cf.br ^bb72
^bb72:
%483 = llvm.load %378 : !llvm.ptr -> i64
%484 = llvm.load %415 : !llvm.ptr -> i64
%485 = arith.cmpi slt, %483, %484 : i64
cf.cond_br %485, ^bb73, ^bb74
^bb73:
%487 = llvm.load %378 : !llvm.ptr -> i64
%488 = llvm.getelementptr %271[0, %487] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%486 = llvm.load %488 : !llvm.ptr -> i64
%490 = llvm.load %378 : !llvm.ptr -> i64
%491 = llvm.getelementptr %331[0, %490] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%489 = llvm.load %491 : !llvm.ptr -> i64
%492 = arith.constant 1 : i32
%493 = arith.extsi %492 : i32 to i64
%494 = llvm.mlir.constant(1 : i64) : i64
%495 = llvm.alloca %494 x i64 : (i64) -> !llvm.ptr
llvm.store %493, %495 : i64, !llvm.ptr
%496 = arith.constant 0 : i32
%497 = arith.extsi %496 : i32 to i64
%498 = llvm.mlir.constant(1 : i64) : i64
%499 = llvm.alloca %498 x i64 : (i64) -> !llvm.ptr
llvm.store %497, %499 : i64, !llvm.ptr
%500 = arith.constant 0 : i32
%501 = arith.extsi %500 : i32 to i64
%502 = llvm.mlir.constant(1 : i64) : i64
%503 = llvm.alloca %502 x i64 : (i64) -> !llvm.ptr
llvm.store %501, %503 : i64, !llvm.ptr
cf.br ^bb75
^bb75:
%504 = llvm.load %503 : !llvm.ptr -> i64
%505 = arith.cmpi sle, %504, %489 : i64
cf.cond_br %505, ^bb76, ^bb77
^bb76:
%506 = arith.constant 0 : i32
%507 = arith.extsi %506 : i32 to i64
%508 = llvm.mlir.constant(1 : i64) : i64
%509 = llvm.alloca %508 x i64 : (i64) -> !llvm.ptr
llvm.store %507, %509 : i64, !llvm.ptr
cf.br ^bb78
^bb78:
%510 = llvm.load %509 : !llvm.ptr -> i64
%511 = llvm.load %480 : !llvm.ptr -> i64
%512 = arith.cmpi slt, %510, %511 : i64
cf.cond_br %512, ^bb79, ^bb80
^bb79:
%515 = llvm.load %509 : !llvm.ptr -> i64
%516 = llvm.getelementptr %459[%515] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%514 = llvm.load %516 : !llvm.ptr -> i64
%517 = llvm.load %495 : !llvm.ptr -> i64
%513 = func.call @mul_fit(%514, %517) : (i64, i64) -> i64
%518 = arith.constant 0 : i32
%520 = arith.extsi %518 : i32 to i64
%519 = arith.cmpi sge, %513, %520 : i64
cf.cond_br %519, ^bb81, ^bb82
^bb81:
%521 = llvm.load %499 : !llvm.ptr -> i64
%522 = llvm.getelementptr %462[%521] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %513, %522 : i64, !llvm.ptr
%523 = llvm.load %499 : !llvm.ptr -> i64
%524 = arith.constant 1 : i32
%526 = arith.extsi %524 : i32 to i64
%525 = arith.addi %523, %526 : i64
llvm.store %525, %499 : i64, !llvm.ptr
cf.br ^bb83
^bb82:
cf.br ^bb83
^bb83:
%527 = llvm.load %509 : !llvm.ptr -> i64
%528 = arith.constant 1 : i32
%530 = arith.extsi %528 : i32 to i64
%529 = arith.addi %527, %530 : i64
llvm.store %529, %509 : i64, !llvm.ptr
cf.br ^bb78
^bb80:
%532 = llvm.load %495 : !llvm.ptr -> i64
%531 = func.call @mul_fit(%532, %486) : (i64, i64) -> i64
%533 = arith.constant 0 : i32
%535 = arith.extsi %533 : i32 to i64
%534 = arith.cmpi slt, %531, %535 : i64
cf.cond_br %534, ^bb84, ^bb85
^bb84:
cf.br ^bb77
^bb85:
cf.br ^bb86
^bb86:
llvm.store %531, %495 : i64, !llvm.ptr
%536 = llvm.load %503 : !llvm.ptr -> i64
%537 = arith.constant 1 : i32
%539 = arith.extsi %537 : i32 to i64
%538 = arith.addi %536, %539 : i64
llvm.store %538, %503 : i64, !llvm.ptr
cf.br ^bb75
^bb77:
%540 = arith.constant 0 : i32
%541 = arith.extsi %540 : i32 to i64
%542 = llvm.mlir.constant(1 : i64) : i64
%543 = llvm.alloca %542 x i64 : (i64) -> !llvm.ptr
llvm.store %541, %543 : i64, !llvm.ptr
cf.br ^bb87
^bb87:
%544 = llvm.load %543 : !llvm.ptr -> i64
%545 = llvm.load %499 : !llvm.ptr -> i64
%546 = arith.cmpi slt, %544, %545 : i64
cf.cond_br %546, ^bb88, ^bb89
^bb88:
%548 = llvm.load %543 : !llvm.ptr -> i64
%549 = llvm.getelementptr %462[%548] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%547 = llvm.load %549 : !llvm.ptr -> i64
%550 = llvm.load %543 : !llvm.ptr -> i64
%551 = llvm.getelementptr %459[%550] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %547, %551 : i64, !llvm.ptr
%552 = llvm.load %543 : !llvm.ptr -> i64
%553 = arith.constant 1 : i32
%555 = arith.extsi %553 : i32 to i64
%554 = arith.addi %552, %555 : i64
llvm.store %554, %543 : i64, !llvm.ptr
cf.br ^bb87
^bb89:
%556 = llvm.load %499 : !llvm.ptr -> i64
llvm.store %556, %480 : i64, !llvm.ptr
%557 = llvm.load %378 : !llvm.ptr -> i64
%558 = arith.constant 1 : i32
%560 = arith.extsi %558 : i32 to i64
%559 = arith.addi %557, %560 : i64
llvm.store %559, %378 : i64, !llvm.ptr
cf.br ^bb72
^bb74:
%562 = llvm.load %480 : !llvm.ptr -> i64
func.call @sort_i64(%459, %562) : (!llvm.ptr, i64) -> ()
%563 = arith.constant 1 : i32
%564 = arith.extsi %563 : i32 to i64
%565 = llvm.mlir.constant(1 : i64) : i64
%566 = llvm.alloca %565 x i64 : (i64) -> !llvm.ptr
llvm.store %564, %566 : i64, !llvm.ptr
%567 = llvm.load %415 : !llvm.ptr -> i64
llvm.store %567, %378 : i64, !llvm.ptr
cf.br ^bb90
^bb90:
%568 = llvm.load %378 : !llvm.ptr -> i64
%569 = arith.constant 14 : i32
%571 = arith.extsi %569 : i32 to i64
%570 = arith.cmpi slt, %568, %571 : i64
cf.cond_br %570, ^bb91, ^bb92
^bb91:
%572 = llvm.load %566 : !llvm.ptr -> i64
%574 = llvm.load %378 : !llvm.ptr -> i64
%575 = llvm.getelementptr %331[0, %574] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%573 = llvm.load %575 : !llvm.ptr -> i64
%576 = arith.constant 1 : i32
%578 = arith.extsi %576 : i32 to i64
%577 = arith.addi %573, %578 : i64
%579 = arith.muli %572, %577 : i64
llvm.store %579, %566 : i64, !llvm.ptr
%580 = llvm.load %378 : !llvm.ptr -> i64
%581 = arith.constant 1 : i32
%583 = arith.extsi %581 : i32 to i64
%582 = arith.addi %580, %583 : i64
llvm.store %582, %378 : i64, !llvm.ptr
cf.br ^bb90
^bb92:
%585 = llvm.load %566 : !llvm.ptr -> i64
%586 = arith.constant 10 : i32
%588 = arith.extsi %586 : i32 to i64
%587 = arith.addi %585, %588 : i64
%589 = arith.constant 8 : i32
%590 = arith.extsi %589 : i32 to i64
%584 = func.call @calloc(%587, %590) : (i64, i64) -> !llvm.ptr
%591 = llvm.mlir.zero : !llvm.ptr
%592 = llvm.icmp "eq" %584, %591 : !llvm.ptr
cf.cond_br %592, ^bb93, ^bb94
^bb93:
%593 = arith.constant 1 : i32
func.return %593 : i32
^bb94:
cf.br ^bb95
^bb95:
%594 = arith.constant 1 : i32
%595 = arith.constant 0 : i32
%596 = arith.extsi %594 : i32 to i64
%597 = arith.extsi %595 : i32 to i64
%598 = llvm.getelementptr %584[%597] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %596, %598 : i64, !llvm.ptr
%599 = arith.constant 1 : i32
%600 = arith.extsi %599 : i32 to i64
%601 = llvm.mlir.constant(1 : i64) : i64
%602 = llvm.alloca %601 x i64 : (i64) -> !llvm.ptr
llvm.store %600, %602 : i64, !llvm.ptr
%603 = llvm.load %415 : !llvm.ptr -> i64
llvm.store %603, %378 : i64, !llvm.ptr
cf.br ^bb96
^bb96:
%604 = llvm.load %378 : !llvm.ptr -> i64
%605 = arith.constant 14 : i32
%607 = arith.extsi %605 : i32 to i64
%606 = arith.cmpi slt, %604, %607 : i64
cf.cond_br %606, ^bb97, ^bb98
^bb97:
%609 = llvm.load %378 : !llvm.ptr -> i64
%610 = llvm.getelementptr %271[0, %609] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%608 = llvm.load %610 : !llvm.ptr -> i64
%612 = llvm.load %378 : !llvm.ptr -> i64
%613 = llvm.getelementptr %331[0, %612] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%611 = llvm.load %613 : !llvm.ptr -> i64
%614 = arith.constant 1 : i32
%615 = arith.extsi %614 : i32 to i64
%616 = llvm.mlir.constant(1 : i64) : i64
%617 = llvm.alloca %616 x i64 : (i64) -> !llvm.ptr
llvm.store %615, %617 : i64, !llvm.ptr
%618 = arith.constant 0 : i32
%619 = arith.extsi %618 : i32 to i64
%620 = llvm.mlir.constant(1 : i64) : i64
%621 = llvm.alloca %620 x i64 : (i64) -> !llvm.ptr
llvm.store %619, %621 : i64, !llvm.ptr
%622 = arith.constant 0 : i32
%623 = arith.extsi %622 : i32 to i64
%624 = llvm.mlir.constant(1 : i64) : i64
%625 = llvm.alloca %624 x i64 : (i64) -> !llvm.ptr
llvm.store %623, %625 : i64, !llvm.ptr
cf.br ^bb99
^bb99:
%626 = llvm.load %625 : !llvm.ptr -> i64
%627 = arith.cmpi sle, %626, %611 : i64
cf.cond_br %627, ^bb100, ^bb101
^bb100:
%628 = arith.constant 0 : i32
%629 = arith.extsi %628 : i32 to i64
%630 = llvm.mlir.constant(1 : i64) : i64
%631 = llvm.alloca %630 x i64 : (i64) -> !llvm.ptr
llvm.store %629, %631 : i64, !llvm.ptr
cf.br ^bb102
^bb102:
%632 = llvm.load %631 : !llvm.ptr -> i64
%633 = llvm.load %602 : !llvm.ptr -> i64
%634 = arith.cmpi slt, %632, %633 : i64
cf.cond_br %634, ^bb103, ^bb104
^bb103:
%637 = llvm.load %631 : !llvm.ptr -> i64
%638 = llvm.getelementptr %584[%637] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%636 = llvm.load %638 : !llvm.ptr -> i64
%639 = llvm.load %617 : !llvm.ptr -> i64
%635 = func.call @mul_fit(%636, %639) : (i64, i64) -> i64
%640 = arith.constant 0 : i32
%642 = arith.extsi %640 : i32 to i64
%641 = arith.cmpi sge, %635, %642 : i64
cf.cond_br %641, ^bb105, ^bb106
^bb105:
%643 = llvm.load %621 : !llvm.ptr -> i64
%644 = llvm.getelementptr %462[%643] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %635, %644 : i64, !llvm.ptr
%645 = llvm.load %621 : !llvm.ptr -> i64
%646 = arith.constant 1 : i32
%648 = arith.extsi %646 : i32 to i64
%647 = arith.addi %645, %648 : i64
llvm.store %647, %621 : i64, !llvm.ptr
cf.br ^bb107
^bb106:
cf.br ^bb107
^bb107:
%649 = llvm.load %631 : !llvm.ptr -> i64
%650 = arith.constant 1 : i32
%652 = arith.extsi %650 : i32 to i64
%651 = arith.addi %649, %652 : i64
llvm.store %651, %631 : i64, !llvm.ptr
cf.br ^bb102
^bb104:
%654 = llvm.load %617 : !llvm.ptr -> i64
%653 = func.call @mul_fit(%654, %608) : (i64, i64) -> i64
%655 = arith.constant 0 : i32
%657 = arith.extsi %655 : i32 to i64
%656 = arith.cmpi slt, %653, %657 : i64
cf.cond_br %656, ^bb108, ^bb109
^bb108:
cf.br ^bb101
^bb109:
cf.br ^bb110
^bb110:
llvm.store %653, %617 : i64, !llvm.ptr
%658 = llvm.load %625 : !llvm.ptr -> i64
%659 = arith.constant 1 : i32
%661 = arith.extsi %659 : i32 to i64
%660 = arith.addi %658, %661 : i64
llvm.store %660, %625 : i64, !llvm.ptr
cf.br ^bb99
^bb101:
%662 = arith.constant 0 : i32
%663 = arith.extsi %662 : i32 to i64
%664 = llvm.mlir.constant(1 : i64) : i64
%665 = llvm.alloca %664 x i64 : (i64) -> !llvm.ptr
llvm.store %663, %665 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%666 = llvm.load %665 : !llvm.ptr -> i64
%667 = llvm.load %621 : !llvm.ptr -> i64
%668 = arith.cmpi slt, %666, %667 : i64
cf.cond_br %668, ^bb112, ^bb113
^bb112:
%670 = llvm.load %665 : !llvm.ptr -> i64
%671 = llvm.getelementptr %462[%670] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%669 = llvm.load %671 : !llvm.ptr -> i64
%672 = llvm.load %665 : !llvm.ptr -> i64
%673 = llvm.getelementptr %584[%672] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %669, %673 : i64, !llvm.ptr
%674 = llvm.load %665 : !llvm.ptr -> i64
%675 = arith.constant 1 : i32
%677 = arith.extsi %675 : i32 to i64
%676 = arith.addi %674, %677 : i64
llvm.store %676, %665 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
%678 = llvm.load %621 : !llvm.ptr -> i64
llvm.store %678, %602 : i64, !llvm.ptr
%679 = llvm.load %378 : !llvm.ptr -> i64
%680 = arith.constant 1 : i32
%682 = arith.extsi %680 : i32 to i64
%681 = arith.addi %679, %682 : i64
llvm.store %681, %378 : i64, !llvm.ptr
cf.br ^bb96
^bb98:
%683 = arith.constant 0.0 : f32
%684 = arith.extf %683 : f32 to f64
%685 = llvm.mlir.constant(1 : i64) : i64
%686 = llvm.alloca %685 x f64 : (i64) -> !llvm.ptr
llvm.store %684, %686 : f64, !llvm.ptr
%687 = arith.constant 0 : i32
%688 = arith.extsi %687 : i32 to i64
llvm.store %688, %378 : i64, !llvm.ptr
cf.br ^bb114
^bb114:
%689 = llvm.load %378 : !llvm.ptr -> i64
%690 = arith.constant 14 : i32
%692 = arith.extsi %690 : i32 to i64
%691 = arith.cmpi slt, %689, %692 : i64
cf.cond_br %691, ^bb115, ^bb116
^bb115:
%693 = llvm.load %686 : !llvm.ptr -> f64
%695 = llvm.load %378 : !llvm.ptr -> i64
%696 = llvm.getelementptr %331[0, %695] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%694 = llvm.load %696 : !llvm.ptr -> i64
%697 = arith.sitofp %694 : i64 to f64
%699 = llvm.load %378 : !llvm.ptr -> i64
%700 = llvm.getelementptr %271[0, %699] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%698 = llvm.load %700 : !llvm.ptr -> i64
%701 = arith.sitofp %698 : i64 to f64
%702 = math.log %701 : f64
%703 = arith.mulf %697, %702 : f64
%704 = arith.addf %693, %703 : f64
llvm.store %704, %686 : f64, !llvm.ptr
%705 = llvm.load %378 : !llvm.ptr -> i64
%706 = arith.constant 1 : i32
%708 = arith.extsi %706 : i32 to i64
%707 = arith.addi %705, %708 : i64
llvm.store %707, %378 : i64, !llvm.ptr
cf.br ^bb114
^bb116:
%709 = llvm.load %686 : !llvm.ptr -> f64
%710 = arith.constant 3.0 : f32
%712 = arith.extf %710 : f32 to f64
%711 = arith.divf %709, %712 : f64
%713 = math.exp %711 : f64
%715 = arith.constant 14 : i32
%716 = arith.constant 4 : i32
%717 = arith.extsi %715 : i32 to i64
%718 = arith.extsi %716 : i32 to i64
%714 = func.call @calloc(%717, %718) : (i64, i64) -> !llvm.ptr
%720 = arith.constant 14 : i32
%721 = arith.constant 4 : i32
%722 = arith.extsi %720 : i32 to i64
%723 = arith.extsi %721 : i32 to i64
%719 = func.call @calloc(%722, %723) : (i64, i64) -> !llvm.ptr
%725 = arith.constant 14 : i32
%726 = arith.constant 8 : i32
%727 = arith.extsi %725 : i32 to i64
%728 = arith.extsi %726 : i32 to i64
%724 = func.call @calloc(%727, %728) : (i64, i64) -> !llvm.ptr
%729 = arith.constant 0 : i32
%730 = arith.extsi %729 : i32 to i64
llvm.store %730, %378 : i64, !llvm.ptr
cf.br ^bb117
^bb117:
%731 = llvm.load %378 : !llvm.ptr -> i64
%732 = arith.constant 14 : i32
%734 = arith.extsi %732 : i32 to i64
%733 = arith.cmpi slt, %731, %734 : i64
cf.cond_br %733, ^bb118, ^bb119
^bb118:
%736 = llvm.load %378 : !llvm.ptr -> i64
%737 = llvm.getelementptr %271[0, %736] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%735 = llvm.load %737 : !llvm.ptr -> i64
%738 = llvm.load %378 : !llvm.ptr -> i64
%739 = llvm.getelementptr %724[%738] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %735, %739 : i64, !llvm.ptr
%740 = llvm.load %378 : !llvm.ptr -> i64
%741 = arith.constant 1 : i32
%743 = arith.extsi %741 : i32 to i64
%742 = arith.addi %740, %743 : i64
llvm.store %742, %378 : i64, !llvm.ptr
cf.br ^bb117
^bb119:
%744 = arith.constant 0 : i32
%745 = arith.extsi %744 : i32 to i64
%746 = llvm.mlir.constant(1 : i64) : i64
%747 = llvm.alloca %746 x i64 : (i64) -> !llvm.ptr
llvm.store %745, %747 : i64, !llvm.ptr
%748 = arith.constant 0 : i32
%749 = arith.extsi %748 : i32 to i64
%750 = llvm.mlir.constant(1 : i64) : i64
%751 = llvm.alloca %750 x i64 : (i64) -> !llvm.ptr
llvm.store %749, %751 : i64, !llvm.ptr
%752 = arith.constant 0 : i32
%753 = arith.extsi %752 : i32 to i64
%754 = llvm.mlir.constant(1 : i64) : i64
%755 = llvm.alloca %754 x i64 : (i64) -> !llvm.ptr
llvm.store %753, %755 : i64, !llvm.ptr
%756 = arith.constant 0 : i32
%757 = llvm.mlir.constant(1 : i64) : i64
%758 = llvm.alloca %757 x i32 : (i64) -> !llvm.ptr
llvm.store %756, %758 : i32, !llvm.ptr
%759 = arith.constant 0.00001 : f32
%760 = arith.extf %759 : f32 to f64
%761 = llvm.mlir.constant(1 : i64) : i64
%762 = llvm.alloca %761 x f64 : (i64) -> !llvm.ptr
llvm.store %760, %762 : f64, !llvm.ptr
cf.br ^bb120
^bb120:
%763 = llvm.load %762 : !llvm.ptr -> f64
%764 = arith.constant 0.05 : f32
%766 = arith.extf %764 : f32 to f64
%765 = arith.cmpf ole, %763, %766 : f64
cf.cond_br %765, ^bb121, ^bb122
^bb121:
%767 = arith.constant 1.0 : f32
%768 = llvm.load %762 : !llvm.ptr -> f64
%770 = arith.extf %767 : f32 to f64
%769 = arith.addf %770, %768 : f64
%771 = arith.divf %713, %769 : f64
%772 = arith.fptosi %771 : f64 to i64
%773 = arith.constant 2 : i32
%775 = arith.extsi %773 : i32 to i64
%774 = arith.subi %772, %775 : i64
%776 = llvm.mlir.constant(1 : i64) : i64
%777 = llvm.alloca %776 x i64 : (i64) -> !llvm.ptr
llvm.store %774, %777 : i64, !llvm.ptr
%778 = llvm.load %777 : !llvm.ptr -> i64
%779 = arith.constant 1 : i32
%781 = arith.extsi %779 : i32 to i64
%780 = arith.cmpi slt, %778, %781 : i64
cf.cond_br %780, ^bb123, ^bb124
^bb123:
%782 = arith.constant 1 : i32
%783 = arith.extsi %782 : i32 to i64
llvm.store %783, %777 : i64, !llvm.ptr
cf.br ^bb125
^bb124:
cf.br ^bb125
^bb125:
%784 = arith.fptosi %713 : f64 to i64
%785 = arith.constant 2 : i32
%787 = arith.extsi %785 : i32 to i64
%786 = arith.addi %784, %787 : i64
%788 = arith.fptosi %713 : f64 to i64
%789 = arith.constant 2 : i32
%791 = arith.extsi %789 : i32 to i64
%790 = arith.subi %788, %791 : i64
%792 = llvm.mlir.constant(1 : i64) : i64
%793 = llvm.alloca %792 x i64 : (i64) -> !llvm.ptr
llvm.store %790, %793 : i64, !llvm.ptr
%794 = llvm.load %793 : !llvm.ptr -> i64
%795 = arith.constant 1 : i32
%797 = arith.extsi %795 : i32 to i64
%796 = arith.cmpi slt, %794, %797 : i64
cf.cond_br %796, ^bb126, ^bb127
^bb126:
%798 = arith.constant 1 : i32
%799 = arith.extsi %798 : i32 to i64
llvm.store %799, %793 : i64, !llvm.ptr
cf.br ^bb128
^bb127:
cf.br ^bb128
^bb128:
%800 = arith.constant 1.0 : f32
%801 = llvm.load %762 : !llvm.ptr -> f64
%803 = arith.extf %800 : f32 to f64
%802 = arith.addf %803, %801 : f64
%804 = arith.mulf %713, %802 : f64
%805 = arith.fptosi %804 : f64 to i64
%806 = arith.constant 2 : i32
%808 = arith.extsi %806 : i32 to i64
%807 = arith.addi %805, %808 : i64
%809 = arith.constant 500000 : i32
%810 = arith.extsi %809 : i32 to i64
%812 = arith.constant 8 : i32
%813 = arith.extsi %812 : i32 to i64
%811 = func.call @calloc(%810, %813) : (i64, i64) -> !llvm.ptr
%815 = arith.constant 8 : i32
%816 = arith.extsi %815 : i32 to i64
%814 = func.call @calloc(%810, %816) : (i64, i64) -> !llvm.ptr
%817 = llvm.mlir.zero : !llvm.ptr
%818 = llvm.icmp "eq" %811, %817 : !llvm.ptr
%819 = scf.if %818 -> (i1) {
%820 = arith.constant true
scf.yield %820 : i1
} else {
%821 = llvm.mlir.zero : !llvm.ptr
%822 = llvm.icmp "eq" %814, %821 : !llvm.ptr
scf.yield %822 : i1
}
cf.cond_br %819, ^bb129, ^bb130
^bb129:
%823 = arith.constant 1 : i32
func.return %823 : i32
^bb130:
cf.br ^bb131
^bb131:
%824 = arith.constant 0 : i32
%825 = arith.extsi %824 : i32 to i64
%826 = llvm.mlir.constant(1 : i64) : i64
%827 = llvm.alloca %826 x i64 : (i64) -> !llvm.ptr
llvm.store %825, %827 : i64, !llvm.ptr
%828 = arith.constant 0 : i32
%829 = arith.extsi %828 : i32 to i64
%830 = llvm.mlir.constant(1 : i64) : i64
%831 = llvm.alloca %830 x i64 : (i64) -> !llvm.ptr
llvm.store %829, %831 : i64, !llvm.ptr
%832 = arith.constant 0 : i32
%833 = arith.extsi %832 : i32 to i64
%834 = llvm.mlir.constant(1 : i64) : i64
%835 = llvm.alloca %834 x i64 : (i64) -> !llvm.ptr
llvm.store %833, %835 : i64, !llvm.ptr
cf.br ^bb132
^bb132:
%836 = llvm.load %835 : !llvm.ptr -> i64
%837 = llvm.load %602 : !llvm.ptr -> i64
%838 = arith.cmpi slt, %836, %837 : i64
cf.cond_br %838, ^bb133, ^bb134
^bb133:
%840 = llvm.load %835 : !llvm.ptr -> i64
%841 = llvm.getelementptr %584[%840] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%839 = llvm.load %841 : !llvm.ptr -> i64
%842 = arith.constant 0 : i32
%844 = arith.extsi %842 : i32 to i64
%843 = arith.cmpi sgt, %839, %844 : i64
cf.cond_br %843, ^bb135, ^bb136
^bb135:
%845 = llvm.load %777 : !llvm.ptr -> i64
%846 = arith.divsi %845, %839 : i64
%847 = llvm.mlir.constant(1 : i64) : i64
%848 = llvm.alloca %847 x i64 : (i64) -> !llvm.ptr
llvm.store %846, %848 : i64, !llvm.ptr
%849 = llvm.load %777 : !llvm.ptr -> i64
%850 = arith.remsi %849, %839 : i64
%851 = arith.constant 0 : i32
%853 = arith.extsi %851 : i32 to i64
%852 = arith.cmpi ne, %850, %853 : i64
cf.cond_br %852, ^bb138, ^bb139
^bb138:
%854 = llvm.load %848 : !llvm.ptr -> i64
%855 = arith.constant 1 : i32
%857 = arith.extsi %855 : i32 to i64
%856 = arith.addi %854, %857 : i64
llvm.store %856, %848 : i64, !llvm.ptr
cf.br ^bb140
^bb139:
cf.br ^bb140
^bb140:
%858 = arith.divsi %786, %839 : i64
%859 = llvm.mlir.constant(1 : i64) : i64
%860 = llvm.alloca %859 x i64 : (i64) -> !llvm.ptr
llvm.store %858, %860 : i64, !llvm.ptr
%861 = llvm.load %848 : !llvm.ptr -> i64
%862 = llvm.load %860 : !llvm.ptr -> i64
%863 = arith.cmpi sle, %861, %862 : i64
cf.cond_br %863, ^bb141, ^bb142
^bb141:
%865 = llvm.load %480 : !llvm.ptr -> i64
%866 = llvm.load %848 : !llvm.ptr -> i64
%864 = func.call @lower_bound(%459, %865, %866) : (!llvm.ptr, i64, i64) -> i64
%868 = llvm.load %480 : !llvm.ptr -> i64
%869 = llvm.load %860 : !llvm.ptr -> i64
%867 = func.call @upper_bound(%459, %868, %869) : (!llvm.ptr, i64, i64) -> i64
%870 = llvm.mlir.constant(1 : i64) : i64
%871 = llvm.alloca %870 x i64 : (i64) -> !llvm.ptr
llvm.store %864, %871 : i64, !llvm.ptr
cf.br ^bb144
^bb144:
%872 = llvm.load %871 : !llvm.ptr -> i64
%873 = arith.cmpi slt, %872, %867 : i64
cf.cond_br %873, ^bb145, ^bb146
^bb145:
%876 = llvm.load %871 : !llvm.ptr -> i64
%877 = llvm.getelementptr %459[%876] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%875 = llvm.load %877 : !llvm.ptr -> i64
%874 = func.call @mul_fit(%875, %839) : (i64, i64) -> i64
%878 = llvm.load %777 : !llvm.ptr -> i64
%879 = arith.cmpi sge, %874, %878 : i64
%880 = scf.if %879 -> (i1) {
%881 = arith.cmpi sle, %874, %786 : i64
scf.yield %881 : i1
} else {
%882 = arith.constant false
scf.yield %882 : i1
}
%883 = scf.if %880 -> (i1) {
%884 = llvm.load %827 : !llvm.ptr -> i64
%885 = arith.cmpi slt, %884, %810 : i64
scf.yield %885 : i1
} else {
%886 = arith.constant false
scf.yield %886 : i1
}
cf.cond_br %883, ^bb147, ^bb148
^bb147:
%887 = llvm.load %827 : !llvm.ptr -> i64
%888 = llvm.getelementptr %811[%887] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %874, %888 : i64, !llvm.ptr
%889 = llvm.load %827 : !llvm.ptr -> i64
%890 = arith.constant 1 : i32
%892 = arith.extsi %890 : i32 to i64
%891 = arith.addi %889, %892 : i64
llvm.store %891, %827 : i64, !llvm.ptr
cf.br ^bb149
^bb148:
cf.br ^bb149
^bb149:
%893 = llvm.load %871 : !llvm.ptr -> i64
%894 = arith.constant 1 : i32
%896 = arith.extsi %894 : i32 to i64
%895 = arith.addi %893, %896 : i64
llvm.store %895, %871 : i64, !llvm.ptr
cf.br ^bb144
^bb146:
cf.br ^bb143
^bb142:
cf.br ^bb143
^bb143:
%897 = llvm.load %793 : !llvm.ptr -> i64
%898 = arith.divsi %897, %839 : i64
llvm.store %898, %848 : i64, !llvm.ptr
%899 = llvm.load %793 : !llvm.ptr -> i64
%900 = arith.remsi %899, %839 : i64
%901 = arith.constant 0 : i32
%903 = arith.extsi %901 : i32 to i64
%902 = arith.cmpi ne, %900, %903 : i64
cf.cond_br %902, ^bb150, ^bb151
^bb150:
%904 = llvm.load %848 : !llvm.ptr -> i64
%905 = arith.constant 1 : i32
%907 = arith.extsi %905 : i32 to i64
%906 = arith.addi %904, %907 : i64
llvm.store %906, %848 : i64, !llvm.ptr
cf.br ^bb152
^bb151:
cf.br ^bb152
^bb152:
%908 = arith.divsi %807, %839 : i64
llvm.store %908, %860 : i64, !llvm.ptr
%909 = llvm.load %848 : !llvm.ptr -> i64
%910 = llvm.load %860 : !llvm.ptr -> i64
%911 = arith.cmpi sle, %909, %910 : i64
cf.cond_br %911, ^bb153, ^bb154
^bb153:
%913 = llvm.load %480 : !llvm.ptr -> i64
%914 = llvm.load %848 : !llvm.ptr -> i64
%912 = func.call @lower_bound(%459, %913, %914) : (!llvm.ptr, i64, i64) -> i64
%916 = llvm.load %480 : !llvm.ptr -> i64
%917 = llvm.load %860 : !llvm.ptr -> i64
%915 = func.call @upper_bound(%459, %916, %917) : (!llvm.ptr, i64, i64) -> i64
%918 = llvm.mlir.constant(1 : i64) : i64
%919 = llvm.alloca %918 x i64 : (i64) -> !llvm.ptr
llvm.store %912, %919 : i64, !llvm.ptr
cf.br ^bb156
^bb156:
%920 = llvm.load %919 : !llvm.ptr -> i64
%921 = arith.cmpi slt, %920, %915 : i64
cf.cond_br %921, ^bb157, ^bb158
^bb157:
%924 = llvm.load %919 : !llvm.ptr -> i64
%925 = llvm.getelementptr %459[%924] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%923 = llvm.load %925 : !llvm.ptr -> i64
%922 = func.call @mul_fit(%923, %839) : (i64, i64) -> i64
%926 = llvm.load %793 : !llvm.ptr -> i64
%927 = arith.cmpi sge, %922, %926 : i64
%928 = scf.if %927 -> (i1) {
%929 = arith.cmpi sle, %922, %807 : i64
scf.yield %929 : i1
} else {
%930 = arith.constant false
scf.yield %930 : i1
}
%931 = scf.if %928 -> (i1) {
%932 = llvm.load %831 : !llvm.ptr -> i64
%933 = arith.cmpi slt, %932, %810 : i64
scf.yield %933 : i1
} else {
%934 = arith.constant false
scf.yield %934 : i1
}
cf.cond_br %931, ^bb159, ^bb160
^bb159:
%935 = llvm.load %831 : !llvm.ptr -> i64
%936 = llvm.getelementptr %814[%935] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %922, %936 : i64, !llvm.ptr
%937 = llvm.load %831 : !llvm.ptr -> i64
%938 = arith.constant 1 : i32
%940 = arith.extsi %938 : i32 to i64
%939 = arith.addi %937, %940 : i64
llvm.store %939, %831 : i64, !llvm.ptr
cf.br ^bb161
^bb160:
cf.br ^bb161
^bb161:
%941 = llvm.load %919 : !llvm.ptr -> i64
%942 = arith.constant 1 : i32
%944 = arith.extsi %942 : i32 to i64
%943 = arith.addi %941, %944 : i64
llvm.store %943, %919 : i64, !llvm.ptr
cf.br ^bb156
^bb158:
cf.br ^bb155
^bb154:
cf.br ^bb155
^bb155:
cf.br ^bb137
^bb136:
cf.br ^bb137
^bb137:
%945 = llvm.load %835 : !llvm.ptr -> i64
%946 = arith.constant 1 : i32
%948 = arith.extsi %946 : i32 to i64
%947 = arith.addi %945, %948 : i64
llvm.store %947, %835 : i64, !llvm.ptr
cf.br ^bb132
^bb134:
%949 = llvm.load %827 : !llvm.ptr -> i64
%950 = arith.constant 0 : i32
%952 = arith.extsi %950 : i32 to i64
%951 = arith.cmpi sgt, %949, %952 : i64
%953 = scf.if %951 -> (i1) {
%954 = llvm.load %831 : !llvm.ptr -> i64
%955 = arith.constant 0 : i32
%957 = arith.extsi %955 : i32 to i64
%956 = arith.cmpi sgt, %954, %957 : i64
scf.yield %956 : i1
} else {
%958 = arith.constant false
scf.yield %958 : i1
}
cf.cond_br %953, ^bb162, ^bb163
^bb162:
%959 = llvm.load %827 : !llvm.ptr -> i64
%960 = arith.extsi %959 : i64 to i128
%961 = llvm.load %831 : !llvm.ptr -> i64
%962 = arith.extsi %961 : i64 to i128
%964 = arith.trunci %960 : i128 to i64
%965 = arith.trunci %962 : i128 to i64
%963 = arith.muli %964, %965 : i64
%966 = arith.extsi %963 : i64 to i128
%967 = arith.constant 50000000 : i32
%968 = arith.extsi %967 : i32 to i128
%970 = arith.trunci %966 : i128 to i64
%971 = arith.trunci %968 : i128 to i64
%969 = arith.cmpi sle, %970, %971 : i64
cf.cond_br %969, ^bb165, ^bb166
^bb165:
%973 = llvm.load %831 : !llvm.ptr -> i64
func.call @sort_i64(%814, %973) : (!llvm.ptr, i64) -> ()
%974 = arith.constant 0 : i32
%975 = arith.extsi %974 : i32 to i64
%976 = llvm.mlir.constant(1 : i64) : i64
%977 = llvm.alloca %976 x i64 : (i64) -> !llvm.ptr
llvm.store %975, %977 : i64, !llvm.ptr
cf.br ^bb168
^bb168:
%978 = llvm.load %977 : !llvm.ptr -> i64
%979 = llvm.load %827 : !llvm.ptr -> i64
%980 = arith.cmpi slt, %978, %979 : i64
cf.cond_br %980, ^bb169, ^bb170
^bb169:
%982 = llvm.load %977 : !llvm.ptr -> i64
%983 = llvm.getelementptr %811[%982] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%981 = llvm.load %983 : !llvm.ptr -> i64
%985 = arith.constant 14 : i32
%986 = arith.extsi %985 : i32 to i64
%984 = func.call @factor_exps(%981, %724, %986, %714) : (i64, !llvm.ptr, i64, !llvm.ptr) -> i1
cf.cond_br %984, ^bb171, ^bb172
^bb171:
%987 = arith.constant 0 : i32
%988 = arith.extsi %987 : i32 to i64
%989 = llvm.mlir.constant(1 : i64) : i64
%990 = llvm.alloca %989 x i64 : (i64) -> !llvm.ptr
llvm.store %988, %990 : i64, !llvm.ptr
cf.br ^bb174
^bb174:
%991 = llvm.load %990 : !llvm.ptr -> i64
%992 = llvm.load %831 : !llvm.ptr -> i64
%993 = arith.cmpi slt, %991, %992 : i64
cf.cond_br %993, ^bb175, ^bb176
^bb175:
%995 = llvm.load %990 : !llvm.ptr -> i64
%996 = llvm.getelementptr %814[%995] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%994 = llvm.load %996 : !llvm.ptr -> i64
%997 = arith.cmpi sge, %994, %981 : i64
%998 = scf.if %997 -> (i1) {
%1000 = arith.constant 14 : i32
%1001 = arith.extsi %1000 : i32 to i64
%999 = func.call @factor_exps(%994, %724, %1001, %719) : (i64, !llvm.ptr, i64, !llvm.ptr) -> i1
scf.yield %999 : i1
} else {
%1002 = arith.constant false
scf.yield %1002 : i1
}
cf.cond_br %998, ^bb177, ^bb178
^bb177:
%1003 = arith.constant 1 : i1
%1004 = llvm.mlir.constant(1 : i64) : i64
%1005 = llvm.alloca %1004 x i1 : (i64) -> !llvm.ptr
llvm.store %1003, %1005 : i1, !llvm.ptr
%1006 = arith.constant 0 : i32
%1007 = arith.extsi %1006 : i32 to i64
%1008 = llvm.mlir.constant(1 : i64) : i64
%1009 = llvm.alloca %1008 x i64 : (i64) -> !llvm.ptr
llvm.store %1007, %1009 : i64, !llvm.ptr
cf.br ^bb180
^bb180:
%1010 = llvm.load %1009 : !llvm.ptr -> i64
%1011 = arith.constant 14 : i32
%1013 = arith.extsi %1011 : i32 to i64
%1012 = arith.cmpi slt, %1010, %1013 : i64
cf.cond_br %1012, ^bb181, ^bb182
^bb181:
%1015 = llvm.load %1009 : !llvm.ptr -> i64
%1016 = llvm.getelementptr %714[%1015] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1014 = llvm.load %1016 : !llvm.ptr -> i32
%1017 = arith.extsi %1014 : i32 to i64
%1019 = llvm.load %1009 : !llvm.ptr -> i64
%1020 = llvm.getelementptr %719[%1019] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1018 = llvm.load %1020 : !llvm.ptr -> i32
%1021 = arith.extsi %1018 : i32 to i64
%1022 = arith.addi %1017, %1021 : i64
%1024 = llvm.load %1009 : !llvm.ptr -> i64
%1025 = llvm.getelementptr %331[0, %1024] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%1023 = llvm.load %1025 : !llvm.ptr -> i64
%1026 = arith.cmpi sgt, %1022, %1023 : i64
cf.cond_br %1026, ^bb183, ^bb184
^bb183:
%1027 = arith.constant 0 : i1
llvm.store %1027, %1005 : i1, !llvm.ptr
cf.br ^bb182
^bb184:
cf.br ^bb185
^bb185:
%1028 = llvm.load %1009 : !llvm.ptr -> i64
%1029 = arith.constant 1 : i32
%1031 = arith.extsi %1029 : i32 to i64
%1030 = arith.addi %1028, %1031 : i64
llvm.store %1030, %1009 : i64, !llvm.ptr
cf.br ^bb180
^bb182:
%1032 = llvm.load %1005 : !llvm.ptr -> i1
cf.cond_br %1032, ^bb186, ^bb187
^bb186:
%1033 = arith.constant 1 : i32
%1034 = arith.extsi %1033 : i32 to i64
%1035 = llvm.mlir.constant(1 : i64) : i64
%1036 = llvm.alloca %1035 x i64 : (i64) -> !llvm.ptr
llvm.store %1034, %1036 : i64, !llvm.ptr
%1037 = arith.constant 0 : i32
%1038 = arith.extsi %1037 : i32 to i64
llvm.store %1038, %1009 : i64, !llvm.ptr
cf.br ^bb189
^bb189:
%1039 = llvm.load %1009 : !llvm.ptr -> i64
%1040 = arith.constant 14 : i32
%1042 = arith.extsi %1040 : i32 to i64
%1041 = arith.cmpi slt, %1039, %1042 : i64
cf.cond_br %1041, ^bb190, ^bb191
^bb190:
%1044 = llvm.load %1009 : !llvm.ptr -> i64
%1045 = llvm.getelementptr %331[0, %1044] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%1043 = llvm.load %1045 : !llvm.ptr -> i64
%1047 = llvm.load %1009 : !llvm.ptr -> i64
%1048 = llvm.getelementptr %714[%1047] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1046 = llvm.load %1048 : !llvm.ptr -> i32
%1049 = arith.extsi %1046 : i32 to i64
%1050 = arith.subi %1043, %1049 : i64
%1052 = llvm.load %1009 : !llvm.ptr -> i64
%1053 = llvm.getelementptr %719[%1052] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1051 = llvm.load %1053 : !llvm.ptr -> i32
%1054 = arith.extsi %1051 : i32 to i64
%1055 = arith.subi %1050, %1054 : i64
%1056 = arith.constant 0 : i32
%1057 = arith.extsi %1056 : i32 to i64
%1058 = llvm.mlir.constant(1 : i64) : i64
%1059 = llvm.alloca %1058 x i64 : (i64) -> !llvm.ptr
llvm.store %1057, %1059 : i64, !llvm.ptr
cf.br ^bb192
^bb192:
%1060 = llvm.load %1059 : !llvm.ptr -> i64
%1061 = arith.cmpi slt, %1060, %1055 : i64
cf.cond_br %1061, ^bb193, ^bb194
^bb193:
%1063 = llvm.load %1036 : !llvm.ptr -> i64
%1065 = llvm.load %1009 : !llvm.ptr -> i64
%1066 = llvm.getelementptr %271[0, %1065] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<14 x i64>
%1064 = llvm.load %1066 : !llvm.ptr -> i64
%1062 = func.call @mul_fit(%1063, %1064) : (i64, i64) -> i64
%1067 = arith.constant 0 : i32
%1069 = arith.extsi %1067 : i32 to i64
%1068 = arith.cmpi slt, %1062, %1069 : i64
cf.cond_br %1068, ^bb195, ^bb196
^bb195:
%1070 = arith.constant 0 : i1
llvm.store %1070, %1005 : i1, !llvm.ptr
cf.br ^bb194
^bb196:
cf.br ^bb197
^bb197:
llvm.store %1062, %1036 : i64, !llvm.ptr
%1071 = llvm.load %1059 : !llvm.ptr -> i64
%1072 = arith.constant 1 : i32
%1074 = arith.extsi %1072 : i32 to i64
%1073 = arith.addi %1071, %1074 : i64
llvm.store %1073, %1059 : i64, !llvm.ptr
cf.br ^bb192
^bb194:
%1075 = llvm.load %1005 : !llvm.ptr -> i1
%1077 = arith.constant 1 : i1
%1076 = arith.xori %1075, %1077 : i1
cf.cond_br %1076, ^bb198, ^bb199
^bb198:
cf.br ^bb191
^bb199:
cf.br ^bb200
^bb200:
%1079 = llvm.load %1009 : !llvm.ptr -> i64
%1080 = arith.constant 1 : i32
%1082 = arith.extsi %1080 : i32 to i64
%1081 = arith.addi %1079, %1082 : i64
llvm.store %1081, %1009 : i64, !llvm.ptr
cf.br ^bb189
^bb191:
%1083 = llvm.load %1005 : !llvm.ptr -> i1
%1084 = scf.if %1083 -> (i1) {
%1085 = llvm.load %1036 : !llvm.ptr -> i64
%1086 = arith.cmpi sle, %981, %1085 : i64
scf.yield %1086 : i1
} else {
%1087 = arith.constant false
scf.yield %1087 : i1
}
%1088 = scf.if %1084 -> (i1) {
%1089 = llvm.load %1036 : !llvm.ptr -> i64
%1090 = arith.cmpi sle, %1089, %994 : i64
scf.yield %1090 : i1
} else {
%1091 = arith.constant false
scf.yield %1091 : i1
}
cf.cond_br %1088, ^bb201, ^bb202
^bb201:
%1092 = llvm.load %758 : !llvm.ptr -> i32
%1093 = arith.constant 0 : i32
%1094 = arith.cmpi eq, %1092, %1093 : i32
%1096 = arith.constant 1 : i1
%1095 = arith.xori %1094, %1096 : i1
cf.cond_br %1095, ^bb204, ^bb205
^bb204:
%1098 = arith.extsi %994 : i64 to i128
%1099 = llvm.load %747 : !llvm.ptr -> i64
%1100 = arith.extsi %1099 : i64 to i128
%1102 = arith.trunci %1098 : i128 to i64
%1103 = arith.trunci %1100 : i128 to i64
%1101 = arith.muli %1102, %1103 : i64
%1104 = llvm.load %751 : !llvm.ptr -> i64
%1105 = arith.extsi %1104 : i64 to i128
%1106 = arith.extsi %981 : i64 to i128
%1108 = arith.trunci %1105 : i128 to i64
%1109 = arith.trunci %1106 : i128 to i64
%1107 = arith.muli %1108, %1109 : i64
%1110 = arith.cmpi slt, %1101, %1107 : i64
%1111 = scf.if %1110 -> (i1) {
%1112 = arith.constant 1 : i1
scf.yield %1112 : i1
} else {
scf.yield %1094 : i1
}
cf.br ^bb206(%1111 : i1)
^bb205:
cf.br ^bb206(%1094 : i1)
^bb206(%1113: i1):
cf.cond_br %1113, ^bb207, ^bb208
^bb207:
llvm.store %981, %747 : i64, !llvm.ptr
llvm.store %994, %751 : i64, !llvm.ptr
%1114 = llvm.load %1036 : !llvm.ptr -> i64
%1115 = arith.addi %981, %1114 : i64
%1116 = arith.addi %1115, %994 : i64
llvm.store %1116, %755 : i64, !llvm.ptr
%1117 = arith.constant 1 : i32
llvm.store %1117, %758 : i32, !llvm.ptr
cf.br ^bb209
^bb208:
cf.br ^bb209
^bb209:
cf.br ^bb203
^bb202:
cf.br ^bb203
^bb203:
cf.br ^bb188
^bb187:
cf.br ^bb188
^bb188:
cf.br ^bb179
^bb178:
cf.br ^bb179
^bb179:
%1118 = llvm.load %990 : !llvm.ptr -> i64
%1119 = arith.constant 1 : i32
%1121 = arith.extsi %1119 : i32 to i64
%1120 = arith.addi %1118, %1121 : i64
llvm.store %1120, %990 : i64, !llvm.ptr
cf.br ^bb174
^bb176:
cf.br ^bb173
^bb172:
cf.br ^bb173
^bb173:
%1122 = llvm.load %977 : !llvm.ptr -> i64
%1123 = arith.constant 1 : i32
%1125 = arith.extsi %1123 : i32 to i64
%1124 = arith.addi %1122, %1125 : i64
llvm.store %1124, %977 : i64, !llvm.ptr
cf.br ^bb168
^bb170:
cf.br ^bb167
^bb166:
cf.br ^bb167
^bb167:
cf.br ^bb164
^bb163:
cf.br ^bb164
^bb164:
func.call @free(%811) : (!llvm.ptr) -> ()
func.call @free(%814) : (!llvm.ptr) -> ()
%1128 = llvm.load %758 : !llvm.ptr -> i32
%1129 = arith.constant 0 : i32
%1130 = arith.cmpi ne, %1128, %1129 : i32
cf.cond_br %1130, ^bb210, ^bb211
^bb210:
cf.br ^bb122
^bb211:
cf.br ^bb212
^bb212:
%1131 = llvm.load %762 : !llvm.ptr -> f64
%1132 = arith.constant 2.0 : f32
%1134 = arith.extf %1132 : f32 to f64
%1133 = arith.mulf %1131, %1134 : f64
llvm.store %1133, %762 : f64, !llvm.ptr
cf.br ^bb120
^bb122:
%1135 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1136 = llvm.load %755 : !llvm.ptr -> i64
%1137 = llvm.call @printf(%1135, %1136) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%724) : (!llvm.ptr) -> ()
func.call @free(%719) : (!llvm.ptr) -> ()
func.call @free(%714) : (!llvm.ptr) -> ()
func.call @free(%584) : (!llvm.ptr) -> ()
func.call @free(%462) : (!llvm.ptr) -> ()
func.call @free(%459) : (!llvm.ptr) -> ()
%1144 = arith.constant 0 : i32
func.return %1144 : i32
}
}