Problem 763
Amoebas in a 3D Grid: D(10000) mod 1e9 via boundary recurrence.
View problem on Project Euler
Performance comparison
| Metric | Our solution | Best known |
| Time complexity | O(n^2) | ? |
| Space complexity | O(n^2) | ? |
| Approach | Flow solution | Not curated |
| Verdict | Unknown |
Flow source
# Project Euler 763
# Amoebas in a 3D Grid: D(10000) mod 1e9 via boundary recurrence.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function malloc(n: i64) -> ptr<void>
}
const MOD: i64 = 1000000000
const M_VAL: i64 = 9999
function main() -> i32 {
let mut n_tmp: i64 = 0
while (n_tmp + 1) * (n_tmp + 2) / 2 <= M_VAL { n_tmp = n_tmp + 1 }
let max_n: i64 = n_tmp - 1
let N: i64 = max_n + 3
let NMAX: i64 = N + 2
let offset_arr: ptr<i64> = calloc(NMAX, 8) as ptr<i64>
let lens_arr: ptr<i64> = calloc(NMAX, 8) as ptr<i64>
for n in 0..NMAX {
offset_arr[n] = (n + 1) * (n + 2) / 2
let ln: i64 = M_VAL - offset_arr[n] + 1
lens_arr[n] = if ln > 0 { ln } else { 0 }
}
let u: ptr<ptr<i32> > = calloc(NMAX, 8) as ptr<ptr<i32> >
let v: ptr<ptr<i32> > = calloc(NMAX, 8) as ptr<ptr<i32> >
for n in 1..NMAX {
let ln: i64 = lens_arr[n]
if ln > 0 {
u[n] = calloc(n * ln, 4) as ptr<i32>
v[n] = calloc(n * ln, 4) as ptr<i32>
}
}
let f0: ptr<i32> = calloc(M_VAL + 1, 4) as ptr<i32>
let a2: ptr<i32> = calloc(M_VAL + 1, 4) as ptr<i32>
a2[0] = 1
let mut n_active: i64 = 0
let mut m: i64 = 0
while m <= M_VAL {
while n_active + 1 < N + 1 && offset_arr[n_active + 1] <= m {
n_active = n_active + 1
}
for n in 1..(n_active + 1) {
let off: i64 = offset_arr[n]
let ln: i64 = lens_arr[n]
let idx_cur: i64 = m - off
let mp1: i64 = m - n - 2
let idx1: i64 = mp1 - off
let mp2: i64 = m - n - 3
let idx2: i64 = mp2 - offset_arr[n + 1]
let lnp: i64 = lens_arr[n + 1]
let mp3: i64 = m - n - 1
let idx3: i64 = mp3 - offset_arr[n - 1]
let lnm: i64 = lens_arr[n - 1]
if n == 1 {
let mut val_u: i64 = 0
if idx1 >= 0 {
val_u = val_u + 2 * (u[1][idx1] as i64) + (v[1][idx1] as i64)
}
if idx2 >= 0 && lnp > 0 {
val_u = val_u + (v[2][idx2] as i64) + (u[2][lnp + idx2] as i64)
}
if mp3 >= 0 {
val_u = val_u + (f0[mp3] as i64)
}
u[1][idx_cur] = (val_u % MOD) as i32
let mut val_v: i64 = 0
if idx1 >= 0 {
val_v = val_v + 2 * (v[1][idx1] as i64) + 2 * (u[1][idx1] as i64)
}
if idx2 >= 0 && lnp > 0 {
val_v = val_v + (v[2][lnp + idx2] as i64) + 2 * (u[2][idx2] as i64)
}
if mp3 >= 0 {
val_v = val_v + (f0[mp3] as i64)
}
v[1][idx_cur] = (val_v % MOD) as i32
} else {
let u_n: ptr<i32> = u[n]
let v_n: ptr<i32> = v[n]
let u_p: ptr<i32> = u[n + 1]
let v_p: ptr<i32> = v[n + 1]
let u_m: ptr<i32> = u[n - 1]
let v_m: ptr<i32> = v[n - 1]
let u_n1: i64 = if idx1 >= 0 { u_n[idx1] as i64 } else { 0 }
let v_n1: i64 = if idx1 >= 0 { v_n[idx1] as i64 } else { 0 }
let u_p1: i64 = if idx2 >= 0 && lnp > 0 { u_p[idx2] as i64 } else { 0 }
let v_p1: i64 = if idx2 >= 0 && lnp > 0 { v_p[idx2] as i64 } else { 0 }
let mut base: i64 = 0
let mut base_next: i64 = ln
let mut base_p: i64 = lnp
let mut base_m: i64 = 0
if idx1 < 0 {
for k in 1..n {
u_n[base + idx_cur] = u_m[base_m + idx3]
v_n[base + idx_cur] = v_m[base_m + idx3]
base = base_next
base_next = base_next + ln
base_m = base_m + lnm
}
u_n[(n - 1) * ln + idx_cur] = u_m[(n - 2) * lnm + idx3]
v_n[(n - 1) * ln + idx_cur] = v_m[(n - 2) * lnm + idx3]
} else {
if idx2 >= 0 && lnp > 0 {
for k in 1..n {
let uu: i64 = (u_n[base + idx1] as i64)
+ v_p1
+ (u_p[base_p + idx2] as i64)
+ (u_m[base_m + idx3] as i64)
+ v_n1
+ (u_n[base_next + idx1] as i64)
u_n[base + idx_cur] = (uu % MOD) as i32
let vv: i64 = (v_n[base + idx1] as i64)
+ (v_p[base_p + idx2] as i64)
+ u_p1
+ (v_m[base_m + idx3] as i64)
+ (v_n[base_next + idx1] as i64)
+ u_n1
v_n[base + idx_cur] = (vv % MOD) as i32
base = base_next
base_next = base_next + ln
base_p = base_p + lnp
base_m = base_m + lnm
}
let bl: i64 = (n - 1) * ln
let uu2: i64 = 2 * (u_n[bl + idx1] as i64)
+ v_n1
+ v_p1
+ (u_p[base_p + idx2] as i64)
+ (u_m[(n - 2) * lnm + idx3] as i64)
u_n[bl + idx_cur] = (uu2 % MOD) as i32
let vv2: i64 = 2 * (v_n[bl + idx1] as i64)
+ 2 * u_n1
+ (v_p[base_p + idx2] as i64)
+ 2 * u_p1
+ (v_m[(n - 2) * lnm + idx3] as i64)
v_n[bl + idx_cur] = (vv2 % MOD) as i32
} else {
for k in 1..n {
let uu: i64 = (u_n[base + idx1] as i64)
+ (u_m[base_m + idx3] as i64)
+ v_n1
+ (u_n[base_next + idx1] as i64)
u_n[base + idx_cur] = (uu % MOD) as i32
let vv: i64 = (v_n[base + idx1] as i64)
+ (v_m[base_m + idx3] as i64)
+ (v_n[base_next + idx1] as i64)
+ u_n1
v_n[base + idx_cur] = (vv % MOD) as i32
base = base_next
base_next = base_next + ln
base_m = base_m + lnm
}
let bl: i64 = (n - 1) * ln
let uu2: i64 = 2 * (u_n[bl + idx1] as i64)
+ v_n1
+ (u_m[(n - 2) * lnm + idx3] as i64)
u_n[bl + idx_cur] = (uu2 % MOD) as i32
let vv2: i64 = 2 * (v_n[bl + idx1] as i64)
+ 2 * u_n1
+ (v_m[(n - 2) * lnm + idx3] as i64)
v_n[bl + idx_cur] = (vv2 % MOD) as i32
}
}
}
}
let mut val_f: i64 = 0
if m - 1 >= 0 { val_f = val_f + (a2[m - 1] as i64) }
if m - 2 >= 0 { val_f = val_f + 4 * (f0[m - 2] as i64) }
let mp: i64 = m - 3
if mp >= offset_arr[1] && lens_arr[1] > 0 {
let id1: i64 = mp - offset_arr[1]
val_f = val_f + 2 * (u[1][id1] as i64) + (v[1][id1] as i64)
}
f0[m] = (val_f % MOD) as i32
if m >= 1 {
let mut val_a: i64 = 3 * (a2[m - 1] as i64)
if m - 2 >= 0 { val_a = val_a + 3 * (f0[m - 2] as i64) }
a2[m] = (val_a % MOD) as i32
}
m = m + 1
}
let ans: i64 = a2[M_VAL] as i64
for n in 1..NMAX {
free(u[n])
free(v[n])
}
free(u)
free(v)
free(f0)
free(a2)
free(offset_arr)
free(lens_arr)
printf("%lld\n", ans)
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; }
int32_t main(void);
static const int64_t MOD = 1000000000;
static const int64_t M_VAL = 9999;
int32_t main(void) {
int64_t n_tmp = 0;
while (FLOW_CHECKED_DIV((((n_tmp + 1) * (n_tmp + 2))), (2)) <= M_VAL) {
n_tmp = (n_tmp + 1);
}
int64_t max_n = (n_tmp - 1);
int64_t N = (max_n + 3);
int64_t NMAX = (N + 2);
int64_t* offset_arr = (int64_t*)(((int64_t*)(calloc(NMAX, 8))));
int64_t* lens_arr = (int64_t*)(((int64_t*)(calloc(NMAX, 8))));
int32_t __flow_step_1 = 1;
for (int32_t n = 0; (0 <= NMAX) ? n < NMAX : n > NMAX; n += (0 <= NMAX) ? 1 : -1) {
offset_arr[n] = FLOW_CHECKED_DIV((((n + 1) * (n + 2))), (2));
int64_t ln = ((M_VAL - offset_arr[n]) + 1);
lens_arr[n] = ((ln > 0) ? (ln) : (0));
}
int32_t** u = (int32_t**)(((int32_t**)(calloc(NMAX, 8))));
int32_t** v = (int32_t**)(((int32_t**)(calloc(NMAX, 8))));
int32_t __flow_step_2 = 1;
for (int32_t n = 1; (1 <= NMAX) ? n < NMAX : n > NMAX; n += (1 <= NMAX) ? 1 : -1) {
int64_t ln = lens_arr[n];
if (ln > 0) {
u[n] = ((int32_t*)(calloc((n * ln), 4)));
v[n] = ((int32_t*)(calloc((n * ln), 4)));
}
}
int32_t* f0 = (int32_t*)(((int32_t*)(calloc((M_VAL + 1), 4))));
int32_t* a2 = (int32_t*)(((int32_t*)(calloc((M_VAL + 1), 4))));
a2[0] = 1;
int64_t n_active = 0;
int64_t m = 0;
while (m <= M_VAL) {
while (((n_active + 1) < (N + 1) && offset_arr[(n_active + 1)] <= m)) {
n_active = (n_active + 1);
}
int32_t __flow_step_3 = 1;
for (int32_t n = 1; (1 <= (n_active + 1)) ? n < (n_active + 1) : n > (n_active + 1); n += (1 <= (n_active + 1)) ? 1 : -1) {
int64_t off = offset_arr[n];
int64_t ln = lens_arr[n];
int64_t idx_cur = (m - off);
int64_t mp1 = ((m - n) - 2);
int64_t idx1 = (mp1 - off);
int64_t mp2 = ((m - n) - 3);
int64_t idx2 = (mp2 - offset_arr[(n + 1)]);
int64_t lnp = lens_arr[(n + 1)];
int64_t mp3 = ((m - n) - 1);
int64_t idx3 = (mp3 - offset_arr[(n - 1)]);
int64_t lnm = lens_arr[(n - 1)];
if (n == 1) {
int64_t val_u = 0;
if (idx1 >= 0) {
val_u = ((val_u + (2 * ((int64_t)(u[1][idx1])))) + ((int64_t)(v[1][idx1])));
}
if ((idx2 >= 0 && lnp > 0)) {
val_u = ((val_u + ((int64_t)(v[2][idx2]))) + ((int64_t)(u[2][(lnp + idx2)])));
}
if (mp3 >= 0) {
val_u = (val_u + ((int64_t)(f0[mp3])));
}
u[1][idx_cur] = ((int32_t)(FLOW_CHECKED_MOD((val_u), (MOD))));
int64_t val_v = 0;
if (idx1 >= 0) {
val_v = ((val_v + (2 * ((int64_t)(v[1][idx1])))) + (2 * ((int64_t)(u[1][idx1]))));
}
if ((idx2 >= 0 && lnp > 0)) {
val_v = ((val_v + ((int64_t)(v[2][(lnp + idx2)]))) + (2 * ((int64_t)(u[2][idx2]))));
}
if (mp3 >= 0) {
val_v = (val_v + ((int64_t)(f0[mp3])));
}
v[1][idx_cur] = ((int32_t)(FLOW_CHECKED_MOD((val_v), (MOD))));
} else {
int32_t* u_n = (int32_t*)(u[n]);
int32_t* v_n = (int32_t*)(v[n]);
int32_t* u_p = (int32_t*)(u[(n + 1)]);
int32_t* v_p = (int32_t*)(v[(n + 1)]);
int32_t* u_m = (int32_t*)(u[(n - 1)]);
int32_t* v_m = (int32_t*)(v[(n - 1)]);
int64_t u_n1 = ((idx1 >= 0) ? (((int64_t)(u_n[idx1]))) : (0));
int64_t v_n1 = ((idx1 >= 0) ? (((int64_t)(v_n[idx1]))) : (0));
int64_t u_p1 = (((idx2 >= 0 && lnp > 0)) ? (((int64_t)(u_p[idx2]))) : (0));
int64_t v_p1 = (((idx2 >= 0 && lnp > 0)) ? (((int64_t)(v_p[idx2]))) : (0));
int64_t base = 0;
int64_t base_next = ln;
int64_t base_p = lnp;
int64_t base_m = 0;
if (idx1 < 0) {
int32_t __flow_step_4 = 1;
for (int32_t k = 1; (1 <= n) ? k < n : k > n; k += (1 <= n) ? 1 : -1) {
u_n[(base + idx_cur)] = u_m[(base_m + idx3)];
v_n[(base + idx_cur)] = v_m[(base_m + idx3)];
base = base_next;
base_next = (base_next + ln);
base_m = (base_m + lnm);
}
u_n[(((n - 1) * ln) + idx_cur)] = u_m[(((n - 2) * lnm) + idx3)];
v_n[(((n - 1) * ln) + idx_cur)] = v_m[(((n - 2) * lnm) + idx3)];
} else {
if ((idx2 >= 0 && lnp > 0)) {
int32_t __flow_step_5 = 1;
for (int32_t k = 1; (1 <= n) ? k < n : k > n; k += (1 <= n) ? 1 : -1) {
int64_t uu = (((((((int64_t)(u_n[(base + idx1)])) + v_p1) + ((int64_t)(u_p[(base_p + idx2)]))) + ((int64_t)(u_m[(base_m + idx3)]))) + v_n1) + ((int64_t)(u_n[(base_next + idx1)])));
u_n[(base + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((uu), (MOD))));
int64_t vv = (((((((int64_t)(v_n[(base + idx1)])) + ((int64_t)(v_p[(base_p + idx2)]))) + u_p1) + ((int64_t)(v_m[(base_m + idx3)]))) + ((int64_t)(v_n[(base_next + idx1)]))) + u_n1);
v_n[(base + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((vv), (MOD))));
base = base_next;
base_next = (base_next + ln);
base_p = (base_p + lnp);
base_m = (base_m + lnm);
}
int64_t bl = ((n - 1) * ln);
int64_t uu2 = (((((2 * ((int64_t)(u_n[(bl + idx1)]))) + v_n1) + v_p1) + ((int64_t)(u_p[(base_p + idx2)]))) + ((int64_t)(u_m[(((n - 2) * lnm) + idx3)])));
u_n[(bl + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((uu2), (MOD))));
int64_t vv2 = (((((2 * ((int64_t)(v_n[(bl + idx1)]))) + (2 * u_n1)) + ((int64_t)(v_p[(base_p + idx2)]))) + (2 * u_p1)) + ((int64_t)(v_m[(((n - 2) * lnm) + idx3)])));
v_n[(bl + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((vv2), (MOD))));
} else {
int32_t __flow_step_6 = 1;
for (int32_t k = 1; (1 <= n) ? k < n : k > n; k += (1 <= n) ? 1 : -1) {
int64_t uu = (((((int64_t)(u_n[(base + idx1)])) + ((int64_t)(u_m[(base_m + idx3)]))) + v_n1) + ((int64_t)(u_n[(base_next + idx1)])));
u_n[(base + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((uu), (MOD))));
int64_t vv = (((((int64_t)(v_n[(base + idx1)])) + ((int64_t)(v_m[(base_m + idx3)]))) + ((int64_t)(v_n[(base_next + idx1)]))) + u_n1);
v_n[(base + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((vv), (MOD))));
base = base_next;
base_next = (base_next + ln);
base_m = (base_m + lnm);
}
int64_t bl = ((n - 1) * ln);
int64_t uu2 = (((2 * ((int64_t)(u_n[(bl + idx1)]))) + v_n1) + ((int64_t)(u_m[(((n - 2) * lnm) + idx3)])));
u_n[(bl + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((uu2), (MOD))));
int64_t vv2 = (((2 * ((int64_t)(v_n[(bl + idx1)]))) + (2 * u_n1)) + ((int64_t)(v_m[(((n - 2) * lnm) + idx3)])));
v_n[(bl + idx_cur)] = ((int32_t)(FLOW_CHECKED_MOD((vv2), (MOD))));
}
}
}
}
int64_t val_f = 0;
if ((m - 1) >= 0) {
val_f = (val_f + ((int64_t)(a2[(m - 1)])));
}
if ((m - 2) >= 0) {
val_f = (val_f + (4 * ((int64_t)(f0[(m - 2)]))));
}
int64_t mp = (m - 3);
if ((mp >= offset_arr[1] && lens_arr[1] > 0)) {
int64_t id1 = (mp - offset_arr[1]);
val_f = ((val_f + (2 * ((int64_t)(u[1][id1])))) + ((int64_t)(v[1][id1])));
}
f0[m] = ((int32_t)(FLOW_CHECKED_MOD((val_f), (MOD))));
if (m >= 1) {
int64_t val_a = (3 * ((int64_t)(a2[(m - 1)])));
if ((m - 2) >= 0) {
val_a = (val_a + (3 * ((int64_t)(f0[(m - 2)]))));
}
a2[m] = ((int32_t)(FLOW_CHECKED_MOD((val_a), (MOD))));
}
m = (m + 1);
}
int64_t ans = ((int64_t)(a2[M_VAL]));
int32_t __flow_step_7 = 1;
for (int32_t n = 1; (1 <= NMAX) ? n < NMAX : n > NMAX; n += (1 <= NMAX) ? 1 : -1) {
free(u[n]);
free(v[n]);
}
free(u);
free(v);
free(f0);
free(a2);
free(offset_arr);
free(lens_arr);
printf("%lld\n", ans);
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
// Constant: MOD
llvm.mlir.global internal constant @MOD(1000000000 : i64) : i64
// Constant: M_VAL
llvm.mlir.global internal constant @M_VAL(9999 : i64) : i64
func.func @main() -> i32 {
%0 = arith.constant 0 : i32
%1 = arith.extsi %0 : i32 to i64
%2 = llvm.mlir.constant(1 : i64) : i64
%3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
llvm.store %1, %3 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%4 = llvm.load %3 : !llvm.ptr -> i64
%5 = arith.constant 1 : i32
%7 = arith.extsi %5 : i32 to i64
%6 = arith.addi %4, %7 : i64
%8 = llvm.load %3 : !llvm.ptr -> i64
%9 = arith.constant 2 : i32
%11 = arith.extsi %9 : i32 to i64
%10 = arith.addi %8, %11 : i64
%12 = arith.muli %6, %10 : i64
%13 = arith.constant 2 : i32
%15 = arith.extsi %13 : i32 to i64
%14 = arith.divsi %12, %15 : i64
%16 = llvm.mlir.addressof @M_VAL : !llvm.ptr
%17 = llvm.load %16 : !llvm.ptr -> i64
%18 = arith.cmpi sle, %14, %17 : i64
cf.cond_br %18, ^bb1, ^bb2
^bb1:
%19 = llvm.load %3 : !llvm.ptr -> i64
%20 = arith.constant 1 : i32
%22 = arith.extsi %20 : i32 to i64
%21 = arith.addi %19, %22 : i64
llvm.store %21, %3 : i64, !llvm.ptr
cf.br ^bb0
^bb2:
%23 = llvm.load %3 : !llvm.ptr -> i64
%24 = arith.constant 1 : i32
%26 = arith.extsi %24 : i32 to i64
%25 = arith.subi %23, %26 : i64
%27 = arith.constant 3 : i32
%29 = arith.extsi %27 : i32 to i64
%28 = arith.addi %25, %29 : i64
%30 = arith.constant 2 : i32
%32 = arith.extsi %30 : i32 to i64
%31 = arith.addi %28, %32 : i64
%34 = arith.constant 8 : i32
%35 = arith.extsi %34 : i32 to i64
%33 = func.call @calloc(%31, %35) : (i64, i64) -> !llvm.ptr
%37 = arith.constant 8 : i32
%38 = arith.extsi %37 : i32 to i64
%36 = func.call @calloc(%31, %38) : (i64, i64) -> !llvm.ptr
%39 = arith.constant 0 : i32
%40 = arith.index_cast %39 : i32 to index
%41 = arith.index_cast %31 : i32 to index
%43 = arith.constant 1 : index
%44 = arith.constant -1 : index
%45 = arith.cmpi sle, %40, %41 : index
%42 = arith.select %45, %43, %44 : index
cf.br ^bb3(%40 : index)
^bb3(%46: index):
%47 = arith.cmpi slt, %46, %41 : index
%48 = arith.cmpi sgt, %46, %41 : index
%49 = arith.select %45, %47, %48 : i1
cf.cond_br %49, ^bb4(%46 : index), ^bb5(%46 : index)
^bb4(%50: index):
%51 = arith.constant 1 : i32
%53 = arith.index_cast %50 : index to i32
%52 = arith.addi %53, %51 : i32
%54 = arith.constant 2 : i32
%56 = arith.index_cast %50 : index to i32
%55 = arith.addi %56, %54 : i32
%57 = arith.muli %52, %55 : i32
%58 = arith.constant 2 : i32
%59 = arith.divsi %57, %58 : i32
%60 = arith.extsi %59 : i32 to i64
%61 = arith.index_cast %50 : index to i64
%62 = llvm.getelementptr %33[%61] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %60, %62 : i64, !llvm.ptr
%63 = llvm.mlir.addressof @M_VAL : !llvm.ptr
%64 = llvm.load %63 : !llvm.ptr -> i64
%66 = arith.index_cast %50 : index to i64
%67 = llvm.getelementptr %33[%66] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%65 = llvm.load %67 : !llvm.ptr -> i64
%68 = arith.subi %64, %65 : i64
%69 = arith.constant 1 : i32
%71 = arith.extsi %69 : i32 to i64
%70 = arith.addi %68, %71 : i64
%72 = arith.constant 0 : i32
%74 = arith.extsi %72 : i32 to i64
%73 = arith.cmpi sgt, %70, %74 : i64
%75 = scf.if %73 -> (i64) {
scf.yield %70 : i64
} else {
%76 = arith.constant 0 : i32
scf.yield %76 : i32
}
%77 = arith.index_cast %50 : index to i64
%78 = llvm.getelementptr %36[%77] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %75, %78 : i64, !llvm.ptr
%79 = arith.addi %50, %42 : index
cf.br ^bb3(%79 : index)
^bb5(%80: index):
%82 = arith.constant 8 : i32
%83 = arith.extsi %82 : i32 to i64
%81 = func.call @calloc(%31, %83) : (i64, i64) -> !llvm.ptr
%85 = arith.constant 8 : i32
%86 = arith.extsi %85 : i32 to i64
%84 = func.call @calloc(%31, %86) : (i64, i64) -> !llvm.ptr
%87 = arith.constant 1 : i32
%88 = arith.index_cast %87 : i32 to index
%89 = arith.index_cast %31 : i32 to index
%91 = arith.constant 1 : index
%92 = arith.constant -1 : index
%93 = arith.cmpi sle, %88, %89 : index
%90 = arith.select %93, %91, %92 : index
cf.br ^bb6(%88 : index)
^bb6(%94: index):
%95 = arith.cmpi slt, %94, %89 : index
%96 = arith.cmpi sgt, %94, %89 : index
%97 = arith.select %93, %95, %96 : i1
cf.cond_br %97, ^bb7(%94 : index), ^bb8(%94 : index)
^bb7(%98: index):
%100 = arith.index_cast %98 : index to i64
%101 = llvm.getelementptr %36[%100] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%99 = llvm.load %101 : !llvm.ptr -> i64
%102 = arith.constant 0 : i32
%104 = arith.extsi %102 : i32 to i64
%103 = arith.cmpi sgt, %99, %104 : i64
cf.cond_br %103, ^bb9, ^bb10
^bb9:
%107 = arith.index_cast %98 : index to i32
%108 = arith.trunci %99 : i64 to i32
%106 = arith.muli %107, %108 : i32
%109 = arith.constant 4 : i32
%110 = arith.extsi %106 : i32 to i64
%111 = arith.extsi %109 : i32 to i64
%105 = func.call @calloc(%110, %111) : (i64, i64) -> !llvm.ptr
%112 = arith.index_cast %98 : index to i64
%113 = llvm.getelementptr %81[%112] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
llvm.store %105, %113 : !llvm.ptr, !llvm.ptr
%116 = arith.index_cast %98 : index to i32
%117 = arith.trunci %99 : i64 to i32
%115 = arith.muli %116, %117 : i32
%118 = arith.constant 4 : i32
%119 = arith.extsi %115 : i32 to i64
%120 = arith.extsi %118 : i32 to i64
%114 = func.call @calloc(%119, %120) : (i64, i64) -> !llvm.ptr
%121 = arith.index_cast %98 : index to i64
%122 = llvm.getelementptr %84[%121] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
llvm.store %114, %122 : !llvm.ptr, !llvm.ptr
cf.br ^bb11
^bb10:
cf.br ^bb11
^bb11:
%123 = arith.addi %98, %90 : index
cf.br ^bb6(%123 : index)
^bb8(%124: index):
%126 = llvm.mlir.addressof @M_VAL : !llvm.ptr
%127 = llvm.load %126 : !llvm.ptr -> i64
%128 = arith.constant 1 : i32
%130 = arith.extsi %128 : i32 to i64
%129 = arith.addi %127, %130 : i64
%131 = arith.constant 4 : i32
%132 = arith.extsi %131 : i32 to i64
%125 = func.call @calloc(%129, %132) : (i64, i64) -> !llvm.ptr
%134 = llvm.mlir.addressof @M_VAL : !llvm.ptr
%135 = llvm.load %134 : !llvm.ptr -> i64
%136 = arith.constant 1 : i32
%138 = arith.extsi %136 : i32 to i64
%137 = arith.addi %135, %138 : i64
%139 = arith.constant 4 : i32
%140 = arith.extsi %139 : i32 to i64
%133 = func.call @calloc(%137, %140) : (i64, i64) -> !llvm.ptr
%141 = arith.constant 1 : i32
%142 = arith.constant 0 : i32
%143 = arith.extsi %142 : i32 to i64
%144 = llvm.getelementptr %133[%143] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %141, %144 : i32, !llvm.ptr
%145 = arith.constant 0 : i32
%146 = arith.extsi %145 : i32 to i64
%147 = llvm.mlir.constant(1 : i64) : i64
%148 = llvm.alloca %147 x i64 : (i64) -> !llvm.ptr
llvm.store %146, %148 : i64, !llvm.ptr
%149 = arith.constant 0 : i32
%150 = arith.extsi %149 : i32 to i64
%151 = llvm.mlir.constant(1 : i64) : i64
%152 = llvm.alloca %151 x i64 : (i64) -> !llvm.ptr
llvm.store %150, %152 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%153 = llvm.load %152 : !llvm.ptr -> i64
%154 = llvm.mlir.addressof @M_VAL : !llvm.ptr
%155 = llvm.load %154 : !llvm.ptr -> i64
%156 = arith.cmpi sle, %153, %155 : i64
cf.cond_br %156, ^bb13, ^bb14
^bb13:
cf.br ^bb15
^bb15:
%157 = llvm.load %148 : !llvm.ptr -> i64
%158 = arith.constant 1 : i32
%160 = arith.extsi %158 : i32 to i64
%159 = arith.addi %157, %160 : i64
%161 = arith.constant 1 : i32
%163 = arith.extsi %161 : i32 to i64
%162 = arith.addi %28, %163 : i64
%164 = arith.cmpi slt, %159, %162 : i64
%165 = scf.if %164 -> (i1) {
%167 = llvm.load %148 : !llvm.ptr -> i64
%168 = arith.constant 1 : i32
%170 = arith.extsi %168 : i32 to i64
%169 = arith.addi %167, %170 : i64
%171 = llvm.getelementptr %33[%169] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%166 = llvm.load %171 : !llvm.ptr -> i64
%172 = llvm.load %152 : !llvm.ptr -> i64
%173 = arith.cmpi sle, %166, %172 : i64
scf.yield %173 : i1
} else {
%174 = arith.constant false
scf.yield %174 : i1
}
cf.cond_br %165, ^bb16, ^bb17
^bb16:
%175 = llvm.load %148 : !llvm.ptr -> i64
%176 = arith.constant 1 : i32
%178 = arith.extsi %176 : i32 to i64
%177 = arith.addi %175, %178 : i64
llvm.store %177, %148 : i64, !llvm.ptr
cf.br ^bb15
^bb17:
%179 = arith.constant 1 : i32
%180 = llvm.load %148 : !llvm.ptr -> i64
%181 = arith.constant 1 : i32
%183 = arith.extsi %181 : i32 to i64
%182 = arith.addi %180, %183 : i64
%184 = arith.index_cast %179 : i32 to index
%185 = arith.index_cast %182 : i32 to index
%187 = arith.constant 1 : index
%188 = arith.constant -1 : index
%189 = arith.cmpi sle, %184, %185 : index
%186 = arith.select %189, %187, %188 : index
cf.br ^bb18(%184 : index)
^bb18(%190: index):
%191 = arith.cmpi slt, %190, %185 : index
%192 = arith.cmpi sgt, %190, %185 : index
%193 = arith.select %189, %191, %192 : i1
cf.cond_br %193, ^bb19(%190 : index), ^bb20(%190 : index)
^bb19(%194: index):
%196 = arith.index_cast %194 : index to i64
%197 = llvm.getelementptr %33[%196] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%195 = llvm.load %197 : !llvm.ptr -> i64
%199 = arith.index_cast %194 : index to i64
%200 = llvm.getelementptr %36[%199] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%198 = llvm.load %200 : !llvm.ptr -> i64
%201 = llvm.load %152 : !llvm.ptr -> i64
%202 = arith.subi %201, %195 : i64
%203 = llvm.load %152 : !llvm.ptr -> i64
%205 = arith.trunci %203 : i64 to i32
%206 = arith.index_cast %194 : index to i32
%204 = arith.subi %205, %206 : i32
%207 = arith.constant 2 : i32
%208 = arith.subi %204, %207 : i32
%209 = arith.extsi %208 : i32 to i64
%210 = arith.subi %209, %195 : i64
%211 = llvm.load %152 : !llvm.ptr -> i64
%213 = arith.trunci %211 : i64 to i32
%214 = arith.index_cast %194 : index to i32
%212 = arith.subi %213, %214 : i32
%215 = arith.constant 3 : i32
%216 = arith.subi %212, %215 : i32
%217 = arith.extsi %216 : i32 to i64
%219 = arith.constant 1 : i32
%221 = arith.index_cast %194 : index to i32
%220 = arith.addi %221, %219 : i32
%222 = arith.extsi %220 : i32 to i64
%223 = llvm.getelementptr %33[%222] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%218 = llvm.load %223 : !llvm.ptr -> i64
%224 = arith.subi %217, %218 : i64
%226 = arith.constant 1 : i32
%228 = arith.index_cast %194 : index to i32
%227 = arith.addi %228, %226 : i32
%229 = arith.extsi %227 : i32 to i64
%230 = llvm.getelementptr %36[%229] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%225 = llvm.load %230 : !llvm.ptr -> i64
%231 = llvm.load %152 : !llvm.ptr -> i64
%233 = arith.trunci %231 : i64 to i32
%234 = arith.index_cast %194 : index to i32
%232 = arith.subi %233, %234 : i32
%235 = arith.constant 1 : i32
%236 = arith.subi %232, %235 : i32
%237 = arith.extsi %236 : i32 to i64
%239 = arith.constant 1 : i32
%241 = arith.index_cast %194 : index to i32
%240 = arith.subi %241, %239 : i32
%242 = arith.extsi %240 : i32 to i64
%243 = llvm.getelementptr %33[%242] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%238 = llvm.load %243 : !llvm.ptr -> i64
%244 = arith.subi %237, %238 : i64
%246 = arith.constant 1 : i32
%248 = arith.index_cast %194 : index to i32
%247 = arith.subi %248, %246 : i32
%249 = arith.extsi %247 : i32 to i64
%250 = llvm.getelementptr %36[%249] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%245 = llvm.load %250 : !llvm.ptr -> i64
%251 = arith.constant 1 : i32
%253 = arith.index_cast %194 : index to i32
%252 = arith.cmpi eq, %253, %251 : i32
cf.cond_br %252, ^bb21, ^bb22
^bb21:
%254 = arith.constant 0 : i32
%255 = arith.extsi %254 : i32 to i64
%256 = llvm.mlir.constant(1 : i64) : i64
%257 = llvm.alloca %256 x i64 : (i64) -> !llvm.ptr
llvm.store %255, %257 : i64, !llvm.ptr
%258 = arith.constant 0 : i32
%260 = arith.extsi %258 : i32 to i64
%259 = arith.cmpi sge, %210, %260 : i64
cf.cond_br %259, ^bb24, ^bb25
^bb24:
%261 = llvm.load %257 : !llvm.ptr -> i64
%262 = arith.constant 2 : i32
%265 = arith.constant 1 : i32
%266 = arith.extsi %265 : i32 to i64
%267 = llvm.getelementptr %81[%266] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%264 = llvm.load %267 : !llvm.ptr -> !llvm.ptr
%268 = llvm.getelementptr %264[%210] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%263 = llvm.load %268 : !llvm.ptr -> i32
%269 = arith.extsi %263 : i32 to i64
%271 = arith.extsi %262 : i32 to i64
%270 = arith.muli %271, %269 : i64
%272 = arith.addi %261, %270 : i64
%275 = arith.constant 1 : i32
%276 = arith.extsi %275 : i32 to i64
%277 = llvm.getelementptr %84[%276] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%274 = llvm.load %277 : !llvm.ptr -> !llvm.ptr
%278 = llvm.getelementptr %274[%210] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%273 = llvm.load %278 : !llvm.ptr -> i32
%279 = arith.extsi %273 : i32 to i64
%280 = arith.addi %272, %279 : i64
llvm.store %280, %257 : i64, !llvm.ptr
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
%281 = arith.constant 0 : i32
%283 = arith.extsi %281 : i32 to i64
%282 = arith.cmpi sge, %224, %283 : i64
%284 = scf.if %282 -> (i1) {
%285 = arith.constant 0 : i32
%287 = arith.extsi %285 : i32 to i64
%286 = arith.cmpi sgt, %225, %287 : i64
scf.yield %286 : i1
} else {
%288 = arith.constant false
scf.yield %288 : i1
}
cf.cond_br %284, ^bb27, ^bb28
^bb27:
%289 = llvm.load %257 : !llvm.ptr -> i64
%292 = arith.constant 2 : i32
%293 = arith.extsi %292 : i32 to i64
%294 = llvm.getelementptr %84[%293] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%291 = llvm.load %294 : !llvm.ptr -> !llvm.ptr
%295 = llvm.getelementptr %291[%224] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%290 = llvm.load %295 : !llvm.ptr -> i32
%296 = arith.extsi %290 : i32 to i64
%297 = arith.addi %289, %296 : i64
%300 = arith.constant 2 : i32
%301 = arith.extsi %300 : i32 to i64
%302 = llvm.getelementptr %81[%301] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%299 = llvm.load %302 : !llvm.ptr -> !llvm.ptr
%303 = arith.addi %225, %224 : i64
%304 = llvm.getelementptr %299[%303] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%298 = llvm.load %304 : !llvm.ptr -> i32
%305 = arith.extsi %298 : i32 to i64
%306 = arith.addi %297, %305 : i64
llvm.store %306, %257 : i64, !llvm.ptr
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
%307 = arith.constant 0 : i32
%309 = arith.extsi %307 : i32 to i64
%308 = arith.cmpi sge, %237, %309 : i64
cf.cond_br %308, ^bb30, ^bb31
^bb30:
%310 = llvm.load %257 : !llvm.ptr -> i64
%312 = llvm.getelementptr %125[%237] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%311 = llvm.load %312 : !llvm.ptr -> i32
%313 = arith.extsi %311 : i32 to i64
%314 = arith.addi %310, %313 : i64
llvm.store %314, %257 : i64, !llvm.ptr
cf.br ^bb32
^bb31:
cf.br ^bb32
^bb32:
%315 = llvm.load %257 : !llvm.ptr -> i64
%316 = llvm.mlir.addressof @MOD : !llvm.ptr
%317 = llvm.load %316 : !llvm.ptr -> i64
%318 = arith.remsi %315, %317 : i64
%319 = arith.trunci %318 : i64 to i32
%321 = arith.constant 1 : i32
%322 = arith.extsi %321 : i32 to i64
%323 = llvm.getelementptr %81[%322] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%320 = llvm.load %323 : !llvm.ptr -> !llvm.ptr
%324 = llvm.getelementptr %320[%202] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %319, %324 : i32, !llvm.ptr
%325 = arith.constant 0 : i32
%326 = arith.extsi %325 : i32 to i64
%327 = llvm.mlir.constant(1 : i64) : i64
%328 = llvm.alloca %327 x i64 : (i64) -> !llvm.ptr
llvm.store %326, %328 : i64, !llvm.ptr
%329 = arith.constant 0 : i32
%331 = arith.extsi %329 : i32 to i64
%330 = arith.cmpi sge, %210, %331 : i64
cf.cond_br %330, ^bb33, ^bb34
^bb33:
%332 = llvm.load %328 : !llvm.ptr -> i64
%333 = arith.constant 2 : i32
%336 = arith.constant 1 : i32
%337 = arith.extsi %336 : i32 to i64
%338 = llvm.getelementptr %84[%337] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%335 = llvm.load %338 : !llvm.ptr -> !llvm.ptr
%339 = llvm.getelementptr %335[%210] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%334 = llvm.load %339 : !llvm.ptr -> i32
%340 = arith.extsi %334 : i32 to i64
%342 = arith.extsi %333 : i32 to i64
%341 = arith.muli %342, %340 : i64
%343 = arith.addi %332, %341 : i64
%344 = arith.constant 2 : i32
%347 = arith.constant 1 : i32
%348 = arith.extsi %347 : i32 to i64
%349 = llvm.getelementptr %81[%348] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%346 = llvm.load %349 : !llvm.ptr -> !llvm.ptr
%350 = llvm.getelementptr %346[%210] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%345 = llvm.load %350 : !llvm.ptr -> i32
%351 = arith.extsi %345 : i32 to i64
%353 = arith.extsi %344 : i32 to i64
%352 = arith.muli %353, %351 : i64
%354 = arith.addi %343, %352 : i64
llvm.store %354, %328 : i64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%355 = arith.constant 0 : i32
%357 = arith.extsi %355 : i32 to i64
%356 = arith.cmpi sge, %224, %357 : i64
%358 = scf.if %356 -> (i1) {
%359 = arith.constant 0 : i32
%361 = arith.extsi %359 : i32 to i64
%360 = arith.cmpi sgt, %225, %361 : i64
scf.yield %360 : i1
} else {
%362 = arith.constant false
scf.yield %362 : i1
}
cf.cond_br %358, ^bb36, ^bb37
^bb36:
%363 = llvm.load %328 : !llvm.ptr -> i64
%366 = arith.constant 2 : i32
%367 = arith.extsi %366 : i32 to i64
%368 = llvm.getelementptr %84[%367] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%365 = llvm.load %368 : !llvm.ptr -> !llvm.ptr
%369 = arith.addi %225, %224 : i64
%370 = llvm.getelementptr %365[%369] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%364 = llvm.load %370 : !llvm.ptr -> i32
%371 = arith.extsi %364 : i32 to i64
%372 = arith.addi %363, %371 : i64
%373 = arith.constant 2 : i32
%376 = arith.constant 2 : i32
%377 = arith.extsi %376 : i32 to i64
%378 = llvm.getelementptr %81[%377] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%375 = llvm.load %378 : !llvm.ptr -> !llvm.ptr
%379 = llvm.getelementptr %375[%224] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%374 = llvm.load %379 : !llvm.ptr -> i32
%380 = arith.extsi %374 : i32 to i64
%382 = arith.extsi %373 : i32 to i64
%381 = arith.muli %382, %380 : i64
%383 = arith.addi %372, %381 : i64
llvm.store %383, %328 : i64, !llvm.ptr
cf.br ^bb38
^bb37:
cf.br ^bb38
^bb38:
%384 = arith.constant 0 : i32
%386 = arith.extsi %384 : i32 to i64
%385 = arith.cmpi sge, %237, %386 : i64
cf.cond_br %385, ^bb39, ^bb40
^bb39:
%387 = llvm.load %328 : !llvm.ptr -> i64
%389 = llvm.getelementptr %125[%237] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%388 = llvm.load %389 : !llvm.ptr -> i32
%390 = arith.extsi %388 : i32 to i64
%391 = arith.addi %387, %390 : i64
llvm.store %391, %328 : i64, !llvm.ptr
cf.br ^bb41
^bb40:
cf.br ^bb41
^bb41:
%392 = llvm.load %328 : !llvm.ptr -> i64
%393 = llvm.mlir.addressof @MOD : !llvm.ptr
%394 = llvm.load %393 : !llvm.ptr -> i64
%395 = arith.remsi %392, %394 : i64
%396 = arith.trunci %395 : i64 to i32
%398 = arith.constant 1 : i32
%399 = arith.extsi %398 : i32 to i64
%400 = llvm.getelementptr %84[%399] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%397 = llvm.load %400 : !llvm.ptr -> !llvm.ptr
%401 = llvm.getelementptr %397[%202] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %396, %401 : i32, !llvm.ptr
cf.br ^bb23
^bb22:
%403 = arith.index_cast %194 : index to i64
%404 = llvm.getelementptr %81[%403] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%402 = llvm.load %404 : !llvm.ptr -> !llvm.ptr
%406 = arith.index_cast %194 : index to i64
%407 = llvm.getelementptr %84[%406] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%405 = llvm.load %407 : !llvm.ptr -> !llvm.ptr
%409 = arith.constant 1 : i32
%411 = arith.index_cast %194 : index to i32
%410 = arith.addi %411, %409 : i32
%412 = arith.extsi %410 : i32 to i64
%413 = llvm.getelementptr %81[%412] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%408 = llvm.load %413 : !llvm.ptr -> !llvm.ptr
%415 = arith.constant 1 : i32
%417 = arith.index_cast %194 : index to i32
%416 = arith.addi %417, %415 : i32
%418 = arith.extsi %416 : i32 to i64
%419 = llvm.getelementptr %84[%418] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%414 = llvm.load %419 : !llvm.ptr -> !llvm.ptr
%421 = arith.constant 1 : i32
%423 = arith.index_cast %194 : index to i32
%422 = arith.subi %423, %421 : i32
%424 = arith.extsi %422 : i32 to i64
%425 = llvm.getelementptr %81[%424] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%420 = llvm.load %425 : !llvm.ptr -> !llvm.ptr
%427 = arith.constant 1 : i32
%429 = arith.index_cast %194 : index to i32
%428 = arith.subi %429, %427 : i32
%430 = arith.extsi %428 : i32 to i64
%431 = llvm.getelementptr %84[%430] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%426 = llvm.load %431 : !llvm.ptr -> !llvm.ptr
%432 = arith.constant 0 : i32
%434 = arith.extsi %432 : i32 to i64
%433 = arith.cmpi sge, %210, %434 : i64
%435 = scf.if %433 -> (i64) {
%437 = llvm.getelementptr %402[%210] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%436 = llvm.load %437 : !llvm.ptr -> i32
%438 = arith.extsi %436 : i32 to i64
scf.yield %438 : i64
} else {
%439 = arith.constant 0 : i32
scf.yield %439 : i32
}
%440 = arith.constant 0 : i32
%442 = arith.extsi %440 : i32 to i64
%441 = arith.cmpi sge, %210, %442 : i64
%443 = scf.if %441 -> (i64) {
%445 = llvm.getelementptr %405[%210] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%444 = llvm.load %445 : !llvm.ptr -> i32
%446 = arith.extsi %444 : i32 to i64
scf.yield %446 : i64
} else {
%447 = arith.constant 0 : i32
scf.yield %447 : i32
}
%448 = arith.constant 0 : i32
%450 = arith.extsi %448 : i32 to i64
%449 = arith.cmpi sge, %224, %450 : i64
%451 = scf.if %449 -> (i1) {
%452 = arith.constant 0 : i32
%454 = arith.extsi %452 : i32 to i64
%453 = arith.cmpi sgt, %225, %454 : i64
scf.yield %453 : i1
} else {
%455 = arith.constant false
scf.yield %455 : i1
}
%456 = scf.if %451 -> (i64) {
%458 = llvm.getelementptr %408[%224] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%457 = llvm.load %458 : !llvm.ptr -> i32
%459 = arith.extsi %457 : i32 to i64
scf.yield %459 : i64
} else {
%460 = arith.constant 0 : i32
scf.yield %460 : i32
}
%461 = arith.constant 0 : i32
%463 = arith.extsi %461 : i32 to i64
%462 = arith.cmpi sge, %224, %463 : i64
%464 = scf.if %462 -> (i1) {
%465 = arith.constant 0 : i32
%467 = arith.extsi %465 : i32 to i64
%466 = arith.cmpi sgt, %225, %467 : i64
scf.yield %466 : i1
} else {
%468 = arith.constant false
scf.yield %468 : i1
}
%469 = scf.if %464 -> (i64) {
%471 = llvm.getelementptr %414[%224] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%470 = llvm.load %471 : !llvm.ptr -> i32
%472 = arith.extsi %470 : i32 to i64
scf.yield %472 : i64
} else {
%473 = arith.constant 0 : i32
scf.yield %473 : i32
}
%474 = arith.constant 0 : i32
%475 = arith.extsi %474 : i32 to i64
%476 = llvm.mlir.constant(1 : i64) : i64
%477 = llvm.alloca %476 x i64 : (i64) -> !llvm.ptr
llvm.store %475, %477 : i64, !llvm.ptr
%478 = llvm.mlir.constant(1 : i64) : i64
%479 = llvm.alloca %478 x i64 : (i64) -> !llvm.ptr
llvm.store %198, %479 : i64, !llvm.ptr
%480 = llvm.mlir.constant(1 : i64) : i64
%481 = llvm.alloca %480 x i64 : (i64) -> !llvm.ptr
llvm.store %225, %481 : i64, !llvm.ptr
%482 = arith.constant 0 : i32
%483 = arith.extsi %482 : i32 to i64
%484 = llvm.mlir.constant(1 : i64) : i64
%485 = llvm.alloca %484 x i64 : (i64) -> !llvm.ptr
llvm.store %483, %485 : i64, !llvm.ptr
%486 = arith.constant 0 : i32
%488 = arith.extsi %486 : i32 to i64
%487 = arith.cmpi slt, %210, %488 : i64
cf.cond_br %487, ^bb42, ^bb43
^bb42:
%489 = arith.constant 1 : i32
%490 = arith.index_cast %489 : i32 to index
%491 = arith.index_cast %194 : i32 to index
%493 = arith.constant 1 : index
%494 = arith.constant -1 : index
%495 = arith.cmpi sle, %490, %491 : index
%492 = arith.select %495, %493, %494 : index
cf.br ^bb45(%490 : index)
^bb45(%496: index):
%497 = arith.cmpi slt, %496, %491 : index
%498 = arith.cmpi sgt, %496, %491 : index
%499 = arith.select %495, %497, %498 : i1
cf.cond_br %499, ^bb46(%496 : index), ^bb47(%496 : index)
^bb46(%500: index):
%502 = llvm.load %485 : !llvm.ptr -> i64
%503 = arith.addi %502, %244 : i64
%504 = llvm.getelementptr %420[%503] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%501 = llvm.load %504 : !llvm.ptr -> i32
%505 = llvm.load %477 : !llvm.ptr -> i64
%506 = arith.addi %505, %202 : i64
%507 = llvm.getelementptr %402[%506] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %501, %507 : i32, !llvm.ptr
%509 = llvm.load %485 : !llvm.ptr -> i64
%510 = arith.addi %509, %244 : i64
%511 = llvm.getelementptr %426[%510] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%508 = llvm.load %511 : !llvm.ptr -> i32
%512 = llvm.load %477 : !llvm.ptr -> i64
%513 = arith.addi %512, %202 : i64
%514 = llvm.getelementptr %405[%513] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %508, %514 : i32, !llvm.ptr
%515 = llvm.load %479 : !llvm.ptr -> i64
llvm.store %515, %477 : i64, !llvm.ptr
%516 = llvm.load %479 : !llvm.ptr -> i64
%517 = arith.addi %516, %198 : i64
llvm.store %517, %479 : i64, !llvm.ptr
%518 = llvm.load %485 : !llvm.ptr -> i64
%519 = arith.addi %518, %245 : i64
llvm.store %519, %485 : i64, !llvm.ptr
%520 = arith.addi %500, %492 : index
cf.br ^bb45(%520 : index)
^bb47(%521: index):
%523 = arith.constant 2 : i32
%525 = arith.index_cast %194 : index to i32
%524 = arith.subi %525, %523 : i32
%527 = arith.extsi %524 : i32 to i64
%526 = arith.muli %527, %245 : i64
%528 = arith.addi %526, %244 : i64
%529 = llvm.getelementptr %420[%528] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%522 = llvm.load %529 : !llvm.ptr -> i32
%530 = arith.constant 1 : i32
%532 = arith.index_cast %194 : index to i32
%531 = arith.subi %532, %530 : i32
%534 = arith.extsi %531 : i32 to i64
%533 = arith.muli %534, %198 : i64
%535 = arith.addi %533, %202 : i64
%536 = llvm.getelementptr %402[%535] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %522, %536 : i32, !llvm.ptr
%538 = arith.constant 2 : i32
%540 = arith.index_cast %194 : index to i32
%539 = arith.subi %540, %538 : i32
%542 = arith.extsi %539 : i32 to i64
%541 = arith.muli %542, %245 : i64
%543 = arith.addi %541, %244 : i64
%544 = llvm.getelementptr %426[%543] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%537 = llvm.load %544 : !llvm.ptr -> i32
%545 = arith.constant 1 : i32
%547 = arith.index_cast %194 : index to i32
%546 = arith.subi %547, %545 : i32
%549 = arith.extsi %546 : i32 to i64
%548 = arith.muli %549, %198 : i64
%550 = arith.addi %548, %202 : i64
%551 = llvm.getelementptr %405[%550] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %537, %551 : i32, !llvm.ptr
cf.br ^bb44
^bb43:
%552 = arith.constant 0 : i32
%554 = arith.extsi %552 : i32 to i64
%553 = arith.cmpi sge, %224, %554 : i64
%555 = scf.if %553 -> (i1) {
%556 = arith.constant 0 : i32
%558 = arith.extsi %556 : i32 to i64
%557 = arith.cmpi sgt, %225, %558 : i64
scf.yield %557 : i1
} else {
%559 = arith.constant false
scf.yield %559 : i1
}
cf.cond_br %555, ^bb48, ^bb49
^bb48:
%560 = arith.constant 1 : i32
%561 = arith.index_cast %560 : i32 to index
%562 = arith.index_cast %194 : i32 to index
%564 = arith.constant 1 : index
%565 = arith.constant -1 : index
%566 = arith.cmpi sle, %561, %562 : index
%563 = arith.select %566, %564, %565 : index
cf.br ^bb51(%561 : index)
^bb51(%567: index):
%568 = arith.cmpi slt, %567, %562 : index
%569 = arith.cmpi sgt, %567, %562 : index
%570 = arith.select %566, %568, %569 : i1
cf.cond_br %570, ^bb52(%567 : index), ^bb53(%567 : index)
^bb52(%571: index):
%573 = llvm.load %477 : !llvm.ptr -> i64
%574 = arith.addi %573, %210 : i64
%575 = llvm.getelementptr %402[%574] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%572 = llvm.load %575 : !llvm.ptr -> i32
%576 = arith.extsi %572 : i32 to i64
%577 = arith.addi %576, %469 : i64
%579 = llvm.load %481 : !llvm.ptr -> i64
%580 = arith.addi %579, %224 : i64
%581 = llvm.getelementptr %408[%580] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%578 = llvm.load %581 : !llvm.ptr -> i32
%582 = arith.extsi %578 : i32 to i64
%583 = arith.addi %577, %582 : i64
%585 = llvm.load %485 : !llvm.ptr -> i64
%586 = arith.addi %585, %244 : i64
%587 = llvm.getelementptr %420[%586] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%584 = llvm.load %587 : !llvm.ptr -> i32
%588 = arith.extsi %584 : i32 to i64
%589 = arith.addi %583, %588 : i64
%590 = arith.addi %589, %443 : i64
%592 = llvm.load %479 : !llvm.ptr -> i64
%593 = arith.addi %592, %210 : i64
%594 = llvm.getelementptr %402[%593] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%591 = llvm.load %594 : !llvm.ptr -> i32
%595 = arith.extsi %591 : i32 to i64
%596 = arith.addi %590, %595 : i64
%597 = llvm.mlir.addressof @MOD : !llvm.ptr
%598 = llvm.load %597 : !llvm.ptr -> i64
%599 = arith.remsi %596, %598 : i64
%600 = arith.trunci %599 : i64 to i32
%601 = llvm.load %477 : !llvm.ptr -> i64
%602 = arith.addi %601, %202 : i64
%603 = llvm.getelementptr %402[%602] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %600, %603 : i32, !llvm.ptr
%605 = llvm.load %477 : !llvm.ptr -> i64
%606 = arith.addi %605, %210 : i64
%607 = llvm.getelementptr %405[%606] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%604 = llvm.load %607 : !llvm.ptr -> i32
%608 = arith.extsi %604 : i32 to i64
%610 = llvm.load %481 : !llvm.ptr -> i64
%611 = arith.addi %610, %224 : i64
%612 = llvm.getelementptr %414[%611] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%609 = llvm.load %612 : !llvm.ptr -> i32
%613 = arith.extsi %609 : i32 to i64
%614 = arith.addi %608, %613 : i64
%615 = arith.addi %614, %456 : i64
%617 = llvm.load %485 : !llvm.ptr -> i64
%618 = arith.addi %617, %244 : i64
%619 = llvm.getelementptr %426[%618] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%616 = llvm.load %619 : !llvm.ptr -> i32
%620 = arith.extsi %616 : i32 to i64
%621 = arith.addi %615, %620 : i64
%623 = llvm.load %479 : !llvm.ptr -> i64
%624 = arith.addi %623, %210 : i64
%625 = llvm.getelementptr %405[%624] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%622 = llvm.load %625 : !llvm.ptr -> i32
%626 = arith.extsi %622 : i32 to i64
%627 = arith.addi %621, %626 : i64
%628 = arith.addi %627, %435 : i64
%629 = llvm.mlir.addressof @MOD : !llvm.ptr
%630 = llvm.load %629 : !llvm.ptr -> i64
%631 = arith.remsi %628, %630 : i64
%632 = arith.trunci %631 : i64 to i32
%633 = llvm.load %477 : !llvm.ptr -> i64
%634 = arith.addi %633, %202 : i64
%635 = llvm.getelementptr %405[%634] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %632, %635 : i32, !llvm.ptr
%636 = llvm.load %479 : !llvm.ptr -> i64
llvm.store %636, %477 : i64, !llvm.ptr
%637 = llvm.load %479 : !llvm.ptr -> i64
%638 = arith.addi %637, %198 : i64
llvm.store %638, %479 : i64, !llvm.ptr
%639 = llvm.load %481 : !llvm.ptr -> i64
%640 = arith.addi %639, %225 : i64
llvm.store %640, %481 : i64, !llvm.ptr
%641 = llvm.load %485 : !llvm.ptr -> i64
%642 = arith.addi %641, %245 : i64
llvm.store %642, %485 : i64, !llvm.ptr
%643 = arith.addi %571, %563 : index
cf.br ^bb51(%643 : index)
^bb53(%644: index):
%645 = arith.constant 1 : i32
%647 = arith.index_cast %194 : index to i32
%646 = arith.subi %647, %645 : i32
%649 = arith.extsi %646 : i32 to i64
%648 = arith.muli %649, %198 : i64
%650 = arith.constant 2 : i32
%652 = arith.addi %648, %210 : i64
%653 = llvm.getelementptr %402[%652] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%651 = llvm.load %653 : !llvm.ptr -> i32
%654 = arith.extsi %651 : i32 to i64
%656 = arith.extsi %650 : i32 to i64
%655 = arith.muli %656, %654 : i64
%657 = arith.addi %655, %443 : i64
%658 = arith.addi %657, %469 : i64
%660 = llvm.load %481 : !llvm.ptr -> i64
%661 = arith.addi %660, %224 : i64
%662 = llvm.getelementptr %408[%661] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%659 = llvm.load %662 : !llvm.ptr -> i32
%663 = arith.extsi %659 : i32 to i64
%664 = arith.addi %658, %663 : i64
%666 = arith.constant 2 : i32
%668 = arith.index_cast %194 : index to i32
%667 = arith.subi %668, %666 : i32
%670 = arith.extsi %667 : i32 to i64
%669 = arith.muli %670, %245 : i64
%671 = arith.addi %669, %244 : i64
%672 = llvm.getelementptr %420[%671] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%665 = llvm.load %672 : !llvm.ptr -> i32
%673 = arith.extsi %665 : i32 to i64
%674 = arith.addi %664, %673 : i64
%675 = llvm.mlir.addressof @MOD : !llvm.ptr
%676 = llvm.load %675 : !llvm.ptr -> i64
%677 = arith.remsi %674, %676 : i64
%678 = arith.trunci %677 : i64 to i32
%679 = arith.addi %648, %202 : i64
%680 = llvm.getelementptr %402[%679] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %678, %680 : i32, !llvm.ptr
%681 = arith.constant 2 : i32
%683 = arith.addi %648, %210 : i64
%684 = llvm.getelementptr %405[%683] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%682 = llvm.load %684 : !llvm.ptr -> i32
%685 = arith.extsi %682 : i32 to i64
%687 = arith.extsi %681 : i32 to i64
%686 = arith.muli %687, %685 : i64
%688 = arith.constant 2 : i32
%690 = arith.extsi %688 : i32 to i64
%689 = arith.muli %690, %435 : i64
%691 = arith.addi %686, %689 : i64
%693 = llvm.load %481 : !llvm.ptr -> i64
%694 = arith.addi %693, %224 : i64
%695 = llvm.getelementptr %414[%694] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%692 = llvm.load %695 : !llvm.ptr -> i32
%696 = arith.extsi %692 : i32 to i64
%697 = arith.addi %691, %696 : i64
%698 = arith.constant 2 : i32
%700 = arith.extsi %698 : i32 to i64
%699 = arith.muli %700, %456 : i64
%701 = arith.addi %697, %699 : i64
%703 = arith.constant 2 : i32
%705 = arith.index_cast %194 : index to i32
%704 = arith.subi %705, %703 : i32
%707 = arith.extsi %704 : i32 to i64
%706 = arith.muli %707, %245 : i64
%708 = arith.addi %706, %244 : i64
%709 = llvm.getelementptr %426[%708] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%702 = llvm.load %709 : !llvm.ptr -> i32
%710 = arith.extsi %702 : i32 to i64
%711 = arith.addi %701, %710 : i64
%712 = llvm.mlir.addressof @MOD : !llvm.ptr
%713 = llvm.load %712 : !llvm.ptr -> i64
%714 = arith.remsi %711, %713 : i64
%715 = arith.trunci %714 : i64 to i32
%716 = arith.addi %648, %202 : i64
%717 = llvm.getelementptr %405[%716] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %715, %717 : i32, !llvm.ptr
cf.br ^bb50
^bb49:
%718 = arith.constant 1 : i32
%719 = arith.index_cast %718 : i32 to index
%720 = arith.index_cast %194 : i32 to index
%722 = arith.constant 1 : index
%723 = arith.constant -1 : index
%724 = arith.cmpi sle, %719, %720 : index
%721 = arith.select %724, %722, %723 : index
cf.br ^bb54(%719 : index)
^bb54(%725: index):
%726 = arith.cmpi slt, %725, %720 : index
%727 = arith.cmpi sgt, %725, %720 : index
%728 = arith.select %724, %726, %727 : i1
cf.cond_br %728, ^bb55(%725 : index), ^bb56(%725 : index)
^bb55(%729: index):
%731 = llvm.load %477 : !llvm.ptr -> i64
%732 = arith.addi %731, %210 : i64
%733 = llvm.getelementptr %402[%732] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%730 = llvm.load %733 : !llvm.ptr -> i32
%734 = arith.extsi %730 : i32 to i64
%736 = llvm.load %485 : !llvm.ptr -> i64
%737 = arith.addi %736, %244 : i64
%738 = llvm.getelementptr %420[%737] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%735 = llvm.load %738 : !llvm.ptr -> i32
%739 = arith.extsi %735 : i32 to i64
%740 = arith.addi %734, %739 : i64
%741 = arith.addi %740, %443 : i64
%743 = llvm.load %479 : !llvm.ptr -> i64
%744 = arith.addi %743, %210 : i64
%745 = llvm.getelementptr %402[%744] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%742 = llvm.load %745 : !llvm.ptr -> i32
%746 = arith.extsi %742 : i32 to i64
%747 = arith.addi %741, %746 : i64
%748 = llvm.mlir.addressof @MOD : !llvm.ptr
%749 = llvm.load %748 : !llvm.ptr -> i64
%750 = arith.remsi %747, %749 : i64
%751 = arith.trunci %750 : i64 to i32
%752 = llvm.load %477 : !llvm.ptr -> i64
%753 = arith.addi %752, %202 : i64
%754 = llvm.getelementptr %402[%753] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %751, %754 : i32, !llvm.ptr
%756 = llvm.load %477 : !llvm.ptr -> i64
%757 = arith.addi %756, %210 : i64
%758 = llvm.getelementptr %405[%757] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%755 = llvm.load %758 : !llvm.ptr -> i32
%759 = arith.extsi %755 : i32 to i64
%761 = llvm.load %485 : !llvm.ptr -> i64
%762 = arith.addi %761, %244 : i64
%763 = llvm.getelementptr %426[%762] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%760 = llvm.load %763 : !llvm.ptr -> i32
%764 = arith.extsi %760 : i32 to i64
%765 = arith.addi %759, %764 : i64
%767 = llvm.load %479 : !llvm.ptr -> i64
%768 = arith.addi %767, %210 : i64
%769 = llvm.getelementptr %405[%768] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%766 = llvm.load %769 : !llvm.ptr -> i32
%770 = arith.extsi %766 : i32 to i64
%771 = arith.addi %765, %770 : i64
%772 = arith.addi %771, %435 : i64
%773 = llvm.mlir.addressof @MOD : !llvm.ptr
%774 = llvm.load %773 : !llvm.ptr -> i64
%775 = arith.remsi %772, %774 : i64
%776 = arith.trunci %775 : i64 to i32
%777 = llvm.load %477 : !llvm.ptr -> i64
%778 = arith.addi %777, %202 : i64
%779 = llvm.getelementptr %405[%778] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %776, %779 : i32, !llvm.ptr
%780 = llvm.load %479 : !llvm.ptr -> i64
llvm.store %780, %477 : i64, !llvm.ptr
%781 = llvm.load %479 : !llvm.ptr -> i64
%782 = arith.addi %781, %198 : i64
llvm.store %782, %479 : i64, !llvm.ptr
%783 = llvm.load %485 : !llvm.ptr -> i64
%784 = arith.addi %783, %245 : i64
llvm.store %784, %485 : i64, !llvm.ptr
%785 = arith.addi %729, %721 : index
cf.br ^bb54(%785 : index)
^bb56(%786: index):
%787 = arith.constant 1 : i32
%789 = arith.index_cast %194 : index to i32
%788 = arith.subi %789, %787 : i32
%791 = arith.extsi %788 : i32 to i64
%790 = arith.muli %791, %198 : i64
%792 = arith.constant 2 : i32
%794 = arith.addi %790, %210 : i64
%795 = llvm.getelementptr %402[%794] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%793 = llvm.load %795 : !llvm.ptr -> i32
%796 = arith.extsi %793 : i32 to i64
%798 = arith.extsi %792 : i32 to i64
%797 = arith.muli %798, %796 : i64
%799 = arith.addi %797, %443 : i64
%801 = arith.constant 2 : i32
%803 = arith.index_cast %194 : index to i32
%802 = arith.subi %803, %801 : i32
%805 = arith.extsi %802 : i32 to i64
%804 = arith.muli %805, %245 : i64
%806 = arith.addi %804, %244 : i64
%807 = llvm.getelementptr %420[%806] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%800 = llvm.load %807 : !llvm.ptr -> i32
%808 = arith.extsi %800 : i32 to i64
%809 = arith.addi %799, %808 : i64
%810 = llvm.mlir.addressof @MOD : !llvm.ptr
%811 = llvm.load %810 : !llvm.ptr -> i64
%812 = arith.remsi %809, %811 : i64
%813 = arith.trunci %812 : i64 to i32
%814 = arith.addi %790, %202 : i64
%815 = llvm.getelementptr %402[%814] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %813, %815 : i32, !llvm.ptr
%816 = arith.constant 2 : i32
%818 = arith.addi %790, %210 : i64
%819 = llvm.getelementptr %405[%818] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%817 = llvm.load %819 : !llvm.ptr -> i32
%820 = arith.extsi %817 : i32 to i64
%822 = arith.extsi %816 : i32 to i64
%821 = arith.muli %822, %820 : i64
%823 = arith.constant 2 : i32
%825 = arith.extsi %823 : i32 to i64
%824 = arith.muli %825, %435 : i64
%826 = arith.addi %821, %824 : i64
%828 = arith.constant 2 : i32
%830 = arith.index_cast %194 : index to i32
%829 = arith.subi %830, %828 : i32
%832 = arith.extsi %829 : i32 to i64
%831 = arith.muli %832, %245 : i64
%833 = arith.addi %831, %244 : i64
%834 = llvm.getelementptr %426[%833] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%827 = llvm.load %834 : !llvm.ptr -> i32
%835 = arith.extsi %827 : i32 to i64
%836 = arith.addi %826, %835 : i64
%837 = llvm.mlir.addressof @MOD : !llvm.ptr
%838 = llvm.load %837 : !llvm.ptr -> i64
%839 = arith.remsi %836, %838 : i64
%840 = arith.trunci %839 : i64 to i32
%841 = arith.addi %790, %202 : i64
%842 = llvm.getelementptr %405[%841] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %840, %842 : i32, !llvm.ptr
cf.br ^bb50
^bb50:
cf.br ^bb44
^bb44:
cf.br ^bb23
^bb23:
%843 = arith.addi %194, %186 : index
cf.br ^bb18(%843 : index)
^bb20(%844: index):
%845 = arith.constant 0 : i32
%846 = arith.extsi %845 : i32 to i64
%847 = llvm.mlir.constant(1 : i64) : i64
%848 = llvm.alloca %847 x i64 : (i64) -> !llvm.ptr
llvm.store %846, %848 : i64, !llvm.ptr
%849 = llvm.load %152 : !llvm.ptr -> i64
%850 = arith.constant 1 : i32
%852 = arith.extsi %850 : i32 to i64
%851 = arith.subi %849, %852 : i64
%853 = arith.constant 0 : i32
%855 = arith.extsi %853 : i32 to i64
%854 = arith.cmpi sge, %851, %855 : i64
cf.cond_br %854, ^bb57, ^bb58
^bb57:
%856 = llvm.load %848 : !llvm.ptr -> i64
%858 = llvm.load %152 : !llvm.ptr -> i64
%859 = arith.constant 1 : i32
%861 = arith.extsi %859 : i32 to i64
%860 = arith.subi %858, %861 : i64
%862 = llvm.getelementptr %133[%860] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%857 = llvm.load %862 : !llvm.ptr -> i32
%863 = arith.extsi %857 : i32 to i64
%864 = arith.addi %856, %863 : i64
llvm.store %864, %848 : i64, !llvm.ptr
cf.br ^bb59
^bb58:
cf.br ^bb59
^bb59:
%865 = llvm.load %152 : !llvm.ptr -> i64
%866 = arith.constant 2 : i32
%868 = arith.extsi %866 : i32 to i64
%867 = arith.subi %865, %868 : i64
%869 = arith.constant 0 : i32
%871 = arith.extsi %869 : i32 to i64
%870 = arith.cmpi sge, %867, %871 : i64
cf.cond_br %870, ^bb60, ^bb61
^bb60:
%872 = llvm.load %848 : !llvm.ptr -> i64
%873 = arith.constant 4 : i32
%875 = llvm.load %152 : !llvm.ptr -> i64
%876 = arith.constant 2 : i32
%878 = arith.extsi %876 : i32 to i64
%877 = arith.subi %875, %878 : i64
%879 = llvm.getelementptr %125[%877] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%874 = llvm.load %879 : !llvm.ptr -> i32
%880 = arith.extsi %874 : i32 to i64
%882 = arith.extsi %873 : i32 to i64
%881 = arith.muli %882, %880 : i64
%883 = arith.addi %872, %881 : i64
llvm.store %883, %848 : i64, !llvm.ptr
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
%884 = llvm.load %152 : !llvm.ptr -> i64
%885 = arith.constant 3 : i32
%887 = arith.extsi %885 : i32 to i64
%886 = arith.subi %884, %887 : i64
%889 = arith.constant 1 : i32
%890 = arith.extsi %889 : i32 to i64
%891 = llvm.getelementptr %33[%890] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%888 = llvm.load %891 : !llvm.ptr -> i64
%892 = arith.cmpi sge, %886, %888 : i64
%893 = scf.if %892 -> (i1) {
%895 = arith.constant 1 : i32
%896 = arith.extsi %895 : i32 to i64
%897 = llvm.getelementptr %36[%896] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%894 = llvm.load %897 : !llvm.ptr -> i64
%898 = arith.constant 0 : i32
%900 = arith.extsi %898 : i32 to i64
%899 = arith.cmpi sgt, %894, %900 : i64
scf.yield %899 : i1
} else {
%901 = arith.constant false
scf.yield %901 : i1
}
cf.cond_br %893, ^bb63, ^bb64
^bb63:
%903 = arith.constant 1 : i32
%904 = arith.extsi %903 : i32 to i64
%905 = llvm.getelementptr %33[%904] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%902 = llvm.load %905 : !llvm.ptr -> i64
%906 = arith.subi %886, %902 : i64
%907 = llvm.load %848 : !llvm.ptr -> i64
%908 = arith.constant 2 : i32
%911 = arith.constant 1 : i32
%912 = arith.extsi %911 : i32 to i64
%913 = llvm.getelementptr %81[%912] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%910 = llvm.load %913 : !llvm.ptr -> !llvm.ptr
%914 = llvm.getelementptr %910[%906] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%909 = llvm.load %914 : !llvm.ptr -> i32
%915 = arith.extsi %909 : i32 to i64
%917 = arith.extsi %908 : i32 to i64
%916 = arith.muli %917, %915 : i64
%918 = arith.addi %907, %916 : i64
%921 = arith.constant 1 : i32
%922 = arith.extsi %921 : i32 to i64
%923 = llvm.getelementptr %84[%922] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%920 = llvm.load %923 : !llvm.ptr -> !llvm.ptr
%924 = llvm.getelementptr %920[%906] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%919 = llvm.load %924 : !llvm.ptr -> i32
%925 = arith.extsi %919 : i32 to i64
%926 = arith.addi %918, %925 : i64
llvm.store %926, %848 : i64, !llvm.ptr
cf.br ^bb65
^bb64:
cf.br ^bb65
^bb65:
%927 = llvm.load %848 : !llvm.ptr -> i64
%928 = llvm.mlir.addressof @MOD : !llvm.ptr
%929 = llvm.load %928 : !llvm.ptr -> i64
%930 = arith.remsi %927, %929 : i64
%931 = arith.trunci %930 : i64 to i32
%932 = llvm.load %152 : !llvm.ptr -> i64
%933 = llvm.getelementptr %125[%932] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %931, %933 : i32, !llvm.ptr
%934 = llvm.load %152 : !llvm.ptr -> i64
%935 = arith.constant 1 : i32
%937 = arith.extsi %935 : i32 to i64
%936 = arith.cmpi sge, %934, %937 : i64
cf.cond_br %936, ^bb66, ^bb67
^bb66:
%938 = arith.constant 3 : i32
%940 = llvm.load %152 : !llvm.ptr -> i64
%941 = arith.constant 1 : i32
%943 = arith.extsi %941 : i32 to i64
%942 = arith.subi %940, %943 : i64
%944 = llvm.getelementptr %133[%942] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%939 = llvm.load %944 : !llvm.ptr -> i32
%945 = arith.extsi %939 : i32 to i64
%947 = arith.extsi %938 : i32 to i64
%946 = arith.muli %947, %945 : i64
%948 = llvm.mlir.constant(1 : i64) : i64
%949 = llvm.alloca %948 x i64 : (i64) -> !llvm.ptr
llvm.store %946, %949 : i64, !llvm.ptr
%950 = llvm.load %152 : !llvm.ptr -> i64
%951 = arith.constant 2 : i32
%953 = arith.extsi %951 : i32 to i64
%952 = arith.subi %950, %953 : i64
%954 = arith.constant 0 : i32
%956 = arith.extsi %954 : i32 to i64
%955 = arith.cmpi sge, %952, %956 : i64
cf.cond_br %955, ^bb69, ^bb70
^bb69:
%957 = llvm.load %949 : !llvm.ptr -> i64
%958 = arith.constant 3 : i32
%960 = llvm.load %152 : !llvm.ptr -> i64
%961 = arith.constant 2 : i32
%963 = arith.extsi %961 : i32 to i64
%962 = arith.subi %960, %963 : i64
%964 = llvm.getelementptr %125[%962] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%959 = llvm.load %964 : !llvm.ptr -> i32
%965 = arith.extsi %959 : i32 to i64
%967 = arith.extsi %958 : i32 to i64
%966 = arith.muli %967, %965 : i64
%968 = arith.addi %957, %966 : i64
llvm.store %968, %949 : i64, !llvm.ptr
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%969 = llvm.load %949 : !llvm.ptr -> i64
%970 = llvm.mlir.addressof @MOD : !llvm.ptr
%971 = llvm.load %970 : !llvm.ptr -> i64
%972 = arith.remsi %969, %971 : i64
%973 = arith.trunci %972 : i64 to i32
%974 = llvm.load %152 : !llvm.ptr -> i64
%975 = llvm.getelementptr %133[%974] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %973, %975 : i32, !llvm.ptr
cf.br ^bb68
^bb67:
cf.br ^bb68
^bb68:
%976 = llvm.load %152 : !llvm.ptr -> i64
%977 = arith.constant 1 : i32
%979 = arith.extsi %977 : i32 to i64
%978 = arith.addi %976, %979 : i64
llvm.store %978, %152 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%981 = llvm.mlir.addressof @M_VAL : !llvm.ptr
%982 = llvm.load %981 : !llvm.ptr -> i64
%983 = llvm.getelementptr %133[%982] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%980 = llvm.load %983 : !llvm.ptr -> i32
%984 = arith.extsi %980 : i32 to i64
%985 = arith.constant 1 : i32
%986 = arith.index_cast %985 : i32 to index
%987 = arith.index_cast %31 : i32 to index
%989 = arith.constant 1 : index
%990 = arith.constant -1 : index
%991 = arith.cmpi sle, %986, %987 : index
%988 = arith.select %991, %989, %990 : index
cf.br ^bb72(%986 : index)
^bb72(%992: index):
%993 = arith.cmpi slt, %992, %987 : index
%994 = arith.cmpi sgt, %992, %987 : index
%995 = arith.select %991, %993, %994 : i1
cf.cond_br %995, ^bb73(%992 : index), ^bb74(%992 : index)
^bb73(%996: index):
%999 = arith.index_cast %996 : index to i64
%1000 = llvm.getelementptr %81[%999] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%998 = llvm.load %1000 : !llvm.ptr -> !llvm.ptr
func.call @free(%998) : (!llvm.ptr) -> ()
%1003 = arith.index_cast %996 : index to i64
%1004 = llvm.getelementptr %84[%1003] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.ptr
%1002 = llvm.load %1004 : !llvm.ptr -> !llvm.ptr
func.call @free(%1002) : (!llvm.ptr) -> ()
%1005 = arith.addi %996, %988 : index
cf.br ^bb72(%1005 : index)
^bb74(%1006: index):
func.call @free(%81) : (!llvm.ptr) -> ()
func.call @free(%84) : (!llvm.ptr) -> ()
func.call @free(%125) : (!llvm.ptr) -> ()
func.call @free(%133) : (!llvm.ptr) -> ()
func.call @free(%33) : (!llvm.ptr) -> ()
func.call @free(%36) : (!llvm.ptr) -> ()
%1013 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1014 = llvm.call @printf(%1013, %984) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
%1015 = arith.constant 0 : i32
func.return %1015 : i32
}
}