← All problems
Problem 701
Expected maximum connected black area in a 7x7 grid where each unit cell is black with probability 1/2. Cell-by-cell frontier DP: each state stores the frontier's canonical component labels (at most 4 live components on a width-7 frontier), the exact size of every live component, and the largest size among components already closed off. States pack into one i64 key held in an open-addressing hash table with exact integer configuration counts. Answer = sum(max_area * count) / 2^49.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^3)O(n * s^2)
Space complexity O(n^2)O(s^2)
Approach Flow solution Markov chain or DP over states
Verdict Unknown
Flow source
# Project Euler 701: Random connected area
# Expected maximum connected black area in a 7x7 grid where each unit cell is
# black with probability 1/2. Cell-by-cell frontier DP: each state stores the
# frontier's canonical component labels (at most 4 live components on a width-7
# frontier), the exact size of every live component, and the largest size among
# components already closed off. States pack into one i64 key held in an
# open-addressing hash table with exact integer configuration counts.
# Answer = sum(max_area * count) / 2^49.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
# Open-addressing insert. Keys are stored as key+1 so 0 means empty.
function insert(k: ptr<i64>, v: ptr<i64>, key: i64, cnt: i64) -> void {
let mut i: i64 = key % 4194301
let mut done: i64 = 0
while done == 0 {
if k[i] == 0 {
k[i] = key + 1
v[i] = cnt
done = 1
} else {
if k[i] == key + 1 {
v[i] = v[i] + cnt
done = 1
} else {
i = i + 1
if i == 4194304 {
i = 0
}
}
}
}
}
# Canonicalise labels by first appearance, normalise the dead maximum,
# pack the state into a key and add it to table B.
function canon_insert(g: ptr<i64>, t: ptr<i64>, nc: i64, d: i64,
mp: ptr<i64>, t2: ptr<i64>,
kb: ptr<i64>, vb: ptr<i64>, cnt: i64) -> void {
let mut l: i64 = 0
while l <= 7 {
mp[l] = 0
l = l + 1
}
let mut nxt: i64 = 0
let mut j: i64 = 0
while j < 7 {
let lab: i64 = g[j]
if lab > 0 {
if mp[lab] == 0 {
nxt = nxt + 1
mp[lab] = nxt
}
g[j] = mp[lab]
}
j = j + 1
}
let mut i: i64 = 0
while i < 4 {
t2[i] = 0
i = i + 1
}
l = 1
while l <= nc {
t2[mp[l] - 1] = t[l - 1]
l = l + 1
}
let mut maxlive: i64 = 0
i = 0
while i < 4 {
if t2[i] > maxlive {
maxlive = t2[i]
}
i = i + 1
}
# A live component only grows until it dies, so a dead maximum that does
# not exceed the current best live size can never decide the answer.
let mut dd: i64 = d
if dd <= maxlive {
dd = 0
}
let mut labs: i64 = 0
j = 6
while j >= 0 {
labs = labs * 8 + g[j]
j = j - 1
}
let mut sz: i64 = 0
i = 3
while i >= 0 {
sz = sz * 64 + t2[i]
i = i - 1
}
let key: i64 = (labs * 16777216 + sz) * 64 + dd
insert(kb, vb, key, cnt)
}
function solve(w: i64, h: i64) -> f64 {
let cap: i64 = 4194304
let mut ka: ptr<i64> = calloc(cap, 8)
let mut va: ptr<i64> = calloc(cap, 8)
let mut kb: ptr<i64> = calloc(cap, 8)
let mut vb: ptr<i64> = calloc(cap, 8)
let f: ptr<i64> = calloc(8, 8)
let s: ptr<i64> = calloc(8, 8)
let g: ptr<i64> = calloc(8, 8)
let t: ptr<i64> = calloc(8, 8)
let mp: ptr<i64> = calloc(8, 8)
let t2: ptr<i64> = calloc(8, 8)
insert(ka, va, 0, 1)
let cells: i64 = w * h
for idx in 0..cells {
let c: i64 = idx % w
let mut slot: i64 = 0
while slot < cap {
kb[slot] = 0
slot = slot + 1
}
slot = 0
while slot < cap {
if ka[slot] != 0 {
let key: i64 = ka[slot] - 1
let cnt: i64 = va[slot]
let d: i64 = key % 64
let mut rest: i64 = key / 64
let mut nc: i64 = 0
let mut i: i64 = 0
while i < 4 {
s[i] = rest % 64
if s[i] > 0 {
nc = nc + 1
}
rest = rest / 64
i = i + 1
}
let mut j: i64 = 0
while j < 7 {
f[j] = rest % 8
rest = rest / 8
j = j + 1
}
let up: i64 = f[c]
let mut left: i64 = 0
if c > 0 {
left = f[c - 1]
}
# Transition 1: current cell white.
j = 0
while j < 7 {
g[j] = f[j]
j = j + 1
}
g[c] = 0
i = 0
while i < 4 {
t[i] = s[i]
i = i + 1
}
let mut d2: i64 = d
let mut nc2: i64 = nc
if up > 0 {
let mut found: i64 = 0
j = 0
while j < 7 {
if g[j] == up {
found = 1
}
j = j + 1
}
if found == 0 {
# Component up left the frontier: it is finished.
if t[up - 1] > d2 {
d2 = t[up - 1]
}
i = up - 1
while i < 3 {
t[i] = t[i + 1]
i = i + 1
}
t[3] = 0
j = 0
while j < 7 {
if g[j] > up {
g[j] = g[j] - 1
}
j = j + 1
}
nc2 = nc2 - 1
}
}
canon_insert(g, t, nc2, d2, mp, t2, kb, vb, cnt)
# Transition 2: current cell black.
j = 0
while j < 7 {
g[j] = f[j]
j = j + 1
}
i = 0
while i < 4 {
t[i] = s[i]
i = i + 1
}
nc2 = nc
if up == 0 && left == 0 {
nc2 = nc2 + 1
t[nc2 - 1] = 1
g[c] = nc2
} else {
if up > 0 && left > 0 && up != left {
# Merge the two neighbouring components.
let mut l1: i64 = up
let mut l2: i64 = left
if l1 > l2 {
l1 = left
l2 = up
}
t[l1 - 1] = t[l1 - 1] + t[l2 - 1] + 1
i = l2 - 1
while i < 3 {
t[i] = t[i + 1]
i = i + 1
}
t[3] = 0
j = 0
while j < 7 {
if g[j] == l2 {
g[j] = l1
} else {
if g[j] > l2 {
g[j] = g[j] - 1
}
}
j = j + 1
}
g[c] = l1
nc2 = nc2 - 1
} else {
let mut lab: i64 = up
if lab == 0 {
lab = left
}
t[lab - 1] = t[lab - 1] + 1
g[c] = lab
}
}
canon_insert(g, t, nc2, d, mp, t2, kb, vb, cnt)
}
slot = slot + 1
}
let tk: ptr<i64> = ka
ka = kb
kb = tk
let tv: ptr<i64> = va
va = vb
vb = tv
}
let mut total: i64 = 0
let mut slot2: i64 = 0
while slot2 < cap {
if ka[slot2] != 0 {
let key: i64 = ka[slot2] - 1
let cnt: i64 = va[slot2]
let mut best: i64 = key % 64
let mut rest: i64 = key / 64
let mut i: i64 = 0
while i < 4 {
let sz: i64 = rest % 64
if sz > best {
best = sz
}
rest = rest / 64
i = i + 1
}
total = total + best * cnt
}
slot2 = slot2 + 1
}
let mut denom: f64 = 1.0
let mut e: i64 = 0
while e < cells {
denom = denom * 2.0
e = e + 1
}
free(ka)
free(va)
free(kb)
free(vb)
free(f)
free(s)
free(g)
free(t)
free(mp)
free(t2)
return (total as f64) / denom
}
function main() -> i32 {
printf("%.8f\n", solve(7, 7))
return 0
}
Generated C
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
while (flow_temp_head) {
flow_temp_node* n = flow_temp_head;
flow_temp_head = n->next;
free(n);
}
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
if (!node) return NULL;
node->next = flow_temp_head;
flow_temp_head = node;
if (!flow_temp_atexit_set) {
flow_temp_atexit_set = 1;
atexit(flow_temp_free_all);
}
return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
char* r = (char*)flow_temp_alloc(la + lb + 1);
if (!r) return NULL;
if (la) memcpy(r, a, la);
if (lb) memcpy(r + la, b, lb);
r[la + lb] = '\0';
return r;
}
#define __flow_in_arr(arr, val) __extension__ ({ \
int _found = 0; \
size_t _n = sizeof(arr)/sizeof((arr)[0]); \
for (size_t _i = 0; _i < _n; _i++) { \
if ((arr)[_i] == (val)) { _found = 1; break; } \
} _found; })
/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
abort();
#if defined(__GNUC__) || defined(__clang__)
__builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")
#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#include <math.h>
void* _ui_state = NULL;
static inline float i32_to_f32(int32_t v) { return (float)v; }
/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }
void insert_ptr_i64_ptr_i64_i64_i64(int64_t* k, int64_t* v, int64_t key, int64_t cnt);
void canon_insert_ptr_i64_ptr_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64(int64_t* g, int64_t* t, int64_t nc, int64_t d, int64_t* mp, int64_t* t2, int64_t* kb, int64_t* vb, int64_t cnt);
double solve_i64_i64(int64_t w, int64_t h);
int32_t main(void);
void insert_ptr_i64_ptr_i64_i64_i64(int64_t* k, int64_t* v, int64_t key, int64_t cnt) {
int64_t i = FLOW_CHECKED_MOD((key), (4194301));
int64_t done = 0;
while (done == 0) {
if (k[i] == 0) {
k[i] = (key + 1);
v[i] = cnt;
done = 1;
} else {
if (k[i] == (key + 1)) {
v[i] = (v[i] + cnt);
done = 1;
} else {
i = (i + 1);
if (i == 4194304) {
i = 0;
}
}
}
}
}
void canon_insert_ptr_i64_ptr_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64(int64_t* g, int64_t* t, int64_t nc, int64_t d, int64_t* mp, int64_t* t2, int64_t* kb, int64_t* vb, int64_t cnt) {
int64_t l = 0;
while (l <= 7) {
mp[l] = 0;
l = (l + 1);
}
int64_t nxt = 0;
int64_t j = 0;
while (j < 7) {
int64_t lab = g[j];
if (lab > 0) {
if (mp[lab] == 0) {
nxt = (nxt + 1);
mp[lab] = nxt;
}
g[j] = mp[lab];
}
j = (j + 1);
}
int64_t i = 0;
while (i < 4) {
t2[i] = 0;
i = (i + 1);
}
l = 1;
while (l <= nc) {
t2[(mp[l] - 1)] = t[(l - 1)];
l = (l + 1);
}
int64_t maxlive = 0;
i = 0;
while (i < 4) {
if (t2[i] > maxlive) {
maxlive = t2[i];
}
i = (i + 1);
}
int64_t dd = d;
if (dd <= maxlive) {
dd = 0;
}
int64_t labs = 0;
j = 6;
while (j >= 0) {
labs = ((labs * 8) + g[j]);
j = (j - 1);
}
int64_t sz = 0;
i = 3;
while (i >= 0) {
sz = ((sz * 64) + t2[i]);
i = (i - 1);
}
int64_t key = ((((labs * 16777216) + sz) * 64) + dd);
insert_ptr_i64_ptr_i64_i64_i64(kb, vb, key, cnt);
}
double solve_i64_i64(int64_t w, int64_t h) {
int64_t cap = 4194304;
int64_t* ka = (int64_t*)(calloc(cap, 8));
int64_t* va = (int64_t*)(calloc(cap, 8));
int64_t* kb = (int64_t*)(calloc(cap, 8));
int64_t* vb = (int64_t*)(calloc(cap, 8));
int64_t* f = (int64_t*)(calloc(8, 8));
int64_t* s = (int64_t*)(calloc(8, 8));
int64_t* g = (int64_t*)(calloc(8, 8));
int64_t* t = (int64_t*)(calloc(8, 8));
int64_t* mp = (int64_t*)(calloc(8, 8));
int64_t* t2 = (int64_t*)(calloc(8, 8));
insert_ptr_i64_ptr_i64_i64_i64(ka, va, 0, 1);
int64_t cells = (w * h);
int32_t __flow_step_1 = 1;
for (int32_t idx = 0; (0 <= cells) ? idx < cells : idx > cells; idx += (0 <= cells) ? 1 : -1) {
int64_t c = FLOW_CHECKED_MOD((idx), (w));
int64_t slot = 0;
while (slot < cap) {
kb[slot] = 0;
slot = (slot + 1);
}
slot = 0;
while (slot < cap) {
if (ka[slot] != 0) {
int64_t key = (ka[slot] - 1);
int64_t cnt = va[slot];
int64_t d = FLOW_CHECKED_MOD((key), (64));
int64_t rest = FLOW_CHECKED_DIV((key), (64));
int64_t nc = 0;
int64_t i = 0;
while (i < 4) {
s[i] = FLOW_CHECKED_MOD((rest), (64));
if (s[i] > 0) {
nc = (nc + 1);
}
rest = FLOW_CHECKED_DIV((rest), (64));
i = (i + 1);
}
int64_t j = 0;
while (j < 7) {
f[j] = FLOW_CHECKED_MOD((rest), (8));
rest = FLOW_CHECKED_DIV((rest), (8));
j = (j + 1);
}
int64_t up = f[c];
int64_t left = 0;
if (c > 0) {
left = f[(c - 1)];
}
j = 0;
while (j < 7) {
g[j] = f[j];
j = (j + 1);
}
g[c] = 0;
i = 0;
while (i < 4) {
t[i] = s[i];
i = (i + 1);
}
int64_t d2 = d;
int64_t nc2 = nc;
if (up > 0) {
int64_t found = 0;
j = 0;
while (j < 7) {
if (g[j] == up) {
found = 1;
}
j = (j + 1);
}
if (found == 0) {
if (t[(up - 1)] > d2) {
d2 = t[(up - 1)];
}
i = (up - 1);
while (i < 3) {
t[i] = t[(i + 1)];
i = (i + 1);
}
t[3] = 0;
j = 0;
while (j < 7) {
if (g[j] > up) {
g[j] = (g[j] - 1);
}
j = (j + 1);
}
nc2 = (nc2 - 1);
}
}
canon_insert_ptr_i64_ptr_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64(g, t, nc2, d2, mp, t2, kb, vb, cnt);
j = 0;
while (j < 7) {
g[j] = f[j];
j = (j + 1);
}
i = 0;
while (i < 4) {
t[i] = s[i];
i = (i + 1);
}
nc2 = nc;
if ((up == 0 && left == 0)) {
nc2 = (nc2 + 1);
t[(nc2 - 1)] = 1;
g[c] = nc2;
} else {
if (((up > 0 && left > 0) && up != left)) {
int64_t l1 = up;
int64_t l2 = left;
if (l1 > l2) {
l1 = left;
l2 = up;
}
t[(l1 - 1)] = ((t[(l1 - 1)] + t[(l2 - 1)]) + 1);
i = (l2 - 1);
while (i < 3) {
t[i] = t[(i + 1)];
i = (i + 1);
}
t[3] = 0;
j = 0;
while (j < 7) {
if (g[j] == l2) {
g[j] = l1;
} else {
if (g[j] > l2) {
g[j] = (g[j] - 1);
}
}
j = (j + 1);
}
g[c] = l1;
nc2 = (nc2 - 1);
} else {
int64_t lab = up;
if (lab == 0) {
lab = left;
}
t[(lab - 1)] = (t[(lab - 1)] + 1);
g[c] = lab;
}
}
canon_insert_ptr_i64_ptr_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64(g, t, nc2, d, mp, t2, kb, vb, cnt);
}
slot = (slot + 1);
}
int64_t* tk = (int64_t*)(ka);
ka = kb;
kb = tk;
int64_t* tv = (int64_t*)(va);
va = vb;
vb = tv;
}
int64_t total = 0;
int64_t slot2 = 0;
while (slot2 < cap) {
if (ka[slot2] != 0) {
int64_t key = (ka[slot2] - 1);
int64_t cnt = va[slot2];
int64_t best = FLOW_CHECKED_MOD((key), (64));
int64_t rest = FLOW_CHECKED_DIV((key), (64));
int64_t i = 0;
while (i < 4) {
int64_t sz = FLOW_CHECKED_MOD((rest), (64));
if (sz > best) {
best = sz;
}
rest = FLOW_CHECKED_DIV((rest), (64));
i = (i + 1);
}
total = (total + (best * cnt));
}
slot2 = (slot2 + 1);
}
double denom = 1.0;
int64_t e = 0;
while (e < cells) {
denom = (denom * 2.0);
e = (e + 1);
}
free(ka);
free(va);
free(kb);
free(vb);
free(f);
free(s);
free(g);
free(t);
free(mp);
free(t2);
return (((double)(total)) / denom);
}
int32_t main(void) {
printf("%.8f\n", solve_i64_i64(7, 7));
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.8f\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 @insert(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: i64) -> () {
%0 = arith.constant 4194301 : i32
%2 = arith.extsi %0 : i32 to i64
%1 = arith.remsi %arg2, %2 : i64
%3 = llvm.mlir.constant(1 : i64) : i64
%4 = llvm.alloca %3 x i64 : (i64) -> !llvm.ptr
llvm.store %1, %4 : i64, !llvm.ptr
%5 = arith.constant 0 : i32
%6 = arith.extsi %5 : i32 to i64
%7 = llvm.mlir.constant(1 : i64) : i64
%8 = llvm.alloca %7 x i64 : (i64) -> !llvm.ptr
llvm.store %6, %8 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%9 = llvm.load %8 : !llvm.ptr -> i64
%10 = arith.constant 0 : i32
%12 = arith.extsi %10 : i32 to i64
%11 = arith.cmpi eq, %9, %12 : i64
cf.cond_br %11, ^bb1, ^bb2
^bb1:
%14 = llvm.load %4 : !llvm.ptr -> i64
%15 = llvm.getelementptr %arg0[%14] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%13 = llvm.load %15 : !llvm.ptr -> i64
%16 = arith.constant 0 : i32
%18 = arith.extsi %16 : i32 to i64
%17 = arith.cmpi eq, %13, %18 : i64
cf.cond_br %17, ^bb3, ^bb4
^bb3:
%19 = arith.constant 1 : i32
%21 = arith.extsi %19 : i32 to i64
%20 = arith.addi %arg2, %21 : i64
%22 = llvm.load %4 : !llvm.ptr -> i64
%23 = llvm.getelementptr %arg0[%22] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %20, %23 : i64, !llvm.ptr
%24 = llvm.load %4 : !llvm.ptr -> i64
%25 = llvm.getelementptr %arg1[%24] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg3, %25 : i64, !llvm.ptr
%26 = arith.constant 1 : i32
%27 = arith.extsi %26 : i32 to i64
llvm.store %27, %8 : i64, !llvm.ptr
cf.br ^bb5
^bb4:
%29 = llvm.load %4 : !llvm.ptr -> i64
%30 = llvm.getelementptr %arg0[%29] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%28 = llvm.load %30 : !llvm.ptr -> i64
%31 = arith.constant 1 : i32
%33 = arith.extsi %31 : i32 to i64
%32 = arith.addi %arg2, %33 : i64
%34 = arith.cmpi eq, %28, %32 : i64
cf.cond_br %34, ^bb6, ^bb7
^bb6:
%36 = llvm.load %4 : !llvm.ptr -> i64
%37 = llvm.getelementptr %arg1[%36] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%35 = llvm.load %37 : !llvm.ptr -> i64
%38 = arith.addi %35, %arg3 : i64
%39 = llvm.load %4 : !llvm.ptr -> i64
%40 = llvm.getelementptr %arg1[%39] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %38, %40 : i64, !llvm.ptr
%41 = arith.constant 1 : i32
%42 = arith.extsi %41 : i32 to i64
llvm.store %42, %8 : i64, !llvm.ptr
cf.br ^bb8
^bb7:
%43 = llvm.load %4 : !llvm.ptr -> i64
%44 = arith.constant 1 : i32
%46 = arith.extsi %44 : i32 to i64
%45 = arith.addi %43, %46 : i64
llvm.store %45, %4 : i64, !llvm.ptr
%47 = llvm.load %4 : !llvm.ptr -> i64
%48 = arith.constant 4194304 : i32
%50 = arith.extsi %48 : i32 to i64
%49 = arith.cmpi eq, %47, %50 : i64
cf.cond_br %49, ^bb9, ^bb10
^bb9:
%51 = arith.constant 0 : i32
%52 = arith.extsi %51 : i32 to i64
llvm.store %52, %4 : i64, !llvm.ptr
cf.br ^bb11
^bb10:
cf.br ^bb11
^bb11:
cf.br ^bb8
^bb8:
cf.br ^bb5
^bb5:
cf.br ^bb0
^bb2:
func.return
}
func.func @canon_insert(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: i64, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: i64) -> () {
%53 = arith.constant 0 : i32
%54 = arith.extsi %53 : i32 to i64
%55 = llvm.mlir.constant(1 : i64) : i64
%56 = llvm.alloca %55 x i64 : (i64) -> !llvm.ptr
llvm.store %54, %56 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%57 = llvm.load %56 : !llvm.ptr -> i64
%58 = arith.constant 7 : i32
%60 = arith.extsi %58 : i32 to i64
%59 = arith.cmpi sle, %57, %60 : i64
cf.cond_br %59, ^bb13, ^bb14
^bb13:
%61 = arith.constant 0 : i32
%62 = llvm.load %56 : !llvm.ptr -> i64
%63 = arith.extsi %61 : i32 to i64
%64 = llvm.getelementptr %arg4[%62] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %63, %64 : i64, !llvm.ptr
%65 = llvm.load %56 : !llvm.ptr -> i64
%66 = arith.constant 1 : i32
%68 = arith.extsi %66 : i32 to i64
%67 = arith.addi %65, %68 : i64
llvm.store %67, %56 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%69 = arith.constant 0 : i32
%70 = arith.extsi %69 : i32 to i64
%71 = llvm.mlir.constant(1 : i64) : i64
%72 = llvm.alloca %71 x i64 : (i64) -> !llvm.ptr
llvm.store %70, %72 : i64, !llvm.ptr
%73 = arith.constant 0 : i32
%74 = arith.extsi %73 : i32 to i64
%75 = llvm.mlir.constant(1 : i64) : i64
%76 = llvm.alloca %75 x i64 : (i64) -> !llvm.ptr
llvm.store %74, %76 : i64, !llvm.ptr
cf.br ^bb15
^bb15:
%77 = llvm.load %76 : !llvm.ptr -> i64
%78 = arith.constant 7 : i32
%80 = arith.extsi %78 : i32 to i64
%79 = arith.cmpi slt, %77, %80 : i64
cf.cond_br %79, ^bb16, ^bb17
^bb16:
%82 = llvm.load %76 : !llvm.ptr -> i64
%83 = llvm.getelementptr %arg0[%82] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%81 = llvm.load %83 : !llvm.ptr -> i64
%84 = arith.constant 0 : i32
%86 = arith.extsi %84 : i32 to i64
%85 = arith.cmpi sgt, %81, %86 : i64
cf.cond_br %85, ^bb18, ^bb19
^bb18:
%88 = llvm.getelementptr %arg4[%81] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%87 = llvm.load %88 : !llvm.ptr -> i64
%89 = arith.constant 0 : i32
%91 = arith.extsi %89 : i32 to i64
%90 = arith.cmpi eq, %87, %91 : i64
cf.cond_br %90, ^bb21, ^bb22
^bb21:
%92 = llvm.load %72 : !llvm.ptr -> i64
%93 = arith.constant 1 : i32
%95 = arith.extsi %93 : i32 to i64
%94 = arith.addi %92, %95 : i64
llvm.store %94, %72 : i64, !llvm.ptr
%96 = llvm.load %72 : !llvm.ptr -> i64
%97 = llvm.getelementptr %arg4[%81] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %96, %97 : i64, !llvm.ptr
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
%99 = llvm.getelementptr %arg4[%81] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%98 = llvm.load %99 : !llvm.ptr -> i64
%100 = llvm.load %76 : !llvm.ptr -> i64
%101 = llvm.getelementptr %arg0[%100] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %98, %101 : i64, !llvm.ptr
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
%102 = llvm.load %76 : !llvm.ptr -> i64
%103 = arith.constant 1 : i32
%105 = arith.extsi %103 : i32 to i64
%104 = arith.addi %102, %105 : i64
llvm.store %104, %76 : i64, !llvm.ptr
cf.br ^bb15
^bb17:
%106 = arith.constant 0 : i32
%107 = arith.extsi %106 : i32 to i64
%108 = llvm.mlir.constant(1 : i64) : i64
%109 = llvm.alloca %108 x i64 : (i64) -> !llvm.ptr
llvm.store %107, %109 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%110 = llvm.load %109 : !llvm.ptr -> i64
%111 = arith.constant 4 : i32
%113 = arith.extsi %111 : i32 to i64
%112 = arith.cmpi slt, %110, %113 : i64
cf.cond_br %112, ^bb25, ^bb26
^bb25:
%114 = arith.constant 0 : i32
%115 = llvm.load %109 : !llvm.ptr -> i64
%116 = arith.extsi %114 : i32 to i64
%117 = llvm.getelementptr %arg5[%115] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %116, %117 : i64, !llvm.ptr
%118 = llvm.load %109 : !llvm.ptr -> i64
%119 = arith.constant 1 : i32
%121 = arith.extsi %119 : i32 to i64
%120 = arith.addi %118, %121 : i64
llvm.store %120, %109 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
%122 = arith.constant 1 : i32
%123 = arith.extsi %122 : i32 to i64
llvm.store %123, %56 : i64, !llvm.ptr
cf.br ^bb27
^bb27:
%124 = llvm.load %56 : !llvm.ptr -> i64
%125 = arith.cmpi sle, %124, %arg2 : i64
cf.cond_br %125, ^bb28, ^bb29
^bb28:
%127 = llvm.load %56 : !llvm.ptr -> i64
%128 = arith.constant 1 : i32
%130 = arith.extsi %128 : i32 to i64
%129 = arith.subi %127, %130 : i64
%131 = llvm.getelementptr %arg1[%129] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%126 = llvm.load %131 : !llvm.ptr -> i64
%133 = llvm.load %56 : !llvm.ptr -> i64
%134 = llvm.getelementptr %arg4[%133] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%132 = llvm.load %134 : !llvm.ptr -> i64
%135 = arith.constant 1 : i32
%137 = arith.extsi %135 : i32 to i64
%136 = arith.subi %132, %137 : i64
%138 = llvm.getelementptr %arg5[%136] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %126, %138 : i64, !llvm.ptr
%139 = llvm.load %56 : !llvm.ptr -> i64
%140 = arith.constant 1 : i32
%142 = arith.extsi %140 : i32 to i64
%141 = arith.addi %139, %142 : i64
llvm.store %141, %56 : i64, !llvm.ptr
cf.br ^bb27
^bb29:
%143 = arith.constant 0 : i32
%144 = arith.extsi %143 : i32 to i64
%145 = llvm.mlir.constant(1 : i64) : i64
%146 = llvm.alloca %145 x i64 : (i64) -> !llvm.ptr
llvm.store %144, %146 : i64, !llvm.ptr
%147 = arith.constant 0 : i32
%148 = arith.extsi %147 : i32 to i64
llvm.store %148, %109 : i64, !llvm.ptr
cf.br ^bb30
^bb30:
%149 = llvm.load %109 : !llvm.ptr -> i64
%150 = arith.constant 4 : i32
%152 = arith.extsi %150 : i32 to i64
%151 = arith.cmpi slt, %149, %152 : i64
cf.cond_br %151, ^bb31, ^bb32
^bb31:
%154 = llvm.load %109 : !llvm.ptr -> i64
%155 = llvm.getelementptr %arg5[%154] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%153 = llvm.load %155 : !llvm.ptr -> i64
%156 = llvm.load %146 : !llvm.ptr -> i64
%157 = arith.cmpi sgt, %153, %156 : i64
cf.cond_br %157, ^bb33, ^bb34
^bb33:
%159 = llvm.load %109 : !llvm.ptr -> i64
%160 = llvm.getelementptr %arg5[%159] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%158 = llvm.load %160 : !llvm.ptr -> i64
llvm.store %158, %146 : i64, !llvm.ptr
cf.br ^bb35
^bb34:
cf.br ^bb35
^bb35:
%161 = llvm.load %109 : !llvm.ptr -> i64
%162 = arith.constant 1 : i32
%164 = arith.extsi %162 : i32 to i64
%163 = arith.addi %161, %164 : i64
llvm.store %163, %109 : i64, !llvm.ptr
cf.br ^bb30
^bb32:
%165 = llvm.mlir.constant(1 : i64) : i64
%166 = llvm.alloca %165 x i64 : (i64) -> !llvm.ptr
llvm.store %arg3, %166 : i64, !llvm.ptr
%167 = llvm.load %166 : !llvm.ptr -> i64
%168 = llvm.load %146 : !llvm.ptr -> i64
%169 = arith.cmpi sle, %167, %168 : i64
cf.cond_br %169, ^bb36, ^bb37
^bb36:
%170 = arith.constant 0 : i32
%171 = arith.extsi %170 : i32 to i64
llvm.store %171, %166 : i64, !llvm.ptr
cf.br ^bb38
^bb37:
cf.br ^bb38
^bb38:
%172 = arith.constant 0 : i32
%173 = arith.extsi %172 : i32 to i64
%174 = llvm.mlir.constant(1 : i64) : i64
%175 = llvm.alloca %174 x i64 : (i64) -> !llvm.ptr
llvm.store %173, %175 : i64, !llvm.ptr
%176 = arith.constant 6 : i32
%177 = arith.extsi %176 : i32 to i64
llvm.store %177, %76 : i64, !llvm.ptr
cf.br ^bb39
^bb39:
%178 = llvm.load %76 : !llvm.ptr -> i64
%179 = arith.constant 0 : i32
%181 = arith.extsi %179 : i32 to i64
%180 = arith.cmpi sge, %178, %181 : i64
cf.cond_br %180, ^bb40, ^bb41
^bb40:
%182 = llvm.load %175 : !llvm.ptr -> i64
%183 = arith.constant 8 : i32
%185 = arith.extsi %183 : i32 to i64
%184 = arith.muli %182, %185 : i64
%187 = llvm.load %76 : !llvm.ptr -> i64
%188 = llvm.getelementptr %arg0[%187] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%186 = llvm.load %188 : !llvm.ptr -> i64
%189 = arith.addi %184, %186 : i64
llvm.store %189, %175 : i64, !llvm.ptr
%190 = llvm.load %76 : !llvm.ptr -> i64
%191 = arith.constant 1 : i32
%193 = arith.extsi %191 : i32 to i64
%192 = arith.subi %190, %193 : i64
llvm.store %192, %76 : i64, !llvm.ptr
cf.br ^bb39
^bb41:
%194 = arith.constant 0 : i32
%195 = arith.extsi %194 : i32 to i64
%196 = llvm.mlir.constant(1 : i64) : i64
%197 = llvm.alloca %196 x i64 : (i64) -> !llvm.ptr
llvm.store %195, %197 : i64, !llvm.ptr
%198 = arith.constant 3 : i32
%199 = arith.extsi %198 : i32 to i64
llvm.store %199, %109 : i64, !llvm.ptr
cf.br ^bb42
^bb42:
%200 = llvm.load %109 : !llvm.ptr -> i64
%201 = arith.constant 0 : i32
%203 = arith.extsi %201 : i32 to i64
%202 = arith.cmpi sge, %200, %203 : i64
cf.cond_br %202, ^bb43, ^bb44
^bb43:
%204 = llvm.load %197 : !llvm.ptr -> i64
%205 = arith.constant 64 : i32
%207 = arith.extsi %205 : i32 to i64
%206 = arith.muli %204, %207 : i64
%209 = llvm.load %109 : !llvm.ptr -> i64
%210 = llvm.getelementptr %arg5[%209] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%208 = llvm.load %210 : !llvm.ptr -> i64
%211 = arith.addi %206, %208 : i64
llvm.store %211, %197 : i64, !llvm.ptr
%212 = llvm.load %109 : !llvm.ptr -> i64
%213 = arith.constant 1 : i32
%215 = arith.extsi %213 : i32 to i64
%214 = arith.subi %212, %215 : i64
llvm.store %214, %109 : i64, !llvm.ptr
cf.br ^bb42
^bb44:
%216 = llvm.load %175 : !llvm.ptr -> i64
%217 = arith.constant 16777216 : i32
%219 = arith.extsi %217 : i32 to i64
%218 = arith.muli %216, %219 : i64
%220 = llvm.load %197 : !llvm.ptr -> i64
%221 = arith.addi %218, %220 : i64
%222 = arith.constant 64 : i32
%224 = arith.extsi %222 : i32 to i64
%223 = arith.muli %221, %224 : i64
%225 = llvm.load %166 : !llvm.ptr -> i64
%226 = arith.addi %223, %225 : i64
func.call @insert(%arg6, %arg7, %226, %arg8) : (!llvm.ptr, !llvm.ptr, i64, i64) -> ()
func.return
}
func.func @solve(%arg0: i64, %arg1: i64) -> f64 {
%228 = arith.constant 4194304 : i32
%229 = arith.extsi %228 : i32 to i64
%231 = arith.constant 8 : i32
%232 = arith.extsi %231 : i32 to i64
%230 = func.call @calloc(%229, %232) : (i64, i64) -> !llvm.ptr
%233 = llvm.mlir.constant(1 : i64) : i64
%234 = llvm.alloca %233 x !llvm.ptr : (i64) -> !llvm.ptr
llvm.store %230, %234 : !llvm.ptr, !llvm.ptr
%236 = arith.constant 8 : i32
%237 = arith.extsi %236 : i32 to i64
%235 = func.call @calloc(%229, %237) : (i64, i64) -> !llvm.ptr
%238 = llvm.mlir.constant(1 : i64) : i64
%239 = llvm.alloca %238 x !llvm.ptr : (i64) -> !llvm.ptr
llvm.store %235, %239 : !llvm.ptr, !llvm.ptr
%241 = arith.constant 8 : i32
%242 = arith.extsi %241 : i32 to i64
%240 = func.call @calloc(%229, %242) : (i64, i64) -> !llvm.ptr
%243 = llvm.mlir.constant(1 : i64) : i64
%244 = llvm.alloca %243 x !llvm.ptr : (i64) -> !llvm.ptr
llvm.store %240, %244 : !llvm.ptr, !llvm.ptr
%246 = arith.constant 8 : i32
%247 = arith.extsi %246 : i32 to i64
%245 = func.call @calloc(%229, %247) : (i64, i64) -> !llvm.ptr
%248 = llvm.mlir.constant(1 : i64) : i64
%249 = llvm.alloca %248 x !llvm.ptr : (i64) -> !llvm.ptr
llvm.store %245, %249 : !llvm.ptr, !llvm.ptr
%251 = arith.constant 8 : i32
%252 = arith.constant 8 : i32
%253 = arith.extsi %251 : i32 to i64
%254 = arith.extsi %252 : i32 to i64
%250 = func.call @calloc(%253, %254) : (i64, i64) -> !llvm.ptr
%256 = arith.constant 8 : i32
%257 = arith.constant 8 : i32
%258 = arith.extsi %256 : i32 to i64
%259 = arith.extsi %257 : i32 to i64
%255 = func.call @calloc(%258, %259) : (i64, i64) -> !llvm.ptr
%261 = arith.constant 8 : i32
%262 = arith.constant 8 : i32
%263 = arith.extsi %261 : i32 to i64
%264 = arith.extsi %262 : i32 to i64
%260 = func.call @calloc(%263, %264) : (i64, i64) -> !llvm.ptr
%266 = arith.constant 8 : i32
%267 = arith.constant 8 : i32
%268 = arith.extsi %266 : i32 to i64
%269 = arith.extsi %267 : i32 to i64
%265 = func.call @calloc(%268, %269) : (i64, i64) -> !llvm.ptr
%271 = arith.constant 8 : i32
%272 = arith.constant 8 : i32
%273 = arith.extsi %271 : i32 to i64
%274 = arith.extsi %272 : i32 to i64
%270 = func.call @calloc(%273, %274) : (i64, i64) -> !llvm.ptr
%276 = arith.constant 8 : i32
%277 = arith.constant 8 : i32
%278 = arith.extsi %276 : i32 to i64
%279 = arith.extsi %277 : i32 to i64
%275 = func.call @calloc(%278, %279) : (i64, i64) -> !llvm.ptr
%281 = llvm.load %234 : !llvm.ptr -> !llvm.ptr
%282 = llvm.load %239 : !llvm.ptr -> !llvm.ptr
%283 = arith.constant 0 : i32
%284 = arith.constant 1 : i32
%285 = arith.extsi %283 : i32 to i64
%286 = arith.extsi %284 : i32 to i64
func.call @insert(%281, %282, %285, %286) : (!llvm.ptr, !llvm.ptr, i64, i64) -> ()
%287 = arith.muli %arg0, %arg1 : i64
%288 = arith.constant 0 : i32
%289 = arith.index_cast %288 : i32 to index
%290 = arith.index_cast %287 : i32 to index
%292 = arith.constant 1 : index
%293 = arith.constant -1 : index
%294 = arith.cmpi sle, %289, %290 : index
%291 = arith.select %294, %292, %293 : index
cf.br ^bb45(%289 : index)
^bb45(%295: index):
%296 = arith.cmpi slt, %295, %290 : index
%297 = arith.cmpi sgt, %295, %290 : index
%298 = arith.select %294, %296, %297 : i1
cf.cond_br %298, ^bb46(%295 : index), ^bb47(%295 : index)
^bb46(%299: index):
%301 = arith.index_cast %299 : index to i32
%302 = arith.trunci %arg0 : i64 to i32
%300 = arith.remsi %301, %302 : i32
%303 = arith.extsi %300 : i32 to i64
%304 = arith.constant 0 : i32
%305 = arith.extsi %304 : i32 to i64
%306 = llvm.mlir.constant(1 : i64) : i64
%307 = llvm.alloca %306 x i64 : (i64) -> !llvm.ptr
llvm.store %305, %307 : i64, !llvm.ptr
cf.br ^bb48
^bb48:
%308 = llvm.load %307 : !llvm.ptr -> i64
%309 = arith.cmpi slt, %308, %229 : i64
cf.cond_br %309, ^bb49, ^bb50
^bb49:
%310 = arith.constant 0 : i32
%311 = llvm.load %244 : !llvm.ptr -> !llvm.ptr
%312 = llvm.load %307 : !llvm.ptr -> i64
%313 = arith.extsi %310 : i32 to i64
%314 = llvm.getelementptr %311[%312] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %313, %314 : i64, !llvm.ptr
%315 = llvm.load %307 : !llvm.ptr -> i64
%316 = arith.constant 1 : i32
%318 = arith.extsi %316 : i32 to i64
%317 = arith.addi %315, %318 : i64
llvm.store %317, %307 : i64, !llvm.ptr
cf.br ^bb48
^bb50:
%319 = arith.constant 0 : i32
%320 = arith.extsi %319 : i32 to i64
llvm.store %320, %307 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%321 = llvm.load %307 : !llvm.ptr -> i64
%322 = arith.cmpi slt, %321, %229 : i64
cf.cond_br %322, ^bb52, ^bb53
^bb52:
%324 = llvm.load %234 : !llvm.ptr -> !llvm.ptr
%325 = llvm.load %307 : !llvm.ptr -> i64
%326 = llvm.getelementptr %324[%325] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%323 = llvm.load %326 : !llvm.ptr -> i64
%327 = arith.constant 0 : i32
%329 = arith.extsi %327 : i32 to i64
%328 = arith.cmpi ne, %323, %329 : i64
cf.cond_br %328, ^bb54, ^bb55
^bb54:
%331 = llvm.load %234 : !llvm.ptr -> !llvm.ptr
%332 = llvm.load %307 : !llvm.ptr -> i64
%333 = llvm.getelementptr %331[%332] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%330 = llvm.load %333 : !llvm.ptr -> i64
%334 = arith.constant 1 : i32
%336 = arith.extsi %334 : i32 to i64
%335 = arith.subi %330, %336 : i64
%338 = llvm.load %239 : !llvm.ptr -> !llvm.ptr
%339 = llvm.load %307 : !llvm.ptr -> i64
%340 = llvm.getelementptr %338[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%337 = llvm.load %340 : !llvm.ptr -> i64
%341 = arith.constant 64 : i32
%343 = arith.extsi %341 : i32 to i64
%342 = arith.remsi %335, %343 : i64
%344 = arith.constant 64 : i32
%346 = arith.extsi %344 : i32 to i64
%345 = arith.divsi %335, %346 : i64
%347 = llvm.mlir.constant(1 : i64) : i64
%348 = llvm.alloca %347 x i64 : (i64) -> !llvm.ptr
llvm.store %345, %348 : i64, !llvm.ptr
%349 = arith.constant 0 : i32
%350 = arith.extsi %349 : i32 to i64
%351 = llvm.mlir.constant(1 : i64) : i64
%352 = llvm.alloca %351 x i64 : (i64) -> !llvm.ptr
llvm.store %350, %352 : i64, !llvm.ptr
%353 = arith.constant 0 : i32
%354 = arith.extsi %353 : i32 to i64
%355 = llvm.mlir.constant(1 : i64) : i64
%356 = llvm.alloca %355 x i64 : (i64) -> !llvm.ptr
llvm.store %354, %356 : i64, !llvm.ptr
cf.br ^bb57
^bb57:
%357 = llvm.load %356 : !llvm.ptr -> i64
%358 = arith.constant 4 : i32
%360 = arith.extsi %358 : i32 to i64
%359 = arith.cmpi slt, %357, %360 : i64
cf.cond_br %359, ^bb58, ^bb59
^bb58:
%361 = llvm.load %348 : !llvm.ptr -> i64
%362 = arith.constant 64 : i32
%364 = arith.extsi %362 : i32 to i64
%363 = arith.remsi %361, %364 : i64
%365 = llvm.load %356 : !llvm.ptr -> i64
%366 = llvm.getelementptr %255[%365] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %363, %366 : i64, !llvm.ptr
%368 = llvm.load %356 : !llvm.ptr -> i64
%369 = llvm.getelementptr %255[%368] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%367 = llvm.load %369 : !llvm.ptr -> i64
%370 = arith.constant 0 : i32
%372 = arith.extsi %370 : i32 to i64
%371 = arith.cmpi sgt, %367, %372 : i64
cf.cond_br %371, ^bb60, ^bb61
^bb60:
%373 = llvm.load %352 : !llvm.ptr -> i64
%374 = arith.constant 1 : i32
%376 = arith.extsi %374 : i32 to i64
%375 = arith.addi %373, %376 : i64
llvm.store %375, %352 : i64, !llvm.ptr
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
%377 = llvm.load %348 : !llvm.ptr -> i64
%378 = arith.constant 64 : i32
%380 = arith.extsi %378 : i32 to i64
%379 = arith.divsi %377, %380 : i64
llvm.store %379, %348 : i64, !llvm.ptr
%381 = llvm.load %356 : !llvm.ptr -> i64
%382 = arith.constant 1 : i32
%384 = arith.extsi %382 : i32 to i64
%383 = arith.addi %381, %384 : i64
llvm.store %383, %356 : i64, !llvm.ptr
cf.br ^bb57
^bb59:
%385 = arith.constant 0 : i32
%386 = arith.extsi %385 : i32 to i64
%387 = llvm.mlir.constant(1 : i64) : i64
%388 = llvm.alloca %387 x i64 : (i64) -> !llvm.ptr
llvm.store %386, %388 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%389 = llvm.load %388 : !llvm.ptr -> i64
%390 = arith.constant 7 : i32
%392 = arith.extsi %390 : i32 to i64
%391 = arith.cmpi slt, %389, %392 : i64
cf.cond_br %391, ^bb64, ^bb65
^bb64:
%393 = llvm.load %348 : !llvm.ptr -> i64
%394 = arith.constant 8 : i32
%396 = arith.extsi %394 : i32 to i64
%395 = arith.remsi %393, %396 : i64
%397 = llvm.load %388 : !llvm.ptr -> i64
%398 = llvm.getelementptr %250[%397] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %395, %398 : i64, !llvm.ptr
%399 = llvm.load %348 : !llvm.ptr -> i64
%400 = arith.constant 8 : i32
%402 = arith.extsi %400 : i32 to i64
%401 = arith.divsi %399, %402 : i64
llvm.store %401, %348 : i64, !llvm.ptr
%403 = llvm.load %388 : !llvm.ptr -> i64
%404 = arith.constant 1 : i32
%406 = arith.extsi %404 : i32 to i64
%405 = arith.addi %403, %406 : i64
llvm.store %405, %388 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
%408 = llvm.getelementptr %250[%303] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%407 = llvm.load %408 : !llvm.ptr -> i64
%409 = arith.constant 0 : i32
%410 = arith.extsi %409 : i32 to i64
%411 = llvm.mlir.constant(1 : i64) : i64
%412 = llvm.alloca %411 x i64 : (i64) -> !llvm.ptr
llvm.store %410, %412 : i64, !llvm.ptr
%413 = arith.constant 0 : i32
%415 = arith.extsi %413 : i32 to i64
%414 = arith.cmpi sgt, %303, %415 : i64
cf.cond_br %414, ^bb66, ^bb67
^bb66:
%417 = arith.constant 1 : i32
%419 = arith.extsi %417 : i32 to i64
%418 = arith.subi %303, %419 : i64
%420 = llvm.getelementptr %250[%418] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%416 = llvm.load %420 : !llvm.ptr -> i64
llvm.store %416, %412 : i64, !llvm.ptr
cf.br ^bb68
^bb67:
cf.br ^bb68
^bb68:
%421 = arith.constant 0 : i32
%422 = arith.extsi %421 : i32 to i64
llvm.store %422, %388 : i64, !llvm.ptr
cf.br ^bb69
^bb69:
%423 = llvm.load %388 : !llvm.ptr -> i64
%424 = arith.constant 7 : i32
%426 = arith.extsi %424 : i32 to i64
%425 = arith.cmpi slt, %423, %426 : i64
cf.cond_br %425, ^bb70, ^bb71
^bb70:
%428 = llvm.load %388 : !llvm.ptr -> i64
%429 = llvm.getelementptr %250[%428] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%427 = llvm.load %429 : !llvm.ptr -> i64
%430 = llvm.load %388 : !llvm.ptr -> i64
%431 = llvm.getelementptr %260[%430] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %427, %431 : i64, !llvm.ptr
%432 = llvm.load %388 : !llvm.ptr -> i64
%433 = arith.constant 1 : i32
%435 = arith.extsi %433 : i32 to i64
%434 = arith.addi %432, %435 : i64
llvm.store %434, %388 : i64, !llvm.ptr
cf.br ^bb69
^bb71:
%436 = arith.constant 0 : i32
%437 = arith.extsi %436 : i32 to i64
%438 = llvm.getelementptr %260[%303] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %437, %438 : i64, !llvm.ptr
%439 = arith.constant 0 : i32
%440 = arith.extsi %439 : i32 to i64
llvm.store %440, %356 : i64, !llvm.ptr
cf.br ^bb72
^bb72:
%441 = llvm.load %356 : !llvm.ptr -> i64
%442 = arith.constant 4 : i32
%444 = arith.extsi %442 : i32 to i64
%443 = arith.cmpi slt, %441, %444 : i64
cf.cond_br %443, ^bb73, ^bb74
^bb73:
%446 = llvm.load %356 : !llvm.ptr -> i64
%447 = llvm.getelementptr %255[%446] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%445 = llvm.load %447 : !llvm.ptr -> i64
%448 = llvm.load %356 : !llvm.ptr -> i64
%449 = llvm.getelementptr %265[%448] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %445, %449 : i64, !llvm.ptr
%450 = llvm.load %356 : !llvm.ptr -> i64
%451 = arith.constant 1 : i32
%453 = arith.extsi %451 : i32 to i64
%452 = arith.addi %450, %453 : i64
llvm.store %452, %356 : i64, !llvm.ptr
cf.br ^bb72
^bb74:
%454 = llvm.mlir.constant(1 : i64) : i64
%455 = llvm.alloca %454 x i64 : (i64) -> !llvm.ptr
llvm.store %342, %455 : i64, !llvm.ptr
%456 = llvm.load %352 : !llvm.ptr -> i64
%457 = llvm.mlir.constant(1 : i64) : i64
%458 = llvm.alloca %457 x i64 : (i64) -> !llvm.ptr
llvm.store %456, %458 : i64, !llvm.ptr
%459 = arith.constant 0 : i32
%461 = arith.extsi %459 : i32 to i64
%460 = arith.cmpi sgt, %407, %461 : i64
cf.cond_br %460, ^bb75, ^bb76
^bb75:
%462 = arith.constant 0 : i32
%463 = arith.extsi %462 : i32 to i64
%464 = llvm.mlir.constant(1 : i64) : i64
%465 = llvm.alloca %464 x i64 : (i64) -> !llvm.ptr
llvm.store %463, %465 : i64, !llvm.ptr
%466 = arith.constant 0 : i32
%467 = arith.extsi %466 : i32 to i64
llvm.store %467, %388 : i64, !llvm.ptr
cf.br ^bb78
^bb78:
%468 = llvm.load %388 : !llvm.ptr -> i64
%469 = arith.constant 7 : i32
%471 = arith.extsi %469 : i32 to i64
%470 = arith.cmpi slt, %468, %471 : i64
cf.cond_br %470, ^bb79, ^bb80
^bb79:
%473 = llvm.load %388 : !llvm.ptr -> i64
%474 = llvm.getelementptr %260[%473] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%472 = llvm.load %474 : !llvm.ptr -> i64
%475 = arith.cmpi eq, %472, %407 : i64
cf.cond_br %475, ^bb81, ^bb82
^bb81:
%476 = arith.constant 1 : i32
%477 = arith.extsi %476 : i32 to i64
llvm.store %477, %465 : i64, !llvm.ptr
cf.br ^bb83
^bb82:
cf.br ^bb83
^bb83:
%478 = llvm.load %388 : !llvm.ptr -> i64
%479 = arith.constant 1 : i32
%481 = arith.extsi %479 : i32 to i64
%480 = arith.addi %478, %481 : i64
llvm.store %480, %388 : i64, !llvm.ptr
cf.br ^bb78
^bb80:
%482 = llvm.load %465 : !llvm.ptr -> i64
%483 = arith.constant 0 : i32
%485 = arith.extsi %483 : i32 to i64
%484 = arith.cmpi eq, %482, %485 : i64
cf.cond_br %484, ^bb84, ^bb85
^bb84:
%487 = arith.constant 1 : i32
%489 = arith.extsi %487 : i32 to i64
%488 = arith.subi %407, %489 : i64
%490 = llvm.getelementptr %265[%488] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%486 = llvm.load %490 : !llvm.ptr -> i64
%491 = llvm.load %455 : !llvm.ptr -> i64
%492 = arith.cmpi sgt, %486, %491 : i64
cf.cond_br %492, ^bb87, ^bb88
^bb87:
%494 = arith.constant 1 : i32
%496 = arith.extsi %494 : i32 to i64
%495 = arith.subi %407, %496 : i64
%497 = llvm.getelementptr %265[%495] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%493 = llvm.load %497 : !llvm.ptr -> i64
llvm.store %493, %455 : i64, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
%498 = arith.constant 1 : i32
%500 = arith.extsi %498 : i32 to i64
%499 = arith.subi %407, %500 : i64
llvm.store %499, %356 : i64, !llvm.ptr
cf.br ^bb90
^bb90:
%501 = llvm.load %356 : !llvm.ptr -> i64
%502 = arith.constant 3 : i32
%504 = arith.extsi %502 : i32 to i64
%503 = arith.cmpi slt, %501, %504 : i64
cf.cond_br %503, ^bb91, ^bb92
^bb91:
%506 = llvm.load %356 : !llvm.ptr -> i64
%507 = arith.constant 1 : i32
%509 = arith.extsi %507 : i32 to i64
%508 = arith.addi %506, %509 : i64
%510 = llvm.getelementptr %265[%508] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%505 = llvm.load %510 : !llvm.ptr -> i64
%511 = llvm.load %356 : !llvm.ptr -> i64
%512 = llvm.getelementptr %265[%511] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %505, %512 : i64, !llvm.ptr
%513 = llvm.load %356 : !llvm.ptr -> i64
%514 = arith.constant 1 : i32
%516 = arith.extsi %514 : i32 to i64
%515 = arith.addi %513, %516 : i64
llvm.store %515, %356 : i64, !llvm.ptr
cf.br ^bb90
^bb92:
%517 = arith.constant 0 : i32
%518 = arith.constant 3 : i32
%519 = arith.extsi %517 : i32 to i64
%520 = arith.extsi %518 : i32 to i64
%521 = llvm.getelementptr %265[%520] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %519, %521 : i64, !llvm.ptr
%522 = arith.constant 0 : i32
%523 = arith.extsi %522 : i32 to i64
llvm.store %523, %388 : i64, !llvm.ptr
cf.br ^bb93
^bb93:
%524 = llvm.load %388 : !llvm.ptr -> i64
%525 = arith.constant 7 : i32
%527 = arith.extsi %525 : i32 to i64
%526 = arith.cmpi slt, %524, %527 : i64
cf.cond_br %526, ^bb94, ^bb95
^bb94:
%529 = llvm.load %388 : !llvm.ptr -> i64
%530 = llvm.getelementptr %260[%529] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%528 = llvm.load %530 : !llvm.ptr -> i64
%531 = arith.cmpi sgt, %528, %407 : i64
cf.cond_br %531, ^bb96, ^bb97
^bb96:
%533 = llvm.load %388 : !llvm.ptr -> i64
%534 = llvm.getelementptr %260[%533] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%532 = llvm.load %534 : !llvm.ptr -> i64
%535 = arith.constant 1 : i32
%537 = arith.extsi %535 : i32 to i64
%536 = arith.subi %532, %537 : i64
%538 = llvm.load %388 : !llvm.ptr -> i64
%539 = llvm.getelementptr %260[%538] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %536, %539 : i64, !llvm.ptr
cf.br ^bb98
^bb97:
cf.br ^bb98
^bb98:
%540 = llvm.load %388 : !llvm.ptr -> i64
%541 = arith.constant 1 : i32
%543 = arith.extsi %541 : i32 to i64
%542 = arith.addi %540, %543 : i64
llvm.store %542, %388 : i64, !llvm.ptr
cf.br ^bb93
^bb95:
%544 = llvm.load %458 : !llvm.ptr -> i64
%545 = arith.constant 1 : i32
%547 = arith.extsi %545 : i32 to i64
%546 = arith.subi %544, %547 : i64
llvm.store %546, %458 : i64, !llvm.ptr
cf.br ^bb86
^bb85:
cf.br ^bb86
^bb86:
cf.br ^bb77
^bb76:
cf.br ^bb77
^bb77:
%549 = llvm.load %458 : !llvm.ptr -> i64
%550 = llvm.load %455 : !llvm.ptr -> i64
%551 = llvm.load %244 : !llvm.ptr -> !llvm.ptr
%552 = llvm.load %249 : !llvm.ptr -> !llvm.ptr
func.call @canon_insert(%260, %265, %549, %550, %270, %275, %551, %552, %337) : (!llvm.ptr, !llvm.ptr, i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> ()
%553 = arith.constant 0 : i32
%554 = arith.extsi %553 : i32 to i64
llvm.store %554, %388 : i64, !llvm.ptr
cf.br ^bb99
^bb99:
%555 = llvm.load %388 : !llvm.ptr -> i64
%556 = arith.constant 7 : i32
%558 = arith.extsi %556 : i32 to i64
%557 = arith.cmpi slt, %555, %558 : i64
cf.cond_br %557, ^bb100, ^bb101
^bb100:
%560 = llvm.load %388 : !llvm.ptr -> i64
%561 = llvm.getelementptr %250[%560] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%559 = llvm.load %561 : !llvm.ptr -> i64
%562 = llvm.load %388 : !llvm.ptr -> i64
%563 = llvm.getelementptr %260[%562] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %559, %563 : i64, !llvm.ptr
%564 = llvm.load %388 : !llvm.ptr -> i64
%565 = arith.constant 1 : i32
%567 = arith.extsi %565 : i32 to i64
%566 = arith.addi %564, %567 : i64
llvm.store %566, %388 : i64, !llvm.ptr
cf.br ^bb99
^bb101:
%568 = arith.constant 0 : i32
%569 = arith.extsi %568 : i32 to i64
llvm.store %569, %356 : i64, !llvm.ptr
cf.br ^bb102
^bb102:
%570 = llvm.load %356 : !llvm.ptr -> i64
%571 = arith.constant 4 : i32
%573 = arith.extsi %571 : i32 to i64
%572 = arith.cmpi slt, %570, %573 : i64
cf.cond_br %572, ^bb103, ^bb104
^bb103:
%575 = llvm.load %356 : !llvm.ptr -> i64
%576 = llvm.getelementptr %255[%575] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%574 = llvm.load %576 : !llvm.ptr -> i64
%577 = llvm.load %356 : !llvm.ptr -> i64
%578 = llvm.getelementptr %265[%577] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %574, %578 : i64, !llvm.ptr
%579 = llvm.load %356 : !llvm.ptr -> i64
%580 = arith.constant 1 : i32
%582 = arith.extsi %580 : i32 to i64
%581 = arith.addi %579, %582 : i64
llvm.store %581, %356 : i64, !llvm.ptr
cf.br ^bb102
^bb104:
%583 = llvm.load %352 : !llvm.ptr -> i64
llvm.store %583, %458 : i64, !llvm.ptr
%584 = arith.constant 0 : i32
%586 = arith.extsi %584 : i32 to i64
%585 = arith.cmpi eq, %407, %586 : i64
%587 = scf.if %585 -> (i1) {
%588 = llvm.load %412 : !llvm.ptr -> i64
%589 = arith.constant 0 : i32
%591 = arith.extsi %589 : i32 to i64
%590 = arith.cmpi eq, %588, %591 : i64
scf.yield %590 : i1
} else {
%592 = arith.constant false
scf.yield %592 : i1
}
cf.cond_br %587, ^bb105, ^bb106
^bb105:
%593 = llvm.load %458 : !llvm.ptr -> i64
%594 = arith.constant 1 : i32
%596 = arith.extsi %594 : i32 to i64
%595 = arith.addi %593, %596 : i64
llvm.store %595, %458 : i64, !llvm.ptr
%597 = arith.constant 1 : i32
%598 = llvm.load %458 : !llvm.ptr -> i64
%599 = arith.constant 1 : i32
%601 = arith.extsi %599 : i32 to i64
%600 = arith.subi %598, %601 : i64
%602 = arith.extsi %597 : i32 to i64
%603 = llvm.getelementptr %265[%600] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %602, %603 : i64, !llvm.ptr
%604 = llvm.load %458 : !llvm.ptr -> i64
%605 = llvm.getelementptr %260[%303] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %604, %605 : i64, !llvm.ptr
cf.br ^bb107
^bb106:
%606 = arith.constant 0 : i32
%608 = arith.extsi %606 : i32 to i64
%607 = arith.cmpi sgt, %407, %608 : i64
%609 = scf.if %607 -> (i1) {
%610 = llvm.load %412 : !llvm.ptr -> i64
%611 = arith.constant 0 : i32
%613 = arith.extsi %611 : i32 to i64
%612 = arith.cmpi sgt, %610, %613 : i64
scf.yield %612 : i1
} else {
%614 = arith.constant false
scf.yield %614 : i1
}
%615 = scf.if %609 -> (i1) {
%616 = llvm.load %412 : !llvm.ptr -> i64
%617 = arith.cmpi ne, %407, %616 : i64
scf.yield %617 : i1
} else {
%618 = arith.constant false
scf.yield %618 : i1
}
cf.cond_br %615, ^bb108, ^bb109
^bb108:
%619 = llvm.mlir.constant(1 : i64) : i64
%620 = llvm.alloca %619 x i64 : (i64) -> !llvm.ptr
llvm.store %407, %620 : i64, !llvm.ptr
%621 = llvm.load %412 : !llvm.ptr -> i64
%622 = llvm.mlir.constant(1 : i64) : i64
%623 = llvm.alloca %622 x i64 : (i64) -> !llvm.ptr
llvm.store %621, %623 : i64, !llvm.ptr
%624 = llvm.load %620 : !llvm.ptr -> i64
%625 = llvm.load %623 : !llvm.ptr -> i64
%626 = arith.cmpi sgt, %624, %625 : i64
cf.cond_br %626, ^bb111, ^bb112
^bb111:
%627 = llvm.load %412 : !llvm.ptr -> i64
llvm.store %627, %620 : i64, !llvm.ptr
llvm.store %407, %623 : i64, !llvm.ptr
cf.br ^bb113
^bb112:
cf.br ^bb113
^bb113:
%629 = llvm.load %620 : !llvm.ptr -> i64
%630 = arith.constant 1 : i32
%632 = arith.extsi %630 : i32 to i64
%631 = arith.subi %629, %632 : i64
%633 = llvm.getelementptr %265[%631] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%628 = llvm.load %633 : !llvm.ptr -> i64
%635 = llvm.load %623 : !llvm.ptr -> i64
%636 = arith.constant 1 : i32
%638 = arith.extsi %636 : i32 to i64
%637 = arith.subi %635, %638 : i64
%639 = llvm.getelementptr %265[%637] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%634 = llvm.load %639 : !llvm.ptr -> i64
%640 = arith.addi %628, %634 : i64
%641 = arith.constant 1 : i32
%643 = arith.extsi %641 : i32 to i64
%642 = arith.addi %640, %643 : i64
%644 = llvm.load %620 : !llvm.ptr -> i64
%645 = arith.constant 1 : i32
%647 = arith.extsi %645 : i32 to i64
%646 = arith.subi %644, %647 : i64
%648 = llvm.getelementptr %265[%646] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %642, %648 : i64, !llvm.ptr
%649 = llvm.load %623 : !llvm.ptr -> i64
%650 = arith.constant 1 : i32
%652 = arith.extsi %650 : i32 to i64
%651 = arith.subi %649, %652 : i64
llvm.store %651, %356 : i64, !llvm.ptr
cf.br ^bb114
^bb114:
%653 = llvm.load %356 : !llvm.ptr -> i64
%654 = arith.constant 3 : i32
%656 = arith.extsi %654 : i32 to i64
%655 = arith.cmpi slt, %653, %656 : i64
cf.cond_br %655, ^bb115, ^bb116
^bb115:
%658 = llvm.load %356 : !llvm.ptr -> i64
%659 = arith.constant 1 : i32
%661 = arith.extsi %659 : i32 to i64
%660 = arith.addi %658, %661 : i64
%662 = llvm.getelementptr %265[%660] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%657 = llvm.load %662 : !llvm.ptr -> i64
%663 = llvm.load %356 : !llvm.ptr -> i64
%664 = llvm.getelementptr %265[%663] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %657, %664 : i64, !llvm.ptr
%665 = llvm.load %356 : !llvm.ptr -> i64
%666 = arith.constant 1 : i32
%668 = arith.extsi %666 : i32 to i64
%667 = arith.addi %665, %668 : i64
llvm.store %667, %356 : i64, !llvm.ptr
cf.br ^bb114
^bb116:
%669 = arith.constant 0 : i32
%670 = arith.constant 3 : i32
%671 = arith.extsi %669 : i32 to i64
%672 = arith.extsi %670 : i32 to i64
%673 = llvm.getelementptr %265[%672] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %671, %673 : i64, !llvm.ptr
%674 = arith.constant 0 : i32
%675 = arith.extsi %674 : i32 to i64
llvm.store %675, %388 : i64, !llvm.ptr
cf.br ^bb117
^bb117:
%676 = llvm.load %388 : !llvm.ptr -> i64
%677 = arith.constant 7 : i32
%679 = arith.extsi %677 : i32 to i64
%678 = arith.cmpi slt, %676, %679 : i64
cf.cond_br %678, ^bb118, ^bb119
^bb118:
%681 = llvm.load %388 : !llvm.ptr -> i64
%682 = llvm.getelementptr %260[%681] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%680 = llvm.load %682 : !llvm.ptr -> i64
%683 = llvm.load %623 : !llvm.ptr -> i64
%684 = arith.cmpi eq, %680, %683 : i64
cf.cond_br %684, ^bb120, ^bb121
^bb120:
%685 = llvm.load %620 : !llvm.ptr -> i64
%686 = llvm.load %388 : !llvm.ptr -> i64
%687 = llvm.getelementptr %260[%686] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %685, %687 : i64, !llvm.ptr
cf.br ^bb122
^bb121:
%689 = llvm.load %388 : !llvm.ptr -> i64
%690 = llvm.getelementptr %260[%689] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%688 = llvm.load %690 : !llvm.ptr -> i64
%691 = llvm.load %623 : !llvm.ptr -> i64
%692 = arith.cmpi sgt, %688, %691 : i64
cf.cond_br %692, ^bb123, ^bb124
^bb123:
%694 = llvm.load %388 : !llvm.ptr -> i64
%695 = llvm.getelementptr %260[%694] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%693 = llvm.load %695 : !llvm.ptr -> i64
%696 = arith.constant 1 : i32
%698 = arith.extsi %696 : i32 to i64
%697 = arith.subi %693, %698 : i64
%699 = llvm.load %388 : !llvm.ptr -> i64
%700 = llvm.getelementptr %260[%699] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %697, %700 : i64, !llvm.ptr
cf.br ^bb125
^bb124:
cf.br ^bb125
^bb125:
cf.br ^bb122
^bb122:
%701 = llvm.load %388 : !llvm.ptr -> i64
%702 = arith.constant 1 : i32
%704 = arith.extsi %702 : i32 to i64
%703 = arith.addi %701, %704 : i64
llvm.store %703, %388 : i64, !llvm.ptr
cf.br ^bb117
^bb119:
%705 = llvm.load %620 : !llvm.ptr -> i64
%706 = llvm.getelementptr %260[%303] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %705, %706 : i64, !llvm.ptr
%707 = llvm.load %458 : !llvm.ptr -> i64
%708 = arith.constant 1 : i32
%710 = arith.extsi %708 : i32 to i64
%709 = arith.subi %707, %710 : i64
llvm.store %709, %458 : i64, !llvm.ptr
cf.br ^bb110
^bb109:
%711 = llvm.mlir.constant(1 : i64) : i64
%712 = llvm.alloca %711 x i64 : (i64) -> !llvm.ptr
llvm.store %407, %712 : i64, !llvm.ptr
%713 = llvm.load %712 : !llvm.ptr -> i64
%714 = arith.constant 0 : i32
%716 = arith.extsi %714 : i32 to i64
%715 = arith.cmpi eq, %713, %716 : i64
cf.cond_br %715, ^bb126, ^bb127
^bb126:
%717 = llvm.load %412 : !llvm.ptr -> i64
llvm.store %717, %712 : i64, !llvm.ptr
cf.br ^bb128
^bb127:
cf.br ^bb128
^bb128:
%719 = llvm.load %712 : !llvm.ptr -> i64
%720 = arith.constant 1 : i32
%722 = arith.extsi %720 : i32 to i64
%721 = arith.subi %719, %722 : i64
%723 = llvm.getelementptr %265[%721] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%718 = llvm.load %723 : !llvm.ptr -> i64
%724 = arith.constant 1 : i32
%726 = arith.extsi %724 : i32 to i64
%725 = arith.addi %718, %726 : i64
%727 = llvm.load %712 : !llvm.ptr -> i64
%728 = arith.constant 1 : i32
%730 = arith.extsi %728 : i32 to i64
%729 = arith.subi %727, %730 : i64
%731 = llvm.getelementptr %265[%729] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %725, %731 : i64, !llvm.ptr
%732 = llvm.load %712 : !llvm.ptr -> i64
%733 = llvm.getelementptr %260[%303] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %732, %733 : i64, !llvm.ptr
cf.br ^bb110
^bb110:
cf.br ^bb107
^bb107:
%735 = llvm.load %458 : !llvm.ptr -> i64
%736 = llvm.load %244 : !llvm.ptr -> !llvm.ptr
%737 = llvm.load %249 : !llvm.ptr -> !llvm.ptr
func.call @canon_insert(%260, %265, %735, %342, %270, %275, %736, %737, %337) : (!llvm.ptr, !llvm.ptr, i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> ()
cf.br ^bb56
^bb55:
cf.br ^bb56
^bb56:
%738 = llvm.load %307 : !llvm.ptr -> i64
%739 = arith.constant 1 : i32
%741 = arith.extsi %739 : i32 to i64
%740 = arith.addi %738, %741 : i64
llvm.store %740, %307 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
%742 = llvm.load %234 : !llvm.ptr -> !llvm.ptr
%743 = llvm.load %244 : !llvm.ptr -> !llvm.ptr
llvm.store %743, %234 : !llvm.ptr, !llvm.ptr
llvm.store %742, %244 : !llvm.ptr, !llvm.ptr
%744 = llvm.load %239 : !llvm.ptr -> !llvm.ptr
%745 = llvm.load %249 : !llvm.ptr -> !llvm.ptr
llvm.store %745, %239 : !llvm.ptr, !llvm.ptr
llvm.store %744, %249 : !llvm.ptr, !llvm.ptr
%746 = arith.addi %299, %291 : index
cf.br ^bb45(%746 : index)
^bb47(%747: index):
%748 = arith.constant 0 : i32
%749 = arith.extsi %748 : i32 to i64
%750 = llvm.mlir.constant(1 : i64) : i64
%751 = llvm.alloca %750 x i64 : (i64) -> !llvm.ptr
llvm.store %749, %751 : i64, !llvm.ptr
%752 = arith.constant 0 : i32
%753 = arith.extsi %752 : i32 to i64
%754 = llvm.mlir.constant(1 : i64) : i64
%755 = llvm.alloca %754 x i64 : (i64) -> !llvm.ptr
llvm.store %753, %755 : i64, !llvm.ptr
cf.br ^bb129
^bb129:
%756 = llvm.load %755 : !llvm.ptr -> i64
%757 = arith.cmpi slt, %756, %229 : i64
cf.cond_br %757, ^bb130, ^bb131
^bb130:
%759 = llvm.load %234 : !llvm.ptr -> !llvm.ptr
%760 = llvm.load %755 : !llvm.ptr -> i64
%761 = llvm.getelementptr %759[%760] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%758 = llvm.load %761 : !llvm.ptr -> i64
%762 = arith.constant 0 : i32
%764 = arith.extsi %762 : i32 to i64
%763 = arith.cmpi ne, %758, %764 : i64
cf.cond_br %763, ^bb132, ^bb133
^bb132:
%766 = llvm.load %234 : !llvm.ptr -> !llvm.ptr
%767 = llvm.load %755 : !llvm.ptr -> i64
%768 = llvm.getelementptr %766[%767] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%765 = llvm.load %768 : !llvm.ptr -> i64
%769 = arith.constant 1 : i32
%771 = arith.extsi %769 : i32 to i64
%770 = arith.subi %765, %771 : i64
%773 = llvm.load %239 : !llvm.ptr -> !llvm.ptr
%774 = llvm.load %755 : !llvm.ptr -> i64
%775 = llvm.getelementptr %773[%774] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%772 = llvm.load %775 : !llvm.ptr -> i64
%776 = arith.constant 64 : i32
%778 = arith.extsi %776 : i32 to i64
%777 = arith.remsi %770, %778 : i64
%779 = llvm.mlir.constant(1 : i64) : i64
%780 = llvm.alloca %779 x i64 : (i64) -> !llvm.ptr
llvm.store %777, %780 : i64, !llvm.ptr
%781 = arith.constant 64 : i32
%783 = arith.extsi %781 : i32 to i64
%782 = arith.divsi %770, %783 : i64
%784 = llvm.mlir.constant(1 : i64) : i64
%785 = llvm.alloca %784 x i64 : (i64) -> !llvm.ptr
llvm.store %782, %785 : i64, !llvm.ptr
%786 = arith.constant 0 : i32
%787 = arith.extsi %786 : i32 to i64
%788 = llvm.mlir.constant(1 : i64) : i64
%789 = llvm.alloca %788 x i64 : (i64) -> !llvm.ptr
llvm.store %787, %789 : i64, !llvm.ptr
cf.br ^bb135
^bb135:
%790 = llvm.load %789 : !llvm.ptr -> i64
%791 = arith.constant 4 : i32
%793 = arith.extsi %791 : i32 to i64
%792 = arith.cmpi slt, %790, %793 : i64
cf.cond_br %792, ^bb136, ^bb137
^bb136:
%794 = llvm.load %785 : !llvm.ptr -> i64
%795 = arith.constant 64 : i32
%797 = arith.extsi %795 : i32 to i64
%796 = arith.remsi %794, %797 : i64
%798 = llvm.load %780 : !llvm.ptr -> i64
%799 = arith.cmpi sgt, %796, %798 : i64
cf.cond_br %799, ^bb138, ^bb139
^bb138:
llvm.store %796, %780 : i64, !llvm.ptr
cf.br ^bb140
^bb139:
cf.br ^bb140
^bb140:
%800 = llvm.load %785 : !llvm.ptr -> i64
%801 = arith.constant 64 : i32
%803 = arith.extsi %801 : i32 to i64
%802 = arith.divsi %800, %803 : i64
llvm.store %802, %785 : i64, !llvm.ptr
%804 = llvm.load %789 : !llvm.ptr -> i64
%805 = arith.constant 1 : i32
%807 = arith.extsi %805 : i32 to i64
%806 = arith.addi %804, %807 : i64
llvm.store %806, %789 : i64, !llvm.ptr
cf.br ^bb135
^bb137:
%808 = llvm.load %751 : !llvm.ptr -> i64
%809 = llvm.load %780 : !llvm.ptr -> i64
%810 = arith.muli %809, %772 : i64
%811 = arith.addi %808, %810 : i64
llvm.store %811, %751 : i64, !llvm.ptr
cf.br ^bb134
^bb133:
cf.br ^bb134
^bb134:
%812 = llvm.load %755 : !llvm.ptr -> i64
%813 = arith.constant 1 : i32
%815 = arith.extsi %813 : i32 to i64
%814 = arith.addi %812, %815 : i64
llvm.store %814, %755 : i64, !llvm.ptr
cf.br ^bb129
^bb131:
%816 = arith.constant 1.0 : f32
%817 = arith.extf %816 : f32 to f64
%818 = llvm.mlir.constant(1 : i64) : i64
%819 = llvm.alloca %818 x f64 : (i64) -> !llvm.ptr
llvm.store %817, %819 : f64, !llvm.ptr
%820 = arith.constant 0 : i32
%821 = arith.extsi %820 : i32 to i64
%822 = llvm.mlir.constant(1 : i64) : i64
%823 = llvm.alloca %822 x i64 : (i64) -> !llvm.ptr
llvm.store %821, %823 : i64, !llvm.ptr
cf.br ^bb141
^bb141:
%824 = llvm.load %823 : !llvm.ptr -> i64
%825 = arith.cmpi slt, %824, %287 : i64
cf.cond_br %825, ^bb142, ^bb143
^bb142:
%826 = llvm.load %819 : !llvm.ptr -> f64
%827 = arith.constant 2.0 : f32
%829 = arith.extf %827 : f32 to f64
%828 = arith.mulf %826, %829 : f64
llvm.store %828, %819 : f64, !llvm.ptr
%830 = llvm.load %823 : !llvm.ptr -> i64
%831 = arith.constant 1 : i32
%833 = arith.extsi %831 : i32 to i64
%832 = arith.addi %830, %833 : i64
llvm.store %832, %823 : i64, !llvm.ptr
cf.br ^bb141
^bb143:
%835 = llvm.load %234 : !llvm.ptr -> !llvm.ptr
func.call @free(%835) : (!llvm.ptr) -> ()
%837 = llvm.load %239 : !llvm.ptr -> !llvm.ptr
func.call @free(%837) : (!llvm.ptr) -> ()
%839 = llvm.load %244 : !llvm.ptr -> !llvm.ptr
func.call @free(%839) : (!llvm.ptr) -> ()
%841 = llvm.load %249 : !llvm.ptr -> !llvm.ptr
func.call @free(%841) : (!llvm.ptr) -> ()
func.call @free(%250) : (!llvm.ptr) -> ()
func.call @free(%255) : (!llvm.ptr) -> ()
func.call @free(%260) : (!llvm.ptr) -> ()
func.call @free(%265) : (!llvm.ptr) -> ()
func.call @free(%270) : (!llvm.ptr) -> ()
func.call @free(%275) : (!llvm.ptr) -> ()
%848 = llvm.load %751 : !llvm.ptr -> i64
%849 = arith.sitofp %848 : i64 to f64
%850 = llvm.load %819 : !llvm.ptr -> f64
%851 = arith.divf %849, %850 : f64
func.return %851 : f64
}
func.func @main() -> i32 {
%852 = llvm.mlir.addressof @str_0 : !llvm.ptr
%854 = arith.constant 7 : i32
%855 = arith.constant 7 : i32
%856 = arith.extsi %854 : i32 to i64
%857 = arith.extsi %855 : i32 to i64
%853 = func.call @solve(%856, %857) : (i64, i64) -> f64
%858 = llvm.call @printf(%852, %853) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
%859 = arith.constant 0 : i32
func.return %859 : i32
}
}