Problem 442
E(10^18): n-th eleven-free integer.
View problem on Project Euler
Performance comparison
| Metric | Our solution | Best known |
| Time complexity | O(n^3) | ? |
| Space complexity | O(n^2) | ? |
| Approach | Flow solution | Not curated |
| Verdict | Unknown |
Flow source
# Project Euler 442
# E(10^18): n-th eleven-free integer.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
# Globals via pointers passed around
function dp_count(
pos: i32, state: i32, started: i32, tight: i32,
D: i32, nstates: i32,
digs: ptr<i32>, trans: ptr<i32>, bad: ptr<i8>,
memo: ptr<i64>, seen: ptr<i8>
) -> i64 {
if pos == D {
if started == 1 { return 1 }
return 0
}
let key: i64 = ((((pos as i64) * (nstates as i64) + (state as i64)) * 2 + (started as i64)) * 2 + (tight as i64))
if seen[key] != 0 {
return memo[key]
}
let mut limit: i32 = 9
if tight == 1 { limit = digs[pos] }
let mut total: i64 = 0
let mut dig: i32 = 0
while dig <= limit {
let mut ntight: i32 = 0
if tight == 1 && dig == limit { ntight = 1 }
if started == 0 && dig == 0 {
total = total + dp_count(pos + 1, 0, 0, ntight, D, nstates, digs, trans, bad, memo, seen)
} else {
let st0: i32 = state
let mut st: i32 = 0
if started == 1 { st = st0 }
let nstate: i32 = trans[st * 10 + dig]
if bad[nstate] == 0 {
total = total + dp_count(pos + 1, nstate, 1, ntight, D, nstates, digs, trans, bad, memo, seen)
}
}
dig = dig + 1
}
seen[key] = 1
memo[key] = total
return total
}
function count_upto(
x: i64, nstates: i32, trans: ptr<i32>, bad: ptr<i8>,
memo: ptr<i64>, seen: ptr<i8>, digs: ptr<i32>, memo_sz: i64
) -> i64 {
if x <= 0 { return 0 }
let mut t: i64 = x
let mut D: i32 = 0
let tmp: array<i32, 20> = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
while t > 0 {
tmp[D] = (t % 10) as i32
t = t / 10
D = D + 1
}
let mut i: i32 = 0
while i < D {
digs[i] = tmp[D - 1 - i]
i = i + 1
}
# clear memo
i = 0
while (i as i64) < memo_sz {
seen[i] = 0
i = i + 1
}
return dp_count(0, 0, 0, 1, D, nstates, digs, trans, bad, memo, seen)
}
function main() -> i32 {
let MAXS: i32 = 800
let nxt: ptr<i32> = calloc((MAXS * 10) as i64, 4)
let link: ptr<i32> = calloc(MAXS as i64, 4)
let bad: ptr<i8> = calloc(MAXS as i64, 1)
if nxt == null || link == null || bad == null { return 1 }
let mut i: i64 = 0
while i < (MAXS * 10) as i64 {
nxt[i] = -1
i = i + 1
}
let mut nstates: i32 = 1
# insert powers of 11
let mut p: i64 = 11
while true {
let mut tmp: i64 = p
let mut digits: array<i8, 40> = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
]
let mut len: i32 = 0
while tmp > 0 {
digits[len] = (tmp % 10) as i8
tmp = tmp / 10
len = len + 1
}
if len > 19 { break }
let mut v: i32 = 0
let mut j: i32 = 0
while j < len {
let d: i32 = digits[len - 1 - j] as i32
let idx: i64 = (v * 10 + d) as i64
if nxt[idx] < 0 {
nxt[idx] = nstates
nstates = nstates + 1
}
v = nxt[idx]
j = j + 1
}
bad[v] = 1
if p > 9223372036854775807 / 11 { break }
p = p * 11
}
let q: ptr<i32> = calloc(MAXS as i64, 4)
if q == null { return 1 }
let mut qh: i32 = 0
let mut qt: i32 = 0
let mut d: i32 = 0
while d < 10 {
if nxt[d] >= 0 {
link[nxt[d]] = 0
q[qt] = nxt[d]
qt = qt + 1
} else {
nxt[d] = 0
}
d = d + 1
}
while qh < qt {
let v: i32 = q[qh]
qh = qh + 1
d = 0
while d < 10 {
let u: i32 = nxt[v * 10 + d]
if u >= 0 {
q[qt] = u
qt = qt + 1
let mut f: i32 = link[v]
while f != 0 && nxt[f * 10 + d] < 0 {
f = link[f]
}
if nxt[f * 10 + d] >= 0 && nxt[f * 10 + d] != u {
link[u] = nxt[f * 10 + d]
} else {
link[u] = 0
}
if bad[link[u]] != 0 { bad[u] = 1 }
} else {
nxt[v * 10 + d] = nxt[link[v] * 10 + d]
}
d = d + 1
}
}
# Full transition table (already filled via failure)
let trans: ptr<i32> = calloc((nstates * 10) as i64, 4)
if trans == null { return 1 }
let mut s: i32 = 0
while s < nstates {
d = 0
while d < 10 {
let u: i32 = nxt[s * 10 + d]
if u < 0 { u = 0 }
trans[s * 10 + d] = u
d = d + 1
}
s = s + 1
}
let memo_sz: i64 = 20 * (nstates as i64) * 2 * 2
let memo: ptr<i64> = calloc(memo_sz, 8)
let seen: ptr<i8> = calloc(memo_sz, 1)
let digs: ptr<i32> = calloc(20, 4)
if memo == null || seen == null || digs == null { return 1 }
let target: i64 = 1000000000000000000
let mut high: i64 = target
while count_upto(high, nstates, trans, bad, memo, seen, digs, memo_sz) < target {
high = high * 2
if high < 0 {
high = 9223372036854775807
break
}
}
let mut low: i64 = 1
while low < high {
let mid: i64 = low + (high - low) / 2
if count_upto(mid, nstates, trans, bad, memo, seen, digs, memo_sz) >= target {
high = mid
} else {
low = mid + 1
}
}
# Nudge in case of off-by-one from automaton edge cases
while low > 1 && count_upto(low - 1, nstates, trans, bad, memo, seen, digs, memo_sz) >= target {
low = low - 1
}
while count_upto(low, nstates, trans, bad, memo, seen, digs, memo_sz) < target {
low = low + 1
}
printf("%lld\n", low)
free(digs)
free(seen)
free(memo)
free(trans)
free(q)
free(bad)
free(link)
free(nxt)
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 dp_count_i32_i32_i32_i32_i32_i32_ptr_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8(int32_t pos, int32_t state, int32_t started, int32_t tight, int32_t D, int32_t nstates, int32_t* digs, int32_t* trans, int8_t* bad, int64_t* memo, int8_t* seen);
int64_t count_upto_i64_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8_ptr_i32_i64(int64_t x, int32_t nstates, int32_t* trans, int8_t* bad, int64_t* memo, int8_t* seen, int32_t* digs, int64_t memo_sz);
int32_t main(void);
int64_t dp_count_i32_i32_i32_i32_i32_i32_ptr_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8(int32_t pos, int32_t state, int32_t started, int32_t tight, int32_t D, int32_t nstates, int32_t* digs, int32_t* trans, int8_t* bad, int64_t* memo, int8_t* seen) {
if (pos == D) {
if (started == 1) {
return 1;
}
return 0;
}
int64_t key = ((((((((int64_t)(pos)) * ((int64_t)(nstates))) + ((int64_t)(state))) * 2) + ((int64_t)(started))) * 2) + ((int64_t)(tight)));
if (seen[key] != 0) {
return memo[key];
}
int32_t limit = 9;
if (tight == 1) {
limit = digs[pos];
}
int64_t total = 0;
int32_t dig = 0;
while (dig <= limit) {
int32_t ntight = 0;
if ((tight == 1 && dig == limit)) {
ntight = 1;
}
if ((started == 0 && dig == 0)) {
total = (total + dp_count_i32_i32_i32_i32_i32_i32_ptr_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8((pos + 1), 0, 0, ntight, D, nstates, digs, trans, bad, memo, seen));
} else {
int32_t st0 = state;
int32_t st = 0;
if (started == 1) {
st = st0;
}
int32_t nstate = trans[((st * 10) + dig)];
if (bad[nstate] == 0) {
total = (total + dp_count_i32_i32_i32_i32_i32_i32_ptr_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8((pos + 1), nstate, 1, ntight, D, nstates, digs, trans, bad, memo, seen));
}
}
dig = (dig + 1);
}
seen[key] = 1;
memo[key] = total;
return total;
}
int64_t count_upto_i64_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8_ptr_i32_i64(int64_t x, int32_t nstates, int32_t* trans, int8_t* bad, int64_t* memo, int8_t* seen, int32_t* digs, int64_t memo_sz) {
if (x <= 0) {
return 0;
}
int64_t t = x;
int32_t D = 0;
int32_t tmp[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
while (t > 0) {
tmp[D] = ((int32_t)(FLOW_CHECKED_MOD((t), (10))));
t = FLOW_CHECKED_DIV((t), (10));
D = (D + 1);
}
int32_t i = 0;
while (i < D) {
digs[i] = (((unsigned)(((D - 1) - i)) < 20) ? tmp[((D - 1) - i)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((D - 1) - i)), 20), flow_fault_handler("array index out of bounds"), tmp[0]));
i = (i + 1);
}
i = 0;
while (((int64_t)(i)) < memo_sz) {
seen[i] = 0;
i = (i + 1);
}
return dp_count_i32_i32_i32_i32_i32_i32_ptr_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8(0, 0, 0, 1, D, nstates, digs, trans, bad, memo, seen);
}
int32_t main(void) {
int32_t MAXS = 800;
int32_t* nxt = (int32_t*)(calloc(((int64_t)((MAXS * 10))), 4));
int32_t* link = (int32_t*)(calloc(((int64_t)(MAXS)), 4));
int8_t* bad = (int8_t*)(calloc(((int64_t)(MAXS)), 1));
if (((nxt == NULL || link == NULL) || bad == NULL)) {
return 1;
}
int64_t i = 0;
while (i < ((int64_t)((MAXS * 10)))) {
nxt[i] = (-1);
i = (i + 1);
}
int32_t nstates = 1;
int64_t p = 11;
while (1) {
int64_t tmp = p;
int8_t digits[40] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int32_t len = 0;
while (tmp > 0) {
digits[len] = ((int8_t)(FLOW_CHECKED_MOD((tmp), (10))));
tmp = FLOW_CHECKED_DIV((tmp), (10));
len = (len + 1);
}
if (len > 19) {
break;
}
int32_t v = 0;
int32_t j = 0;
while (j < len) {
int32_t d = ((int32_t)((((unsigned)(((len - 1) - j)) < 40) ? digits[((len - 1) - j)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((len - 1) - j)), 40), flow_fault_handler("array index out of bounds"), digits[0]))));
int64_t idx = ((int64_t)(((v * 10) + d)));
if (nxt[idx] < 0) {
nxt[idx] = nstates;
nstates = (nstates + 1);
}
v = nxt[idx];
j = (j + 1);
}
bad[v] = 1;
if (p > FLOW_CHECKED_DIV((9223372036854775807), (11))) {
break;
}
p = (p * 11);
}
int32_t* q = (int32_t*)(calloc(((int64_t)(MAXS)), 4));
if (q == NULL) {
return 1;
}
int32_t qh = 0;
int32_t qt = 0;
int32_t d = 0;
while (d < 10) {
if (nxt[d] >= 0) {
link[nxt[d]] = 0;
q[qt] = nxt[d];
qt = (qt + 1);
} else {
nxt[d] = 0;
}
d = (d + 1);
}
while (qh < qt) {
int32_t v = q[qh];
qh = (qh + 1);
d = 0;
while (d < 10) {
int32_t u = nxt[((v * 10) + d)];
if (u >= 0) {
q[qt] = u;
qt = (qt + 1);
int32_t f = link[v];
while ((f != 0 && nxt[((f * 10) + d)] < 0)) {
f = link[f];
}
if ((nxt[((f * 10) + d)] >= 0 && nxt[((f * 10) + d)] != u)) {
link[u] = nxt[((f * 10) + d)];
} else {
link[u] = 0;
}
if (bad[link[u]] != 0) {
bad[u] = 1;
}
} else {
nxt[((v * 10) + d)] = nxt[((link[v] * 10) + d)];
}
d = (d + 1);
}
}
int32_t* trans = (int32_t*)(calloc(((int64_t)((nstates * 10))), 4));
if (trans == NULL) {
return 1;
}
int32_t s = 0;
while (s < nstates) {
d = 0;
while (d < 10) {
int32_t u = nxt[((s * 10) + d)];
if (u < 0) {
u = 0;
}
trans[((s * 10) + d)] = u;
d = (d + 1);
}
s = (s + 1);
}
int64_t memo_sz = (((20 * ((int64_t)(nstates))) * 2) * 2);
int64_t* memo = (int64_t*)(calloc(memo_sz, 8));
int8_t* seen = (int8_t*)(calloc(memo_sz, 1));
int32_t* digs = (int32_t*)(calloc(20, 4));
if (((memo == NULL || seen == NULL) || digs == NULL)) {
return 1;
}
int64_t target = 1000000000000000000;
int64_t high = target;
while (count_upto_i64_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8_ptr_i32_i64(high, nstates, trans, bad, memo, seen, digs, memo_sz) < target) {
high = (high * 2);
if (high < 0) {
high = 9223372036854775807;
break;
}
}
int64_t low = 1;
while (low < high) {
int64_t mid = (low + FLOW_CHECKED_DIV(((high - low)), (2)));
if (count_upto_i64_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8_ptr_i32_i64(mid, nstates, trans, bad, memo, seen, digs, memo_sz) >= target) {
high = mid;
} else {
low = (mid + 1);
}
}
while ((low > 1 && count_upto_i64_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8_ptr_i32_i64((low - 1), nstates, trans, bad, memo, seen, digs, memo_sz) >= target)) {
low = (low - 1);
}
while (count_upto_i64_i32_ptr_i32_ptr_i8_ptr_i64_ptr_i8_ptr_i32_i64(low, nstates, trans, bad, memo, seen, digs, memo_sz) < target) {
low = (low + 1);
}
printf("%lld\n", low);
free(digs);
free(seen);
free(memo);
free(trans);
free(q);
free(bad);
free(link);
free(nxt);
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 @dp_count(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32, %arg4: i32, %arg5: i32, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: !llvm.ptr, %arg9: !llvm.ptr, %arg10: !llvm.ptr) -> i64 {
%0 = arith.cmpi eq, %arg0, %arg4 : i32
cf.cond_br %0, ^bb0, ^bb1
^bb0:
%1 = arith.constant 1 : i32
%2 = arith.cmpi eq, %arg2, %1 : i32
cf.cond_br %2, ^bb3, ^bb4
^bb3:
%3 = arith.constant 1 : i32
%4 = arith.extsi %3 : i32 to i64
func.return %4 : i64
^bb4:
cf.br ^bb5
^bb5:
%5 = arith.constant 0 : i32
%6 = arith.extsi %5 : i32 to i64
func.return %6 : i64
^bb1:
cf.br ^bb2
^bb2:
%7 = arith.extsi %arg0 : i32 to i64
%8 = arith.extsi %arg5 : i32 to i64
%9 = arith.muli %7, %8 : i64
%10 = arith.extsi %arg1 : i32 to i64
%11 = arith.addi %9, %10 : i64
%12 = arith.constant 2 : i32
%14 = arith.extsi %12 : i32 to i64
%13 = arith.muli %11, %14 : i64
%15 = arith.extsi %arg2 : i32 to i64
%16 = arith.addi %13, %15 : i64
%17 = arith.constant 2 : i32
%19 = arith.extsi %17 : i32 to i64
%18 = arith.muli %16, %19 : i64
%20 = arith.extsi %arg3 : i32 to i64
%21 = arith.addi %18, %20 : i64
%23 = llvm.getelementptr %arg10[%21] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%22 = llvm.load %23 : !llvm.ptr -> i8
%24 = arith.constant 0 : i32
%26 = arith.extsi %22 : i8 to i32
%25 = arith.cmpi ne, %26, %24 : i32
cf.cond_br %25, ^bb6, ^bb7
^bb6:
%28 = llvm.getelementptr %arg9[%21] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%27 = llvm.load %28 : !llvm.ptr -> i64
func.return %27 : i64
^bb7:
cf.br ^bb8
^bb8:
%29 = arith.constant 9 : i32
%30 = llvm.mlir.constant(1 : i64) : i64
%31 = llvm.alloca %30 x i32 : (i64) -> !llvm.ptr
llvm.store %29, %31 : i32, !llvm.ptr
%32 = arith.constant 1 : i32
%33 = arith.cmpi eq, %arg3, %32 : i32
cf.cond_br %33, ^bb9, ^bb10
^bb9:
%35 = arith.extsi %arg0 : i32 to i64
%36 = llvm.getelementptr %arg6[%35] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%34 = llvm.load %36 : !llvm.ptr -> i32
llvm.store %34, %31 : i32, !llvm.ptr
cf.br ^bb11
^bb10:
cf.br ^bb11
^bb11:
%37 = arith.constant 0 : i32
%38 = arith.extsi %37 : i32 to i64
%39 = llvm.mlir.constant(1 : i64) : i64
%40 = llvm.alloca %39 x i64 : (i64) -> !llvm.ptr
llvm.store %38, %40 : i64, !llvm.ptr
%41 = arith.constant 0 : i32
%42 = llvm.mlir.constant(1 : i64) : i64
%43 = llvm.alloca %42 x i32 : (i64) -> !llvm.ptr
llvm.store %41, %43 : i32, !llvm.ptr
cf.br ^bb12
^bb12:
%44 = llvm.load %43 : !llvm.ptr -> i32
%45 = llvm.load %31 : !llvm.ptr -> i32
%46 = arith.cmpi sle, %44, %45 : i32
cf.cond_br %46, ^bb13, ^bb14
^bb13:
%47 = arith.constant 0 : i32
%48 = llvm.mlir.constant(1 : i64) : i64
%49 = llvm.alloca %48 x i32 : (i64) -> !llvm.ptr
llvm.store %47, %49 : i32, !llvm.ptr
%50 = arith.constant 1 : i32
%51 = arith.cmpi eq, %arg3, %50 : i32
%52 = scf.if %51 -> (i1) {
%53 = llvm.load %43 : !llvm.ptr -> i32
%54 = llvm.load %31 : !llvm.ptr -> i32
%55 = arith.cmpi eq, %53, %54 : i32
scf.yield %55 : i1
} else {
%56 = arith.constant false
scf.yield %56 : i1
}
cf.cond_br %52, ^bb15, ^bb16
^bb15:
%57 = arith.constant 1 : i32
llvm.store %57, %49 : i32, !llvm.ptr
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%58 = arith.constant 0 : i32
%59 = arith.cmpi eq, %arg2, %58 : i32
%60 = scf.if %59 -> (i1) {
%61 = llvm.load %43 : !llvm.ptr -> i32
%62 = arith.constant 0 : i32
%63 = arith.cmpi eq, %61, %62 : i32
scf.yield %63 : i1
} else {
%64 = arith.constant false
scf.yield %64 : i1
}
cf.cond_br %60, ^bb18, ^bb19
^bb18:
%65 = llvm.load %40 : !llvm.ptr -> i64
%67 = arith.constant 1 : i32
%68 = arith.addi %arg0, %67 : i32
%69 = arith.constant 0 : i32
%70 = arith.constant 0 : i32
%71 = llvm.load %49 : !llvm.ptr -> i32
%66 = func.call @dp_count(%68, %69, %70, %71, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10) : (i32, i32, i32, i32, i32, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> i64
%72 = arith.addi %65, %66 : i64
llvm.store %72, %40 : i64, !llvm.ptr
cf.br ^bb20
^bb19:
%73 = arith.constant 0 : i32
%74 = llvm.mlir.constant(1 : i64) : i64
%75 = llvm.alloca %74 x i32 : (i64) -> !llvm.ptr
llvm.store %73, %75 : i32, !llvm.ptr
%76 = arith.constant 1 : i32
%77 = arith.cmpi eq, %arg2, %76 : i32
cf.cond_br %77, ^bb21, ^bb22
^bb21:
llvm.store %arg1, %75 : i32, !llvm.ptr
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
%79 = llvm.load %75 : !llvm.ptr -> i32
%80 = arith.constant 10 : i32
%81 = arith.muli %79, %80 : i32
%82 = llvm.load %43 : !llvm.ptr -> i32
%83 = arith.addi %81, %82 : i32
%84 = arith.extsi %83 : i32 to i64
%85 = llvm.getelementptr %arg7[%84] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%78 = llvm.load %85 : !llvm.ptr -> i32
%87 = arith.extsi %78 : i32 to i64
%88 = llvm.getelementptr %arg8[%87] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%86 = llvm.load %88 : !llvm.ptr -> i8
%89 = arith.constant 0 : i32
%91 = arith.extsi %86 : i8 to i32
%90 = arith.cmpi eq, %91, %89 : i32
cf.cond_br %90, ^bb24, ^bb25
^bb24:
%92 = llvm.load %40 : !llvm.ptr -> i64
%94 = arith.constant 1 : i32
%95 = arith.addi %arg0, %94 : i32
%96 = arith.constant 1 : i32
%97 = llvm.load %49 : !llvm.ptr -> i32
%93 = func.call @dp_count(%95, %78, %96, %97, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10) : (i32, i32, i32, i32, i32, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> i64
%98 = arith.addi %92, %93 : i64
llvm.store %98, %40 : i64, !llvm.ptr
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
cf.br ^bb20
^bb20:
%99 = llvm.load %43 : !llvm.ptr -> i32
%100 = arith.constant 1 : i32
%101 = arith.addi %99, %100 : i32
llvm.store %101, %43 : i32, !llvm.ptr
cf.br ^bb12
^bb14:
%102 = arith.constant 1 : i32
%103 = arith.trunci %102 : i32 to i8
%104 = llvm.getelementptr %arg10[%21] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %103, %104 : i8, !llvm.ptr
%105 = llvm.load %40 : !llvm.ptr -> i64
%106 = llvm.getelementptr %arg9[%21] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %105, %106 : i64, !llvm.ptr
%107 = llvm.load %40 : !llvm.ptr -> i64
func.return %107 : i64
}
func.func @count_upto(%arg0: i64, %arg1: i32, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: !llvm.ptr, %arg7: i64) -> i64 {
%108 = arith.constant 0 : i32
%110 = arith.extsi %108 : i32 to i64
%109 = arith.cmpi sle, %arg0, %110 : i64
cf.cond_br %109, ^bb27, ^bb28
^bb27:
%111 = arith.constant 0 : i32
%112 = arith.extsi %111 : i32 to i64
func.return %112 : i64
^bb28:
cf.br ^bb29
^bb29:
%113 = llvm.mlir.constant(1 : i64) : i64
%114 = llvm.alloca %113 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %114 : i64, !llvm.ptr
%115 = arith.constant 0 : i32
%116 = llvm.mlir.constant(1 : i64) : i64
%117 = llvm.alloca %116 x i32 : (i64) -> !llvm.ptr
llvm.store %115, %117 : i32, !llvm.ptr
%119 = arith.constant 0 : i32
%120 = arith.constant 0 : i32
%121 = arith.constant 0 : i32
%122 = arith.constant 0 : i32
%123 = arith.constant 0 : i32
%124 = arith.constant 0 : i32
%125 = arith.constant 0 : i32
%126 = arith.constant 0 : i32
%127 = arith.constant 0 : i32
%128 = arith.constant 0 : i32
%129 = arith.constant 0 : i32
%130 = arith.constant 0 : i32
%131 = arith.constant 0 : i32
%132 = arith.constant 0 : i32
%133 = arith.constant 0 : i32
%134 = arith.constant 0 : i32
%135 = arith.constant 0 : i32
%136 = arith.constant 0 : i32
%137 = arith.constant 0 : i32
%138 = arith.constant 0 : i32
%139 = llvm.mlir.constant(1 : i64) : i64
%140 = llvm.alloca %139 x !llvm.array<20 x i32> : (i64) -> !llvm.ptr
%141 = llvm.mlir.zero : !llvm.array<20 x i32>
llvm.store %141, %140 : !llvm.array<20 x i32>, !llvm.ptr
%142 = llvm.mlir.constant(0 : i64) : i64
%143 = llvm.getelementptr %140[0, %142] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %119, %143 : i32, !llvm.ptr
%144 = llvm.mlir.constant(1 : i64) : i64
%145 = llvm.getelementptr %140[0, %144] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %120, %145 : i32, !llvm.ptr
%146 = llvm.mlir.constant(2 : i64) : i64
%147 = llvm.getelementptr %140[0, %146] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %121, %147 : i32, !llvm.ptr
%148 = llvm.mlir.constant(3 : i64) : i64
%149 = llvm.getelementptr %140[0, %148] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %122, %149 : i32, !llvm.ptr
%150 = llvm.mlir.constant(4 : i64) : i64
%151 = llvm.getelementptr %140[0, %150] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %123, %151 : i32, !llvm.ptr
%152 = llvm.mlir.constant(5 : i64) : i64
%153 = llvm.getelementptr %140[0, %152] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %124, %153 : i32, !llvm.ptr
%154 = llvm.mlir.constant(6 : i64) : i64
%155 = llvm.getelementptr %140[0, %154] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %125, %155 : i32, !llvm.ptr
%156 = llvm.mlir.constant(7 : i64) : i64
%157 = llvm.getelementptr %140[0, %156] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %126, %157 : i32, !llvm.ptr
%158 = llvm.mlir.constant(8 : i64) : i64
%159 = llvm.getelementptr %140[0, %158] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %127, %159 : i32, !llvm.ptr
%160 = llvm.mlir.constant(9 : i64) : i64
%161 = llvm.getelementptr %140[0, %160] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %128, %161 : i32, !llvm.ptr
%162 = llvm.mlir.constant(10 : i64) : i64
%163 = llvm.getelementptr %140[0, %162] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %129, %163 : i32, !llvm.ptr
%164 = llvm.mlir.constant(11 : i64) : i64
%165 = llvm.getelementptr %140[0, %164] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %130, %165 : i32, !llvm.ptr
%166 = llvm.mlir.constant(12 : i64) : i64
%167 = llvm.getelementptr %140[0, %166] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %131, %167 : i32, !llvm.ptr
%168 = llvm.mlir.constant(13 : i64) : i64
%169 = llvm.getelementptr %140[0, %168] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %132, %169 : i32, !llvm.ptr
%170 = llvm.mlir.constant(14 : i64) : i64
%171 = llvm.getelementptr %140[0, %170] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %133, %171 : i32, !llvm.ptr
%172 = llvm.mlir.constant(15 : i64) : i64
%173 = llvm.getelementptr %140[0, %172] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %134, %173 : i32, !llvm.ptr
%174 = llvm.mlir.constant(16 : i64) : i64
%175 = llvm.getelementptr %140[0, %174] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %135, %175 : i32, !llvm.ptr
%176 = llvm.mlir.constant(17 : i64) : i64
%177 = llvm.getelementptr %140[0, %176] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %136, %177 : i32, !llvm.ptr
%178 = llvm.mlir.constant(18 : i64) : i64
%179 = llvm.getelementptr %140[0, %178] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %137, %179 : i32, !llvm.ptr
%180 = llvm.mlir.constant(19 : i64) : i64
%181 = llvm.getelementptr %140[0, %180] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %138, %181 : i32, !llvm.ptr
cf.br ^bb30
^bb30:
%182 = llvm.load %114 : !llvm.ptr -> i64
%183 = arith.constant 0 : i32
%185 = arith.extsi %183 : i32 to i64
%184 = arith.cmpi sgt, %182, %185 : i64
cf.cond_br %184, ^bb31, ^bb32
^bb31:
%186 = llvm.load %114 : !llvm.ptr -> i64
%187 = arith.constant 10 : i32
%189 = arith.extsi %187 : i32 to i64
%188 = arith.remsi %186, %189 : i64
%190 = arith.trunci %188 : i64 to i32
%191 = llvm.load %117 : !llvm.ptr -> i32
%192 = arith.extsi %191 : i32 to i64
%193 = llvm.getelementptr %140[0, %192] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
llvm.store %190, %193 : i32, !llvm.ptr
%194 = llvm.load %114 : !llvm.ptr -> i64
%195 = arith.constant 10 : i32
%197 = arith.extsi %195 : i32 to i64
%196 = arith.divsi %194, %197 : i64
llvm.store %196, %114 : i64, !llvm.ptr
%198 = llvm.load %117 : !llvm.ptr -> i32
%199 = arith.constant 1 : i32
%200 = arith.addi %198, %199 : i32
llvm.store %200, %117 : i32, !llvm.ptr
cf.br ^bb30
^bb32:
%201 = arith.constant 0 : i32
%202 = llvm.mlir.constant(1 : i64) : i64
%203 = llvm.alloca %202 x i32 : (i64) -> !llvm.ptr
llvm.store %201, %203 : i32, !llvm.ptr
cf.br ^bb33
^bb33:
%204 = llvm.load %203 : !llvm.ptr -> i32
%205 = llvm.load %117 : !llvm.ptr -> i32
%206 = arith.cmpi slt, %204, %205 : i32
cf.cond_br %206, ^bb34, ^bb35
^bb34:
%208 = llvm.load %117 : !llvm.ptr -> i32
%209 = arith.constant 1 : i32
%210 = arith.subi %208, %209 : i32
%211 = llvm.load %203 : !llvm.ptr -> i32
%212 = arith.subi %210, %211 : i32
%213 = arith.extsi %212 : i32 to i64
%214 = llvm.getelementptr %140[0, %213] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<20 x i32>
%207 = llvm.load %214 : !llvm.ptr -> i32
%215 = llvm.load %203 : !llvm.ptr -> i32
%216 = arith.extsi %215 : i32 to i64
%217 = llvm.getelementptr %arg6[%216] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %207, %217 : i32, !llvm.ptr
%218 = llvm.load %203 : !llvm.ptr -> i32
%219 = arith.constant 1 : i32
%220 = arith.addi %218, %219 : i32
llvm.store %220, %203 : i32, !llvm.ptr
cf.br ^bb33
^bb35:
%221 = arith.constant 0 : i32
llvm.store %221, %203 : i32, !llvm.ptr
cf.br ^bb36
^bb36:
%222 = llvm.load %203 : !llvm.ptr -> i32
%223 = arith.extsi %222 : i32 to i64
%224 = arith.cmpi slt, %223, %arg7 : i64
cf.cond_br %224, ^bb37, ^bb38
^bb37:
%225 = arith.constant 0 : i32
%226 = llvm.load %203 : !llvm.ptr -> i32
%227 = arith.trunci %225 : i32 to i8
%228 = arith.extsi %226 : i32 to i64
%229 = llvm.getelementptr %arg5[%228] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %227, %229 : i8, !llvm.ptr
%230 = llvm.load %203 : !llvm.ptr -> i32
%231 = arith.constant 1 : i32
%232 = arith.addi %230, %231 : i32
llvm.store %232, %203 : i32, !llvm.ptr
cf.br ^bb36
^bb38:
%234 = arith.constant 0 : i32
%235 = arith.constant 0 : i32
%236 = arith.constant 0 : i32
%237 = arith.constant 1 : i32
%238 = llvm.load %117 : !llvm.ptr -> i32
%233 = func.call @dp_count(%234, %235, %236, %237, %238, %arg1, %arg6, %arg2, %arg3, %arg4, %arg5) : (i32, i32, i32, i32, i32, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> i64
func.return %233 : i64
}
func.func @main() -> i32 {
%239 = arith.constant 800 : i32
%241 = arith.constant 10 : i32
%242 = arith.muli %239, %241 : i32
%243 = arith.extsi %242 : i32 to i64
%244 = arith.constant 4 : i32
%245 = arith.extsi %244 : i32 to i64
%240 = func.call @calloc(%243, %245) : (i64, i64) -> !llvm.ptr
%247 = arith.extsi %239 : i32 to i64
%248 = arith.constant 4 : i32
%249 = arith.extsi %248 : i32 to i64
%246 = func.call @calloc(%247, %249) : (i64, i64) -> !llvm.ptr
%251 = arith.extsi %239 : i32 to i64
%252 = arith.constant 1 : i32
%253 = arith.extsi %252 : i32 to i64
%250 = func.call @calloc(%251, %253) : (i64, i64) -> !llvm.ptr
%254 = llvm.mlir.zero : !llvm.ptr
%255 = llvm.icmp "eq" %240, %254 : !llvm.ptr
%256 = scf.if %255 -> (i1) {
%257 = arith.constant true
scf.yield %257 : i1
} else {
%258 = llvm.mlir.zero : !llvm.ptr
%259 = llvm.icmp "eq" %246, %258 : !llvm.ptr
scf.yield %259 : i1
}
%260 = scf.if %256 -> (i1) {
%261 = arith.constant true
scf.yield %261 : i1
} else {
%262 = llvm.mlir.zero : !llvm.ptr
%263 = llvm.icmp "eq" %250, %262 : !llvm.ptr
scf.yield %263 : i1
}
cf.cond_br %260, ^bb39, ^bb40
^bb39:
%264 = arith.constant 1 : i32
func.return %264 : i32
^bb40:
cf.br ^bb41
^bb41:
%265 = arith.constant 0 : i32
%266 = arith.extsi %265 : i32 to i64
%267 = llvm.mlir.constant(1 : i64) : i64
%268 = llvm.alloca %267 x i64 : (i64) -> !llvm.ptr
llvm.store %266, %268 : i64, !llvm.ptr
cf.br ^bb42
^bb42:
%269 = llvm.load %268 : !llvm.ptr -> i64
%270 = arith.constant 10 : i32
%271 = arith.muli %239, %270 : i32
%272 = arith.extsi %271 : i32 to i64
%273 = arith.cmpi slt, %269, %272 : i64
cf.cond_br %273, ^bb43, ^bb44
^bb43:
%274 = arith.constant 1 : i32
%276 = arith.constant 0 : i32
%275 = arith.subi %276, %274 : i32
%277 = llvm.load %268 : !llvm.ptr -> i64
%278 = llvm.getelementptr %240[%277] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %275, %278 : i32, !llvm.ptr
%279 = llvm.load %268 : !llvm.ptr -> i64
%280 = arith.constant 1 : i32
%282 = arith.extsi %280 : i32 to i64
%281 = arith.addi %279, %282 : i64
llvm.store %281, %268 : i64, !llvm.ptr
cf.br ^bb42
^bb44:
%283 = arith.constant 1 : i32
%284 = llvm.mlir.constant(1 : i64) : i64
%285 = llvm.alloca %284 x i32 : (i64) -> !llvm.ptr
llvm.store %283, %285 : i32, !llvm.ptr
%286 = arith.constant 11 : i32
%287 = arith.extsi %286 : i32 to i64
%288 = llvm.mlir.constant(1 : i64) : i64
%289 = llvm.alloca %288 x i64 : (i64) -> !llvm.ptr
llvm.store %287, %289 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%290 = arith.constant 1 : i1
cf.cond_br %290, ^bb46, ^bb47
^bb46:
%291 = llvm.load %289 : !llvm.ptr -> i64
%292 = llvm.mlir.constant(1 : i64) : i64
%293 = llvm.alloca %292 x i64 : (i64) -> !llvm.ptr
llvm.store %291, %293 : i64, !llvm.ptr
%295 = arith.constant 0 : i32
%296 = arith.constant 0 : i32
%297 = arith.constant 0 : i32
%298 = arith.constant 0 : i32
%299 = arith.constant 0 : i32
%300 = arith.constant 0 : i32
%301 = arith.constant 0 : i32
%302 = arith.constant 0 : i32
%303 = arith.constant 0 : i32
%304 = arith.constant 0 : i32
%305 = arith.constant 0 : i32
%306 = arith.constant 0 : i32
%307 = arith.constant 0 : i32
%308 = arith.constant 0 : i32
%309 = arith.constant 0 : i32
%310 = arith.constant 0 : i32
%311 = arith.constant 0 : i32
%312 = arith.constant 0 : i32
%313 = arith.constant 0 : i32
%314 = arith.constant 0 : i32
%315 = arith.constant 0 : i32
%316 = arith.constant 0 : i32
%317 = arith.constant 0 : i32
%318 = arith.constant 0 : i32
%319 = arith.constant 0 : i32
%320 = arith.constant 0 : i32
%321 = arith.constant 0 : i32
%322 = arith.constant 0 : i32
%323 = arith.constant 0 : i32
%324 = arith.constant 0 : i32
%325 = arith.constant 0 : i32
%326 = arith.constant 0 : i32
%327 = arith.constant 0 : i32
%328 = arith.constant 0 : i32
%329 = arith.constant 0 : i32
%330 = arith.constant 0 : i32
%331 = arith.constant 0 : i32
%332 = arith.constant 0 : i32
%333 = arith.constant 0 : i32
%334 = arith.constant 0 : i32
%335 = llvm.mlir.constant(1 : i64) : i64
%336 = llvm.alloca %335 x !llvm.array<40 x i8> : (i64) -> !llvm.ptr
%337 = llvm.mlir.zero : !llvm.array<40 x i8>
llvm.store %337, %336 : !llvm.array<40 x i8>, !llvm.ptr
%338 = arith.trunci %295 : i32 to i8
%339 = arith.trunci %296 : i32 to i8
%340 = arith.trunci %297 : i32 to i8
%341 = arith.trunci %298 : i32 to i8
%342 = arith.trunci %299 : i32 to i8
%343 = arith.trunci %300 : i32 to i8
%344 = arith.trunci %301 : i32 to i8
%345 = arith.trunci %302 : i32 to i8
%346 = arith.trunci %303 : i32 to i8
%347 = arith.trunci %304 : i32 to i8
%348 = arith.trunci %305 : i32 to i8
%349 = arith.trunci %306 : i32 to i8
%350 = arith.trunci %307 : i32 to i8
%351 = arith.trunci %308 : i32 to i8
%352 = arith.trunci %309 : i32 to i8
%353 = arith.trunci %310 : i32 to i8
%354 = arith.trunci %311 : i32 to i8
%355 = arith.trunci %312 : i32 to i8
%356 = arith.trunci %313 : i32 to i8
%357 = arith.trunci %314 : i32 to i8
%358 = arith.trunci %315 : i32 to i8
%359 = arith.trunci %316 : i32 to i8
%360 = arith.trunci %317 : i32 to i8
%361 = arith.trunci %318 : i32 to i8
%362 = arith.trunci %319 : i32 to i8
%363 = arith.trunci %320 : i32 to i8
%364 = arith.trunci %321 : i32 to i8
%365 = arith.trunci %322 : i32 to i8
%366 = arith.trunci %323 : i32 to i8
%367 = arith.trunci %324 : i32 to i8
%368 = arith.trunci %325 : i32 to i8
%369 = arith.trunci %326 : i32 to i8
%370 = arith.trunci %327 : i32 to i8
%371 = arith.trunci %328 : i32 to i8
%372 = arith.trunci %329 : i32 to i8
%373 = arith.trunci %330 : i32 to i8
%374 = arith.trunci %331 : i32 to i8
%375 = arith.trunci %332 : i32 to i8
%376 = arith.trunci %333 : i32 to i8
%377 = arith.trunci %334 : i32 to i8
%378 = llvm.mlir.constant(0 : i64) : i64
%379 = llvm.getelementptr %336[0, %378] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %338, %379 : i8, !llvm.ptr
%380 = llvm.mlir.constant(1 : i64) : i64
%381 = llvm.getelementptr %336[0, %380] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %339, %381 : i8, !llvm.ptr
%382 = llvm.mlir.constant(2 : i64) : i64
%383 = llvm.getelementptr %336[0, %382] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %340, %383 : i8, !llvm.ptr
%384 = llvm.mlir.constant(3 : i64) : i64
%385 = llvm.getelementptr %336[0, %384] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %341, %385 : i8, !llvm.ptr
%386 = llvm.mlir.constant(4 : i64) : i64
%387 = llvm.getelementptr %336[0, %386] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %342, %387 : i8, !llvm.ptr
%388 = llvm.mlir.constant(5 : i64) : i64
%389 = llvm.getelementptr %336[0, %388] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %343, %389 : i8, !llvm.ptr
%390 = llvm.mlir.constant(6 : i64) : i64
%391 = llvm.getelementptr %336[0, %390] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %344, %391 : i8, !llvm.ptr
%392 = llvm.mlir.constant(7 : i64) : i64
%393 = llvm.getelementptr %336[0, %392] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %345, %393 : i8, !llvm.ptr
%394 = llvm.mlir.constant(8 : i64) : i64
%395 = llvm.getelementptr %336[0, %394] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %346, %395 : i8, !llvm.ptr
%396 = llvm.mlir.constant(9 : i64) : i64
%397 = llvm.getelementptr %336[0, %396] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %347, %397 : i8, !llvm.ptr
%398 = llvm.mlir.constant(10 : i64) : i64
%399 = llvm.getelementptr %336[0, %398] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %348, %399 : i8, !llvm.ptr
%400 = llvm.mlir.constant(11 : i64) : i64
%401 = llvm.getelementptr %336[0, %400] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %349, %401 : i8, !llvm.ptr
%402 = llvm.mlir.constant(12 : i64) : i64
%403 = llvm.getelementptr %336[0, %402] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %350, %403 : i8, !llvm.ptr
%404 = llvm.mlir.constant(13 : i64) : i64
%405 = llvm.getelementptr %336[0, %404] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %351, %405 : i8, !llvm.ptr
%406 = llvm.mlir.constant(14 : i64) : i64
%407 = llvm.getelementptr %336[0, %406] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %352, %407 : i8, !llvm.ptr
%408 = llvm.mlir.constant(15 : i64) : i64
%409 = llvm.getelementptr %336[0, %408] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %353, %409 : i8, !llvm.ptr
%410 = llvm.mlir.constant(16 : i64) : i64
%411 = llvm.getelementptr %336[0, %410] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %354, %411 : i8, !llvm.ptr
%412 = llvm.mlir.constant(17 : i64) : i64
%413 = llvm.getelementptr %336[0, %412] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %355, %413 : i8, !llvm.ptr
%414 = llvm.mlir.constant(18 : i64) : i64
%415 = llvm.getelementptr %336[0, %414] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %356, %415 : i8, !llvm.ptr
%416 = llvm.mlir.constant(19 : i64) : i64
%417 = llvm.getelementptr %336[0, %416] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %357, %417 : i8, !llvm.ptr
%418 = llvm.mlir.constant(20 : i64) : i64
%419 = llvm.getelementptr %336[0, %418] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %358, %419 : i8, !llvm.ptr
%420 = llvm.mlir.constant(21 : i64) : i64
%421 = llvm.getelementptr %336[0, %420] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %359, %421 : i8, !llvm.ptr
%422 = llvm.mlir.constant(22 : i64) : i64
%423 = llvm.getelementptr %336[0, %422] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %360, %423 : i8, !llvm.ptr
%424 = llvm.mlir.constant(23 : i64) : i64
%425 = llvm.getelementptr %336[0, %424] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %361, %425 : i8, !llvm.ptr
%426 = llvm.mlir.constant(24 : i64) : i64
%427 = llvm.getelementptr %336[0, %426] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %362, %427 : i8, !llvm.ptr
%428 = llvm.mlir.constant(25 : i64) : i64
%429 = llvm.getelementptr %336[0, %428] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %363, %429 : i8, !llvm.ptr
%430 = llvm.mlir.constant(26 : i64) : i64
%431 = llvm.getelementptr %336[0, %430] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %364, %431 : i8, !llvm.ptr
%432 = llvm.mlir.constant(27 : i64) : i64
%433 = llvm.getelementptr %336[0, %432] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %365, %433 : i8, !llvm.ptr
%434 = llvm.mlir.constant(28 : i64) : i64
%435 = llvm.getelementptr %336[0, %434] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %366, %435 : i8, !llvm.ptr
%436 = llvm.mlir.constant(29 : i64) : i64
%437 = llvm.getelementptr %336[0, %436] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %367, %437 : i8, !llvm.ptr
%438 = llvm.mlir.constant(30 : i64) : i64
%439 = llvm.getelementptr %336[0, %438] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %368, %439 : i8, !llvm.ptr
%440 = llvm.mlir.constant(31 : i64) : i64
%441 = llvm.getelementptr %336[0, %440] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %369, %441 : i8, !llvm.ptr
%442 = llvm.mlir.constant(32 : i64) : i64
%443 = llvm.getelementptr %336[0, %442] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %370, %443 : i8, !llvm.ptr
%444 = llvm.mlir.constant(33 : i64) : i64
%445 = llvm.getelementptr %336[0, %444] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %371, %445 : i8, !llvm.ptr
%446 = llvm.mlir.constant(34 : i64) : i64
%447 = llvm.getelementptr %336[0, %446] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %372, %447 : i8, !llvm.ptr
%448 = llvm.mlir.constant(35 : i64) : i64
%449 = llvm.getelementptr %336[0, %448] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %373, %449 : i8, !llvm.ptr
%450 = llvm.mlir.constant(36 : i64) : i64
%451 = llvm.getelementptr %336[0, %450] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %374, %451 : i8, !llvm.ptr
%452 = llvm.mlir.constant(37 : i64) : i64
%453 = llvm.getelementptr %336[0, %452] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %375, %453 : i8, !llvm.ptr
%454 = llvm.mlir.constant(38 : i64) : i64
%455 = llvm.getelementptr %336[0, %454] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %376, %455 : i8, !llvm.ptr
%456 = llvm.mlir.constant(39 : i64) : i64
%457 = llvm.getelementptr %336[0, %456] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %377, %457 : i8, !llvm.ptr
%458 = arith.constant 0 : i32
%459 = llvm.mlir.constant(1 : i64) : i64
%460 = llvm.alloca %459 x i32 : (i64) -> !llvm.ptr
llvm.store %458, %460 : i32, !llvm.ptr
cf.br ^bb48
^bb48:
%461 = llvm.load %293 : !llvm.ptr -> i64
%462 = arith.constant 0 : i32
%464 = arith.extsi %462 : i32 to i64
%463 = arith.cmpi sgt, %461, %464 : i64
cf.cond_br %463, ^bb49, ^bb50
^bb49:
%465 = llvm.load %293 : !llvm.ptr -> i64
%466 = arith.constant 10 : i32
%468 = arith.extsi %466 : i32 to i64
%467 = arith.remsi %465, %468 : i64
%469 = arith.trunci %467 : i64 to i8
%470 = llvm.load %460 : !llvm.ptr -> i32
%471 = arith.extsi %470 : i32 to i64
%472 = llvm.getelementptr %336[0, %471] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
llvm.store %469, %472 : i8, !llvm.ptr
%473 = llvm.load %293 : !llvm.ptr -> i64
%474 = arith.constant 10 : i32
%476 = arith.extsi %474 : i32 to i64
%475 = arith.divsi %473, %476 : i64
llvm.store %475, %293 : i64, !llvm.ptr
%477 = llvm.load %460 : !llvm.ptr -> i32
%478 = arith.constant 1 : i32
%479 = arith.addi %477, %478 : i32
llvm.store %479, %460 : i32, !llvm.ptr
cf.br ^bb48
^bb50:
%480 = llvm.load %460 : !llvm.ptr -> i32
%481 = arith.constant 19 : i32
%482 = arith.cmpi sgt, %480, %481 : i32
cf.cond_br %482, ^bb51, ^bb52
^bb51:
cf.br ^bb47
^bb52:
cf.br ^bb53
^bb53:
%483 = arith.constant 0 : i32
%484 = llvm.mlir.constant(1 : i64) : i64
%485 = llvm.alloca %484 x i32 : (i64) -> !llvm.ptr
llvm.store %483, %485 : i32, !llvm.ptr
%486 = arith.constant 0 : i32
%487 = llvm.mlir.constant(1 : i64) : i64
%488 = llvm.alloca %487 x i32 : (i64) -> !llvm.ptr
llvm.store %486, %488 : i32, !llvm.ptr
cf.br ^bb54
^bb54:
%489 = llvm.load %488 : !llvm.ptr -> i32
%490 = llvm.load %460 : !llvm.ptr -> i32
%491 = arith.cmpi slt, %489, %490 : i32
cf.cond_br %491, ^bb55, ^bb56
^bb55:
%493 = llvm.load %460 : !llvm.ptr -> i32
%494 = arith.constant 1 : i32
%495 = arith.subi %493, %494 : i32
%496 = llvm.load %488 : !llvm.ptr -> i32
%497 = arith.subi %495, %496 : i32
%498 = arith.extsi %497 : i32 to i64
%499 = llvm.getelementptr %336[0, %498] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<40 x i8>
%492 = llvm.load %499 : !llvm.ptr -> i8
%500 = arith.extsi %492 : i8 to i32
%501 = llvm.load %485 : !llvm.ptr -> i32
%502 = arith.constant 10 : i32
%503 = arith.muli %501, %502 : i32
%504 = arith.addi %503, %500 : i32
%505 = arith.extsi %504 : i32 to i64
%507 = llvm.getelementptr %240[%505] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%506 = llvm.load %507 : !llvm.ptr -> i32
%508 = arith.constant 0 : i32
%509 = arith.cmpi slt, %506, %508 : i32
cf.cond_br %509, ^bb57, ^bb58
^bb57:
%510 = llvm.load %285 : !llvm.ptr -> i32
%511 = llvm.getelementptr %240[%505] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %510, %511 : i32, !llvm.ptr
%512 = llvm.load %285 : !llvm.ptr -> i32
%513 = arith.constant 1 : i32
%514 = arith.addi %512, %513 : i32
llvm.store %514, %285 : i32, !llvm.ptr
cf.br ^bb59
^bb58:
cf.br ^bb59
^bb59:
%516 = llvm.getelementptr %240[%505] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%515 = llvm.load %516 : !llvm.ptr -> i32
llvm.store %515, %485 : i32, !llvm.ptr
%517 = llvm.load %488 : !llvm.ptr -> i32
%518 = arith.constant 1 : i32
%519 = arith.addi %517, %518 : i32
llvm.store %519, %488 : i32, !llvm.ptr
cf.br ^bb54
^bb56:
%520 = arith.constant 1 : i32
%521 = llvm.load %485 : !llvm.ptr -> i32
%522 = arith.trunci %520 : i32 to i8
%523 = arith.extsi %521 : i32 to i64
%524 = llvm.getelementptr %250[%523] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %522, %524 : i8, !llvm.ptr
%525 = llvm.load %289 : !llvm.ptr -> i64
%526 = arith.constant 9223372032559808511 : i32
%527 = arith.constant 11 : i32
%528 = arith.divsi %526, %527 : i32
%530 = arith.extsi %528 : i32 to i64
%529 = arith.cmpi sgt, %525, %530 : i64
cf.cond_br %529, ^bb60, ^bb61
^bb60:
cf.br ^bb47
^bb61:
cf.br ^bb62
^bb62:
%531 = llvm.load %289 : !llvm.ptr -> i64
%532 = arith.constant 11 : i32
%534 = arith.extsi %532 : i32 to i64
%533 = arith.muli %531, %534 : i64
llvm.store %533, %289 : i64, !llvm.ptr
cf.br ^bb45
^bb47:
%536 = arith.extsi %239 : i32 to i64
%537 = arith.constant 4 : i32
%538 = arith.extsi %537 : i32 to i64
%535 = func.call @calloc(%536, %538) : (i64, i64) -> !llvm.ptr
%539 = llvm.mlir.zero : !llvm.ptr
%540 = llvm.icmp "eq" %535, %539 : !llvm.ptr
cf.cond_br %540, ^bb63, ^bb64
^bb63:
%541 = arith.constant 1 : i32
func.return %541 : i32
^bb64:
cf.br ^bb65
^bb65:
%542 = arith.constant 0 : i32
%543 = llvm.mlir.constant(1 : i64) : i64
%544 = llvm.alloca %543 x i32 : (i64) -> !llvm.ptr
llvm.store %542, %544 : i32, !llvm.ptr
%545 = arith.constant 0 : i32
%546 = llvm.mlir.constant(1 : i64) : i64
%547 = llvm.alloca %546 x i32 : (i64) -> !llvm.ptr
llvm.store %545, %547 : i32, !llvm.ptr
%548 = arith.constant 0 : i32
%549 = llvm.mlir.constant(1 : i64) : i64
%550 = llvm.alloca %549 x i32 : (i64) -> !llvm.ptr
llvm.store %548, %550 : i32, !llvm.ptr
cf.br ^bb66
^bb66:
%551 = llvm.load %550 : !llvm.ptr -> i32
%552 = arith.constant 10 : i32
%553 = arith.cmpi slt, %551, %552 : i32
cf.cond_br %553, ^bb67, ^bb68
^bb67:
%555 = llvm.load %550 : !llvm.ptr -> i32
%556 = arith.extsi %555 : i32 to i64
%557 = llvm.getelementptr %240[%556] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%554 = llvm.load %557 : !llvm.ptr -> i32
%558 = arith.constant 0 : i32
%559 = arith.cmpi sge, %554, %558 : i32
cf.cond_br %559, ^bb69, ^bb70
^bb69:
%560 = arith.constant 0 : i32
%562 = llvm.load %550 : !llvm.ptr -> i32
%563 = arith.extsi %562 : i32 to i64
%564 = llvm.getelementptr %240[%563] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%561 = llvm.load %564 : !llvm.ptr -> i32
%565 = arith.extsi %561 : i32 to i64
%566 = llvm.getelementptr %246[%565] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %560, %566 : i32, !llvm.ptr
%568 = llvm.load %550 : !llvm.ptr -> i32
%569 = arith.extsi %568 : i32 to i64
%570 = llvm.getelementptr %240[%569] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%567 = llvm.load %570 : !llvm.ptr -> i32
%571 = llvm.load %547 : !llvm.ptr -> i32
%572 = arith.extsi %571 : i32 to i64
%573 = llvm.getelementptr %535[%572] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %567, %573 : i32, !llvm.ptr
%574 = llvm.load %547 : !llvm.ptr -> i32
%575 = arith.constant 1 : i32
%576 = arith.addi %574, %575 : i32
llvm.store %576, %547 : i32, !llvm.ptr
cf.br ^bb71
^bb70:
%577 = arith.constant 0 : i32
%578 = llvm.load %550 : !llvm.ptr -> i32
%579 = arith.extsi %578 : i32 to i64
%580 = llvm.getelementptr %240[%579] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %577, %580 : i32, !llvm.ptr
cf.br ^bb71
^bb71:
%581 = llvm.load %550 : !llvm.ptr -> i32
%582 = arith.constant 1 : i32
%583 = arith.addi %581, %582 : i32
llvm.store %583, %550 : i32, !llvm.ptr
cf.br ^bb66
^bb68:
cf.br ^bb72
^bb72:
%584 = llvm.load %544 : !llvm.ptr -> i32
%585 = llvm.load %547 : !llvm.ptr -> i32
%586 = arith.cmpi slt, %584, %585 : i32
cf.cond_br %586, ^bb73, ^bb74
^bb73:
%588 = llvm.load %544 : !llvm.ptr -> i32
%589 = arith.extsi %588 : i32 to i64
%590 = llvm.getelementptr %535[%589] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%587 = llvm.load %590 : !llvm.ptr -> i32
%591 = llvm.load %544 : !llvm.ptr -> i32
%592 = arith.constant 1 : i32
%593 = arith.addi %591, %592 : i32
llvm.store %593, %544 : i32, !llvm.ptr
%594 = arith.constant 0 : i32
llvm.store %594, %550 : i32, !llvm.ptr
cf.br ^bb75
^bb75:
%595 = llvm.load %550 : !llvm.ptr -> i32
%596 = arith.constant 10 : i32
%597 = arith.cmpi slt, %595, %596 : i32
cf.cond_br %597, ^bb76, ^bb77
^bb76:
%599 = arith.constant 10 : i32
%600 = arith.muli %587, %599 : i32
%601 = llvm.load %550 : !llvm.ptr -> i32
%602 = arith.addi %600, %601 : i32
%603 = arith.extsi %602 : i32 to i64
%604 = llvm.getelementptr %240[%603] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%598 = llvm.load %604 : !llvm.ptr -> i32
%605 = arith.constant 0 : i32
%606 = arith.cmpi sge, %598, %605 : i32
cf.cond_br %606, ^bb78, ^bb79
^bb78:
%607 = llvm.load %547 : !llvm.ptr -> i32
%608 = arith.extsi %607 : i32 to i64
%609 = llvm.getelementptr %535[%608] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %598, %609 : i32, !llvm.ptr
%610 = llvm.load %547 : !llvm.ptr -> i32
%611 = arith.constant 1 : i32
%612 = arith.addi %610, %611 : i32
llvm.store %612, %547 : i32, !llvm.ptr
%614 = arith.extsi %587 : i32 to i64
%615 = llvm.getelementptr %246[%614] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%613 = llvm.load %615 : !llvm.ptr -> i32
%616 = llvm.mlir.constant(1 : i64) : i64
%617 = llvm.alloca %616 x i32 : (i64) -> !llvm.ptr
llvm.store %613, %617 : i32, !llvm.ptr
cf.br ^bb81
^bb81:
%618 = llvm.load %617 : !llvm.ptr -> i32
%619 = arith.constant 0 : i32
%620 = arith.cmpi ne, %618, %619 : i32
%621 = scf.if %620 -> (i1) {
%623 = llvm.load %617 : !llvm.ptr -> i32
%624 = arith.constant 10 : i32
%625 = arith.muli %623, %624 : i32
%626 = llvm.load %550 : !llvm.ptr -> i32
%627 = arith.addi %625, %626 : i32
%628 = arith.extsi %627 : i32 to i64
%629 = llvm.getelementptr %240[%628] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%622 = llvm.load %629 : !llvm.ptr -> i32
%630 = arith.constant 0 : i32
%631 = arith.cmpi slt, %622, %630 : i32
scf.yield %631 : i1
} else {
%632 = arith.constant false
scf.yield %632 : i1
}
cf.cond_br %621, ^bb82, ^bb83
^bb82:
%634 = llvm.load %617 : !llvm.ptr -> i32
%635 = arith.extsi %634 : i32 to i64
%636 = llvm.getelementptr %246[%635] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%633 = llvm.load %636 : !llvm.ptr -> i32
llvm.store %633, %617 : i32, !llvm.ptr
cf.br ^bb81
^bb83:
%638 = llvm.load %617 : !llvm.ptr -> i32
%639 = arith.constant 10 : i32
%640 = arith.muli %638, %639 : i32
%641 = llvm.load %550 : !llvm.ptr -> i32
%642 = arith.addi %640, %641 : i32
%643 = arith.extsi %642 : i32 to i64
%644 = llvm.getelementptr %240[%643] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%637 = llvm.load %644 : !llvm.ptr -> i32
%645 = arith.constant 0 : i32
%646 = arith.cmpi sge, %637, %645 : i32
%647 = scf.if %646 -> (i1) {
%649 = llvm.load %617 : !llvm.ptr -> i32
%650 = arith.constant 10 : i32
%651 = arith.muli %649, %650 : i32
%652 = llvm.load %550 : !llvm.ptr -> i32
%653 = arith.addi %651, %652 : i32
%654 = arith.extsi %653 : i32 to i64
%655 = llvm.getelementptr %240[%654] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%648 = llvm.load %655 : !llvm.ptr -> i32
%656 = arith.cmpi ne, %648, %598 : i32
scf.yield %656 : i1
} else {
%657 = arith.constant false
scf.yield %657 : i1
}
cf.cond_br %647, ^bb84, ^bb85
^bb84:
%659 = llvm.load %617 : !llvm.ptr -> i32
%660 = arith.constant 10 : i32
%661 = arith.muli %659, %660 : i32
%662 = llvm.load %550 : !llvm.ptr -> i32
%663 = arith.addi %661, %662 : i32
%664 = arith.extsi %663 : i32 to i64
%665 = llvm.getelementptr %240[%664] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%658 = llvm.load %665 : !llvm.ptr -> i32
%666 = arith.extsi %598 : i32 to i64
%667 = llvm.getelementptr %246[%666] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %658, %667 : i32, !llvm.ptr
cf.br ^bb86
^bb85:
%668 = arith.constant 0 : i32
%669 = arith.extsi %598 : i32 to i64
%670 = llvm.getelementptr %246[%669] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %668, %670 : i32, !llvm.ptr
cf.br ^bb86
^bb86:
%673 = arith.extsi %598 : i32 to i64
%674 = llvm.getelementptr %246[%673] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%672 = llvm.load %674 : !llvm.ptr -> i32
%675 = arith.extsi %672 : i32 to i64
%676 = llvm.getelementptr %250[%675] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%671 = llvm.load %676 : !llvm.ptr -> i8
%677 = arith.constant 0 : i32
%679 = arith.extsi %671 : i8 to i32
%678 = arith.cmpi ne, %679, %677 : i32
cf.cond_br %678, ^bb87, ^bb88
^bb87:
%680 = arith.constant 1 : i32
%681 = arith.trunci %680 : i32 to i8
%682 = arith.extsi %598 : i32 to i64
%683 = llvm.getelementptr %250[%682] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %681, %683 : i8, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
cf.br ^bb80
^bb79:
%686 = arith.extsi %587 : i32 to i64
%687 = llvm.getelementptr %246[%686] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%685 = llvm.load %687 : !llvm.ptr -> i32
%688 = arith.constant 10 : i32
%689 = arith.muli %685, %688 : i32
%690 = llvm.load %550 : !llvm.ptr -> i32
%691 = arith.addi %689, %690 : i32
%692 = arith.extsi %691 : i32 to i64
%693 = llvm.getelementptr %240[%692] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%684 = llvm.load %693 : !llvm.ptr -> i32
%694 = arith.constant 10 : i32
%695 = arith.muli %587, %694 : i32
%696 = llvm.load %550 : !llvm.ptr -> i32
%697 = arith.addi %695, %696 : i32
%698 = arith.extsi %697 : i32 to i64
%699 = llvm.getelementptr %240[%698] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %684, %699 : i32, !llvm.ptr
cf.br ^bb80
^bb80:
%700 = llvm.load %550 : !llvm.ptr -> i32
%701 = arith.constant 1 : i32
%702 = arith.addi %700, %701 : i32
llvm.store %702, %550 : i32, !llvm.ptr
cf.br ^bb75
^bb77:
cf.br ^bb72
^bb74:
%704 = llvm.load %285 : !llvm.ptr -> i32
%705 = arith.constant 10 : i32
%706 = arith.muli %704, %705 : i32
%707 = arith.extsi %706 : i32 to i64
%708 = arith.constant 4 : i32
%709 = arith.extsi %708 : i32 to i64
%703 = func.call @calloc(%707, %709) : (i64, i64) -> !llvm.ptr
%710 = llvm.mlir.zero : !llvm.ptr
%711 = llvm.icmp "eq" %703, %710 : !llvm.ptr
cf.cond_br %711, ^bb90, ^bb91
^bb90:
%712 = arith.constant 1 : i32
func.return %712 : i32
^bb91:
cf.br ^bb92
^bb92:
%713 = arith.constant 0 : i32
%714 = llvm.mlir.constant(1 : i64) : i64
%715 = llvm.alloca %714 x i32 : (i64) -> !llvm.ptr
llvm.store %713, %715 : i32, !llvm.ptr
cf.br ^bb93
^bb93:
%716 = llvm.load %715 : !llvm.ptr -> i32
%717 = llvm.load %285 : !llvm.ptr -> i32
%718 = arith.cmpi slt, %716, %717 : i32
cf.cond_br %718, ^bb94, ^bb95
^bb94:
%719 = arith.constant 0 : i32
llvm.store %719, %550 : i32, !llvm.ptr
cf.br ^bb96
^bb96:
%720 = llvm.load %550 : !llvm.ptr -> i32
%721 = arith.constant 10 : i32
%722 = arith.cmpi slt, %720, %721 : i32
cf.cond_br %722, ^bb97, ^bb98
^bb97:
%724 = llvm.load %715 : !llvm.ptr -> i32
%725 = arith.constant 10 : i32
%726 = arith.muli %724, %725 : i32
%727 = llvm.load %550 : !llvm.ptr -> i32
%728 = arith.addi %726, %727 : i32
%729 = arith.extsi %728 : i32 to i64
%730 = llvm.getelementptr %240[%729] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%723 = llvm.load %730 : !llvm.ptr -> i32
%731 = arith.constant 0 : i32
%732 = arith.cmpi slt, %723, %731 : i32
%733 = scf.if %732 -> (i32) {
%734 = arith.constant 0 : i32
scf.yield %734 : i32
} else {
scf.yield %723 : i32
}
%735 = llvm.load %715 : !llvm.ptr -> i32
%736 = arith.constant 10 : i32
%737 = arith.muli %735, %736 : i32
%738 = llvm.load %550 : !llvm.ptr -> i32
%739 = arith.addi %737, %738 : i32
%740 = arith.extsi %739 : i32 to i64
%741 = llvm.getelementptr %703[%740] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %733, %741 : i32, !llvm.ptr
%742 = llvm.load %550 : !llvm.ptr -> i32
%743 = arith.constant 1 : i32
%744 = arith.addi %742, %743 : i32
llvm.store %744, %550 : i32, !llvm.ptr
cf.br ^bb96
^bb98:
%745 = llvm.load %715 : !llvm.ptr -> i32
%746 = arith.constant 1 : i32
%747 = arith.addi %745, %746 : i32
llvm.store %747, %715 : i32, !llvm.ptr
cf.br ^bb93
^bb95:
%748 = arith.constant 20 : i32
%749 = llvm.load %285 : !llvm.ptr -> i32
%750 = arith.extsi %749 : i32 to i64
%752 = arith.extsi %748 : i32 to i64
%751 = arith.muli %752, %750 : i64
%753 = arith.constant 2 : i32
%755 = arith.extsi %753 : i32 to i64
%754 = arith.muli %751, %755 : i64
%756 = arith.constant 2 : i32
%758 = arith.extsi %756 : i32 to i64
%757 = arith.muli %754, %758 : i64
%760 = arith.constant 8 : i32
%761 = arith.extsi %760 : i32 to i64
%759 = func.call @calloc(%757, %761) : (i64, i64) -> !llvm.ptr
%763 = arith.constant 1 : i32
%764 = arith.extsi %763 : i32 to i64
%762 = func.call @calloc(%757, %764) : (i64, i64) -> !llvm.ptr
%766 = arith.constant 20 : i32
%767 = arith.constant 4 : i32
%768 = arith.extsi %766 : i32 to i64
%769 = arith.extsi %767 : i32 to i64
%765 = func.call @calloc(%768, %769) : (i64, i64) -> !llvm.ptr
%770 = llvm.mlir.zero : !llvm.ptr
%771 = llvm.icmp "eq" %759, %770 : !llvm.ptr
%772 = scf.if %771 -> (i1) {
%773 = arith.constant true
scf.yield %773 : i1
} else {
%774 = llvm.mlir.zero : !llvm.ptr
%775 = llvm.icmp "eq" %762, %774 : !llvm.ptr
scf.yield %775 : i1
}
%776 = scf.if %772 -> (i1) {
%777 = arith.constant true
scf.yield %777 : i1
} else {
%778 = llvm.mlir.zero : !llvm.ptr
%779 = llvm.icmp "eq" %765, %778 : !llvm.ptr
scf.yield %779 : i1
}
cf.cond_br %776, ^bb99, ^bb100
^bb99:
%780 = arith.constant 1 : i32
func.return %780 : i32
^bb100:
cf.br ^bb101
^bb101:
%781 = arith.constant 999999995705032704 : i32
%782 = arith.extsi %781 : i32 to i64
%783 = llvm.mlir.constant(1 : i64) : i64
%784 = llvm.alloca %783 x i64 : (i64) -> !llvm.ptr
llvm.store %782, %784 : i64, !llvm.ptr
cf.br ^bb102
^bb102:
%786 = llvm.load %784 : !llvm.ptr -> i64
%787 = llvm.load %285 : !llvm.ptr -> i32
%785 = func.call @count_upto(%786, %787, %703, %250, %759, %762, %765, %757) : (i64, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> i64
%788 = arith.cmpi slt, %785, %782 : i64
cf.cond_br %788, ^bb103, ^bb104
^bb103:
%789 = llvm.load %784 : !llvm.ptr -> i64
%790 = arith.constant 2 : i32
%792 = arith.extsi %790 : i32 to i64
%791 = arith.muli %789, %792 : i64
llvm.store %791, %784 : i64, !llvm.ptr
%793 = llvm.load %784 : !llvm.ptr -> i64
%794 = arith.constant 0 : i32
%796 = arith.extsi %794 : i32 to i64
%795 = arith.cmpi slt, %793, %796 : i64
cf.cond_br %795, ^bb105, ^bb106
^bb105:
%797 = arith.constant 9223372032559808511 : i32
%798 = arith.extsi %797 : i32 to i64
llvm.store %798, %784 : i64, !llvm.ptr
cf.br ^bb104
^bb106:
cf.br ^bb107
^bb107:
cf.br ^bb102
^bb104:
%799 = arith.constant 1 : i32
%800 = arith.extsi %799 : i32 to i64
%801 = llvm.mlir.constant(1 : i64) : i64
%802 = llvm.alloca %801 x i64 : (i64) -> !llvm.ptr
llvm.store %800, %802 : i64, !llvm.ptr
cf.br ^bb108
^bb108:
%803 = llvm.load %802 : !llvm.ptr -> i64
%804 = llvm.load %784 : !llvm.ptr -> i64
%805 = arith.cmpi slt, %803, %804 : i64
cf.cond_br %805, ^bb109, ^bb110
^bb109:
%806 = llvm.load %802 : !llvm.ptr -> i64
%807 = llvm.load %784 : !llvm.ptr -> i64
%808 = llvm.load %802 : !llvm.ptr -> i64
%809 = arith.subi %807, %808 : i64
%810 = arith.constant 2 : i32
%812 = arith.extsi %810 : i32 to i64
%811 = arith.divsi %809, %812 : i64
%813 = arith.addi %806, %811 : i64
%815 = llvm.load %285 : !llvm.ptr -> i32
%814 = func.call @count_upto(%813, %815, %703, %250, %759, %762, %765, %757) : (i64, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> i64
%816 = arith.cmpi sge, %814, %782 : i64
cf.cond_br %816, ^bb111, ^bb112
^bb111:
llvm.store %813, %784 : i64, !llvm.ptr
cf.br ^bb113
^bb112:
%817 = arith.constant 1 : i32
%819 = arith.extsi %817 : i32 to i64
%818 = arith.addi %813, %819 : i64
llvm.store %818, %802 : i64, !llvm.ptr
cf.br ^bb113
^bb113:
cf.br ^bb108
^bb110:
cf.br ^bb114
^bb114:
%820 = llvm.load %802 : !llvm.ptr -> i64
%821 = arith.constant 1 : i32
%823 = arith.extsi %821 : i32 to i64
%822 = arith.cmpi sgt, %820, %823 : i64
%824 = scf.if %822 -> (i1) {
%826 = llvm.load %802 : !llvm.ptr -> i64
%827 = arith.constant 1 : i32
%829 = arith.extsi %827 : i32 to i64
%828 = arith.subi %826, %829 : i64
%830 = llvm.load %285 : !llvm.ptr -> i32
%825 = func.call @count_upto(%828, %830, %703, %250, %759, %762, %765, %757) : (i64, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> i64
%831 = arith.cmpi sge, %825, %782 : i64
scf.yield %831 : i1
} else {
%832 = arith.constant false
scf.yield %832 : i1
}
cf.cond_br %824, ^bb115, ^bb116
^bb115:
%833 = llvm.load %802 : !llvm.ptr -> i64
%834 = arith.constant 1 : i32
%836 = arith.extsi %834 : i32 to i64
%835 = arith.subi %833, %836 : i64
llvm.store %835, %802 : i64, !llvm.ptr
cf.br ^bb114
^bb116:
cf.br ^bb117
^bb117:
%838 = llvm.load %802 : !llvm.ptr -> i64
%839 = llvm.load %285 : !llvm.ptr -> i32
%837 = func.call @count_upto(%838, %839, %703, %250, %759, %762, %765, %757) : (i64, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> i64
%840 = arith.cmpi slt, %837, %782 : i64
cf.cond_br %840, ^bb118, ^bb119
^bb118:
%841 = llvm.load %802 : !llvm.ptr -> i64
%842 = arith.constant 1 : i32
%844 = arith.extsi %842 : i32 to i64
%843 = arith.addi %841, %844 : i64
llvm.store %843, %802 : i64, !llvm.ptr
cf.br ^bb117
^bb119:
%845 = llvm.mlir.addressof @str_0 : !llvm.ptr
%846 = llvm.load %802 : !llvm.ptr -> i64
%847 = llvm.call @printf(%845, %846) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%765) : (!llvm.ptr) -> ()
func.call @free(%762) : (!llvm.ptr) -> ()
func.call @free(%759) : (!llvm.ptr) -> ()
func.call @free(%703) : (!llvm.ptr) -> ()
func.call @free(%535) : (!llvm.ptr) -> ()
func.call @free(%250) : (!llvm.ptr) -> ()
func.call @free(%246) : (!llvm.ptr) -> ()
func.call @free(%240) : (!llvm.ptr) -> ()
%856 = arith.constant 0 : i32
func.return %856 : i32
}
}