Problem 289
L(6,10) mod 10^10 Eulerian non-crossing cycles.
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 289
# L(6,10) mod 10^10 Eulerian non-crossing cycles.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
function rep_state(s0: i64) -> i64 {
if s0 == 0 { return 0 }
let mapping: ptr<i32> = calloc(20, 4)
let mut nxt: i64 = 0
let mut out: i64 = 0
let mut i: i64 = 0
let mut s: i64 = s0
while (s >> (4 * i)) != 0 {
let x: i64 = (s >> (4 * i)) & 15
if mapping[x] == 0 {
nxt = nxt + 1
mapping[x] = nxt as i32
}
out = out | (((mapping[x] as i64) - 1) << (4 * i))
i = i + 1
}
free(mapping)
return out
}
function merge_label(s0: i64, src: i64, dst: i64, m: i64) -> i64 {
if s0 == -1 { return -1 }
let mut s: i64 = s0
let mut i: i64 = 0
while i < m + 4 {
if ((s >> (4 * i)) & 15) == src {
s = s ^ ((src ^ dst) << (4 * i))
}
i = i + 1
}
return s
}
function count_label(s0: i64, label: i64, m: i64) -> i64 {
let mut cnt: i64 = 0
let mut s: i64 = s0
let mut i: i64 = 0
while i < m + 4 {
if (s & 15) == label { cnt = cnt + 1 }
s = s >> 4
i = i + 1
}
return cnt
}
function main() -> i32 {
let MOD: i64 = 10000000000
let m: i64 = 6
let n: i64 = 10
let CONNECTIONS: ptr<i32> = calloc(14, 4)
CONNECTIONS[0] = 1111; CONNECTIONS[1] = 1114; CONNECTIONS[2] = 1133; CONNECTIONS[3] = 1134
CONNECTIONS[4] = 1131; CONNECTIONS[5] = 1211; CONNECTIONS[6] = 1214; CONNECTIONS[7] = 1221
CONNECTIONS[8] = 1222; CONNECTIONS[9] = 1224; CONNECTIONS[10] = 1231; CONNECTIONS[11] = 1232
CONNECTIONS[12] = 1233; CONNECTIONS[13] = 1234
let CAP: i64 = 200003
let keys: ptr<i64> = calloc(CAP, 8)
let vals: ptr<i64> = calloc(CAP, 8)
let used: ptr<i8> = calloc(CAP, 1)
let nkeys: ptr<i64> = calloc(CAP, 8)
let nvals: ptr<i64> = calloc(CAP, 8)
let nused: ptr<i8> = calloc(CAP, 1)
# dp[0]=1
let mut h: i64 = 0
used[h] = 1
keys[h] = 0
vals[h] = 1
let mut x: i64 = 0
while x <= n {
let mut y: i64 = 0
while y <= m {
let final: bool = (x == n && y == m)
# clear nxt
h = 0
while h < CAP {
nused[h] = 0
nvals[h] = 0
h = h + 1
}
let new_color: i64 = 15
if x == n || y == m { new_color = 0 }
h = 0
while h < CAP {
if used[h] != 0 {
let state: i64 = keys[h]
let ways: i64 = vals[h]
let mut ci: i64 = 0
while ci < 14 {
let C: i64 = CONNECTIONS[ci] as i64
let a: i64 = C / 1000 - 1
let b: i64 = (C / 100) % 10 - 1
let c: i64 = (C / 10) % 10 - 1
let d: i64 = C % 10 - 1
let colors0: i64 = (state >> (4 * y)) & 15
let colors1: i64 = (state >> (4 * (y + 1))) & 15
let colors2: i64 = (state >> (4 * (y + 2))) & 15
let colors3: i64 = new_color
let idx0: i64 = a
let idx1: i64 = b
let idx2: i64 = c
let idx3: i64 = d
let mut ok: bool = true
let mut i: i64 = 0
while i < 4 {
let coli: i64 = colors0
let idxi: i64 = idx0
if i == 1 { coli = colors1; idxi = idx1 }
elif i == 2 { coli = colors2; idxi = idx2 }
elif i == 3 { coli = colors3; idxi = idx3 }
if coli == 0 {
let mut j: i64 = 0
while j < 4 {
let colj: i64 = colors0
let idxj: i64 = idx0
if j == 1 { colj = colors1; idxj = idx1 }
elif j == 2 { colj = colors2; idxj = idx2 }
elif j == 3 { colj = colors3; idxj = idx3 }
let left: bool = (colj == 0)
let right: bool = (idxi == idxj)
if left != right { ok = false; break }
j = j + 1
}
}
if !ok { break }
i = i + 1
}
if ok {
let mut kk: i64 = (state << 4) | new_color
let mut bad: bool = false
i = 0
while i < 4 {
let idxi: i64 = idx0
if i == 1 { idxi = idx1 }
elif i == 2 { idxi = idx2 }
elif i == 3 { idxi = idx3 }
if i != idxi {
let mut src: i64 = 0
if i == 3 { src = new_color }
else { src = (kk >> (4 * (y + i + 1))) & 15 }
let dst: i64 = (kk >> (4 * (y + idxi + 1))) & 15
if src != 0 {
if dst == 0 || src == dst {
bad = true
break
}
kk = merge_label(kk, src, dst, m)
}
}
i = i + 1
}
if !bad && kk != -1 {
let cur: i64 = kk & 15
kk = kk >> 4
let old: i64 = (kk >> (4 * (y + 1))) & 15
if count_label(kk, old, m) > 1 || old == cur || final {
kk = kk ^ ((cur ^ old) << (4 * (y + 1)))
if y == m {
kk = kk << 4
}
let st2: i64 = rep_state(kk)
let mut hh: i64 = st2 % CAP
if hh < 0 { hh = -hh }
while nused[hh] != 0 {
if nkeys[hh] == st2 { break }
hh = hh + 1
if hh == CAP { hh = 0 }
}
if nused[hh] == 0 {
nused[hh] = 1
nkeys[hh] = st2
nvals[hh] = ways % MOD
} else {
nvals[hh] = (nvals[hh] + ways) % MOD
}
}
}
}
ci = ci + 1
}
}
h = h + 1
}
# swap
h = 0
while h < CAP {
used[h] = nused[h]
keys[h] = nkeys[h]
vals[h] = nvals[h]
h = h + 1
}
y = y + 1
}
x = x + 1
}
# get dp[0]
let mut ans: i64 = 0
h = 0
while h < CAP {
if used[h] != 0 && keys[h] == 0 {
ans = vals[h]
break
}
h = h + 1
}
printf("%lld\n", ans % MOD)
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 rep_state_i64(int64_t s0);
int64_t merge_label_i64_i64_i64_i64(int64_t s0, int64_t src, int64_t dst, int64_t m);
int64_t count_label_i64_i64_i64(int64_t s0, int64_t label, int64_t m);
int32_t main(void);
int64_t rep_state_i64(int64_t s0) {
if (s0 == 0) {
return 0;
}
int32_t* mapping = (int32_t*)(calloc(20, 4));
int64_t nxt = 0;
int64_t out = 0;
int64_t i = 0;
int64_t s = s0;
while (FLOW_CHECKED_SHR((s), ((4 * i))) != 0) {
int64_t x = (FLOW_CHECKED_SHR((s), ((4 * i))) & 15);
if (mapping[x] == 0) {
nxt = (nxt + 1);
mapping[x] = ((int32_t)(nxt));
}
out = (out | FLOW_CHECKED_SHL(((((int64_t)(mapping[x])) - 1)), ((4 * i))));
i = (i + 1);
}
free(mapping);
return out;
}
int64_t merge_label_i64_i64_i64_i64(int64_t s0, int64_t src, int64_t dst, int64_t m) {
if (s0 == (-1)) {
return (-1);
}
int64_t s = s0;
int64_t i = 0;
while (i < (m + 4)) {
if ((FLOW_CHECKED_SHR((s), ((4 * i))) & 15) == src) {
s = (s ^ FLOW_CHECKED_SHL(((src ^ dst)), ((4 * i))));
}
i = (i + 1);
}
return s;
}
int64_t count_label_i64_i64_i64(int64_t s0, int64_t label, int64_t m) {
int64_t cnt = 0;
int64_t s = s0;
int64_t i = 0;
while (i < (m + 4)) {
if ((s & 15) == label) {
cnt = (cnt + 1);
}
s = FLOW_CHECKED_SHR((s), (4));
i = (i + 1);
}
return cnt;
}
int32_t main(void) {
int64_t MOD = 10000000000;
int64_t m = 6;
int64_t n = 10;
int32_t* CONNECTIONS = (int32_t*)(calloc(14, 4));
CONNECTIONS[0] = 1111;
CONNECTIONS[1] = 1114;
CONNECTIONS[2] = 1133;
CONNECTIONS[3] = 1134;
CONNECTIONS[4] = 1131;
CONNECTIONS[5] = 1211;
CONNECTIONS[6] = 1214;
CONNECTIONS[7] = 1221;
CONNECTIONS[8] = 1222;
CONNECTIONS[9] = 1224;
CONNECTIONS[10] = 1231;
CONNECTIONS[11] = 1232;
CONNECTIONS[12] = 1233;
CONNECTIONS[13] = 1234;
int64_t CAP = 200003;
int64_t* keys = (int64_t*)(calloc(CAP, 8));
int64_t* vals = (int64_t*)(calloc(CAP, 8));
int8_t* used = (int8_t*)(calloc(CAP, 1));
int64_t* nkeys = (int64_t*)(calloc(CAP, 8));
int64_t* nvals = (int64_t*)(calloc(CAP, 8));
int8_t* nused = (int8_t*)(calloc(CAP, 1));
int64_t h = 0;
used[h] = 1;
keys[h] = 0;
vals[h] = 1;
int64_t x = 0;
while (x <= n) {
int64_t y = 0;
while (y <= m) {
bool final = (x == n && y == m);
h = 0;
while (h < CAP) {
nused[h] = 0;
nvals[h] = 0;
h = (h + 1);
}
int64_t new_color = 15;
if ((x == n || y == m)) {
new_color = 0;
}
h = 0;
while (h < CAP) {
if (used[h] != 0) {
int64_t state = keys[h];
int64_t ways = vals[h];
int64_t ci = 0;
while (ci < 14) {
int64_t C = ((int64_t)(CONNECTIONS[ci]));
int64_t a = (FLOW_CHECKED_DIV((C), (1000)) - 1);
int64_t b = (FLOW_CHECKED_MOD((FLOW_CHECKED_DIV((C), (100))), (10)) - 1);
int64_t c = (FLOW_CHECKED_MOD((FLOW_CHECKED_DIV((C), (10))), (10)) - 1);
int64_t d = (FLOW_CHECKED_MOD((C), (10)) - 1);
int64_t colors0 = (FLOW_CHECKED_SHR((state), ((4 * y))) & 15);
int64_t colors1 = (FLOW_CHECKED_SHR((state), ((4 * (y + 1)))) & 15);
int64_t colors2 = (FLOW_CHECKED_SHR((state), ((4 * (y + 2)))) & 15);
int64_t colors3 = new_color;
int64_t idx0 = a;
int64_t idx1 = b;
int64_t idx2 = c;
int64_t idx3 = d;
bool ok = 1;
int64_t i = 0;
while (i < 4) {
int64_t coli = colors0;
int64_t idxi = idx0;
if (i == 1) {
coli = colors1;
idxi = idx1;
} else if (i == 2) {
coli = colors2;
idxi = idx2;
} else if (i == 3) {
coli = colors3;
idxi = idx3;
}
if (coli == 0) {
int64_t j = 0;
while (j < 4) {
int64_t colj = colors0;
int64_t idxj = idx0;
if (j == 1) {
colj = colors1;
idxj = idx1;
} else if (j == 2) {
colj = colors2;
idxj = idx2;
} else if (j == 3) {
colj = colors3;
idxj = idx3;
}
bool left = colj == 0;
bool right = idxi == idxj;
if (left != right) {
ok = 0;
break;
}
j = (j + 1);
}
}
if ((!(ok))) {
break;
}
i = (i + 1);
}
if (ok) {
int64_t kk = (FLOW_CHECKED_SHL((state), (4)) | new_color);
bool bad = 0;
i = 0;
while (i < 4) {
int64_t idxi = idx0;
if (i == 1) {
idxi = idx1;
} else if (i == 2) {
idxi = idx2;
} else if (i == 3) {
idxi = idx3;
}
if (i != idxi) {
int64_t src = 0;
if (i == 3) {
src = new_color;
} else {
src = (FLOW_CHECKED_SHR((kk), ((4 * ((y + i) + 1)))) & 15);
}
int64_t dst = (FLOW_CHECKED_SHR((kk), ((4 * ((y + idxi) + 1)))) & 15);
if (src != 0) {
if ((dst == 0 || src == dst)) {
bad = 1;
break;
}
kk = merge_label_i64_i64_i64_i64(kk, src, dst, m);
}
}
i = (i + 1);
}
if (((!(bad)) && kk != (-1))) {
int64_t cur = (kk & 15);
kk = FLOW_CHECKED_SHR((kk), (4));
int64_t old = (FLOW_CHECKED_SHR((kk), ((4 * (y + 1)))) & 15);
if (((count_label_i64_i64_i64(kk, old, m) > 1 || old == cur) || final)) {
kk = (kk ^ FLOW_CHECKED_SHL(((cur ^ old)), ((4 * (y + 1)))));
if (y == m) {
kk = FLOW_CHECKED_SHL((kk), (4));
}
int64_t st2 = rep_state_i64(kk);
int64_t hh = FLOW_CHECKED_MOD((st2), (CAP));
if (hh < 0) {
hh = (-hh);
}
while (nused[hh] != 0) {
if (nkeys[hh] == st2) {
break;
}
hh = (hh + 1);
if (hh == CAP) {
hh = 0;
}
}
if (nused[hh] == 0) {
nused[hh] = 1;
nkeys[hh] = st2;
nvals[hh] = FLOW_CHECKED_MOD((ways), (MOD));
} else {
nvals[hh] = FLOW_CHECKED_MOD(((nvals[hh] + ways)), (MOD));
}
}
}
}
ci = (ci + 1);
}
}
h = (h + 1);
}
h = 0;
while (h < CAP) {
used[h] = nused[h];
keys[h] = nkeys[h];
vals[h] = nvals[h];
h = (h + 1);
}
y = (y + 1);
}
x = (x + 1);
}
int64_t ans = 0;
h = 0;
while (h < CAP) {
if ((used[h] != 0 && keys[h] == 0)) {
ans = vals[h];
break;
}
h = (h + 1);
}
printf("%lld\n", FLOW_CHECKED_MOD((ans), (MOD)));
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 @rep_state(%arg0: i64) -> i64 {
%0 = arith.constant 0 : i32
%2 = arith.extsi %0 : i32 to i64
%1 = arith.cmpi eq, %arg0, %2 : i64
cf.cond_br %1, ^bb0, ^bb1
^bb0:
%3 = arith.constant 0 : i32
%4 = arith.extsi %3 : i32 to i64
func.return %4 : i64
^bb1:
cf.br ^bb2
^bb2:
%6 = arith.constant 20 : 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 = arith.extsi %10 : i32 to i64
%12 = llvm.mlir.constant(1 : i64) : i64
%13 = llvm.alloca %12 x i64 : (i64) -> !llvm.ptr
llvm.store %11, %13 : i64, !llvm.ptr
%14 = arith.constant 0 : i32
%15 = arith.extsi %14 : i32 to i64
%16 = llvm.mlir.constant(1 : i64) : i64
%17 = llvm.alloca %16 x i64 : (i64) -> !llvm.ptr
llvm.store %15, %17 : i64, !llvm.ptr
%18 = arith.constant 0 : i32
%19 = arith.extsi %18 : i32 to i64
%20 = llvm.mlir.constant(1 : i64) : i64
%21 = llvm.alloca %20 x i64 : (i64) -> !llvm.ptr
llvm.store %19, %21 : i64, !llvm.ptr
%22 = llvm.mlir.constant(1 : i64) : i64
%23 = llvm.alloca %22 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %23 : i64, !llvm.ptr
cf.br ^bb3
^bb3:
%24 = llvm.load %23 : !llvm.ptr -> i64
%25 = arith.constant 4 : i32
%26 = llvm.load %21 : !llvm.ptr -> i64
%28 = arith.extsi %25 : i32 to i64
%27 = arith.muli %28, %26 : i64
%29 = arith.shrsi %24, %27 : i64
%30 = arith.constant 0 : i32
%32 = arith.extsi %30 : i32 to i64
%31 = arith.cmpi ne, %29, %32 : i64
cf.cond_br %31, ^bb4, ^bb5
^bb4:
%33 = llvm.load %23 : !llvm.ptr -> i64
%34 = arith.constant 4 : i32
%35 = llvm.load %21 : !llvm.ptr -> i64
%37 = arith.extsi %34 : i32 to i64
%36 = arith.muli %37, %35 : i64
%38 = arith.shrsi %33, %36 : i64
%39 = arith.constant 15 : i32
%41 = arith.extsi %39 : i32 to i64
%40 = arith.andi %38, %41 : i64
%43 = llvm.getelementptr %5[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%42 = llvm.load %43 : !llvm.ptr -> i32
%44 = arith.constant 0 : i32
%45 = arith.cmpi eq, %42, %44 : i32
cf.cond_br %45, ^bb6, ^bb7
^bb6:
%46 = llvm.load %13 : !llvm.ptr -> i64
%47 = arith.constant 1 : i32
%49 = arith.extsi %47 : i32 to i64
%48 = arith.addi %46, %49 : i64
llvm.store %48, %13 : i64, !llvm.ptr
%50 = llvm.load %13 : !llvm.ptr -> i64
%51 = arith.trunci %50 : i64 to i32
%52 = llvm.getelementptr %5[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %51, %52 : i32, !llvm.ptr
cf.br ^bb8
^bb7:
cf.br ^bb8
^bb8:
%53 = llvm.load %17 : !llvm.ptr -> i64
%55 = llvm.getelementptr %5[%40] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%54 = llvm.load %55 : !llvm.ptr -> i32
%56 = arith.extsi %54 : i32 to i64
%57 = arith.constant 1 : i32
%59 = arith.extsi %57 : i32 to i64
%58 = arith.subi %56, %59 : i64
%60 = arith.constant 4 : i32
%61 = llvm.load %21 : !llvm.ptr -> i64
%63 = arith.extsi %60 : i32 to i64
%62 = arith.muli %63, %61 : i64
%64 = arith.shli %58, %62 : i64
%65 = arith.ori %53, %64 : i64
llvm.store %65, %17 : i64, !llvm.ptr
%66 = llvm.load %21 : !llvm.ptr -> i64
%67 = arith.constant 1 : i32
%69 = arith.extsi %67 : i32 to i64
%68 = arith.addi %66, %69 : i64
llvm.store %68, %21 : i64, !llvm.ptr
cf.br ^bb3
^bb5:
func.call @free(%5) : (!llvm.ptr) -> ()
%71 = llvm.load %17 : !llvm.ptr -> i64
func.return %71 : i64
}
func.func @merge_label(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i64) -> i64 {
%72 = arith.constant 1 : i32
%74 = arith.constant 0 : i32
%73 = arith.subi %74, %72 : i32
%76 = arith.extsi %73 : i32 to i64
%75 = arith.cmpi eq, %arg0, %76 : i64
cf.cond_br %75, ^bb9, ^bb10
^bb9:
%77 = arith.constant 1 : i32
%79 = arith.constant 0 : i32
%78 = arith.subi %79, %77 : i32
%80 = arith.extsi %78 : i32 to i64
func.return %80 : i64
^bb10:
cf.br ^bb11
^bb11:
%81 = llvm.mlir.constant(1 : i64) : i64
%82 = llvm.alloca %81 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %82 : i64, !llvm.ptr
%83 = arith.constant 0 : i32
%84 = arith.extsi %83 : i32 to i64
%85 = llvm.mlir.constant(1 : i64) : i64
%86 = llvm.alloca %85 x i64 : (i64) -> !llvm.ptr
llvm.store %84, %86 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%87 = llvm.load %86 : !llvm.ptr -> i64
%88 = arith.constant 4 : i32
%90 = arith.extsi %88 : i32 to i64
%89 = arith.addi %arg3, %90 : i64
%91 = arith.cmpi slt, %87, %89 : i64
cf.cond_br %91, ^bb13, ^bb14
^bb13:
%92 = llvm.load %82 : !llvm.ptr -> i64
%93 = arith.constant 4 : i32
%94 = llvm.load %86 : !llvm.ptr -> i64
%96 = arith.extsi %93 : i32 to i64
%95 = arith.muli %96, %94 : i64
%97 = arith.shrsi %92, %95 : i64
%98 = arith.constant 15 : i32
%100 = arith.extsi %98 : i32 to i64
%99 = arith.andi %97, %100 : i64
%101 = arith.cmpi eq, %99, %arg1 : i64
cf.cond_br %101, ^bb15, ^bb16
^bb15:
%102 = llvm.load %82 : !llvm.ptr -> i64
%103 = arith.xori %arg1, %arg2 : i64
%104 = arith.constant 4 : i32
%105 = llvm.load %86 : !llvm.ptr -> i64
%107 = arith.extsi %104 : i32 to i64
%106 = arith.muli %107, %105 : i64
%108 = arith.shli %103, %106 : i64
%109 = arith.xori %102, %108 : i64
llvm.store %109, %82 : i64, !llvm.ptr
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%110 = llvm.load %86 : !llvm.ptr -> i64
%111 = arith.constant 1 : i32
%113 = arith.extsi %111 : i32 to i64
%112 = arith.addi %110, %113 : i64
llvm.store %112, %86 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%114 = llvm.load %82 : !llvm.ptr -> i64
func.return %114 : i64
}
func.func @count_label(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
%115 = arith.constant 0 : i32
%116 = arith.extsi %115 : i32 to i64
%117 = llvm.mlir.constant(1 : i64) : i64
%118 = llvm.alloca %117 x i64 : (i64) -> !llvm.ptr
llvm.store %116, %118 : i64, !llvm.ptr
%119 = llvm.mlir.constant(1 : i64) : i64
%120 = llvm.alloca %119 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %120 : i64, !llvm.ptr
%121 = arith.constant 0 : i32
%122 = arith.extsi %121 : i32 to i64
%123 = llvm.mlir.constant(1 : i64) : i64
%124 = llvm.alloca %123 x i64 : (i64) -> !llvm.ptr
llvm.store %122, %124 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%125 = llvm.load %124 : !llvm.ptr -> i64
%126 = arith.constant 4 : i32
%128 = arith.extsi %126 : i32 to i64
%127 = arith.addi %arg2, %128 : i64
%129 = arith.cmpi slt, %125, %127 : i64
cf.cond_br %129, ^bb19, ^bb20
^bb19:
%130 = llvm.load %120 : !llvm.ptr -> i64
%131 = arith.constant 15 : i32
%133 = arith.extsi %131 : i32 to i64
%132 = arith.andi %130, %133 : i64
%134 = arith.cmpi eq, %132, %arg1 : i64
cf.cond_br %134, ^bb21, ^bb22
^bb21:
%135 = llvm.load %118 : !llvm.ptr -> i64
%136 = arith.constant 1 : i32
%138 = arith.extsi %136 : i32 to i64
%137 = arith.addi %135, %138 : i64
llvm.store %137, %118 : i64, !llvm.ptr
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
%139 = llvm.load %120 : !llvm.ptr -> i64
%140 = arith.constant 4 : i32
%142 = arith.extsi %140 : i32 to i64
%141 = arith.shrsi %139, %142 : i64
llvm.store %141, %120 : i64, !llvm.ptr
%143 = llvm.load %124 : !llvm.ptr -> i64
%144 = arith.constant 1 : i32
%146 = arith.extsi %144 : i32 to i64
%145 = arith.addi %143, %146 : i64
llvm.store %145, %124 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
%147 = llvm.load %118 : !llvm.ptr -> i64
func.return %147 : i64
}
func.func @main() -> i32 {
%148 = arith.constant 5705032704 : i32
%149 = arith.extsi %148 : i32 to i64
%150 = arith.constant 6 : i32
%151 = arith.extsi %150 : i32 to i64
%152 = arith.constant 10 : i32
%153 = arith.extsi %152 : i32 to i64
%155 = arith.constant 14 : i32
%156 = arith.constant 4 : i32
%157 = arith.extsi %155 : i32 to i64
%158 = arith.extsi %156 : i32 to i64
%154 = func.call @calloc(%157, %158) : (i64, i64) -> !llvm.ptr
%159 = arith.constant 1111 : i32
%160 = arith.constant 0 : i32
%161 = arith.extsi %160 : i32 to i64
%162 = llvm.getelementptr %154[%161] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %159, %162 : i32, !llvm.ptr
%163 = arith.constant 1114 : i32
%164 = arith.constant 1 : i32
%165 = arith.extsi %164 : i32 to i64
%166 = llvm.getelementptr %154[%165] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %163, %166 : i32, !llvm.ptr
%167 = arith.constant 1133 : i32
%168 = arith.constant 2 : i32
%169 = arith.extsi %168 : i32 to i64
%170 = llvm.getelementptr %154[%169] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %167, %170 : i32, !llvm.ptr
%171 = arith.constant 1134 : i32
%172 = arith.constant 3 : i32
%173 = arith.extsi %172 : i32 to i64
%174 = llvm.getelementptr %154[%173] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %171, %174 : i32, !llvm.ptr
%175 = arith.constant 1131 : i32
%176 = arith.constant 4 : i32
%177 = arith.extsi %176 : i32 to i64
%178 = llvm.getelementptr %154[%177] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %175, %178 : i32, !llvm.ptr
%179 = arith.constant 1211 : i32
%180 = arith.constant 5 : i32
%181 = arith.extsi %180 : i32 to i64
%182 = llvm.getelementptr %154[%181] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %179, %182 : i32, !llvm.ptr
%183 = arith.constant 1214 : i32
%184 = arith.constant 6 : i32
%185 = arith.extsi %184 : i32 to i64
%186 = llvm.getelementptr %154[%185] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %183, %186 : i32, !llvm.ptr
%187 = arith.constant 1221 : i32
%188 = arith.constant 7 : i32
%189 = arith.extsi %188 : i32 to i64
%190 = llvm.getelementptr %154[%189] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %187, %190 : i32, !llvm.ptr
%191 = arith.constant 1222 : i32
%192 = arith.constant 8 : i32
%193 = arith.extsi %192 : i32 to i64
%194 = llvm.getelementptr %154[%193] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %191, %194 : i32, !llvm.ptr
%195 = arith.constant 1224 : i32
%196 = arith.constant 9 : i32
%197 = arith.extsi %196 : i32 to i64
%198 = llvm.getelementptr %154[%197] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %195, %198 : i32, !llvm.ptr
%199 = arith.constant 1231 : i32
%200 = arith.constant 10 : i32
%201 = arith.extsi %200 : i32 to i64
%202 = llvm.getelementptr %154[%201] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %199, %202 : i32, !llvm.ptr
%203 = arith.constant 1232 : i32
%204 = arith.constant 11 : i32
%205 = arith.extsi %204 : i32 to i64
%206 = llvm.getelementptr %154[%205] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %203, %206 : i32, !llvm.ptr
%207 = arith.constant 1233 : i32
%208 = arith.constant 12 : i32
%209 = arith.extsi %208 : i32 to i64
%210 = llvm.getelementptr %154[%209] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %207, %210 : i32, !llvm.ptr
%211 = arith.constant 1234 : i32
%212 = arith.constant 13 : i32
%213 = arith.extsi %212 : i32 to i64
%214 = llvm.getelementptr %154[%213] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %211, %214 : i32, !llvm.ptr
%215 = arith.constant 200003 : i32
%216 = arith.extsi %215 : i32 to i64
%218 = arith.constant 8 : i32
%219 = arith.extsi %218 : i32 to i64
%217 = func.call @calloc(%216, %219) : (i64, i64) -> !llvm.ptr
%221 = arith.constant 8 : i32
%222 = arith.extsi %221 : i32 to i64
%220 = func.call @calloc(%216, %222) : (i64, i64) -> !llvm.ptr
%224 = arith.constant 1 : i32
%225 = arith.extsi %224 : i32 to i64
%223 = func.call @calloc(%216, %225) : (i64, i64) -> !llvm.ptr
%227 = arith.constant 8 : i32
%228 = arith.extsi %227 : i32 to i64
%226 = func.call @calloc(%216, %228) : (i64, i64) -> !llvm.ptr
%230 = arith.constant 8 : i32
%231 = arith.extsi %230 : i32 to i64
%229 = func.call @calloc(%216, %231) : (i64, i64) -> !llvm.ptr
%233 = arith.constant 1 : i32
%234 = arith.extsi %233 : i32 to i64
%232 = func.call @calloc(%216, %234) : (i64, i64) -> !llvm.ptr
%235 = arith.constant 0 : i32
%236 = arith.extsi %235 : i32 to i64
%237 = llvm.mlir.constant(1 : i64) : i64
%238 = llvm.alloca %237 x i64 : (i64) -> !llvm.ptr
llvm.store %236, %238 : i64, !llvm.ptr
%239 = arith.constant 1 : i32
%240 = llvm.load %238 : !llvm.ptr -> i64
%241 = arith.trunci %239 : i32 to i8
%242 = llvm.getelementptr %223[%240] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %241, %242 : i8, !llvm.ptr
%243 = arith.constant 0 : i32
%244 = llvm.load %238 : !llvm.ptr -> i64
%245 = arith.extsi %243 : i32 to i64
%246 = llvm.getelementptr %217[%244] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %245, %246 : i64, !llvm.ptr
%247 = arith.constant 1 : i32
%248 = llvm.load %238 : !llvm.ptr -> i64
%249 = arith.extsi %247 : i32 to i64
%250 = llvm.getelementptr %220[%248] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %249, %250 : i64, !llvm.ptr
%251 = arith.constant 0 : i32
%252 = arith.extsi %251 : i32 to i64
%253 = llvm.mlir.constant(1 : i64) : i64
%254 = llvm.alloca %253 x i64 : (i64) -> !llvm.ptr
llvm.store %252, %254 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%255 = llvm.load %254 : !llvm.ptr -> i64
%256 = arith.cmpi sle, %255, %153 : i64
cf.cond_br %256, ^bb25, ^bb26
^bb25:
%257 = arith.constant 0 : i32
%258 = arith.extsi %257 : i32 to i64
%259 = llvm.mlir.constant(1 : i64) : i64
%260 = llvm.alloca %259 x i64 : (i64) -> !llvm.ptr
llvm.store %258, %260 : i64, !llvm.ptr
cf.br ^bb27
^bb27:
%261 = llvm.load %260 : !llvm.ptr -> i64
%262 = arith.cmpi sle, %261, %151 : i64
cf.cond_br %262, ^bb28, ^bb29
^bb28:
%263 = llvm.load %254 : !llvm.ptr -> i64
%264 = arith.cmpi eq, %263, %153 : i64
%265 = scf.if %264 -> (i1) {
%266 = llvm.load %260 : !llvm.ptr -> i64
%267 = arith.cmpi eq, %266, %151 : i64
scf.yield %267 : i1
} else {
%268 = arith.constant false
scf.yield %268 : i1
}
%269 = arith.constant 0 : i32
%270 = arith.extsi %269 : i32 to i64
llvm.store %270, %238 : i64, !llvm.ptr
cf.br ^bb30
^bb30:
%271 = llvm.load %238 : !llvm.ptr -> i64
%272 = arith.cmpi slt, %271, %216 : i64
cf.cond_br %272, ^bb31, ^bb32
^bb31:
%273 = arith.constant 0 : i32
%274 = llvm.load %238 : !llvm.ptr -> i64
%275 = arith.trunci %273 : i32 to i8
%276 = llvm.getelementptr %232[%274] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %275, %276 : i8, !llvm.ptr
%277 = arith.constant 0 : i32
%278 = llvm.load %238 : !llvm.ptr -> i64
%279 = arith.extsi %277 : i32 to i64
%280 = llvm.getelementptr %229[%278] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %279, %280 : i64, !llvm.ptr
%281 = llvm.load %238 : !llvm.ptr -> i64
%282 = arith.constant 1 : i32
%284 = arith.extsi %282 : i32 to i64
%283 = arith.addi %281, %284 : i64
llvm.store %283, %238 : i64, !llvm.ptr
cf.br ^bb30
^bb32:
%285 = arith.constant 15 : i32
%286 = arith.extsi %285 : i32 to i64
%287 = llvm.load %254 : !llvm.ptr -> i64
%288 = arith.cmpi eq, %287, %153 : i64
%289 = scf.if %288 -> (i1) {
%290 = arith.constant true
scf.yield %290 : i1
} else {
%291 = llvm.load %260 : !llvm.ptr -> i64
%292 = arith.cmpi eq, %291, %151 : i64
scf.yield %292 : i1
}
%293 = scf.if %289 -> (i64) {
%294 = arith.constant 0 : i32
%295 = arith.extsi %294 : i32 to i64
scf.yield %295 : i64
} else {
scf.yield %286 : i64
}
%296 = arith.constant 0 : i32
%297 = arith.extsi %296 : i32 to i64
llvm.store %297, %238 : i64, !llvm.ptr
cf.br ^bb33
^bb33:
%298 = llvm.load %238 : !llvm.ptr -> i64
%299 = arith.cmpi slt, %298, %216 : i64
cf.cond_br %299, ^bb34, ^bb35
^bb34:
%301 = llvm.load %238 : !llvm.ptr -> i64
%302 = llvm.getelementptr %223[%301] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%300 = llvm.load %302 : !llvm.ptr -> i8
%303 = arith.constant 0 : i32
%305 = arith.extsi %300 : i8 to i32
%304 = arith.cmpi ne, %305, %303 : i32
cf.cond_br %304, ^bb36, ^bb37
^bb36:
%307 = llvm.load %238 : !llvm.ptr -> i64
%308 = llvm.getelementptr %217[%307] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%306 = llvm.load %308 : !llvm.ptr -> i64
%310 = llvm.load %238 : !llvm.ptr -> i64
%311 = llvm.getelementptr %220[%310] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%309 = llvm.load %311 : !llvm.ptr -> i64
%312 = arith.constant 0 : i32
%313 = arith.extsi %312 : i32 to i64
%314 = llvm.mlir.constant(1 : i64) : i64
%315 = llvm.alloca %314 x i64 : (i64) -> !llvm.ptr
llvm.store %313, %315 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%316 = llvm.load %315 : !llvm.ptr -> i64
%317 = arith.constant 14 : i32
%319 = arith.extsi %317 : i32 to i64
%318 = arith.cmpi slt, %316, %319 : i64
cf.cond_br %318, ^bb40, ^bb41
^bb40:
%321 = llvm.load %315 : !llvm.ptr -> i64
%322 = llvm.getelementptr %154[%321] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%320 = llvm.load %322 : !llvm.ptr -> i32
%323 = arith.extsi %320 : i32 to i64
%324 = arith.constant 1000 : i32
%326 = arith.extsi %324 : i32 to i64
%325 = arith.divsi %323, %326 : i64
%327 = arith.constant 1 : i32
%329 = arith.extsi %327 : i32 to i64
%328 = arith.subi %325, %329 : i64
%330 = arith.constant 100 : i32
%332 = arith.extsi %330 : i32 to i64
%331 = arith.divsi %323, %332 : i64
%333 = arith.constant 10 : i32
%335 = arith.extsi %333 : i32 to i64
%334 = arith.remsi %331, %335 : i64
%336 = arith.constant 1 : i32
%338 = arith.extsi %336 : i32 to i64
%337 = arith.subi %334, %338 : i64
%339 = arith.constant 10 : i32
%341 = arith.extsi %339 : i32 to i64
%340 = arith.divsi %323, %341 : i64
%342 = arith.constant 10 : i32
%344 = arith.extsi %342 : i32 to i64
%343 = arith.remsi %340, %344 : i64
%345 = arith.constant 1 : i32
%347 = arith.extsi %345 : i32 to i64
%346 = arith.subi %343, %347 : i64
%348 = arith.constant 10 : i32
%350 = arith.extsi %348 : i32 to i64
%349 = arith.remsi %323, %350 : i64
%351 = arith.constant 1 : i32
%353 = arith.extsi %351 : i32 to i64
%352 = arith.subi %349, %353 : i64
%354 = arith.constant 4 : i32
%355 = llvm.load %260 : !llvm.ptr -> i64
%357 = arith.extsi %354 : i32 to i64
%356 = arith.muli %357, %355 : i64
%358 = arith.shrsi %306, %356 : i64
%359 = arith.constant 15 : i32
%361 = arith.extsi %359 : i32 to i64
%360 = arith.andi %358, %361 : i64
%362 = arith.constant 4 : i32
%363 = llvm.load %260 : !llvm.ptr -> i64
%364 = arith.constant 1 : i32
%366 = arith.extsi %364 : i32 to i64
%365 = arith.addi %363, %366 : i64
%368 = arith.extsi %362 : i32 to i64
%367 = arith.muli %368, %365 : i64
%369 = arith.shrsi %306, %367 : i64
%370 = arith.constant 15 : i32
%372 = arith.extsi %370 : i32 to i64
%371 = arith.andi %369, %372 : i64
%373 = arith.constant 4 : i32
%374 = llvm.load %260 : !llvm.ptr -> i64
%375 = arith.constant 2 : i32
%377 = arith.extsi %375 : i32 to i64
%376 = arith.addi %374, %377 : i64
%379 = arith.extsi %373 : i32 to i64
%378 = arith.muli %379, %376 : i64
%380 = arith.shrsi %306, %378 : i64
%381 = arith.constant 15 : i32
%383 = arith.extsi %381 : i32 to i64
%382 = arith.andi %380, %383 : i64
%384 = arith.constant 1 : i1
%385 = llvm.mlir.constant(1 : i64) : i64
%386 = llvm.alloca %385 x i1 : (i64) -> !llvm.ptr
llvm.store %384, %386 : i1, !llvm.ptr
%387 = arith.constant 0 : i32
%388 = arith.extsi %387 : i32 to i64
%389 = llvm.mlir.constant(1 : i64) : i64
%390 = llvm.alloca %389 x i64 : (i64) -> !llvm.ptr
llvm.store %388, %390 : i64, !llvm.ptr
cf.br ^bb42
^bb42:
%391 = llvm.load %390 : !llvm.ptr -> i64
%392 = arith.constant 4 : i32
%394 = arith.extsi %392 : i32 to i64
%393 = arith.cmpi slt, %391, %394 : i64
cf.cond_br %393, ^bb43, ^bb44
^bb43:
%395 = llvm.load %390 : !llvm.ptr -> i64
%396 = arith.constant 1 : i32
%398 = arith.extsi %396 : i32 to i64
%397 = arith.cmpi eq, %395, %398 : i64
cf.cond_br %397, ^bb45, ^bb46
^bb45:
cf.br ^bb47(%371, %337 : i64, i64)
^bb46:
%399 = llvm.load %390 : !llvm.ptr -> i64
%400 = arith.constant 2 : i32
%402 = arith.extsi %400 : i32 to i64
%401 = arith.cmpi eq, %399, %402 : i64
cf.cond_br %401, ^bb49, ^bb48
^bb49:
cf.br ^bb47(%382, %346 : i64, i64)
^bb48:
%403 = llvm.load %390 : !llvm.ptr -> i64
%404 = arith.constant 3 : i32
%406 = arith.extsi %404 : i32 to i64
%405 = arith.cmpi eq, %403, %406 : i64
cf.cond_br %405, ^bb50, ^bb47(%360, %328 : i64, i64)
^bb50:
cf.br ^bb47(%293, %352 : i64, i64)
^bb47(%407: i64, %408: i64):
%409 = arith.constant 0 : i32
%411 = arith.extsi %409 : i32 to i64
%410 = arith.cmpi eq, %407, %411 : i64
cf.cond_br %410, ^bb51, ^bb52
^bb51:
%412 = arith.constant 0 : i32
%413 = arith.extsi %412 : i32 to i64
%414 = llvm.mlir.constant(1 : i64) : i64
%415 = llvm.alloca %414 x i64 : (i64) -> !llvm.ptr
llvm.store %413, %415 : i64, !llvm.ptr
cf.br ^bb54
^bb54:
%416 = llvm.load %415 : !llvm.ptr -> i64
%417 = arith.constant 4 : i32
%419 = arith.extsi %417 : i32 to i64
%418 = arith.cmpi slt, %416, %419 : i64
cf.cond_br %418, ^bb55, ^bb56
^bb55:
%420 = llvm.load %415 : !llvm.ptr -> i64
%421 = arith.constant 1 : i32
%423 = arith.extsi %421 : i32 to i64
%422 = arith.cmpi eq, %420, %423 : i64
cf.cond_br %422, ^bb57, ^bb58
^bb57:
cf.br ^bb59(%371, %337 : i64, i64)
^bb58:
%424 = llvm.load %415 : !llvm.ptr -> i64
%425 = arith.constant 2 : i32
%427 = arith.extsi %425 : i32 to i64
%426 = arith.cmpi eq, %424, %427 : i64
cf.cond_br %426, ^bb61, ^bb60
^bb61:
cf.br ^bb59(%382, %346 : i64, i64)
^bb60:
%428 = llvm.load %415 : !llvm.ptr -> i64
%429 = arith.constant 3 : i32
%431 = arith.extsi %429 : i32 to i64
%430 = arith.cmpi eq, %428, %431 : i64
cf.cond_br %430, ^bb62, ^bb59(%360, %328 : i64, i64)
^bb62:
cf.br ^bb59(%293, %352 : i64, i64)
^bb59(%432: i64, %433: i64):
%434 = arith.constant 0 : i32
%436 = arith.extsi %434 : i32 to i64
%435 = arith.cmpi eq, %432, %436 : i64
%437 = arith.cmpi eq, %408, %433 : i64
%438 = arith.cmpi ne, %435, %437 : i1
cf.cond_br %438, ^bb63, ^bb64
^bb63:
%439 = arith.constant 0 : i1
llvm.store %439, %386 : i1, !llvm.ptr
cf.br ^bb56
^bb64:
cf.br ^bb65
^bb65:
%440 = llvm.load %415 : !llvm.ptr -> i64
%441 = arith.constant 1 : i32
%443 = arith.extsi %441 : i32 to i64
%442 = arith.addi %440, %443 : i64
llvm.store %442, %415 : i64, !llvm.ptr
cf.br ^bb54
^bb56:
cf.br ^bb53
^bb52:
cf.br ^bb53
^bb53:
%444 = llvm.load %386 : !llvm.ptr -> i1
%446 = arith.constant 1 : i1
%445 = arith.xori %444, %446 : i1
cf.cond_br %445, ^bb66, ^bb67
^bb66:
cf.br ^bb44
^bb67:
cf.br ^bb68
^bb68:
%448 = llvm.load %390 : !llvm.ptr -> i64
%449 = arith.constant 1 : i32
%451 = arith.extsi %449 : i32 to i64
%450 = arith.addi %448, %451 : i64
llvm.store %450, %390 : i64, !llvm.ptr
cf.br ^bb42
^bb44:
%452 = llvm.load %386 : !llvm.ptr -> i1
cf.cond_br %452, ^bb69, ^bb70
^bb69:
%453 = arith.constant 4 : i32
%455 = arith.extsi %453 : i32 to i64
%454 = arith.shli %306, %455 : i64
%456 = arith.ori %454, %293 : i64
%457 = llvm.mlir.constant(1 : i64) : i64
%458 = llvm.alloca %457 x i64 : (i64) -> !llvm.ptr
llvm.store %456, %458 : i64, !llvm.ptr
%459 = arith.constant 0 : i1
%460 = llvm.mlir.constant(1 : i64) : i64
%461 = llvm.alloca %460 x i1 : (i64) -> !llvm.ptr
llvm.store %459, %461 : i1, !llvm.ptr
%462 = arith.constant 0 : i32
%463 = arith.extsi %462 : i32 to i64
llvm.store %463, %390 : i64, !llvm.ptr
cf.br ^bb72
^bb72:
%464 = llvm.load %390 : !llvm.ptr -> i64
%465 = arith.constant 4 : i32
%467 = arith.extsi %465 : i32 to i64
%466 = arith.cmpi slt, %464, %467 : i64
cf.cond_br %466, ^bb73, ^bb74
^bb73:
%468 = llvm.load %390 : !llvm.ptr -> i64
%469 = arith.constant 1 : i32
%471 = arith.extsi %469 : i32 to i64
%470 = arith.cmpi eq, %468, %471 : i64
cf.cond_br %470, ^bb75, ^bb76
^bb75:
cf.br ^bb77(%337 : i64)
^bb76:
%472 = llvm.load %390 : !llvm.ptr -> i64
%473 = arith.constant 2 : i32
%475 = arith.extsi %473 : i32 to i64
%474 = arith.cmpi eq, %472, %475 : i64
cf.cond_br %474, ^bb79, ^bb78
^bb79:
cf.br ^bb77(%346 : i64)
^bb78:
%476 = llvm.load %390 : !llvm.ptr -> i64
%477 = arith.constant 3 : i32
%479 = arith.extsi %477 : i32 to i64
%478 = arith.cmpi eq, %476, %479 : i64
cf.cond_br %478, ^bb80, ^bb77(%328 : i64)
^bb80:
cf.br ^bb77(%352 : i64)
^bb77(%480: i64):
%481 = llvm.load %390 : !llvm.ptr -> i64
%482 = arith.cmpi ne, %481, %480 : i64
cf.cond_br %482, ^bb81, ^bb82
^bb81:
%483 = arith.constant 0 : i32
%484 = arith.extsi %483 : i32 to i64
%485 = llvm.mlir.constant(1 : i64) : i64
%486 = llvm.alloca %485 x i64 : (i64) -> !llvm.ptr
llvm.store %484, %486 : i64, !llvm.ptr
%487 = llvm.load %390 : !llvm.ptr -> i64
%488 = arith.constant 3 : i32
%490 = arith.extsi %488 : i32 to i64
%489 = arith.cmpi eq, %487, %490 : i64
cf.cond_br %489, ^bb84, ^bb85
^bb84:
llvm.store %293, %486 : i64, !llvm.ptr
cf.br ^bb86
^bb85:
%491 = llvm.load %458 : !llvm.ptr -> i64
%492 = arith.constant 4 : i32
%493 = llvm.load %260 : !llvm.ptr -> i64
%494 = llvm.load %390 : !llvm.ptr -> i64
%495 = arith.addi %493, %494 : i64
%496 = arith.constant 1 : i32
%498 = arith.extsi %496 : i32 to i64
%497 = arith.addi %495, %498 : i64
%500 = arith.extsi %492 : i32 to i64
%499 = arith.muli %500, %497 : i64
%501 = arith.shrsi %491, %499 : i64
%502 = arith.constant 15 : i32
%504 = arith.extsi %502 : i32 to i64
%503 = arith.andi %501, %504 : i64
llvm.store %503, %486 : i64, !llvm.ptr
cf.br ^bb86
^bb86:
%505 = llvm.load %458 : !llvm.ptr -> i64
%506 = arith.constant 4 : i32
%507 = llvm.load %260 : !llvm.ptr -> i64
%508 = arith.addi %507, %480 : i64
%509 = arith.constant 1 : i32
%511 = arith.extsi %509 : i32 to i64
%510 = arith.addi %508, %511 : i64
%513 = arith.extsi %506 : i32 to i64
%512 = arith.muli %513, %510 : i64
%514 = arith.shrsi %505, %512 : i64
%515 = arith.constant 15 : i32
%517 = arith.extsi %515 : i32 to i64
%516 = arith.andi %514, %517 : i64
%518 = llvm.load %486 : !llvm.ptr -> i64
%519 = arith.constant 0 : i32
%521 = arith.extsi %519 : i32 to i64
%520 = arith.cmpi ne, %518, %521 : i64
cf.cond_br %520, ^bb87, ^bb88
^bb87:
%522 = arith.constant 0 : i32
%524 = arith.extsi %522 : i32 to i64
%523 = arith.cmpi eq, %516, %524 : i64
%525 = scf.if %523 -> (i1) {
%526 = arith.constant true
scf.yield %526 : i1
} else {
%527 = llvm.load %486 : !llvm.ptr -> i64
%528 = arith.cmpi eq, %527, %516 : i64
scf.yield %528 : i1
}
cf.cond_br %525, ^bb90, ^bb91
^bb90:
%529 = arith.constant 1 : i1
llvm.store %529, %461 : i1, !llvm.ptr
cf.br ^bb74
^bb91:
cf.br ^bb92
^bb92:
%531 = llvm.load %458 : !llvm.ptr -> i64
%532 = llvm.load %486 : !llvm.ptr -> i64
%530 = func.call @merge_label(%531, %532, %516, %151) : (i64, i64, i64, i64) -> i64
llvm.store %530, %458 : i64, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
cf.br ^bb83
^bb82:
cf.br ^bb83
^bb83:
%533 = llvm.load %390 : !llvm.ptr -> i64
%534 = arith.constant 1 : i32
%536 = arith.extsi %534 : i32 to i64
%535 = arith.addi %533, %536 : i64
llvm.store %535, %390 : i64, !llvm.ptr
cf.br ^bb72
^bb74:
%537 = llvm.load %461 : !llvm.ptr -> i1
%539 = arith.constant 1 : i1
%538 = arith.xori %537, %539 : i1
%541 = scf.if %538 -> (i1) {
%542 = llvm.load %458 : !llvm.ptr -> i64
%543 = arith.constant 1 : i32
%545 = arith.constant 0 : i32
%544 = arith.subi %545, %543 : i32
%547 = arith.extsi %544 : i32 to i64
%546 = arith.cmpi ne, %542, %547 : i64
scf.yield %546 : i1
} else {
%548 = arith.constant false
scf.yield %548 : i1
}
cf.cond_br %541, ^bb93, ^bb94
^bb93:
%549 = llvm.load %458 : !llvm.ptr -> i64
%550 = arith.constant 15 : i32
%552 = arith.extsi %550 : i32 to i64
%551 = arith.andi %549, %552 : i64
%553 = llvm.load %458 : !llvm.ptr -> i64
%554 = arith.constant 4 : i32
%556 = arith.extsi %554 : i32 to i64
%555 = arith.shrsi %553, %556 : i64
llvm.store %555, %458 : i64, !llvm.ptr
%557 = llvm.load %458 : !llvm.ptr -> i64
%558 = arith.constant 4 : i32
%559 = llvm.load %260 : !llvm.ptr -> i64
%560 = arith.constant 1 : i32
%562 = arith.extsi %560 : i32 to i64
%561 = arith.addi %559, %562 : i64
%564 = arith.extsi %558 : i32 to i64
%563 = arith.muli %564, %561 : i64
%565 = arith.shrsi %557, %563 : i64
%566 = arith.constant 15 : i32
%568 = arith.extsi %566 : i32 to i64
%567 = arith.andi %565, %568 : i64
%570 = llvm.load %458 : !llvm.ptr -> i64
%569 = func.call @count_label(%570, %567, %151) : (i64, i64, i64) -> i64
%571 = arith.constant 1 : i32
%573 = arith.extsi %571 : i32 to i64
%572 = arith.cmpi sgt, %569, %573 : i64
%574 = scf.if %572 -> (i1) {
%575 = arith.constant true
scf.yield %575 : i1
} else {
%576 = arith.cmpi eq, %567, %551 : i64
scf.yield %576 : i1
}
%577 = scf.if %574 -> (i1) {
%578 = arith.constant true
scf.yield %578 : i1
} else {
scf.yield %265 : i1
}
cf.cond_br %577, ^bb96, ^bb97
^bb96:
%579 = llvm.load %458 : !llvm.ptr -> i64
%580 = arith.xori %551, %567 : i64
%581 = arith.constant 4 : i32
%582 = llvm.load %260 : !llvm.ptr -> i64
%583 = arith.constant 1 : i32
%585 = arith.extsi %583 : i32 to i64
%584 = arith.addi %582, %585 : i64
%587 = arith.extsi %581 : i32 to i64
%586 = arith.muli %587, %584 : i64
%588 = arith.shli %580, %586 : i64
%589 = arith.xori %579, %588 : i64
llvm.store %589, %458 : i64, !llvm.ptr
%590 = llvm.load %260 : !llvm.ptr -> i64
%591 = arith.cmpi eq, %590, %151 : i64
cf.cond_br %591, ^bb99, ^bb100
^bb99:
%592 = llvm.load %458 : !llvm.ptr -> i64
%593 = arith.constant 4 : i32
%595 = arith.extsi %593 : i32 to i64
%594 = arith.shli %592, %595 : i64
llvm.store %594, %458 : i64, !llvm.ptr
cf.br ^bb101
^bb100:
cf.br ^bb101
^bb101:
%597 = llvm.load %458 : !llvm.ptr -> i64
%596 = func.call @rep_state(%597) : (i64) -> i64
%598 = arith.remsi %596, %216 : i64
%599 = llvm.mlir.constant(1 : i64) : i64
%600 = llvm.alloca %599 x i64 : (i64) -> !llvm.ptr
llvm.store %598, %600 : i64, !llvm.ptr
%601 = llvm.load %600 : !llvm.ptr -> i64
%602 = arith.constant 0 : i32
%604 = arith.extsi %602 : i32 to i64
%603 = arith.cmpi slt, %601, %604 : i64
cf.cond_br %603, ^bb102, ^bb103
^bb102:
%605 = llvm.load %600 : !llvm.ptr -> i64
%607 = arith.constant 0 : i64
%606 = arith.subi %607, %605 : i64
llvm.store %606, %600 : i64, !llvm.ptr
cf.br ^bb104
^bb103:
cf.br ^bb104
^bb104:
cf.br ^bb105
^bb105:
%609 = llvm.load %600 : !llvm.ptr -> i64
%610 = llvm.getelementptr %232[%609] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%608 = llvm.load %610 : !llvm.ptr -> i8
%611 = arith.constant 0 : i32
%613 = arith.extsi %608 : i8 to i32
%612 = arith.cmpi ne, %613, %611 : i32
cf.cond_br %612, ^bb106, ^bb107
^bb106:
%615 = llvm.load %600 : !llvm.ptr -> i64
%616 = llvm.getelementptr %226[%615] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%614 = llvm.load %616 : !llvm.ptr -> i64
%617 = arith.cmpi eq, %614, %596 : i64
cf.cond_br %617, ^bb108, ^bb109
^bb108:
cf.br ^bb107
^bb109:
cf.br ^bb110
^bb110:
%618 = llvm.load %600 : !llvm.ptr -> i64
%619 = arith.constant 1 : i32
%621 = arith.extsi %619 : i32 to i64
%620 = arith.addi %618, %621 : i64
llvm.store %620, %600 : i64, !llvm.ptr
%622 = llvm.load %600 : !llvm.ptr -> i64
%623 = arith.cmpi eq, %622, %216 : i64
cf.cond_br %623, ^bb111, ^bb112
^bb111:
%624 = arith.constant 0 : i32
%625 = arith.extsi %624 : i32 to i64
llvm.store %625, %600 : i64, !llvm.ptr
cf.br ^bb113
^bb112:
cf.br ^bb113
^bb113:
cf.br ^bb105
^bb107:
%627 = llvm.load %600 : !llvm.ptr -> i64
%628 = llvm.getelementptr %232[%627] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%626 = llvm.load %628 : !llvm.ptr -> i8
%629 = arith.constant 0 : i32
%631 = arith.extsi %626 : i8 to i32
%630 = arith.cmpi eq, %631, %629 : i32
cf.cond_br %630, ^bb114, ^bb115
^bb114:
%632 = arith.constant 1 : i32
%633 = llvm.load %600 : !llvm.ptr -> i64
%634 = arith.trunci %632 : i32 to i8
%635 = llvm.getelementptr %232[%633] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %634, %635 : i8, !llvm.ptr
%636 = llvm.load %600 : !llvm.ptr -> i64
%637 = llvm.getelementptr %226[%636] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %596, %637 : i64, !llvm.ptr
%638 = arith.remsi %309, %149 : i64
%639 = llvm.load %600 : !llvm.ptr -> i64
%640 = llvm.getelementptr %229[%639] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %638, %640 : i64, !llvm.ptr
cf.br ^bb116
^bb115:
%642 = llvm.load %600 : !llvm.ptr -> i64
%643 = llvm.getelementptr %229[%642] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%641 = llvm.load %643 : !llvm.ptr -> i64
%644 = arith.addi %641, %309 : i64
%645 = arith.remsi %644, %149 : i64
%646 = llvm.load %600 : !llvm.ptr -> i64
%647 = llvm.getelementptr %229[%646] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %645, %647 : i64, !llvm.ptr
cf.br ^bb116
^bb116:
cf.br ^bb98
^bb97:
cf.br ^bb98
^bb98:
cf.br ^bb95
^bb94:
cf.br ^bb95
^bb95:
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%648 = llvm.load %315 : !llvm.ptr -> i64
%649 = arith.constant 1 : i32
%651 = arith.extsi %649 : i32 to i64
%650 = arith.addi %648, %651 : i64
llvm.store %650, %315 : i64, !llvm.ptr
cf.br ^bb39
^bb41:
cf.br ^bb38
^bb37:
cf.br ^bb38
^bb38:
%652 = llvm.load %238 : !llvm.ptr -> i64
%653 = arith.constant 1 : i32
%655 = arith.extsi %653 : i32 to i64
%654 = arith.addi %652, %655 : i64
llvm.store %654, %238 : i64, !llvm.ptr
cf.br ^bb33
^bb35:
%656 = arith.constant 0 : i32
%657 = arith.extsi %656 : i32 to i64
llvm.store %657, %238 : i64, !llvm.ptr
cf.br ^bb117
^bb117:
%658 = llvm.load %238 : !llvm.ptr -> i64
%659 = arith.cmpi slt, %658, %216 : i64
cf.cond_br %659, ^bb118, ^bb119
^bb118:
%661 = llvm.load %238 : !llvm.ptr -> i64
%662 = llvm.getelementptr %232[%661] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%660 = llvm.load %662 : !llvm.ptr -> i8
%663 = llvm.load %238 : !llvm.ptr -> i64
%664 = llvm.getelementptr %223[%663] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %660, %664 : i8, !llvm.ptr
%666 = llvm.load %238 : !llvm.ptr -> i64
%667 = llvm.getelementptr %226[%666] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%665 = llvm.load %667 : !llvm.ptr -> i64
%668 = llvm.load %238 : !llvm.ptr -> i64
%669 = llvm.getelementptr %217[%668] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %665, %669 : i64, !llvm.ptr
%671 = llvm.load %238 : !llvm.ptr -> i64
%672 = llvm.getelementptr %229[%671] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%670 = llvm.load %672 : !llvm.ptr -> i64
%673 = llvm.load %238 : !llvm.ptr -> i64
%674 = llvm.getelementptr %220[%673] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %670, %674 : i64, !llvm.ptr
%675 = llvm.load %238 : !llvm.ptr -> i64
%676 = arith.constant 1 : i32
%678 = arith.extsi %676 : i32 to i64
%677 = arith.addi %675, %678 : i64
llvm.store %677, %238 : i64, !llvm.ptr
cf.br ^bb117
^bb119:
%679 = llvm.load %260 : !llvm.ptr -> i64
%680 = arith.constant 1 : i32
%682 = arith.extsi %680 : i32 to i64
%681 = arith.addi %679, %682 : i64
llvm.store %681, %260 : i64, !llvm.ptr
cf.br ^bb27
^bb29:
%683 = llvm.load %254 : !llvm.ptr -> i64
%684 = arith.constant 1 : i32
%686 = arith.extsi %684 : i32 to i64
%685 = arith.addi %683, %686 : i64
llvm.store %685, %254 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
%687 = arith.constant 0 : i32
%688 = arith.extsi %687 : i32 to i64
%689 = llvm.mlir.constant(1 : i64) : i64
%690 = llvm.alloca %689 x i64 : (i64) -> !llvm.ptr
llvm.store %688, %690 : i64, !llvm.ptr
%691 = arith.constant 0 : i32
%692 = arith.extsi %691 : i32 to i64
llvm.store %692, %238 : i64, !llvm.ptr
cf.br ^bb120
^bb120:
%693 = llvm.load %238 : !llvm.ptr -> i64
%694 = arith.cmpi slt, %693, %216 : i64
cf.cond_br %694, ^bb121, ^bb122
^bb121:
%696 = llvm.load %238 : !llvm.ptr -> i64
%697 = llvm.getelementptr %223[%696] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%695 = llvm.load %697 : !llvm.ptr -> i8
%698 = arith.constant 0 : i32
%700 = arith.extsi %695 : i8 to i32
%699 = arith.cmpi ne, %700, %698 : i32
%701 = scf.if %699 -> (i1) {
%703 = llvm.load %238 : !llvm.ptr -> i64
%704 = llvm.getelementptr %217[%703] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%702 = llvm.load %704 : !llvm.ptr -> i64
%705 = arith.constant 0 : i32
%707 = arith.extsi %705 : i32 to i64
%706 = arith.cmpi eq, %702, %707 : i64
scf.yield %706 : i1
} else {
%708 = arith.constant false
scf.yield %708 : i1
}
cf.cond_br %701, ^bb123, ^bb124
^bb123:
%710 = llvm.load %238 : !llvm.ptr -> i64
%711 = llvm.getelementptr %220[%710] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%709 = llvm.load %711 : !llvm.ptr -> i64
llvm.store %709, %690 : i64, !llvm.ptr
cf.br ^bb122
^bb124:
cf.br ^bb125
^bb125:
%712 = llvm.load %238 : !llvm.ptr -> i64
%713 = arith.constant 1 : i32
%715 = arith.extsi %713 : i32 to i64
%714 = arith.addi %712, %715 : i64
llvm.store %714, %238 : i64, !llvm.ptr
cf.br ^bb120
^bb122:
%716 = llvm.mlir.addressof @str_0 : !llvm.ptr
%717 = llvm.load %690 : !llvm.ptr -> i64
%718 = arith.remsi %717, %149 : i64
%719 = llvm.call @printf(%716, %718) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
%720 = arith.constant 0 : i32
func.return %720 : i32
}
}