← All problems
Problem 983
Parity family of circles on lattice points. Find minimum radius^2 m for k=10 vectors giving 512 circles, 512 harmony points. Port of the C reference solver to pure Flow.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^2)O(n^2)
Space complexity O(n^2)O(n^2)
Approach Flow solution Combinatorial or DP counting
Verdict Optimal
Flow source
# Project Euler 983
# Parity family of circles on lattice points.
# Find minimum radius^2 m for k=10 vectors giving 512 circles, 512 harmony points.
# Port of the C reference solver to pure Flow.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function malloc(n: i64) -> ptr<void>
function sqrt(x: f64) -> f64
function fabs(x: f64) -> f64
}
function encode(x: i64, y: i64) -> i64 {
return ((x + 100000) << 32) | ((y + 100000) & 4294967295)
}
function iabs(x: i64) -> i64 {
if x < 0 { return -x }
return x
}
# --- HashSet (open addressing, linear probing) ---
let mut hs_keys: ptr<i64> = null
let mut hs_used: ptr<i64> = null
let mut hs_cap: i64 = 0
let mut hs_count: i64 = 0
function hash_ll(key: i64, cap: i64) -> i64 {
let mut h: i64 = key % cap
if h < 0 { h = h + cap }
return h
}
function hs_init(cap: i64) -> void {
hs_cap = cap
hs_count = 0
hs_keys = calloc(cap, 8) as ptr<i64>
hs_used = calloc(cap, 8) as ptr<i64>
}
function hs_free() -> void {
free(hs_keys as ptr<void>)
free(hs_used as ptr<void>)
hs_keys = null
hs_used = null
hs_cap = 0
hs_count = 0
}
function hs_insert(key: i64) -> void {
if hs_count * 2 > hs_cap {
let old_cap: i64 = hs_cap
let old_keys: ptr<i64> = hs_keys
let old_used: ptr<i64> = hs_used
hs_cap = old_cap * 2
hs_keys = calloc(hs_cap, 8) as ptr<i64>
hs_used = calloc(hs_cap, 8) as ptr<i64>
hs_count = 0
let mut i: i64 = 0
while i < old_cap {
if old_used[i] != 0 {
let mut h: i64 = hash_ll(old_keys[i], hs_cap)
while hs_used[h] != 0 { h = (h + 1) % hs_cap }
hs_keys[h] = old_keys[i]
hs_used[h] = 1
hs_count = hs_count + 1
}
i = i + 1
}
free(old_keys as ptr<void>)
free(old_used as ptr<void>)
}
let mut h: i64 = hash_ll(key, hs_cap)
while hs_used[h] != 0 {
if hs_keys[h] == key { return }
h = (h + 1) % hs_cap
}
hs_keys[h] = key
hs_used[h] = 1
hs_count = hs_count + 1
}
function hs_contains(key: i64) -> i64 {
let mut h: i64 = hash_ll(key, hs_cap)
while hs_used[h] != 0 {
if hs_keys[h] == key { return 1 }
h = (h + 1) % hs_cap
}
return 0
}
# --- HashMap (long long -> int) ---
let mut hm_keys: ptr<i64> = null
let mut hm_vals: ptr<i64> = null
let mut hm_used: ptr<i64> = null
let mut hm_cap: i64 = 0
function hm_init(cap: i64) -> void {
hm_cap = cap
hm_keys = calloc(cap, 8) as ptr<i64>
hm_vals = calloc(cap, 8) as ptr<i64>
hm_used = calloc(cap, 8) as ptr<i64>
}
function hm_free() -> void {
free(hm_keys as ptr<void>)
free(hm_vals as ptr<void>)
free(hm_used as ptr<void>)
hm_keys = null
hm_vals = null
hm_used = null
hm_cap = 0
}
function hm_get(key: i64) -> i64 {
# returns value if found, -1 if not found
let mut h: i64 = hash_ll(key, hm_cap)
while hm_used[h] != 0 {
if hm_keys[h] == key { return hm_vals[h] }
h = (h + 1) % hm_cap
}
return -1
}
function hm_set(key: i64, val: i64) -> void {
let mut h: i64 = hash_ll(key, hm_cap)
while hm_used[h] != 0 {
if hm_keys[h] == key { hm_vals[h] = val; return }
h = (h + 1) % hm_cap
}
hm_keys[h] = key
hm_vals[h] = val
hm_used[h] = 1
}
function isqrt_int(n: i64) -> i64 {
if n < 0 { return 0 }
let mut r: i64 = sqrt((n as f64)) as i64
while r * r > n { r = r - 1 }
while (r + 1) * (r + 1) <= n { r = r + 1 }
return r
}
function antipodal_pair_count(m: i64) -> i64 {
let mut x: i64 = m
while x % 2 == 0 { x = x / 2 }
let mut product: i64 = 1
let mut p: i64 = 3
while p * p <= x {
if x % p == 0 {
let mut exp: i64 = 0
while x % p == 0 { x = x / p; exp = exp + 1 }
if p % 4 == 1 { product = product * (exp + 1) }
else {
if exp % 2 == 1 { return 0 }
}
}
p = p + 2
}
if x > 1 {
if x % 4 == 1 { product = product * 2 }
else {
if x % 4 == 3 { return 0 }
}
}
return 2 * product
}
const MAXPTS: i64 = 100
# Global circle points
let mut circle_px: ptr<i64> = null
let mut circle_py: ptr<i64> = null
let mut num_circle_points: i64 = 0
# Global pair data
let mut pair_px: ptr<i64> = null
let mut pair_py: ptr<i64> = null
let mut pair_nx: ptr<i64> = null
let mut pair_ny: ptr<i64> = null
let mut num_pairs: i64 = 0
function lattice_points_on_circle(m: i64) -> i64 {
let lim: i64 = isqrt_int(m)
let mut cnt: i64 = 0
let mut x: i64 = -lim
while x <= lim {
let y2: i64 = m - x * x
if y2 >= 0 {
let y: i64 = isqrt_int(y2)
if y * y == y2 {
circle_px[cnt] = x
circle_py[cnt] = y
cnt = cnt + 1
if y != 0 {
circle_px[cnt] = x
circle_py[cnt] = -y
cnt = cnt + 1
}
}
}
x = x + 1
}
return cnt
}
function has_unit_coordinate(npts: i64) -> i64 {
let mut i: i64 = 0
while i < npts {
if iabs(circle_px[i]) == 1 || iabs(circle_py[i]) == 1 { return 1 }
i = i + 1
}
return 0
}
function build_displacement_set() -> void {
hs_init(1024)
let mut i: i64 = 0
while i < num_circle_points {
let mut j: i64 = 0
while j < num_circle_points {
if i != j {
hs_insert(encode(circle_px[i] - circle_px[j], circle_py[i] - circle_py[j]))
}
j = j + 1
}
i = i + 1
}
}
# DFS state
let mut sel_x: ptr<i64> = null
let mut sel_y: ptr<i64> = null
let mut dfs_k: i64 = 0
let mut dfs_n: i64 = 0
let mut dfs_masks: ptr<i64> = null
let mut dfs_nmasks: i64 = 0
function passes_four_vector_prune(sel_len: i64, vx: i64, vy: i64) -> i64 {
if sel_len < 3 { return 1 }
let mut i: i64 = 0
while i < sel_len - 2 {
let ax: i64 = sel_x[i]
let ay: i64 = sel_y[i]
let mut j: i64 = i + 1
while j < sel_len - 1 {
let bx: i64 = sel_x[j]
let by: i64 = sel_y[j]
let mut k: i64 = j + 1
while k < sel_len {
let cx: i64 = sel_x[k]
let cy: i64 = sel_y[k]
let mut sa: i64 = 1
while sa >= -1 {
let x1: i64 = vx + sa * ax
let y1: i64 = vy + sa * ay
let mut sb: i64 = 1
while sb >= -1 {
let x2: i64 = x1 + sb * bx
let y2: i64 = y1 + sb * by
let mut sc: i64 = 1
while sc >= -1 {
let mut x: i64 = x2 + sc * cx
let mut y: i64 = y2 + sc * cy
if (x != 0 || y != 0) && hs_contains(encode(x, y)) { return 0 }
x = x2 - cx
y = y2 - cy
if (x != 0 || y != 0) && hs_contains(encode(x, y)) { return 0 }
sc = sc - 2
}
sb = sb - 2
}
sa = sa - 2
}
k = k + 1
}
j = j + 1
}
i = i + 1
}
return 1
}
function popcount(x: i64) -> i64 {
let mut c: i64 = 0
let mut v: i64 = x
while v != 0 {
c = c + 1
v = v & (v - 1)
}
return c
}
let mut even_masks: ptr<i64> = null
let mut num_even_masks: i64 = 0
function compute_even_masks(k: i64) -> void {
num_even_masks = 0
let mut mask: i64 = 0
while mask < (1 << k) {
if popcount(mask) % 2 == 0 {
even_masks[num_even_masks] = mask
num_even_masks = num_even_masks + 1
}
mask = mask + 1
}
}
function centers_from_vectors(vx: ptr<i64>, vy: ptr<i64>, k: i64, masks: ptr<i64>, nmasks: i64, cx: ptr<i64>, cy: ptr<i64>) -> void {
let mut mi: i64 = 0
while mi < nmasks {
let mask: i64 = masks[mi]
let mut x: i64 = 0
let mut y: i64 = 0
let mut i: i64 = 0
while i < k {
if (mask & (1 << i)) != 0 { x = x + vx[i]; y = y + vy[i] }
i = i + 1
}
cx[mi] = x
cy[mi] = y
mi = mi + 1
}
}
function quick_harmony_count_equals_n(ncen: i64, cx: ptr<i64>, cy: ptr<i64>, n: i64) -> i64 {
hm_init(16384)
let mut harmony: i64 = 0
let mut ci: i64 = 0
while ci < ncen {
let mut vi: i64 = 0
while vi < num_circle_points {
let key: i64 = encode(cx[ci] + circle_px[vi], cy[ci] + circle_py[vi])
let cur: i64 = hm_get(key)
if cur == -1 {
hm_set(key, 1)
} else {
if cur == 1 {
hm_set(key, 2)
harmony = harmony + 1
if harmony > n { hm_free(); return 0 }
} else {
hm_set(key, cur + 1)
}
}
vi = vi + 1
}
ci = ci + 1
}
hm_free()
if harmony == n { return 1 }
return 0
}
# Union-Find
let mut uf_parent: ptr<i64> = null
let mut uf_size: ptr<i64> = null
function uf_find(x: i64) -> i64 {
let mut xx: i64 = x
while uf_parent[xx] != xx {
uf_parent[xx] = uf_parent[uf_parent[xx]]
xx = uf_parent[xx]
}
return xx
}
function uf_union(a: i64, b: i64) -> void {
let ra: i64 = uf_find(a)
let rb: i64 = uf_find(b)
if ra == rb { return }
let mut r1: i64 = ra
let mut r2: i64 = rb
if uf_size[r1] < uf_size[r2] { r1 = rb; r2 = ra }
uf_parent[r2] = r1
uf_size[r1] = uf_size[r1] + uf_size[r2]
}
function strict_perfect_check(ncen: i64, cx: ptr<i64>, cy: ptr<i64>, n: i64) -> i64 {
# Check no tangent circle pairs
hs_init(1024)
let mut i: i64 = 0
while i < ncen {
hs_insert(encode(cx[i], cy[i]))
i = i + 1
}
i = 0
while i < ncen {
let mut vi: i64 = 0
while vi < num_circle_points {
let other: i64 = encode(cx[i] + 2 * circle_px[vi], cy[i] + 2 * circle_py[vi])
if hs_contains(other) != 0 {
let ci_enc: i64 = encode(cx[i], cy[i])
if ci_enc < other {
hs_free()
return 0
}
}
vi = vi + 1
}
i = i + 1
}
hs_free()
# Build linked list of centers per point
let total_entries: i64 = ncen * num_circle_points
let link_next: ptr<i64> = calloc(total_entries, 8) as ptr<i64>
let link_center: ptr<i64> = calloc(total_entries, 8) as ptr<i64>
let link_key: ptr<i64> = calloc(total_entries, 8) as ptr<i64>
hm_init(16384)
let mut link_count: i64 = 0
let mut ci: i64 = 0
while ci < ncen {
let mut vi: i64 = 0
while vi < num_circle_points {
let key: i64 = encode(cx[ci] + circle_px[vi], cy[ci] + circle_py[vi])
let head: i64 = hm_get(key)
if head == -1 {
link_key[link_count] = key
link_center[link_count] = ci
link_next[link_count] = -1
hm_set(key, link_count)
link_count = link_count + 1
} else {
link_key[link_count] = key
link_center[link_count] = ci
link_next[link_count] = head
hm_set(key, link_count)
link_count = link_count + 1
}
vi = vi + 1
}
ci = ci + 1
}
# Init union-find
let mut ii: i64 = 0
while ii < n {
uf_parent[ii] = ii
uf_size[ii] = 1
ii = ii + 1
}
let mut harmony: i64 = 0
let mut h: i64 = 0
while h < hm_cap {
if hm_used[h] != 0 {
let key: i64 = hm_keys[h]
let head: i64 = hm_vals[h]
let mut count: i64 = 0
let mut idx2: i64 = head
while idx2 != -1 {
count = count + 1
idx2 = link_next[idx2]
}
if count >= 2 {
harmony = harmony + 1
idx2 = head
let base: i64 = link_center[idx2]
idx2 = link_next[idx2]
while idx2 != -1 {
uf_union(base, link_center[idx2])
idx2 = link_next[idx2]
}
}
}
h = h + 1
}
free(link_next as ptr<void>)
free(link_center as ptr<void>)
free(link_key as ptr<void>)
hm_free()
if harmony != n { return 0 }
# Check all circles connected
let root: i64 = uf_find(0)
let mut i3: i64 = 1
while i3 < n {
if uf_find(i3) != root { return 0 }
i3 = i3 + 1
}
return 1
}
function dfs(start: i64, sel_len: i64) -> i64 {
if sel_len == dfs_k {
let cx: ptr<i64> = calloc(1024, 8) as ptr<i64>
let cy: ptr<i64> = calloc(1024, 8) as ptr<i64>
centers_from_vectors(sel_x, sel_y, dfs_k, dfs_masks, dfs_nmasks, cx, cy)
let ok1: i64 = quick_harmony_count_equals_n(dfs_nmasks, cx, cy, dfs_n)
let mut result: i64 = 0
if ok1 != 0 {
result = strict_perfect_check(dfs_nmasks, cx, cy, dfs_n)
}
free(cx as ptr<void>)
free(cy as ptr<void>)
return result
}
let needed: i64 = dfs_k - sel_len
let mut pi: i64 = start
while pi < num_pairs - needed + 1 {
let n_choices: i64 = 0
if sel_len == 0 { n_choices = 1 } else { n_choices = 2 }
let mut ci: i64 = 0
while ci < n_choices {
let mut vx: i64 = 0
let mut vy: i64 = 0
if ci == 0 { vx = pair_px[pi]; vy = pair_py[pi] }
else { vx = pair_nx[pi]; vy = pair_ny[pi] }
if passes_four_vector_prune(sel_len, vx, vy) != 0 {
sel_x[sel_len] = vx
sel_y[sel_len] = vy
if dfs(pi + 1, sel_len + 1) != 0 { return 1 }
}
ci = ci + 1
}
pi = pi + 1
}
return 0
}
function has_valid_oriented_vectors(k: i64, n: i64) -> i64 {
dfs_k = k
dfs_n = n
compute_even_masks(k)
dfs_nmasks = num_even_masks
let mut i: i64 = 0
while i < num_even_masks {
dfs_masks[i] = even_masks[i]
i = i + 1
}
return dfs(0, 0)
}
# Sort points by (x, y) ascending. Selection sort on sorted_pts arrays.
function sort_points(npts: i64, sx: ptr<i64>, sy: ptr<i64>) -> void {
let mut i: i64 = 0
while i < npts {
let mut best: i64 = i
let mut j: i64 = i + 1
while j < npts {
if sx[j] < sx[best] || (sx[j] == sx[best] && sy[j] < sy[best]) {
best = j
}
j = j + 1
}
if best != i {
let tx: i64 = sx[i]
let ty: i64 = sy[i]
sx[i] = sx[best]
sy[i] = sy[best]
sx[best] = tx
sy[best] = ty
}
i = i + 1
}
}
function find_min_radius_sq(k: i64, m_limit: i64, filtered: i64) -> i64 {
let n: i64 = 1 << (k - 1)
let mut m: i64 = 1
while m <= m_limit {
let p: i64 = antipodal_pair_count(m)
if p < k { m = m + 1 } else {
let mut skip: i64 = 0
if filtered != 0 {
if p != k && p != k + 2 { skip = 1 }
}
if skip != 0 { m = m + 1 } else {
num_circle_points = lattice_points_on_circle(m)
let mut skip2: i64 = 0
if filtered != 0 {
if has_unit_coordinate(num_circle_points) == 0 { skip2 = 1 }
}
if skip2 != 0 { m = m + 1 } else {
# Sort points
let sx: ptr<i64> = calloc(MAXPTS, 8) as ptr<i64>
let sy: ptr<i64> = calloc(MAXPTS, 8) as ptr<i64>
let mut i: i64 = 0
while i < num_circle_points {
sx[i] = circle_px[i]
sy[i] = circle_py[i]
i = i + 1
}
sort_points(num_circle_points, sx, sy)
# Group into antipodal pairs
let used: ptr<i64> = calloc(MAXPTS, 8) as ptr<i64>
num_pairs = 0
i = 0
while i < num_circle_points {
if used[i] != 0 { i = i + 1 } else {
let nx: i64 = -sx[i]
let ny: i64 = -sy[i]
# Binary search for negation
let mut lo: i64 = 0
let mut hi: i64 = num_circle_points - 1
let mut found: i64 = -1
while lo <= hi {
let mid: i64 = (lo + hi) / 2
if sx[mid] < nx || (sx[mid] == nx && sy[mid] < ny) {
lo = mid + 1
} else {
if sx[mid] > nx || (sx[mid] == nx && sy[mid] > ny) {
hi = mid - 1
} else {
found = mid
lo = hi + 1
}
}
}
if found == -1 {
i = i + 1
} else {
used[i] = 1
used[found] = 1
pair_px[num_pairs] = sx[i]
pair_py[num_pairs] = sy[i]
pair_nx[num_pairs] = nx
pair_ny[num_pairs] = ny
num_pairs = num_pairs + 1
i = i + 1
}
}
}
free(sx as ptr<void>)
free(sy as ptr<void>)
free(used as ptr<void>)
if num_pairs != p { m = m + 1 } else {
build_displacement_set()
if has_valid_oriented_vectors(k, n) != 0 {
hs_free()
return m
}
hs_free()
m = m + 1
}
}
}
}
}
return -1
}
function main() -> i32 {
circle_px = calloc(MAXPTS, 8) as ptr<i64>
circle_py = calloc(MAXPTS, 8) as ptr<i64>
pair_px = calloc(MAXPTS, 8) as ptr<i64>
pair_py = calloc(MAXPTS, 8) as ptr<i64>
pair_nx = calloc(MAXPTS, 8) as ptr<i64>
pair_ny = calloc(MAXPTS, 8) as ptr<i64>
sel_x = calloc(16, 8) as ptr<i64>
sel_y = calloc(16, 8) as ptr<i64>
even_masks = calloc(1024, 8) as ptr<i64>
dfs_masks = calloc(1024, 8) as ptr<i64>
uf_parent = calloc(1024, 8) as ptr<i64>
uf_size = calloc(1024, 8) as ptr<i64>
printf("%lld\n", find_min_radius_sq(10, 20000, 1))
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 encode_i64_i64(int64_t x, int64_t y);
int64_t iabs_i64(int64_t x);
int64_t hash_ll_i64_i64(int64_t key, int64_t cap);
void hs_init_i64(int64_t cap);
void hs_free(void);
void hs_insert_i64(int64_t key);
int64_t hs_contains_i64(int64_t key);
void hm_init_i64(int64_t cap);
void hm_free(void);
int64_t hm_get_i64(int64_t key);
void hm_set_i64_i64(int64_t key, int64_t val);
int64_t isqrt_int_i64(int64_t n);
int64_t antipodal_pair_count_i64(int64_t m);
int64_t lattice_points_on_circle_i64(int64_t m);
int64_t has_unit_coordinate_i64(int64_t npts);
void build_displacement_set(void);
int64_t passes_four_vector_prune_i64_i64_i64(int64_t sel_len, int64_t vx, int64_t vy);
int64_t popcount_i64(int64_t x);
void compute_even_masks_i64(int64_t k);
void centers_from_vectors_ptr_i64_ptr_i64_i64_ptr_i64_i64_ptr_i64_ptr_i64(int64_t* vx, int64_t* vy, int64_t k, int64_t* masks, int64_t nmasks, int64_t* cx, int64_t* cy);
int64_t quick_harmony_count_equals_n_i64_ptr_i64_ptr_i64_i64(int64_t ncen, int64_t* cx, int64_t* cy, int64_t n);
int64_t uf_find_i64(int64_t x);
void uf_union_i64_i64(int64_t a, int64_t b);
int64_t strict_perfect_check_i64_ptr_i64_ptr_i64_i64(int64_t ncen, int64_t* cx, int64_t* cy, int64_t n);
int64_t dfs_i64_i64(int64_t start, int64_t sel_len);
int64_t has_valid_oriented_vectors_i64_i64(int64_t k, int64_t n);
void sort_points_i64_ptr_i64_ptr_i64(int64_t npts, int64_t* sx, int64_t* sy);
int64_t find_min_radius_sq_i64_i64_i64(int64_t k, int64_t m_limit, int64_t filtered);
int32_t main(void);
static const int64_t MAXPTS = 100;
/* Module statics */
static int64_t* hs_keys = NULL;
static int64_t* hs_used = NULL;
static int64_t hs_cap = 0;
static int64_t hs_count = 0;
static int64_t* hm_keys = NULL;
static int64_t* hm_vals = NULL;
static int64_t* hm_used = NULL;
static int64_t hm_cap = 0;
static int64_t* circle_px = NULL;
static int64_t* circle_py = NULL;
static int64_t num_circle_points = 0;
static int64_t* pair_px = NULL;
static int64_t* pair_py = NULL;
static int64_t* pair_nx = NULL;
static int64_t* pair_ny = NULL;
static int64_t num_pairs = 0;
static int64_t* sel_x = NULL;
static int64_t* sel_y = NULL;
static int64_t dfs_k = 0;
static int64_t dfs_n = 0;
static int64_t* dfs_masks = NULL;
static int64_t dfs_nmasks = 0;
static int64_t* even_masks = NULL;
static int64_t num_even_masks = 0;
static int64_t* uf_parent = NULL;
static int64_t* uf_size = NULL;
int64_t encode_i64_i64(int64_t x, int64_t y) {
return (FLOW_CHECKED_SHL(((x + 100000)), (32)) | ((y + 100000) & 4294967295));
}
int64_t iabs_i64(int64_t x) {
if (x < 0) {
return (-x);
}
return x;
}
int64_t hash_ll_i64_i64(int64_t key, int64_t cap) {
int64_t h = FLOW_CHECKED_MOD((key), (cap));
if (h < 0) {
h = (h + cap);
}
return h;
}
void hs_init_i64(int64_t cap) {
hs_cap = cap;
hs_count = 0;
hs_keys = ((int64_t*)(calloc(cap, 8)));
hs_used = ((int64_t*)(calloc(cap, 8)));
}
void hs_free(void) {
free(((void*)(hs_keys)));
free(((void*)(hs_used)));
hs_keys = NULL;
hs_used = NULL;
hs_cap = 0;
hs_count = 0;
}
void hs_insert_i64(int64_t key) {
if ((hs_count * 2) > hs_cap) {
int64_t old_cap = hs_cap;
int64_t* old_keys = (int64_t*)(hs_keys);
int64_t* old_used = (int64_t*)(hs_used);
hs_cap = (old_cap * 2);
hs_keys = ((int64_t*)(calloc(hs_cap, 8)));
hs_used = ((int64_t*)(calloc(hs_cap, 8)));
hs_count = 0;
int64_t i = 0;
while (i < old_cap) {
if (old_used[i] != 0) {
int64_t h = hash_ll_i64_i64(old_keys[i], hs_cap);
while (hs_used[h] != 0) {
h = FLOW_CHECKED_MOD(((h + 1)), (hs_cap));
}
hs_keys[h] = old_keys[i];
hs_used[h] = 1;
hs_count = (hs_count + 1);
}
i = (i + 1);
}
free(((void*)(old_keys)));
free(((void*)(old_used)));
}
int64_t h = hash_ll_i64_i64(key, hs_cap);
while (hs_used[h] != 0) {
if (hs_keys[h] == key) {
return;
}
h = FLOW_CHECKED_MOD(((h + 1)), (hs_cap));
}
hs_keys[h] = key;
hs_used[h] = 1;
hs_count = (hs_count + 1);
}
int64_t hs_contains_i64(int64_t key) {
int64_t h = hash_ll_i64_i64(key, hs_cap);
while (hs_used[h] != 0) {
if (hs_keys[h] == key) {
return 1;
}
h = FLOW_CHECKED_MOD(((h + 1)), (hs_cap));
}
return 0;
}
void hm_init_i64(int64_t cap) {
hm_cap = cap;
hm_keys = ((int64_t*)(calloc(cap, 8)));
hm_vals = ((int64_t*)(calloc(cap, 8)));
hm_used = ((int64_t*)(calloc(cap, 8)));
}
void hm_free(void) {
free(((void*)(hm_keys)));
free(((void*)(hm_vals)));
free(((void*)(hm_used)));
hm_keys = NULL;
hm_vals = NULL;
hm_used = NULL;
hm_cap = 0;
}
int64_t hm_get_i64(int64_t key) {
int64_t h = hash_ll_i64_i64(key, hm_cap);
while (hm_used[h] != 0) {
if (hm_keys[h] == key) {
return hm_vals[h];
}
h = FLOW_CHECKED_MOD(((h + 1)), (hm_cap));
}
return (-1);
}
void hm_set_i64_i64(int64_t key, int64_t val) {
int64_t h = hash_ll_i64_i64(key, hm_cap);
while (hm_used[h] != 0) {
if (hm_keys[h] == key) {
hm_vals[h] = val;
return;
}
h = FLOW_CHECKED_MOD(((h + 1)), (hm_cap));
}
hm_keys[h] = key;
hm_vals[h] = val;
hm_used[h] = 1;
}
int64_t isqrt_int_i64(int64_t n) {
if (n < 0) {
return 0;
}
int64_t r = ((int64_t)(sqrt(((double)(n)))));
while ((r * r) > n) {
r = (r - 1);
}
while (((r + 1) * (r + 1)) <= n) {
r = (r + 1);
}
return r;
}
int64_t antipodal_pair_count_i64(int64_t m) {
int64_t x = m;
while (FLOW_CHECKED_MOD((x), (2)) == 0) {
x = FLOW_CHECKED_DIV((x), (2));
}
int64_t product = 1;
int64_t p = 3;
while ((p * p) <= x) {
if (FLOW_CHECKED_MOD((x), (p)) == 0) {
int64_t exp = 0;
while (FLOW_CHECKED_MOD((x), (p)) == 0) {
x = FLOW_CHECKED_DIV((x), (p));
exp = (exp + 1);
}
if (FLOW_CHECKED_MOD((p), (4)) == 1) {
product = (product * (exp + 1));
} else {
if (FLOW_CHECKED_MOD((exp), (2)) == 1) {
return 0;
}
}
}
p = (p + 2);
}
if (x > 1) {
if (FLOW_CHECKED_MOD((x), (4)) == 1) {
product = (product * 2);
} else {
if (FLOW_CHECKED_MOD((x), (4)) == 3) {
return 0;
}
}
}
return (2 * product);
}
int64_t lattice_points_on_circle_i64(int64_t m) {
int64_t lim = isqrt_int_i64(m);
int64_t cnt = 0;
int64_t x = (-lim);
while (x <= lim) {
int64_t y2 = (m - (x * x));
if (y2 >= 0) {
int64_t y = isqrt_int_i64(y2);
if ((y * y) == y2) {
circle_px[cnt] = x;
circle_py[cnt] = y;
cnt = (cnt + 1);
if (y != 0) {
circle_px[cnt] = x;
circle_py[cnt] = (-y);
cnt = (cnt + 1);
}
}
}
x = (x + 1);
}
return cnt;
}
int64_t has_unit_coordinate_i64(int64_t npts) {
int64_t i = 0;
while (i < npts) {
if ((iabs_i64(circle_px[i]) == 1 || iabs_i64(circle_py[i]) == 1)) {
return 1;
}
i = (i + 1);
}
return 0;
}
void build_displacement_set(void) {
hs_init_i64(1024);
int64_t i = 0;
while (i < num_circle_points) {
int64_t j = 0;
while (j < num_circle_points) {
if (i != j) {
hs_insert_i64(encode_i64_i64((circle_px[i] - circle_px[j]), (circle_py[i] - circle_py[j])));
}
j = (j + 1);
}
i = (i + 1);
}
}
int64_t passes_four_vector_prune_i64_i64_i64(int64_t sel_len, int64_t vx, int64_t vy) {
if (sel_len < 3) {
return 1;
}
int64_t i = 0;
while (i < (sel_len - 2)) {
int64_t ax = sel_x[i];
int64_t ay = sel_y[i];
int64_t j = (i + 1);
while (j < (sel_len - 1)) {
int64_t bx = sel_x[j];
int64_t by = sel_y[j];
int64_t k = (j + 1);
while (k < sel_len) {
int64_t cx = sel_x[k];
int64_t cy = sel_y[k];
int64_t sa = 1;
while (sa >= (-1)) {
int64_t x1 = (vx + (sa * ax));
int64_t y1 = (vy + (sa * ay));
int64_t sb = 1;
while (sb >= (-1)) {
int64_t x2 = (x1 + (sb * bx));
int64_t y2 = (y1 + (sb * by));
int64_t sc = 1;
while (sc >= (-1)) {
int64_t x = (x2 + (sc * cx));
int64_t y = (y2 + (sc * cy));
if (((x != 0 || y != 0) && hs_contains_i64(encode_i64_i64(x, y)))) {
return 0;
}
x = (x2 - cx);
y = (y2 - cy);
if (((x != 0 || y != 0) && hs_contains_i64(encode_i64_i64(x, y)))) {
return 0;
}
sc = (sc - 2);
}
sb = (sb - 2);
}
sa = (sa - 2);
}
k = (k + 1);
}
j = (j + 1);
}
i = (i + 1);
}
return 1;
}
int64_t popcount_i64(int64_t x) {
int64_t c = 0;
int64_t v = x;
while (v != 0) {
c = (c + 1);
v = (v & (v - 1));
}
return c;
}
void compute_even_masks_i64(int64_t k) {
num_even_masks = 0;
int64_t mask = 0;
while (mask < FLOW_CHECKED_SHL((1), (k))) {
if (FLOW_CHECKED_MOD((popcount_i64(mask)), (2)) == 0) {
even_masks[num_even_masks] = mask;
num_even_masks = (num_even_masks + 1);
}
mask = (mask + 1);
}
}
void centers_from_vectors_ptr_i64_ptr_i64_i64_ptr_i64_i64_ptr_i64_ptr_i64(int64_t* vx, int64_t* vy, int64_t k, int64_t* masks, int64_t nmasks, int64_t* cx, int64_t* cy) {
int64_t mi = 0;
while (mi < nmasks) {
int64_t mask = masks[mi];
int64_t x = 0;
int64_t y = 0;
int64_t i = 0;
while (i < k) {
if ((mask & FLOW_CHECKED_SHL((1), (i))) != 0) {
x = (x + vx[i]);
y = (y + vy[i]);
}
i = (i + 1);
}
cx[mi] = x;
cy[mi] = y;
mi = (mi + 1);
}
}
int64_t quick_harmony_count_equals_n_i64_ptr_i64_ptr_i64_i64(int64_t ncen, int64_t* cx, int64_t* cy, int64_t n) {
hm_init_i64(16384);
int64_t harmony = 0;
int64_t ci = 0;
while (ci < ncen) {
int64_t vi = 0;
while (vi < num_circle_points) {
int64_t key = encode_i64_i64((cx[ci] + circle_px[vi]), (cy[ci] + circle_py[vi]));
int64_t cur = hm_get_i64(key);
if (cur == (-1)) {
hm_set_i64_i64(key, 1);
} else {
if (cur == 1) {
hm_set_i64_i64(key, 2);
harmony = (harmony + 1);
if (harmony > n) {
hm_free();
return 0;
}
} else {
hm_set_i64_i64(key, (cur + 1));
}
}
vi = (vi + 1);
}
ci = (ci + 1);
}
hm_free();
if (harmony == n) {
return 1;
}
return 0;
}
int64_t uf_find_i64(int64_t x) {
int64_t xx = x;
while (uf_parent[xx] != xx) {
uf_parent[xx] = uf_parent[uf_parent[xx]];
xx = uf_parent[xx];
}
return xx;
}
void uf_union_i64_i64(int64_t a, int64_t b) {
int64_t ra = uf_find_i64(a);
int64_t rb = uf_find_i64(b);
if (ra == rb) {
return;
}
int64_t r1 = ra;
int64_t r2 = rb;
if (uf_size[r1] < uf_size[r2]) {
r1 = rb;
r2 = ra;
}
uf_parent[r2] = r1;
uf_size[r1] = (uf_size[r1] + uf_size[r2]);
}
int64_t strict_perfect_check_i64_ptr_i64_ptr_i64_i64(int64_t ncen, int64_t* cx, int64_t* cy, int64_t n) {
hs_init_i64(1024);
int64_t i = 0;
while (i < ncen) {
hs_insert_i64(encode_i64_i64(cx[i], cy[i]));
i = (i + 1);
}
i = 0;
while (i < ncen) {
int64_t vi = 0;
while (vi < num_circle_points) {
int64_t other = encode_i64_i64((cx[i] + (2 * circle_px[vi])), (cy[i] + (2 * circle_py[vi])));
if (hs_contains_i64(other) != 0) {
int64_t ci_enc = encode_i64_i64(cx[i], cy[i]);
if (ci_enc < other) {
hs_free();
return 0;
}
}
vi = (vi + 1);
}
i = (i + 1);
}
hs_free();
int64_t total_entries = (ncen * num_circle_points);
int64_t* link_next = (int64_t*)(((int64_t*)(calloc(total_entries, 8))));
int64_t* link_center = (int64_t*)(((int64_t*)(calloc(total_entries, 8))));
int64_t* link_key = (int64_t*)(((int64_t*)(calloc(total_entries, 8))));
hm_init_i64(16384);
int64_t link_count = 0;
int64_t ci = 0;
while (ci < ncen) {
int64_t vi = 0;
while (vi < num_circle_points) {
int64_t key = encode_i64_i64((cx[ci] + circle_px[vi]), (cy[ci] + circle_py[vi]));
int64_t head = hm_get_i64(key);
if (head == (-1)) {
link_key[link_count] = key;
link_center[link_count] = ci;
link_next[link_count] = (-1);
hm_set_i64_i64(key, link_count);
link_count = (link_count + 1);
} else {
link_key[link_count] = key;
link_center[link_count] = ci;
link_next[link_count] = head;
hm_set_i64_i64(key, link_count);
link_count = (link_count + 1);
}
vi = (vi + 1);
}
ci = (ci + 1);
}
int64_t ii = 0;
while (ii < n) {
uf_parent[ii] = ii;
uf_size[ii] = 1;
ii = (ii + 1);
}
int64_t harmony = 0;
int64_t h = 0;
while (h < hm_cap) {
if (hm_used[h] != 0) {
int64_t key = hm_keys[h];
int64_t head = hm_vals[h];
int64_t count = 0;
int64_t idx2 = head;
while (idx2 != (-1)) {
count = (count + 1);
idx2 = link_next[idx2];
}
if (count >= 2) {
harmony = (harmony + 1);
idx2 = head;
int64_t base = link_center[idx2];
idx2 = link_next[idx2];
while (idx2 != (-1)) {
uf_union_i64_i64(base, link_center[idx2]);
idx2 = link_next[idx2];
}
}
}
h = (h + 1);
}
free(((void*)(link_next)));
free(((void*)(link_center)));
free(((void*)(link_key)));
hm_free();
if (harmony != n) {
return 0;
}
int64_t root = uf_find_i64(0);
int64_t i3 = 1;
while (i3 < n) {
if (uf_find_i64(i3) != root) {
return 0;
}
i3 = (i3 + 1);
}
return 1;
}
int64_t dfs_i64_i64(int64_t start, int64_t sel_len) {
if (sel_len == dfs_k) {
int64_t* cx = (int64_t*)(((int64_t*)(calloc(1024, 8))));
int64_t* cy = (int64_t*)(((int64_t*)(calloc(1024, 8))));
centers_from_vectors_ptr_i64_ptr_i64_i64_ptr_i64_i64_ptr_i64_ptr_i64(sel_x, sel_y, dfs_k, dfs_masks, dfs_nmasks, cx, cy);
int64_t ok1 = quick_harmony_count_equals_n_i64_ptr_i64_ptr_i64_i64(dfs_nmasks, cx, cy, dfs_n);
int64_t result = 0;
if (ok1 != 0) {
result = strict_perfect_check_i64_ptr_i64_ptr_i64_i64(dfs_nmasks, cx, cy, dfs_n);
}
free(((void*)(cx)));
free(((void*)(cy)));
return result;
}
int64_t needed = (dfs_k - sel_len);
int64_t pi = start;
while (pi < ((num_pairs - needed) + 1)) {
int64_t n_choices = 0;
if (sel_len == 0) {
n_choices = 1;
} else {
n_choices = 2;
}
int64_t ci = 0;
while (ci < n_choices) {
int64_t vx = 0;
int64_t vy = 0;
if (ci == 0) {
vx = pair_px[pi];
vy = pair_py[pi];
} else {
vx = pair_nx[pi];
vy = pair_ny[pi];
}
if (passes_four_vector_prune_i64_i64_i64(sel_len, vx, vy) != 0) {
sel_x[sel_len] = vx;
sel_y[sel_len] = vy;
if (dfs_i64_i64((pi + 1), (sel_len + 1)) != 0) {
return 1;
}
}
ci = (ci + 1);
}
pi = (pi + 1);
}
return 0;
}
int64_t has_valid_oriented_vectors_i64_i64(int64_t k, int64_t n) {
dfs_k = k;
dfs_n = n;
compute_even_masks_i64(k);
dfs_nmasks = num_even_masks;
int64_t i = 0;
while (i < num_even_masks) {
dfs_masks[i] = even_masks[i];
i = (i + 1);
}
return dfs_i64_i64(0, 0);
}
void sort_points_i64_ptr_i64_ptr_i64(int64_t npts, int64_t* sx, int64_t* sy) {
int64_t i = 0;
while (i < npts) {
int64_t best = i;
int64_t j = (i + 1);
while (j < npts) {
if ((sx[j] < sx[best] || (sx[j] == sx[best] && sy[j] < sy[best]))) {
best = j;
}
j = (j + 1);
}
if (best != i) {
int64_t tx = sx[i];
int64_t ty = sy[i];
sx[i] = sx[best];
sy[i] = sy[best];
sx[best] = tx;
sy[best] = ty;
}
i = (i + 1);
}
}
int64_t find_min_radius_sq_i64_i64_i64(int64_t k, int64_t m_limit, int64_t filtered) {
int64_t n = FLOW_CHECKED_SHL((1), ((k - 1)));
int64_t m = 1;
while (m <= m_limit) {
int64_t p = antipodal_pair_count_i64(m);
if (p < k) {
m = (m + 1);
} else {
int64_t skip = 0;
if (filtered != 0) {
if ((p != k && p != (k + 2))) {
skip = 1;
}
}
if (skip != 0) {
m = (m + 1);
} else {
num_circle_points = lattice_points_on_circle_i64(m);
int64_t skip2 = 0;
if (filtered != 0) {
if (has_unit_coordinate_i64(num_circle_points) == 0) {
skip2 = 1;
}
}
if (skip2 != 0) {
m = (m + 1);
} else {
int64_t* sx = (int64_t*)(((int64_t*)(calloc(MAXPTS, 8))));
int64_t* sy = (int64_t*)(((int64_t*)(calloc(MAXPTS, 8))));
int64_t i = 0;
while (i < num_circle_points) {
sx[i] = circle_px[i];
sy[i] = circle_py[i];
i = (i + 1);
}
sort_points_i64_ptr_i64_ptr_i64(num_circle_points, sx, sy);
int64_t* used = (int64_t*)(((int64_t*)(calloc(MAXPTS, 8))));
num_pairs = 0;
i = 0;
while (i < num_circle_points) {
if (used[i] != 0) {
i = (i + 1);
} else {
int64_t nx = (-sx[i]);
int64_t ny = (-sy[i]);
int64_t lo = 0;
int64_t hi = (num_circle_points - 1);
int64_t found = (-1);
while (lo <= hi) {
int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
if ((sx[mid] < nx || (sx[mid] == nx && sy[mid] < ny))) {
lo = (mid + 1);
} else {
if ((sx[mid] > nx || (sx[mid] == nx && sy[mid] > ny))) {
hi = (mid - 1);
} else {
found = mid;
lo = (hi + 1);
}
}
}
if (found == (-1)) {
i = (i + 1);
} else {
used[i] = 1;
used[found] = 1;
pair_px[num_pairs] = sx[i];
pair_py[num_pairs] = sy[i];
pair_nx[num_pairs] = nx;
pair_ny[num_pairs] = ny;
num_pairs = (num_pairs + 1);
i = (i + 1);
}
}
}
free(((void*)(sx)));
free(((void*)(sy)));
free(((void*)(used)));
if (num_pairs != p) {
m = (m + 1);
} else {
build_displacement_set();
if (has_valid_oriented_vectors_i64_i64(k, n) != 0) {
hs_free();
return m;
}
hs_free();
m = (m + 1);
}
}
}
}
}
return (-1);
}
int32_t main(void) {
circle_px = ((int64_t*)(calloc(MAXPTS, 8)));
circle_py = ((int64_t*)(calloc(MAXPTS, 8)));
pair_px = ((int64_t*)(calloc(MAXPTS, 8)));
pair_py = ((int64_t*)(calloc(MAXPTS, 8)));
pair_nx = ((int64_t*)(calloc(MAXPTS, 8)));
pair_ny = ((int64_t*)(calloc(MAXPTS, 8)));
sel_x = ((int64_t*)(calloc(16, 8)));
sel_y = ((int64_t*)(calloc(16, 8)));
even_masks = ((int64_t*)(calloc(1024, 8)));
dfs_masks = ((int64_t*)(calloc(1024, 8)));
uf_parent = ((int64_t*)(calloc(1024, 8)));
uf_size = ((int64_t*)(calloc(1024, 8)));
printf("%lld\n", find_min_radius_sq_i64_i64_i64(10, 20000, 1));
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 private @malloc(i64) -> !llvm.ptr
func.func private @sqrt(f64) -> f64
func.func private @fabs(f64) -> f64
func.func @encode(%arg0: i64, %arg1: i64) -> i64 {
%0 = arith.constant 100000 : i32
%2 = arith.extsi %0 : i32 to i64
%1 = arith.addi %arg0, %2 : i64
%3 = arith.constant 32 : i32
%5 = arith.extsi %3 : i32 to i64
%4 = arith.shli %1, %5 : i64
%6 = arith.constant 100000 : i32
%8 = arith.extsi %6 : i32 to i64
%7 = arith.addi %arg1, %8 : i64
%9 = arith.constant -1 : i32
%11 = arith.extsi %9 : i32 to i64
%10 = arith.andi %7, %11 : i64
%12 = arith.ori %4, %10 : i64
func.return %12 : i64
}
func.func @iabs(%arg0: i64) -> i64 {
%13 = arith.constant 0 : i32
%15 = arith.extsi %13 : i32 to i64
%14 = arith.cmpi slt, %arg0, %15 : i64
cf.cond_br %14, ^bb0, ^bb1
^bb0:
%17 = arith.constant 0 : i64
%16 = arith.subi %17, %arg0 : i64
func.return %16 : i64
^bb1:
cf.br ^bb2
^bb2:
func.return %arg0 : i64
}
// Module static: hs_keys
llvm.mlir.global internal @hs_keys() {addr_space = 0 : i32} : !llvm.ptr {
%18 = llvm.mlir.zero : !llvm.ptr
llvm.return %18 : !llvm.ptr
}
// Module static: hs_used
llvm.mlir.global internal @hs_used() {addr_space = 0 : i32} : !llvm.ptr {
%19 = llvm.mlir.zero : !llvm.ptr
llvm.return %19 : !llvm.ptr
}
// Module static: hs_cap
llvm.mlir.global internal @hs_cap(0 : i64) : i64
// Module static: hs_count
llvm.mlir.global internal @hs_count(0 : i64) : i64
func.func @hash_ll(%arg0: i64, %arg1: i64) -> i64 {
%20 = arith.remsi %arg0, %arg1 : i64
%21 = llvm.mlir.constant(1 : i64) : i64
%22 = llvm.alloca %21 x i64 : (i64) -> !llvm.ptr
llvm.store %20, %22 : i64, !llvm.ptr
%23 = llvm.load %22 : !llvm.ptr -> i64
%24 = arith.constant 0 : i32
%26 = arith.extsi %24 : i32 to i64
%25 = arith.cmpi slt, %23, %26 : i64
cf.cond_br %25, ^bb3, ^bb4
^bb3:
%27 = llvm.load %22 : !llvm.ptr -> i64
%28 = arith.addi %27, %arg1 : i64
llvm.store %28, %22 : i64, !llvm.ptr
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
%29 = llvm.load %22 : !llvm.ptr -> i64
func.return %29 : i64
}
func.func @hs_init(%arg0: i64) -> () {
%30 = llvm.mlir.addressof @hs_cap : !llvm.ptr
llvm.store %arg0, %30 : i64, !llvm.ptr
%31 = arith.constant 0 : i32
%32 = arith.extsi %31 : i32 to i64
%33 = llvm.mlir.addressof @hs_count : !llvm.ptr
llvm.store %32, %33 : i64, !llvm.ptr
%35 = arith.constant 8 : i32
%36 = arith.extsi %35 : i32 to i64
%34 = func.call @calloc(%arg0, %36) : (i64, i64) -> !llvm.ptr
%37 = llvm.mlir.addressof @hs_keys : !llvm.ptr
llvm.store %34, %37 : !llvm.ptr, !llvm.ptr
%39 = arith.constant 8 : i32
%40 = arith.extsi %39 : i32 to i64
%38 = func.call @calloc(%arg0, %40) : (i64, i64) -> !llvm.ptr
%41 = llvm.mlir.addressof @hs_used : !llvm.ptr
llvm.store %38, %41 : !llvm.ptr, !llvm.ptr
func.return
}
func.func @hs_free() -> () {
%43 = llvm.mlir.addressof @hs_keys : !llvm.ptr
%44 = llvm.load %43 : !llvm.ptr -> !llvm.ptr
func.call @free(%44) : (!llvm.ptr) -> ()
%46 = llvm.mlir.addressof @hs_used : !llvm.ptr
%47 = llvm.load %46 : !llvm.ptr -> !llvm.ptr
func.call @free(%47) : (!llvm.ptr) -> ()
%48 = llvm.mlir.zero : !llvm.ptr
%49 = llvm.mlir.addressof @hs_keys : !llvm.ptr
llvm.store %48, %49 : !llvm.ptr, !llvm.ptr
%50 = llvm.mlir.zero : !llvm.ptr
%51 = llvm.mlir.addressof @hs_used : !llvm.ptr
llvm.store %50, %51 : !llvm.ptr, !llvm.ptr
%52 = arith.constant 0 : i32
%53 = arith.extsi %52 : i32 to i64
%54 = llvm.mlir.addressof @hs_cap : !llvm.ptr
llvm.store %53, %54 : i64, !llvm.ptr
%55 = arith.constant 0 : i32
%56 = arith.extsi %55 : i32 to i64
%57 = llvm.mlir.addressof @hs_count : !llvm.ptr
llvm.store %56, %57 : i64, !llvm.ptr
func.return
}
func.func @hs_insert(%arg0: i64) -> () {
%58 = llvm.mlir.addressof @hs_count : !llvm.ptr
%59 = llvm.load %58 : !llvm.ptr -> i64
%60 = arith.constant 2 : i32
%62 = arith.extsi %60 : i32 to i64
%61 = arith.muli %59, %62 : i64
%63 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%64 = llvm.load %63 : !llvm.ptr -> i64
%65 = arith.cmpi sgt, %61, %64 : i64
cf.cond_br %65, ^bb6, ^bb7
^bb6:
%66 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%67 = llvm.load %66 : !llvm.ptr -> i64
%68 = llvm.mlir.addressof @hs_keys : !llvm.ptr
%69 = llvm.load %68 : !llvm.ptr -> !llvm.ptr
%70 = llvm.mlir.addressof @hs_used : !llvm.ptr
%71 = llvm.load %70 : !llvm.ptr -> !llvm.ptr
%72 = arith.constant 2 : i32
%74 = arith.extsi %72 : i32 to i64
%73 = arith.muli %67, %74 : i64
%75 = llvm.mlir.addressof @hs_cap : !llvm.ptr
llvm.store %73, %75 : i64, !llvm.ptr
%77 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%78 = llvm.load %77 : !llvm.ptr -> i64
%79 = arith.constant 8 : i32
%80 = arith.extsi %79 : i32 to i64
%76 = func.call @calloc(%78, %80) : (i64, i64) -> !llvm.ptr
%81 = llvm.mlir.addressof @hs_keys : !llvm.ptr
llvm.store %76, %81 : !llvm.ptr, !llvm.ptr
%83 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%84 = llvm.load %83 : !llvm.ptr -> i64
%85 = arith.constant 8 : i32
%86 = arith.extsi %85 : i32 to i64
%82 = func.call @calloc(%84, %86) : (i64, i64) -> !llvm.ptr
%87 = llvm.mlir.addressof @hs_used : !llvm.ptr
llvm.store %82, %87 : !llvm.ptr, !llvm.ptr
%88 = arith.constant 0 : i32
%89 = arith.extsi %88 : i32 to i64
%90 = llvm.mlir.addressof @hs_count : !llvm.ptr
llvm.store %89, %90 : i64, !llvm.ptr
%91 = arith.constant 0 : i32
%92 = arith.extsi %91 : i32 to i64
%93 = llvm.mlir.constant(1 : i64) : i64
%94 = llvm.alloca %93 x i64 : (i64) -> !llvm.ptr
llvm.store %92, %94 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%95 = llvm.load %94 : !llvm.ptr -> i64
%96 = arith.cmpi slt, %95, %67 : i64
cf.cond_br %96, ^bb10, ^bb11
^bb10:
%98 = llvm.load %94 : !llvm.ptr -> i64
%99 = llvm.getelementptr %71[%98] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%97 = llvm.load %99 : !llvm.ptr -> i64
%100 = arith.constant 0 : i32
%102 = arith.extsi %100 : i32 to i64
%101 = arith.cmpi ne, %97, %102 : i64
cf.cond_br %101, ^bb12, ^bb13
^bb12:
%105 = llvm.load %94 : !llvm.ptr -> i64
%106 = llvm.getelementptr %69[%105] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%104 = llvm.load %106 : !llvm.ptr -> i64
%107 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%108 = llvm.load %107 : !llvm.ptr -> i64
%103 = func.call @hash_ll(%104, %108) : (i64, i64) -> i64
%109 = llvm.mlir.constant(1 : i64) : i64
%110 = llvm.alloca %109 x i64 : (i64) -> !llvm.ptr
llvm.store %103, %110 : i64, !llvm.ptr
cf.br ^bb15
^bb15:
%112 = llvm.mlir.addressof @hs_used : !llvm.ptr
%113 = llvm.load %112 : !llvm.ptr -> !llvm.ptr
%114 = llvm.load %110 : !llvm.ptr -> i64
%115 = llvm.getelementptr %113[%114] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%111 = llvm.load %115 : !llvm.ptr -> i64
%116 = arith.constant 0 : i32
%118 = arith.extsi %116 : i32 to i64
%117 = arith.cmpi ne, %111, %118 : i64
cf.cond_br %117, ^bb16, ^bb17
^bb16:
%119 = llvm.load %110 : !llvm.ptr -> i64
%120 = arith.constant 1 : i32
%122 = arith.extsi %120 : i32 to i64
%121 = arith.addi %119, %122 : i64
%123 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%124 = llvm.load %123 : !llvm.ptr -> i64
%125 = arith.remsi %121, %124 : i64
llvm.store %125, %110 : i64, !llvm.ptr
cf.br ^bb15
^bb17:
%127 = llvm.load %94 : !llvm.ptr -> i64
%128 = llvm.getelementptr %69[%127] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%126 = llvm.load %128 : !llvm.ptr -> i64
%129 = llvm.mlir.addressof @hs_keys : !llvm.ptr
%130 = llvm.load %129 : !llvm.ptr -> !llvm.ptr
%131 = llvm.load %110 : !llvm.ptr -> i64
%132 = llvm.getelementptr %130[%131] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %126, %132 : i64, !llvm.ptr
%133 = arith.constant 1 : i32
%134 = llvm.mlir.addressof @hs_used : !llvm.ptr
%135 = llvm.load %134 : !llvm.ptr -> !llvm.ptr
%136 = llvm.load %110 : !llvm.ptr -> i64
%137 = arith.extsi %133 : i32 to i64
%138 = llvm.getelementptr %135[%136] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %137, %138 : i64, !llvm.ptr
%139 = llvm.mlir.addressof @hs_count : !llvm.ptr
%140 = llvm.load %139 : !llvm.ptr -> i64
%141 = arith.constant 1 : i32
%143 = arith.extsi %141 : i32 to i64
%142 = arith.addi %140, %143 : i64
%144 = llvm.mlir.addressof @hs_count : !llvm.ptr
llvm.store %142, %144 : i64, !llvm.ptr
cf.br ^bb14
^bb13:
cf.br ^bb14
^bb14:
%145 = llvm.load %94 : !llvm.ptr -> i64
%146 = arith.constant 1 : i32
%148 = arith.extsi %146 : i32 to i64
%147 = arith.addi %145, %148 : i64
llvm.store %147, %94 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
func.call @free(%69) : (!llvm.ptr) -> ()
func.call @free(%71) : (!llvm.ptr) -> ()
cf.br ^bb8
^bb7:
cf.br ^bb8
^bb8:
%152 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%153 = llvm.load %152 : !llvm.ptr -> i64
%151 = func.call @hash_ll(%arg0, %153) : (i64, i64) -> i64
%154 = llvm.mlir.constant(1 : i64) : i64
%155 = llvm.alloca %154 x i64 : (i64) -> !llvm.ptr
llvm.store %151, %155 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%157 = llvm.mlir.addressof @hs_used : !llvm.ptr
%158 = llvm.load %157 : !llvm.ptr -> !llvm.ptr
%159 = llvm.load %155 : !llvm.ptr -> i64
%160 = llvm.getelementptr %158[%159] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%156 = llvm.load %160 : !llvm.ptr -> i64
%161 = arith.constant 0 : i32
%163 = arith.extsi %161 : i32 to i64
%162 = arith.cmpi ne, %156, %163 : i64
cf.cond_br %162, ^bb19, ^bb20
^bb19:
%165 = llvm.mlir.addressof @hs_keys : !llvm.ptr
%166 = llvm.load %165 : !llvm.ptr -> !llvm.ptr
%167 = llvm.load %155 : !llvm.ptr -> i64
%168 = llvm.getelementptr %166[%167] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%164 = llvm.load %168 : !llvm.ptr -> i64
%169 = arith.cmpi eq, %164, %arg0 : i64
cf.cond_br %169, ^bb21, ^bb22
^bb21:
func.return
^bb22:
cf.br ^bb23
^bb23:
%170 = llvm.load %155 : !llvm.ptr -> i64
%171 = arith.constant 1 : i32
%173 = arith.extsi %171 : i32 to i64
%172 = arith.addi %170, %173 : i64
%174 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%175 = llvm.load %174 : !llvm.ptr -> i64
%176 = arith.remsi %172, %175 : i64
llvm.store %176, %155 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
%177 = llvm.mlir.addressof @hs_keys : !llvm.ptr
%178 = llvm.load %177 : !llvm.ptr -> !llvm.ptr
%179 = llvm.load %155 : !llvm.ptr -> i64
%180 = llvm.getelementptr %178[%179] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg0, %180 : i64, !llvm.ptr
%181 = arith.constant 1 : i32
%182 = llvm.mlir.addressof @hs_used : !llvm.ptr
%183 = llvm.load %182 : !llvm.ptr -> !llvm.ptr
%184 = llvm.load %155 : !llvm.ptr -> i64
%185 = arith.extsi %181 : i32 to i64
%186 = llvm.getelementptr %183[%184] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %185, %186 : i64, !llvm.ptr
%187 = llvm.mlir.addressof @hs_count : !llvm.ptr
%188 = llvm.load %187 : !llvm.ptr -> i64
%189 = arith.constant 1 : i32
%191 = arith.extsi %189 : i32 to i64
%190 = arith.addi %188, %191 : i64
%192 = llvm.mlir.addressof @hs_count : !llvm.ptr
llvm.store %190, %192 : i64, !llvm.ptr
func.return
}
func.func @hs_contains(%arg0: i64) -> i64 {
%194 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%195 = llvm.load %194 : !llvm.ptr -> i64
%193 = func.call @hash_ll(%arg0, %195) : (i64, i64) -> i64
%196 = llvm.mlir.constant(1 : i64) : i64
%197 = llvm.alloca %196 x i64 : (i64) -> !llvm.ptr
llvm.store %193, %197 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%199 = llvm.mlir.addressof @hs_used : !llvm.ptr
%200 = llvm.load %199 : !llvm.ptr -> !llvm.ptr
%201 = llvm.load %197 : !llvm.ptr -> i64
%202 = llvm.getelementptr %200[%201] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%198 = llvm.load %202 : !llvm.ptr -> i64
%203 = arith.constant 0 : i32
%205 = arith.extsi %203 : i32 to i64
%204 = arith.cmpi ne, %198, %205 : i64
cf.cond_br %204, ^bb25, ^bb26
^bb25:
%207 = llvm.mlir.addressof @hs_keys : !llvm.ptr
%208 = llvm.load %207 : !llvm.ptr -> !llvm.ptr
%209 = llvm.load %197 : !llvm.ptr -> i64
%210 = llvm.getelementptr %208[%209] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%206 = llvm.load %210 : !llvm.ptr -> i64
%211 = arith.cmpi eq, %206, %arg0 : i64
cf.cond_br %211, ^bb27, ^bb28
^bb27:
%212 = arith.constant 1 : i32
%213 = arith.extsi %212 : i32 to i64
func.return %213 : i64
^bb28:
cf.br ^bb29
^bb29:
%214 = llvm.load %197 : !llvm.ptr -> i64
%215 = arith.constant 1 : i32
%217 = arith.extsi %215 : i32 to i64
%216 = arith.addi %214, %217 : i64
%218 = llvm.mlir.addressof @hs_cap : !llvm.ptr
%219 = llvm.load %218 : !llvm.ptr -> i64
%220 = arith.remsi %216, %219 : i64
llvm.store %220, %197 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
%221 = arith.constant 0 : i32
%222 = arith.extsi %221 : i32 to i64
func.return %222 : i64
}
// Module static: hm_keys
llvm.mlir.global internal @hm_keys() {addr_space = 0 : i32} : !llvm.ptr {
%223 = llvm.mlir.zero : !llvm.ptr
llvm.return %223 : !llvm.ptr
}
// Module static: hm_vals
llvm.mlir.global internal @hm_vals() {addr_space = 0 : i32} : !llvm.ptr {
%224 = llvm.mlir.zero : !llvm.ptr
llvm.return %224 : !llvm.ptr
}
// Module static: hm_used
llvm.mlir.global internal @hm_used() {addr_space = 0 : i32} : !llvm.ptr {
%225 = llvm.mlir.zero : !llvm.ptr
llvm.return %225 : !llvm.ptr
}
// Module static: hm_cap
llvm.mlir.global internal @hm_cap(0 : i64) : i64
func.func @hm_init(%arg0: i64) -> () {
%226 = llvm.mlir.addressof @hm_cap : !llvm.ptr
llvm.store %arg0, %226 : i64, !llvm.ptr
%228 = arith.constant 8 : i32
%229 = arith.extsi %228 : i32 to i64
%227 = func.call @calloc(%arg0, %229) : (i64, i64) -> !llvm.ptr
%230 = llvm.mlir.addressof @hm_keys : !llvm.ptr
llvm.store %227, %230 : !llvm.ptr, !llvm.ptr
%232 = arith.constant 8 : i32
%233 = arith.extsi %232 : i32 to i64
%231 = func.call @calloc(%arg0, %233) : (i64, i64) -> !llvm.ptr
%234 = llvm.mlir.addressof @hm_vals : !llvm.ptr
llvm.store %231, %234 : !llvm.ptr, !llvm.ptr
%236 = arith.constant 8 : i32
%237 = arith.extsi %236 : i32 to i64
%235 = func.call @calloc(%arg0, %237) : (i64, i64) -> !llvm.ptr
%238 = llvm.mlir.addressof @hm_used : !llvm.ptr
llvm.store %235, %238 : !llvm.ptr, !llvm.ptr
func.return
}
func.func @hm_free() -> () {
%240 = llvm.mlir.addressof @hm_keys : !llvm.ptr
%241 = llvm.load %240 : !llvm.ptr -> !llvm.ptr
func.call @free(%241) : (!llvm.ptr) -> ()
%243 = llvm.mlir.addressof @hm_vals : !llvm.ptr
%244 = llvm.load %243 : !llvm.ptr -> !llvm.ptr
func.call @free(%244) : (!llvm.ptr) -> ()
%246 = llvm.mlir.addressof @hm_used : !llvm.ptr
%247 = llvm.load %246 : !llvm.ptr -> !llvm.ptr
func.call @free(%247) : (!llvm.ptr) -> ()
%248 = llvm.mlir.zero : !llvm.ptr
%249 = llvm.mlir.addressof @hm_keys : !llvm.ptr
llvm.store %248, %249 : !llvm.ptr, !llvm.ptr
%250 = llvm.mlir.zero : !llvm.ptr
%251 = llvm.mlir.addressof @hm_vals : !llvm.ptr
llvm.store %250, %251 : !llvm.ptr, !llvm.ptr
%252 = llvm.mlir.zero : !llvm.ptr
%253 = llvm.mlir.addressof @hm_used : !llvm.ptr
llvm.store %252, %253 : !llvm.ptr, !llvm.ptr
%254 = arith.constant 0 : i32
%255 = arith.extsi %254 : i32 to i64
%256 = llvm.mlir.addressof @hm_cap : !llvm.ptr
llvm.store %255, %256 : i64, !llvm.ptr
func.return
}
func.func @hm_get(%arg0: i64) -> i64 {
%258 = llvm.mlir.addressof @hm_cap : !llvm.ptr
%259 = llvm.load %258 : !llvm.ptr -> i64
%257 = func.call @hash_ll(%arg0, %259) : (i64, i64) -> i64
%260 = llvm.mlir.constant(1 : i64) : i64
%261 = llvm.alloca %260 x i64 : (i64) -> !llvm.ptr
llvm.store %257, %261 : i64, !llvm.ptr
cf.br ^bb30
^bb30:
%263 = llvm.mlir.addressof @hm_used : !llvm.ptr
%264 = llvm.load %263 : !llvm.ptr -> !llvm.ptr
%265 = llvm.load %261 : !llvm.ptr -> i64
%266 = llvm.getelementptr %264[%265] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%262 = llvm.load %266 : !llvm.ptr -> i64
%267 = arith.constant 0 : i32
%269 = arith.extsi %267 : i32 to i64
%268 = arith.cmpi ne, %262, %269 : i64
cf.cond_br %268, ^bb31, ^bb32
^bb31:
%271 = llvm.mlir.addressof @hm_keys : !llvm.ptr
%272 = llvm.load %271 : !llvm.ptr -> !llvm.ptr
%273 = llvm.load %261 : !llvm.ptr -> i64
%274 = llvm.getelementptr %272[%273] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%270 = llvm.load %274 : !llvm.ptr -> i64
%275 = arith.cmpi eq, %270, %arg0 : i64
cf.cond_br %275, ^bb33, ^bb34
^bb33:
%277 = llvm.mlir.addressof @hm_vals : !llvm.ptr
%278 = llvm.load %277 : !llvm.ptr -> !llvm.ptr
%279 = llvm.load %261 : !llvm.ptr -> i64
%280 = llvm.getelementptr %278[%279] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%276 = llvm.load %280 : !llvm.ptr -> i64
func.return %276 : i64
^bb34:
cf.br ^bb35
^bb35:
%281 = llvm.load %261 : !llvm.ptr -> i64
%282 = arith.constant 1 : i32
%284 = arith.extsi %282 : i32 to i64
%283 = arith.addi %281, %284 : i64
%285 = llvm.mlir.addressof @hm_cap : !llvm.ptr
%286 = llvm.load %285 : !llvm.ptr -> i64
%287 = arith.remsi %283, %286 : i64
llvm.store %287, %261 : i64, !llvm.ptr
cf.br ^bb30
^bb32:
%288 = arith.constant 1 : i32
%290 = arith.constant 0 : i32
%289 = arith.subi %290, %288 : i32
%291 = arith.extsi %289 : i32 to i64
func.return %291 : i64
}
func.func @hm_set(%arg0: i64, %arg1: i64) -> () {
%293 = llvm.mlir.addressof @hm_cap : !llvm.ptr
%294 = llvm.load %293 : !llvm.ptr -> i64
%292 = func.call @hash_ll(%arg0, %294) : (i64, i64) -> i64
%295 = llvm.mlir.constant(1 : i64) : i64
%296 = llvm.alloca %295 x i64 : (i64) -> !llvm.ptr
llvm.store %292, %296 : i64, !llvm.ptr
cf.br ^bb36
^bb36:
%298 = llvm.mlir.addressof @hm_used : !llvm.ptr
%299 = llvm.load %298 : !llvm.ptr -> !llvm.ptr
%300 = llvm.load %296 : !llvm.ptr -> i64
%301 = llvm.getelementptr %299[%300] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%297 = llvm.load %301 : !llvm.ptr -> i64
%302 = arith.constant 0 : i32
%304 = arith.extsi %302 : i32 to i64
%303 = arith.cmpi ne, %297, %304 : i64
cf.cond_br %303, ^bb37, ^bb38
^bb37:
%306 = llvm.mlir.addressof @hm_keys : !llvm.ptr
%307 = llvm.load %306 : !llvm.ptr -> !llvm.ptr
%308 = llvm.load %296 : !llvm.ptr -> i64
%309 = llvm.getelementptr %307[%308] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%305 = llvm.load %309 : !llvm.ptr -> i64
%310 = arith.cmpi eq, %305, %arg0 : i64
cf.cond_br %310, ^bb39, ^bb40
^bb39:
%311 = llvm.mlir.addressof @hm_vals : !llvm.ptr
%312 = llvm.load %311 : !llvm.ptr -> !llvm.ptr
%313 = llvm.load %296 : !llvm.ptr -> i64
%314 = llvm.getelementptr %312[%313] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg1, %314 : i64, !llvm.ptr
func.return
^bb40:
cf.br ^bb41
^bb41:
%315 = llvm.load %296 : !llvm.ptr -> i64
%316 = arith.constant 1 : i32
%318 = arith.extsi %316 : i32 to i64
%317 = arith.addi %315, %318 : i64
%319 = llvm.mlir.addressof @hm_cap : !llvm.ptr
%320 = llvm.load %319 : !llvm.ptr -> i64
%321 = arith.remsi %317, %320 : i64
llvm.store %321, %296 : i64, !llvm.ptr
cf.br ^bb36
^bb38:
%322 = llvm.mlir.addressof @hm_keys : !llvm.ptr
%323 = llvm.load %322 : !llvm.ptr -> !llvm.ptr
%324 = llvm.load %296 : !llvm.ptr -> i64
%325 = llvm.getelementptr %323[%324] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg0, %325 : i64, !llvm.ptr
%326 = llvm.mlir.addressof @hm_vals : !llvm.ptr
%327 = llvm.load %326 : !llvm.ptr -> !llvm.ptr
%328 = llvm.load %296 : !llvm.ptr -> i64
%329 = llvm.getelementptr %327[%328] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg1, %329 : i64, !llvm.ptr
%330 = arith.constant 1 : i32
%331 = llvm.mlir.addressof @hm_used : !llvm.ptr
%332 = llvm.load %331 : !llvm.ptr -> !llvm.ptr
%333 = llvm.load %296 : !llvm.ptr -> i64
%334 = arith.extsi %330 : i32 to i64
%335 = llvm.getelementptr %332[%333] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %334, %335 : i64, !llvm.ptr
func.return
}
func.func @isqrt_int(%arg0: i64) -> i64 {
%336 = arith.constant 0 : i32
%338 = arith.extsi %336 : i32 to i64
%337 = arith.cmpi slt, %arg0, %338 : i64
cf.cond_br %337, ^bb42, ^bb43
^bb42:
%339 = arith.constant 0 : i32
%340 = arith.extsi %339 : i32 to i64
func.return %340 : i64
^bb43:
cf.br ^bb44
^bb44:
%341 = arith.sitofp %arg0 : i64 to f64
%342 = math.sqrt %341 : f64
%343 = arith.fptosi %342 : f64 to i64
%344 = llvm.mlir.constant(1 : i64) : i64
%345 = llvm.alloca %344 x i64 : (i64) -> !llvm.ptr
llvm.store %343, %345 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%346 = llvm.load %345 : !llvm.ptr -> i64
%347 = llvm.load %345 : !llvm.ptr -> i64
%348 = arith.muli %346, %347 : i64
%349 = arith.cmpi sgt, %348, %arg0 : i64
cf.cond_br %349, ^bb46, ^bb47
^bb46:
%350 = llvm.load %345 : !llvm.ptr -> i64
%351 = arith.constant 1 : i32
%353 = arith.extsi %351 : i32 to i64
%352 = arith.subi %350, %353 : i64
llvm.store %352, %345 : i64, !llvm.ptr
cf.br ^bb45
^bb47:
cf.br ^bb48
^bb48:
%354 = llvm.load %345 : !llvm.ptr -> i64
%355 = arith.constant 1 : i32
%357 = arith.extsi %355 : i32 to i64
%356 = arith.addi %354, %357 : i64
%358 = llvm.load %345 : !llvm.ptr -> i64
%359 = arith.constant 1 : i32
%361 = arith.extsi %359 : i32 to i64
%360 = arith.addi %358, %361 : i64
%362 = arith.muli %356, %360 : i64
%363 = arith.cmpi sle, %362, %arg0 : i64
cf.cond_br %363, ^bb49, ^bb50
^bb49:
%364 = llvm.load %345 : !llvm.ptr -> i64
%365 = arith.constant 1 : i32
%367 = arith.extsi %365 : i32 to i64
%366 = arith.addi %364, %367 : i64
llvm.store %366, %345 : i64, !llvm.ptr
cf.br ^bb48
^bb50:
%368 = llvm.load %345 : !llvm.ptr -> i64
func.return %368 : i64
}
func.func @antipodal_pair_count(%arg0: i64) -> i64 {
%369 = llvm.mlir.constant(1 : i64) : i64
%370 = llvm.alloca %369 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %370 : i64, !llvm.ptr
cf.br ^bb51
^bb51:
%371 = llvm.load %370 : !llvm.ptr -> i64
%372 = arith.constant 2 : i32
%374 = arith.extsi %372 : i32 to i64
%373 = arith.remsi %371, %374 : i64
%375 = arith.constant 0 : i32
%377 = arith.extsi %375 : i32 to i64
%376 = arith.cmpi eq, %373, %377 : i64
cf.cond_br %376, ^bb52, ^bb53
^bb52:
%378 = llvm.load %370 : !llvm.ptr -> i64
%379 = arith.constant 2 : i32
%381 = arith.extsi %379 : i32 to i64
%380 = arith.divsi %378, %381 : i64
llvm.store %380, %370 : i64, !llvm.ptr
cf.br ^bb51
^bb53:
%382 = arith.constant 1 : i32
%383 = arith.extsi %382 : i32 to i64
%384 = llvm.mlir.constant(1 : i64) : i64
%385 = llvm.alloca %384 x i64 : (i64) -> !llvm.ptr
llvm.store %383, %385 : i64, !llvm.ptr
%386 = arith.constant 3 : i32
%387 = arith.extsi %386 : i32 to i64
%388 = llvm.mlir.constant(1 : i64) : i64
%389 = llvm.alloca %388 x i64 : (i64) -> !llvm.ptr
llvm.store %387, %389 : i64, !llvm.ptr
cf.br ^bb54
^bb54:
%390 = llvm.load %389 : !llvm.ptr -> i64
%391 = llvm.load %389 : !llvm.ptr -> i64
%392 = arith.muli %390, %391 : i64
%393 = llvm.load %370 : !llvm.ptr -> i64
%394 = arith.cmpi sle, %392, %393 : i64
cf.cond_br %394, ^bb55, ^bb56
^bb55:
%395 = llvm.load %370 : !llvm.ptr -> i64
%396 = llvm.load %389 : !llvm.ptr -> i64
%397 = arith.remsi %395, %396 : i64
%398 = arith.constant 0 : i32
%400 = arith.extsi %398 : i32 to i64
%399 = arith.cmpi eq, %397, %400 : i64
cf.cond_br %399, ^bb57, ^bb58
^bb57:
%401 = arith.constant 0 : i32
%402 = arith.extsi %401 : i32 to i64
%403 = llvm.mlir.constant(1 : i64) : i64
%404 = llvm.alloca %403 x i64 : (i64) -> !llvm.ptr
llvm.store %402, %404 : i64, !llvm.ptr
cf.br ^bb60
^bb60:
%405 = llvm.load %370 : !llvm.ptr -> i64
%406 = llvm.load %389 : !llvm.ptr -> i64
%407 = arith.remsi %405, %406 : i64
%408 = arith.constant 0 : i32
%410 = arith.extsi %408 : i32 to i64
%409 = arith.cmpi eq, %407, %410 : i64
cf.cond_br %409, ^bb61, ^bb62
^bb61:
%411 = llvm.load %370 : !llvm.ptr -> i64
%412 = llvm.load %389 : !llvm.ptr -> i64
%413 = arith.divsi %411, %412 : i64
llvm.store %413, %370 : i64, !llvm.ptr
%414 = llvm.load %404 : !llvm.ptr -> i64
%415 = arith.constant 1 : i32
%417 = arith.extsi %415 : i32 to i64
%416 = arith.addi %414, %417 : i64
llvm.store %416, %404 : i64, !llvm.ptr
cf.br ^bb60
^bb62:
%418 = llvm.load %389 : !llvm.ptr -> i64
%419 = arith.constant 4 : i32
%421 = arith.extsi %419 : i32 to i64
%420 = arith.remsi %418, %421 : i64
%422 = arith.constant 1 : i32
%424 = arith.extsi %422 : i32 to i64
%423 = arith.cmpi eq, %420, %424 : i64
cf.cond_br %423, ^bb63, ^bb64
^bb63:
%425 = llvm.load %385 : !llvm.ptr -> i64
%426 = llvm.load %404 : !llvm.ptr -> i64
%427 = arith.constant 1 : i32
%429 = arith.extsi %427 : i32 to i64
%428 = arith.addi %426, %429 : i64
%430 = arith.muli %425, %428 : i64
llvm.store %430, %385 : i64, !llvm.ptr
cf.br ^bb65
^bb64:
%431 = llvm.load %404 : !llvm.ptr -> i64
%432 = arith.constant 2 : i32
%434 = arith.extsi %432 : i32 to i64
%433 = arith.remsi %431, %434 : i64
%435 = arith.constant 1 : i32
%437 = arith.extsi %435 : i32 to i64
%436 = arith.cmpi eq, %433, %437 : i64
cf.cond_br %436, ^bb66, ^bb67
^bb66:
%438 = arith.constant 0 : i32
%439 = arith.extsi %438 : i32 to i64
func.return %439 : i64
^bb67:
cf.br ^bb68
^bb68:
cf.br ^bb65
^bb65:
cf.br ^bb59
^bb58:
cf.br ^bb59
^bb59:
%440 = llvm.load %389 : !llvm.ptr -> i64
%441 = arith.constant 2 : i32
%443 = arith.extsi %441 : i32 to i64
%442 = arith.addi %440, %443 : i64
llvm.store %442, %389 : i64, !llvm.ptr
cf.br ^bb54
^bb56:
%444 = llvm.load %370 : !llvm.ptr -> i64
%445 = arith.constant 1 : i32
%447 = arith.extsi %445 : i32 to i64
%446 = arith.cmpi sgt, %444, %447 : i64
cf.cond_br %446, ^bb69, ^bb70
^bb69:
%448 = llvm.load %370 : !llvm.ptr -> i64
%449 = arith.constant 4 : i32
%451 = arith.extsi %449 : i32 to i64
%450 = arith.remsi %448, %451 : i64
%452 = arith.constant 1 : i32
%454 = arith.extsi %452 : i32 to i64
%453 = arith.cmpi eq, %450, %454 : i64
cf.cond_br %453, ^bb72, ^bb73
^bb72:
%455 = llvm.load %385 : !llvm.ptr -> i64
%456 = arith.constant 2 : i32
%458 = arith.extsi %456 : i32 to i64
%457 = arith.muli %455, %458 : i64
llvm.store %457, %385 : i64, !llvm.ptr
cf.br ^bb74
^bb73:
%459 = llvm.load %370 : !llvm.ptr -> i64
%460 = arith.constant 4 : i32
%462 = arith.extsi %460 : i32 to i64
%461 = arith.remsi %459, %462 : i64
%463 = arith.constant 3 : i32
%465 = arith.extsi %463 : i32 to i64
%464 = arith.cmpi eq, %461, %465 : i64
cf.cond_br %464, ^bb75, ^bb76
^bb75:
%466 = arith.constant 0 : i32
%467 = arith.extsi %466 : i32 to i64
func.return %467 : i64
^bb76:
cf.br ^bb77
^bb77:
cf.br ^bb74
^bb74:
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%468 = arith.constant 2 : i32
%469 = llvm.load %385 : !llvm.ptr -> i64
%471 = arith.extsi %468 : i32 to i64
%470 = arith.muli %471, %469 : i64
func.return %470 : i64
}
// Constant: MAXPTS
llvm.mlir.global internal constant @MAXPTS(100 : i64) : i64
// Module static: circle_px
llvm.mlir.global internal @circle_px() {addr_space = 0 : i32} : !llvm.ptr {
%472 = llvm.mlir.zero : !llvm.ptr
llvm.return %472 : !llvm.ptr
}
// Module static: circle_py
llvm.mlir.global internal @circle_py() {addr_space = 0 : i32} : !llvm.ptr {
%473 = llvm.mlir.zero : !llvm.ptr
llvm.return %473 : !llvm.ptr
}
// Module static: num_circle_points
llvm.mlir.global internal @num_circle_points(0 : i64) : i64
// Module static: pair_px
llvm.mlir.global internal @pair_px() {addr_space = 0 : i32} : !llvm.ptr {
%474 = llvm.mlir.zero : !llvm.ptr
llvm.return %474 : !llvm.ptr
}
// Module static: pair_py
llvm.mlir.global internal @pair_py() {addr_space = 0 : i32} : !llvm.ptr {
%475 = llvm.mlir.zero : !llvm.ptr
llvm.return %475 : !llvm.ptr
}
// Module static: pair_nx
llvm.mlir.global internal @pair_nx() {addr_space = 0 : i32} : !llvm.ptr {
%476 = llvm.mlir.zero : !llvm.ptr
llvm.return %476 : !llvm.ptr
}
// Module static: pair_ny
llvm.mlir.global internal @pair_ny() {addr_space = 0 : i32} : !llvm.ptr {
%477 = llvm.mlir.zero : !llvm.ptr
llvm.return %477 : !llvm.ptr
}
// Module static: num_pairs
llvm.mlir.global internal @num_pairs(0 : i64) : i64
func.func @lattice_points_on_circle(%arg0: i64) -> i64 {
%478 = func.call @isqrt_int(%arg0) : (i64) -> i64
%479 = arith.constant 0 : i32
%480 = arith.extsi %479 : i32 to i64
%481 = llvm.mlir.constant(1 : i64) : i64
%482 = llvm.alloca %481 x i64 : (i64) -> !llvm.ptr
llvm.store %480, %482 : i64, !llvm.ptr
%484 = arith.constant 0 : i64
%483 = arith.subi %484, %478 : i64
%485 = llvm.mlir.constant(1 : i64) : i64
%486 = llvm.alloca %485 x i64 : (i64) -> !llvm.ptr
llvm.store %483, %486 : i64, !llvm.ptr
cf.br ^bb78
^bb78:
%487 = llvm.load %486 : !llvm.ptr -> i64
%488 = arith.cmpi sle, %487, %478 : i64
cf.cond_br %488, ^bb79, ^bb80
^bb79:
%489 = llvm.load %486 : !llvm.ptr -> i64
%490 = llvm.load %486 : !llvm.ptr -> i64
%491 = arith.muli %489, %490 : i64
%492 = arith.subi %arg0, %491 : i64
%493 = arith.constant 0 : i32
%495 = arith.extsi %493 : i32 to i64
%494 = arith.cmpi sge, %492, %495 : i64
cf.cond_br %494, ^bb81, ^bb82
^bb81:
%496 = func.call @isqrt_int(%492) : (i64) -> i64
%497 = arith.muli %496, %496 : i64
%498 = arith.cmpi eq, %497, %492 : i64
cf.cond_br %498, ^bb84, ^bb85
^bb84:
%499 = llvm.load %486 : !llvm.ptr -> i64
%500 = llvm.mlir.addressof @circle_px : !llvm.ptr
%501 = llvm.load %500 : !llvm.ptr -> !llvm.ptr
%502 = llvm.load %482 : !llvm.ptr -> i64
%503 = llvm.getelementptr %501[%502] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %499, %503 : i64, !llvm.ptr
%504 = llvm.mlir.addressof @circle_py : !llvm.ptr
%505 = llvm.load %504 : !llvm.ptr -> !llvm.ptr
%506 = llvm.load %482 : !llvm.ptr -> i64
%507 = llvm.getelementptr %505[%506] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %496, %507 : i64, !llvm.ptr
%508 = llvm.load %482 : !llvm.ptr -> i64
%509 = arith.constant 1 : i32
%511 = arith.extsi %509 : i32 to i64
%510 = arith.addi %508, %511 : i64
llvm.store %510, %482 : i64, !llvm.ptr
%512 = arith.constant 0 : i32
%514 = arith.extsi %512 : i32 to i64
%513 = arith.cmpi ne, %496, %514 : i64
cf.cond_br %513, ^bb87, ^bb88
^bb87:
%515 = llvm.load %486 : !llvm.ptr -> i64
%516 = llvm.mlir.addressof @circle_px : !llvm.ptr
%517 = llvm.load %516 : !llvm.ptr -> !llvm.ptr
%518 = llvm.load %482 : !llvm.ptr -> i64
%519 = llvm.getelementptr %517[%518] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %515, %519 : i64, !llvm.ptr
%521 = arith.constant 0 : i64
%520 = arith.subi %521, %496 : i64
%522 = llvm.mlir.addressof @circle_py : !llvm.ptr
%523 = llvm.load %522 : !llvm.ptr -> !llvm.ptr
%524 = llvm.load %482 : !llvm.ptr -> i64
%525 = llvm.getelementptr %523[%524] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %520, %525 : i64, !llvm.ptr
%526 = llvm.load %482 : !llvm.ptr -> i64
%527 = arith.constant 1 : i32
%529 = arith.extsi %527 : i32 to i64
%528 = arith.addi %526, %529 : i64
llvm.store %528, %482 : i64, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
cf.br ^bb86
^bb85:
cf.br ^bb86
^bb86:
cf.br ^bb83
^bb82:
cf.br ^bb83
^bb83:
%530 = llvm.load %486 : !llvm.ptr -> i64
%531 = arith.constant 1 : i32
%533 = arith.extsi %531 : i32 to i64
%532 = arith.addi %530, %533 : i64
llvm.store %532, %486 : i64, !llvm.ptr
cf.br ^bb78
^bb80:
%534 = llvm.load %482 : !llvm.ptr -> i64
func.return %534 : i64
}
func.func @has_unit_coordinate(%arg0: i64) -> i64 {
%535 = arith.constant 0 : i32
%536 = arith.extsi %535 : i32 to i64
%537 = llvm.mlir.constant(1 : i64) : i64
%538 = llvm.alloca %537 x i64 : (i64) -> !llvm.ptr
llvm.store %536, %538 : i64, !llvm.ptr
cf.br ^bb90
^bb90:
%539 = llvm.load %538 : !llvm.ptr -> i64
%540 = arith.cmpi slt, %539, %arg0 : i64
cf.cond_br %540, ^bb91, ^bb92
^bb91:
%543 = llvm.mlir.addressof @circle_px : !llvm.ptr
%544 = llvm.load %543 : !llvm.ptr -> !llvm.ptr
%545 = llvm.load %538 : !llvm.ptr -> i64
%546 = llvm.getelementptr %544[%545] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%542 = llvm.load %546 : !llvm.ptr -> i64
%541 = func.call @iabs(%542) : (i64) -> i64
%547 = arith.constant 1 : i32
%549 = arith.extsi %547 : i32 to i64
%548 = arith.cmpi eq, %541, %549 : i64
%550 = scf.if %548 -> (i1) {
%551 = arith.constant true
scf.yield %551 : i1
} else {
%554 = llvm.mlir.addressof @circle_py : !llvm.ptr
%555 = llvm.load %554 : !llvm.ptr -> !llvm.ptr
%556 = llvm.load %538 : !llvm.ptr -> i64
%557 = llvm.getelementptr %555[%556] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%553 = llvm.load %557 : !llvm.ptr -> i64
%552 = func.call @iabs(%553) : (i64) -> i64
%558 = arith.constant 1 : i32
%560 = arith.extsi %558 : i32 to i64
%559 = arith.cmpi eq, %552, %560 : i64
scf.yield %559 : i1
}
cf.cond_br %550, ^bb93, ^bb94
^bb93:
%561 = arith.constant 1 : i32
%562 = arith.extsi %561 : i32 to i64
func.return %562 : i64
^bb94:
cf.br ^bb95
^bb95:
%563 = llvm.load %538 : !llvm.ptr -> i64
%564 = arith.constant 1 : i32
%566 = arith.extsi %564 : i32 to i64
%565 = arith.addi %563, %566 : i64
llvm.store %565, %538 : i64, !llvm.ptr
cf.br ^bb90
^bb92:
%567 = arith.constant 0 : i32
%568 = arith.extsi %567 : i32 to i64
func.return %568 : i64
}
func.func @build_displacement_set() -> () {
%570 = arith.constant 1024 : i32
%571 = arith.extsi %570 : i32 to i64
func.call @hs_init(%571) : (i64) -> ()
%572 = arith.constant 0 : i32
%573 = arith.extsi %572 : i32 to i64
%574 = llvm.mlir.constant(1 : i64) : i64
%575 = llvm.alloca %574 x i64 : (i64) -> !llvm.ptr
llvm.store %573, %575 : i64, !llvm.ptr
cf.br ^bb96
^bb96:
%576 = llvm.load %575 : !llvm.ptr -> i64
%577 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%578 = llvm.load %577 : !llvm.ptr -> i64
%579 = arith.cmpi slt, %576, %578 : i64
cf.cond_br %579, ^bb97, ^bb98
^bb97:
%580 = arith.constant 0 : i32
%581 = arith.extsi %580 : i32 to i64
%582 = llvm.mlir.constant(1 : i64) : i64
%583 = llvm.alloca %582 x i64 : (i64) -> !llvm.ptr
llvm.store %581, %583 : i64, !llvm.ptr
cf.br ^bb99
^bb99:
%584 = llvm.load %583 : !llvm.ptr -> i64
%585 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%586 = llvm.load %585 : !llvm.ptr -> i64
%587 = arith.cmpi slt, %584, %586 : i64
cf.cond_br %587, ^bb100, ^bb101
^bb100:
%588 = llvm.load %575 : !llvm.ptr -> i64
%589 = llvm.load %583 : !llvm.ptr -> i64
%590 = arith.cmpi ne, %588, %589 : i64
cf.cond_br %590, ^bb102, ^bb103
^bb102:
%594 = llvm.mlir.addressof @circle_px : !llvm.ptr
%595 = llvm.load %594 : !llvm.ptr -> !llvm.ptr
%596 = llvm.load %575 : !llvm.ptr -> i64
%597 = llvm.getelementptr %595[%596] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%593 = llvm.load %597 : !llvm.ptr -> i64
%599 = llvm.mlir.addressof @circle_px : !llvm.ptr
%600 = llvm.load %599 : !llvm.ptr -> !llvm.ptr
%601 = llvm.load %583 : !llvm.ptr -> i64
%602 = llvm.getelementptr %600[%601] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%598 = llvm.load %602 : !llvm.ptr -> i64
%603 = arith.subi %593, %598 : i64
%605 = llvm.mlir.addressof @circle_py : !llvm.ptr
%606 = llvm.load %605 : !llvm.ptr -> !llvm.ptr
%607 = llvm.load %575 : !llvm.ptr -> i64
%608 = llvm.getelementptr %606[%607] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%604 = llvm.load %608 : !llvm.ptr -> i64
%610 = llvm.mlir.addressof @circle_py : !llvm.ptr
%611 = llvm.load %610 : !llvm.ptr -> !llvm.ptr
%612 = llvm.load %583 : !llvm.ptr -> i64
%613 = llvm.getelementptr %611[%612] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%609 = llvm.load %613 : !llvm.ptr -> i64
%614 = arith.subi %604, %609 : i64
%592 = func.call @encode(%603, %614) : (i64, i64) -> i64
func.call @hs_insert(%592) : (i64) -> ()
cf.br ^bb104
^bb103:
cf.br ^bb104
^bb104:
%615 = llvm.load %583 : !llvm.ptr -> i64
%616 = arith.constant 1 : i32
%618 = arith.extsi %616 : i32 to i64
%617 = arith.addi %615, %618 : i64
llvm.store %617, %583 : i64, !llvm.ptr
cf.br ^bb99
^bb101:
%619 = llvm.load %575 : !llvm.ptr -> i64
%620 = arith.constant 1 : i32
%622 = arith.extsi %620 : i32 to i64
%621 = arith.addi %619, %622 : i64
llvm.store %621, %575 : i64, !llvm.ptr
cf.br ^bb96
^bb98:
func.return
}
// Module static: sel_x
llvm.mlir.global internal @sel_x() {addr_space = 0 : i32} : !llvm.ptr {
%623 = llvm.mlir.zero : !llvm.ptr
llvm.return %623 : !llvm.ptr
}
// Module static: sel_y
llvm.mlir.global internal @sel_y() {addr_space = 0 : i32} : !llvm.ptr {
%624 = llvm.mlir.zero : !llvm.ptr
llvm.return %624 : !llvm.ptr
}
// Module static: dfs_k
llvm.mlir.global internal @dfs_k(0 : i64) : i64
// Module static: dfs_n
llvm.mlir.global internal @dfs_n(0 : i64) : i64
// Module static: dfs_masks
llvm.mlir.global internal @dfs_masks() {addr_space = 0 : i32} : !llvm.ptr {
%625 = llvm.mlir.zero : !llvm.ptr
llvm.return %625 : !llvm.ptr
}
// Module static: dfs_nmasks
llvm.mlir.global internal @dfs_nmasks(0 : i64) : i64
func.func @passes_four_vector_prune(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
%626 = arith.constant 3 : i32
%628 = arith.extsi %626 : i32 to i64
%627 = arith.cmpi slt, %arg0, %628 : i64
cf.cond_br %627, ^bb105, ^bb106
^bb105:
%629 = arith.constant 1 : i32
%630 = arith.extsi %629 : i32 to i64
func.return %630 : i64
^bb106:
cf.br ^bb107
^bb107:
%631 = arith.constant 0 : i32
%632 = arith.extsi %631 : i32 to i64
%633 = llvm.mlir.constant(1 : i64) : i64
%634 = llvm.alloca %633 x i64 : (i64) -> !llvm.ptr
llvm.store %632, %634 : i64, !llvm.ptr
cf.br ^bb108
^bb108:
%635 = llvm.load %634 : !llvm.ptr -> i64
%636 = arith.constant 2 : i32
%638 = arith.extsi %636 : i32 to i64
%637 = arith.subi %arg0, %638 : i64
%639 = arith.cmpi slt, %635, %637 : i64
cf.cond_br %639, ^bb109, ^bb110
^bb109:
%641 = llvm.mlir.addressof @sel_x : !llvm.ptr
%642 = llvm.load %641 : !llvm.ptr -> !llvm.ptr
%643 = llvm.load %634 : !llvm.ptr -> i64
%644 = llvm.getelementptr %642[%643] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%640 = llvm.load %644 : !llvm.ptr -> i64
%646 = llvm.mlir.addressof @sel_y : !llvm.ptr
%647 = llvm.load %646 : !llvm.ptr -> !llvm.ptr
%648 = llvm.load %634 : !llvm.ptr -> i64
%649 = llvm.getelementptr %647[%648] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%645 = llvm.load %649 : !llvm.ptr -> i64
%650 = llvm.load %634 : !llvm.ptr -> i64
%651 = arith.constant 1 : i32
%653 = arith.extsi %651 : i32 to i64
%652 = arith.addi %650, %653 : i64
%654 = llvm.mlir.constant(1 : i64) : i64
%655 = llvm.alloca %654 x i64 : (i64) -> !llvm.ptr
llvm.store %652, %655 : i64, !llvm.ptr
cf.br ^bb111
^bb111:
%656 = llvm.load %655 : !llvm.ptr -> i64
%657 = arith.constant 1 : i32
%659 = arith.extsi %657 : i32 to i64
%658 = arith.subi %arg0, %659 : i64
%660 = arith.cmpi slt, %656, %658 : i64
cf.cond_br %660, ^bb112, ^bb113
^bb112:
%662 = llvm.mlir.addressof @sel_x : !llvm.ptr
%663 = llvm.load %662 : !llvm.ptr -> !llvm.ptr
%664 = llvm.load %655 : !llvm.ptr -> i64
%665 = llvm.getelementptr %663[%664] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%661 = llvm.load %665 : !llvm.ptr -> i64
%667 = llvm.mlir.addressof @sel_y : !llvm.ptr
%668 = llvm.load %667 : !llvm.ptr -> !llvm.ptr
%669 = llvm.load %655 : !llvm.ptr -> i64
%670 = llvm.getelementptr %668[%669] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%666 = llvm.load %670 : !llvm.ptr -> i64
%671 = llvm.load %655 : !llvm.ptr -> i64
%672 = arith.constant 1 : i32
%674 = arith.extsi %672 : i32 to i64
%673 = arith.addi %671, %674 : i64
%675 = llvm.mlir.constant(1 : i64) : i64
%676 = llvm.alloca %675 x i64 : (i64) -> !llvm.ptr
llvm.store %673, %676 : i64, !llvm.ptr
cf.br ^bb114
^bb114:
%677 = llvm.load %676 : !llvm.ptr -> i64
%678 = arith.cmpi slt, %677, %arg0 : i64
cf.cond_br %678, ^bb115, ^bb116
^bb115:
%680 = llvm.mlir.addressof @sel_x : !llvm.ptr
%681 = llvm.load %680 : !llvm.ptr -> !llvm.ptr
%682 = llvm.load %676 : !llvm.ptr -> i64
%683 = llvm.getelementptr %681[%682] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%679 = llvm.load %683 : !llvm.ptr -> i64
%685 = llvm.mlir.addressof @sel_y : !llvm.ptr
%686 = llvm.load %685 : !llvm.ptr -> !llvm.ptr
%687 = llvm.load %676 : !llvm.ptr -> i64
%688 = llvm.getelementptr %686[%687] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%684 = llvm.load %688 : !llvm.ptr -> i64
%689 = arith.constant 1 : i32
%690 = arith.extsi %689 : i32 to i64
%691 = llvm.mlir.constant(1 : i64) : i64
%692 = llvm.alloca %691 x i64 : (i64) -> !llvm.ptr
llvm.store %690, %692 : i64, !llvm.ptr
cf.br ^bb117
^bb117:
%693 = llvm.load %692 : !llvm.ptr -> i64
%694 = arith.constant 1 : i32
%696 = arith.constant 0 : i32
%695 = arith.subi %696, %694 : i32
%698 = arith.extsi %695 : i32 to i64
%697 = arith.cmpi sge, %693, %698 : i64
cf.cond_br %697, ^bb118, ^bb119
^bb118:
%699 = llvm.load %692 : !llvm.ptr -> i64
%700 = arith.muli %699, %640 : i64
%701 = arith.addi %arg1, %700 : i64
%702 = llvm.load %692 : !llvm.ptr -> i64
%703 = arith.muli %702, %645 : i64
%704 = arith.addi %arg2, %703 : i64
%705 = arith.constant 1 : i32
%706 = arith.extsi %705 : i32 to i64
%707 = llvm.mlir.constant(1 : i64) : i64
%708 = llvm.alloca %707 x i64 : (i64) -> !llvm.ptr
llvm.store %706, %708 : i64, !llvm.ptr
cf.br ^bb120
^bb120:
%709 = llvm.load %708 : !llvm.ptr -> i64
%710 = arith.constant 1 : i32
%712 = arith.constant 0 : i32
%711 = arith.subi %712, %710 : i32
%714 = arith.extsi %711 : i32 to i64
%713 = arith.cmpi sge, %709, %714 : i64
cf.cond_br %713, ^bb121, ^bb122
^bb121:
%715 = llvm.load %708 : !llvm.ptr -> i64
%716 = arith.muli %715, %661 : i64
%717 = arith.addi %701, %716 : i64
%718 = llvm.load %708 : !llvm.ptr -> i64
%719 = arith.muli %718, %666 : i64
%720 = arith.addi %704, %719 : i64
%721 = arith.constant 1 : i32
%722 = arith.extsi %721 : i32 to i64
%723 = llvm.mlir.constant(1 : i64) : i64
%724 = llvm.alloca %723 x i64 : (i64) -> !llvm.ptr
llvm.store %722, %724 : i64, !llvm.ptr
cf.br ^bb123
^bb123:
%725 = llvm.load %724 : !llvm.ptr -> i64
%726 = arith.constant 1 : i32
%728 = arith.constant 0 : i32
%727 = arith.subi %728, %726 : i32
%730 = arith.extsi %727 : i32 to i64
%729 = arith.cmpi sge, %725, %730 : i64
cf.cond_br %729, ^bb124, ^bb125
^bb124:
%731 = llvm.load %724 : !llvm.ptr -> i64
%732 = arith.muli %731, %679 : i64
%733 = arith.addi %717, %732 : i64
%734 = llvm.mlir.constant(1 : i64) : i64
%735 = llvm.alloca %734 x i64 : (i64) -> !llvm.ptr
llvm.store %733, %735 : i64, !llvm.ptr
%736 = llvm.load %724 : !llvm.ptr -> i64
%737 = arith.muli %736, %684 : i64
%738 = arith.addi %720, %737 : i64
%739 = llvm.mlir.constant(1 : i64) : i64
%740 = llvm.alloca %739 x i64 : (i64) -> !llvm.ptr
llvm.store %738, %740 : i64, !llvm.ptr
%741 = llvm.load %735 : !llvm.ptr -> i64
%742 = arith.constant 0 : i32
%744 = arith.extsi %742 : i32 to i64
%743 = arith.cmpi ne, %741, %744 : i64
%745 = scf.if %743 -> (i1) {
%746 = arith.constant true
scf.yield %746 : i1
} else {
%747 = llvm.load %740 : !llvm.ptr -> i64
%748 = arith.constant 0 : i32
%750 = arith.extsi %748 : i32 to i64
%749 = arith.cmpi ne, %747, %750 : i64
scf.yield %749 : i1
}
%751 = scf.if %745 -> (i1) {
%754 = llvm.load %735 : !llvm.ptr -> i64
%755 = llvm.load %740 : !llvm.ptr -> i64
%753 = func.call @encode(%754, %755) : (i64, i64) -> i64
%752 = func.call @hs_contains(%753) : (i64) -> i64
%757 = arith.constant 0 : i64
%756 = arith.cmpi ne, %752, %757 : i64
scf.yield %756 : i1
} else {
%758 = arith.constant false
scf.yield %758 : i1
}
cf.cond_br %751, ^bb126, ^bb127
^bb126:
%759 = arith.constant 0 : i32
%760 = arith.extsi %759 : i32 to i64
func.return %760 : i64
^bb127:
cf.br ^bb128
^bb128:
%761 = arith.subi %717, %679 : i64
llvm.store %761, %735 : i64, !llvm.ptr
%762 = arith.subi %720, %684 : i64
llvm.store %762, %740 : i64, !llvm.ptr
%763 = llvm.load %735 : !llvm.ptr -> i64
%764 = arith.constant 0 : i32
%766 = arith.extsi %764 : i32 to i64
%765 = arith.cmpi ne, %763, %766 : i64
%767 = scf.if %765 -> (i1) {
%768 = arith.constant true
scf.yield %768 : i1
} else {
%769 = llvm.load %740 : !llvm.ptr -> i64
%770 = arith.constant 0 : i32
%772 = arith.extsi %770 : i32 to i64
%771 = arith.cmpi ne, %769, %772 : i64
scf.yield %771 : i1
}
%773 = scf.if %767 -> (i1) {
%776 = llvm.load %735 : !llvm.ptr -> i64
%777 = llvm.load %740 : !llvm.ptr -> i64
%775 = func.call @encode(%776, %777) : (i64, i64) -> i64
%774 = func.call @hs_contains(%775) : (i64) -> i64
%779 = arith.constant 0 : i64
%778 = arith.cmpi ne, %774, %779 : i64
scf.yield %778 : i1
} else {
%780 = arith.constant false
scf.yield %780 : i1
}
cf.cond_br %773, ^bb129, ^bb130
^bb129:
%781 = arith.constant 0 : i32
%782 = arith.extsi %781 : i32 to i64
func.return %782 : i64
^bb130:
cf.br ^bb131
^bb131:
%783 = llvm.load %724 : !llvm.ptr -> i64
%784 = arith.constant 2 : i32
%786 = arith.extsi %784 : i32 to i64
%785 = arith.subi %783, %786 : i64
llvm.store %785, %724 : i64, !llvm.ptr
cf.br ^bb123
^bb125:
%787 = llvm.load %708 : !llvm.ptr -> i64
%788 = arith.constant 2 : i32
%790 = arith.extsi %788 : i32 to i64
%789 = arith.subi %787, %790 : i64
llvm.store %789, %708 : i64, !llvm.ptr
cf.br ^bb120
^bb122:
%791 = llvm.load %692 : !llvm.ptr -> i64
%792 = arith.constant 2 : i32
%794 = arith.extsi %792 : i32 to i64
%793 = arith.subi %791, %794 : i64
llvm.store %793, %692 : i64, !llvm.ptr
cf.br ^bb117
^bb119:
%795 = llvm.load %676 : !llvm.ptr -> i64
%796 = arith.constant 1 : i32
%798 = arith.extsi %796 : i32 to i64
%797 = arith.addi %795, %798 : i64
llvm.store %797, %676 : i64, !llvm.ptr
cf.br ^bb114
^bb116:
%799 = llvm.load %655 : !llvm.ptr -> i64
%800 = arith.constant 1 : i32
%802 = arith.extsi %800 : i32 to i64
%801 = arith.addi %799, %802 : i64
llvm.store %801, %655 : i64, !llvm.ptr
cf.br ^bb111
^bb113:
%803 = llvm.load %634 : !llvm.ptr -> i64
%804 = arith.constant 1 : i32
%806 = arith.extsi %804 : i32 to i64
%805 = arith.addi %803, %806 : i64
llvm.store %805, %634 : i64, !llvm.ptr
cf.br ^bb108
^bb110:
%807 = arith.constant 1 : i32
%808 = arith.extsi %807 : i32 to i64
func.return %808 : i64
}
func.func @popcount(%arg0: i64) -> i64 {
%809 = arith.constant 0 : i32
%810 = arith.extsi %809 : i32 to i64
%811 = llvm.mlir.constant(1 : i64) : i64
%812 = llvm.alloca %811 x i64 : (i64) -> !llvm.ptr
llvm.store %810, %812 : i64, !llvm.ptr
%813 = llvm.mlir.constant(1 : i64) : i64
%814 = llvm.alloca %813 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %814 : i64, !llvm.ptr
cf.br ^bb132
^bb132:
%815 = llvm.load %814 : !llvm.ptr -> i64
%816 = arith.constant 0 : i32
%818 = arith.extsi %816 : i32 to i64
%817 = arith.cmpi ne, %815, %818 : i64
cf.cond_br %817, ^bb133, ^bb134
^bb133:
%819 = llvm.load %812 : !llvm.ptr -> i64
%820 = arith.constant 1 : i32
%822 = arith.extsi %820 : i32 to i64
%821 = arith.addi %819, %822 : i64
llvm.store %821, %812 : i64, !llvm.ptr
%823 = llvm.load %814 : !llvm.ptr -> i64
%824 = llvm.load %814 : !llvm.ptr -> i64
%825 = arith.constant 1 : i32
%827 = arith.extsi %825 : i32 to i64
%826 = arith.subi %824, %827 : i64
%828 = arith.andi %823, %826 : i64
llvm.store %828, %814 : i64, !llvm.ptr
cf.br ^bb132
^bb134:
%829 = llvm.load %812 : !llvm.ptr -> i64
func.return %829 : i64
}
// Module static: even_masks
llvm.mlir.global internal @even_masks() {addr_space = 0 : i32} : !llvm.ptr {
%830 = llvm.mlir.zero : !llvm.ptr
llvm.return %830 : !llvm.ptr
}
// Module static: num_even_masks
llvm.mlir.global internal @num_even_masks(0 : i64) : i64
func.func @compute_even_masks(%arg0: i64) -> () {
%831 = arith.constant 0 : i32
%832 = arith.extsi %831 : i32 to i64
%833 = llvm.mlir.addressof @num_even_masks : !llvm.ptr
llvm.store %832, %833 : i64, !llvm.ptr
%834 = arith.constant 0 : i32
%835 = arith.extsi %834 : i32 to i64
%836 = llvm.mlir.constant(1 : i64) : i64
%837 = llvm.alloca %836 x i64 : (i64) -> !llvm.ptr
llvm.store %835, %837 : i64, !llvm.ptr
cf.br ^bb135
^bb135:
%838 = llvm.load %837 : !llvm.ptr -> i64
%839 = arith.constant 1 : i32
%841 = arith.extsi %839 : i32 to i64
%840 = arith.shli %841, %arg0 : i64
%842 = arith.cmpi slt, %838, %840 : i64
cf.cond_br %842, ^bb136, ^bb137
^bb136:
%844 = llvm.load %837 : !llvm.ptr -> i64
%843 = func.call @popcount(%844) : (i64) -> i64
%845 = arith.constant 2 : i32
%847 = arith.extsi %845 : i32 to i64
%846 = arith.remsi %843, %847 : i64
%848 = arith.constant 0 : i32
%850 = arith.extsi %848 : i32 to i64
%849 = arith.cmpi eq, %846, %850 : i64
cf.cond_br %849, ^bb138, ^bb139
^bb138:
%851 = llvm.load %837 : !llvm.ptr -> i64
%852 = llvm.mlir.addressof @even_masks : !llvm.ptr
%853 = llvm.load %852 : !llvm.ptr -> !llvm.ptr
%854 = llvm.mlir.addressof @num_even_masks : !llvm.ptr
%855 = llvm.load %854 : !llvm.ptr -> i64
%856 = llvm.getelementptr %853[%855] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %851, %856 : i64, !llvm.ptr
%857 = llvm.mlir.addressof @num_even_masks : !llvm.ptr
%858 = llvm.load %857 : !llvm.ptr -> i64
%859 = arith.constant 1 : i32
%861 = arith.extsi %859 : i32 to i64
%860 = arith.addi %858, %861 : i64
%862 = llvm.mlir.addressof @num_even_masks : !llvm.ptr
llvm.store %860, %862 : i64, !llvm.ptr
cf.br ^bb140
^bb139:
cf.br ^bb140
^bb140:
%863 = llvm.load %837 : !llvm.ptr -> i64
%864 = arith.constant 1 : i32
%866 = arith.extsi %864 : i32 to i64
%865 = arith.addi %863, %866 : i64
llvm.store %865, %837 : i64, !llvm.ptr
cf.br ^bb135
^bb137:
func.return
}
func.func @centers_from_vectors(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: !llvm.ptr, %arg4: i64, %arg5: !llvm.ptr, %arg6: !llvm.ptr) -> () {
%867 = arith.constant 0 : i32
%868 = arith.extsi %867 : i32 to i64
%869 = llvm.mlir.constant(1 : i64) : i64
%870 = llvm.alloca %869 x i64 : (i64) -> !llvm.ptr
llvm.store %868, %870 : i64, !llvm.ptr
cf.br ^bb141
^bb141:
%871 = llvm.load %870 : !llvm.ptr -> i64
%872 = arith.cmpi slt, %871, %arg4 : i64
cf.cond_br %872, ^bb142, ^bb143
^bb142:
%874 = llvm.load %870 : !llvm.ptr -> i64
%875 = llvm.getelementptr %arg3[%874] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%873 = llvm.load %875 : !llvm.ptr -> i64
%876 = arith.constant 0 : i32
%877 = arith.extsi %876 : i32 to i64
%878 = llvm.mlir.constant(1 : i64) : i64
%879 = llvm.alloca %878 x i64 : (i64) -> !llvm.ptr
llvm.store %877, %879 : i64, !llvm.ptr
%880 = arith.constant 0 : i32
%881 = arith.extsi %880 : i32 to i64
%882 = llvm.mlir.constant(1 : i64) : i64
%883 = llvm.alloca %882 x i64 : (i64) -> !llvm.ptr
llvm.store %881, %883 : i64, !llvm.ptr
%884 = arith.constant 0 : i32
%885 = arith.extsi %884 : i32 to i64
%886 = llvm.mlir.constant(1 : i64) : i64
%887 = llvm.alloca %886 x i64 : (i64) -> !llvm.ptr
llvm.store %885, %887 : i64, !llvm.ptr
cf.br ^bb144
^bb144:
%888 = llvm.load %887 : !llvm.ptr -> i64
%889 = arith.cmpi slt, %888, %arg2 : i64
cf.cond_br %889, ^bb145, ^bb146
^bb145:
%890 = arith.constant 1 : i32
%891 = llvm.load %887 : !llvm.ptr -> i64
%893 = arith.extsi %890 : i32 to i64
%892 = arith.shli %893, %891 : i64
%894 = arith.andi %873, %892 : i64
%895 = arith.constant 0 : i32
%897 = arith.extsi %895 : i32 to i64
%896 = arith.cmpi ne, %894, %897 : i64
cf.cond_br %896, ^bb147, ^bb148
^bb147:
%898 = llvm.load %879 : !llvm.ptr -> i64
%900 = llvm.load %887 : !llvm.ptr -> i64
%901 = llvm.getelementptr %arg0[%900] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%899 = llvm.load %901 : !llvm.ptr -> i64
%902 = arith.addi %898, %899 : i64
llvm.store %902, %879 : i64, !llvm.ptr
%903 = llvm.load %883 : !llvm.ptr -> i64
%905 = llvm.load %887 : !llvm.ptr -> i64
%906 = llvm.getelementptr %arg1[%905] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%904 = llvm.load %906 : !llvm.ptr -> i64
%907 = arith.addi %903, %904 : i64
llvm.store %907, %883 : i64, !llvm.ptr
cf.br ^bb149
^bb148:
cf.br ^bb149
^bb149:
%908 = llvm.load %887 : !llvm.ptr -> i64
%909 = arith.constant 1 : i32
%911 = arith.extsi %909 : i32 to i64
%910 = arith.addi %908, %911 : i64
llvm.store %910, %887 : i64, !llvm.ptr
cf.br ^bb144
^bb146:
%912 = llvm.load %879 : !llvm.ptr -> i64
%913 = llvm.load %870 : !llvm.ptr -> i64
%914 = llvm.getelementptr %arg5[%913] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %912, %914 : i64, !llvm.ptr
%915 = llvm.load %883 : !llvm.ptr -> i64
%916 = llvm.load %870 : !llvm.ptr -> i64
%917 = llvm.getelementptr %arg6[%916] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %915, %917 : i64, !llvm.ptr
%918 = llvm.load %870 : !llvm.ptr -> i64
%919 = arith.constant 1 : i32
%921 = arith.extsi %919 : i32 to i64
%920 = arith.addi %918, %921 : i64
llvm.store %920, %870 : i64, !llvm.ptr
cf.br ^bb141
^bb143:
func.return
}
func.func @quick_harmony_count_equals_n(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i64) -> i64 {
%923 = arith.constant 16384 : i32
%924 = arith.extsi %923 : i32 to i64
func.call @hm_init(%924) : (i64) -> ()
%925 = arith.constant 0 : i32
%926 = arith.extsi %925 : i32 to i64
%927 = llvm.mlir.constant(1 : i64) : i64
%928 = llvm.alloca %927 x i64 : (i64) -> !llvm.ptr
llvm.store %926, %928 : i64, !llvm.ptr
%929 = arith.constant 0 : i32
%930 = arith.extsi %929 : i32 to i64
%931 = llvm.mlir.constant(1 : i64) : i64
%932 = llvm.alloca %931 x i64 : (i64) -> !llvm.ptr
llvm.store %930, %932 : i64, !llvm.ptr
cf.br ^bb150
^bb150:
%933 = llvm.load %932 : !llvm.ptr -> i64
%934 = arith.cmpi slt, %933, %arg0 : i64
cf.cond_br %934, ^bb151, ^bb152
^bb151:
%935 = arith.constant 0 : i32
%936 = arith.extsi %935 : i32 to i64
%937 = llvm.mlir.constant(1 : i64) : i64
%938 = llvm.alloca %937 x i64 : (i64) -> !llvm.ptr
llvm.store %936, %938 : i64, !llvm.ptr
cf.br ^bb153
^bb153:
%939 = llvm.load %938 : !llvm.ptr -> i64
%940 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%941 = llvm.load %940 : !llvm.ptr -> i64
%942 = arith.cmpi slt, %939, %941 : i64
cf.cond_br %942, ^bb154, ^bb155
^bb154:
%945 = llvm.load %932 : !llvm.ptr -> i64
%946 = llvm.getelementptr %arg1[%945] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%944 = llvm.load %946 : !llvm.ptr -> i64
%948 = llvm.mlir.addressof @circle_px : !llvm.ptr
%949 = llvm.load %948 : !llvm.ptr -> !llvm.ptr
%950 = llvm.load %938 : !llvm.ptr -> i64
%951 = llvm.getelementptr %949[%950] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%947 = llvm.load %951 : !llvm.ptr -> i64
%952 = arith.addi %944, %947 : i64
%954 = llvm.load %932 : !llvm.ptr -> i64
%955 = llvm.getelementptr %arg2[%954] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%953 = llvm.load %955 : !llvm.ptr -> i64
%957 = llvm.mlir.addressof @circle_py : !llvm.ptr
%958 = llvm.load %957 : !llvm.ptr -> !llvm.ptr
%959 = llvm.load %938 : !llvm.ptr -> i64
%960 = llvm.getelementptr %958[%959] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%956 = llvm.load %960 : !llvm.ptr -> i64
%961 = arith.addi %953, %956 : i64
%943 = func.call @encode(%952, %961) : (i64, i64) -> i64
%962 = func.call @hm_get(%943) : (i64) -> i64
%963 = arith.constant 1 : i32
%965 = arith.constant 0 : i32
%964 = arith.subi %965, %963 : i32
%967 = arith.extsi %964 : i32 to i64
%966 = arith.cmpi eq, %962, %967 : i64
cf.cond_br %966, ^bb156, ^bb157
^bb156:
%969 = arith.constant 1 : i32
%970 = arith.extsi %969 : i32 to i64
func.call @hm_set(%943, %970) : (i64, i64) -> ()
cf.br ^bb158
^bb157:
%971 = arith.constant 1 : i32
%973 = arith.extsi %971 : i32 to i64
%972 = arith.cmpi eq, %962, %973 : i64
cf.cond_br %972, ^bb159, ^bb160
^bb159:
%975 = arith.constant 2 : i32
%976 = arith.extsi %975 : i32 to i64
func.call @hm_set(%943, %976) : (i64, i64) -> ()
%977 = llvm.load %928 : !llvm.ptr -> i64
%978 = arith.constant 1 : i32
%980 = arith.extsi %978 : i32 to i64
%979 = arith.addi %977, %980 : i64
llvm.store %979, %928 : i64, !llvm.ptr
%981 = llvm.load %928 : !llvm.ptr -> i64
%982 = arith.cmpi sgt, %981, %arg3 : i64
cf.cond_br %982, ^bb162, ^bb163
^bb162:
func.call @hm_free() : () -> ()
%984 = arith.constant 0 : i32
%985 = arith.extsi %984 : i32 to i64
func.return %985 : i64
^bb163:
cf.br ^bb164
^bb164:
cf.br ^bb161
^bb160:
%987 = arith.constant 1 : i32
%989 = arith.extsi %987 : i32 to i64
%988 = arith.addi %962, %989 : i64
func.call @hm_set(%943, %988) : (i64, i64) -> ()
cf.br ^bb161
^bb161:
cf.br ^bb158
^bb158:
%990 = llvm.load %938 : !llvm.ptr -> i64
%991 = arith.constant 1 : i32
%993 = arith.extsi %991 : i32 to i64
%992 = arith.addi %990, %993 : i64
llvm.store %992, %938 : i64, !llvm.ptr
cf.br ^bb153
^bb155:
%994 = llvm.load %932 : !llvm.ptr -> i64
%995 = arith.constant 1 : i32
%997 = arith.extsi %995 : i32 to i64
%996 = arith.addi %994, %997 : i64
llvm.store %996, %932 : i64, !llvm.ptr
cf.br ^bb150
^bb152:
func.call @hm_free() : () -> ()
%999 = llvm.load %928 : !llvm.ptr -> i64
%1000 = arith.cmpi eq, %999, %arg3 : i64
cf.cond_br %1000, ^bb165, ^bb166
^bb165:
%1001 = arith.constant 1 : i32
%1002 = arith.extsi %1001 : i32 to i64
func.return %1002 : i64
^bb166:
cf.br ^bb167
^bb167:
%1003 = arith.constant 0 : i32
%1004 = arith.extsi %1003 : i32 to i64
func.return %1004 : i64
}
// Module static: uf_parent
llvm.mlir.global internal @uf_parent() {addr_space = 0 : i32} : !llvm.ptr {
%1005 = llvm.mlir.zero : !llvm.ptr
llvm.return %1005 : !llvm.ptr
}
// Module static: uf_size
llvm.mlir.global internal @uf_size() {addr_space = 0 : i32} : !llvm.ptr {
%1006 = llvm.mlir.zero : !llvm.ptr
llvm.return %1006 : !llvm.ptr
}
func.func @uf_find(%arg0: i64) -> i64 {
%1007 = llvm.mlir.constant(1 : i64) : i64
%1008 = llvm.alloca %1007 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %1008 : i64, !llvm.ptr
cf.br ^bb168
^bb168:
%1010 = llvm.mlir.addressof @uf_parent : !llvm.ptr
%1011 = llvm.load %1010 : !llvm.ptr -> !llvm.ptr
%1012 = llvm.load %1008 : !llvm.ptr -> i64
%1013 = llvm.getelementptr %1011[%1012] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1009 = llvm.load %1013 : !llvm.ptr -> i64
%1014 = llvm.load %1008 : !llvm.ptr -> i64
%1015 = arith.cmpi ne, %1009, %1014 : i64
cf.cond_br %1015, ^bb169, ^bb170
^bb169:
%1017 = llvm.mlir.addressof @uf_parent : !llvm.ptr
%1018 = llvm.load %1017 : !llvm.ptr -> !llvm.ptr
%1020 = llvm.mlir.addressof @uf_parent : !llvm.ptr
%1021 = llvm.load %1020 : !llvm.ptr -> !llvm.ptr
%1022 = llvm.load %1008 : !llvm.ptr -> i64
%1023 = llvm.getelementptr %1021[%1022] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1019 = llvm.load %1023 : !llvm.ptr -> i64
%1024 = llvm.getelementptr %1018[%1019] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1016 = llvm.load %1024 : !llvm.ptr -> i64
%1025 = llvm.mlir.addressof @uf_parent : !llvm.ptr
%1026 = llvm.load %1025 : !llvm.ptr -> !llvm.ptr
%1027 = llvm.load %1008 : !llvm.ptr -> i64
%1028 = llvm.getelementptr %1026[%1027] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1016, %1028 : i64, !llvm.ptr
%1030 = llvm.mlir.addressof @uf_parent : !llvm.ptr
%1031 = llvm.load %1030 : !llvm.ptr -> !llvm.ptr
%1032 = llvm.load %1008 : !llvm.ptr -> i64
%1033 = llvm.getelementptr %1031[%1032] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1029 = llvm.load %1033 : !llvm.ptr -> i64
llvm.store %1029, %1008 : i64, !llvm.ptr
cf.br ^bb168
^bb170:
%1034 = llvm.load %1008 : !llvm.ptr -> i64
func.return %1034 : i64
}
func.func @uf_union(%arg0: i64, %arg1: i64) -> () {
%1035 = func.call @uf_find(%arg0) : (i64) -> i64
%1036 = func.call @uf_find(%arg1) : (i64) -> i64
%1037 = arith.cmpi eq, %1035, %1036 : i64
cf.cond_br %1037, ^bb171, ^bb172
^bb171:
func.return
^bb172:
cf.br ^bb173
^bb173:
%1038 = llvm.mlir.constant(1 : i64) : i64
%1039 = llvm.alloca %1038 x i64 : (i64) -> !llvm.ptr
llvm.store %1035, %1039 : i64, !llvm.ptr
%1040 = llvm.mlir.constant(1 : i64) : i64
%1041 = llvm.alloca %1040 x i64 : (i64) -> !llvm.ptr
llvm.store %1036, %1041 : i64, !llvm.ptr
%1043 = llvm.mlir.addressof @uf_size : !llvm.ptr
%1044 = llvm.load %1043 : !llvm.ptr -> !llvm.ptr
%1045 = llvm.load %1039 : !llvm.ptr -> i64
%1046 = llvm.getelementptr %1044[%1045] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1042 = llvm.load %1046 : !llvm.ptr -> i64
%1048 = llvm.mlir.addressof @uf_size : !llvm.ptr
%1049 = llvm.load %1048 : !llvm.ptr -> !llvm.ptr
%1050 = llvm.load %1041 : !llvm.ptr -> i64
%1051 = llvm.getelementptr %1049[%1050] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1047 = llvm.load %1051 : !llvm.ptr -> i64
%1052 = arith.cmpi slt, %1042, %1047 : i64
cf.cond_br %1052, ^bb174, ^bb175
^bb174:
llvm.store %1036, %1039 : i64, !llvm.ptr
llvm.store %1035, %1041 : i64, !llvm.ptr
cf.br ^bb176
^bb175:
cf.br ^bb176
^bb176:
%1053 = llvm.load %1039 : !llvm.ptr -> i64
%1054 = llvm.mlir.addressof @uf_parent : !llvm.ptr
%1055 = llvm.load %1054 : !llvm.ptr -> !llvm.ptr
%1056 = llvm.load %1041 : !llvm.ptr -> i64
%1057 = llvm.getelementptr %1055[%1056] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1053, %1057 : i64, !llvm.ptr
%1059 = llvm.mlir.addressof @uf_size : !llvm.ptr
%1060 = llvm.load %1059 : !llvm.ptr -> !llvm.ptr
%1061 = llvm.load %1039 : !llvm.ptr -> i64
%1062 = llvm.getelementptr %1060[%1061] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1058 = llvm.load %1062 : !llvm.ptr -> i64
%1064 = llvm.mlir.addressof @uf_size : !llvm.ptr
%1065 = llvm.load %1064 : !llvm.ptr -> !llvm.ptr
%1066 = llvm.load %1041 : !llvm.ptr -> i64
%1067 = llvm.getelementptr %1065[%1066] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1063 = llvm.load %1067 : !llvm.ptr -> i64
%1068 = arith.addi %1058, %1063 : i64
%1069 = llvm.mlir.addressof @uf_size : !llvm.ptr
%1070 = llvm.load %1069 : !llvm.ptr -> !llvm.ptr
%1071 = llvm.load %1039 : !llvm.ptr -> i64
%1072 = llvm.getelementptr %1070[%1071] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1068, %1072 : i64, !llvm.ptr
func.return
}
func.func @strict_perfect_check(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i64) -> i64 {
%1074 = arith.constant 1024 : i32
%1075 = arith.extsi %1074 : i32 to i64
func.call @hs_init(%1075) : (i64) -> ()
%1076 = arith.constant 0 : i32
%1077 = arith.extsi %1076 : i32 to i64
%1078 = llvm.mlir.constant(1 : i64) : i64
%1079 = llvm.alloca %1078 x i64 : (i64) -> !llvm.ptr
llvm.store %1077, %1079 : i64, !llvm.ptr
cf.br ^bb177
^bb177:
%1080 = llvm.load %1079 : !llvm.ptr -> i64
%1081 = arith.cmpi slt, %1080, %arg0 : i64
cf.cond_br %1081, ^bb178, ^bb179
^bb178:
%1085 = llvm.load %1079 : !llvm.ptr -> i64
%1086 = llvm.getelementptr %arg1[%1085] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1084 = llvm.load %1086 : !llvm.ptr -> i64
%1088 = llvm.load %1079 : !llvm.ptr -> i64
%1089 = llvm.getelementptr %arg2[%1088] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1087 = llvm.load %1089 : !llvm.ptr -> i64
%1083 = func.call @encode(%1084, %1087) : (i64, i64) -> i64
func.call @hs_insert(%1083) : (i64) -> ()
%1090 = llvm.load %1079 : !llvm.ptr -> i64
%1091 = arith.constant 1 : i32
%1093 = arith.extsi %1091 : i32 to i64
%1092 = arith.addi %1090, %1093 : i64
llvm.store %1092, %1079 : i64, !llvm.ptr
cf.br ^bb177
^bb179:
%1094 = arith.constant 0 : i32
%1095 = arith.extsi %1094 : i32 to i64
llvm.store %1095, %1079 : i64, !llvm.ptr
cf.br ^bb180
^bb180:
%1096 = llvm.load %1079 : !llvm.ptr -> i64
%1097 = arith.cmpi slt, %1096, %arg0 : i64
cf.cond_br %1097, ^bb181, ^bb182
^bb181:
%1098 = arith.constant 0 : i32
%1099 = arith.extsi %1098 : i32 to i64
%1100 = llvm.mlir.constant(1 : i64) : i64
%1101 = llvm.alloca %1100 x i64 : (i64) -> !llvm.ptr
llvm.store %1099, %1101 : i64, !llvm.ptr
cf.br ^bb183
^bb183:
%1102 = llvm.load %1101 : !llvm.ptr -> i64
%1103 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1104 = llvm.load %1103 : !llvm.ptr -> i64
%1105 = arith.cmpi slt, %1102, %1104 : i64
cf.cond_br %1105, ^bb184, ^bb185
^bb184:
%1108 = llvm.load %1079 : !llvm.ptr -> i64
%1109 = llvm.getelementptr %arg1[%1108] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1107 = llvm.load %1109 : !llvm.ptr -> i64
%1110 = arith.constant 2 : i32
%1112 = llvm.mlir.addressof @circle_px : !llvm.ptr
%1113 = llvm.load %1112 : !llvm.ptr -> !llvm.ptr
%1114 = llvm.load %1101 : !llvm.ptr -> i64
%1115 = llvm.getelementptr %1113[%1114] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1111 = llvm.load %1115 : !llvm.ptr -> i64
%1117 = arith.extsi %1110 : i32 to i64
%1116 = arith.muli %1117, %1111 : i64
%1118 = arith.addi %1107, %1116 : i64
%1120 = llvm.load %1079 : !llvm.ptr -> i64
%1121 = llvm.getelementptr %arg2[%1120] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1119 = llvm.load %1121 : !llvm.ptr -> i64
%1122 = arith.constant 2 : i32
%1124 = llvm.mlir.addressof @circle_py : !llvm.ptr
%1125 = llvm.load %1124 : !llvm.ptr -> !llvm.ptr
%1126 = llvm.load %1101 : !llvm.ptr -> i64
%1127 = llvm.getelementptr %1125[%1126] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1123 = llvm.load %1127 : !llvm.ptr -> i64
%1129 = arith.extsi %1122 : i32 to i64
%1128 = arith.muli %1129, %1123 : i64
%1130 = arith.addi %1119, %1128 : i64
%1106 = func.call @encode(%1118, %1130) : (i64, i64) -> i64
%1131 = func.call @hs_contains(%1106) : (i64) -> i64
%1132 = arith.constant 0 : i32
%1134 = arith.extsi %1132 : i32 to i64
%1133 = arith.cmpi ne, %1131, %1134 : i64
cf.cond_br %1133, ^bb186, ^bb187
^bb186:
%1137 = llvm.load %1079 : !llvm.ptr -> i64
%1138 = llvm.getelementptr %arg1[%1137] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1136 = llvm.load %1138 : !llvm.ptr -> i64
%1140 = llvm.load %1079 : !llvm.ptr -> i64
%1141 = llvm.getelementptr %arg2[%1140] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1139 = llvm.load %1141 : !llvm.ptr -> i64
%1135 = func.call @encode(%1136, %1139) : (i64, i64) -> i64
%1142 = arith.cmpi slt, %1135, %1106 : i64
cf.cond_br %1142, ^bb189, ^bb190
^bb189:
func.call @hs_free() : () -> ()
%1144 = arith.constant 0 : i32
%1145 = arith.extsi %1144 : i32 to i64
func.return %1145 : i64
^bb190:
cf.br ^bb191
^bb191:
cf.br ^bb188
^bb187:
cf.br ^bb188
^bb188:
%1146 = llvm.load %1101 : !llvm.ptr -> i64
%1147 = arith.constant 1 : i32
%1149 = arith.extsi %1147 : i32 to i64
%1148 = arith.addi %1146, %1149 : i64
llvm.store %1148, %1101 : i64, !llvm.ptr
cf.br ^bb183
^bb185:
%1150 = llvm.load %1079 : !llvm.ptr -> i64
%1151 = arith.constant 1 : i32
%1153 = arith.extsi %1151 : i32 to i64
%1152 = arith.addi %1150, %1153 : i64
llvm.store %1152, %1079 : i64, !llvm.ptr
cf.br ^bb180
^bb182:
func.call @hs_free() : () -> ()
%1155 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1156 = llvm.load %1155 : !llvm.ptr -> i64
%1157 = arith.muli %arg0, %1156 : i64
%1159 = arith.constant 8 : i32
%1160 = arith.extsi %1159 : i32 to i64
%1158 = func.call @calloc(%1157, %1160) : (i64, i64) -> !llvm.ptr
%1162 = arith.constant 8 : i32
%1163 = arith.extsi %1162 : i32 to i64
%1161 = func.call @calloc(%1157, %1163) : (i64, i64) -> !llvm.ptr
%1165 = arith.constant 8 : i32
%1166 = arith.extsi %1165 : i32 to i64
%1164 = func.call @calloc(%1157, %1166) : (i64, i64) -> !llvm.ptr
%1168 = arith.constant 16384 : i32
%1169 = arith.extsi %1168 : i32 to i64
func.call @hm_init(%1169) : (i64) -> ()
%1170 = arith.constant 0 : i32
%1171 = arith.extsi %1170 : i32 to i64
%1172 = llvm.mlir.constant(1 : i64) : i64
%1173 = llvm.alloca %1172 x i64 : (i64) -> !llvm.ptr
llvm.store %1171, %1173 : i64, !llvm.ptr
%1174 = arith.constant 0 : i32
%1175 = arith.extsi %1174 : i32 to i64
%1176 = llvm.mlir.constant(1 : i64) : i64
%1177 = llvm.alloca %1176 x i64 : (i64) -> !llvm.ptr
llvm.store %1175, %1177 : i64, !llvm.ptr
cf.br ^bb192
^bb192:
%1178 = llvm.load %1177 : !llvm.ptr -> i64
%1179 = arith.cmpi slt, %1178, %arg0 : i64
cf.cond_br %1179, ^bb193, ^bb194
^bb193:
%1180 = arith.constant 0 : i32
%1181 = arith.extsi %1180 : i32 to i64
%1182 = llvm.mlir.constant(1 : i64) : i64
%1183 = llvm.alloca %1182 x i64 : (i64) -> !llvm.ptr
llvm.store %1181, %1183 : i64, !llvm.ptr
cf.br ^bb195
^bb195:
%1184 = llvm.load %1183 : !llvm.ptr -> i64
%1185 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1186 = llvm.load %1185 : !llvm.ptr -> i64
%1187 = arith.cmpi slt, %1184, %1186 : i64
cf.cond_br %1187, ^bb196, ^bb197
^bb196:
%1190 = llvm.load %1177 : !llvm.ptr -> i64
%1191 = llvm.getelementptr %arg1[%1190] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1189 = llvm.load %1191 : !llvm.ptr -> i64
%1193 = llvm.mlir.addressof @circle_px : !llvm.ptr
%1194 = llvm.load %1193 : !llvm.ptr -> !llvm.ptr
%1195 = llvm.load %1183 : !llvm.ptr -> i64
%1196 = llvm.getelementptr %1194[%1195] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1192 = llvm.load %1196 : !llvm.ptr -> i64
%1197 = arith.addi %1189, %1192 : i64
%1199 = llvm.load %1177 : !llvm.ptr -> i64
%1200 = llvm.getelementptr %arg2[%1199] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1198 = llvm.load %1200 : !llvm.ptr -> i64
%1202 = llvm.mlir.addressof @circle_py : !llvm.ptr
%1203 = llvm.load %1202 : !llvm.ptr -> !llvm.ptr
%1204 = llvm.load %1183 : !llvm.ptr -> i64
%1205 = llvm.getelementptr %1203[%1204] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1201 = llvm.load %1205 : !llvm.ptr -> i64
%1206 = arith.addi %1198, %1201 : i64
%1188 = func.call @encode(%1197, %1206) : (i64, i64) -> i64
%1207 = func.call @hm_get(%1188) : (i64) -> i64
%1208 = arith.constant 1 : i32
%1210 = arith.constant 0 : i32
%1209 = arith.subi %1210, %1208 : i32
%1212 = arith.extsi %1209 : i32 to i64
%1211 = arith.cmpi eq, %1207, %1212 : i64
cf.cond_br %1211, ^bb198, ^bb199
^bb198:
%1213 = llvm.load %1173 : !llvm.ptr -> i64
%1214 = llvm.getelementptr %1164[%1213] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1188, %1214 : i64, !llvm.ptr
%1215 = llvm.load %1177 : !llvm.ptr -> i64
%1216 = llvm.load %1173 : !llvm.ptr -> i64
%1217 = llvm.getelementptr %1161[%1216] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1215, %1217 : i64, !llvm.ptr
%1218 = arith.constant 1 : i32
%1220 = arith.constant 0 : i32
%1219 = arith.subi %1220, %1218 : i32
%1221 = llvm.load %1173 : !llvm.ptr -> i64
%1222 = arith.extsi %1219 : i32 to i64
%1223 = llvm.getelementptr %1158[%1221] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1222, %1223 : i64, !llvm.ptr
%1225 = llvm.load %1173 : !llvm.ptr -> i64
func.call @hm_set(%1188, %1225) : (i64, i64) -> ()
%1226 = llvm.load %1173 : !llvm.ptr -> i64
%1227 = arith.constant 1 : i32
%1229 = arith.extsi %1227 : i32 to i64
%1228 = arith.addi %1226, %1229 : i64
llvm.store %1228, %1173 : i64, !llvm.ptr
cf.br ^bb200
^bb199:
%1230 = llvm.load %1173 : !llvm.ptr -> i64
%1231 = llvm.getelementptr %1164[%1230] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1188, %1231 : i64, !llvm.ptr
%1232 = llvm.load %1177 : !llvm.ptr -> i64
%1233 = llvm.load %1173 : !llvm.ptr -> i64
%1234 = llvm.getelementptr %1161[%1233] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1232, %1234 : i64, !llvm.ptr
%1235 = llvm.load %1173 : !llvm.ptr -> i64
%1236 = llvm.getelementptr %1158[%1235] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1207, %1236 : i64, !llvm.ptr
%1238 = llvm.load %1173 : !llvm.ptr -> i64
func.call @hm_set(%1188, %1238) : (i64, i64) -> ()
%1239 = llvm.load %1173 : !llvm.ptr -> i64
%1240 = arith.constant 1 : i32
%1242 = arith.extsi %1240 : i32 to i64
%1241 = arith.addi %1239, %1242 : i64
llvm.store %1241, %1173 : i64, !llvm.ptr
cf.br ^bb200
^bb200:
%1243 = llvm.load %1183 : !llvm.ptr -> i64
%1244 = arith.constant 1 : i32
%1246 = arith.extsi %1244 : i32 to i64
%1245 = arith.addi %1243, %1246 : i64
llvm.store %1245, %1183 : i64, !llvm.ptr
cf.br ^bb195
^bb197:
%1247 = llvm.load %1177 : !llvm.ptr -> i64
%1248 = arith.constant 1 : i32
%1250 = arith.extsi %1248 : i32 to i64
%1249 = arith.addi %1247, %1250 : i64
llvm.store %1249, %1177 : i64, !llvm.ptr
cf.br ^bb192
^bb194:
%1251 = arith.constant 0 : i32
%1252 = arith.extsi %1251 : i32 to i64
%1253 = llvm.mlir.constant(1 : i64) : i64
%1254 = llvm.alloca %1253 x i64 : (i64) -> !llvm.ptr
llvm.store %1252, %1254 : i64, !llvm.ptr
cf.br ^bb201
^bb201:
%1255 = llvm.load %1254 : !llvm.ptr -> i64
%1256 = arith.cmpi slt, %1255, %arg3 : i64
cf.cond_br %1256, ^bb202, ^bb203
^bb202:
%1257 = llvm.load %1254 : !llvm.ptr -> i64
%1258 = llvm.mlir.addressof @uf_parent : !llvm.ptr
%1259 = llvm.load %1258 : !llvm.ptr -> !llvm.ptr
%1260 = llvm.load %1254 : !llvm.ptr -> i64
%1261 = llvm.getelementptr %1259[%1260] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1257, %1261 : i64, !llvm.ptr
%1262 = arith.constant 1 : i32
%1263 = llvm.mlir.addressof @uf_size : !llvm.ptr
%1264 = llvm.load %1263 : !llvm.ptr -> !llvm.ptr
%1265 = llvm.load %1254 : !llvm.ptr -> i64
%1266 = arith.extsi %1262 : i32 to i64
%1267 = llvm.getelementptr %1264[%1265] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1266, %1267 : i64, !llvm.ptr
%1268 = llvm.load %1254 : !llvm.ptr -> i64
%1269 = arith.constant 1 : i32
%1271 = arith.extsi %1269 : i32 to i64
%1270 = arith.addi %1268, %1271 : i64
llvm.store %1270, %1254 : i64, !llvm.ptr
cf.br ^bb201
^bb203:
%1272 = arith.constant 0 : i32
%1273 = arith.extsi %1272 : i32 to i64
%1274 = llvm.mlir.constant(1 : i64) : i64
%1275 = llvm.alloca %1274 x i64 : (i64) -> !llvm.ptr
llvm.store %1273, %1275 : i64, !llvm.ptr
%1276 = arith.constant 0 : i32
%1277 = arith.extsi %1276 : i32 to i64
%1278 = llvm.mlir.constant(1 : i64) : i64
%1279 = llvm.alloca %1278 x i64 : (i64) -> !llvm.ptr
llvm.store %1277, %1279 : i64, !llvm.ptr
cf.br ^bb204
^bb204:
%1280 = llvm.load %1279 : !llvm.ptr -> i64
%1281 = llvm.mlir.addressof @hm_cap : !llvm.ptr
%1282 = llvm.load %1281 : !llvm.ptr -> i64
%1283 = arith.cmpi slt, %1280, %1282 : i64
cf.cond_br %1283, ^bb205, ^bb206
^bb205:
%1285 = llvm.mlir.addressof @hm_used : !llvm.ptr
%1286 = llvm.load %1285 : !llvm.ptr -> !llvm.ptr
%1287 = llvm.load %1279 : !llvm.ptr -> i64
%1288 = llvm.getelementptr %1286[%1287] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1284 = llvm.load %1288 : !llvm.ptr -> i64
%1289 = arith.constant 0 : i32
%1291 = arith.extsi %1289 : i32 to i64
%1290 = arith.cmpi ne, %1284, %1291 : i64
cf.cond_br %1290, ^bb207, ^bb208
^bb207:
%1293 = llvm.mlir.addressof @hm_keys : !llvm.ptr
%1294 = llvm.load %1293 : !llvm.ptr -> !llvm.ptr
%1295 = llvm.load %1279 : !llvm.ptr -> i64
%1296 = llvm.getelementptr %1294[%1295] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1292 = llvm.load %1296 : !llvm.ptr -> i64
%1298 = llvm.mlir.addressof @hm_vals : !llvm.ptr
%1299 = llvm.load %1298 : !llvm.ptr -> !llvm.ptr
%1300 = llvm.load %1279 : !llvm.ptr -> i64
%1301 = llvm.getelementptr %1299[%1300] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1297 = llvm.load %1301 : !llvm.ptr -> i64
%1302 = arith.constant 0 : i32
%1303 = arith.extsi %1302 : i32 to i64
%1304 = llvm.mlir.constant(1 : i64) : i64
%1305 = llvm.alloca %1304 x i64 : (i64) -> !llvm.ptr
llvm.store %1303, %1305 : i64, !llvm.ptr
%1306 = llvm.mlir.constant(1 : i64) : i64
%1307 = llvm.alloca %1306 x i64 : (i64) -> !llvm.ptr
llvm.store %1297, %1307 : i64, !llvm.ptr
cf.br ^bb210
^bb210:
%1308 = llvm.load %1307 : !llvm.ptr -> i64
%1309 = arith.constant 1 : i32
%1311 = arith.constant 0 : i32
%1310 = arith.subi %1311, %1309 : i32
%1313 = arith.extsi %1310 : i32 to i64
%1312 = arith.cmpi ne, %1308, %1313 : i64
cf.cond_br %1312, ^bb211, ^bb212
^bb211:
%1314 = llvm.load %1305 : !llvm.ptr -> i64
%1315 = arith.constant 1 : i32
%1317 = arith.extsi %1315 : i32 to i64
%1316 = arith.addi %1314, %1317 : i64
llvm.store %1316, %1305 : i64, !llvm.ptr
%1319 = llvm.load %1307 : !llvm.ptr -> i64
%1320 = llvm.getelementptr %1158[%1319] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1318 = llvm.load %1320 : !llvm.ptr -> i64
llvm.store %1318, %1307 : i64, !llvm.ptr
cf.br ^bb210
^bb212:
%1321 = llvm.load %1305 : !llvm.ptr -> i64
%1322 = arith.constant 2 : i32
%1324 = arith.extsi %1322 : i32 to i64
%1323 = arith.cmpi sge, %1321, %1324 : i64
cf.cond_br %1323, ^bb213, ^bb214
^bb213:
%1325 = llvm.load %1275 : !llvm.ptr -> i64
%1326 = arith.constant 1 : i32
%1328 = arith.extsi %1326 : i32 to i64
%1327 = arith.addi %1325, %1328 : i64
llvm.store %1327, %1275 : i64, !llvm.ptr
llvm.store %1297, %1307 : i64, !llvm.ptr
%1330 = llvm.load %1307 : !llvm.ptr -> i64
%1331 = llvm.getelementptr %1161[%1330] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1329 = llvm.load %1331 : !llvm.ptr -> i64
%1333 = llvm.load %1307 : !llvm.ptr -> i64
%1334 = llvm.getelementptr %1158[%1333] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1332 = llvm.load %1334 : !llvm.ptr -> i64
llvm.store %1332, %1307 : i64, !llvm.ptr
cf.br ^bb216
^bb216:
%1335 = llvm.load %1307 : !llvm.ptr -> i64
%1336 = arith.constant 1 : i32
%1338 = arith.constant 0 : i32
%1337 = arith.subi %1338, %1336 : i32
%1340 = arith.extsi %1337 : i32 to i64
%1339 = arith.cmpi ne, %1335, %1340 : i64
cf.cond_br %1339, ^bb217, ^bb218
^bb217:
%1343 = llvm.load %1307 : !llvm.ptr -> i64
%1344 = llvm.getelementptr %1161[%1343] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1342 = llvm.load %1344 : !llvm.ptr -> i64
func.call @uf_union(%1329, %1342) : (i64, i64) -> ()
%1346 = llvm.load %1307 : !llvm.ptr -> i64
%1347 = llvm.getelementptr %1158[%1346] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1345 = llvm.load %1347 : !llvm.ptr -> i64
llvm.store %1345, %1307 : i64, !llvm.ptr
cf.br ^bb216
^bb218:
cf.br ^bb215
^bb214:
cf.br ^bb215
^bb215:
cf.br ^bb209
^bb208:
cf.br ^bb209
^bb209:
%1348 = llvm.load %1279 : !llvm.ptr -> i64
%1349 = arith.constant 1 : i32
%1351 = arith.extsi %1349 : i32 to i64
%1350 = arith.addi %1348, %1351 : i64
llvm.store %1350, %1279 : i64, !llvm.ptr
cf.br ^bb204
^bb206:
func.call @free(%1158) : (!llvm.ptr) -> ()
func.call @free(%1161) : (!llvm.ptr) -> ()
func.call @free(%1164) : (!llvm.ptr) -> ()
func.call @hm_free() : () -> ()
%1356 = llvm.load %1275 : !llvm.ptr -> i64
%1357 = arith.cmpi ne, %1356, %arg3 : i64
cf.cond_br %1357, ^bb219, ^bb220
^bb219:
%1358 = arith.constant 0 : i32
%1359 = arith.extsi %1358 : i32 to i64
func.return %1359 : i64
^bb220:
cf.br ^bb221
^bb221:
%1361 = arith.constant 0 : i32
%1362 = arith.extsi %1361 : i32 to i64
%1360 = func.call @uf_find(%1362) : (i64) -> i64
%1363 = arith.constant 1 : i32
%1364 = arith.extsi %1363 : i32 to i64
%1365 = llvm.mlir.constant(1 : i64) : i64
%1366 = llvm.alloca %1365 x i64 : (i64) -> !llvm.ptr
llvm.store %1364, %1366 : i64, !llvm.ptr
cf.br ^bb222
^bb222:
%1367 = llvm.load %1366 : !llvm.ptr -> i64
%1368 = arith.cmpi slt, %1367, %arg3 : i64
cf.cond_br %1368, ^bb223, ^bb224
^bb223:
%1370 = llvm.load %1366 : !llvm.ptr -> i64
%1369 = func.call @uf_find(%1370) : (i64) -> i64
%1371 = arith.cmpi ne, %1369, %1360 : i64
cf.cond_br %1371, ^bb225, ^bb226
^bb225:
%1372 = arith.constant 0 : i32
%1373 = arith.extsi %1372 : i32 to i64
func.return %1373 : i64
^bb226:
cf.br ^bb227
^bb227:
%1374 = llvm.load %1366 : !llvm.ptr -> i64
%1375 = arith.constant 1 : i32
%1377 = arith.extsi %1375 : i32 to i64
%1376 = arith.addi %1374, %1377 : i64
llvm.store %1376, %1366 : i64, !llvm.ptr
cf.br ^bb222
^bb224:
%1378 = arith.constant 1 : i32
%1379 = arith.extsi %1378 : i32 to i64
func.return %1379 : i64
}
func.func @dfs(%arg0: i64, %arg1: i64) -> i64 {
%1380 = llvm.mlir.addressof @dfs_k : !llvm.ptr
%1381 = llvm.load %1380 : !llvm.ptr -> i64
%1382 = arith.cmpi eq, %arg1, %1381 : i64
cf.cond_br %1382, ^bb228, ^bb229
^bb228:
%1384 = arith.constant 1024 : i32
%1385 = arith.constant 8 : i32
%1386 = arith.extsi %1384 : i32 to i64
%1387 = arith.extsi %1385 : i32 to i64
%1383 = func.call @calloc(%1386, %1387) : (i64, i64) -> !llvm.ptr
%1389 = arith.constant 1024 : i32
%1390 = arith.constant 8 : i32
%1391 = arith.extsi %1389 : i32 to i64
%1392 = arith.extsi %1390 : i32 to i64
%1388 = func.call @calloc(%1391, %1392) : (i64, i64) -> !llvm.ptr
%1394 = llvm.mlir.addressof @sel_x : !llvm.ptr
%1395 = llvm.load %1394 : !llvm.ptr -> !llvm.ptr
%1396 = llvm.mlir.addressof @sel_y : !llvm.ptr
%1397 = llvm.load %1396 : !llvm.ptr -> !llvm.ptr
%1398 = llvm.mlir.addressof @dfs_k : !llvm.ptr
%1399 = llvm.load %1398 : !llvm.ptr -> i64
%1400 = llvm.mlir.addressof @dfs_masks : !llvm.ptr
%1401 = llvm.load %1400 : !llvm.ptr -> !llvm.ptr
%1402 = llvm.mlir.addressof @dfs_nmasks : !llvm.ptr
%1403 = llvm.load %1402 : !llvm.ptr -> i64
func.call @centers_from_vectors(%1395, %1397, %1399, %1401, %1403, %1383, %1388) : (!llvm.ptr, !llvm.ptr, i64, !llvm.ptr, i64, !llvm.ptr, !llvm.ptr) -> ()
%1405 = llvm.mlir.addressof @dfs_nmasks : !llvm.ptr
%1406 = llvm.load %1405 : !llvm.ptr -> i64
%1407 = llvm.mlir.addressof @dfs_n : !llvm.ptr
%1408 = llvm.load %1407 : !llvm.ptr -> i64
%1404 = func.call @quick_harmony_count_equals_n(%1406, %1383, %1388, %1408) : (i64, !llvm.ptr, !llvm.ptr, i64) -> i64
%1409 = arith.constant 0 : i32
%1410 = arith.extsi %1409 : i32 to i64
%1411 = llvm.mlir.constant(1 : i64) : i64
%1412 = llvm.alloca %1411 x i64 : (i64) -> !llvm.ptr
llvm.store %1410, %1412 : i64, !llvm.ptr
%1413 = arith.constant 0 : i32
%1415 = arith.extsi %1413 : i32 to i64
%1414 = arith.cmpi ne, %1404, %1415 : i64
cf.cond_br %1414, ^bb231, ^bb232
^bb231:
%1417 = llvm.mlir.addressof @dfs_nmasks : !llvm.ptr
%1418 = llvm.load %1417 : !llvm.ptr -> i64
%1419 = llvm.mlir.addressof @dfs_n : !llvm.ptr
%1420 = llvm.load %1419 : !llvm.ptr -> i64
%1416 = func.call @strict_perfect_check(%1418, %1383, %1388, %1420) : (i64, !llvm.ptr, !llvm.ptr, i64) -> i64
llvm.store %1416, %1412 : i64, !llvm.ptr
cf.br ^bb233
^bb232:
cf.br ^bb233
^bb233:
func.call @free(%1383) : (!llvm.ptr) -> ()
func.call @free(%1388) : (!llvm.ptr) -> ()
%1423 = llvm.load %1412 : !llvm.ptr -> i64
func.return %1423 : i64
^bb229:
cf.br ^bb230
^bb230:
%1424 = llvm.mlir.addressof @dfs_k : !llvm.ptr
%1425 = llvm.load %1424 : !llvm.ptr -> i64
%1426 = arith.subi %1425, %arg1 : i64
%1427 = llvm.mlir.constant(1 : i64) : i64
%1428 = llvm.alloca %1427 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %1428 : i64, !llvm.ptr
cf.br ^bb234
^bb234:
%1429 = llvm.load %1428 : !llvm.ptr -> i64
%1430 = llvm.mlir.addressof @num_pairs : !llvm.ptr
%1431 = llvm.load %1430 : !llvm.ptr -> i64
%1432 = arith.subi %1431, %1426 : i64
%1433 = arith.constant 1 : i32
%1435 = arith.extsi %1433 : i32 to i64
%1434 = arith.addi %1432, %1435 : i64
%1436 = arith.cmpi slt, %1429, %1434 : i64
cf.cond_br %1436, ^bb235, ^bb236
^bb235:
%1437 = arith.constant 0 : i32
%1438 = arith.extsi %1437 : i32 to i64
%1439 = arith.constant 0 : i32
%1441 = arith.extsi %1439 : i32 to i64
%1440 = arith.cmpi eq, %arg1, %1441 : i64
%1442 = scf.if %1440 -> (i64) {
%1443 = arith.constant 1 : i32
%1444 = arith.extsi %1443 : i32 to i64
scf.yield %1444 : i64
} else {
%1445 = arith.constant 2 : i32
%1446 = arith.extsi %1445 : i32 to i64
scf.yield %1446 : i64
}
%1447 = arith.constant 0 : i32
%1448 = arith.extsi %1447 : i32 to i64
%1449 = llvm.mlir.constant(1 : i64) : i64
%1450 = llvm.alloca %1449 x i64 : (i64) -> !llvm.ptr
llvm.store %1448, %1450 : i64, !llvm.ptr
cf.br ^bb237
^bb237:
%1451 = llvm.load %1450 : !llvm.ptr -> i64
%1452 = arith.cmpi slt, %1451, %1442 : i64
cf.cond_br %1452, ^bb238, ^bb239
^bb238:
%1453 = arith.constant 0 : i32
%1454 = arith.extsi %1453 : i32 to i64
%1455 = llvm.mlir.constant(1 : i64) : i64
%1456 = llvm.alloca %1455 x i64 : (i64) -> !llvm.ptr
llvm.store %1454, %1456 : i64, !llvm.ptr
%1457 = arith.constant 0 : i32
%1458 = arith.extsi %1457 : i32 to i64
%1459 = llvm.mlir.constant(1 : i64) : i64
%1460 = llvm.alloca %1459 x i64 : (i64) -> !llvm.ptr
llvm.store %1458, %1460 : i64, !llvm.ptr
%1461 = llvm.load %1450 : !llvm.ptr -> i64
%1462 = arith.constant 0 : i32
%1464 = arith.extsi %1462 : i32 to i64
%1463 = arith.cmpi eq, %1461, %1464 : i64
cf.cond_br %1463, ^bb240, ^bb241
^bb240:
%1466 = llvm.mlir.addressof @pair_px : !llvm.ptr
%1467 = llvm.load %1466 : !llvm.ptr -> !llvm.ptr
%1468 = llvm.load %1428 : !llvm.ptr -> i64
%1469 = llvm.getelementptr %1467[%1468] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1465 = llvm.load %1469 : !llvm.ptr -> i64
llvm.store %1465, %1456 : i64, !llvm.ptr
%1471 = llvm.mlir.addressof @pair_py : !llvm.ptr
%1472 = llvm.load %1471 : !llvm.ptr -> !llvm.ptr
%1473 = llvm.load %1428 : !llvm.ptr -> i64
%1474 = llvm.getelementptr %1472[%1473] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1470 = llvm.load %1474 : !llvm.ptr -> i64
llvm.store %1470, %1460 : i64, !llvm.ptr
cf.br ^bb242
^bb241:
%1476 = llvm.mlir.addressof @pair_nx : !llvm.ptr
%1477 = llvm.load %1476 : !llvm.ptr -> !llvm.ptr
%1478 = llvm.load %1428 : !llvm.ptr -> i64
%1479 = llvm.getelementptr %1477[%1478] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1475 = llvm.load %1479 : !llvm.ptr -> i64
llvm.store %1475, %1456 : i64, !llvm.ptr
%1481 = llvm.mlir.addressof @pair_ny : !llvm.ptr
%1482 = llvm.load %1481 : !llvm.ptr -> !llvm.ptr
%1483 = llvm.load %1428 : !llvm.ptr -> i64
%1484 = llvm.getelementptr %1482[%1483] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1480 = llvm.load %1484 : !llvm.ptr -> i64
llvm.store %1480, %1460 : i64, !llvm.ptr
cf.br ^bb242
^bb242:
%1486 = llvm.load %1456 : !llvm.ptr -> i64
%1487 = llvm.load %1460 : !llvm.ptr -> i64
%1485 = func.call @passes_four_vector_prune(%arg1, %1486, %1487) : (i64, i64, i64) -> i64
%1488 = arith.constant 0 : i32
%1490 = arith.extsi %1488 : i32 to i64
%1489 = arith.cmpi ne, %1485, %1490 : i64
cf.cond_br %1489, ^bb243, ^bb244
^bb243:
%1491 = llvm.load %1456 : !llvm.ptr -> i64
%1492 = llvm.mlir.addressof @sel_x : !llvm.ptr
%1493 = llvm.load %1492 : !llvm.ptr -> !llvm.ptr
%1494 = llvm.getelementptr %1493[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1491, %1494 : i64, !llvm.ptr
%1495 = llvm.load %1460 : !llvm.ptr -> i64
%1496 = llvm.mlir.addressof @sel_y : !llvm.ptr
%1497 = llvm.load %1496 : !llvm.ptr -> !llvm.ptr
%1498 = llvm.getelementptr %1497[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1495, %1498 : i64, !llvm.ptr
%1500 = llvm.load %1428 : !llvm.ptr -> i64
%1501 = arith.constant 1 : i32
%1503 = arith.extsi %1501 : i32 to i64
%1502 = arith.addi %1500, %1503 : i64
%1504 = arith.constant 1 : i32
%1506 = arith.extsi %1504 : i32 to i64
%1505 = arith.addi %arg1, %1506 : i64
%1499 = func.call @dfs(%1502, %1505) : (i64, i64) -> i64
%1507 = arith.constant 0 : i32
%1509 = arith.extsi %1507 : i32 to i64
%1508 = arith.cmpi ne, %1499, %1509 : i64
cf.cond_br %1508, ^bb246, ^bb247
^bb246:
%1510 = arith.constant 1 : i32
%1511 = arith.extsi %1510 : i32 to i64
func.return %1511 : i64
^bb247:
cf.br ^bb248
^bb248:
cf.br ^bb245
^bb244:
cf.br ^bb245
^bb245:
%1512 = llvm.load %1450 : !llvm.ptr -> i64
%1513 = arith.constant 1 : i32
%1515 = arith.extsi %1513 : i32 to i64
%1514 = arith.addi %1512, %1515 : i64
llvm.store %1514, %1450 : i64, !llvm.ptr
cf.br ^bb237
^bb239:
%1516 = llvm.load %1428 : !llvm.ptr -> i64
%1517 = arith.constant 1 : i32
%1519 = arith.extsi %1517 : i32 to i64
%1518 = arith.addi %1516, %1519 : i64
llvm.store %1518, %1428 : i64, !llvm.ptr
cf.br ^bb234
^bb236:
%1520 = arith.constant 0 : i32
%1521 = arith.extsi %1520 : i32 to i64
func.return %1521 : i64
}
func.func @has_valid_oriented_vectors(%arg0: i64, %arg1: i64) -> i64 {
%1522 = llvm.mlir.addressof @dfs_k : !llvm.ptr
llvm.store %arg0, %1522 : i64, !llvm.ptr
%1523 = llvm.mlir.addressof @dfs_n : !llvm.ptr
llvm.store %arg1, %1523 : i64, !llvm.ptr
func.call @compute_even_masks(%arg0) : (i64) -> ()
%1525 = llvm.mlir.addressof @num_even_masks : !llvm.ptr
%1526 = llvm.load %1525 : !llvm.ptr -> i64
%1527 = llvm.mlir.addressof @dfs_nmasks : !llvm.ptr
llvm.store %1526, %1527 : i64, !llvm.ptr
%1528 = arith.constant 0 : i32
%1529 = arith.extsi %1528 : i32 to i64
%1530 = llvm.mlir.constant(1 : i64) : i64
%1531 = llvm.alloca %1530 x i64 : (i64) -> !llvm.ptr
llvm.store %1529, %1531 : i64, !llvm.ptr
cf.br ^bb249
^bb249:
%1532 = llvm.load %1531 : !llvm.ptr -> i64
%1533 = llvm.mlir.addressof @num_even_masks : !llvm.ptr
%1534 = llvm.load %1533 : !llvm.ptr -> i64
%1535 = arith.cmpi slt, %1532, %1534 : i64
cf.cond_br %1535, ^bb250, ^bb251
^bb250:
%1537 = llvm.mlir.addressof @even_masks : !llvm.ptr
%1538 = llvm.load %1537 : !llvm.ptr -> !llvm.ptr
%1539 = llvm.load %1531 : !llvm.ptr -> i64
%1540 = llvm.getelementptr %1538[%1539] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1536 = llvm.load %1540 : !llvm.ptr -> i64
%1541 = llvm.mlir.addressof @dfs_masks : !llvm.ptr
%1542 = llvm.load %1541 : !llvm.ptr -> !llvm.ptr
%1543 = llvm.load %1531 : !llvm.ptr -> i64
%1544 = llvm.getelementptr %1542[%1543] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1536, %1544 : i64, !llvm.ptr
%1545 = llvm.load %1531 : !llvm.ptr -> i64
%1546 = arith.constant 1 : i32
%1548 = arith.extsi %1546 : i32 to i64
%1547 = arith.addi %1545, %1548 : i64
llvm.store %1547, %1531 : i64, !llvm.ptr
cf.br ^bb249
^bb251:
%1550 = arith.constant 0 : i32
%1551 = arith.constant 0 : i32
%1552 = arith.extsi %1550 : i32 to i64
%1553 = arith.extsi %1551 : i32 to i64
%1549 = func.call @dfs(%1552, %1553) : (i64, i64) -> i64
func.return %1549 : i64
}
func.func @sort_points(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> () {
%1554 = arith.constant 0 : i32
%1555 = arith.extsi %1554 : i32 to i64
%1556 = llvm.mlir.constant(1 : i64) : i64
%1557 = llvm.alloca %1556 x i64 : (i64) -> !llvm.ptr
llvm.store %1555, %1557 : i64, !llvm.ptr
cf.br ^bb252
^bb252:
%1558 = llvm.load %1557 : !llvm.ptr -> i64
%1559 = arith.cmpi slt, %1558, %arg0 : i64
cf.cond_br %1559, ^bb253, ^bb254
^bb253:
%1560 = llvm.load %1557 : !llvm.ptr -> i64
%1561 = llvm.mlir.constant(1 : i64) : i64
%1562 = llvm.alloca %1561 x i64 : (i64) -> !llvm.ptr
llvm.store %1560, %1562 : i64, !llvm.ptr
%1563 = llvm.load %1557 : !llvm.ptr -> i64
%1564 = arith.constant 1 : i32
%1566 = arith.extsi %1564 : i32 to i64
%1565 = arith.addi %1563, %1566 : i64
%1567 = llvm.mlir.constant(1 : i64) : i64
%1568 = llvm.alloca %1567 x i64 : (i64) -> !llvm.ptr
llvm.store %1565, %1568 : i64, !llvm.ptr
cf.br ^bb255
^bb255:
%1569 = llvm.load %1568 : !llvm.ptr -> i64
%1570 = arith.cmpi slt, %1569, %arg0 : i64
cf.cond_br %1570, ^bb256, ^bb257
^bb256:
%1572 = llvm.load %1568 : !llvm.ptr -> i64
%1573 = llvm.getelementptr %arg1[%1572] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1571 = llvm.load %1573 : !llvm.ptr -> i64
%1575 = llvm.load %1562 : !llvm.ptr -> i64
%1576 = llvm.getelementptr %arg1[%1575] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1574 = llvm.load %1576 : !llvm.ptr -> i64
%1577 = arith.cmpi slt, %1571, %1574 : i64
%1578 = scf.if %1577 -> (i1) {
%1579 = arith.constant true
scf.yield %1579 : i1
} else {
%1581 = llvm.load %1568 : !llvm.ptr -> i64
%1582 = llvm.getelementptr %arg1[%1581] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1580 = llvm.load %1582 : !llvm.ptr -> i64
%1584 = llvm.load %1562 : !llvm.ptr -> i64
%1585 = llvm.getelementptr %arg1[%1584] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1583 = llvm.load %1585 : !llvm.ptr -> i64
%1586 = arith.cmpi eq, %1580, %1583 : i64
%1587 = scf.if %1586 -> (i1) {
%1589 = llvm.load %1568 : !llvm.ptr -> i64
%1590 = llvm.getelementptr %arg2[%1589] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1588 = llvm.load %1590 : !llvm.ptr -> i64
%1592 = llvm.load %1562 : !llvm.ptr -> i64
%1593 = llvm.getelementptr %arg2[%1592] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1591 = llvm.load %1593 : !llvm.ptr -> i64
%1594 = arith.cmpi slt, %1588, %1591 : i64
scf.yield %1594 : i1
} else {
%1595 = arith.constant false
scf.yield %1595 : i1
}
scf.yield %1587 : i1
}
cf.cond_br %1578, ^bb258, ^bb259
^bb258:
%1596 = llvm.load %1568 : !llvm.ptr -> i64
llvm.store %1596, %1562 : i64, !llvm.ptr
cf.br ^bb260
^bb259:
cf.br ^bb260
^bb260:
%1597 = llvm.load %1568 : !llvm.ptr -> i64
%1598 = arith.constant 1 : i32
%1600 = arith.extsi %1598 : i32 to i64
%1599 = arith.addi %1597, %1600 : i64
llvm.store %1599, %1568 : i64, !llvm.ptr
cf.br ^bb255
^bb257:
%1601 = llvm.load %1562 : !llvm.ptr -> i64
%1602 = llvm.load %1557 : !llvm.ptr -> i64
%1603 = arith.cmpi ne, %1601, %1602 : i64
cf.cond_br %1603, ^bb261, ^bb262
^bb261:
%1605 = llvm.load %1557 : !llvm.ptr -> i64
%1606 = llvm.getelementptr %arg1[%1605] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1604 = llvm.load %1606 : !llvm.ptr -> i64
%1608 = llvm.load %1557 : !llvm.ptr -> i64
%1609 = llvm.getelementptr %arg2[%1608] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1607 = llvm.load %1609 : !llvm.ptr -> i64
%1611 = llvm.load %1562 : !llvm.ptr -> i64
%1612 = llvm.getelementptr %arg1[%1611] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1610 = llvm.load %1612 : !llvm.ptr -> i64
%1613 = llvm.load %1557 : !llvm.ptr -> i64
%1614 = llvm.getelementptr %arg1[%1613] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1610, %1614 : i64, !llvm.ptr
%1616 = llvm.load %1562 : !llvm.ptr -> i64
%1617 = llvm.getelementptr %arg2[%1616] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1615 = llvm.load %1617 : !llvm.ptr -> i64
%1618 = llvm.load %1557 : !llvm.ptr -> i64
%1619 = llvm.getelementptr %arg2[%1618] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1615, %1619 : i64, !llvm.ptr
%1620 = llvm.load %1562 : !llvm.ptr -> i64
%1621 = llvm.getelementptr %arg1[%1620] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1604, %1621 : i64, !llvm.ptr
%1622 = llvm.load %1562 : !llvm.ptr -> i64
%1623 = llvm.getelementptr %arg2[%1622] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1607, %1623 : i64, !llvm.ptr
cf.br ^bb263
^bb262:
cf.br ^bb263
^bb263:
%1624 = llvm.load %1557 : !llvm.ptr -> i64
%1625 = arith.constant 1 : i32
%1627 = arith.extsi %1625 : i32 to i64
%1626 = arith.addi %1624, %1627 : i64
llvm.store %1626, %1557 : i64, !llvm.ptr
cf.br ^bb252
^bb254:
func.return
}
func.func @find_min_radius_sq(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
%1628 = arith.constant 1 : i32
%1629 = arith.constant 1 : i32
%1631 = arith.extsi %1629 : i32 to i64
%1630 = arith.subi %arg0, %1631 : i64
%1633 = arith.extsi %1628 : i32 to i64
%1632 = arith.shli %1633, %1630 : i64
%1634 = arith.constant 1 : i32
%1635 = arith.extsi %1634 : i32 to i64
%1636 = llvm.mlir.constant(1 : i64) : i64
%1637 = llvm.alloca %1636 x i64 : (i64) -> !llvm.ptr
llvm.store %1635, %1637 : i64, !llvm.ptr
cf.br ^bb264
^bb264:
%1638 = llvm.load %1637 : !llvm.ptr -> i64
%1639 = arith.cmpi sle, %1638, %arg1 : i64
cf.cond_br %1639, ^bb265, ^bb266
^bb265:
%1641 = llvm.load %1637 : !llvm.ptr -> i64
%1640 = func.call @antipodal_pair_count(%1641) : (i64) -> i64
%1642 = arith.cmpi slt, %1640, %arg0 : i64
cf.cond_br %1642, ^bb267, ^bb268
^bb267:
%1643 = llvm.load %1637 : !llvm.ptr -> i64
%1644 = arith.constant 1 : i32
%1646 = arith.extsi %1644 : i32 to i64
%1645 = arith.addi %1643, %1646 : i64
llvm.store %1645, %1637 : i64, !llvm.ptr
cf.br ^bb269
^bb268:
%1647 = arith.constant 0 : i32
%1648 = arith.extsi %1647 : i32 to i64
%1649 = llvm.mlir.constant(1 : i64) : i64
%1650 = llvm.alloca %1649 x i64 : (i64) -> !llvm.ptr
llvm.store %1648, %1650 : i64, !llvm.ptr
%1651 = arith.constant 0 : i32
%1653 = arith.extsi %1651 : i32 to i64
%1652 = arith.cmpi ne, %arg2, %1653 : i64
cf.cond_br %1652, ^bb270, ^bb271
^bb270:
%1654 = arith.cmpi ne, %1640, %arg0 : i64
%1655 = scf.if %1654 -> (i1) {
%1656 = arith.constant 2 : i32
%1658 = arith.extsi %1656 : i32 to i64
%1657 = arith.addi %arg0, %1658 : i64
%1659 = arith.cmpi ne, %1640, %1657 : i64
scf.yield %1659 : i1
} else {
%1660 = arith.constant false
scf.yield %1660 : i1
}
cf.cond_br %1655, ^bb273, ^bb274
^bb273:
%1661 = arith.constant 1 : i32
%1662 = arith.extsi %1661 : i32 to i64
llvm.store %1662, %1650 : i64, !llvm.ptr
cf.br ^bb275
^bb274:
cf.br ^bb275
^bb275:
cf.br ^bb272
^bb271:
cf.br ^bb272
^bb272:
%1663 = llvm.load %1650 : !llvm.ptr -> i64
%1664 = arith.constant 0 : i32
%1666 = arith.extsi %1664 : i32 to i64
%1665 = arith.cmpi ne, %1663, %1666 : i64
cf.cond_br %1665, ^bb276, ^bb277
^bb276:
%1667 = llvm.load %1637 : !llvm.ptr -> i64
%1668 = arith.constant 1 : i32
%1670 = arith.extsi %1668 : i32 to i64
%1669 = arith.addi %1667, %1670 : i64
llvm.store %1669, %1637 : i64, !llvm.ptr
cf.br ^bb278
^bb277:
%1672 = llvm.load %1637 : !llvm.ptr -> i64
%1671 = func.call @lattice_points_on_circle(%1672) : (i64) -> i64
%1673 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
llvm.store %1671, %1673 : i64, !llvm.ptr
%1674 = arith.constant 0 : i32
%1675 = arith.extsi %1674 : i32 to i64
%1676 = llvm.mlir.constant(1 : i64) : i64
%1677 = llvm.alloca %1676 x i64 : (i64) -> !llvm.ptr
llvm.store %1675, %1677 : i64, !llvm.ptr
%1678 = arith.constant 0 : i32
%1680 = arith.extsi %1678 : i32 to i64
%1679 = arith.cmpi ne, %arg2, %1680 : i64
cf.cond_br %1679, ^bb279, ^bb280
^bb279:
%1682 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1683 = llvm.load %1682 : !llvm.ptr -> i64
%1681 = func.call @has_unit_coordinate(%1683) : (i64) -> i64
%1684 = arith.constant 0 : i32
%1686 = arith.extsi %1684 : i32 to i64
%1685 = arith.cmpi eq, %1681, %1686 : i64
cf.cond_br %1685, ^bb282, ^bb283
^bb282:
%1687 = arith.constant 1 : i32
%1688 = arith.extsi %1687 : i32 to i64
llvm.store %1688, %1677 : i64, !llvm.ptr
cf.br ^bb284
^bb283:
cf.br ^bb284
^bb284:
cf.br ^bb281
^bb280:
cf.br ^bb281
^bb281:
%1689 = llvm.load %1677 : !llvm.ptr -> i64
%1690 = arith.constant 0 : i32
%1692 = arith.extsi %1690 : i32 to i64
%1691 = arith.cmpi ne, %1689, %1692 : i64
cf.cond_br %1691, ^bb285, ^bb286
^bb285:
%1693 = llvm.load %1637 : !llvm.ptr -> i64
%1694 = arith.constant 1 : i32
%1696 = arith.extsi %1694 : i32 to i64
%1695 = arith.addi %1693, %1696 : i64
llvm.store %1695, %1637 : i64, !llvm.ptr
cf.br ^bb287
^bb286:
%1698 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1699 = llvm.load %1698 : !llvm.ptr -> i64
%1700 = arith.constant 8 : i32
%1701 = arith.extsi %1700 : i32 to i64
%1697 = func.call @calloc(%1699, %1701) : (i64, i64) -> !llvm.ptr
%1703 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1704 = llvm.load %1703 : !llvm.ptr -> i64
%1705 = arith.constant 8 : i32
%1706 = arith.extsi %1705 : i32 to i64
%1702 = func.call @calloc(%1704, %1706) : (i64, i64) -> !llvm.ptr
%1707 = arith.constant 0 : i32
%1708 = arith.extsi %1707 : i32 to i64
%1709 = llvm.mlir.constant(1 : i64) : i64
%1710 = llvm.alloca %1709 x i64 : (i64) -> !llvm.ptr
llvm.store %1708, %1710 : i64, !llvm.ptr
cf.br ^bb288
^bb288:
%1711 = llvm.load %1710 : !llvm.ptr -> i64
%1712 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1713 = llvm.load %1712 : !llvm.ptr -> i64
%1714 = arith.cmpi slt, %1711, %1713 : i64
cf.cond_br %1714, ^bb289, ^bb290
^bb289:
%1716 = llvm.mlir.addressof @circle_px : !llvm.ptr
%1717 = llvm.load %1716 : !llvm.ptr -> !llvm.ptr
%1718 = llvm.load %1710 : !llvm.ptr -> i64
%1719 = llvm.getelementptr %1717[%1718] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1715 = llvm.load %1719 : !llvm.ptr -> i64
%1720 = llvm.load %1710 : !llvm.ptr -> i64
%1721 = llvm.getelementptr %1697[%1720] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1715, %1721 : i64, !llvm.ptr
%1723 = llvm.mlir.addressof @circle_py : !llvm.ptr
%1724 = llvm.load %1723 : !llvm.ptr -> !llvm.ptr
%1725 = llvm.load %1710 : !llvm.ptr -> i64
%1726 = llvm.getelementptr %1724[%1725] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1722 = llvm.load %1726 : !llvm.ptr -> i64
%1727 = llvm.load %1710 : !llvm.ptr -> i64
%1728 = llvm.getelementptr %1702[%1727] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1722, %1728 : i64, !llvm.ptr
%1729 = llvm.load %1710 : !llvm.ptr -> i64
%1730 = arith.constant 1 : i32
%1732 = arith.extsi %1730 : i32 to i64
%1731 = arith.addi %1729, %1732 : i64
llvm.store %1731, %1710 : i64, !llvm.ptr
cf.br ^bb288
^bb290:
%1734 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1735 = llvm.load %1734 : !llvm.ptr -> i64
func.call @sort_points(%1735, %1697, %1702) : (i64, !llvm.ptr, !llvm.ptr) -> ()
%1737 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1738 = llvm.load %1737 : !llvm.ptr -> i64
%1739 = arith.constant 8 : i32
%1740 = arith.extsi %1739 : i32 to i64
%1736 = func.call @calloc(%1738, %1740) : (i64, i64) -> !llvm.ptr
%1741 = arith.constant 0 : i32
%1742 = arith.extsi %1741 : i32 to i64
%1743 = llvm.mlir.addressof @num_pairs : !llvm.ptr
llvm.store %1742, %1743 : i64, !llvm.ptr
%1744 = arith.constant 0 : i32
%1745 = arith.extsi %1744 : i32 to i64
llvm.store %1745, %1710 : i64, !llvm.ptr
cf.br ^bb291
^bb291:
%1746 = llvm.load %1710 : !llvm.ptr -> i64
%1747 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1748 = llvm.load %1747 : !llvm.ptr -> i64
%1749 = arith.cmpi slt, %1746, %1748 : i64
cf.cond_br %1749, ^bb292, ^bb293
^bb292:
%1751 = llvm.load %1710 : !llvm.ptr -> i64
%1752 = llvm.getelementptr %1736[%1751] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1750 = llvm.load %1752 : !llvm.ptr -> i64
%1753 = arith.constant 0 : i32
%1755 = arith.extsi %1753 : i32 to i64
%1754 = arith.cmpi ne, %1750, %1755 : i64
cf.cond_br %1754, ^bb294, ^bb295
^bb294:
%1756 = llvm.load %1710 : !llvm.ptr -> i64
%1757 = arith.constant 1 : i32
%1759 = arith.extsi %1757 : i32 to i64
%1758 = arith.addi %1756, %1759 : i64
llvm.store %1758, %1710 : i64, !llvm.ptr
cf.br ^bb296
^bb295:
%1761 = llvm.load %1710 : !llvm.ptr -> i64
%1762 = llvm.getelementptr %1697[%1761] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1760 = llvm.load %1762 : !llvm.ptr -> i64
%1764 = arith.constant 0 : i64
%1763 = arith.subi %1764, %1760 : i64
%1766 = llvm.load %1710 : !llvm.ptr -> i64
%1767 = llvm.getelementptr %1702[%1766] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1765 = llvm.load %1767 : !llvm.ptr -> i64
%1769 = arith.constant 0 : i64
%1768 = arith.subi %1769, %1765 : i64
%1770 = arith.constant 0 : i32
%1771 = arith.extsi %1770 : i32 to i64
%1772 = llvm.mlir.constant(1 : i64) : i64
%1773 = llvm.alloca %1772 x i64 : (i64) -> !llvm.ptr
llvm.store %1771, %1773 : i64, !llvm.ptr
%1774 = llvm.mlir.addressof @num_circle_points : !llvm.ptr
%1775 = llvm.load %1774 : !llvm.ptr -> i64
%1776 = arith.constant 1 : i32
%1778 = arith.extsi %1776 : i32 to i64
%1777 = arith.subi %1775, %1778 : i64
%1779 = llvm.mlir.constant(1 : i64) : i64
%1780 = llvm.alloca %1779 x i64 : (i64) -> !llvm.ptr
llvm.store %1777, %1780 : i64, !llvm.ptr
%1781 = arith.constant 1 : i32
%1783 = arith.constant 0 : i32
%1782 = arith.subi %1783, %1781 : i32
%1784 = arith.extsi %1782 : i32 to i64
%1785 = llvm.mlir.constant(1 : i64) : i64
%1786 = llvm.alloca %1785 x i64 : (i64) -> !llvm.ptr
llvm.store %1784, %1786 : i64, !llvm.ptr
cf.br ^bb297
^bb297:
%1787 = llvm.load %1773 : !llvm.ptr -> i64
%1788 = llvm.load %1780 : !llvm.ptr -> i64
%1789 = arith.cmpi sle, %1787, %1788 : i64
cf.cond_br %1789, ^bb298, ^bb299
^bb298:
%1790 = llvm.load %1773 : !llvm.ptr -> i64
%1791 = llvm.load %1780 : !llvm.ptr -> i64
%1792 = arith.addi %1790, %1791 : i64
%1793 = arith.constant 2 : i32
%1795 = arith.extsi %1793 : i32 to i64
%1794 = arith.divsi %1792, %1795 : i64
%1797 = llvm.getelementptr %1697[%1794] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1796 = llvm.load %1797 : !llvm.ptr -> i64
%1798 = arith.cmpi slt, %1796, %1763 : i64
%1799 = scf.if %1798 -> (i1) {
%1800 = arith.constant true
scf.yield %1800 : i1
} else {
%1802 = llvm.getelementptr %1697[%1794] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1801 = llvm.load %1802 : !llvm.ptr -> i64
%1803 = arith.cmpi eq, %1801, %1763 : i64
%1804 = scf.if %1803 -> (i1) {
%1806 = llvm.getelementptr %1702[%1794] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1805 = llvm.load %1806 : !llvm.ptr -> i64
%1807 = arith.cmpi slt, %1805, %1768 : i64
scf.yield %1807 : i1
} else {
%1808 = arith.constant false
scf.yield %1808 : i1
}
scf.yield %1804 : i1
}
cf.cond_br %1799, ^bb300, ^bb301
^bb300:
%1809 = arith.constant 1 : i32
%1811 = arith.extsi %1809 : i32 to i64
%1810 = arith.addi %1794, %1811 : i64
llvm.store %1810, %1773 : i64, !llvm.ptr
cf.br ^bb302
^bb301:
%1813 = llvm.getelementptr %1697[%1794] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1812 = llvm.load %1813 : !llvm.ptr -> i64
%1814 = arith.cmpi sgt, %1812, %1763 : i64
%1815 = scf.if %1814 -> (i1) {
%1816 = arith.constant true
scf.yield %1816 : i1
} else {
%1818 = llvm.getelementptr %1697[%1794] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1817 = llvm.load %1818 : !llvm.ptr -> i64
%1819 = arith.cmpi eq, %1817, %1763 : i64
%1820 = scf.if %1819 -> (i1) {
%1822 = llvm.getelementptr %1702[%1794] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1821 = llvm.load %1822 : !llvm.ptr -> i64
%1823 = arith.cmpi sgt, %1821, %1768 : i64
scf.yield %1823 : i1
} else {
%1824 = arith.constant false
scf.yield %1824 : i1
}
scf.yield %1820 : i1
}
cf.cond_br %1815, ^bb303, ^bb304
^bb303:
%1825 = arith.constant 1 : i32
%1827 = arith.extsi %1825 : i32 to i64
%1826 = arith.subi %1794, %1827 : i64
llvm.store %1826, %1780 : i64, !llvm.ptr
cf.br ^bb305
^bb304:
llvm.store %1794, %1786 : i64, !llvm.ptr
%1828 = llvm.load %1780 : !llvm.ptr -> i64
%1829 = arith.constant 1 : i32
%1831 = arith.extsi %1829 : i32 to i64
%1830 = arith.addi %1828, %1831 : i64
llvm.store %1830, %1773 : i64, !llvm.ptr
cf.br ^bb305
^bb305:
cf.br ^bb302
^bb302:
cf.br ^bb297
^bb299:
%1832 = llvm.load %1786 : !llvm.ptr -> i64
%1833 = arith.constant 1 : i32
%1835 = arith.constant 0 : i32
%1834 = arith.subi %1835, %1833 : i32
%1837 = arith.extsi %1834 : i32 to i64
%1836 = arith.cmpi eq, %1832, %1837 : i64
cf.cond_br %1836, ^bb306, ^bb307
^bb306:
%1838 = llvm.load %1710 : !llvm.ptr -> i64
%1839 = arith.constant 1 : i32
%1841 = arith.extsi %1839 : i32 to i64
%1840 = arith.addi %1838, %1841 : i64
llvm.store %1840, %1710 : i64, !llvm.ptr
cf.br ^bb308
^bb307:
%1842 = arith.constant 1 : i32
%1843 = llvm.load %1710 : !llvm.ptr -> i64
%1844 = arith.extsi %1842 : i32 to i64
%1845 = llvm.getelementptr %1736[%1843] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1844, %1845 : i64, !llvm.ptr
%1846 = arith.constant 1 : i32
%1847 = llvm.load %1786 : !llvm.ptr -> i64
%1848 = arith.extsi %1846 : i32 to i64
%1849 = llvm.getelementptr %1736[%1847] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1848, %1849 : i64, !llvm.ptr
%1851 = llvm.load %1710 : !llvm.ptr -> i64
%1852 = llvm.getelementptr %1697[%1851] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1850 = llvm.load %1852 : !llvm.ptr -> i64
%1853 = llvm.mlir.addressof @pair_px : !llvm.ptr
%1854 = llvm.load %1853 : !llvm.ptr -> !llvm.ptr
%1855 = llvm.mlir.addressof @num_pairs : !llvm.ptr
%1856 = llvm.load %1855 : !llvm.ptr -> i64
%1857 = llvm.getelementptr %1854[%1856] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1850, %1857 : i64, !llvm.ptr
%1859 = llvm.load %1710 : !llvm.ptr -> i64
%1860 = llvm.getelementptr %1702[%1859] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%1858 = llvm.load %1860 : !llvm.ptr -> i64
%1861 = llvm.mlir.addressof @pair_py : !llvm.ptr
%1862 = llvm.load %1861 : !llvm.ptr -> !llvm.ptr
%1863 = llvm.mlir.addressof @num_pairs : !llvm.ptr
%1864 = llvm.load %1863 : !llvm.ptr -> i64
%1865 = llvm.getelementptr %1862[%1864] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1858, %1865 : i64, !llvm.ptr
%1866 = llvm.mlir.addressof @pair_nx : !llvm.ptr
%1867 = llvm.load %1866 : !llvm.ptr -> !llvm.ptr
%1868 = llvm.mlir.addressof @num_pairs : !llvm.ptr
%1869 = llvm.load %1868 : !llvm.ptr -> i64
%1870 = llvm.getelementptr %1867[%1869] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1763, %1870 : i64, !llvm.ptr
%1871 = llvm.mlir.addressof @pair_ny : !llvm.ptr
%1872 = llvm.load %1871 : !llvm.ptr -> !llvm.ptr
%1873 = llvm.mlir.addressof @num_pairs : !llvm.ptr
%1874 = llvm.load %1873 : !llvm.ptr -> i64
%1875 = llvm.getelementptr %1872[%1874] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %1768, %1875 : i64, !llvm.ptr
%1876 = llvm.mlir.addressof @num_pairs : !llvm.ptr
%1877 = llvm.load %1876 : !llvm.ptr -> i64
%1878 = arith.constant 1 : i32
%1880 = arith.extsi %1878 : i32 to i64
%1879 = arith.addi %1877, %1880 : i64
%1881 = llvm.mlir.addressof @num_pairs : !llvm.ptr
llvm.store %1879, %1881 : i64, !llvm.ptr
%1882 = llvm.load %1710 : !llvm.ptr -> i64
%1883 = arith.constant 1 : i32
%1885 = arith.extsi %1883 : i32 to i64
%1884 = arith.addi %1882, %1885 : i64
llvm.store %1884, %1710 : i64, !llvm.ptr
cf.br ^bb308
^bb308:
cf.br ^bb296
^bb296:
cf.br ^bb291
^bb293:
func.call @free(%1697) : (!llvm.ptr) -> ()
func.call @free(%1702) : (!llvm.ptr) -> ()
func.call @free(%1736) : (!llvm.ptr) -> ()
%1889 = llvm.mlir.addressof @num_pairs : !llvm.ptr
%1890 = llvm.load %1889 : !llvm.ptr -> i64
%1891 = arith.cmpi ne, %1890, %1640 : i64
cf.cond_br %1891, ^bb309, ^bb310
^bb309:
%1892 = llvm.load %1637 : !llvm.ptr -> i64
%1893 = arith.constant 1 : i32
%1895 = arith.extsi %1893 : i32 to i64
%1894 = arith.addi %1892, %1895 : i64
llvm.store %1894, %1637 : i64, !llvm.ptr
cf.br ^bb311
^bb310:
func.call @build_displacement_set() : () -> ()
%1897 = func.call @has_valid_oriented_vectors(%arg0, %1632) : (i64, i64) -> i64
%1898 = arith.constant 0 : i32
%1900 = arith.extsi %1898 : i32 to i64
%1899 = arith.cmpi ne, %1897, %1900 : i64
cf.cond_br %1899, ^bb312, ^bb313
^bb312:
func.call @hs_free() : () -> ()
%1902 = llvm.load %1637 : !llvm.ptr -> i64
func.return %1902 : i64
^bb313:
cf.br ^bb314
^bb314:
func.call @hs_free() : () -> ()
%1904 = llvm.load %1637 : !llvm.ptr -> i64
%1905 = arith.constant 1 : i32
%1907 = arith.extsi %1905 : i32 to i64
%1906 = arith.addi %1904, %1907 : i64
llvm.store %1906, %1637 : i64, !llvm.ptr
cf.br ^bb311
^bb311:
cf.br ^bb287
^bb287:
cf.br ^bb278
^bb278:
cf.br ^bb269
^bb269:
cf.br ^bb264
^bb266:
%1908 = arith.constant 1 : i32
%1910 = arith.constant 0 : i32
%1909 = arith.subi %1910, %1908 : i32
%1911 = arith.extsi %1909 : i32 to i64
func.return %1911 : i64
}
func.func @main() -> i32 {
%1913 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1914 = llvm.load %1913 : !llvm.ptr -> i64
%1915 = arith.constant 8 : i32
%1916 = arith.extsi %1915 : i32 to i64
%1912 = func.call @calloc(%1914, %1916) : (i64, i64) -> !llvm.ptr
%1917 = llvm.mlir.addressof @circle_px : !llvm.ptr
llvm.store %1912, %1917 : !llvm.ptr, !llvm.ptr
%1919 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1920 = llvm.load %1919 : !llvm.ptr -> i64
%1921 = arith.constant 8 : i32
%1922 = arith.extsi %1921 : i32 to i64
%1918 = func.call @calloc(%1920, %1922) : (i64, i64) -> !llvm.ptr
%1923 = llvm.mlir.addressof @circle_py : !llvm.ptr
llvm.store %1918, %1923 : !llvm.ptr, !llvm.ptr
%1925 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1926 = llvm.load %1925 : !llvm.ptr -> i64
%1927 = arith.constant 8 : i32
%1928 = arith.extsi %1927 : i32 to i64
%1924 = func.call @calloc(%1926, %1928) : (i64, i64) -> !llvm.ptr
%1929 = llvm.mlir.addressof @pair_px : !llvm.ptr
llvm.store %1924, %1929 : !llvm.ptr, !llvm.ptr
%1931 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1932 = llvm.load %1931 : !llvm.ptr -> i64
%1933 = arith.constant 8 : i32
%1934 = arith.extsi %1933 : i32 to i64
%1930 = func.call @calloc(%1932, %1934) : (i64, i64) -> !llvm.ptr
%1935 = llvm.mlir.addressof @pair_py : !llvm.ptr
llvm.store %1930, %1935 : !llvm.ptr, !llvm.ptr
%1937 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1938 = llvm.load %1937 : !llvm.ptr -> i64
%1939 = arith.constant 8 : i32
%1940 = arith.extsi %1939 : i32 to i64
%1936 = func.call @calloc(%1938, %1940) : (i64, i64) -> !llvm.ptr
%1941 = llvm.mlir.addressof @pair_nx : !llvm.ptr
llvm.store %1936, %1941 : !llvm.ptr, !llvm.ptr
%1943 = llvm.mlir.addressof @MAXPTS : !llvm.ptr
%1944 = llvm.load %1943 : !llvm.ptr -> i64
%1945 = arith.constant 8 : i32
%1946 = arith.extsi %1945 : i32 to i64
%1942 = func.call @calloc(%1944, %1946) : (i64, i64) -> !llvm.ptr
%1947 = llvm.mlir.addressof @pair_ny : !llvm.ptr
llvm.store %1942, %1947 : !llvm.ptr, !llvm.ptr
%1949 = arith.constant 16 : i32
%1950 = arith.constant 8 : i32
%1951 = arith.extsi %1949 : i32 to i64
%1952 = arith.extsi %1950 : i32 to i64
%1948 = func.call @calloc(%1951, %1952) : (i64, i64) -> !llvm.ptr
%1953 = llvm.mlir.addressof @sel_x : !llvm.ptr
llvm.store %1948, %1953 : !llvm.ptr, !llvm.ptr
%1955 = arith.constant 16 : i32
%1956 = arith.constant 8 : i32
%1957 = arith.extsi %1955 : i32 to i64
%1958 = arith.extsi %1956 : i32 to i64
%1954 = func.call @calloc(%1957, %1958) : (i64, i64) -> !llvm.ptr
%1959 = llvm.mlir.addressof @sel_y : !llvm.ptr
llvm.store %1954, %1959 : !llvm.ptr, !llvm.ptr
%1961 = arith.constant 1024 : i32
%1962 = arith.constant 8 : i32
%1963 = arith.extsi %1961 : i32 to i64
%1964 = arith.extsi %1962 : i32 to i64
%1960 = func.call @calloc(%1963, %1964) : (i64, i64) -> !llvm.ptr
%1965 = llvm.mlir.addressof @even_masks : !llvm.ptr
llvm.store %1960, %1965 : !llvm.ptr, !llvm.ptr
%1967 = arith.constant 1024 : i32
%1968 = arith.constant 8 : i32
%1969 = arith.extsi %1967 : i32 to i64
%1970 = arith.extsi %1968 : i32 to i64
%1966 = func.call @calloc(%1969, %1970) : (i64, i64) -> !llvm.ptr
%1971 = llvm.mlir.addressof @dfs_masks : !llvm.ptr
llvm.store %1966, %1971 : !llvm.ptr, !llvm.ptr
%1973 = arith.constant 1024 : i32
%1974 = arith.constant 8 : i32
%1975 = arith.extsi %1973 : i32 to i64
%1976 = arith.extsi %1974 : i32 to i64
%1972 = func.call @calloc(%1975, %1976) : (i64, i64) -> !llvm.ptr
%1977 = llvm.mlir.addressof @uf_parent : !llvm.ptr
llvm.store %1972, %1977 : !llvm.ptr, !llvm.ptr
%1979 = arith.constant 1024 : i32
%1980 = arith.constant 8 : i32
%1981 = arith.extsi %1979 : i32 to i64
%1982 = arith.extsi %1980 : i32 to i64
%1978 = func.call @calloc(%1981, %1982) : (i64, i64) -> !llvm.ptr
%1983 = llvm.mlir.addressof @uf_size : !llvm.ptr
llvm.store %1978, %1983 : !llvm.ptr, !llvm.ptr
%1984 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1986 = arith.constant 10 : i32
%1987 = arith.constant 20000 : i32
%1988 = arith.constant 1 : i32
%1989 = arith.extsi %1986 : i32 to i64
%1990 = arith.extsi %1987 : i32 to i64
%1991 = arith.extsi %1988 : i32 to i64
%1985 = func.call @find_min_radius_sq(%1989, %1990, %1991) : (i64, i64, i64) -> i64
%1992 = llvm.call @printf(%1984, %1985) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
%1993 = arith.constant 0 : i32
func.return %1993 : i32
}
}