← All problems
Problem 176
Smallest integer L that is a cathetus of exactly 47547 integer right triangles. With m = L (odd L) or m = L/2 (even L): (tau(m^2)-1)/2 = 47547 so tau(m^2) = 95095 = 5*7*11*13*19. Minimize L among even/odd cases.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^2)O(n^2)
Space complexity O(n)O(n^2)
Approach Flow solution Bottom-up DP
Verdict Optimal
Flow source
# Project Euler 176
# Smallest integer L that is a cathetus of exactly 47547 integer right triangles.
# With m = L (odd L) or m = L/2 (even L): (tau(m^2)-1)/2 = 47547
# so tau(m^2) = 95095 = 5*7*11*13*19. Minimize L among even/odd cases.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
function ipow(base: i64, exp: i64) -> i64 {
let mut r: i64 = 1
let mut b: i64 = base
let mut e: i64 = exp
while e > 0 {
if (e % 2) == 1 { r = r * b }
b = b * b
e = e / 2
}
return r
}
# Global-ish via heap for DFS state
# primes[0..11], search for minimal m with product of (2e_i+1) = target
function main() -> i32 {
let primes: ptr<i64> = calloc(12, 8)
if primes == null { return 1 }
primes[0] = 2; primes[1] = 3; primes[2] = 5; primes[3] = 7
primes[4] = 11; primes[5] = 13; primes[6] = 17; primes[7] = 19
primes[8] = 23; primes[9] = 29; primes[10] = 31; primes[11] = 37
let target: i64 = 95095
# Collect divisors of target
let divs: ptr<i64> = calloc(64, 8)
if divs == null { free(primes); return 1 }
let mut dc: i32 = 0
let mut d: i64 = 1
while d * d <= target {
if target % d == 0 {
divs[dc] = d
dc = dc + 1
if d * d != target {
divs[dc] = target / d
dc = dc + 1
}
}
d = d + 1
}
# sort descending for nicer search (simple bubble)
let mut i: i32 = 0
while i < dc {
let mut j: i32 = i + 1
while j < dc {
if divs[j] > divs[i] {
let t: i64 = divs[i]
divs[i] = divs[j]
divs[j] = t
}
j = j + 1
}
i = i + 1
}
# Iterative DFS via explicit stack of (rem, idx, max_e, cur)
# Stack entries as 4 i64s
let stack: ptr<i64> = calloc(100000 * 4, 8)
if stack == null { free(divs); free(primes); return 1 }
let mut sp: i32 = 0
# push initial: rem=target, idx=0, max_e=1e9, cur=1
stack[0] = target; stack[1] = 0; stack[2] = 1000000000; stack[3] = 1
sp = 1
let mut best_any: i64 = 0
while sp > 0 {
sp = sp - 1
let rem: i64 = stack[sp * 4]
let idx: i64 = stack[sp * 4 + 1]
let max_e: i64 = stack[sp * 4 + 2]
let cur: i64 = stack[sp * 4 + 3]
if rem == 1 {
if best_any == 0 || cur < best_any { best_any = cur }
continue
}
if idx >= 12 { continue }
if best_any != 0 && cur >= best_any { continue }
let mut di: i32 = 0
while di < dc {
let dd: i64 = divs[di]
di = di + 1
if dd == 1 { continue }
if rem % dd != 0 { continue }
let e: i64 = (dd - 1) / 2
if 2 * e + 1 != dd { continue }
if e > max_e { continue }
# check overflow / prune
if e > 60 { continue }
let mut nxt: i64 = cur
let mut ok: bool = true
let mut ee: i64 = 0
while ee < e {
if best_any != 0 && nxt > best_any / primes[idx] {
ok = false
break
}
nxt = nxt * primes[idx]
ee = ee + 1
}
if !ok { continue }
if best_any != 0 && nxt >= best_any { continue }
stack[sp * 4] = rem / dd
stack[sp * 4 + 1] = idx + 1
stack[sp * 4 + 2] = e
stack[sp * 4 + 3] = nxt
sp = sp + 1
}
}
# Odd m: start from primes[1..]
stack[0] = target; stack[1] = 1; stack[2] = 1000000000; stack[3] = 1
sp = 1
let mut best_odd: i64 = 0
while sp > 0 {
sp = sp - 1
let rem: i64 = stack[sp * 4]
let idx: i64 = stack[sp * 4 + 1]
let max_e: i64 = stack[sp * 4 + 2]
let cur: i64 = stack[sp * 4 + 3]
if rem == 1 {
if best_odd == 0 || cur < best_odd { best_odd = cur }
continue
}
if idx >= 12 { continue }
if best_odd != 0 && cur >= best_odd { continue }
let mut di: i32 = 0
while di < dc {
let dd: i64 = divs[di]
di = di + 1
if dd == 1 { continue }
if rem % dd != 0 { continue }
let e: i64 = (dd - 1) / 2
if 2 * e + 1 != dd { continue }
if e > max_e { continue }
if e > 60 { continue }
let mut nxt: i64 = cur
let mut ok: bool = true
let mut ee: i64 = 0
while ee < e {
if best_odd != 0 && nxt > best_odd / primes[idx] {
ok = false
break
}
nxt = nxt * primes[idx]
ee = ee + 1
}
if !ok { continue }
if best_odd != 0 && nxt >= best_odd { continue }
stack[sp * 4] = rem / dd
stack[sp * 4 + 1] = idx + 1
stack[sp * 4 + 2] = e
stack[sp * 4 + 3] = nxt
sp = sp + 1
}
}
let mut ans: i64 = 0
if best_any % 2 == 1 {
ans = best_any
} else {
let two_m: i64 = 2 * best_any
if best_odd != 0 && best_odd < two_m {
ans = best_odd
} else {
ans = two_m
}
}
printf("%lld\n", ans)
free(stack)
free(divs)
free(primes)
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 ipow_i64_i64(int64_t base, int64_t exp);
int32_t main(void);
int64_t ipow_i64_i64(int64_t base, int64_t exp) {
int64_t r = 1;
int64_t b = base;
int64_t e = exp;
while (e > 0) {
if (FLOW_CHECKED_MOD((e), (2)) == 1) {
r = (r * b);
}
b = (b * b);
e = FLOW_CHECKED_DIV((e), (2));
}
return r;
}
int32_t main(void) {
int64_t* primes = (int64_t*)(calloc(12, 8));
if (primes == NULL) {
return 1;
}
primes[0] = 2;
primes[1] = 3;
primes[2] = 5;
primes[3] = 7;
primes[4] = 11;
primes[5] = 13;
primes[6] = 17;
primes[7] = 19;
primes[8] = 23;
primes[9] = 29;
primes[10] = 31;
primes[11] = 37;
int64_t target = 95095;
int64_t* divs = (int64_t*)(calloc(64, 8));
if (divs == NULL) {
free(primes);
return 1;
}
int32_t dc = 0;
int64_t d = 1;
while ((d * d) <= target) {
if (FLOW_CHECKED_MOD((target), (d)) == 0) {
divs[dc] = d;
dc = (dc + 1);
if ((d * d) != target) {
divs[dc] = FLOW_CHECKED_DIV((target), (d));
dc = (dc + 1);
}
}
d = (d + 1);
}
int32_t i = 0;
while (i < dc) {
int32_t j = (i + 1);
while (j < dc) {
if (divs[j] > divs[i]) {
int64_t t = divs[i];
divs[i] = divs[j];
divs[j] = t;
}
j = (j + 1);
}
i = (i + 1);
}
int64_t* stack = (int64_t*)(calloc((100000 * 4), 8));
if (stack == NULL) {
free(divs);
free(primes);
return 1;
}
int32_t sp = 0;
stack[0] = target;
stack[1] = 0;
stack[2] = 1000000000;
stack[3] = 1;
sp = 1;
int64_t best_any = 0;
while (sp > 0) {
sp = (sp - 1);
int64_t rem = stack[(sp * 4)];
int64_t idx = stack[((sp * 4) + 1)];
int64_t max_e = stack[((sp * 4) + 2)];
int64_t cur = stack[((sp * 4) + 3)];
if (rem == 1) {
if ((best_any == 0 || cur < best_any)) {
best_any = cur;
}
continue;
}
if (idx >= 12) {
continue;
}
if ((best_any != 0 && cur >= best_any)) {
continue;
}
int32_t di = 0;
while (di < dc) {
int64_t dd = divs[di];
di = (di + 1);
if (dd == 1) {
continue;
}
if (FLOW_CHECKED_MOD((rem), (dd)) != 0) {
continue;
}
int64_t e = FLOW_CHECKED_DIV(((dd - 1)), (2));
if (((2 * e) + 1) != dd) {
continue;
}
if (e > max_e) {
continue;
}
if (e > 60) {
continue;
}
int64_t nxt = cur;
bool ok = 1;
int64_t ee = 0;
while (ee < e) {
if ((best_any != 0 && nxt > FLOW_CHECKED_DIV((best_any), (primes[idx])))) {
ok = 0;
break;
}
nxt = (nxt * primes[idx]);
ee = (ee + 1);
}
if ((!(ok))) {
continue;
}
if ((best_any != 0 && nxt >= best_any)) {
continue;
}
stack[(sp * 4)] = FLOW_CHECKED_DIV((rem), (dd));
stack[((sp * 4) + 1)] = (idx + 1);
stack[((sp * 4) + 2)] = e;
stack[((sp * 4) + 3)] = nxt;
sp = (sp + 1);
}
}
stack[0] = target;
stack[1] = 1;
stack[2] = 1000000000;
stack[3] = 1;
sp = 1;
int64_t best_odd = 0;
while (sp > 0) {
sp = (sp - 1);
int64_t rem = stack[(sp * 4)];
int64_t idx = stack[((sp * 4) + 1)];
int64_t max_e = stack[((sp * 4) + 2)];
int64_t cur = stack[((sp * 4) + 3)];
if (rem == 1) {
if ((best_odd == 0 || cur < best_odd)) {
best_odd = cur;
}
continue;
}
if (idx >= 12) {
continue;
}
if ((best_odd != 0 && cur >= best_odd)) {
continue;
}
int32_t di = 0;
while (di < dc) {
int64_t dd = divs[di];
di = (di + 1);
if (dd == 1) {
continue;
}
if (FLOW_CHECKED_MOD((rem), (dd)) != 0) {
continue;
}
int64_t e = FLOW_CHECKED_DIV(((dd - 1)), (2));
if (((2 * e) + 1) != dd) {
continue;
}
if (e > max_e) {
continue;
}
if (e > 60) {
continue;
}
int64_t nxt = cur;
bool ok = 1;
int64_t ee = 0;
while (ee < e) {
if ((best_odd != 0 && nxt > FLOW_CHECKED_DIV((best_odd), (primes[idx])))) {
ok = 0;
break;
}
nxt = (nxt * primes[idx]);
ee = (ee + 1);
}
if ((!(ok))) {
continue;
}
if ((best_odd != 0 && nxt >= best_odd)) {
continue;
}
stack[(sp * 4)] = FLOW_CHECKED_DIV((rem), (dd));
stack[((sp * 4) + 1)] = (idx + 1);
stack[((sp * 4) + 2)] = e;
stack[((sp * 4) + 3)] = nxt;
sp = (sp + 1);
}
}
int64_t ans = 0;
if (FLOW_CHECKED_MOD((best_any), (2)) == 1) {
ans = best_any;
} else {
int64_t two_m = (2 * best_any);
if ((best_odd != 0 && best_odd < two_m)) {
ans = best_odd;
} else {
ans = two_m;
}
}
printf("%lld\n", ans);
free(stack);
free(divs);
free(primes);
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 @ipow(%arg0: i64, %arg1: i64) -> i64 {
%0 = arith.constant 1 : i32
%1 = arith.extsi %0 : i32 to i64
%2 = llvm.mlir.constant(1 : i64) : i64
%3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
llvm.store %1, %3 : i64, !llvm.ptr
%4 = llvm.mlir.constant(1 : i64) : i64
%5 = llvm.alloca %4 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %5 : i64, !llvm.ptr
%6 = llvm.mlir.constant(1 : i64) : i64
%7 = llvm.alloca %6 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %7 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%8 = llvm.load %7 : !llvm.ptr -> i64
%9 = arith.constant 0 : i32
%11 = arith.extsi %9 : i32 to i64
%10 = arith.cmpi sgt, %8, %11 : i64
cf.cond_br %10, ^bb1, ^bb2
^bb1:
%12 = llvm.load %7 : !llvm.ptr -> i64
%13 = arith.constant 2 : i32
%15 = arith.extsi %13 : i32 to i64
%14 = arith.remsi %12, %15 : i64
%16 = arith.constant 1 : i32
%18 = arith.extsi %16 : i32 to i64
%17 = arith.cmpi eq, %14, %18 : i64
cf.cond_br %17, ^bb3, ^bb4
^bb3:
%19 = llvm.load %3 : !llvm.ptr -> i64
%20 = llvm.load %5 : !llvm.ptr -> i64
%21 = arith.muli %19, %20 : i64
llvm.store %21, %3 : i64, !llvm.ptr
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
%22 = llvm.load %5 : !llvm.ptr -> i64
%23 = llvm.load %5 : !llvm.ptr -> i64
%24 = arith.muli %22, %23 : i64
llvm.store %24, %5 : i64, !llvm.ptr
%25 = llvm.load %7 : !llvm.ptr -> i64
%26 = arith.constant 2 : i32
%28 = arith.extsi %26 : i32 to i64
%27 = arith.divsi %25, %28 : i64
llvm.store %27, %7 : i64, !llvm.ptr
cf.br ^bb0
^bb2:
%29 = llvm.load %3 : !llvm.ptr -> i64
func.return %29 : i64
}
func.func @main() -> i32 {
%31 = arith.constant 12 : i32
%32 = arith.constant 8 : i32
%33 = arith.extsi %31 : i32 to i64
%34 = arith.extsi %32 : i32 to i64
%30 = func.call @calloc(%33, %34) : (i64, i64) -> !llvm.ptr
%35 = llvm.mlir.zero : !llvm.ptr
%36 = llvm.icmp "eq" %30, %35 : !llvm.ptr
cf.cond_br %36, ^bb6, ^bb7
^bb6:
%37 = arith.constant 1 : i32
func.return %37 : i32
^bb7:
cf.br ^bb8
^bb8:
%38 = arith.constant 2 : i32
%39 = arith.constant 0 : i32
%40 = arith.extsi %38 : i32 to i64
%41 = arith.extsi %39 : i32 to i64
%42 = llvm.getelementptr %30[%41] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %40, %42 : i64, !llvm.ptr
%43 = arith.constant 3 : i32
%44 = arith.constant 1 : i32
%45 = arith.extsi %43 : i32 to i64
%46 = arith.extsi %44 : i32 to i64
%47 = llvm.getelementptr %30[%46] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %45, %47 : i64, !llvm.ptr
%48 = arith.constant 5 : i32
%49 = arith.constant 2 : i32
%50 = arith.extsi %48 : i32 to i64
%51 = arith.extsi %49 : i32 to i64
%52 = llvm.getelementptr %30[%51] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %50, %52 : i64, !llvm.ptr
%53 = arith.constant 7 : i32
%54 = arith.constant 3 : i32
%55 = arith.extsi %53 : i32 to i64
%56 = arith.extsi %54 : i32 to i64
%57 = llvm.getelementptr %30[%56] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %55, %57 : i64, !llvm.ptr
%58 = arith.constant 11 : i32
%59 = arith.constant 4 : i32
%60 = arith.extsi %58 : i32 to i64
%61 = arith.extsi %59 : i32 to i64
%62 = llvm.getelementptr %30[%61] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %60, %62 : i64, !llvm.ptr
%63 = arith.constant 13 : i32
%64 = arith.constant 5 : i32
%65 = arith.extsi %63 : i32 to i64
%66 = arith.extsi %64 : i32 to i64
%67 = llvm.getelementptr %30[%66] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %65, %67 : i64, !llvm.ptr
%68 = arith.constant 17 : i32
%69 = arith.constant 6 : i32
%70 = arith.extsi %68 : i32 to i64
%71 = arith.extsi %69 : i32 to i64
%72 = llvm.getelementptr %30[%71] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %70, %72 : i64, !llvm.ptr
%73 = arith.constant 19 : i32
%74 = arith.constant 7 : i32
%75 = arith.extsi %73 : i32 to i64
%76 = arith.extsi %74 : i32 to i64
%77 = llvm.getelementptr %30[%76] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %75, %77 : i64, !llvm.ptr
%78 = arith.constant 23 : i32
%79 = arith.constant 8 : i32
%80 = arith.extsi %78 : i32 to i64
%81 = arith.extsi %79 : i32 to i64
%82 = llvm.getelementptr %30[%81] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %80, %82 : i64, !llvm.ptr
%83 = arith.constant 29 : i32
%84 = arith.constant 9 : i32
%85 = arith.extsi %83 : i32 to i64
%86 = arith.extsi %84 : i32 to i64
%87 = llvm.getelementptr %30[%86] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %85, %87 : i64, !llvm.ptr
%88 = arith.constant 31 : i32
%89 = arith.constant 10 : i32
%90 = arith.extsi %88 : i32 to i64
%91 = arith.extsi %89 : i32 to i64
%92 = llvm.getelementptr %30[%91] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %90, %92 : i64, !llvm.ptr
%93 = arith.constant 37 : i32
%94 = arith.constant 11 : i32
%95 = arith.extsi %93 : i32 to i64
%96 = arith.extsi %94 : i32 to i64
%97 = llvm.getelementptr %30[%96] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %95, %97 : i64, !llvm.ptr
%98 = arith.constant 95095 : i32
%99 = arith.extsi %98 : i32 to i64
%101 = arith.constant 64 : i32
%102 = arith.constant 8 : i32
%103 = arith.extsi %101 : i32 to i64
%104 = arith.extsi %102 : i32 to i64
%100 = func.call @calloc(%103, %104) : (i64, i64) -> !llvm.ptr
%105 = llvm.mlir.zero : !llvm.ptr
%106 = llvm.icmp "eq" %100, %105 : !llvm.ptr
cf.cond_br %106, ^bb9, ^bb10
^bb9:
func.call @free(%30) : (!llvm.ptr) -> ()
%108 = arith.constant 1 : i32
func.return %108 : i32
^bb10:
cf.br ^bb11
^bb11:
%109 = arith.constant 0 : i32
%110 = llvm.mlir.constant(1 : i64) : i64
%111 = llvm.alloca %110 x i32 : (i64) -> !llvm.ptr
llvm.store %109, %111 : i32, !llvm.ptr
%112 = arith.constant 1 : i32
%113 = arith.extsi %112 : i32 to i64
%114 = llvm.mlir.constant(1 : i64) : i64
%115 = llvm.alloca %114 x i64 : (i64) -> !llvm.ptr
llvm.store %113, %115 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%116 = llvm.load %115 : !llvm.ptr -> i64
%117 = llvm.load %115 : !llvm.ptr -> i64
%118 = arith.muli %116, %117 : i64
%119 = arith.cmpi sle, %118, %99 : i64
cf.cond_br %119, ^bb13, ^bb14
^bb13:
%120 = llvm.load %115 : !llvm.ptr -> i64
%121 = arith.remsi %99, %120 : i64
%122 = arith.constant 0 : i32
%124 = arith.extsi %122 : i32 to i64
%123 = arith.cmpi eq, %121, %124 : i64
cf.cond_br %123, ^bb15, ^bb16
^bb15:
%125 = llvm.load %115 : !llvm.ptr -> i64
%126 = llvm.load %111 : !llvm.ptr -> i32
%127 = arith.extsi %126 : i32 to i64
%128 = llvm.getelementptr %100[%127] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %125, %128 : i64, !llvm.ptr
%129 = llvm.load %111 : !llvm.ptr -> i32
%130 = arith.constant 1 : i32
%131 = arith.addi %129, %130 : i32
llvm.store %131, %111 : i32, !llvm.ptr
%132 = llvm.load %115 : !llvm.ptr -> i64
%133 = llvm.load %115 : !llvm.ptr -> i64
%134 = arith.muli %132, %133 : i64
%135 = arith.cmpi ne, %134, %99 : i64
cf.cond_br %135, ^bb18, ^bb19
^bb18:
%136 = llvm.load %115 : !llvm.ptr -> i64
%137 = arith.divsi %99, %136 : i64
%138 = llvm.load %111 : !llvm.ptr -> i32
%139 = arith.extsi %138 : i32 to i64
%140 = llvm.getelementptr %100[%139] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %137, %140 : i64, !llvm.ptr
%141 = llvm.load %111 : !llvm.ptr -> i32
%142 = arith.constant 1 : i32
%143 = arith.addi %141, %142 : i32
llvm.store %143, %111 : i32, !llvm.ptr
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%144 = llvm.load %115 : !llvm.ptr -> i64
%145 = arith.constant 1 : i32
%147 = arith.extsi %145 : i32 to i64
%146 = arith.addi %144, %147 : i64
llvm.store %146, %115 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%148 = arith.constant 0 : i32
%149 = llvm.mlir.constant(1 : i64) : i64
%150 = llvm.alloca %149 x i32 : (i64) -> !llvm.ptr
llvm.store %148, %150 : i32, !llvm.ptr
cf.br ^bb21
^bb21:
%151 = llvm.load %150 : !llvm.ptr -> i32
%152 = llvm.load %111 : !llvm.ptr -> i32
%153 = arith.cmpi slt, %151, %152 : i32
cf.cond_br %153, ^bb22, ^bb23
^bb22:
%154 = llvm.load %150 : !llvm.ptr -> i32
%155 = arith.constant 1 : i32
%156 = arith.addi %154, %155 : i32
%157 = llvm.mlir.constant(1 : i64) : i64
%158 = llvm.alloca %157 x i32 : (i64) -> !llvm.ptr
llvm.store %156, %158 : i32, !llvm.ptr
cf.br ^bb24
^bb24:
%159 = llvm.load %158 : !llvm.ptr -> i32
%160 = llvm.load %111 : !llvm.ptr -> i32
%161 = arith.cmpi slt, %159, %160 : i32
cf.cond_br %161, ^bb25, ^bb26
^bb25:
%163 = llvm.load %158 : !llvm.ptr -> i32
%164 = arith.extsi %163 : i32 to i64
%165 = llvm.getelementptr %100[%164] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%162 = llvm.load %165 : !llvm.ptr -> i64
%167 = llvm.load %150 : !llvm.ptr -> i32
%168 = arith.extsi %167 : i32 to i64
%169 = llvm.getelementptr %100[%168] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%166 = llvm.load %169 : !llvm.ptr -> i64
%170 = arith.cmpi sgt, %162, %166 : i64
cf.cond_br %170, ^bb27, ^bb28
^bb27:
%172 = llvm.load %150 : !llvm.ptr -> i32
%173 = arith.extsi %172 : i32 to i64
%174 = llvm.getelementptr %100[%173] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%171 = llvm.load %174 : !llvm.ptr -> i64
%176 = llvm.load %158 : !llvm.ptr -> i32
%177 = arith.extsi %176 : i32 to i64
%178 = llvm.getelementptr %100[%177] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%175 = llvm.load %178 : !llvm.ptr -> i64
%179 = llvm.load %150 : !llvm.ptr -> i32
%180 = arith.extsi %179 : i32 to i64
%181 = llvm.getelementptr %100[%180] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %175, %181 : i64, !llvm.ptr
%182 = llvm.load %158 : !llvm.ptr -> i32
%183 = arith.extsi %182 : i32 to i64
%184 = llvm.getelementptr %100[%183] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %171, %184 : i64, !llvm.ptr
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
%185 = llvm.load %158 : !llvm.ptr -> i32
%186 = arith.constant 1 : i32
%187 = arith.addi %185, %186 : i32
llvm.store %187, %158 : i32, !llvm.ptr
cf.br ^bb24
^bb26:
%188 = llvm.load %150 : !llvm.ptr -> i32
%189 = arith.constant 1 : i32
%190 = arith.addi %188, %189 : i32
llvm.store %190, %150 : i32, !llvm.ptr
cf.br ^bb21
^bb23:
%192 = arith.constant 100000 : i32
%193 = arith.constant 4 : i32
%194 = arith.muli %192, %193 : i32
%195 = arith.constant 8 : i32
%196 = arith.extsi %194 : i32 to i64
%197 = arith.extsi %195 : i32 to i64
%191 = func.call @calloc(%196, %197) : (i64, i64) -> !llvm.ptr
%198 = llvm.mlir.zero : !llvm.ptr
%199 = llvm.icmp "eq" %191, %198 : !llvm.ptr
cf.cond_br %199, ^bb30, ^bb31
^bb30:
func.call @free(%100) : (!llvm.ptr) -> ()
func.call @free(%30) : (!llvm.ptr) -> ()
%202 = arith.constant 1 : i32
func.return %202 : i32
^bb31:
cf.br ^bb32
^bb32:
%203 = arith.constant 0 : i32
%204 = llvm.mlir.constant(1 : i64) : i64
%205 = llvm.alloca %204 x i32 : (i64) -> !llvm.ptr
llvm.store %203, %205 : i32, !llvm.ptr
%206 = arith.constant 0 : i32
%207 = arith.extsi %206 : i32 to i64
%208 = llvm.getelementptr %191[%207] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %99, %208 : i64, !llvm.ptr
%209 = arith.constant 0 : i32
%210 = arith.constant 1 : i32
%211 = arith.extsi %209 : i32 to i64
%212 = arith.extsi %210 : i32 to i64
%213 = llvm.getelementptr %191[%212] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %211, %213 : i64, !llvm.ptr
%214 = arith.constant 1000000000 : i32
%215 = arith.constant 2 : i32
%216 = arith.extsi %214 : i32 to i64
%217 = arith.extsi %215 : i32 to i64
%218 = llvm.getelementptr %191[%217] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %216, %218 : i64, !llvm.ptr
%219 = arith.constant 1 : i32
%220 = arith.constant 3 : i32
%221 = arith.extsi %219 : i32 to i64
%222 = arith.extsi %220 : i32 to i64
%223 = llvm.getelementptr %191[%222] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %221, %223 : i64, !llvm.ptr
%224 = arith.constant 1 : i32
llvm.store %224, %205 : i32, !llvm.ptr
%225 = arith.constant 0 : i32
%226 = arith.extsi %225 : i32 to i64
%227 = llvm.mlir.constant(1 : i64) : i64
%228 = llvm.alloca %227 x i64 : (i64) -> !llvm.ptr
llvm.store %226, %228 : i64, !llvm.ptr
cf.br ^bb33
^bb33:
%229 = llvm.load %205 : !llvm.ptr -> i32
%230 = arith.constant 0 : i32
%231 = arith.cmpi sgt, %229, %230 : i32
cf.cond_br %231, ^bb34, ^bb35
^bb34:
%232 = llvm.load %205 : !llvm.ptr -> i32
%233 = arith.constant 1 : i32
%234 = arith.subi %232, %233 : i32
llvm.store %234, %205 : i32, !llvm.ptr
%236 = llvm.load %205 : !llvm.ptr -> i32
%237 = arith.constant 4 : i32
%238 = arith.muli %236, %237 : i32
%239 = arith.extsi %238 : i32 to i64
%240 = llvm.getelementptr %191[%239] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%235 = llvm.load %240 : !llvm.ptr -> i64
%242 = llvm.load %205 : !llvm.ptr -> i32
%243 = arith.constant 4 : i32
%244 = arith.muli %242, %243 : i32
%245 = arith.constant 1 : i32
%246 = arith.addi %244, %245 : i32
%247 = arith.extsi %246 : i32 to i64
%248 = llvm.getelementptr %191[%247] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%241 = llvm.load %248 : !llvm.ptr -> i64
%250 = llvm.load %205 : !llvm.ptr -> i32
%251 = arith.constant 4 : i32
%252 = arith.muli %250, %251 : i32
%253 = arith.constant 2 : i32
%254 = arith.addi %252, %253 : i32
%255 = arith.extsi %254 : i32 to i64
%256 = llvm.getelementptr %191[%255] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%249 = llvm.load %256 : !llvm.ptr -> i64
%258 = llvm.load %205 : !llvm.ptr -> i32
%259 = arith.constant 4 : i32
%260 = arith.muli %258, %259 : i32
%261 = arith.constant 3 : i32
%262 = arith.addi %260, %261 : i32
%263 = arith.extsi %262 : i32 to i64
%264 = llvm.getelementptr %191[%263] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%257 = llvm.load %264 : !llvm.ptr -> i64
%265 = arith.constant 1 : i32
%267 = arith.extsi %265 : i32 to i64
%266 = arith.cmpi eq, %235, %267 : i64
cf.cond_br %266, ^bb36, ^bb37
^bb36:
%268 = llvm.load %228 : !llvm.ptr -> i64
%269 = arith.constant 0 : i32
%271 = arith.extsi %269 : i32 to i64
%270 = arith.cmpi eq, %268, %271 : i64
%272 = scf.if %270 -> (i1) {
%273 = arith.constant true
scf.yield %273 : i1
} else {
%274 = llvm.load %228 : !llvm.ptr -> i64
%275 = arith.cmpi slt, %257, %274 : i64
scf.yield %275 : i1
}
cf.cond_br %272, ^bb39, ^bb40
^bb39:
llvm.store %257, %228 : i64, !llvm.ptr
cf.br ^bb41
^bb40:
cf.br ^bb41
^bb41:
cf.br ^bb33
^bb37:
cf.br ^bb38
^bb38:
%276 = arith.constant 12 : i32
%278 = arith.extsi %276 : i32 to i64
%277 = arith.cmpi sge, %241, %278 : i64
cf.cond_br %277, ^bb42, ^bb43
^bb42:
cf.br ^bb33
^bb43:
cf.br ^bb44
^bb44:
%279 = llvm.load %228 : !llvm.ptr -> i64
%280 = arith.constant 0 : i32
%282 = arith.extsi %280 : i32 to i64
%281 = arith.cmpi ne, %279, %282 : i64
%283 = scf.if %281 -> (i1) {
%284 = llvm.load %228 : !llvm.ptr -> i64
%285 = arith.cmpi sge, %257, %284 : i64
scf.yield %285 : i1
} else {
%286 = arith.constant false
scf.yield %286 : i1
}
cf.cond_br %283, ^bb45, ^bb46
^bb45:
cf.br ^bb33
^bb46:
cf.br ^bb47
^bb47:
%287 = arith.constant 0 : i32
%288 = llvm.mlir.constant(1 : i64) : i64
%289 = llvm.alloca %288 x i32 : (i64) -> !llvm.ptr
llvm.store %287, %289 : i32, !llvm.ptr
cf.br ^bb48
^bb48:
%290 = llvm.load %289 : !llvm.ptr -> i32
%291 = llvm.load %111 : !llvm.ptr -> i32
%292 = arith.cmpi slt, %290, %291 : i32
cf.cond_br %292, ^bb49, ^bb50
^bb49:
%294 = llvm.load %289 : !llvm.ptr -> i32
%295 = arith.extsi %294 : i32 to i64
%296 = llvm.getelementptr %100[%295] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%293 = llvm.load %296 : !llvm.ptr -> i64
%297 = llvm.load %289 : !llvm.ptr -> i32
%298 = arith.constant 1 : i32
%299 = arith.addi %297, %298 : i32
llvm.store %299, %289 : i32, !llvm.ptr
%300 = arith.constant 1 : i32
%302 = arith.extsi %300 : i32 to i64
%301 = arith.cmpi eq, %293, %302 : i64
cf.cond_br %301, ^bb51, ^bb52
^bb51:
cf.br ^bb48
^bb52:
cf.br ^bb53
^bb53:
%303 = arith.remsi %235, %293 : i64
%304 = arith.constant 0 : i32
%306 = arith.extsi %304 : i32 to i64
%305 = arith.cmpi ne, %303, %306 : i64
cf.cond_br %305, ^bb54, ^bb55
^bb54:
cf.br ^bb48
^bb55:
cf.br ^bb56
^bb56:
%307 = arith.constant 1 : i32
%309 = arith.extsi %307 : i32 to i64
%308 = arith.subi %293, %309 : i64
%310 = arith.constant 2 : i32
%312 = arith.extsi %310 : i32 to i64
%311 = arith.divsi %308, %312 : i64
%313 = arith.constant 2 : i32
%315 = arith.extsi %313 : i32 to i64
%314 = arith.muli %315, %311 : i64
%316 = arith.constant 1 : i32
%318 = arith.extsi %316 : i32 to i64
%317 = arith.addi %314, %318 : i64
%319 = arith.cmpi ne, %317, %293 : i64
cf.cond_br %319, ^bb57, ^bb58
^bb57:
cf.br ^bb48
^bb58:
cf.br ^bb59
^bb59:
%320 = arith.cmpi sgt, %311, %249 : i64
cf.cond_br %320, ^bb60, ^bb61
^bb60:
cf.br ^bb48
^bb61:
cf.br ^bb62
^bb62:
%321 = arith.constant 60 : i32
%323 = arith.extsi %321 : i32 to i64
%322 = arith.cmpi sgt, %311, %323 : i64
cf.cond_br %322, ^bb63, ^bb64
^bb63:
cf.br ^bb48
^bb64:
cf.br ^bb65
^bb65:
%324 = llvm.mlir.constant(1 : i64) : i64
%325 = llvm.alloca %324 x i64 : (i64) -> !llvm.ptr
llvm.store %257, %325 : i64, !llvm.ptr
%326 = arith.constant 1 : i1
%327 = llvm.mlir.constant(1 : i64) : i64
%328 = llvm.alloca %327 x i1 : (i64) -> !llvm.ptr
llvm.store %326, %328 : i1, !llvm.ptr
%329 = arith.constant 0 : i32
%330 = arith.extsi %329 : i32 to i64
%331 = llvm.mlir.constant(1 : i64) : i64
%332 = llvm.alloca %331 x i64 : (i64) -> !llvm.ptr
llvm.store %330, %332 : i64, !llvm.ptr
cf.br ^bb66
^bb66:
%333 = llvm.load %332 : !llvm.ptr -> i64
%334 = arith.cmpi slt, %333, %311 : i64
cf.cond_br %334, ^bb67, ^bb68
^bb67:
%335 = llvm.load %228 : !llvm.ptr -> i64
%336 = arith.constant 0 : i32
%338 = arith.extsi %336 : i32 to i64
%337 = arith.cmpi ne, %335, %338 : i64
%339 = scf.if %337 -> (i1) {
%340 = llvm.load %325 : !llvm.ptr -> i64
%341 = llvm.load %228 : !llvm.ptr -> i64
%343 = llvm.getelementptr %30[%241] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%342 = llvm.load %343 : !llvm.ptr -> i64
%344 = arith.divsi %341, %342 : i64
%345 = arith.cmpi sgt, %340, %344 : i64
scf.yield %345 : i1
} else {
%346 = arith.constant false
scf.yield %346 : i1
}
cf.cond_br %339, ^bb69, ^bb70
^bb69:
%347 = arith.constant 0 : i1
llvm.store %347, %328 : i1, !llvm.ptr
cf.br ^bb68
^bb70:
cf.br ^bb71
^bb71:
%348 = llvm.load %325 : !llvm.ptr -> i64
%350 = llvm.getelementptr %30[%241] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%349 = llvm.load %350 : !llvm.ptr -> i64
%351 = arith.muli %348, %349 : i64
llvm.store %351, %325 : i64, !llvm.ptr
%352 = llvm.load %332 : !llvm.ptr -> i64
%353 = arith.constant 1 : i32
%355 = arith.extsi %353 : i32 to i64
%354 = arith.addi %352, %355 : i64
llvm.store %354, %332 : i64, !llvm.ptr
cf.br ^bb66
^bb68:
%356 = llvm.load %328 : !llvm.ptr -> i1
%358 = arith.constant 1 : i1
%357 = arith.xori %356, %358 : i1
cf.cond_br %357, ^bb72, ^bb73
^bb72:
cf.br ^bb48
^bb73:
cf.br ^bb74
^bb74:
%360 = llvm.load %228 : !llvm.ptr -> i64
%361 = arith.constant 0 : i32
%363 = arith.extsi %361 : i32 to i64
%362 = arith.cmpi ne, %360, %363 : i64
%364 = scf.if %362 -> (i1) {
%365 = llvm.load %325 : !llvm.ptr -> i64
%366 = llvm.load %228 : !llvm.ptr -> i64
%367 = arith.cmpi sge, %365, %366 : i64
scf.yield %367 : i1
} else {
%368 = arith.constant false
scf.yield %368 : i1
}
cf.cond_br %364, ^bb75, ^bb76
^bb75:
cf.br ^bb48
^bb76:
cf.br ^bb77
^bb77:
%369 = arith.divsi %235, %293 : i64
%370 = llvm.load %205 : !llvm.ptr -> i32
%371 = arith.constant 4 : i32
%372 = arith.muli %370, %371 : i32
%373 = arith.extsi %372 : i32 to i64
%374 = llvm.getelementptr %191[%373] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %369, %374 : i64, !llvm.ptr
%375 = arith.constant 1 : i32
%377 = arith.extsi %375 : i32 to i64
%376 = arith.addi %241, %377 : i64
%378 = llvm.load %205 : !llvm.ptr -> i32
%379 = arith.constant 4 : i32
%380 = arith.muli %378, %379 : i32
%381 = arith.constant 1 : i32
%382 = arith.addi %380, %381 : i32
%383 = arith.extsi %382 : i32 to i64
%384 = llvm.getelementptr %191[%383] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %376, %384 : i64, !llvm.ptr
%385 = llvm.load %205 : !llvm.ptr -> i32
%386 = arith.constant 4 : i32
%387 = arith.muli %385, %386 : i32
%388 = arith.constant 2 : i32
%389 = arith.addi %387, %388 : i32
%390 = arith.extsi %389 : i32 to i64
%391 = llvm.getelementptr %191[%390] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %311, %391 : i64, !llvm.ptr
%392 = llvm.load %325 : !llvm.ptr -> i64
%393 = llvm.load %205 : !llvm.ptr -> i32
%394 = arith.constant 4 : i32
%395 = arith.muli %393, %394 : i32
%396 = arith.constant 3 : i32
%397 = arith.addi %395, %396 : i32
%398 = arith.extsi %397 : i32 to i64
%399 = llvm.getelementptr %191[%398] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %392, %399 : i64, !llvm.ptr
%400 = llvm.load %205 : !llvm.ptr -> i32
%401 = arith.constant 1 : i32
%402 = arith.addi %400, %401 : i32
llvm.store %402, %205 : i32, !llvm.ptr
cf.br ^bb48
^bb50:
cf.br ^bb33
^bb35:
%403 = arith.constant 0 : i32
%404 = arith.extsi %403 : i32 to i64
%405 = llvm.getelementptr %191[%404] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %99, %405 : i64, !llvm.ptr
%406 = arith.constant 1 : i32
%407 = arith.constant 1 : i32
%408 = arith.extsi %406 : i32 to i64
%409 = arith.extsi %407 : i32 to i64
%410 = llvm.getelementptr %191[%409] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %408, %410 : i64, !llvm.ptr
%411 = arith.constant 1000000000 : i32
%412 = arith.constant 2 : i32
%413 = arith.extsi %411 : i32 to i64
%414 = arith.extsi %412 : i32 to i64
%415 = llvm.getelementptr %191[%414] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %413, %415 : i64, !llvm.ptr
%416 = arith.constant 1 : i32
%417 = arith.constant 3 : i32
%418 = arith.extsi %416 : i32 to i64
%419 = arith.extsi %417 : i32 to i64
%420 = llvm.getelementptr %191[%419] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %418, %420 : i64, !llvm.ptr
%421 = arith.constant 1 : i32
llvm.store %421, %205 : i32, !llvm.ptr
%422 = arith.constant 0 : i32
%423 = arith.extsi %422 : i32 to i64
%424 = llvm.mlir.constant(1 : i64) : i64
%425 = llvm.alloca %424 x i64 : (i64) -> !llvm.ptr
llvm.store %423, %425 : i64, !llvm.ptr
cf.br ^bb78
^bb78:
%426 = llvm.load %205 : !llvm.ptr -> i32
%427 = arith.constant 0 : i32
%428 = arith.cmpi sgt, %426, %427 : i32
cf.cond_br %428, ^bb79, ^bb80
^bb79:
%429 = llvm.load %205 : !llvm.ptr -> i32
%430 = arith.constant 1 : i32
%431 = arith.subi %429, %430 : i32
llvm.store %431, %205 : i32, !llvm.ptr
%433 = llvm.load %205 : !llvm.ptr -> i32
%434 = arith.constant 4 : i32
%435 = arith.muli %433, %434 : i32
%436 = arith.extsi %435 : i32 to i64
%437 = llvm.getelementptr %191[%436] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%432 = llvm.load %437 : !llvm.ptr -> i64
%439 = llvm.load %205 : !llvm.ptr -> i32
%440 = arith.constant 4 : i32
%441 = arith.muli %439, %440 : i32
%442 = arith.constant 1 : i32
%443 = arith.addi %441, %442 : i32
%444 = arith.extsi %443 : i32 to i64
%445 = llvm.getelementptr %191[%444] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%438 = llvm.load %445 : !llvm.ptr -> i64
%447 = llvm.load %205 : !llvm.ptr -> i32
%448 = arith.constant 4 : i32
%449 = arith.muli %447, %448 : i32
%450 = arith.constant 2 : i32
%451 = arith.addi %449, %450 : i32
%452 = arith.extsi %451 : i32 to i64
%453 = llvm.getelementptr %191[%452] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%446 = llvm.load %453 : !llvm.ptr -> i64
%455 = llvm.load %205 : !llvm.ptr -> i32
%456 = arith.constant 4 : i32
%457 = arith.muli %455, %456 : i32
%458 = arith.constant 3 : i32
%459 = arith.addi %457, %458 : i32
%460 = arith.extsi %459 : i32 to i64
%461 = llvm.getelementptr %191[%460] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%454 = llvm.load %461 : !llvm.ptr -> i64
%462 = arith.constant 1 : i32
%464 = arith.extsi %462 : i32 to i64
%463 = arith.cmpi eq, %432, %464 : i64
cf.cond_br %463, ^bb81, ^bb82
^bb81:
%465 = llvm.load %425 : !llvm.ptr -> i64
%466 = arith.constant 0 : i32
%468 = arith.extsi %466 : i32 to i64
%467 = arith.cmpi eq, %465, %468 : i64
%469 = scf.if %467 -> (i1) {
%470 = arith.constant true
scf.yield %470 : i1
} else {
%471 = llvm.load %425 : !llvm.ptr -> i64
%472 = arith.cmpi slt, %454, %471 : i64
scf.yield %472 : i1
}
cf.cond_br %469, ^bb84, ^bb85
^bb84:
llvm.store %454, %425 : i64, !llvm.ptr
cf.br ^bb86
^bb85:
cf.br ^bb86
^bb86:
cf.br ^bb78
^bb82:
cf.br ^bb83
^bb83:
%473 = arith.constant 12 : i32
%475 = arith.extsi %473 : i32 to i64
%474 = arith.cmpi sge, %438, %475 : i64
cf.cond_br %474, ^bb87, ^bb88
^bb87:
cf.br ^bb78
^bb88:
cf.br ^bb89
^bb89:
%476 = llvm.load %425 : !llvm.ptr -> i64
%477 = arith.constant 0 : i32
%479 = arith.extsi %477 : i32 to i64
%478 = arith.cmpi ne, %476, %479 : i64
%480 = scf.if %478 -> (i1) {
%481 = llvm.load %425 : !llvm.ptr -> i64
%482 = arith.cmpi sge, %454, %481 : i64
scf.yield %482 : i1
} else {
%483 = arith.constant false
scf.yield %483 : i1
}
cf.cond_br %480, ^bb90, ^bb91
^bb90:
cf.br ^bb78
^bb91:
cf.br ^bb92
^bb92:
%484 = arith.constant 0 : i32
%485 = llvm.mlir.constant(1 : i64) : i64
%486 = llvm.alloca %485 x i32 : (i64) -> !llvm.ptr
llvm.store %484, %486 : i32, !llvm.ptr
cf.br ^bb93
^bb93:
%487 = llvm.load %486 : !llvm.ptr -> i32
%488 = llvm.load %111 : !llvm.ptr -> i32
%489 = arith.cmpi slt, %487, %488 : i32
cf.cond_br %489, ^bb94, ^bb95
^bb94:
%491 = llvm.load %486 : !llvm.ptr -> i32
%492 = arith.extsi %491 : i32 to i64
%493 = llvm.getelementptr %100[%492] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%490 = llvm.load %493 : !llvm.ptr -> i64
%494 = llvm.load %486 : !llvm.ptr -> i32
%495 = arith.constant 1 : i32
%496 = arith.addi %494, %495 : i32
llvm.store %496, %486 : i32, !llvm.ptr
%497 = arith.constant 1 : i32
%499 = arith.extsi %497 : i32 to i64
%498 = arith.cmpi eq, %490, %499 : i64
cf.cond_br %498, ^bb96, ^bb97
^bb96:
cf.br ^bb93
^bb97:
cf.br ^bb98
^bb98:
%500 = arith.remsi %432, %490 : i64
%501 = arith.constant 0 : i32
%503 = arith.extsi %501 : i32 to i64
%502 = arith.cmpi ne, %500, %503 : i64
cf.cond_br %502, ^bb99, ^bb100
^bb99:
cf.br ^bb93
^bb100:
cf.br ^bb101
^bb101:
%504 = arith.constant 1 : i32
%506 = arith.extsi %504 : i32 to i64
%505 = arith.subi %490, %506 : i64
%507 = arith.constant 2 : i32
%509 = arith.extsi %507 : i32 to i64
%508 = arith.divsi %505, %509 : i64
%510 = arith.constant 2 : i32
%512 = arith.extsi %510 : i32 to i64
%511 = arith.muli %512, %508 : i64
%513 = arith.constant 1 : i32
%515 = arith.extsi %513 : i32 to i64
%514 = arith.addi %511, %515 : i64
%516 = arith.cmpi ne, %514, %490 : i64
cf.cond_br %516, ^bb102, ^bb103
^bb102:
cf.br ^bb93
^bb103:
cf.br ^bb104
^bb104:
%517 = arith.cmpi sgt, %508, %446 : i64
cf.cond_br %517, ^bb105, ^bb106
^bb105:
cf.br ^bb93
^bb106:
cf.br ^bb107
^bb107:
%518 = arith.constant 60 : i32
%520 = arith.extsi %518 : i32 to i64
%519 = arith.cmpi sgt, %508, %520 : i64
cf.cond_br %519, ^bb108, ^bb109
^bb108:
cf.br ^bb93
^bb109:
cf.br ^bb110
^bb110:
%521 = llvm.mlir.constant(1 : i64) : i64
%522 = llvm.alloca %521 x i64 : (i64) -> !llvm.ptr
llvm.store %454, %522 : i64, !llvm.ptr
%523 = arith.constant 1 : i1
%524 = llvm.mlir.constant(1 : i64) : i64
%525 = llvm.alloca %524 x i1 : (i64) -> !llvm.ptr
llvm.store %523, %525 : i1, !llvm.ptr
%526 = arith.constant 0 : i32
%527 = arith.extsi %526 : i32 to i64
%528 = llvm.mlir.constant(1 : i64) : i64
%529 = llvm.alloca %528 x i64 : (i64) -> !llvm.ptr
llvm.store %527, %529 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%530 = llvm.load %529 : !llvm.ptr -> i64
%531 = arith.cmpi slt, %530, %508 : i64
cf.cond_br %531, ^bb112, ^bb113
^bb112:
%532 = llvm.load %425 : !llvm.ptr -> i64
%533 = arith.constant 0 : i32
%535 = arith.extsi %533 : i32 to i64
%534 = arith.cmpi ne, %532, %535 : i64
%536 = scf.if %534 -> (i1) {
%537 = llvm.load %522 : !llvm.ptr -> i64
%538 = llvm.load %425 : !llvm.ptr -> i64
%540 = llvm.getelementptr %30[%438] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%539 = llvm.load %540 : !llvm.ptr -> i64
%541 = arith.divsi %538, %539 : i64
%542 = arith.cmpi sgt, %537, %541 : i64
scf.yield %542 : i1
} else {
%543 = arith.constant false
scf.yield %543 : i1
}
cf.cond_br %536, ^bb114, ^bb115
^bb114:
%544 = arith.constant 0 : i1
llvm.store %544, %525 : i1, !llvm.ptr
cf.br ^bb113
^bb115:
cf.br ^bb116
^bb116:
%545 = llvm.load %522 : !llvm.ptr -> i64
%547 = llvm.getelementptr %30[%438] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%546 = llvm.load %547 : !llvm.ptr -> i64
%548 = arith.muli %545, %546 : i64
llvm.store %548, %522 : i64, !llvm.ptr
%549 = llvm.load %529 : !llvm.ptr -> i64
%550 = arith.constant 1 : i32
%552 = arith.extsi %550 : i32 to i64
%551 = arith.addi %549, %552 : i64
llvm.store %551, %529 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
%553 = llvm.load %525 : !llvm.ptr -> i1
%555 = arith.constant 1 : i1
%554 = arith.xori %553, %555 : i1
cf.cond_br %554, ^bb117, ^bb118
^bb117:
cf.br ^bb93
^bb118:
cf.br ^bb119
^bb119:
%557 = llvm.load %425 : !llvm.ptr -> i64
%558 = arith.constant 0 : i32
%560 = arith.extsi %558 : i32 to i64
%559 = arith.cmpi ne, %557, %560 : i64
%561 = scf.if %559 -> (i1) {
%562 = llvm.load %522 : !llvm.ptr -> i64
%563 = llvm.load %425 : !llvm.ptr -> i64
%564 = arith.cmpi sge, %562, %563 : i64
scf.yield %564 : i1
} else {
%565 = arith.constant false
scf.yield %565 : i1
}
cf.cond_br %561, ^bb120, ^bb121
^bb120:
cf.br ^bb93
^bb121:
cf.br ^bb122
^bb122:
%566 = arith.divsi %432, %490 : i64
%567 = llvm.load %205 : !llvm.ptr -> i32
%568 = arith.constant 4 : i32
%569 = arith.muli %567, %568 : i32
%570 = arith.extsi %569 : i32 to i64
%571 = llvm.getelementptr %191[%570] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %566, %571 : i64, !llvm.ptr
%572 = arith.constant 1 : i32
%574 = arith.extsi %572 : i32 to i64
%573 = arith.addi %438, %574 : i64
%575 = llvm.load %205 : !llvm.ptr -> i32
%576 = arith.constant 4 : i32
%577 = arith.muli %575, %576 : i32
%578 = arith.constant 1 : i32
%579 = arith.addi %577, %578 : i32
%580 = arith.extsi %579 : i32 to i64
%581 = llvm.getelementptr %191[%580] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %573, %581 : i64, !llvm.ptr
%582 = llvm.load %205 : !llvm.ptr -> i32
%583 = arith.constant 4 : i32
%584 = arith.muli %582, %583 : i32
%585 = arith.constant 2 : i32
%586 = arith.addi %584, %585 : i32
%587 = arith.extsi %586 : i32 to i64
%588 = llvm.getelementptr %191[%587] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %508, %588 : i64, !llvm.ptr
%589 = llvm.load %522 : !llvm.ptr -> i64
%590 = llvm.load %205 : !llvm.ptr -> i32
%591 = arith.constant 4 : i32
%592 = arith.muli %590, %591 : i32
%593 = arith.constant 3 : i32
%594 = arith.addi %592, %593 : i32
%595 = arith.extsi %594 : i32 to i64
%596 = llvm.getelementptr %191[%595] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %589, %596 : i64, !llvm.ptr
%597 = llvm.load %205 : !llvm.ptr -> i32
%598 = arith.constant 1 : i32
%599 = arith.addi %597, %598 : i32
llvm.store %599, %205 : i32, !llvm.ptr
cf.br ^bb93
^bb95:
cf.br ^bb78
^bb80:
%600 = arith.constant 0 : i32
%601 = arith.extsi %600 : i32 to i64
%602 = llvm.mlir.constant(1 : i64) : i64
%603 = llvm.alloca %602 x i64 : (i64) -> !llvm.ptr
llvm.store %601, %603 : i64, !llvm.ptr
%604 = llvm.load %228 : !llvm.ptr -> i64
%605 = arith.constant 2 : i32
%607 = arith.extsi %605 : i32 to i64
%606 = arith.remsi %604, %607 : i64
%608 = arith.constant 1 : i32
%610 = arith.extsi %608 : i32 to i64
%609 = arith.cmpi eq, %606, %610 : i64
cf.cond_br %609, ^bb123, ^bb124
^bb123:
%611 = llvm.load %228 : !llvm.ptr -> i64
llvm.store %611, %603 : i64, !llvm.ptr
cf.br ^bb125
^bb124:
%612 = arith.constant 2 : i32
%613 = llvm.load %228 : !llvm.ptr -> i64
%615 = arith.extsi %612 : i32 to i64
%614 = arith.muli %615, %613 : i64
%616 = llvm.load %425 : !llvm.ptr -> i64
%617 = arith.constant 0 : i32
%619 = arith.extsi %617 : i32 to i64
%618 = arith.cmpi ne, %616, %619 : i64
%620 = scf.if %618 -> (i1) {
%621 = llvm.load %425 : !llvm.ptr -> i64
%622 = arith.cmpi slt, %621, %614 : i64
scf.yield %622 : i1
} else {
%623 = arith.constant false
scf.yield %623 : i1
}
cf.cond_br %620, ^bb126, ^bb127
^bb126:
%624 = llvm.load %425 : !llvm.ptr -> i64
llvm.store %624, %603 : i64, !llvm.ptr
cf.br ^bb128
^bb127:
llvm.store %614, %603 : i64, !llvm.ptr
cf.br ^bb128
^bb128:
cf.br ^bb125
^bb125:
%625 = llvm.mlir.addressof @str_0 : !llvm.ptr
%626 = llvm.load %603 : !llvm.ptr -> i64
%627 = llvm.call @printf(%625, %626) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%191) : (!llvm.ptr) -> ()
func.call @free(%100) : (!llvm.ptr) -> ()
func.call @free(%30) : (!llvm.ptr) -> ()
%631 = arith.constant 0 : i32
func.return %631 : i32
}
}