← All problems
Problem 490
Jumping Frog — S(10^14) = sum f(n)^3 mod 10^9 via companion matrix + tensor doubling.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^4)O(n log n)
Space complexity O(n^2)O(n)
Approach Flow solution Modular DP or matrix exponentiation
Verdict Suboptimal
Flow source
# Project Euler 490
# Jumping Frog — S(10^14) = sum f(n)^3 mod 10^9 via companion matrix + tensor doubling.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
const MOD: i64 = 1000000000
const DIM: i32 = 8
const TSIZE: i32 = 512
function mod_mul(a: i64, b: i64) -> i64 {
return ((a as i128) * (b as i128) % (MOD as i128)) as i64
}
function mod_add(a: i64, b: i64) -> i64 {
let mut s: i64 = a + b
if s >= MOD { s = s - MOD }
if s < 0 { s = s + MOD }
return s
}
function mat_mul8(A: ptr<i64>, B: ptr<i64>, out: ptr<i64>) -> void {
let mut i: i32 = 0
while i < DIM {
let mut j: i32 = 0
while j < DIM {
let mut s: i128 = 0
let mut k: i32 = 0
while k < DIM {
s = s + (A[(i * DIM + k) as i64] as i128) * (B[(k * DIM + j) as i64] as i128)
k = k + 1
}
out[(i * DIM + j) as i64] = (s % (MOD as i128)) as i64
j = j + 1
}
i = i + 1
}
}
function tensor_from_vec(v: ptr<i64>, T: ptr<i64>) -> void {
let mut i: i32 = 0
while i < DIM {
let vi: i64 = v[i as i64] % MOD
let mut j: i32 = 0
while j < DIM {
let vij: i64 = mod_mul(vi, v[j as i64] % MOD)
let base: i32 = i * 64 + j * 8
let mut k: i32 = 0
while k < DIM {
T[(base + k) as i64] = mod_mul(vij, v[k as i64] % MOD)
k = k + 1
}
j = j + 1
}
i = i + 1
}
}
function tensor_transform(M: ptr<i64>, T: ptr<i64>, W: ptr<i64>, U: ptr<i64>, V: ptr<i64>) -> void {
# mode-1
let mut j: i32 = 0
while j < DIM {
let mut k: i32 = 0
while k < DIM {
let base_jk: i32 = j * 8 + k
let mut i: i32 = 0
while i < DIM {
let mut s: i128 = 0
let mut p: i32 = 0
while p < DIM {
s = s + (M[(i * DIM + p) as i64] as i128) * (T[(p * 64 + base_jk) as i64] as i128)
p = p + 1
}
U[(i * 64 + base_jk) as i64] = (s % (MOD as i128)) as i64
i = i + 1
}
k = k + 1
}
j = j + 1
}
# mode-2
let mut i2: i32 = 0
while i2 < DIM {
let ioff: i32 = i2 * 64
let mut k2: i32 = 0
while k2 < DIM {
let mut j2: i32 = 0
while j2 < DIM {
let mut s2: i128 = 0
let mut q: i32 = 0
while q < DIM {
s2 = s2 + (M[(j2 * DIM + q) as i64] as i128) * (U[(ioff + q * 8 + k2) as i64] as i128)
q = q + 1
}
V[(ioff + j2 * 8 + k2) as i64] = (s2 % (MOD as i128)) as i64
j2 = j2 + 1
}
k2 = k2 + 1
}
i2 = i2 + 1
}
# mode-3
let mut i3: i32 = 0
while i3 < DIM {
let ioff3: i32 = i3 * 64
let mut j3: i32 = 0
while j3 < DIM {
let joff: i32 = ioff3 + j3 * 8
let mut k3: i32 = 0
while k3 < DIM {
let mut s3: i128 = 0
let mut r: i32 = 0
while r < DIM {
s3 = s3 + (M[(k3 * DIM + r) as i64] as i128) * (V[(joff + r) as i64] as i128)
r = r + 1
}
W[(joff + k3) as i64] = (s3 % (MOD as i128)) as i64
k3 = k3 + 1
}
j3 = j3 + 1
}
i3 = i3 + 1
}
}
function copy_n(src: ptr<i64>, src_off: i64, dst: ptr<i64>, dst_off: i64, n: i32) -> void {
let mut i: i32 = 0
while i < n {
dst[dst_off + (i as i64)] = src[src_off + (i as i64)]
i = i + 1
}
}
function mat_mul8_off(A: ptr<i64>, Aoff: i64, B: ptr<i64>, Boff: i64, out: ptr<i64>, ooff: i64) -> void {
let mut i: i32 = 0
while i < DIM {
let mut j: i32 = 0
while j < DIM {
let mut s: i128 = 0
let mut k: i32 = 0
while k < DIM {
s = s + (A[Aoff + (i * DIM + k) as i64] as i128) * (B[Boff + (k * DIM + j) as i64] as i128)
k = k + 1
}
out[ooff + (i * DIM + j) as i64] = (s % (MOD as i128)) as i64
j = j + 1
}
i = i + 1
}
}
function tensor_transform_off(M: ptr<i64>, Moff: i64, T: ptr<i64>, Toff: i64, W: ptr<i64>, U: ptr<i64>, V: ptr<i64>) -> void {
let mut j: i32 = 0
while j < DIM {
let mut k: i32 = 0
while k < DIM {
let base_jk: i32 = j * 8 + k
let mut i: i32 = 0
while i < DIM {
let mut s: i128 = 0
let mut p: i32 = 0
while p < DIM {
s = s + (M[Moff + (i * DIM + p) as i64] as i128) * (T[Toff + (p * 64 + base_jk) as i64] as i128)
p = p + 1
}
U[(i * 64 + base_jk) as i64] = (s % (MOD as i128)) as i64
i = i + 1
}
k = k + 1
}
j = j + 1
}
let mut i2: i32 = 0
while i2 < DIM {
let ioff: i32 = i2 * 64
let mut k2: i32 = 0
while k2 < DIM {
let mut j2: i32 = 0
while j2 < DIM {
let mut s2: i128 = 0
let mut q: i32 = 0
while q < DIM {
s2 = s2 + (M[Moff + (j2 * DIM + q) as i64] as i128) * (U[(ioff + q * 8 + k2) as i64] as i128)
q = q + 1
}
V[(ioff + j2 * 8 + k2) as i64] = (s2 % (MOD as i128)) as i64
j2 = j2 + 1
}
k2 = k2 + 1
}
i2 = i2 + 1
}
let mut i3: i32 = 0
while i3 < DIM {
let ioff3: i32 = i3 * 64
let mut j3: i32 = 0
while j3 < DIM {
let joff: i32 = ioff3 + j3 * 8
let mut k3: i32 = 0
while k3 < DIM {
let mut s3: i128 = 0
let mut r: i32 = 0
while r < DIM {
s3 = s3 + (M[Moff + (k3 * DIM + r) as i64] as i128) * (V[(joff + r) as i64] as i128)
r = r + 1
}
W[(joff + k3) as i64] = (s3 % (MOD as i128)) as i64
k3 = k3 + 1
}
j3 = j3 + 1
}
i3 = i3 + 1
}
}
function sum_cubes_from_state(u: ptr<i64>, length0: i64, A: ptr<i64>) -> i64 {
if length0 <= 0 { return 0 }
let blocksP: ptr<i64> = calloc(64 * 64, 8)
let blocksT: ptr<i64> = calloc(64 * 512, 8)
let P: ptr<i64> = calloc(64, 8)
let T: ptr<i64> = calloc(512, 8)
let PT: ptr<i64> = calloc(512, 8)
let tmpP: ptr<i64> = calloc(64, 8)
let Utmp: ptr<i64> = calloc(512, 8)
let Vtmp: ptr<i64> = calloc(512, 8)
if blocksP == null || blocksT == null || P == null || T == null { return 0 }
copy_n(A, 0, P, 0, 64)
tensor_from_vec(u, T)
let mut nblocks: i32 = 0
let mut m: i64 = 1
while m <= length0 {
copy_n(P, 0, blocksP, (nblocks * 64) as i64, 64)
copy_n(T, 0, blocksT, (nblocks * 512) as i64, 512)
tensor_transform(P, T, PT, Utmp, Vtmp)
let mut i: i32 = 0
while i < TSIZE {
T[i as i64] = mod_add(T[i as i64], PT[i as i64])
i = i + 1
}
mat_mul8(P, P, tmpP)
copy_n(tmpP, 0, P, 0, 64)
m = m << 1
nblocks = nblocks + 1
}
let Q: ptr<i64> = calloc(64, 8)
let acc: ptr<i64> = calloc(512, 8)
let contrib: ptr<i64> = calloc(512, 8)
if Q == null || acc == null { return 0 }
let mut di: i32 = 0
while di < DIM {
Q[(di * DIM + di) as i64] = 1
di = di + 1
}
let mut rem: i64 = length0
let mut bit: i32 = 0
while rem > 0 {
if (rem & 1) != 0 {
tensor_transform_off(Q, 0, blocksT, (bit * 512) as i64, contrib, Utmp, Vtmp)
let mut t: i32 = 0
while t < TSIZE {
acc[t as i64] = mod_add(acc[t as i64], contrib[t as i64])
t = t + 1
}
mat_mul8_off(Q, 0, blocksP, (bit * 64) as i64, tmpP, 0)
copy_n(tmpP, 0, Q, 0, 64)
}
rem = rem >> 1
bit = bit + 1
}
let ans: i64 = acc[0]
free(contrib)
free(acc)
free(Q)
free(Vtmp)
free(Utmp)
free(tmpP)
free(PT)
free(T)
free(P)
free(blocksT)
free(blocksP)
return ans
}
function S_mod(L: i64) -> i64 {
let F: array<i64, 8> = [1, 1, 1, 2, 6, 14, 28, 56]
if L <= 0 { return 0 }
if L <= 8 {
let mut s: i64 = 0
let mut i: i64 = 0
while i < L {
let c: i64 = F[i as i32]
s = mod_add(s, mod_mul(mod_mul(c, c), c))
i = i + 1
}
return s
}
let mut prefix: i64 = 0
let mut i2: i32 = 0
while i2 < 7 {
let c: i64 = F[i2]
prefix = mod_add(prefix, mod_mul(mod_mul(c, c), c))
i2 = i2 + 1
}
let u: ptr<i64> = calloc(8, 8)
let A: ptr<i64> = calloc(64, 8)
if u == null || A == null { return 0 }
u[0] = F[7]
u[1] = F[6]
u[2] = F[5]
u[3] = F[4]
u[4] = F[3]
u[5] = F[2]
u[6] = F[1]
u[7] = F[0]
# companion: f(n+1) = 2f(n) - f(n-1) + 2f(n-2) + f(n-3) + f(n-4) - f(n-6) - f(n-7)
let coeffs: array<i64, 8> = [2, -1, 2, 1, 1, 0, -1, -1]
let mut c: i32 = 0
while c < DIM {
let mut v: i64 = coeffs[c] % MOD
if v < 0 { v = v + MOD }
A[c as i64] = v
c = c + 1
}
let mut r: i32 = 1
while r < DIM {
A[(r * DIM + (r - 1)) as i64] = 1
r = r + 1
}
let tail: i64 = sum_cubes_from_state(u, L - 7, A)
free(A)
free(u)
return mod_add(prefix, tail)
}
function main() -> i32 {
let ans: i64 = S_mod(100000000000000)
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; }
int64_t mod_mul_i64_i64(int64_t a, int64_t b);
int64_t mod_add_i64_i64(int64_t a, int64_t b);
void mat_mul8_ptr_i64_ptr_i64_ptr_i64(int64_t* A, int64_t* B, int64_t* out);
void tensor_from_vec_ptr_i64_ptr_i64(int64_t* v, int64_t* T);
void tensor_transform_ptr_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64(int64_t* M, int64_t* T, int64_t* W, int64_t* U, int64_t* V);
void copy_n_ptr_i64_i64_ptr_i64_i64_i32(int64_t* src, int64_t src_off, int64_t* dst, int64_t dst_off, int32_t n);
void mat_mul8_off_ptr_i64_i64_ptr_i64_i64_ptr_i64_i64(int64_t* A, int64_t Aoff, int64_t* B, int64_t Boff, int64_t* out, int64_t ooff);
void tensor_transform_off_ptr_i64_i64_ptr_i64_i64_ptr_i64_ptr_i64_ptr_i64(int64_t* M, int64_t Moff, int64_t* T, int64_t Toff, int64_t* W, int64_t* U, int64_t* V);
int64_t sum_cubes_from_state_ptr_i64_i64_ptr_i64(int64_t* u, int64_t length0, int64_t* A);
int64_t S_mod_i64(int64_t L);
int32_t main(void);
static const int64_t MOD = 1000000000;
static const int32_t DIM = 8;
static const int32_t TSIZE = 512;
int64_t mod_mul_i64_i64(int64_t a, int64_t b) {
return ((int64_t)(FLOW_CHECKED_MOD(((((__int128)(a)) * ((__int128)(b)))), (((__int128)(MOD))))));
}
int64_t mod_add_i64_i64(int64_t a, int64_t b) {
int64_t s = (a + b);
if (s >= MOD) {
s = (s - MOD);
}
if (s < 0) {
s = (s + MOD);
}
return s;
}
void mat_mul8_ptr_i64_ptr_i64_ptr_i64(int64_t* A, int64_t* B, int64_t* out) {
int32_t i = 0;
while (i < DIM) {
int32_t j = 0;
while (j < DIM) {
__int128 s = 0;
int32_t k = 0;
while (k < DIM) {
s = (s + (((__int128)(A[((int64_t)(((i * DIM) + k)))])) * ((__int128)(B[((int64_t)(((k * DIM) + j)))]))));
k = (k + 1);
}
out[((int64_t)(((i * DIM) + j)))] = ((int64_t)(FLOW_CHECKED_MOD((s), (((__int128)(MOD))))));
j = (j + 1);
}
i = (i + 1);
}
}
void tensor_from_vec_ptr_i64_ptr_i64(int64_t* v, int64_t* T) {
int32_t i = 0;
while (i < DIM) {
int64_t vi = FLOW_CHECKED_MOD((v[((int64_t)(i))]), (MOD));
int32_t j = 0;
while (j < DIM) {
int64_t vij = mod_mul_i64_i64(vi, FLOW_CHECKED_MOD((v[((int64_t)(j))]), (MOD)));
int32_t base = ((i * 64) + (j * 8));
int32_t k = 0;
while (k < DIM) {
T[((int64_t)((base + k)))] = mod_mul_i64_i64(vij, FLOW_CHECKED_MOD((v[((int64_t)(k))]), (MOD)));
k = (k + 1);
}
j = (j + 1);
}
i = (i + 1);
}
}
void tensor_transform_ptr_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64(int64_t* M, int64_t* T, int64_t* W, int64_t* U, int64_t* V) {
int32_t j = 0;
while (j < DIM) {
int32_t k = 0;
while (k < DIM) {
int32_t base_jk = ((j * 8) + k);
int32_t i = 0;
while (i < DIM) {
__int128 s = 0;
int32_t p = 0;
while (p < DIM) {
s = (s + (((__int128)(M[((int64_t)(((i * DIM) + p)))])) * ((__int128)(T[((int64_t)(((p * 64) + base_jk)))]))));
p = (p + 1);
}
U[((int64_t)(((i * 64) + base_jk)))] = ((int64_t)(FLOW_CHECKED_MOD((s), (((__int128)(MOD))))));
i = (i + 1);
}
k = (k + 1);
}
j = (j + 1);
}
int32_t i2 = 0;
while (i2 < DIM) {
int32_t ioff = (i2 * 64);
int32_t k2 = 0;
while (k2 < DIM) {
int32_t j2 = 0;
while (j2 < DIM) {
__int128 s2 = 0;
int32_t q = 0;
while (q < DIM) {
s2 = (s2 + (((__int128)(M[((int64_t)(((j2 * DIM) + q)))])) * ((__int128)(U[((int64_t)(((ioff + (q * 8)) + k2)))]))));
q = (q + 1);
}
V[((int64_t)(((ioff + (j2 * 8)) + k2)))] = ((int64_t)(FLOW_CHECKED_MOD((s2), (((__int128)(MOD))))));
j2 = (j2 + 1);
}
k2 = (k2 + 1);
}
i2 = (i2 + 1);
}
int32_t i3 = 0;
while (i3 < DIM) {
int32_t ioff3 = (i3 * 64);
int32_t j3 = 0;
while (j3 < DIM) {
int32_t joff = (ioff3 + (j3 * 8));
int32_t k3 = 0;
while (k3 < DIM) {
__int128 s3 = 0;
int32_t r = 0;
while (r < DIM) {
s3 = (s3 + (((__int128)(M[((int64_t)(((k3 * DIM) + r)))])) * ((__int128)(V[((int64_t)((joff + r)))]))));
r = (r + 1);
}
W[((int64_t)((joff + k3)))] = ((int64_t)(FLOW_CHECKED_MOD((s3), (((__int128)(MOD))))));
k3 = (k3 + 1);
}
j3 = (j3 + 1);
}
i3 = (i3 + 1);
}
}
void copy_n_ptr_i64_i64_ptr_i64_i64_i32(int64_t* src, int64_t src_off, int64_t* dst, int64_t dst_off, int32_t n) {
int32_t i = 0;
while (i < n) {
dst[(dst_off + ((int64_t)(i)))] = src[(src_off + ((int64_t)(i)))];
i = (i + 1);
}
}
void mat_mul8_off_ptr_i64_i64_ptr_i64_i64_ptr_i64_i64(int64_t* A, int64_t Aoff, int64_t* B, int64_t Boff, int64_t* out, int64_t ooff) {
int32_t i = 0;
while (i < DIM) {
int32_t j = 0;
while (j < DIM) {
__int128 s = 0;
int32_t k = 0;
while (k < DIM) {
s = (s + (((__int128)(A[(Aoff + ((int64_t)(((i * DIM) + k))))])) * ((__int128)(B[(Boff + ((int64_t)(((k * DIM) + j))))]))));
k = (k + 1);
}
out[(ooff + ((int64_t)(((i * DIM) + j))))] = ((int64_t)(FLOW_CHECKED_MOD((s), (((__int128)(MOD))))));
j = (j + 1);
}
i = (i + 1);
}
}
void tensor_transform_off_ptr_i64_i64_ptr_i64_i64_ptr_i64_ptr_i64_ptr_i64(int64_t* M, int64_t Moff, int64_t* T, int64_t Toff, int64_t* W, int64_t* U, int64_t* V) {
int32_t j = 0;
while (j < DIM) {
int32_t k = 0;
while (k < DIM) {
int32_t base_jk = ((j * 8) + k);
int32_t i = 0;
while (i < DIM) {
__int128 s = 0;
int32_t p = 0;
while (p < DIM) {
s = (s + (((__int128)(M[(Moff + ((int64_t)(((i * DIM) + p))))])) * ((__int128)(T[(Toff + ((int64_t)(((p * 64) + base_jk))))]))));
p = (p + 1);
}
U[((int64_t)(((i * 64) + base_jk)))] = ((int64_t)(FLOW_CHECKED_MOD((s), (((__int128)(MOD))))));
i = (i + 1);
}
k = (k + 1);
}
j = (j + 1);
}
int32_t i2 = 0;
while (i2 < DIM) {
int32_t ioff = (i2 * 64);
int32_t k2 = 0;
while (k2 < DIM) {
int32_t j2 = 0;
while (j2 < DIM) {
__int128 s2 = 0;
int32_t q = 0;
while (q < DIM) {
s2 = (s2 + (((__int128)(M[(Moff + ((int64_t)(((j2 * DIM) + q))))])) * ((__int128)(U[((int64_t)(((ioff + (q * 8)) + k2)))]))));
q = (q + 1);
}
V[((int64_t)(((ioff + (j2 * 8)) + k2)))] = ((int64_t)(FLOW_CHECKED_MOD((s2), (((__int128)(MOD))))));
j2 = (j2 + 1);
}
k2 = (k2 + 1);
}
i2 = (i2 + 1);
}
int32_t i3 = 0;
while (i3 < DIM) {
int32_t ioff3 = (i3 * 64);
int32_t j3 = 0;
while (j3 < DIM) {
int32_t joff = (ioff3 + (j3 * 8));
int32_t k3 = 0;
while (k3 < DIM) {
__int128 s3 = 0;
int32_t r = 0;
while (r < DIM) {
s3 = (s3 + (((__int128)(M[(Moff + ((int64_t)(((k3 * DIM) + r))))])) * ((__int128)(V[((int64_t)((joff + r)))]))));
r = (r + 1);
}
W[((int64_t)((joff + k3)))] = ((int64_t)(FLOW_CHECKED_MOD((s3), (((__int128)(MOD))))));
k3 = (k3 + 1);
}
j3 = (j3 + 1);
}
i3 = (i3 + 1);
}
}
int64_t sum_cubes_from_state_ptr_i64_i64_ptr_i64(int64_t* u, int64_t length0, int64_t* A) {
if (length0 <= 0) {
return 0;
}
int64_t* blocksP = (int64_t*)(calloc((64 * 64), 8));
int64_t* blocksT = (int64_t*)(calloc((64 * 512), 8));
int64_t* P = (int64_t*)(calloc(64, 8));
int64_t* T = (int64_t*)(calloc(512, 8));
int64_t* PT = (int64_t*)(calloc(512, 8));
int64_t* tmpP = (int64_t*)(calloc(64, 8));
int64_t* Utmp = (int64_t*)(calloc(512, 8));
int64_t* Vtmp = (int64_t*)(calloc(512, 8));
if ((((blocksP == NULL || blocksT == NULL) || P == NULL) || T == NULL)) {
return 0;
}
copy_n_ptr_i64_i64_ptr_i64_i64_i32(A, 0, P, 0, 64);
tensor_from_vec_ptr_i64_ptr_i64(u, T);
int32_t nblocks = 0;
int64_t m = 1;
while (m <= length0) {
copy_n_ptr_i64_i64_ptr_i64_i64_i32(P, 0, blocksP, ((int64_t)((nblocks * 64))), 64);
copy_n_ptr_i64_i64_ptr_i64_i64_i32(T, 0, blocksT, ((int64_t)((nblocks * 512))), 512);
tensor_transform_ptr_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64(P, T, PT, Utmp, Vtmp);
int32_t i = 0;
while (i < TSIZE) {
T[((int64_t)(i))] = mod_add_i64_i64(T[((int64_t)(i))], PT[((int64_t)(i))]);
i = (i + 1);
}
mat_mul8_ptr_i64_ptr_i64_ptr_i64(P, P, tmpP);
copy_n_ptr_i64_i64_ptr_i64_i64_i32(tmpP, 0, P, 0, 64);
m = FLOW_CHECKED_SHL((m), (1));
nblocks = (nblocks + 1);
}
int64_t* Q = (int64_t*)(calloc(64, 8));
int64_t* acc = (int64_t*)(calloc(512, 8));
int64_t* contrib = (int64_t*)(calloc(512, 8));
if ((Q == NULL || acc == NULL)) {
return 0;
}
int32_t di = 0;
while (di < DIM) {
Q[((int64_t)(((di * DIM) + di)))] = 1;
di = (di + 1);
}
int64_t rem = length0;
int32_t bit = 0;
while (rem > 0) {
if ((rem & 1) != 0) {
tensor_transform_off_ptr_i64_i64_ptr_i64_i64_ptr_i64_ptr_i64_ptr_i64(Q, 0, blocksT, ((int64_t)((bit * 512))), contrib, Utmp, Vtmp);
int32_t t = 0;
while (t < TSIZE) {
acc[((int64_t)(t))] = mod_add_i64_i64(acc[((int64_t)(t))], contrib[((int64_t)(t))]);
t = (t + 1);
}
mat_mul8_off_ptr_i64_i64_ptr_i64_i64_ptr_i64_i64(Q, 0, blocksP, ((int64_t)((bit * 64))), tmpP, 0);
copy_n_ptr_i64_i64_ptr_i64_i64_i32(tmpP, 0, Q, 0, 64);
}
rem = FLOW_CHECKED_SHR((rem), (1));
bit = (bit + 1);
}
int64_t ans = acc[0];
free(contrib);
free(acc);
free(Q);
free(Vtmp);
free(Utmp);
free(tmpP);
free(PT);
free(T);
free(P);
free(blocksT);
free(blocksP);
return ans;
}
int64_t S_mod_i64(int64_t L) {
int64_t F[8] = { 1, 1, 1, 2, 6, 14, 28, 56 };
if (L <= 0) {
return 0;
}
if (L <= 8) {
int64_t s = 0;
int64_t i = 0;
while (i < L) {
int64_t c = (((unsigned)(((int32_t)(i))) < 8) ? F[((int32_t)(i))] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((int32_t)(i))), 8), flow_fault_handler("array index out of bounds"), F[0]));
s = mod_add_i64_i64(s, mod_mul_i64_i64(mod_mul_i64_i64(c, c), c));
i = (i + 1);
}
return s;
}
int64_t prefix = 0;
int32_t i2 = 0;
while (i2 < 7) {
int64_t c = (((unsigned)(i2) < 8) ? F[i2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(i2), 8), flow_fault_handler("array index out of bounds"), F[0]));
prefix = mod_add_i64_i64(prefix, mod_mul_i64_i64(mod_mul_i64_i64(c, c), c));
i2 = (i2 + 1);
}
int64_t* u = (int64_t*)(calloc(8, 8));
int64_t* A = (int64_t*)(calloc(64, 8));
if ((u == NULL || A == NULL)) {
return 0;
}
u[0] = (((unsigned)(7) < 8) ? F[7] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(7), 8), flow_fault_handler("array index out of bounds"), F[0]));
u[1] = (((unsigned)(6) < 8) ? F[6] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(6), 8), flow_fault_handler("array index out of bounds"), F[0]));
u[2] = (((unsigned)(5) < 8) ? F[5] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(5), 8), flow_fault_handler("array index out of bounds"), F[0]));
u[3] = (((unsigned)(4) < 8) ? F[4] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(4), 8), flow_fault_handler("array index out of bounds"), F[0]));
u[4] = (((unsigned)(3) < 8) ? F[3] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(3), 8), flow_fault_handler("array index out of bounds"), F[0]));
u[5] = (((unsigned)(2) < 8) ? F[2] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(2), 8), flow_fault_handler("array index out of bounds"), F[0]));
u[6] = (((unsigned)(1) < 8) ? F[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 8), flow_fault_handler("array index out of bounds"), F[0]));
u[7] = (((unsigned)(0) < 8) ? F[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 8), flow_fault_handler("array index out of bounds"), F[0]));
int64_t coeffs[8] = { 2, (-1), 2, 1, 1, 0, (-1), (-1) };
int32_t c = 0;
while (c < DIM) {
int64_t v = FLOW_CHECKED_MOD(((((unsigned)(c) < 8) ? coeffs[c] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(c), 8), flow_fault_handler("array index out of bounds"), coeffs[0]))), (MOD));
if (v < 0) {
v = (v + MOD);
}
A[((int64_t)(c))] = v;
c = (c + 1);
}
int32_t r = 1;
while (r < DIM) {
A[((int64_t)(((r * DIM) + (r - 1))))] = 1;
r = (r + 1);
}
int64_t tail = sum_cubes_from_state_ptr_i64_i64_ptr_i64(u, (L - 7), A);
free(A);
free(u);
return mod_add_i64_i64(prefix, tail);
}
int32_t main(void) {
int64_t ans = S_mod_i64(100000000000000);
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) -> ()
// Constant: MOD
llvm.mlir.global internal constant @MOD(1000000000 : i64) : i64
// Constant: DIM
llvm.mlir.global internal constant @DIM(8 : i32) : i32
// Constant: TSIZE
llvm.mlir.global internal constant @TSIZE(512 : i32) : i32
func.func @mod_mul(%arg0: i64, %arg1: i64) -> i64 {
%0 = arith.extsi %arg0 : i64 to i128
%1 = arith.extsi %arg1 : i64 to i128
%3 = arith.trunci %0 : i128 to i64
%4 = arith.trunci %1 : i128 to i64
%2 = arith.muli %3, %4 : i64
%5 = llvm.mlir.addressof @MOD : !llvm.ptr
%6 = llvm.load %5 : !llvm.ptr -> i64
%7 = arith.extsi %6 : i64 to i128
%9 = arith.trunci %7 : i128 to i64
%8 = arith.remsi %2, %9 : i64
func.return %8 : i64
}
func.func @mod_add(%arg0: i64, %arg1: i64) -> i64 {
%10 = arith.addi %arg0, %arg1 : 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 = llvm.load %12 : !llvm.ptr -> i64
%14 = llvm.mlir.addressof @MOD : !llvm.ptr
%15 = llvm.load %14 : !llvm.ptr -> i64
%16 = arith.cmpi sge, %13, %15 : i64
cf.cond_br %16, ^bb0, ^bb1
^bb0:
%17 = llvm.load %12 : !llvm.ptr -> i64
%18 = llvm.mlir.addressof @MOD : !llvm.ptr
%19 = llvm.load %18 : !llvm.ptr -> i64
%20 = arith.subi %17, %19 : i64
llvm.store %20, %12 : i64, !llvm.ptr
cf.br ^bb2
^bb1:
cf.br ^bb2
^bb2:
%21 = llvm.load %12 : !llvm.ptr -> i64
%22 = arith.constant 0 : i32
%24 = arith.extsi %22 : i32 to i64
%23 = arith.cmpi slt, %21, %24 : i64
cf.cond_br %23, ^bb3, ^bb4
^bb3:
%25 = llvm.load %12 : !llvm.ptr -> i64
%26 = llvm.mlir.addressof @MOD : !llvm.ptr
%27 = llvm.load %26 : !llvm.ptr -> i64
%28 = arith.addi %25, %27 : i64
llvm.store %28, %12 : i64, !llvm.ptr
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
%29 = llvm.load %12 : !llvm.ptr -> i64
func.return %29 : i64
}
func.func @mat_mul8(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> () {
%30 = arith.constant 0 : i32
%31 = llvm.mlir.constant(1 : i64) : i64
%32 = llvm.alloca %31 x i32 : (i64) -> !llvm.ptr
llvm.store %30, %32 : i32, !llvm.ptr
cf.br ^bb6
^bb6:
%33 = llvm.load %32 : !llvm.ptr -> i32
%34 = llvm.mlir.addressof @DIM : !llvm.ptr
%35 = llvm.load %34 : !llvm.ptr -> i32
%36 = arith.cmpi slt, %33, %35 : i32
cf.cond_br %36, ^bb7, ^bb8
^bb7:
%37 = arith.constant 0 : i32
%38 = llvm.mlir.constant(1 : i64) : i64
%39 = llvm.alloca %38 x i32 : (i64) -> !llvm.ptr
llvm.store %37, %39 : i32, !llvm.ptr
cf.br ^bb9
^bb9:
%40 = llvm.load %39 : !llvm.ptr -> i32
%41 = llvm.mlir.addressof @DIM : !llvm.ptr
%42 = llvm.load %41 : !llvm.ptr -> i32
%43 = arith.cmpi slt, %40, %42 : i32
cf.cond_br %43, ^bb10, ^bb11
^bb10:
%44 = arith.constant 0 : i32
%45 = arith.extsi %44 : i32 to i128
%46 = llvm.mlir.constant(1 : i64) : i64
%47 = llvm.alloca %46 x i128 : (i64) -> !llvm.ptr
llvm.store %45, %47 : i128, !llvm.ptr
%48 = arith.constant 0 : i32
%49 = llvm.mlir.constant(1 : i64) : i64
%50 = llvm.alloca %49 x i32 : (i64) -> !llvm.ptr
llvm.store %48, %50 : i32, !llvm.ptr
cf.br ^bb12
^bb12:
%51 = llvm.load %50 : !llvm.ptr -> i32
%52 = llvm.mlir.addressof @DIM : !llvm.ptr
%53 = llvm.load %52 : !llvm.ptr -> i32
%54 = arith.cmpi slt, %51, %53 : i32
cf.cond_br %54, ^bb13, ^bb14
^bb13:
%55 = llvm.load %47 : !llvm.ptr -> i128
%57 = llvm.load %32 : !llvm.ptr -> i32
%58 = llvm.mlir.addressof @DIM : !llvm.ptr
%59 = llvm.load %58 : !llvm.ptr -> i32
%60 = arith.muli %57, %59 : i32
%61 = llvm.load %50 : !llvm.ptr -> i32
%62 = arith.addi %60, %61 : i32
%63 = arith.extsi %62 : i32 to i64
%64 = llvm.getelementptr %arg0[%63] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%56 = llvm.load %64 : !llvm.ptr -> i64
%65 = arith.extsi %56 : i64 to i128
%67 = llvm.load %50 : !llvm.ptr -> i32
%68 = llvm.mlir.addressof @DIM : !llvm.ptr
%69 = llvm.load %68 : !llvm.ptr -> i32
%70 = arith.muli %67, %69 : i32
%71 = llvm.load %39 : !llvm.ptr -> i32
%72 = arith.addi %70, %71 : i32
%73 = arith.extsi %72 : i32 to i64
%74 = llvm.getelementptr %arg1[%73] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%66 = llvm.load %74 : !llvm.ptr -> i64
%75 = arith.extsi %66 : i64 to i128
%77 = arith.trunci %65 : i128 to i64
%78 = arith.trunci %75 : i128 to i64
%76 = arith.muli %77, %78 : i64
%80 = arith.trunci %55 : i128 to i64
%79 = arith.addi %80, %76 : i64
%81 = arith.extsi %79 : i64 to i128
llvm.store %81, %47 : i128, !llvm.ptr
%82 = llvm.load %50 : !llvm.ptr -> i32
%83 = arith.constant 1 : i32
%84 = arith.addi %82, %83 : i32
llvm.store %84, %50 : i32, !llvm.ptr
cf.br ^bb12
^bb14:
%85 = llvm.load %47 : !llvm.ptr -> i128
%86 = llvm.mlir.addressof @MOD : !llvm.ptr
%87 = llvm.load %86 : !llvm.ptr -> i64
%88 = arith.extsi %87 : i64 to i128
%90 = arith.trunci %85 : i128 to i64
%91 = arith.trunci %88 : i128 to i64
%89 = arith.remsi %90, %91 : i64
%92 = llvm.load %32 : !llvm.ptr -> i32
%93 = llvm.mlir.addressof @DIM : !llvm.ptr
%94 = llvm.load %93 : !llvm.ptr -> i32
%95 = arith.muli %92, %94 : i32
%96 = llvm.load %39 : !llvm.ptr -> i32
%97 = arith.addi %95, %96 : i32
%98 = arith.extsi %97 : i32 to i64
%99 = llvm.getelementptr %arg2[%98] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %89, %99 : i64, !llvm.ptr
%100 = llvm.load %39 : !llvm.ptr -> i32
%101 = arith.constant 1 : i32
%102 = arith.addi %100, %101 : i32
llvm.store %102, %39 : i32, !llvm.ptr
cf.br ^bb9
^bb11:
%103 = llvm.load %32 : !llvm.ptr -> i32
%104 = arith.constant 1 : i32
%105 = arith.addi %103, %104 : i32
llvm.store %105, %32 : i32, !llvm.ptr
cf.br ^bb6
^bb8:
func.return
}
func.func @tensor_from_vec(%arg0: !llvm.ptr, %arg1: !llvm.ptr) -> () {
%106 = arith.constant 0 : i32
%107 = llvm.mlir.constant(1 : i64) : i64
%108 = llvm.alloca %107 x i32 : (i64) -> !llvm.ptr
llvm.store %106, %108 : i32, !llvm.ptr
cf.br ^bb15
^bb15:
%109 = llvm.load %108 : !llvm.ptr -> i32
%110 = llvm.mlir.addressof @DIM : !llvm.ptr
%111 = llvm.load %110 : !llvm.ptr -> i32
%112 = arith.cmpi slt, %109, %111 : i32
cf.cond_br %112, ^bb16, ^bb17
^bb16:
%114 = llvm.load %108 : !llvm.ptr -> i32
%115 = arith.extsi %114 : i32 to i64
%116 = llvm.getelementptr %arg0[%115] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%113 = llvm.load %116 : !llvm.ptr -> i64
%117 = llvm.mlir.addressof @MOD : !llvm.ptr
%118 = llvm.load %117 : !llvm.ptr -> i64
%119 = arith.remsi %113, %118 : i64
%120 = arith.constant 0 : i32
%121 = llvm.mlir.constant(1 : i64) : i64
%122 = llvm.alloca %121 x i32 : (i64) -> !llvm.ptr
llvm.store %120, %122 : i32, !llvm.ptr
cf.br ^bb18
^bb18:
%123 = llvm.load %122 : !llvm.ptr -> i32
%124 = llvm.mlir.addressof @DIM : !llvm.ptr
%125 = llvm.load %124 : !llvm.ptr -> i32
%126 = arith.cmpi slt, %123, %125 : i32
cf.cond_br %126, ^bb19, ^bb20
^bb19:
%129 = llvm.load %122 : !llvm.ptr -> i32
%130 = arith.extsi %129 : i32 to i64
%131 = llvm.getelementptr %arg0[%130] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%128 = llvm.load %131 : !llvm.ptr -> i64
%132 = llvm.mlir.addressof @MOD : !llvm.ptr
%133 = llvm.load %132 : !llvm.ptr -> i64
%134 = arith.remsi %128, %133 : i64
%127 = func.call @mod_mul(%119, %134) : (i64, i64) -> i64
%135 = llvm.load %108 : !llvm.ptr -> i32
%136 = arith.constant 64 : i32
%137 = arith.muli %135, %136 : i32
%138 = llvm.load %122 : !llvm.ptr -> i32
%139 = arith.constant 8 : i32
%140 = arith.muli %138, %139 : i32
%141 = arith.addi %137, %140 : i32
%142 = arith.constant 0 : i32
%143 = llvm.mlir.constant(1 : i64) : i64
%144 = llvm.alloca %143 x i32 : (i64) -> !llvm.ptr
llvm.store %142, %144 : i32, !llvm.ptr
cf.br ^bb21
^bb21:
%145 = llvm.load %144 : !llvm.ptr -> i32
%146 = llvm.mlir.addressof @DIM : !llvm.ptr
%147 = llvm.load %146 : !llvm.ptr -> i32
%148 = arith.cmpi slt, %145, %147 : i32
cf.cond_br %148, ^bb22, ^bb23
^bb22:
%151 = llvm.load %144 : !llvm.ptr -> i32
%152 = arith.extsi %151 : i32 to i64
%153 = llvm.getelementptr %arg0[%152] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%150 = llvm.load %153 : !llvm.ptr -> i64
%154 = llvm.mlir.addressof @MOD : !llvm.ptr
%155 = llvm.load %154 : !llvm.ptr -> i64
%156 = arith.remsi %150, %155 : i64
%149 = func.call @mod_mul(%127, %156) : (i64, i64) -> i64
%157 = llvm.load %144 : !llvm.ptr -> i32
%158 = arith.addi %141, %157 : i32
%159 = arith.extsi %158 : i32 to i64
%160 = llvm.getelementptr %arg1[%159] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %149, %160 : i64, !llvm.ptr
%161 = llvm.load %144 : !llvm.ptr -> i32
%162 = arith.constant 1 : i32
%163 = arith.addi %161, %162 : i32
llvm.store %163, %144 : i32, !llvm.ptr
cf.br ^bb21
^bb23:
%164 = llvm.load %122 : !llvm.ptr -> i32
%165 = arith.constant 1 : i32
%166 = arith.addi %164, %165 : i32
llvm.store %166, %122 : i32, !llvm.ptr
cf.br ^bb18
^bb20:
%167 = llvm.load %108 : !llvm.ptr -> i32
%168 = arith.constant 1 : i32
%169 = arith.addi %167, %168 : i32
llvm.store %169, %108 : i32, !llvm.ptr
cf.br ^bb15
^bb17:
func.return
}
func.func @tensor_transform(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr) -> () {
%170 = arith.constant 0 : i32
%171 = llvm.mlir.constant(1 : i64) : i64
%172 = llvm.alloca %171 x i32 : (i64) -> !llvm.ptr
llvm.store %170, %172 : i32, !llvm.ptr
cf.br ^bb24
^bb24:
%173 = llvm.load %172 : !llvm.ptr -> i32
%174 = llvm.mlir.addressof @DIM : !llvm.ptr
%175 = llvm.load %174 : !llvm.ptr -> i32
%176 = arith.cmpi slt, %173, %175 : i32
cf.cond_br %176, ^bb25, ^bb26
^bb25:
%177 = arith.constant 0 : i32
%178 = llvm.mlir.constant(1 : i64) : i64
%179 = llvm.alloca %178 x i32 : (i64) -> !llvm.ptr
llvm.store %177, %179 : i32, !llvm.ptr
cf.br ^bb27
^bb27:
%180 = llvm.load %179 : !llvm.ptr -> i32
%181 = llvm.mlir.addressof @DIM : !llvm.ptr
%182 = llvm.load %181 : !llvm.ptr -> i32
%183 = arith.cmpi slt, %180, %182 : i32
cf.cond_br %183, ^bb28, ^bb29
^bb28:
%184 = llvm.load %172 : !llvm.ptr -> i32
%185 = arith.constant 8 : i32
%186 = arith.muli %184, %185 : i32
%187 = llvm.load %179 : !llvm.ptr -> i32
%188 = arith.addi %186, %187 : i32
%189 = arith.constant 0 : i32
%190 = llvm.mlir.constant(1 : i64) : i64
%191 = llvm.alloca %190 x i32 : (i64) -> !llvm.ptr
llvm.store %189, %191 : i32, !llvm.ptr
cf.br ^bb30
^bb30:
%192 = llvm.load %191 : !llvm.ptr -> i32
%193 = llvm.mlir.addressof @DIM : !llvm.ptr
%194 = llvm.load %193 : !llvm.ptr -> i32
%195 = arith.cmpi slt, %192, %194 : i32
cf.cond_br %195, ^bb31, ^bb32
^bb31:
%196 = arith.constant 0 : i32
%197 = arith.extsi %196 : i32 to i128
%198 = llvm.mlir.constant(1 : i64) : i64
%199 = llvm.alloca %198 x i128 : (i64) -> !llvm.ptr
llvm.store %197, %199 : i128, !llvm.ptr
%200 = arith.constant 0 : i32
%201 = llvm.mlir.constant(1 : i64) : i64
%202 = llvm.alloca %201 x i32 : (i64) -> !llvm.ptr
llvm.store %200, %202 : i32, !llvm.ptr
cf.br ^bb33
^bb33:
%203 = llvm.load %202 : !llvm.ptr -> i32
%204 = llvm.mlir.addressof @DIM : !llvm.ptr
%205 = llvm.load %204 : !llvm.ptr -> i32
%206 = arith.cmpi slt, %203, %205 : i32
cf.cond_br %206, ^bb34, ^bb35
^bb34:
%207 = llvm.load %199 : !llvm.ptr -> i128
%209 = llvm.load %191 : !llvm.ptr -> i32
%210 = llvm.mlir.addressof @DIM : !llvm.ptr
%211 = llvm.load %210 : !llvm.ptr -> i32
%212 = arith.muli %209, %211 : i32
%213 = llvm.load %202 : !llvm.ptr -> i32
%214 = arith.addi %212, %213 : i32
%215 = arith.extsi %214 : i32 to i64
%216 = llvm.getelementptr %arg0[%215] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%208 = llvm.load %216 : !llvm.ptr -> i64
%217 = arith.extsi %208 : i64 to i128
%219 = llvm.load %202 : !llvm.ptr -> i32
%220 = arith.constant 64 : i32
%221 = arith.muli %219, %220 : i32
%222 = arith.addi %221, %188 : i32
%223 = arith.extsi %222 : i32 to i64
%224 = llvm.getelementptr %arg1[%223] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%218 = llvm.load %224 : !llvm.ptr -> i64
%225 = arith.extsi %218 : i64 to i128
%227 = arith.trunci %217 : i128 to i64
%228 = arith.trunci %225 : i128 to i64
%226 = arith.muli %227, %228 : i64
%230 = arith.trunci %207 : i128 to i64
%229 = arith.addi %230, %226 : i64
%231 = arith.extsi %229 : i64 to i128
llvm.store %231, %199 : i128, !llvm.ptr
%232 = llvm.load %202 : !llvm.ptr -> i32
%233 = arith.constant 1 : i32
%234 = arith.addi %232, %233 : i32
llvm.store %234, %202 : i32, !llvm.ptr
cf.br ^bb33
^bb35:
%235 = llvm.load %199 : !llvm.ptr -> i128
%236 = llvm.mlir.addressof @MOD : !llvm.ptr
%237 = llvm.load %236 : !llvm.ptr -> i64
%238 = arith.extsi %237 : i64 to i128
%240 = arith.trunci %235 : i128 to i64
%241 = arith.trunci %238 : i128 to i64
%239 = arith.remsi %240, %241 : i64
%242 = llvm.load %191 : !llvm.ptr -> i32
%243 = arith.constant 64 : i32
%244 = arith.muli %242, %243 : i32
%245 = arith.addi %244, %188 : i32
%246 = arith.extsi %245 : i32 to i64
%247 = llvm.getelementptr %arg3[%246] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %239, %247 : i64, !llvm.ptr
%248 = llvm.load %191 : !llvm.ptr -> i32
%249 = arith.constant 1 : i32
%250 = arith.addi %248, %249 : i32
llvm.store %250, %191 : i32, !llvm.ptr
cf.br ^bb30
^bb32:
%251 = llvm.load %179 : !llvm.ptr -> i32
%252 = arith.constant 1 : i32
%253 = arith.addi %251, %252 : i32
llvm.store %253, %179 : i32, !llvm.ptr
cf.br ^bb27
^bb29:
%254 = llvm.load %172 : !llvm.ptr -> i32
%255 = arith.constant 1 : i32
%256 = arith.addi %254, %255 : i32
llvm.store %256, %172 : i32, !llvm.ptr
cf.br ^bb24
^bb26:
%257 = arith.constant 0 : i32
%258 = llvm.mlir.constant(1 : i64) : i64
%259 = llvm.alloca %258 x i32 : (i64) -> !llvm.ptr
llvm.store %257, %259 : i32, !llvm.ptr
cf.br ^bb36
^bb36:
%260 = llvm.load %259 : !llvm.ptr -> i32
%261 = llvm.mlir.addressof @DIM : !llvm.ptr
%262 = llvm.load %261 : !llvm.ptr -> i32
%263 = arith.cmpi slt, %260, %262 : i32
cf.cond_br %263, ^bb37, ^bb38
^bb37:
%264 = llvm.load %259 : !llvm.ptr -> i32
%265 = arith.constant 64 : i32
%266 = arith.muli %264, %265 : i32
%267 = arith.constant 0 : i32
%268 = llvm.mlir.constant(1 : i64) : i64
%269 = llvm.alloca %268 x i32 : (i64) -> !llvm.ptr
llvm.store %267, %269 : i32, !llvm.ptr
cf.br ^bb39
^bb39:
%270 = llvm.load %269 : !llvm.ptr -> i32
%271 = llvm.mlir.addressof @DIM : !llvm.ptr
%272 = llvm.load %271 : !llvm.ptr -> i32
%273 = arith.cmpi slt, %270, %272 : i32
cf.cond_br %273, ^bb40, ^bb41
^bb40:
%274 = arith.constant 0 : i32
%275 = llvm.mlir.constant(1 : i64) : i64
%276 = llvm.alloca %275 x i32 : (i64) -> !llvm.ptr
llvm.store %274, %276 : i32, !llvm.ptr
cf.br ^bb42
^bb42:
%277 = llvm.load %276 : !llvm.ptr -> i32
%278 = llvm.mlir.addressof @DIM : !llvm.ptr
%279 = llvm.load %278 : !llvm.ptr -> i32
%280 = arith.cmpi slt, %277, %279 : i32
cf.cond_br %280, ^bb43, ^bb44
^bb43:
%281 = arith.constant 0 : i32
%282 = arith.extsi %281 : i32 to i128
%283 = llvm.mlir.constant(1 : i64) : i64
%284 = llvm.alloca %283 x i128 : (i64) -> !llvm.ptr
llvm.store %282, %284 : i128, !llvm.ptr
%285 = arith.constant 0 : i32
%286 = llvm.mlir.constant(1 : i64) : i64
%287 = llvm.alloca %286 x i32 : (i64) -> !llvm.ptr
llvm.store %285, %287 : i32, !llvm.ptr
cf.br ^bb45
^bb45:
%288 = llvm.load %287 : !llvm.ptr -> i32
%289 = llvm.mlir.addressof @DIM : !llvm.ptr
%290 = llvm.load %289 : !llvm.ptr -> i32
%291 = arith.cmpi slt, %288, %290 : i32
cf.cond_br %291, ^bb46, ^bb47
^bb46:
%292 = llvm.load %284 : !llvm.ptr -> i128
%294 = llvm.load %276 : !llvm.ptr -> i32
%295 = llvm.mlir.addressof @DIM : !llvm.ptr
%296 = llvm.load %295 : !llvm.ptr -> i32
%297 = arith.muli %294, %296 : i32
%298 = llvm.load %287 : !llvm.ptr -> i32
%299 = arith.addi %297, %298 : i32
%300 = arith.extsi %299 : i32 to i64
%301 = llvm.getelementptr %arg0[%300] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%293 = llvm.load %301 : !llvm.ptr -> i64
%302 = arith.extsi %293 : i64 to i128
%304 = llvm.load %287 : !llvm.ptr -> i32
%305 = arith.constant 8 : i32
%306 = arith.muli %304, %305 : i32
%307 = arith.addi %266, %306 : i32
%308 = llvm.load %269 : !llvm.ptr -> i32
%309 = arith.addi %307, %308 : i32
%310 = arith.extsi %309 : i32 to i64
%311 = llvm.getelementptr %arg3[%310] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%303 = llvm.load %311 : !llvm.ptr -> i64
%312 = arith.extsi %303 : i64 to i128
%314 = arith.trunci %302 : i128 to i64
%315 = arith.trunci %312 : i128 to i64
%313 = arith.muli %314, %315 : i64
%317 = arith.trunci %292 : i128 to i64
%316 = arith.addi %317, %313 : i64
%318 = arith.extsi %316 : i64 to i128
llvm.store %318, %284 : i128, !llvm.ptr
%319 = llvm.load %287 : !llvm.ptr -> i32
%320 = arith.constant 1 : i32
%321 = arith.addi %319, %320 : i32
llvm.store %321, %287 : i32, !llvm.ptr
cf.br ^bb45
^bb47:
%322 = llvm.load %284 : !llvm.ptr -> i128
%323 = llvm.mlir.addressof @MOD : !llvm.ptr
%324 = llvm.load %323 : !llvm.ptr -> i64
%325 = arith.extsi %324 : i64 to i128
%327 = arith.trunci %322 : i128 to i64
%328 = arith.trunci %325 : i128 to i64
%326 = arith.remsi %327, %328 : i64
%329 = llvm.load %276 : !llvm.ptr -> i32
%330 = arith.constant 8 : i32
%331 = arith.muli %329, %330 : i32
%332 = arith.addi %266, %331 : i32
%333 = llvm.load %269 : !llvm.ptr -> i32
%334 = arith.addi %332, %333 : i32
%335 = arith.extsi %334 : i32 to i64
%336 = llvm.getelementptr %arg4[%335] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %326, %336 : i64, !llvm.ptr
%337 = llvm.load %276 : !llvm.ptr -> i32
%338 = arith.constant 1 : i32
%339 = arith.addi %337, %338 : i32
llvm.store %339, %276 : i32, !llvm.ptr
cf.br ^bb42
^bb44:
%340 = llvm.load %269 : !llvm.ptr -> i32
%341 = arith.constant 1 : i32
%342 = arith.addi %340, %341 : i32
llvm.store %342, %269 : i32, !llvm.ptr
cf.br ^bb39
^bb41:
%343 = llvm.load %259 : !llvm.ptr -> i32
%344 = arith.constant 1 : i32
%345 = arith.addi %343, %344 : i32
llvm.store %345, %259 : i32, !llvm.ptr
cf.br ^bb36
^bb38:
%346 = arith.constant 0 : i32
%347 = llvm.mlir.constant(1 : i64) : i64
%348 = llvm.alloca %347 x i32 : (i64) -> !llvm.ptr
llvm.store %346, %348 : i32, !llvm.ptr
cf.br ^bb48
^bb48:
%349 = llvm.load %348 : !llvm.ptr -> i32
%350 = llvm.mlir.addressof @DIM : !llvm.ptr
%351 = llvm.load %350 : !llvm.ptr -> i32
%352 = arith.cmpi slt, %349, %351 : i32
cf.cond_br %352, ^bb49, ^bb50
^bb49:
%353 = llvm.load %348 : !llvm.ptr -> i32
%354 = arith.constant 64 : i32
%355 = arith.muli %353, %354 : i32
%356 = arith.constant 0 : i32
%357 = llvm.mlir.constant(1 : i64) : i64
%358 = llvm.alloca %357 x i32 : (i64) -> !llvm.ptr
llvm.store %356, %358 : i32, !llvm.ptr
cf.br ^bb51
^bb51:
%359 = llvm.load %358 : !llvm.ptr -> i32
%360 = llvm.mlir.addressof @DIM : !llvm.ptr
%361 = llvm.load %360 : !llvm.ptr -> i32
%362 = arith.cmpi slt, %359, %361 : i32
cf.cond_br %362, ^bb52, ^bb53
^bb52:
%363 = llvm.load %358 : !llvm.ptr -> i32
%364 = arith.constant 8 : i32
%365 = arith.muli %363, %364 : i32
%366 = arith.addi %355, %365 : i32
%367 = arith.constant 0 : i32
%368 = llvm.mlir.constant(1 : i64) : i64
%369 = llvm.alloca %368 x i32 : (i64) -> !llvm.ptr
llvm.store %367, %369 : i32, !llvm.ptr
cf.br ^bb54
^bb54:
%370 = llvm.load %369 : !llvm.ptr -> i32
%371 = llvm.mlir.addressof @DIM : !llvm.ptr
%372 = llvm.load %371 : !llvm.ptr -> i32
%373 = arith.cmpi slt, %370, %372 : i32
cf.cond_br %373, ^bb55, ^bb56
^bb55:
%374 = arith.constant 0 : i32
%375 = arith.extsi %374 : i32 to i128
%376 = llvm.mlir.constant(1 : i64) : i64
%377 = llvm.alloca %376 x i128 : (i64) -> !llvm.ptr
llvm.store %375, %377 : i128, !llvm.ptr
%378 = arith.constant 0 : i32
%379 = llvm.mlir.constant(1 : i64) : i64
%380 = llvm.alloca %379 x i32 : (i64) -> !llvm.ptr
llvm.store %378, %380 : i32, !llvm.ptr
cf.br ^bb57
^bb57:
%381 = llvm.load %380 : !llvm.ptr -> i32
%382 = llvm.mlir.addressof @DIM : !llvm.ptr
%383 = llvm.load %382 : !llvm.ptr -> i32
%384 = arith.cmpi slt, %381, %383 : i32
cf.cond_br %384, ^bb58, ^bb59
^bb58:
%385 = llvm.load %377 : !llvm.ptr -> i128
%387 = llvm.load %369 : !llvm.ptr -> i32
%388 = llvm.mlir.addressof @DIM : !llvm.ptr
%389 = llvm.load %388 : !llvm.ptr -> i32
%390 = arith.muli %387, %389 : i32
%391 = llvm.load %380 : !llvm.ptr -> i32
%392 = arith.addi %390, %391 : i32
%393 = arith.extsi %392 : i32 to i64
%394 = llvm.getelementptr %arg0[%393] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%386 = llvm.load %394 : !llvm.ptr -> i64
%395 = arith.extsi %386 : i64 to i128
%397 = llvm.load %380 : !llvm.ptr -> i32
%398 = arith.addi %366, %397 : i32
%399 = arith.extsi %398 : i32 to i64
%400 = llvm.getelementptr %arg4[%399] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%396 = llvm.load %400 : !llvm.ptr -> i64
%401 = arith.extsi %396 : i64 to i128
%403 = arith.trunci %395 : i128 to i64
%404 = arith.trunci %401 : i128 to i64
%402 = arith.muli %403, %404 : i64
%406 = arith.trunci %385 : i128 to i64
%405 = arith.addi %406, %402 : i64
%407 = arith.extsi %405 : i64 to i128
llvm.store %407, %377 : i128, !llvm.ptr
%408 = llvm.load %380 : !llvm.ptr -> i32
%409 = arith.constant 1 : i32
%410 = arith.addi %408, %409 : i32
llvm.store %410, %380 : i32, !llvm.ptr
cf.br ^bb57
^bb59:
%411 = llvm.load %377 : !llvm.ptr -> i128
%412 = llvm.mlir.addressof @MOD : !llvm.ptr
%413 = llvm.load %412 : !llvm.ptr -> i64
%414 = arith.extsi %413 : i64 to i128
%416 = arith.trunci %411 : i128 to i64
%417 = arith.trunci %414 : i128 to i64
%415 = arith.remsi %416, %417 : i64
%418 = llvm.load %369 : !llvm.ptr -> i32
%419 = arith.addi %366, %418 : i32
%420 = arith.extsi %419 : i32 to i64
%421 = llvm.getelementptr %arg2[%420] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %415, %421 : i64, !llvm.ptr
%422 = llvm.load %369 : !llvm.ptr -> i32
%423 = arith.constant 1 : i32
%424 = arith.addi %422, %423 : i32
llvm.store %424, %369 : i32, !llvm.ptr
cf.br ^bb54
^bb56:
%425 = llvm.load %358 : !llvm.ptr -> i32
%426 = arith.constant 1 : i32
%427 = arith.addi %425, %426 : i32
llvm.store %427, %358 : i32, !llvm.ptr
cf.br ^bb51
^bb53:
%428 = llvm.load %348 : !llvm.ptr -> i32
%429 = arith.constant 1 : i32
%430 = arith.addi %428, %429 : i32
llvm.store %430, %348 : i32, !llvm.ptr
cf.br ^bb48
^bb50:
func.return
}
func.func @copy_n(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: i32) -> () {
%431 = arith.constant 0 : i32
%432 = llvm.mlir.constant(1 : i64) : i64
%433 = llvm.alloca %432 x i32 : (i64) -> !llvm.ptr
llvm.store %431, %433 : i32, !llvm.ptr
cf.br ^bb60
^bb60:
%434 = llvm.load %433 : !llvm.ptr -> i32
%435 = arith.cmpi slt, %434, %arg4 : i32
cf.cond_br %435, ^bb61, ^bb62
^bb61:
%437 = llvm.load %433 : !llvm.ptr -> i32
%438 = arith.extsi %437 : i32 to i64
%439 = arith.addi %arg1, %438 : i64
%440 = llvm.getelementptr %arg0[%439] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%436 = llvm.load %440 : !llvm.ptr -> i64
%441 = llvm.load %433 : !llvm.ptr -> i32
%442 = arith.extsi %441 : i32 to i64
%443 = arith.addi %arg3, %442 : i64
%444 = llvm.getelementptr %arg2[%443] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %436, %444 : i64, !llvm.ptr
%445 = llvm.load %433 : !llvm.ptr -> i32
%446 = arith.constant 1 : i32
%447 = arith.addi %445, %446 : i32
llvm.store %447, %433 : i32, !llvm.ptr
cf.br ^bb60
^bb62:
func.return
}
func.func @mat_mul8_off(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: !llvm.ptr, %arg5: i64) -> () {
%448 = arith.constant 0 : i32
%449 = llvm.mlir.constant(1 : i64) : i64
%450 = llvm.alloca %449 x i32 : (i64) -> !llvm.ptr
llvm.store %448, %450 : i32, !llvm.ptr
cf.br ^bb63
^bb63:
%451 = llvm.load %450 : !llvm.ptr -> i32
%452 = llvm.mlir.addressof @DIM : !llvm.ptr
%453 = llvm.load %452 : !llvm.ptr -> i32
%454 = arith.cmpi slt, %451, %453 : i32
cf.cond_br %454, ^bb64, ^bb65
^bb64:
%455 = arith.constant 0 : i32
%456 = llvm.mlir.constant(1 : i64) : i64
%457 = llvm.alloca %456 x i32 : (i64) -> !llvm.ptr
llvm.store %455, %457 : i32, !llvm.ptr
cf.br ^bb66
^bb66:
%458 = llvm.load %457 : !llvm.ptr -> i32
%459 = llvm.mlir.addressof @DIM : !llvm.ptr
%460 = llvm.load %459 : !llvm.ptr -> i32
%461 = arith.cmpi slt, %458, %460 : i32
cf.cond_br %461, ^bb67, ^bb68
^bb67:
%462 = arith.constant 0 : i32
%463 = arith.extsi %462 : i32 to i128
%464 = llvm.mlir.constant(1 : i64) : i64
%465 = llvm.alloca %464 x i128 : (i64) -> !llvm.ptr
llvm.store %463, %465 : i128, !llvm.ptr
%466 = arith.constant 0 : i32
%467 = llvm.mlir.constant(1 : i64) : i64
%468 = llvm.alloca %467 x i32 : (i64) -> !llvm.ptr
llvm.store %466, %468 : i32, !llvm.ptr
cf.br ^bb69
^bb69:
%469 = llvm.load %468 : !llvm.ptr -> i32
%470 = llvm.mlir.addressof @DIM : !llvm.ptr
%471 = llvm.load %470 : !llvm.ptr -> i32
%472 = arith.cmpi slt, %469, %471 : i32
cf.cond_br %472, ^bb70, ^bb71
^bb70:
%473 = llvm.load %465 : !llvm.ptr -> i128
%475 = llvm.load %450 : !llvm.ptr -> i32
%476 = llvm.mlir.addressof @DIM : !llvm.ptr
%477 = llvm.load %476 : !llvm.ptr -> i32
%478 = arith.muli %475, %477 : i32
%479 = llvm.load %468 : !llvm.ptr -> i32
%480 = arith.addi %478, %479 : i32
%481 = arith.extsi %480 : i32 to i64
%482 = arith.addi %arg1, %481 : i64
%483 = llvm.getelementptr %arg0[%482] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%474 = llvm.load %483 : !llvm.ptr -> i64
%484 = arith.extsi %474 : i64 to i128
%486 = llvm.load %468 : !llvm.ptr -> i32
%487 = llvm.mlir.addressof @DIM : !llvm.ptr
%488 = llvm.load %487 : !llvm.ptr -> i32
%489 = arith.muli %486, %488 : i32
%490 = llvm.load %457 : !llvm.ptr -> i32
%491 = arith.addi %489, %490 : i32
%492 = arith.extsi %491 : i32 to i64
%493 = arith.addi %arg3, %492 : i64
%494 = llvm.getelementptr %arg2[%493] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%485 = llvm.load %494 : !llvm.ptr -> i64
%495 = arith.extsi %485 : i64 to i128
%497 = arith.trunci %484 : i128 to i64
%498 = arith.trunci %495 : i128 to i64
%496 = arith.muli %497, %498 : i64
%500 = arith.trunci %473 : i128 to i64
%499 = arith.addi %500, %496 : i64
%501 = arith.extsi %499 : i64 to i128
llvm.store %501, %465 : i128, !llvm.ptr
%502 = llvm.load %468 : !llvm.ptr -> i32
%503 = arith.constant 1 : i32
%504 = arith.addi %502, %503 : i32
llvm.store %504, %468 : i32, !llvm.ptr
cf.br ^bb69
^bb71:
%505 = llvm.load %465 : !llvm.ptr -> i128
%506 = llvm.mlir.addressof @MOD : !llvm.ptr
%507 = llvm.load %506 : !llvm.ptr -> i64
%508 = arith.extsi %507 : i64 to i128
%510 = arith.trunci %505 : i128 to i64
%511 = arith.trunci %508 : i128 to i64
%509 = arith.remsi %510, %511 : i64
%512 = llvm.load %450 : !llvm.ptr -> i32
%513 = llvm.mlir.addressof @DIM : !llvm.ptr
%514 = llvm.load %513 : !llvm.ptr -> i32
%515 = arith.muli %512, %514 : i32
%516 = llvm.load %457 : !llvm.ptr -> i32
%517 = arith.addi %515, %516 : i32
%518 = arith.extsi %517 : i32 to i64
%519 = arith.addi %arg5, %518 : i64
%520 = llvm.getelementptr %arg4[%519] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %509, %520 : i64, !llvm.ptr
%521 = llvm.load %457 : !llvm.ptr -> i32
%522 = arith.constant 1 : i32
%523 = arith.addi %521, %522 : i32
llvm.store %523, %457 : i32, !llvm.ptr
cf.br ^bb66
^bb68:
%524 = llvm.load %450 : !llvm.ptr -> i32
%525 = arith.constant 1 : i32
%526 = arith.addi %524, %525 : i32
llvm.store %526, %450 : i32, !llvm.ptr
cf.br ^bb63
^bb65:
func.return
}
func.func @tensor_transform_off(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr, %arg3: i64, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: !llvm.ptr) -> () {
%527 = arith.constant 0 : i32
%528 = llvm.mlir.constant(1 : i64) : i64
%529 = llvm.alloca %528 x i32 : (i64) -> !llvm.ptr
llvm.store %527, %529 : i32, !llvm.ptr
cf.br ^bb72
^bb72:
%530 = llvm.load %529 : !llvm.ptr -> i32
%531 = llvm.mlir.addressof @DIM : !llvm.ptr
%532 = llvm.load %531 : !llvm.ptr -> i32
%533 = arith.cmpi slt, %530, %532 : i32
cf.cond_br %533, ^bb73, ^bb74
^bb73:
%534 = arith.constant 0 : i32
%535 = llvm.mlir.constant(1 : i64) : i64
%536 = llvm.alloca %535 x i32 : (i64) -> !llvm.ptr
llvm.store %534, %536 : i32, !llvm.ptr
cf.br ^bb75
^bb75:
%537 = llvm.load %536 : !llvm.ptr -> i32
%538 = llvm.mlir.addressof @DIM : !llvm.ptr
%539 = llvm.load %538 : !llvm.ptr -> i32
%540 = arith.cmpi slt, %537, %539 : i32
cf.cond_br %540, ^bb76, ^bb77
^bb76:
%541 = llvm.load %529 : !llvm.ptr -> i32
%542 = arith.constant 8 : i32
%543 = arith.muli %541, %542 : i32
%544 = llvm.load %536 : !llvm.ptr -> i32
%545 = arith.addi %543, %544 : i32
%546 = arith.constant 0 : i32
%547 = llvm.mlir.constant(1 : i64) : i64
%548 = llvm.alloca %547 x i32 : (i64) -> !llvm.ptr
llvm.store %546, %548 : i32, !llvm.ptr
cf.br ^bb78
^bb78:
%549 = llvm.load %548 : !llvm.ptr -> i32
%550 = llvm.mlir.addressof @DIM : !llvm.ptr
%551 = llvm.load %550 : !llvm.ptr -> i32
%552 = arith.cmpi slt, %549, %551 : i32
cf.cond_br %552, ^bb79, ^bb80
^bb79:
%553 = arith.constant 0 : i32
%554 = arith.extsi %553 : i32 to i128
%555 = llvm.mlir.constant(1 : i64) : i64
%556 = llvm.alloca %555 x i128 : (i64) -> !llvm.ptr
llvm.store %554, %556 : i128, !llvm.ptr
%557 = arith.constant 0 : i32
%558 = llvm.mlir.constant(1 : i64) : i64
%559 = llvm.alloca %558 x i32 : (i64) -> !llvm.ptr
llvm.store %557, %559 : i32, !llvm.ptr
cf.br ^bb81
^bb81:
%560 = llvm.load %559 : !llvm.ptr -> i32
%561 = llvm.mlir.addressof @DIM : !llvm.ptr
%562 = llvm.load %561 : !llvm.ptr -> i32
%563 = arith.cmpi slt, %560, %562 : i32
cf.cond_br %563, ^bb82, ^bb83
^bb82:
%564 = llvm.load %556 : !llvm.ptr -> i128
%566 = llvm.load %548 : !llvm.ptr -> i32
%567 = llvm.mlir.addressof @DIM : !llvm.ptr
%568 = llvm.load %567 : !llvm.ptr -> i32
%569 = arith.muli %566, %568 : i32
%570 = llvm.load %559 : !llvm.ptr -> i32
%571 = arith.addi %569, %570 : i32
%572 = arith.extsi %571 : i32 to i64
%573 = arith.addi %arg1, %572 : i64
%574 = llvm.getelementptr %arg0[%573] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%565 = llvm.load %574 : !llvm.ptr -> i64
%575 = arith.extsi %565 : i64 to i128
%577 = llvm.load %559 : !llvm.ptr -> i32
%578 = arith.constant 64 : i32
%579 = arith.muli %577, %578 : i32
%580 = arith.addi %579, %545 : i32
%581 = arith.extsi %580 : i32 to i64
%582 = arith.addi %arg3, %581 : i64
%583 = llvm.getelementptr %arg2[%582] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%576 = llvm.load %583 : !llvm.ptr -> i64
%584 = arith.extsi %576 : i64 to i128
%586 = arith.trunci %575 : i128 to i64
%587 = arith.trunci %584 : i128 to i64
%585 = arith.muli %586, %587 : i64
%589 = arith.trunci %564 : i128 to i64
%588 = arith.addi %589, %585 : i64
%590 = arith.extsi %588 : i64 to i128
llvm.store %590, %556 : i128, !llvm.ptr
%591 = llvm.load %559 : !llvm.ptr -> i32
%592 = arith.constant 1 : i32
%593 = arith.addi %591, %592 : i32
llvm.store %593, %559 : i32, !llvm.ptr
cf.br ^bb81
^bb83:
%594 = llvm.load %556 : !llvm.ptr -> i128
%595 = llvm.mlir.addressof @MOD : !llvm.ptr
%596 = llvm.load %595 : !llvm.ptr -> i64
%597 = arith.extsi %596 : i64 to i128
%599 = arith.trunci %594 : i128 to i64
%600 = arith.trunci %597 : i128 to i64
%598 = arith.remsi %599, %600 : i64
%601 = llvm.load %548 : !llvm.ptr -> i32
%602 = arith.constant 64 : i32
%603 = arith.muli %601, %602 : i32
%604 = arith.addi %603, %545 : i32
%605 = arith.extsi %604 : i32 to i64
%606 = llvm.getelementptr %arg5[%605] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %598, %606 : i64, !llvm.ptr
%607 = llvm.load %548 : !llvm.ptr -> i32
%608 = arith.constant 1 : i32
%609 = arith.addi %607, %608 : i32
llvm.store %609, %548 : i32, !llvm.ptr
cf.br ^bb78
^bb80:
%610 = llvm.load %536 : !llvm.ptr -> i32
%611 = arith.constant 1 : i32
%612 = arith.addi %610, %611 : i32
llvm.store %612, %536 : i32, !llvm.ptr
cf.br ^bb75
^bb77:
%613 = llvm.load %529 : !llvm.ptr -> i32
%614 = arith.constant 1 : i32
%615 = arith.addi %613, %614 : i32
llvm.store %615, %529 : i32, !llvm.ptr
cf.br ^bb72
^bb74:
%616 = arith.constant 0 : i32
%617 = llvm.mlir.constant(1 : i64) : i64
%618 = llvm.alloca %617 x i32 : (i64) -> !llvm.ptr
llvm.store %616, %618 : i32, !llvm.ptr
cf.br ^bb84
^bb84:
%619 = llvm.load %618 : !llvm.ptr -> i32
%620 = llvm.mlir.addressof @DIM : !llvm.ptr
%621 = llvm.load %620 : !llvm.ptr -> i32
%622 = arith.cmpi slt, %619, %621 : i32
cf.cond_br %622, ^bb85, ^bb86
^bb85:
%623 = llvm.load %618 : !llvm.ptr -> i32
%624 = arith.constant 64 : i32
%625 = arith.muli %623, %624 : i32
%626 = arith.constant 0 : i32
%627 = llvm.mlir.constant(1 : i64) : i64
%628 = llvm.alloca %627 x i32 : (i64) -> !llvm.ptr
llvm.store %626, %628 : i32, !llvm.ptr
cf.br ^bb87
^bb87:
%629 = llvm.load %628 : !llvm.ptr -> i32
%630 = llvm.mlir.addressof @DIM : !llvm.ptr
%631 = llvm.load %630 : !llvm.ptr -> i32
%632 = arith.cmpi slt, %629, %631 : i32
cf.cond_br %632, ^bb88, ^bb89
^bb88:
%633 = arith.constant 0 : i32
%634 = llvm.mlir.constant(1 : i64) : i64
%635 = llvm.alloca %634 x i32 : (i64) -> !llvm.ptr
llvm.store %633, %635 : i32, !llvm.ptr
cf.br ^bb90
^bb90:
%636 = llvm.load %635 : !llvm.ptr -> i32
%637 = llvm.mlir.addressof @DIM : !llvm.ptr
%638 = llvm.load %637 : !llvm.ptr -> i32
%639 = arith.cmpi slt, %636, %638 : i32
cf.cond_br %639, ^bb91, ^bb92
^bb91:
%640 = arith.constant 0 : i32
%641 = arith.extsi %640 : i32 to i128
%642 = llvm.mlir.constant(1 : i64) : i64
%643 = llvm.alloca %642 x i128 : (i64) -> !llvm.ptr
llvm.store %641, %643 : i128, !llvm.ptr
%644 = arith.constant 0 : i32
%645 = llvm.mlir.constant(1 : i64) : i64
%646 = llvm.alloca %645 x i32 : (i64) -> !llvm.ptr
llvm.store %644, %646 : i32, !llvm.ptr
cf.br ^bb93
^bb93:
%647 = llvm.load %646 : !llvm.ptr -> i32
%648 = llvm.mlir.addressof @DIM : !llvm.ptr
%649 = llvm.load %648 : !llvm.ptr -> i32
%650 = arith.cmpi slt, %647, %649 : i32
cf.cond_br %650, ^bb94, ^bb95
^bb94:
%651 = llvm.load %643 : !llvm.ptr -> i128
%653 = llvm.load %635 : !llvm.ptr -> i32
%654 = llvm.mlir.addressof @DIM : !llvm.ptr
%655 = llvm.load %654 : !llvm.ptr -> i32
%656 = arith.muli %653, %655 : i32
%657 = llvm.load %646 : !llvm.ptr -> i32
%658 = arith.addi %656, %657 : i32
%659 = arith.extsi %658 : i32 to i64
%660 = arith.addi %arg1, %659 : i64
%661 = llvm.getelementptr %arg0[%660] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%652 = llvm.load %661 : !llvm.ptr -> i64
%662 = arith.extsi %652 : i64 to i128
%664 = llvm.load %646 : !llvm.ptr -> i32
%665 = arith.constant 8 : i32
%666 = arith.muli %664, %665 : i32
%667 = arith.addi %625, %666 : i32
%668 = llvm.load %628 : !llvm.ptr -> i32
%669 = arith.addi %667, %668 : i32
%670 = arith.extsi %669 : i32 to i64
%671 = llvm.getelementptr %arg5[%670] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%663 = llvm.load %671 : !llvm.ptr -> i64
%672 = arith.extsi %663 : i64 to i128
%674 = arith.trunci %662 : i128 to i64
%675 = arith.trunci %672 : i128 to i64
%673 = arith.muli %674, %675 : i64
%677 = arith.trunci %651 : i128 to i64
%676 = arith.addi %677, %673 : i64
%678 = arith.extsi %676 : i64 to i128
llvm.store %678, %643 : i128, !llvm.ptr
%679 = llvm.load %646 : !llvm.ptr -> i32
%680 = arith.constant 1 : i32
%681 = arith.addi %679, %680 : i32
llvm.store %681, %646 : i32, !llvm.ptr
cf.br ^bb93
^bb95:
%682 = llvm.load %643 : !llvm.ptr -> i128
%683 = llvm.mlir.addressof @MOD : !llvm.ptr
%684 = llvm.load %683 : !llvm.ptr -> i64
%685 = arith.extsi %684 : i64 to i128
%687 = arith.trunci %682 : i128 to i64
%688 = arith.trunci %685 : i128 to i64
%686 = arith.remsi %687, %688 : i64
%689 = llvm.load %635 : !llvm.ptr -> i32
%690 = arith.constant 8 : i32
%691 = arith.muli %689, %690 : i32
%692 = arith.addi %625, %691 : i32
%693 = llvm.load %628 : !llvm.ptr -> i32
%694 = arith.addi %692, %693 : i32
%695 = arith.extsi %694 : i32 to i64
%696 = llvm.getelementptr %arg6[%695] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %686, %696 : i64, !llvm.ptr
%697 = llvm.load %635 : !llvm.ptr -> i32
%698 = arith.constant 1 : i32
%699 = arith.addi %697, %698 : i32
llvm.store %699, %635 : i32, !llvm.ptr
cf.br ^bb90
^bb92:
%700 = llvm.load %628 : !llvm.ptr -> i32
%701 = arith.constant 1 : i32
%702 = arith.addi %700, %701 : i32
llvm.store %702, %628 : i32, !llvm.ptr
cf.br ^bb87
^bb89:
%703 = llvm.load %618 : !llvm.ptr -> i32
%704 = arith.constant 1 : i32
%705 = arith.addi %703, %704 : i32
llvm.store %705, %618 : i32, !llvm.ptr
cf.br ^bb84
^bb86:
%706 = arith.constant 0 : i32
%707 = llvm.mlir.constant(1 : i64) : i64
%708 = llvm.alloca %707 x i32 : (i64) -> !llvm.ptr
llvm.store %706, %708 : i32, !llvm.ptr
cf.br ^bb96
^bb96:
%709 = llvm.load %708 : !llvm.ptr -> i32
%710 = llvm.mlir.addressof @DIM : !llvm.ptr
%711 = llvm.load %710 : !llvm.ptr -> i32
%712 = arith.cmpi slt, %709, %711 : i32
cf.cond_br %712, ^bb97, ^bb98
^bb97:
%713 = llvm.load %708 : !llvm.ptr -> i32
%714 = arith.constant 64 : i32
%715 = arith.muli %713, %714 : i32
%716 = arith.constant 0 : i32
%717 = llvm.mlir.constant(1 : i64) : i64
%718 = llvm.alloca %717 x i32 : (i64) -> !llvm.ptr
llvm.store %716, %718 : i32, !llvm.ptr
cf.br ^bb99
^bb99:
%719 = llvm.load %718 : !llvm.ptr -> i32
%720 = llvm.mlir.addressof @DIM : !llvm.ptr
%721 = llvm.load %720 : !llvm.ptr -> i32
%722 = arith.cmpi slt, %719, %721 : i32
cf.cond_br %722, ^bb100, ^bb101
^bb100:
%723 = llvm.load %718 : !llvm.ptr -> i32
%724 = arith.constant 8 : i32
%725 = arith.muli %723, %724 : i32
%726 = arith.addi %715, %725 : i32
%727 = arith.constant 0 : i32
%728 = llvm.mlir.constant(1 : i64) : i64
%729 = llvm.alloca %728 x i32 : (i64) -> !llvm.ptr
llvm.store %727, %729 : i32, !llvm.ptr
cf.br ^bb102
^bb102:
%730 = llvm.load %729 : !llvm.ptr -> i32
%731 = llvm.mlir.addressof @DIM : !llvm.ptr
%732 = llvm.load %731 : !llvm.ptr -> i32
%733 = arith.cmpi slt, %730, %732 : i32
cf.cond_br %733, ^bb103, ^bb104
^bb103:
%734 = arith.constant 0 : i32
%735 = arith.extsi %734 : i32 to i128
%736 = llvm.mlir.constant(1 : i64) : i64
%737 = llvm.alloca %736 x i128 : (i64) -> !llvm.ptr
llvm.store %735, %737 : i128, !llvm.ptr
%738 = arith.constant 0 : i32
%739 = llvm.mlir.constant(1 : i64) : i64
%740 = llvm.alloca %739 x i32 : (i64) -> !llvm.ptr
llvm.store %738, %740 : i32, !llvm.ptr
cf.br ^bb105
^bb105:
%741 = llvm.load %740 : !llvm.ptr -> i32
%742 = llvm.mlir.addressof @DIM : !llvm.ptr
%743 = llvm.load %742 : !llvm.ptr -> i32
%744 = arith.cmpi slt, %741, %743 : i32
cf.cond_br %744, ^bb106, ^bb107
^bb106:
%745 = llvm.load %737 : !llvm.ptr -> i128
%747 = llvm.load %729 : !llvm.ptr -> i32
%748 = llvm.mlir.addressof @DIM : !llvm.ptr
%749 = llvm.load %748 : !llvm.ptr -> i32
%750 = arith.muli %747, %749 : i32
%751 = llvm.load %740 : !llvm.ptr -> i32
%752 = arith.addi %750, %751 : i32
%753 = arith.extsi %752 : i32 to i64
%754 = arith.addi %arg1, %753 : i64
%755 = llvm.getelementptr %arg0[%754] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%746 = llvm.load %755 : !llvm.ptr -> i64
%756 = arith.extsi %746 : i64 to i128
%758 = llvm.load %740 : !llvm.ptr -> i32
%759 = arith.addi %726, %758 : i32
%760 = arith.extsi %759 : i32 to i64
%761 = llvm.getelementptr %arg6[%760] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%757 = llvm.load %761 : !llvm.ptr -> i64
%762 = arith.extsi %757 : i64 to i128
%764 = arith.trunci %756 : i128 to i64
%765 = arith.trunci %762 : i128 to i64
%763 = arith.muli %764, %765 : i64
%767 = arith.trunci %745 : i128 to i64
%766 = arith.addi %767, %763 : i64
%768 = arith.extsi %766 : i64 to i128
llvm.store %768, %737 : i128, !llvm.ptr
%769 = llvm.load %740 : !llvm.ptr -> i32
%770 = arith.constant 1 : i32
%771 = arith.addi %769, %770 : i32
llvm.store %771, %740 : i32, !llvm.ptr
cf.br ^bb105
^bb107:
%772 = llvm.load %737 : !llvm.ptr -> i128
%773 = llvm.mlir.addressof @MOD : !llvm.ptr
%774 = llvm.load %773 : !llvm.ptr -> i64
%775 = arith.extsi %774 : i64 to i128
%777 = arith.trunci %772 : i128 to i64
%778 = arith.trunci %775 : i128 to i64
%776 = arith.remsi %777, %778 : i64
%779 = llvm.load %729 : !llvm.ptr -> i32
%780 = arith.addi %726, %779 : i32
%781 = arith.extsi %780 : i32 to i64
%782 = llvm.getelementptr %arg4[%781] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %776, %782 : i64, !llvm.ptr
%783 = llvm.load %729 : !llvm.ptr -> i32
%784 = arith.constant 1 : i32
%785 = arith.addi %783, %784 : i32
llvm.store %785, %729 : i32, !llvm.ptr
cf.br ^bb102
^bb104:
%786 = llvm.load %718 : !llvm.ptr -> i32
%787 = arith.constant 1 : i32
%788 = arith.addi %786, %787 : i32
llvm.store %788, %718 : i32, !llvm.ptr
cf.br ^bb99
^bb101:
%789 = llvm.load %708 : !llvm.ptr -> i32
%790 = arith.constant 1 : i32
%791 = arith.addi %789, %790 : i32
llvm.store %791, %708 : i32, !llvm.ptr
cf.br ^bb96
^bb98:
func.return
}
func.func @sum_cubes_from_state(%arg0: !llvm.ptr, %arg1: i64, %arg2: !llvm.ptr) -> i64 {
%792 = arith.constant 0 : i32
%794 = arith.extsi %792 : i32 to i64
%793 = arith.cmpi sle, %arg1, %794 : i64
cf.cond_br %793, ^bb108, ^bb109
^bb108:
%795 = arith.constant 0 : i32
%796 = arith.extsi %795 : i32 to i64
func.return %796 : i64
^bb109:
cf.br ^bb110
^bb110:
%798 = arith.constant 64 : i32
%799 = arith.constant 64 : i32
%800 = arith.muli %798, %799 : i32
%801 = arith.constant 8 : i32
%802 = arith.extsi %800 : i32 to i64
%803 = arith.extsi %801 : i32 to i64
%797 = func.call @calloc(%802, %803) : (i64, i64) -> !llvm.ptr
%805 = arith.constant 64 : i32
%806 = arith.constant 512 : i32
%807 = arith.muli %805, %806 : i32
%808 = arith.constant 8 : i32
%809 = arith.extsi %807 : i32 to i64
%810 = arith.extsi %808 : i32 to i64
%804 = func.call @calloc(%809, %810) : (i64, i64) -> !llvm.ptr
%812 = arith.constant 64 : i32
%813 = arith.constant 8 : i32
%814 = arith.extsi %812 : i32 to i64
%815 = arith.extsi %813 : i32 to i64
%811 = func.call @calloc(%814, %815) : (i64, i64) -> !llvm.ptr
%817 = arith.constant 512 : i32
%818 = arith.constant 8 : i32
%819 = arith.extsi %817 : i32 to i64
%820 = arith.extsi %818 : i32 to i64
%816 = func.call @calloc(%819, %820) : (i64, i64) -> !llvm.ptr
%822 = arith.constant 512 : i32
%823 = arith.constant 8 : i32
%824 = arith.extsi %822 : i32 to i64
%825 = arith.extsi %823 : i32 to i64
%821 = func.call @calloc(%824, %825) : (i64, i64) -> !llvm.ptr
%827 = arith.constant 64 : i32
%828 = arith.constant 8 : i32
%829 = arith.extsi %827 : i32 to i64
%830 = arith.extsi %828 : i32 to i64
%826 = func.call @calloc(%829, %830) : (i64, i64) -> !llvm.ptr
%832 = arith.constant 512 : i32
%833 = arith.constant 8 : i32
%834 = arith.extsi %832 : i32 to i64
%835 = arith.extsi %833 : i32 to i64
%831 = func.call @calloc(%834, %835) : (i64, i64) -> !llvm.ptr
%837 = arith.constant 512 : i32
%838 = arith.constant 8 : i32
%839 = arith.extsi %837 : i32 to i64
%840 = arith.extsi %838 : i32 to i64
%836 = func.call @calloc(%839, %840) : (i64, i64) -> !llvm.ptr
%841 = llvm.mlir.zero : !llvm.ptr
%842 = llvm.icmp "eq" %797, %841 : !llvm.ptr
%843 = scf.if %842 -> (i1) {
%844 = arith.constant true
scf.yield %844 : i1
} else {
%845 = llvm.mlir.zero : !llvm.ptr
%846 = llvm.icmp "eq" %804, %845 : !llvm.ptr
scf.yield %846 : i1
}
%847 = scf.if %843 -> (i1) {
%848 = arith.constant true
scf.yield %848 : i1
} else {
%849 = llvm.mlir.zero : !llvm.ptr
%850 = llvm.icmp "eq" %811, %849 : !llvm.ptr
scf.yield %850 : i1
}
%851 = scf.if %847 -> (i1) {
%852 = arith.constant true
scf.yield %852 : i1
} else {
%853 = llvm.mlir.zero : !llvm.ptr
%854 = llvm.icmp "eq" %816, %853 : !llvm.ptr
scf.yield %854 : i1
}
cf.cond_br %851, ^bb111, ^bb112
^bb111:
%855 = arith.constant 0 : i32
%856 = arith.extsi %855 : i32 to i64
func.return %856 : i64
^bb112:
cf.br ^bb113
^bb113:
%858 = arith.constant 0 : i32
%859 = arith.constant 0 : i32
%860 = arith.constant 64 : i32
%861 = arith.extsi %858 : i32 to i64
%862 = arith.extsi %859 : i32 to i64
func.call @copy_n(%arg2, %861, %811, %862, %860) : (!llvm.ptr, i64, !llvm.ptr, i64, i32) -> ()
func.call @tensor_from_vec(%arg0, %816) : (!llvm.ptr, !llvm.ptr) -> ()
%864 = arith.constant 0 : i32
%865 = llvm.mlir.constant(1 : i64) : i64
%866 = llvm.alloca %865 x i32 : (i64) -> !llvm.ptr
llvm.store %864, %866 : i32, !llvm.ptr
%867 = arith.constant 1 : i32
%868 = arith.extsi %867 : i32 to i64
%869 = llvm.mlir.constant(1 : i64) : i64
%870 = llvm.alloca %869 x i64 : (i64) -> !llvm.ptr
llvm.store %868, %870 : i64, !llvm.ptr
cf.br ^bb114
^bb114:
%871 = llvm.load %870 : !llvm.ptr -> i64
%872 = arith.cmpi sle, %871, %arg1 : i64
cf.cond_br %872, ^bb115, ^bb116
^bb115:
%874 = arith.constant 0 : i32
%875 = llvm.load %866 : !llvm.ptr -> i32
%876 = arith.constant 64 : i32
%877 = arith.muli %875, %876 : i32
%878 = arith.extsi %877 : i32 to i64
%879 = arith.constant 64 : i32
%880 = arith.extsi %874 : i32 to i64
func.call @copy_n(%811, %880, %797, %878, %879) : (!llvm.ptr, i64, !llvm.ptr, i64, i32) -> ()
%882 = arith.constant 0 : i32
%883 = llvm.load %866 : !llvm.ptr -> i32
%884 = arith.constant 512 : i32
%885 = arith.muli %883, %884 : i32
%886 = arith.extsi %885 : i32 to i64
%887 = arith.constant 512 : i32
%888 = arith.extsi %882 : i32 to i64
func.call @copy_n(%816, %888, %804, %886, %887) : (!llvm.ptr, i64, !llvm.ptr, i64, i32) -> ()
func.call @tensor_transform(%811, %816, %821, %831, %836) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
%890 = arith.constant 0 : i32
%891 = llvm.mlir.constant(1 : i64) : i64
%892 = llvm.alloca %891 x i32 : (i64) -> !llvm.ptr
llvm.store %890, %892 : i32, !llvm.ptr
cf.br ^bb117
^bb117:
%893 = llvm.load %892 : !llvm.ptr -> i32
%894 = llvm.mlir.addressof @TSIZE : !llvm.ptr
%895 = llvm.load %894 : !llvm.ptr -> i32
%896 = arith.cmpi slt, %893, %895 : i32
cf.cond_br %896, ^bb118, ^bb119
^bb118:
%899 = llvm.load %892 : !llvm.ptr -> i32
%900 = arith.extsi %899 : i32 to i64
%901 = llvm.getelementptr %816[%900] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%898 = llvm.load %901 : !llvm.ptr -> i64
%903 = llvm.load %892 : !llvm.ptr -> i32
%904 = arith.extsi %903 : i32 to i64
%905 = llvm.getelementptr %821[%904] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%902 = llvm.load %905 : !llvm.ptr -> i64
%897 = func.call @mod_add(%898, %902) : (i64, i64) -> i64
%906 = llvm.load %892 : !llvm.ptr -> i32
%907 = arith.extsi %906 : i32 to i64
%908 = llvm.getelementptr %816[%907] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %897, %908 : i64, !llvm.ptr
%909 = llvm.load %892 : !llvm.ptr -> i32
%910 = arith.constant 1 : i32
%911 = arith.addi %909, %910 : i32
llvm.store %911, %892 : i32, !llvm.ptr
cf.br ^bb117
^bb119:
func.call @mat_mul8(%811, %811, %826) : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
%914 = arith.constant 0 : i32
%915 = arith.constant 0 : i32
%916 = arith.constant 64 : i32
%917 = arith.extsi %914 : i32 to i64
%918 = arith.extsi %915 : i32 to i64
func.call @copy_n(%826, %917, %811, %918, %916) : (!llvm.ptr, i64, !llvm.ptr, i64, i32) -> ()
%919 = llvm.load %870 : !llvm.ptr -> i64
%920 = arith.constant 1 : i32
%922 = arith.extsi %920 : i32 to i64
%921 = arith.shli %919, %922 : i64
llvm.store %921, %870 : i64, !llvm.ptr
%923 = llvm.load %866 : !llvm.ptr -> i32
%924 = arith.constant 1 : i32
%925 = arith.addi %923, %924 : i32
llvm.store %925, %866 : i32, !llvm.ptr
cf.br ^bb114
^bb116:
%927 = arith.constant 64 : i32
%928 = arith.constant 8 : i32
%929 = arith.extsi %927 : i32 to i64
%930 = arith.extsi %928 : i32 to i64
%926 = func.call @calloc(%929, %930) : (i64, i64) -> !llvm.ptr
%932 = arith.constant 512 : i32
%933 = arith.constant 8 : i32
%934 = arith.extsi %932 : i32 to i64
%935 = arith.extsi %933 : i32 to i64
%931 = func.call @calloc(%934, %935) : (i64, i64) -> !llvm.ptr
%937 = arith.constant 512 : i32
%938 = arith.constant 8 : i32
%939 = arith.extsi %937 : i32 to i64
%940 = arith.extsi %938 : i32 to i64
%936 = func.call @calloc(%939, %940) : (i64, i64) -> !llvm.ptr
%941 = llvm.mlir.zero : !llvm.ptr
%942 = llvm.icmp "eq" %926, %941 : !llvm.ptr
%943 = scf.if %942 -> (i1) {
%944 = arith.constant true
scf.yield %944 : i1
} else {
%945 = llvm.mlir.zero : !llvm.ptr
%946 = llvm.icmp "eq" %931, %945 : !llvm.ptr
scf.yield %946 : i1
}
cf.cond_br %943, ^bb120, ^bb121
^bb120:
%947 = arith.constant 0 : i32
%948 = arith.extsi %947 : i32 to i64
func.return %948 : i64
^bb121:
cf.br ^bb122
^bb122:
%949 = arith.constant 0 : i32
%950 = llvm.mlir.constant(1 : i64) : i64
%951 = llvm.alloca %950 x i32 : (i64) -> !llvm.ptr
llvm.store %949, %951 : i32, !llvm.ptr
cf.br ^bb123
^bb123:
%952 = llvm.load %951 : !llvm.ptr -> i32
%953 = llvm.mlir.addressof @DIM : !llvm.ptr
%954 = llvm.load %953 : !llvm.ptr -> i32
%955 = arith.cmpi slt, %952, %954 : i32
cf.cond_br %955, ^bb124, ^bb125
^bb124:
%956 = arith.constant 1 : i32
%957 = llvm.load %951 : !llvm.ptr -> i32
%958 = llvm.mlir.addressof @DIM : !llvm.ptr
%959 = llvm.load %958 : !llvm.ptr -> i32
%960 = arith.muli %957, %959 : i32
%961 = llvm.load %951 : !llvm.ptr -> i32
%962 = arith.addi %960, %961 : i32
%963 = arith.extsi %962 : i32 to i64
%964 = arith.extsi %956 : i32 to i64
%965 = llvm.getelementptr %926[%963] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %964, %965 : i64, !llvm.ptr
%966 = llvm.load %951 : !llvm.ptr -> i32
%967 = arith.constant 1 : i32
%968 = arith.addi %966, %967 : i32
llvm.store %968, %951 : i32, !llvm.ptr
cf.br ^bb123
^bb125:
%969 = llvm.mlir.constant(1 : i64) : i64
%970 = llvm.alloca %969 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %970 : i64, !llvm.ptr
%971 = arith.constant 0 : i32
%972 = llvm.mlir.constant(1 : i64) : i64
%973 = llvm.alloca %972 x i32 : (i64) -> !llvm.ptr
llvm.store %971, %973 : i32, !llvm.ptr
cf.br ^bb126
^bb126:
%974 = llvm.load %970 : !llvm.ptr -> i64
%975 = arith.constant 0 : i32
%977 = arith.extsi %975 : i32 to i64
%976 = arith.cmpi sgt, %974, %977 : i64
cf.cond_br %976, ^bb127, ^bb128
^bb127:
%978 = llvm.load %970 : !llvm.ptr -> i64
%979 = arith.constant 1 : i32
%981 = arith.extsi %979 : i32 to i64
%980 = arith.andi %978, %981 : i64
%982 = arith.constant 0 : i32
%984 = arith.extsi %982 : i32 to i64
%983 = arith.cmpi ne, %980, %984 : i64
cf.cond_br %983, ^bb129, ^bb130
^bb129:
%986 = arith.constant 0 : i32
%987 = llvm.load %973 : !llvm.ptr -> i32
%988 = arith.constant 512 : i32
%989 = arith.muli %987, %988 : i32
%990 = arith.extsi %989 : i32 to i64
%991 = arith.extsi %986 : i32 to i64
func.call @tensor_transform_off(%926, %991, %804, %990, %936, %831, %836) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
%992 = arith.constant 0 : i32
%993 = llvm.mlir.constant(1 : i64) : i64
%994 = llvm.alloca %993 x i32 : (i64) -> !llvm.ptr
llvm.store %992, %994 : i32, !llvm.ptr
cf.br ^bb132
^bb132:
%995 = llvm.load %994 : !llvm.ptr -> i32
%996 = llvm.mlir.addressof @TSIZE : !llvm.ptr
%997 = llvm.load %996 : !llvm.ptr -> i32
%998 = arith.cmpi slt, %995, %997 : i32
cf.cond_br %998, ^bb133, ^bb134
^bb133:
%1001 = llvm.load %994 : !llvm.ptr -> i32
%1002 = arith.extsi %1001 : i32 to i64
%1003 = llvm.getelementptr %931[%1002] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1000 = llvm.load %1003 : !llvm.ptr -> i64
%1005 = llvm.load %994 : !llvm.ptr -> i32
%1006 = arith.extsi %1005 : i32 to i64
%1007 = llvm.getelementptr %936[%1006] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1004 = llvm.load %1007 : !llvm.ptr -> i64
%999 = func.call @mod_add(%1000, %1004) : (i64, i64) -> i64
%1008 = llvm.load %994 : !llvm.ptr -> i32
%1009 = arith.extsi %1008 : i32 to i64
%1010 = llvm.getelementptr %931[%1009] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %999, %1010 : i64, !llvm.ptr
%1011 = llvm.load %994 : !llvm.ptr -> i32
%1012 = arith.constant 1 : i32
%1013 = arith.addi %1011, %1012 : i32
llvm.store %1013, %994 : i32, !llvm.ptr
cf.br ^bb132
^bb134:
%1015 = arith.constant 0 : i32
%1016 = llvm.load %973 : !llvm.ptr -> i32
%1017 = arith.constant 64 : i32
%1018 = arith.muli %1016, %1017 : i32
%1019 = arith.extsi %1018 : i32 to i64
%1020 = arith.constant 0 : i32
%1021 = arith.extsi %1015 : i32 to i64
%1022 = arith.extsi %1020 : i32 to i64
func.call @mat_mul8_off(%926, %1021, %797, %1019, %826, %1022) : (!llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr, i64) -> ()
%1024 = arith.constant 0 : i32
%1025 = arith.constant 0 : i32
%1026 = arith.constant 64 : i32
%1027 = arith.extsi %1024 : i32 to i64
%1028 = arith.extsi %1025 : i32 to i64
func.call @copy_n(%826, %1027, %926, %1028, %1026) : (!llvm.ptr, i64, !llvm.ptr, i64, i32) -> ()
cf.br ^bb131
^bb130:
cf.br ^bb131
^bb131:
%1029 = llvm.load %970 : !llvm.ptr -> i64
%1030 = arith.constant 1 : i32
%1032 = arith.extsi %1030 : i32 to i64
%1031 = arith.shrsi %1029, %1032 : i64
llvm.store %1031, %970 : i64, !llvm.ptr
%1033 = llvm.load %973 : !llvm.ptr -> i32
%1034 = arith.constant 1 : i32
%1035 = arith.addi %1033, %1034 : i32
llvm.store %1035, %973 : i32, !llvm.ptr
cf.br ^bb126
^bb128:
%1037 = arith.constant 0 : i32
%1038 = arith.extsi %1037 : i32 to i64
%1039 = llvm.getelementptr %931[%1038] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1036 = llvm.load %1039 : !llvm.ptr -> i64
func.call @free(%936) : (!llvm.ptr) -> ()
func.call @free(%931) : (!llvm.ptr) -> ()
func.call @free(%926) : (!llvm.ptr) -> ()
func.call @free(%836) : (!llvm.ptr) -> ()
func.call @free(%831) : (!llvm.ptr) -> ()
func.call @free(%826) : (!llvm.ptr) -> ()
func.call @free(%821) : (!llvm.ptr) -> ()
func.call @free(%816) : (!llvm.ptr) -> ()
func.call @free(%811) : (!llvm.ptr) -> ()
func.call @free(%804) : (!llvm.ptr) -> ()
func.call @free(%797) : (!llvm.ptr) -> ()
func.return %1036 : i64
}
func.func @S_mod(%arg0: i64) -> i64 {
%1052 = arith.constant 1 : i32
%1053 = arith.constant 1 : i32
%1054 = arith.constant 1 : i32
%1055 = arith.constant 2 : i32
%1056 = arith.constant 6 : i32
%1057 = arith.constant 14 : i32
%1058 = arith.constant 28 : i32
%1059 = arith.constant 56 : i32
%1060 = llvm.mlir.constant(1 : i64) : i64
%1061 = llvm.alloca %1060 x !llvm.array<8 x i64> : (i64) -> !llvm.ptr
%1062 = llvm.mlir.zero : !llvm.array<8 x i64>
llvm.store %1062, %1061 : !llvm.array<8 x i64>, !llvm.ptr
%1063 = arith.extsi %1052 : i32 to i64
%1064 = arith.extsi %1053 : i32 to i64
%1065 = arith.extsi %1054 : i32 to i64
%1066 = arith.extsi %1055 : i32 to i64
%1067 = arith.extsi %1056 : i32 to i64
%1068 = arith.extsi %1057 : i32 to i64
%1069 = arith.extsi %1058 : i32 to i64
%1070 = arith.extsi %1059 : i32 to i64
%1071 = llvm.mlir.constant(0 : i64) : i64
%1072 = llvm.getelementptr %1061[0, %1071] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1063, %1072 : i64, !llvm.ptr
%1073 = llvm.mlir.constant(1 : i64) : i64
%1074 = llvm.getelementptr %1061[0, %1073] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1064, %1074 : i64, !llvm.ptr
%1075 = llvm.mlir.constant(2 : i64) : i64
%1076 = llvm.getelementptr %1061[0, %1075] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1065, %1076 : i64, !llvm.ptr
%1077 = llvm.mlir.constant(3 : i64) : i64
%1078 = llvm.getelementptr %1061[0, %1077] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1066, %1078 : i64, !llvm.ptr
%1079 = llvm.mlir.constant(4 : i64) : i64
%1080 = llvm.getelementptr %1061[0, %1079] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1067, %1080 : i64, !llvm.ptr
%1081 = llvm.mlir.constant(5 : i64) : i64
%1082 = llvm.getelementptr %1061[0, %1081] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1068, %1082 : i64, !llvm.ptr
%1083 = llvm.mlir.constant(6 : i64) : i64
%1084 = llvm.getelementptr %1061[0, %1083] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1069, %1084 : i64, !llvm.ptr
%1085 = llvm.mlir.constant(7 : i64) : i64
%1086 = llvm.getelementptr %1061[0, %1085] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1070, %1086 : i64, !llvm.ptr
%1087 = arith.constant 0 : i32
%1089 = arith.extsi %1087 : i32 to i64
%1088 = arith.cmpi sle, %arg0, %1089 : i64
cf.cond_br %1088, ^bb135, ^bb136
^bb135:
%1090 = arith.constant 0 : i32
%1091 = arith.extsi %1090 : i32 to i64
func.return %1091 : i64
^bb136:
cf.br ^bb137
^bb137:
%1092 = arith.constant 8 : i32
%1094 = arith.extsi %1092 : i32 to i64
%1093 = arith.cmpi sle, %arg0, %1094 : i64
cf.cond_br %1093, ^bb138, ^bb139
^bb138:
%1095 = arith.constant 0 : i32
%1096 = arith.extsi %1095 : i32 to i64
%1097 = llvm.mlir.constant(1 : i64) : i64
%1098 = llvm.alloca %1097 x i64 : (i64) -> !llvm.ptr
llvm.store %1096, %1098 : i64, !llvm.ptr
%1099 = arith.constant 0 : i32
%1100 = arith.extsi %1099 : i32 to i64
%1101 = llvm.mlir.constant(1 : i64) : i64
%1102 = llvm.alloca %1101 x i64 : (i64) -> !llvm.ptr
llvm.store %1100, %1102 : i64, !llvm.ptr
cf.br ^bb141
^bb141:
%1103 = llvm.load %1102 : !llvm.ptr -> i64
%1104 = arith.cmpi slt, %1103, %arg0 : i64
cf.cond_br %1104, ^bb142, ^bb143
^bb142:
%1106 = llvm.load %1102 : !llvm.ptr -> i64
%1107 = arith.trunci %1106 : i64 to i32
%1108 = arith.extsi %1107 : i32 to i64
%1109 = llvm.getelementptr %1061[0, %1108] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1105 = llvm.load %1109 : !llvm.ptr -> i64
%1111 = llvm.load %1098 : !llvm.ptr -> i64
%1113 = func.call @mod_mul(%1105, %1105) : (i64, i64) -> i64
%1112 = func.call @mod_mul(%1113, %1105) : (i64, i64) -> i64
%1110 = func.call @mod_add(%1111, %1112) : (i64, i64) -> i64
llvm.store %1110, %1098 : i64, !llvm.ptr
%1114 = llvm.load %1102 : !llvm.ptr -> i64
%1115 = arith.constant 1 : i32
%1117 = arith.extsi %1115 : i32 to i64
%1116 = arith.addi %1114, %1117 : i64
llvm.store %1116, %1102 : i64, !llvm.ptr
cf.br ^bb141
^bb143:
%1118 = llvm.load %1098 : !llvm.ptr -> i64
func.return %1118 : i64
^bb139:
cf.br ^bb140
^bb140:
%1119 = arith.constant 0 : i32
%1120 = arith.extsi %1119 : i32 to i64
%1121 = llvm.mlir.constant(1 : i64) : i64
%1122 = llvm.alloca %1121 x i64 : (i64) -> !llvm.ptr
llvm.store %1120, %1122 : i64, !llvm.ptr
%1123 = arith.constant 0 : i32
%1124 = llvm.mlir.constant(1 : i64) : i64
%1125 = llvm.alloca %1124 x i32 : (i64) -> !llvm.ptr
llvm.store %1123, %1125 : i32, !llvm.ptr
cf.br ^bb144
^bb144:
%1126 = llvm.load %1125 : !llvm.ptr -> i32
%1127 = arith.constant 7 : i32
%1128 = arith.cmpi slt, %1126, %1127 : i32
cf.cond_br %1128, ^bb145, ^bb146
^bb145:
%1130 = llvm.load %1125 : !llvm.ptr -> i32
%1131 = arith.extsi %1130 : i32 to i64
%1132 = llvm.getelementptr %1061[0, %1131] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1129 = llvm.load %1132 : !llvm.ptr -> i64
%1134 = llvm.load %1122 : !llvm.ptr -> i64
%1136 = func.call @mod_mul(%1129, %1129) : (i64, i64) -> i64
%1135 = func.call @mod_mul(%1136, %1129) : (i64, i64) -> i64
%1133 = func.call @mod_add(%1134, %1135) : (i64, i64) -> i64
llvm.store %1133, %1122 : i64, !llvm.ptr
%1137 = llvm.load %1125 : !llvm.ptr -> i32
%1138 = arith.constant 1 : i32
%1139 = arith.addi %1137, %1138 : i32
llvm.store %1139, %1125 : i32, !llvm.ptr
cf.br ^bb144
^bb146:
%1141 = arith.constant 8 : i32
%1142 = arith.constant 8 : i32
%1143 = arith.extsi %1141 : i32 to i64
%1144 = arith.extsi %1142 : i32 to i64
%1140 = func.call @calloc(%1143, %1144) : (i64, i64) -> !llvm.ptr
%1146 = arith.constant 64 : i32
%1147 = arith.constant 8 : i32
%1148 = arith.extsi %1146 : i32 to i64
%1149 = arith.extsi %1147 : i32 to i64
%1145 = func.call @calloc(%1148, %1149) : (i64, i64) -> !llvm.ptr
%1150 = llvm.mlir.zero : !llvm.ptr
%1151 = llvm.icmp "eq" %1140, %1150 : !llvm.ptr
%1152 = scf.if %1151 -> (i1) {
%1153 = arith.constant true
scf.yield %1153 : i1
} else {
%1154 = llvm.mlir.zero : !llvm.ptr
%1155 = llvm.icmp "eq" %1145, %1154 : !llvm.ptr
scf.yield %1155 : i1
}
cf.cond_br %1152, ^bb147, ^bb148
^bb147:
%1156 = arith.constant 0 : i32
%1157 = arith.extsi %1156 : i32 to i64
func.return %1157 : i64
^bb148:
cf.br ^bb149
^bb149:
%1159 = arith.constant 7 : i32
%1160 = arith.extsi %1159 : i32 to i64
%1161 = llvm.getelementptr %1061[0, %1160] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1158 = llvm.load %1161 : !llvm.ptr -> i64
%1162 = arith.constant 0 : i32
%1163 = arith.extsi %1162 : i32 to i64
%1164 = llvm.getelementptr %1140[%1163] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1158, %1164 : i64, !llvm.ptr
%1166 = arith.constant 6 : i32
%1167 = arith.extsi %1166 : i32 to i64
%1168 = llvm.getelementptr %1061[0, %1167] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1165 = llvm.load %1168 : !llvm.ptr -> i64
%1169 = arith.constant 1 : i32
%1170 = arith.extsi %1169 : i32 to i64
%1171 = llvm.getelementptr %1140[%1170] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1165, %1171 : i64, !llvm.ptr
%1173 = arith.constant 5 : i32
%1174 = arith.extsi %1173 : i32 to i64
%1175 = llvm.getelementptr %1061[0, %1174] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1172 = llvm.load %1175 : !llvm.ptr -> i64
%1176 = arith.constant 2 : i32
%1177 = arith.extsi %1176 : i32 to i64
%1178 = llvm.getelementptr %1140[%1177] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1172, %1178 : i64, !llvm.ptr
%1180 = arith.constant 4 : i32
%1181 = arith.extsi %1180 : i32 to i64
%1182 = llvm.getelementptr %1061[0, %1181] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1179 = llvm.load %1182 : !llvm.ptr -> i64
%1183 = arith.constant 3 : i32
%1184 = arith.extsi %1183 : i32 to i64
%1185 = llvm.getelementptr %1140[%1184] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1179, %1185 : i64, !llvm.ptr
%1187 = arith.constant 3 : i32
%1188 = arith.extsi %1187 : i32 to i64
%1189 = llvm.getelementptr %1061[0, %1188] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1186 = llvm.load %1189 : !llvm.ptr -> i64
%1190 = arith.constant 4 : i32
%1191 = arith.extsi %1190 : i32 to i64
%1192 = llvm.getelementptr %1140[%1191] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1186, %1192 : i64, !llvm.ptr
%1194 = arith.constant 2 : i32
%1195 = arith.extsi %1194 : i32 to i64
%1196 = llvm.getelementptr %1061[0, %1195] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1193 = llvm.load %1196 : !llvm.ptr -> i64
%1197 = arith.constant 5 : i32
%1198 = arith.extsi %1197 : i32 to i64
%1199 = llvm.getelementptr %1140[%1198] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1193, %1199 : i64, !llvm.ptr
%1201 = arith.constant 1 : i32
%1202 = arith.extsi %1201 : i32 to i64
%1203 = llvm.getelementptr %1061[0, %1202] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1200 = llvm.load %1203 : !llvm.ptr -> i64
%1204 = arith.constant 6 : i32
%1205 = arith.extsi %1204 : i32 to i64
%1206 = llvm.getelementptr %1140[%1205] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1200, %1206 : i64, !llvm.ptr
%1208 = arith.constant 0 : i32
%1209 = arith.extsi %1208 : i32 to i64
%1210 = llvm.getelementptr %1061[0, %1209] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1207 = llvm.load %1210 : !llvm.ptr -> i64
%1211 = arith.constant 7 : i32
%1212 = arith.extsi %1211 : i32 to i64
%1213 = llvm.getelementptr %1140[%1212] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1207, %1213 : i64, !llvm.ptr
%1215 = arith.constant 2 : i32
%1216 = arith.constant 1 : i32
%1218 = arith.constant 0 : i32
%1217 = arith.subi %1218, %1216 : i32
%1219 = arith.constant 2 : i32
%1220 = arith.constant 1 : i32
%1221 = arith.constant 1 : i32
%1222 = arith.constant 0 : i32
%1223 = arith.constant 1 : i32
%1225 = arith.constant 0 : i32
%1224 = arith.subi %1225, %1223 : i32
%1226 = arith.constant 1 : i32
%1228 = arith.constant 0 : i32
%1227 = arith.subi %1228, %1226 : i32
%1229 = llvm.mlir.constant(1 : i64) : i64
%1230 = llvm.alloca %1229 x !llvm.array<8 x i64> : (i64) -> !llvm.ptr
%1231 = llvm.mlir.zero : !llvm.array<8 x i64>
llvm.store %1231, %1230 : !llvm.array<8 x i64>, !llvm.ptr
%1232 = arith.extsi %1215 : i32 to i64
%1233 = arith.extsi %1217 : i32 to i64
%1234 = arith.extsi %1219 : i32 to i64
%1235 = arith.extsi %1220 : i32 to i64
%1236 = arith.extsi %1221 : i32 to i64
%1237 = arith.extsi %1222 : i32 to i64
%1238 = arith.extsi %1224 : i32 to i64
%1239 = arith.extsi %1227 : i32 to i64
%1240 = llvm.mlir.constant(0 : i64) : i64
%1241 = llvm.getelementptr %1230[0, %1240] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1232, %1241 : i64, !llvm.ptr
%1242 = llvm.mlir.constant(1 : i64) : i64
%1243 = llvm.getelementptr %1230[0, %1242] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1233, %1243 : i64, !llvm.ptr
%1244 = llvm.mlir.constant(2 : i64) : i64
%1245 = llvm.getelementptr %1230[0, %1244] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1234, %1245 : i64, !llvm.ptr
%1246 = llvm.mlir.constant(3 : i64) : i64
%1247 = llvm.getelementptr %1230[0, %1246] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1235, %1247 : i64, !llvm.ptr
%1248 = llvm.mlir.constant(4 : i64) : i64
%1249 = llvm.getelementptr %1230[0, %1248] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1236, %1249 : i64, !llvm.ptr
%1250 = llvm.mlir.constant(5 : i64) : i64
%1251 = llvm.getelementptr %1230[0, %1250] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1237, %1251 : i64, !llvm.ptr
%1252 = llvm.mlir.constant(6 : i64) : i64
%1253 = llvm.getelementptr %1230[0, %1252] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1238, %1253 : i64, !llvm.ptr
%1254 = llvm.mlir.constant(7 : i64) : i64
%1255 = llvm.getelementptr %1230[0, %1254] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
llvm.store %1239, %1255 : i64, !llvm.ptr
%1256 = arith.constant 0 : i32
%1257 = llvm.mlir.constant(1 : i64) : i64
%1258 = llvm.alloca %1257 x i32 : (i64) -> !llvm.ptr
llvm.store %1256, %1258 : i32, !llvm.ptr
cf.br ^bb150
^bb150:
%1259 = llvm.load %1258 : !llvm.ptr -> i32
%1260 = llvm.mlir.addressof @DIM : !llvm.ptr
%1261 = llvm.load %1260 : !llvm.ptr -> i32
%1262 = arith.cmpi slt, %1259, %1261 : i32
cf.cond_br %1262, ^bb151, ^bb152
^bb151:
%1264 = llvm.load %1258 : !llvm.ptr -> i32
%1265 = arith.extsi %1264 : i32 to i64
%1266 = llvm.getelementptr %1230[0, %1265] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<8 x i64>
%1263 = llvm.load %1266 : !llvm.ptr -> i64
%1267 = llvm.mlir.addressof @MOD : !llvm.ptr
%1268 = llvm.load %1267 : !llvm.ptr -> i64
%1269 = arith.remsi %1263, %1268 : i64
%1270 = llvm.mlir.constant(1 : i64) : i64
%1271 = llvm.alloca %1270 x i64 : (i64) -> !llvm.ptr
llvm.store %1269, %1271 : i64, !llvm.ptr
%1272 = llvm.load %1271 : !llvm.ptr -> i64
%1273 = arith.constant 0 : i32
%1275 = arith.extsi %1273 : i32 to i64
%1274 = arith.cmpi slt, %1272, %1275 : i64
cf.cond_br %1274, ^bb153, ^bb154
^bb153:
%1276 = llvm.load %1271 : !llvm.ptr -> i64
%1277 = llvm.mlir.addressof @MOD : !llvm.ptr
%1278 = llvm.load %1277 : !llvm.ptr -> i64
%1279 = arith.addi %1276, %1278 : i64
llvm.store %1279, %1271 : i64, !llvm.ptr
cf.br ^bb155
^bb154:
cf.br ^bb155
^bb155:
%1280 = llvm.load %1271 : !llvm.ptr -> i64
%1281 = llvm.load %1258 : !llvm.ptr -> i32
%1282 = arith.extsi %1281 : i32 to i64
%1283 = llvm.getelementptr %1145[%1282] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1280, %1283 : i64, !llvm.ptr
%1284 = llvm.load %1258 : !llvm.ptr -> i32
%1285 = arith.constant 1 : i32
%1286 = arith.addi %1284, %1285 : i32
llvm.store %1286, %1258 : i32, !llvm.ptr
cf.br ^bb150
^bb152:
%1287 = arith.constant 1 : i32
%1288 = llvm.mlir.constant(1 : i64) : i64
%1289 = llvm.alloca %1288 x i32 : (i64) -> !llvm.ptr
llvm.store %1287, %1289 : i32, !llvm.ptr
cf.br ^bb156
^bb156:
%1290 = llvm.load %1289 : !llvm.ptr -> i32
%1291 = llvm.mlir.addressof @DIM : !llvm.ptr
%1292 = llvm.load %1291 : !llvm.ptr -> i32
%1293 = arith.cmpi slt, %1290, %1292 : i32
cf.cond_br %1293, ^bb157, ^bb158
^bb157:
%1294 = arith.constant 1 : i32
%1295 = llvm.load %1289 : !llvm.ptr -> i32
%1296 = llvm.mlir.addressof @DIM : !llvm.ptr
%1297 = llvm.load %1296 : !llvm.ptr -> i32
%1298 = arith.muli %1295, %1297 : i32
%1299 = llvm.load %1289 : !llvm.ptr -> i32
%1300 = arith.constant 1 : i32
%1301 = arith.subi %1299, %1300 : i32
%1302 = arith.addi %1298, %1301 : i32
%1303 = arith.extsi %1302 : i32 to i64
%1304 = arith.extsi %1294 : i32 to i64
%1305 = llvm.getelementptr %1145[%1303] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1304, %1305 : i64, !llvm.ptr
%1306 = llvm.load %1289 : !llvm.ptr -> i32
%1307 = arith.constant 1 : i32
%1308 = arith.addi %1306, %1307 : i32
llvm.store %1308, %1289 : i32, !llvm.ptr
cf.br ^bb156
^bb158:
%1310 = arith.constant 7 : i32
%1312 = arith.extsi %1310 : i32 to i64
%1311 = arith.subi %arg0, %1312 : i64
%1309 = func.call @sum_cubes_from_state(%1140, %1311, %1145) : (!llvm.ptr, i64, !llvm.ptr) -> i64
func.call @free(%1145) : (!llvm.ptr) -> ()
func.call @free(%1140) : (!llvm.ptr) -> ()
%1316 = llvm.load %1122 : !llvm.ptr -> i64
%1315 = func.call @mod_add(%1316, %1309) : (i64, i64) -> i64
func.return %1315 : i64
}
func.func @main() -> i32 {
%1318 = arith.constant 99995705032704 : i32
%1319 = arith.extsi %1318 : i32 to i64
%1317 = func.call @S_mod(%1319) : (i64) -> i64
%1320 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1321 = llvm.call @printf(%1320, %1317) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
%1322 = arith.constant 0 : i32
func.return %1322 : i32
}
}