Problem 923
DP with hot types and int types, modular arithmetic.
View problem on Project Euler
Performance comparison
| Metric | Our solution | Best known |
| Time complexity | O(n^5) | O(log n) |
| Space complexity | O(n^2) | O(1) |
| Approach | Flow solution | Modular exponentiation |
| Verdict | Unknown |
Flow source
# Project Euler 923
# DP with hot types and int types, modular arithmetic.
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>
}
const MOD: i64 = 1000000007
const M: i32 = 8
const W: i32 = 64
const SUM_OFF: i32 = 2000
const SUM_RNG: i32 = 4001
# powmod
function powmod(a0: i64, b0: i64, m: i64) -> i64 {
let mut r: i64 = 1
let mut a: i64 = a0 % m
if a < 0 { a = a + m }
let mut b: i64 = b0
while b > 0 {
if (b & 1) == 1 {
let aw: i128 = r as i128
let bw: i128 = a as i128
let mw: i128 = m as i128
r = ((aw * bw) % mw) as i64
}
let aw2: i128 = a as i128
let bw2: i128 = a as i128
let mw2: i128 = m as i128
a = ((aw2 * bw2) % mw2) as i64
b = b >> 1
}
return r
}
# reduced_hook: compute Mv and Nv
# Returns Mv via g_mv_out, Nv via g_nv_out
let mut g_mv_out: i64 = 0
let mut g_nv_out: i64 = 0
function reduced_hook(a: i64, b: i64, k: i64) -> void {
let mut d: i64 = 0
let mut j: i64 = 0
while j < k {
let row_len: i64 = (k - j) * b
let start: i64 = j * a + 1
if row_len >= start {
let endv: i64 = (j + 1) * a
let cand: i64 = endv
if row_len < endv { cand = row_len }
if cand > d { d = cand }
}
j = j + 1
}
let block_of_row_d: i64 = (d - 1) / a
let lambda_d: i64 = (k - block_of_row_d) * b
let mv: i64 = lambda_d - d + 1
let need_blocks: i64 = (d + b - 1) / b
let last_block: i64 = k - need_blocks
let col_height: i64 = (last_block + 1) * a
let nv: i64 = col_height - d + 1
g_mv_out = mv
g_nv_out = nv
}
# collect_counts globals
let mut g_int_counts: ptr<i64> = null # [2001]
let mut g_int_vals: ptr<i64> = null # [2001]
let mut g_num_int_vals: i32 = 0
# hot types (after dedup)
let mut g_hot_t: ptr<i64> = null # [2000]
let mut g_hot_r: ptr<i64> = null # [2000]
let mut g_hot_count: ptr<i64> = null # [2000]
let mut g_num_hot_types: i32 = 0
# temp hot (before dedup)
let mut g_temp_t: ptr<i64> = null # [50000]
let mut g_temp_r: ptr<i64> = null # [50000]
let mut g_temp_count: ptr<i64> = null # [50000]
let mut g_temp_n: i32 = 0
# heapsort for temp_hot: sort by t descending, then R ascending
function sift_down(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 {
# compare: want "largest" = one that should come first in sort order
# sort order: t descending, R ascending
# "largest" in heap = "should come last" = smallest t, or same t and largest R
let tl: i64 = g_temp_t[left]
let tr: i64 = g_temp_t[largest]
if tl < tr {
largest = left
} else {
if tl == tr {
if g_temp_r[left] > g_temp_r[largest] {
largest = left
}
}
}
}
if right < n {
let tr2: i64 = g_temp_t[right]
let tl2: i64 = g_temp_t[largest]
if tr2 < tl2 {
largest = right
} else {
if tr2 == tl2 {
if g_temp_r[right] > g_temp_r[largest] {
largest = right
}
}
}
}
if largest == root { return }
# swap
let tt: i64 = g_temp_t[root]
g_temp_t[root] = g_temp_t[largest]
g_temp_t[largest] = tt
let tr3: i64 = g_temp_r[root]
g_temp_r[root] = g_temp_r[largest]
g_temp_r[largest] = tr3
let tc: i64 = g_temp_count[root]
g_temp_count[root] = g_temp_count[largest]
g_temp_count[largest] = tc
root = largest
}
}
function heapsort_temp(n: i32) -> void {
# Build heap
let mut i: i32 = n / 2 - 1
while i >= 0 {
sift_down(n, i)
i = i - 1
}
# Extract
let mut j: i32 = n - 1
while j > 0 {
# swap root and j
let tt: i64 = g_temp_t[0]
g_temp_t[0] = g_temp_t[j]
g_temp_t[j] = tt
let tr: i64 = g_temp_r[0]
g_temp_r[0] = g_temp_r[j]
g_temp_r[j] = tr
let tc: i64 = g_temp_count[0]
g_temp_count[0] = g_temp_count[j]
g_temp_count[j] = tc
sift_down(j, 0)
j = j - 1
}
}
function collect_counts() -> void {
memset(g_int_counts as ptr<void>, 0, 2001 * 8)
g_temp_n = 0
let mut a: i64 = 1
while a < W as i64 - 1 {
let mut b: i64 = 1
while b < W as i64 - a {
let max_k: i64 = W as i64 - a - b
if max_k >= 1 {
let mut k: i64 = 1
while k <= max_k {
reduced_hook(a, b, k)
let mv: i64 = g_mv_out
let nv: i64 = g_nv_out
if nv == 1 {
let v: i64 = mv - 1
g_int_counts[v + 1000] = g_int_counts[v + 1000] + 1
} else {
if mv == 1 {
let v2: i64 = -(nv - 1)
g_int_counts[v2 + 1000] = g_int_counts[v2 + 1000] + 1
} else {
let t: i64 = mv + nv - 4
let r: i64 = -(nv - 2)
g_temp_t[g_temp_n] = t
g_temp_r[g_temp_n] = r
g_temp_count[g_temp_n] = 1
g_temp_n = g_temp_n + 1
}
}
k = k + 1
}
}
b = b + 1
}
a = a + 1
}
# Sort temp_hot by (t descending, R ascending)
heapsort_temp(g_temp_n)
# Dedup
g_num_hot_types = 0
let mut i: i32 = 0
while i < g_temp_n {
if g_num_hot_types > 0 {
if g_hot_t[g_num_hot_types - 1] == g_temp_t[i] && g_hot_r[g_num_hot_types - 1] == g_temp_r[i] {
g_hot_count[g_num_hot_types - 1] = g_hot_count[g_num_hot_types - 1] + 1
} else {
g_hot_t[g_num_hot_types] = g_temp_t[i]
g_hot_r[g_num_hot_types] = g_temp_r[i]
g_hot_count[g_num_hot_types] = g_temp_count[i]
g_num_hot_types = g_num_hot_types + 1
}
} else {
g_hot_t[g_num_hot_types] = g_temp_t[i]
g_hot_r[g_num_hot_types] = g_temp_r[i]
g_hot_count[g_num_hot_types] = g_temp_count[i]
g_num_hot_types = g_num_hot_types + 1
}
i = i + 1
}
# Collect int vals
g_num_int_vals = 0
let mut v: i32 = -1000
while v <= 1000 {
if g_int_counts[v + 1000] > 0 {
g_int_vals[g_num_int_vals] = v as i64
g_num_int_vals = g_num_int_vals + 1
}
v = v + 1
}
}
# DP arrays
# hot_a[9][2][SUM_RNG], hot_b[9][2][SUM_RNG] -> flat: 9*2*4001
# int_a[9][SUM_RNG], int_b[9][SUM_RNG] -> flat: 9*4001
let mut g_hot_a: ptr<i64> = null
let mut g_hot_b: ptr<i64> = null
let mut g_int_a: ptr<i64> = null
let mut g_int_b: ptr<i64> = null
# min/max tracking
let mut g_hot_min_a: ptr<i64> = null # [9][2]
let mut g_hot_max_a: ptr<i64> = null
let mut g_hot_min_b: ptr<i64> = null
let mut g_hot_max_b: ptr<i64> = null
let mut g_int_min_a: ptr<i64> = null # [9]
let mut g_int_max_a: ptr<i64> = null
let mut g_int_min_b: ptr<i64> = null
let mut g_int_max_b: ptr<i64> = null
function main() -> i32 {
# Allocate arrays
g_int_counts = calloc(2001, 8)
g_int_vals = calloc(2001, 8)
g_hot_t = calloc(2000, 8)
g_hot_r = calloc(2000, 8)
g_hot_count = calloc(2000, 8)
g_temp_t = calloc(50000, 8)
g_temp_r = calloc(50000, 8)
g_temp_count = calloc(50000, 8)
let hot_sz: i64 = 9 * 2 * SUM_RNG as i64
g_hot_a = calloc(hot_sz, 8)
g_hot_b = calloc(hot_sz, 8)
let int_sz: i64 = 9 * SUM_RNG as i64
g_int_a = calloc(int_sz, 8)
g_int_b = calloc(int_sz, 8)
g_hot_min_a = calloc(18, 8)
g_hot_max_a = calloc(18, 8)
g_hot_min_b = calloc(18, 8)
g_hot_max_b = calloc(18, 8)
g_int_min_a = calloc(9, 8)
g_int_max_a = calloc(9, 8)
g_int_min_b = calloc(9, 8)
g_int_max_b = calloc(9, 8)
# Factorials and inverse factorials
let fact: ptr<i64> = calloc(10, 8)
let invfact: ptr<i64> = calloc(10, 8)
fact[0] = 1
let mut i: i32 = 1
while i <= M {
fact[i] = fact[i - 1] * (i as i64) % MOD
i = i + 1
}
invfact[M] = powmod(fact[M], MOD - 2, MOD)
let mut j: i32 = M
while j >= 1 {
invfact[j - 1] = invfact[j] * (j as i64) % MOD
j = j - 1
}
collect_counts()
# Hot DP
memset(g_hot_a as ptr<void>, 0, hot_sz * 8)
let mut u: i32 = 0
while u <= M {
let mut p: i32 = 0
while p < 2 {
g_hot_min_a[u * 2 + p] = SUM_RNG as i64
g_hot_max_a[u * 2 + p] = -1
p = p + 1
}
u = u + 1
}
g_hot_a[0 * 2 * SUM_RNG + 0 * SUM_RNG + SUM_OFF] = 1
g_hot_min_a[0 * 2 + 0] = SUM_OFF as i64
g_hot_max_a[0 * 2 + 0] = SUM_OFF as i64
let mut ht: i32 = 0
while ht < g_num_hot_types {
let t: i64 = g_hot_t[ht]
let r: i64 = g_hot_r[ht]
let c: i64 = g_hot_count[ht]
# poly[0..M]
let poly: ptr<i64> = calloc(10, 8)
poly[0] = 1
let mut p: i64 = 1
let mut kk: i32 = 1
while kk <= M {
p = p * c % MOD
poly[kk] = p * invfact[kk] % MOD
kk = kk + 1
}
memset(g_hot_b as ptr<void>, 0, hot_sz * 8)
let mut u2: i32 = 0
while u2 <= M {
let mut p2: i32 = 0
while p2 < 2 {
g_hot_min_b[u2 * 2 + p2] = SUM_RNG as i64
g_hot_max_b[u2 * 2 + p2] = -1
p2 = p2 + 1
}
u2 = u2 + 1
}
let mut used: i32 = 0
while used <= M {
let mut parity: i32 = 0
while parity < 2 {
if g_hot_max_a[used * 2 + parity] >= 0 {
let mn: i64 = g_hot_min_a[used * 2 + parity]
let mx: i64 = g_hot_max_a[used * 2 + parity]
let mut idx: i64 = mn
while idx <= mx {
let coeff: i64 = g_hot_a[used * 2 * SUM_RNG + parity * SUM_RNG + idx]
if coeff != 0 {
let mut k: i32 = 0
while k <= M - used {
let mult: i64 = poly[k]
if mult != 0 {
let right_turns: i64 = ((k as i64) + 1 - parity as i64) / 2
let delta: i64 = (k as i64) * r + right_turns * t
let nu: i32 = used + k
let np: i32 = parity ^ (k & 1)
let nidx: i64 = idx + delta
if nidx >= 0 && nidx < SUM_RNG as i64 {
let aw: i128 = g_hot_b[nu * 2 * SUM_RNG + np * SUM_RNG + nidx] as i128
let bw: i128 = coeff as i128
let cw: i128 = mult as i128
let mw: i128 = MOD as i128
g_hot_b[nu * 2 * SUM_RNG + np * SUM_RNG + nidx] = ((aw + bw * cw) % mw) as i64
if nidx < g_hot_min_b[nu * 2 + np] { g_hot_min_b[nu * 2 + np] = nidx }
if nidx > g_hot_max_b[nu * 2 + np] { g_hot_max_b[nu * 2 + np] = nidx }
}
}
k = k + 1
}
}
idx = idx + 1
}
}
parity = parity + 1
}
used = used + 1
}
memcpy(g_hot_a as ptr<void>, g_hot_b as ptr<void>, hot_sz * 8)
memcpy(g_hot_min_a as ptr<void>, g_hot_min_b as ptr<void>, 18 * 8)
memcpy(g_hot_max_a as ptr<void>, g_hot_max_b as ptr<void>, 18 * 8)
free(poly)
ht = ht + 1
}
# Int DP
memset(g_int_a as ptr<void>, 0, int_sz * 8)
let mut u3: i32 = 0
while u3 <= M {
g_int_min_a[u3] = SUM_RNG as i64
g_int_max_a[u3] = -1
u3 = u3 + 1
}
g_int_a[0 * SUM_RNG + SUM_OFF] = 1
g_int_min_a[0] = SUM_OFF as i64
g_int_max_a[0] = SUM_OFF as i64
let mut iv: i32 = 0
while iv < g_num_int_vals {
let v: i64 = g_int_vals[iv]
let c: i64 = g_int_counts[v + 1000]
let poly2: ptr<i64> = calloc(10, 8)
poly2[0] = 1
let mut p2: i64 = 1
let mut kk2: i32 = 1
while kk2 <= M {
p2 = p2 * c % MOD
poly2[kk2] = p2 * invfact[kk2] % MOD
kk2 = kk2 + 1
}
memset(g_int_b as ptr<void>, 0, int_sz * 8)
let mut u4: i32 = 0
while u4 <= M {
g_int_min_b[u4] = SUM_RNG as i64
g_int_max_b[u4] = -1
u4 = u4 + 1
}
let mut used2: i32 = 0
while used2 <= M {
if g_int_max_a[used2] >= 0 {
let mn2: i64 = g_int_min_a[used2]
let mx2: i64 = g_int_max_a[used2]
let mut idx2: i64 = mn2
while idx2 <= mx2 {
let coeff2: i64 = g_int_a[used2 * SUM_RNG + idx2]
if coeff2 != 0 {
let mut k2: i32 = 0
while k2 <= M - used2 {
let mult2: i64 = poly2[k2]
if mult2 != 0 {
let nu2: i32 = used2 + k2
let nidx2: i64 = idx2 + (k2 as i64) * v
if nidx2 >= 0 && nidx2 < SUM_RNG as i64 {
let aw2: i128 = g_int_b[nu2 * SUM_RNG + nidx2] as i128
let bw2: i128 = coeff2 as i128
let cw2: i128 = mult2 as i128
let mw2: i128 = MOD as i128
g_int_b[nu2 * SUM_RNG + nidx2] = ((aw2 + bw2 * cw2) % mw2) as i64
if nidx2 < g_int_min_b[nu2] { g_int_min_b[nu2] = nidx2 }
if nidx2 > g_int_max_b[nu2] { g_int_max_b[nu2] = nidx2 }
}
}
k2 = k2 + 1
}
}
idx2 = idx2 + 1
}
}
used2 = used2 + 1
}
memcpy(g_int_a as ptr<void>, g_int_b as ptr<void>, int_sz * 8)
memcpy(g_int_min_a as ptr<void>, g_int_min_b as ptr<void>, 9 * 8)
memcpy(g_int_max_a as ptr<void>, g_int_max_b as ptr<void>, 9 * 8)
free(poly2)
iv = iv + 1
}
# Combine
let mut multiset_count: i64 = 0
let mut j2: i32 = 0
while j2 <= M {
let mut parity2: i32 = 0
while parity2 < 2 {
if g_hot_max_a[j2 * 2 + parity2] >= 0 {
if g_int_max_a[M - j2] >= 0 {
let hmn: i64 = g_hot_min_a[j2 * 2 + parity2]
let hmx: i64 = g_hot_max_a[j2 * 2 + parity2]
let mut hidx: i64 = hmn
while hidx <= hmx {
let ch: i64 = g_hot_a[j2 * 2 * SUM_RNG + parity2 * SUM_RNG + hidx]
if ch != 0 {
let imn: i64 = g_int_min_a[M - j2]
let imx: i64 = g_int_max_a[M - j2]
let mut iidx: i64 = imn
while iidx <= imx {
let ci: i64 = g_int_a[(M - j2) * SUM_RNG + iidx]
if ci != 0 {
let total: i64 = (hidx - SUM_OFF as i64) + (iidx - SUM_OFF as i64)
if total > 0 {
let aw3: i128 = multiset_count as i128
let bw3: i128 = ch as i128
let cw3: i128 = ci as i128
let mw3: i128 = MOD as i128
multiset_count = ((aw3 + bw3 * cw3) % mw3) as i64
} else {
if total == 0 {
if parity2 == 1 {
let aw4: i128 = multiset_count as i128
let bw4: i128 = ch as i128
let cw4: i128 = ci as i128
let mw4: i128 = MOD as i128
multiset_count = ((aw4 + bw4 * cw4) % mw4) as i64
}
}
}
}
iidx = iidx + 1
}
}
hidx = hidx + 1
}
}
}
parity2 = parity2 + 1
}
j2 = j2 + 1
}
let result: i64 = multiset_count * fact[M] % MOD
printf("%lld\n", result)
return 0
}
Generated C
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
while (flow_temp_head) {
flow_temp_node* n = flow_temp_head;
flow_temp_head = n->next;
free(n);
}
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
if (!node) return NULL;
node->next = flow_temp_head;
flow_temp_head = node;
if (!flow_temp_atexit_set) {
flow_temp_atexit_set = 1;
atexit(flow_temp_free_all);
}
return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
char* r = (char*)flow_temp_alloc(la + lb + 1);
if (!r) return NULL;
if (la) memcpy(r, a, la);
if (lb) memcpy(r + la, b, lb);
r[la + lb] = '\0';
return r;
}
#define __flow_in_arr(arr, val) __extension__ ({ \
int _found = 0; \
size_t _n = sizeof(arr)/sizeof((arr)[0]); \
for (size_t _i = 0; _i < _n; _i++) { \
if ((arr)[_i] == (val)) { _found = 1; break; } \
} _found; })
/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
abort();
#if defined(__GNUC__) || defined(__clang__)
__builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")
#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#include <math.h>
void* _ui_state = NULL;
static inline float i32_to_f32(int32_t v) { return (float)v; }
/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }
int64_t powmod_i64_i64_i64(int64_t a0, int64_t b0, int64_t m);
void reduced_hook_i64_i64_i64(int64_t a, int64_t b, int64_t k);
void sift_down_i32_i32(int32_t n, int32_t i);
void heapsort_temp_i32(int32_t n);
void collect_counts(void);
int32_t main(void);
static const int64_t MOD = 1000000007;
static const int32_t M = 8;
static const int32_t W = 64;
static const int32_t SUM_OFF = 2000;
static const int32_t SUM_RNG = 4001;
/* Module statics */
static int64_t g_mv_out = 0;
static int64_t g_nv_out = 0;
static int64_t* g_int_counts = NULL;
static int64_t* g_int_vals = NULL;
static int32_t g_num_int_vals = 0;
static int64_t* g_hot_t = NULL;
static int64_t* g_hot_r = NULL;
static int64_t* g_hot_count = NULL;
static int32_t g_num_hot_types = 0;
static int64_t* g_temp_t = NULL;
static int64_t* g_temp_r = NULL;
static int64_t* g_temp_count = NULL;
static int32_t g_temp_n = 0;
static int64_t* g_hot_a = NULL;
static int64_t* g_hot_b = NULL;
static int64_t* g_int_a = NULL;
static int64_t* g_int_b = NULL;
static int64_t* g_hot_min_a = NULL;
static int64_t* g_hot_max_a = NULL;
static int64_t* g_hot_min_b = NULL;
static int64_t* g_hot_max_b = NULL;
static int64_t* g_int_min_a = NULL;
static int64_t* g_int_max_a = NULL;
static int64_t* g_int_min_b = NULL;
static int64_t* g_int_max_b = NULL;
int64_t powmod_i64_i64_i64(int64_t a0, int64_t b0, int64_t m) {
int64_t r = 1;
int64_t a = FLOW_CHECKED_MOD((a0), (m));
if (a < 0) {
a = (a + m);
}
int64_t b = b0;
while (b > 0) {
if ((b & 1) == 1) {
__int128 aw = ((__int128)(r));
__int128 bw = ((__int128)(a));
__int128 mw = ((__int128)(m));
r = ((int64_t)(FLOW_CHECKED_MOD(((aw * bw)), (mw))));
}
__int128 aw2 = ((__int128)(a));
__int128 bw2 = ((__int128)(a));
__int128 mw2 = ((__int128)(m));
a = ((int64_t)(FLOW_CHECKED_MOD(((aw2 * bw2)), (mw2))));
b = FLOW_CHECKED_SHR((b), (1));
}
return r;
}
void reduced_hook_i64_i64_i64(int64_t a, int64_t b, int64_t k) {
int64_t d = 0;
int64_t j = 0;
while (j < k) {
int64_t row_len = ((k - j) * b);
int64_t start = ((j * a) + 1);
if (row_len >= start) {
int64_t endv = ((j + 1) * a);
int64_t cand = endv;
if (row_len < endv) {
cand = row_len;
}
if (cand > d) {
d = cand;
}
}
j = (j + 1);
}
int64_t block_of_row_d = FLOW_CHECKED_DIV(((d - 1)), (a));
int64_t lambda_d = ((k - block_of_row_d) * b);
int64_t mv = ((lambda_d - d) + 1);
int64_t need_blocks = FLOW_CHECKED_DIV((((d + b) - 1)), (b));
int64_t last_block = (k - need_blocks);
int64_t col_height = ((last_block + 1) * a);
int64_t nv = ((col_height - d) + 1);
g_mv_out = mv;
g_nv_out = nv;
}
void sift_down_i32_i32(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) {
int64_t tl = g_temp_t[left];
int64_t tr = g_temp_t[largest];
if (tl < tr) {
largest = left;
} else {
if (tl == tr) {
if (g_temp_r[left] > g_temp_r[largest]) {
largest = left;
}
}
}
}
if (right < n) {
int64_t tr2 = g_temp_t[right];
int64_t tl2 = g_temp_t[largest];
if (tr2 < tl2) {
largest = right;
} else {
if (tr2 == tl2) {
if (g_temp_r[right] > g_temp_r[largest]) {
largest = right;
}
}
}
}
if (largest == root) {
return;
}
int64_t tt = g_temp_t[root];
g_temp_t[root] = g_temp_t[largest];
g_temp_t[largest] = tt;
int64_t tr3 = g_temp_r[root];
g_temp_r[root] = g_temp_r[largest];
g_temp_r[largest] = tr3;
int64_t tc = g_temp_count[root];
g_temp_count[root] = g_temp_count[largest];
g_temp_count[largest] = tc;
root = largest;
}
}
void heapsort_temp_i32(int32_t n) {
int32_t i = (FLOW_CHECKED_DIV((n), (2)) - 1);
while (i >= 0) {
sift_down_i32_i32(n, i);
i = (i - 1);
}
int32_t j = (n - 1);
while (j > 0) {
int64_t tt = g_temp_t[0];
g_temp_t[0] = g_temp_t[j];
g_temp_t[j] = tt;
int64_t tr = g_temp_r[0];
g_temp_r[0] = g_temp_r[j];
g_temp_r[j] = tr;
int64_t tc = g_temp_count[0];
g_temp_count[0] = g_temp_count[j];
g_temp_count[j] = tc;
sift_down_i32_i32(j, 0);
j = (j - 1);
}
}
void collect_counts(void) {
memset(((void*)(g_int_counts)), 0, (2001 * 8));
g_temp_n = 0;
int64_t a = 1;
while (a < (((int64_t)(W)) - 1)) {
int64_t b = 1;
while (b < (((int64_t)(W)) - a)) {
int64_t max_k = ((((int64_t)(W)) - a) - b);
if (max_k >= 1) {
int64_t k = 1;
while (k <= max_k) {
reduced_hook_i64_i64_i64(a, b, k);
int64_t mv = g_mv_out;
int64_t nv = g_nv_out;
if (nv == 1) {
int64_t v = (mv - 1);
g_int_counts[(v + 1000)] = (g_int_counts[(v + 1000)] + 1);
} else {
if (mv == 1) {
int64_t v2 = (-(nv - 1));
g_int_counts[(v2 + 1000)] = (g_int_counts[(v2 + 1000)] + 1);
} else {
int64_t t = ((mv + nv) - 4);
int64_t r = (-(nv - 2));
g_temp_t[g_temp_n] = t;
g_temp_r[g_temp_n] = r;
g_temp_count[g_temp_n] = 1;
g_temp_n = (g_temp_n + 1);
}
}
k = (k + 1);
}
}
b = (b + 1);
}
a = (a + 1);
}
heapsort_temp_i32(g_temp_n);
g_num_hot_types = 0;
int32_t i = 0;
while (i < g_temp_n) {
if (g_num_hot_types > 0) {
if ((g_hot_t[(g_num_hot_types - 1)] == g_temp_t[i] && g_hot_r[(g_num_hot_types - 1)] == g_temp_r[i])) {
g_hot_count[(g_num_hot_types - 1)] = (g_hot_count[(g_num_hot_types - 1)] + 1);
} else {
g_hot_t[g_num_hot_types] = g_temp_t[i];
g_hot_r[g_num_hot_types] = g_temp_r[i];
g_hot_count[g_num_hot_types] = g_temp_count[i];
g_num_hot_types = (g_num_hot_types + 1);
}
} else {
g_hot_t[g_num_hot_types] = g_temp_t[i];
g_hot_r[g_num_hot_types] = g_temp_r[i];
g_hot_count[g_num_hot_types] = g_temp_count[i];
g_num_hot_types = (g_num_hot_types + 1);
}
i = (i + 1);
}
g_num_int_vals = 0;
int32_t v = (-1000);
while (v <= 1000) {
if (g_int_counts[(v + 1000)] > 0) {
g_int_vals[g_num_int_vals] = ((int64_t)(v));
g_num_int_vals = (g_num_int_vals + 1);
}
v = (v + 1);
}
}
int32_t main(void) {
g_int_counts = calloc(2001, 8);
g_int_vals = calloc(2001, 8);
g_hot_t = calloc(2000, 8);
g_hot_r = calloc(2000, 8);
g_hot_count = calloc(2000, 8);
g_temp_t = calloc(50000, 8);
g_temp_r = calloc(50000, 8);
g_temp_count = calloc(50000, 8);
int64_t hot_sz = ((9 * 2) * ((int64_t)(SUM_RNG)));
g_hot_a = calloc(hot_sz, 8);
g_hot_b = calloc(hot_sz, 8);
int64_t int_sz = (9 * ((int64_t)(SUM_RNG)));
g_int_a = calloc(int_sz, 8);
g_int_b = calloc(int_sz, 8);
g_hot_min_a = calloc(18, 8);
g_hot_max_a = calloc(18, 8);
g_hot_min_b = calloc(18, 8);
g_hot_max_b = calloc(18, 8);
g_int_min_a = calloc(9, 8);
g_int_max_a = calloc(9, 8);
g_int_min_b = calloc(9, 8);
g_int_max_b = calloc(9, 8);
int64_t* fact = (int64_t*)(calloc(10, 8));
int64_t* invfact = (int64_t*)(calloc(10, 8));
fact[0] = 1;
int32_t i = 1;
while (i <= M) {
fact[i] = FLOW_CHECKED_MOD(((fact[(i - 1)] * ((int64_t)(i)))), (MOD));
i = (i + 1);
}
invfact[M] = powmod_i64_i64_i64(fact[M], (MOD - 2), MOD);
int32_t j = M;
while (j >= 1) {
invfact[(j - 1)] = FLOW_CHECKED_MOD(((invfact[j] * ((int64_t)(j)))), (MOD));
j = (j - 1);
}
collect_counts();
memset(((void*)(g_hot_a)), 0, (hot_sz * 8));
int32_t u = 0;
while (u <= M) {
int32_t p = 0;
while (p < 2) {
g_hot_min_a[((u * 2) + p)] = ((int64_t)(SUM_RNG));
g_hot_max_a[((u * 2) + p)] = (-1);
p = (p + 1);
}
u = (u + 1);
}
g_hot_a[((((0 * 2) * SUM_RNG) + (0 * SUM_RNG)) + SUM_OFF)] = 1;
g_hot_min_a[((0 * 2) + 0)] = ((int64_t)(SUM_OFF));
g_hot_max_a[((0 * 2) + 0)] = ((int64_t)(SUM_OFF));
int32_t ht = 0;
while (ht < g_num_hot_types) {
int64_t t = g_hot_t[ht];
int64_t r = g_hot_r[ht];
int64_t c = g_hot_count[ht];
int64_t* poly = (int64_t*)(calloc(10, 8));
poly[0] = 1;
int64_t p = 1;
int32_t kk = 1;
while (kk <= M) {
p = FLOW_CHECKED_MOD(((p * c)), (MOD));
poly[kk] = FLOW_CHECKED_MOD(((p * invfact[kk])), (MOD));
kk = (kk + 1);
}
memset(((void*)(g_hot_b)), 0, (hot_sz * 8));
int32_t u2 = 0;
while (u2 <= M) {
int32_t p2 = 0;
while (p2 < 2) {
g_hot_min_b[((u2 * 2) + p2)] = ((int64_t)(SUM_RNG));
g_hot_max_b[((u2 * 2) + p2)] = (-1);
p2 = (p2 + 1);
}
u2 = (u2 + 1);
}
int32_t used = 0;
while (used <= M) {
int32_t parity = 0;
while (parity < 2) {
if (g_hot_max_a[((used * 2) + parity)] >= 0) {
int64_t mn = g_hot_min_a[((used * 2) + parity)];
int64_t mx = g_hot_max_a[((used * 2) + parity)];
int64_t idx = mn;
while (idx <= mx) {
int64_t coeff = g_hot_a[((((used * 2) * SUM_RNG) + (parity * SUM_RNG)) + idx)];
if (coeff != 0) {
int32_t k = 0;
while (k <= (M - used)) {
int64_t mult = poly[k];
if (mult != 0) {
int64_t right_turns = FLOW_CHECKED_DIV((((((int64_t)(k)) + 1) - ((int64_t)(parity)))), (2));
int64_t delta = ((((int64_t)(k)) * r) + (right_turns * t));
int32_t nu = (used + k);
int32_t np = (parity ^ (k & 1));
int64_t nidx = (idx + delta);
if ((nidx >= 0 && nidx < ((int64_t)(SUM_RNG)))) {
__int128 aw = ((__int128)(g_hot_b[((((nu * 2) * SUM_RNG) + (np * SUM_RNG)) + nidx)]));
__int128 bw = ((__int128)(coeff));
__int128 cw = ((__int128)(mult));
__int128 mw = ((__int128)(MOD));
g_hot_b[((((nu * 2) * SUM_RNG) + (np * SUM_RNG)) + nidx)] = ((int64_t)(FLOW_CHECKED_MOD(((aw + (bw * cw))), (mw))));
if (nidx < g_hot_min_b[((nu * 2) + np)]) {
g_hot_min_b[((nu * 2) + np)] = nidx;
}
if (nidx > g_hot_max_b[((nu * 2) + np)]) {
g_hot_max_b[((nu * 2) + np)] = nidx;
}
}
}
k = (k + 1);
}
}
idx = (idx + 1);
}
}
parity = (parity + 1);
}
used = (used + 1);
}
memcpy(((void*)(g_hot_a)), ((void*)(g_hot_b)), (hot_sz * 8));
memcpy(((void*)(g_hot_min_a)), ((void*)(g_hot_min_b)), (18 * 8));
memcpy(((void*)(g_hot_max_a)), ((void*)(g_hot_max_b)), (18 * 8));
free(poly);
ht = (ht + 1);
}
memset(((void*)(g_int_a)), 0, (int_sz * 8));
int32_t u3 = 0;
while (u3 <= M) {
g_int_min_a[u3] = ((int64_t)(SUM_RNG));
g_int_max_a[u3] = (-1);
u3 = (u3 + 1);
}
g_int_a[((0 * SUM_RNG) + SUM_OFF)] = 1;
g_int_min_a[0] = ((int64_t)(SUM_OFF));
g_int_max_a[0] = ((int64_t)(SUM_OFF));
int32_t iv = 0;
while (iv < g_num_int_vals) {
int64_t v = g_int_vals[iv];
int64_t c = g_int_counts[(v + 1000)];
int64_t* poly2 = (int64_t*)(calloc(10, 8));
poly2[0] = 1;
int64_t p2 = 1;
int32_t kk2 = 1;
while (kk2 <= M) {
p2 = FLOW_CHECKED_MOD(((p2 * c)), (MOD));
poly2[kk2] = FLOW_CHECKED_MOD(((p2 * invfact[kk2])), (MOD));
kk2 = (kk2 + 1);
}
memset(((void*)(g_int_b)), 0, (int_sz * 8));
int32_t u4 = 0;
while (u4 <= M) {
g_int_min_b[u4] = ((int64_t)(SUM_RNG));
g_int_max_b[u4] = (-1);
u4 = (u4 + 1);
}
int32_t used2 = 0;
while (used2 <= M) {
if (g_int_max_a[used2] >= 0) {
int64_t mn2 = g_int_min_a[used2];
int64_t mx2 = g_int_max_a[used2];
int64_t idx2 = mn2;
while (idx2 <= mx2) {
int64_t coeff2 = g_int_a[((used2 * SUM_RNG) + idx2)];
if (coeff2 != 0) {
int32_t k2 = 0;
while (k2 <= (M - used2)) {
int64_t mult2 = poly2[k2];
if (mult2 != 0) {
int32_t nu2 = (used2 + k2);
int64_t nidx2 = (idx2 + (((int64_t)(k2)) * v));
if ((nidx2 >= 0 && nidx2 < ((int64_t)(SUM_RNG)))) {
__int128 aw2 = ((__int128)(g_int_b[((nu2 * SUM_RNG) + nidx2)]));
__int128 bw2 = ((__int128)(coeff2));
__int128 cw2 = ((__int128)(mult2));
__int128 mw2 = ((__int128)(MOD));
g_int_b[((nu2 * SUM_RNG) + nidx2)] = ((int64_t)(FLOW_CHECKED_MOD(((aw2 + (bw2 * cw2))), (mw2))));
if (nidx2 < g_int_min_b[nu2]) {
g_int_min_b[nu2] = nidx2;
}
if (nidx2 > g_int_max_b[nu2]) {
g_int_max_b[nu2] = nidx2;
}
}
}
k2 = (k2 + 1);
}
}
idx2 = (idx2 + 1);
}
}
used2 = (used2 + 1);
}
memcpy(((void*)(g_int_a)), ((void*)(g_int_b)), (int_sz * 8));
memcpy(((void*)(g_int_min_a)), ((void*)(g_int_min_b)), (9 * 8));
memcpy(((void*)(g_int_max_a)), ((void*)(g_int_max_b)), (9 * 8));
free(poly2);
iv = (iv + 1);
}
int64_t multiset_count = 0;
int32_t j2 = 0;
while (j2 <= M) {
int32_t parity2 = 0;
while (parity2 < 2) {
if (g_hot_max_a[((j2 * 2) + parity2)] >= 0) {
if (g_int_max_a[(M - j2)] >= 0) {
int64_t hmn = g_hot_min_a[((j2 * 2) + parity2)];
int64_t hmx = g_hot_max_a[((j2 * 2) + parity2)];
int64_t hidx = hmn;
while (hidx <= hmx) {
int64_t ch = g_hot_a[((((j2 * 2) * SUM_RNG) + (parity2 * SUM_RNG)) + hidx)];
if (ch != 0) {
int64_t imn = g_int_min_a[(M - j2)];
int64_t imx = g_int_max_a[(M - j2)];
int64_t iidx = imn;
while (iidx <= imx) {
int64_t ci = g_int_a[(((M - j2) * SUM_RNG) + iidx)];
if (ci != 0) {
int64_t total = ((hidx - ((int64_t)(SUM_OFF))) + (iidx - ((int64_t)(SUM_OFF))));
if (total > 0) {
__int128 aw3 = ((__int128)(multiset_count));
__int128 bw3 = ((__int128)(ch));
__int128 cw3 = ((__int128)(ci));
__int128 mw3 = ((__int128)(MOD));
multiset_count = ((int64_t)(FLOW_CHECKED_MOD(((aw3 + (bw3 * cw3))), (mw3))));
} else {
if (total == 0) {
if (parity2 == 1) {
__int128 aw4 = ((__int128)(multiset_count));
__int128 bw4 = ((__int128)(ch));
__int128 cw4 = ((__int128)(ci));
__int128 mw4 = ((__int128)(MOD));
multiset_count = ((int64_t)(FLOW_CHECKED_MOD(((aw4 + (bw4 * cw4))), (mw4))));
}
}
}
}
iidx = (iidx + 1);
}
}
hidx = (hidx + 1);
}
}
}
parity2 = (parity2 + 1);
}
j2 = (j2 + 1);
}
int64_t result = FLOW_CHECKED_MOD(((multiset_count * fact[M])), (MOD));
printf("%lld\n", result);
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
// Constant: MOD
llvm.mlir.global internal constant @MOD(1000000007 : i64) : i64
// Constant: M
llvm.mlir.global internal constant @M(8 : i32) : i32
// Constant: W
llvm.mlir.global internal constant @W(64 : i32) : i32
// Constant: SUM_OFF
llvm.mlir.global internal constant @SUM_OFF(2000 : i32) : i32
// Constant: SUM_RNG
llvm.mlir.global internal constant @SUM_RNG(4001 : i32) : i32
func.func @powmod(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
%0 = arith.constant 1 : i32
%1 = arith.extsi %0 : i32 to i64
%2 = llvm.mlir.constant(1 : i64) : i64
%3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
llvm.store %1, %3 : i64, !llvm.ptr
%4 = arith.remsi %arg0, %arg2 : i64
%5 = llvm.mlir.constant(1 : i64) : i64
%6 = llvm.alloca %5 x i64 : (i64) -> !llvm.ptr
llvm.store %4, %6 : i64, !llvm.ptr
%7 = llvm.load %6 : !llvm.ptr -> i64
%8 = arith.constant 0 : i32
%10 = arith.extsi %8 : i32 to i64
%9 = arith.cmpi slt, %7, %10 : i64
cf.cond_br %9, ^bb0, ^bb1
^bb0:
%11 = llvm.load %6 : !llvm.ptr -> i64
%12 = arith.addi %11, %arg2 : i64
llvm.store %12, %6 : i64, !llvm.ptr
cf.br ^bb2
^bb1:
cf.br ^bb2
^bb2:
%13 = llvm.mlir.constant(1 : i64) : i64
%14 = llvm.alloca %13 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %14 : i64, !llvm.ptr
cf.br ^bb3
^bb3:
%15 = llvm.load %14 : !llvm.ptr -> i64
%16 = arith.constant 0 : i32
%18 = arith.extsi %16 : i32 to i64
%17 = arith.cmpi sgt, %15, %18 : i64
cf.cond_br %17, ^bb4, ^bb5
^bb4:
%19 = llvm.load %14 : !llvm.ptr -> i64
%20 = arith.constant 1 : i32
%22 = arith.extsi %20 : i32 to i64
%21 = arith.andi %19, %22 : i64
%23 = arith.constant 1 : i32
%25 = arith.extsi %23 : i32 to i64
%24 = arith.cmpi eq, %21, %25 : i64
cf.cond_br %24, ^bb6, ^bb7
^bb6:
%26 = llvm.load %3 : !llvm.ptr -> i64
%27 = arith.extsi %26 : i64 to i128
%28 = llvm.load %6 : !llvm.ptr -> i64
%29 = arith.extsi %28 : i64 to i128
%30 = arith.extsi %arg2 : i64 to i128
%32 = arith.trunci %27 : i128 to i64
%33 = arith.trunci %29 : i128 to i64
%31 = arith.muli %32, %33 : i64
%35 = arith.trunci %30 : i128 to i64
%34 = arith.remsi %31, %35 : i64
llvm.store %34, %3 : i64, !llvm.ptr
cf.br ^bb8
^bb7:
cf.br ^bb8
^bb8:
%36 = llvm.load %6 : !llvm.ptr -> i64
%37 = arith.extsi %36 : i64 to i128
%38 = llvm.load %6 : !llvm.ptr -> i64
%39 = arith.extsi %38 : i64 to i128
%40 = arith.extsi %arg2 : i64 to i128
%42 = arith.trunci %37 : i128 to i64
%43 = arith.trunci %39 : i128 to i64
%41 = arith.muli %42, %43 : i64
%45 = arith.trunci %40 : i128 to i64
%44 = arith.remsi %41, %45 : i64
llvm.store %44, %6 : i64, !llvm.ptr
%46 = llvm.load %14 : !llvm.ptr -> i64
%47 = arith.constant 1 : i32
%49 = arith.extsi %47 : i32 to i64
%48 = arith.shrsi %46, %49 : i64
llvm.store %48, %14 : i64, !llvm.ptr
cf.br ^bb3
^bb5:
%50 = llvm.load %3 : !llvm.ptr -> i64
func.return %50 : i64
}
// Module static: g_mv_out
llvm.mlir.global internal @g_mv_out(0 : i64) : i64
// Module static: g_nv_out
llvm.mlir.global internal @g_nv_out(0 : i64) : i64
func.func @reduced_hook(%arg0: i64, %arg1: i64, %arg2: i64) -> () {
%51 = arith.constant 0 : i32
%52 = arith.extsi %51 : i32 to i64
%53 = llvm.mlir.constant(1 : i64) : i64
%54 = llvm.alloca %53 x i64 : (i64) -> !llvm.ptr
llvm.store %52, %54 : i64, !llvm.ptr
%55 = arith.constant 0 : i32
%56 = arith.extsi %55 : i32 to i64
%57 = llvm.mlir.constant(1 : i64) : i64
%58 = llvm.alloca %57 x i64 : (i64) -> !llvm.ptr
llvm.store %56, %58 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%59 = llvm.load %58 : !llvm.ptr -> i64
%60 = arith.cmpi slt, %59, %arg2 : i64
cf.cond_br %60, ^bb10, ^bb11
^bb10:
%61 = llvm.load %58 : !llvm.ptr -> i64
%62 = arith.subi %arg2, %61 : i64
%63 = arith.muli %62, %arg1 : i64
%64 = llvm.load %58 : !llvm.ptr -> i64
%65 = arith.muli %64, %arg0 : i64
%66 = arith.constant 1 : i32
%68 = arith.extsi %66 : i32 to i64
%67 = arith.addi %65, %68 : i64
%69 = arith.cmpi sge, %63, %67 : i64
cf.cond_br %69, ^bb12, ^bb13
^bb12:
%70 = llvm.load %58 : !llvm.ptr -> i64
%71 = arith.constant 1 : i32
%73 = arith.extsi %71 : i32 to i64
%72 = arith.addi %70, %73 : i64
%74 = arith.muli %72, %arg0 : i64
%75 = arith.cmpi slt, %63, %74 : i64
%76 = scf.if %75 -> (i64) {
scf.yield %63 : i64
} else {
scf.yield %74 : i64
}
%77 = llvm.load %54 : !llvm.ptr -> i64
%78 = arith.cmpi sgt, %76, %77 : i64
cf.cond_br %78, ^bb15, ^bb16
^bb15:
llvm.store %76, %54 : i64, !llvm.ptr
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
cf.br ^bb14
^bb13:
cf.br ^bb14
^bb14:
%79 = llvm.load %58 : !llvm.ptr -> i64
%80 = arith.constant 1 : i32
%82 = arith.extsi %80 : i32 to i64
%81 = arith.addi %79, %82 : i64
llvm.store %81, %58 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
%83 = llvm.load %54 : !llvm.ptr -> i64
%84 = arith.constant 1 : i32
%86 = arith.extsi %84 : i32 to i64
%85 = arith.subi %83, %86 : i64
%87 = arith.divsi %85, %arg0 : i64
%88 = arith.subi %arg2, %87 : i64
%89 = arith.muli %88, %arg1 : i64
%90 = llvm.load %54 : !llvm.ptr -> i64
%91 = arith.subi %89, %90 : i64
%92 = arith.constant 1 : i32
%94 = arith.extsi %92 : i32 to i64
%93 = arith.addi %91, %94 : i64
%95 = llvm.load %54 : !llvm.ptr -> i64
%96 = arith.addi %95, %arg1 : i64
%97 = arith.constant 1 : i32
%99 = arith.extsi %97 : i32 to i64
%98 = arith.subi %96, %99 : i64
%100 = arith.divsi %98, %arg1 : i64
%101 = arith.subi %arg2, %100 : i64
%102 = arith.constant 1 : i32
%104 = arith.extsi %102 : i32 to i64
%103 = arith.addi %101, %104 : i64
%105 = arith.muli %103, %arg0 : i64
%106 = llvm.load %54 : !llvm.ptr -> i64
%107 = arith.subi %105, %106 : i64
%108 = arith.constant 1 : i32
%110 = arith.extsi %108 : i32 to i64
%109 = arith.addi %107, %110 : i64
%111 = llvm.mlir.addressof @g_mv_out : !llvm.ptr
llvm.store %93, %111 : i64, !llvm.ptr
%112 = llvm.mlir.addressof @g_nv_out : !llvm.ptr
llvm.store %109, %112 : i64, !llvm.ptr
func.return
}
// Module static: g_int_counts
llvm.mlir.global internal @g_int_counts() {addr_space = 0 : i32} : !llvm.ptr {
%113 = llvm.mlir.zero : !llvm.ptr
llvm.return %113 : !llvm.ptr
}
// Module static: g_int_vals
llvm.mlir.global internal @g_int_vals() {addr_space = 0 : i32} : !llvm.ptr {
%114 = llvm.mlir.zero : !llvm.ptr
llvm.return %114 : !llvm.ptr
}
// Module static: g_num_int_vals
llvm.mlir.global internal @g_num_int_vals(0 : i32) : i32
// Module static: g_hot_t
llvm.mlir.global internal @g_hot_t() {addr_space = 0 : i32} : !llvm.ptr {
%115 = llvm.mlir.zero : !llvm.ptr
llvm.return %115 : !llvm.ptr
}
// Module static: g_hot_r
llvm.mlir.global internal @g_hot_r() {addr_space = 0 : i32} : !llvm.ptr {
%116 = llvm.mlir.zero : !llvm.ptr
llvm.return %116 : !llvm.ptr
}
// Module static: g_hot_count
llvm.mlir.global internal @g_hot_count() {addr_space = 0 : i32} : !llvm.ptr {
%117 = llvm.mlir.zero : !llvm.ptr
llvm.return %117 : !llvm.ptr
}
// Module static: g_num_hot_types
llvm.mlir.global internal @g_num_hot_types(0 : i32) : i32
// Module static: g_temp_t
llvm.mlir.global internal @g_temp_t() {addr_space = 0 : i32} : !llvm.ptr {
%118 = llvm.mlir.zero : !llvm.ptr
llvm.return %118 : !llvm.ptr
}
// Module static: g_temp_r
llvm.mlir.global internal @g_temp_r() {addr_space = 0 : i32} : !llvm.ptr {
%119 = llvm.mlir.zero : !llvm.ptr
llvm.return %119 : !llvm.ptr
}
// Module static: g_temp_count
llvm.mlir.global internal @g_temp_count() {addr_space = 0 : i32} : !llvm.ptr {
%120 = llvm.mlir.zero : !llvm.ptr
llvm.return %120 : !llvm.ptr
}
// Module static: g_temp_n
llvm.mlir.global internal @g_temp_n(0 : i32) : i32
func.func @sift_down(%arg0: i32, %arg1: i32) -> () {
%121 = llvm.mlir.constant(1 : i64) : i64
%122 = llvm.alloca %121 x i32 : (i64) -> !llvm.ptr
llvm.store %arg1, %122 : i32, !llvm.ptr
cf.br ^bb18
^bb18:
%123 = arith.constant 1 : i1
cf.cond_br %123, ^bb19, ^bb20
^bb19:
%124 = arith.constant 2 : i32
%125 = llvm.load %122 : !llvm.ptr -> i32
%126 = arith.muli %124, %125 : i32
%127 = arith.constant 1 : i32
%128 = arith.addi %126, %127 : i32
%129 = arith.constant 2 : i32
%130 = llvm.load %122 : !llvm.ptr -> i32
%131 = arith.muli %129, %130 : i32
%132 = arith.constant 2 : i32
%133 = arith.addi %131, %132 : i32
%134 = llvm.load %122 : !llvm.ptr -> i32
%135 = llvm.mlir.constant(1 : i64) : i64
%136 = llvm.alloca %135 x i32 : (i64) -> !llvm.ptr
llvm.store %134, %136 : i32, !llvm.ptr
%137 = arith.cmpi slt, %128, %arg0 : i32
cf.cond_br %137, ^bb21, ^bb22
^bb21:
%139 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%140 = llvm.load %139 : !llvm.ptr -> !llvm.ptr
%141 = arith.extsi %128 : i32 to i64
%142 = llvm.getelementptr %140[%141] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%138 = llvm.load %142 : !llvm.ptr -> i64
%144 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%145 = llvm.load %144 : !llvm.ptr -> !llvm.ptr
%146 = llvm.load %136 : !llvm.ptr -> i32
%147 = arith.extsi %146 : i32 to i64
%148 = llvm.getelementptr %145[%147] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%143 = llvm.load %148 : !llvm.ptr -> i64
%149 = arith.cmpi slt, %138, %143 : i64
cf.cond_br %149, ^bb24, ^bb25
^bb24:
llvm.store %128, %136 : i32, !llvm.ptr
cf.br ^bb26
^bb25:
%150 = arith.cmpi eq, %138, %143 : i64
cf.cond_br %150, ^bb27, ^bb28
^bb27:
%152 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%153 = llvm.load %152 : !llvm.ptr -> !llvm.ptr
%154 = arith.extsi %128 : i32 to i64
%155 = llvm.getelementptr %153[%154] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%151 = llvm.load %155 : !llvm.ptr -> i64
%157 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%158 = llvm.load %157 : !llvm.ptr -> !llvm.ptr
%159 = llvm.load %136 : !llvm.ptr -> i32
%160 = arith.extsi %159 : i32 to i64
%161 = llvm.getelementptr %158[%160] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%156 = llvm.load %161 : !llvm.ptr -> i64
%162 = arith.cmpi sgt, %151, %156 : i64
cf.cond_br %162, ^bb30, ^bb31
^bb30:
llvm.store %128, %136 : i32, !llvm.ptr
cf.br ^bb32
^bb31:
cf.br ^bb32
^bb32:
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
cf.br ^bb26
^bb26:
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
%163 = arith.cmpi slt, %133, %arg0 : i32
cf.cond_br %163, ^bb33, ^bb34
^bb33:
%165 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%166 = llvm.load %165 : !llvm.ptr -> !llvm.ptr
%167 = arith.extsi %133 : i32 to i64
%168 = llvm.getelementptr %166[%167] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%164 = llvm.load %168 : !llvm.ptr -> i64
%170 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%171 = llvm.load %170 : !llvm.ptr -> !llvm.ptr
%172 = llvm.load %136 : !llvm.ptr -> i32
%173 = arith.extsi %172 : i32 to i64
%174 = llvm.getelementptr %171[%173] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%169 = llvm.load %174 : !llvm.ptr -> i64
%175 = arith.cmpi slt, %164, %169 : i64
cf.cond_br %175, ^bb36, ^bb37
^bb36:
llvm.store %133, %136 : i32, !llvm.ptr
cf.br ^bb38
^bb37:
%176 = arith.cmpi eq, %164, %169 : i64
cf.cond_br %176, ^bb39, ^bb40
^bb39:
%178 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%179 = llvm.load %178 : !llvm.ptr -> !llvm.ptr
%180 = arith.extsi %133 : i32 to i64
%181 = llvm.getelementptr %179[%180] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%177 = llvm.load %181 : !llvm.ptr -> i64
%183 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%184 = llvm.load %183 : !llvm.ptr -> !llvm.ptr
%185 = llvm.load %136 : !llvm.ptr -> i32
%186 = arith.extsi %185 : i32 to i64
%187 = llvm.getelementptr %184[%186] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%182 = llvm.load %187 : !llvm.ptr -> i64
%188 = arith.cmpi sgt, %177, %182 : i64
cf.cond_br %188, ^bb42, ^bb43
^bb42:
llvm.store %133, %136 : i32, !llvm.ptr
cf.br ^bb44
^bb43:
cf.br ^bb44
^bb44:
cf.br ^bb41
^bb40:
cf.br ^bb41
^bb41:
cf.br ^bb38
^bb38:
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%189 = llvm.load %136 : !llvm.ptr -> i32
%190 = llvm.load %122 : !llvm.ptr -> i32
%191 = arith.cmpi eq, %189, %190 : i32
cf.cond_br %191, ^bb45, ^bb46
^bb45:
func.return
^bb46:
cf.br ^bb47
^bb47:
%193 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%194 = llvm.load %193 : !llvm.ptr -> !llvm.ptr
%195 = llvm.load %122 : !llvm.ptr -> i32
%196 = arith.extsi %195 : i32 to i64
%197 = llvm.getelementptr %194[%196] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%192 = llvm.load %197 : !llvm.ptr -> i64
%199 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%200 = llvm.load %199 : !llvm.ptr -> !llvm.ptr
%201 = llvm.load %136 : !llvm.ptr -> i32
%202 = arith.extsi %201 : i32 to i64
%203 = llvm.getelementptr %200[%202] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%198 = llvm.load %203 : !llvm.ptr -> i64
%204 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%205 = llvm.load %204 : !llvm.ptr -> !llvm.ptr
%206 = llvm.load %122 : !llvm.ptr -> i32
%207 = arith.extsi %206 : i32 to i64
%208 = llvm.getelementptr %205[%207] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %198, %208 : i64, !llvm.ptr
%209 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%210 = llvm.load %209 : !llvm.ptr -> !llvm.ptr
%211 = llvm.load %136 : !llvm.ptr -> i32
%212 = arith.extsi %211 : i32 to i64
%213 = llvm.getelementptr %210[%212] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %192, %213 : i64, !llvm.ptr
%215 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%216 = llvm.load %215 : !llvm.ptr -> !llvm.ptr
%217 = llvm.load %122 : !llvm.ptr -> i32
%218 = arith.extsi %217 : i32 to i64
%219 = llvm.getelementptr %216[%218] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%214 = llvm.load %219 : !llvm.ptr -> i64
%221 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%222 = llvm.load %221 : !llvm.ptr -> !llvm.ptr
%223 = llvm.load %136 : !llvm.ptr -> i32
%224 = arith.extsi %223 : i32 to i64
%225 = llvm.getelementptr %222[%224] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%220 = llvm.load %225 : !llvm.ptr -> i64
%226 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%227 = llvm.load %226 : !llvm.ptr -> !llvm.ptr
%228 = llvm.load %122 : !llvm.ptr -> i32
%229 = arith.extsi %228 : i32 to i64
%230 = llvm.getelementptr %227[%229] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %220, %230 : i64, !llvm.ptr
%231 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%232 = llvm.load %231 : !llvm.ptr -> !llvm.ptr
%233 = llvm.load %136 : !llvm.ptr -> i32
%234 = arith.extsi %233 : i32 to i64
%235 = llvm.getelementptr %232[%234] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %214, %235 : i64, !llvm.ptr
%237 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%238 = llvm.load %237 : !llvm.ptr -> !llvm.ptr
%239 = llvm.load %122 : !llvm.ptr -> i32
%240 = arith.extsi %239 : i32 to i64
%241 = llvm.getelementptr %238[%240] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%236 = llvm.load %241 : !llvm.ptr -> i64
%243 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%244 = llvm.load %243 : !llvm.ptr -> !llvm.ptr
%245 = llvm.load %136 : !llvm.ptr -> i32
%246 = arith.extsi %245 : i32 to i64
%247 = llvm.getelementptr %244[%246] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%242 = llvm.load %247 : !llvm.ptr -> i64
%248 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%249 = llvm.load %248 : !llvm.ptr -> !llvm.ptr
%250 = llvm.load %122 : !llvm.ptr -> i32
%251 = arith.extsi %250 : i32 to i64
%252 = llvm.getelementptr %249[%251] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %242, %252 : i64, !llvm.ptr
%253 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%254 = llvm.load %253 : !llvm.ptr -> !llvm.ptr
%255 = llvm.load %136 : !llvm.ptr -> i32
%256 = arith.extsi %255 : i32 to i64
%257 = llvm.getelementptr %254[%256] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %236, %257 : i64, !llvm.ptr
%258 = llvm.load %136 : !llvm.ptr -> i32
llvm.store %258, %122 : i32, !llvm.ptr
cf.br ^bb18
^bb20:
func.return
}
func.func @heapsort_temp(%arg0: i32) -> () {
%259 = arith.constant 2 : i32
%260 = arith.divsi %arg0, %259 : i32
%261 = arith.constant 1 : i32
%262 = arith.subi %260, %261 : i32
%263 = llvm.mlir.constant(1 : i64) : i64
%264 = llvm.alloca %263 x i32 : (i64) -> !llvm.ptr
llvm.store %262, %264 : i32, !llvm.ptr
cf.br ^bb48
^bb48:
%265 = llvm.load %264 : !llvm.ptr -> i32
%266 = arith.constant 0 : i32
%267 = arith.cmpi sge, %265, %266 : i32
cf.cond_br %267, ^bb49, ^bb50
^bb49:
%269 = llvm.load %264 : !llvm.ptr -> i32
func.call @sift_down(%arg0, %269) : (i32, i32) -> ()
%270 = llvm.load %264 : !llvm.ptr -> i32
%271 = arith.constant 1 : i32
%272 = arith.subi %270, %271 : i32
llvm.store %272, %264 : i32, !llvm.ptr
cf.br ^bb48
^bb50:
%273 = arith.constant 1 : i32
%274 = arith.subi %arg0, %273 : i32
%275 = llvm.mlir.constant(1 : i64) : i64
%276 = llvm.alloca %275 x i32 : (i64) -> !llvm.ptr
llvm.store %274, %276 : i32, !llvm.ptr
cf.br ^bb51
^bb51:
%277 = llvm.load %276 : !llvm.ptr -> i32
%278 = arith.constant 0 : i32
%279 = arith.cmpi sgt, %277, %278 : i32
cf.cond_br %279, ^bb52, ^bb53
^bb52:
%281 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%282 = llvm.load %281 : !llvm.ptr -> !llvm.ptr
%283 = arith.constant 0 : i32
%284 = arith.extsi %283 : i32 to i64
%285 = llvm.getelementptr %282[%284] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%280 = llvm.load %285 : !llvm.ptr -> i64
%287 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%288 = llvm.load %287 : !llvm.ptr -> !llvm.ptr
%289 = llvm.load %276 : !llvm.ptr -> i32
%290 = arith.extsi %289 : i32 to i64
%291 = llvm.getelementptr %288[%290] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%286 = llvm.load %291 : !llvm.ptr -> i64
%292 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%293 = llvm.load %292 : !llvm.ptr -> !llvm.ptr
%294 = arith.constant 0 : i32
%295 = arith.extsi %294 : i32 to i64
%296 = llvm.getelementptr %293[%295] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %286, %296 : i64, !llvm.ptr
%297 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%298 = llvm.load %297 : !llvm.ptr -> !llvm.ptr
%299 = llvm.load %276 : !llvm.ptr -> i32
%300 = arith.extsi %299 : i32 to i64
%301 = llvm.getelementptr %298[%300] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %280, %301 : i64, !llvm.ptr
%303 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%304 = llvm.load %303 : !llvm.ptr -> !llvm.ptr
%305 = arith.constant 0 : i32
%306 = arith.extsi %305 : i32 to i64
%307 = llvm.getelementptr %304[%306] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%302 = llvm.load %307 : !llvm.ptr -> i64
%309 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%310 = llvm.load %309 : !llvm.ptr -> !llvm.ptr
%311 = llvm.load %276 : !llvm.ptr -> i32
%312 = arith.extsi %311 : i32 to i64
%313 = llvm.getelementptr %310[%312] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%308 = llvm.load %313 : !llvm.ptr -> i64
%314 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%315 = llvm.load %314 : !llvm.ptr -> !llvm.ptr
%316 = arith.constant 0 : i32
%317 = arith.extsi %316 : i32 to i64
%318 = llvm.getelementptr %315[%317] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %308, %318 : i64, !llvm.ptr
%319 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%320 = llvm.load %319 : !llvm.ptr -> !llvm.ptr
%321 = llvm.load %276 : !llvm.ptr -> i32
%322 = arith.extsi %321 : i32 to i64
%323 = llvm.getelementptr %320[%322] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %302, %323 : i64, !llvm.ptr
%325 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%326 = llvm.load %325 : !llvm.ptr -> !llvm.ptr
%327 = arith.constant 0 : i32
%328 = arith.extsi %327 : i32 to i64
%329 = llvm.getelementptr %326[%328] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%324 = llvm.load %329 : !llvm.ptr -> i64
%331 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%332 = llvm.load %331 : !llvm.ptr -> !llvm.ptr
%333 = llvm.load %276 : !llvm.ptr -> i32
%334 = arith.extsi %333 : i32 to i64
%335 = llvm.getelementptr %332[%334] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%330 = llvm.load %335 : !llvm.ptr -> i64
%336 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%337 = llvm.load %336 : !llvm.ptr -> !llvm.ptr
%338 = arith.constant 0 : i32
%339 = arith.extsi %338 : i32 to i64
%340 = llvm.getelementptr %337[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %330, %340 : i64, !llvm.ptr
%341 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%342 = llvm.load %341 : !llvm.ptr -> !llvm.ptr
%343 = llvm.load %276 : !llvm.ptr -> i32
%344 = arith.extsi %343 : i32 to i64
%345 = llvm.getelementptr %342[%344] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %324, %345 : i64, !llvm.ptr
%347 = llvm.load %276 : !llvm.ptr -> i32
%348 = arith.constant 0 : i32
func.call @sift_down(%347, %348) : (i32, i32) -> ()
%349 = llvm.load %276 : !llvm.ptr -> i32
%350 = arith.constant 1 : i32
%351 = arith.subi %349, %350 : i32
llvm.store %351, %276 : i32, !llvm.ptr
cf.br ^bb51
^bb53:
func.return
}
func.func @collect_counts() -> () {
%353 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
%354 = llvm.load %353 : !llvm.ptr -> !llvm.ptr
%355 = arith.constant 0 : i32
%356 = arith.constant 2001 : i32
%357 = arith.constant 8 : i32
%358 = arith.muli %356, %357 : i32
%359 = arith.extsi %358 : i32 to i64
%352 = func.call @memset(%354, %355, %359) : (!llvm.ptr, i32, i64) -> !llvm.ptr
%360 = arith.constant 0 : i32
%361 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
llvm.store %360, %361 : i32, !llvm.ptr
%362 = arith.constant 1 : i32
%363 = arith.extsi %362 : i32 to i64
%364 = llvm.mlir.constant(1 : i64) : i64
%365 = llvm.alloca %364 x i64 : (i64) -> !llvm.ptr
llvm.store %363, %365 : i64, !llvm.ptr
cf.br ^bb54
^bb54:
%366 = llvm.load %365 : !llvm.ptr -> i64
%367 = llvm.mlir.addressof @W : !llvm.ptr
%368 = llvm.load %367 : !llvm.ptr -> i32
%369 = arith.extsi %368 : i32 to i64
%370 = arith.constant 1 : i32
%372 = arith.extsi %370 : i32 to i64
%371 = arith.subi %369, %372 : i64
%373 = arith.cmpi slt, %366, %371 : i64
cf.cond_br %373, ^bb55, ^bb56
^bb55:
%374 = arith.constant 1 : i32
%375 = arith.extsi %374 : i32 to i64
%376 = llvm.mlir.constant(1 : i64) : i64
%377 = llvm.alloca %376 x i64 : (i64) -> !llvm.ptr
llvm.store %375, %377 : i64, !llvm.ptr
cf.br ^bb57
^bb57:
%378 = llvm.load %377 : !llvm.ptr -> i64
%379 = llvm.mlir.addressof @W : !llvm.ptr
%380 = llvm.load %379 : !llvm.ptr -> i32
%381 = arith.extsi %380 : i32 to i64
%382 = llvm.load %365 : !llvm.ptr -> i64
%383 = arith.subi %381, %382 : i64
%384 = arith.cmpi slt, %378, %383 : i64
cf.cond_br %384, ^bb58, ^bb59
^bb58:
%385 = llvm.mlir.addressof @W : !llvm.ptr
%386 = llvm.load %385 : !llvm.ptr -> i32
%387 = arith.extsi %386 : i32 to i64
%388 = llvm.load %365 : !llvm.ptr -> i64
%389 = arith.subi %387, %388 : i64
%390 = llvm.load %377 : !llvm.ptr -> i64
%391 = arith.subi %389, %390 : i64
%392 = arith.constant 1 : i32
%394 = arith.extsi %392 : i32 to i64
%393 = arith.cmpi sge, %391, %394 : i64
cf.cond_br %393, ^bb60, ^bb61
^bb60:
%395 = arith.constant 1 : i32
%396 = arith.extsi %395 : i32 to i64
%397 = llvm.mlir.constant(1 : i64) : i64
%398 = llvm.alloca %397 x i64 : (i64) -> !llvm.ptr
llvm.store %396, %398 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%399 = llvm.load %398 : !llvm.ptr -> i64
%400 = arith.cmpi sle, %399, %391 : i64
cf.cond_br %400, ^bb64, ^bb65
^bb64:
%402 = llvm.load %365 : !llvm.ptr -> i64
%403 = llvm.load %377 : !llvm.ptr -> i64
%404 = llvm.load %398 : !llvm.ptr -> i64
func.call @reduced_hook(%402, %403, %404) : (i64, i64, i64) -> ()
%405 = llvm.mlir.addressof @g_mv_out : !llvm.ptr
%406 = llvm.load %405 : !llvm.ptr -> i64
%407 = llvm.mlir.addressof @g_nv_out : !llvm.ptr
%408 = llvm.load %407 : !llvm.ptr -> i64
%409 = arith.constant 1 : i32
%411 = arith.extsi %409 : i32 to i64
%410 = arith.cmpi eq, %408, %411 : i64
cf.cond_br %410, ^bb66, ^bb67
^bb66:
%412 = arith.constant 1 : i32
%414 = arith.extsi %412 : i32 to i64
%413 = arith.subi %406, %414 : i64
%416 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
%417 = llvm.load %416 : !llvm.ptr -> !llvm.ptr
%418 = arith.constant 1000 : i32
%420 = arith.extsi %418 : i32 to i64
%419 = arith.addi %413, %420 : i64
%421 = llvm.getelementptr %417[%419] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%415 = llvm.load %421 : !llvm.ptr -> i64
%422 = arith.constant 1 : i32
%424 = arith.extsi %422 : i32 to i64
%423 = arith.addi %415, %424 : i64
%425 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
%426 = llvm.load %425 : !llvm.ptr -> !llvm.ptr
%427 = arith.constant 1000 : i32
%429 = arith.extsi %427 : i32 to i64
%428 = arith.addi %413, %429 : i64
%430 = llvm.getelementptr %426[%428] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %423, %430 : i64, !llvm.ptr
cf.br ^bb68
^bb67:
%431 = arith.constant 1 : i32
%433 = arith.extsi %431 : i32 to i64
%432 = arith.cmpi eq, %406, %433 : i64
cf.cond_br %432, ^bb69, ^bb70
^bb69:
%434 = arith.constant 1 : i32
%436 = arith.extsi %434 : i32 to i64
%435 = arith.subi %408, %436 : i64
%438 = arith.constant 0 : i64
%437 = arith.subi %438, %435 : i64
%440 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
%441 = llvm.load %440 : !llvm.ptr -> !llvm.ptr
%442 = arith.constant 1000 : i32
%444 = arith.extsi %442 : i32 to i64
%443 = arith.addi %437, %444 : i64
%445 = llvm.getelementptr %441[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%439 = llvm.load %445 : !llvm.ptr -> i64
%446 = arith.constant 1 : i32
%448 = arith.extsi %446 : i32 to i64
%447 = arith.addi %439, %448 : i64
%449 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
%450 = llvm.load %449 : !llvm.ptr -> !llvm.ptr
%451 = arith.constant 1000 : i32
%453 = arith.extsi %451 : i32 to i64
%452 = arith.addi %437, %453 : i64
%454 = llvm.getelementptr %450[%452] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %447, %454 : i64, !llvm.ptr
cf.br ^bb71
^bb70:
%455 = arith.addi %406, %408 : i64
%456 = arith.constant 4 : i32
%458 = arith.extsi %456 : i32 to i64
%457 = arith.subi %455, %458 : i64
%459 = arith.constant 2 : i32
%461 = arith.extsi %459 : i32 to i64
%460 = arith.subi %408, %461 : i64
%463 = arith.constant 0 : i64
%462 = arith.subi %463, %460 : i64
%464 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%465 = llvm.load %464 : !llvm.ptr -> !llvm.ptr
%466 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
%467 = llvm.load %466 : !llvm.ptr -> i32
%468 = arith.extsi %467 : i32 to i64
%469 = llvm.getelementptr %465[%468] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %457, %469 : i64, !llvm.ptr
%470 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%471 = llvm.load %470 : !llvm.ptr -> !llvm.ptr
%472 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
%473 = llvm.load %472 : !llvm.ptr -> i32
%474 = arith.extsi %473 : i32 to i64
%475 = llvm.getelementptr %471[%474] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %462, %475 : i64, !llvm.ptr
%476 = arith.constant 1 : i32
%477 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%478 = llvm.load %477 : !llvm.ptr -> !llvm.ptr
%479 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
%480 = llvm.load %479 : !llvm.ptr -> i32
%481 = arith.extsi %476 : i32 to i64
%482 = arith.extsi %480 : i32 to i64
%483 = llvm.getelementptr %478[%482] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %481, %483 : i64, !llvm.ptr
%484 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
%485 = llvm.load %484 : !llvm.ptr -> i32
%486 = arith.constant 1 : i32
%487 = arith.addi %485, %486 : i32
%488 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
llvm.store %487, %488 : i32, !llvm.ptr
cf.br ^bb71
^bb71:
cf.br ^bb68
^bb68:
%489 = llvm.load %398 : !llvm.ptr -> i64
%490 = arith.constant 1 : i32
%492 = arith.extsi %490 : i32 to i64
%491 = arith.addi %489, %492 : i64
llvm.store %491, %398 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
%493 = llvm.load %377 : !llvm.ptr -> i64
%494 = arith.constant 1 : i32
%496 = arith.extsi %494 : i32 to i64
%495 = arith.addi %493, %496 : i64
llvm.store %495, %377 : i64, !llvm.ptr
cf.br ^bb57
^bb59:
%497 = llvm.load %365 : !llvm.ptr -> i64
%498 = arith.constant 1 : i32
%500 = arith.extsi %498 : i32 to i64
%499 = arith.addi %497, %500 : i64
llvm.store %499, %365 : i64, !llvm.ptr
cf.br ^bb54
^bb56:
%502 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
%503 = llvm.load %502 : !llvm.ptr -> i32
func.call @heapsort_temp(%503) : (i32) -> ()
%504 = arith.constant 0 : i32
%505 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
llvm.store %504, %505 : i32, !llvm.ptr
%506 = arith.constant 0 : i32
%507 = llvm.mlir.constant(1 : i64) : i64
%508 = llvm.alloca %507 x i32 : (i64) -> !llvm.ptr
llvm.store %506, %508 : i32, !llvm.ptr
cf.br ^bb72
^bb72:
%509 = llvm.load %508 : !llvm.ptr -> i32
%510 = llvm.mlir.addressof @g_temp_n : !llvm.ptr
%511 = llvm.load %510 : !llvm.ptr -> i32
%512 = arith.cmpi slt, %509, %511 : i32
cf.cond_br %512, ^bb73, ^bb74
^bb73:
%513 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%514 = llvm.load %513 : !llvm.ptr -> i32
%515 = arith.constant 0 : i32
%516 = arith.cmpi sgt, %514, %515 : i32
cf.cond_br %516, ^bb75, ^bb76
^bb75:
%518 = llvm.mlir.addressof @g_hot_t : !llvm.ptr
%519 = llvm.load %518 : !llvm.ptr -> !llvm.ptr
%520 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%521 = llvm.load %520 : !llvm.ptr -> i32
%522 = arith.constant 1 : i32
%523 = arith.subi %521, %522 : i32
%524 = arith.extsi %523 : i32 to i64
%525 = llvm.getelementptr %519[%524] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%517 = llvm.load %525 : !llvm.ptr -> i64
%527 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%528 = llvm.load %527 : !llvm.ptr -> !llvm.ptr
%529 = llvm.load %508 : !llvm.ptr -> i32
%530 = arith.extsi %529 : i32 to i64
%531 = llvm.getelementptr %528[%530] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%526 = llvm.load %531 : !llvm.ptr -> i64
%532 = arith.cmpi eq, %517, %526 : i64
%533 = scf.if %532 -> (i1) {
%535 = llvm.mlir.addressof @g_hot_r : !llvm.ptr
%536 = llvm.load %535 : !llvm.ptr -> !llvm.ptr
%537 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%538 = llvm.load %537 : !llvm.ptr -> i32
%539 = arith.constant 1 : i32
%540 = arith.subi %538, %539 : i32
%541 = arith.extsi %540 : i32 to i64
%542 = llvm.getelementptr %536[%541] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%534 = llvm.load %542 : !llvm.ptr -> i64
%544 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%545 = llvm.load %544 : !llvm.ptr -> !llvm.ptr
%546 = llvm.load %508 : !llvm.ptr -> i32
%547 = arith.extsi %546 : i32 to i64
%548 = llvm.getelementptr %545[%547] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%543 = llvm.load %548 : !llvm.ptr -> i64
%549 = arith.cmpi eq, %534, %543 : i64
scf.yield %549 : i1
} else {
%550 = arith.constant false
scf.yield %550 : i1
}
cf.cond_br %533, ^bb78, ^bb79
^bb78:
%552 = llvm.mlir.addressof @g_hot_count : !llvm.ptr
%553 = llvm.load %552 : !llvm.ptr -> !llvm.ptr
%554 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%555 = llvm.load %554 : !llvm.ptr -> i32
%556 = arith.constant 1 : i32
%557 = arith.subi %555, %556 : i32
%558 = arith.extsi %557 : i32 to i64
%559 = llvm.getelementptr %553[%558] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%551 = llvm.load %559 : !llvm.ptr -> i64
%560 = arith.constant 1 : i32
%562 = arith.extsi %560 : i32 to i64
%561 = arith.addi %551, %562 : i64
%563 = llvm.mlir.addressof @g_hot_count : !llvm.ptr
%564 = llvm.load %563 : !llvm.ptr -> !llvm.ptr
%565 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%566 = llvm.load %565 : !llvm.ptr -> i32
%567 = arith.constant 1 : i32
%568 = arith.subi %566, %567 : i32
%569 = arith.extsi %568 : i32 to i64
%570 = llvm.getelementptr %564[%569] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %561, %570 : i64, !llvm.ptr
cf.br ^bb80
^bb79:
%572 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%573 = llvm.load %572 : !llvm.ptr -> !llvm.ptr
%574 = llvm.load %508 : !llvm.ptr -> i32
%575 = arith.extsi %574 : i32 to i64
%576 = llvm.getelementptr %573[%575] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%571 = llvm.load %576 : !llvm.ptr -> i64
%577 = llvm.mlir.addressof @g_hot_t : !llvm.ptr
%578 = llvm.load %577 : !llvm.ptr -> !llvm.ptr
%579 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%580 = llvm.load %579 : !llvm.ptr -> i32
%581 = arith.extsi %580 : i32 to i64
%582 = llvm.getelementptr %578[%581] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %571, %582 : i64, !llvm.ptr
%584 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%585 = llvm.load %584 : !llvm.ptr -> !llvm.ptr
%586 = llvm.load %508 : !llvm.ptr -> i32
%587 = arith.extsi %586 : i32 to i64
%588 = llvm.getelementptr %585[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%583 = llvm.load %588 : !llvm.ptr -> i64
%589 = llvm.mlir.addressof @g_hot_r : !llvm.ptr
%590 = llvm.load %589 : !llvm.ptr -> !llvm.ptr
%591 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%592 = llvm.load %591 : !llvm.ptr -> i32
%593 = arith.extsi %592 : i32 to i64
%594 = llvm.getelementptr %590[%593] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %583, %594 : i64, !llvm.ptr
%596 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%597 = llvm.load %596 : !llvm.ptr -> !llvm.ptr
%598 = llvm.load %508 : !llvm.ptr -> i32
%599 = arith.extsi %598 : i32 to i64
%600 = llvm.getelementptr %597[%599] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%595 = llvm.load %600 : !llvm.ptr -> i64
%601 = llvm.mlir.addressof @g_hot_count : !llvm.ptr
%602 = llvm.load %601 : !llvm.ptr -> !llvm.ptr
%603 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%604 = llvm.load %603 : !llvm.ptr -> i32
%605 = arith.extsi %604 : i32 to i64
%606 = llvm.getelementptr %602[%605] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %595, %606 : i64, !llvm.ptr
%607 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%608 = llvm.load %607 : !llvm.ptr -> i32
%609 = arith.constant 1 : i32
%610 = arith.addi %608, %609 : i32
%611 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
llvm.store %610, %611 : i32, !llvm.ptr
cf.br ^bb80
^bb80:
cf.br ^bb77
^bb76:
%613 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
%614 = llvm.load %613 : !llvm.ptr -> !llvm.ptr
%615 = llvm.load %508 : !llvm.ptr -> i32
%616 = arith.extsi %615 : i32 to i64
%617 = llvm.getelementptr %614[%616] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%612 = llvm.load %617 : !llvm.ptr -> i64
%618 = llvm.mlir.addressof @g_hot_t : !llvm.ptr
%619 = llvm.load %618 : !llvm.ptr -> !llvm.ptr
%620 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%621 = llvm.load %620 : !llvm.ptr -> i32
%622 = arith.extsi %621 : i32 to i64
%623 = llvm.getelementptr %619[%622] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %612, %623 : i64, !llvm.ptr
%625 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
%626 = llvm.load %625 : !llvm.ptr -> !llvm.ptr
%627 = llvm.load %508 : !llvm.ptr -> i32
%628 = arith.extsi %627 : i32 to i64
%629 = llvm.getelementptr %626[%628] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%624 = llvm.load %629 : !llvm.ptr -> i64
%630 = llvm.mlir.addressof @g_hot_r : !llvm.ptr
%631 = llvm.load %630 : !llvm.ptr -> !llvm.ptr
%632 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%633 = llvm.load %632 : !llvm.ptr -> i32
%634 = arith.extsi %633 : i32 to i64
%635 = llvm.getelementptr %631[%634] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %624, %635 : i64, !llvm.ptr
%637 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
%638 = llvm.load %637 : !llvm.ptr -> !llvm.ptr
%639 = llvm.load %508 : !llvm.ptr -> i32
%640 = arith.extsi %639 : i32 to i64
%641 = llvm.getelementptr %638[%640] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%636 = llvm.load %641 : !llvm.ptr -> i64
%642 = llvm.mlir.addressof @g_hot_count : !llvm.ptr
%643 = llvm.load %642 : !llvm.ptr -> !llvm.ptr
%644 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%645 = llvm.load %644 : !llvm.ptr -> i32
%646 = arith.extsi %645 : i32 to i64
%647 = llvm.getelementptr %643[%646] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %636, %647 : i64, !llvm.ptr
%648 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%649 = llvm.load %648 : !llvm.ptr -> i32
%650 = arith.constant 1 : i32
%651 = arith.addi %649, %650 : i32
%652 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
llvm.store %651, %652 : i32, !llvm.ptr
cf.br ^bb77
^bb77:
%653 = llvm.load %508 : !llvm.ptr -> i32
%654 = arith.constant 1 : i32
%655 = arith.addi %653, %654 : i32
llvm.store %655, %508 : i32, !llvm.ptr
cf.br ^bb72
^bb74:
%656 = arith.constant 0 : i32
%657 = llvm.mlir.addressof @g_num_int_vals : !llvm.ptr
llvm.store %656, %657 : i32, !llvm.ptr
%658 = arith.constant 1000 : i32
%660 = arith.constant 0 : i32
%659 = arith.subi %660, %658 : i32
%661 = llvm.mlir.constant(1 : i64) : i64
%662 = llvm.alloca %661 x i32 : (i64) -> !llvm.ptr
llvm.store %659, %662 : i32, !llvm.ptr
cf.br ^bb81
^bb81:
%663 = llvm.load %662 : !llvm.ptr -> i32
%664 = arith.constant 1000 : i32
%665 = arith.cmpi sle, %663, %664 : i32
cf.cond_br %665, ^bb82, ^bb83
^bb82:
%667 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
%668 = llvm.load %667 : !llvm.ptr -> !llvm.ptr
%669 = llvm.load %662 : !llvm.ptr -> i32
%670 = arith.constant 1000 : i32
%671 = arith.addi %669, %670 : i32
%672 = arith.extsi %671 : i32 to i64
%673 = llvm.getelementptr %668[%672] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%666 = llvm.load %673 : !llvm.ptr -> i64
%674 = arith.constant 0 : i32
%676 = arith.extsi %674 : i32 to i64
%675 = arith.cmpi sgt, %666, %676 : i64
cf.cond_br %675, ^bb84, ^bb85
^bb84:
%677 = llvm.load %662 : !llvm.ptr -> i32
%678 = arith.extsi %677 : i32 to i64
%679 = llvm.mlir.addressof @g_int_vals : !llvm.ptr
%680 = llvm.load %679 : !llvm.ptr -> !llvm.ptr
%681 = llvm.mlir.addressof @g_num_int_vals : !llvm.ptr
%682 = llvm.load %681 : !llvm.ptr -> i32
%683 = arith.extsi %682 : i32 to i64
%684 = llvm.getelementptr %680[%683] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %678, %684 : i64, !llvm.ptr
%685 = llvm.mlir.addressof @g_num_int_vals : !llvm.ptr
%686 = llvm.load %685 : !llvm.ptr -> i32
%687 = arith.constant 1 : i32
%688 = arith.addi %686, %687 : i32
%689 = llvm.mlir.addressof @g_num_int_vals : !llvm.ptr
llvm.store %688, %689 : i32, !llvm.ptr
cf.br ^bb86
^bb85:
cf.br ^bb86
^bb86:
%690 = llvm.load %662 : !llvm.ptr -> i32
%691 = arith.constant 1 : i32
%692 = arith.addi %690, %691 : i32
llvm.store %692, %662 : i32, !llvm.ptr
cf.br ^bb81
^bb83:
func.return
}
// Module static: g_hot_a
llvm.mlir.global internal @g_hot_a() {addr_space = 0 : i32} : !llvm.ptr {
%693 = llvm.mlir.zero : !llvm.ptr
llvm.return %693 : !llvm.ptr
}
// Module static: g_hot_b
llvm.mlir.global internal @g_hot_b() {addr_space = 0 : i32} : !llvm.ptr {
%694 = llvm.mlir.zero : !llvm.ptr
llvm.return %694 : !llvm.ptr
}
// Module static: g_int_a
llvm.mlir.global internal @g_int_a() {addr_space = 0 : i32} : !llvm.ptr {
%695 = llvm.mlir.zero : !llvm.ptr
llvm.return %695 : !llvm.ptr
}
// Module static: g_int_b
llvm.mlir.global internal @g_int_b() {addr_space = 0 : i32} : !llvm.ptr {
%696 = llvm.mlir.zero : !llvm.ptr
llvm.return %696 : !llvm.ptr
}
// Module static: g_hot_min_a
llvm.mlir.global internal @g_hot_min_a() {addr_space = 0 : i32} : !llvm.ptr {
%697 = llvm.mlir.zero : !llvm.ptr
llvm.return %697 : !llvm.ptr
}
// Module static: g_hot_max_a
llvm.mlir.global internal @g_hot_max_a() {addr_space = 0 : i32} : !llvm.ptr {
%698 = llvm.mlir.zero : !llvm.ptr
llvm.return %698 : !llvm.ptr
}
// Module static: g_hot_min_b
llvm.mlir.global internal @g_hot_min_b() {addr_space = 0 : i32} : !llvm.ptr {
%699 = llvm.mlir.zero : !llvm.ptr
llvm.return %699 : !llvm.ptr
}
// Module static: g_hot_max_b
llvm.mlir.global internal @g_hot_max_b() {addr_space = 0 : i32} : !llvm.ptr {
%700 = llvm.mlir.zero : !llvm.ptr
llvm.return %700 : !llvm.ptr
}
// Module static: g_int_min_a
llvm.mlir.global internal @g_int_min_a() {addr_space = 0 : i32} : !llvm.ptr {
%701 = llvm.mlir.zero : !llvm.ptr
llvm.return %701 : !llvm.ptr
}
// Module static: g_int_max_a
llvm.mlir.global internal @g_int_max_a() {addr_space = 0 : i32} : !llvm.ptr {
%702 = llvm.mlir.zero : !llvm.ptr
llvm.return %702 : !llvm.ptr
}
// Module static: g_int_min_b
llvm.mlir.global internal @g_int_min_b() {addr_space = 0 : i32} : !llvm.ptr {
%703 = llvm.mlir.zero : !llvm.ptr
llvm.return %703 : !llvm.ptr
}
// Module static: g_int_max_b
llvm.mlir.global internal @g_int_max_b() {addr_space = 0 : i32} : !llvm.ptr {
%704 = llvm.mlir.zero : !llvm.ptr
llvm.return %704 : !llvm.ptr
}
func.func @main() -> i32 {
%706 = arith.constant 2001 : i32
%707 = arith.constant 8 : i32
%708 = arith.extsi %706 : i32 to i64
%709 = arith.extsi %707 : i32 to i64
%705 = func.call @calloc(%708, %709) : (i64, i64) -> !llvm.ptr
%710 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
llvm.store %705, %710 : !llvm.ptr, !llvm.ptr
%712 = arith.constant 2001 : i32
%713 = arith.constant 8 : i32
%714 = arith.extsi %712 : i32 to i64
%715 = arith.extsi %713 : i32 to i64
%711 = func.call @calloc(%714, %715) : (i64, i64) -> !llvm.ptr
%716 = llvm.mlir.addressof @g_int_vals : !llvm.ptr
llvm.store %711, %716 : !llvm.ptr, !llvm.ptr
%718 = arith.constant 2000 : i32
%719 = arith.constant 8 : i32
%720 = arith.extsi %718 : i32 to i64
%721 = arith.extsi %719 : i32 to i64
%717 = func.call @calloc(%720, %721) : (i64, i64) -> !llvm.ptr
%722 = llvm.mlir.addressof @g_hot_t : !llvm.ptr
llvm.store %717, %722 : !llvm.ptr, !llvm.ptr
%724 = arith.constant 2000 : i32
%725 = arith.constant 8 : i32
%726 = arith.extsi %724 : i32 to i64
%727 = arith.extsi %725 : i32 to i64
%723 = func.call @calloc(%726, %727) : (i64, i64) -> !llvm.ptr
%728 = llvm.mlir.addressof @g_hot_r : !llvm.ptr
llvm.store %723, %728 : !llvm.ptr, !llvm.ptr
%730 = arith.constant 2000 : i32
%731 = arith.constant 8 : i32
%732 = arith.extsi %730 : i32 to i64
%733 = arith.extsi %731 : i32 to i64
%729 = func.call @calloc(%732, %733) : (i64, i64) -> !llvm.ptr
%734 = llvm.mlir.addressof @g_hot_count : !llvm.ptr
llvm.store %729, %734 : !llvm.ptr, !llvm.ptr
%736 = arith.constant 50000 : i32
%737 = arith.constant 8 : i32
%738 = arith.extsi %736 : i32 to i64
%739 = arith.extsi %737 : i32 to i64
%735 = func.call @calloc(%738, %739) : (i64, i64) -> !llvm.ptr
%740 = llvm.mlir.addressof @g_temp_t : !llvm.ptr
llvm.store %735, %740 : !llvm.ptr, !llvm.ptr
%742 = arith.constant 50000 : i32
%743 = arith.constant 8 : i32
%744 = arith.extsi %742 : i32 to i64
%745 = arith.extsi %743 : i32 to i64
%741 = func.call @calloc(%744, %745) : (i64, i64) -> !llvm.ptr
%746 = llvm.mlir.addressof @g_temp_r : !llvm.ptr
llvm.store %741, %746 : !llvm.ptr, !llvm.ptr
%748 = arith.constant 50000 : i32
%749 = arith.constant 8 : i32
%750 = arith.extsi %748 : i32 to i64
%751 = arith.extsi %749 : i32 to i64
%747 = func.call @calloc(%750, %751) : (i64, i64) -> !llvm.ptr
%752 = llvm.mlir.addressof @g_temp_count : !llvm.ptr
llvm.store %747, %752 : !llvm.ptr, !llvm.ptr
%753 = arith.constant 9 : i32
%754 = arith.constant 2 : i32
%755 = arith.muli %753, %754 : i32
%756 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%757 = llvm.load %756 : !llvm.ptr -> i32
%758 = arith.extsi %757 : i32 to i64
%760 = arith.extsi %755 : i32 to i64
%759 = arith.muli %760, %758 : i64
%762 = arith.constant 8 : i32
%763 = arith.extsi %762 : i32 to i64
%761 = func.call @calloc(%759, %763) : (i64, i64) -> !llvm.ptr
%764 = llvm.mlir.addressof @g_hot_a : !llvm.ptr
llvm.store %761, %764 : !llvm.ptr, !llvm.ptr
%766 = arith.constant 8 : i32
%767 = arith.extsi %766 : i32 to i64
%765 = func.call @calloc(%759, %767) : (i64, i64) -> !llvm.ptr
%768 = llvm.mlir.addressof @g_hot_b : !llvm.ptr
llvm.store %765, %768 : !llvm.ptr, !llvm.ptr
%769 = arith.constant 9 : i32
%770 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%771 = llvm.load %770 : !llvm.ptr -> i32
%772 = arith.extsi %771 : i32 to i64
%774 = arith.extsi %769 : i32 to i64
%773 = arith.muli %774, %772 : i64
%776 = arith.constant 8 : i32
%777 = arith.extsi %776 : i32 to i64
%775 = func.call @calloc(%773, %777) : (i64, i64) -> !llvm.ptr
%778 = llvm.mlir.addressof @g_int_a : !llvm.ptr
llvm.store %775, %778 : !llvm.ptr, !llvm.ptr
%780 = arith.constant 8 : i32
%781 = arith.extsi %780 : i32 to i64
%779 = func.call @calloc(%773, %781) : (i64, i64) -> !llvm.ptr
%782 = llvm.mlir.addressof @g_int_b : !llvm.ptr
llvm.store %779, %782 : !llvm.ptr, !llvm.ptr
%784 = arith.constant 18 : i32
%785 = arith.constant 8 : i32
%786 = arith.extsi %784 : i32 to i64
%787 = arith.extsi %785 : i32 to i64
%783 = func.call @calloc(%786, %787) : (i64, i64) -> !llvm.ptr
%788 = llvm.mlir.addressof @g_hot_min_a : !llvm.ptr
llvm.store %783, %788 : !llvm.ptr, !llvm.ptr
%790 = arith.constant 18 : i32
%791 = arith.constant 8 : i32
%792 = arith.extsi %790 : i32 to i64
%793 = arith.extsi %791 : i32 to i64
%789 = func.call @calloc(%792, %793) : (i64, i64) -> !llvm.ptr
%794 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
llvm.store %789, %794 : !llvm.ptr, !llvm.ptr
%796 = arith.constant 18 : i32
%797 = arith.constant 8 : i32
%798 = arith.extsi %796 : i32 to i64
%799 = arith.extsi %797 : i32 to i64
%795 = func.call @calloc(%798, %799) : (i64, i64) -> !llvm.ptr
%800 = llvm.mlir.addressof @g_hot_min_b : !llvm.ptr
llvm.store %795, %800 : !llvm.ptr, !llvm.ptr
%802 = arith.constant 18 : i32
%803 = arith.constant 8 : i32
%804 = arith.extsi %802 : i32 to i64
%805 = arith.extsi %803 : i32 to i64
%801 = func.call @calloc(%804, %805) : (i64, i64) -> !llvm.ptr
%806 = llvm.mlir.addressof @g_hot_max_b : !llvm.ptr
llvm.store %801, %806 : !llvm.ptr, !llvm.ptr
%808 = arith.constant 9 : i32
%809 = arith.constant 8 : i32
%810 = arith.extsi %808 : i32 to i64
%811 = arith.extsi %809 : i32 to i64
%807 = func.call @calloc(%810, %811) : (i64, i64) -> !llvm.ptr
%812 = llvm.mlir.addressof @g_int_min_a : !llvm.ptr
llvm.store %807, %812 : !llvm.ptr, !llvm.ptr
%814 = arith.constant 9 : i32
%815 = arith.constant 8 : i32
%816 = arith.extsi %814 : i32 to i64
%817 = arith.extsi %815 : i32 to i64
%813 = func.call @calloc(%816, %817) : (i64, i64) -> !llvm.ptr
%818 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
llvm.store %813, %818 : !llvm.ptr, !llvm.ptr
%820 = arith.constant 9 : i32
%821 = arith.constant 8 : i32
%822 = arith.extsi %820 : i32 to i64
%823 = arith.extsi %821 : i32 to i64
%819 = func.call @calloc(%822, %823) : (i64, i64) -> !llvm.ptr
%824 = llvm.mlir.addressof @g_int_min_b : !llvm.ptr
llvm.store %819, %824 : !llvm.ptr, !llvm.ptr
%826 = arith.constant 9 : i32
%827 = arith.constant 8 : i32
%828 = arith.extsi %826 : i32 to i64
%829 = arith.extsi %827 : i32 to i64
%825 = func.call @calloc(%828, %829) : (i64, i64) -> !llvm.ptr
%830 = llvm.mlir.addressof @g_int_max_b : !llvm.ptr
llvm.store %825, %830 : !llvm.ptr, !llvm.ptr
%832 = arith.constant 10 : i32
%833 = arith.constant 8 : i32
%834 = arith.extsi %832 : i32 to i64
%835 = arith.extsi %833 : i32 to i64
%831 = func.call @calloc(%834, %835) : (i64, i64) -> !llvm.ptr
%837 = arith.constant 10 : i32
%838 = arith.constant 8 : i32
%839 = arith.extsi %837 : i32 to i64
%840 = arith.extsi %838 : i32 to i64
%836 = func.call @calloc(%839, %840) : (i64, i64) -> !llvm.ptr
%841 = arith.constant 1 : i32
%842 = arith.constant 0 : i32
%843 = arith.extsi %841 : i32 to i64
%844 = arith.extsi %842 : i32 to i64
%845 = llvm.getelementptr %831[%844] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %843, %845 : i64, !llvm.ptr
%846 = arith.constant 1 : i32
%847 = llvm.mlir.constant(1 : i64) : i64
%848 = llvm.alloca %847 x i32 : (i64) -> !llvm.ptr
llvm.store %846, %848 : i32, !llvm.ptr
cf.br ^bb87
^bb87:
%849 = llvm.load %848 : !llvm.ptr -> i32
%850 = llvm.mlir.addressof @M : !llvm.ptr
%851 = llvm.load %850 : !llvm.ptr -> i32
%852 = arith.cmpi sle, %849, %851 : i32
cf.cond_br %852, ^bb88, ^bb89
^bb88:
%854 = llvm.load %848 : !llvm.ptr -> i32
%855 = arith.constant 1 : i32
%856 = arith.subi %854, %855 : i32
%857 = arith.extsi %856 : i32 to i64
%858 = llvm.getelementptr %831[%857] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%853 = llvm.load %858 : !llvm.ptr -> i64
%859 = llvm.load %848 : !llvm.ptr -> i32
%860 = arith.extsi %859 : i32 to i64
%861 = arith.muli %853, %860 : i64
%862 = llvm.mlir.addressof @MOD : !llvm.ptr
%863 = llvm.load %862 : !llvm.ptr -> i64
%864 = arith.remsi %861, %863 : i64
%865 = llvm.load %848 : !llvm.ptr -> i32
%866 = arith.extsi %865 : i32 to i64
%867 = llvm.getelementptr %831[%866] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %864, %867 : i64, !llvm.ptr
%868 = llvm.load %848 : !llvm.ptr -> i32
%869 = arith.constant 1 : i32
%870 = arith.addi %868, %869 : i32
llvm.store %870, %848 : i32, !llvm.ptr
cf.br ^bb87
^bb89:
%873 = llvm.mlir.addressof @M : !llvm.ptr
%874 = llvm.load %873 : !llvm.ptr -> i32
%875 = arith.extsi %874 : i32 to i64
%876 = llvm.getelementptr %831[%875] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%872 = llvm.load %876 : !llvm.ptr -> i64
%877 = llvm.mlir.addressof @MOD : !llvm.ptr
%878 = llvm.load %877 : !llvm.ptr -> i64
%879 = arith.constant 2 : i32
%881 = arith.extsi %879 : i32 to i64
%880 = arith.subi %878, %881 : i64
%882 = llvm.mlir.addressof @MOD : !llvm.ptr
%883 = llvm.load %882 : !llvm.ptr -> i64
%871 = func.call @powmod(%872, %880, %883) : (i64, i64, i64) -> i64
%884 = llvm.mlir.addressof @M : !llvm.ptr
%885 = llvm.load %884 : !llvm.ptr -> i32
%886 = arith.extsi %885 : i32 to i64
%887 = llvm.getelementptr %836[%886] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %871, %887 : i64, !llvm.ptr
%888 = llvm.mlir.addressof @M : !llvm.ptr
%889 = llvm.load %888 : !llvm.ptr -> i32
%890 = llvm.mlir.constant(1 : i64) : i64
%891 = llvm.alloca %890 x i32 : (i64) -> !llvm.ptr
llvm.store %889, %891 : i32, !llvm.ptr
cf.br ^bb90
^bb90:
%892 = llvm.load %891 : !llvm.ptr -> i32
%893 = arith.constant 1 : i32
%894 = arith.cmpi sge, %892, %893 : i32
cf.cond_br %894, ^bb91, ^bb92
^bb91:
%896 = llvm.load %891 : !llvm.ptr -> i32
%897 = arith.extsi %896 : i32 to i64
%898 = llvm.getelementptr %836[%897] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%895 = llvm.load %898 : !llvm.ptr -> i64
%899 = llvm.load %891 : !llvm.ptr -> i32
%900 = arith.extsi %899 : i32 to i64
%901 = arith.muli %895, %900 : i64
%902 = llvm.mlir.addressof @MOD : !llvm.ptr
%903 = llvm.load %902 : !llvm.ptr -> i64
%904 = arith.remsi %901, %903 : i64
%905 = llvm.load %891 : !llvm.ptr -> i32
%906 = arith.constant 1 : i32
%907 = arith.subi %905, %906 : i32
%908 = arith.extsi %907 : i32 to i64
%909 = llvm.getelementptr %836[%908] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %904, %909 : i64, !llvm.ptr
%910 = llvm.load %891 : !llvm.ptr -> i32
%911 = arith.constant 1 : i32
%912 = arith.subi %910, %911 : i32
llvm.store %912, %891 : i32, !llvm.ptr
cf.br ^bb90
^bb92:
func.call @collect_counts() : () -> ()
%915 = llvm.mlir.addressof @g_hot_a : !llvm.ptr
%916 = llvm.load %915 : !llvm.ptr -> !llvm.ptr
%917 = arith.constant 0 : i32
%918 = arith.constant 8 : i32
%920 = arith.extsi %918 : i32 to i64
%919 = arith.muli %759, %920 : i64
%914 = func.call @memset(%916, %917, %919) : (!llvm.ptr, i32, i64) -> !llvm.ptr
%921 = arith.constant 0 : i32
%922 = llvm.mlir.constant(1 : i64) : i64
%923 = llvm.alloca %922 x i32 : (i64) -> !llvm.ptr
llvm.store %921, %923 : i32, !llvm.ptr
cf.br ^bb93
^bb93:
%924 = llvm.load %923 : !llvm.ptr -> i32
%925 = llvm.mlir.addressof @M : !llvm.ptr
%926 = llvm.load %925 : !llvm.ptr -> i32
%927 = arith.cmpi sle, %924, %926 : i32
cf.cond_br %927, ^bb94, ^bb95
^bb94:
%928 = arith.constant 0 : i32
%929 = llvm.mlir.constant(1 : i64) : i64
%930 = llvm.alloca %929 x i32 : (i64) -> !llvm.ptr
llvm.store %928, %930 : i32, !llvm.ptr
cf.br ^bb96
^bb96:
%931 = llvm.load %930 : !llvm.ptr -> i32
%932 = arith.constant 2 : i32
%933 = arith.cmpi slt, %931, %932 : i32
cf.cond_br %933, ^bb97, ^bb98
^bb97:
%934 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%935 = llvm.load %934 : !llvm.ptr -> i32
%936 = arith.extsi %935 : i32 to i64
%937 = llvm.mlir.addressof @g_hot_min_a : !llvm.ptr
%938 = llvm.load %937 : !llvm.ptr -> !llvm.ptr
%939 = llvm.load %923 : !llvm.ptr -> i32
%940 = arith.constant 2 : i32
%941 = arith.muli %939, %940 : i32
%942 = llvm.load %930 : !llvm.ptr -> i32
%943 = arith.addi %941, %942 : i32
%944 = arith.extsi %943 : i32 to i64
%945 = llvm.getelementptr %938[%944] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %936, %945 : i64, !llvm.ptr
%946 = arith.constant 1 : i32
%948 = arith.constant 0 : i32
%947 = arith.subi %948, %946 : i32
%949 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
%950 = llvm.load %949 : !llvm.ptr -> !llvm.ptr
%951 = llvm.load %923 : !llvm.ptr -> i32
%952 = arith.constant 2 : i32
%953 = arith.muli %951, %952 : i32
%954 = llvm.load %930 : !llvm.ptr -> i32
%955 = arith.addi %953, %954 : i32
%956 = arith.extsi %947 : i32 to i64
%957 = arith.extsi %955 : i32 to i64
%958 = llvm.getelementptr %950[%957] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %956, %958 : i64, !llvm.ptr
%959 = llvm.load %930 : !llvm.ptr -> i32
%960 = arith.constant 1 : i32
%961 = arith.addi %959, %960 : i32
llvm.store %961, %930 : i32, !llvm.ptr
cf.br ^bb96
^bb98:
%962 = llvm.load %923 : !llvm.ptr -> i32
%963 = arith.constant 1 : i32
%964 = arith.addi %962, %963 : i32
llvm.store %964, %923 : i32, !llvm.ptr
cf.br ^bb93
^bb95:
%965 = arith.constant 1 : i32
%966 = llvm.mlir.addressof @g_hot_a : !llvm.ptr
%967 = llvm.load %966 : !llvm.ptr -> !llvm.ptr
%968 = arith.constant 0 : i32
%969 = arith.constant 2 : i32
%970 = arith.muli %968, %969 : i32
%971 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%972 = llvm.load %971 : !llvm.ptr -> i32
%973 = arith.muli %970, %972 : i32
%974 = arith.constant 0 : i32
%975 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%976 = llvm.load %975 : !llvm.ptr -> i32
%977 = arith.muli %974, %976 : i32
%978 = arith.addi %973, %977 : i32
%979 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%980 = llvm.load %979 : !llvm.ptr -> i32
%981 = arith.addi %978, %980 : i32
%982 = arith.extsi %965 : i32 to i64
%983 = arith.extsi %981 : i32 to i64
%984 = llvm.getelementptr %967[%983] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %982, %984 : i64, !llvm.ptr
%985 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%986 = llvm.load %985 : !llvm.ptr -> i32
%987 = arith.extsi %986 : i32 to i64
%988 = llvm.mlir.addressof @g_hot_min_a : !llvm.ptr
%989 = llvm.load %988 : !llvm.ptr -> !llvm.ptr
%990 = arith.constant 0 : i32
%991 = arith.constant 2 : i32
%992 = arith.muli %990, %991 : i32
%993 = arith.constant 0 : i32
%994 = arith.addi %992, %993 : i32
%995 = arith.extsi %994 : i32 to i64
%996 = llvm.getelementptr %989[%995] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %987, %996 : i64, !llvm.ptr
%997 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%998 = llvm.load %997 : !llvm.ptr -> i32
%999 = arith.extsi %998 : i32 to i64
%1000 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
%1001 = llvm.load %1000 : !llvm.ptr -> !llvm.ptr
%1002 = arith.constant 0 : i32
%1003 = arith.constant 2 : i32
%1004 = arith.muli %1002, %1003 : i32
%1005 = arith.constant 0 : i32
%1006 = arith.addi %1004, %1005 : i32
%1007 = arith.extsi %1006 : i32 to i64
%1008 = llvm.getelementptr %1001[%1007] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %999, %1008 : i64, !llvm.ptr
%1009 = arith.constant 0 : i32
%1010 = llvm.mlir.constant(1 : i64) : i64
%1011 = llvm.alloca %1010 x i32 : (i64) -> !llvm.ptr
llvm.store %1009, %1011 : i32, !llvm.ptr
cf.br ^bb99
^bb99:
%1012 = llvm.load %1011 : !llvm.ptr -> i32
%1013 = llvm.mlir.addressof @g_num_hot_types : !llvm.ptr
%1014 = llvm.load %1013 : !llvm.ptr -> i32
%1015 = arith.cmpi slt, %1012, %1014 : i32
cf.cond_br %1015, ^bb100, ^bb101
^bb100:
%1017 = llvm.mlir.addressof @g_hot_t : !llvm.ptr
%1018 = llvm.load %1017 : !llvm.ptr -> !llvm.ptr
%1019 = llvm.load %1011 : !llvm.ptr -> i32
%1020 = arith.extsi %1019 : i32 to i64
%1021 = llvm.getelementptr %1018[%1020] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1016 = llvm.load %1021 : !llvm.ptr -> i64
%1023 = llvm.mlir.addressof @g_hot_r : !llvm.ptr
%1024 = llvm.load %1023 : !llvm.ptr -> !llvm.ptr
%1025 = llvm.load %1011 : !llvm.ptr -> i32
%1026 = arith.extsi %1025 : i32 to i64
%1027 = llvm.getelementptr %1024[%1026] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1022 = llvm.load %1027 : !llvm.ptr -> i64
%1029 = llvm.mlir.addressof @g_hot_count : !llvm.ptr
%1030 = llvm.load %1029 : !llvm.ptr -> !llvm.ptr
%1031 = llvm.load %1011 : !llvm.ptr -> i32
%1032 = arith.extsi %1031 : i32 to i64
%1033 = llvm.getelementptr %1030[%1032] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1028 = llvm.load %1033 : !llvm.ptr -> i64
%1035 = arith.constant 10 : i32
%1036 = arith.constant 8 : i32
%1037 = arith.extsi %1035 : i32 to i64
%1038 = arith.extsi %1036 : i32 to i64
%1034 = func.call @calloc(%1037, %1038) : (i64, i64) -> !llvm.ptr
%1039 = arith.constant 1 : i32
%1040 = arith.constant 0 : i32
%1041 = arith.extsi %1039 : i32 to i64
%1042 = arith.extsi %1040 : i32 to i64
%1043 = llvm.getelementptr %1034[%1042] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1041, %1043 : i64, !llvm.ptr
%1044 = arith.constant 1 : i32
%1045 = arith.extsi %1044 : i32 to i64
%1046 = llvm.mlir.constant(1 : i64) : i64
%1047 = llvm.alloca %1046 x i64 : (i64) -> !llvm.ptr
llvm.store %1045, %1047 : i64, !llvm.ptr
%1048 = arith.constant 1 : i32
%1049 = llvm.mlir.constant(1 : i64) : i64
%1050 = llvm.alloca %1049 x i32 : (i64) -> !llvm.ptr
llvm.store %1048, %1050 : i32, !llvm.ptr
cf.br ^bb102
^bb102:
%1051 = llvm.load %1050 : !llvm.ptr -> i32
%1052 = llvm.mlir.addressof @M : !llvm.ptr
%1053 = llvm.load %1052 : !llvm.ptr -> i32
%1054 = arith.cmpi sle, %1051, %1053 : i32
cf.cond_br %1054, ^bb103, ^bb104
^bb103:
%1055 = llvm.load %1047 : !llvm.ptr -> i64
%1056 = arith.muli %1055, %1028 : i64
%1057 = llvm.mlir.addressof @MOD : !llvm.ptr
%1058 = llvm.load %1057 : !llvm.ptr -> i64
%1059 = arith.remsi %1056, %1058 : i64
llvm.store %1059, %1047 : i64, !llvm.ptr
%1060 = llvm.load %1047 : !llvm.ptr -> i64
%1062 = llvm.load %1050 : !llvm.ptr -> i32
%1063 = arith.extsi %1062 : i32 to i64
%1064 = llvm.getelementptr %836[%1063] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1061 = llvm.load %1064 : !llvm.ptr -> i64
%1065 = arith.muli %1060, %1061 : i64
%1066 = llvm.mlir.addressof @MOD : !llvm.ptr
%1067 = llvm.load %1066 : !llvm.ptr -> i64
%1068 = arith.remsi %1065, %1067 : i64
%1069 = llvm.load %1050 : !llvm.ptr -> i32
%1070 = arith.extsi %1069 : i32 to i64
%1071 = llvm.getelementptr %1034[%1070] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1068, %1071 : i64, !llvm.ptr
%1072 = llvm.load %1050 : !llvm.ptr -> i32
%1073 = arith.constant 1 : i32
%1074 = arith.addi %1072, %1073 : i32
llvm.store %1074, %1050 : i32, !llvm.ptr
cf.br ^bb102
^bb104:
%1076 = llvm.mlir.addressof @g_hot_b : !llvm.ptr
%1077 = llvm.load %1076 : !llvm.ptr -> !llvm.ptr
%1078 = arith.constant 0 : i32
%1079 = arith.constant 8 : i32
%1081 = arith.extsi %1079 : i32 to i64
%1080 = arith.muli %759, %1081 : i64
%1075 = func.call @memset(%1077, %1078, %1080) : (!llvm.ptr, i32, i64) -> !llvm.ptr
%1082 = arith.constant 0 : i32
%1083 = llvm.mlir.constant(1 : i64) : i64
%1084 = llvm.alloca %1083 x i32 : (i64) -> !llvm.ptr
llvm.store %1082, %1084 : i32, !llvm.ptr
cf.br ^bb105
^bb105:
%1085 = llvm.load %1084 : !llvm.ptr -> i32
%1086 = llvm.mlir.addressof @M : !llvm.ptr
%1087 = llvm.load %1086 : !llvm.ptr -> i32
%1088 = arith.cmpi sle, %1085, %1087 : i32
cf.cond_br %1088, ^bb106, ^bb107
^bb106:
%1089 = arith.constant 0 : i32
%1090 = llvm.mlir.constant(1 : i64) : i64
%1091 = llvm.alloca %1090 x i32 : (i64) -> !llvm.ptr
llvm.store %1089, %1091 : i32, !llvm.ptr
cf.br ^bb108
^bb108:
%1092 = llvm.load %1091 : !llvm.ptr -> i32
%1093 = arith.constant 2 : i32
%1094 = arith.cmpi slt, %1092, %1093 : i32
cf.cond_br %1094, ^bb109, ^bb110
^bb109:
%1095 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1096 = llvm.load %1095 : !llvm.ptr -> i32
%1097 = arith.extsi %1096 : i32 to i64
%1098 = llvm.mlir.addressof @g_hot_min_b : !llvm.ptr
%1099 = llvm.load %1098 : !llvm.ptr -> !llvm.ptr
%1100 = llvm.load %1084 : !llvm.ptr -> i32
%1101 = arith.constant 2 : i32
%1102 = arith.muli %1100, %1101 : i32
%1103 = llvm.load %1091 : !llvm.ptr -> i32
%1104 = arith.addi %1102, %1103 : i32
%1105 = arith.extsi %1104 : i32 to i64
%1106 = llvm.getelementptr %1099[%1105] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1097, %1106 : i64, !llvm.ptr
%1107 = arith.constant 1 : i32
%1109 = arith.constant 0 : i32
%1108 = arith.subi %1109, %1107 : i32
%1110 = llvm.mlir.addressof @g_hot_max_b : !llvm.ptr
%1111 = llvm.load %1110 : !llvm.ptr -> !llvm.ptr
%1112 = llvm.load %1084 : !llvm.ptr -> i32
%1113 = arith.constant 2 : i32
%1114 = arith.muli %1112, %1113 : i32
%1115 = llvm.load %1091 : !llvm.ptr -> i32
%1116 = arith.addi %1114, %1115 : i32
%1117 = arith.extsi %1108 : i32 to i64
%1118 = arith.extsi %1116 : i32 to i64
%1119 = llvm.getelementptr %1111[%1118] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1117, %1119 : i64, !llvm.ptr
%1120 = llvm.load %1091 : !llvm.ptr -> i32
%1121 = arith.constant 1 : i32
%1122 = arith.addi %1120, %1121 : i32
llvm.store %1122, %1091 : i32, !llvm.ptr
cf.br ^bb108
^bb110:
%1123 = llvm.load %1084 : !llvm.ptr -> i32
%1124 = arith.constant 1 : i32
%1125 = arith.addi %1123, %1124 : i32
llvm.store %1125, %1084 : i32, !llvm.ptr
cf.br ^bb105
^bb107:
%1126 = arith.constant 0 : i32
%1127 = llvm.mlir.constant(1 : i64) : i64
%1128 = llvm.alloca %1127 x i32 : (i64) -> !llvm.ptr
llvm.store %1126, %1128 : i32, !llvm.ptr
cf.br ^bb111
^bb111:
%1129 = llvm.load %1128 : !llvm.ptr -> i32
%1130 = llvm.mlir.addressof @M : !llvm.ptr
%1131 = llvm.load %1130 : !llvm.ptr -> i32
%1132 = arith.cmpi sle, %1129, %1131 : i32
cf.cond_br %1132, ^bb112, ^bb113
^bb112:
%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 ^bb114
^bb114:
%1136 = llvm.load %1135 : !llvm.ptr -> i32
%1137 = arith.constant 2 : i32
%1138 = arith.cmpi slt, %1136, %1137 : i32
cf.cond_br %1138, ^bb115, ^bb116
^bb115:
%1140 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
%1141 = llvm.load %1140 : !llvm.ptr -> !llvm.ptr
%1142 = llvm.load %1128 : !llvm.ptr -> i32
%1143 = arith.constant 2 : i32
%1144 = arith.muli %1142, %1143 : i32
%1145 = llvm.load %1135 : !llvm.ptr -> i32
%1146 = arith.addi %1144, %1145 : i32
%1147 = arith.extsi %1146 : i32 to i64
%1148 = llvm.getelementptr %1141[%1147] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1139 = llvm.load %1148 : !llvm.ptr -> i64
%1149 = arith.constant 0 : i32
%1151 = arith.extsi %1149 : i32 to i64
%1150 = arith.cmpi sge, %1139, %1151 : i64
cf.cond_br %1150, ^bb117, ^bb118
^bb117:
%1153 = llvm.mlir.addressof @g_hot_min_a : !llvm.ptr
%1154 = llvm.load %1153 : !llvm.ptr -> !llvm.ptr
%1155 = llvm.load %1128 : !llvm.ptr -> i32
%1156 = arith.constant 2 : i32
%1157 = arith.muli %1155, %1156 : i32
%1158 = llvm.load %1135 : !llvm.ptr -> i32
%1159 = arith.addi %1157, %1158 : i32
%1160 = arith.extsi %1159 : i32 to i64
%1161 = llvm.getelementptr %1154[%1160] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1152 = llvm.load %1161 : !llvm.ptr -> i64
%1163 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
%1164 = llvm.load %1163 : !llvm.ptr -> !llvm.ptr
%1165 = llvm.load %1128 : !llvm.ptr -> i32
%1166 = arith.constant 2 : i32
%1167 = arith.muli %1165, %1166 : i32
%1168 = llvm.load %1135 : !llvm.ptr -> i32
%1169 = arith.addi %1167, %1168 : i32
%1170 = arith.extsi %1169 : i32 to i64
%1171 = llvm.getelementptr %1164[%1170] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1162 = llvm.load %1171 : !llvm.ptr -> i64
%1172 = llvm.mlir.constant(1 : i64) : i64
%1173 = llvm.alloca %1172 x i64 : (i64) -> !llvm.ptr
llvm.store %1152, %1173 : i64, !llvm.ptr
cf.br ^bb120
^bb120:
%1174 = llvm.load %1173 : !llvm.ptr -> i64
%1175 = arith.cmpi sle, %1174, %1162 : i64
cf.cond_br %1175, ^bb121, ^bb122
^bb121:
%1177 = llvm.mlir.addressof @g_hot_a : !llvm.ptr
%1178 = llvm.load %1177 : !llvm.ptr -> !llvm.ptr
%1179 = llvm.load %1128 : !llvm.ptr -> i32
%1180 = arith.constant 2 : i32
%1181 = arith.muli %1179, %1180 : i32
%1182 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1183 = llvm.load %1182 : !llvm.ptr -> i32
%1184 = arith.muli %1181, %1183 : i32
%1185 = llvm.load %1135 : !llvm.ptr -> i32
%1186 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1187 = llvm.load %1186 : !llvm.ptr -> i32
%1188 = arith.muli %1185, %1187 : i32
%1189 = arith.addi %1184, %1188 : i32
%1190 = llvm.load %1173 : !llvm.ptr -> i64
%1192 = arith.extsi %1189 : i32 to i64
%1191 = arith.addi %1192, %1190 : i64
%1193 = llvm.getelementptr %1178[%1191] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1176 = llvm.load %1193 : !llvm.ptr -> i64
%1194 = arith.constant 0 : i32
%1196 = arith.extsi %1194 : i32 to i64
%1195 = arith.cmpi ne, %1176, %1196 : i64
cf.cond_br %1195, ^bb123, ^bb124
^bb123:
%1197 = arith.constant 0 : i32
%1198 = llvm.mlir.constant(1 : i64) : i64
%1199 = llvm.alloca %1198 x i32 : (i64) -> !llvm.ptr
llvm.store %1197, %1199 : i32, !llvm.ptr
cf.br ^bb126
^bb126:
%1200 = llvm.load %1199 : !llvm.ptr -> i32
%1201 = llvm.mlir.addressof @M : !llvm.ptr
%1202 = llvm.load %1201 : !llvm.ptr -> i32
%1203 = llvm.load %1128 : !llvm.ptr -> i32
%1204 = arith.subi %1202, %1203 : i32
%1205 = arith.cmpi sle, %1200, %1204 : i32
cf.cond_br %1205, ^bb127, ^bb128
^bb127:
%1207 = llvm.load %1199 : !llvm.ptr -> i32
%1208 = arith.extsi %1207 : i32 to i64
%1209 = llvm.getelementptr %1034[%1208] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1206 = llvm.load %1209 : !llvm.ptr -> i64
%1210 = arith.constant 0 : i32
%1212 = arith.extsi %1210 : i32 to i64
%1211 = arith.cmpi ne, %1206, %1212 : i64
cf.cond_br %1211, ^bb129, ^bb130
^bb129:
%1213 = llvm.load %1199 : !llvm.ptr -> i32
%1214 = arith.extsi %1213 : i32 to i64
%1215 = arith.constant 1 : i32
%1217 = arith.extsi %1215 : i32 to i64
%1216 = arith.addi %1214, %1217 : i64
%1218 = llvm.load %1135 : !llvm.ptr -> i32
%1219 = arith.extsi %1218 : i32 to i64
%1220 = arith.subi %1216, %1219 : i64
%1221 = arith.constant 2 : i32
%1223 = arith.extsi %1221 : i32 to i64
%1222 = arith.divsi %1220, %1223 : i64
%1224 = llvm.load %1199 : !llvm.ptr -> i32
%1225 = arith.extsi %1224 : i32 to i64
%1226 = arith.muli %1225, %1022 : i64
%1227 = arith.muli %1222, %1016 : i64
%1228 = arith.addi %1226, %1227 : i64
%1229 = llvm.load %1128 : !llvm.ptr -> i32
%1230 = llvm.load %1199 : !llvm.ptr -> i32
%1231 = arith.addi %1229, %1230 : i32
%1232 = llvm.load %1135 : !llvm.ptr -> i32
%1233 = llvm.load %1199 : !llvm.ptr -> i32
%1234 = arith.constant 1 : i32
%1235 = arith.andi %1233, %1234 : i32
%1236 = arith.xori %1232, %1235 : i32
%1237 = llvm.load %1173 : !llvm.ptr -> i64
%1238 = arith.addi %1237, %1228 : i64
%1239 = arith.constant 0 : i32
%1241 = arith.extsi %1239 : i32 to i64
%1240 = arith.cmpi sge, %1238, %1241 : i64
%1242 = scf.if %1240 -> (i1) {
%1243 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1244 = llvm.load %1243 : !llvm.ptr -> i32
%1245 = arith.extsi %1244 : i32 to i64
%1246 = arith.cmpi slt, %1238, %1245 : i64
scf.yield %1246 : i1
} else {
%1247 = arith.constant false
scf.yield %1247 : i1
}
cf.cond_br %1242, ^bb132, ^bb133
^bb132:
%1249 = llvm.mlir.addressof @g_hot_b : !llvm.ptr
%1250 = llvm.load %1249 : !llvm.ptr -> !llvm.ptr
%1251 = arith.constant 2 : i32
%1252 = arith.muli %1231, %1251 : i32
%1253 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1254 = llvm.load %1253 : !llvm.ptr -> i32
%1255 = arith.muli %1252, %1254 : i32
%1256 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1257 = llvm.load %1256 : !llvm.ptr -> i32
%1258 = arith.muli %1236, %1257 : i32
%1259 = arith.addi %1255, %1258 : i32
%1261 = arith.extsi %1259 : i32 to i64
%1260 = arith.addi %1261, %1238 : i64
%1262 = llvm.getelementptr %1250[%1260] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1248 = llvm.load %1262 : !llvm.ptr -> i64
%1263 = arith.extsi %1248 : i64 to i128
%1264 = arith.extsi %1176 : i64 to i128
%1265 = arith.extsi %1206 : i64 to i128
%1266 = llvm.mlir.addressof @MOD : !llvm.ptr
%1267 = llvm.load %1266 : !llvm.ptr -> i64
%1268 = arith.extsi %1267 : i64 to i128
%1270 = arith.trunci %1264 : i128 to i64
%1271 = arith.trunci %1265 : i128 to i64
%1269 = arith.muli %1270, %1271 : i64
%1273 = arith.trunci %1263 : i128 to i64
%1272 = arith.addi %1273, %1269 : i64
%1275 = arith.trunci %1268 : i128 to i64
%1274 = arith.remsi %1272, %1275 : i64
%1276 = llvm.mlir.addressof @g_hot_b : !llvm.ptr
%1277 = llvm.load %1276 : !llvm.ptr -> !llvm.ptr
%1278 = arith.constant 2 : i32
%1279 = arith.muli %1231, %1278 : i32
%1280 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1281 = llvm.load %1280 : !llvm.ptr -> i32
%1282 = arith.muli %1279, %1281 : i32
%1283 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1284 = llvm.load %1283 : !llvm.ptr -> i32
%1285 = arith.muli %1236, %1284 : i32
%1286 = arith.addi %1282, %1285 : i32
%1288 = arith.extsi %1286 : i32 to i64
%1287 = arith.addi %1288, %1238 : i64
%1289 = llvm.getelementptr %1277[%1287] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1274, %1289 : i64, !llvm.ptr
%1291 = llvm.mlir.addressof @g_hot_min_b : !llvm.ptr
%1292 = llvm.load %1291 : !llvm.ptr -> !llvm.ptr
%1293 = arith.constant 2 : i32
%1294 = arith.muli %1231, %1293 : i32
%1295 = arith.addi %1294, %1236 : i32
%1296 = arith.extsi %1295 : i32 to i64
%1297 = llvm.getelementptr %1292[%1296] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1290 = llvm.load %1297 : !llvm.ptr -> i64
%1298 = arith.cmpi slt, %1238, %1290 : i64
cf.cond_br %1298, ^bb135, ^bb136
^bb135:
%1299 = llvm.mlir.addressof @g_hot_min_b : !llvm.ptr
%1300 = llvm.load %1299 : !llvm.ptr -> !llvm.ptr
%1301 = arith.constant 2 : i32
%1302 = arith.muli %1231, %1301 : i32
%1303 = arith.addi %1302, %1236 : i32
%1304 = arith.extsi %1303 : i32 to i64
%1305 = llvm.getelementptr %1300[%1304] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1238, %1305 : i64, !llvm.ptr
cf.br ^bb137
^bb136:
cf.br ^bb137
^bb137:
%1307 = llvm.mlir.addressof @g_hot_max_b : !llvm.ptr
%1308 = llvm.load %1307 : !llvm.ptr -> !llvm.ptr
%1309 = arith.constant 2 : i32
%1310 = arith.muli %1231, %1309 : i32
%1311 = arith.addi %1310, %1236 : i32
%1312 = arith.extsi %1311 : i32 to i64
%1313 = llvm.getelementptr %1308[%1312] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1306 = llvm.load %1313 : !llvm.ptr -> i64
%1314 = arith.cmpi sgt, %1238, %1306 : i64
cf.cond_br %1314, ^bb138, ^bb139
^bb138:
%1315 = llvm.mlir.addressof @g_hot_max_b : !llvm.ptr
%1316 = llvm.load %1315 : !llvm.ptr -> !llvm.ptr
%1317 = arith.constant 2 : i32
%1318 = arith.muli %1231, %1317 : i32
%1319 = arith.addi %1318, %1236 : i32
%1320 = arith.extsi %1319 : i32 to i64
%1321 = llvm.getelementptr %1316[%1320] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1238, %1321 : i64, !llvm.ptr
cf.br ^bb140
^bb139:
cf.br ^bb140
^bb140:
cf.br ^bb134
^bb133:
cf.br ^bb134
^bb134:
cf.br ^bb131
^bb130:
cf.br ^bb131
^bb131:
%1322 = llvm.load %1199 : !llvm.ptr -> i32
%1323 = arith.constant 1 : i32
%1324 = arith.addi %1322, %1323 : i32
llvm.store %1324, %1199 : i32, !llvm.ptr
cf.br ^bb126
^bb128:
cf.br ^bb125
^bb124:
cf.br ^bb125
^bb125:
%1325 = llvm.load %1173 : !llvm.ptr -> i64
%1326 = arith.constant 1 : i32
%1328 = arith.extsi %1326 : i32 to i64
%1327 = arith.addi %1325, %1328 : i64
llvm.store %1327, %1173 : i64, !llvm.ptr
cf.br ^bb120
^bb122:
cf.br ^bb119
^bb118:
cf.br ^bb119
^bb119:
%1329 = llvm.load %1135 : !llvm.ptr -> i32
%1330 = arith.constant 1 : i32
%1331 = arith.addi %1329, %1330 : i32
llvm.store %1331, %1135 : i32, !llvm.ptr
cf.br ^bb114
^bb116:
%1332 = llvm.load %1128 : !llvm.ptr -> i32
%1333 = arith.constant 1 : i32
%1334 = arith.addi %1332, %1333 : i32
llvm.store %1334, %1128 : i32, !llvm.ptr
cf.br ^bb111
^bb113:
%1336 = llvm.mlir.addressof @g_hot_a : !llvm.ptr
%1337 = llvm.load %1336 : !llvm.ptr -> !llvm.ptr
%1338 = llvm.mlir.addressof @g_hot_b : !llvm.ptr
%1339 = llvm.load %1338 : !llvm.ptr -> !llvm.ptr
%1340 = arith.constant 8 : i32
%1342 = arith.extsi %1340 : i32 to i64
%1341 = arith.muli %759, %1342 : i64
%1335 = func.call @memcpy(%1337, %1339, %1341) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
%1344 = llvm.mlir.addressof @g_hot_min_a : !llvm.ptr
%1345 = llvm.load %1344 : !llvm.ptr -> !llvm.ptr
%1346 = llvm.mlir.addressof @g_hot_min_b : !llvm.ptr
%1347 = llvm.load %1346 : !llvm.ptr -> !llvm.ptr
%1348 = arith.constant 18 : i32
%1349 = arith.constant 8 : i32
%1350 = arith.muli %1348, %1349 : i32
%1351 = arith.extsi %1350 : i32 to i64
%1343 = func.call @memcpy(%1345, %1347, %1351) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
%1353 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
%1354 = llvm.load %1353 : !llvm.ptr -> !llvm.ptr
%1355 = llvm.mlir.addressof @g_hot_max_b : !llvm.ptr
%1356 = llvm.load %1355 : !llvm.ptr -> !llvm.ptr
%1357 = arith.constant 18 : i32
%1358 = arith.constant 8 : i32
%1359 = arith.muli %1357, %1358 : i32
%1360 = arith.extsi %1359 : i32 to i64
%1352 = func.call @memcpy(%1354, %1356, %1360) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
func.call @free(%1034) : (!llvm.ptr) -> ()
%1362 = llvm.load %1011 : !llvm.ptr -> i32
%1363 = arith.constant 1 : i32
%1364 = arith.addi %1362, %1363 : i32
llvm.store %1364, %1011 : i32, !llvm.ptr
cf.br ^bb99
^bb101:
%1366 = llvm.mlir.addressof @g_int_a : !llvm.ptr
%1367 = llvm.load %1366 : !llvm.ptr -> !llvm.ptr
%1368 = arith.constant 0 : i32
%1369 = arith.constant 8 : i32
%1371 = arith.extsi %1369 : i32 to i64
%1370 = arith.muli %773, %1371 : i64
%1365 = func.call @memset(%1367, %1368, %1370) : (!llvm.ptr, i32, i64) -> !llvm.ptr
%1372 = arith.constant 0 : i32
%1373 = llvm.mlir.constant(1 : i64) : i64
%1374 = llvm.alloca %1373 x i32 : (i64) -> !llvm.ptr
llvm.store %1372, %1374 : i32, !llvm.ptr
cf.br ^bb141
^bb141:
%1375 = llvm.load %1374 : !llvm.ptr -> i32
%1376 = llvm.mlir.addressof @M : !llvm.ptr
%1377 = llvm.load %1376 : !llvm.ptr -> i32
%1378 = arith.cmpi sle, %1375, %1377 : i32
cf.cond_br %1378, ^bb142, ^bb143
^bb142:
%1379 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1380 = llvm.load %1379 : !llvm.ptr -> i32
%1381 = arith.extsi %1380 : i32 to i64
%1382 = llvm.mlir.addressof @g_int_min_a : !llvm.ptr
%1383 = llvm.load %1382 : !llvm.ptr -> !llvm.ptr
%1384 = llvm.load %1374 : !llvm.ptr -> i32
%1385 = arith.extsi %1384 : i32 to i64
%1386 = llvm.getelementptr %1383[%1385] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1381, %1386 : i64, !llvm.ptr
%1387 = arith.constant 1 : i32
%1389 = arith.constant 0 : i32
%1388 = arith.subi %1389, %1387 : i32
%1390 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
%1391 = llvm.load %1390 : !llvm.ptr -> !llvm.ptr
%1392 = llvm.load %1374 : !llvm.ptr -> i32
%1393 = arith.extsi %1388 : i32 to i64
%1394 = arith.extsi %1392 : i32 to i64
%1395 = llvm.getelementptr %1391[%1394] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1393, %1395 : i64, !llvm.ptr
%1396 = llvm.load %1374 : !llvm.ptr -> i32
%1397 = arith.constant 1 : i32
%1398 = arith.addi %1396, %1397 : i32
llvm.store %1398, %1374 : i32, !llvm.ptr
cf.br ^bb141
^bb143:
%1399 = arith.constant 1 : i32
%1400 = llvm.mlir.addressof @g_int_a : !llvm.ptr
%1401 = llvm.load %1400 : !llvm.ptr -> !llvm.ptr
%1402 = arith.constant 0 : i32
%1403 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1404 = llvm.load %1403 : !llvm.ptr -> i32
%1405 = arith.muli %1402, %1404 : i32
%1406 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%1407 = llvm.load %1406 : !llvm.ptr -> i32
%1408 = arith.addi %1405, %1407 : i32
%1409 = arith.extsi %1399 : i32 to i64
%1410 = arith.extsi %1408 : i32 to i64
%1411 = llvm.getelementptr %1401[%1410] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1409, %1411 : i64, !llvm.ptr
%1412 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%1413 = llvm.load %1412 : !llvm.ptr -> i32
%1414 = arith.extsi %1413 : i32 to i64
%1415 = llvm.mlir.addressof @g_int_min_a : !llvm.ptr
%1416 = llvm.load %1415 : !llvm.ptr -> !llvm.ptr
%1417 = arith.constant 0 : i32
%1418 = arith.extsi %1417 : i32 to i64
%1419 = llvm.getelementptr %1416[%1418] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1414, %1419 : i64, !llvm.ptr
%1420 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%1421 = llvm.load %1420 : !llvm.ptr -> i32
%1422 = arith.extsi %1421 : i32 to i64
%1423 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
%1424 = llvm.load %1423 : !llvm.ptr -> !llvm.ptr
%1425 = arith.constant 0 : i32
%1426 = arith.extsi %1425 : i32 to i64
%1427 = llvm.getelementptr %1424[%1426] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1422, %1427 : i64, !llvm.ptr
%1428 = arith.constant 0 : i32
%1429 = llvm.mlir.constant(1 : i64) : i64
%1430 = llvm.alloca %1429 x i32 : (i64) -> !llvm.ptr
llvm.store %1428, %1430 : i32, !llvm.ptr
cf.br ^bb144
^bb144:
%1431 = llvm.load %1430 : !llvm.ptr -> i32
%1432 = llvm.mlir.addressof @g_num_int_vals : !llvm.ptr
%1433 = llvm.load %1432 : !llvm.ptr -> i32
%1434 = arith.cmpi slt, %1431, %1433 : i32
cf.cond_br %1434, ^bb145, ^bb146
^bb145:
%1436 = llvm.mlir.addressof @g_int_vals : !llvm.ptr
%1437 = llvm.load %1436 : !llvm.ptr -> !llvm.ptr
%1438 = llvm.load %1430 : !llvm.ptr -> i32
%1439 = arith.extsi %1438 : i32 to i64
%1440 = llvm.getelementptr %1437[%1439] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1435 = llvm.load %1440 : !llvm.ptr -> i64
%1442 = llvm.mlir.addressof @g_int_counts : !llvm.ptr
%1443 = llvm.load %1442 : !llvm.ptr -> !llvm.ptr
%1444 = arith.constant 1000 : i32
%1446 = arith.extsi %1444 : i32 to i64
%1445 = arith.addi %1435, %1446 : i64
%1447 = llvm.getelementptr %1443[%1445] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1441 = llvm.load %1447 : !llvm.ptr -> i64
%1449 = arith.constant 10 : i32
%1450 = arith.constant 8 : i32
%1451 = arith.extsi %1449 : i32 to i64
%1452 = arith.extsi %1450 : i32 to i64
%1448 = func.call @calloc(%1451, %1452) : (i64, i64) -> !llvm.ptr
%1453 = arith.constant 1 : i32
%1454 = arith.constant 0 : i32
%1455 = arith.extsi %1453 : i32 to i64
%1456 = arith.extsi %1454 : i32 to i64
%1457 = llvm.getelementptr %1448[%1456] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1455, %1457 : i64, !llvm.ptr
%1458 = arith.constant 1 : i32
%1459 = arith.extsi %1458 : i32 to i64
%1460 = llvm.mlir.constant(1 : i64) : i64
%1461 = llvm.alloca %1460 x i64 : (i64) -> !llvm.ptr
llvm.store %1459, %1461 : i64, !llvm.ptr
%1462 = arith.constant 1 : i32
%1463 = llvm.mlir.constant(1 : i64) : i64
%1464 = llvm.alloca %1463 x i32 : (i64) -> !llvm.ptr
llvm.store %1462, %1464 : i32, !llvm.ptr
cf.br ^bb147
^bb147:
%1465 = llvm.load %1464 : !llvm.ptr -> i32
%1466 = llvm.mlir.addressof @M : !llvm.ptr
%1467 = llvm.load %1466 : !llvm.ptr -> i32
%1468 = arith.cmpi sle, %1465, %1467 : i32
cf.cond_br %1468, ^bb148, ^bb149
^bb148:
%1469 = llvm.load %1461 : !llvm.ptr -> i64
%1470 = arith.muli %1469, %1441 : i64
%1471 = llvm.mlir.addressof @MOD : !llvm.ptr
%1472 = llvm.load %1471 : !llvm.ptr -> i64
%1473 = arith.remsi %1470, %1472 : i64
llvm.store %1473, %1461 : i64, !llvm.ptr
%1474 = llvm.load %1461 : !llvm.ptr -> i64
%1476 = llvm.load %1464 : !llvm.ptr -> i32
%1477 = arith.extsi %1476 : i32 to i64
%1478 = llvm.getelementptr %836[%1477] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1475 = llvm.load %1478 : !llvm.ptr -> i64
%1479 = arith.muli %1474, %1475 : i64
%1480 = llvm.mlir.addressof @MOD : !llvm.ptr
%1481 = llvm.load %1480 : !llvm.ptr -> i64
%1482 = arith.remsi %1479, %1481 : i64
%1483 = llvm.load %1464 : !llvm.ptr -> i32
%1484 = arith.extsi %1483 : i32 to i64
%1485 = llvm.getelementptr %1448[%1484] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1482, %1485 : i64, !llvm.ptr
%1486 = llvm.load %1464 : !llvm.ptr -> i32
%1487 = arith.constant 1 : i32
%1488 = arith.addi %1486, %1487 : i32
llvm.store %1488, %1464 : i32, !llvm.ptr
cf.br ^bb147
^bb149:
%1490 = llvm.mlir.addressof @g_int_b : !llvm.ptr
%1491 = llvm.load %1490 : !llvm.ptr -> !llvm.ptr
%1492 = arith.constant 0 : i32
%1493 = arith.constant 8 : i32
%1495 = arith.extsi %1493 : i32 to i64
%1494 = arith.muli %773, %1495 : i64
%1489 = func.call @memset(%1491, %1492, %1494) : (!llvm.ptr, i32, i64) -> !llvm.ptr
%1496 = arith.constant 0 : i32
%1497 = llvm.mlir.constant(1 : i64) : i64
%1498 = llvm.alloca %1497 x i32 : (i64) -> !llvm.ptr
llvm.store %1496, %1498 : i32, !llvm.ptr
cf.br ^bb150
^bb150:
%1499 = llvm.load %1498 : !llvm.ptr -> i32
%1500 = llvm.mlir.addressof @M : !llvm.ptr
%1501 = llvm.load %1500 : !llvm.ptr -> i32
%1502 = arith.cmpi sle, %1499, %1501 : i32
cf.cond_br %1502, ^bb151, ^bb152
^bb151:
%1503 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1504 = llvm.load %1503 : !llvm.ptr -> i32
%1505 = arith.extsi %1504 : i32 to i64
%1506 = llvm.mlir.addressof @g_int_min_b : !llvm.ptr
%1507 = llvm.load %1506 : !llvm.ptr -> !llvm.ptr
%1508 = llvm.load %1498 : !llvm.ptr -> i32
%1509 = arith.extsi %1508 : i32 to i64
%1510 = llvm.getelementptr %1507[%1509] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1505, %1510 : i64, !llvm.ptr
%1511 = arith.constant 1 : i32
%1513 = arith.constant 0 : i32
%1512 = arith.subi %1513, %1511 : i32
%1514 = llvm.mlir.addressof @g_int_max_b : !llvm.ptr
%1515 = llvm.load %1514 : !llvm.ptr -> !llvm.ptr
%1516 = llvm.load %1498 : !llvm.ptr -> i32
%1517 = arith.extsi %1512 : i32 to i64
%1518 = arith.extsi %1516 : i32 to i64
%1519 = llvm.getelementptr %1515[%1518] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1517, %1519 : i64, !llvm.ptr
%1520 = llvm.load %1498 : !llvm.ptr -> i32
%1521 = arith.constant 1 : i32
%1522 = arith.addi %1520, %1521 : i32
llvm.store %1522, %1498 : i32, !llvm.ptr
cf.br ^bb150
^bb152:
%1523 = arith.constant 0 : i32
%1524 = llvm.mlir.constant(1 : i64) : i64
%1525 = llvm.alloca %1524 x i32 : (i64) -> !llvm.ptr
llvm.store %1523, %1525 : i32, !llvm.ptr
cf.br ^bb153
^bb153:
%1526 = llvm.load %1525 : !llvm.ptr -> i32
%1527 = llvm.mlir.addressof @M : !llvm.ptr
%1528 = llvm.load %1527 : !llvm.ptr -> i32
%1529 = arith.cmpi sle, %1526, %1528 : i32
cf.cond_br %1529, ^bb154, ^bb155
^bb154:
%1531 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
%1532 = llvm.load %1531 : !llvm.ptr -> !llvm.ptr
%1533 = llvm.load %1525 : !llvm.ptr -> i32
%1534 = arith.extsi %1533 : i32 to i64
%1535 = llvm.getelementptr %1532[%1534] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1530 = llvm.load %1535 : !llvm.ptr -> i64
%1536 = arith.constant 0 : i32
%1538 = arith.extsi %1536 : i32 to i64
%1537 = arith.cmpi sge, %1530, %1538 : i64
cf.cond_br %1537, ^bb156, ^bb157
^bb156:
%1540 = llvm.mlir.addressof @g_int_min_a : !llvm.ptr
%1541 = llvm.load %1540 : !llvm.ptr -> !llvm.ptr
%1542 = llvm.load %1525 : !llvm.ptr -> i32
%1543 = arith.extsi %1542 : i32 to i64
%1544 = llvm.getelementptr %1541[%1543] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1539 = llvm.load %1544 : !llvm.ptr -> i64
%1546 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
%1547 = llvm.load %1546 : !llvm.ptr -> !llvm.ptr
%1548 = llvm.load %1525 : !llvm.ptr -> i32
%1549 = arith.extsi %1548 : i32 to i64
%1550 = llvm.getelementptr %1547[%1549] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1545 = llvm.load %1550 : !llvm.ptr -> i64
%1551 = llvm.mlir.constant(1 : i64) : i64
%1552 = llvm.alloca %1551 x i64 : (i64) -> !llvm.ptr
llvm.store %1539, %1552 : i64, !llvm.ptr
cf.br ^bb159
^bb159:
%1553 = llvm.load %1552 : !llvm.ptr -> i64
%1554 = arith.cmpi sle, %1553, %1545 : i64
cf.cond_br %1554, ^bb160, ^bb161
^bb160:
%1556 = llvm.mlir.addressof @g_int_a : !llvm.ptr
%1557 = llvm.load %1556 : !llvm.ptr -> !llvm.ptr
%1558 = llvm.load %1525 : !llvm.ptr -> i32
%1559 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1560 = llvm.load %1559 : !llvm.ptr -> i32
%1561 = arith.muli %1558, %1560 : i32
%1562 = llvm.load %1552 : !llvm.ptr -> i64
%1564 = arith.extsi %1561 : i32 to i64
%1563 = arith.addi %1564, %1562 : i64
%1565 = llvm.getelementptr %1557[%1563] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1555 = llvm.load %1565 : !llvm.ptr -> i64
%1566 = arith.constant 0 : i32
%1568 = arith.extsi %1566 : i32 to i64
%1567 = arith.cmpi ne, %1555, %1568 : i64
cf.cond_br %1567, ^bb162, ^bb163
^bb162:
%1569 = arith.constant 0 : i32
%1570 = llvm.mlir.constant(1 : i64) : i64
%1571 = llvm.alloca %1570 x i32 : (i64) -> !llvm.ptr
llvm.store %1569, %1571 : i32, !llvm.ptr
cf.br ^bb165
^bb165:
%1572 = llvm.load %1571 : !llvm.ptr -> i32
%1573 = llvm.mlir.addressof @M : !llvm.ptr
%1574 = llvm.load %1573 : !llvm.ptr -> i32
%1575 = llvm.load %1525 : !llvm.ptr -> i32
%1576 = arith.subi %1574, %1575 : i32
%1577 = arith.cmpi sle, %1572, %1576 : i32
cf.cond_br %1577, ^bb166, ^bb167
^bb166:
%1579 = llvm.load %1571 : !llvm.ptr -> i32
%1580 = arith.extsi %1579 : i32 to i64
%1581 = llvm.getelementptr %1448[%1580] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1578 = llvm.load %1581 : !llvm.ptr -> i64
%1582 = arith.constant 0 : i32
%1584 = arith.extsi %1582 : i32 to i64
%1583 = arith.cmpi ne, %1578, %1584 : i64
cf.cond_br %1583, ^bb168, ^bb169
^bb168:
%1585 = llvm.load %1525 : !llvm.ptr -> i32
%1586 = llvm.load %1571 : !llvm.ptr -> i32
%1587 = arith.addi %1585, %1586 : i32
%1588 = llvm.load %1552 : !llvm.ptr -> i64
%1589 = llvm.load %1571 : !llvm.ptr -> i32
%1590 = arith.extsi %1589 : i32 to i64
%1591 = arith.muli %1590, %1435 : i64
%1592 = arith.addi %1588, %1591 : i64
%1593 = arith.constant 0 : i32
%1595 = arith.extsi %1593 : i32 to i64
%1594 = arith.cmpi sge, %1592, %1595 : i64
%1596 = scf.if %1594 -> (i1) {
%1597 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1598 = llvm.load %1597 : !llvm.ptr -> i32
%1599 = arith.extsi %1598 : i32 to i64
%1600 = arith.cmpi slt, %1592, %1599 : i64
scf.yield %1600 : i1
} else {
%1601 = arith.constant false
scf.yield %1601 : i1
}
cf.cond_br %1596, ^bb171, ^bb172
^bb171:
%1603 = llvm.mlir.addressof @g_int_b : !llvm.ptr
%1604 = llvm.load %1603 : !llvm.ptr -> !llvm.ptr
%1605 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1606 = llvm.load %1605 : !llvm.ptr -> i32
%1607 = arith.muli %1587, %1606 : i32
%1609 = arith.extsi %1607 : i32 to i64
%1608 = arith.addi %1609, %1592 : i64
%1610 = llvm.getelementptr %1604[%1608] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1602 = llvm.load %1610 : !llvm.ptr -> i64
%1611 = arith.extsi %1602 : i64 to i128
%1612 = arith.extsi %1555 : i64 to i128
%1613 = arith.extsi %1578 : i64 to i128
%1614 = llvm.mlir.addressof @MOD : !llvm.ptr
%1615 = llvm.load %1614 : !llvm.ptr -> i64
%1616 = arith.extsi %1615 : i64 to i128
%1618 = arith.trunci %1612 : i128 to i64
%1619 = arith.trunci %1613 : i128 to i64
%1617 = arith.muli %1618, %1619 : i64
%1621 = arith.trunci %1611 : i128 to i64
%1620 = arith.addi %1621, %1617 : i64
%1623 = arith.trunci %1616 : i128 to i64
%1622 = arith.remsi %1620, %1623 : i64
%1624 = llvm.mlir.addressof @g_int_b : !llvm.ptr
%1625 = llvm.load %1624 : !llvm.ptr -> !llvm.ptr
%1626 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1627 = llvm.load %1626 : !llvm.ptr -> i32
%1628 = arith.muli %1587, %1627 : i32
%1630 = arith.extsi %1628 : i32 to i64
%1629 = arith.addi %1630, %1592 : i64
%1631 = llvm.getelementptr %1625[%1629] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1622, %1631 : i64, !llvm.ptr
%1633 = llvm.mlir.addressof @g_int_min_b : !llvm.ptr
%1634 = llvm.load %1633 : !llvm.ptr -> !llvm.ptr
%1635 = arith.extsi %1587 : i32 to i64
%1636 = llvm.getelementptr %1634[%1635] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1632 = llvm.load %1636 : !llvm.ptr -> i64
%1637 = arith.cmpi slt, %1592, %1632 : i64
cf.cond_br %1637, ^bb174, ^bb175
^bb174:
%1638 = llvm.mlir.addressof @g_int_min_b : !llvm.ptr
%1639 = llvm.load %1638 : !llvm.ptr -> !llvm.ptr
%1640 = arith.extsi %1587 : i32 to i64
%1641 = llvm.getelementptr %1639[%1640] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1592, %1641 : i64, !llvm.ptr
cf.br ^bb176
^bb175:
cf.br ^bb176
^bb176:
%1643 = llvm.mlir.addressof @g_int_max_b : !llvm.ptr
%1644 = llvm.load %1643 : !llvm.ptr -> !llvm.ptr
%1645 = arith.extsi %1587 : i32 to i64
%1646 = llvm.getelementptr %1644[%1645] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1642 = llvm.load %1646 : !llvm.ptr -> i64
%1647 = arith.cmpi sgt, %1592, %1642 : i64
cf.cond_br %1647, ^bb177, ^bb178
^bb177:
%1648 = llvm.mlir.addressof @g_int_max_b : !llvm.ptr
%1649 = llvm.load %1648 : !llvm.ptr -> !llvm.ptr
%1650 = arith.extsi %1587 : i32 to i64
%1651 = llvm.getelementptr %1649[%1650] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1592, %1651 : i64, !llvm.ptr
cf.br ^bb179
^bb178:
cf.br ^bb179
^bb179:
cf.br ^bb173
^bb172:
cf.br ^bb173
^bb173:
cf.br ^bb170
^bb169:
cf.br ^bb170
^bb170:
%1652 = llvm.load %1571 : !llvm.ptr -> i32
%1653 = arith.constant 1 : i32
%1654 = arith.addi %1652, %1653 : i32
llvm.store %1654, %1571 : i32, !llvm.ptr
cf.br ^bb165
^bb167:
cf.br ^bb164
^bb163:
cf.br ^bb164
^bb164:
%1655 = llvm.load %1552 : !llvm.ptr -> i64
%1656 = arith.constant 1 : i32
%1658 = arith.extsi %1656 : i32 to i64
%1657 = arith.addi %1655, %1658 : i64
llvm.store %1657, %1552 : i64, !llvm.ptr
cf.br ^bb159
^bb161:
cf.br ^bb158
^bb157:
cf.br ^bb158
^bb158:
%1659 = llvm.load %1525 : !llvm.ptr -> i32
%1660 = arith.constant 1 : i32
%1661 = arith.addi %1659, %1660 : i32
llvm.store %1661, %1525 : i32, !llvm.ptr
cf.br ^bb153
^bb155:
%1663 = llvm.mlir.addressof @g_int_a : !llvm.ptr
%1664 = llvm.load %1663 : !llvm.ptr -> !llvm.ptr
%1665 = llvm.mlir.addressof @g_int_b : !llvm.ptr
%1666 = llvm.load %1665 : !llvm.ptr -> !llvm.ptr
%1667 = arith.constant 8 : i32
%1669 = arith.extsi %1667 : i32 to i64
%1668 = arith.muli %773, %1669 : i64
%1662 = func.call @memcpy(%1664, %1666, %1668) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
%1671 = llvm.mlir.addressof @g_int_min_a : !llvm.ptr
%1672 = llvm.load %1671 : !llvm.ptr -> !llvm.ptr
%1673 = llvm.mlir.addressof @g_int_min_b : !llvm.ptr
%1674 = llvm.load %1673 : !llvm.ptr -> !llvm.ptr
%1675 = arith.constant 9 : i32
%1676 = arith.constant 8 : i32
%1677 = arith.muli %1675, %1676 : i32
%1678 = arith.extsi %1677 : i32 to i64
%1670 = func.call @memcpy(%1672, %1674, %1678) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
%1680 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
%1681 = llvm.load %1680 : !llvm.ptr -> !llvm.ptr
%1682 = llvm.mlir.addressof @g_int_max_b : !llvm.ptr
%1683 = llvm.load %1682 : !llvm.ptr -> !llvm.ptr
%1684 = arith.constant 9 : i32
%1685 = arith.constant 8 : i32
%1686 = arith.muli %1684, %1685 : i32
%1687 = arith.extsi %1686 : i32 to i64
%1679 = func.call @memcpy(%1681, %1683, %1687) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
func.call @free(%1448) : (!llvm.ptr) -> ()
%1689 = llvm.load %1430 : !llvm.ptr -> i32
%1690 = arith.constant 1 : i32
%1691 = arith.addi %1689, %1690 : i32
llvm.store %1691, %1430 : i32, !llvm.ptr
cf.br ^bb144
^bb146:
%1692 = arith.constant 0 : i32
%1693 = arith.extsi %1692 : i32 to i64
%1694 = llvm.mlir.constant(1 : i64) : i64
%1695 = llvm.alloca %1694 x i64 : (i64) -> !llvm.ptr
llvm.store %1693, %1695 : i64, !llvm.ptr
%1696 = arith.constant 0 : 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 ^bb180
^bb180:
%1699 = llvm.load %1698 : !llvm.ptr -> i32
%1700 = llvm.mlir.addressof @M : !llvm.ptr
%1701 = llvm.load %1700 : !llvm.ptr -> i32
%1702 = arith.cmpi sle, %1699, %1701 : i32
cf.cond_br %1702, ^bb181, ^bb182
^bb181:
%1703 = arith.constant 0 : i32
%1704 = llvm.mlir.constant(1 : i64) : i64
%1705 = llvm.alloca %1704 x i32 : (i64) -> !llvm.ptr
llvm.store %1703, %1705 : i32, !llvm.ptr
cf.br ^bb183
^bb183:
%1706 = llvm.load %1705 : !llvm.ptr -> i32
%1707 = arith.constant 2 : i32
%1708 = arith.cmpi slt, %1706, %1707 : i32
cf.cond_br %1708, ^bb184, ^bb185
^bb184:
%1710 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
%1711 = llvm.load %1710 : !llvm.ptr -> !llvm.ptr
%1712 = llvm.load %1698 : !llvm.ptr -> i32
%1713 = arith.constant 2 : i32
%1714 = arith.muli %1712, %1713 : i32
%1715 = llvm.load %1705 : !llvm.ptr -> i32
%1716 = arith.addi %1714, %1715 : i32
%1717 = arith.extsi %1716 : i32 to i64
%1718 = llvm.getelementptr %1711[%1717] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1709 = llvm.load %1718 : !llvm.ptr -> i64
%1719 = arith.constant 0 : i32
%1721 = arith.extsi %1719 : i32 to i64
%1720 = arith.cmpi sge, %1709, %1721 : i64
cf.cond_br %1720, ^bb186, ^bb187
^bb186:
%1723 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
%1724 = llvm.load %1723 : !llvm.ptr -> !llvm.ptr
%1725 = llvm.mlir.addressof @M : !llvm.ptr
%1726 = llvm.load %1725 : !llvm.ptr -> i32
%1727 = llvm.load %1698 : !llvm.ptr -> i32
%1728 = arith.subi %1726, %1727 : i32
%1729 = arith.extsi %1728 : i32 to i64
%1730 = llvm.getelementptr %1724[%1729] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1722 = llvm.load %1730 : !llvm.ptr -> i64
%1731 = arith.constant 0 : i32
%1733 = arith.extsi %1731 : i32 to i64
%1732 = arith.cmpi sge, %1722, %1733 : i64
cf.cond_br %1732, ^bb189, ^bb190
^bb189:
%1735 = llvm.mlir.addressof @g_hot_min_a : !llvm.ptr
%1736 = llvm.load %1735 : !llvm.ptr -> !llvm.ptr
%1737 = llvm.load %1698 : !llvm.ptr -> i32
%1738 = arith.constant 2 : i32
%1739 = arith.muli %1737, %1738 : i32
%1740 = llvm.load %1705 : !llvm.ptr -> i32
%1741 = arith.addi %1739, %1740 : i32
%1742 = arith.extsi %1741 : i32 to i64
%1743 = llvm.getelementptr %1736[%1742] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1734 = llvm.load %1743 : !llvm.ptr -> i64
%1745 = llvm.mlir.addressof @g_hot_max_a : !llvm.ptr
%1746 = llvm.load %1745 : !llvm.ptr -> !llvm.ptr
%1747 = llvm.load %1698 : !llvm.ptr -> i32
%1748 = arith.constant 2 : i32
%1749 = arith.muli %1747, %1748 : i32
%1750 = llvm.load %1705 : !llvm.ptr -> i32
%1751 = arith.addi %1749, %1750 : i32
%1752 = arith.extsi %1751 : i32 to i64
%1753 = llvm.getelementptr %1746[%1752] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1744 = llvm.load %1753 : !llvm.ptr -> i64
%1754 = llvm.mlir.constant(1 : i64) : i64
%1755 = llvm.alloca %1754 x i64 : (i64) -> !llvm.ptr
llvm.store %1734, %1755 : i64, !llvm.ptr
cf.br ^bb192
^bb192:
%1756 = llvm.load %1755 : !llvm.ptr -> i64
%1757 = arith.cmpi sle, %1756, %1744 : i64
cf.cond_br %1757, ^bb193, ^bb194
^bb193:
%1759 = llvm.mlir.addressof @g_hot_a : !llvm.ptr
%1760 = llvm.load %1759 : !llvm.ptr -> !llvm.ptr
%1761 = llvm.load %1698 : !llvm.ptr -> i32
%1762 = arith.constant 2 : i32
%1763 = arith.muli %1761, %1762 : i32
%1764 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1765 = llvm.load %1764 : !llvm.ptr -> i32
%1766 = arith.muli %1763, %1765 : i32
%1767 = llvm.load %1705 : !llvm.ptr -> i32
%1768 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1769 = llvm.load %1768 : !llvm.ptr -> i32
%1770 = arith.muli %1767, %1769 : i32
%1771 = arith.addi %1766, %1770 : i32
%1772 = llvm.load %1755 : !llvm.ptr -> i64
%1774 = arith.extsi %1771 : i32 to i64
%1773 = arith.addi %1774, %1772 : i64
%1775 = llvm.getelementptr %1760[%1773] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1758 = llvm.load %1775 : !llvm.ptr -> i64
%1776 = arith.constant 0 : i32
%1778 = arith.extsi %1776 : i32 to i64
%1777 = arith.cmpi ne, %1758, %1778 : i64
cf.cond_br %1777, ^bb195, ^bb196
^bb195:
%1780 = llvm.mlir.addressof @g_int_min_a : !llvm.ptr
%1781 = llvm.load %1780 : !llvm.ptr -> !llvm.ptr
%1782 = llvm.mlir.addressof @M : !llvm.ptr
%1783 = llvm.load %1782 : !llvm.ptr -> i32
%1784 = llvm.load %1698 : !llvm.ptr -> i32
%1785 = arith.subi %1783, %1784 : i32
%1786 = arith.extsi %1785 : i32 to i64
%1787 = llvm.getelementptr %1781[%1786] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1779 = llvm.load %1787 : !llvm.ptr -> i64
%1789 = llvm.mlir.addressof @g_int_max_a : !llvm.ptr
%1790 = llvm.load %1789 : !llvm.ptr -> !llvm.ptr
%1791 = llvm.mlir.addressof @M : !llvm.ptr
%1792 = llvm.load %1791 : !llvm.ptr -> i32
%1793 = llvm.load %1698 : !llvm.ptr -> i32
%1794 = arith.subi %1792, %1793 : i32
%1795 = arith.extsi %1794 : i32 to i64
%1796 = llvm.getelementptr %1790[%1795] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1788 = llvm.load %1796 : !llvm.ptr -> i64
%1797 = llvm.mlir.constant(1 : i64) : i64
%1798 = llvm.alloca %1797 x i64 : (i64) -> !llvm.ptr
llvm.store %1779, %1798 : i64, !llvm.ptr
cf.br ^bb198
^bb198:
%1799 = llvm.load %1798 : !llvm.ptr -> i64
%1800 = arith.cmpi sle, %1799, %1788 : i64
cf.cond_br %1800, ^bb199, ^bb200
^bb199:
%1802 = llvm.mlir.addressof @g_int_a : !llvm.ptr
%1803 = llvm.load %1802 : !llvm.ptr -> !llvm.ptr
%1804 = llvm.mlir.addressof @M : !llvm.ptr
%1805 = llvm.load %1804 : !llvm.ptr -> i32
%1806 = llvm.load %1698 : !llvm.ptr -> i32
%1807 = arith.subi %1805, %1806 : i32
%1808 = llvm.mlir.addressof @SUM_RNG : !llvm.ptr
%1809 = llvm.load %1808 : !llvm.ptr -> i32
%1810 = arith.muli %1807, %1809 : i32
%1811 = llvm.load %1798 : !llvm.ptr -> i64
%1813 = arith.extsi %1810 : i32 to i64
%1812 = arith.addi %1813, %1811 : i64
%1814 = llvm.getelementptr %1803[%1812] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1801 = llvm.load %1814 : !llvm.ptr -> i64
%1815 = arith.constant 0 : i32
%1817 = arith.extsi %1815 : i32 to i64
%1816 = arith.cmpi ne, %1801, %1817 : i64
cf.cond_br %1816, ^bb201, ^bb202
^bb201:
%1818 = llvm.load %1755 : !llvm.ptr -> i64
%1819 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%1820 = llvm.load %1819 : !llvm.ptr -> i32
%1821 = arith.extsi %1820 : i32 to i64
%1822 = arith.subi %1818, %1821 : i64
%1823 = llvm.load %1798 : !llvm.ptr -> i64
%1824 = llvm.mlir.addressof @SUM_OFF : !llvm.ptr
%1825 = llvm.load %1824 : !llvm.ptr -> i32
%1826 = arith.extsi %1825 : i32 to i64
%1827 = arith.subi %1823, %1826 : i64
%1828 = arith.addi %1822, %1827 : i64
%1829 = arith.constant 0 : i32
%1831 = arith.extsi %1829 : i32 to i64
%1830 = arith.cmpi sgt, %1828, %1831 : i64
cf.cond_br %1830, ^bb204, ^bb205
^bb204:
%1832 = llvm.load %1695 : !llvm.ptr -> i64
%1833 = arith.extsi %1832 : i64 to i128
%1834 = arith.extsi %1758 : i64 to i128
%1835 = arith.extsi %1801 : i64 to i128
%1836 = llvm.mlir.addressof @MOD : !llvm.ptr
%1837 = llvm.load %1836 : !llvm.ptr -> i64
%1838 = arith.extsi %1837 : i64 to i128
%1840 = arith.trunci %1834 : i128 to i64
%1841 = arith.trunci %1835 : i128 to i64
%1839 = arith.muli %1840, %1841 : i64
%1843 = arith.trunci %1833 : i128 to i64
%1842 = arith.addi %1843, %1839 : i64
%1845 = arith.trunci %1838 : i128 to i64
%1844 = arith.remsi %1842, %1845 : i64
llvm.store %1844, %1695 : i64, !llvm.ptr
cf.br ^bb206
^bb205:
%1846 = arith.constant 0 : i32
%1848 = arith.extsi %1846 : i32 to i64
%1847 = arith.cmpi eq, %1828, %1848 : i64
cf.cond_br %1847, ^bb207, ^bb208
^bb207:
%1849 = llvm.load %1705 : !llvm.ptr -> i32
%1850 = arith.constant 1 : i32
%1851 = arith.cmpi eq, %1849, %1850 : i32
cf.cond_br %1851, ^bb210, ^bb211
^bb210:
%1852 = llvm.load %1695 : !llvm.ptr -> i64
%1853 = arith.extsi %1852 : i64 to i128
%1854 = arith.extsi %1758 : i64 to i128
%1855 = arith.extsi %1801 : i64 to i128
%1856 = llvm.mlir.addressof @MOD : !llvm.ptr
%1857 = llvm.load %1856 : !llvm.ptr -> i64
%1858 = arith.extsi %1857 : i64 to i128
%1860 = arith.trunci %1854 : i128 to i64
%1861 = arith.trunci %1855 : i128 to i64
%1859 = arith.muli %1860, %1861 : i64
%1863 = arith.trunci %1853 : i128 to i64
%1862 = arith.addi %1863, %1859 : i64
%1865 = arith.trunci %1858 : i128 to i64
%1864 = arith.remsi %1862, %1865 : i64
llvm.store %1864, %1695 : i64, !llvm.ptr
cf.br ^bb212
^bb211:
cf.br ^bb212
^bb212:
cf.br ^bb209
^bb208:
cf.br ^bb209
^bb209:
cf.br ^bb206
^bb206:
cf.br ^bb203
^bb202:
cf.br ^bb203
^bb203:
%1866 = llvm.load %1798 : !llvm.ptr -> i64
%1867 = arith.constant 1 : i32
%1869 = arith.extsi %1867 : i32 to i64
%1868 = arith.addi %1866, %1869 : i64
llvm.store %1868, %1798 : i64, !llvm.ptr
cf.br ^bb198
^bb200:
cf.br ^bb197
^bb196:
cf.br ^bb197
^bb197:
%1870 = llvm.load %1755 : !llvm.ptr -> i64
%1871 = arith.constant 1 : i32
%1873 = arith.extsi %1871 : i32 to i64
%1872 = arith.addi %1870, %1873 : i64
llvm.store %1872, %1755 : i64, !llvm.ptr
cf.br ^bb192
^bb194:
cf.br ^bb191
^bb190:
cf.br ^bb191
^bb191:
cf.br ^bb188
^bb187:
cf.br ^bb188
^bb188:
%1874 = llvm.load %1705 : !llvm.ptr -> i32
%1875 = arith.constant 1 : i32
%1876 = arith.addi %1874, %1875 : i32
llvm.store %1876, %1705 : i32, !llvm.ptr
cf.br ^bb183
^bb185:
%1877 = llvm.load %1698 : !llvm.ptr -> i32
%1878 = arith.constant 1 : i32
%1879 = arith.addi %1877, %1878 : i32
llvm.store %1879, %1698 : i32, !llvm.ptr
cf.br ^bb180
^bb182:
%1880 = llvm.load %1695 : !llvm.ptr -> i64
%1882 = llvm.mlir.addressof @M : !llvm.ptr
%1883 = llvm.load %1882 : !llvm.ptr -> i32
%1884 = arith.extsi %1883 : i32 to i64
%1885 = llvm.getelementptr %831[%1884] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1881 = llvm.load %1885 : !llvm.ptr -> i64
%1886 = arith.muli %1880, %1881 : i64
%1887 = llvm.mlir.addressof @MOD : !llvm.ptr
%1888 = llvm.load %1887 : !llvm.ptr -> i64
%1889 = arith.remsi %1886, %1888 : i64
%1890 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1891 = llvm.call @printf(%1890, %1889) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
%1892 = arith.constant 0 : i32
func.return %1892 : i32
}
}