Problem 920
m(k) = smallest tau number x with tau(x)=k M(n) = sum of all m(k) whose values do not exceed 10^n Compute M(16).
View problem on Project Euler
Performance comparison
| Metric | Our solution | Best known |
| Time complexity | O(n^4) | O(n log n) |
| Space complexity | O(n^2) | O(n) |
| Approach | Flow solution | Addition chain DP |
| Verdict | Suboptimal |
Flow source
# Project Euler 920: Tau Numbers
# m(k) = smallest tau number x with tau(x)=k
# M(n) = sum of all m(k) whose values do not exceed 10^n
# Compute M(16).
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function memset(p: ptr<void>, c: i32, n: i64) -> ptr<void>
function memcpy(dst: ptr<void>, src: ptr<void>, n: i64) -> ptr<void>
function sqrt(x: f64) -> f64
}
const LIMIT: i64 = 10000000000000000
const MAX_VECS: i32 = 300000
const MAX_EXP_LEN: i32 = 20
const MAX_REQ: i32 = 12
let mut g_inf: i128 = 0
# Primes
let mut g_primes: ptr<i32> = null
let mut g_num_primes: i32 = 0
# Exponent vectors
let mut g_vec_len: ptr<i32> = null
let mut g_vec_data: ptr<i32> = null
let mut g_num_vecs: i32 = 0
let mut g_lb_primes: ptr<i32> = null
let mut g_num_lb_primes: i32 = 0
let mut g_dfs_exps: ptr<i32> = null
# Factorize small
let mut g_fac_primes: ptr<i32> = null
let mut g_fac_exps: ptr<i32> = null
let mut g_fac_count: i32 = 0
# min_tau_number globals
let mut g_g_exps: ptr<i32> = null
let mut g_g_r: i32 = 0
let mut g_g_req_primes: ptr<i64> = null
let mut g_g_req_exps: ptr<i32> = null
let mut g_g_s: i32 = 0
let mut g_g_fillers: ptr<i64> = null
let mut g_g_num_fillers: i32 = 0
let mut g_g_best: i128 = 0
let mut g_g_limit: i128 = 0
function sieve() -> void {
let isp: ptr<i8> = calloc(201, 1)
memset(isp as ptr<void>, 1, 201)
isp[0] = 0
isp[1] = 0
let mut p: i32 = 2
while p * p <= 200 {
if isp[p] != 0 {
let mut m: i32 = p * p
while m <= 200 {
isp[m] = 0
m = m + p
}
}
p = p + 1
}
g_num_primes = 0
let mut i: i32 = 2
while i <= 200 {
if isp[i] != 0 {
g_primes[g_num_primes] = i
g_num_primes = g_num_primes + 1
}
i = i + 1
}
free(isp)
}
function ipow128(base0: i64, exp0: i32) -> i128 {
let mut result: i128 = 1
let mut b: i128 = base0 as i128
let cap: i128 = (1000000000000000000 as i128) * (100 as i128)
let mut e: i32 = exp0
while e > 0 {
if (e & 1) == 1 {
result = result * b
if result > cap { return cap }
}
e = e >> 1
if e > 0 {
b = b * b
if b > cap { b = cap }
}
}
return result
}
function safe_mul(a: i128, b: i128) -> i128 {
if a == 0 || b == 0 { return 0 }
let r: i128 = a * b
if r / a != b { return g_inf }
return r
}
function dfs_gen(idx: i32, max_e: i32, current: i128) -> void {
if idx >= g_num_lb_primes { return }
let p: i32 = g_lb_primes[idx]
let mut p_pow: i128 = 1
let mut e: i32 = 1
while e <= max_e {
p_pow = p_pow * (p as i128)
let nxt: i128 = current * p_pow
if nxt > (LIMIT as i128) { break }
g_dfs_exps[idx] = e
let len: i32 = idx + 1
g_vec_len[g_num_vecs] = len
memcpy(g_vec_data + g_num_vecs * MAX_EXP_LEN, g_dfs_exps as ptr<void>, (len as i64) * 4)
g_num_vecs = g_num_vecs + 1
dfs_gen(idx + 1, e, nxt)
e = e + 1
}
}
function factorize_small(n0: i32) -> void {
g_fac_count = 0
let mut n: i32 = n0
let mut i: i32 = 0
while i < g_num_primes && g_primes[i] * g_primes[i] <= n {
if (n % g_primes[i]) == 0 {
let mut e: i32 = 0
while (n % g_primes[i]) == 0 {
n = n / g_primes[i]
e = e + 1
}
g_fac_primes[g_fac_count] = g_primes[i]
g_fac_exps[g_fac_count] = e
g_fac_count = g_fac_count + 1
}
i = i + 1
}
if n > 1 {
g_fac_primes[g_fac_count] = n
g_fac_exps[g_fac_count] = 1
g_fac_count = g_fac_count + 1
}
}
function lower_bound(mask: i32, current_prod: i128, next_req_idx: i32) -> i128 {
# Collect remaining exponents (not in mask), sort descending
let rem_exps: array<i32, 20> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let mut rem_count: i32 = 0
let mut i: i32 = 0
while i < g_g_r {
if ((mask >> i) & 1) == 0 {
rem_exps[rem_count] = g_g_exps[i]
rem_count = rem_count + 1
}
i = i + 1
}
# Sort descending (bubble sort, small array)
let mut i2: i32 = 0
while i2 < rem_count {
let mut j: i32 = i2 + 1
while j < rem_count {
if rem_exps[j] > rem_exps[i2] {
let t: i32 = rem_exps[i2]
rem_exps[i2] = rem_exps[j]
rem_exps[j] = t
}
j = j + 1
}
i2 = i2 + 1
}
# Collect remaining primes (fillers + remaining required), sort ascending
let rem_primes: array<i64, 40> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let mut rp_count: i32 = 0
let mut i3: i32 = 0
while i3 < g_g_num_fillers {
rem_primes[rp_count] = g_g_fillers[i3]
rp_count = rp_count + 1
i3 = i3 + 1
}
let mut i4: i32 = next_req_idx
while i4 < g_g_s {
rem_primes[rp_count] = g_g_req_primes[i4]
rp_count = rp_count + 1
i4 = i4 + 1
}
# Sort ascending (bubble sort)
let mut i5: i32 = 0
while i5 < rp_count {
let mut j2: i32 = i5 + 1
while j2 < rp_count {
if rem_primes[j2] < rem_primes[i5] {
let t2: i64 = rem_primes[i5]
rem_primes[i5] = rem_primes[j2]
rem_primes[j2] = t2
}
j2 = j2 + 1
}
i5 = i5 + 1
}
let mut lb: i128 = current_prod
let n: i32 = if rem_count < rp_count { rem_count } else { rp_count }
let mut i6: i32 = 0
while i6 < n {
let pp: i128 = ipow128(rem_primes[i6], rem_exps[i6])
lb = safe_mul(lb, pp)
if lb >= g_g_best || lb >= g_inf { break }
i6 = i6 + 1
}
return lb
}
function dfs_assign(req_idx: i32, mask: i32, current_prod: i128) -> void {
if current_prod >= g_g_best { return }
if req_idx == g_g_s {
# Collect remaining exponents, sort descending
let rem_exps: array<i32, 20> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let mut rem_count: i32 = 0
let mut i: i32 = 0
while i < g_g_r {
if ((mask >> i) & 1) == 0 {
rem_exps[rem_count] = g_g_exps[i]
rem_count = rem_count + 1
}
i = i + 1
}
# Sort descending
let mut i2: i32 = 0
while i2 < rem_count {
let mut j: i32 = i2 + 1
while j < rem_count {
if rem_exps[j] > rem_exps[i2] {
let t: i32 = rem_exps[i2]
rem_exps[i2] = rem_exps[j]
rem_exps[j] = t
}
j = j + 1
}
i2 = i2 + 1
}
let mut total: i128 = current_prod
let mut i3: i32 = 0
while i3 < g_g_num_fillers && i3 < rem_count {
total = safe_mul(total, ipow128(g_g_fillers[i3], rem_exps[i3]))
if total >= g_g_best { return }
i3 = i3 + 1
}
if total <= g_g_limit && total < g_g_best { g_g_best = total }
return
}
if lower_bound(mask, current_prod, req_idx) >= g_g_best { return }
let p: i64 = g_g_req_primes[req_idx]
let need: i32 = g_g_req_exps[req_idx]
let mut prev_e: i32 = -1
let mut i4: i32 = 0
while i4 < g_g_r {
if ((mask >> i4) & 1) != 0 {
i4 = i4 + 1
continue
}
let e: i32 = g_g_exps[i4]
if e < need {
i4 = i4 + 1
continue
}
if e == prev_e {
i4 = i4 + 1
continue
}
prev_e = e
let nxt: i128 = safe_mul(current_prod, ipow128(p, e))
if nxt >= g_g_best || nxt > g_g_limit {
i4 = i4 + 1
continue
}
dfs_assign(req_idx + 1, mask | (1 << i4), nxt)
i4 = i4 + 1
}
}
function min_tau_number(exps: ptr<i32>, r: i32, req_pr: ptr<i64>, req_ex: ptr<i32>, s: i32) -> i64 {
if r == 0 { return 1 }
if s > r { return -1 }
let mut max_exp: i32 = exps[0]
let mut i: i32 = 0
while i < s {
if req_ex[i] > max_exp { return -1 }
i = i + 1
}
# Required set marking
let req_mark: ptr<i32> = calloc(200, 4)
let mut i2: i32 = 0
while i2 < s {
let mut j: i32 = 0
while j < g_num_primes {
if (g_primes[j] as i64) == req_pr[i2] {
req_mark[j] = 1
break
}
j = j + 1
}
i2 = i2 + 1
}
let fillers_needed: i32 = r - s
g_g_num_fillers = 0
let mut j2: i32 = 0
while j2 < g_num_primes && g_g_num_fillers < fillers_needed {
if req_mark[j2] == 0 {
g_g_fillers[g_g_num_fillers] = g_primes[j2] as i64
g_g_num_fillers = g_g_num_fillers + 1
}
j2 = j2 + 1
}
g_g_r = r
memcpy(g_g_exps as ptr<void>, exps as ptr<void>, (r as i64) * 4)
g_g_s = s
let mut i3: i32 = 0
while i3 < s {
g_g_req_primes[i3] = req_pr[i3]
g_g_req_exps[i3] = req_ex[i3]
i3 = i3 + 1
}
# Sort required primes descending (bubble sort)
let mut i4: i32 = 0
while i4 < s {
let mut j3: i32 = i4 + 1
while j3 < s {
if g_g_req_primes[j3] > g_g_req_primes[i4] {
let tp: i64 = g_g_req_primes[i4]
g_g_req_primes[i4] = g_g_req_primes[j3]
g_g_req_primes[j3] = tp
let te: i32 = g_g_req_exps[i4]
g_g_req_exps[i4] = g_g_req_exps[j3]
g_g_req_exps[j3] = te
}
j3 = j3 + 1
}
i4 = i4 + 1
}
g_g_limit = LIMIT as i128
# Greedy upper bound
let avail: ptr<i32> = calloc(MAX_EXP_LEN as i64, 4)
memcpy(avail as ptr<void>, exps as ptr<void>, (r as i64) * 4)
# Sort ascending
let mut i5: i32 = 0
while i5 < r {
let mut j4: i32 = i5 + 1
while j4 < r {
if avail[j4] < avail[i5] {
let t: i32 = avail[i5]
avail[i5] = avail[j4]
avail[j4] = t
}
j4 = j4 + 1
}
i5 = i5 + 1
}
let mut gp: i128 = 1
let mut gok: i32 = 1
let au: ptr<i32> = calloc(MAX_EXP_LEN as i64, 4)
let mut i6: i32 = 0
while i6 < s && gok != 0 {
let p: i64 = g_g_req_primes[i6]
let need: i32 = g_g_req_exps[i6]
let mut found: i32 = -1
let mut j5: i32 = 0
while j5 < r {
if au[j5] == 0 && avail[j5] >= need {
found = j5
break
}
j5 = j5 + 1
}
if found < 0 {
gok = 0
} else {
au[found] = 1
gp = safe_mul(gp, ipow128(p, avail[found]))
if gp > g_g_limit { gok = 0 }
}
i6 = i6 + 1
}
if gok != 0 {
# Remaining exponents sorted descending
let rem: ptr<i32> = calloc(MAX_EXP_LEN as i64, 4)
let mut rc: i32 = 0
let mut j6: i32 = 0
while j6 < r {
if au[j6] == 0 {
rem[rc] = avail[j6]
rc = rc + 1
}
j6 = j6 + 1
}
# Sort descending
let mut i7: i32 = 0
while i7 < rc {
let mut j7: i32 = i7 + 1
while j7 < rc {
if rem[j7] > rem[i7] {
let t: i32 = rem[i7]
rem[i7] = rem[j7]
rem[j7] = t
}
j7 = j7 + 1
}
i7 = i7 + 1
}
let mut i8v: i32 = 0
while i8v < g_g_num_fillers && i8v < rc {
gp = safe_mul(gp, ipow128(g_g_fillers[i8v], rem[i8v]))
if gp > g_g_limit { gok = 0; break }
i8v = i8v + 1
}
free(rem)
}
g_g_best = if gok != 0 { gp } else { g_inf }
dfs_assign(0, 0, 1)
free(req_mark)
free(avail)
free(au)
if g_g_best <= g_g_limit && g_g_best < g_inf { return g_g_best as i64 }
return -1
}
# Heapsort for kn_pairs: sort by (k ascending, n ascending)
function kn_sift_down(pk: ptr<i64>, pn: ptr<i64>, n: i32, i: i32) -> void {
let mut root: i32 = i
while true {
let left: i32 = 2 * root + 1
let right: i32 = 2 * root + 2
let mut largest: i32 = root
if left < n {
if pk[left] > pk[largest] { largest = left }
if pk[left] == pk[largest] && pn[left] > pn[largest] { largest = left }
}
if right < n {
if pk[right] > pk[largest] { largest = right }
if pk[right] == pk[largest] && pn[right] > pn[largest] { largest = right }
}
if largest == root { return }
let tk: i64 = pk[root]
pk[root] = pk[largest]
pk[largest] = tk
let tn: i64 = pn[root]
pn[root] = pn[largest]
pn[largest] = tn
root = largest
}
}
function kn_heapsort(pk: ptr<i64>, pn: ptr<i64>, n: i32) -> void {
let mut i: i32 = n / 2 - 1
while i >= 0 {
kn_sift_down(pk, pn, n, i)
i = i - 1
}
let mut j: i32 = n - 1
while j > 0 {
let tk: i64 = pk[0]
pk[0] = pk[j]
pk[j] = tk
let tn: i64 = pn[0]
pn[0] = pn[j]
pn[j] = tn
kn_sift_down(pk, pn, j, 0)
j = j - 1
}
}
function main() -> i32 {
g_inf = (1 as i128) << 120
# Allocate arrays
g_primes = calloc(200, 4)
g_vec_len = calloc(MAX_VECS as i64, 4)
g_vec_data = calloc((MAX_VECS as i64) * (MAX_EXP_LEN as i64), 4)
g_lb_primes = calloc(20, 4)
g_dfs_exps = calloc(MAX_EXP_LEN as i64, 4)
g_fac_primes = calloc(10, 4)
g_fac_exps = calloc(10, 4)
g_g_exps = calloc(MAX_EXP_LEN as i64, 4)
g_g_req_primes = calloc(MAX_REQ as i64, 8)
g_g_req_exps = calloc(MAX_REQ as i64, 4)
g_g_fillers = calloc(MAX_EXP_LEN as i64, 8)
sieve()
# Generate exponent vectors
g_num_vecs = 0
let mut prod: i128 = 1
g_num_lb_primes = 0
let mut i: i32 = 0
while i < g_num_primes {
if prod * (g_primes[i] as i128) > (LIMIT as i128) { break }
prod = prod * (g_primes[i] as i128)
g_lb_primes[g_num_lb_primes] = g_primes[i]
g_num_lb_primes = g_num_lb_primes + 1
i = i + 1
}
dfs_gen(0, 60, 1)
# Collect (k, n) pairs
let pair_k: ptr<i64> = calloc((g_num_vecs + 1) as i64, 8)
let pair_n: ptr<i64> = calloc((g_num_vecs + 1) as i64, 8)
let mut np: i32 = 0
# k=1, n=1
pair_k[np] = 1
pair_n[np] = 1
np = np + 1
let req_pr: ptr<i64> = calloc(MAX_REQ as i64, 8)
let req_ex: ptr<i32> = calloc(MAX_REQ as i64, 4)
let mut v: i32 = 0
while v < g_num_vecs {
let exps: ptr<i32> = g_vec_data + v * MAX_EXP_LEN
let r: i32 = g_vec_len[v]
let mut k: i64 = 1
let mut s: i32 = 0
let mut i2: i32 = 0
while i2 < r {
let ai1: i32 = exps[i2] + 1
k = k * (ai1 as i64)
factorize_small(ai1)
let mut j: i32 = 0
while j < g_fac_count {
let fp: i32 = g_fac_primes[j]
let fe: i32 = g_fac_exps[j]
let mut found: i32 = -1
let mut t: i32 = 0
while t < s {
if req_pr[t] == (fp as i64) {
found = t
break
}
t = t + 1
}
if found >= 0 {
req_ex[found] = req_ex[found] + fe
} else {
req_pr[s] = fp as i64
req_ex[s] = fe
s = s + 1
}
j = j + 1
}
i2 = i2 + 1
}
let n_val: i64 = min_tau_number(exps, r, req_pr, req_ex, s)
if n_val > 0 && n_val <= LIMIT {
pair_k[np] = k
pair_n[np] = n_val
np = np + 1
}
v = v + 1
}
# Sort pairs by (k ascending, n ascending)
kn_heapsort(pair_k, pair_n, np)
# Sum unique k values
let mut sum: i128 = 0
let mut prev_k: i64 = -1
let mut i3: i32 = 0
while i3 < np {
if pair_k[i3] != prev_k {
sum = sum + (pair_n[i3] as i128)
prev_k = pair_k[i3]
}
i3 = i3 + 1
}
printf("%lld\n", sum as i64)
return 0
}
Generated C
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
while (flow_temp_head) {
flow_temp_node* n = flow_temp_head;
flow_temp_head = n->next;
free(n);
}
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
if (!node) return NULL;
node->next = flow_temp_head;
flow_temp_head = node;
if (!flow_temp_atexit_set) {
flow_temp_atexit_set = 1;
atexit(flow_temp_free_all);
}
return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
char* r = (char*)flow_temp_alloc(la + lb + 1);
if (!r) return NULL;
if (la) memcpy(r, a, la);
if (lb) memcpy(r + la, b, lb);
r[la + lb] = '\0';
return r;
}
#define __flow_in_arr(arr, val) __extension__ ({ \
int _found = 0; \
size_t _n = sizeof(arr)/sizeof((arr)[0]); \
for (size_t _i = 0; _i < _n; _i++) { \
if ((arr)[_i] == (val)) { _found = 1; break; } \
} _found; })
/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
abort();
#if defined(__GNUC__) || defined(__clang__)
__builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")
#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#include <math.h>
void* _ui_state = NULL;
static inline float i32_to_f32(int32_t v) { return (float)v; }
/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }
void sieve(void);
__int128 ipow128_i64_i32(int64_t base0, int32_t exp0);
__int128 safe_mul_i128_i128(__int128 a, __int128 b);
void dfs_gen_i32_i32_i128(int32_t idx, int32_t max_e, __int128 current);
void factorize_small_i32(int32_t n0);
__int128 lower_bound_i32_i128_i32(int32_t mask, __int128 current_prod, int32_t next_req_idx);
void dfs_assign_i32_i32_i128(int32_t req_idx, int32_t mask, __int128 current_prod);
int64_t min_tau_number_ptr_i32_i32_ptr_i64_ptr_i32_i32(int32_t* exps, int32_t r, int64_t* req_pr, int32_t* req_ex, int32_t s);
void kn_sift_down_ptr_i64_ptr_i64_i32_i32(int64_t* pk, int64_t* pn, int32_t n, int32_t i);
void kn_heapsort_ptr_i64_ptr_i64_i32(int64_t* pk, int64_t* pn, int32_t n);
int32_t main(void);
static const int64_t LIMIT = 10000000000000000;
static const int32_t MAX_VECS = 300000;
static const int32_t MAX_EXP_LEN = 20;
static const int32_t MAX_REQ = 12;
/* Module statics */
static __int128 g_inf = 0;
static int32_t* g_primes = NULL;
static int32_t g_num_primes = 0;
static int32_t* g_vec_len = NULL;
static int32_t* g_vec_data = NULL;
static int32_t g_num_vecs = 0;
static int32_t* g_lb_primes = NULL;
static int32_t g_num_lb_primes = 0;
static int32_t* g_dfs_exps = NULL;
static int32_t* g_fac_primes = NULL;
static int32_t* g_fac_exps = NULL;
static int32_t g_fac_count = 0;
static int32_t* g_g_exps = NULL;
static int32_t g_g_r = 0;
static int64_t* g_g_req_primes = NULL;
static int32_t* g_g_req_exps = NULL;
static int32_t g_g_s = 0;
static int64_t* g_g_fillers = NULL;
static int32_t g_g_num_fillers = 0;
static __int128 g_g_best = 0;
static __int128 g_g_limit = 0;
void sieve(void) {
int8_t* isp = (int8_t*)(calloc(201, 1));
memset(((void*)(isp)), 1, 201);
isp[0] = 0;
isp[1] = 0;
int32_t p = 2;
while ((p * p) <= 200) {
if (isp[p] != 0) {
int32_t m = (p * p);
while (m <= 200) {
isp[m] = 0;
m = (m + p);
}
}
p = (p + 1);
}
g_num_primes = 0;
int32_t i = 2;
while (i <= 200) {
if (isp[i] != 0) {
g_primes[g_num_primes] = i;
g_num_primes = (g_num_primes + 1);
}
i = (i + 1);
}
free(isp);
}
__int128 ipow128_i64_i32(int64_t base0, int32_t exp0) {
__int128 result = 1;
__int128 b = ((__int128)(base0));
__int128 cap = (((__int128)(1000000000000000000)) * ((__int128)(100)));
int32_t e = exp0;
while (e > 0) {
if ((e & 1) == 1) {
result = (result * b);
if (result > cap) {
return cap;
}
}
e = FLOW_CHECKED_SHR((e), (1));
if (e > 0) {
b = (b * b);
if (b > cap) {
b = cap;
}
}
}
return result;
}
__int128 safe_mul_i128_i128(__int128 a, __int128 b) {
if ((a == 0 || b == 0)) {
return 0;
}
__int128 r = (a * b);
if (FLOW_CHECKED_DIV((r), (a)) != b) {
return g_inf;
}
return r;
}
void dfs_gen_i32_i32_i128(int32_t idx, int32_t max_e, __int128 current) {
if (idx >= g_num_lb_primes) {
return;
}
int32_t p = g_lb_primes[idx];
__int128 p_pow = 1;
int32_t e = 1;
while (e <= max_e) {
p_pow = (p_pow * ((__int128)(p)));
__int128 nxt = (current * p_pow);
if (nxt > ((__int128)(LIMIT))) {
break;
}
g_dfs_exps[idx] = e;
int32_t len = (idx + 1);
g_vec_len[g_num_vecs] = len;
memcpy((g_vec_data + (g_num_vecs * MAX_EXP_LEN)), ((void*)(g_dfs_exps)), (((int64_t)(len)) * 4));
g_num_vecs = (g_num_vecs + 1);
dfs_gen_i32_i32_i128((idx + 1), e, nxt);
e = (e + 1);
}
}
void factorize_small_i32(int32_t n0) {
g_fac_count = 0;
int32_t n = n0;
int32_t i = 0;
while ((i < g_num_primes && (g_primes[i] * g_primes[i]) <= n)) {
if (FLOW_CHECKED_MOD((n), (g_primes[i])) == 0) {
int32_t e = 0;
while (FLOW_CHECKED_MOD((n), (g_primes[i])) == 0) {
n = FLOW_CHECKED_DIV((n), (g_primes[i]));
e = (e + 1);
}
g_fac_primes[g_fac_count] = g_primes[i];
g_fac_exps[g_fac_count] = e;
g_fac_count = (g_fac_count + 1);
}
i = (i + 1);
}
if (n > 1) {
g_fac_primes[g_fac_count] = n;
g_fac_exps[g_fac_count] = 1;
g_fac_count = (g_fac_count + 1);
}
}
__int128 lower_bound_i32_i128_i32(int32_t mask, __int128 current_prod, int32_t next_req_idx) {
int32_t rem_exps[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int32_t rem_count = 0;
int32_t i = 0;
while (i < g_g_r) {
if ((FLOW_CHECKED_SHR((mask), (i)) & 1) == 0) {
rem_exps[rem_count] = g_g_exps[i];
rem_count = (rem_count + 1);
}
i = (i + 1);
}
int32_t i2 = 0;
while (i2 < rem_count) {
int32_t j = (i2 + 1);
while (j < rem_count) {
if ((((unsigned)(j) < 20) ? rem_exps[j] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(j), 20), flow_fault_handler("array index out of bounds"), rem_exps[0])) > (((unsigned)(i2) < 20) ? rem_exps[i2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i2), 20), flow_fault_handler("array index out of bounds"), rem_exps[0]))) {
int32_t t = (((unsigned)(i2) < 20) ? rem_exps[i2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i2), 20), flow_fault_handler("array index out of bounds"), rem_exps[0]));
rem_exps[i2] = (((unsigned)(j) < 20) ? rem_exps[j] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(j), 20), flow_fault_handler("array index out of bounds"), rem_exps[0]));
rem_exps[j] = t;
}
j = (j + 1);
}
i2 = (i2 + 1);
}
int64_t rem_primes[40] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int32_t rp_count = 0;
int32_t i3 = 0;
while (i3 < g_g_num_fillers) {
rem_primes[rp_count] = g_g_fillers[i3];
rp_count = (rp_count + 1);
i3 = (i3 + 1);
}
int32_t i4 = next_req_idx;
while (i4 < g_g_s) {
rem_primes[rp_count] = g_g_req_primes[i4];
rp_count = (rp_count + 1);
i4 = (i4 + 1);
}
int32_t i5 = 0;
while (i5 < rp_count) {
int32_t j2 = (i5 + 1);
while (j2 < rp_count) {
if ((((unsigned)(j2) < 40) ? rem_primes[j2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(j2), 40), flow_fault_handler("array index out of bounds"), rem_primes[0])) < (((unsigned)(i5) < 40) ? rem_primes[i5] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i5), 40), flow_fault_handler("array index out of bounds"), rem_primes[0]))) {
int64_t t2 = (((unsigned)(i5) < 40) ? rem_primes[i5] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i5), 40), flow_fault_handler("array index out of bounds"), rem_primes[0]));
rem_primes[i5] = (((unsigned)(j2) < 40) ? rem_primes[j2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(j2), 40), flow_fault_handler("array index out of bounds"), rem_primes[0]));
rem_primes[j2] = t2;
}
j2 = (j2 + 1);
}
i5 = (i5 + 1);
}
__int128 lb = current_prod;
int32_t n = ((rem_count < rp_count) ? (rem_count) : (rp_count));
int32_t i6 = 0;
while (i6 < n) {
__int128 pp = ipow128_i64_i32((((unsigned)(i6) < 40) ? rem_primes[i6] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i6), 40), flow_fault_handler("array index out of bounds"), rem_primes[0])), (((unsigned)(i6) < 20) ? rem_exps[i6] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i6), 20), flow_fault_handler("array index out of bounds"), rem_exps[0])));
lb = safe_mul_i128_i128(lb, pp);
if ((lb >= g_g_best || lb >= g_inf)) {
break;
}
i6 = (i6 + 1);
}
return lb;
}
void dfs_assign_i32_i32_i128(int32_t req_idx, int32_t mask, __int128 current_prod) {
if (current_prod >= g_g_best) {
return;
}
if (req_idx == g_g_s) {
int32_t rem_exps[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int32_t rem_count = 0;
int32_t i = 0;
while (i < g_g_r) {
if ((FLOW_CHECKED_SHR((mask), (i)) & 1) == 0) {
rem_exps[rem_count] = g_g_exps[i];
rem_count = (rem_count + 1);
}
i = (i + 1);
}
int32_t i2 = 0;
while (i2 < rem_count) {
int32_t j = (i2 + 1);
while (j < rem_count) {
if ((((unsigned)(j) < 20) ? rem_exps[j] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(j), 20), flow_fault_handler("array index out of bounds"), rem_exps[0])) > (((unsigned)(i2) < 20) ? rem_exps[i2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i2), 20), flow_fault_handler("array index out of bounds"), rem_exps[0]))) {
int32_t t = (((unsigned)(i2) < 20) ? rem_exps[i2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i2), 20), flow_fault_handler("array index out of bounds"), rem_exps[0]));
rem_exps[i2] = (((unsigned)(j) < 20) ? rem_exps[j] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(j), 20), flow_fault_handler("array index out of bounds"), rem_exps[0]));
rem_exps[j] = t;
}
j = (j + 1);
}
i2 = (i2 + 1);
}
__int128 total = current_prod;
int32_t i3 = 0;
while ((i3 < g_g_num_fillers && i3 < rem_count)) {
total = safe_mul_i128_i128(total, ipow128_i64_i32(g_g_fillers[i3], (((unsigned)(i3) < 20) ? rem_exps[i3] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i3), 20), flow_fault_handler("array index out of bounds"), rem_exps[0]))));
if (total >= g_g_best) {
return;
}
i3 = (i3 + 1);
}
if ((total <= g_g_limit && total < g_g_best)) {
g_g_best = total;
}
return;
}
if (lower_bound_i32_i128_i32(mask, current_prod, req_idx) >= g_g_best) {
return;
}
int64_t p = g_g_req_primes[req_idx];
int32_t need = g_g_req_exps[req_idx];
int32_t prev_e = (-1);
int32_t i4 = 0;
while (i4 < g_g_r) {
if ((FLOW_CHECKED_SHR((mask), (i4)) & 1) != 0) {
i4 = (i4 + 1);
continue;
}
int32_t e = g_g_exps[i4];
if (e < need) {
i4 = (i4 + 1);
continue;
}
if (e == prev_e) {
i4 = (i4 + 1);
continue;
}
prev_e = e;
__int128 nxt = safe_mul_i128_i128(current_prod, ipow128_i64_i32(p, e));
if ((nxt >= g_g_best || nxt > g_g_limit)) {
i4 = (i4 + 1);
continue;
}
dfs_assign_i32_i32_i128((req_idx + 1), (mask | FLOW_CHECKED_SHL((1), (i4))), nxt);
i4 = (i4 + 1);
}
}
int64_t min_tau_number_ptr_i32_i32_ptr_i64_ptr_i32_i32(int32_t* exps, int32_t r, int64_t* req_pr, int32_t* req_ex, int32_t s) {
if (r == 0) {
return 1;
}
if (s > r) {
return (-1);
}
int32_t max_exp = exps[0];
int32_t i = 0;
while (i < s) {
if (req_ex[i] > max_exp) {
return (-1);
}
i = (i + 1);
}
int32_t* req_mark = (int32_t*)(calloc(200, 4));
int32_t i2 = 0;
while (i2 < s) {
int32_t j = 0;
while (j < g_num_primes) {
if (((int64_t)(g_primes[j])) == req_pr[i2]) {
req_mark[j] = 1;
break;
}
j = (j + 1);
}
i2 = (i2 + 1);
}
int32_t fillers_needed = (r - s);
g_g_num_fillers = 0;
int32_t j2 = 0;
while ((j2 < g_num_primes && g_g_num_fillers < fillers_needed)) {
if (req_mark[j2] == 0) {
g_g_fillers[g_g_num_fillers] = ((int64_t)(g_primes[j2]));
g_g_num_fillers = (g_g_num_fillers + 1);
}
j2 = (j2 + 1);
}
g_g_r = r;
memcpy(((void*)(g_g_exps)), ((void*)(exps)), (((int64_t)(r)) * 4));
g_g_s = s;
int32_t i3 = 0;
while (i3 < s) {
g_g_req_primes[i3] = req_pr[i3];
g_g_req_exps[i3] = req_ex[i3];
i3 = (i3 + 1);
}
int32_t i4 = 0;
while (i4 < s) {
int32_t j3 = (i4 + 1);
while (j3 < s) {
if (g_g_req_primes[j3] > g_g_req_primes[i4]) {
int64_t tp = g_g_req_primes[i4];
g_g_req_primes[i4] = g_g_req_primes[j3];
g_g_req_primes[j3] = tp;
int32_t te = g_g_req_exps[i4];
g_g_req_exps[i4] = g_g_req_exps[j3];
g_g_req_exps[j3] = te;
}
j3 = (j3 + 1);
}
i4 = (i4 + 1);
}
g_g_limit = ((__int128)(LIMIT));
int32_t* avail = (int32_t*)(calloc(((int64_t)(MAX_EXP_LEN)), 4));
memcpy(((void*)(avail)), ((void*)(exps)), (((int64_t)(r)) * 4));
int32_t i5 = 0;
while (i5 < r) {
int32_t j4 = (i5 + 1);
while (j4 < r) {
if (avail[j4] < avail[i5]) {
int32_t t = avail[i5];
avail[i5] = avail[j4];
avail[j4] = t;
}
j4 = (j4 + 1);
}
i5 = (i5 + 1);
}
__int128 gp = 1;
int32_t gok = 1;
int32_t* au = (int32_t*)(calloc(((int64_t)(MAX_EXP_LEN)), 4));
int32_t i6 = 0;
while ((i6 < s && gok != 0)) {
int64_t p = g_g_req_primes[i6];
int32_t need = g_g_req_exps[i6];
int32_t found = (-1);
int32_t j5 = 0;
while (j5 < r) {
if ((au[j5] == 0 && avail[j5] >= need)) {
found = j5;
break;
}
j5 = (j5 + 1);
}
if (found < 0) {
gok = 0;
} else {
au[found] = 1;
gp = safe_mul_i128_i128(gp, ipow128_i64_i32(p, avail[found]));
if (gp > g_g_limit) {
gok = 0;
}
}
i6 = (i6 + 1);
}
if (gok != 0) {
int32_t* rem = (int32_t*)(calloc(((int64_t)(MAX_EXP_LEN)), 4));
int32_t rc = 0;
int32_t j6 = 0;
while (j6 < r) {
if (au[j6] == 0) {
rem[rc] = avail[j6];
rc = (rc + 1);
}
j6 = (j6 + 1);
}
int32_t i7 = 0;
while (i7 < rc) {
int32_t j7 = (i7 + 1);
while (j7 < rc) {
if (rem[j7] > rem[i7]) {
int32_t t = rem[i7];
rem[i7] = rem[j7];
rem[j7] = t;
}
j7 = (j7 + 1);
}
i7 = (i7 + 1);
}
int32_t i8v = 0;
while ((i8v < g_g_num_fillers && i8v < rc)) {
gp = safe_mul_i128_i128(gp, ipow128_i64_i32(g_g_fillers[i8v], rem[i8v]));
if (gp > g_g_limit) {
gok = 0;
break;
}
i8v = (i8v + 1);
}
free(rem);
}
g_g_best = ((gok != 0) ? (gp) : (g_inf));
dfs_assign_i32_i32_i128(0, 0, 1);
free(req_mark);
free(avail);
free(au);
if ((g_g_best <= g_g_limit && g_g_best < g_inf)) {
return ((int64_t)(g_g_best));
}
return (-1);
}
void kn_sift_down_ptr_i64_ptr_i64_i32_i32(int64_t* pk, int64_t* pn, int32_t n, int32_t i) {
int32_t root = i;
while (1) {
int32_t left = ((2 * root) + 1);
int32_t right = ((2 * root) + 2);
int32_t largest = root;
if (left < n) {
if (pk[left] > pk[largest]) {
largest = left;
}
if ((pk[left] == pk[largest] && pn[left] > pn[largest])) {
largest = left;
}
}
if (right < n) {
if (pk[right] > pk[largest]) {
largest = right;
}
if ((pk[right] == pk[largest] && pn[right] > pn[largest])) {
largest = right;
}
}
if (largest == root) {
return;
}
int64_t tk = pk[root];
pk[root] = pk[largest];
pk[largest] = tk;
int64_t tn = pn[root];
pn[root] = pn[largest];
pn[largest] = tn;
root = largest;
}
}
void kn_heapsort_ptr_i64_ptr_i64_i32(int64_t* pk, int64_t* pn, int32_t n) {
int32_t i = (FLOW_CHECKED_DIV((n), (2)) - 1);
while (i >= 0) {
kn_sift_down_ptr_i64_ptr_i64_i32_i32(pk, pn, n, i);
i = (i - 1);
}
int32_t j = (n - 1);
while (j > 0) {
int64_t tk = pk[0];
pk[0] = pk[j];
pk[j] = tk;
int64_t tn = pn[0];
pn[0] = pn[j];
pn[j] = tn;
kn_sift_down_ptr_i64_ptr_i64_i32_i32(pk, pn, j, 0);
j = (j - 1);
}
}
int32_t main(void) {
g_inf = FLOW_CHECKED_SHL((((__int128)(1))), (120));
g_primes = calloc(200, 4);
g_vec_len = calloc(((int64_t)(MAX_VECS)), 4);
g_vec_data = calloc((((int64_t)(MAX_VECS)) * ((int64_t)(MAX_EXP_LEN))), 4);
g_lb_primes = calloc(20, 4);
g_dfs_exps = calloc(((int64_t)(MAX_EXP_LEN)), 4);
g_fac_primes = calloc(10, 4);
g_fac_exps = calloc(10, 4);
g_g_exps = calloc(((int64_t)(MAX_EXP_LEN)), 4);
g_g_req_primes = calloc(((int64_t)(MAX_REQ)), 8);
g_g_req_exps = calloc(((int64_t)(MAX_REQ)), 4);
g_g_fillers = calloc(((int64_t)(MAX_EXP_LEN)), 8);
sieve();
g_num_vecs = 0;
__int128 prod = 1;
g_num_lb_primes = 0;
int32_t i = 0;
while (i < g_num_primes) {
if ((prod * ((__int128)(g_primes[i]))) > ((__int128)(LIMIT))) {
break;
}
prod = (prod * ((__int128)(g_primes[i])));
g_lb_primes[g_num_lb_primes] = g_primes[i];
g_num_lb_primes = (g_num_lb_primes + 1);
i = (i + 1);
}
dfs_gen_i32_i32_i128(0, 60, 1);
int64_t* pair_k = (int64_t*)(calloc(((int64_t)((g_num_vecs + 1))), 8));
int64_t* pair_n = (int64_t*)(calloc(((int64_t)((g_num_vecs + 1))), 8));
int32_t np = 0;
pair_k[np] = 1;
pair_n[np] = 1;
np = (np + 1);
int64_t* req_pr = (int64_t*)(calloc(((int64_t)(MAX_REQ)), 8));
int32_t* req_ex = (int32_t*)(calloc(((int64_t)(MAX_REQ)), 4));
int32_t v = 0;
while (v < g_num_vecs) {
int32_t* exps = (int32_t*)((g_vec_data + (v * MAX_EXP_LEN)));
int32_t r = g_vec_len[v];
int64_t k = 1;
int32_t s = 0;
int32_t i2 = 0;
while (i2 < r) {
int32_t ai1 = (exps[i2] + 1);
k = (k * ((int64_t)(ai1)));
factorize_small_i32(ai1);
int32_t j = 0;
while (j < g_fac_count) {
int32_t fp = g_fac_primes[j];
int32_t fe = g_fac_exps[j];
int32_t found = (-1);
int32_t t = 0;
while (t < s) {
if (req_pr[t] == ((int64_t)(fp))) {
found = t;
break;
}
t = (t + 1);
}
if (found >= 0) {
req_ex[found] = (req_ex[found] + fe);
} else {
req_pr[s] = ((int64_t)(fp));
req_ex[s] = fe;
s = (s + 1);
}
j = (j + 1);
}
i2 = (i2 + 1);
}
int64_t n_val = min_tau_number_ptr_i32_i32_ptr_i64_ptr_i32_i32(exps, r, req_pr, req_ex, s);
if ((n_val > 0 && n_val <= LIMIT)) {
pair_k[np] = k;
pair_n[np] = n_val;
np = (np + 1);
}
v = (v + 1);
}
kn_heapsort_ptr_i64_ptr_i64_i32(pair_k, pair_n, np);
__int128 sum = 0;
int64_t prev_k = (-1);
int32_t i3 = 0;
while (i3 < np) {
if (pair_k[i3] != prev_k) {
sum = (sum + ((__int128)(pair_n[i3])));
prev_k = pair_k[i3];
}
i3 = (i3 + 1);
}
printf("%lld\n", ((int64_t)(sum)));
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 @memset(!llvm.ptr, i32, i64) -> !llvm.ptr
func.func private @memcpy(!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
func.func private @sqrt(f64) -> f64
// Constant: LIMIT
llvm.mlir.global internal constant @LIMIT(10000000000000000 : i64) : i64
// Constant: MAX_VECS
llvm.mlir.global internal constant @MAX_VECS(300000 : i32) : i32
// Constant: MAX_EXP_LEN
llvm.mlir.global internal constant @MAX_EXP_LEN(20 : i32) : i32
// Constant: MAX_REQ
llvm.mlir.global internal constant @MAX_REQ(12 : i32) : i32
// Module static: g_inf
llvm.mlir.global internal @g_inf(0 : i128) : i128
// Module static: g_primes
llvm.mlir.global internal @g_primes() {addr_space = 0 : i32} : !llvm.ptr {
%0 = llvm.mlir.zero : !llvm.ptr
llvm.return %0 : !llvm.ptr
}
// Module static: g_num_primes
llvm.mlir.global internal @g_num_primes(0 : i32) : i32
// Module static: g_vec_len
llvm.mlir.global internal @g_vec_len() {addr_space = 0 : i32} : !llvm.ptr {
%1 = llvm.mlir.zero : !llvm.ptr
llvm.return %1 : !llvm.ptr
}
// Module static: g_vec_data
llvm.mlir.global internal @g_vec_data() {addr_space = 0 : i32} : !llvm.ptr {
%2 = llvm.mlir.zero : !llvm.ptr
llvm.return %2 : !llvm.ptr
}
// Module static: g_num_vecs
llvm.mlir.global internal @g_num_vecs(0 : i32) : i32
// Module static: g_lb_primes
llvm.mlir.global internal @g_lb_primes() {addr_space = 0 : i32} : !llvm.ptr {
%3 = llvm.mlir.zero : !llvm.ptr
llvm.return %3 : !llvm.ptr
}
// Module static: g_num_lb_primes
llvm.mlir.global internal @g_num_lb_primes(0 : i32) : i32
// Module static: g_dfs_exps
llvm.mlir.global internal @g_dfs_exps() {addr_space = 0 : i32} : !llvm.ptr {
%4 = llvm.mlir.zero : !llvm.ptr
llvm.return %4 : !llvm.ptr
}
// Module static: g_fac_primes
llvm.mlir.global internal @g_fac_primes() {addr_space = 0 : i32} : !llvm.ptr {
%5 = llvm.mlir.zero : !llvm.ptr
llvm.return %5 : !llvm.ptr
}
// Module static: g_fac_exps
llvm.mlir.global internal @g_fac_exps() {addr_space = 0 : i32} : !llvm.ptr {
%6 = llvm.mlir.zero : !llvm.ptr
llvm.return %6 : !llvm.ptr
}
// Module static: g_fac_count
llvm.mlir.global internal @g_fac_count(0 : i32) : i32
// Module static: g_g_exps
llvm.mlir.global internal @g_g_exps() {addr_space = 0 : i32} : !llvm.ptr {
%7 = llvm.mlir.zero : !llvm.ptr
llvm.return %7 : !llvm.ptr
}
// Module static: g_g_r
llvm.mlir.global internal @g_g_r(0 : i32) : i32
// Module static: g_g_req_primes
llvm.mlir.global internal @g_g_req_primes() {addr_space = 0 : i32} : !llvm.ptr {
%8 = llvm.mlir.zero : !llvm.ptr
llvm.return %8 : !llvm.ptr
}
// Module static: g_g_req_exps
llvm.mlir.global internal @g_g_req_exps() {addr_space = 0 : i32} : !llvm.ptr {
%9 = llvm.mlir.zero : !llvm.ptr
llvm.return %9 : !llvm.ptr
}
// Module static: g_g_s
llvm.mlir.global internal @g_g_s(0 : i32) : i32
// Module static: g_g_fillers
llvm.mlir.global internal @g_g_fillers() {addr_space = 0 : i32} : !llvm.ptr {
%10 = llvm.mlir.zero : !llvm.ptr
llvm.return %10 : !llvm.ptr
}
// Module static: g_g_num_fillers
llvm.mlir.global internal @g_g_num_fillers(0 : i32) : i32
// Module static: g_g_best
llvm.mlir.global internal @g_g_best(0 : i128) : i128
// Module static: g_g_limit
llvm.mlir.global internal @g_g_limit(0 : i128) : i128
func.func @sieve() -> () {
%12 = arith.constant 201 : i32
%13 = arith.constant 1 : i32
%14 = arith.extsi %12 : i32 to i64
%15 = arith.extsi %13 : i32 to i64
%11 = func.call @calloc(%14, %15) : (i64, i64) -> !llvm.ptr
%17 = arith.constant 1 : i32
%18 = arith.constant 201 : i32
%19 = arith.extsi %18 : i32 to i64
%16 = func.call @memset(%11, %17, %19) : (!llvm.ptr, i32, i64) -> !llvm.ptr
%20 = arith.constant 0 : i32
%21 = arith.constant 0 : i32
%22 = arith.trunci %20 : i32 to i8
%23 = arith.extsi %21 : i32 to i64
%24 = llvm.getelementptr %11[%23] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %22, %24 : i8, !llvm.ptr
%25 = arith.constant 0 : i32
%26 = arith.constant 1 : i32
%27 = arith.trunci %25 : i32 to i8
%28 = arith.extsi %26 : i32 to i64
%29 = llvm.getelementptr %11[%28] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %27, %29 : i8, !llvm.ptr
%30 = arith.constant 2 : i32
%31 = llvm.mlir.constant(1 : i64) : i64
%32 = llvm.alloca %31 x i32 : (i64) -> !llvm.ptr
llvm.store %30, %32 : i32, !llvm.ptr
cf.br ^bb0
^bb0:
%33 = llvm.load %32 : !llvm.ptr -> i32
%34 = llvm.load %32 : !llvm.ptr -> i32
%35 = arith.muli %33, %34 : i32
%36 = arith.constant 200 : i32
%37 = arith.cmpi sle, %35, %36 : i32
cf.cond_br %37, ^bb1, ^bb2
^bb1:
%39 = llvm.load %32 : !llvm.ptr -> i32
%40 = arith.extsi %39 : i32 to i64
%41 = llvm.getelementptr %11[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%38 = llvm.load %41 : !llvm.ptr -> i8
%42 = arith.constant 0 : i32
%44 = arith.extsi %38 : i8 to i32
%43 = arith.cmpi ne, %44, %42 : i32
cf.cond_br %43, ^bb3, ^bb4
^bb3:
%45 = llvm.load %32 : !llvm.ptr -> i32
%46 = llvm.load %32 : !llvm.ptr -> i32
%47 = arith.muli %45, %46 : i32
%48 = llvm.mlir.constant(1 : i64) : i64
%49 = llvm.alloca %48 x i32 : (i64) -> !llvm.ptr
llvm.store %47, %49 : i32, !llvm.ptr
cf.br ^bb6
^bb6:
%50 = llvm.load %49 : !llvm.ptr -> i32
%51 = arith.constant 200 : i32
%52 = arith.cmpi sle, %50, %51 : i32
cf.cond_br %52, ^bb7, ^bb8
^bb7:
%53 = arith.constant 0 : i32
%54 = llvm.load %49 : !llvm.ptr -> i32
%55 = arith.trunci %53 : i32 to i8
%56 = arith.extsi %54 : i32 to i64
%57 = llvm.getelementptr %11[%56] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %55, %57 : i8, !llvm.ptr
%58 = llvm.load %49 : !llvm.ptr -> i32
%59 = llvm.load %32 : !llvm.ptr -> i32
%60 = arith.addi %58, %59 : i32
llvm.store %60, %49 : i32, !llvm.ptr
cf.br ^bb6
^bb8:
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
%61 = llvm.load %32 : !llvm.ptr -> i32
%62 = arith.constant 1 : i32
%63 = arith.addi %61, %62 : i32
llvm.store %63, %32 : i32, !llvm.ptr
cf.br ^bb0
^bb2:
%64 = arith.constant 0 : i32
%65 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
llvm.store %64, %65 : i32, !llvm.ptr
%66 = arith.constant 2 : i32
%67 = llvm.mlir.constant(1 : i64) : i64
%68 = llvm.alloca %67 x i32 : (i64) -> !llvm.ptr
llvm.store %66, %68 : i32, !llvm.ptr
cf.br ^bb9
^bb9:
%69 = llvm.load %68 : !llvm.ptr -> i32
%70 = arith.constant 200 : i32
%71 = arith.cmpi sle, %69, %70 : i32
cf.cond_br %71, ^bb10, ^bb11
^bb10:
%73 = llvm.load %68 : !llvm.ptr -> i32
%74 = arith.extsi %73 : i32 to i64
%75 = llvm.getelementptr %11[%74] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%72 = llvm.load %75 : !llvm.ptr -> i8
%76 = arith.constant 0 : i32
%78 = arith.extsi %72 : i8 to i32
%77 = arith.cmpi ne, %78, %76 : i32
cf.cond_br %77, ^bb12, ^bb13
^bb12:
%79 = llvm.load %68 : !llvm.ptr -> i32
%80 = llvm.mlir.addressof @g_primes : !llvm.ptr
%81 = llvm.load %80 : !llvm.ptr -> !llvm.ptr
%82 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
%83 = llvm.load %82 : !llvm.ptr -> i32
%84 = arith.extsi %83 : i32 to i64
%85 = llvm.getelementptr %81[%84] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %79, %85 : i32, !llvm.ptr
%86 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
%87 = llvm.load %86 : !llvm.ptr -> i32
%88 = arith.constant 1 : i32
%89 = arith.addi %87, %88 : i32
%90 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
llvm.store %89, %90 : i32, !llvm.ptr
cf.br ^bb14
^bb13:
cf.br ^bb14
^bb14:
%91 = llvm.load %68 : !llvm.ptr -> i32
%92 = arith.constant 1 : i32
%93 = arith.addi %91, %92 : i32
llvm.store %93, %68 : i32, !llvm.ptr
cf.br ^bb9
^bb11:
func.call @free(%11) : (!llvm.ptr) -> ()
func.return
}
func.func @ipow128(%arg0: i64, %arg1: i32) -> i128 {
%95 = arith.constant 1 : i32
%96 = arith.extsi %95 : i32 to i128
%97 = llvm.mlir.constant(1 : i64) : i64
%98 = llvm.alloca %97 x i128 : (i64) -> !llvm.ptr
llvm.store %96, %98 : i128, !llvm.ptr
%99 = arith.extsi %arg0 : i64 to i128
%100 = llvm.mlir.constant(1 : i64) : i64
%101 = llvm.alloca %100 x i128 : (i64) -> !llvm.ptr
llvm.store %99, %101 : i128, !llvm.ptr
%102 = arith.constant 999999995705032704 : i32
%103 = arith.extsi %102 : i32 to i128
%104 = arith.constant 100 : i32
%105 = arith.extsi %104 : i32 to i128
%107 = arith.trunci %103 : i128 to i64
%108 = arith.trunci %105 : i128 to i64
%106 = arith.muli %107, %108 : i64
%109 = arith.extsi %106 : i64 to i128
%110 = llvm.mlir.constant(1 : i64) : i64
%111 = llvm.alloca %110 x i32 : (i64) -> !llvm.ptr
llvm.store %arg1, %111 : i32, !llvm.ptr
cf.br ^bb15
^bb15:
%112 = llvm.load %111 : !llvm.ptr -> i32
%113 = arith.constant 0 : i32
%114 = arith.cmpi sgt, %112, %113 : i32
cf.cond_br %114, ^bb16, ^bb17
^bb16:
%115 = llvm.load %111 : !llvm.ptr -> i32
%116 = arith.constant 1 : i32
%117 = arith.andi %115, %116 : i32
%118 = arith.constant 1 : i32
%119 = arith.cmpi eq, %117, %118 : i32
cf.cond_br %119, ^bb18, ^bb19
^bb18:
%120 = llvm.load %98 : !llvm.ptr -> i128
%121 = llvm.load %101 : !llvm.ptr -> i128
%123 = arith.trunci %120 : i128 to i64
%124 = arith.trunci %121 : i128 to i64
%122 = arith.muli %123, %124 : i64
%125 = arith.extsi %122 : i64 to i128
llvm.store %125, %98 : i128, !llvm.ptr
%126 = llvm.load %98 : !llvm.ptr -> i128
%128 = arith.trunci %126 : i128 to i64
%129 = arith.trunci %109 : i128 to i64
%127 = arith.cmpi sgt, %128, %129 : i64
cf.cond_br %127, ^bb21, ^bb22
^bb21:
func.return %109 : i128
^bb22:
cf.br ^bb23
^bb23:
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
%130 = llvm.load %111 : !llvm.ptr -> i32
%131 = arith.constant 1 : i32
%132 = arith.shrsi %130, %131 : i32
llvm.store %132, %111 : i32, !llvm.ptr
%133 = llvm.load %111 : !llvm.ptr -> i32
%134 = arith.constant 0 : i32
%135 = arith.cmpi sgt, %133, %134 : i32
cf.cond_br %135, ^bb24, ^bb25
^bb24:
%136 = llvm.load %101 : !llvm.ptr -> i128
%137 = llvm.load %101 : !llvm.ptr -> i128
%139 = arith.trunci %136 : i128 to i64
%140 = arith.trunci %137 : i128 to i64
%138 = arith.muli %139, %140 : i64
%141 = arith.extsi %138 : i64 to i128
llvm.store %141, %101 : i128, !llvm.ptr
%142 = llvm.load %101 : !llvm.ptr -> i128
%144 = arith.trunci %142 : i128 to i64
%145 = arith.trunci %109 : i128 to i64
%143 = arith.cmpi sgt, %144, %145 : i64
cf.cond_br %143, ^bb27, ^bb28
^bb27:
llvm.store %109, %101 : i128, !llvm.ptr
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
cf.br ^bb15
^bb17:
%146 = llvm.load %98 : !llvm.ptr -> i128
func.return %146 : i128
}
func.func @safe_mul(%arg0: i128, %arg1: i128) -> i128 {
%147 = arith.constant 0 : i32
%149 = arith.trunci %arg0 : i128 to i64
%150 = arith.extsi %147 : i32 to i64
%148 = arith.cmpi eq, %149, %150 : i64
%151 = scf.if %148 -> (i1) {
%152 = arith.constant true
scf.yield %152 : i1
} else {
%153 = arith.constant 0 : i32
%155 = arith.trunci %arg1 : i128 to i64
%156 = arith.extsi %153 : i32 to i64
%154 = arith.cmpi eq, %155, %156 : i64
scf.yield %154 : i1
}
cf.cond_br %151, ^bb30, ^bb31
^bb30:
%157 = arith.constant 0 : i32
%158 = arith.extsi %157 : i32 to i128
func.return %158 : i128
^bb31:
cf.br ^bb32
^bb32:
%160 = arith.trunci %arg0 : i128 to i64
%161 = arith.trunci %arg1 : i128 to i64
%159 = arith.muli %160, %161 : i64
%162 = arith.extsi %159 : i64 to i128
%164 = arith.trunci %162 : i128 to i64
%165 = arith.trunci %arg0 : i128 to i64
%163 = arith.divsi %164, %165 : i64
%167 = arith.trunci %arg1 : i128 to i64
%166 = arith.cmpi ne, %163, %167 : i64
cf.cond_br %166, ^bb33, ^bb34
^bb33:
%168 = llvm.mlir.addressof @g_inf : !llvm.ptr
%169 = llvm.load %168 : !llvm.ptr -> i128
func.return %169 : i128
^bb34:
cf.br ^bb35
^bb35:
func.return %162 : i128
}
func.func @dfs_gen(%arg0: i32, %arg1: i32, %arg2: i128) -> () {
%170 = llvm.mlir.addressof @g_num_lb_primes : !llvm.ptr
%171 = llvm.load %170 : !llvm.ptr -> i32
%172 = arith.cmpi sge, %arg0, %171 : i32
cf.cond_br %172, ^bb36, ^bb37
^bb36:
func.return
^bb37:
cf.br ^bb38
^bb38:
%174 = llvm.mlir.addressof @g_lb_primes : !llvm.ptr
%175 = llvm.load %174 : !llvm.ptr -> !llvm.ptr
%176 = arith.extsi %arg0 : i32 to i64
%177 = llvm.getelementptr %175[%176] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%173 = llvm.load %177 : !llvm.ptr -> i32
%178 = arith.constant 1 : i32
%179 = arith.extsi %178 : i32 to i128
%180 = llvm.mlir.constant(1 : i64) : i64
%181 = llvm.alloca %180 x i128 : (i64) -> !llvm.ptr
llvm.store %179, %181 : i128, !llvm.ptr
%182 = arith.constant 1 : i32
%183 = llvm.mlir.constant(1 : i64) : i64
%184 = llvm.alloca %183 x i32 : (i64) -> !llvm.ptr
llvm.store %182, %184 : i32, !llvm.ptr
cf.br ^bb39
^bb39:
%185 = llvm.load %184 : !llvm.ptr -> i32
%186 = arith.cmpi sle, %185, %arg1 : i32
cf.cond_br %186, ^bb40, ^bb41
^bb40:
%187 = llvm.load %181 : !llvm.ptr -> i128
%188 = arith.extsi %173 : i32 to i128
%190 = arith.trunci %187 : i128 to i64
%191 = arith.trunci %188 : i128 to i64
%189 = arith.muli %190, %191 : i64
%192 = arith.extsi %189 : i64 to i128
llvm.store %192, %181 : i128, !llvm.ptr
%193 = llvm.load %181 : !llvm.ptr -> i128
%195 = arith.trunci %arg2 : i128 to i64
%196 = arith.trunci %193 : i128 to i64
%194 = arith.muli %195, %196 : i64
%197 = arith.extsi %194 : i64 to i128
%198 = llvm.mlir.addressof @LIMIT : !llvm.ptr
%199 = llvm.load %198 : !llvm.ptr -> i64
%200 = arith.extsi %199 : i64 to i128
%202 = arith.trunci %197 : i128 to i64
%203 = arith.trunci %200 : i128 to i64
%201 = arith.cmpi sgt, %202, %203 : i64
cf.cond_br %201, ^bb42, ^bb43
^bb42:
cf.br ^bb41
^bb43:
cf.br ^bb44
^bb44:
%204 = llvm.load %184 : !llvm.ptr -> i32
%205 = llvm.mlir.addressof @g_dfs_exps : !llvm.ptr
%206 = llvm.load %205 : !llvm.ptr -> !llvm.ptr
%207 = arith.extsi %arg0 : i32 to i64
%208 = llvm.getelementptr %206[%207] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %204, %208 : i32, !llvm.ptr
%209 = arith.constant 1 : i32
%210 = arith.addi %arg0, %209 : i32
%211 = llvm.mlir.addressof @g_vec_len : !llvm.ptr
%212 = llvm.load %211 : !llvm.ptr -> !llvm.ptr
%213 = llvm.mlir.addressof @g_num_vecs : !llvm.ptr
%214 = llvm.load %213 : !llvm.ptr -> i32
%215 = arith.extsi %214 : i32 to i64
%216 = llvm.getelementptr %212[%215] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %210, %216 : i32, !llvm.ptr
# String concatenation: !llvm.ptr + i32
%219 = llvm.mlir.addressof @g_dfs_exps : !llvm.ptr
%220 = llvm.load %219 : !llvm.ptr -> !llvm.ptr
%221 = arith.extsi %210 : i32 to i64
%222 = arith.constant 4 : i32
%224 = arith.extsi %222 : i32 to i64
%223 = arith.muli %221, %224 : i64
%217 = func.call @memcpy(%218, %220, %223) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
%225 = llvm.mlir.addressof @g_num_vecs : !llvm.ptr
%226 = llvm.load %225 : !llvm.ptr -> i32
%227 = arith.constant 1 : i32
%228 = arith.addi %226, %227 : i32
%229 = llvm.mlir.addressof @g_num_vecs : !llvm.ptr
llvm.store %228, %229 : i32, !llvm.ptr
%231 = arith.constant 1 : i32
%232 = arith.addi %arg0, %231 : i32
%233 = llvm.load %184 : !llvm.ptr -> i32
func.call @dfs_gen(%232, %233, %197) : (i32, i32, i128) -> ()
%234 = llvm.load %184 : !llvm.ptr -> i32
%235 = arith.constant 1 : i32
%236 = arith.addi %234, %235 : i32
llvm.store %236, %184 : i32, !llvm.ptr
cf.br ^bb39
^bb41:
func.return
}
func.func @factorize_small(%arg0: i32) -> () {
%237 = arith.constant 0 : i32
%238 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
llvm.store %237, %238 : i32, !llvm.ptr
%239 = llvm.mlir.constant(1 : i64) : i64
%240 = llvm.alloca %239 x i32 : (i64) -> !llvm.ptr
llvm.store %arg0, %240 : i32, !llvm.ptr
%241 = arith.constant 0 : i32
%242 = llvm.mlir.constant(1 : i64) : i64
%243 = llvm.alloca %242 x i32 : (i64) -> !llvm.ptr
llvm.store %241, %243 : i32, !llvm.ptr
cf.br ^bb45
^bb45:
%244 = llvm.load %243 : !llvm.ptr -> i32
%245 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
%246 = llvm.load %245 : !llvm.ptr -> i32
%247 = arith.cmpi slt, %244, %246 : i32
%248 = scf.if %247 -> (i1) {
%250 = llvm.mlir.addressof @g_primes : !llvm.ptr
%251 = llvm.load %250 : !llvm.ptr -> !llvm.ptr
%252 = llvm.load %243 : !llvm.ptr -> i32
%253 = arith.extsi %252 : i32 to i64
%254 = llvm.getelementptr %251[%253] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%249 = llvm.load %254 : !llvm.ptr -> i32
%256 = llvm.mlir.addressof @g_primes : !llvm.ptr
%257 = llvm.load %256 : !llvm.ptr -> !llvm.ptr
%258 = llvm.load %243 : !llvm.ptr -> i32
%259 = arith.extsi %258 : i32 to i64
%260 = llvm.getelementptr %257[%259] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%255 = llvm.load %260 : !llvm.ptr -> i32
%261 = arith.muli %249, %255 : i32
%262 = llvm.load %240 : !llvm.ptr -> i32
%263 = arith.cmpi sle, %261, %262 : i32
scf.yield %263 : i1
} else {
%264 = arith.constant false
scf.yield %264 : i1
}
cf.cond_br %248, ^bb46, ^bb47
^bb46:
%265 = llvm.load %240 : !llvm.ptr -> i32
%267 = llvm.mlir.addressof @g_primes : !llvm.ptr
%268 = llvm.load %267 : !llvm.ptr -> !llvm.ptr
%269 = llvm.load %243 : !llvm.ptr -> i32
%270 = arith.extsi %269 : i32 to i64
%271 = llvm.getelementptr %268[%270] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%266 = llvm.load %271 : !llvm.ptr -> i32
%272 = arith.remsi %265, %266 : i32
%273 = arith.constant 0 : i32
%274 = arith.cmpi eq, %272, %273 : i32
cf.cond_br %274, ^bb48, ^bb49
^bb48:
%275 = arith.constant 0 : i32
%276 = llvm.mlir.constant(1 : i64) : i64
%277 = llvm.alloca %276 x i32 : (i64) -> !llvm.ptr
llvm.store %275, %277 : i32, !llvm.ptr
cf.br ^bb51
^bb51:
%278 = llvm.load %240 : !llvm.ptr -> i32
%280 = llvm.mlir.addressof @g_primes : !llvm.ptr
%281 = llvm.load %280 : !llvm.ptr -> !llvm.ptr
%282 = llvm.load %243 : !llvm.ptr -> i32
%283 = arith.extsi %282 : i32 to i64
%284 = llvm.getelementptr %281[%283] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%279 = llvm.load %284 : !llvm.ptr -> i32
%285 = arith.remsi %278, %279 : i32
%286 = arith.constant 0 : i32
%287 = arith.cmpi eq, %285, %286 : i32
cf.cond_br %287, ^bb52, ^bb53
^bb52:
%288 = llvm.load %240 : !llvm.ptr -> i32
%290 = llvm.mlir.addressof @g_primes : !llvm.ptr
%291 = llvm.load %290 : !llvm.ptr -> !llvm.ptr
%292 = llvm.load %243 : !llvm.ptr -> i32
%293 = arith.extsi %292 : i32 to i64
%294 = llvm.getelementptr %291[%293] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%289 = llvm.load %294 : !llvm.ptr -> i32
%295 = arith.divsi %288, %289 : i32
llvm.store %295, %240 : i32, !llvm.ptr
%296 = llvm.load %277 : !llvm.ptr -> i32
%297 = arith.constant 1 : i32
%298 = arith.addi %296, %297 : i32
llvm.store %298, %277 : i32, !llvm.ptr
cf.br ^bb51
^bb53:
%300 = llvm.mlir.addressof @g_primes : !llvm.ptr
%301 = llvm.load %300 : !llvm.ptr -> !llvm.ptr
%302 = llvm.load %243 : !llvm.ptr -> i32
%303 = arith.extsi %302 : i32 to i64
%304 = llvm.getelementptr %301[%303] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%299 = llvm.load %304 : !llvm.ptr -> i32
%305 = llvm.mlir.addressof @g_fac_primes : !llvm.ptr
%306 = llvm.load %305 : !llvm.ptr -> !llvm.ptr
%307 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
%308 = llvm.load %307 : !llvm.ptr -> i32
%309 = arith.extsi %308 : i32 to i64
%310 = llvm.getelementptr %306[%309] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %299, %310 : i32, !llvm.ptr
%311 = llvm.load %277 : !llvm.ptr -> i32
%312 = llvm.mlir.addressof @g_fac_exps : !llvm.ptr
%313 = llvm.load %312 : !llvm.ptr -> !llvm.ptr
%314 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
%315 = llvm.load %314 : !llvm.ptr -> i32
%316 = arith.extsi %315 : i32 to i64
%317 = llvm.getelementptr %313[%316] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %311, %317 : i32, !llvm.ptr
%318 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
%319 = llvm.load %318 : !llvm.ptr -> i32
%320 = arith.constant 1 : i32
%321 = arith.addi %319, %320 : i32
%322 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
llvm.store %321, %322 : i32, !llvm.ptr
cf.br ^bb50
^bb49:
cf.br ^bb50
^bb50:
%323 = llvm.load %243 : !llvm.ptr -> i32
%324 = arith.constant 1 : i32
%325 = arith.addi %323, %324 : i32
llvm.store %325, %243 : i32, !llvm.ptr
cf.br ^bb45
^bb47:
%326 = llvm.load %240 : !llvm.ptr -> i32
%327 = arith.constant 1 : i32
%328 = arith.cmpi sgt, %326, %327 : i32
cf.cond_br %328, ^bb54, ^bb55
^bb54:
%329 = llvm.load %240 : !llvm.ptr -> i32
%330 = llvm.mlir.addressof @g_fac_primes : !llvm.ptr
%331 = llvm.load %330 : !llvm.ptr -> !llvm.ptr
%332 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
%333 = llvm.load %332 : !llvm.ptr -> i32
%334 = arith.extsi %333 : i32 to i64
%335 = llvm.getelementptr %331[%334] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %329, %335 : i32, !llvm.ptr
%336 = arith.constant 1 : i32
%337 = llvm.mlir.addressof @g_fac_exps : !llvm.ptr
%338 = llvm.load %337 : !llvm.ptr -> !llvm.ptr
%339 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
%340 = llvm.load %339 : !llvm.ptr -> i32
%341 = arith.extsi %340 : i32 to i64
%342 = llvm.getelementptr %338[%341] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %336, %342 : i32, !llvm.ptr
%343 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
%344 = llvm.load %343 : !llvm.ptr -> i32
%345 = arith.constant 1 : i32
%346 = arith.addi %344, %345 : i32
%347 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
llvm.store %346, %347 : i32, !llvm.ptr
cf.br ^bb56
^bb55:
cf.br ^bb56
^bb56:
func.return
}
func.func @lower_bound(%arg0: i32, %arg1: i128, %arg2: i32) -> i128 {
%349 = arith.constant 0 : i32
%350 = arith.constant 0 : i32
%351 = arith.constant 0 : i32
%352 = arith.constant 0 : i32
%353 = arith.constant 0 : i32
%354 = arith.constant 0 : i32
%355 = arith.constant 0 : i32
%356 = arith.constant 0 : i32
%357 = arith.constant 0 : i32
%358 = arith.constant 0 : i32
%359 = arith.constant 0 : i32
%360 = arith.constant 0 : i32
%361 = arith.constant 0 : i32
%362 = arith.constant 0 : i32
%363 = arith.constant 0 : i32
%364 = arith.constant 0 : i32
%365 = arith.constant 0 : i32
%366 = arith.constant 0 : i32
%367 = arith.constant 0 : i32
%368 = arith.constant 0 : i32
%369 = llvm.mlir.constant(1 : i64) : i64
%370 = llvm.alloca %369 x !llvm.array<20 x i32> : (i64) -> !llvm.ptr
%371 = llvm.mlir.zero : !llvm.array<20 x i32>
llvm.store %371, %370 : !llvm.array<20 x i32>, !llvm.ptr
%372 = llvm.mlir.constant(0 : i64) : i64
%373 = llvm.getelementptr %370[0, %372] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %349, %373 : i32, !llvm.ptr
%374 = llvm.mlir.constant(1 : i64) : i64
%375 = llvm.getelementptr %370[0, %374] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %350, %375 : i32, !llvm.ptr
%376 = llvm.mlir.constant(2 : i64) : i64
%377 = llvm.getelementptr %370[0, %376] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %351, %377 : i32, !llvm.ptr
%378 = llvm.mlir.constant(3 : i64) : i64
%379 = llvm.getelementptr %370[0, %378] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %352, %379 : i32, !llvm.ptr
%380 = llvm.mlir.constant(4 : i64) : i64
%381 = llvm.getelementptr %370[0, %380] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %353, %381 : i32, !llvm.ptr
%382 = llvm.mlir.constant(5 : i64) : i64
%383 = llvm.getelementptr %370[0, %382] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %354, %383 : i32, !llvm.ptr
%384 = llvm.mlir.constant(6 : i64) : i64
%385 = llvm.getelementptr %370[0, %384] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %355, %385 : i32, !llvm.ptr
%386 = llvm.mlir.constant(7 : i64) : i64
%387 = llvm.getelementptr %370[0, %386] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %356, %387 : i32, !llvm.ptr
%388 = llvm.mlir.constant(8 : i64) : i64
%389 = llvm.getelementptr %370[0, %388] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %357, %389 : i32, !llvm.ptr
%390 = llvm.mlir.constant(9 : i64) : i64
%391 = llvm.getelementptr %370[0, %390] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %358, %391 : i32, !llvm.ptr
%392 = llvm.mlir.constant(10 : i64) : i64
%393 = llvm.getelementptr %370[0, %392] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %359, %393 : i32, !llvm.ptr
%394 = llvm.mlir.constant(11 : i64) : i64
%395 = llvm.getelementptr %370[0, %394] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %360, %395 : i32, !llvm.ptr
%396 = llvm.mlir.constant(12 : i64) : i64
%397 = llvm.getelementptr %370[0, %396] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %361, %397 : i32, !llvm.ptr
%398 = llvm.mlir.constant(13 : i64) : i64
%399 = llvm.getelementptr %370[0, %398] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %362, %399 : i32, !llvm.ptr
%400 = llvm.mlir.constant(14 : i64) : i64
%401 = llvm.getelementptr %370[0, %400] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %363, %401 : i32, !llvm.ptr
%402 = llvm.mlir.constant(15 : i64) : i64
%403 = llvm.getelementptr %370[0, %402] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %364, %403 : i32, !llvm.ptr
%404 = llvm.mlir.constant(16 : i64) : i64
%405 = llvm.getelementptr %370[0, %404] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %365, %405 : i32, !llvm.ptr
%406 = llvm.mlir.constant(17 : i64) : i64
%407 = llvm.getelementptr %370[0, %406] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %366, %407 : i32, !llvm.ptr
%408 = llvm.mlir.constant(18 : i64) : i64
%409 = llvm.getelementptr %370[0, %408] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %367, %409 : i32, !llvm.ptr
%410 = llvm.mlir.constant(19 : i64) : i64
%411 = llvm.getelementptr %370[0, %410] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %368, %411 : i32, !llvm.ptr
%412 = arith.constant 0 : i32
%413 = llvm.mlir.constant(1 : i64) : i64
%414 = llvm.alloca %413 x i32 : (i64) -> !llvm.ptr
llvm.store %412, %414 : i32, !llvm.ptr
%415 = arith.constant 0 : i32
%416 = llvm.mlir.constant(1 : i64) : i64
%417 = llvm.alloca %416 x i32 : (i64) -> !llvm.ptr
llvm.store %415, %417 : i32, !llvm.ptr
cf.br ^bb57
^bb57:
%418 = llvm.load %417 : !llvm.ptr -> i32
%419 = llvm.mlir.addressof @g_g_r : !llvm.ptr
%420 = llvm.load %419 : !llvm.ptr -> i32
%421 = arith.cmpi slt, %418, %420 : i32
cf.cond_br %421, ^bb58, ^bb59
^bb58:
%422 = llvm.load %417 : !llvm.ptr -> i32
%423 = arith.shrsi %arg0, %422 : i32
%424 = arith.constant 1 : i32
%425 = arith.andi %423, %424 : i32
%426 = arith.constant 0 : i32
%427 = arith.cmpi eq, %425, %426 : i32
cf.cond_br %427, ^bb60, ^bb61
^bb60:
%429 = llvm.mlir.addressof @g_g_exps : !llvm.ptr
%430 = llvm.load %429 : !llvm.ptr -> !llvm.ptr
%431 = llvm.load %417 : !llvm.ptr -> i32
%432 = arith.extsi %431 : i32 to i64
%433 = llvm.getelementptr %430[%432] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%428 = llvm.load %433 : !llvm.ptr -> i32
%434 = llvm.load %414 : !llvm.ptr -> i32
%435 = arith.extsi %434 : i32 to i64
%436 = llvm.getelementptr %370[0, %435] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %428, %436 : i32, !llvm.ptr
%437 = llvm.load %414 : !llvm.ptr -> i32
%438 = arith.constant 1 : i32
%439 = arith.addi %437, %438 : i32
llvm.store %439, %414 : i32, !llvm.ptr
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
%440 = llvm.load %417 : !llvm.ptr -> i32
%441 = arith.constant 1 : i32
%442 = arith.addi %440, %441 : i32
llvm.store %442, %417 : i32, !llvm.ptr
cf.br ^bb57
^bb59:
%443 = arith.constant 0 : i32
%444 = llvm.mlir.constant(1 : i64) : i64
%445 = llvm.alloca %444 x i32 : (i64) -> !llvm.ptr
llvm.store %443, %445 : i32, !llvm.ptr
cf.br ^bb63
^bb63:
%446 = llvm.load %445 : !llvm.ptr -> i32
%447 = llvm.load %414 : !llvm.ptr -> i32
%448 = arith.cmpi slt, %446, %447 : i32
cf.cond_br %448, ^bb64, ^bb65
^bb64:
%449 = llvm.load %445 : !llvm.ptr -> i32
%450 = arith.constant 1 : i32
%451 = arith.addi %449, %450 : i32
%452 = llvm.mlir.constant(1 : i64) : i64
%453 = llvm.alloca %452 x i32 : (i64) -> !llvm.ptr
llvm.store %451, %453 : i32, !llvm.ptr
cf.br ^bb66
^bb66:
%454 = llvm.load %453 : !llvm.ptr -> i32
%455 = llvm.load %414 : !llvm.ptr -> i32
%456 = arith.cmpi slt, %454, %455 : i32
cf.cond_br %456, ^bb67, ^bb68
^bb67:
%458 = llvm.load %453 : !llvm.ptr -> i32
%459 = arith.extsi %458 : i32 to i64
%460 = llvm.getelementptr %370[0, %459] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%457 = llvm.load %460 : !llvm.ptr -> i32
%462 = llvm.load %445 : !llvm.ptr -> i32
%463 = arith.extsi %462 : i32 to i64
%464 = llvm.getelementptr %370[0, %463] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%461 = llvm.load %464 : !llvm.ptr -> i32
%465 = arith.cmpi sgt, %457, %461 : i32
cf.cond_br %465, ^bb69, ^bb70
^bb69:
%467 = llvm.load %445 : !llvm.ptr -> i32
%468 = arith.extsi %467 : i32 to i64
%469 = llvm.getelementptr %370[0, %468] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%466 = llvm.load %469 : !llvm.ptr -> i32
%471 = llvm.load %453 : !llvm.ptr -> i32
%472 = arith.extsi %471 : i32 to i64
%473 = llvm.getelementptr %370[0, %472] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%470 = llvm.load %473 : !llvm.ptr -> i32
%474 = llvm.load %445 : !llvm.ptr -> i32
%475 = arith.extsi %474 : i32 to i64
%476 = llvm.getelementptr %370[0, %475] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %470, %476 : i32, !llvm.ptr
%477 = llvm.load %453 : !llvm.ptr -> i32
%478 = arith.extsi %477 : i32 to i64
%479 = llvm.getelementptr %370[0, %478] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %466, %479 : i32, !llvm.ptr
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%480 = llvm.load %453 : !llvm.ptr -> i32
%481 = arith.constant 1 : i32
%482 = arith.addi %480, %481 : i32
llvm.store %482, %453 : i32, !llvm.ptr
cf.br ^bb66
^bb68:
%483 = llvm.load %445 : !llvm.ptr -> i32
%484 = arith.constant 1 : i32
%485 = arith.addi %483, %484 : i32
llvm.store %485, %445 : i32, !llvm.ptr
cf.br ^bb63
^bb65:
%487 = arith.constant 0 : i32
%488 = arith.constant 0 : i32
%489 = arith.constant 0 : i32
%490 = arith.constant 0 : i32
%491 = arith.constant 0 : i32
%492 = arith.constant 0 : i32
%493 = arith.constant 0 : i32
%494 = arith.constant 0 : i32
%495 = arith.constant 0 : i32
%496 = arith.constant 0 : i32
%497 = arith.constant 0 : i32
%498 = arith.constant 0 : i32
%499 = arith.constant 0 : i32
%500 = arith.constant 0 : i32
%501 = arith.constant 0 : i32
%502 = arith.constant 0 : i32
%503 = arith.constant 0 : i32
%504 = arith.constant 0 : i32
%505 = arith.constant 0 : i32
%506 = arith.constant 0 : i32
%507 = arith.constant 0 : i32
%508 = arith.constant 0 : i32
%509 = arith.constant 0 : i32
%510 = arith.constant 0 : i32
%511 = arith.constant 0 : i32
%512 = arith.constant 0 : i32
%513 = arith.constant 0 : i32
%514 = arith.constant 0 : i32
%515 = arith.constant 0 : i32
%516 = arith.constant 0 : i32
%517 = arith.constant 0 : i32
%518 = arith.constant 0 : i32
%519 = arith.constant 0 : i32
%520 = arith.constant 0 : i32
%521 = arith.constant 0 : i32
%522 = arith.constant 0 : i32
%523 = arith.constant 0 : i32
%524 = arith.constant 0 : i32
%525 = arith.constant 0 : i32
%526 = arith.constant 0 : i32
%527 = llvm.mlir.constant(1 : i64) : i64
%528 = llvm.alloca %527 x !llvm.array<40 x i64> : (i64) -> !llvm.ptr
%529 = llvm.mlir.zero : !llvm.array<40 x i64>
llvm.store %529, %528 : !llvm.array<40 x i64>, !llvm.ptr
%530 = arith.extsi %487 : i32 to i64
%531 = arith.extsi %488 : i32 to i64
%532 = arith.extsi %489 : i32 to i64
%533 = arith.extsi %490 : i32 to i64
%534 = arith.extsi %491 : i32 to i64
%535 = arith.extsi %492 : i32 to i64
%536 = arith.extsi %493 : i32 to i64
%537 = arith.extsi %494 : i32 to i64
%538 = arith.extsi %495 : i32 to i64
%539 = arith.extsi %496 : i32 to i64
%540 = arith.extsi %497 : i32 to i64
%541 = arith.extsi %498 : i32 to i64
%542 = arith.extsi %499 : i32 to i64
%543 = arith.extsi %500 : i32 to i64
%544 = arith.extsi %501 : i32 to i64
%545 = arith.extsi %502 : i32 to i64
%546 = arith.extsi %503 : i32 to i64
%547 = arith.extsi %504 : i32 to i64
%548 = arith.extsi %505 : i32 to i64
%549 = arith.extsi %506 : i32 to i64
%550 = arith.extsi %507 : i32 to i64
%551 = arith.extsi %508 : i32 to i64
%552 = arith.extsi %509 : i32 to i64
%553 = arith.extsi %510 : i32 to i64
%554 = arith.extsi %511 : i32 to i64
%555 = arith.extsi %512 : i32 to i64
%556 = arith.extsi %513 : i32 to i64
%557 = arith.extsi %514 : i32 to i64
%558 = arith.extsi %515 : i32 to i64
%559 = arith.extsi %516 : i32 to i64
%560 = arith.extsi %517 : i32 to i64
%561 = arith.extsi %518 : i32 to i64
%562 = arith.extsi %519 : i32 to i64
%563 = arith.extsi %520 : i32 to i64
%564 = arith.extsi %521 : i32 to i64
%565 = arith.extsi %522 : i32 to i64
%566 = arith.extsi %523 : i32 to i64
%567 = arith.extsi %524 : i32 to i64
%568 = arith.extsi %525 : i32 to i64
%569 = arith.extsi %526 : i32 to i64
%570 = llvm.mlir.constant(0 : i64) : i64
%571 = llvm.getelementptr %528[0, %570] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %530, %571 : i64, !llvm.ptr
%572 = llvm.mlir.constant(1 : i64) : i64
%573 = llvm.getelementptr %528[0, %572] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %531, %573 : i64, !llvm.ptr
%574 = llvm.mlir.constant(2 : i64) : i64
%575 = llvm.getelementptr %528[0, %574] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %532, %575 : i64, !llvm.ptr
%576 = llvm.mlir.constant(3 : i64) : i64
%577 = llvm.getelementptr %528[0, %576] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %533, %577 : i64, !llvm.ptr
%578 = llvm.mlir.constant(4 : i64) : i64
%579 = llvm.getelementptr %528[0, %578] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %534, %579 : i64, !llvm.ptr
%580 = llvm.mlir.constant(5 : i64) : i64
%581 = llvm.getelementptr %528[0, %580] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %535, %581 : i64, !llvm.ptr
%582 = llvm.mlir.constant(6 : i64) : i64
%583 = llvm.getelementptr %528[0, %582] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %536, %583 : i64, !llvm.ptr
%584 = llvm.mlir.constant(7 : i64) : i64
%585 = llvm.getelementptr %528[0, %584] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %537, %585 : i64, !llvm.ptr
%586 = llvm.mlir.constant(8 : i64) : i64
%587 = llvm.getelementptr %528[0, %586] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %538, %587 : i64, !llvm.ptr
%588 = llvm.mlir.constant(9 : i64) : i64
%589 = llvm.getelementptr %528[0, %588] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %539, %589 : i64, !llvm.ptr
%590 = llvm.mlir.constant(10 : i64) : i64
%591 = llvm.getelementptr %528[0, %590] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %540, %591 : i64, !llvm.ptr
%592 = llvm.mlir.constant(11 : i64) : i64
%593 = llvm.getelementptr %528[0, %592] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %541, %593 : i64, !llvm.ptr
%594 = llvm.mlir.constant(12 : i64) : i64
%595 = llvm.getelementptr %528[0, %594] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %542, %595 : i64, !llvm.ptr
%596 = llvm.mlir.constant(13 : i64) : i64
%597 = llvm.getelementptr %528[0, %596] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %543, %597 : i64, !llvm.ptr
%598 = llvm.mlir.constant(14 : i64) : i64
%599 = llvm.getelementptr %528[0, %598] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %544, %599 : i64, !llvm.ptr
%600 = llvm.mlir.constant(15 : i64) : i64
%601 = llvm.getelementptr %528[0, %600] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %545, %601 : i64, !llvm.ptr
%602 = llvm.mlir.constant(16 : i64) : i64
%603 = llvm.getelementptr %528[0, %602] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %546, %603 : i64, !llvm.ptr
%604 = llvm.mlir.constant(17 : i64) : i64
%605 = llvm.getelementptr %528[0, %604] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %547, %605 : i64, !llvm.ptr
%606 = llvm.mlir.constant(18 : i64) : i64
%607 = llvm.getelementptr %528[0, %606] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %548, %607 : i64, !llvm.ptr
%608 = llvm.mlir.constant(19 : i64) : i64
%609 = llvm.getelementptr %528[0, %608] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %549, %609 : i64, !llvm.ptr
%610 = llvm.mlir.constant(20 : i64) : i64
%611 = llvm.getelementptr %528[0, %610] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %550, %611 : i64, !llvm.ptr
%612 = llvm.mlir.constant(21 : i64) : i64
%613 = llvm.getelementptr %528[0, %612] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %551, %613 : i64, !llvm.ptr
%614 = llvm.mlir.constant(22 : i64) : i64
%615 = llvm.getelementptr %528[0, %614] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %552, %615 : i64, !llvm.ptr
%616 = llvm.mlir.constant(23 : i64) : i64
%617 = llvm.getelementptr %528[0, %616] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %553, %617 : i64, !llvm.ptr
%618 = llvm.mlir.constant(24 : i64) : i64
%619 = llvm.getelementptr %528[0, %618] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %554, %619 : i64, !llvm.ptr
%620 = llvm.mlir.constant(25 : i64) : i64
%621 = llvm.getelementptr %528[0, %620] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %555, %621 : i64, !llvm.ptr
%622 = llvm.mlir.constant(26 : i64) : i64
%623 = llvm.getelementptr %528[0, %622] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %556, %623 : i64, !llvm.ptr
%624 = llvm.mlir.constant(27 : i64) : i64
%625 = llvm.getelementptr %528[0, %624] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %557, %625 : i64, !llvm.ptr
%626 = llvm.mlir.constant(28 : i64) : i64
%627 = llvm.getelementptr %528[0, %626] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %558, %627 : i64, !llvm.ptr
%628 = llvm.mlir.constant(29 : i64) : i64
%629 = llvm.getelementptr %528[0, %628] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %559, %629 : i64, !llvm.ptr
%630 = llvm.mlir.constant(30 : i64) : i64
%631 = llvm.getelementptr %528[0, %630] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %560, %631 : i64, !llvm.ptr
%632 = llvm.mlir.constant(31 : i64) : i64
%633 = llvm.getelementptr %528[0, %632] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %561, %633 : i64, !llvm.ptr
%634 = llvm.mlir.constant(32 : i64) : i64
%635 = llvm.getelementptr %528[0, %634] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %562, %635 : i64, !llvm.ptr
%636 = llvm.mlir.constant(33 : i64) : i64
%637 = llvm.getelementptr %528[0, %636] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %563, %637 : i64, !llvm.ptr
%638 = llvm.mlir.constant(34 : i64) : i64
%639 = llvm.getelementptr %528[0, %638] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %564, %639 : i64, !llvm.ptr
%640 = llvm.mlir.constant(35 : i64) : i64
%641 = llvm.getelementptr %528[0, %640] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %565, %641 : i64, !llvm.ptr
%642 = llvm.mlir.constant(36 : i64) : i64
%643 = llvm.getelementptr %528[0, %642] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %566, %643 : i64, !llvm.ptr
%644 = llvm.mlir.constant(37 : i64) : i64
%645 = llvm.getelementptr %528[0, %644] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %567, %645 : i64, !llvm.ptr
%646 = llvm.mlir.constant(38 : i64) : i64
%647 = llvm.getelementptr %528[0, %646] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %568, %647 : i64, !llvm.ptr
%648 = llvm.mlir.constant(39 : i64) : i64
%649 = llvm.getelementptr %528[0, %648] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %569, %649 : i64, !llvm.ptr
%650 = arith.constant 0 : i32
%651 = llvm.mlir.constant(1 : i64) : i64
%652 = llvm.alloca %651 x i32 : (i64) -> !llvm.ptr
llvm.store %650, %652 : i32, !llvm.ptr
%653 = arith.constant 0 : i32
%654 = llvm.mlir.constant(1 : i64) : i64
%655 = llvm.alloca %654 x i32 : (i64) -> !llvm.ptr
llvm.store %653, %655 : i32, !llvm.ptr
cf.br ^bb72
^bb72:
%656 = llvm.load %655 : !llvm.ptr -> i32
%657 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
%658 = llvm.load %657 : !llvm.ptr -> i32
%659 = arith.cmpi slt, %656, %658 : i32
cf.cond_br %659, ^bb73, ^bb74
^bb73:
%661 = llvm.mlir.addressof @g_g_fillers : !llvm.ptr
%662 = llvm.load %661 : !llvm.ptr -> !llvm.ptr
%663 = llvm.load %655 : !llvm.ptr -> i32
%664 = arith.extsi %663 : i32 to i64
%665 = llvm.getelementptr %662[%664] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%660 = llvm.load %665 : !llvm.ptr -> i64
%666 = llvm.load %652 : !llvm.ptr -> i32
%667 = arith.extsi %666 : i32 to i64
%668 = llvm.getelementptr %528[0, %667] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %660, %668 : i64, !llvm.ptr
%669 = llvm.load %652 : !llvm.ptr -> i32
%670 = arith.constant 1 : i32
%671 = arith.addi %669, %670 : i32
llvm.store %671, %652 : i32, !llvm.ptr
%672 = llvm.load %655 : !llvm.ptr -> i32
%673 = arith.constant 1 : i32
%674 = arith.addi %672, %673 : i32
llvm.store %674, %655 : i32, !llvm.ptr
cf.br ^bb72
^bb74:
%675 = llvm.mlir.constant(1 : i64) : i64
%676 = llvm.alloca %675 x i32 : (i64) -> !llvm.ptr
llvm.store %arg2, %676 : i32, !llvm.ptr
cf.br ^bb75
^bb75:
%677 = llvm.load %676 : !llvm.ptr -> i32
%678 = llvm.mlir.addressof @g_g_s : !llvm.ptr
%679 = llvm.load %678 : !llvm.ptr -> i32
%680 = arith.cmpi slt, %677, %679 : i32
cf.cond_br %680, ^bb76, ^bb77
^bb76:
%682 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%683 = llvm.load %682 : !llvm.ptr -> !llvm.ptr
%684 = llvm.load %676 : !llvm.ptr -> i32
%685 = arith.extsi %684 : i32 to i64
%686 = llvm.getelementptr %683[%685] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%681 = llvm.load %686 : !llvm.ptr -> i64
%687 = llvm.load %652 : !llvm.ptr -> i32
%688 = arith.extsi %687 : i32 to i64
%689 = llvm.getelementptr %528[0, %688] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %681, %689 : i64, !llvm.ptr
%690 = llvm.load %652 : !llvm.ptr -> i32
%691 = arith.constant 1 : i32
%692 = arith.addi %690, %691 : i32
llvm.store %692, %652 : i32, !llvm.ptr
%693 = llvm.load %676 : !llvm.ptr -> i32
%694 = arith.constant 1 : i32
%695 = arith.addi %693, %694 : i32
llvm.store %695, %676 : i32, !llvm.ptr
cf.br ^bb75
^bb77:
%696 = arith.constant 0 : i32
%697 = llvm.mlir.constant(1 : i64) : i64
%698 = llvm.alloca %697 x i32 : (i64) -> !llvm.ptr
llvm.store %696, %698 : i32, !llvm.ptr
cf.br ^bb78
^bb78:
%699 = llvm.load %698 : !llvm.ptr -> i32
%700 = llvm.load %652 : !llvm.ptr -> i32
%701 = arith.cmpi slt, %699, %700 : i32
cf.cond_br %701, ^bb79, ^bb80
^bb79:
%702 = llvm.load %698 : !llvm.ptr -> i32
%703 = arith.constant 1 : i32
%704 = arith.addi %702, %703 : i32
%705 = llvm.mlir.constant(1 : i64) : i64
%706 = llvm.alloca %705 x i32 : (i64) -> !llvm.ptr
llvm.store %704, %706 : i32, !llvm.ptr
cf.br ^bb81
^bb81:
%707 = llvm.load %706 : !llvm.ptr -> i32
%708 = llvm.load %652 : !llvm.ptr -> i32
%709 = arith.cmpi slt, %707, %708 : i32
cf.cond_br %709, ^bb82, ^bb83
^bb82:
%711 = llvm.load %706 : !llvm.ptr -> i32
%712 = arith.extsi %711 : i32 to i64
%713 = llvm.getelementptr %528[0, %712] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
%710 = llvm.load %713 : !llvm.ptr -> i64
%715 = llvm.load %698 : !llvm.ptr -> i32
%716 = arith.extsi %715 : i32 to i64
%717 = llvm.getelementptr %528[0, %716] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
%714 = llvm.load %717 : !llvm.ptr -> i64
%718 = arith.cmpi slt, %710, %714 : i64
cf.cond_br %718, ^bb84, ^bb85
^bb84:
%720 = llvm.load %698 : !llvm.ptr -> i32
%721 = arith.extsi %720 : i32 to i64
%722 = llvm.getelementptr %528[0, %721] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
%719 = llvm.load %722 : !llvm.ptr -> i64
%724 = llvm.load %706 : !llvm.ptr -> i32
%725 = arith.extsi %724 : i32 to i64
%726 = llvm.getelementptr %528[0, %725] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
%723 = llvm.load %726 : !llvm.ptr -> i64
%727 = llvm.load %698 : !llvm.ptr -> i32
%728 = arith.extsi %727 : i32 to i64
%729 = llvm.getelementptr %528[0, %728] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %723, %729 : i64, !llvm.ptr
%730 = llvm.load %706 : !llvm.ptr -> i32
%731 = arith.extsi %730 : i32 to i64
%732 = llvm.getelementptr %528[0, %731] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
llvm.store %719, %732 : i64, !llvm.ptr
cf.br ^bb86
^bb85:
cf.br ^bb86
^bb86:
%733 = llvm.load %706 : !llvm.ptr -> i32
%734 = arith.constant 1 : i32
%735 = arith.addi %733, %734 : i32
llvm.store %735, %706 : i32, !llvm.ptr
cf.br ^bb81
^bb83:
%736 = llvm.load %698 : !llvm.ptr -> i32
%737 = arith.constant 1 : i32
%738 = arith.addi %736, %737 : i32
llvm.store %738, %698 : i32, !llvm.ptr
cf.br ^bb78
^bb80:
%739 = llvm.mlir.constant(1 : i64) : i64
%740 = llvm.alloca %739 x i128 : (i64) -> !llvm.ptr
llvm.store %arg1, %740 : i128, !llvm.ptr
%741 = llvm.load %414 : !llvm.ptr -> i32
%742 = llvm.load %652 : !llvm.ptr -> i32
%743 = arith.cmpi slt, %741, %742 : i32
%744 = scf.if %743 -> (i32) {
%745 = llvm.load %414 : !llvm.ptr -> i32
scf.yield %745 : i32
} else {
%746 = llvm.load %652 : !llvm.ptr -> i32
scf.yield %746 : i32
}
%747 = arith.constant 0 : i32
%748 = llvm.mlir.constant(1 : i64) : i64
%749 = llvm.alloca %748 x i32 : (i64) -> !llvm.ptr
llvm.store %747, %749 : i32, !llvm.ptr
cf.br ^bb87
^bb87:
%750 = llvm.load %749 : !llvm.ptr -> i32
%751 = arith.cmpi slt, %750, %744 : i32
cf.cond_br %751, ^bb88, ^bb89
^bb88:
%754 = llvm.load %749 : !llvm.ptr -> i32
%755 = arith.extsi %754 : i32 to i64
%756 = llvm.getelementptr %528[0, %755] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i64>
%753 = llvm.load %756 : !llvm.ptr -> i64
%758 = llvm.load %749 : !llvm.ptr -> i32
%759 = arith.extsi %758 : i32 to i64
%760 = llvm.getelementptr %370[0, %759] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%757 = llvm.load %760 : !llvm.ptr -> i32
%752 = func.call @ipow128(%753, %757) : (i64, i32) -> i128
%762 = llvm.load %740 : !llvm.ptr -> i128
%761 = func.call @safe_mul(%762, %752) : (i128, i128) -> i128
llvm.store %761, %740 : i128, !llvm.ptr
%763 = llvm.load %740 : !llvm.ptr -> i128
%764 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%765 = llvm.load %764 : !llvm.ptr -> i128
%767 = arith.trunci %763 : i128 to i64
%768 = arith.trunci %765 : i128 to i64
%766 = arith.cmpi sge, %767, %768 : i64
%769 = scf.if %766 -> (i1) {
%770 = arith.constant true
scf.yield %770 : i1
} else {
%771 = llvm.load %740 : !llvm.ptr -> i128
%772 = llvm.mlir.addressof @g_inf : !llvm.ptr
%773 = llvm.load %772 : !llvm.ptr -> i128
%775 = arith.trunci %771 : i128 to i64
%776 = arith.trunci %773 : i128 to i64
%774 = arith.cmpi sge, %775, %776 : i64
scf.yield %774 : i1
}
cf.cond_br %769, ^bb90, ^bb91
^bb90:
cf.br ^bb89
^bb91:
cf.br ^bb92
^bb92:
%777 = llvm.load %749 : !llvm.ptr -> i32
%778 = arith.constant 1 : i32
%779 = arith.addi %777, %778 : i32
llvm.store %779, %749 : i32, !llvm.ptr
cf.br ^bb87
^bb89:
%780 = llvm.load %740 : !llvm.ptr -> i128
func.return %780 : i128
}
func.func @dfs_assign(%arg0: i32, %arg1: i32, %arg2: i128) -> () {
%781 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%782 = llvm.load %781 : !llvm.ptr -> i128
%784 = arith.trunci %arg2 : i128 to i64
%785 = arith.trunci %782 : i128 to i64
%783 = arith.cmpi sge, %784, %785 : i64
cf.cond_br %783, ^bb93, ^bb94
^bb93:
func.return
^bb94:
cf.br ^bb95
^bb95:
%786 = llvm.mlir.addressof @g_g_s : !llvm.ptr
%787 = llvm.load %786 : !llvm.ptr -> i32
%788 = arith.cmpi eq, %arg0, %787 : i32
cf.cond_br %788, ^bb96, ^bb97
^bb96:
%790 = arith.constant 0 : i32
%791 = arith.constant 0 : i32
%792 = arith.constant 0 : i32
%793 = arith.constant 0 : i32
%794 = arith.constant 0 : i32
%795 = arith.constant 0 : i32
%796 = arith.constant 0 : i32
%797 = arith.constant 0 : i32
%798 = arith.constant 0 : i32
%799 = arith.constant 0 : i32
%800 = arith.constant 0 : i32
%801 = arith.constant 0 : i32
%802 = arith.constant 0 : i32
%803 = arith.constant 0 : i32
%804 = arith.constant 0 : i32
%805 = arith.constant 0 : i32
%806 = arith.constant 0 : i32
%807 = arith.constant 0 : i32
%808 = arith.constant 0 : i32
%809 = arith.constant 0 : i32
%810 = llvm.mlir.constant(1 : i64) : i64
%811 = llvm.alloca %810 x !llvm.array<20 x i32> : (i64) -> !llvm.ptr
%812 = llvm.mlir.zero : !llvm.array<20 x i32>
llvm.store %812, %811 : !llvm.array<20 x i32>, !llvm.ptr
%813 = llvm.mlir.constant(0 : i64) : i64
%814 = llvm.getelementptr %811[0, %813] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %790, %814 : i32, !llvm.ptr
%815 = llvm.mlir.constant(1 : i64) : i64
%816 = llvm.getelementptr %811[0, %815] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %791, %816 : i32, !llvm.ptr
%817 = llvm.mlir.constant(2 : i64) : i64
%818 = llvm.getelementptr %811[0, %817] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %792, %818 : i32, !llvm.ptr
%819 = llvm.mlir.constant(3 : i64) : i64
%820 = llvm.getelementptr %811[0, %819] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %793, %820 : i32, !llvm.ptr
%821 = llvm.mlir.constant(4 : i64) : i64
%822 = llvm.getelementptr %811[0, %821] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %794, %822 : i32, !llvm.ptr
%823 = llvm.mlir.constant(5 : i64) : i64
%824 = llvm.getelementptr %811[0, %823] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %795, %824 : i32, !llvm.ptr
%825 = llvm.mlir.constant(6 : i64) : i64
%826 = llvm.getelementptr %811[0, %825] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %796, %826 : i32, !llvm.ptr
%827 = llvm.mlir.constant(7 : i64) : i64
%828 = llvm.getelementptr %811[0, %827] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %797, %828 : i32, !llvm.ptr
%829 = llvm.mlir.constant(8 : i64) : i64
%830 = llvm.getelementptr %811[0, %829] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %798, %830 : i32, !llvm.ptr
%831 = llvm.mlir.constant(9 : i64) : i64
%832 = llvm.getelementptr %811[0, %831] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %799, %832 : i32, !llvm.ptr
%833 = llvm.mlir.constant(10 : i64) : i64
%834 = llvm.getelementptr %811[0, %833] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %800, %834 : i32, !llvm.ptr
%835 = llvm.mlir.constant(11 : i64) : i64
%836 = llvm.getelementptr %811[0, %835] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %801, %836 : i32, !llvm.ptr
%837 = llvm.mlir.constant(12 : i64) : i64
%838 = llvm.getelementptr %811[0, %837] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %802, %838 : i32, !llvm.ptr
%839 = llvm.mlir.constant(13 : i64) : i64
%840 = llvm.getelementptr %811[0, %839] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %803, %840 : i32, !llvm.ptr
%841 = llvm.mlir.constant(14 : i64) : i64
%842 = llvm.getelementptr %811[0, %841] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %804, %842 : i32, !llvm.ptr
%843 = llvm.mlir.constant(15 : i64) : i64
%844 = llvm.getelementptr %811[0, %843] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %805, %844 : i32, !llvm.ptr
%845 = llvm.mlir.constant(16 : i64) : i64
%846 = llvm.getelementptr %811[0, %845] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %806, %846 : i32, !llvm.ptr
%847 = llvm.mlir.constant(17 : i64) : i64
%848 = llvm.getelementptr %811[0, %847] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %807, %848 : i32, !llvm.ptr
%849 = llvm.mlir.constant(18 : i64) : i64
%850 = llvm.getelementptr %811[0, %849] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %808, %850 : i32, !llvm.ptr
%851 = llvm.mlir.constant(19 : i64) : i64
%852 = llvm.getelementptr %811[0, %851] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %809, %852 : i32, !llvm.ptr
%853 = arith.constant 0 : i32
%854 = llvm.mlir.constant(1 : i64) : i64
%855 = llvm.alloca %854 x i32 : (i64) -> !llvm.ptr
llvm.store %853, %855 : i32, !llvm.ptr
%856 = arith.constant 0 : i32
%857 = llvm.mlir.constant(1 : i64) : i64
%858 = llvm.alloca %857 x i32 : (i64) -> !llvm.ptr
llvm.store %856, %858 : i32, !llvm.ptr
cf.br ^bb99
^bb99:
%859 = llvm.load %858 : !llvm.ptr -> i32
%860 = llvm.mlir.addressof @g_g_r : !llvm.ptr
%861 = llvm.load %860 : !llvm.ptr -> i32
%862 = arith.cmpi slt, %859, %861 : i32
cf.cond_br %862, ^bb100, ^bb101
^bb100:
%863 = llvm.load %858 : !llvm.ptr -> i32
%864 = arith.shrsi %arg1, %863 : i32
%865 = arith.constant 1 : i32
%866 = arith.andi %864, %865 : i32
%867 = arith.constant 0 : i32
%868 = arith.cmpi eq, %866, %867 : i32
cf.cond_br %868, ^bb102, ^bb103
^bb102:
%870 = llvm.mlir.addressof @g_g_exps : !llvm.ptr
%871 = llvm.load %870 : !llvm.ptr -> !llvm.ptr
%872 = llvm.load %858 : !llvm.ptr -> i32
%873 = arith.extsi %872 : i32 to i64
%874 = llvm.getelementptr %871[%873] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%869 = llvm.load %874 : !llvm.ptr -> i32
%875 = llvm.load %855 : !llvm.ptr -> i32
%876 = arith.extsi %875 : i32 to i64
%877 = llvm.getelementptr %811[0, %876] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %869, %877 : i32, !llvm.ptr
%878 = llvm.load %855 : !llvm.ptr -> i32
%879 = arith.constant 1 : i32
%880 = arith.addi %878, %879 : i32
llvm.store %880, %855 : i32, !llvm.ptr
cf.br ^bb104
^bb103:
cf.br ^bb104
^bb104:
%881 = llvm.load %858 : !llvm.ptr -> i32
%882 = arith.constant 1 : i32
%883 = arith.addi %881, %882 : i32
llvm.store %883, %858 : i32, !llvm.ptr
cf.br ^bb99
^bb101:
%884 = arith.constant 0 : i32
%885 = llvm.mlir.constant(1 : i64) : i64
%886 = llvm.alloca %885 x i32 : (i64) -> !llvm.ptr
llvm.store %884, %886 : i32, !llvm.ptr
cf.br ^bb105
^bb105:
%887 = llvm.load %886 : !llvm.ptr -> i32
%888 = llvm.load %855 : !llvm.ptr -> i32
%889 = arith.cmpi slt, %887, %888 : i32
cf.cond_br %889, ^bb106, ^bb107
^bb106:
%890 = llvm.load %886 : !llvm.ptr -> i32
%891 = arith.constant 1 : i32
%892 = arith.addi %890, %891 : i32
%893 = llvm.mlir.constant(1 : i64) : i64
%894 = llvm.alloca %893 x i32 : (i64) -> !llvm.ptr
llvm.store %892, %894 : i32, !llvm.ptr
cf.br ^bb108
^bb108:
%895 = llvm.load %894 : !llvm.ptr -> i32
%896 = llvm.load %855 : !llvm.ptr -> i32
%897 = arith.cmpi slt, %895, %896 : i32
cf.cond_br %897, ^bb109, ^bb110
^bb109:
%899 = llvm.load %894 : !llvm.ptr -> i32
%900 = arith.extsi %899 : i32 to i64
%901 = llvm.getelementptr %811[0, %900] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%898 = llvm.load %901 : !llvm.ptr -> i32
%903 = llvm.load %886 : !llvm.ptr -> i32
%904 = arith.extsi %903 : i32 to i64
%905 = llvm.getelementptr %811[0, %904] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%902 = llvm.load %905 : !llvm.ptr -> i32
%906 = arith.cmpi sgt, %898, %902 : i32
cf.cond_br %906, ^bb111, ^bb112
^bb111:
%908 = llvm.load %886 : !llvm.ptr -> i32
%909 = arith.extsi %908 : i32 to i64
%910 = llvm.getelementptr %811[0, %909] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%907 = llvm.load %910 : !llvm.ptr -> i32
%912 = llvm.load %894 : !llvm.ptr -> i32
%913 = arith.extsi %912 : i32 to i64
%914 = llvm.getelementptr %811[0, %913] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%911 = llvm.load %914 : !llvm.ptr -> i32
%915 = llvm.load %886 : !llvm.ptr -> i32
%916 = arith.extsi %915 : i32 to i64
%917 = llvm.getelementptr %811[0, %916] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %911, %917 : i32, !llvm.ptr
%918 = llvm.load %894 : !llvm.ptr -> i32
%919 = arith.extsi %918 : i32 to i64
%920 = llvm.getelementptr %811[0, %919] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %907, %920 : i32, !llvm.ptr
cf.br ^bb113
^bb112:
cf.br ^bb113
^bb113:
%921 = llvm.load %894 : !llvm.ptr -> i32
%922 = arith.constant 1 : i32
%923 = arith.addi %921, %922 : i32
llvm.store %923, %894 : i32, !llvm.ptr
cf.br ^bb108
^bb110:
%924 = llvm.load %886 : !llvm.ptr -> i32
%925 = arith.constant 1 : i32
%926 = arith.addi %924, %925 : i32
llvm.store %926, %886 : i32, !llvm.ptr
cf.br ^bb105
^bb107:
%927 = llvm.mlir.constant(1 : i64) : i64
%928 = llvm.alloca %927 x i128 : (i64) -> !llvm.ptr
llvm.store %arg2, %928 : i128, !llvm.ptr
%929 = arith.constant 0 : i32
%930 = llvm.mlir.constant(1 : i64) : i64
%931 = llvm.alloca %930 x i32 : (i64) -> !llvm.ptr
llvm.store %929, %931 : i32, !llvm.ptr
cf.br ^bb114
^bb114:
%932 = llvm.load %931 : !llvm.ptr -> i32
%933 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
%934 = llvm.load %933 : !llvm.ptr -> i32
%935 = arith.cmpi slt, %932, %934 : i32
%936 = scf.if %935 -> (i1) {
%937 = llvm.load %931 : !llvm.ptr -> i32
%938 = llvm.load %855 : !llvm.ptr -> i32
%939 = arith.cmpi slt, %937, %938 : i32
scf.yield %939 : i1
} else {
%940 = arith.constant false
scf.yield %940 : i1
}
cf.cond_br %936, ^bb115, ^bb116
^bb115:
%942 = llvm.load %928 : !llvm.ptr -> i128
%945 = llvm.mlir.addressof @g_g_fillers : !llvm.ptr
%946 = llvm.load %945 : !llvm.ptr -> !llvm.ptr
%947 = llvm.load %931 : !llvm.ptr -> i32
%948 = arith.extsi %947 : i32 to i64
%949 = llvm.getelementptr %946[%948] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%944 = llvm.load %949 : !llvm.ptr -> i64
%951 = llvm.load %931 : !llvm.ptr -> i32
%952 = arith.extsi %951 : i32 to i64
%953 = llvm.getelementptr %811[0, %952] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%950 = llvm.load %953 : !llvm.ptr -> i32
%943 = func.call @ipow128(%944, %950) : (i64, i32) -> i128
%941 = func.call @safe_mul(%942, %943) : (i128, i128) -> i128
llvm.store %941, %928 : i128, !llvm.ptr
%954 = llvm.load %928 : !llvm.ptr -> i128
%955 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%956 = llvm.load %955 : !llvm.ptr -> i128
%958 = arith.trunci %954 : i128 to i64
%959 = arith.trunci %956 : i128 to i64
%957 = arith.cmpi sge, %958, %959 : i64
cf.cond_br %957, ^bb117, ^bb118
^bb117:
func.return
^bb118:
cf.br ^bb119
^bb119:
%960 = llvm.load %931 : !llvm.ptr -> i32
%961 = arith.constant 1 : i32
%962 = arith.addi %960, %961 : i32
llvm.store %962, %931 : i32, !llvm.ptr
cf.br ^bb114
^bb116:
%963 = llvm.load %928 : !llvm.ptr -> i128
%964 = llvm.mlir.addressof @g_g_limit : !llvm.ptr
%965 = llvm.load %964 : !llvm.ptr -> i128
%967 = arith.trunci %963 : i128 to i64
%968 = arith.trunci %965 : i128 to i64
%966 = arith.cmpi sle, %967, %968 : i64
%969 = scf.if %966 -> (i1) {
%970 = llvm.load %928 : !llvm.ptr -> i128
%971 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%972 = llvm.load %971 : !llvm.ptr -> i128
%974 = arith.trunci %970 : i128 to i64
%975 = arith.trunci %972 : i128 to i64
%973 = arith.cmpi slt, %974, %975 : i64
scf.yield %973 : i1
} else {
%976 = arith.constant false
scf.yield %976 : i1
}
cf.cond_br %969, ^bb120, ^bb121
^bb120:
%977 = llvm.load %928 : !llvm.ptr -> i128
%978 = llvm.mlir.addressof @g_g_best : !llvm.ptr
llvm.store %977, %978 : i128, !llvm.ptr
cf.br ^bb122
^bb121:
cf.br ^bb122
^bb122:
func.return
^bb97:
cf.br ^bb98
^bb98:
%979 = func.call @lower_bound(%arg1, %arg2, %arg0) : (i32, i128, i32) -> i128
%980 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%981 = llvm.load %980 : !llvm.ptr -> i128
%983 = arith.trunci %979 : i128 to i64
%984 = arith.trunci %981 : i128 to i64
%982 = arith.cmpi sge, %983, %984 : i64
cf.cond_br %982, ^bb123, ^bb124
^bb123:
func.return
^bb124:
cf.br ^bb125
^bb125:
%986 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%987 = llvm.load %986 : !llvm.ptr -> !llvm.ptr
%988 = arith.extsi %arg0 : i32 to i64
%989 = llvm.getelementptr %987[%988] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%985 = llvm.load %989 : !llvm.ptr -> i64
%991 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
%992 = llvm.load %991 : !llvm.ptr -> !llvm.ptr
%993 = arith.extsi %arg0 : i32 to i64
%994 = llvm.getelementptr %992[%993] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%990 = llvm.load %994 : !llvm.ptr -> i32
%995 = arith.constant 1 : i32
%997 = arith.constant 0 : i32
%996 = arith.subi %997, %995 : i32
%998 = llvm.mlir.constant(1 : i64) : i64
%999 = llvm.alloca %998 x i32 : (i64) -> !llvm.ptr
llvm.store %996, %999 : i32, !llvm.ptr
%1000 = arith.constant 0 : i32
%1001 = llvm.mlir.constant(1 : i64) : i64
%1002 = llvm.alloca %1001 x i32 : (i64) -> !llvm.ptr
llvm.store %1000, %1002 : i32, !llvm.ptr
cf.br ^bb126
^bb126:
%1003 = llvm.load %1002 : !llvm.ptr -> i32
%1004 = llvm.mlir.addressof @g_g_r : !llvm.ptr
%1005 = llvm.load %1004 : !llvm.ptr -> i32
%1006 = arith.cmpi slt, %1003, %1005 : i32
cf.cond_br %1006, ^bb127, ^bb128
^bb127:
%1007 = llvm.load %1002 : !llvm.ptr -> i32
%1008 = arith.shrsi %arg1, %1007 : i32
%1009 = arith.constant 1 : i32
%1010 = arith.andi %1008, %1009 : i32
%1011 = arith.constant 0 : i32
%1012 = arith.cmpi ne, %1010, %1011 : i32
cf.cond_br %1012, ^bb129, ^bb130
^bb129:
%1013 = llvm.load %1002 : !llvm.ptr -> i32
%1014 = arith.constant 1 : i32
%1015 = arith.addi %1013, %1014 : i32
llvm.store %1015, %1002 : i32, !llvm.ptr
cf.br ^bb126
^bb130:
cf.br ^bb131
^bb131:
%1017 = llvm.mlir.addressof @g_g_exps : !llvm.ptr
%1018 = llvm.load %1017 : !llvm.ptr -> !llvm.ptr
%1019 = llvm.load %1002 : !llvm.ptr -> i32
%1020 = arith.extsi %1019 : i32 to i64
%1021 = llvm.getelementptr %1018[%1020] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1016 = llvm.load %1021 : !llvm.ptr -> i32
%1022 = arith.cmpi slt, %1016, %990 : i32
cf.cond_br %1022, ^bb132, ^bb133
^bb132:
%1023 = llvm.load %1002 : !llvm.ptr -> i32
%1024 = arith.constant 1 : i32
%1025 = arith.addi %1023, %1024 : i32
llvm.store %1025, %1002 : i32, !llvm.ptr
cf.br ^bb126
^bb133:
cf.br ^bb134
^bb134:
%1026 = llvm.load %999 : !llvm.ptr -> i32
%1027 = arith.cmpi eq, %1016, %1026 : i32
cf.cond_br %1027, ^bb135, ^bb136
^bb135:
%1028 = llvm.load %1002 : !llvm.ptr -> i32
%1029 = arith.constant 1 : i32
%1030 = arith.addi %1028, %1029 : i32
llvm.store %1030, %1002 : i32, !llvm.ptr
cf.br ^bb126
^bb136:
cf.br ^bb137
^bb137:
llvm.store %1016, %999 : i32, !llvm.ptr
%1032 = func.call @ipow128(%985, %1016) : (i64, i32) -> i128
%1031 = func.call @safe_mul(%arg2, %1032) : (i128, i128) -> i128
%1033 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%1034 = llvm.load %1033 : !llvm.ptr -> i128
%1036 = arith.trunci %1031 : i128 to i64
%1037 = arith.trunci %1034 : i128 to i64
%1035 = arith.cmpi sge, %1036, %1037 : i64
%1038 = scf.if %1035 -> (i1) {
%1039 = arith.constant true
scf.yield %1039 : i1
} else {
%1040 = llvm.mlir.addressof @g_g_limit : !llvm.ptr
%1041 = llvm.load %1040 : !llvm.ptr -> i128
%1043 = arith.trunci %1031 : i128 to i64
%1044 = arith.trunci %1041 : i128 to i64
%1042 = arith.cmpi sgt, %1043, %1044 : i64
scf.yield %1042 : i1
}
cf.cond_br %1038, ^bb138, ^bb139
^bb138:
%1045 = llvm.load %1002 : !llvm.ptr -> i32
%1046 = arith.constant 1 : i32
%1047 = arith.addi %1045, %1046 : i32
llvm.store %1047, %1002 : i32, !llvm.ptr
cf.br ^bb126
^bb139:
cf.br ^bb140
^bb140:
%1049 = arith.constant 1 : i32
%1050 = arith.addi %arg0, %1049 : i32
%1051 = arith.constant 1 : i32
%1052 = llvm.load %1002 : !llvm.ptr -> i32
%1053 = arith.shli %1051, %1052 : i32
%1054 = arith.ori %arg1, %1053 : i32
func.call @dfs_assign(%1050, %1054, %1031) : (i32, i32, i128) -> ()
%1055 = llvm.load %1002 : !llvm.ptr -> i32
%1056 = arith.constant 1 : i32
%1057 = arith.addi %1055, %1056 : i32
llvm.store %1057, %1002 : i32, !llvm.ptr
cf.br ^bb126
^bb128:
func.return
}
func.func @min_tau_number(%arg0: !llvm.ptr, %arg1: i32, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: i32) -> i64 {
%1058 = arith.constant 0 : i32
%1059 = arith.cmpi eq, %arg1, %1058 : i32
cf.cond_br %1059, ^bb141, ^bb142
^bb141:
%1060 = arith.constant 1 : i32
%1061 = arith.extsi %1060 : i32 to i64
func.return %1061 : i64
^bb142:
cf.br ^bb143
^bb143:
%1062 = arith.cmpi sgt, %arg4, %arg1 : i32
cf.cond_br %1062, ^bb144, ^bb145
^bb144:
%1063 = arith.constant 1 : i32
%1065 = arith.constant 0 : i32
%1064 = arith.subi %1065, %1063 : i32
%1066 = arith.extsi %1064 : i32 to i64
func.return %1066 : i64
^bb145:
cf.br ^bb146
^bb146:
%1068 = arith.constant 0 : i32
%1069 = arith.extsi %1068 : i32 to i64
%1070 = llvm.getelementptr %arg0[%1069] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1067 = llvm.load %1070 : !llvm.ptr -> i32
%1071 = llvm.mlir.constant(1 : i64) : i64
%1072 = llvm.alloca %1071 x i32 : (i64) -> !llvm.ptr
llvm.store %1067, %1072 : i32, !llvm.ptr
%1073 = arith.constant 0 : i32
%1074 = llvm.mlir.constant(1 : i64) : i64
%1075 = llvm.alloca %1074 x i32 : (i64) -> !llvm.ptr
llvm.store %1073, %1075 : i32, !llvm.ptr
cf.br ^bb147
^bb147:
%1076 = llvm.load %1075 : !llvm.ptr -> i32
%1077 = arith.cmpi slt, %1076, %arg4 : i32
cf.cond_br %1077, ^bb148, ^bb149
^bb148:
%1079 = llvm.load %1075 : !llvm.ptr -> i32
%1080 = arith.extsi %1079 : i32 to i64
%1081 = llvm.getelementptr %arg3[%1080] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1078 = llvm.load %1081 : !llvm.ptr -> i32
%1082 = llvm.load %1072 : !llvm.ptr -> i32
%1083 = arith.cmpi sgt, %1078, %1082 : i32
cf.cond_br %1083, ^bb150, ^bb151
^bb150:
%1084 = arith.constant 1 : i32
%1086 = arith.constant 0 : i32
%1085 = arith.subi %1086, %1084 : i32
%1087 = arith.extsi %1085 : i32 to i64
func.return %1087 : i64
^bb151:
cf.br ^bb152
^bb152:
%1088 = llvm.load %1075 : !llvm.ptr -> i32
%1089 = arith.constant 1 : i32
%1090 = arith.addi %1088, %1089 : i32
llvm.store %1090, %1075 : i32, !llvm.ptr
cf.br ^bb147
^bb149:
%1092 = arith.constant 200 : i32
%1093 = arith.constant 4 : i32
%1094 = arith.extsi %1092 : i32 to i64
%1095 = arith.extsi %1093 : i32 to i64
%1091 = func.call @calloc(%1094, %1095) : (i64, i64) -> !llvm.ptr
%1096 = arith.constant 0 : i32
%1097 = llvm.mlir.constant(1 : i64) : i64
%1098 = llvm.alloca %1097 x i32 : (i64) -> !llvm.ptr
llvm.store %1096, %1098 : i32, !llvm.ptr
cf.br ^bb153
^bb153:
%1099 = llvm.load %1098 : !llvm.ptr -> i32
%1100 = arith.cmpi slt, %1099, %arg4 : i32
cf.cond_br %1100, ^bb154, ^bb155
^bb154:
%1101 = arith.constant 0 : i32
%1102 = llvm.mlir.constant(1 : i64) : i64
%1103 = llvm.alloca %1102 x i32 : (i64) -> !llvm.ptr
llvm.store %1101, %1103 : i32, !llvm.ptr
cf.br ^bb156
^bb156:
%1104 = llvm.load %1103 : !llvm.ptr -> i32
%1105 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
%1106 = llvm.load %1105 : !llvm.ptr -> i32
%1107 = arith.cmpi slt, %1104, %1106 : i32
cf.cond_br %1107, ^bb157, ^bb158
^bb157:
%1109 = llvm.mlir.addressof @g_primes : !llvm.ptr
%1110 = llvm.load %1109 : !llvm.ptr -> !llvm.ptr
%1111 = llvm.load %1103 : !llvm.ptr -> i32
%1112 = arith.extsi %1111 : i32 to i64
%1113 = llvm.getelementptr %1110[%1112] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1108 = llvm.load %1113 : !llvm.ptr -> i32
%1114 = arith.extsi %1108 : i32 to i64
%1116 = llvm.load %1098 : !llvm.ptr -> i32
%1117 = arith.extsi %1116 : i32 to i64
%1118 = llvm.getelementptr %arg2[%1117] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1115 = llvm.load %1118 : !llvm.ptr -> i64
%1119 = arith.cmpi eq, %1114, %1115 : i64
cf.cond_br %1119, ^bb159, ^bb160
^bb159:
%1120 = arith.constant 1 : i32
%1121 = llvm.load %1103 : !llvm.ptr -> i32
%1122 = arith.extsi %1121 : i32 to i64
%1123 = llvm.getelementptr %1091[%1122] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1120, %1123 : i32, !llvm.ptr
cf.br ^bb158
^bb160:
cf.br ^bb161
^bb161:
%1124 = llvm.load %1103 : !llvm.ptr -> i32
%1125 = arith.constant 1 : i32
%1126 = arith.addi %1124, %1125 : i32
llvm.store %1126, %1103 : i32, !llvm.ptr
cf.br ^bb156
^bb158:
%1127 = llvm.load %1098 : !llvm.ptr -> i32
%1128 = arith.constant 1 : i32
%1129 = arith.addi %1127, %1128 : i32
llvm.store %1129, %1098 : i32, !llvm.ptr
cf.br ^bb153
^bb155:
%1130 = arith.subi %arg1, %arg4 : i32
%1131 = arith.constant 0 : i32
%1132 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
llvm.store %1131, %1132 : i32, !llvm.ptr
%1133 = arith.constant 0 : i32
%1134 = llvm.mlir.constant(1 : i64) : i64
%1135 = llvm.alloca %1134 x i32 : (i64) -> !llvm.ptr
llvm.store %1133, %1135 : i32, !llvm.ptr
cf.br ^bb162
^bb162:
%1136 = llvm.load %1135 : !llvm.ptr -> i32
%1137 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
%1138 = llvm.load %1137 : !llvm.ptr -> i32
%1139 = arith.cmpi slt, %1136, %1138 : i32
%1140 = scf.if %1139 -> (i1) {
%1141 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
%1142 = llvm.load %1141 : !llvm.ptr -> i32
%1143 = arith.cmpi slt, %1142, %1130 : i32
scf.yield %1143 : i1
} else {
%1144 = arith.constant false
scf.yield %1144 : i1
}
cf.cond_br %1140, ^bb163, ^bb164
^bb163:
%1146 = llvm.load %1135 : !llvm.ptr -> i32
%1147 = arith.extsi %1146 : i32 to i64
%1148 = llvm.getelementptr %1091[%1147] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1145 = llvm.load %1148 : !llvm.ptr -> i32
%1149 = arith.constant 0 : i32
%1150 = arith.cmpi eq, %1145, %1149 : i32
cf.cond_br %1150, ^bb165, ^bb166
^bb165:
%1152 = llvm.mlir.addressof @g_primes : !llvm.ptr
%1153 = llvm.load %1152 : !llvm.ptr -> !llvm.ptr
%1154 = llvm.load %1135 : !llvm.ptr -> i32
%1155 = arith.extsi %1154 : i32 to i64
%1156 = llvm.getelementptr %1153[%1155] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1151 = llvm.load %1156 : !llvm.ptr -> i32
%1157 = arith.extsi %1151 : i32 to i64
%1158 = llvm.mlir.addressof @g_g_fillers : !llvm.ptr
%1159 = llvm.load %1158 : !llvm.ptr -> !llvm.ptr
%1160 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
%1161 = llvm.load %1160 : !llvm.ptr -> i32
%1162 = arith.extsi %1161 : i32 to i64
%1163 = llvm.getelementptr %1159[%1162] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1157, %1163 : i64, !llvm.ptr
%1164 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
%1165 = llvm.load %1164 : !llvm.ptr -> i32
%1166 = arith.constant 1 : i32
%1167 = arith.addi %1165, %1166 : i32
%1168 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
llvm.store %1167, %1168 : i32, !llvm.ptr
cf.br ^bb167
^bb166:
cf.br ^bb167
^bb167:
%1169 = llvm.load %1135 : !llvm.ptr -> i32
%1170 = arith.constant 1 : i32
%1171 = arith.addi %1169, %1170 : i32
llvm.store %1171, %1135 : i32, !llvm.ptr
cf.br ^bb162
^bb164:
%1172 = llvm.mlir.addressof @g_g_r : !llvm.ptr
llvm.store %arg1, %1172 : i32, !llvm.ptr
%1174 = llvm.mlir.addressof @g_g_exps : !llvm.ptr
%1175 = llvm.load %1174 : !llvm.ptr -> !llvm.ptr
%1176 = arith.extsi %arg1 : i32 to i64
%1177 = arith.constant 4 : i32
%1179 = arith.extsi %1177 : i32 to i64
%1178 = arith.muli %1176, %1179 : i64
%1173 = func.call @memcpy(%1175, %arg0, %1178) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
%1180 = llvm.mlir.addressof @g_g_s : !llvm.ptr
llvm.store %arg4, %1180 : i32, !llvm.ptr
%1181 = arith.constant 0 : i32
%1182 = llvm.mlir.constant(1 : i64) : i64
%1183 = llvm.alloca %1182 x i32 : (i64) -> !llvm.ptr
llvm.store %1181, %1183 : i32, !llvm.ptr
cf.br ^bb168
^bb168:
%1184 = llvm.load %1183 : !llvm.ptr -> i32
%1185 = arith.cmpi slt, %1184, %arg4 : i32
cf.cond_br %1185, ^bb169, ^bb170
^bb169:
%1187 = llvm.load %1183 : !llvm.ptr -> i32
%1188 = arith.extsi %1187 : i32 to i64
%1189 = llvm.getelementptr %arg2[%1188] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1186 = llvm.load %1189 : !llvm.ptr -> i64
%1190 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1191 = llvm.load %1190 : !llvm.ptr -> !llvm.ptr
%1192 = llvm.load %1183 : !llvm.ptr -> i32
%1193 = arith.extsi %1192 : i32 to i64
%1194 = llvm.getelementptr %1191[%1193] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1186, %1194 : i64, !llvm.ptr
%1196 = llvm.load %1183 : !llvm.ptr -> i32
%1197 = arith.extsi %1196 : i32 to i64
%1198 = llvm.getelementptr %arg3[%1197] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1195 = llvm.load %1198 : !llvm.ptr -> i32
%1199 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
%1200 = llvm.load %1199 : !llvm.ptr -> !llvm.ptr
%1201 = llvm.load %1183 : !llvm.ptr -> i32
%1202 = arith.extsi %1201 : i32 to i64
%1203 = llvm.getelementptr %1200[%1202] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1195, %1203 : i32, !llvm.ptr
%1204 = llvm.load %1183 : !llvm.ptr -> i32
%1205 = arith.constant 1 : i32
%1206 = arith.addi %1204, %1205 : i32
llvm.store %1206, %1183 : i32, !llvm.ptr
cf.br ^bb168
^bb170:
%1207 = arith.constant 0 : i32
%1208 = llvm.mlir.constant(1 : i64) : i64
%1209 = llvm.alloca %1208 x i32 : (i64) -> !llvm.ptr
llvm.store %1207, %1209 : i32, !llvm.ptr
cf.br ^bb171
^bb171:
%1210 = llvm.load %1209 : !llvm.ptr -> i32
%1211 = arith.cmpi slt, %1210, %arg4 : i32
cf.cond_br %1211, ^bb172, ^bb173
^bb172:
%1212 = llvm.load %1209 : !llvm.ptr -> i32
%1213 = arith.constant 1 : i32
%1214 = arith.addi %1212, %1213 : i32
%1215 = llvm.mlir.constant(1 : i64) : i64
%1216 = llvm.alloca %1215 x i32 : (i64) -> !llvm.ptr
llvm.store %1214, %1216 : i32, !llvm.ptr
cf.br ^bb174
^bb174:
%1217 = llvm.load %1216 : !llvm.ptr -> i32
%1218 = arith.cmpi slt, %1217, %arg4 : i32
cf.cond_br %1218, ^bb175, ^bb176
^bb175:
%1220 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1221 = llvm.load %1220 : !llvm.ptr -> !llvm.ptr
%1222 = llvm.load %1216 : !llvm.ptr -> i32
%1223 = arith.extsi %1222 : i32 to i64
%1224 = llvm.getelementptr %1221[%1223] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1219 = llvm.load %1224 : !llvm.ptr -> i64
%1226 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1227 = llvm.load %1226 : !llvm.ptr -> !llvm.ptr
%1228 = llvm.load %1209 : !llvm.ptr -> i32
%1229 = arith.extsi %1228 : i32 to i64
%1230 = llvm.getelementptr %1227[%1229] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1225 = llvm.load %1230 : !llvm.ptr -> i64
%1231 = arith.cmpi sgt, %1219, %1225 : i64
cf.cond_br %1231, ^bb177, ^bb178
^bb177:
%1233 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1234 = llvm.load %1233 : !llvm.ptr -> !llvm.ptr
%1235 = llvm.load %1209 : !llvm.ptr -> i32
%1236 = arith.extsi %1235 : i32 to i64
%1237 = llvm.getelementptr %1234[%1236] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1232 = llvm.load %1237 : !llvm.ptr -> i64
%1239 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1240 = llvm.load %1239 : !llvm.ptr -> !llvm.ptr
%1241 = llvm.load %1216 : !llvm.ptr -> i32
%1242 = arith.extsi %1241 : i32 to i64
%1243 = llvm.getelementptr %1240[%1242] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1238 = llvm.load %1243 : !llvm.ptr -> i64
%1244 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1245 = llvm.load %1244 : !llvm.ptr -> !llvm.ptr
%1246 = llvm.load %1209 : !llvm.ptr -> i32
%1247 = arith.extsi %1246 : i32 to i64
%1248 = llvm.getelementptr %1245[%1247] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1238, %1248 : i64, !llvm.ptr
%1249 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1250 = llvm.load %1249 : !llvm.ptr -> !llvm.ptr
%1251 = llvm.load %1216 : !llvm.ptr -> i32
%1252 = arith.extsi %1251 : i32 to i64
%1253 = llvm.getelementptr %1250[%1252] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1232, %1253 : i64, !llvm.ptr
%1255 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
%1256 = llvm.load %1255 : !llvm.ptr -> !llvm.ptr
%1257 = llvm.load %1209 : !llvm.ptr -> i32
%1258 = arith.extsi %1257 : i32 to i64
%1259 = llvm.getelementptr %1256[%1258] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1254 = llvm.load %1259 : !llvm.ptr -> i32
%1261 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
%1262 = llvm.load %1261 : !llvm.ptr -> !llvm.ptr
%1263 = llvm.load %1216 : !llvm.ptr -> i32
%1264 = arith.extsi %1263 : i32 to i64
%1265 = llvm.getelementptr %1262[%1264] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1260 = llvm.load %1265 : !llvm.ptr -> i32
%1266 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
%1267 = llvm.load %1266 : !llvm.ptr -> !llvm.ptr
%1268 = llvm.load %1209 : !llvm.ptr -> i32
%1269 = arith.extsi %1268 : i32 to i64
%1270 = llvm.getelementptr %1267[%1269] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1260, %1270 : i32, !llvm.ptr
%1271 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
%1272 = llvm.load %1271 : !llvm.ptr -> !llvm.ptr
%1273 = llvm.load %1216 : !llvm.ptr -> i32
%1274 = arith.extsi %1273 : i32 to i64
%1275 = llvm.getelementptr %1272[%1274] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1254, %1275 : i32, !llvm.ptr
cf.br ^bb179
^bb178:
cf.br ^bb179
^bb179:
%1276 = llvm.load %1216 : !llvm.ptr -> i32
%1277 = arith.constant 1 : i32
%1278 = arith.addi %1276, %1277 : i32
llvm.store %1278, %1216 : i32, !llvm.ptr
cf.br ^bb174
^bb176:
%1279 = llvm.load %1209 : !llvm.ptr -> i32
%1280 = arith.constant 1 : i32
%1281 = arith.addi %1279, %1280 : i32
llvm.store %1281, %1209 : i32, !llvm.ptr
cf.br ^bb171
^bb173:
%1282 = llvm.mlir.addressof @LIMIT : !llvm.ptr
%1283 = llvm.load %1282 : !llvm.ptr -> i64
%1284 = arith.extsi %1283 : i64 to i128
%1285 = llvm.mlir.addressof @g_g_limit : !llvm.ptr
llvm.store %1284, %1285 : i128, !llvm.ptr
%1287 = llvm.mlir.addressof @MAX_EXP_LEN : !llvm.ptr
%1288 = llvm.load %1287 : !llvm.ptr -> i32
%1289 = arith.extsi %1288 : i32 to i64
%1290 = arith.constant 4 : i32
%1291 = arith.extsi %1290 : i32 to i64
%1286 = func.call @calloc(%1289, %1291) : (i64, i64) -> !llvm.ptr
%1293 = arith.extsi %arg1 : i32 to i64
%1294 = arith.constant 4 : i32
%1296 = arith.extsi %1294 : i32 to i64
%1295 = arith.muli %1293, %1296 : i64
%1292 = func.call @memcpy(%1286, %arg0, %1295) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
%1297 = arith.constant 0 : i32
%1298 = llvm.mlir.constant(1 : i64) : i64
%1299 = llvm.alloca %1298 x i32 : (i64) -> !llvm.ptr
llvm.store %1297, %1299 : i32, !llvm.ptr
cf.br ^bb180
^bb180:
%1300 = llvm.load %1299 : !llvm.ptr -> i32
%1301 = arith.cmpi slt, %1300, %arg1 : i32
cf.cond_br %1301, ^bb181, ^bb182
^bb181:
%1302 = llvm.load %1299 : !llvm.ptr -> i32
%1303 = arith.constant 1 : i32
%1304 = arith.addi %1302, %1303 : i32
%1305 = llvm.mlir.constant(1 : i64) : i64
%1306 = llvm.alloca %1305 x i32 : (i64) -> !llvm.ptr
llvm.store %1304, %1306 : i32, !llvm.ptr
cf.br ^bb183
^bb183:
%1307 = llvm.load %1306 : !llvm.ptr -> i32
%1308 = arith.cmpi slt, %1307, %arg1 : i32
cf.cond_br %1308, ^bb184, ^bb185
^bb184:
%1310 = llvm.load %1306 : !llvm.ptr -> i32
%1311 = arith.extsi %1310 : i32 to i64
%1312 = llvm.getelementptr %1286[%1311] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1309 = llvm.load %1312 : !llvm.ptr -> i32
%1314 = llvm.load %1299 : !llvm.ptr -> i32
%1315 = arith.extsi %1314 : i32 to i64
%1316 = llvm.getelementptr %1286[%1315] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1313 = llvm.load %1316 : !llvm.ptr -> i32
%1317 = arith.cmpi slt, %1309, %1313 : i32
cf.cond_br %1317, ^bb186, ^bb187
^bb186:
%1319 = llvm.load %1299 : !llvm.ptr -> i32
%1320 = arith.extsi %1319 : i32 to i64
%1321 = llvm.getelementptr %1286[%1320] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1318 = llvm.load %1321 : !llvm.ptr -> i32
%1323 = llvm.load %1306 : !llvm.ptr -> i32
%1324 = arith.extsi %1323 : i32 to i64
%1325 = llvm.getelementptr %1286[%1324] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1322 = llvm.load %1325 : !llvm.ptr -> i32
%1326 = llvm.load %1299 : !llvm.ptr -> i32
%1327 = arith.extsi %1326 : i32 to i64
%1328 = llvm.getelementptr %1286[%1327] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1322, %1328 : i32, !llvm.ptr
%1329 = llvm.load %1306 : !llvm.ptr -> i32
%1330 = arith.extsi %1329 : i32 to i64
%1331 = llvm.getelementptr %1286[%1330] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1318, %1331 : i32, !llvm.ptr
cf.br ^bb188
^bb187:
cf.br ^bb188
^bb188:
%1332 = llvm.load %1306 : !llvm.ptr -> i32
%1333 = arith.constant 1 : i32
%1334 = arith.addi %1332, %1333 : i32
llvm.store %1334, %1306 : i32, !llvm.ptr
cf.br ^bb183
^bb185:
%1335 = llvm.load %1299 : !llvm.ptr -> i32
%1336 = arith.constant 1 : i32
%1337 = arith.addi %1335, %1336 : i32
llvm.store %1337, %1299 : i32, !llvm.ptr
cf.br ^bb180
^bb182:
%1338 = arith.constant 1 : i32
%1339 = arith.extsi %1338 : i32 to i128
%1340 = llvm.mlir.constant(1 : i64) : i64
%1341 = llvm.alloca %1340 x i128 : (i64) -> !llvm.ptr
llvm.store %1339, %1341 : i128, !llvm.ptr
%1342 = arith.constant 1 : i32
%1343 = llvm.mlir.constant(1 : i64) : i64
%1344 = llvm.alloca %1343 x i32 : (i64) -> !llvm.ptr
llvm.store %1342, %1344 : i32, !llvm.ptr
%1346 = llvm.mlir.addressof @MAX_EXP_LEN : !llvm.ptr
%1347 = llvm.load %1346 : !llvm.ptr -> i32
%1348 = arith.extsi %1347 : i32 to i64
%1349 = arith.constant 4 : i32
%1350 = arith.extsi %1349 : i32 to i64
%1345 = func.call @calloc(%1348, %1350) : (i64, i64) -> !llvm.ptr
%1351 = arith.constant 0 : i32
%1352 = llvm.mlir.constant(1 : i64) : i64
%1353 = llvm.alloca %1352 x i32 : (i64) -> !llvm.ptr
llvm.store %1351, %1353 : i32, !llvm.ptr
cf.br ^bb189
^bb189:
%1354 = llvm.load %1353 : !llvm.ptr -> i32
%1355 = arith.cmpi slt, %1354, %arg4 : i32
%1356 = scf.if %1355 -> (i1) {
%1357 = llvm.load %1344 : !llvm.ptr -> i32
%1358 = arith.constant 0 : i32
%1359 = arith.cmpi ne, %1357, %1358 : i32
scf.yield %1359 : i1
} else {
%1360 = arith.constant false
scf.yield %1360 : i1
}
cf.cond_br %1356, ^bb190, ^bb191
^bb190:
%1362 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
%1363 = llvm.load %1362 : !llvm.ptr -> !llvm.ptr
%1364 = llvm.load %1353 : !llvm.ptr -> i32
%1365 = arith.extsi %1364 : i32 to i64
%1366 = llvm.getelementptr %1363[%1365] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1361 = llvm.load %1366 : !llvm.ptr -> i64
%1368 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
%1369 = llvm.load %1368 : !llvm.ptr -> !llvm.ptr
%1370 = llvm.load %1353 : !llvm.ptr -> i32
%1371 = arith.extsi %1370 : i32 to i64
%1372 = llvm.getelementptr %1369[%1371] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1367 = llvm.load %1372 : !llvm.ptr -> i32
%1373 = arith.constant 1 : i32
%1375 = arith.constant 0 : i32
%1374 = arith.subi %1375, %1373 : i32
%1376 = llvm.mlir.constant(1 : i64) : i64
%1377 = llvm.alloca %1376 x i32 : (i64) -> !llvm.ptr
llvm.store %1374, %1377 : i32, !llvm.ptr
%1378 = arith.constant 0 : i32
%1379 = llvm.mlir.constant(1 : i64) : i64
%1380 = llvm.alloca %1379 x i32 : (i64) -> !llvm.ptr
llvm.store %1378, %1380 : i32, !llvm.ptr
cf.br ^bb192
^bb192:
%1381 = llvm.load %1380 : !llvm.ptr -> i32
%1382 = arith.cmpi slt, %1381, %arg1 : i32
cf.cond_br %1382, ^bb193, ^bb194
^bb193:
%1384 = llvm.load %1380 : !llvm.ptr -> i32
%1385 = arith.extsi %1384 : i32 to i64
%1386 = llvm.getelementptr %1345[%1385] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1383 = llvm.load %1386 : !llvm.ptr -> i32
%1387 = arith.constant 0 : i32
%1388 = arith.cmpi eq, %1383, %1387 : i32
%1389 = scf.if %1388 -> (i1) {
%1391 = llvm.load %1380 : !llvm.ptr -> i32
%1392 = arith.extsi %1391 : i32 to i64
%1393 = llvm.getelementptr %1286[%1392] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1390 = llvm.load %1393 : !llvm.ptr -> i32
%1394 = arith.cmpi sge, %1390, %1367 : i32
scf.yield %1394 : i1
} else {
%1395 = arith.constant false
scf.yield %1395 : i1
}
cf.cond_br %1389, ^bb195, ^bb196
^bb195:
%1396 = llvm.load %1380 : !llvm.ptr -> i32
llvm.store %1396, %1377 : i32, !llvm.ptr
cf.br ^bb194
^bb196:
cf.br ^bb197
^bb197:
%1397 = llvm.load %1380 : !llvm.ptr -> i32
%1398 = arith.constant 1 : i32
%1399 = arith.addi %1397, %1398 : i32
llvm.store %1399, %1380 : i32, !llvm.ptr
cf.br ^bb192
^bb194:
%1400 = llvm.load %1377 : !llvm.ptr -> i32
%1401 = arith.constant 0 : i32
%1402 = arith.cmpi slt, %1400, %1401 : i32
cf.cond_br %1402, ^bb198, ^bb199
^bb198:
%1403 = arith.constant 0 : i32
llvm.store %1403, %1344 : i32, !llvm.ptr
cf.br ^bb200
^bb199:
%1404 = arith.constant 1 : i32
%1405 = llvm.load %1377 : !llvm.ptr -> i32
%1406 = arith.extsi %1405 : i32 to i64
%1407 = llvm.getelementptr %1345[%1406] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1404, %1407 : i32, !llvm.ptr
%1409 = llvm.load %1341 : !llvm.ptr -> i128
%1412 = llvm.load %1377 : !llvm.ptr -> i32
%1413 = arith.extsi %1412 : i32 to i64
%1414 = llvm.getelementptr %1286[%1413] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1411 = llvm.load %1414 : !llvm.ptr -> i32
%1410 = func.call @ipow128(%1361, %1411) : (i64, i32) -> i128
%1408 = func.call @safe_mul(%1409, %1410) : (i128, i128) -> i128
llvm.store %1408, %1341 : i128, !llvm.ptr
%1415 = llvm.load %1341 : !llvm.ptr -> i128
%1416 = llvm.mlir.addressof @g_g_limit : !llvm.ptr
%1417 = llvm.load %1416 : !llvm.ptr -> i128
%1419 = arith.trunci %1415 : i128 to i64
%1420 = arith.trunci %1417 : i128 to i64
%1418 = arith.cmpi sgt, %1419, %1420 : i64
cf.cond_br %1418, ^bb201, ^bb202
^bb201:
%1421 = arith.constant 0 : i32
llvm.store %1421, %1344 : i32, !llvm.ptr
cf.br ^bb203
^bb202:
cf.br ^bb203
^bb203:
cf.br ^bb200
^bb200:
%1422 = llvm.load %1353 : !llvm.ptr -> i32
%1423 = arith.constant 1 : i32
%1424 = arith.addi %1422, %1423 : i32
llvm.store %1424, %1353 : i32, !llvm.ptr
cf.br ^bb189
^bb191:
%1425 = llvm.load %1344 : !llvm.ptr -> i32
%1426 = arith.constant 0 : i32
%1427 = arith.cmpi ne, %1425, %1426 : i32
cf.cond_br %1427, ^bb204, ^bb205
^bb204:
%1429 = llvm.mlir.addressof @MAX_EXP_LEN : !llvm.ptr
%1430 = llvm.load %1429 : !llvm.ptr -> i32
%1431 = arith.extsi %1430 : i32 to i64
%1432 = arith.constant 4 : i32
%1433 = arith.extsi %1432 : i32 to i64
%1428 = func.call @calloc(%1431, %1433) : (i64, i64) -> !llvm.ptr
%1434 = arith.constant 0 : i32
%1435 = llvm.mlir.constant(1 : i64) : i64
%1436 = llvm.alloca %1435 x i32 : (i64) -> !llvm.ptr
llvm.store %1434, %1436 : i32, !llvm.ptr
%1437 = arith.constant 0 : i32
%1438 = llvm.mlir.constant(1 : i64) : i64
%1439 = llvm.alloca %1438 x i32 : (i64) -> !llvm.ptr
llvm.store %1437, %1439 : i32, !llvm.ptr
cf.br ^bb207
^bb207:
%1440 = llvm.load %1439 : !llvm.ptr -> i32
%1441 = arith.cmpi slt, %1440, %arg1 : i32
cf.cond_br %1441, ^bb208, ^bb209
^bb208:
%1443 = llvm.load %1439 : !llvm.ptr -> i32
%1444 = arith.extsi %1443 : i32 to i64
%1445 = llvm.getelementptr %1345[%1444] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1442 = llvm.load %1445 : !llvm.ptr -> i32
%1446 = arith.constant 0 : i32
%1447 = arith.cmpi eq, %1442, %1446 : i32
cf.cond_br %1447, ^bb210, ^bb211
^bb210:
%1449 = llvm.load %1439 : !llvm.ptr -> i32
%1450 = arith.extsi %1449 : i32 to i64
%1451 = llvm.getelementptr %1286[%1450] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1448 = llvm.load %1451 : !llvm.ptr -> i32
%1452 = llvm.load %1436 : !llvm.ptr -> i32
%1453 = arith.extsi %1452 : i32 to i64
%1454 = llvm.getelementptr %1428[%1453] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1448, %1454 : i32, !llvm.ptr
%1455 = llvm.load %1436 : !llvm.ptr -> i32
%1456 = arith.constant 1 : i32
%1457 = arith.addi %1455, %1456 : i32
llvm.store %1457, %1436 : i32, !llvm.ptr
cf.br ^bb212
^bb211:
cf.br ^bb212
^bb212:
%1458 = llvm.load %1439 : !llvm.ptr -> i32
%1459 = arith.constant 1 : i32
%1460 = arith.addi %1458, %1459 : i32
llvm.store %1460, %1439 : i32, !llvm.ptr
cf.br ^bb207
^bb209:
%1461 = arith.constant 0 : i32
%1462 = llvm.mlir.constant(1 : i64) : i64
%1463 = llvm.alloca %1462 x i32 : (i64) -> !llvm.ptr
llvm.store %1461, %1463 : i32, !llvm.ptr
cf.br ^bb213
^bb213:
%1464 = llvm.load %1463 : !llvm.ptr -> i32
%1465 = llvm.load %1436 : !llvm.ptr -> i32
%1466 = arith.cmpi slt, %1464, %1465 : i32
cf.cond_br %1466, ^bb214, ^bb215
^bb214:
%1467 = llvm.load %1463 : !llvm.ptr -> i32
%1468 = arith.constant 1 : i32
%1469 = arith.addi %1467, %1468 : i32
%1470 = llvm.mlir.constant(1 : i64) : i64
%1471 = llvm.alloca %1470 x i32 : (i64) -> !llvm.ptr
llvm.store %1469, %1471 : i32, !llvm.ptr
cf.br ^bb216
^bb216:
%1472 = llvm.load %1471 : !llvm.ptr -> i32
%1473 = llvm.load %1436 : !llvm.ptr -> i32
%1474 = arith.cmpi slt, %1472, %1473 : i32
cf.cond_br %1474, ^bb217, ^bb218
^bb217:
%1476 = llvm.load %1471 : !llvm.ptr -> i32
%1477 = arith.extsi %1476 : i32 to i64
%1478 = llvm.getelementptr %1428[%1477] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1475 = llvm.load %1478 : !llvm.ptr -> i32
%1480 = llvm.load %1463 : !llvm.ptr -> i32
%1481 = arith.extsi %1480 : i32 to i64
%1482 = llvm.getelementptr %1428[%1481] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1479 = llvm.load %1482 : !llvm.ptr -> i32
%1483 = arith.cmpi sgt, %1475, %1479 : i32
cf.cond_br %1483, ^bb219, ^bb220
^bb219:
%1485 = llvm.load %1463 : !llvm.ptr -> i32
%1486 = arith.extsi %1485 : i32 to i64
%1487 = llvm.getelementptr %1428[%1486] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1484 = llvm.load %1487 : !llvm.ptr -> i32
%1489 = llvm.load %1471 : !llvm.ptr -> i32
%1490 = arith.extsi %1489 : i32 to i64
%1491 = llvm.getelementptr %1428[%1490] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1488 = llvm.load %1491 : !llvm.ptr -> i32
%1492 = llvm.load %1463 : !llvm.ptr -> i32
%1493 = arith.extsi %1492 : i32 to i64
%1494 = llvm.getelementptr %1428[%1493] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1488, %1494 : i32, !llvm.ptr
%1495 = llvm.load %1471 : !llvm.ptr -> i32
%1496 = arith.extsi %1495 : i32 to i64
%1497 = llvm.getelementptr %1428[%1496] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1484, %1497 : i32, !llvm.ptr
cf.br ^bb221
^bb220:
cf.br ^bb221
^bb221:
%1498 = llvm.load %1471 : !llvm.ptr -> i32
%1499 = arith.constant 1 : i32
%1500 = arith.addi %1498, %1499 : i32
llvm.store %1500, %1471 : i32, !llvm.ptr
cf.br ^bb216
^bb218:
%1501 = llvm.load %1463 : !llvm.ptr -> i32
%1502 = arith.constant 1 : i32
%1503 = arith.addi %1501, %1502 : i32
llvm.store %1503, %1463 : i32, !llvm.ptr
cf.br ^bb213
^bb215:
%1504 = arith.constant 0 : i32
%1505 = llvm.mlir.constant(1 : i64) : i64
%1506 = llvm.alloca %1505 x i32 : (i64) -> !llvm.ptr
llvm.store %1504, %1506 : i32, !llvm.ptr
cf.br ^bb222
^bb222:
%1507 = llvm.load %1506 : !llvm.ptr -> i32
%1508 = llvm.mlir.addressof @g_g_num_fillers : !llvm.ptr
%1509 = llvm.load %1508 : !llvm.ptr -> i32
%1510 = arith.cmpi slt, %1507, %1509 : i32
%1511 = scf.if %1510 -> (i1) {
%1512 = llvm.load %1506 : !llvm.ptr -> i32
%1513 = llvm.load %1436 : !llvm.ptr -> i32
%1514 = arith.cmpi slt, %1512, %1513 : i32
scf.yield %1514 : i1
} else {
%1515 = arith.constant false
scf.yield %1515 : i1
}
cf.cond_br %1511, ^bb223, ^bb224
^bb223:
%1517 = llvm.load %1341 : !llvm.ptr -> i128
%1520 = llvm.mlir.addressof @g_g_fillers : !llvm.ptr
%1521 = llvm.load %1520 : !llvm.ptr -> !llvm.ptr
%1522 = llvm.load %1506 : !llvm.ptr -> i32
%1523 = arith.extsi %1522 : i32 to i64
%1524 = llvm.getelementptr %1521[%1523] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1519 = llvm.load %1524 : !llvm.ptr -> i64
%1526 = llvm.load %1506 : !llvm.ptr -> i32
%1527 = arith.extsi %1526 : i32 to i64
%1528 = llvm.getelementptr %1428[%1527] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1525 = llvm.load %1528 : !llvm.ptr -> i32
%1518 = func.call @ipow128(%1519, %1525) : (i64, i32) -> i128
%1516 = func.call @safe_mul(%1517, %1518) : (i128, i128) -> i128
llvm.store %1516, %1341 : i128, !llvm.ptr
%1529 = llvm.load %1341 : !llvm.ptr -> i128
%1530 = llvm.mlir.addressof @g_g_limit : !llvm.ptr
%1531 = llvm.load %1530 : !llvm.ptr -> i128
%1533 = arith.trunci %1529 : i128 to i64
%1534 = arith.trunci %1531 : i128 to i64
%1532 = arith.cmpi sgt, %1533, %1534 : i64
cf.cond_br %1532, ^bb225, ^bb226
^bb225:
%1535 = arith.constant 0 : i32
llvm.store %1535, %1344 : i32, !llvm.ptr
cf.br ^bb224
^bb226:
cf.br ^bb227
^bb227:
%1536 = llvm.load %1506 : !llvm.ptr -> i32
%1537 = arith.constant 1 : i32
%1538 = arith.addi %1536, %1537 : i32
llvm.store %1538, %1506 : i32, !llvm.ptr
cf.br ^bb222
^bb224:
func.call @free(%1428) : (!llvm.ptr) -> ()
cf.br ^bb206
^bb205:
cf.br ^bb206
^bb206:
%1540 = llvm.load %1344 : !llvm.ptr -> i32
%1541 = arith.constant 0 : i32
%1542 = arith.cmpi ne, %1540, %1541 : i32
%1543 = scf.if %1542 -> (i128) {
%1544 = llvm.load %1341 : !llvm.ptr -> i128
scf.yield %1544 : i128
} else {
%1545 = llvm.mlir.addressof @g_inf : !llvm.ptr
%1546 = llvm.load %1545 : !llvm.ptr -> i128
scf.yield %1546 : i128
}
%1547 = llvm.mlir.addressof @g_g_best : !llvm.ptr
llvm.store %1543, %1547 : i128, !llvm.ptr
%1549 = arith.constant 0 : i32
%1550 = arith.constant 0 : i32
%1551 = arith.constant 1 : i32
%1552 = arith.extsi %1551 : i32 to i128
func.call @dfs_assign(%1549, %1550, %1552) : (i32, i32, i128) -> ()
func.call @free(%1091) : (!llvm.ptr) -> ()
func.call @free(%1286) : (!llvm.ptr) -> ()
func.call @free(%1345) : (!llvm.ptr) -> ()
%1556 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%1557 = llvm.load %1556 : !llvm.ptr -> i128
%1558 = llvm.mlir.addressof @g_g_limit : !llvm.ptr
%1559 = llvm.load %1558 : !llvm.ptr -> i128
%1561 = arith.trunci %1557 : i128 to i64
%1562 = arith.trunci %1559 : i128 to i64
%1560 = arith.cmpi sle, %1561, %1562 : i64
%1563 = scf.if %1560 -> (i1) {
%1564 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%1565 = llvm.load %1564 : !llvm.ptr -> i128
%1566 = llvm.mlir.addressof @g_inf : !llvm.ptr
%1567 = llvm.load %1566 : !llvm.ptr -> i128
%1569 = arith.trunci %1565 : i128 to i64
%1570 = arith.trunci %1567 : i128 to i64
%1568 = arith.cmpi slt, %1569, %1570 : i64
scf.yield %1568 : i1
} else {
%1571 = arith.constant false
scf.yield %1571 : i1
}
cf.cond_br %1563, ^bb228, ^bb229
^bb228:
%1572 = llvm.mlir.addressof @g_g_best : !llvm.ptr
%1573 = llvm.load %1572 : !llvm.ptr -> i128
%1574 = arith.trunci %1573 : i128 to i64
func.return %1574 : i64
^bb229:
cf.br ^bb230
^bb230:
%1575 = arith.constant 1 : i32
%1577 = arith.constant 0 : i32
%1576 = arith.subi %1577, %1575 : i32
%1578 = arith.extsi %1576 : i32 to i64
func.return %1578 : i64
}
func.func @kn_sift_down(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i32, %arg3: i32) -> () {
%1579 = llvm.mlir.constant(1 : i64) : i64
%1580 = llvm.alloca %1579 x i32 : (i64) -> !llvm.ptr
llvm.store %arg3, %1580 : i32, !llvm.ptr
cf.br ^bb231
^bb231:
%1581 = arith.constant 1 : i1
cf.cond_br %1581, ^bb232, ^bb233
^bb232:
%1582 = arith.constant 2 : i32
%1583 = llvm.load %1580 : !llvm.ptr -> i32
%1584 = arith.muli %1582, %1583 : i32
%1585 = arith.constant 1 : i32
%1586 = arith.addi %1584, %1585 : i32
%1587 = arith.constant 2 : i32
%1588 = llvm.load %1580 : !llvm.ptr -> i32
%1589 = arith.muli %1587, %1588 : i32
%1590 = arith.constant 2 : i32
%1591 = arith.addi %1589, %1590 : i32
%1592 = llvm.load %1580 : !llvm.ptr -> i32
%1593 = llvm.mlir.constant(1 : i64) : i64
%1594 = llvm.alloca %1593 x i32 : (i64) -> !llvm.ptr
llvm.store %1592, %1594 : i32, !llvm.ptr
%1595 = arith.cmpi slt, %1586, %arg2 : i32
cf.cond_br %1595, ^bb234, ^bb235
^bb234:
%1597 = arith.extsi %1586 : i32 to i64
%1598 = llvm.getelementptr %arg0[%1597] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1596 = llvm.load %1598 : !llvm.ptr -> i64
%1600 = llvm.load %1594 : !llvm.ptr -> i32
%1601 = arith.extsi %1600 : i32 to i64
%1602 = llvm.getelementptr %arg0[%1601] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1599 = llvm.load %1602 : !llvm.ptr -> i64
%1603 = arith.cmpi sgt, %1596, %1599 : i64
cf.cond_br %1603, ^bb237, ^bb238
^bb237:
llvm.store %1586, %1594 : i32, !llvm.ptr
cf.br ^bb239
^bb238:
cf.br ^bb239
^bb239:
%1605 = arith.extsi %1586 : i32 to i64
%1606 = llvm.getelementptr %arg0[%1605] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1604 = llvm.load %1606 : !llvm.ptr -> i64
%1608 = llvm.load %1594 : !llvm.ptr -> i32
%1609 = arith.extsi %1608 : i32 to i64
%1610 = llvm.getelementptr %arg0[%1609] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1607 = llvm.load %1610 : !llvm.ptr -> i64
%1611 = arith.cmpi eq, %1604, %1607 : i64
%1612 = scf.if %1611 -> (i1) {
%1614 = arith.extsi %1586 : i32 to i64
%1615 = llvm.getelementptr %arg1[%1614] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1613 = llvm.load %1615 : !llvm.ptr -> i64
%1617 = llvm.load %1594 : !llvm.ptr -> i32
%1618 = arith.extsi %1617 : i32 to i64
%1619 = llvm.getelementptr %arg1[%1618] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1616 = llvm.load %1619 : !llvm.ptr -> i64
%1620 = arith.cmpi sgt, %1613, %1616 : i64
scf.yield %1620 : i1
} else {
%1621 = arith.constant false
scf.yield %1621 : i1
}
cf.cond_br %1612, ^bb240, ^bb241
^bb240:
llvm.store %1586, %1594 : i32, !llvm.ptr
cf.br ^bb242
^bb241:
cf.br ^bb242
^bb242:
cf.br ^bb236
^bb235:
cf.br ^bb236
^bb236:
%1622 = arith.cmpi slt, %1591, %arg2 : i32
cf.cond_br %1622, ^bb243, ^bb244
^bb243:
%1624 = arith.extsi %1591 : i32 to i64
%1625 = llvm.getelementptr %arg0[%1624] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1623 = llvm.load %1625 : !llvm.ptr -> i64
%1627 = llvm.load %1594 : !llvm.ptr -> i32
%1628 = arith.extsi %1627 : i32 to i64
%1629 = llvm.getelementptr %arg0[%1628] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1626 = llvm.load %1629 : !llvm.ptr -> i64
%1630 = arith.cmpi sgt, %1623, %1626 : i64
cf.cond_br %1630, ^bb246, ^bb247
^bb246:
llvm.store %1591, %1594 : i32, !llvm.ptr
cf.br ^bb248
^bb247:
cf.br ^bb248
^bb248:
%1632 = arith.extsi %1591 : i32 to i64
%1633 = llvm.getelementptr %arg0[%1632] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1631 = llvm.load %1633 : !llvm.ptr -> i64
%1635 = llvm.load %1594 : !llvm.ptr -> i32
%1636 = arith.extsi %1635 : i32 to i64
%1637 = llvm.getelementptr %arg0[%1636] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1634 = llvm.load %1637 : !llvm.ptr -> i64
%1638 = arith.cmpi eq, %1631, %1634 : i64
%1639 = scf.if %1638 -> (i1) {
%1641 = arith.extsi %1591 : i32 to i64
%1642 = llvm.getelementptr %arg1[%1641] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1640 = llvm.load %1642 : !llvm.ptr -> i64
%1644 = llvm.load %1594 : !llvm.ptr -> i32
%1645 = arith.extsi %1644 : i32 to i64
%1646 = llvm.getelementptr %arg1[%1645] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1643 = llvm.load %1646 : !llvm.ptr -> i64
%1647 = arith.cmpi sgt, %1640, %1643 : i64
scf.yield %1647 : i1
} else {
%1648 = arith.constant false
scf.yield %1648 : i1
}
cf.cond_br %1639, ^bb249, ^bb250
^bb249:
llvm.store %1591, %1594 : i32, !llvm.ptr
cf.br ^bb251
^bb250:
cf.br ^bb251
^bb251:
cf.br ^bb245
^bb244:
cf.br ^bb245
^bb245:
%1649 = llvm.load %1594 : !llvm.ptr -> i32
%1650 = llvm.load %1580 : !llvm.ptr -> i32
%1651 = arith.cmpi eq, %1649, %1650 : i32
cf.cond_br %1651, ^bb252, ^bb253
^bb252:
func.return
^bb253:
cf.br ^bb254
^bb254:
%1653 = llvm.load %1580 : !llvm.ptr -> i32
%1654 = arith.extsi %1653 : i32 to i64
%1655 = llvm.getelementptr %arg0[%1654] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1652 = llvm.load %1655 : !llvm.ptr -> i64
%1657 = llvm.load %1594 : !llvm.ptr -> i32
%1658 = arith.extsi %1657 : i32 to i64
%1659 = llvm.getelementptr %arg0[%1658] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1656 = llvm.load %1659 : !llvm.ptr -> i64
%1660 = llvm.load %1580 : !llvm.ptr -> i32
%1661 = arith.extsi %1660 : i32 to i64
%1662 = llvm.getelementptr %arg0[%1661] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1656, %1662 : i64, !llvm.ptr
%1663 = llvm.load %1594 : !llvm.ptr -> i32
%1664 = arith.extsi %1663 : i32 to i64
%1665 = llvm.getelementptr %arg0[%1664] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1652, %1665 : i64, !llvm.ptr
%1667 = llvm.load %1580 : !llvm.ptr -> i32
%1668 = arith.extsi %1667 : i32 to i64
%1669 = llvm.getelementptr %arg1[%1668] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1666 = llvm.load %1669 : !llvm.ptr -> i64
%1671 = llvm.load %1594 : !llvm.ptr -> i32
%1672 = arith.extsi %1671 : i32 to i64
%1673 = llvm.getelementptr %arg1[%1672] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1670 = llvm.load %1673 : !llvm.ptr -> i64
%1674 = llvm.load %1580 : !llvm.ptr -> i32
%1675 = arith.extsi %1674 : i32 to i64
%1676 = llvm.getelementptr %arg1[%1675] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1670, %1676 : i64, !llvm.ptr
%1677 = llvm.load %1594 : !llvm.ptr -> i32
%1678 = arith.extsi %1677 : i32 to i64
%1679 = llvm.getelementptr %arg1[%1678] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1666, %1679 : i64, !llvm.ptr
%1680 = llvm.load %1594 : !llvm.ptr -> i32
llvm.store %1680, %1580 : i32, !llvm.ptr
cf.br ^bb231
^bb233:
func.return
}
func.func @kn_heapsort(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i32) -> () {
%1681 = arith.constant 2 : i32
%1682 = arith.divsi %arg2, %1681 : i32
%1683 = arith.constant 1 : i32
%1684 = arith.subi %1682, %1683 : i32
%1685 = llvm.mlir.constant(1 : i64) : i64
%1686 = llvm.alloca %1685 x i32 : (i64) -> !llvm.ptr
llvm.store %1684, %1686 : i32, !llvm.ptr
cf.br ^bb255
^bb255:
%1687 = llvm.load %1686 : !llvm.ptr -> i32
%1688 = arith.constant 0 : i32
%1689 = arith.cmpi sge, %1687, %1688 : i32
cf.cond_br %1689, ^bb256, ^bb257
^bb256:
%1691 = llvm.load %1686 : !llvm.ptr -> i32
func.call @kn_sift_down(%arg0, %arg1, %arg2, %1691) : (!llvm.ptr, !llvm.ptr, i32, i32) -> ()
%1692 = llvm.load %1686 : !llvm.ptr -> i32
%1693 = arith.constant 1 : i32
%1694 = arith.subi %1692, %1693 : i32
llvm.store %1694, %1686 : i32, !llvm.ptr
cf.br ^bb255
^bb257:
%1695 = arith.constant 1 : i32
%1696 = arith.subi %arg2, %1695 : i32
%1697 = llvm.mlir.constant(1 : i64) : i64
%1698 = llvm.alloca %1697 x i32 : (i64) -> !llvm.ptr
llvm.store %1696, %1698 : i32, !llvm.ptr
cf.br ^bb258
^bb258:
%1699 = llvm.load %1698 : !llvm.ptr -> i32
%1700 = arith.constant 0 : i32
%1701 = arith.cmpi sgt, %1699, %1700 : i32
cf.cond_br %1701, ^bb259, ^bb260
^bb259:
%1703 = arith.constant 0 : i32
%1704 = arith.extsi %1703 : i32 to i64
%1705 = llvm.getelementptr %arg0[%1704] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1702 = llvm.load %1705 : !llvm.ptr -> i64
%1707 = llvm.load %1698 : !llvm.ptr -> i32
%1708 = arith.extsi %1707 : i32 to i64
%1709 = llvm.getelementptr %arg0[%1708] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1706 = llvm.load %1709 : !llvm.ptr -> i64
%1710 = arith.constant 0 : i32
%1711 = arith.extsi %1710 : i32 to i64
%1712 = llvm.getelementptr %arg0[%1711] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1706, %1712 : i64, !llvm.ptr
%1713 = llvm.load %1698 : !llvm.ptr -> i32
%1714 = arith.extsi %1713 : i32 to i64
%1715 = llvm.getelementptr %arg0[%1714] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1702, %1715 : i64, !llvm.ptr
%1717 = arith.constant 0 : i32
%1718 = arith.extsi %1717 : i32 to i64
%1719 = llvm.getelementptr %arg1[%1718] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1716 = llvm.load %1719 : !llvm.ptr -> i64
%1721 = llvm.load %1698 : !llvm.ptr -> i32
%1722 = arith.extsi %1721 : i32 to i64
%1723 = llvm.getelementptr %arg1[%1722] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1720 = llvm.load %1723 : !llvm.ptr -> i64
%1724 = arith.constant 0 : i32
%1725 = arith.extsi %1724 : i32 to i64
%1726 = llvm.getelementptr %arg1[%1725] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1720, %1726 : i64, !llvm.ptr
%1727 = llvm.load %1698 : !llvm.ptr -> i32
%1728 = arith.extsi %1727 : i32 to i64
%1729 = llvm.getelementptr %arg1[%1728] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1716, %1729 : i64, !llvm.ptr
%1731 = llvm.load %1698 : !llvm.ptr -> i32
%1732 = arith.constant 0 : i32
func.call @kn_sift_down(%arg0, %arg1, %1731, %1732) : (!llvm.ptr, !llvm.ptr, i32, i32) -> ()
%1733 = llvm.load %1698 : !llvm.ptr -> i32
%1734 = arith.constant 1 : i32
%1735 = arith.subi %1733, %1734 : i32
llvm.store %1735, %1698 : i32, !llvm.ptr
cf.br ^bb258
^bb260:
func.return
}
func.func @main() -> i32 {
%1736 = arith.constant 1 : i32
%1737 = arith.extsi %1736 : i32 to i128
%1738 = arith.constant 120 : i32
%1740 = arith.trunci %1737 : i128 to i64
%1741 = arith.extsi %1738 : i32 to i64
%1739 = arith.shli %1740, %1741 : i64
%1742 = arith.extsi %1739 : i64 to i128
%1743 = llvm.mlir.addressof @g_inf : !llvm.ptr
llvm.store %1742, %1743 : i128, !llvm.ptr
%1745 = arith.constant 200 : i32
%1746 = arith.constant 4 : i32
%1747 = arith.extsi %1745 : i32 to i64
%1748 = arith.extsi %1746 : i32 to i64
%1744 = func.call @calloc(%1747, %1748) : (i64, i64) -> !llvm.ptr
%1749 = llvm.mlir.addressof @g_primes : !llvm.ptr
llvm.store %1744, %1749 : !llvm.ptr, !llvm.ptr
%1751 = llvm.mlir.addressof @MAX_VECS : !llvm.ptr
%1752 = llvm.load %1751 : !llvm.ptr -> i32
%1753 = arith.extsi %1752 : i32 to i64
%1754 = arith.constant 4 : i32
%1755 = arith.extsi %1754 : i32 to i64
%1750 = func.call @calloc(%1753, %1755) : (i64, i64) -> !llvm.ptr
%1756 = llvm.mlir.addressof @g_vec_len : !llvm.ptr
llvm.store %1750, %1756 : !llvm.ptr, !llvm.ptr
%1758 = llvm.mlir.addressof @MAX_VECS : !llvm.ptr
%1759 = llvm.load %1758 : !llvm.ptr -> i32
%1760 = arith.extsi %1759 : i32 to i64
%1761 = llvm.mlir.addressof @MAX_EXP_LEN : !llvm.ptr
%1762 = llvm.load %1761 : !llvm.ptr -> i32
%1763 = arith.extsi %1762 : i32 to i64
%1764 = arith.muli %1760, %1763 : i64
%1765 = arith.constant 4 : i32
%1766 = arith.extsi %1765 : i32 to i64
%1757 = func.call @calloc(%1764, %1766) : (i64, i64) -> !llvm.ptr
%1767 = llvm.mlir.addressof @g_vec_data : !llvm.ptr
llvm.store %1757, %1767 : !llvm.ptr, !llvm.ptr
%1769 = arith.constant 20 : i32
%1770 = arith.constant 4 : i32
%1771 = arith.extsi %1769 : i32 to i64
%1772 = arith.extsi %1770 : i32 to i64
%1768 = func.call @calloc(%1771, %1772) : (i64, i64) -> !llvm.ptr
%1773 = llvm.mlir.addressof @g_lb_primes : !llvm.ptr
llvm.store %1768, %1773 : !llvm.ptr, !llvm.ptr
%1775 = llvm.mlir.addressof @MAX_EXP_LEN : !llvm.ptr
%1776 = llvm.load %1775 : !llvm.ptr -> i32
%1777 = arith.extsi %1776 : i32 to i64
%1778 = arith.constant 4 : i32
%1779 = arith.extsi %1778 : i32 to i64
%1774 = func.call @calloc(%1777, %1779) : (i64, i64) -> !llvm.ptr
%1780 = llvm.mlir.addressof @g_dfs_exps : !llvm.ptr
llvm.store %1774, %1780 : !llvm.ptr, !llvm.ptr
%1782 = arith.constant 10 : i32
%1783 = arith.constant 4 : i32
%1784 = arith.extsi %1782 : i32 to i64
%1785 = arith.extsi %1783 : i32 to i64
%1781 = func.call @calloc(%1784, %1785) : (i64, i64) -> !llvm.ptr
%1786 = llvm.mlir.addressof @g_fac_primes : !llvm.ptr
llvm.store %1781, %1786 : !llvm.ptr, !llvm.ptr
%1788 = arith.constant 10 : i32
%1789 = arith.constant 4 : i32
%1790 = arith.extsi %1788 : i32 to i64
%1791 = arith.extsi %1789 : i32 to i64
%1787 = func.call @calloc(%1790, %1791) : (i64, i64) -> !llvm.ptr
%1792 = llvm.mlir.addressof @g_fac_exps : !llvm.ptr
llvm.store %1787, %1792 : !llvm.ptr, !llvm.ptr
%1794 = llvm.mlir.addressof @MAX_EXP_LEN : !llvm.ptr
%1795 = llvm.load %1794 : !llvm.ptr -> i32
%1796 = arith.extsi %1795 : i32 to i64
%1797 = arith.constant 4 : i32
%1798 = arith.extsi %1797 : i32 to i64
%1793 = func.call @calloc(%1796, %1798) : (i64, i64) -> !llvm.ptr
%1799 = llvm.mlir.addressof @g_g_exps : !llvm.ptr
llvm.store %1793, %1799 : !llvm.ptr, !llvm.ptr
%1801 = llvm.mlir.addressof @MAX_REQ : !llvm.ptr
%1802 = llvm.load %1801 : !llvm.ptr -> i32
%1803 = arith.extsi %1802 : i32 to i64
%1804 = arith.constant 8 : i32
%1805 = arith.extsi %1804 : i32 to i64
%1800 = func.call @calloc(%1803, %1805) : (i64, i64) -> !llvm.ptr
%1806 = llvm.mlir.addressof @g_g_req_primes : !llvm.ptr
llvm.store %1800, %1806 : !llvm.ptr, !llvm.ptr
%1808 = llvm.mlir.addressof @MAX_REQ : !llvm.ptr
%1809 = llvm.load %1808 : !llvm.ptr -> i32
%1810 = arith.extsi %1809 : i32 to i64
%1811 = arith.constant 4 : i32
%1812 = arith.extsi %1811 : i32 to i64
%1807 = func.call @calloc(%1810, %1812) : (i64, i64) -> !llvm.ptr
%1813 = llvm.mlir.addressof @g_g_req_exps : !llvm.ptr
llvm.store %1807, %1813 : !llvm.ptr, !llvm.ptr
%1815 = llvm.mlir.addressof @MAX_EXP_LEN : !llvm.ptr
%1816 = llvm.load %1815 : !llvm.ptr -> i32
%1817 = arith.extsi %1816 : i32 to i64
%1818 = arith.constant 8 : i32
%1819 = arith.extsi %1818 : i32 to i64
%1814 = func.call @calloc(%1817, %1819) : (i64, i64) -> !llvm.ptr
%1820 = llvm.mlir.addressof @g_g_fillers : !llvm.ptr
llvm.store %1814, %1820 : !llvm.ptr, !llvm.ptr
func.call @sieve() : () -> ()
%1822 = arith.constant 0 : i32
%1823 = llvm.mlir.addressof @g_num_vecs : !llvm.ptr
llvm.store %1822, %1823 : i32, !llvm.ptr
%1824 = arith.constant 1 : i32
%1825 = arith.extsi %1824 : i32 to i128
%1826 = llvm.mlir.constant(1 : i64) : i64
%1827 = llvm.alloca %1826 x i128 : (i64) -> !llvm.ptr
llvm.store %1825, %1827 : i128, !llvm.ptr
%1828 = arith.constant 0 : i32
%1829 = llvm.mlir.addressof @g_num_lb_primes : !llvm.ptr
llvm.store %1828, %1829 : i32, !llvm.ptr
%1830 = arith.constant 0 : i32
%1831 = llvm.mlir.constant(1 : i64) : i64
%1832 = llvm.alloca %1831 x i32 : (i64) -> !llvm.ptr
llvm.store %1830, %1832 : i32, !llvm.ptr
cf.br ^bb261
^bb261:
%1833 = llvm.load %1832 : !llvm.ptr -> i32
%1834 = llvm.mlir.addressof @g_num_primes : !llvm.ptr
%1835 = llvm.load %1834 : !llvm.ptr -> i32
%1836 = arith.cmpi slt, %1833, %1835 : i32
cf.cond_br %1836, ^bb262, ^bb263
^bb262:
%1837 = llvm.load %1827 : !llvm.ptr -> i128
%1839 = llvm.mlir.addressof @g_primes : !llvm.ptr
%1840 = llvm.load %1839 : !llvm.ptr -> !llvm.ptr
%1841 = llvm.load %1832 : !llvm.ptr -> i32
%1842 = arith.extsi %1841 : i32 to i64
%1843 = llvm.getelementptr %1840[%1842] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1838 = llvm.load %1843 : !llvm.ptr -> i32
%1844 = arith.extsi %1838 : i32 to i128
%1846 = arith.trunci %1837 : i128 to i64
%1847 = arith.trunci %1844 : i128 to i64
%1845 = arith.muli %1846, %1847 : i64
%1848 = llvm.mlir.addressof @LIMIT : !llvm.ptr
%1849 = llvm.load %1848 : !llvm.ptr -> i64
%1850 = arith.extsi %1849 : i64 to i128
%1852 = arith.trunci %1850 : i128 to i64
%1851 = arith.cmpi sgt, %1845, %1852 : i64
cf.cond_br %1851, ^bb264, ^bb265
^bb264:
cf.br ^bb263
^bb265:
cf.br ^bb266
^bb266:
%1853 = llvm.load %1827 : !llvm.ptr -> i128
%1855 = llvm.mlir.addressof @g_primes : !llvm.ptr
%1856 = llvm.load %1855 : !llvm.ptr -> !llvm.ptr
%1857 = llvm.load %1832 : !llvm.ptr -> i32
%1858 = arith.extsi %1857 : i32 to i64
%1859 = llvm.getelementptr %1856[%1858] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1854 = llvm.load %1859 : !llvm.ptr -> i32
%1860 = arith.extsi %1854 : i32 to i128
%1862 = arith.trunci %1853 : i128 to i64
%1863 = arith.trunci %1860 : i128 to i64
%1861 = arith.muli %1862, %1863 : i64
%1864 = arith.extsi %1861 : i64 to i128
llvm.store %1864, %1827 : i128, !llvm.ptr
%1866 = llvm.mlir.addressof @g_primes : !llvm.ptr
%1867 = llvm.load %1866 : !llvm.ptr -> !llvm.ptr
%1868 = llvm.load %1832 : !llvm.ptr -> i32
%1869 = arith.extsi %1868 : i32 to i64
%1870 = llvm.getelementptr %1867[%1869] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1865 = llvm.load %1870 : !llvm.ptr -> i32
%1871 = llvm.mlir.addressof @g_lb_primes : !llvm.ptr
%1872 = llvm.load %1871 : !llvm.ptr -> !llvm.ptr
%1873 = llvm.mlir.addressof @g_num_lb_primes : !llvm.ptr
%1874 = llvm.load %1873 : !llvm.ptr -> i32
%1875 = arith.extsi %1874 : i32 to i64
%1876 = llvm.getelementptr %1872[%1875] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1865, %1876 : i32, !llvm.ptr
%1877 = llvm.mlir.addressof @g_num_lb_primes : !llvm.ptr
%1878 = llvm.load %1877 : !llvm.ptr -> i32
%1879 = arith.constant 1 : i32
%1880 = arith.addi %1878, %1879 : i32
%1881 = llvm.mlir.addressof @g_num_lb_primes : !llvm.ptr
llvm.store %1880, %1881 : i32, !llvm.ptr
%1882 = llvm.load %1832 : !llvm.ptr -> i32
%1883 = arith.constant 1 : i32
%1884 = arith.addi %1882, %1883 : i32
llvm.store %1884, %1832 : i32, !llvm.ptr
cf.br ^bb261
^bb263:
%1886 = arith.constant 0 : i32
%1887 = arith.constant 60 : i32
%1888 = arith.constant 1 : i32
%1889 = arith.extsi %1888 : i32 to i128
func.call @dfs_gen(%1886, %1887, %1889) : (i32, i32, i128) -> ()
%1891 = llvm.mlir.addressof @g_num_vecs : !llvm.ptr
%1892 = llvm.load %1891 : !llvm.ptr -> i32
%1893 = arith.constant 1 : i32
%1894 = arith.addi %1892, %1893 : i32
%1895 = arith.extsi %1894 : i32 to i64
%1896 = arith.constant 8 : i32
%1897 = arith.extsi %1896 : i32 to i64
%1890 = func.call @calloc(%1895, %1897) : (i64, i64) -> !llvm.ptr
%1899 = llvm.mlir.addressof @g_num_vecs : !llvm.ptr
%1900 = llvm.load %1899 : !llvm.ptr -> i32
%1901 = arith.constant 1 : i32
%1902 = arith.addi %1900, %1901 : i32
%1903 = arith.extsi %1902 : i32 to i64
%1904 = arith.constant 8 : i32
%1905 = arith.extsi %1904 : i32 to i64
%1898 = func.call @calloc(%1903, %1905) : (i64, i64) -> !llvm.ptr
%1906 = arith.constant 0 : i32
%1907 = llvm.mlir.constant(1 : i64) : i64
%1908 = llvm.alloca %1907 x i32 : (i64) -> !llvm.ptr
llvm.store %1906, %1908 : i32, !llvm.ptr
%1909 = arith.constant 1 : i32
%1910 = llvm.load %1908 : !llvm.ptr -> i32
%1911 = arith.extsi %1909 : i32 to i64
%1912 = arith.extsi %1910 : i32 to i64
%1913 = llvm.getelementptr %1890[%1912] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1911, %1913 : i64, !llvm.ptr
%1914 = arith.constant 1 : i32
%1915 = llvm.load %1908 : !llvm.ptr -> i32
%1916 = arith.extsi %1914 : i32 to i64
%1917 = arith.extsi %1915 : i32 to i64
%1918 = llvm.getelementptr %1898[%1917] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1916, %1918 : i64, !llvm.ptr
%1919 = llvm.load %1908 : !llvm.ptr -> i32
%1920 = arith.constant 1 : i32
%1921 = arith.addi %1919, %1920 : i32
llvm.store %1921, %1908 : i32, !llvm.ptr
%1923 = llvm.mlir.addressof @MAX_REQ : !llvm.ptr
%1924 = llvm.load %1923 : !llvm.ptr -> i32
%1925 = arith.extsi %1924 : i32 to i64
%1926 = arith.constant 8 : i32
%1927 = arith.extsi %1926 : i32 to i64
%1922 = func.call @calloc(%1925, %1927) : (i64, i64) -> !llvm.ptr
%1929 = llvm.mlir.addressof @MAX_REQ : !llvm.ptr
%1930 = llvm.load %1929 : !llvm.ptr -> i32
%1931 = arith.extsi %1930 : i32 to i64
%1932 = arith.constant 4 : i32
%1933 = arith.extsi %1932 : i32 to i64
%1928 = func.call @calloc(%1931, %1933) : (i64, i64) -> !llvm.ptr
%1934 = arith.constant 0 : i32
%1935 = llvm.mlir.constant(1 : i64) : i64
%1936 = llvm.alloca %1935 x i32 : (i64) -> !llvm.ptr
llvm.store %1934, %1936 : i32, !llvm.ptr
cf.br ^bb267
^bb267:
%1937 = llvm.load %1936 : !llvm.ptr -> i32
%1938 = llvm.mlir.addressof @g_num_vecs : !llvm.ptr
%1939 = llvm.load %1938 : !llvm.ptr -> i32
%1940 = arith.cmpi slt, %1937, %1939 : i32
cf.cond_br %1940, ^bb268, ^bb269
^bb268:
# String concatenation: !llvm.ptr + i32
%1943 = llvm.mlir.addressof @g_vec_len : !llvm.ptr
%1944 = llvm.load %1943 : !llvm.ptr -> !llvm.ptr
%1945 = llvm.load %1936 : !llvm.ptr -> i32
%1946 = arith.extsi %1945 : i32 to i64
%1947 = llvm.getelementptr %1944[%1946] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1942 = llvm.load %1947 : !llvm.ptr -> i32
%1948 = arith.constant 1 : i32
%1949 = arith.extsi %1948 : i32 to i64
%1950 = llvm.mlir.constant(1 : i64) : i64
%1951 = llvm.alloca %1950 x i64 : (i64) -> !llvm.ptr
llvm.store %1949, %1951 : i64, !llvm.ptr
%1952 = arith.constant 0 : i32
%1953 = llvm.mlir.constant(1 : i64) : i64
%1954 = llvm.alloca %1953 x i32 : (i64) -> !llvm.ptr
llvm.store %1952, %1954 : i32, !llvm.ptr
%1955 = arith.constant 0 : i32
%1956 = llvm.mlir.constant(1 : i64) : i64
%1957 = llvm.alloca %1956 x i32 : (i64) -> !llvm.ptr
llvm.store %1955, %1957 : i32, !llvm.ptr
cf.br ^bb270
^bb270:
%1958 = llvm.load %1957 : !llvm.ptr -> i32
%1959 = arith.cmpi slt, %1958, %1942 : i32
cf.cond_br %1959, ^bb271, ^bb272
^bb271:
%1961 = llvm.load %1957 : !llvm.ptr -> i32
%1962 = arith.extsi %1961 : i32 to i64
%1963 = llvm.getelementptr %1941[%1962] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1960 = llvm.load %1963 : !llvm.ptr -> i32
%1964 = arith.constant 1 : i32
%1965 = arith.addi %1960, %1964 : i32
%1966 = llvm.load %1951 : !llvm.ptr -> i64
%1967 = arith.extsi %1965 : i32 to i64
%1968 = arith.muli %1966, %1967 : i64
llvm.store %1968, %1951 : i64, !llvm.ptr
func.call @factorize_small(%1965) : (i32) -> ()
%1970 = arith.constant 0 : i32
%1971 = llvm.mlir.constant(1 : i64) : i64
%1972 = llvm.alloca %1971 x i32 : (i64) -> !llvm.ptr
llvm.store %1970, %1972 : i32, !llvm.ptr
cf.br ^bb273
^bb273:
%1973 = llvm.load %1972 : !llvm.ptr -> i32
%1974 = llvm.mlir.addressof @g_fac_count : !llvm.ptr
%1975 = llvm.load %1974 : !llvm.ptr -> i32
%1976 = arith.cmpi slt, %1973, %1975 : i32
cf.cond_br %1976, ^bb274, ^bb275
^bb274:
%1978 = llvm.mlir.addressof @g_fac_primes : !llvm.ptr
%1979 = llvm.load %1978 : !llvm.ptr -> !llvm.ptr
%1980 = llvm.load %1972 : !llvm.ptr -> i32
%1981 = arith.extsi %1980 : i32 to i64
%1982 = llvm.getelementptr %1979[%1981] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1977 = llvm.load %1982 : !llvm.ptr -> i32
%1984 = llvm.mlir.addressof @g_fac_exps : !llvm.ptr
%1985 = llvm.load %1984 : !llvm.ptr -> !llvm.ptr
%1986 = llvm.load %1972 : !llvm.ptr -> i32
%1987 = arith.extsi %1986 : i32 to i64
%1988 = llvm.getelementptr %1985[%1987] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%1983 = llvm.load %1988 : !llvm.ptr -> i32
%1989 = arith.constant 1 : i32
%1991 = arith.constant 0 : i32
%1990 = arith.subi %1991, %1989 : i32
%1992 = llvm.mlir.constant(1 : i64) : i64
%1993 = llvm.alloca %1992 x i32 : (i64) -> !llvm.ptr
llvm.store %1990, %1993 : i32, !llvm.ptr
%1994 = arith.constant 0 : i32
%1995 = llvm.mlir.constant(1 : i64) : i64
%1996 = llvm.alloca %1995 x i32 : (i64) -> !llvm.ptr
llvm.store %1994, %1996 : i32, !llvm.ptr
cf.br ^bb276
^bb276:
%1997 = llvm.load %1996 : !llvm.ptr -> i32
%1998 = llvm.load %1954 : !llvm.ptr -> i32
%1999 = arith.cmpi slt, %1997, %1998 : i32
cf.cond_br %1999, ^bb277, ^bb278
^bb277:
%2001 = llvm.load %1996 : !llvm.ptr -> i32
%2002 = arith.extsi %2001 : i32 to i64
%2003 = llvm.getelementptr %1922[%2002] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%2000 = llvm.load %2003 : !llvm.ptr -> i64
%2004 = arith.extsi %1977 : i32 to i64
%2005 = arith.cmpi eq, %2000, %2004 : i64
cf.cond_br %2005, ^bb279, ^bb280
^bb279:
%2006 = llvm.load %1996 : !llvm.ptr -> i32
llvm.store %2006, %1993 : i32, !llvm.ptr
cf.br ^bb278
^bb280:
cf.br ^bb281
^bb281:
%2007 = llvm.load %1996 : !llvm.ptr -> i32
%2008 = arith.constant 1 : i32
%2009 = arith.addi %2007, %2008 : i32
llvm.store %2009, %1996 : i32, !llvm.ptr
cf.br ^bb276
^bb278:
%2010 = llvm.load %1993 : !llvm.ptr -> i32
%2011 = arith.constant 0 : i32
%2012 = arith.cmpi sge, %2010, %2011 : i32
cf.cond_br %2012, ^bb282, ^bb283
^bb282:
%2014 = llvm.load %1993 : !llvm.ptr -> i32
%2015 = arith.extsi %2014 : i32 to i64
%2016 = llvm.getelementptr %1928[%2015] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%2013 = llvm.load %2016 : !llvm.ptr -> i32
%2017 = arith.addi %2013, %1983 : i32
%2018 = llvm.load %1993 : !llvm.ptr -> i32
%2019 = arith.extsi %2018 : i32 to i64
%2020 = llvm.getelementptr %1928[%2019] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %2017, %2020 : i32, !llvm.ptr
cf.br ^bb284
^bb283:
%2021 = arith.extsi %1977 : i32 to i64
%2022 = llvm.load %1954 : !llvm.ptr -> i32
%2023 = arith.extsi %2022 : i32 to i64
%2024 = llvm.getelementptr %1922[%2023] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %2021, %2024 : i64, !llvm.ptr
%2025 = llvm.load %1954 : !llvm.ptr -> i32
%2026 = arith.extsi %2025 : i32 to i64
%2027 = llvm.getelementptr %1928[%2026] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %1983, %2027 : i32, !llvm.ptr
%2028 = llvm.load %1954 : !llvm.ptr -> i32
%2029 = arith.constant 1 : i32
%2030 = arith.addi %2028, %2029 : i32
llvm.store %2030, %1954 : i32, !llvm.ptr
cf.br ^bb284
^bb284:
%2031 = llvm.load %1972 : !llvm.ptr -> i32
%2032 = arith.constant 1 : i32
%2033 = arith.addi %2031, %2032 : i32
llvm.store %2033, %1972 : i32, !llvm.ptr
cf.br ^bb273
^bb275:
%2034 = llvm.load %1957 : !llvm.ptr -> i32
%2035 = arith.constant 1 : i32
%2036 = arith.addi %2034, %2035 : i32
llvm.store %2036, %1957 : i32, !llvm.ptr
cf.br ^bb270
^bb272:
%2038 = llvm.load %1954 : !llvm.ptr -> i32
%2037 = func.call @min_tau_number(%1941, %1942, %1922, %1928, %2038) : (!llvm.ptr, i32, !llvm.ptr, !llvm.ptr, i32) -> i64
%2039 = arith.constant 0 : i32
%2041 = arith.extsi %2039 : i32 to i64
%2040 = arith.cmpi sgt, %2037, %2041 : i64
%2042 = scf.if %2040 -> (i1) {
%2043 = llvm.mlir.addressof @LIMIT : !llvm.ptr
%2044 = llvm.load %2043 : !llvm.ptr -> i64
%2045 = arith.cmpi sle, %2037, %2044 : i64
scf.yield %2045 : i1
} else {
%2046 = arith.constant false
scf.yield %2046 : i1
}
cf.cond_br %2042, ^bb285, ^bb286
^bb285:
%2047 = llvm.load %1951 : !llvm.ptr -> i64
%2048 = llvm.load %1908 : !llvm.ptr -> i32
%2049 = arith.extsi %2048 : i32 to i64
%2050 = llvm.getelementptr %1890[%2049] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %2047, %2050 : i64, !llvm.ptr
%2051 = llvm.load %1908 : !llvm.ptr -> i32
%2052 = arith.extsi %2051 : i32 to i64
%2053 = llvm.getelementptr %1898[%2052] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %2037, %2053 : i64, !llvm.ptr
%2054 = llvm.load %1908 : !llvm.ptr -> i32
%2055 = arith.constant 1 : i32
%2056 = arith.addi %2054, %2055 : i32
llvm.store %2056, %1908 : i32, !llvm.ptr
cf.br ^bb287
^bb286:
cf.br ^bb287
^bb287:
%2057 = llvm.load %1936 : !llvm.ptr -> i32
%2058 = arith.constant 1 : i32
%2059 = arith.addi %2057, %2058 : i32
llvm.store %2059, %1936 : i32, !llvm.ptr
cf.br ^bb267
^bb269:
%2061 = llvm.load %1908 : !llvm.ptr -> i32
func.call @kn_heapsort(%1890, %1898, %2061) : (!llvm.ptr, !llvm.ptr, i32) -> ()
%2062 = arith.constant 0 : i32
%2063 = arith.extsi %2062 : i32 to i128
%2064 = llvm.mlir.constant(1 : i64) : i64
%2065 = llvm.alloca %2064 x i128 : (i64) -> !llvm.ptr
llvm.store %2063, %2065 : i128, !llvm.ptr
%2066 = arith.constant 1 : i32
%2068 = arith.constant 0 : i32
%2067 = arith.subi %2068, %2066 : i32
%2069 = arith.extsi %2067 : i32 to i64
%2070 = llvm.mlir.constant(1 : i64) : i64
%2071 = llvm.alloca %2070 x i64 : (i64) -> !llvm.ptr
llvm.store %2069, %2071 : i64, !llvm.ptr
%2072 = arith.constant 0 : i32
%2073 = llvm.mlir.constant(1 : i64) : i64
%2074 = llvm.alloca %2073 x i32 : (i64) -> !llvm.ptr
llvm.store %2072, %2074 : i32, !llvm.ptr
cf.br ^bb288
^bb288:
%2075 = llvm.load %2074 : !llvm.ptr -> i32
%2076 = llvm.load %1908 : !llvm.ptr -> i32
%2077 = arith.cmpi slt, %2075, %2076 : i32
cf.cond_br %2077, ^bb289, ^bb290
^bb289:
%2079 = llvm.load %2074 : !llvm.ptr -> i32
%2080 = arith.extsi %2079 : i32 to i64
%2081 = llvm.getelementptr %1890[%2080] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%2078 = llvm.load %2081 : !llvm.ptr -> i64
%2082 = llvm.load %2071 : !llvm.ptr -> i64
%2083 = arith.cmpi ne, %2078, %2082 : i64
cf.cond_br %2083, ^bb291, ^bb292
^bb291:
%2084 = llvm.load %2065 : !llvm.ptr -> i128
%2086 = llvm.load %2074 : !llvm.ptr -> i32
%2087 = arith.extsi %2086 : i32 to i64
%2088 = llvm.getelementptr %1898[%2087] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%2085 = llvm.load %2088 : !llvm.ptr -> i64
%2089 = arith.extsi %2085 : i64 to i128
%2091 = arith.trunci %2084 : i128 to i64
%2092 = arith.trunci %2089 : i128 to i64
%2090 = arith.addi %2091, %2092 : i64
%2093 = arith.extsi %2090 : i64 to i128
llvm.store %2093, %2065 : i128, !llvm.ptr
%2095 = llvm.load %2074 : !llvm.ptr -> i32
%2096 = arith.extsi %2095 : i32 to i64
%2097 = llvm.getelementptr %1890[%2096] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%2094 = llvm.load %2097 : !llvm.ptr -> i64
llvm.store %2094, %2071 : i64, !llvm.ptr
cf.br ^bb293
^bb292:
cf.br ^bb293
^bb293:
%2098 = llvm.load %2074 : !llvm.ptr -> i32
%2099 = arith.constant 1 : i32
%2100 = arith.addi %2098, %2099 : i32
llvm.store %2100, %2074 : i32, !llvm.ptr
cf.br ^bb288
^bb290:
%2101 = llvm.mlir.addressof @str_0 : !llvm.ptr
%2102 = llvm.load %2065 : !llvm.ptr -> i128
%2103 = arith.trunci %2102 : i128 to i64
%2104 = llvm.call @printf(%2101, %2103) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
%2105 = arith.constant 0 : i32
func.return %2105 : i32
}
}