← All problems
Problem 671
Colouring a Loop: F_10(10004003002001) mod 1000004321. Tilings of the 2 x n loop (1x1/1x2/1x3 tiles, vertical 1x2 allowed, no four tile corners at a point, adjacent tiles differently coloured) are counted up to rotation of the loop: F_4(3) = 104 is not divisible by k(k-1) = 12, which rules out any fixed-position count, and Burnside over rotations reproduces all three given values exactly. Fixed configurations of period d come from a transfer matrix whose state is (top overhang, bottom overhang, interface colour classes) with colours tracked relative to the two seam colours A and B (interface tiles always have distinct colours since they share a column). This class tracking also kills self-adjacent periodic colourings automatically. The target n is prime, so F = (FIX(n) + (n-1) FIX(1)) / n mod 1000004321. Verified: F_4(3)=104, F_5(7)=3327300, F_6(101)=75309980 mod 1000004321.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^4)O(n * s)
Space complexity O(n^2)O(s)
Approach Flow solution Tiling DP with state
Verdict Unknown
Flow source
# Project Euler 671
# Colouring a Loop: F_10(10004003002001) mod 1000004321.
#
# Tilings of the 2 x n loop (1x1/1x2/1x3 tiles, vertical 1x2 allowed, no
# four tile corners at a point, adjacent tiles differently coloured) are
# counted up to rotation of the loop: F_4(3) = 104 is not divisible by
# k(k-1) = 12, which rules out any fixed-position count, and Burnside over
# rotations reproduces all three given values exactly.
#
# Fixed configurations of period d come from a transfer matrix whose state
# is (top overhang, bottom overhang, interface colour classes) with colours
# tracked relative to the two seam colours A and B (interface tiles always
# have distinct colours since they share a column). This class tracking
# also kills self-adjacent periodic colourings automatically. The target
# n is prime, so F = (FIX(n) + (n-1) FIX(1)) / n mod 1000004321.
# Verified: F_4(3)=104, F_5(7)=3327300, F_6(101)=75309980 mod 1000004321.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
const MOD: i64 = 1000004321
const K: i64 = 10
const N: i64 = 10004003002001
const NS: i64 = 66 # 3 vertical states + 63 D-states
function inv_mod(a0: i64) -> i64 {
let mut g: i64 = MOD
let mut x: i64 = 0
let mut r: i64 = a0 % MOD
let mut s: i64 = 1
while r != 0 {
let q: i64 = g / r
let t: i64 = g - q * r
g = r
r = t
let u: i64 = x - q * s
x = s
s = u
}
x = x % MOD
if x < 0 {
x = x + MOD
}
return x
}
function matmul(a: ptr<i64>, b: ptr<i64>, c: ptr<i64>) -> void {
let mut i: i64 = 0
while i < NS {
let mut j: i64 = 0
while j < NS {
let mut acc: i64 = 0
let mut t: i64 = 0
while t < NS {
acc = (acc + a[i * NS + t] * b[t * NS + j]) % MOD
t = t + 1
}
c[i * NS + j] = acc
j = j + 1
}
i = i + 1
}
}
# fresh-colour option count given f distinct forbidden colours of which
# nab are in {A, B}: K - (f + 2 - nab)
function fresh_cnt(f: i64, nab: i64) -> i64 {
let c: i64 = K - (f + 2 - nab)
if c < 0 {
return 0
}
return c
}
function main() -> i32 {
# state indexing: 0..2 = ('V', x); D-states packed via lookup table
let didx: ptr<i64> = calloc(81, 8) # (o1*3+o2)*9 + x*3+y -> state id
let mut ns: i64 = 3
let mut o1: i64 = 0
while o1 < 3 {
let mut o2: i64 = 0
while o2 < 3 {
let mut x: i64 = 0
while x < 3 {
let mut y: i64 = 0
while y < 3 {
if x == y && x != 2 {
didx[(o1 * 3 + o2) * 9 + x * 3 + y] = 0 - 1
} else {
didx[(o1 * 3 + o2) * 9 + x * 3 + y] = ns
ns = ns + 1
}
y = y + 1
}
x = x + 1
}
o2 = o2 + 1
}
o1 = o1 + 1
}
let T: ptr<i64> = calloc(NS * NS, 8)
# transitions from V-states
let mut xv: i64 = 0
while xv < 3 {
let i: i64 = xv
# vertical again: forbidden {x}
let mut z: i64 = 0
while z < 2 {
if z != xv {
T[i * NS + z] = (T[i * NS + z] + 1) % MOD
}
z = z + 1
}
let mut nab: i64 = 0
if xv < 2 {
nab = 1
}
T[i * NS + 2] = (T[i * NS + 2] + fresh_cnt(1, nab)) % MOD
# two horizontals lengths a, b; colours w (top), zz (bottom)
let mut a: i64 = 1
while a <= 3 {
let mut b: i64 = 1
while b <= 3 {
let mut w: i64 = 0
while w < 3 {
# weight for w given forbidden {xv}
let mut cw: i64 = 0
if w < 2 {
if w != xv {
cw = 1
}
} else {
cw = fresh_cnt(1, nab)
}
if cw > 0 {
let mut zz: i64 = 0
while zz < 3 {
# forbidden {xv, w}: distinct colours
let mut nab2: i64 = 0
if xv < 2 {
nab2 = nab2 + 1
}
if w < 2 {
nab2 = nab2 + 1
}
let mut cz: i64 = 0
if zz < 2 {
if zz != xv && zz != w {
cz = 1
}
} else {
cz = fresh_cnt(2, nab2)
}
if cz > 0 {
let st2: i64 = didx[((a - 1) * 3 + (b - 1)) * 9 + w * 3 + zz]
if st2 >= 0 {
T[i * NS + st2] = (T[i * NS + st2] + cw * cz) % MOD
}
}
zz = zz + 1
}
}
w = w + 1
}
b = b + 1
}
a = a + 1
}
xv = xv + 1
}
# transitions from D-states
o1 = 0
while o1 < 3 {
let mut o2: i64 = 0
while o2 < 3 {
let mut x: i64 = 0
while x < 3 {
let mut y: i64 = 0
while y < 3 {
let i: i64 = didx[(o1 * 3 + o2) * 9 + x * 3 + y]
if i >= 0 {
# forbidden pair {x, y} for any new tile here
let mut nab: i64 = 0
if x < 2 {
nab = nab + 1
}
if y < 2 {
nab = nab + 1
}
if o1 > 0 && o2 > 0 {
let st2: i64 = didx[((o1 - 1) * 3 + (o2 - 1)) * 9 + x * 3 + y]
T[i * NS + st2] = (T[i * NS + st2] + 1) % MOD
}
if o1 > 0 && o2 == 0 {
let mut b: i64 = 1
while b <= 3 {
let mut z: i64 = 0
while z < 3 {
let mut c: i64 = 0
if z < 2 {
if z != x && z != y {
c = 1
}
} else {
c = fresh_cnt(2, nab)
}
if c > 0 {
let st2: i64 = didx[((o1 - 1) * 3 + (b - 1)) * 9 + x * 3 + z]
if st2 >= 0 {
T[i * NS + st2] = (T[i * NS + st2] + c) % MOD
}
}
z = z + 1
}
b = b + 1
}
}
if o1 == 0 && o2 > 0 {
let mut a: i64 = 1
while a <= 3 {
let mut w: i64 = 0
while w < 3 {
let mut c: i64 = 0
if w < 2 {
if w != x && w != y {
c = 1
}
} else {
c = fresh_cnt(2, nab)
}
if c > 0 {
let st2: i64 = didx[((a - 1) * 3 + (o2 - 1)) * 9 + w * 3 + y]
if st2 >= 0 {
T[i * NS + st2] = (T[i * NS + st2] + c) % MOD
}
}
w = w + 1
}
a = a + 1
}
}
if o1 == 0 && o2 == 0 {
# corner rule: vertical only
let mut z: i64 = 0
while z < 3 {
let mut c: i64 = 0
if z < 2 {
if z != x && z != y {
c = 1
}
} else {
c = fresh_cnt(2, nab)
}
if c > 0 {
T[i * NS + z] = (T[i * NS + z] + c) % MOD
}
z = z + 1
}
}
}
y = y + 1
}
x = x + 1
}
o2 = o2 + 1
}
o1 = o1 + 1
}
# FIX(d) = K * (T^d)[V_A][V_A] + K(K-1) * sum over (o1,o2) diag with (A,B)
let R: ptr<i64> = calloc(NS * NS, 8)
let Bm: ptr<i64> = calloc(NS * NS, 8)
let W: ptr<i64> = calloc(NS * NS, 8)
# FIX(1): directly from T
let mut fix1: i64 = K % MOD * T[0 * NS + 0] % MOD
o1 = 0
while o1 < 3 {
let mut o2: i64 = 0
while o2 < 3 {
let st: i64 = didx[(o1 * 3 + o2) * 9 + 0 * 3 + 1]
fix1 = (fix1 + K * (K - 1) % MOD * T[st * NS + st]) % MOD
o2 = o2 + 1
}
o1 = o1 + 1
}
# R = T^N
let mut i: i64 = 0
while i < NS * NS {
R[i] = 0
Bm[i] = T[i]
i = i + 1
}
i = 0
while i < NS {
R[i * NS + i] = 1
i = i + 1
}
let mut e: i64 = N
while e > 0 {
if (e & 1) == 1 {
matmul(R, Bm, W)
i = 0
while i < NS * NS {
R[i] = W[i]
i = i + 1
}
}
e = e >> 1
if e > 0 {
matmul(Bm, Bm, W)
i = 0
while i < NS * NS {
Bm[i] = W[i]
i = i + 1
}
}
}
let mut fixn: i64 = K % MOD * R[0 * NS + 0] % MOD
o1 = 0
while o1 < 3 {
let mut o2: i64 = 0
while o2 < 3 {
let st: i64 = didx[(o1 * 3 + o2) * 9 + 0 * 3 + 1]
fixn = (fixn + K * (K - 1) % MOD * R[st * NS + st]) % MOD
o2 = o2 + 1
}
o1 = o1 + 1
}
# N is prime: F = (FIX(N) + (N-1) FIX(1)) / N mod MOD
let nm: i64 = N % MOD
let nm1: i64 = (N - 1) % MOD
let tot: i64 = (fixn + nm1 * fix1) % MOD
let ans: i64 = tot * inv_mod(nm) % MOD
printf("%lld\n", ans)
free(didx)
free(T)
free(R)
free(Bm)
free(W)
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 inv_mod_i64(int64_t a0);
void matmul_ptr_i64_ptr_i64_ptr_i64(int64_t* a, int64_t* b, int64_t* c);
int64_t fresh_cnt_i64_i64(int64_t f, int64_t nab);
int32_t main(void);
static const int64_t MOD = 1000004321;
static const int64_t K = 10;
static const int64_t N = 10004003002001;
static const int64_t NS = 66;
int64_t inv_mod_i64(int64_t a0) {
int64_t g = MOD;
int64_t x = 0;
int64_t r = FLOW_CHECKED_MOD((a0), (MOD));
int64_t s = 1;
while (r != 0) {
int64_t q = FLOW_CHECKED_DIV((g), (r));
int64_t t = (g - (q * r));
g = r;
r = t;
int64_t u = (x - (q * s));
x = s;
s = u;
}
x = FLOW_CHECKED_MOD((x), (MOD));
if (x < 0) {
x = (x + MOD);
}
return x;
}
void matmul_ptr_i64_ptr_i64_ptr_i64(int64_t* a, int64_t* b, int64_t* c) {
int64_t i = 0;
while (i < NS) {
int64_t j = 0;
while (j < NS) {
int64_t acc = 0;
int64_t t = 0;
while (t < NS) {
acc = FLOW_CHECKED_MOD(((acc + (a[((i * NS) + t)] * b[((t * NS) + j)]))), (MOD));
t = (t + 1);
}
c[((i * NS) + j)] = acc;
j = (j + 1);
}
i = (i + 1);
}
}
int64_t fresh_cnt_i64_i64(int64_t f, int64_t nab) {
int64_t c = (K - ((f + 2) - nab));
if (c < 0) {
return 0;
}
return c;
}
int32_t main(void) {
int64_t* didx = (int64_t*)(calloc(81, 8));
int64_t ns = 3;
int64_t o1 = 0;
while (o1 < 3) {
int64_t o2 = 0;
while (o2 < 3) {
int64_t x = 0;
while (x < 3) {
int64_t y = 0;
while (y < 3) {
if ((x == y && x != 2)) {
didx[(((((o1 * 3) + o2) * 9) + (x * 3)) + y)] = (0 - 1);
} else {
didx[(((((o1 * 3) + o2) * 9) + (x * 3)) + y)] = ns;
ns = (ns + 1);
}
y = (y + 1);
}
x = (x + 1);
}
o2 = (o2 + 1);
}
o1 = (o1 + 1);
}
int64_t* T = (int64_t*)(calloc((NS * NS), 8));
int64_t xv = 0;
while (xv < 3) {
int64_t i = xv;
int64_t z = 0;
while (z < 2) {
if (z != xv) {
T[((i * NS) + z)] = FLOW_CHECKED_MOD(((T[((i * NS) + z)] + 1)), (MOD));
}
z = (z + 1);
}
int64_t nab = 0;
if (xv < 2) {
nab = 1;
}
T[((i * NS) + 2)] = FLOW_CHECKED_MOD(((T[((i * NS) + 2)] + fresh_cnt_i64_i64(1, nab))), (MOD));
int64_t a = 1;
while (a <= 3) {
int64_t b = 1;
while (b <= 3) {
int64_t w = 0;
while (w < 3) {
int64_t cw = 0;
if (w < 2) {
if (w != xv) {
cw = 1;
}
} else {
cw = fresh_cnt_i64_i64(1, nab);
}
if (cw > 0) {
int64_t zz = 0;
while (zz < 3) {
int64_t nab2 = 0;
if (xv < 2) {
nab2 = (nab2 + 1);
}
if (w < 2) {
nab2 = (nab2 + 1);
}
int64_t cz = 0;
if (zz < 2) {
if ((zz != xv && zz != w)) {
cz = 1;
}
} else {
cz = fresh_cnt_i64_i64(2, nab2);
}
if (cz > 0) {
int64_t st2 = didx[((((((a - 1) * 3) + (b - 1)) * 9) + (w * 3)) + zz)];
if (st2 >= 0) {
T[((i * NS) + st2)] = FLOW_CHECKED_MOD(((T[((i * NS) + st2)] + (cw * cz))), (MOD));
}
}
zz = (zz + 1);
}
}
w = (w + 1);
}
b = (b + 1);
}
a = (a + 1);
}
xv = (xv + 1);
}
o1 = 0;
while (o1 < 3) {
int64_t o2 = 0;
while (o2 < 3) {
int64_t x = 0;
while (x < 3) {
int64_t y = 0;
while (y < 3) {
int64_t i = didx[(((((o1 * 3) + o2) * 9) + (x * 3)) + y)];
if (i >= 0) {
int64_t nab = 0;
if (x < 2) {
nab = (nab + 1);
}
if (y < 2) {
nab = (nab + 1);
}
if ((o1 > 0 && o2 > 0)) {
int64_t st2 = didx[((((((o1 - 1) * 3) + (o2 - 1)) * 9) + (x * 3)) + y)];
T[((i * NS) + st2)] = FLOW_CHECKED_MOD(((T[((i * NS) + st2)] + 1)), (MOD));
}
if ((o1 > 0 && o2 == 0)) {
int64_t b = 1;
while (b <= 3) {
int64_t z = 0;
while (z < 3) {
int64_t c = 0;
if (z < 2) {
if ((z != x && z != y)) {
c = 1;
}
} else {
c = fresh_cnt_i64_i64(2, nab);
}
if (c > 0) {
int64_t st2 = didx[((((((o1 - 1) * 3) + (b - 1)) * 9) + (x * 3)) + z)];
if (st2 >= 0) {
T[((i * NS) + st2)] = FLOW_CHECKED_MOD(((T[((i * NS) + st2)] + c)), (MOD));
}
}
z = (z + 1);
}
b = (b + 1);
}
}
if ((o1 == 0 && o2 > 0)) {
int64_t a = 1;
while (a <= 3) {
int64_t w = 0;
while (w < 3) {
int64_t c = 0;
if (w < 2) {
if ((w != x && w != y)) {
c = 1;
}
} else {
c = fresh_cnt_i64_i64(2, nab);
}
if (c > 0) {
int64_t st2 = didx[((((((a - 1) * 3) + (o2 - 1)) * 9) + (w * 3)) + y)];
if (st2 >= 0) {
T[((i * NS) + st2)] = FLOW_CHECKED_MOD(((T[((i * NS) + st2)] + c)), (MOD));
}
}
w = (w + 1);
}
a = (a + 1);
}
}
if ((o1 == 0 && o2 == 0)) {
int64_t z = 0;
while (z < 3) {
int64_t c = 0;
if (z < 2) {
if ((z != x && z != y)) {
c = 1;
}
} else {
c = fresh_cnt_i64_i64(2, nab);
}
if (c > 0) {
T[((i * NS) + z)] = FLOW_CHECKED_MOD(((T[((i * NS) + z)] + c)), (MOD));
}
z = (z + 1);
}
}
}
y = (y + 1);
}
x = (x + 1);
}
o2 = (o2 + 1);
}
o1 = (o1 + 1);
}
int64_t* R = (int64_t*)(calloc((NS * NS), 8));
int64_t* Bm = (int64_t*)(calloc((NS * NS), 8));
int64_t* W = (int64_t*)(calloc((NS * NS), 8));
int64_t fix1 = FLOW_CHECKED_MOD(((FLOW_CHECKED_MOD((K), (MOD)) * T[((0 * NS) + 0)])), (MOD));
o1 = 0;
while (o1 < 3) {
int64_t o2 = 0;
while (o2 < 3) {
int64_t st = didx[(((((o1 * 3) + o2) * 9) + (0 * 3)) + 1)];
fix1 = FLOW_CHECKED_MOD(((fix1 + (FLOW_CHECKED_MOD(((K * (K - 1))), (MOD)) * T[((st * NS) + st)]))), (MOD));
o2 = (o2 + 1);
}
o1 = (o1 + 1);
}
int64_t i = 0;
while (i < (NS * NS)) {
R[i] = 0;
Bm[i] = T[i];
i = (i + 1);
}
i = 0;
while (i < NS) {
R[((i * NS) + i)] = 1;
i = (i + 1);
}
int64_t e = N;
while (e > 0) {
if ((e & 1) == 1) {
matmul_ptr_i64_ptr_i64_ptr_i64(R, Bm, W);
i = 0;
while (i < (NS * NS)) {
R[i] = W[i];
i = (i + 1);
}
}
e = FLOW_CHECKED_SHR((e), (1));
if (e > 0) {
matmul_ptr_i64_ptr_i64_ptr_i64(Bm, Bm, W);
i = 0;
while (i < (NS * NS)) {
Bm[i] = W[i];
i = (i + 1);
}
}
}
int64_t fixn = FLOW_CHECKED_MOD(((FLOW_CHECKED_MOD((K), (MOD)) * R[((0 * NS) + 0)])), (MOD));
o1 = 0;
while (o1 < 3) {
int64_t o2 = 0;
while (o2 < 3) {
int64_t st = didx[(((((o1 * 3) + o2) * 9) + (0 * 3)) + 1)];
fixn = FLOW_CHECKED_MOD(((fixn + (FLOW_CHECKED_MOD(((K * (K - 1))), (MOD)) * R[((st * NS) + st)]))), (MOD));
o2 = (o2 + 1);
}
o1 = (o1 + 1);
}
int64_t nm = FLOW_CHECKED_MOD((N), (MOD));
int64_t nm1 = FLOW_CHECKED_MOD(((N - 1)), (MOD));
int64_t tot = FLOW_CHECKED_MOD(((fixn + (nm1 * fix1))), (MOD));
int64_t ans = FLOW_CHECKED_MOD(((tot * inv_mod_i64(nm))), (MOD));
printf("%lld\n", ans);
free(didx);
free(T);
free(R);
free(Bm);
free(W);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%lld\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
// Constant: MOD
llvm.mlir.global internal constant @MOD(1000004321 : i64) : i64
// Constant: K
llvm.mlir.global internal constant @K(10 : i64) : i64
// Constant: N
llvm.mlir.global internal constant @N(10004003002001 : i64) : i64
// Constant: NS
llvm.mlir.global internal constant @NS(66 : i64) : i64
func.func @inv_mod(%arg0: i64) -> i64 {
%0 = llvm.mlir.addressof @MOD : !llvm.ptr
%1 = llvm.load %0 : !llvm.ptr -> i64
%2 = llvm.mlir.constant(1 : i64) : i64
%3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
llvm.store %1, %3 : i64, !llvm.ptr
%4 = arith.constant 0 : i32
%5 = arith.extsi %4 : i32 to i64
%6 = llvm.mlir.constant(1 : i64) : i64
%7 = llvm.alloca %6 x i64 : (i64) -> !llvm.ptr
llvm.store %5, %7 : i64, !llvm.ptr
%8 = llvm.mlir.addressof @MOD : !llvm.ptr
%9 = llvm.load %8 : !llvm.ptr -> i64
%10 = arith.remsi %arg0, %9 : i64
%11 = llvm.mlir.constant(1 : i64) : i64
%12 = llvm.alloca %11 x i64 : (i64) -> !llvm.ptr
llvm.store %10, %12 : i64, !llvm.ptr
%13 = arith.constant 1 : i32
%14 = arith.extsi %13 : i32 to i64
%15 = llvm.mlir.constant(1 : i64) : i64
%16 = llvm.alloca %15 x i64 : (i64) -> !llvm.ptr
llvm.store %14, %16 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%17 = llvm.load %12 : !llvm.ptr -> i64
%18 = arith.constant 0 : i32
%20 = arith.extsi %18 : i32 to i64
%19 = arith.cmpi ne, %17, %20 : i64
cf.cond_br %19, ^bb1, ^bb2
^bb1:
%21 = llvm.load %3 : !llvm.ptr -> i64
%22 = llvm.load %12 : !llvm.ptr -> i64
%23 = arith.divsi %21, %22 : i64
%24 = llvm.load %3 : !llvm.ptr -> i64
%25 = llvm.load %12 : !llvm.ptr -> i64
%26 = arith.muli %23, %25 : i64
%27 = arith.subi %24, %26 : i64
%28 = llvm.load %12 : !llvm.ptr -> i64
llvm.store %28, %3 : i64, !llvm.ptr
llvm.store %27, %12 : i64, !llvm.ptr
%29 = llvm.load %7 : !llvm.ptr -> i64
%30 = llvm.load %16 : !llvm.ptr -> i64
%31 = arith.muli %23, %30 : i64
%32 = arith.subi %29, %31 : i64
%33 = llvm.load %16 : !llvm.ptr -> i64
llvm.store %33, %7 : i64, !llvm.ptr
llvm.store %32, %16 : i64, !llvm.ptr
cf.br ^bb0
^bb2:
%34 = llvm.load %7 : !llvm.ptr -> i64
%35 = llvm.mlir.addressof @MOD : !llvm.ptr
%36 = llvm.load %35 : !llvm.ptr -> i64
%37 = arith.remsi %34, %36 : i64
llvm.store %37, %7 : i64, !llvm.ptr
%38 = llvm.load %7 : !llvm.ptr -> i64
%39 = arith.constant 0 : i32
%41 = arith.extsi %39 : i32 to i64
%40 = arith.cmpi slt, %38, %41 : i64
cf.cond_br %40, ^bb3, ^bb4
^bb3:
%42 = llvm.load %7 : !llvm.ptr -> i64
%43 = llvm.mlir.addressof @MOD : !llvm.ptr
%44 = llvm.load %43 : !llvm.ptr -> i64
%45 = arith.addi %42, %44 : i64
llvm.store %45, %7 : i64, !llvm.ptr
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
%46 = llvm.load %7 : !llvm.ptr -> i64
func.return %46 : i64
}
func.func @matmul(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> () {
%47 = arith.constant 0 : i32
%48 = arith.extsi %47 : i32 to i64
%49 = llvm.mlir.constant(1 : i64) : i64
%50 = llvm.alloca %49 x i64 : (i64) -> !llvm.ptr
llvm.store %48, %50 : i64, !llvm.ptr
cf.br ^bb6
^bb6:
%51 = llvm.load %50 : !llvm.ptr -> i64
%52 = llvm.mlir.addressof @NS : !llvm.ptr
%53 = llvm.load %52 : !llvm.ptr -> i64
%54 = arith.cmpi slt, %51, %53 : i64
cf.cond_br %54, ^bb7, ^bb8
^bb7:
%55 = arith.constant 0 : i32
%56 = arith.extsi %55 : i32 to i64
%57 = llvm.mlir.constant(1 : i64) : i64
%58 = llvm.alloca %57 x i64 : (i64) -> !llvm.ptr
llvm.store %56, %58 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%59 = llvm.load %58 : !llvm.ptr -> i64
%60 = llvm.mlir.addressof @NS : !llvm.ptr
%61 = llvm.load %60 : !llvm.ptr -> i64
%62 = arith.cmpi slt, %59, %61 : i64
cf.cond_br %62, ^bb10, ^bb11
^bb10:
%63 = arith.constant 0 : i32
%64 = arith.extsi %63 : i32 to i64
%65 = llvm.mlir.constant(1 : i64) : i64
%66 = llvm.alloca %65 x i64 : (i64) -> !llvm.ptr
llvm.store %64, %66 : i64, !llvm.ptr
%67 = arith.constant 0 : i32
%68 = arith.extsi %67 : i32 to i64
%69 = llvm.mlir.constant(1 : i64) : i64
%70 = llvm.alloca %69 x i64 : (i64) -> !llvm.ptr
llvm.store %68, %70 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%71 = llvm.load %70 : !llvm.ptr -> i64
%72 = llvm.mlir.addressof @NS : !llvm.ptr
%73 = llvm.load %72 : !llvm.ptr -> i64
%74 = arith.cmpi slt, %71, %73 : i64
cf.cond_br %74, ^bb13, ^bb14
^bb13:
%75 = llvm.load %66 : !llvm.ptr -> i64
%77 = llvm.load %50 : !llvm.ptr -> i64
%78 = llvm.mlir.addressof @NS : !llvm.ptr
%79 = llvm.load %78 : !llvm.ptr -> i64
%80 = arith.muli %77, %79 : i64
%81 = llvm.load %70 : !llvm.ptr -> i64
%82 = arith.addi %80, %81 : i64
%83 = llvm.getelementptr %arg0[%82] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%76 = llvm.load %83 : !llvm.ptr -> i64
%85 = llvm.load %70 : !llvm.ptr -> i64
%86 = llvm.mlir.addressof @NS : !llvm.ptr
%87 = llvm.load %86 : !llvm.ptr -> i64
%88 = arith.muli %85, %87 : i64
%89 = llvm.load %58 : !llvm.ptr -> i64
%90 = arith.addi %88, %89 : i64
%91 = llvm.getelementptr %arg1[%90] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%84 = llvm.load %91 : !llvm.ptr -> i64
%92 = arith.muli %76, %84 : i64
%93 = arith.addi %75, %92 : i64
%94 = llvm.mlir.addressof @MOD : !llvm.ptr
%95 = llvm.load %94 : !llvm.ptr -> i64
%96 = arith.remsi %93, %95 : i64
llvm.store %96, %66 : i64, !llvm.ptr
%97 = llvm.load %70 : !llvm.ptr -> i64
%98 = arith.constant 1 : i32
%100 = arith.extsi %98 : i32 to i64
%99 = arith.addi %97, %100 : i64
llvm.store %99, %70 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%101 = llvm.load %66 : !llvm.ptr -> i64
%102 = llvm.load %50 : !llvm.ptr -> i64
%103 = llvm.mlir.addressof @NS : !llvm.ptr
%104 = llvm.load %103 : !llvm.ptr -> i64
%105 = arith.muli %102, %104 : i64
%106 = llvm.load %58 : !llvm.ptr -> i64
%107 = arith.addi %105, %106 : i64
%108 = llvm.getelementptr %arg2[%107] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %101, %108 : i64, !llvm.ptr
%109 = llvm.load %58 : !llvm.ptr -> i64
%110 = arith.constant 1 : i32
%112 = arith.extsi %110 : i32 to i64
%111 = arith.addi %109, %112 : i64
llvm.store %111, %58 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
%113 = llvm.load %50 : !llvm.ptr -> i64
%114 = arith.constant 1 : i32
%116 = arith.extsi %114 : i32 to i64
%115 = arith.addi %113, %116 : i64
llvm.store %115, %50 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
func.return
}
func.func @fresh_cnt(%arg0: i64, %arg1: i64) -> i64 {
%117 = llvm.mlir.addressof @K : !llvm.ptr
%118 = llvm.load %117 : !llvm.ptr -> i64
%119 = arith.constant 2 : i32
%121 = arith.extsi %119 : i32 to i64
%120 = arith.addi %arg0, %121 : i64
%122 = arith.subi %120, %arg1 : i64
%123 = arith.subi %118, %122 : i64
%124 = arith.constant 0 : i32
%126 = arith.extsi %124 : i32 to i64
%125 = arith.cmpi slt, %123, %126 : i64
cf.cond_br %125, ^bb15, ^bb16
^bb15:
%127 = arith.constant 0 : i32
%128 = arith.extsi %127 : i32 to i64
func.return %128 : i64
^bb16:
cf.br ^bb17
^bb17:
func.return %123 : i64
}
func.func @main() -> i32 {
%130 = arith.constant 81 : i32
%131 = arith.constant 8 : i32
%132 = arith.extsi %130 : i32 to i64
%133 = arith.extsi %131 : i32 to i64
%129 = func.call @calloc(%132, %133) : (i64, i64) -> !llvm.ptr
%134 = arith.constant 3 : i32
%135 = arith.extsi %134 : i32 to i64
%136 = llvm.mlir.constant(1 : i64) : i64
%137 = llvm.alloca %136 x i64 : (i64) -> !llvm.ptr
llvm.store %135, %137 : i64, !llvm.ptr
%138 = arith.constant 0 : i32
%139 = arith.extsi %138 : i32 to i64
%140 = llvm.mlir.constant(1 : i64) : i64
%141 = llvm.alloca %140 x i64 : (i64) -> !llvm.ptr
llvm.store %139, %141 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%142 = llvm.load %141 : !llvm.ptr -> i64
%143 = arith.constant 3 : i32
%145 = arith.extsi %143 : i32 to i64
%144 = arith.cmpi slt, %142, %145 : i64
cf.cond_br %144, ^bb19, ^bb20
^bb19:
%146 = arith.constant 0 : i32
%147 = arith.extsi %146 : i32 to i64
%148 = llvm.mlir.constant(1 : i64) : i64
%149 = llvm.alloca %148 x i64 : (i64) -> !llvm.ptr
llvm.store %147, %149 : i64, !llvm.ptr
cf.br ^bb21
^bb21:
%150 = llvm.load %149 : !llvm.ptr -> i64
%151 = arith.constant 3 : i32
%153 = arith.extsi %151 : i32 to i64
%152 = arith.cmpi slt, %150, %153 : i64
cf.cond_br %152, ^bb22, ^bb23
^bb22:
%154 = arith.constant 0 : i32
%155 = arith.extsi %154 : i32 to i64
%156 = llvm.mlir.constant(1 : i64) : i64
%157 = llvm.alloca %156 x i64 : (i64) -> !llvm.ptr
llvm.store %155, %157 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%158 = llvm.load %157 : !llvm.ptr -> i64
%159 = arith.constant 3 : i32
%161 = arith.extsi %159 : i32 to i64
%160 = arith.cmpi slt, %158, %161 : i64
cf.cond_br %160, ^bb25, ^bb26
^bb25:
%162 = arith.constant 0 : i32
%163 = arith.extsi %162 : i32 to i64
%164 = llvm.mlir.constant(1 : i64) : i64
%165 = llvm.alloca %164 x i64 : (i64) -> !llvm.ptr
llvm.store %163, %165 : i64, !llvm.ptr
cf.br ^bb27
^bb27:
%166 = llvm.load %165 : !llvm.ptr -> i64
%167 = arith.constant 3 : i32
%169 = arith.extsi %167 : i32 to i64
%168 = arith.cmpi slt, %166, %169 : i64
cf.cond_br %168, ^bb28, ^bb29
^bb28:
%170 = llvm.load %157 : !llvm.ptr -> i64
%171 = llvm.load %165 : !llvm.ptr -> i64
%172 = arith.cmpi eq, %170, %171 : i64
%173 = scf.if %172 -> (i1) {
%174 = llvm.load %157 : !llvm.ptr -> i64
%175 = arith.constant 2 : i32
%177 = arith.extsi %175 : i32 to i64
%176 = arith.cmpi ne, %174, %177 : i64
scf.yield %176 : i1
} else {
%178 = arith.constant false
scf.yield %178 : i1
}
cf.cond_br %173, ^bb30, ^bb31
^bb30:
%179 = arith.constant 0 : i32
%180 = arith.constant 1 : i32
%181 = arith.subi %179, %180 : i32
%182 = llvm.load %141 : !llvm.ptr -> i64
%183 = arith.constant 3 : i32
%185 = arith.extsi %183 : i32 to i64
%184 = arith.muli %182, %185 : i64
%186 = llvm.load %149 : !llvm.ptr -> i64
%187 = arith.addi %184, %186 : i64
%188 = arith.constant 9 : i32
%190 = arith.extsi %188 : i32 to i64
%189 = arith.muli %187, %190 : i64
%191 = llvm.load %157 : !llvm.ptr -> i64
%192 = arith.constant 3 : i32
%194 = arith.extsi %192 : i32 to i64
%193 = arith.muli %191, %194 : i64
%195 = arith.addi %189, %193 : i64
%196 = llvm.load %165 : !llvm.ptr -> i64
%197 = arith.addi %195, %196 : i64
%198 = arith.extsi %181 : i32 to i64
%199 = llvm.getelementptr %129[%197] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %198, %199 : i64, !llvm.ptr
cf.br ^bb32
^bb31:
%200 = llvm.load %137 : !llvm.ptr -> i64
%201 = llvm.load %141 : !llvm.ptr -> i64
%202 = arith.constant 3 : i32
%204 = arith.extsi %202 : i32 to i64
%203 = arith.muli %201, %204 : i64
%205 = llvm.load %149 : !llvm.ptr -> i64
%206 = arith.addi %203, %205 : i64
%207 = arith.constant 9 : i32
%209 = arith.extsi %207 : i32 to i64
%208 = arith.muli %206, %209 : i64
%210 = llvm.load %157 : !llvm.ptr -> i64
%211 = arith.constant 3 : i32
%213 = arith.extsi %211 : i32 to i64
%212 = arith.muli %210, %213 : i64
%214 = arith.addi %208, %212 : i64
%215 = llvm.load %165 : !llvm.ptr -> i64
%216 = arith.addi %214, %215 : i64
%217 = llvm.getelementptr %129[%216] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %200, %217 : i64, !llvm.ptr
%218 = llvm.load %137 : !llvm.ptr -> i64
%219 = arith.constant 1 : i32
%221 = arith.extsi %219 : i32 to i64
%220 = arith.addi %218, %221 : i64
llvm.store %220, %137 : i64, !llvm.ptr
cf.br ^bb32
^bb32:
%222 = llvm.load %165 : !llvm.ptr -> i64
%223 = arith.constant 1 : i32
%225 = arith.extsi %223 : i32 to i64
%224 = arith.addi %222, %225 : i64
llvm.store %224, %165 : i64, !llvm.ptr
cf.br ^bb27
^bb29:
%226 = llvm.load %157 : !llvm.ptr -> i64
%227 = arith.constant 1 : i32
%229 = arith.extsi %227 : i32 to i64
%228 = arith.addi %226, %229 : i64
llvm.store %228, %157 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
%230 = llvm.load %149 : !llvm.ptr -> i64
%231 = arith.constant 1 : i32
%233 = arith.extsi %231 : i32 to i64
%232 = arith.addi %230, %233 : i64
llvm.store %232, %149 : i64, !llvm.ptr
cf.br ^bb21
^bb23:
%234 = llvm.load %141 : !llvm.ptr -> i64
%235 = arith.constant 1 : i32
%237 = arith.extsi %235 : i32 to i64
%236 = arith.addi %234, %237 : i64
llvm.store %236, %141 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
%239 = llvm.mlir.addressof @NS : !llvm.ptr
%240 = llvm.load %239 : !llvm.ptr -> i64
%241 = llvm.mlir.addressof @NS : !llvm.ptr
%242 = llvm.load %241 : !llvm.ptr -> i64
%243 = arith.muli %240, %242 : i64
%244 = arith.constant 8 : i32
%245 = arith.extsi %244 : i32 to i64
%238 = func.call @calloc(%243, %245) : (i64, i64) -> !llvm.ptr
%246 = arith.constant 0 : i32
%247 = arith.extsi %246 : i32 to i64
%248 = llvm.mlir.constant(1 : i64) : i64
%249 = llvm.alloca %248 x i64 : (i64) -> !llvm.ptr
llvm.store %247, %249 : i64, !llvm.ptr
cf.br ^bb33
^bb33:
%250 = llvm.load %249 : !llvm.ptr -> i64
%251 = arith.constant 3 : i32
%253 = arith.extsi %251 : i32 to i64
%252 = arith.cmpi slt, %250, %253 : i64
cf.cond_br %252, ^bb34, ^bb35
^bb34:
%254 = llvm.load %249 : !llvm.ptr -> i64
%255 = arith.constant 0 : i32
%256 = arith.extsi %255 : i32 to i64
%257 = llvm.mlir.constant(1 : i64) : i64
%258 = llvm.alloca %257 x i64 : (i64) -> !llvm.ptr
llvm.store %256, %258 : i64, !llvm.ptr
cf.br ^bb36
^bb36:
%259 = llvm.load %258 : !llvm.ptr -> i64
%260 = arith.constant 2 : i32
%262 = arith.extsi %260 : i32 to i64
%261 = arith.cmpi slt, %259, %262 : i64
cf.cond_br %261, ^bb37, ^bb38
^bb37:
%263 = llvm.load %258 : !llvm.ptr -> i64
%264 = llvm.load %249 : !llvm.ptr -> i64
%265 = arith.cmpi ne, %263, %264 : i64
cf.cond_br %265, ^bb39, ^bb40
^bb39:
%267 = llvm.mlir.addressof @NS : !llvm.ptr
%268 = llvm.load %267 : !llvm.ptr -> i64
%269 = arith.muli %254, %268 : i64
%270 = llvm.load %258 : !llvm.ptr -> i64
%271 = arith.addi %269, %270 : i64
%272 = llvm.getelementptr %238[%271] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%266 = llvm.load %272 : !llvm.ptr -> i64
%273 = arith.constant 1 : i32
%275 = arith.extsi %273 : i32 to i64
%274 = arith.addi %266, %275 : i64
%276 = llvm.mlir.addressof @MOD : !llvm.ptr
%277 = llvm.load %276 : !llvm.ptr -> i64
%278 = arith.remsi %274, %277 : i64
%279 = llvm.mlir.addressof @NS : !llvm.ptr
%280 = llvm.load %279 : !llvm.ptr -> i64
%281 = arith.muli %254, %280 : i64
%282 = llvm.load %258 : !llvm.ptr -> i64
%283 = arith.addi %281, %282 : i64
%284 = llvm.getelementptr %238[%283] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %278, %284 : i64, !llvm.ptr
cf.br ^bb41
^bb40:
cf.br ^bb41
^bb41:
%285 = llvm.load %258 : !llvm.ptr -> i64
%286 = arith.constant 1 : i32
%288 = arith.extsi %286 : i32 to i64
%287 = arith.addi %285, %288 : i64
llvm.store %287, %258 : i64, !llvm.ptr
cf.br ^bb36
^bb38:
%289 = arith.constant 0 : i32
%290 = arith.extsi %289 : i32 to i64
%291 = llvm.mlir.constant(1 : i64) : i64
%292 = llvm.alloca %291 x i64 : (i64) -> !llvm.ptr
llvm.store %290, %292 : i64, !llvm.ptr
%293 = llvm.load %249 : !llvm.ptr -> i64
%294 = arith.constant 2 : i32
%296 = arith.extsi %294 : i32 to i64
%295 = arith.cmpi slt, %293, %296 : i64
cf.cond_br %295, ^bb42, ^bb43
^bb42:
%297 = arith.constant 1 : i32
%298 = arith.extsi %297 : i32 to i64
llvm.store %298, %292 : i64, !llvm.ptr
cf.br ^bb44
^bb43:
cf.br ^bb44
^bb44:
%300 = llvm.mlir.addressof @NS : !llvm.ptr
%301 = llvm.load %300 : !llvm.ptr -> i64
%302 = arith.muli %254, %301 : i64
%303 = arith.constant 2 : i32
%305 = arith.extsi %303 : i32 to i64
%304 = arith.addi %302, %305 : i64
%306 = llvm.getelementptr %238[%304] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%299 = llvm.load %306 : !llvm.ptr -> i64
%308 = arith.constant 1 : i32
%309 = llvm.load %292 : !llvm.ptr -> i64
%310 = arith.extsi %308 : i32 to i64
%307 = func.call @fresh_cnt(%310, %309) : (i64, i64) -> i64
%311 = arith.addi %299, %307 : i64
%312 = llvm.mlir.addressof @MOD : !llvm.ptr
%313 = llvm.load %312 : !llvm.ptr -> i64
%314 = arith.remsi %311, %313 : i64
%315 = llvm.mlir.addressof @NS : !llvm.ptr
%316 = llvm.load %315 : !llvm.ptr -> i64
%317 = arith.muli %254, %316 : i64
%318 = arith.constant 2 : i32
%320 = arith.extsi %318 : i32 to i64
%319 = arith.addi %317, %320 : i64
%321 = llvm.getelementptr %238[%319] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %314, %321 : i64, !llvm.ptr
%322 = arith.constant 1 : i32
%323 = arith.extsi %322 : i32 to i64
%324 = llvm.mlir.constant(1 : i64) : i64
%325 = llvm.alloca %324 x i64 : (i64) -> !llvm.ptr
llvm.store %323, %325 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%326 = llvm.load %325 : !llvm.ptr -> i64
%327 = arith.constant 3 : i32
%329 = arith.extsi %327 : i32 to i64
%328 = arith.cmpi sle, %326, %329 : i64
cf.cond_br %328, ^bb46, ^bb47
^bb46:
%330 = arith.constant 1 : i32
%331 = arith.extsi %330 : i32 to i64
%332 = llvm.mlir.constant(1 : i64) : i64
%333 = llvm.alloca %332 x i64 : (i64) -> !llvm.ptr
llvm.store %331, %333 : i64, !llvm.ptr
cf.br ^bb48
^bb48:
%334 = llvm.load %333 : !llvm.ptr -> i64
%335 = arith.constant 3 : i32
%337 = arith.extsi %335 : i32 to i64
%336 = arith.cmpi sle, %334, %337 : i64
cf.cond_br %336, ^bb49, ^bb50
^bb49:
%338 = arith.constant 0 : i32
%339 = arith.extsi %338 : i32 to i64
%340 = llvm.mlir.constant(1 : i64) : i64
%341 = llvm.alloca %340 x i64 : (i64) -> !llvm.ptr
llvm.store %339, %341 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%342 = llvm.load %341 : !llvm.ptr -> i64
%343 = arith.constant 3 : i32
%345 = arith.extsi %343 : i32 to i64
%344 = arith.cmpi slt, %342, %345 : i64
cf.cond_br %344, ^bb52, ^bb53
^bb52:
%346 = arith.constant 0 : i32
%347 = arith.extsi %346 : i32 to i64
%348 = llvm.mlir.constant(1 : i64) : i64
%349 = llvm.alloca %348 x i64 : (i64) -> !llvm.ptr
llvm.store %347, %349 : i64, !llvm.ptr
%350 = llvm.load %341 : !llvm.ptr -> i64
%351 = arith.constant 2 : i32
%353 = arith.extsi %351 : i32 to i64
%352 = arith.cmpi slt, %350, %353 : i64
cf.cond_br %352, ^bb54, ^bb55
^bb54:
%354 = llvm.load %341 : !llvm.ptr -> i64
%355 = llvm.load %249 : !llvm.ptr -> i64
%356 = arith.cmpi ne, %354, %355 : i64
cf.cond_br %356, ^bb57, ^bb58
^bb57:
%357 = arith.constant 1 : i32
%358 = arith.extsi %357 : i32 to i64
llvm.store %358, %349 : i64, !llvm.ptr
cf.br ^bb59
^bb58:
cf.br ^bb59
^bb59:
cf.br ^bb56
^bb55:
%360 = arith.constant 1 : i32
%361 = llvm.load %292 : !llvm.ptr -> i64
%362 = arith.extsi %360 : i32 to i64
%359 = func.call @fresh_cnt(%362, %361) : (i64, i64) -> i64
llvm.store %359, %349 : i64, !llvm.ptr
cf.br ^bb56
^bb56:
%363 = llvm.load %349 : !llvm.ptr -> i64
%364 = arith.constant 0 : i32
%366 = arith.extsi %364 : i32 to i64
%365 = arith.cmpi sgt, %363, %366 : i64
cf.cond_br %365, ^bb60, ^bb61
^bb60:
%367 = arith.constant 0 : i32
%368 = arith.extsi %367 : i32 to i64
%369 = llvm.mlir.constant(1 : i64) : i64
%370 = llvm.alloca %369 x i64 : (i64) -> !llvm.ptr
llvm.store %368, %370 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%371 = llvm.load %370 : !llvm.ptr -> i64
%372 = arith.constant 3 : i32
%374 = arith.extsi %372 : i32 to i64
%373 = arith.cmpi slt, %371, %374 : i64
cf.cond_br %373, ^bb64, ^bb65
^bb64:
%375 = arith.constant 0 : i32
%376 = arith.extsi %375 : i32 to i64
%377 = llvm.mlir.constant(1 : i64) : i64
%378 = llvm.alloca %377 x i64 : (i64) -> !llvm.ptr
llvm.store %376, %378 : i64, !llvm.ptr
%379 = llvm.load %249 : !llvm.ptr -> i64
%380 = arith.constant 2 : i32
%382 = arith.extsi %380 : i32 to i64
%381 = arith.cmpi slt, %379, %382 : i64
cf.cond_br %381, ^bb66, ^bb67
^bb66:
%383 = llvm.load %378 : !llvm.ptr -> i64
%384 = arith.constant 1 : i32
%386 = arith.extsi %384 : i32 to i64
%385 = arith.addi %383, %386 : i64
llvm.store %385, %378 : i64, !llvm.ptr
cf.br ^bb68
^bb67:
cf.br ^bb68
^bb68:
%387 = llvm.load %341 : !llvm.ptr -> i64
%388 = arith.constant 2 : i32
%390 = arith.extsi %388 : i32 to i64
%389 = arith.cmpi slt, %387, %390 : i64
cf.cond_br %389, ^bb69, ^bb70
^bb69:
%391 = llvm.load %378 : !llvm.ptr -> i64
%392 = arith.constant 1 : i32
%394 = arith.extsi %392 : i32 to i64
%393 = arith.addi %391, %394 : i64
llvm.store %393, %378 : i64, !llvm.ptr
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%395 = arith.constant 0 : i32
%396 = arith.extsi %395 : i32 to i64
%397 = llvm.mlir.constant(1 : i64) : i64
%398 = llvm.alloca %397 x i64 : (i64) -> !llvm.ptr
llvm.store %396, %398 : i64, !llvm.ptr
%399 = llvm.load %370 : !llvm.ptr -> i64
%400 = arith.constant 2 : i32
%402 = arith.extsi %400 : i32 to i64
%401 = arith.cmpi slt, %399, %402 : i64
cf.cond_br %401, ^bb72, ^bb73
^bb72:
%403 = llvm.load %370 : !llvm.ptr -> i64
%404 = llvm.load %249 : !llvm.ptr -> i64
%405 = arith.cmpi ne, %403, %404 : i64
%406 = scf.if %405 -> (i1) {
%407 = llvm.load %370 : !llvm.ptr -> i64
%408 = llvm.load %341 : !llvm.ptr -> i64
%409 = arith.cmpi ne, %407, %408 : i64
scf.yield %409 : i1
} else {
%410 = arith.constant false
scf.yield %410 : i1
}
cf.cond_br %406, ^bb75, ^bb76
^bb75:
%411 = arith.constant 1 : i32
%412 = arith.extsi %411 : i32 to i64
llvm.store %412, %398 : i64, !llvm.ptr
cf.br ^bb77
^bb76:
cf.br ^bb77
^bb77:
cf.br ^bb74
^bb73:
%414 = arith.constant 2 : i32
%415 = llvm.load %378 : !llvm.ptr -> i64
%416 = arith.extsi %414 : i32 to i64
%413 = func.call @fresh_cnt(%416, %415) : (i64, i64) -> i64
llvm.store %413, %398 : i64, !llvm.ptr
cf.br ^bb74
^bb74:
%417 = llvm.load %398 : !llvm.ptr -> i64
%418 = arith.constant 0 : i32
%420 = arith.extsi %418 : i32 to i64
%419 = arith.cmpi sgt, %417, %420 : i64
cf.cond_br %419, ^bb78, ^bb79
^bb78:
%422 = llvm.load %325 : !llvm.ptr -> i64
%423 = arith.constant 1 : i32
%425 = arith.extsi %423 : i32 to i64
%424 = arith.subi %422, %425 : i64
%426 = arith.constant 3 : i32
%428 = arith.extsi %426 : i32 to i64
%427 = arith.muli %424, %428 : i64
%429 = llvm.load %333 : !llvm.ptr -> i64
%430 = arith.constant 1 : i32
%432 = arith.extsi %430 : i32 to i64
%431 = arith.subi %429, %432 : i64
%433 = arith.addi %427, %431 : i64
%434 = arith.constant 9 : i32
%436 = arith.extsi %434 : i32 to i64
%435 = arith.muli %433, %436 : i64
%437 = llvm.load %341 : !llvm.ptr -> i64
%438 = arith.constant 3 : i32
%440 = arith.extsi %438 : i32 to i64
%439 = arith.muli %437, %440 : i64
%441 = arith.addi %435, %439 : i64
%442 = llvm.load %370 : !llvm.ptr -> i64
%443 = arith.addi %441, %442 : i64
%444 = llvm.getelementptr %129[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%421 = llvm.load %444 : !llvm.ptr -> i64
%445 = arith.constant 0 : i32
%447 = arith.extsi %445 : i32 to i64
%446 = arith.cmpi sge, %421, %447 : i64
cf.cond_br %446, ^bb81, ^bb82
^bb81:
%449 = llvm.mlir.addressof @NS : !llvm.ptr
%450 = llvm.load %449 : !llvm.ptr -> i64
%451 = arith.muli %254, %450 : i64
%452 = arith.addi %451, %421 : i64
%453 = llvm.getelementptr %238[%452] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%448 = llvm.load %453 : !llvm.ptr -> i64
%454 = llvm.load %349 : !llvm.ptr -> i64
%455 = llvm.load %398 : !llvm.ptr -> i64
%456 = arith.muli %454, %455 : i64
%457 = arith.addi %448, %456 : i64
%458 = llvm.mlir.addressof @MOD : !llvm.ptr
%459 = llvm.load %458 : !llvm.ptr -> i64
%460 = arith.remsi %457, %459 : i64
%461 = llvm.mlir.addressof @NS : !llvm.ptr
%462 = llvm.load %461 : !llvm.ptr -> i64
%463 = arith.muli %254, %462 : i64
%464 = arith.addi %463, %421 : i64
%465 = llvm.getelementptr %238[%464] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %460, %465 : i64, !llvm.ptr
cf.br ^bb83
^bb82:
cf.br ^bb83
^bb83:
cf.br ^bb80
^bb79:
cf.br ^bb80
^bb80:
%466 = llvm.load %370 : !llvm.ptr -> i64
%467 = arith.constant 1 : i32
%469 = arith.extsi %467 : i32 to i64
%468 = arith.addi %466, %469 : i64
llvm.store %468, %370 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
%470 = llvm.load %341 : !llvm.ptr -> i64
%471 = arith.constant 1 : i32
%473 = arith.extsi %471 : i32 to i64
%472 = arith.addi %470, %473 : i64
llvm.store %472, %341 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
%474 = llvm.load %333 : !llvm.ptr -> i64
%475 = arith.constant 1 : i32
%477 = arith.extsi %475 : i32 to i64
%476 = arith.addi %474, %477 : i64
llvm.store %476, %333 : i64, !llvm.ptr
cf.br ^bb48
^bb50:
%478 = llvm.load %325 : !llvm.ptr -> i64
%479 = arith.constant 1 : i32
%481 = arith.extsi %479 : i32 to i64
%480 = arith.addi %478, %481 : i64
llvm.store %480, %325 : i64, !llvm.ptr
cf.br ^bb45
^bb47:
%482 = llvm.load %249 : !llvm.ptr -> i64
%483 = arith.constant 1 : i32
%485 = arith.extsi %483 : i32 to i64
%484 = arith.addi %482, %485 : i64
llvm.store %484, %249 : i64, !llvm.ptr
cf.br ^bb33
^bb35:
%486 = arith.constant 0 : i32
%487 = arith.extsi %486 : i32 to i64
llvm.store %487, %141 : i64, !llvm.ptr
cf.br ^bb84
^bb84:
%488 = llvm.load %141 : !llvm.ptr -> i64
%489 = arith.constant 3 : i32
%491 = arith.extsi %489 : i32 to i64
%490 = arith.cmpi slt, %488, %491 : i64
cf.cond_br %490, ^bb85, ^bb86
^bb85:
%492 = arith.constant 0 : i32
%493 = arith.extsi %492 : i32 to i64
%494 = llvm.mlir.constant(1 : i64) : i64
%495 = llvm.alloca %494 x i64 : (i64) -> !llvm.ptr
llvm.store %493, %495 : i64, !llvm.ptr
cf.br ^bb87
^bb87:
%496 = llvm.load %495 : !llvm.ptr -> i64
%497 = arith.constant 3 : i32
%499 = arith.extsi %497 : i32 to i64
%498 = arith.cmpi slt, %496, %499 : i64
cf.cond_br %498, ^bb88, ^bb89
^bb88:
%500 = arith.constant 0 : i32
%501 = arith.extsi %500 : i32 to i64
%502 = llvm.mlir.constant(1 : i64) : i64
%503 = llvm.alloca %502 x i64 : (i64) -> !llvm.ptr
llvm.store %501, %503 : i64, !llvm.ptr
cf.br ^bb90
^bb90:
%504 = llvm.load %503 : !llvm.ptr -> i64
%505 = arith.constant 3 : i32
%507 = arith.extsi %505 : i32 to i64
%506 = arith.cmpi slt, %504, %507 : i64
cf.cond_br %506, ^bb91, ^bb92
^bb91:
%508 = arith.constant 0 : i32
%509 = arith.extsi %508 : i32 to i64
%510 = llvm.mlir.constant(1 : i64) : i64
%511 = llvm.alloca %510 x i64 : (i64) -> !llvm.ptr
llvm.store %509, %511 : i64, !llvm.ptr
cf.br ^bb93
^bb93:
%512 = llvm.load %511 : !llvm.ptr -> i64
%513 = arith.constant 3 : i32
%515 = arith.extsi %513 : i32 to i64
%514 = arith.cmpi slt, %512, %515 : i64
cf.cond_br %514, ^bb94, ^bb95
^bb94:
%517 = llvm.load %141 : !llvm.ptr -> i64
%518 = arith.constant 3 : i32
%520 = arith.extsi %518 : i32 to i64
%519 = arith.muli %517, %520 : i64
%521 = llvm.load %495 : !llvm.ptr -> i64
%522 = arith.addi %519, %521 : i64
%523 = arith.constant 9 : i32
%525 = arith.extsi %523 : i32 to i64
%524 = arith.muli %522, %525 : i64
%526 = llvm.load %503 : !llvm.ptr -> i64
%527 = arith.constant 3 : i32
%529 = arith.extsi %527 : i32 to i64
%528 = arith.muli %526, %529 : i64
%530 = arith.addi %524, %528 : i64
%531 = llvm.load %511 : !llvm.ptr -> i64
%532 = arith.addi %530, %531 : i64
%533 = llvm.getelementptr %129[%532] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%516 = llvm.load %533 : !llvm.ptr -> i64
%534 = arith.constant 0 : i32
%536 = arith.extsi %534 : i32 to i64
%535 = arith.cmpi sge, %516, %536 : i64
cf.cond_br %535, ^bb96, ^bb97
^bb96:
%537 = arith.constant 0 : i32
%538 = arith.extsi %537 : i32 to i64
%539 = llvm.mlir.constant(1 : i64) : i64
%540 = llvm.alloca %539 x i64 : (i64) -> !llvm.ptr
llvm.store %538, %540 : i64, !llvm.ptr
%541 = llvm.load %503 : !llvm.ptr -> i64
%542 = arith.constant 2 : i32
%544 = arith.extsi %542 : i32 to i64
%543 = arith.cmpi slt, %541, %544 : i64
cf.cond_br %543, ^bb99, ^bb100
^bb99:
%545 = llvm.load %540 : !llvm.ptr -> i64
%546 = arith.constant 1 : i32
%548 = arith.extsi %546 : i32 to i64
%547 = arith.addi %545, %548 : i64
llvm.store %547, %540 : i64, !llvm.ptr
cf.br ^bb101
^bb100:
cf.br ^bb101
^bb101:
%549 = llvm.load %511 : !llvm.ptr -> i64
%550 = arith.constant 2 : i32
%552 = arith.extsi %550 : i32 to i64
%551 = arith.cmpi slt, %549, %552 : i64
cf.cond_br %551, ^bb102, ^bb103
^bb102:
%553 = llvm.load %540 : !llvm.ptr -> i64
%554 = arith.constant 1 : i32
%556 = arith.extsi %554 : i32 to i64
%555 = arith.addi %553, %556 : i64
llvm.store %555, %540 : i64, !llvm.ptr
cf.br ^bb104
^bb103:
cf.br ^bb104
^bb104:
%557 = llvm.load %141 : !llvm.ptr -> i64
%558 = arith.constant 0 : i32
%560 = arith.extsi %558 : i32 to i64
%559 = arith.cmpi sgt, %557, %560 : i64
%561 = scf.if %559 -> (i1) {
%562 = llvm.load %495 : !llvm.ptr -> i64
%563 = arith.constant 0 : i32
%565 = arith.extsi %563 : i32 to i64
%564 = arith.cmpi sgt, %562, %565 : i64
scf.yield %564 : i1
} else {
%566 = arith.constant false
scf.yield %566 : i1
}
cf.cond_br %561, ^bb105, ^bb106
^bb105:
%568 = llvm.load %141 : !llvm.ptr -> i64
%569 = arith.constant 1 : i32
%571 = arith.extsi %569 : i32 to i64
%570 = arith.subi %568, %571 : i64
%572 = arith.constant 3 : i32
%574 = arith.extsi %572 : i32 to i64
%573 = arith.muli %570, %574 : i64
%575 = llvm.load %495 : !llvm.ptr -> i64
%576 = arith.constant 1 : i32
%578 = arith.extsi %576 : i32 to i64
%577 = arith.subi %575, %578 : i64
%579 = arith.addi %573, %577 : i64
%580 = arith.constant 9 : i32
%582 = arith.extsi %580 : i32 to i64
%581 = arith.muli %579, %582 : i64
%583 = llvm.load %503 : !llvm.ptr -> i64
%584 = arith.constant 3 : i32
%586 = arith.extsi %584 : i32 to i64
%585 = arith.muli %583, %586 : i64
%587 = arith.addi %581, %585 : i64
%588 = llvm.load %511 : !llvm.ptr -> i64
%589 = arith.addi %587, %588 : i64
%590 = llvm.getelementptr %129[%589] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%567 = llvm.load %590 : !llvm.ptr -> i64
%592 = llvm.mlir.addressof @NS : !llvm.ptr
%593 = llvm.load %592 : !llvm.ptr -> i64
%594 = arith.muli %516, %593 : i64
%595 = arith.addi %594, %567 : i64
%596 = llvm.getelementptr %238[%595] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%591 = llvm.load %596 : !llvm.ptr -> i64
%597 = arith.constant 1 : i32
%599 = arith.extsi %597 : i32 to i64
%598 = arith.addi %591, %599 : i64
%600 = llvm.mlir.addressof @MOD : !llvm.ptr
%601 = llvm.load %600 : !llvm.ptr -> i64
%602 = arith.remsi %598, %601 : i64
%603 = llvm.mlir.addressof @NS : !llvm.ptr
%604 = llvm.load %603 : !llvm.ptr -> i64
%605 = arith.muli %516, %604 : i64
%606 = arith.addi %605, %567 : i64
%607 = llvm.getelementptr %238[%606] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %602, %607 : i64, !llvm.ptr
cf.br ^bb107
^bb106:
cf.br ^bb107
^bb107:
%608 = llvm.load %141 : !llvm.ptr -> i64
%609 = arith.constant 0 : i32
%611 = arith.extsi %609 : i32 to i64
%610 = arith.cmpi sgt, %608, %611 : i64
%612 = scf.if %610 -> (i1) {
%613 = llvm.load %495 : !llvm.ptr -> i64
%614 = arith.constant 0 : i32
%616 = arith.extsi %614 : i32 to i64
%615 = arith.cmpi eq, %613, %616 : i64
scf.yield %615 : i1
} else {
%617 = arith.constant false
scf.yield %617 : i1
}
cf.cond_br %612, ^bb108, ^bb109
^bb108:
%618 = arith.constant 1 : i32
%619 = arith.extsi %618 : i32 to i64
%620 = llvm.mlir.constant(1 : i64) : i64
%621 = llvm.alloca %620 x i64 : (i64) -> !llvm.ptr
llvm.store %619, %621 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%622 = llvm.load %621 : !llvm.ptr -> i64
%623 = arith.constant 3 : i32
%625 = arith.extsi %623 : i32 to i64
%624 = arith.cmpi sle, %622, %625 : i64
cf.cond_br %624, ^bb112, ^bb113
^bb112:
%626 = arith.constant 0 : i32
%627 = arith.extsi %626 : i32 to i64
%628 = llvm.mlir.constant(1 : i64) : i64
%629 = llvm.alloca %628 x i64 : (i64) -> !llvm.ptr
llvm.store %627, %629 : i64, !llvm.ptr
cf.br ^bb114
^bb114:
%630 = llvm.load %629 : !llvm.ptr -> i64
%631 = arith.constant 3 : i32
%633 = arith.extsi %631 : i32 to i64
%632 = arith.cmpi slt, %630, %633 : i64
cf.cond_br %632, ^bb115, ^bb116
^bb115:
%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
%638 = llvm.load %629 : !llvm.ptr -> i64
%639 = arith.constant 2 : i32
%641 = arith.extsi %639 : i32 to i64
%640 = arith.cmpi slt, %638, %641 : i64
cf.cond_br %640, ^bb117, ^bb118
^bb117:
%642 = llvm.load %629 : !llvm.ptr -> i64
%643 = llvm.load %503 : !llvm.ptr -> i64
%644 = arith.cmpi ne, %642, %643 : i64
%645 = scf.if %644 -> (i1) {
%646 = llvm.load %629 : !llvm.ptr -> i64
%647 = llvm.load %511 : !llvm.ptr -> i64
%648 = arith.cmpi ne, %646, %647 : i64
scf.yield %648 : i1
} else {
%649 = arith.constant false
scf.yield %649 : i1
}
cf.cond_br %645, ^bb120, ^bb121
^bb120:
%650 = arith.constant 1 : i32
%651 = arith.extsi %650 : i32 to i64
llvm.store %651, %637 : i64, !llvm.ptr
cf.br ^bb122
^bb121:
cf.br ^bb122
^bb122:
cf.br ^bb119
^bb118:
%653 = arith.constant 2 : i32
%654 = llvm.load %540 : !llvm.ptr -> i64
%655 = arith.extsi %653 : i32 to i64
%652 = func.call @fresh_cnt(%655, %654) : (i64, i64) -> i64
llvm.store %652, %637 : i64, !llvm.ptr
cf.br ^bb119
^bb119:
%656 = llvm.load %637 : !llvm.ptr -> i64
%657 = arith.constant 0 : i32
%659 = arith.extsi %657 : i32 to i64
%658 = arith.cmpi sgt, %656, %659 : i64
cf.cond_br %658, ^bb123, ^bb124
^bb123:
%661 = llvm.load %141 : !llvm.ptr -> i64
%662 = arith.constant 1 : i32
%664 = arith.extsi %662 : i32 to i64
%663 = arith.subi %661, %664 : i64
%665 = arith.constant 3 : i32
%667 = arith.extsi %665 : i32 to i64
%666 = arith.muli %663, %667 : i64
%668 = llvm.load %621 : !llvm.ptr -> i64
%669 = arith.constant 1 : i32
%671 = arith.extsi %669 : i32 to i64
%670 = arith.subi %668, %671 : i64
%672 = arith.addi %666, %670 : i64
%673 = arith.constant 9 : i32
%675 = arith.extsi %673 : i32 to i64
%674 = arith.muli %672, %675 : i64
%676 = llvm.load %503 : !llvm.ptr -> i64
%677 = arith.constant 3 : i32
%679 = arith.extsi %677 : i32 to i64
%678 = arith.muli %676, %679 : i64
%680 = arith.addi %674, %678 : i64
%681 = llvm.load %629 : !llvm.ptr -> i64
%682 = arith.addi %680, %681 : i64
%683 = llvm.getelementptr %129[%682] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%660 = llvm.load %683 : !llvm.ptr -> i64
%684 = arith.constant 0 : i32
%686 = arith.extsi %684 : i32 to i64
%685 = arith.cmpi sge, %660, %686 : i64
cf.cond_br %685, ^bb126, ^bb127
^bb126:
%688 = llvm.mlir.addressof @NS : !llvm.ptr
%689 = llvm.load %688 : !llvm.ptr -> i64
%690 = arith.muli %516, %689 : i64
%691 = arith.addi %690, %660 : i64
%692 = llvm.getelementptr %238[%691] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%687 = llvm.load %692 : !llvm.ptr -> i64
%693 = llvm.load %637 : !llvm.ptr -> i64
%694 = arith.addi %687, %693 : i64
%695 = llvm.mlir.addressof @MOD : !llvm.ptr
%696 = llvm.load %695 : !llvm.ptr -> i64
%697 = arith.remsi %694, %696 : i64
%698 = llvm.mlir.addressof @NS : !llvm.ptr
%699 = llvm.load %698 : !llvm.ptr -> i64
%700 = arith.muli %516, %699 : i64
%701 = arith.addi %700, %660 : i64
%702 = llvm.getelementptr %238[%701] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %697, %702 : i64, !llvm.ptr
cf.br ^bb128
^bb127:
cf.br ^bb128
^bb128:
cf.br ^bb125
^bb124:
cf.br ^bb125
^bb125:
%703 = llvm.load %629 : !llvm.ptr -> i64
%704 = arith.constant 1 : i32
%706 = arith.extsi %704 : i32 to i64
%705 = arith.addi %703, %706 : i64
llvm.store %705, %629 : i64, !llvm.ptr
cf.br ^bb114
^bb116:
%707 = llvm.load %621 : !llvm.ptr -> i64
%708 = arith.constant 1 : i32
%710 = arith.extsi %708 : i32 to i64
%709 = arith.addi %707, %710 : i64
llvm.store %709, %621 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
cf.br ^bb110
^bb109:
cf.br ^bb110
^bb110:
%711 = llvm.load %141 : !llvm.ptr -> i64
%712 = arith.constant 0 : i32
%714 = arith.extsi %712 : i32 to i64
%713 = arith.cmpi eq, %711, %714 : i64
%715 = scf.if %713 -> (i1) {
%716 = llvm.load %495 : !llvm.ptr -> i64
%717 = arith.constant 0 : i32
%719 = arith.extsi %717 : i32 to i64
%718 = arith.cmpi sgt, %716, %719 : i64
scf.yield %718 : i1
} else {
%720 = arith.constant false
scf.yield %720 : i1
}
cf.cond_br %715, ^bb129, ^bb130
^bb129:
%721 = arith.constant 1 : i32
%722 = arith.extsi %721 : i32 to i64
%723 = llvm.mlir.constant(1 : i64) : i64
%724 = llvm.alloca %723 x i64 : (i64) -> !llvm.ptr
llvm.store %722, %724 : i64, !llvm.ptr
cf.br ^bb132
^bb132:
%725 = llvm.load %724 : !llvm.ptr -> i64
%726 = arith.constant 3 : i32
%728 = arith.extsi %726 : i32 to i64
%727 = arith.cmpi sle, %725, %728 : i64
cf.cond_br %727, ^bb133, ^bb134
^bb133:
%729 = arith.constant 0 : i32
%730 = arith.extsi %729 : i32 to i64
%731 = llvm.mlir.constant(1 : i64) : i64
%732 = llvm.alloca %731 x i64 : (i64) -> !llvm.ptr
llvm.store %730, %732 : i64, !llvm.ptr
cf.br ^bb135
^bb135:
%733 = llvm.load %732 : !llvm.ptr -> i64
%734 = arith.constant 3 : i32
%736 = arith.extsi %734 : i32 to i64
%735 = arith.cmpi slt, %733, %736 : i64
cf.cond_br %735, ^bb136, ^bb137
^bb136:
%737 = arith.constant 0 : i32
%738 = arith.extsi %737 : i32 to i64
%739 = llvm.mlir.constant(1 : i64) : i64
%740 = llvm.alloca %739 x i64 : (i64) -> !llvm.ptr
llvm.store %738, %740 : i64, !llvm.ptr
%741 = llvm.load %732 : !llvm.ptr -> i64
%742 = arith.constant 2 : i32
%744 = arith.extsi %742 : i32 to i64
%743 = arith.cmpi slt, %741, %744 : i64
cf.cond_br %743, ^bb138, ^bb139
^bb138:
%745 = llvm.load %732 : !llvm.ptr -> i64
%746 = llvm.load %503 : !llvm.ptr -> i64
%747 = arith.cmpi ne, %745, %746 : i64
%748 = scf.if %747 -> (i1) {
%749 = llvm.load %732 : !llvm.ptr -> i64
%750 = llvm.load %511 : !llvm.ptr -> i64
%751 = arith.cmpi ne, %749, %750 : i64
scf.yield %751 : i1
} else {
%752 = arith.constant false
scf.yield %752 : i1
}
cf.cond_br %748, ^bb141, ^bb142
^bb141:
%753 = arith.constant 1 : i32
%754 = arith.extsi %753 : i32 to i64
llvm.store %754, %740 : i64, !llvm.ptr
cf.br ^bb143
^bb142:
cf.br ^bb143
^bb143:
cf.br ^bb140
^bb139:
%756 = arith.constant 2 : i32
%757 = llvm.load %540 : !llvm.ptr -> i64
%758 = arith.extsi %756 : i32 to i64
%755 = func.call @fresh_cnt(%758, %757) : (i64, i64) -> i64
llvm.store %755, %740 : i64, !llvm.ptr
cf.br ^bb140
^bb140:
%759 = llvm.load %740 : !llvm.ptr -> i64
%760 = arith.constant 0 : i32
%762 = arith.extsi %760 : i32 to i64
%761 = arith.cmpi sgt, %759, %762 : i64
cf.cond_br %761, ^bb144, ^bb145
^bb144:
%764 = llvm.load %724 : !llvm.ptr -> i64
%765 = arith.constant 1 : i32
%767 = arith.extsi %765 : i32 to i64
%766 = arith.subi %764, %767 : i64
%768 = arith.constant 3 : i32
%770 = arith.extsi %768 : i32 to i64
%769 = arith.muli %766, %770 : i64
%771 = llvm.load %495 : !llvm.ptr -> i64
%772 = arith.constant 1 : i32
%774 = arith.extsi %772 : i32 to i64
%773 = arith.subi %771, %774 : i64
%775 = arith.addi %769, %773 : i64
%776 = arith.constant 9 : i32
%778 = arith.extsi %776 : i32 to i64
%777 = arith.muli %775, %778 : i64
%779 = llvm.load %732 : !llvm.ptr -> i64
%780 = arith.constant 3 : i32
%782 = arith.extsi %780 : i32 to i64
%781 = arith.muli %779, %782 : i64
%783 = arith.addi %777, %781 : i64
%784 = llvm.load %511 : !llvm.ptr -> i64
%785 = arith.addi %783, %784 : i64
%786 = llvm.getelementptr %129[%785] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%763 = llvm.load %786 : !llvm.ptr -> i64
%787 = arith.constant 0 : i32
%789 = arith.extsi %787 : i32 to i64
%788 = arith.cmpi sge, %763, %789 : i64
cf.cond_br %788, ^bb147, ^bb148
^bb147:
%791 = llvm.mlir.addressof @NS : !llvm.ptr
%792 = llvm.load %791 : !llvm.ptr -> i64
%793 = arith.muli %516, %792 : i64
%794 = arith.addi %793, %763 : i64
%795 = llvm.getelementptr %238[%794] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%790 = llvm.load %795 : !llvm.ptr -> i64
%796 = llvm.load %740 : !llvm.ptr -> i64
%797 = arith.addi %790, %796 : i64
%798 = llvm.mlir.addressof @MOD : !llvm.ptr
%799 = llvm.load %798 : !llvm.ptr -> i64
%800 = arith.remsi %797, %799 : i64
%801 = llvm.mlir.addressof @NS : !llvm.ptr
%802 = llvm.load %801 : !llvm.ptr -> i64
%803 = arith.muli %516, %802 : i64
%804 = arith.addi %803, %763 : i64
%805 = llvm.getelementptr %238[%804] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %800, %805 : i64, !llvm.ptr
cf.br ^bb149
^bb148:
cf.br ^bb149
^bb149:
cf.br ^bb146
^bb145:
cf.br ^bb146
^bb146:
%806 = llvm.load %732 : !llvm.ptr -> i64
%807 = arith.constant 1 : i32
%809 = arith.extsi %807 : i32 to i64
%808 = arith.addi %806, %809 : i64
llvm.store %808, %732 : i64, !llvm.ptr
cf.br ^bb135
^bb137:
%810 = llvm.load %724 : !llvm.ptr -> i64
%811 = arith.constant 1 : i32
%813 = arith.extsi %811 : i32 to i64
%812 = arith.addi %810, %813 : i64
llvm.store %812, %724 : i64, !llvm.ptr
cf.br ^bb132
^bb134:
cf.br ^bb131
^bb130:
cf.br ^bb131
^bb131:
%814 = llvm.load %141 : !llvm.ptr -> i64
%815 = arith.constant 0 : i32
%817 = arith.extsi %815 : i32 to i64
%816 = arith.cmpi eq, %814, %817 : i64
%818 = scf.if %816 -> (i1) {
%819 = llvm.load %495 : !llvm.ptr -> i64
%820 = arith.constant 0 : i32
%822 = arith.extsi %820 : i32 to i64
%821 = arith.cmpi eq, %819, %822 : i64
scf.yield %821 : i1
} else {
%823 = arith.constant false
scf.yield %823 : i1
}
cf.cond_br %818, ^bb150, ^bb151
^bb150:
%824 = arith.constant 0 : i32
%825 = arith.extsi %824 : i32 to i64
%826 = llvm.mlir.constant(1 : i64) : i64
%827 = llvm.alloca %826 x i64 : (i64) -> !llvm.ptr
llvm.store %825, %827 : i64, !llvm.ptr
cf.br ^bb153
^bb153:
%828 = llvm.load %827 : !llvm.ptr -> i64
%829 = arith.constant 3 : i32
%831 = arith.extsi %829 : i32 to i64
%830 = arith.cmpi slt, %828, %831 : i64
cf.cond_br %830, ^bb154, ^bb155
^bb154:
%832 = arith.constant 0 : i32
%833 = arith.extsi %832 : i32 to i64
%834 = llvm.mlir.constant(1 : i64) : i64
%835 = llvm.alloca %834 x i64 : (i64) -> !llvm.ptr
llvm.store %833, %835 : i64, !llvm.ptr
%836 = llvm.load %827 : !llvm.ptr -> i64
%837 = arith.constant 2 : i32
%839 = arith.extsi %837 : i32 to i64
%838 = arith.cmpi slt, %836, %839 : i64
cf.cond_br %838, ^bb156, ^bb157
^bb156:
%840 = llvm.load %827 : !llvm.ptr -> i64
%841 = llvm.load %503 : !llvm.ptr -> i64
%842 = arith.cmpi ne, %840, %841 : i64
%843 = scf.if %842 -> (i1) {
%844 = llvm.load %827 : !llvm.ptr -> i64
%845 = llvm.load %511 : !llvm.ptr -> i64
%846 = arith.cmpi ne, %844, %845 : i64
scf.yield %846 : i1
} else {
%847 = arith.constant false
scf.yield %847 : i1
}
cf.cond_br %843, ^bb159, ^bb160
^bb159:
%848 = arith.constant 1 : i32
%849 = arith.extsi %848 : i32 to i64
llvm.store %849, %835 : i64, !llvm.ptr
cf.br ^bb161
^bb160:
cf.br ^bb161
^bb161:
cf.br ^bb158
^bb157:
%851 = arith.constant 2 : i32
%852 = llvm.load %540 : !llvm.ptr -> i64
%853 = arith.extsi %851 : i32 to i64
%850 = func.call @fresh_cnt(%853, %852) : (i64, i64) -> i64
llvm.store %850, %835 : i64, !llvm.ptr
cf.br ^bb158
^bb158:
%854 = llvm.load %835 : !llvm.ptr -> i64
%855 = arith.constant 0 : i32
%857 = arith.extsi %855 : i32 to i64
%856 = arith.cmpi sgt, %854, %857 : i64
cf.cond_br %856, ^bb162, ^bb163
^bb162:
%859 = llvm.mlir.addressof @NS : !llvm.ptr
%860 = llvm.load %859 : !llvm.ptr -> i64
%861 = arith.muli %516, %860 : i64
%862 = llvm.load %827 : !llvm.ptr -> i64
%863 = arith.addi %861, %862 : i64
%864 = llvm.getelementptr %238[%863] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%858 = llvm.load %864 : !llvm.ptr -> i64
%865 = llvm.load %835 : !llvm.ptr -> i64
%866 = arith.addi %858, %865 : i64
%867 = llvm.mlir.addressof @MOD : !llvm.ptr
%868 = llvm.load %867 : !llvm.ptr -> i64
%869 = arith.remsi %866, %868 : i64
%870 = llvm.mlir.addressof @NS : !llvm.ptr
%871 = llvm.load %870 : !llvm.ptr -> i64
%872 = arith.muli %516, %871 : i64
%873 = llvm.load %827 : !llvm.ptr -> i64
%874 = arith.addi %872, %873 : i64
%875 = llvm.getelementptr %238[%874] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %869, %875 : i64, !llvm.ptr
cf.br ^bb164
^bb163:
cf.br ^bb164
^bb164:
%876 = llvm.load %827 : !llvm.ptr -> i64
%877 = arith.constant 1 : i32
%879 = arith.extsi %877 : i32 to i64
%878 = arith.addi %876, %879 : i64
llvm.store %878, %827 : i64, !llvm.ptr
cf.br ^bb153
^bb155:
cf.br ^bb152
^bb151:
cf.br ^bb152
^bb152:
cf.br ^bb98
^bb97:
cf.br ^bb98
^bb98:
%880 = llvm.load %511 : !llvm.ptr -> i64
%881 = arith.constant 1 : i32
%883 = arith.extsi %881 : i32 to i64
%882 = arith.addi %880, %883 : i64
llvm.store %882, %511 : i64, !llvm.ptr
cf.br ^bb93
^bb95:
%884 = llvm.load %503 : !llvm.ptr -> i64
%885 = arith.constant 1 : i32
%887 = arith.extsi %885 : i32 to i64
%886 = arith.addi %884, %887 : i64
llvm.store %886, %503 : i64, !llvm.ptr
cf.br ^bb90
^bb92:
%888 = llvm.load %495 : !llvm.ptr -> i64
%889 = arith.constant 1 : i32
%891 = arith.extsi %889 : i32 to i64
%890 = arith.addi %888, %891 : i64
llvm.store %890, %495 : i64, !llvm.ptr
cf.br ^bb87
^bb89:
%892 = llvm.load %141 : !llvm.ptr -> i64
%893 = arith.constant 1 : i32
%895 = arith.extsi %893 : i32 to i64
%894 = arith.addi %892, %895 : i64
llvm.store %894, %141 : i64, !llvm.ptr
cf.br ^bb84
^bb86:
%897 = llvm.mlir.addressof @NS : !llvm.ptr
%898 = llvm.load %897 : !llvm.ptr -> i64
%899 = llvm.mlir.addressof @NS : !llvm.ptr
%900 = llvm.load %899 : !llvm.ptr -> i64
%901 = arith.muli %898, %900 : i64
%902 = arith.constant 8 : i32
%903 = arith.extsi %902 : i32 to i64
%896 = func.call @calloc(%901, %903) : (i64, i64) -> !llvm.ptr
%905 = llvm.mlir.addressof @NS : !llvm.ptr
%906 = llvm.load %905 : !llvm.ptr -> i64
%907 = llvm.mlir.addressof @NS : !llvm.ptr
%908 = llvm.load %907 : !llvm.ptr -> i64
%909 = arith.muli %906, %908 : i64
%910 = arith.constant 8 : i32
%911 = arith.extsi %910 : i32 to i64
%904 = func.call @calloc(%909, %911) : (i64, i64) -> !llvm.ptr
%913 = llvm.mlir.addressof @NS : !llvm.ptr
%914 = llvm.load %913 : !llvm.ptr -> i64
%915 = llvm.mlir.addressof @NS : !llvm.ptr
%916 = llvm.load %915 : !llvm.ptr -> i64
%917 = arith.muli %914, %916 : i64
%918 = arith.constant 8 : i32
%919 = arith.extsi %918 : i32 to i64
%912 = func.call @calloc(%917, %919) : (i64, i64) -> !llvm.ptr
%920 = llvm.mlir.addressof @K : !llvm.ptr
%921 = llvm.load %920 : !llvm.ptr -> i64
%922 = llvm.mlir.addressof @MOD : !llvm.ptr
%923 = llvm.load %922 : !llvm.ptr -> i64
%924 = arith.remsi %921, %923 : i64
%926 = arith.constant 0 : i32
%927 = llvm.mlir.addressof @NS : !llvm.ptr
%928 = llvm.load %927 : !llvm.ptr -> i64
%930 = arith.extsi %926 : i32 to i64
%929 = arith.muli %930, %928 : i64
%931 = arith.constant 0 : i32
%933 = arith.extsi %931 : i32 to i64
%932 = arith.addi %929, %933 : i64
%934 = llvm.getelementptr %238[%932] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%925 = llvm.load %934 : !llvm.ptr -> i64
%935 = arith.muli %924, %925 : i64
%936 = llvm.mlir.addressof @MOD : !llvm.ptr
%937 = llvm.load %936 : !llvm.ptr -> i64
%938 = arith.remsi %935, %937 : i64
%939 = llvm.mlir.constant(1 : i64) : i64
%940 = llvm.alloca %939 x i64 : (i64) -> !llvm.ptr
llvm.store %938, %940 : i64, !llvm.ptr
%941 = arith.constant 0 : i32
%942 = arith.extsi %941 : i32 to i64
llvm.store %942, %141 : i64, !llvm.ptr
cf.br ^bb165
^bb165:
%943 = llvm.load %141 : !llvm.ptr -> i64
%944 = arith.constant 3 : i32
%946 = arith.extsi %944 : i32 to i64
%945 = arith.cmpi slt, %943, %946 : i64
cf.cond_br %945, ^bb166, ^bb167
^bb166:
%947 = arith.constant 0 : i32
%948 = arith.extsi %947 : i32 to i64
%949 = llvm.mlir.constant(1 : i64) : i64
%950 = llvm.alloca %949 x i64 : (i64) -> !llvm.ptr
llvm.store %948, %950 : i64, !llvm.ptr
cf.br ^bb168
^bb168:
%951 = llvm.load %950 : !llvm.ptr -> i64
%952 = arith.constant 3 : i32
%954 = arith.extsi %952 : i32 to i64
%953 = arith.cmpi slt, %951, %954 : i64
cf.cond_br %953, ^bb169, ^bb170
^bb169:
%956 = llvm.load %141 : !llvm.ptr -> i64
%957 = arith.constant 3 : i32
%959 = arith.extsi %957 : i32 to i64
%958 = arith.muli %956, %959 : i64
%960 = llvm.load %950 : !llvm.ptr -> i64
%961 = arith.addi %958, %960 : i64
%962 = arith.constant 9 : i32
%964 = arith.extsi %962 : i32 to i64
%963 = arith.muli %961, %964 : i64
%965 = arith.constant 0 : i32
%966 = arith.constant 3 : i32
%967 = arith.muli %965, %966 : i32
%969 = arith.extsi %967 : i32 to i64
%968 = arith.addi %963, %969 : i64
%970 = arith.constant 1 : i32
%972 = arith.extsi %970 : i32 to i64
%971 = arith.addi %968, %972 : i64
%973 = llvm.getelementptr %129[%971] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%955 = llvm.load %973 : !llvm.ptr -> i64
%974 = llvm.load %940 : !llvm.ptr -> i64
%975 = llvm.mlir.addressof @K : !llvm.ptr
%976 = llvm.load %975 : !llvm.ptr -> i64
%977 = llvm.mlir.addressof @K : !llvm.ptr
%978 = llvm.load %977 : !llvm.ptr -> i64
%979 = arith.constant 1 : i32
%981 = arith.extsi %979 : i32 to i64
%980 = arith.subi %978, %981 : i64
%982 = arith.muli %976, %980 : i64
%983 = llvm.mlir.addressof @MOD : !llvm.ptr
%984 = llvm.load %983 : !llvm.ptr -> i64
%985 = arith.remsi %982, %984 : i64
%987 = llvm.mlir.addressof @NS : !llvm.ptr
%988 = llvm.load %987 : !llvm.ptr -> i64
%989 = arith.muli %955, %988 : i64
%990 = arith.addi %989, %955 : i64
%991 = llvm.getelementptr %238[%990] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%986 = llvm.load %991 : !llvm.ptr -> i64
%992 = arith.muli %985, %986 : i64
%993 = arith.addi %974, %992 : i64
%994 = llvm.mlir.addressof @MOD : !llvm.ptr
%995 = llvm.load %994 : !llvm.ptr -> i64
%996 = arith.remsi %993, %995 : i64
llvm.store %996, %940 : i64, !llvm.ptr
%997 = llvm.load %950 : !llvm.ptr -> i64
%998 = arith.constant 1 : i32
%1000 = arith.extsi %998 : i32 to i64
%999 = arith.addi %997, %1000 : i64
llvm.store %999, %950 : i64, !llvm.ptr
cf.br ^bb168
^bb170:
%1001 = llvm.load %141 : !llvm.ptr -> i64
%1002 = arith.constant 1 : i32
%1004 = arith.extsi %1002 : i32 to i64
%1003 = arith.addi %1001, %1004 : i64
llvm.store %1003, %141 : i64, !llvm.ptr
cf.br ^bb165
^bb167:
%1005 = arith.constant 0 : i32
%1006 = arith.extsi %1005 : i32 to i64
%1007 = llvm.mlir.constant(1 : i64) : i64
%1008 = llvm.alloca %1007 x i64 : (i64) -> !llvm.ptr
llvm.store %1006, %1008 : i64, !llvm.ptr
cf.br ^bb171
^bb171:
%1009 = llvm.load %1008 : !llvm.ptr -> i64
%1010 = llvm.mlir.addressof @NS : !llvm.ptr
%1011 = llvm.load %1010 : !llvm.ptr -> i64
%1012 = llvm.mlir.addressof @NS : !llvm.ptr
%1013 = llvm.load %1012 : !llvm.ptr -> i64
%1014 = arith.muli %1011, %1013 : i64
%1015 = arith.cmpi slt, %1009, %1014 : i64
cf.cond_br %1015, ^bb172, ^bb173
^bb172:
%1016 = arith.constant 0 : i32
%1017 = llvm.load %1008 : !llvm.ptr -> i64
%1018 = arith.extsi %1016 : i32 to i64
%1019 = llvm.getelementptr %896[%1017] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1018, %1019 : i64, !llvm.ptr
%1021 = llvm.load %1008 : !llvm.ptr -> i64
%1022 = llvm.getelementptr %238[%1021] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1020 = llvm.load %1022 : !llvm.ptr -> i64
%1023 = llvm.load %1008 : !llvm.ptr -> i64
%1024 = llvm.getelementptr %904[%1023] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1020, %1024 : i64, !llvm.ptr
%1025 = llvm.load %1008 : !llvm.ptr -> i64
%1026 = arith.constant 1 : i32
%1028 = arith.extsi %1026 : i32 to i64
%1027 = arith.addi %1025, %1028 : i64
llvm.store %1027, %1008 : i64, !llvm.ptr
cf.br ^bb171
^bb173:
%1029 = arith.constant 0 : i32
%1030 = arith.extsi %1029 : i32 to i64
llvm.store %1030, %1008 : i64, !llvm.ptr
cf.br ^bb174
^bb174:
%1031 = llvm.load %1008 : !llvm.ptr -> i64
%1032 = llvm.mlir.addressof @NS : !llvm.ptr
%1033 = llvm.load %1032 : !llvm.ptr -> i64
%1034 = arith.cmpi slt, %1031, %1033 : i64
cf.cond_br %1034, ^bb175, ^bb176
^bb175:
%1035 = arith.constant 1 : i32
%1036 = llvm.load %1008 : !llvm.ptr -> i64
%1037 = llvm.mlir.addressof @NS : !llvm.ptr
%1038 = llvm.load %1037 : !llvm.ptr -> i64
%1039 = arith.muli %1036, %1038 : i64
%1040 = llvm.load %1008 : !llvm.ptr -> i64
%1041 = arith.addi %1039, %1040 : i64
%1042 = arith.extsi %1035 : i32 to i64
%1043 = llvm.getelementptr %896[%1041] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1042, %1043 : i64, !llvm.ptr
%1044 = llvm.load %1008 : !llvm.ptr -> i64
%1045 = arith.constant 1 : i32
%1047 = arith.extsi %1045 : i32 to i64
%1046 = arith.addi %1044, %1047 : i64
llvm.store %1046, %1008 : i64, !llvm.ptr
cf.br ^bb174
^bb176:
%1048 = llvm.mlir.addressof @N : !llvm.ptr
%1049 = llvm.load %1048 : !llvm.ptr -> i64
%1050 = llvm.mlir.constant(1 : i64) : i64
%1051 = llvm.alloca %1050 x i64 : (i64) -> !llvm.ptr
llvm.store %1049, %1051 : i64, !llvm.ptr
cf.br ^bb177
^bb177:
%1052 = llvm.load %1051 : !llvm.ptr -> i64
%1053 = arith.constant 0 : i32
%1055 = arith.extsi %1053 : i32 to i64
%1054 = arith.cmpi sgt, %1052, %1055 : i64
cf.cond_br %1054, ^bb178, ^bb179
^bb178:
%1056 = llvm.load %1051 : !llvm.ptr -> i64
%1057 = arith.constant 1 : i32
%1059 = arith.extsi %1057 : i32 to i64
%1058 = arith.andi %1056, %1059 : i64
%1060 = arith.constant 1 : i32
%1062 = arith.extsi %1060 : i32 to i64
%1061 = arith.cmpi eq, %1058, %1062 : i64
cf.cond_br %1061, ^bb180, ^bb181
^bb180:
func.call @matmul(%896, %904, %912) : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
%1064 = arith.constant 0 : i32
%1065 = arith.extsi %1064 : i32 to i64
llvm.store %1065, %1008 : i64, !llvm.ptr
cf.br ^bb183
^bb183:
%1066 = llvm.load %1008 : !llvm.ptr -> i64
%1067 = llvm.mlir.addressof @NS : !llvm.ptr
%1068 = llvm.load %1067 : !llvm.ptr -> i64
%1069 = llvm.mlir.addressof @NS : !llvm.ptr
%1070 = llvm.load %1069 : !llvm.ptr -> i64
%1071 = arith.muli %1068, %1070 : i64
%1072 = arith.cmpi slt, %1066, %1071 : i64
cf.cond_br %1072, ^bb184, ^bb185
^bb184:
%1074 = llvm.load %1008 : !llvm.ptr -> i64
%1075 = llvm.getelementptr %912[%1074] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1073 = llvm.load %1075 : !llvm.ptr -> i64
%1076 = llvm.load %1008 : !llvm.ptr -> i64
%1077 = llvm.getelementptr %896[%1076] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1073, %1077 : i64, !llvm.ptr
%1078 = llvm.load %1008 : !llvm.ptr -> i64
%1079 = arith.constant 1 : i32
%1081 = arith.extsi %1079 : i32 to i64
%1080 = arith.addi %1078, %1081 : i64
llvm.store %1080, %1008 : i64, !llvm.ptr
cf.br ^bb183
^bb185:
cf.br ^bb182
^bb181:
cf.br ^bb182
^bb182:
%1082 = llvm.load %1051 : !llvm.ptr -> i64
%1083 = arith.constant 1 : i32
%1085 = arith.extsi %1083 : i32 to i64
%1084 = arith.shrsi %1082, %1085 : i64
llvm.store %1084, %1051 : i64, !llvm.ptr
%1086 = llvm.load %1051 : !llvm.ptr -> i64
%1087 = arith.constant 0 : i32
%1089 = arith.extsi %1087 : i32 to i64
%1088 = arith.cmpi sgt, %1086, %1089 : i64
cf.cond_br %1088, ^bb186, ^bb187
^bb186:
func.call @matmul(%904, %904, %912) : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
%1091 = arith.constant 0 : i32
%1092 = arith.extsi %1091 : i32 to i64
llvm.store %1092, %1008 : i64, !llvm.ptr
cf.br ^bb189
^bb189:
%1093 = llvm.load %1008 : !llvm.ptr -> i64
%1094 = llvm.mlir.addressof @NS : !llvm.ptr
%1095 = llvm.load %1094 : !llvm.ptr -> i64
%1096 = llvm.mlir.addressof @NS : !llvm.ptr
%1097 = llvm.load %1096 : !llvm.ptr -> i64
%1098 = arith.muli %1095, %1097 : i64
%1099 = arith.cmpi slt, %1093, %1098 : i64
cf.cond_br %1099, ^bb190, ^bb191
^bb190:
%1101 = llvm.load %1008 : !llvm.ptr -> i64
%1102 = llvm.getelementptr %912[%1101] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1100 = llvm.load %1102 : !llvm.ptr -> i64
%1103 = llvm.load %1008 : !llvm.ptr -> i64
%1104 = llvm.getelementptr %904[%1103] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1100, %1104 : i64, !llvm.ptr
%1105 = llvm.load %1008 : !llvm.ptr -> i64
%1106 = arith.constant 1 : i32
%1108 = arith.extsi %1106 : i32 to i64
%1107 = arith.addi %1105, %1108 : i64
llvm.store %1107, %1008 : i64, !llvm.ptr
cf.br ^bb189
^bb191:
cf.br ^bb188
^bb187:
cf.br ^bb188
^bb188:
cf.br ^bb177
^bb179:
%1109 = llvm.mlir.addressof @K : !llvm.ptr
%1110 = llvm.load %1109 : !llvm.ptr -> i64
%1111 = llvm.mlir.addressof @MOD : !llvm.ptr
%1112 = llvm.load %1111 : !llvm.ptr -> i64
%1113 = arith.remsi %1110, %1112 : i64
%1115 = arith.constant 0 : i32
%1116 = llvm.mlir.addressof @NS : !llvm.ptr
%1117 = llvm.load %1116 : !llvm.ptr -> i64
%1119 = arith.extsi %1115 : i32 to i64
%1118 = arith.muli %1119, %1117 : i64
%1120 = arith.constant 0 : i32
%1122 = arith.extsi %1120 : i32 to i64
%1121 = arith.addi %1118, %1122 : i64
%1123 = llvm.getelementptr %896[%1121] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1114 = llvm.load %1123 : !llvm.ptr -> i64
%1124 = arith.muli %1113, %1114 : i64
%1125 = llvm.mlir.addressof @MOD : !llvm.ptr
%1126 = llvm.load %1125 : !llvm.ptr -> i64
%1127 = arith.remsi %1124, %1126 : i64
%1128 = llvm.mlir.constant(1 : i64) : i64
%1129 = llvm.alloca %1128 x i64 : (i64) -> !llvm.ptr
llvm.store %1127, %1129 : i64, !llvm.ptr
%1130 = arith.constant 0 : i32
%1131 = arith.extsi %1130 : i32 to i64
llvm.store %1131, %141 : i64, !llvm.ptr
cf.br ^bb192
^bb192:
%1132 = llvm.load %141 : !llvm.ptr -> i64
%1133 = arith.constant 3 : i32
%1135 = arith.extsi %1133 : i32 to i64
%1134 = arith.cmpi slt, %1132, %1135 : i64
cf.cond_br %1134, ^bb193, ^bb194
^bb193:
%1136 = arith.constant 0 : i32
%1137 = arith.extsi %1136 : i32 to i64
%1138 = llvm.mlir.constant(1 : i64) : i64
%1139 = llvm.alloca %1138 x i64 : (i64) -> !llvm.ptr
llvm.store %1137, %1139 : i64, !llvm.ptr
cf.br ^bb195
^bb195:
%1140 = llvm.load %1139 : !llvm.ptr -> i64
%1141 = arith.constant 3 : i32
%1143 = arith.extsi %1141 : i32 to i64
%1142 = arith.cmpi slt, %1140, %1143 : i64
cf.cond_br %1142, ^bb196, ^bb197
^bb196:
%1145 = llvm.load %141 : !llvm.ptr -> i64
%1146 = arith.constant 3 : i32
%1148 = arith.extsi %1146 : i32 to i64
%1147 = arith.muli %1145, %1148 : i64
%1149 = llvm.load %1139 : !llvm.ptr -> i64
%1150 = arith.addi %1147, %1149 : i64
%1151 = arith.constant 9 : i32
%1153 = arith.extsi %1151 : i32 to i64
%1152 = arith.muli %1150, %1153 : i64
%1154 = arith.constant 0 : i32
%1155 = arith.constant 3 : i32
%1156 = arith.muli %1154, %1155 : i32
%1158 = arith.extsi %1156 : i32 to i64
%1157 = arith.addi %1152, %1158 : i64
%1159 = arith.constant 1 : i32
%1161 = arith.extsi %1159 : i32 to i64
%1160 = arith.addi %1157, %1161 : i64
%1162 = llvm.getelementptr %129[%1160] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1144 = llvm.load %1162 : !llvm.ptr -> i64
%1163 = llvm.load %1129 : !llvm.ptr -> i64
%1164 = llvm.mlir.addressof @K : !llvm.ptr
%1165 = llvm.load %1164 : !llvm.ptr -> i64
%1166 = llvm.mlir.addressof @K : !llvm.ptr
%1167 = llvm.load %1166 : !llvm.ptr -> i64
%1168 = arith.constant 1 : i32
%1170 = arith.extsi %1168 : i32 to i64
%1169 = arith.subi %1167, %1170 : i64
%1171 = arith.muli %1165, %1169 : i64
%1172 = llvm.mlir.addressof @MOD : !llvm.ptr
%1173 = llvm.load %1172 : !llvm.ptr -> i64
%1174 = arith.remsi %1171, %1173 : i64
%1176 = llvm.mlir.addressof @NS : !llvm.ptr
%1177 = llvm.load %1176 : !llvm.ptr -> i64
%1178 = arith.muli %1144, %1177 : i64
%1179 = arith.addi %1178, %1144 : i64
%1180 = llvm.getelementptr %896[%1179] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1175 = llvm.load %1180 : !llvm.ptr -> i64
%1181 = arith.muli %1174, %1175 : i64
%1182 = arith.addi %1163, %1181 : i64
%1183 = llvm.mlir.addressof @MOD : !llvm.ptr
%1184 = llvm.load %1183 : !llvm.ptr -> i64
%1185 = arith.remsi %1182, %1184 : i64
llvm.store %1185, %1129 : i64, !llvm.ptr
%1186 = llvm.load %1139 : !llvm.ptr -> i64
%1187 = arith.constant 1 : i32
%1189 = arith.extsi %1187 : i32 to i64
%1188 = arith.addi %1186, %1189 : i64
llvm.store %1188, %1139 : i64, !llvm.ptr
cf.br ^bb195
^bb197:
%1190 = llvm.load %141 : !llvm.ptr -> i64
%1191 = arith.constant 1 : i32
%1193 = arith.extsi %1191 : i32 to i64
%1192 = arith.addi %1190, %1193 : i64
llvm.store %1192, %141 : i64, !llvm.ptr
cf.br ^bb192
^bb194:
%1194 = llvm.mlir.addressof @N : !llvm.ptr
%1195 = llvm.load %1194 : !llvm.ptr -> i64
%1196 = llvm.mlir.addressof @MOD : !llvm.ptr
%1197 = llvm.load %1196 : !llvm.ptr -> i64
%1198 = arith.remsi %1195, %1197 : i64
%1199 = llvm.mlir.addressof @N : !llvm.ptr
%1200 = llvm.load %1199 : !llvm.ptr -> i64
%1201 = arith.constant 1 : i32
%1203 = arith.extsi %1201 : i32 to i64
%1202 = arith.subi %1200, %1203 : i64
%1204 = llvm.mlir.addressof @MOD : !llvm.ptr
%1205 = llvm.load %1204 : !llvm.ptr -> i64
%1206 = arith.remsi %1202, %1205 : i64
%1207 = llvm.load %1129 : !llvm.ptr -> i64
%1208 = llvm.load %940 : !llvm.ptr -> i64
%1209 = arith.muli %1206, %1208 : i64
%1210 = arith.addi %1207, %1209 : i64
%1211 = llvm.mlir.addressof @MOD : !llvm.ptr
%1212 = llvm.load %1211 : !llvm.ptr -> i64
%1213 = arith.remsi %1210, %1212 : i64
%1214 = func.call @inv_mod(%1198) : (i64) -> i64
%1215 = arith.muli %1213, %1214 : i64
%1216 = llvm.mlir.addressof @MOD : !llvm.ptr
%1217 = llvm.load %1216 : !llvm.ptr -> i64
%1218 = arith.remsi %1215, %1217 : i64
%1219 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1220 = llvm.call @printf(%1219, %1218) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%129) : (!llvm.ptr) -> ()
func.call @free(%238) : (!llvm.ptr) -> ()
func.call @free(%896) : (!llvm.ptr) -> ()
func.call @free(%904) : (!llvm.ptr) -> ()
func.call @free(%912) : (!llvm.ptr) -> ()
%1226 = arith.constant 0 : i32
func.return %1226 : i32
}
}