← All problems
Problem 980
Count ordered pairs (i, j) with 0 <= i, j < N such that the concatenation c(i)c(j) of 50-letter {x,y,z} strings is neutral. Neutrality maps to the quaternion group Q8 product being +1 under x -> i, y -> j, z -> -k.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^2)?
Space complexity O(1)?
Approach Flow solution Not curated
Verdict Unknown
Flow source
# Project Euler 980
# Count ordered pairs (i, j) with 0 <= i, j < N such that the
# concatenation c(i)c(j) of 50-letter {x,y,z} strings is neutral.
# Neutrality maps to the quaternion group Q8 product being +1 under
# x -> i, y -> j, z -> -k.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
function build_mul_table_q8(mul: ptr<i32>) -> void {
# Elements 0..7: 0:1, 1:i, 2:j, 3:k, 4:-1, 5:-i, 6:-j, 7:-k
# base[a][b] and sgn[a][b] stored as 4x4 arrays
let base: ptr<i32> = calloc(16, 4)
let sgn: ptr<i32> = calloc(16, 4)
let mut a: i32 = 0
while a < 4 {
let mut b: i32 = 0
while b < 4 {
if a == 0 {
base[a * 4 + b] = b
sgn[a * 4 + b] = 1
} else {
if b == 0 {
base[a * 4 + b] = a
sgn[a * 4 + b] = 1
} else {
if a == b {
base[a * 4 + b] = 0
sgn[a * 4 + b] = -1
} else {
if a == 1 && b == 2 {
base[a * 4 + b] = 3
sgn[a * 4 + b] = 1
} else {
if a == 2 && b == 3 {
base[a * 4 + b] = 1
sgn[a * 4 + b] = 1
} else {
if a == 3 && b == 1 {
base[a * 4 + b] = 2
sgn[a * 4 + b] = 1
} else {
if a == 2 && b == 1 {
base[a * 4 + b] = 3
sgn[a * 4 + b] = -1
} else {
if a == 3 && b == 2 {
base[a * 4 + b] = 1
sgn[a * 4 + b] = -1
} else {
if a == 1 && b == 3 {
base[a * 4 + b] = 2
sgn[a * 4 + b] = -1
}
}
}
}
}
}
}
}
}
b = b + 1
}
a = a + 1
}
let mut A: i32 = 0
while A < 8 {
let sa_val: i32 = if A < 4 { 1 } else { -1 }
let a_idx: i32 = A & 3
let mut B: i32 = 0
while B < 8 {
let sb_val: i32 = if B < 4 { 1 } else { -1 }
let b_idx: i32 = B & 3
let s: i32 = sa_val * sb_val * sgn[a_idx * 4 + b_idx]
let c: i32 = base[a_idx * 4 + b_idx]
if s == 1 {
mul[A * 8 + B] = c
} else {
mul[A * 8 + B] = c ^ 4
}
B = B + 1
}
A = A + 1
}
free(base)
free(sgn)
}
function main() -> i32 {
let mul: ptr<i32> = calloc(64, 4)
build_mul_table_q8(mul)
# x -> i (1), y -> j (2), z -> -k (7)
let gen: array<i32, 3> = [1, 2, 7]
# Right-multiply table: R[v*3 + b] = mul[v][gen[b]]
let R: ptr<i32> = calloc(24, 4)
let mut v: i64 = 0
while v < 8 {
let mut b: i64 = 0
while b < 3 {
R[v * 3 + b] = mul[v * 8 + (gen[b] as i64)]
b = b + 1
}
v = v + 1
}
# Inverses in Q8
let inv: ptr<i32> = calloc(8, 4)
let mut e: i64 = 0
while e < 8 {
let mut f: i64 = 0
while f < 8 {
if mul[e * 8 + f] == 0 && mul[f * 8 + e] == 0 {
inv[e] = f as i32
break
}
f = f + 1
}
e = e + 1
}
let MOD: i64 = 888888883
let MULT: i64 = 8888
let mut a: i64 = 88888888
let N: i64 = 1000000
let counts: ptr<i64> = calloc(8, 8)
let mut i: i64 = 0
while i < 8 {
counts[i] = 0
i = i + 1
}
i = 0
while i < N {
let mut qv: i64 = 0
let mut j: i64 = 0
while j < 50 {
qv = R[qv * 3 + (a % 3)] as i64
a = (a * MULT) % MOD
j = j + 1
}
counts[qv] = counts[qv] + 1
i = i + 1
}
let mut total: i64 = 0
let mut e2: i64 = 0
while e2 < 8 {
total = total + counts[e2] * counts[inv[e2] as i64]
e2 = e2 + 1
}
printf("%lld\n", total)
free(mul)
free(R)
free(inv)
free(counts)
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; }
void build_mul_table_q8_ptr_i32(int32_t* mul);
int32_t main(void);
void build_mul_table_q8_ptr_i32(int32_t* mul) {
int32_t* base = (int32_t*)(calloc(16, 4));
int32_t* sgn = (int32_t*)(calloc(16, 4));
int32_t a = 0;
while (a < 4) {
int32_t b = 0;
while (b < 4) {
if (a == 0) {
base[((a * 4) + b)] = b;
sgn[((a * 4) + b)] = 1;
} else {
if (b == 0) {
base[((a * 4) + b)] = a;
sgn[((a * 4) + b)] = 1;
} else {
if (a == b) {
base[((a * 4) + b)] = 0;
sgn[((a * 4) + b)] = (-1);
} else {
if ((a == 1 && b == 2)) {
base[((a * 4) + b)] = 3;
sgn[((a * 4) + b)] = 1;
} else {
if ((a == 2 && b == 3)) {
base[((a * 4) + b)] = 1;
sgn[((a * 4) + b)] = 1;
} else {
if ((a == 3 && b == 1)) {
base[((a * 4) + b)] = 2;
sgn[((a * 4) + b)] = 1;
} else {
if ((a == 2 && b == 1)) {
base[((a * 4) + b)] = 3;
sgn[((a * 4) + b)] = (-1);
} else {
if ((a == 3 && b == 2)) {
base[((a * 4) + b)] = 1;
sgn[((a * 4) + b)] = (-1);
} else {
if ((a == 1 && b == 3)) {
base[((a * 4) + b)] = 2;
sgn[((a * 4) + b)] = (-1);
}
}
}
}
}
}
}
}
}
b = (b + 1);
}
a = (a + 1);
}
int32_t A = 0;
while (A < 8) {
int32_t sa_val = ((A < 4) ? (1) : ((-1)));
int32_t a_idx = (A & 3);
int32_t B = 0;
while (B < 8) {
int32_t sb_val = ((B < 4) ? (1) : ((-1)));
int32_t b_idx = (B & 3);
int32_t s = ((sa_val * sb_val) * sgn[((a_idx * 4) + b_idx)]);
int32_t c = base[((a_idx * 4) + b_idx)];
if (s == 1) {
mul[((A * 8) + B)] = c;
} else {
mul[((A * 8) + B)] = (c ^ 4);
}
B = (B + 1);
}
A = (A + 1);
}
free(base);
free(sgn);
}
int32_t main(void) {
int32_t* mul = (int32_t*)(calloc(64, 4));
build_mul_table_q8_ptr_i32(mul);
int32_t gen[3] = { 1, 2, 7 };
int32_t* R = (int32_t*)(calloc(24, 4));
int64_t v = 0;
while (v < 8) {
int64_t b = 0;
while (b < 3) {
R[((v * 3) + b)] = mul[((v * 8) + ((int64_t)((((unsigned)(b) < 3) ? gen[b] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(b), 3), flow_fault_handler("array index out of bounds"), gen[0])))))];
b = (b + 1);
}
v = (v + 1);
}
int32_t* inv = (int32_t*)(calloc(8, 4));
int64_t e = 0;
while (e < 8) {
int64_t f = 0;
while (f < 8) {
if ((mul[((e * 8) + f)] == 0 && mul[((f * 8) + e)] == 0)) {
inv[e] = ((int32_t)(f));
break;
}
f = (f + 1);
}
e = (e + 1);
}
int64_t MOD = 888888883;
int64_t MULT = 8888;
int64_t a = 88888888;
int64_t N = 1000000;
int64_t* counts = (int64_t*)(calloc(8, 8));
int64_t i = 0;
while (i < 8) {
counts[i] = 0;
i = (i + 1);
}
i = 0;
while (i < N) {
int64_t qv = 0;
int64_t j = 0;
while (j < 50) {
qv = ((int64_t)(R[((qv * 3) + FLOW_CHECKED_MOD((a), (3)))]));
a = FLOW_CHECKED_MOD(((a * MULT)), (MOD));
j = (j + 1);
}
counts[qv] = (counts[qv] + 1);
i = (i + 1);
}
int64_t total = 0;
int64_t e2 = 0;
while (e2 < 8) {
total = (total + (counts[e2] * counts[((int64_t)(inv[e2]))]));
e2 = (e2 + 1);
}
printf("%lld\n", total);
free(mul);
free(R);
free(inv);
free(counts);
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 @build_mul_table_q8(%arg0: !llvm.ptr) -> () {
%1 = arith.constant 16 : i32
%2 = arith.constant 4 : i32
%3 = arith.extsi %1 : i32 to i64
%4 = arith.extsi %2 : i32 to i64
%0 = func.call @calloc(%3, %4) : (i64, i64) -> !llvm.ptr
%6 = arith.constant 16 : i32
%7 = arith.constant 4 : i32
%8 = arith.extsi %6 : i32 to i64
%9 = arith.extsi %7 : i32 to i64
%5 = func.call @calloc(%8, %9) : (i64, i64) -> !llvm.ptr
%10 = arith.constant 0 : i32
%11 = llvm.mlir.constant(1 : i64) : i64
%12 = llvm.alloca %11 x i32 : (i64) -> !llvm.ptr
llvm.store %10, %12 : i32, !llvm.ptr
cf.br ^bb0
^bb0:
%13 = llvm.load %12 : !llvm.ptr -> i32
%14 = arith.constant 4 : i32
%15 = arith.cmpi slt, %13, %14 : i32
cf.cond_br %15, ^bb1, ^bb2
^bb1:
%16 = arith.constant 0 : i32
%17 = llvm.mlir.constant(1 : i64) : i64
%18 = llvm.alloca %17 x i32 : (i64) -> !llvm.ptr
llvm.store %16, %18 : i32, !llvm.ptr
cf.br ^bb3
^bb3:
%19 = llvm.load %18 : !llvm.ptr -> i32
%20 = arith.constant 4 : i32
%21 = arith.cmpi slt, %19, %20 : i32
cf.cond_br %21, ^bb4, ^bb5
^bb4:
%22 = llvm.load %12 : !llvm.ptr -> i32
%23 = arith.constant 0 : i32
%24 = arith.cmpi eq, %22, %23 : i32
cf.cond_br %24, ^bb6, ^bb7
^bb6:
%25 = llvm.load %18 : !llvm.ptr -> i32
%26 = llvm.load %12 : !llvm.ptr -> i32
%27 = arith.constant 4 : i32
%28 = arith.muli %26, %27 : i32
%29 = llvm.load %18 : !llvm.ptr -> i32
%30 = arith.addi %28, %29 : i32
%31 = arith.extsi %30 : i32 to i64
%32 = llvm.getelementptr %0[%31] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %25, %32 : i32, !llvm.ptr
%33 = arith.constant 1 : i32
%34 = llvm.load %12 : !llvm.ptr -> i32
%35 = arith.constant 4 : i32
%36 = arith.muli %34, %35 : i32
%37 = llvm.load %18 : !llvm.ptr -> i32
%38 = arith.addi %36, %37 : i32
%39 = arith.extsi %38 : i32 to i64
%40 = llvm.getelementptr %5[%39] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %33, %40 : i32, !llvm.ptr
cf.br ^bb8
^bb7:
%41 = llvm.load %18 : !llvm.ptr -> i32
%42 = arith.constant 0 : i32
%43 = arith.cmpi eq, %41, %42 : i32
cf.cond_br %43, ^bb9, ^bb10
^bb9:
%44 = llvm.load %12 : !llvm.ptr -> i32
%45 = llvm.load %12 : !llvm.ptr -> i32
%46 = arith.constant 4 : i32
%47 = arith.muli %45, %46 : i32
%48 = llvm.load %18 : !llvm.ptr -> i32
%49 = arith.addi %47, %48 : i32
%50 = arith.extsi %49 : i32 to i64
%51 = llvm.getelementptr %0[%50] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %44, %51 : i32, !llvm.ptr
%52 = arith.constant 1 : i32
%53 = llvm.load %12 : !llvm.ptr -> i32
%54 = arith.constant 4 : i32
%55 = arith.muli %53, %54 : i32
%56 = llvm.load %18 : !llvm.ptr -> i32
%57 = arith.addi %55, %56 : i32
%58 = arith.extsi %57 : i32 to i64
%59 = llvm.getelementptr %5[%58] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %52, %59 : i32, !llvm.ptr
cf.br ^bb11
^bb10:
%60 = llvm.load %12 : !llvm.ptr -> i32
%61 = llvm.load %18 : !llvm.ptr -> i32
%62 = arith.cmpi eq, %60, %61 : i32
cf.cond_br %62, ^bb12, ^bb13
^bb12:
%63 = arith.constant 0 : i32
%64 = llvm.load %12 : !llvm.ptr -> i32
%65 = arith.constant 4 : i32
%66 = arith.muli %64, %65 : i32
%67 = llvm.load %18 : !llvm.ptr -> i32
%68 = arith.addi %66, %67 : i32
%69 = arith.extsi %68 : i32 to i64
%70 = llvm.getelementptr %0[%69] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %63, %70 : i32, !llvm.ptr
%71 = arith.constant 1 : i32
%73 = arith.constant 0 : i32
%72 = arith.subi %73, %71 : i32
%74 = llvm.load %12 : !llvm.ptr -> i32
%75 = arith.constant 4 : i32
%76 = arith.muli %74, %75 : i32
%77 = llvm.load %18 : !llvm.ptr -> i32
%78 = arith.addi %76, %77 : i32
%79 = arith.extsi %78 : i32 to i64
%80 = llvm.getelementptr %5[%79] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %72, %80 : i32, !llvm.ptr
cf.br ^bb14
^bb13:
%81 = llvm.load %12 : !llvm.ptr -> i32
%82 = arith.constant 1 : i32
%83 = arith.cmpi eq, %81, %82 : i32
%84 = scf.if %83 -> (i1) {
%85 = llvm.load %18 : !llvm.ptr -> i32
%86 = arith.constant 2 : i32
%87 = arith.cmpi eq, %85, %86 : i32
scf.yield %87 : i1
} else {
%88 = arith.constant false
scf.yield %88 : i1
}
cf.cond_br %84, ^bb15, ^bb16
^bb15:
%89 = arith.constant 3 : i32
%90 = llvm.load %12 : !llvm.ptr -> i32
%91 = arith.constant 4 : i32
%92 = arith.muli %90, %91 : i32
%93 = llvm.load %18 : !llvm.ptr -> i32
%94 = arith.addi %92, %93 : i32
%95 = arith.extsi %94 : i32 to i64
%96 = llvm.getelementptr %0[%95] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %89, %96 : i32, !llvm.ptr
%97 = arith.constant 1 : i32
%98 = llvm.load %12 : !llvm.ptr -> i32
%99 = arith.constant 4 : i32
%100 = arith.muli %98, %99 : i32
%101 = llvm.load %18 : !llvm.ptr -> i32
%102 = arith.addi %100, %101 : i32
%103 = arith.extsi %102 : i32 to i64
%104 = llvm.getelementptr %5[%103] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %97, %104 : i32, !llvm.ptr
cf.br ^bb17
^bb16:
%105 = llvm.load %12 : !llvm.ptr -> i32
%106 = arith.constant 2 : i32
%107 = arith.cmpi eq, %105, %106 : i32
%108 = scf.if %107 -> (i1) {
%109 = llvm.load %18 : !llvm.ptr -> i32
%110 = arith.constant 3 : i32
%111 = arith.cmpi eq, %109, %110 : i32
scf.yield %111 : i1
} else {
%112 = arith.constant false
scf.yield %112 : i1
}
cf.cond_br %108, ^bb18, ^bb19
^bb18:
%113 = arith.constant 1 : i32
%114 = llvm.load %12 : !llvm.ptr -> i32
%115 = arith.constant 4 : i32
%116 = arith.muli %114, %115 : i32
%117 = llvm.load %18 : !llvm.ptr -> i32
%118 = arith.addi %116, %117 : i32
%119 = arith.extsi %118 : i32 to i64
%120 = llvm.getelementptr %0[%119] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %113, %120 : i32, !llvm.ptr
%121 = arith.constant 1 : i32
%122 = llvm.load %12 : !llvm.ptr -> i32
%123 = arith.constant 4 : i32
%124 = arith.muli %122, %123 : i32
%125 = llvm.load %18 : !llvm.ptr -> i32
%126 = arith.addi %124, %125 : i32
%127 = arith.extsi %126 : i32 to i64
%128 = llvm.getelementptr %5[%127] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %121, %128 : i32, !llvm.ptr
cf.br ^bb20
^bb19:
%129 = llvm.load %12 : !llvm.ptr -> i32
%130 = arith.constant 3 : i32
%131 = arith.cmpi eq, %129, %130 : i32
%132 = scf.if %131 -> (i1) {
%133 = llvm.load %18 : !llvm.ptr -> i32
%134 = arith.constant 1 : i32
%135 = arith.cmpi eq, %133, %134 : i32
scf.yield %135 : i1
} else {
%136 = arith.constant false
scf.yield %136 : i1
}
cf.cond_br %132, ^bb21, ^bb22
^bb21:
%137 = arith.constant 2 : i32
%138 = llvm.load %12 : !llvm.ptr -> i32
%139 = arith.constant 4 : i32
%140 = arith.muli %138, %139 : i32
%141 = llvm.load %18 : !llvm.ptr -> i32
%142 = arith.addi %140, %141 : i32
%143 = arith.extsi %142 : i32 to i64
%144 = llvm.getelementptr %0[%143] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %137, %144 : i32, !llvm.ptr
%145 = arith.constant 1 : i32
%146 = llvm.load %12 : !llvm.ptr -> i32
%147 = arith.constant 4 : i32
%148 = arith.muli %146, %147 : i32
%149 = llvm.load %18 : !llvm.ptr -> i32
%150 = arith.addi %148, %149 : i32
%151 = arith.extsi %150 : i32 to i64
%152 = llvm.getelementptr %5[%151] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %145, %152 : i32, !llvm.ptr
cf.br ^bb23
^bb22:
%153 = llvm.load %12 : !llvm.ptr -> i32
%154 = arith.constant 2 : i32
%155 = arith.cmpi eq, %153, %154 : i32
%156 = scf.if %155 -> (i1) {
%157 = llvm.load %18 : !llvm.ptr -> i32
%158 = arith.constant 1 : i32
%159 = arith.cmpi eq, %157, %158 : i32
scf.yield %159 : i1
} else {
%160 = arith.constant false
scf.yield %160 : i1
}
cf.cond_br %156, ^bb24, ^bb25
^bb24:
%161 = arith.constant 3 : i32
%162 = llvm.load %12 : !llvm.ptr -> i32
%163 = arith.constant 4 : i32
%164 = arith.muli %162, %163 : i32
%165 = llvm.load %18 : !llvm.ptr -> i32
%166 = arith.addi %164, %165 : i32
%167 = arith.extsi %166 : i32 to i64
%168 = llvm.getelementptr %0[%167] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %161, %168 : i32, !llvm.ptr
%169 = arith.constant 1 : i32
%171 = arith.constant 0 : i32
%170 = arith.subi %171, %169 : i32
%172 = llvm.load %12 : !llvm.ptr -> i32
%173 = arith.constant 4 : i32
%174 = arith.muli %172, %173 : i32
%175 = llvm.load %18 : !llvm.ptr -> i32
%176 = arith.addi %174, %175 : i32
%177 = arith.extsi %176 : i32 to i64
%178 = llvm.getelementptr %5[%177] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %170, %178 : i32, !llvm.ptr
cf.br ^bb26
^bb25:
%179 = llvm.load %12 : !llvm.ptr -> i32
%180 = arith.constant 3 : i32
%181 = arith.cmpi eq, %179, %180 : i32
%182 = scf.if %181 -> (i1) {
%183 = llvm.load %18 : !llvm.ptr -> i32
%184 = arith.constant 2 : i32
%185 = arith.cmpi eq, %183, %184 : i32
scf.yield %185 : i1
} else {
%186 = arith.constant false
scf.yield %186 : i1
}
cf.cond_br %182, ^bb27, ^bb28
^bb27:
%187 = arith.constant 1 : i32
%188 = llvm.load %12 : !llvm.ptr -> i32
%189 = arith.constant 4 : i32
%190 = arith.muli %188, %189 : i32
%191 = llvm.load %18 : !llvm.ptr -> i32
%192 = arith.addi %190, %191 : i32
%193 = arith.extsi %192 : i32 to i64
%194 = llvm.getelementptr %0[%193] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %187, %194 : i32, !llvm.ptr
%195 = arith.constant 1 : i32
%197 = arith.constant 0 : i32
%196 = arith.subi %197, %195 : i32
%198 = llvm.load %12 : !llvm.ptr -> i32
%199 = arith.constant 4 : i32
%200 = arith.muli %198, %199 : i32
%201 = llvm.load %18 : !llvm.ptr -> i32
%202 = arith.addi %200, %201 : i32
%203 = arith.extsi %202 : i32 to i64
%204 = llvm.getelementptr %5[%203] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %196, %204 : i32, !llvm.ptr
cf.br ^bb29
^bb28:
%205 = llvm.load %12 : !llvm.ptr -> i32
%206 = arith.constant 1 : i32
%207 = arith.cmpi eq, %205, %206 : i32
%208 = scf.if %207 -> (i1) {
%209 = llvm.load %18 : !llvm.ptr -> i32
%210 = arith.constant 3 : i32
%211 = arith.cmpi eq, %209, %210 : i32
scf.yield %211 : i1
} else {
%212 = arith.constant false
scf.yield %212 : i1
}
cf.cond_br %208, ^bb30, ^bb31
^bb30:
%213 = arith.constant 2 : i32
%214 = llvm.load %12 : !llvm.ptr -> i32
%215 = arith.constant 4 : i32
%216 = arith.muli %214, %215 : i32
%217 = llvm.load %18 : !llvm.ptr -> i32
%218 = arith.addi %216, %217 : i32
%219 = arith.extsi %218 : i32 to i64
%220 = llvm.getelementptr %0[%219] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %213, %220 : i32, !llvm.ptr
%221 = arith.constant 1 : i32
%223 = arith.constant 0 : i32
%222 = arith.subi %223, %221 : i32
%224 = llvm.load %12 : !llvm.ptr -> i32
%225 = arith.constant 4 : i32
%226 = arith.muli %224, %225 : i32
%227 = llvm.load %18 : !llvm.ptr -> i32
%228 = arith.addi %226, %227 : i32
%229 = arith.extsi %228 : i32 to i64
%230 = llvm.getelementptr %5[%229] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %222, %230 : i32, !llvm.ptr
cf.br ^bb32
^bb31:
cf.br ^bb32
^bb32:
cf.br ^bb29
^bb29:
cf.br ^bb26
^bb26:
cf.br ^bb23
^bb23:
cf.br ^bb20
^bb20:
cf.br ^bb17
^bb17:
cf.br ^bb14
^bb14:
cf.br ^bb11
^bb11:
cf.br ^bb8
^bb8:
%231 = llvm.load %18 : !llvm.ptr -> i32
%232 = arith.constant 1 : i32
%233 = arith.addi %231, %232 : i32
llvm.store %233, %18 : i32, !llvm.ptr
cf.br ^bb3
^bb5:
%234 = llvm.load %12 : !llvm.ptr -> i32
%235 = arith.constant 1 : i32
%236 = arith.addi %234, %235 : i32
llvm.store %236, %12 : i32, !llvm.ptr
cf.br ^bb0
^bb2:
%237 = arith.constant 0 : i32
%238 = llvm.mlir.constant(1 : i64) : i64
%239 = llvm.alloca %238 x i32 : (i64) -> !llvm.ptr
llvm.store %237, %239 : i32, !llvm.ptr
cf.br ^bb33
^bb33:
%240 = llvm.load %239 : !llvm.ptr -> i32
%241 = arith.constant 8 : i32
%242 = arith.cmpi slt, %240, %241 : i32
cf.cond_br %242, ^bb34, ^bb35
^bb34:
%243 = llvm.load %239 : !llvm.ptr -> i32
%244 = arith.constant 4 : i32
%245 = arith.cmpi slt, %243, %244 : i32
%246 = scf.if %245 -> (i32) {
%247 = arith.constant 1 : i32
scf.yield %247 : i32
} else {
%248 = arith.constant 1 : i32
%250 = arith.constant 0 : i32
%249 = arith.subi %250, %248 : i32
scf.yield %249 : i32
}
%251 = llvm.load %239 : !llvm.ptr -> i32
%252 = arith.constant 3 : i32
%253 = arith.andi %251, %252 : i32
%254 = arith.constant 0 : i32
%255 = llvm.mlir.constant(1 : i64) : i64
%256 = llvm.alloca %255 x i32 : (i64) -> !llvm.ptr
llvm.store %254, %256 : i32, !llvm.ptr
cf.br ^bb36
^bb36:
%257 = llvm.load %256 : !llvm.ptr -> i32
%258 = arith.constant 8 : i32
%259 = arith.cmpi slt, %257, %258 : i32
cf.cond_br %259, ^bb37, ^bb38
^bb37:
%260 = llvm.load %256 : !llvm.ptr -> i32
%261 = arith.constant 4 : i32
%262 = arith.cmpi slt, %260, %261 : i32
%263 = scf.if %262 -> (i32) {
%264 = arith.constant 1 : i32
scf.yield %264 : i32
} else {
%265 = arith.constant 1 : i32
%267 = arith.constant 0 : i32
%266 = arith.subi %267, %265 : i32
scf.yield %266 : i32
}
%268 = llvm.load %256 : !llvm.ptr -> i32
%269 = arith.constant 3 : i32
%270 = arith.andi %268, %269 : i32
%271 = arith.muli %246, %263 : i32
%273 = arith.constant 4 : i32
%274 = arith.muli %253, %273 : i32
%275 = arith.addi %274, %270 : i32
%276 = arith.extsi %275 : i32 to i64
%277 = llvm.getelementptr %5[%276] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%272 = llvm.load %277 : !llvm.ptr -> i32
%278 = arith.muli %271, %272 : i32
%280 = arith.constant 4 : i32
%281 = arith.muli %253, %280 : i32
%282 = arith.addi %281, %270 : i32
%283 = arith.extsi %282 : i32 to i64
%284 = llvm.getelementptr %0[%283] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%279 = llvm.load %284 : !llvm.ptr -> i32
%285 = arith.constant 1 : i32
%286 = arith.cmpi eq, %278, %285 : i32
cf.cond_br %286, ^bb39, ^bb40
^bb39:
%287 = llvm.load %239 : !llvm.ptr -> i32
%288 = arith.constant 8 : i32
%289 = arith.muli %287, %288 : i32
%290 = llvm.load %256 : !llvm.ptr -> i32
%291 = arith.addi %289, %290 : i32
%292 = arith.extsi %291 : i32 to i64
%293 = llvm.getelementptr %arg0[%292] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %279, %293 : i32, !llvm.ptr
cf.br ^bb41
^bb40:
%294 = arith.constant 4 : i32
%295 = arith.xori %279, %294 : i32
%296 = llvm.load %239 : !llvm.ptr -> i32
%297 = arith.constant 8 : i32
%298 = arith.muli %296, %297 : i32
%299 = llvm.load %256 : !llvm.ptr -> i32
%300 = arith.addi %298, %299 : i32
%301 = arith.extsi %300 : i32 to i64
%302 = llvm.getelementptr %arg0[%301] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %295, %302 : i32, !llvm.ptr
cf.br ^bb41
^bb41:
%303 = llvm.load %256 : !llvm.ptr -> i32
%304 = arith.constant 1 : i32
%305 = arith.addi %303, %304 : i32
llvm.store %305, %256 : i32, !llvm.ptr
cf.br ^bb36
^bb38:
%306 = llvm.load %239 : !llvm.ptr -> i32
%307 = arith.constant 1 : i32
%308 = arith.addi %306, %307 : i32
llvm.store %308, %239 : i32, !llvm.ptr
cf.br ^bb33
^bb35:
func.call @free(%0) : (!llvm.ptr) -> ()
func.call @free(%5) : (!llvm.ptr) -> ()
func.return
}
func.func @main() -> i32 {
%312 = arith.constant 64 : i32
%313 = arith.constant 4 : i32
%314 = arith.extsi %312 : i32 to i64
%315 = arith.extsi %313 : i32 to i64
%311 = func.call @calloc(%314, %315) : (i64, i64) -> !llvm.ptr
func.call @build_mul_table_q8(%311) : (!llvm.ptr) -> ()
%318 = arith.constant 1 : i32
%319 = arith.constant 2 : i32
%320 = arith.constant 7 : i32
%321 = llvm.mlir.constant(1 : i64) : i64
%322 = llvm.alloca %321 x !llvm.array<3 x i32> : (i64) -> !llvm.ptr
%323 = llvm.mlir.zero : !llvm.array<3 x i32>
llvm.store %323, %322 : !llvm.array<3 x i32>, !llvm.ptr
%324 = llvm.mlir.constant(0 : i64) : i64
%325 = llvm.getelementptr %322[0, %324] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<3 x i32>
llvm.store %318, %325 : i32, !llvm.ptr
%326 = llvm.mlir.constant(1 : i64) : i64
%327 = llvm.getelementptr %322[0, %326] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<3 x i32>
llvm.store %319, %327 : i32, !llvm.ptr
%328 = llvm.mlir.constant(2 : i64) : i64
%329 = llvm.getelementptr %322[0, %328] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<3 x i32>
llvm.store %320, %329 : i32, !llvm.ptr
%331 = arith.constant 24 : i32
%332 = arith.constant 4 : i32
%333 = arith.extsi %331 : i32 to i64
%334 = arith.extsi %332 : i32 to i64
%330 = func.call @calloc(%333, %334) : (i64, i64) -> !llvm.ptr
%335 = arith.constant 0 : i32
%336 = arith.extsi %335 : i32 to i64
%337 = llvm.mlir.constant(1 : i64) : i64
%338 = llvm.alloca %337 x i64 : (i64) -> !llvm.ptr
llvm.store %336, %338 : i64, !llvm.ptr
cf.br ^bb42
^bb42:
%339 = llvm.load %338 : !llvm.ptr -> i64
%340 = arith.constant 8 : i32
%342 = arith.extsi %340 : i32 to i64
%341 = arith.cmpi slt, %339, %342 : i64
cf.cond_br %341, ^bb43, ^bb44
^bb43:
%343 = arith.constant 0 : i32
%344 = arith.extsi %343 : i32 to i64
%345 = llvm.mlir.constant(1 : i64) : i64
%346 = llvm.alloca %345 x i64 : (i64) -> !llvm.ptr
llvm.store %344, %346 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%347 = llvm.load %346 : !llvm.ptr -> i64
%348 = arith.constant 3 : i32
%350 = arith.extsi %348 : i32 to i64
%349 = arith.cmpi slt, %347, %350 : i64
cf.cond_br %349, ^bb46, ^bb47
^bb46:
%352 = llvm.load %338 : !llvm.ptr -> i64
%353 = arith.constant 8 : i32
%355 = arith.extsi %353 : i32 to i64
%354 = arith.muli %352, %355 : i64
%357 = llvm.load %346 : !llvm.ptr -> i64
%358 = llvm.getelementptr %322[0, %357] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<3 x i32>
%356 = llvm.load %358 : !llvm.ptr -> i32
%359 = arith.extsi %356 : i32 to i64
%360 = arith.addi %354, %359 : i64
%361 = llvm.getelementptr %311[%360] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%351 = llvm.load %361 : !llvm.ptr -> i32
%362 = llvm.load %338 : !llvm.ptr -> i64
%363 = arith.constant 3 : i32
%365 = arith.extsi %363 : i32 to i64
%364 = arith.muli %362, %365 : i64
%366 = llvm.load %346 : !llvm.ptr -> i64
%367 = arith.addi %364, %366 : i64
%368 = llvm.getelementptr %330[%367] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %351, %368 : i32, !llvm.ptr
%369 = llvm.load %346 : !llvm.ptr -> i64
%370 = arith.constant 1 : i32
%372 = arith.extsi %370 : i32 to i64
%371 = arith.addi %369, %372 : i64
llvm.store %371, %346 : i64, !llvm.ptr
cf.br ^bb45
^bb47:
%373 = llvm.load %338 : !llvm.ptr -> i64
%374 = arith.constant 1 : i32
%376 = arith.extsi %374 : i32 to i64
%375 = arith.addi %373, %376 : i64
llvm.store %375, %338 : i64, !llvm.ptr
cf.br ^bb42
^bb44:
%378 = arith.constant 8 : i32
%379 = arith.constant 4 : i32
%380 = arith.extsi %378 : i32 to i64
%381 = arith.extsi %379 : i32 to i64
%377 = func.call @calloc(%380, %381) : (i64, i64) -> !llvm.ptr
%382 = arith.constant 0 : i32
%383 = arith.extsi %382 : i32 to i64
%384 = llvm.mlir.constant(1 : i64) : i64
%385 = llvm.alloca %384 x i64 : (i64) -> !llvm.ptr
llvm.store %383, %385 : i64, !llvm.ptr
cf.br ^bb48
^bb48:
%386 = llvm.load %385 : !llvm.ptr -> i64
%387 = arith.constant 8 : i32
%389 = arith.extsi %387 : i32 to i64
%388 = arith.cmpi slt, %386, %389 : i64
cf.cond_br %388, ^bb49, ^bb50
^bb49:
%390 = arith.constant 0 : i32
%391 = arith.extsi %390 : i32 to i64
%392 = llvm.mlir.constant(1 : i64) : i64
%393 = llvm.alloca %392 x i64 : (i64) -> !llvm.ptr
llvm.store %391, %393 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%394 = llvm.load %393 : !llvm.ptr -> i64
%395 = arith.constant 8 : i32
%397 = arith.extsi %395 : i32 to i64
%396 = arith.cmpi slt, %394, %397 : i64
cf.cond_br %396, ^bb52, ^bb53
^bb52:
%399 = llvm.load %385 : !llvm.ptr -> i64
%400 = arith.constant 8 : i32
%402 = arith.extsi %400 : i32 to i64
%401 = arith.muli %399, %402 : i64
%403 = llvm.load %393 : !llvm.ptr -> i64
%404 = arith.addi %401, %403 : i64
%405 = llvm.getelementptr %311[%404] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%398 = llvm.load %405 : !llvm.ptr -> i32
%406 = arith.constant 0 : i32
%407 = arith.cmpi eq, %398, %406 : i32
%408 = scf.if %407 -> (i1) {
%410 = llvm.load %393 : !llvm.ptr -> i64
%411 = arith.constant 8 : i32
%413 = arith.extsi %411 : i32 to i64
%412 = arith.muli %410, %413 : i64
%414 = llvm.load %385 : !llvm.ptr -> i64
%415 = arith.addi %412, %414 : i64
%416 = llvm.getelementptr %311[%415] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%409 = llvm.load %416 : !llvm.ptr -> i32
%417 = arith.constant 0 : i32
%418 = arith.cmpi eq, %409, %417 : i32
scf.yield %418 : i1
} else {
%419 = arith.constant false
scf.yield %419 : i1
}
cf.cond_br %408, ^bb54, ^bb55
^bb54:
%420 = llvm.load %393 : !llvm.ptr -> i64
%421 = arith.trunci %420 : i64 to i32
%422 = llvm.load %385 : !llvm.ptr -> i64
%423 = llvm.getelementptr %377[%422] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %421, %423 : i32, !llvm.ptr
cf.br ^bb53
^bb55:
cf.br ^bb56
^bb56:
%424 = llvm.load %393 : !llvm.ptr -> i64
%425 = arith.constant 1 : i32
%427 = arith.extsi %425 : i32 to i64
%426 = arith.addi %424, %427 : i64
llvm.store %426, %393 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
%428 = llvm.load %385 : !llvm.ptr -> i64
%429 = arith.constant 1 : i32
%431 = arith.extsi %429 : i32 to i64
%430 = arith.addi %428, %431 : i64
llvm.store %430, %385 : i64, !llvm.ptr
cf.br ^bb48
^bb50:
%432 = arith.constant 888888883 : i32
%433 = arith.extsi %432 : i32 to i64
%434 = arith.constant 8888 : i32
%435 = arith.extsi %434 : i32 to i64
%436 = arith.constant 88888888 : i32
%437 = arith.extsi %436 : i32 to i64
%438 = llvm.mlir.constant(1 : i64) : i64
%439 = llvm.alloca %438 x i64 : (i64) -> !llvm.ptr
llvm.store %437, %439 : i64, !llvm.ptr
%440 = arith.constant 1000000 : i32
%441 = arith.extsi %440 : i32 to i64
%443 = arith.constant 8 : i32
%444 = arith.constant 8 : i32
%445 = arith.extsi %443 : i32 to i64
%446 = arith.extsi %444 : i32 to i64
%442 = func.call @calloc(%445, %446) : (i64, i64) -> !llvm.ptr
%447 = arith.constant 0 : i32
%448 = arith.extsi %447 : i32 to i64
%449 = llvm.mlir.constant(1 : i64) : i64
%450 = llvm.alloca %449 x i64 : (i64) -> !llvm.ptr
llvm.store %448, %450 : i64, !llvm.ptr
cf.br ^bb57
^bb57:
%451 = llvm.load %450 : !llvm.ptr -> i64
%452 = arith.constant 8 : i32
%454 = arith.extsi %452 : i32 to i64
%453 = arith.cmpi slt, %451, %454 : i64
cf.cond_br %453, ^bb58, ^bb59
^bb58:
%455 = arith.constant 0 : i32
%456 = llvm.load %450 : !llvm.ptr -> i64
%457 = arith.extsi %455 : i32 to i64
%458 = llvm.getelementptr %442[%456] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %457, %458 : i64, !llvm.ptr
%459 = llvm.load %450 : !llvm.ptr -> i64
%460 = arith.constant 1 : i32
%462 = arith.extsi %460 : i32 to i64
%461 = arith.addi %459, %462 : i64
llvm.store %461, %450 : i64, !llvm.ptr
cf.br ^bb57
^bb59:
%463 = arith.constant 0 : i32
%464 = arith.extsi %463 : i32 to i64
llvm.store %464, %450 : i64, !llvm.ptr
cf.br ^bb60
^bb60:
%465 = llvm.load %450 : !llvm.ptr -> i64
%466 = arith.cmpi slt, %465, %441 : i64
cf.cond_br %466, ^bb61, ^bb62
^bb61:
%467 = arith.constant 0 : i32
%468 = arith.extsi %467 : i32 to i64
%469 = llvm.mlir.constant(1 : i64) : i64
%470 = llvm.alloca %469 x i64 : (i64) -> !llvm.ptr
llvm.store %468, %470 : i64, !llvm.ptr
%471 = arith.constant 0 : i32
%472 = arith.extsi %471 : i32 to i64
%473 = llvm.mlir.constant(1 : i64) : i64
%474 = llvm.alloca %473 x i64 : (i64) -> !llvm.ptr
llvm.store %472, %474 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%475 = llvm.load %474 : !llvm.ptr -> i64
%476 = arith.constant 50 : i32
%478 = arith.extsi %476 : i32 to i64
%477 = arith.cmpi slt, %475, %478 : i64
cf.cond_br %477, ^bb64, ^bb65
^bb64:
%480 = llvm.load %470 : !llvm.ptr -> i64
%481 = arith.constant 3 : i32
%483 = arith.extsi %481 : i32 to i64
%482 = arith.muli %480, %483 : i64
%484 = llvm.load %439 : !llvm.ptr -> i64
%485 = arith.constant 3 : i32
%487 = arith.extsi %485 : i32 to i64
%486 = arith.remsi %484, %487 : i64
%488 = arith.addi %482, %486 : i64
%489 = llvm.getelementptr %330[%488] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%479 = llvm.load %489 : !llvm.ptr -> i32
%490 = arith.extsi %479 : i32 to i64
llvm.store %490, %470 : i64, !llvm.ptr
%491 = llvm.load %439 : !llvm.ptr -> i64
%492 = arith.muli %491, %435 : i64
%493 = arith.remsi %492, %433 : i64
llvm.store %493, %439 : i64, !llvm.ptr
%494 = llvm.load %474 : !llvm.ptr -> i64
%495 = arith.constant 1 : i32
%497 = arith.extsi %495 : i32 to i64
%496 = arith.addi %494, %497 : i64
llvm.store %496, %474 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
%499 = llvm.load %470 : !llvm.ptr -> i64
%500 = llvm.getelementptr %442[%499] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%498 = llvm.load %500 : !llvm.ptr -> i64
%501 = arith.constant 1 : i32
%503 = arith.extsi %501 : i32 to i64
%502 = arith.addi %498, %503 : i64
%504 = llvm.load %470 : !llvm.ptr -> i64
%505 = llvm.getelementptr %442[%504] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %502, %505 : i64, !llvm.ptr
%506 = llvm.load %450 : !llvm.ptr -> i64
%507 = arith.constant 1 : i32
%509 = arith.extsi %507 : i32 to i64
%508 = arith.addi %506, %509 : i64
llvm.store %508, %450 : i64, !llvm.ptr
cf.br ^bb60
^bb62:
%510 = arith.constant 0 : i32
%511 = arith.extsi %510 : i32 to i64
%512 = llvm.mlir.constant(1 : i64) : i64
%513 = llvm.alloca %512 x i64 : (i64) -> !llvm.ptr
llvm.store %511, %513 : i64, !llvm.ptr
%514 = arith.constant 0 : i32
%515 = arith.extsi %514 : i32 to i64
%516 = llvm.mlir.constant(1 : i64) : i64
%517 = llvm.alloca %516 x i64 : (i64) -> !llvm.ptr
llvm.store %515, %517 : i64, !llvm.ptr
cf.br ^bb66
^bb66:
%518 = llvm.load %517 : !llvm.ptr -> i64
%519 = arith.constant 8 : i32
%521 = arith.extsi %519 : i32 to i64
%520 = arith.cmpi slt, %518, %521 : i64
cf.cond_br %520, ^bb67, ^bb68
^bb67:
%522 = llvm.load %513 : !llvm.ptr -> i64
%524 = llvm.load %517 : !llvm.ptr -> i64
%525 = llvm.getelementptr %442[%524] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%523 = llvm.load %525 : !llvm.ptr -> i64
%528 = llvm.load %517 : !llvm.ptr -> i64
%529 = llvm.getelementptr %377[%528] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%527 = llvm.load %529 : !llvm.ptr -> i32
%530 = arith.extsi %527 : i32 to i64
%531 = llvm.getelementptr %442[%530] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%526 = llvm.load %531 : !llvm.ptr -> i64
%532 = arith.muli %523, %526 : i64
%533 = arith.addi %522, %532 : i64
llvm.store %533, %513 : i64, !llvm.ptr
%534 = llvm.load %517 : !llvm.ptr -> i64
%535 = arith.constant 1 : i32
%537 = arith.extsi %535 : i32 to i64
%536 = arith.addi %534, %537 : i64
llvm.store %536, %517 : i64, !llvm.ptr
cf.br ^bb66
^bb68:
%538 = llvm.mlir.addressof @str_0 : !llvm.ptr
%539 = llvm.load %513 : !llvm.ptr -> i64
%540 = llvm.call @printf(%538, %539) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%311) : (!llvm.ptr) -> ()
func.call @free(%330) : (!llvm.ptr) -> ()
func.call @free(%377) : (!llvm.ptr) -> ()
func.call @free(%442) : (!llvm.ptr) -> ()
%545 = arith.constant 0 : i32
func.return %545 : i32
}
}