← All problems
Problem 646
Bounded Divisors: S(70!, 10^20, 10^60) mod 1e9+7, where S sums lambda(d) * d over divisors d of 70! in [L, H]. Meet in the middle over the 3.5e12 divisors: primes are split greedily into two sets with balanced divisor counts; the smaller side is enumerated, sorted, and prefix-summed (lambda(b) * b mod p), the other side streams with a binary-searched range per divisor. Ordering uses exact 90-bit fixed-point logs: keys add exactly, so a divisor equal to a bound compares equal, and otherwise |d - 10^E| >= 1 gives a log gap >= ~4e-21, dwarfing the < 2e-25 rounding error. Verified against exact enumeration for S(10!,1e2,1e3) = 1457, S(15!,1e3,1e5) = -107974, S(30!,1e8,1e12) = 9766732243224.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^3)O(n log log n)
Space complexity O(n^2)O(n)
Approach Flow solution Sieve-based divisor sums
Verdict Suboptimal
Flow source
# Project Euler 646
# Bounded Divisors: S(70!, 10^20, 10^60) mod 1e9+7, where S sums
# lambda(d) * d over divisors d of 70! in [L, H].
#
# Meet in the middle over the 3.5e12 divisors: primes are split greedily
# into two sets with balanced divisor counts; the smaller side is
# enumerated, sorted, and prefix-summed (lambda(b) * b mod p), the other
# side streams with a binary-searched range per divisor.
# Ordering uses exact 90-bit fixed-point logs: keys add exactly, so a
# divisor equal to a bound compares equal, and otherwise |d - 10^E| >= 1
# gives a log gap >= ~4e-21, dwarfing the < 2e-25 rounding error.
# Verified against exact enumeration for S(10!,1e2,1e3) = 1457,
# S(15!,1e3,1e5) = -107974, S(30!,1e8,1e12) = 9766732243224.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
const MOD: i64 = 1000000007
const NFACT: i64 = 70
const LEXP: i64 = 20 # L = 10^LEXP
const HEXP: i64 = 60 # H = 10^HEXP
const BCAP: i64 = 4200000
function key_of(lp_hi: ptr<i64>, lp_lo: ptr<i64>, p: i64) -> i128 {
let sh: i128 = 35184372088832 as i128 # 2^45
return (lp_hi[p] as i128) * sh + (lp_lo[p] as i128)
}
# iterative quicksort on (keys i128, vals i64)
function qsort_kv(keys: ptr<i128>, vals: ptr<i64>, n: i64) -> void {
let stk: ptr<i64> = calloc(256, 8)
let mut sp: i64 = 0
stk[0] = 0
stk[1] = n - 1
sp = 2
while sp > 0 {
let hi: i64 = stk[sp - 1]
let lo: i64 = stk[sp - 2]
sp = sp - 2
if lo < hi {
if hi - lo < 12 {
# insertion sort
let mut i: i64 = lo + 1
while i <= hi {
let kk: i128 = keys[i]
let vv: i64 = vals[i]
let mut j: i64 = i - 1
while j >= lo && keys[j] > kk {
keys[j + 1] = keys[j]
vals[j + 1] = vals[j]
j = j - 1
}
keys[j + 1] = kk
vals[j + 1] = vv
i = i + 1
}
} else {
# median of three -> pivot at hi
let mid: i64 = (lo + hi) / 2
if keys[mid] < keys[lo] {
let tk: i128 = keys[mid]; keys[mid] = keys[lo]; keys[lo] = tk
let tv: i64 = vals[mid]; vals[mid] = vals[lo]; vals[lo] = tv
}
if keys[hi] < keys[lo] {
let tk: i128 = keys[hi]; keys[hi] = keys[lo]; keys[lo] = tk
let tv: i64 = vals[hi]; vals[hi] = vals[lo]; vals[lo] = tv
}
if keys[hi] < keys[mid] {
let tk: i128 = keys[hi]; keys[hi] = keys[mid]; keys[mid] = tk
let tv: i64 = vals[hi]; vals[hi] = vals[mid]; vals[mid] = tv
}
let piv: i128 = keys[mid]
let mut i: i64 = lo
let mut j: i64 = hi
while i <= j {
while keys[i] < piv {
i = i + 1
}
while keys[j] > piv {
j = j - 1
}
if i <= j {
let tk: i128 = keys[i]; keys[i] = keys[j]; keys[j] = tk
let tv: i64 = vals[i]; vals[i] = vals[j]; vals[j] = tv
i = i + 1
j = j - 1
}
}
stk[sp] = lo; stk[sp + 1] = j; sp = sp + 2
stk[sp] = i; stk[sp + 1] = hi; sp = sp + 2
}
}
}
free(stk)
}
# recursive streaming over A-side divisors
function walkA(ip: i64, nA: i64, aprimes: ptr<i64>, aexp: ptr<i64>,
lp_hi: ptr<i64>, lp_lo: ptr<i64>,
key: i128, sgn: i64, vmod: i64,
klo0: i128, khi0: i128,
bkeys: ptr<i128>, bpref: ptr<i64>, nb: i64,
acc: ptr<i64>) -> void {
if ip == nA {
let klo: i128 = klo0 - key
let khi: i128 = khi0 - key
# first index with bkey >= klo
let mut lo: i64 = 0
let mut hi: i64 = nb
while lo < hi {
let mid: i64 = (lo + hi) / 2
if bkeys[mid] < klo {
lo = mid + 1
} else {
hi = mid
}
}
let i0: i64 = lo
# first index with bkey > khi
lo = 0
hi = nb
while lo < hi {
let mid: i64 = (lo + hi) / 2
if bkeys[mid] <= khi {
lo = mid + 1
} else {
hi = mid
}
}
let i1: i64 = lo
if i1 > i0 {
let rangesum: i64 = ((bpref[i1] - bpref[i0]) % MOD + MOD) % MOD
let term: i64 = vmod * rangesum % MOD
if sgn == 1 {
acc[0] = (acc[0] + term) % MOD
} else {
acc[0] = (acc[0] - term + MOD) % MOD
}
}
return
}
let p: i64 = aprimes[ip]
let e: i64 = aexp[ip]
let kp: i128 = key_of(lp_hi, lp_lo, p)
let mut k: i128 = key
let mut s: i64 = sgn
let mut m: i64 = vmod
let mut j: i64 = 0
while j <= e {
walkA(ip + 1, nA, aprimes, aexp, lp_hi, lp_lo, k, s, m,
klo0, khi0, bkeys, bpref, nb, acc)
k = k + kp
s = 0 - s
m = m * (p % MOD) % MOD
j = j + 1
}
}
function main() -> i32 {
let lp_hi: ptr<i64> = calloc(70, 8)
let lp_lo: ptr<i64> = calloc(70, 8)
lp_hi[2] = 35184372088832; lp_lo[2] = 0
lp_hi[3] = 55765910372218; lp_lo[3] = 28718273670216
lp_hi[5] = 81695582054029; lp_lo[5] = 27143733165936
lp_hi[7] = 98775020163088; lp_lo[7] = 24656546046991
lp_hi[11] = 121717929286005; lp_lo[11] = 1030321070489
lp_hi[13] = 130197647935368; lp_lo[13] = 28010264356978
lp_hi[17] = 143814813505826; lp_lo[17] = 13580471717386
lp_hi[19] = 149460662239386; lp_lo[19] = 348383530181
lp_hi[23] = 159158687028794; lp_lo[23] = 22862384261715
lp_hi[29] = 170925010933042; lp_lo[29] = 30002115389543
lp_hi[31] = 174310286385770; lp_lo[31] = 15759379298558
lp_hi[37] = 183291345595707; lp_lo[37] = 5083077604958
lp_hi[41] = 188502103215750; lp_lo[41] = 15279225905332
lp_hi[43] = 190919718181953; lp_lo[43] = 11039161118608
lp_hi[47] = 195434720957904; lp_lo[47] = 1908955837756
lp_hi[53] = 201533284568583; lp_lo[53] = 11514214811642
lp_hi[59] = 206977101914528; lp_lo[59] = 11709912803785
lp_hi[61] = 208669269245941; lp_lo[61] = 14894089328475
lp_hi[67] = 213431539201107; lp_lo[67] = 33444092302059
# primes up to NFACT and exponents in NFACT!
let primes: ptr<i64> = calloc(32, 8)
let exps: ptr<i64> = calloc(32, 8)
let mut np: i64 = 0
let mut cand: i64 = 2
while cand <= NFACT {
let mut isp: i64 = 1
let mut q: i64 = 2
while q * q <= cand {
if cand % q == 0 {
isp = 0
}
q = q + 1
}
if isp == 1 {
let mut e: i64 = 0
let mut pw: i64 = cand
while pw <= NFACT {
e = e + NFACT / pw
if pw > NFACT / cand {
pw = NFACT + 1
} else {
pw = pw * cand
}
}
primes[np] = cand
exps[np] = e
np = np + 1
}
cand = cand + 1
}
# greedy split by descending (e+1): assign to the side with the
# smaller current divisor-count product
let ordv: ptr<i64> = calloc(32, 8)
let mut i: i64 = 0
while i < np {
ordv[i] = i
i = i + 1
}
# selection sort by exps desc (stable enough; ties by prime asc)
i = 0
while i < np {
let mut best: i64 = i
let mut j: i64 = i + 1
while j < np {
if exps[ordv[j]] > exps[ordv[best]] {
best = j
}
j = j + 1
}
let t: i64 = ordv[i]
ordv[i] = ordv[best]
ordv[best] = t
i = i + 1
}
let aidx: ptr<i64> = calloc(32, 8)
let bidx: ptr<i64> = calloc(32, 8)
let mut nA: i64 = 0
let mut nB: i64 = 0
let mut ta: i64 = 1
let mut tb: i64 = 1
i = 0
while i < np {
let pi: i64 = ordv[i]
if ta <= tb {
aidx[nA] = pi
nA = nA + 1
ta = ta * (exps[pi] + 1)
} else {
bidx[nB] = pi
nB = nB + 1
tb = tb * (exps[pi] + 1)
}
i = i + 1
}
# enumerate B divisors iteratively
let bkeys: ptr<i128> = calloc(BCAP, 16)
let bval: ptr<i64> = calloc(BCAP, 8) # signed lambda*b mod
bkeys[0] = 0 as i128
bval[0] = 1
let mut nb: i64 = 1
i = 0
while i < nB {
let p: i64 = primes[bidx[i]]
let e: i64 = exps[bidx[i]]
let kp: i128 = key_of(lp_hi, lp_lo, p)
let old: i64 = nb
let mut kacc: i128 = 0 as i128
let mut sacc: i64 = 1
let mut macc: i64 = 1
let mut j: i64 = 1
while j <= e {
kacc = kacc + kp
sacc = 0 - sacc
macc = macc * (p % MOD) % MOD
let mut u: i64 = 0
while u < old {
bkeys[nb] = bkeys[u] + kacc
let mut v: i64 = bval[u] * macc % MOD
if sacc == 0 - 1 {
v = 0 - v
}
bval[nb] = v
nb = nb + 1
u = u + 1
}
j = j + 1
}
i = i + 1
}
qsort_kv(bkeys, bval, nb)
# prefix sums (mod, kept non-negative)
let bpref: ptr<i64> = calloc(nb + 1, 8)
bpref[0] = 0
i = 0
while i < nb {
bpref[i + 1] = ((bpref[i] + bval[i]) % MOD + MOD) % MOD
i = i + 1
}
# bounds: 10^E keys
let k10: i128 = key_of(lp_hi, lp_lo, 2) + key_of(lp_hi, lp_lo, 5)
let klo0: i128 = k10 * (LEXP as i128)
let khi0: i128 = k10 * (HEXP as i128)
# stream A side
let aprimes: ptr<i64> = calloc(32, 8)
let aexp: ptr<i64> = calloc(32, 8)
i = 0
while i < nA {
aprimes[i] = primes[aidx[i]]
aexp[i] = exps[aidx[i]]
i = i + 1
}
let acc: ptr<i64> = calloc(1, 8)
walkA(0, nA, aprimes, aexp, lp_hi, lp_lo, 0 as i128, 1, 1,
klo0, khi0, bkeys, bpref, nb, acc)
printf("%lld\n", acc[0])
free(lp_hi)
free(lp_lo)
free(primes)
free(exps)
free(ordv)
free(aidx)
free(bidx)
free(bkeys)
free(bval)
free(bpref)
free(aprimes)
free(aexp)
free(acc)
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; }
__int128 key_of_ptr_i64_ptr_i64_i64(int64_t* lp_hi, int64_t* lp_lo, int64_t p);
void qsort_kv_ptr_i128_ptr_i64_i64(__int128* keys, int64_t* vals, int64_t n);
void walkA_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i128_i64_i64_i128_i128_ptr_i128_ptr_i64_i64_ptr_i64(int64_t ip, int64_t nA, int64_t* aprimes, int64_t* aexp, int64_t* lp_hi, int64_t* lp_lo, __int128 key, int64_t sgn, int64_t vmod, __int128 klo0, __int128 khi0, __int128* bkeys, int64_t* bpref, int64_t nb, int64_t* acc);
int32_t main(void);
static const int64_t MOD = 1000000007;
static const int64_t NFACT = 70;
static const int64_t LEXP = 20;
static const int64_t HEXP = 60;
static const int64_t BCAP = 4200000;
__int128 key_of_ptr_i64_ptr_i64_i64(int64_t* lp_hi, int64_t* lp_lo, int64_t p) {
__int128 sh = ((__int128)(35184372088832));
return ((((__int128)(lp_hi[p])) * sh) + ((__int128)(lp_lo[p])));
}
void qsort_kv_ptr_i128_ptr_i64_i64(__int128* keys, int64_t* vals, int64_t n) {
int64_t* stk = (int64_t*)(calloc(256, 8));
int64_t sp = 0;
stk[0] = 0;
stk[1] = (n - 1);
sp = 2;
while (sp > 0) {
int64_t hi = stk[(sp - 1)];
int64_t lo = stk[(sp - 2)];
sp = (sp - 2);
if (lo < hi) {
if ((hi - lo) < 12) {
int64_t i = (lo + 1);
while (i <= hi) {
__int128 kk = keys[i];
int64_t vv = vals[i];
int64_t j = (i - 1);
while ((j >= lo && keys[j] > kk)) {
keys[(j + 1)] = keys[j];
vals[(j + 1)] = vals[j];
j = (j - 1);
}
keys[(j + 1)] = kk;
vals[(j + 1)] = vv;
i = (i + 1);
}
} else {
int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
if (keys[mid] < keys[lo]) {
__int128 tk = keys[mid];
keys[mid] = keys[lo];
keys[lo] = tk;
int64_t tv = vals[mid];
vals[mid] = vals[lo];
vals[lo] = tv;
}
if (keys[hi] < keys[lo]) {
__int128 tk = keys[hi];
keys[hi] = keys[lo];
keys[lo] = tk;
int64_t tv = vals[hi];
vals[hi] = vals[lo];
vals[lo] = tv;
}
if (keys[hi] < keys[mid]) {
__int128 tk = keys[hi];
keys[hi] = keys[mid];
keys[mid] = tk;
int64_t tv = vals[hi];
vals[hi] = vals[mid];
vals[mid] = tv;
}
__int128 piv = keys[mid];
int64_t i = lo;
int64_t j = hi;
while (i <= j) {
while (keys[i] < piv) {
i = (i + 1);
}
while (keys[j] > piv) {
j = (j - 1);
}
if (i <= j) {
__int128 tk = keys[i];
keys[i] = keys[j];
keys[j] = tk;
int64_t tv = vals[i];
vals[i] = vals[j];
vals[j] = tv;
i = (i + 1);
j = (j - 1);
}
}
stk[sp] = lo;
stk[(sp + 1)] = j;
sp = (sp + 2);
stk[sp] = i;
stk[(sp + 1)] = hi;
sp = (sp + 2);
}
}
}
free(stk);
}
void walkA_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i128_i64_i64_i128_i128_ptr_i128_ptr_i64_i64_ptr_i64(int64_t ip, int64_t nA, int64_t* aprimes, int64_t* aexp, int64_t* lp_hi, int64_t* lp_lo, __int128 key, int64_t sgn, int64_t vmod, __int128 klo0, __int128 khi0, __int128* bkeys, int64_t* bpref, int64_t nb, int64_t* acc) {
if (ip == nA) {
__int128 klo = (klo0 - key);
__int128 khi = (khi0 - key);
int64_t lo = 0;
int64_t hi = nb;
while (lo < hi) {
int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
if (bkeys[mid] < klo) {
lo = (mid + 1);
} else {
hi = mid;
}
}
int64_t i0 = lo;
lo = 0;
hi = nb;
while (lo < hi) {
int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
if (bkeys[mid] <= khi) {
lo = (mid + 1);
} else {
hi = mid;
}
}
int64_t i1 = lo;
if (i1 > i0) {
int64_t rangesum = FLOW_CHECKED_MOD(((FLOW_CHECKED_MOD(((bpref[i1] - bpref[i0])), (MOD)) + MOD)), (MOD));
int64_t term = FLOW_CHECKED_MOD(((vmod * rangesum)), (MOD));
if (sgn == 1) {
acc[0] = FLOW_CHECKED_MOD(((acc[0] + term)), (MOD));
} else {
acc[0] = FLOW_CHECKED_MOD((((acc[0] - term) + MOD)), (MOD));
}
}
return;
}
int64_t p = aprimes[ip];
int64_t e = aexp[ip];
__int128 kp = key_of_ptr_i64_ptr_i64_i64(lp_hi, lp_lo, p);
__int128 k = key;
int64_t s = sgn;
int64_t m = vmod;
int64_t j = 0;
while (j <= e) {
walkA_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i128_i64_i64_i128_i128_ptr_i128_ptr_i64_i64_ptr_i64((ip + 1), nA, aprimes, aexp, lp_hi, lp_lo, k, s, m, klo0, khi0, bkeys, bpref, nb, acc);
k = (k + kp);
s = (0 - s);
m = FLOW_CHECKED_MOD(((m * FLOW_CHECKED_MOD((p), (MOD)))), (MOD));
j = (j + 1);
}
}
int32_t main(void) {
int64_t* lp_hi = (int64_t*)(calloc(70, 8));
int64_t* lp_lo = (int64_t*)(calloc(70, 8));
lp_hi[2] = 35184372088832;
lp_lo[2] = 0;
lp_hi[3] = 55765910372218;
lp_lo[3] = 28718273670216;
lp_hi[5] = 81695582054029;
lp_lo[5] = 27143733165936;
lp_hi[7] = 98775020163088;
lp_lo[7] = 24656546046991;
lp_hi[11] = 121717929286005;
lp_lo[11] = 1030321070489;
lp_hi[13] = 130197647935368;
lp_lo[13] = 28010264356978;
lp_hi[17] = 143814813505826;
lp_lo[17] = 13580471717386;
lp_hi[19] = 149460662239386;
lp_lo[19] = 348383530181;
lp_hi[23] = 159158687028794;
lp_lo[23] = 22862384261715;
lp_hi[29] = 170925010933042;
lp_lo[29] = 30002115389543;
lp_hi[31] = 174310286385770;
lp_lo[31] = 15759379298558;
lp_hi[37] = 183291345595707;
lp_lo[37] = 5083077604958;
lp_hi[41] = 188502103215750;
lp_lo[41] = 15279225905332;
lp_hi[43] = 190919718181953;
lp_lo[43] = 11039161118608;
lp_hi[47] = 195434720957904;
lp_lo[47] = 1908955837756;
lp_hi[53] = 201533284568583;
lp_lo[53] = 11514214811642;
lp_hi[59] = 206977101914528;
lp_lo[59] = 11709912803785;
lp_hi[61] = 208669269245941;
lp_lo[61] = 14894089328475;
lp_hi[67] = 213431539201107;
lp_lo[67] = 33444092302059;
int64_t* primes = (int64_t*)(calloc(32, 8));
int64_t* exps = (int64_t*)(calloc(32, 8));
int64_t np = 0;
int64_t cand = 2;
while (cand <= NFACT) {
int64_t isp = 1;
int64_t q = 2;
while ((q * q) <= cand) {
if (FLOW_CHECKED_MOD((cand), (q)) == 0) {
isp = 0;
}
q = (q + 1);
}
if (isp == 1) {
int64_t e = 0;
int64_t pw = cand;
while (pw <= NFACT) {
e = (e + FLOW_CHECKED_DIV((NFACT), (pw)));
if (pw > FLOW_CHECKED_DIV((NFACT), (cand))) {
pw = (NFACT + 1);
} else {
pw = (pw * cand);
}
}
primes[np] = cand;
exps[np] = e;
np = (np + 1);
}
cand = (cand + 1);
}
int64_t* ordv = (int64_t*)(calloc(32, 8));
int64_t i = 0;
while (i < np) {
ordv[i] = i;
i = (i + 1);
}
i = 0;
while (i < np) {
int64_t best = i;
int64_t j = (i + 1);
while (j < np) {
if (exps[ordv[j]] > exps[ordv[best]]) {
best = j;
}
j = (j + 1);
}
int64_t t = ordv[i];
ordv[i] = ordv[best];
ordv[best] = t;
i = (i + 1);
}
int64_t* aidx = (int64_t*)(calloc(32, 8));
int64_t* bidx = (int64_t*)(calloc(32, 8));
int64_t nA = 0;
int64_t nB = 0;
int64_t ta = 1;
int64_t tb = 1;
i = 0;
while (i < np) {
int64_t pi = ordv[i];
if (ta <= tb) {
aidx[nA] = pi;
nA = (nA + 1);
ta = (ta * (exps[pi] + 1));
} else {
bidx[nB] = pi;
nB = (nB + 1);
tb = (tb * (exps[pi] + 1));
}
i = (i + 1);
}
__int128* bkeys = (__int128*)(calloc(BCAP, 16));
int64_t* bval = (int64_t*)(calloc(BCAP, 8));
bkeys[0] = ((__int128)(0));
bval[0] = 1;
int64_t nb = 1;
i = 0;
while (i < nB) {
int64_t p = primes[bidx[i]];
int64_t e = exps[bidx[i]];
__int128 kp = key_of_ptr_i64_ptr_i64_i64(lp_hi, lp_lo, p);
int64_t old = nb;
__int128 kacc = ((__int128)(0));
int64_t sacc = 1;
int64_t macc = 1;
int64_t j = 1;
while (j <= e) {
kacc = (kacc + kp);
sacc = (0 - sacc);
macc = FLOW_CHECKED_MOD(((macc * FLOW_CHECKED_MOD((p), (MOD)))), (MOD));
int64_t u = 0;
while (u < old) {
bkeys[nb] = (bkeys[u] + kacc);
int64_t v = FLOW_CHECKED_MOD(((bval[u] * macc)), (MOD));
if (sacc == (0 - 1)) {
v = (0 - v);
}
bval[nb] = v;
nb = (nb + 1);
u = (u + 1);
}
j = (j + 1);
}
i = (i + 1);
}
qsort_kv_ptr_i128_ptr_i64_i64(bkeys, bval, nb);
int64_t* bpref = (int64_t*)(calloc((nb + 1), 8));
bpref[0] = 0;
i = 0;
while (i < nb) {
bpref[(i + 1)] = FLOW_CHECKED_MOD(((FLOW_CHECKED_MOD(((bpref[i] + bval[i])), (MOD)) + MOD)), (MOD));
i = (i + 1);
}
__int128 k10 = (key_of_ptr_i64_ptr_i64_i64(lp_hi, lp_lo, 2) + key_of_ptr_i64_ptr_i64_i64(lp_hi, lp_lo, 5));
__int128 klo0 = (k10 * ((__int128)(LEXP)));
__int128 khi0 = (k10 * ((__int128)(HEXP)));
int64_t* aprimes = (int64_t*)(calloc(32, 8));
int64_t* aexp = (int64_t*)(calloc(32, 8));
i = 0;
while (i < nA) {
aprimes[i] = primes[aidx[i]];
aexp[i] = exps[aidx[i]];
i = (i + 1);
}
int64_t* acc = (int64_t*)(calloc(1, 8));
walkA_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i128_i64_i64_i128_i128_ptr_i128_ptr_i64_i64_ptr_i64(0, nA, aprimes, aexp, lp_hi, lp_lo, ((__int128)(0)), 1, 1, klo0, khi0, bkeys, bpref, nb, acc);
printf("%lld\n", acc[0]);
free(lp_hi);
free(lp_lo);
free(primes);
free(exps);
free(ordv);
free(aidx);
free(bidx);
free(bkeys);
free(bval);
free(bpref);
free(aprimes);
free(aexp);
free(acc);
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) -> ()
// Constant: MOD
llvm.mlir.global internal constant @MOD(1000000007 : i64) : i64
// Constant: NFACT
llvm.mlir.global internal constant @NFACT(70 : i64) : i64
// Constant: LEXP
llvm.mlir.global internal constant @LEXP(20 : i64) : i64
// Constant: HEXP
llvm.mlir.global internal constant @HEXP(60 : i64) : i64
// Constant: BCAP
llvm.mlir.global internal constant @BCAP(4200000 : i64) : i64
func.func @key_of(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64) -> i128 {
%0 = arith.constant 35180077121536 : i32
%1 = arith.extsi %0 : i32 to i128
%3 = llvm.getelementptr %arg0[%arg2] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%2 = llvm.load %3 : !llvm.ptr -> i64
%4 = arith.extsi %2 : i64 to i128
%6 = arith.trunci %4 : i128 to i64
%7 = arith.trunci %1 : i128 to i64
%5 = arith.muli %6, %7 : i64
%9 = llvm.getelementptr %arg1[%arg2] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%8 = llvm.load %9 : !llvm.ptr -> i64
%10 = arith.extsi %8 : i64 to i128
%12 = arith.trunci %10 : i128 to i64
%11 = arith.addi %5, %12 : i64
%13 = arith.extsi %11 : i64 to i128
func.return %13 : i128
}
func.func @qsort_kv(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64) -> () {
%15 = arith.constant 256 : i32
%16 = arith.constant 8 : i32
%17 = arith.extsi %15 : i32 to i64
%18 = arith.extsi %16 : i32 to i64
%14 = func.call @calloc(%17, %18) : (i64, i64) -> !llvm.ptr
%19 = arith.constant 0 : i32
%20 = arith.extsi %19 : i32 to i64
%21 = llvm.mlir.constant(1 : i64) : i64
%22 = llvm.alloca %21 x i64 : (i64) -> !llvm.ptr
llvm.store %20, %22 : i64, !llvm.ptr
%23 = arith.constant 0 : i32
%24 = arith.constant 0 : i32
%25 = arith.extsi %23 : i32 to i64
%26 = arith.extsi %24 : i32 to i64
%27 = llvm.getelementptr %14[%26] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %25, %27 : i64, !llvm.ptr
%28 = arith.constant 1 : i32
%30 = arith.extsi %28 : i32 to i64
%29 = arith.subi %arg2, %30 : i64
%31 = arith.constant 1 : i32
%32 = arith.extsi %31 : i32 to i64
%33 = llvm.getelementptr %14[%32] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %29, %33 : i64, !llvm.ptr
%34 = arith.constant 2 : i32
%35 = arith.extsi %34 : i32 to i64
llvm.store %35, %22 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%36 = llvm.load %22 : !llvm.ptr -> i64
%37 = arith.constant 0 : i32
%39 = arith.extsi %37 : i32 to i64
%38 = arith.cmpi sgt, %36, %39 : i64
cf.cond_br %38, ^bb1, ^bb2
^bb1:
%41 = llvm.load %22 : !llvm.ptr -> i64
%42 = arith.constant 1 : i32
%44 = arith.extsi %42 : i32 to i64
%43 = arith.subi %41, %44 : i64
%45 = llvm.getelementptr %14[%43] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%40 = llvm.load %45 : !llvm.ptr -> i64
%47 = llvm.load %22 : !llvm.ptr -> i64
%48 = arith.constant 2 : i32
%50 = arith.extsi %48 : i32 to i64
%49 = arith.subi %47, %50 : i64
%51 = llvm.getelementptr %14[%49] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%46 = llvm.load %51 : !llvm.ptr -> i64
%52 = llvm.load %22 : !llvm.ptr -> i64
%53 = arith.constant 2 : i32
%55 = arith.extsi %53 : i32 to i64
%54 = arith.subi %52, %55 : i64
llvm.store %54, %22 : i64, !llvm.ptr
%56 = arith.cmpi slt, %46, %40 : i64
cf.cond_br %56, ^bb3, ^bb4
^bb3:
%57 = arith.subi %40, %46 : i64
%58 = arith.constant 12 : i32
%60 = arith.extsi %58 : i32 to i64
%59 = arith.cmpi slt, %57, %60 : i64
cf.cond_br %59, ^bb6, ^bb7
^bb6:
%61 = arith.constant 1 : i32
%63 = arith.extsi %61 : i32 to i64
%62 = arith.addi %46, %63 : i64
%64 = llvm.mlir.constant(1 : i64) : i64
%65 = llvm.alloca %64 x i64 : (i64) -> !llvm.ptr
llvm.store %62, %65 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%66 = llvm.load %65 : !llvm.ptr -> i64
%67 = arith.cmpi sle, %66, %40 : i64
cf.cond_br %67, ^bb10, ^bb11
^bb10:
%69 = llvm.load %65 : !llvm.ptr -> i64
%70 = llvm.getelementptr %arg0[%69] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%68 = llvm.load %70 : !llvm.ptr -> i128
%72 = llvm.load %65 : !llvm.ptr -> i64
%73 = llvm.getelementptr %arg1[%72] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%71 = llvm.load %73 : !llvm.ptr -> i64
%74 = llvm.load %65 : !llvm.ptr -> i64
%75 = arith.constant 1 : i32
%77 = arith.extsi %75 : i32 to i64
%76 = arith.subi %74, %77 : i64
%78 = llvm.mlir.constant(1 : i64) : i64
%79 = llvm.alloca %78 x i64 : (i64) -> !llvm.ptr
llvm.store %76, %79 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%80 = llvm.load %79 : !llvm.ptr -> i64
%81 = arith.cmpi sge, %80, %46 : i64
%82 = scf.if %81 -> (i1) {
%84 = llvm.load %79 : !llvm.ptr -> i64
%85 = llvm.getelementptr %arg0[%84] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%83 = llvm.load %85 : !llvm.ptr -> i128
%87 = arith.trunci %83 : i128 to i64
%88 = arith.trunci %68 : i128 to i64
%86 = arith.cmpi sgt, %87, %88 : i64
scf.yield %86 : i1
} else {
%89 = arith.constant false
scf.yield %89 : i1
}
cf.cond_br %82, ^bb13, ^bb14
^bb13:
%91 = llvm.load %79 : !llvm.ptr -> i64
%92 = llvm.getelementptr %arg0[%91] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%90 = llvm.load %92 : !llvm.ptr -> i128
%93 = llvm.load %79 : !llvm.ptr -> i64
%94 = arith.constant 1 : i32
%96 = arith.extsi %94 : i32 to i64
%95 = arith.addi %93, %96 : i64
%97 = llvm.getelementptr %arg0[%95] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %90, %97 : i128, !llvm.ptr
%99 = llvm.load %79 : !llvm.ptr -> i64
%100 = llvm.getelementptr %arg1[%99] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%98 = llvm.load %100 : !llvm.ptr -> i64
%101 = llvm.load %79 : !llvm.ptr -> i64
%102 = arith.constant 1 : i32
%104 = arith.extsi %102 : i32 to i64
%103 = arith.addi %101, %104 : i64
%105 = llvm.getelementptr %arg1[%103] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %98, %105 : i64, !llvm.ptr
%106 = llvm.load %79 : !llvm.ptr -> i64
%107 = arith.constant 1 : i32
%109 = arith.extsi %107 : i32 to i64
%108 = arith.subi %106, %109 : i64
llvm.store %108, %79 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%110 = llvm.load %79 : !llvm.ptr -> i64
%111 = arith.constant 1 : i32
%113 = arith.extsi %111 : i32 to i64
%112 = arith.addi %110, %113 : i64
%114 = llvm.getelementptr %arg0[%112] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %68, %114 : i128, !llvm.ptr
%115 = llvm.load %79 : !llvm.ptr -> i64
%116 = arith.constant 1 : i32
%118 = arith.extsi %116 : i32 to i64
%117 = arith.addi %115, %118 : i64
%119 = llvm.getelementptr %arg1[%117] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %71, %119 : i64, !llvm.ptr
%120 = llvm.load %65 : !llvm.ptr -> i64
%121 = arith.constant 1 : i32
%123 = arith.extsi %121 : i32 to i64
%122 = arith.addi %120, %123 : i64
llvm.store %122, %65 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
cf.br ^bb8
^bb7:
%124 = arith.addi %46, %40 : i64
%125 = arith.constant 2 : i32
%127 = arith.extsi %125 : i32 to i64
%126 = arith.divsi %124, %127 : i64
%129 = llvm.getelementptr %arg0[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%128 = llvm.load %129 : !llvm.ptr -> i128
%131 = llvm.getelementptr %arg0[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%130 = llvm.load %131 : !llvm.ptr -> i128
%133 = arith.trunci %128 : i128 to i64
%134 = arith.trunci %130 : i128 to i64
%132 = arith.cmpi slt, %133, %134 : i64
cf.cond_br %132, ^bb15, ^bb16
^bb15:
%136 = llvm.getelementptr %arg0[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%135 = llvm.load %136 : !llvm.ptr -> i128
%138 = llvm.getelementptr %arg0[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%137 = llvm.load %138 : !llvm.ptr -> i128
%139 = llvm.getelementptr %arg0[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %137, %139 : i128, !llvm.ptr
%140 = llvm.getelementptr %arg0[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %135, %140 : i128, !llvm.ptr
%142 = llvm.getelementptr %arg1[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%141 = llvm.load %142 : !llvm.ptr -> i64
%144 = llvm.getelementptr %arg1[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%143 = llvm.load %144 : !llvm.ptr -> i64
%145 = llvm.getelementptr %arg1[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %143, %145 : i64, !llvm.ptr
%146 = llvm.getelementptr %arg1[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %141, %146 : i64, !llvm.ptr
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%148 = llvm.getelementptr %arg0[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%147 = llvm.load %148 : !llvm.ptr -> i128
%150 = llvm.getelementptr %arg0[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%149 = llvm.load %150 : !llvm.ptr -> i128
%152 = arith.trunci %147 : i128 to i64
%153 = arith.trunci %149 : i128 to i64
%151 = arith.cmpi slt, %152, %153 : i64
cf.cond_br %151, ^bb18, ^bb19
^bb18:
%155 = llvm.getelementptr %arg0[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%154 = llvm.load %155 : !llvm.ptr -> i128
%157 = llvm.getelementptr %arg0[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%156 = llvm.load %157 : !llvm.ptr -> i128
%158 = llvm.getelementptr %arg0[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %156, %158 : i128, !llvm.ptr
%159 = llvm.getelementptr %arg0[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %154, %159 : i128, !llvm.ptr
%161 = llvm.getelementptr %arg1[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%160 = llvm.load %161 : !llvm.ptr -> i64
%163 = llvm.getelementptr %arg1[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%162 = llvm.load %163 : !llvm.ptr -> i64
%164 = llvm.getelementptr %arg1[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %162, %164 : i64, !llvm.ptr
%165 = llvm.getelementptr %arg1[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %160, %165 : i64, !llvm.ptr
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
%167 = llvm.getelementptr %arg0[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%166 = llvm.load %167 : !llvm.ptr -> i128
%169 = llvm.getelementptr %arg0[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%168 = llvm.load %169 : !llvm.ptr -> i128
%171 = arith.trunci %166 : i128 to i64
%172 = arith.trunci %168 : i128 to i64
%170 = arith.cmpi slt, %171, %172 : i64
cf.cond_br %170, ^bb21, ^bb22
^bb21:
%174 = llvm.getelementptr %arg0[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%173 = llvm.load %174 : !llvm.ptr -> i128
%176 = llvm.getelementptr %arg0[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%175 = llvm.load %176 : !llvm.ptr -> i128
%177 = llvm.getelementptr %arg0[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %175, %177 : i128, !llvm.ptr
%178 = llvm.getelementptr %arg0[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %173, %178 : i128, !llvm.ptr
%180 = llvm.getelementptr %arg1[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%179 = llvm.load %180 : !llvm.ptr -> i64
%182 = llvm.getelementptr %arg1[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%181 = llvm.load %182 : !llvm.ptr -> i64
%183 = llvm.getelementptr %arg1[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %181, %183 : i64, !llvm.ptr
%184 = llvm.getelementptr %arg1[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %179, %184 : i64, !llvm.ptr
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
%186 = llvm.getelementptr %arg0[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%185 = llvm.load %186 : !llvm.ptr -> i128
%187 = llvm.mlir.constant(1 : i64) : i64
%188 = llvm.alloca %187 x i64 : (i64) -> !llvm.ptr
llvm.store %46, %188 : i64, !llvm.ptr
%189 = llvm.mlir.constant(1 : i64) : i64
%190 = llvm.alloca %189 x i64 : (i64) -> !llvm.ptr
llvm.store %40, %190 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%191 = llvm.load %188 : !llvm.ptr -> i64
%192 = llvm.load %190 : !llvm.ptr -> i64
%193 = arith.cmpi sle, %191, %192 : i64
cf.cond_br %193, ^bb25, ^bb26
^bb25:
cf.br ^bb27
^bb27:
%195 = llvm.load %188 : !llvm.ptr -> i64
%196 = llvm.getelementptr %arg0[%195] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%194 = llvm.load %196 : !llvm.ptr -> i128
%198 = arith.trunci %194 : i128 to i64
%199 = arith.trunci %185 : i128 to i64
%197 = arith.cmpi slt, %198, %199 : i64
cf.cond_br %197, ^bb28, ^bb29
^bb28:
%200 = llvm.load %188 : !llvm.ptr -> i64
%201 = arith.constant 1 : i32
%203 = arith.extsi %201 : i32 to i64
%202 = arith.addi %200, %203 : i64
llvm.store %202, %188 : i64, !llvm.ptr
cf.br ^bb27
^bb29:
cf.br ^bb30
^bb30:
%205 = llvm.load %190 : !llvm.ptr -> i64
%206 = llvm.getelementptr %arg0[%205] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%204 = llvm.load %206 : !llvm.ptr -> i128
%208 = arith.trunci %204 : i128 to i64
%209 = arith.trunci %185 : i128 to i64
%207 = arith.cmpi sgt, %208, %209 : i64
cf.cond_br %207, ^bb31, ^bb32
^bb31:
%210 = llvm.load %190 : !llvm.ptr -> i64
%211 = arith.constant 1 : i32
%213 = arith.extsi %211 : i32 to i64
%212 = arith.subi %210, %213 : i64
llvm.store %212, %190 : i64, !llvm.ptr
cf.br ^bb30
^bb32:
%214 = llvm.load %188 : !llvm.ptr -> i64
%215 = llvm.load %190 : !llvm.ptr -> i64
%216 = arith.cmpi sle, %214, %215 : i64
cf.cond_br %216, ^bb33, ^bb34
^bb33:
%218 = llvm.load %188 : !llvm.ptr -> i64
%219 = llvm.getelementptr %arg0[%218] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%217 = llvm.load %219 : !llvm.ptr -> i128
%221 = llvm.load %190 : !llvm.ptr -> i64
%222 = llvm.getelementptr %arg0[%221] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%220 = llvm.load %222 : !llvm.ptr -> i128
%223 = llvm.load %188 : !llvm.ptr -> i64
%224 = llvm.getelementptr %arg0[%223] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %220, %224 : i128, !llvm.ptr
%225 = llvm.load %190 : !llvm.ptr -> i64
%226 = llvm.getelementptr %arg0[%225] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %217, %226 : i128, !llvm.ptr
%228 = llvm.load %188 : !llvm.ptr -> i64
%229 = llvm.getelementptr %arg1[%228] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%227 = llvm.load %229 : !llvm.ptr -> i64
%231 = llvm.load %190 : !llvm.ptr -> i64
%232 = llvm.getelementptr %arg1[%231] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%230 = llvm.load %232 : !llvm.ptr -> i64
%233 = llvm.load %188 : !llvm.ptr -> i64
%234 = llvm.getelementptr %arg1[%233] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %230, %234 : i64, !llvm.ptr
%235 = llvm.load %190 : !llvm.ptr -> i64
%236 = llvm.getelementptr %arg1[%235] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %227, %236 : i64, !llvm.ptr
%237 = llvm.load %188 : !llvm.ptr -> i64
%238 = arith.constant 1 : i32
%240 = arith.extsi %238 : i32 to i64
%239 = arith.addi %237, %240 : i64
llvm.store %239, %188 : i64, !llvm.ptr
%241 = llvm.load %190 : !llvm.ptr -> i64
%242 = arith.constant 1 : i32
%244 = arith.extsi %242 : i32 to i64
%243 = arith.subi %241, %244 : i64
llvm.store %243, %190 : i64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
cf.br ^bb24
^bb26:
%245 = llvm.load %22 : !llvm.ptr -> i64
%246 = llvm.getelementptr %14[%245] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %46, %246 : i64, !llvm.ptr
%247 = llvm.load %190 : !llvm.ptr -> i64
%248 = llvm.load %22 : !llvm.ptr -> i64
%249 = arith.constant 1 : i32
%251 = arith.extsi %249 : i32 to i64
%250 = arith.addi %248, %251 : i64
%252 = llvm.getelementptr %14[%250] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %247, %252 : i64, !llvm.ptr
%253 = llvm.load %22 : !llvm.ptr -> i64
%254 = arith.constant 2 : i32
%256 = arith.extsi %254 : i32 to i64
%255 = arith.addi %253, %256 : i64
llvm.store %255, %22 : i64, !llvm.ptr
%257 = llvm.load %188 : !llvm.ptr -> i64
%258 = llvm.load %22 : !llvm.ptr -> i64
%259 = llvm.getelementptr %14[%258] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %257, %259 : i64, !llvm.ptr
%260 = llvm.load %22 : !llvm.ptr -> i64
%261 = arith.constant 1 : i32
%263 = arith.extsi %261 : i32 to i64
%262 = arith.addi %260, %263 : i64
%264 = llvm.getelementptr %14[%262] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %40, %264 : i64, !llvm.ptr
%265 = llvm.load %22 : !llvm.ptr -> i64
%266 = arith.constant 2 : i32
%268 = arith.extsi %266 : i32 to i64
%267 = arith.addi %265, %268 : i64
llvm.store %267, %22 : i64, !llvm.ptr
cf.br ^bb8
^bb8:
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
cf.br ^bb0
^bb2:
func.call @free(%14) : (!llvm.ptr) -> ()
func.return
}
func.func @walkA(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: i128, %arg7: i64, %arg8: i64, %arg9: i128, %arg10: i128, %arg11: !llvm.ptr, %arg12: !llvm.ptr, %arg13: i64, %arg14: !llvm.ptr) -> () {
%270 = arith.cmpi eq, %arg0, %arg1 : i64
cf.cond_br %270, ^bb36, ^bb37
^bb36:
%272 = arith.trunci %arg9 : i128 to i64
%273 = arith.trunci %arg6 : i128 to i64
%271 = arith.subi %272, %273 : i64
%274 = arith.extsi %271 : i64 to i128
%276 = arith.trunci %arg10 : i128 to i64
%277 = arith.trunci %arg6 : i128 to i64
%275 = arith.subi %276, %277 : i64
%278 = arith.extsi %275 : i64 to i128
%279 = arith.constant 0 : i32
%280 = arith.extsi %279 : i32 to i64
%281 = llvm.mlir.constant(1 : i64) : i64
%282 = llvm.alloca %281 x i64 : (i64) -> !llvm.ptr
llvm.store %280, %282 : i64, !llvm.ptr
%283 = llvm.mlir.constant(1 : i64) : i64
%284 = llvm.alloca %283 x i64 : (i64) -> !llvm.ptr
llvm.store %arg13, %284 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%285 = llvm.load %282 : !llvm.ptr -> i64
%286 = llvm.load %284 : !llvm.ptr -> i64
%287 = arith.cmpi slt, %285, %286 : i64
cf.cond_br %287, ^bb40, ^bb41
^bb40:
%288 = llvm.load %282 : !llvm.ptr -> i64
%289 = llvm.load %284 : !llvm.ptr -> i64
%290 = arith.addi %288, %289 : i64
%291 = arith.constant 2 : i32
%293 = arith.extsi %291 : i32 to i64
%292 = arith.divsi %290, %293 : i64
%295 = llvm.getelementptr %arg11[%292] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%294 = llvm.load %295 : !llvm.ptr -> i128
%297 = arith.trunci %294 : i128 to i64
%298 = arith.trunci %274 : i128 to i64
%296 = arith.cmpi slt, %297, %298 : i64
cf.cond_br %296, ^bb42, ^bb43
^bb42:
%299 = arith.constant 1 : i32
%301 = arith.extsi %299 : i32 to i64
%300 = arith.addi %292, %301 : i64
llvm.store %300, %282 : i64, !llvm.ptr
cf.br ^bb44
^bb43:
llvm.store %292, %284 : i64, !llvm.ptr
cf.br ^bb44
^bb44:
cf.br ^bb39
^bb41:
%302 = llvm.load %282 : !llvm.ptr -> i64
%303 = arith.constant 0 : i32
%304 = arith.extsi %303 : i32 to i64
llvm.store %304, %282 : i64, !llvm.ptr
llvm.store %arg13, %284 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%305 = llvm.load %282 : !llvm.ptr -> i64
%306 = llvm.load %284 : !llvm.ptr -> i64
%307 = arith.cmpi slt, %305, %306 : i64
cf.cond_br %307, ^bb46, ^bb47
^bb46:
%308 = llvm.load %282 : !llvm.ptr -> i64
%309 = llvm.load %284 : !llvm.ptr -> i64
%310 = arith.addi %308, %309 : i64
%311 = arith.constant 2 : i32
%313 = arith.extsi %311 : i32 to i64
%312 = arith.divsi %310, %313 : i64
%315 = llvm.getelementptr %arg11[%312] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%314 = llvm.load %315 : !llvm.ptr -> i128
%317 = arith.trunci %314 : i128 to i64
%318 = arith.trunci %278 : i128 to i64
%316 = arith.cmpi sle, %317, %318 : i64
cf.cond_br %316, ^bb48, ^bb49
^bb48:
%319 = arith.constant 1 : i32
%321 = arith.extsi %319 : i32 to i64
%320 = arith.addi %312, %321 : i64
llvm.store %320, %282 : i64, !llvm.ptr
cf.br ^bb50
^bb49:
llvm.store %312, %284 : i64, !llvm.ptr
cf.br ^bb50
^bb50:
cf.br ^bb45
^bb47:
%322 = llvm.load %282 : !llvm.ptr -> i64
%323 = arith.cmpi sgt, %322, %302 : i64
cf.cond_br %323, ^bb51, ^bb52
^bb51:
%325 = llvm.getelementptr %arg12[%322] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%324 = llvm.load %325 : !llvm.ptr -> i64
%327 = llvm.getelementptr %arg12[%302] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%326 = llvm.load %327 : !llvm.ptr -> i64
%328 = arith.subi %324, %326 : i64
%329 = llvm.mlir.addressof @MOD : !llvm.ptr
%330 = llvm.load %329 : !llvm.ptr -> i64
%331 = arith.remsi %328, %330 : i64
%332 = llvm.mlir.addressof @MOD : !llvm.ptr
%333 = llvm.load %332 : !llvm.ptr -> i64
%334 = arith.addi %331, %333 : i64
%335 = llvm.mlir.addressof @MOD : !llvm.ptr
%336 = llvm.load %335 : !llvm.ptr -> i64
%337 = arith.remsi %334, %336 : i64
%338 = arith.muli %arg8, %337 : i64
%339 = llvm.mlir.addressof @MOD : !llvm.ptr
%340 = llvm.load %339 : !llvm.ptr -> i64
%341 = arith.remsi %338, %340 : i64
%342 = arith.constant 1 : i32
%344 = arith.extsi %342 : i32 to i64
%343 = arith.cmpi eq, %arg7, %344 : i64
cf.cond_br %343, ^bb54, ^bb55
^bb54:
%346 = arith.constant 0 : i32
%347 = arith.extsi %346 : i32 to i64
%348 = llvm.getelementptr %arg14[%347] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%345 = llvm.load %348 : !llvm.ptr -> i64
%349 = arith.addi %345, %341 : i64
%350 = llvm.mlir.addressof @MOD : !llvm.ptr
%351 = llvm.load %350 : !llvm.ptr -> i64
%352 = arith.remsi %349, %351 : i64
%353 = arith.constant 0 : i32
%354 = arith.extsi %353 : i32 to i64
%355 = llvm.getelementptr %arg14[%354] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %352, %355 : i64, !llvm.ptr
cf.br ^bb56
^bb55:
%357 = arith.constant 0 : i32
%358 = arith.extsi %357 : i32 to i64
%359 = llvm.getelementptr %arg14[%358] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%356 = llvm.load %359 : !llvm.ptr -> i64
%360 = arith.subi %356, %341 : i64
%361 = llvm.mlir.addressof @MOD : !llvm.ptr
%362 = llvm.load %361 : !llvm.ptr -> i64
%363 = arith.addi %360, %362 : i64
%364 = llvm.mlir.addressof @MOD : !llvm.ptr
%365 = llvm.load %364 : !llvm.ptr -> i64
%366 = arith.remsi %363, %365 : i64
%367 = arith.constant 0 : i32
%368 = arith.extsi %367 : i32 to i64
%369 = llvm.getelementptr %arg14[%368] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %366, %369 : i64, !llvm.ptr
cf.br ^bb56
^bb56:
cf.br ^bb53
^bb52:
cf.br ^bb53
^bb53:
func.return
^bb37:
cf.br ^bb38
^bb38:
%371 = llvm.getelementptr %arg2[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%370 = llvm.load %371 : !llvm.ptr -> i64
%373 = llvm.getelementptr %arg3[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%372 = llvm.load %373 : !llvm.ptr -> i64
%374 = func.call @key_of(%arg4, %arg5, %370) : (!llvm.ptr, !llvm.ptr, i64) -> i128
%375 = llvm.mlir.constant(1 : i64) : i64
%376 = llvm.alloca %375 x i128 : (i64) -> !llvm.ptr
llvm.store %arg6, %376 : i128, !llvm.ptr
%377 = llvm.mlir.constant(1 : i64) : i64
%378 = llvm.alloca %377 x i64 : (i64) -> !llvm.ptr
llvm.store %arg7, %378 : i64, !llvm.ptr
%379 = llvm.mlir.constant(1 : i64) : i64
%380 = llvm.alloca %379 x i64 : (i64) -> !llvm.ptr
llvm.store %arg8, %380 : i64, !llvm.ptr
%381 = arith.constant 0 : i32
%382 = arith.extsi %381 : i32 to i64
%383 = llvm.mlir.constant(1 : i64) : i64
%384 = llvm.alloca %383 x i64 : (i64) -> !llvm.ptr
llvm.store %382, %384 : i64, !llvm.ptr
cf.br ^bb57
^bb57:
%385 = llvm.load %384 : !llvm.ptr -> i64
%386 = arith.cmpi sle, %385, %372 : i64
cf.cond_br %386, ^bb58, ^bb59
^bb58:
%388 = arith.constant 1 : i32
%390 = arith.extsi %388 : i32 to i64
%389 = arith.addi %arg0, %390 : i64
%391 = llvm.load %376 : !llvm.ptr -> i128
%392 = llvm.load %378 : !llvm.ptr -> i64
%393 = llvm.load %380 : !llvm.ptr -> i64
func.call @walkA(%389, %arg1, %arg2, %arg3, %arg4, %arg5, %391, %392, %393, %arg9, %arg10, %arg11, %arg12, %arg13, %arg14) : (i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i128, i64, i64, i128, i128, !llvm.ptr, !llvm.ptr, i64, !llvm.ptr) -> ()
%394 = llvm.load %376 : !llvm.ptr -> i128
%396 = arith.trunci %394 : i128 to i64
%397 = arith.trunci %374 : i128 to i64
%395 = arith.addi %396, %397 : i64
%398 = arith.extsi %395 : i64 to i128
llvm.store %398, %376 : i128, !llvm.ptr
%399 = arith.constant 0 : i32
%400 = llvm.load %378 : !llvm.ptr -> i64
%402 = arith.extsi %399 : i32 to i64
%401 = arith.subi %402, %400 : i64
llvm.store %401, %378 : i64, !llvm.ptr
%403 = llvm.load %380 : !llvm.ptr -> i64
%404 = llvm.mlir.addressof @MOD : !llvm.ptr
%405 = llvm.load %404 : !llvm.ptr -> i64
%406 = arith.remsi %370, %405 : i64
%407 = arith.muli %403, %406 : i64
%408 = llvm.mlir.addressof @MOD : !llvm.ptr
%409 = llvm.load %408 : !llvm.ptr -> i64
%410 = arith.remsi %407, %409 : i64
llvm.store %410, %380 : i64, !llvm.ptr
%411 = llvm.load %384 : !llvm.ptr -> i64
%412 = arith.constant 1 : i32
%414 = arith.extsi %412 : i32 to i64
%413 = arith.addi %411, %414 : i64
llvm.store %413, %384 : i64, !llvm.ptr
cf.br ^bb57
^bb59:
func.return
}
func.func @main() -> i32 {
%416 = arith.constant 70 : i32
%417 = arith.constant 8 : i32
%418 = arith.extsi %416 : i32 to i64
%419 = arith.extsi %417 : i32 to i64
%415 = func.call @calloc(%418, %419) : (i64, i64) -> !llvm.ptr
%421 = arith.constant 70 : i32
%422 = arith.constant 8 : i32
%423 = arith.extsi %421 : i32 to i64
%424 = arith.extsi %422 : i32 to i64
%420 = func.call @calloc(%423, %424) : (i64, i64) -> !llvm.ptr
%425 = arith.constant 35180077121536 : i32
%426 = arith.constant 2 : i32
%427 = arith.extsi %425 : i32 to i64
%428 = arith.extsi %426 : i32 to i64
%429 = llvm.getelementptr %415[%428] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %427, %429 : i64, !llvm.ptr
%430 = arith.constant 0 : i32
%431 = arith.constant 2 : i32
%432 = arith.extsi %430 : i32 to i64
%433 = arith.extsi %431 : i32 to i64
%434 = llvm.getelementptr %420[%433] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %432, %434 : i64, !llvm.ptr
%435 = arith.constant 55761615404922 : i32
%436 = arith.constant 3 : i32
%437 = arith.extsi %435 : i32 to i64
%438 = arith.extsi %436 : i32 to i64
%439 = llvm.getelementptr %415[%438] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %437, %439 : i64, !llvm.ptr
%440 = arith.constant 28713978702920 : i32
%441 = arith.constant 3 : i32
%442 = arith.extsi %440 : i32 to i64
%443 = arith.extsi %441 : i32 to i64
%444 = llvm.getelementptr %420[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %442, %444 : i64, !llvm.ptr
%445 = arith.constant 81691287086733 : i32
%446 = arith.constant 5 : i32
%447 = arith.extsi %445 : i32 to i64
%448 = arith.extsi %446 : i32 to i64
%449 = llvm.getelementptr %415[%448] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %447, %449 : i64, !llvm.ptr
%450 = arith.constant 27139438198640 : i32
%451 = arith.constant 5 : i32
%452 = arith.extsi %450 : i32 to i64
%453 = arith.extsi %451 : i32 to i64
%454 = llvm.getelementptr %420[%453] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %452, %454 : i64, !llvm.ptr
%455 = arith.constant 98770725195792 : i32
%456 = arith.constant 7 : i32
%457 = arith.extsi %455 : i32 to i64
%458 = arith.extsi %456 : i32 to i64
%459 = llvm.getelementptr %415[%458] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %457, %459 : i64, !llvm.ptr
%460 = arith.constant 24652251079695 : i32
%461 = arith.constant 7 : i32
%462 = arith.extsi %460 : i32 to i64
%463 = arith.extsi %461 : i32 to i64
%464 = llvm.getelementptr %420[%463] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %462, %464 : i64, !llvm.ptr
%465 = arith.constant 121713634318709 : i32
%466 = arith.constant 11 : i32
%467 = arith.extsi %465 : i32 to i64
%468 = arith.extsi %466 : i32 to i64
%469 = llvm.getelementptr %415[%468] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %467, %469 : i64, !llvm.ptr
%470 = arith.constant 1026026103193 : i32
%471 = arith.constant 11 : i32
%472 = arith.extsi %470 : i32 to i64
%473 = arith.extsi %471 : i32 to i64
%474 = llvm.getelementptr %420[%473] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %472, %474 : i64, !llvm.ptr
%475 = arith.constant 130193352968072 : i32
%476 = arith.constant 13 : i32
%477 = arith.extsi %475 : i32 to i64
%478 = arith.extsi %476 : i32 to i64
%479 = llvm.getelementptr %415[%478] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %477, %479 : i64, !llvm.ptr
%480 = arith.constant 28005969389682 : i32
%481 = arith.constant 13 : i32
%482 = arith.extsi %480 : i32 to i64
%483 = arith.extsi %481 : i32 to i64
%484 = llvm.getelementptr %420[%483] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %482, %484 : i64, !llvm.ptr
%485 = arith.constant 143810518538530 : i32
%486 = arith.constant 17 : i32
%487 = arith.extsi %485 : i32 to i64
%488 = arith.extsi %486 : i32 to i64
%489 = llvm.getelementptr %415[%488] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %487, %489 : i64, !llvm.ptr
%490 = arith.constant 13576176750090 : i32
%491 = arith.constant 17 : i32
%492 = arith.extsi %490 : i32 to i64
%493 = arith.extsi %491 : i32 to i64
%494 = llvm.getelementptr %420[%493] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %492, %494 : i64, !llvm.ptr
%495 = arith.constant 149456367272090 : i32
%496 = arith.constant 19 : i32
%497 = arith.extsi %495 : i32 to i64
%498 = arith.extsi %496 : i32 to i64
%499 = llvm.getelementptr %415[%498] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %497, %499 : i64, !llvm.ptr
%500 = arith.constant 344088562885 : i32
%501 = arith.constant 19 : i32
%502 = arith.extsi %500 : i32 to i64
%503 = arith.extsi %501 : i32 to i64
%504 = llvm.getelementptr %420[%503] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %502, %504 : i64, !llvm.ptr
%505 = arith.constant 159154392061498 : i32
%506 = arith.constant 23 : i32
%507 = arith.extsi %505 : i32 to i64
%508 = arith.extsi %506 : i32 to i64
%509 = llvm.getelementptr %415[%508] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %507, %509 : i64, !llvm.ptr
%510 = arith.constant 22858089294419 : i32
%511 = arith.constant 23 : i32
%512 = arith.extsi %510 : i32 to i64
%513 = arith.extsi %511 : i32 to i64
%514 = llvm.getelementptr %420[%513] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %512, %514 : i64, !llvm.ptr
%515 = arith.constant 170920715965746 : i32
%516 = arith.constant 29 : i32
%517 = arith.extsi %515 : i32 to i64
%518 = arith.extsi %516 : i32 to i64
%519 = llvm.getelementptr %415[%518] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %517, %519 : i64, !llvm.ptr
%520 = arith.constant 29997820422247 : i32
%521 = arith.constant 29 : i32
%522 = arith.extsi %520 : i32 to i64
%523 = arith.extsi %521 : i32 to i64
%524 = llvm.getelementptr %420[%523] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %522, %524 : i64, !llvm.ptr
%525 = arith.constant 174305991418474 : i32
%526 = arith.constant 31 : i32
%527 = arith.extsi %525 : i32 to i64
%528 = arith.extsi %526 : i32 to i64
%529 = llvm.getelementptr %415[%528] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %527, %529 : i64, !llvm.ptr
%530 = arith.constant 15755084331262 : i32
%531 = arith.constant 31 : i32
%532 = arith.extsi %530 : i32 to i64
%533 = arith.extsi %531 : i32 to i64
%534 = llvm.getelementptr %420[%533] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %532, %534 : i64, !llvm.ptr
%535 = arith.constant 183287050628411 : i32
%536 = arith.constant 37 : i32
%537 = arith.extsi %535 : i32 to i64
%538 = arith.extsi %536 : i32 to i64
%539 = llvm.getelementptr %415[%538] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %537, %539 : i64, !llvm.ptr
%540 = arith.constant 5078782637662 : i32
%541 = arith.constant 37 : i32
%542 = arith.extsi %540 : i32 to i64
%543 = arith.extsi %541 : i32 to i64
%544 = llvm.getelementptr %420[%543] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %542, %544 : i64, !llvm.ptr
%545 = arith.constant 188497808248454 : i32
%546 = arith.constant 41 : i32
%547 = arith.extsi %545 : i32 to i64
%548 = arith.extsi %546 : i32 to i64
%549 = llvm.getelementptr %415[%548] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %547, %549 : i64, !llvm.ptr
%550 = arith.constant 15274930938036 : i32
%551 = arith.constant 41 : i32
%552 = arith.extsi %550 : i32 to i64
%553 = arith.extsi %551 : i32 to i64
%554 = llvm.getelementptr %420[%553] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %552, %554 : i64, !llvm.ptr
%555 = arith.constant 190915423214657 : i32
%556 = arith.constant 43 : i32
%557 = arith.extsi %555 : i32 to i64
%558 = arith.extsi %556 : i32 to i64
%559 = llvm.getelementptr %415[%558] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %557, %559 : i64, !llvm.ptr
%560 = arith.constant 11034866151312 : i32
%561 = arith.constant 43 : i32
%562 = arith.extsi %560 : i32 to i64
%563 = arith.extsi %561 : i32 to i64
%564 = llvm.getelementptr %420[%563] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %562, %564 : i64, !llvm.ptr
%565 = arith.constant 195430425990608 : i32
%566 = arith.constant 47 : i32
%567 = arith.extsi %565 : i32 to i64
%568 = arith.extsi %566 : i32 to i64
%569 = llvm.getelementptr %415[%568] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %567, %569 : i64, !llvm.ptr
%570 = arith.constant 1904660870460 : i32
%571 = arith.constant 47 : i32
%572 = arith.extsi %570 : i32 to i64
%573 = arith.extsi %571 : i32 to i64
%574 = llvm.getelementptr %420[%573] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %572, %574 : i64, !llvm.ptr
%575 = arith.constant 201528989601287 : i32
%576 = arith.constant 53 : i32
%577 = arith.extsi %575 : i32 to i64
%578 = arith.extsi %576 : i32 to i64
%579 = llvm.getelementptr %415[%578] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %577, %579 : i64, !llvm.ptr
%580 = arith.constant 11509919844346 : i32
%581 = arith.constant 53 : i32
%582 = arith.extsi %580 : i32 to i64
%583 = arith.extsi %581 : i32 to i64
%584 = llvm.getelementptr %420[%583] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %582, %584 : i64, !llvm.ptr
%585 = arith.constant 206972806947232 : i32
%586 = arith.constant 59 : i32
%587 = arith.extsi %585 : i32 to i64
%588 = arith.extsi %586 : i32 to i64
%589 = llvm.getelementptr %415[%588] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %587, %589 : i64, !llvm.ptr
%590 = arith.constant 11705617836489 : i32
%591 = arith.constant 59 : i32
%592 = arith.extsi %590 : i32 to i64
%593 = arith.extsi %591 : i32 to i64
%594 = llvm.getelementptr %420[%593] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %592, %594 : i64, !llvm.ptr
%595 = arith.constant 208664974278645 : i32
%596 = arith.constant 61 : i32
%597 = arith.extsi %595 : i32 to i64
%598 = arith.extsi %596 : i32 to i64
%599 = llvm.getelementptr %415[%598] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %597, %599 : i64, !llvm.ptr
%600 = arith.constant 14889794361179 : i32
%601 = arith.constant 61 : i32
%602 = arith.extsi %600 : i32 to i64
%603 = arith.extsi %601 : i32 to i64
%604 = llvm.getelementptr %420[%603] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %602, %604 : i64, !llvm.ptr
%605 = arith.constant 213427244233811 : i32
%606 = arith.constant 67 : i32
%607 = arith.extsi %605 : i32 to i64
%608 = arith.extsi %606 : i32 to i64
%609 = llvm.getelementptr %415[%608] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %607, %609 : i64, !llvm.ptr
%610 = arith.constant 33439797334763 : i32
%611 = arith.constant 67 : i32
%612 = arith.extsi %610 : i32 to i64
%613 = arith.extsi %611 : i32 to i64
%614 = llvm.getelementptr %420[%613] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %612, %614 : i64, !llvm.ptr
%616 = arith.constant 32 : i32
%617 = arith.constant 8 : i32
%618 = arith.extsi %616 : i32 to i64
%619 = arith.extsi %617 : i32 to i64
%615 = func.call @calloc(%618, %619) : (i64, i64) -> !llvm.ptr
%621 = arith.constant 32 : i32
%622 = arith.constant 8 : i32
%623 = arith.extsi %621 : i32 to i64
%624 = arith.extsi %622 : i32 to i64
%620 = func.call @calloc(%623, %624) : (i64, i64) -> !llvm.ptr
%625 = arith.constant 0 : i32
%626 = arith.extsi %625 : i32 to i64
%627 = llvm.mlir.constant(1 : i64) : i64
%628 = llvm.alloca %627 x i64 : (i64) -> !llvm.ptr
llvm.store %626, %628 : i64, !llvm.ptr
%629 = arith.constant 2 : i32
%630 = arith.extsi %629 : i32 to i64
%631 = llvm.mlir.constant(1 : i64) : i64
%632 = llvm.alloca %631 x i64 : (i64) -> !llvm.ptr
llvm.store %630, %632 : i64, !llvm.ptr
cf.br ^bb60
^bb60:
%633 = llvm.load %632 : !llvm.ptr -> i64
%634 = llvm.mlir.addressof @NFACT : !llvm.ptr
%635 = llvm.load %634 : !llvm.ptr -> i64
%636 = arith.cmpi sle, %633, %635 : i64
cf.cond_br %636, ^bb61, ^bb62
^bb61:
%637 = arith.constant 1 : i32
%638 = arith.extsi %637 : i32 to i64
%639 = llvm.mlir.constant(1 : i64) : i64
%640 = llvm.alloca %639 x i64 : (i64) -> !llvm.ptr
llvm.store %638, %640 : i64, !llvm.ptr
%641 = arith.constant 2 : i32
%642 = arith.extsi %641 : i32 to i64
%643 = llvm.mlir.constant(1 : i64) : i64
%644 = llvm.alloca %643 x i64 : (i64) -> !llvm.ptr
llvm.store %642, %644 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%645 = llvm.load %644 : !llvm.ptr -> i64
%646 = llvm.load %644 : !llvm.ptr -> i64
%647 = arith.muli %645, %646 : i64
%648 = llvm.load %632 : !llvm.ptr -> i64
%649 = arith.cmpi sle, %647, %648 : i64
cf.cond_br %649, ^bb64, ^bb65
^bb64:
%650 = llvm.load %632 : !llvm.ptr -> i64
%651 = llvm.load %644 : !llvm.ptr -> i64
%652 = arith.remsi %650, %651 : i64
%653 = arith.constant 0 : i32
%655 = arith.extsi %653 : i32 to i64
%654 = arith.cmpi eq, %652, %655 : i64
cf.cond_br %654, ^bb66, ^bb67
^bb66:
%656 = arith.constant 0 : i32
%657 = arith.extsi %656 : i32 to i64
llvm.store %657, %640 : i64, !llvm.ptr
cf.br ^bb68
^bb67:
cf.br ^bb68
^bb68:
%658 = llvm.load %644 : !llvm.ptr -> i64
%659 = arith.constant 1 : i32
%661 = arith.extsi %659 : i32 to i64
%660 = arith.addi %658, %661 : i64
llvm.store %660, %644 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
%662 = llvm.load %640 : !llvm.ptr -> i64
%663 = arith.constant 1 : i32
%665 = arith.extsi %663 : i32 to i64
%664 = arith.cmpi eq, %662, %665 : i64
cf.cond_br %664, ^bb69, ^bb70
^bb69:
%666 = arith.constant 0 : i32
%667 = arith.extsi %666 : i32 to i64
%668 = llvm.mlir.constant(1 : i64) : i64
%669 = llvm.alloca %668 x i64 : (i64) -> !llvm.ptr
llvm.store %667, %669 : i64, !llvm.ptr
%670 = llvm.load %632 : !llvm.ptr -> i64
%671 = llvm.mlir.constant(1 : i64) : i64
%672 = llvm.alloca %671 x i64 : (i64) -> !llvm.ptr
llvm.store %670, %672 : i64, !llvm.ptr
cf.br ^bb72
^bb72:
%673 = llvm.load %672 : !llvm.ptr -> i64
%674 = llvm.mlir.addressof @NFACT : !llvm.ptr
%675 = llvm.load %674 : !llvm.ptr -> i64
%676 = arith.cmpi sle, %673, %675 : i64
cf.cond_br %676, ^bb73, ^bb74
^bb73:
%677 = llvm.load %669 : !llvm.ptr -> i64
%678 = llvm.mlir.addressof @NFACT : !llvm.ptr
%679 = llvm.load %678 : !llvm.ptr -> i64
%680 = llvm.load %672 : !llvm.ptr -> i64
%681 = arith.divsi %679, %680 : i64
%682 = arith.addi %677, %681 : i64
llvm.store %682, %669 : i64, !llvm.ptr
%683 = llvm.load %672 : !llvm.ptr -> i64
%684 = llvm.mlir.addressof @NFACT : !llvm.ptr
%685 = llvm.load %684 : !llvm.ptr -> i64
%686 = llvm.load %632 : !llvm.ptr -> i64
%687 = arith.divsi %685, %686 : i64
%688 = arith.cmpi sgt, %683, %687 : i64
cf.cond_br %688, ^bb75, ^bb76
^bb75:
%689 = llvm.mlir.addressof @NFACT : !llvm.ptr
%690 = llvm.load %689 : !llvm.ptr -> i64
%691 = arith.constant 1 : i32
%693 = arith.extsi %691 : i32 to i64
%692 = arith.addi %690, %693 : i64
llvm.store %692, %672 : i64, !llvm.ptr
cf.br ^bb77
^bb76:
%694 = llvm.load %672 : !llvm.ptr -> i64
%695 = llvm.load %632 : !llvm.ptr -> i64
%696 = arith.muli %694, %695 : i64
llvm.store %696, %672 : i64, !llvm.ptr
cf.br ^bb77
^bb77:
cf.br ^bb72
^bb74:
%697 = llvm.load %632 : !llvm.ptr -> i64
%698 = llvm.load %628 : !llvm.ptr -> i64
%699 = llvm.getelementptr %615[%698] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %697, %699 : i64, !llvm.ptr
%700 = llvm.load %669 : !llvm.ptr -> i64
%701 = llvm.load %628 : !llvm.ptr -> i64
%702 = llvm.getelementptr %620[%701] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %700, %702 : i64, !llvm.ptr
%703 = llvm.load %628 : !llvm.ptr -> i64
%704 = arith.constant 1 : i32
%706 = arith.extsi %704 : i32 to i64
%705 = arith.addi %703, %706 : i64
llvm.store %705, %628 : i64, !llvm.ptr
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%707 = llvm.load %632 : !llvm.ptr -> i64
%708 = arith.constant 1 : i32
%710 = arith.extsi %708 : i32 to i64
%709 = arith.addi %707, %710 : i64
llvm.store %709, %632 : i64, !llvm.ptr
cf.br ^bb60
^bb62:
%712 = arith.constant 32 : i32
%713 = arith.constant 8 : i32
%714 = arith.extsi %712 : i32 to i64
%715 = arith.extsi %713 : i32 to i64
%711 = func.call @calloc(%714, %715) : (i64, i64) -> !llvm.ptr
%716 = arith.constant 0 : i32
%717 = arith.extsi %716 : i32 to i64
%718 = llvm.mlir.constant(1 : i64) : i64
%719 = llvm.alloca %718 x i64 : (i64) -> !llvm.ptr
llvm.store %717, %719 : i64, !llvm.ptr
cf.br ^bb78
^bb78:
%720 = llvm.load %719 : !llvm.ptr -> i64
%721 = llvm.load %628 : !llvm.ptr -> i64
%722 = arith.cmpi slt, %720, %721 : i64
cf.cond_br %722, ^bb79, ^bb80
^bb79:
%723 = llvm.load %719 : !llvm.ptr -> i64
%724 = llvm.load %719 : !llvm.ptr -> i64
%725 = llvm.getelementptr %711[%724] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %723, %725 : i64, !llvm.ptr
%726 = llvm.load %719 : !llvm.ptr -> i64
%727 = arith.constant 1 : i32
%729 = arith.extsi %727 : i32 to i64
%728 = arith.addi %726, %729 : i64
llvm.store %728, %719 : i64, !llvm.ptr
cf.br ^bb78
^bb80:
%730 = arith.constant 0 : i32
%731 = arith.extsi %730 : i32 to i64
llvm.store %731, %719 : i64, !llvm.ptr
cf.br ^bb81
^bb81:
%732 = llvm.load %719 : !llvm.ptr -> i64
%733 = llvm.load %628 : !llvm.ptr -> i64
%734 = arith.cmpi slt, %732, %733 : i64
cf.cond_br %734, ^bb82, ^bb83
^bb82:
%735 = llvm.load %719 : !llvm.ptr -> i64
%736 = llvm.mlir.constant(1 : i64) : i64
%737 = llvm.alloca %736 x i64 : (i64) -> !llvm.ptr
llvm.store %735, %737 : i64, !llvm.ptr
%738 = llvm.load %719 : !llvm.ptr -> i64
%739 = arith.constant 1 : i32
%741 = arith.extsi %739 : i32 to i64
%740 = arith.addi %738, %741 : i64
%742 = llvm.mlir.constant(1 : i64) : i64
%743 = llvm.alloca %742 x i64 : (i64) -> !llvm.ptr
llvm.store %740, %743 : i64, !llvm.ptr
cf.br ^bb84
^bb84:
%744 = llvm.load %743 : !llvm.ptr -> i64
%745 = llvm.load %628 : !llvm.ptr -> i64
%746 = arith.cmpi slt, %744, %745 : i64
cf.cond_br %746, ^bb85, ^bb86
^bb85:
%749 = llvm.load %743 : !llvm.ptr -> i64
%750 = llvm.getelementptr %711[%749] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%748 = llvm.load %750 : !llvm.ptr -> i64
%751 = llvm.getelementptr %620[%748] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%747 = llvm.load %751 : !llvm.ptr -> i64
%754 = llvm.load %737 : !llvm.ptr -> i64
%755 = llvm.getelementptr %711[%754] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%753 = llvm.load %755 : !llvm.ptr -> i64
%756 = llvm.getelementptr %620[%753] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%752 = llvm.load %756 : !llvm.ptr -> i64
%757 = arith.cmpi sgt, %747, %752 : i64
cf.cond_br %757, ^bb87, ^bb88
^bb87:
%758 = llvm.load %743 : !llvm.ptr -> i64
llvm.store %758, %737 : i64, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
%759 = llvm.load %743 : !llvm.ptr -> i64
%760 = arith.constant 1 : i32
%762 = arith.extsi %760 : i32 to i64
%761 = arith.addi %759, %762 : i64
llvm.store %761, %743 : i64, !llvm.ptr
cf.br ^bb84
^bb86:
%764 = llvm.load %719 : !llvm.ptr -> i64
%765 = llvm.getelementptr %711[%764] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%763 = llvm.load %765 : !llvm.ptr -> i64
%767 = llvm.load %737 : !llvm.ptr -> i64
%768 = llvm.getelementptr %711[%767] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%766 = llvm.load %768 : !llvm.ptr -> i64
%769 = llvm.load %719 : !llvm.ptr -> i64
%770 = llvm.getelementptr %711[%769] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %766, %770 : i64, !llvm.ptr
%771 = llvm.load %737 : !llvm.ptr -> i64
%772 = llvm.getelementptr %711[%771] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %763, %772 : i64, !llvm.ptr
%773 = llvm.load %719 : !llvm.ptr -> i64
%774 = arith.constant 1 : i32
%776 = arith.extsi %774 : i32 to i64
%775 = arith.addi %773, %776 : i64
llvm.store %775, %719 : i64, !llvm.ptr
cf.br ^bb81
^bb83:
%778 = arith.constant 32 : i32
%779 = arith.constant 8 : i32
%780 = arith.extsi %778 : i32 to i64
%781 = arith.extsi %779 : i32 to i64
%777 = func.call @calloc(%780, %781) : (i64, i64) -> !llvm.ptr
%783 = arith.constant 32 : i32
%784 = arith.constant 8 : i32
%785 = arith.extsi %783 : i32 to i64
%786 = arith.extsi %784 : i32 to i64
%782 = func.call @calloc(%785, %786) : (i64, i64) -> !llvm.ptr
%787 = arith.constant 0 : i32
%788 = arith.extsi %787 : i32 to i64
%789 = llvm.mlir.constant(1 : i64) : i64
%790 = llvm.alloca %789 x i64 : (i64) -> !llvm.ptr
llvm.store %788, %790 : i64, !llvm.ptr
%791 = arith.constant 0 : i32
%792 = arith.extsi %791 : i32 to i64
%793 = llvm.mlir.constant(1 : i64) : i64
%794 = llvm.alloca %793 x i64 : (i64) -> !llvm.ptr
llvm.store %792, %794 : i64, !llvm.ptr
%795 = arith.constant 1 : i32
%796 = arith.extsi %795 : i32 to i64
%797 = llvm.mlir.constant(1 : i64) : i64
%798 = llvm.alloca %797 x i64 : (i64) -> !llvm.ptr
llvm.store %796, %798 : i64, !llvm.ptr
%799 = arith.constant 1 : i32
%800 = arith.extsi %799 : i32 to i64
%801 = llvm.mlir.constant(1 : i64) : i64
%802 = llvm.alloca %801 x i64 : (i64) -> !llvm.ptr
llvm.store %800, %802 : i64, !llvm.ptr
%803 = arith.constant 0 : i32
%804 = arith.extsi %803 : i32 to i64
llvm.store %804, %719 : i64, !llvm.ptr
cf.br ^bb90
^bb90:
%805 = llvm.load %719 : !llvm.ptr -> i64
%806 = llvm.load %628 : !llvm.ptr -> i64
%807 = arith.cmpi slt, %805, %806 : i64
cf.cond_br %807, ^bb91, ^bb92
^bb91:
%809 = llvm.load %719 : !llvm.ptr -> i64
%810 = llvm.getelementptr %711[%809] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%808 = llvm.load %810 : !llvm.ptr -> i64
%811 = llvm.load %798 : !llvm.ptr -> i64
%812 = llvm.load %802 : !llvm.ptr -> i64
%813 = arith.cmpi sle, %811, %812 : i64
cf.cond_br %813, ^bb93, ^bb94
^bb93:
%814 = llvm.load %790 : !llvm.ptr -> i64
%815 = llvm.getelementptr %777[%814] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %808, %815 : i64, !llvm.ptr
%816 = llvm.load %790 : !llvm.ptr -> i64
%817 = arith.constant 1 : i32
%819 = arith.extsi %817 : i32 to i64
%818 = arith.addi %816, %819 : i64
llvm.store %818, %790 : i64, !llvm.ptr
%820 = llvm.load %798 : !llvm.ptr -> i64
%822 = llvm.getelementptr %620[%808] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%821 = llvm.load %822 : !llvm.ptr -> i64
%823 = arith.constant 1 : i32
%825 = arith.extsi %823 : i32 to i64
%824 = arith.addi %821, %825 : i64
%826 = arith.muli %820, %824 : i64
llvm.store %826, %798 : i64, !llvm.ptr
cf.br ^bb95
^bb94:
%827 = llvm.load %794 : !llvm.ptr -> i64
%828 = llvm.getelementptr %782[%827] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %808, %828 : i64, !llvm.ptr
%829 = llvm.load %794 : !llvm.ptr -> i64
%830 = arith.constant 1 : i32
%832 = arith.extsi %830 : i32 to i64
%831 = arith.addi %829, %832 : i64
llvm.store %831, %794 : i64, !llvm.ptr
%833 = llvm.load %802 : !llvm.ptr -> i64
%835 = llvm.getelementptr %620[%808] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%834 = llvm.load %835 : !llvm.ptr -> i64
%836 = arith.constant 1 : i32
%838 = arith.extsi %836 : i32 to i64
%837 = arith.addi %834, %838 : i64
%839 = arith.muli %833, %837 : i64
llvm.store %839, %802 : i64, !llvm.ptr
cf.br ^bb95
^bb95:
%840 = llvm.load %719 : !llvm.ptr -> i64
%841 = arith.constant 1 : i32
%843 = arith.extsi %841 : i32 to i64
%842 = arith.addi %840, %843 : i64
llvm.store %842, %719 : i64, !llvm.ptr
cf.br ^bb90
^bb92:
%845 = llvm.mlir.addressof @BCAP : !llvm.ptr
%846 = llvm.load %845 : !llvm.ptr -> i64
%847 = arith.constant 16 : i32
%848 = arith.extsi %847 : i32 to i64
%844 = func.call @calloc(%846, %848) : (i64, i64) -> !llvm.ptr
%850 = llvm.mlir.addressof @BCAP : !llvm.ptr
%851 = llvm.load %850 : !llvm.ptr -> i64
%852 = arith.constant 8 : i32
%853 = arith.extsi %852 : i32 to i64
%849 = func.call @calloc(%851, %853) : (i64, i64) -> !llvm.ptr
%854 = arith.constant 0 : i32
%855 = arith.extsi %854 : i32 to i128
%856 = arith.constant 0 : i32
%857 = arith.extsi %856 : i32 to i64
%858 = llvm.getelementptr %844[%857] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %855, %858 : i128, !llvm.ptr
%859 = arith.constant 1 : i32
%860 = arith.constant 0 : i32
%861 = arith.extsi %859 : i32 to i64
%862 = arith.extsi %860 : i32 to i64
%863 = llvm.getelementptr %849[%862] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %861, %863 : i64, !llvm.ptr
%864 = arith.constant 1 : i32
%865 = arith.extsi %864 : i32 to i64
%866 = llvm.mlir.constant(1 : i64) : i64
%867 = llvm.alloca %866 x i64 : (i64) -> !llvm.ptr
llvm.store %865, %867 : i64, !llvm.ptr
%868 = arith.constant 0 : i32
%869 = arith.extsi %868 : i32 to i64
llvm.store %869, %719 : i64, !llvm.ptr
cf.br ^bb96
^bb96:
%870 = llvm.load %719 : !llvm.ptr -> i64
%871 = llvm.load %794 : !llvm.ptr -> i64
%872 = arith.cmpi slt, %870, %871 : i64
cf.cond_br %872, ^bb97, ^bb98
^bb97:
%875 = llvm.load %719 : !llvm.ptr -> i64
%876 = llvm.getelementptr %782[%875] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%874 = llvm.load %876 : !llvm.ptr -> i64
%877 = llvm.getelementptr %615[%874] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%873 = llvm.load %877 : !llvm.ptr -> i64
%880 = llvm.load %719 : !llvm.ptr -> i64
%881 = llvm.getelementptr %782[%880] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%879 = llvm.load %881 : !llvm.ptr -> i64
%882 = llvm.getelementptr %620[%879] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%878 = llvm.load %882 : !llvm.ptr -> i64
%883 = func.call @key_of(%415, %420, %873) : (!llvm.ptr, !llvm.ptr, i64) -> i128
%884 = llvm.load %867 : !llvm.ptr -> i64
%885 = arith.constant 0 : i32
%886 = arith.extsi %885 : i32 to i128
%887 = llvm.mlir.constant(1 : i64) : i64
%888 = llvm.alloca %887 x i128 : (i64) -> !llvm.ptr
llvm.store %886, %888 : i128, !llvm.ptr
%889 = arith.constant 1 : i32
%890 = arith.extsi %889 : i32 to i64
%891 = llvm.mlir.constant(1 : i64) : i64
%892 = llvm.alloca %891 x i64 : (i64) -> !llvm.ptr
llvm.store %890, %892 : i64, !llvm.ptr
%893 = arith.constant 1 : i32
%894 = arith.extsi %893 : i32 to i64
%895 = llvm.mlir.constant(1 : i64) : i64
%896 = llvm.alloca %895 x i64 : (i64) -> !llvm.ptr
llvm.store %894, %896 : i64, !llvm.ptr
%897 = arith.constant 1 : i32
%898 = arith.extsi %897 : i32 to i64
%899 = llvm.mlir.constant(1 : i64) : i64
%900 = llvm.alloca %899 x i64 : (i64) -> !llvm.ptr
llvm.store %898, %900 : i64, !llvm.ptr
cf.br ^bb99
^bb99:
%901 = llvm.load %900 : !llvm.ptr -> i64
%902 = arith.cmpi sle, %901, %878 : i64
cf.cond_br %902, ^bb100, ^bb101
^bb100:
%903 = llvm.load %888 : !llvm.ptr -> i128
%905 = arith.trunci %903 : i128 to i64
%906 = arith.trunci %883 : i128 to i64
%904 = arith.addi %905, %906 : i64
%907 = arith.extsi %904 : i64 to i128
llvm.store %907, %888 : i128, !llvm.ptr
%908 = arith.constant 0 : i32
%909 = llvm.load %892 : !llvm.ptr -> i64
%911 = arith.extsi %908 : i32 to i64
%910 = arith.subi %911, %909 : i64
llvm.store %910, %892 : i64, !llvm.ptr
%912 = llvm.load %896 : !llvm.ptr -> i64
%913 = llvm.mlir.addressof @MOD : !llvm.ptr
%914 = llvm.load %913 : !llvm.ptr -> i64
%915 = arith.remsi %873, %914 : i64
%916 = arith.muli %912, %915 : i64
%917 = llvm.mlir.addressof @MOD : !llvm.ptr
%918 = llvm.load %917 : !llvm.ptr -> i64
%919 = arith.remsi %916, %918 : i64
llvm.store %919, %896 : i64, !llvm.ptr
%920 = arith.constant 0 : i32
%921 = arith.extsi %920 : i32 to i64
%922 = llvm.mlir.constant(1 : i64) : i64
%923 = llvm.alloca %922 x i64 : (i64) -> !llvm.ptr
llvm.store %921, %923 : i64, !llvm.ptr
cf.br ^bb102
^bb102:
%924 = llvm.load %923 : !llvm.ptr -> i64
%925 = arith.cmpi slt, %924, %884 : i64
cf.cond_br %925, ^bb103, ^bb104
^bb103:
%927 = llvm.load %923 : !llvm.ptr -> i64
%928 = llvm.getelementptr %844[%927] : (!llvm.ptr, i64) -> !llvm.ptr, i128
%926 = llvm.load %928 : !llvm.ptr -> i128
%929 = llvm.load %888 : !llvm.ptr -> i128
%931 = arith.trunci %926 : i128 to i64
%932 = arith.trunci %929 : i128 to i64
%930 = arith.addi %931, %932 : i64
%933 = llvm.load %867 : !llvm.ptr -> i64
%934 = arith.extsi %930 : i64 to i128
%935 = llvm.getelementptr %844[%933] : (!llvm.ptr, i64) -> !llvm.ptr, i128
llvm.store %934, %935 : i128, !llvm.ptr
%937 = llvm.load %923 : !llvm.ptr -> i64
%938 = llvm.getelementptr %849[%937] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%936 = llvm.load %938 : !llvm.ptr -> i64
%939 = llvm.load %896 : !llvm.ptr -> i64
%940 = arith.muli %936, %939 : i64
%941 = llvm.mlir.addressof @MOD : !llvm.ptr
%942 = llvm.load %941 : !llvm.ptr -> i64
%943 = arith.remsi %940, %942 : i64
%944 = llvm.mlir.constant(1 : i64) : i64
%945 = llvm.alloca %944 x i64 : (i64) -> !llvm.ptr
llvm.store %943, %945 : i64, !llvm.ptr
%946 = llvm.load %892 : !llvm.ptr -> i64
%947 = arith.constant 0 : i32
%948 = arith.constant 1 : i32
%949 = arith.subi %947, %948 : i32
%951 = arith.extsi %949 : i32 to i64
%950 = arith.cmpi eq, %946, %951 : i64
cf.cond_br %950, ^bb105, ^bb106
^bb105:
%952 = arith.constant 0 : i32
%953 = llvm.load %945 : !llvm.ptr -> i64
%955 = arith.extsi %952 : i32 to i64
%954 = arith.subi %955, %953 : i64
llvm.store %954, %945 : i64, !llvm.ptr
cf.br ^bb107
^bb106:
cf.br ^bb107
^bb107:
%956 = llvm.load %945 : !llvm.ptr -> i64
%957 = llvm.load %867 : !llvm.ptr -> i64
%958 = llvm.getelementptr %849[%957] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %956, %958 : i64, !llvm.ptr
%959 = llvm.load %867 : !llvm.ptr -> i64
%960 = arith.constant 1 : i32
%962 = arith.extsi %960 : i32 to i64
%961 = arith.addi %959, %962 : i64
llvm.store %961, %867 : i64, !llvm.ptr
%963 = llvm.load %923 : !llvm.ptr -> i64
%964 = arith.constant 1 : i32
%966 = arith.extsi %964 : i32 to i64
%965 = arith.addi %963, %966 : i64
llvm.store %965, %923 : i64, !llvm.ptr
cf.br ^bb102
^bb104:
%967 = llvm.load %900 : !llvm.ptr -> i64
%968 = arith.constant 1 : i32
%970 = arith.extsi %968 : i32 to i64
%969 = arith.addi %967, %970 : i64
llvm.store %969, %900 : i64, !llvm.ptr
cf.br ^bb99
^bb101:
%971 = llvm.load %719 : !llvm.ptr -> i64
%972 = arith.constant 1 : i32
%974 = arith.extsi %972 : i32 to i64
%973 = arith.addi %971, %974 : i64
llvm.store %973, %719 : i64, !llvm.ptr
cf.br ^bb96
^bb98:
%976 = llvm.load %867 : !llvm.ptr -> i64
func.call @qsort_kv(%844, %849, %976) : (!llvm.ptr, !llvm.ptr, i64) -> ()
%978 = llvm.load %867 : !llvm.ptr -> i64
%979 = arith.constant 1 : i32
%981 = arith.extsi %979 : i32 to i64
%980 = arith.addi %978, %981 : i64
%982 = arith.constant 8 : i32
%983 = arith.extsi %982 : i32 to i64
%977 = func.call @calloc(%980, %983) : (i64, i64) -> !llvm.ptr
%984 = arith.constant 0 : i32
%985 = arith.constant 0 : i32
%986 = arith.extsi %984 : i32 to i64
%987 = arith.extsi %985 : i32 to i64
%988 = llvm.getelementptr %977[%987] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %986, %988 : i64, !llvm.ptr
%989 = arith.constant 0 : i32
%990 = arith.extsi %989 : i32 to i64
llvm.store %990, %719 : i64, !llvm.ptr
cf.br ^bb108
^bb108:
%991 = llvm.load %719 : !llvm.ptr -> i64
%992 = llvm.load %867 : !llvm.ptr -> i64
%993 = arith.cmpi slt, %991, %992 : i64
cf.cond_br %993, ^bb109, ^bb110
^bb109:
%995 = llvm.load %719 : !llvm.ptr -> i64
%996 = llvm.getelementptr %977[%995] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%994 = llvm.load %996 : !llvm.ptr -> i64
%998 = llvm.load %719 : !llvm.ptr -> i64
%999 = llvm.getelementptr %849[%998] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%997 = llvm.load %999 : !llvm.ptr -> i64
%1000 = arith.addi %994, %997 : i64
%1001 = llvm.mlir.addressof @MOD : !llvm.ptr
%1002 = llvm.load %1001 : !llvm.ptr -> i64
%1003 = arith.remsi %1000, %1002 : i64
%1004 = llvm.mlir.addressof @MOD : !llvm.ptr
%1005 = llvm.load %1004 : !llvm.ptr -> i64
%1006 = arith.addi %1003, %1005 : i64
%1007 = llvm.mlir.addressof @MOD : !llvm.ptr
%1008 = llvm.load %1007 : !llvm.ptr -> i64
%1009 = arith.remsi %1006, %1008 : i64
%1010 = llvm.load %719 : !llvm.ptr -> i64
%1011 = arith.constant 1 : i32
%1013 = arith.extsi %1011 : i32 to i64
%1012 = arith.addi %1010, %1013 : i64
%1014 = llvm.getelementptr %977[%1012] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1009, %1014 : i64, !llvm.ptr
%1015 = llvm.load %719 : !llvm.ptr -> i64
%1016 = arith.constant 1 : i32
%1018 = arith.extsi %1016 : i32 to i64
%1017 = arith.addi %1015, %1018 : i64
llvm.store %1017, %719 : i64, !llvm.ptr
cf.br ^bb108
^bb110:
%1020 = arith.constant 2 : i32
%1021 = arith.extsi %1020 : i32 to i64
%1019 = func.call @key_of(%415, %420, %1021) : (!llvm.ptr, !llvm.ptr, i64) -> i128
%1023 = arith.constant 5 : i32
%1024 = arith.extsi %1023 : i32 to i64
%1022 = func.call @key_of(%415, %420, %1024) : (!llvm.ptr, !llvm.ptr, i64) -> i128
%1026 = arith.trunci %1019 : i128 to i64
%1027 = arith.trunci %1022 : i128 to i64
%1025 = arith.addi %1026, %1027 : i64
%1028 = arith.extsi %1025 : i64 to i128
%1029 = llvm.mlir.addressof @LEXP : !llvm.ptr
%1030 = llvm.load %1029 : !llvm.ptr -> i64
%1031 = arith.extsi %1030 : i64 to i128
%1033 = arith.trunci %1028 : i128 to i64
%1034 = arith.trunci %1031 : i128 to i64
%1032 = arith.muli %1033, %1034 : i64
%1035 = arith.extsi %1032 : i64 to i128
%1036 = llvm.mlir.addressof @HEXP : !llvm.ptr
%1037 = llvm.load %1036 : !llvm.ptr -> i64
%1038 = arith.extsi %1037 : i64 to i128
%1040 = arith.trunci %1028 : i128 to i64
%1041 = arith.trunci %1038 : i128 to i64
%1039 = arith.muli %1040, %1041 : i64
%1042 = arith.extsi %1039 : i64 to i128
%1044 = arith.constant 32 : i32
%1045 = arith.constant 8 : i32
%1046 = arith.extsi %1044 : i32 to i64
%1047 = arith.extsi %1045 : i32 to i64
%1043 = func.call @calloc(%1046, %1047) : (i64, i64) -> !llvm.ptr
%1049 = arith.constant 32 : i32
%1050 = arith.constant 8 : i32
%1051 = arith.extsi %1049 : i32 to i64
%1052 = arith.extsi %1050 : i32 to i64
%1048 = func.call @calloc(%1051, %1052) : (i64, i64) -> !llvm.ptr
%1053 = arith.constant 0 : i32
%1054 = arith.extsi %1053 : i32 to i64
llvm.store %1054, %719 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%1055 = llvm.load %719 : !llvm.ptr -> i64
%1056 = llvm.load %790 : !llvm.ptr -> i64
%1057 = arith.cmpi slt, %1055, %1056 : i64
cf.cond_br %1057, ^bb112, ^bb113
^bb112:
%1060 = llvm.load %719 : !llvm.ptr -> i64
%1061 = llvm.getelementptr %777[%1060] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1059 = llvm.load %1061 : !llvm.ptr -> i64
%1062 = llvm.getelementptr %615[%1059] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1058 = llvm.load %1062 : !llvm.ptr -> i64
%1063 = llvm.load %719 : !llvm.ptr -> i64
%1064 = llvm.getelementptr %1043[%1063] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1058, %1064 : i64, !llvm.ptr
%1067 = llvm.load %719 : !llvm.ptr -> i64
%1068 = llvm.getelementptr %777[%1067] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1066 = llvm.load %1068 : !llvm.ptr -> i64
%1069 = llvm.getelementptr %620[%1066] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1065 = llvm.load %1069 : !llvm.ptr -> i64
%1070 = llvm.load %719 : !llvm.ptr -> i64
%1071 = llvm.getelementptr %1048[%1070] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1065, %1071 : i64, !llvm.ptr
%1072 = llvm.load %719 : !llvm.ptr -> i64
%1073 = arith.constant 1 : i32
%1075 = arith.extsi %1073 : i32 to i64
%1074 = arith.addi %1072, %1075 : i64
llvm.store %1074, %719 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
%1077 = arith.constant 1 : i32
%1078 = arith.constant 8 : i32
%1079 = arith.extsi %1077 : i32 to i64
%1080 = arith.extsi %1078 : i32 to i64
%1076 = func.call @calloc(%1079, %1080) : (i64, i64) -> !llvm.ptr
%1082 = arith.constant 0 : i32
%1083 = llvm.load %790 : !llvm.ptr -> i64
%1084 = arith.constant 0 : i32
%1085 = arith.extsi %1084 : i32 to i128
%1086 = arith.constant 1 : i32
%1087 = arith.constant 1 : i32
%1088 = llvm.load %867 : !llvm.ptr -> i64
%1089 = arith.extsi %1082 : i32 to i64
%1090 = arith.extsi %1086 : i32 to i64
%1091 = arith.extsi %1087 : i32 to i64
func.call @walkA(%1089, %1083, %1043, %1048, %415, %420, %1085, %1090, %1091, %1035, %1042, %844, %977, %1088, %1076) : (i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i128, i64, i64, i128, i128, !llvm.ptr, !llvm.ptr, i64, !llvm.ptr) -> ()
%1092 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1094 = arith.constant 0 : i32
%1095 = arith.extsi %1094 : i32 to i64
%1096 = llvm.getelementptr %1076[%1095] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1093 = llvm.load %1096 : !llvm.ptr -> i64
%1097 = llvm.call @printf(%1092, %1093) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%415) : (!llvm.ptr) -> ()
func.call @free(%420) : (!llvm.ptr) -> ()
func.call @free(%615) : (!llvm.ptr) -> ()
func.call @free(%620) : (!llvm.ptr) -> ()
func.call @free(%711) : (!llvm.ptr) -> ()
func.call @free(%777) : (!llvm.ptr) -> ()
func.call @free(%782) : (!llvm.ptr) -> ()
func.call @free(%844) : (!llvm.ptr) -> ()
func.call @free(%849) : (!llvm.ptr) -> ()
func.call @free(%977) : (!llvm.ptr) -> ()
func.call @free(%1043) : (!llvm.ptr) -> ()
func.call @free(%1048) : (!llvm.ptr) -> ()
func.call @free(%1076) : (!llvm.ptr) -> ()
%1111 = arith.constant 0 : i32
func.return %1111 : i32
}
}