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