← All problems
Problem 966
sum I(a,b,c) for 1<=a<=b<=c<a+b, a+b+c<=200, where I(a,b,c) is the largest intersection area between the triangle and a circle of equal area, with the circle free to translate.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^3)O(n^2)
Space complexity O(n)O(n^2)
Approach Flow solution Bottom-up DP
Verdict Suboptimal
Flow source
# Project Euler 966: Triangle Circle Intersection
# sum I(a,b,c) for 1<=a<=b<=c<a+b, a+b+c<=200, where I(a,b,c) is the
# largest intersection area between the triangle and a circle of equal
# area, with the circle free to translate.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function sqrt(x: f64) -> f64
function fabs(x: f64) -> f64
function atan2(y: f64, x: f64) -> f64
function hypot(x: f64, y: f64) -> f64
function acos(x: f64) -> f64
}
const EPS: f64 = 1e-12
struct TriTuple {
a: i32,
b: i32,
c: i32,
g2: i64
}
let mut g_pi: f64 = 0.0
# ---------- segment / circle intersection ----------
function segment_circle_ts(ax: f64, ay: f64, bx: f64, by: f64,
r2: f64, t1_out: ptr<f64>, t2_out: ptr<f64>) -> i32 {
let dx: f64 = bx - ax
let dy: f64 = by - ay
let qa: f64 = dx * dx + dy * dy
if qa < 1e-18 {
t1_out[0] = 0.0
t2_out[0] = 0.0
return 0
}
let qb: f64 = 2.0 * (ax * dx + ay * dy)
let qc: f64 = ax * ax + ay * ay - r2
let mut disc: f64 = qb * qb - 4.0 * qa * qc
if disc < 0.0 - 1e-12 {
t1_out[0] = 0.0
t2_out[0] = 0.0
return 0
}
if disc < 0.0 { disc = 0.0 }
let sdisc: f64 = sqrt(disc)
let inv2a: f64 = 0.5 / qa
let t1: f64 = (0.0 - qb - sdisc) * inv2a
let t2: f64 = (0.0 - qb + sdisc) * inv2a
let ts: array<f64, 2> = [0.0, 0.0]
let mut nts: i32 = 0
if (0.0 - EPS) <= t1 && t1 <= 1.0 + EPS {
let mut tv: f64 = t1
if tv < 0.0 { tv = 0.0 }
if tv > 1.0 { tv = 1.0 }
ts[nts] = tv
nts = nts + 1
}
if (0.0 - EPS) <= t2 && t2 <= 1.0 + EPS {
let mut t2c: f64 = t2
if t2c < 0.0 { t2c = 0.0 }
if t2c > 1.0 { t2c = 1.0 }
if nts == 0 || fabs(t2c - ts[0]) > 1e-11 {
ts[nts] = t2c
nts = nts + 1
}
}
if nts == 0 {
t1_out[0] = 0.0
t2_out[0] = 0.0
return 0
}
if nts == 1 {
t1_out[0] = ts[0]
t2_out[0] = 0.0
return 1
}
if ts[0] > ts[1] {
let tmp: f64 = ts[0]
ts[0] = ts[1]
ts[1] = tmp
}
t1_out[0] = ts[0]
t2_out[0] = ts[1]
return 2
}
function tri_or_sector(px: f64, py: f64, qx: f64, qy: f64, r2: f64) -> f64 {
let cross: f64 = px * qy - py * qx
let p2: f64 = px * px + py * py
let q2: f64 = qx * qx + qy * qy
if p2 <= r2 + 1e-12 && q2 <= r2 + 1e-12 {
return 0.5 * cross
}
let dot: f64 = px * qx + py * qy
let ang: f64 = atan2(cross, dot)
return 0.5 * r2 * ang
}
function project_to_circle(x: f64, y: f64, r: f64, ox: ptr<f64>, oy: ptr<f64>) -> void {
let d: f64 = hypot(x, y)
if d < 1e-18 {
ox[0] = x
oy[0] = y
return
}
let s: f64 = r / d
ox[0] = x * s
oy[0] = y * s
}
function edge_contrib(ax: f64, ay: f64, bx: f64, by: f64, r2: f64) -> f64 {
let tbuf: array<f64, 2> = [0.0, 0.0]
let k: i32 = segment_circle_ts(ax, ay, bx, by, r2, &tbuf[0], &tbuf[1])
let t1: f64 = tbuf[0]
let t2: f64 = tbuf[1]
if k == 0 {
return tri_or_sector(ax, ay, bx, by, r2)
}
let dx: f64 = bx - ax
let dy: f64 = by - ay
let r: f64 = sqrt(r2)
if k == 1 {
let mut ix: f64 = ax + dx * t1
let mut iy: f64 = ay + dy * t1
project_to_circle(ix, iy, r, &ix, &iy)
return tri_or_sector(ax, ay, ix, iy, r2)
+ tri_or_sector(ix, iy, bx, by, r2)
}
let mut i1x: f64 = ax + dx * t1
let mut i1y: f64 = ay + dy * t1
let mut i2x: f64 = ax + dx * t2
let mut i2y: f64 = ay + dy * t2
project_to_circle(i1x, i1y, r, &i1x, &i1y)
project_to_circle(i2x, i2y, r, &i2x, &i2y)
return tri_or_sector(ax, ay, i1x, i1y, r2)
+ tri_or_sector(i1x, i1y, i2x, i2y, r2)
+ tri_or_sector(i2x, i2y, bx, by, r2)
}
function tri_circle_area(ax: f64, ay: f64, bx: f64, by: f64,
cx: f64, cy: f64,
ox: f64, oy: f64, r: f64) -> f64 {
let r2: f64 = r * r
let a1x: f64 = ax - ox
let a1y: f64 = ay - oy
let b1x: f64 = bx - ox
let b1y: f64 = by - oy
let c1x: f64 = cx - ox
let c1y: f64 = cy - oy
let mut total: f64 = 0.0
total = total + edge_contrib(a1x, a1y, b1x, b1y, r2)
total = total + edge_contrib(b1x, b1y, c1x, c1y, r2)
total = total + edge_contrib(c1x, c1y, a1x, a1y, r2)
return fabs(total)
}
# ---------- triangle construction ----------
function tri_coords(a: i32, b: i32, c: i32,
ax: ptr<f64>, ay: ptr<f64>, bx: ptr<f64>, by: ptr<f64>,
cx: ptr<f64>, cy: ptr<f64>) -> void {
ax[0] = 0.0
ay[0] = 0.0
bx[0] = c as f64
by[0] = 0.0
let x: f64 = ((b * b + c * c - a * a) as f64) / (2.0 * (c as f64))
let mut y2: f64 = (b * b) as f64 - x * x
if y2 < 0.0 && y2 > 0.0 - 1e-12 { y2 = 0.0 }
if y2 > 0.0 {
cy[0] = sqrt(y2)
} else {
cy[0] = 0.0
}
cx[0] = x
}
function tri_area(ax: f64, ay: f64, bx: f64, by: f64,
cx: f64, cy: f64) -> f64 {
return fabs(0.5 * ((bx - ax) * (cy - ay) - (by - ay) * (cx - ax)))
}
function circumcenter(ax: f64, ay: f64, bx: f64, by: f64,
cx: f64, cy: f64, ux: ptr<f64>, uy: ptr<f64>) -> i32 {
let d: f64 = 2.0 * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by))
if fabs(d) < 1e-15 { return 0 }
let a2: f64 = ax * ax + ay * ay
let b2: f64 = bx * bx + by * by
let c2: f64 = cx * cx + cy * cy
ux[0] = (a2 * (by - cy) + b2 * (cy - ay) + c2 * (ay - by)) / d
uy[0] = (a2 * (cx - bx) + b2 * (ax - cx) + c2 * (bx - ax)) / d
return 1
}
function fmin_val(a: f64, b: f64) -> f64 {
if a < b { return a }
return b
}
function fmax_val(a: f64, b: f64) -> f64 {
if a > b { return a }
return b
}
# ---------- maximization (pattern search) ----------
function maximize_intersection(a: i32, b: i32, c: i32) -> f64 {
let abuf: array<f64, 1> = [0.0]
let aybuf: array<f64, 1> = [0.0]
let bbuf: array<f64, 1> = [0.0]
let bybuf: array<f64, 1> = [0.0]
let cbuf: array<f64, 1> = [0.0]
let cybuf: array<f64, 1> = [0.0]
tri_coords(a, b, c, &abuf[0], &aybuf[0], &bbuf[0], &bybuf[0], &cbuf[0], &cybuf[0])
let ax: f64 = abuf[0]
let ay: f64 = aybuf[0]
let bx: f64 = bbuf[0]
let by: f64 = bybuf[0]
let cx: f64 = cbuf[0]
let cy: f64 = cybuf[0]
let area: f64 = tri_area(ax, ay, bx, by, cx, cy)
if area <= 0.0 { return 0.0 }
let r: f64 = sqrt(area / g_pi)
let xmin: f64 = fmin_val(ax, fmin_val(bx, cx)) - r
let xmax: f64 = fmax_val(ax, fmax_val(bx, cx)) + r
let ymin: f64 = fmin_val(ay, fmin_val(by, cy)) - r
let ymax: f64 = fmax_val(ay, fmax_val(by, cy)) + r
let cenx: f64 = (ax + bx + cx) / 3.0
let ceny: f64 = (ay + by + cy) / 3.0
let per: i32 = a + b + c
let incx: f64 = ((a as f64) * ax + (b as f64) * bx + (c as f64) * cx) / (per as f64)
let incy: f64 = ((a as f64) * ay + (b as f64) * by + (c as f64) * cy) / (per as f64)
let ccbuf: array<f64, 2> = [0.0, 0.0]
let has_cc: i32 = circumcenter(ax, ay, bx, by, cx, cy, &ccbuf[0], &ccbuf[1])
let ccx: f64 = ccbuf[0]
let ccy: f64 = ccbuf[1]
# starts: 16 x 2
let starts: array<f64, 32> = [
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
]
let mut ns: i32 = 0
starts[ns * 2 + 0] = cenx; starts[ns * 2 + 1] = ceny; ns = ns + 1
starts[ns * 2 + 0] = incx; starts[ns * 2 + 1] = incy; ns = ns + 1
starts[ns * 2 + 0] = ax; starts[ns * 2 + 1] = ay; ns = ns + 1
starts[ns * 2 + 0] = bx; starts[ns * 2 + 1] = by; ns = ns + 1
starts[ns * 2 + 0] = cx; starts[ns * 2 + 1] = cy; ns = ns + 1
starts[ns * 2 + 0] = (ax + bx) * 0.5; starts[ns * 2 + 1] = (ay + by) * 0.5; ns = ns + 1
starts[ns * 2 + 0] = (bx + cx) * 0.5; starts[ns * 2 + 1] = (by + cy) * 0.5; ns = ns + 1
starts[ns * 2 + 0] = (cx + ax) * 0.5; starts[ns * 2 + 1] = (cy + ay) * 0.5; ns = ns + 1
if has_cc != 0 {
starts[ns * 2 + 0] = ccx; starts[ns * 2 + 1] = ccy; ns = ns + 1
}
# clamp helper
let mut bestx: f64 = cenx
let mut besty: f64 = ceny
if bestx < xmin { bestx = xmin }
if bestx > xmax { bestx = xmax }
if besty < ymin { besty = ymin }
if besty > ymax { besty = ymax }
let mut bestv: f64 = tri_circle_area(ax, ay, bx, by, cx, cy, bestx, besty, r)
if bestv < 0.0 { bestv = 0.0 }
if bestv > area { bestv = area }
let mut s: i32 = 0
while s < ns {
let mut sx: f64 = starts[s * 2 + 0]
let mut sy: f64 = starts[s * 2 + 1]
if sx < xmin { sx = xmin }
if sx > xmax { sx = xmax }
if sy < ymin { sy = ymin }
if sy > ymax { sy = ymax }
let mut v: f64 = tri_circle_area(ax, ay, bx, by, cx, cy, sx, sy, r)
if v < 0.0 { v = 0.0 }
if v > area { v = area }
if v > bestv {
bestv = v
bestx = sx
besty = sy
}
s = s + 1
}
let span: f64 = fmax_val(xmax - xmin, ymax - ymin)
let mut step: f64 = fmax_val(span, r)
let dirs: array<f64, 16> = [
1.0, 0.0, 0.0 - 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 - 1.0,
1.0, 1.0, 1.0, 0.0 - 1.0, 0.0 - 1.0, 1.0, 0.0 - 1.0, 0.0 - 1.0
]
let tol_step: f64 = fmax_val(1e-7, 1e-7 * fmax_val(1.0, r))
while step > tol_step {
let mut moved_any: i32 = 0
let mut cont_outer: bool = true
while cont_outer {
let mut improved: i32 = 0
let mut bx0: f64 = bestx
let mut by0: f64 = besty
let mut bv0: f64 = bestv
let mut d: i32 = 0
while d < 8 {
let mut px: f64 = bestx + dirs[d * 2 + 0] * step
let mut py: f64 = besty + dirs[d * 2 + 1] * step
if px < xmin { px = xmin }
if px > xmax { px = xmax }
if py < ymin { py = ymin }
if py > ymax { py = ymax }
let mut v: f64 = tri_circle_area(ax, ay, bx, by, cx, cy, px, py, r)
if v < 0.0 { v = 0.0 }
if v > area { v = area }
if v > bv0 + 1e-13 {
bv0 = v
bx0 = px
by0 = py
improved = 1
}
d = d + 1
}
if improved != 0 {
bestv = bv0
bestx = bx0
besty = by0
moved_any = 1
} else {
cont_outer = false
}
}
if moved_any == 0 {
step = step * 0.5
}
}
return bestv
}
# ---------- heapsort for TriTuple ----------
function tt_less(a: TriTuple, b: TriTuple) -> bool {
if a.a != b.a { return a.a < b.a }
if a.b != b.b { return a.b < b.b }
return a.c < b.c
}
function tt_sift_down(arr: ptr<TriTuple>, start: i32, endd: i32) -> void {
let mut root: i32 = start
let mut cont: bool = true
while cont {
let mut child: i32 = 2 * root + 1
if child > endd {
cont = false
} else {
if child + 1 <= endd && tt_less(arr[child], arr[child + 1]) {
child = child + 1
}
if tt_less(arr[root], arr[child]) {
let t: TriTuple = arr[root]
arr[root] = arr[child]
arr[child] = t
root = child
} else {
cont = false
}
}
}
}
function heapsort_tt(arr: ptr<TriTuple>, n: i32) -> void {
if n <= 1 { return }
let mut start: i32 = n / 2 - 1
while start >= 0 {
tt_sift_down(arr, start, n - 1)
start = start - 1
}
let mut endd: i32 = n - 1
while endd > 0 {
let t: TriTuple = arr[0]
arr[0] = arr[endd]
arr[endd] = t
endd = endd - 1
tt_sift_down(arr, 0, endd)
}
}
function gcd_int(a0: i32, b0: i32) -> i32 {
let mut a: i32 = a0
let mut b: i32 = b0
while b != 0 {
let t: i32 = a % b
a = b
b = t
}
return a
}
function main() -> i32 {
g_pi = acos(0.0 - 1.0)
let limit: i32 = 200
# Collect (primitive_shape, g^2) tuples for every triangle.
let cap: i32 = 300000
let tuples: ptr<TriTuple> = calloc((cap as i64), 24) as ptr<TriTuple>
let mut nt: i32 = 0
let mut a: i32 = 1
while a <= limit {
let mut b: i32 = a
while b <= limit {
let maxc1: i32 = a + b - 1
let maxc2: i32 = limit - a - b
let maxc: i32 = maxc1
if maxc2 < maxc1 { maxc = maxc2 }
if maxc >= b {
let mut c: i32 = b
while c <= maxc {
let g: i32 = gcd_int(gcd_int(a, b), c)
tuples[nt] = TriTuple {
a: a / g,
b: b / g,
c: c / g,
g2: (g as i64) * (g as i64)
}
nt = nt + 1
c = c + 1
}
}
b = b + 1
}
a = a + 1
}
heapsort_tt(tuples, nt)
# Merge duplicates and accumulate weights with Kahan summation.
let mut total: f64 = 0.0
let mut corr: f64 = 0.0
let mut i: i32 = 0
while i < nt {
let ta: i32 = tuples[i].a
let tb: i32 = tuples[i].b
let tc: i32 = tuples[i].c
let mut weight: i64 = 0
while i < nt && tuples[i].a == ta && tuples[i].b == tb && tuples[i].c == tc {
weight = weight + tuples[i].g2
i = i + 1
}
let Ival: f64 = maximize_intersection(ta, tb, tc)
let term: f64 = Ival * (weight as f64)
let y: f64 = term - corr
let t: f64 = total + y
corr = (t - total) - y
total = t
}
free(tuples as ptr<void>)
printf("%.2f\n", total)
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; }
typedef struct TriTuple TriTuple;
struct TriTuple {
int32_t a;
int32_t b;
int32_t c;
int64_t g2;
};
double atan2(double y, double x);
double hypot(double x, double y);
double acos(double x);
int32_t segment_circle_ts_f64_f64_f64_f64_f64_ptr_f64_ptr_f64(double ax, double ay, double bx, double by, double r2, double* t1_out, double* t2_out);
double tri_or_sector_f64_f64_f64_f64_f64(double px, double py, double qx, double qy, double r2);
void project_to_circle_f64_f64_f64_ptr_f64_ptr_f64(double x, double y, double r, double* ox, double* oy);
double edge_contrib_f64_f64_f64_f64_f64(double ax, double ay, double bx, double by, double r2);
double tri_circle_area_f64_f64_f64_f64_f64_f64_f64_f64_f64(double ax, double ay, double bx, double by, double cx, double cy, double ox, double oy, double r);
void tri_coords_i32_i32_i32_ptr_f64_ptr_f64_ptr_f64_ptr_f64_ptr_f64_ptr_f64(int32_t a, int32_t b, int32_t c, double* ax, double* ay, double* bx, double* by, double* cx, double* cy);
double tri_area_f64_f64_f64_f64_f64_f64(double ax, double ay, double bx, double by, double cx, double cy);
int32_t circumcenter_f64_f64_f64_f64_f64_f64_ptr_f64_ptr_f64(double ax, double ay, double bx, double by, double cx, double cy, double* ux, double* uy);
double fmin_val_f64_f64(double a, double b);
double fmax_val_f64_f64(double a, double b);
double maximize_intersection_i32_i32_i32(int32_t a, int32_t b, int32_t c);
bool tt_less_TriTuple_TriTuple(TriTuple a, TriTuple b);
void tt_sift_down_ptr_TriTuple_i32_i32(TriTuple* arr, int32_t start, int32_t endd);
void heapsort_tt_ptr_TriTuple_i32(TriTuple* arr, int32_t n);
int32_t gcd_int_i32_i32(int32_t a0, int32_t b0);
int32_t main(void);
static const double EPS = 1e-12;
/* Module statics */
static double g_pi = 0.0;
int32_t segment_circle_ts_f64_f64_f64_f64_f64_ptr_f64_ptr_f64(double ax, double ay, double bx, double by, double r2, double* t1_out, double* t2_out) {
double dx = (bx - ax);
double dy = (by - ay);
double qa = ((dx * dx) + (dy * dy));
if (qa < 1e-18) {
t1_out[0] = 0.0;
t2_out[0] = 0.0;
return 0;
}
double qb = (2.0 * ((ax * dx) + (ay * dy)));
double qc = (((ax * ax) + (ay * ay)) - r2);
double disc = ((qb * qb) - ((4.0 * qa) * qc));
if (disc < (0.0 - 1e-12)) {
t1_out[0] = 0.0;
t2_out[0] = 0.0;
return 0;
}
if (disc < 0.0) {
disc = 0.0;
}
double sdisc = sqrt(disc);
double inv2a = (0.5 / qa);
double t1 = (((0.0 - qb) - sdisc) * inv2a);
double t2 = (((0.0 - qb) + sdisc) * inv2a);
double ts[2] = { 0.0, 0.0 };
int32_t nts = 0;
if (((0.0 - EPS) <= t1 && t1 <= (1.0 + EPS))) {
double tv = t1;
if (tv < 0.0) {
tv = 0.0;
}
if (tv > 1.0) {
tv = 1.0;
}
ts[nts] = tv;
nts = (nts + 1);
}
if (((0.0 - EPS) <= t2 && t2 <= (1.0 + EPS))) {
double t2c = t2;
if (t2c < 0.0) {
t2c = 0.0;
}
if (t2c > 1.0) {
t2c = 1.0;
}
if ((nts == 0 || fabs((t2c - (((unsigned)(0) < 2) ? ts[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), ts[0])))) > 1e-11)) {
ts[nts] = t2c;
nts = (nts + 1);
}
}
if (nts == 0) {
t1_out[0] = 0.0;
t2_out[0] = 0.0;
return 0;
}
if (nts == 1) {
t1_out[0] = (((unsigned)(0) < 2) ? ts[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), ts[0]));
t2_out[0] = 0.0;
return 1;
}
if ((((unsigned)(0) < 2) ? ts[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), ts[0])) > (((unsigned)(1) < 2) ? ts[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 2), flow_fault_handler("array index out of bounds"), ts[0]))) {
double tmp = (((unsigned)(0) < 2) ? ts[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), ts[0]));
ts[0] = (((unsigned)(1) < 2) ? ts[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 2), flow_fault_handler("array index out of bounds"), ts[0]));
ts[1] = tmp;
}
t1_out[0] = (((unsigned)(0) < 2) ? ts[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), ts[0]));
t2_out[0] = (((unsigned)(1) < 2) ? ts[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 2), flow_fault_handler("array index out of bounds"), ts[0]));
return 2;
}
double tri_or_sector_f64_f64_f64_f64_f64(double px, double py, double qx, double qy, double r2) {
double cross = ((px * qy) - (py * qx));
double p2 = ((px * px) + (py * py));
double q2 = ((qx * qx) + (qy * qy));
if ((p2 <= (r2 + 1e-12) && q2 <= (r2 + 1e-12))) {
return (0.5 * cross);
}
double dot = ((px * qx) + (py * qy));
double ang = atan2(cross, dot);
return ((0.5 * r2) * ang);
}
void project_to_circle_f64_f64_f64_ptr_f64_ptr_f64(double x, double y, double r, double* ox, double* oy) {
double d = hypot(x, y);
if (d < 1e-18) {
ox[0] = x;
oy[0] = y;
return;
}
double s = (r / d);
ox[0] = (x * s);
oy[0] = (y * s);
}
double edge_contrib_f64_f64_f64_f64_f64(double ax, double ay, double bx, double by, double r2) {
double tbuf[2] = { 0.0, 0.0 };
int32_t k = segment_circle_ts_f64_f64_f64_f64_f64_ptr_f64_ptr_f64(ax, ay, bx, by, r2, (&(tbuf[0])), (&(tbuf[1])));
double t1 = (((unsigned)(0) < 2) ? tbuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), tbuf[0]));
double t2 = (((unsigned)(1) < 2) ? tbuf[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 2), flow_fault_handler("array index out of bounds"), tbuf[0]));
if (k == 0) {
return tri_or_sector_f64_f64_f64_f64_f64(ax, ay, bx, by, r2);
}
double dx = (bx - ax);
double dy = (by - ay);
double r = sqrt(r2);
if (k == 1) {
double ix = (ax + (dx * t1));
double iy = (ay + (dy * t1));
project_to_circle_f64_f64_f64_ptr_f64_ptr_f64(ix, iy, r, (&(ix)), (&(iy)));
return (tri_or_sector_f64_f64_f64_f64_f64(ax, ay, ix, iy, r2) + tri_or_sector_f64_f64_f64_f64_f64(ix, iy, bx, by, r2));
}
double i1x = (ax + (dx * t1));
double i1y = (ay + (dy * t1));
double i2x = (ax + (dx * t2));
double i2y = (ay + (dy * t2));
project_to_circle_f64_f64_f64_ptr_f64_ptr_f64(i1x, i1y, r, (&(i1x)), (&(i1y)));
project_to_circle_f64_f64_f64_ptr_f64_ptr_f64(i2x, i2y, r, (&(i2x)), (&(i2y)));
return ((tri_or_sector_f64_f64_f64_f64_f64(ax, ay, i1x, i1y, r2) + tri_or_sector_f64_f64_f64_f64_f64(i1x, i1y, i2x, i2y, r2)) + tri_or_sector_f64_f64_f64_f64_f64(i2x, i2y, bx, by, r2));
}
double tri_circle_area_f64_f64_f64_f64_f64_f64_f64_f64_f64(double ax, double ay, double bx, double by, double cx, double cy, double ox, double oy, double r) {
double r2 = (r * r);
double a1x = (ax - ox);
double a1y = (ay - oy);
double b1x = (bx - ox);
double b1y = (by - oy);
double c1x = (cx - ox);
double c1y = (cy - oy);
double total = 0.0;
total = (total + edge_contrib_f64_f64_f64_f64_f64(a1x, a1y, b1x, b1y, r2));
total = (total + edge_contrib_f64_f64_f64_f64_f64(b1x, b1y, c1x, c1y, r2));
total = (total + edge_contrib_f64_f64_f64_f64_f64(c1x, c1y, a1x, a1y, r2));
return fabs(total);
}
void tri_coords_i32_i32_i32_ptr_f64_ptr_f64_ptr_f64_ptr_f64_ptr_f64_ptr_f64(int32_t a, int32_t b, int32_t c, double* ax, double* ay, double* bx, double* by, double* cx, double* cy) {
ax[0] = 0.0;
ay[0] = 0.0;
bx[0] = ((double)(c));
by[0] = 0.0;
double x = (((double)((((b * b) + (c * c)) - (a * a)))) / (2.0 * ((double)(c))));
double y2 = (((double)((b * b))) - (x * x));
if ((y2 < 0.0 && y2 > (0.0 - 1e-12))) {
y2 = 0.0;
}
if (y2 > 0.0) {
cy[0] = sqrt(y2);
} else {
cy[0] = 0.0;
}
cx[0] = x;
}
double tri_area_f64_f64_f64_f64_f64_f64(double ax, double ay, double bx, double by, double cx, double cy) {
return fabs((0.5 * (((bx - ax) * (cy - ay)) - ((by - ay) * (cx - ax)))));
}
int32_t circumcenter_f64_f64_f64_f64_f64_f64_ptr_f64_ptr_f64(double ax, double ay, double bx, double by, double cx, double cy, double* ux, double* uy) {
double d = (2.0 * (((ax * (by - cy)) + (bx * (cy - ay))) + (cx * (ay - by))));
if (fabs(d) < 1e-15) {
return 0;
}
double a2 = ((ax * ax) + (ay * ay));
double b2 = ((bx * bx) + (by * by));
double c2 = ((cx * cx) + (cy * cy));
ux[0] = ((((a2 * (by - cy)) + (b2 * (cy - ay))) + (c2 * (ay - by))) / d);
uy[0] = ((((a2 * (cx - bx)) + (b2 * (ax - cx))) + (c2 * (bx - ax))) / d);
return 1;
}
double fmin_val_f64_f64(double a, double b) {
if (a < b) {
return a;
}
return b;
}
double fmax_val_f64_f64(double a, double b) {
if (a > b) {
return a;
}
return b;
}
double maximize_intersection_i32_i32_i32(int32_t a, int32_t b, int32_t c) {
double abuf[1] = { 0.0 };
double aybuf[1] = { 0.0 };
double bbuf[1] = { 0.0 };
double bybuf[1] = { 0.0 };
double cbuf[1] = { 0.0 };
double cybuf[1] = { 0.0 };
tri_coords_i32_i32_i32_ptr_f64_ptr_f64_ptr_f64_ptr_f64_ptr_f64_ptr_f64(a, b, c, (&(abuf[0])), (&(aybuf[0])), (&(bbuf[0])), (&(bybuf[0])), (&(cbuf[0])), (&(cybuf[0])));
double ax = (((unsigned)(0) < 1) ? abuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 1), flow_fault_handler("array index out of bounds"), abuf[0]));
double ay = (((unsigned)(0) < 1) ? aybuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 1), flow_fault_handler("array index out of bounds"), aybuf[0]));
double bx = (((unsigned)(0) < 1) ? bbuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 1), flow_fault_handler("array index out of bounds"), bbuf[0]));
double by = (((unsigned)(0) < 1) ? bybuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 1), flow_fault_handler("array index out of bounds"), bybuf[0]));
double cx = (((unsigned)(0) < 1) ? cbuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 1), flow_fault_handler("array index out of bounds"), cbuf[0]));
double cy = (((unsigned)(0) < 1) ? cybuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 1), flow_fault_handler("array index out of bounds"), cybuf[0]));
double area = tri_area_f64_f64_f64_f64_f64_f64(ax, ay, bx, by, cx, cy);
if (area <= 0.0) {
return 0.0;
}
double r = sqrt((area / g_pi));
double xmin = (fmin_val_f64_f64(ax, fmin_val_f64_f64(bx, cx)) - r);
double xmax = (fmax_val_f64_f64(ax, fmax_val_f64_f64(bx, cx)) + r);
double ymin = (fmin_val_f64_f64(ay, fmin_val_f64_f64(by, cy)) - r);
double ymax = (fmax_val_f64_f64(ay, fmax_val_f64_f64(by, cy)) + r);
double cenx = (((ax + bx) + cx) / 3.0);
double ceny = (((ay + by) + cy) / 3.0);
int32_t per = ((a + b) + c);
double incx = ((((((double)(a)) * ax) + (((double)(b)) * bx)) + (((double)(c)) * cx)) / ((double)(per)));
double incy = ((((((double)(a)) * ay) + (((double)(b)) * by)) + (((double)(c)) * cy)) / ((double)(per)));
double ccbuf[2] = { 0.0, 0.0 };
int32_t has_cc = circumcenter_f64_f64_f64_f64_f64_f64_ptr_f64_ptr_f64(ax, ay, bx, by, cx, cy, (&(ccbuf[0])), (&(ccbuf[1])));
double ccx = (((unsigned)(0) < 2) ? ccbuf[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), ccbuf[0]));
double ccy = (((unsigned)(1) < 2) ? ccbuf[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 2), flow_fault_handler("array index out of bounds"), ccbuf[0]));
double starts[32] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
int32_t ns = 0;
starts[((ns * 2) + 0)] = cenx;
starts[((ns * 2) + 1)] = ceny;
ns = (ns + 1);
starts[((ns * 2) + 0)] = incx;
starts[((ns * 2) + 1)] = incy;
ns = (ns + 1);
starts[((ns * 2) + 0)] = ax;
starts[((ns * 2) + 1)] = ay;
ns = (ns + 1);
starts[((ns * 2) + 0)] = bx;
starts[((ns * 2) + 1)] = by;
ns = (ns + 1);
starts[((ns * 2) + 0)] = cx;
starts[((ns * 2) + 1)] = cy;
ns = (ns + 1);
starts[((ns * 2) + 0)] = ((ax + bx) * 0.5);
starts[((ns * 2) + 1)] = ((ay + by) * 0.5);
ns = (ns + 1);
starts[((ns * 2) + 0)] = ((bx + cx) * 0.5);
starts[((ns * 2) + 1)] = ((by + cy) * 0.5);
ns = (ns + 1);
starts[((ns * 2) + 0)] = ((cx + ax) * 0.5);
starts[((ns * 2) + 1)] = ((cy + ay) * 0.5);
ns = (ns + 1);
if (has_cc != 0) {
starts[((ns * 2) + 0)] = ccx;
starts[((ns * 2) + 1)] = ccy;
ns = (ns + 1);
}
double bestx = cenx;
double besty = ceny;
if (bestx < xmin) {
bestx = xmin;
}
if (bestx > xmax) {
bestx = xmax;
}
if (besty < ymin) {
besty = ymin;
}
if (besty > ymax) {
besty = ymax;
}
double bestv = tri_circle_area_f64_f64_f64_f64_f64_f64_f64_f64_f64(ax, ay, bx, by, cx, cy, bestx, besty, r);
if (bestv < 0.0) {
bestv = 0.0;
}
if (bestv > area) {
bestv = area;
}
int32_t s = 0;
while (s < ns) {
double sx = (((unsigned)(((s * 2) + 0)) < 32) ? starts[((s * 2) + 0)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((s * 2) + 0)), 32), flow_fault_handler("array index out of bounds"), starts[0]));
double sy = (((unsigned)(((s * 2) + 1)) < 32) ? starts[((s * 2) + 1)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((s * 2) + 1)), 32), flow_fault_handler("array index out of bounds"), starts[0]));
if (sx < xmin) {
sx = xmin;
}
if (sx > xmax) {
sx = xmax;
}
if (sy < ymin) {
sy = ymin;
}
if (sy > ymax) {
sy = ymax;
}
double v = tri_circle_area_f64_f64_f64_f64_f64_f64_f64_f64_f64(ax, ay, bx, by, cx, cy, sx, sy, r);
if (v < 0.0) {
v = 0.0;
}
if (v > area) {
v = area;
}
if (v > bestv) {
bestv = v;
bestx = sx;
besty = sy;
}
s = (s + 1);
}
double span = fmax_val_f64_f64((xmax - xmin), (ymax - ymin));
double step = fmax_val_f64_f64(span, r);
double dirs[16] = { 1.0, 0.0, (0.0 - 1.0), 0.0, 0.0, 1.0, 0.0, (0.0 - 1.0), 1.0, 1.0, 1.0, (0.0 - 1.0), (0.0 - 1.0), 1.0, (0.0 - 1.0), (0.0 - 1.0) };
double tol_step = fmax_val_f64_f64(1e-7, (1e-7 * fmax_val_f64_f64(1.0, r)));
while (step > tol_step) {
int32_t moved_any = 0;
bool cont_outer = 1;
while (cont_outer) {
int32_t improved = 0;
double bx0 = bestx;
double by0 = besty;
double bv0 = bestv;
int32_t d = 0;
while (d < 8) {
double px = (bestx + ((((unsigned)(((d * 2) + 0)) < 16) ? dirs[((d * 2) + 0)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((d * 2) + 0)), 16), flow_fault_handler("array index out of bounds"), dirs[0])) * step));
double py = (besty + ((((unsigned)(((d * 2) + 1)) < 16) ? dirs[((d * 2) + 1)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((d * 2) + 1)), 16), flow_fault_handler("array index out of bounds"), dirs[0])) * step));
if (px < xmin) {
px = xmin;
}
if (px > xmax) {
px = xmax;
}
if (py < ymin) {
py = ymin;
}
if (py > ymax) {
py = ymax;
}
double v = tri_circle_area_f64_f64_f64_f64_f64_f64_f64_f64_f64(ax, ay, bx, by, cx, cy, px, py, r);
if (v < 0.0) {
v = 0.0;
}
if (v > area) {
v = area;
}
if (v > (bv0 + 1e-13)) {
bv0 = v;
bx0 = px;
by0 = py;
improved = 1;
}
d = (d + 1);
}
if (improved != 0) {
bestv = bv0;
bestx = bx0;
besty = by0;
moved_any = 1;
} else {
cont_outer = 0;
}
}
if (moved_any == 0) {
step = (step * 0.5);
}
}
return bestv;
}
bool tt_less_TriTuple_TriTuple(TriTuple a, TriTuple b) {
if (a.a != b.a) {
return a.a < b.a;
}
if (a.b != b.b) {
return a.b < b.b;
}
return a.c < b.c;
}
void tt_sift_down_ptr_TriTuple_i32_i32(TriTuple* arr, int32_t start, int32_t endd) {
int32_t root = start;
bool cont = 1;
while (cont) {
int32_t child = ((2 * root) + 1);
if (child > endd) {
cont = 0;
} else {
if (((child + 1) <= endd && tt_less_TriTuple_TriTuple(arr[child], arr[(child + 1)]))) {
child = (child + 1);
}
if (tt_less_TriTuple_TriTuple(arr[root], arr[child])) {
TriTuple t = arr[root];
arr[root] = arr[child];
arr[child] = t;
root = child;
} else {
cont = 0;
}
}
}
}
void heapsort_tt_ptr_TriTuple_i32(TriTuple* arr, int32_t n) {
if (n <= 1) {
return;
}
int32_t start = (FLOW_CHECKED_DIV((n), (2)) - 1);
while (start >= 0) {
tt_sift_down_ptr_TriTuple_i32_i32(arr, start, (n - 1));
start = (start - 1);
}
int32_t endd = (n - 1);
while (endd > 0) {
TriTuple t = arr[0];
arr[0] = arr[endd];
arr[endd] = t;
endd = (endd - 1);
tt_sift_down_ptr_TriTuple_i32_i32(arr, 0, endd);
}
}
int32_t gcd_int_i32_i32(int32_t a0, int32_t b0) {
int32_t a = a0;
int32_t b = b0;
while (b != 0) {
int32_t t = FLOW_CHECKED_MOD((a), (b));
a = b;
b = t;
}
return a;
}
int32_t main(void) {
g_pi = acos((0.0 - 1.0));
int32_t limit = 200;
int32_t cap = 300000;
TriTuple* tuples = (TriTuple*)(((TriTuple*)(calloc(((int64_t)(cap)), 24))));
int32_t nt = 0;
int32_t a = 1;
while (a <= limit) {
int32_t b = a;
while (b <= limit) {
int32_t maxc1 = ((a + b) - 1);
int32_t maxc2 = ((limit - a) - b);
int32_t maxc = maxc1;
if (maxc2 < maxc1) {
maxc = maxc2;
}
if (maxc >= b) {
int32_t c = b;
while (c <= maxc) {
int32_t g = gcd_int_i32_i32(gcd_int_i32_i32(a, b), c);
tuples[nt] = (TriTuple){ .a = FLOW_CHECKED_DIV((a), (g)), .b = FLOW_CHECKED_DIV((b), (g)), .c = FLOW_CHECKED_DIV((c), (g)), .g2 = (((int64_t)(g)) * ((int64_t)(g))) };
nt = (nt + 1);
c = (c + 1);
}
}
b = (b + 1);
}
a = (a + 1);
}
heapsort_tt_ptr_TriTuple_i32(tuples, nt);
double total = 0.0;
double corr = 0.0;
int32_t i = 0;
while (i < nt) {
int32_t ta = tuples[i].a;
int32_t tb = tuples[i].b;
int32_t tc = tuples[i].c;
int64_t weight = 0;
while ((((i < nt && tuples[i].a == ta) && tuples[i].b == tb) && tuples[i].c == tc)) {
weight = (weight + tuples[i].g2);
i = (i + 1);
}
double Ival = maximize_intersection_i32_i32_i32(ta, tb, tc);
double term = (Ival * ((double)(weight)));
double y = (term - corr);
double t = (total + y);
corr = ((t - total) - y);
total = t;
}
free(((void*)(tuples)));
printf("%.2f\n", total);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%.2f\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 @sqrt(f64) -> f64
func.func private @fabs(f64) -> f64
func.func private @atan2(f64, f64) -> f64
func.func private @hypot(f64, f64) -> f64
func.func private @acos(f64) -> f64
// Constant: EPS
llvm.mlir.global internal constant @EPS(0.000000000001 : f64) : f64
// Struct: TriTuple
// Fields:
// a: i32
// b: i32
// c: i32
// g2: i64
// Module static: g_pi
llvm.mlir.global internal @g_pi(0.0 : f64) : f64
func.func @segment_circle_ts(%arg0: f64, %arg1: f64, %arg2: f64, %arg3: f64, %arg4: f64, %arg5: !llvm.ptr, %arg6: !llvm.ptr) -> i32 {
%0 = arith.subf %arg2, %arg0 : f64
%1 = arith.subf %arg3, %arg1 : f64
%2 = arith.mulf %0, %0 : f64
%3 = arith.mulf %1, %1 : f64
%4 = arith.addf %2, %3 : f64
%5 = arith.constant 0 : f32
%7 = arith.extf %5 : f32 to f64
%6 = arith.cmpf olt, %4, %7 : f64
cf.cond_br %6, ^bb0, ^bb1
^bb0:
%8 = arith.constant 0.0 : f32
%9 = arith.constant 0 : i32
%10 = arith.extf %8 : f32 to f64
%11 = arith.extsi %9 : i32 to i64
%12 = llvm.getelementptr %arg5[%11] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %10, %12 : f64, !llvm.ptr
%13 = arith.constant 0.0 : f32
%14 = arith.constant 0 : i32
%15 = arith.extf %13 : f32 to f64
%16 = arith.extsi %14 : i32 to i64
%17 = llvm.getelementptr %arg6[%16] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %15, %17 : f64, !llvm.ptr
%18 = arith.constant 0 : i32
func.return %18 : i32
^bb1:
cf.br ^bb2
^bb2:
%19 = arith.constant 2.0 : f32
%20 = arith.mulf %arg0, %0 : f64
%21 = arith.mulf %arg1, %1 : f64
%22 = arith.addf %20, %21 : f64
%24 = arith.extf %19 : f32 to f64
%23 = arith.mulf %24, %22 : f64
%25 = arith.mulf %arg0, %arg0 : f64
%26 = arith.mulf %arg1, %arg1 : f64
%27 = arith.addf %25, %26 : f64
%28 = arith.subf %27, %arg4 : f64
%29 = arith.mulf %23, %23 : f64
%30 = arith.constant 4.0 : f32
%32 = arith.extf %30 : f32 to f64
%31 = arith.mulf %32, %4 : f64
%33 = arith.mulf %31, %28 : f64
%34 = arith.subf %29, %33 : f64
%35 = llvm.mlir.constant(1 : i64) : i64
%36 = llvm.alloca %35 x f64 : (i64) -> !llvm.ptr
llvm.store %34, %36 : f64, !llvm.ptr
%37 = llvm.load %36 : !llvm.ptr -> f64
%38 = arith.constant 0.0 : f32
%39 = arith.constant 0 : f32
%40 = arith.subf %38, %39 : f32
%42 = arith.extf %40 : f32 to f64
%41 = arith.cmpf olt, %37, %42 : f64
cf.cond_br %41, ^bb3, ^bb4
^bb3:
%43 = arith.constant 0.0 : f32
%44 = arith.constant 0 : i32
%45 = arith.extf %43 : f32 to f64
%46 = arith.extsi %44 : i32 to i64
%47 = llvm.getelementptr %arg5[%46] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %45, %47 : f64, !llvm.ptr
%48 = arith.constant 0.0 : f32
%49 = arith.constant 0 : i32
%50 = arith.extf %48 : f32 to f64
%51 = arith.extsi %49 : i32 to i64
%52 = llvm.getelementptr %arg6[%51] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %50, %52 : f64, !llvm.ptr
%53 = arith.constant 0 : i32
func.return %53 : i32
^bb4:
cf.br ^bb5
^bb5:
%54 = llvm.load %36 : !llvm.ptr -> f64
%55 = arith.constant 0.0 : f32
%57 = arith.extf %55 : f32 to f64
%56 = arith.cmpf olt, %54, %57 : f64
cf.cond_br %56, ^bb6, ^bb7
^bb6:
%58 = arith.constant 0.0 : f32
%59 = arith.extf %58 : f32 to f64
llvm.store %59, %36 : f64, !llvm.ptr
cf.br ^bb8
^bb7:
cf.br ^bb8
^bb8:
%60 = llvm.load %36 : !llvm.ptr -> f64
%61 = math.sqrt %60 : f64
%62 = arith.constant 0.5 : f32
%64 = arith.extf %62 : f32 to f64
%63 = arith.divf %64, %4 : f64
%65 = arith.constant 0.0 : f32
%67 = arith.extf %65 : f32 to f64
%66 = arith.subf %67, %23 : f64
%68 = arith.subf %66, %61 : f64
%69 = arith.mulf %68, %63 : f64
%70 = arith.constant 0.0 : f32
%72 = arith.extf %70 : f32 to f64
%71 = arith.subf %72, %23 : f64
%73 = arith.addf %71, %61 : f64
%74 = arith.mulf %73, %63 : f64
%76 = arith.constant 0.0 : f32
%77 = arith.constant 0.0 : f32
%78 = llvm.mlir.constant(1 : i64) : i64
%79 = llvm.alloca %78 x !llvm.array<2 x f64> : (i64) -> !llvm.ptr
%80 = llvm.mlir.zero : !llvm.array<2 x f64>
llvm.store %80, %79 : !llvm.array<2 x f64>, !llvm.ptr
%81 = arith.extf %76 : f32 to f64
%82 = arith.extf %77 : f32 to f64
%83 = llvm.mlir.constant(0 : i64) : i64
%84 = llvm.getelementptr %79[0, %83] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %81, %84 : f64, !llvm.ptr
%85 = llvm.mlir.constant(1 : i64) : i64
%86 = llvm.getelementptr %79[0, %85] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %82, %86 : f64, !llvm.ptr
%87 = arith.constant 0 : i32
%88 = llvm.mlir.constant(1 : i64) : i64
%89 = llvm.alloca %88 x i32 : (i64) -> !llvm.ptr
llvm.store %87, %89 : i32, !llvm.ptr
%90 = arith.constant 0.0 : f32
%91 = llvm.mlir.addressof @EPS : !llvm.ptr
%92 = llvm.load %91 : !llvm.ptr -> f64
%94 = arith.extf %90 : f32 to f64
%93 = arith.subf %94, %92 : f64
%95 = arith.cmpf ole, %93, %69 : f64
%96 = scf.if %95 -> (i1) {
%97 = arith.constant 1.0 : f32
%98 = llvm.mlir.addressof @EPS : !llvm.ptr
%99 = llvm.load %98 : !llvm.ptr -> f64
%101 = arith.extf %97 : f32 to f64
%100 = arith.addf %101, %99 : f64
%102 = arith.cmpf ole, %69, %100 : f64
scf.yield %102 : i1
} else {
%103 = arith.constant false
scf.yield %103 : i1
}
cf.cond_br %96, ^bb9, ^bb10
^bb9:
%104 = llvm.mlir.constant(1 : i64) : i64
%105 = llvm.alloca %104 x f64 : (i64) -> !llvm.ptr
llvm.store %69, %105 : f64, !llvm.ptr
%106 = llvm.load %105 : !llvm.ptr -> f64
%107 = arith.constant 0.0 : f32
%109 = arith.extf %107 : f32 to f64
%108 = arith.cmpf olt, %106, %109 : f64
cf.cond_br %108, ^bb12, ^bb13
^bb12:
%110 = arith.constant 0.0 : f32
%111 = arith.extf %110 : f32 to f64
llvm.store %111, %105 : f64, !llvm.ptr
cf.br ^bb14
^bb13:
cf.br ^bb14
^bb14:
%112 = llvm.load %105 : !llvm.ptr -> f64
%113 = arith.constant 1.0 : f32
%115 = arith.extf %113 : f32 to f64
%114 = arith.cmpf ogt, %112, %115 : f64
cf.cond_br %114, ^bb15, ^bb16
^bb15:
%116 = arith.constant 1.0 : f32
%117 = arith.extf %116 : f32 to f64
llvm.store %117, %105 : f64, !llvm.ptr
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%118 = llvm.load %105 : !llvm.ptr -> f64
%119 = llvm.load %89 : !llvm.ptr -> i32
%120 = arith.extsi %119 : i32 to i64
%121 = llvm.getelementptr %79[0, %120] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %118, %121 : f64, !llvm.ptr
%122 = llvm.load %89 : !llvm.ptr -> i32
%123 = arith.constant 1 : i32
%124 = arith.addi %122, %123 : i32
llvm.store %124, %89 : i32, !llvm.ptr
cf.br ^bb11
^bb10:
cf.br ^bb11
^bb11:
%125 = arith.constant 0.0 : f32
%126 = llvm.mlir.addressof @EPS : !llvm.ptr
%127 = llvm.load %126 : !llvm.ptr -> f64
%129 = arith.extf %125 : f32 to f64
%128 = arith.subf %129, %127 : f64
%130 = arith.cmpf ole, %128, %74 : f64
%131 = scf.if %130 -> (i1) {
%132 = arith.constant 1.0 : f32
%133 = llvm.mlir.addressof @EPS : !llvm.ptr
%134 = llvm.load %133 : !llvm.ptr -> f64
%136 = arith.extf %132 : f32 to f64
%135 = arith.addf %136, %134 : f64
%137 = arith.cmpf ole, %74, %135 : f64
scf.yield %137 : i1
} else {
%138 = arith.constant false
scf.yield %138 : i1
}
cf.cond_br %131, ^bb18, ^bb19
^bb18:
%139 = llvm.mlir.constant(1 : i64) : i64
%140 = llvm.alloca %139 x f64 : (i64) -> !llvm.ptr
llvm.store %74, %140 : f64, !llvm.ptr
%141 = llvm.load %140 : !llvm.ptr -> f64
%142 = arith.constant 0.0 : f32
%144 = arith.extf %142 : f32 to f64
%143 = arith.cmpf olt, %141, %144 : f64
cf.cond_br %143, ^bb21, ^bb22
^bb21:
%145 = arith.constant 0.0 : f32
%146 = arith.extf %145 : f32 to f64
llvm.store %146, %140 : f64, !llvm.ptr
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
%147 = llvm.load %140 : !llvm.ptr -> f64
%148 = arith.constant 1.0 : f32
%150 = arith.extf %148 : f32 to f64
%149 = arith.cmpf ogt, %147, %150 : f64
cf.cond_br %149, ^bb24, ^bb25
^bb24:
%151 = arith.constant 1.0 : f32
%152 = arith.extf %151 : f32 to f64
llvm.store %152, %140 : f64, !llvm.ptr
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
%153 = llvm.load %89 : !llvm.ptr -> i32
%154 = arith.constant 0 : i32
%155 = arith.cmpi eq, %153, %154 : i32
%156 = scf.if %155 -> (i1) {
%157 = arith.constant true
scf.yield %157 : i1
} else {
%158 = llvm.load %140 : !llvm.ptr -> f64
%160 = arith.constant 0 : i32
%161 = arith.extsi %160 : i32 to i64
%162 = llvm.getelementptr %79[0, %161] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%159 = llvm.load %162 : !llvm.ptr -> f64
%163 = arith.subf %158, %159 : f64
%164 = math.absf %163 : f64
%165 = arith.constant 0 : f32
%167 = arith.extf %165 : f32 to f64
%166 = arith.cmpf ogt, %164, %167 : f64
scf.yield %166 : i1
}
cf.cond_br %156, ^bb27, ^bb28
^bb27:
%168 = llvm.load %140 : !llvm.ptr -> f64
%169 = llvm.load %89 : !llvm.ptr -> i32
%170 = arith.extsi %169 : i32 to i64
%171 = llvm.getelementptr %79[0, %170] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %168, %171 : f64, !llvm.ptr
%172 = llvm.load %89 : !llvm.ptr -> i32
%173 = arith.constant 1 : i32
%174 = arith.addi %172, %173 : i32
llvm.store %174, %89 : i32, !llvm.ptr
cf.br ^bb29
^bb28:
cf.br ^bb29
^bb29:
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
%175 = llvm.load %89 : !llvm.ptr -> i32
%176 = arith.constant 0 : i32
%177 = arith.cmpi eq, %175, %176 : i32
cf.cond_br %177, ^bb30, ^bb31
^bb30:
%178 = arith.constant 0.0 : f32
%179 = arith.constant 0 : i32
%180 = arith.extf %178 : f32 to f64
%181 = arith.extsi %179 : i32 to i64
%182 = llvm.getelementptr %arg5[%181] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %180, %182 : f64, !llvm.ptr
%183 = arith.constant 0.0 : f32
%184 = arith.constant 0 : i32
%185 = arith.extf %183 : f32 to f64
%186 = arith.extsi %184 : i32 to i64
%187 = llvm.getelementptr %arg6[%186] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %185, %187 : f64, !llvm.ptr
%188 = arith.constant 0 : i32
func.return %188 : i32
^bb31:
cf.br ^bb32
^bb32:
%189 = llvm.load %89 : !llvm.ptr -> i32
%190 = arith.constant 1 : i32
%191 = arith.cmpi eq, %189, %190 : i32
cf.cond_br %191, ^bb33, ^bb34
^bb33:
%193 = arith.constant 0 : i32
%194 = arith.extsi %193 : i32 to i64
%195 = llvm.getelementptr %79[0, %194] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%192 = llvm.load %195 : !llvm.ptr -> f64
%196 = arith.constant 0 : i32
%197 = arith.extsi %196 : i32 to i64
%198 = llvm.getelementptr %arg5[%197] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %192, %198 : f64, !llvm.ptr
%199 = arith.constant 0.0 : f32
%200 = arith.constant 0 : i32
%201 = arith.extf %199 : f32 to f64
%202 = arith.extsi %200 : i32 to i64
%203 = llvm.getelementptr %arg6[%202] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %201, %203 : f64, !llvm.ptr
%204 = arith.constant 1 : i32
func.return %204 : i32
^bb34:
cf.br ^bb35
^bb35:
%206 = arith.constant 0 : i32
%207 = arith.extsi %206 : i32 to i64
%208 = llvm.getelementptr %79[0, %207] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%205 = llvm.load %208 : !llvm.ptr -> f64
%210 = arith.constant 1 : i32
%211 = arith.extsi %210 : i32 to i64
%212 = llvm.getelementptr %79[0, %211] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%209 = llvm.load %212 : !llvm.ptr -> f64
%213 = arith.cmpf ogt, %205, %209 : f64
cf.cond_br %213, ^bb36, ^bb37
^bb36:
%215 = arith.constant 0 : i32
%216 = arith.extsi %215 : i32 to i64
%217 = llvm.getelementptr %79[0, %216] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%214 = llvm.load %217 : !llvm.ptr -> f64
%219 = arith.constant 1 : i32
%220 = arith.extsi %219 : i32 to i64
%221 = llvm.getelementptr %79[0, %220] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%218 = llvm.load %221 : !llvm.ptr -> f64
%222 = arith.constant 0 : i32
%223 = arith.extsi %222 : i32 to i64
%224 = llvm.getelementptr %79[0, %223] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %218, %224 : f64, !llvm.ptr
%225 = arith.constant 1 : i32
%226 = arith.extsi %225 : i32 to i64
%227 = llvm.getelementptr %79[0, %226] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %214, %227 : f64, !llvm.ptr
cf.br ^bb38
^bb37:
cf.br ^bb38
^bb38:
%229 = arith.constant 0 : i32
%230 = arith.extsi %229 : i32 to i64
%231 = llvm.getelementptr %79[0, %230] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%228 = llvm.load %231 : !llvm.ptr -> f64
%232 = arith.constant 0 : i32
%233 = arith.extsi %232 : i32 to i64
%234 = llvm.getelementptr %arg5[%233] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %228, %234 : f64, !llvm.ptr
%236 = arith.constant 1 : i32
%237 = arith.extsi %236 : i32 to i64
%238 = llvm.getelementptr %79[0, %237] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%235 = llvm.load %238 : !llvm.ptr -> f64
%239 = arith.constant 0 : i32
%240 = arith.extsi %239 : i32 to i64
%241 = llvm.getelementptr %arg6[%240] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %235, %241 : f64, !llvm.ptr
%242 = arith.constant 2 : i32
func.return %242 : i32
}
func.func @tri_or_sector(%arg0: f64, %arg1: f64, %arg2: f64, %arg3: f64, %arg4: f64) -> f64 {
%243 = arith.mulf %arg0, %arg3 : f64
%244 = arith.mulf %arg1, %arg2 : f64
%245 = arith.subf %243, %244 : f64
%246 = arith.mulf %arg0, %arg0 : f64
%247 = arith.mulf %arg1, %arg1 : f64
%248 = arith.addf %246, %247 : f64
%249 = arith.mulf %arg2, %arg2 : f64
%250 = arith.mulf %arg3, %arg3 : f64
%251 = arith.addf %249, %250 : f64
%252 = arith.constant 0 : f32
%254 = arith.extf %252 : f32 to f64
%253 = arith.addf %arg4, %254 : f64
%255 = arith.cmpf ole, %248, %253 : f64
%256 = scf.if %255 -> (i1) {
%257 = arith.constant 0 : f32
%259 = arith.extf %257 : f32 to f64
%258 = arith.addf %arg4, %259 : f64
%260 = arith.cmpf ole, %251, %258 : f64
scf.yield %260 : i1
} else {
%261 = arith.constant false
scf.yield %261 : i1
}
cf.cond_br %256, ^bb39, ^bb40
^bb39:
%262 = arith.constant 0.5 : f32
%264 = arith.extf %262 : f32 to f64
%263 = arith.mulf %264, %245 : f64
func.return %263 : f64
^bb40:
cf.br ^bb41
^bb41:
%265 = arith.mulf %arg0, %arg2 : f64
%266 = arith.mulf %arg1, %arg3 : f64
%267 = arith.addf %265, %266 : f64
%268 = func.call @atan2(%245, %267) : (f64, f64) -> f64
%269 = arith.constant 0.5 : f32
%271 = arith.extf %269 : f32 to f64
%270 = arith.mulf %271, %arg4 : f64
%272 = arith.mulf %270, %268 : f64
func.return %272 : f64
}
func.func @project_to_circle(%arg0: f64, %arg1: f64, %arg2: f64, %arg3: !llvm.ptr, %arg4: !llvm.ptr) -> () {
%273 = func.call @hypot(%arg0, %arg1) : (f64, f64) -> f64
%274 = arith.constant 0 : f32
%276 = arith.extf %274 : f32 to f64
%275 = arith.cmpf olt, %273, %276 : f64
cf.cond_br %275, ^bb42, ^bb43
^bb42:
%277 = arith.constant 0 : i32
%278 = arith.extsi %277 : i32 to i64
%279 = llvm.getelementptr %arg3[%278] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg0, %279 : f64, !llvm.ptr
%280 = arith.constant 0 : i32
%281 = arith.extsi %280 : i32 to i64
%282 = llvm.getelementptr %arg4[%281] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %arg1, %282 : f64, !llvm.ptr
func.return
^bb43:
cf.br ^bb44
^bb44:
%283 = arith.divf %arg2, %273 : f64
%284 = arith.mulf %arg0, %283 : f64
%285 = arith.constant 0 : i32
%286 = arith.extsi %285 : i32 to i64
%287 = llvm.getelementptr %arg3[%286] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %284, %287 : f64, !llvm.ptr
%288 = arith.mulf %arg1, %283 : f64
%289 = arith.constant 0 : i32
%290 = arith.extsi %289 : i32 to i64
%291 = llvm.getelementptr %arg4[%290] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %288, %291 : f64, !llvm.ptr
func.return
}
func.func @edge_contrib(%arg0: f64, %arg1: f64, %arg2: f64, %arg3: f64, %arg4: f64) -> f64 {
%293 = arith.constant 0.0 : f32
%294 = arith.constant 0.0 : f32
%295 = llvm.mlir.constant(1 : i64) : i64
%296 = llvm.alloca %295 x !llvm.array<2 x f64> : (i64) -> !llvm.ptr
%297 = llvm.mlir.zero : !llvm.array<2 x f64>
llvm.store %297, %296 : !llvm.array<2 x f64>, !llvm.ptr
%298 = arith.extf %293 : f32 to f64
%299 = arith.extf %294 : f32 to f64
%300 = llvm.mlir.constant(0 : i64) : i64
%301 = llvm.getelementptr %296[0, %300] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %298, %301 : f64, !llvm.ptr
%302 = llvm.mlir.constant(1 : i64) : i64
%303 = llvm.getelementptr %296[0, %302] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %299, %303 : f64, !llvm.ptr
%305 = arith.constant 0 : i32
%306 = arith.extsi %305 : i32 to i64
%307 = llvm.getelementptr %296[0, %306] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%308 = arith.constant 1 : i32
%309 = arith.extsi %308 : i32 to i64
%310 = llvm.getelementptr %296[0, %309] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%304 = func.call @segment_circle_ts(%arg0, %arg1, %arg2, %arg3, %arg4, %307, %310) : (f64, f64, f64, f64, f64, !llvm.ptr, !llvm.ptr) -> i32
%312 = arith.constant 0 : i32
%313 = arith.extsi %312 : i32 to i64
%314 = llvm.getelementptr %296[0, %313] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%311 = llvm.load %314 : !llvm.ptr -> f64
%316 = arith.constant 1 : i32
%317 = arith.extsi %316 : i32 to i64
%318 = llvm.getelementptr %296[0, %317] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%315 = llvm.load %318 : !llvm.ptr -> f64
%319 = arith.constant 0 : i32
%320 = arith.cmpi eq, %304, %319 : i32
cf.cond_br %320, ^bb45, ^bb46
^bb45:
%321 = func.call @tri_or_sector(%arg0, %arg1, %arg2, %arg3, %arg4) : (f64, f64, f64, f64, f64) -> f64
func.return %321 : f64
^bb46:
cf.br ^bb47
^bb47:
%322 = arith.subf %arg2, %arg0 : f64
%323 = arith.subf %arg3, %arg1 : f64
%324 = math.sqrt %arg4 : f64
%325 = arith.constant 1 : i32
%326 = arith.cmpi eq, %304, %325 : i32
cf.cond_br %326, ^bb48, ^bb49
^bb48:
%327 = arith.mulf %322, %311 : f64
%328 = arith.addf %arg0, %327 : f64
%329 = llvm.mlir.constant(1 : i64) : i64
%330 = llvm.alloca %329 x f64 : (i64) -> !llvm.ptr
llvm.store %328, %330 : f64, !llvm.ptr
%331 = arith.mulf %323, %311 : f64
%332 = arith.addf %arg1, %331 : f64
%333 = llvm.mlir.constant(1 : i64) : i64
%334 = llvm.alloca %333 x f64 : (i64) -> !llvm.ptr
llvm.store %332, %334 : f64, !llvm.ptr
%336 = llvm.load %330 : !llvm.ptr -> f64
%337 = llvm.load %334 : !llvm.ptr -> f64
func.call @project_to_circle(%336, %337, %324, %330, %334) : (f64, f64, f64, !llvm.ptr, !llvm.ptr) -> ()
%339 = llvm.load %330 : !llvm.ptr -> f64
%340 = llvm.load %334 : !llvm.ptr -> f64
%338 = func.call @tri_or_sector(%arg0, %arg1, %339, %340, %arg4) : (f64, f64, f64, f64, f64) -> f64
%342 = llvm.load %330 : !llvm.ptr -> f64
%343 = llvm.load %334 : !llvm.ptr -> f64
%341 = func.call @tri_or_sector(%342, %343, %arg2, %arg3, %arg4) : (f64, f64, f64, f64, f64) -> f64
%344 = arith.addf %338, %341 : f64
func.return %344 : f64
^bb49:
cf.br ^bb50
^bb50:
%345 = arith.mulf %322, %311 : f64
%346 = arith.addf %arg0, %345 : f64
%347 = llvm.mlir.constant(1 : i64) : i64
%348 = llvm.alloca %347 x f64 : (i64) -> !llvm.ptr
llvm.store %346, %348 : f64, !llvm.ptr
%349 = arith.mulf %323, %311 : f64
%350 = arith.addf %arg1, %349 : f64
%351 = llvm.mlir.constant(1 : i64) : i64
%352 = llvm.alloca %351 x f64 : (i64) -> !llvm.ptr
llvm.store %350, %352 : f64, !llvm.ptr
%353 = arith.mulf %322, %315 : f64
%354 = arith.addf %arg0, %353 : f64
%355 = llvm.mlir.constant(1 : i64) : i64
%356 = llvm.alloca %355 x f64 : (i64) -> !llvm.ptr
llvm.store %354, %356 : f64, !llvm.ptr
%357 = arith.mulf %323, %315 : f64
%358 = arith.addf %arg1, %357 : f64
%359 = llvm.mlir.constant(1 : i64) : i64
%360 = llvm.alloca %359 x f64 : (i64) -> !llvm.ptr
llvm.store %358, %360 : f64, !llvm.ptr
%362 = llvm.load %348 : !llvm.ptr -> f64
%363 = llvm.load %352 : !llvm.ptr -> f64
func.call @project_to_circle(%362, %363, %324, %348, %352) : (f64, f64, f64, !llvm.ptr, !llvm.ptr) -> ()
%365 = llvm.load %356 : !llvm.ptr -> f64
%366 = llvm.load %360 : !llvm.ptr -> f64
func.call @project_to_circle(%365, %366, %324, %356, %360) : (f64, f64, f64, !llvm.ptr, !llvm.ptr) -> ()
%368 = llvm.load %348 : !llvm.ptr -> f64
%369 = llvm.load %352 : !llvm.ptr -> f64
%367 = func.call @tri_or_sector(%arg0, %arg1, %368, %369, %arg4) : (f64, f64, f64, f64, f64) -> f64
%371 = llvm.load %348 : !llvm.ptr -> f64
%372 = llvm.load %352 : !llvm.ptr -> f64
%373 = llvm.load %356 : !llvm.ptr -> f64
%374 = llvm.load %360 : !llvm.ptr -> f64
%370 = func.call @tri_or_sector(%371, %372, %373, %374, %arg4) : (f64, f64, f64, f64, f64) -> f64
%375 = arith.addf %367, %370 : f64
%377 = llvm.load %356 : !llvm.ptr -> f64
%378 = llvm.load %360 : !llvm.ptr -> f64
%376 = func.call @tri_or_sector(%377, %378, %arg2, %arg3, %arg4) : (f64, f64, f64, f64, f64) -> f64
%379 = arith.addf %375, %376 : f64
func.return %379 : f64
}
func.func @tri_circle_area(%arg0: f64, %arg1: f64, %arg2: f64, %arg3: f64, %arg4: f64, %arg5: f64, %arg6: f64, %arg7: f64, %arg8: f64) -> f64 {
%380 = arith.mulf %arg8, %arg8 : f64
%381 = arith.subf %arg0, %arg6 : f64
%382 = arith.subf %arg1, %arg7 : f64
%383 = arith.subf %arg2, %arg6 : f64
%384 = arith.subf %arg3, %arg7 : f64
%385 = arith.subf %arg4, %arg6 : f64
%386 = arith.subf %arg5, %arg7 : f64
%387 = arith.constant 0.0 : f32
%388 = arith.extf %387 : f32 to f64
%389 = llvm.mlir.constant(1 : i64) : i64
%390 = llvm.alloca %389 x f64 : (i64) -> !llvm.ptr
llvm.store %388, %390 : f64, !llvm.ptr
%391 = llvm.load %390 : !llvm.ptr -> f64
%392 = func.call @edge_contrib(%381, %382, %383, %384, %380) : (f64, f64, f64, f64, f64) -> f64
%393 = arith.addf %391, %392 : f64
llvm.store %393, %390 : f64, !llvm.ptr
%394 = llvm.load %390 : !llvm.ptr -> f64
%395 = func.call @edge_contrib(%383, %384, %385, %386, %380) : (f64, f64, f64, f64, f64) -> f64
%396 = arith.addf %394, %395 : f64
llvm.store %396, %390 : f64, !llvm.ptr
%397 = llvm.load %390 : !llvm.ptr -> f64
%398 = func.call @edge_contrib(%385, %386, %381, %382, %380) : (f64, f64, f64, f64, f64) -> f64
%399 = arith.addf %397, %398 : f64
llvm.store %399, %390 : f64, !llvm.ptr
%400 = llvm.load %390 : !llvm.ptr -> f64
%401 = math.absf %400 : f64
func.return %401 : f64
}
func.func @tri_coords(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: !llvm.ptr) -> () {
%402 = arith.constant 0.0 : f32
%403 = arith.constant 0 : i32
%404 = arith.extf %402 : f32 to f64
%405 = arith.extsi %403 : i32 to i64
%406 = llvm.getelementptr %arg3[%405] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %404, %406 : f64, !llvm.ptr
%407 = arith.constant 0.0 : f32
%408 = arith.constant 0 : i32
%409 = arith.extf %407 : f32 to f64
%410 = arith.extsi %408 : i32 to i64
%411 = llvm.getelementptr %arg4[%410] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %409, %411 : f64, !llvm.ptr
%412 = arith.sitofp %arg2 : i32 to f64
%413 = arith.constant 0 : i32
%414 = arith.extsi %413 : i32 to i64
%415 = llvm.getelementptr %arg5[%414] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %412, %415 : f64, !llvm.ptr
%416 = arith.constant 0.0 : f32
%417 = arith.constant 0 : i32
%418 = arith.extf %416 : f32 to f64
%419 = arith.extsi %417 : i32 to i64
%420 = llvm.getelementptr %arg6[%419] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %418, %420 : f64, !llvm.ptr
%421 = arith.muli %arg1, %arg1 : i32
%422 = arith.muli %arg2, %arg2 : i32
%423 = arith.addi %421, %422 : i32
%424 = arith.muli %arg0, %arg0 : i32
%425 = arith.subi %423, %424 : i32
%426 = arith.sitofp %425 : i32 to f64
%427 = arith.constant 2.0 : f32
%428 = arith.sitofp %arg2 : i32 to f64
%430 = arith.extf %427 : f32 to f64
%429 = arith.mulf %430, %428 : f64
%431 = arith.divf %426, %429 : f64
%432 = arith.muli %arg1, %arg1 : i32
%433 = arith.sitofp %432 : i32 to f64
%434 = arith.mulf %431, %431 : f64
%435 = arith.subf %433, %434 : f64
%436 = llvm.mlir.constant(1 : i64) : i64
%437 = llvm.alloca %436 x f64 : (i64) -> !llvm.ptr
llvm.store %435, %437 : f64, !llvm.ptr
%438 = llvm.load %437 : !llvm.ptr -> f64
%439 = arith.constant 0.0 : f32
%441 = arith.extf %439 : f32 to f64
%440 = arith.cmpf olt, %438, %441 : f64
%442 = scf.if %440 -> (i1) {
%443 = llvm.load %437 : !llvm.ptr -> f64
%444 = arith.constant 0.0 : f32
%445 = arith.constant 0 : f32
%446 = arith.subf %444, %445 : f32
%448 = arith.extf %446 : f32 to f64
%447 = arith.cmpf ogt, %443, %448 : f64
scf.yield %447 : i1
} else {
%449 = arith.constant false
scf.yield %449 : i1
}
cf.cond_br %442, ^bb51, ^bb52
^bb51:
%450 = arith.constant 0.0 : f32
%451 = arith.extf %450 : f32 to f64
llvm.store %451, %437 : f64, !llvm.ptr
cf.br ^bb53
^bb52:
cf.br ^bb53
^bb53:
%452 = llvm.load %437 : !llvm.ptr -> f64
%453 = arith.constant 0.0 : f32
%455 = arith.extf %453 : f32 to f64
%454 = arith.cmpf ogt, %452, %455 : f64
cf.cond_br %454, ^bb54, ^bb55
^bb54:
%456 = llvm.load %437 : !llvm.ptr -> f64
%457 = math.sqrt %456 : f64
%458 = arith.constant 0 : i32
%459 = arith.extsi %458 : i32 to i64
%460 = llvm.getelementptr %arg8[%459] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %457, %460 : f64, !llvm.ptr
cf.br ^bb56
^bb55:
%461 = arith.constant 0.0 : f32
%462 = arith.constant 0 : i32
%463 = arith.extf %461 : f32 to f64
%464 = arith.extsi %462 : i32 to i64
%465 = llvm.getelementptr %arg8[%464] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %463, %465 : f64, !llvm.ptr
cf.br ^bb56
^bb56:
%466 = arith.constant 0 : i32
%467 = arith.extsi %466 : i32 to i64
%468 = llvm.getelementptr %arg7[%467] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %431, %468 : f64, !llvm.ptr
func.return
}
func.func @tri_area(%arg0: f64, %arg1: f64, %arg2: f64, %arg3: f64, %arg4: f64, %arg5: f64) -> f64 {
%469 = arith.constant 0.5 : f32
%470 = arith.subf %arg2, %arg0 : f64
%471 = arith.subf %arg5, %arg1 : f64
%472 = arith.mulf %470, %471 : f64
%473 = arith.subf %arg3, %arg1 : f64
%474 = arith.subf %arg4, %arg0 : f64
%475 = arith.mulf %473, %474 : f64
%476 = arith.subf %472, %475 : f64
%478 = arith.extf %469 : f32 to f64
%477 = arith.mulf %478, %476 : f64
%479 = math.absf %477 : f64
func.return %479 : f64
}
func.func @circumcenter(%arg0: f64, %arg1: f64, %arg2: f64, %arg3: f64, %arg4: f64, %arg5: f64, %arg6: !llvm.ptr, %arg7: !llvm.ptr) -> i32 {
%480 = arith.constant 2.0 : f32
%481 = arith.subf %arg3, %arg5 : f64
%482 = arith.mulf %arg0, %481 : f64
%483 = arith.subf %arg5, %arg1 : f64
%484 = arith.mulf %arg2, %483 : f64
%485 = arith.addf %482, %484 : f64
%486 = arith.subf %arg1, %arg3 : f64
%487 = arith.mulf %arg4, %486 : f64
%488 = arith.addf %485, %487 : f64
%490 = arith.extf %480 : f32 to f64
%489 = arith.mulf %490, %488 : f64
%491 = math.absf %489 : f64
%492 = arith.constant 0 : f32
%494 = arith.extf %492 : f32 to f64
%493 = arith.cmpf olt, %491, %494 : f64
cf.cond_br %493, ^bb57, ^bb58
^bb57:
%495 = arith.constant 0 : i32
func.return %495 : i32
^bb58:
cf.br ^bb59
^bb59:
%496 = arith.mulf %arg0, %arg0 : f64
%497 = arith.mulf %arg1, %arg1 : f64
%498 = arith.addf %496, %497 : f64
%499 = arith.mulf %arg2, %arg2 : f64
%500 = arith.mulf %arg3, %arg3 : f64
%501 = arith.addf %499, %500 : f64
%502 = arith.mulf %arg4, %arg4 : f64
%503 = arith.mulf %arg5, %arg5 : f64
%504 = arith.addf %502, %503 : f64
%505 = arith.subf %arg3, %arg5 : f64
%506 = arith.mulf %498, %505 : f64
%507 = arith.subf %arg5, %arg1 : f64
%508 = arith.mulf %501, %507 : f64
%509 = arith.addf %506, %508 : f64
%510 = arith.subf %arg1, %arg3 : f64
%511 = arith.mulf %504, %510 : f64
%512 = arith.addf %509, %511 : f64
%513 = arith.divf %512, %489 : f64
%514 = arith.constant 0 : i32
%515 = arith.extsi %514 : i32 to i64
%516 = llvm.getelementptr %arg6[%515] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %513, %516 : f64, !llvm.ptr
%517 = arith.subf %arg4, %arg2 : f64
%518 = arith.mulf %498, %517 : f64
%519 = arith.subf %arg0, %arg4 : f64
%520 = arith.mulf %501, %519 : f64
%521 = arith.addf %518, %520 : f64
%522 = arith.subf %arg2, %arg0 : f64
%523 = arith.mulf %504, %522 : f64
%524 = arith.addf %521, %523 : f64
%525 = arith.divf %524, %489 : f64
%526 = arith.constant 0 : i32
%527 = arith.extsi %526 : i32 to i64
%528 = llvm.getelementptr %arg7[%527] : (!llvm.ptr, i64) -> !llvm.ptr, f64
llvm.store %525, %528 : f64, !llvm.ptr
%529 = arith.constant 1 : i32
func.return %529 : i32
}
func.func @fmin_val(%arg0: f64, %arg1: f64) -> f64 {
%530 = arith.cmpf olt, %arg0, %arg1 : f64
cf.cond_br %530, ^bb60, ^bb61
^bb60:
func.return %arg0 : f64
^bb61:
cf.br ^bb62
^bb62:
func.return %arg1 : f64
}
func.func @fmax_val(%arg0: f64, %arg1: f64) -> f64 {
%531 = arith.cmpf ogt, %arg0, %arg1 : f64
cf.cond_br %531, ^bb63, ^bb64
^bb63:
func.return %arg0 : f64
^bb64:
cf.br ^bb65
^bb65:
func.return %arg1 : f64
}
func.func @maximize_intersection(%arg0: i32, %arg1: i32, %arg2: i32) -> f64 {
%533 = arith.constant 0.0 : f32
%534 = llvm.mlir.constant(1 : i64) : i64
%535 = llvm.alloca %534 x !llvm.array<1 x f64> : (i64) -> !llvm.ptr
%536 = llvm.mlir.zero : !llvm.array<1 x f64>
llvm.store %536, %535 : !llvm.array<1 x f64>, !llvm.ptr
%537 = arith.extf %533 : f32 to f64
%538 = llvm.mlir.constant(0 : i64) : i64
%539 = llvm.getelementptr %535[0, %538] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
llvm.store %537, %539 : f64, !llvm.ptr
%541 = arith.constant 0.0 : f32
%542 = llvm.mlir.constant(1 : i64) : i64
%543 = llvm.alloca %542 x !llvm.array<1 x f64> : (i64) -> !llvm.ptr
%544 = llvm.mlir.zero : !llvm.array<1 x f64>
llvm.store %544, %543 : !llvm.array<1 x f64>, !llvm.ptr
%545 = arith.extf %541 : f32 to f64
%546 = llvm.mlir.constant(0 : i64) : i64
%547 = llvm.getelementptr %543[0, %546] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
llvm.store %545, %547 : f64, !llvm.ptr
%549 = arith.constant 0.0 : f32
%550 = llvm.mlir.constant(1 : i64) : i64
%551 = llvm.alloca %550 x !llvm.array<1 x f64> : (i64) -> !llvm.ptr
%552 = llvm.mlir.zero : !llvm.array<1 x f64>
llvm.store %552, %551 : !llvm.array<1 x f64>, !llvm.ptr
%553 = arith.extf %549 : f32 to f64
%554 = llvm.mlir.constant(0 : i64) : i64
%555 = llvm.getelementptr %551[0, %554] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
llvm.store %553, %555 : f64, !llvm.ptr
%557 = arith.constant 0.0 : f32
%558 = llvm.mlir.constant(1 : i64) : i64
%559 = llvm.alloca %558 x !llvm.array<1 x f64> : (i64) -> !llvm.ptr
%560 = llvm.mlir.zero : !llvm.array<1 x f64>
llvm.store %560, %559 : !llvm.array<1 x f64>, !llvm.ptr
%561 = arith.extf %557 : f32 to f64
%562 = llvm.mlir.constant(0 : i64) : i64
%563 = llvm.getelementptr %559[0, %562] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
llvm.store %561, %563 : f64, !llvm.ptr
%565 = arith.constant 0.0 : f32
%566 = llvm.mlir.constant(1 : i64) : i64
%567 = llvm.alloca %566 x !llvm.array<1 x f64> : (i64) -> !llvm.ptr
%568 = llvm.mlir.zero : !llvm.array<1 x f64>
llvm.store %568, %567 : !llvm.array<1 x f64>, !llvm.ptr
%569 = arith.extf %565 : f32 to f64
%570 = llvm.mlir.constant(0 : i64) : i64
%571 = llvm.getelementptr %567[0, %570] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
llvm.store %569, %571 : f64, !llvm.ptr
%573 = arith.constant 0.0 : f32
%574 = llvm.mlir.constant(1 : i64) : i64
%575 = llvm.alloca %574 x !llvm.array<1 x f64> : (i64) -> !llvm.ptr
%576 = llvm.mlir.zero : !llvm.array<1 x f64>
llvm.store %576, %575 : !llvm.array<1 x f64>, !llvm.ptr
%577 = arith.extf %573 : f32 to f64
%578 = llvm.mlir.constant(0 : i64) : i64
%579 = llvm.getelementptr %575[0, %578] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
llvm.store %577, %579 : f64, !llvm.ptr
%581 = arith.constant 0 : i32
%582 = arith.extsi %581 : i32 to i64
%583 = llvm.getelementptr %535[0, %582] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%584 = arith.constant 0 : i32
%585 = arith.extsi %584 : i32 to i64
%586 = llvm.getelementptr %543[0, %585] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%587 = arith.constant 0 : i32
%588 = arith.extsi %587 : i32 to i64
%589 = llvm.getelementptr %551[0, %588] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%590 = arith.constant 0 : i32
%591 = arith.extsi %590 : i32 to i64
%592 = llvm.getelementptr %559[0, %591] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%593 = arith.constant 0 : i32
%594 = arith.extsi %593 : i32 to i64
%595 = llvm.getelementptr %567[0, %594] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%596 = arith.constant 0 : i32
%597 = arith.extsi %596 : i32 to i64
%598 = llvm.getelementptr %575[0, %597] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
func.call @tri_coords(%arg0, %arg1, %arg2, %583, %586, %589, %592, %595, %598) : (i32, i32, i32, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
%600 = arith.constant 0 : i32
%601 = arith.extsi %600 : i32 to i64
%602 = llvm.getelementptr %535[0, %601] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%599 = llvm.load %602 : !llvm.ptr -> f64
%604 = arith.constant 0 : i32
%605 = arith.extsi %604 : i32 to i64
%606 = llvm.getelementptr %543[0, %605] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%603 = llvm.load %606 : !llvm.ptr -> f64
%608 = arith.constant 0 : i32
%609 = arith.extsi %608 : i32 to i64
%610 = llvm.getelementptr %551[0, %609] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%607 = llvm.load %610 : !llvm.ptr -> f64
%612 = arith.constant 0 : i32
%613 = arith.extsi %612 : i32 to i64
%614 = llvm.getelementptr %559[0, %613] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%611 = llvm.load %614 : !llvm.ptr -> f64
%616 = arith.constant 0 : i32
%617 = arith.extsi %616 : i32 to i64
%618 = llvm.getelementptr %567[0, %617] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%615 = llvm.load %618 : !llvm.ptr -> f64
%620 = arith.constant 0 : i32
%621 = arith.extsi %620 : i32 to i64
%622 = llvm.getelementptr %575[0, %621] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<1 x f64>
%619 = llvm.load %622 : !llvm.ptr -> f64
%623 = func.call @tri_area(%599, %603, %607, %611, %615, %619) : (f64, f64, f64, f64, f64, f64) -> f64
%624 = arith.constant 0.0 : f32
%626 = arith.extf %624 : f32 to f64
%625 = arith.cmpf ole, %623, %626 : f64
cf.cond_br %625, ^bb66, ^bb67
^bb66:
%627 = arith.constant 0.0 : f32
%628 = arith.extf %627 : f32 to f64
func.return %628 : f64
^bb67:
cf.br ^bb68
^bb68:
%629 = llvm.mlir.addressof @g_pi : !llvm.ptr
%630 = llvm.load %629 : !llvm.ptr -> f64
%631 = arith.divf %623, %630 : f64
%632 = math.sqrt %631 : f64
%634 = func.call @fmin_val(%607, %615) : (f64, f64) -> f64
%633 = func.call @fmin_val(%599, %634) : (f64, f64) -> f64
%635 = arith.subf %633, %632 : f64
%637 = func.call @fmax_val(%607, %615) : (f64, f64) -> f64
%636 = func.call @fmax_val(%599, %637) : (f64, f64) -> f64
%638 = arith.addf %636, %632 : f64
%640 = func.call @fmin_val(%611, %619) : (f64, f64) -> f64
%639 = func.call @fmin_val(%603, %640) : (f64, f64) -> f64
%641 = arith.subf %639, %632 : f64
%643 = func.call @fmax_val(%611, %619) : (f64, f64) -> f64
%642 = func.call @fmax_val(%603, %643) : (f64, f64) -> f64
%644 = arith.addf %642, %632 : f64
%645 = arith.addf %599, %607 : f64
%646 = arith.addf %645, %615 : f64
%647 = arith.constant 3.0 : f32
%649 = arith.extf %647 : f32 to f64
%648 = arith.divf %646, %649 : f64
%650 = arith.addf %603, %611 : f64
%651 = arith.addf %650, %619 : f64
%652 = arith.constant 3.0 : f32
%654 = arith.extf %652 : f32 to f64
%653 = arith.divf %651, %654 : f64
%655 = arith.addi %arg0, %arg1 : i32
%656 = arith.addi %655, %arg2 : i32
%657 = arith.sitofp %arg0 : i32 to f64
%658 = arith.mulf %657, %599 : f64
%659 = arith.sitofp %arg1 : i32 to f64
%660 = arith.mulf %659, %607 : f64
%661 = arith.addf %658, %660 : f64
%662 = arith.sitofp %arg2 : i32 to f64
%663 = arith.mulf %662, %615 : f64
%664 = arith.addf %661, %663 : f64
%665 = arith.sitofp %656 : i32 to f64
%666 = arith.divf %664, %665 : f64
%667 = arith.sitofp %arg0 : i32 to f64
%668 = arith.mulf %667, %603 : f64
%669 = arith.sitofp %arg1 : i32 to f64
%670 = arith.mulf %669, %611 : f64
%671 = arith.addf %668, %670 : f64
%672 = arith.sitofp %arg2 : i32 to f64
%673 = arith.mulf %672, %619 : f64
%674 = arith.addf %671, %673 : f64
%675 = arith.sitofp %656 : i32 to f64
%676 = arith.divf %674, %675 : f64
%678 = arith.constant 0.0 : f32
%679 = arith.constant 0.0 : f32
%680 = llvm.mlir.constant(1 : i64) : i64
%681 = llvm.alloca %680 x !llvm.array<2 x f64> : (i64) -> !llvm.ptr
%682 = llvm.mlir.zero : !llvm.array<2 x f64>
llvm.store %682, %681 : !llvm.array<2 x f64>, !llvm.ptr
%683 = arith.extf %678 : f32 to f64
%684 = arith.extf %679 : f32 to f64
%685 = llvm.mlir.constant(0 : i64) : i64
%686 = llvm.getelementptr %681[0, %685] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %683, %686 : f64, !llvm.ptr
%687 = llvm.mlir.constant(1 : i64) : i64
%688 = llvm.getelementptr %681[0, %687] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
llvm.store %684, %688 : f64, !llvm.ptr
%690 = arith.constant 0 : i32
%691 = arith.extsi %690 : i32 to i64
%692 = llvm.getelementptr %681[0, %691] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%693 = arith.constant 1 : i32
%694 = arith.extsi %693 : i32 to i64
%695 = llvm.getelementptr %681[0, %694] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%689 = func.call @circumcenter(%599, %603, %607, %611, %615, %619, %692, %695) : (f64, f64, f64, f64, f64, f64, !llvm.ptr, !llvm.ptr) -> i32
%697 = arith.constant 0 : i32
%698 = arith.extsi %697 : i32 to i64
%699 = llvm.getelementptr %681[0, %698] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%696 = llvm.load %699 : !llvm.ptr -> f64
%701 = arith.constant 1 : i32
%702 = arith.extsi %701 : i32 to i64
%703 = llvm.getelementptr %681[0, %702] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x f64>
%700 = llvm.load %703 : !llvm.ptr -> f64
%705 = arith.constant 0.0 : f32
%706 = arith.constant 0.0 : f32
%707 = arith.constant 0.0 : f32
%708 = arith.constant 0.0 : f32
%709 = arith.constant 0.0 : f32
%710 = arith.constant 0.0 : f32
%711 = arith.constant 0.0 : f32
%712 = arith.constant 0.0 : f32
%713 = arith.constant 0.0 : f32
%714 = arith.constant 0.0 : f32
%715 = arith.constant 0.0 : f32
%716 = arith.constant 0.0 : f32
%717 = arith.constant 0.0 : f32
%718 = arith.constant 0.0 : f32
%719 = arith.constant 0.0 : f32
%720 = arith.constant 0.0 : f32
%721 = arith.constant 0.0 : f32
%722 = arith.constant 0.0 : f32
%723 = arith.constant 0.0 : f32
%724 = arith.constant 0.0 : f32
%725 = arith.constant 0.0 : f32
%726 = arith.constant 0.0 : f32
%727 = arith.constant 0.0 : f32
%728 = arith.constant 0.0 : f32
%729 = arith.constant 0.0 : f32
%730 = arith.constant 0.0 : f32
%731 = arith.constant 0.0 : f32
%732 = arith.constant 0.0 : f32
%733 = arith.constant 0.0 : f32
%734 = arith.constant 0.0 : f32
%735 = arith.constant 0.0 : f32
%736 = arith.constant 0.0 : f32
%737 = llvm.mlir.constant(1 : i64) : i64
%738 = llvm.alloca %737 x !llvm.array<32 x f64> : (i64) -> !llvm.ptr
%739 = llvm.mlir.zero : !llvm.array<32 x f64>
llvm.store %739, %738 : !llvm.array<32 x f64>, !llvm.ptr
%740 = arith.extf %705 : f32 to f64
%741 = arith.extf %706 : f32 to f64
%742 = arith.extf %707 : f32 to f64
%743 = arith.extf %708 : f32 to f64
%744 = arith.extf %709 : f32 to f64
%745 = arith.extf %710 : f32 to f64
%746 = arith.extf %711 : f32 to f64
%747 = arith.extf %712 : f32 to f64
%748 = arith.extf %713 : f32 to f64
%749 = arith.extf %714 : f32 to f64
%750 = arith.extf %715 : f32 to f64
%751 = arith.extf %716 : f32 to f64
%752 = arith.extf %717 : f32 to f64
%753 = arith.extf %718 : f32 to f64
%754 = arith.extf %719 : f32 to f64
%755 = arith.extf %720 : f32 to f64
%756 = arith.extf %721 : f32 to f64
%757 = arith.extf %722 : f32 to f64
%758 = arith.extf %723 : f32 to f64
%759 = arith.extf %724 : f32 to f64
%760 = arith.extf %725 : f32 to f64
%761 = arith.extf %726 : f32 to f64
%762 = arith.extf %727 : f32 to f64
%763 = arith.extf %728 : f32 to f64
%764 = arith.extf %729 : f32 to f64
%765 = arith.extf %730 : f32 to f64
%766 = arith.extf %731 : f32 to f64
%767 = arith.extf %732 : f32 to f64
%768 = arith.extf %733 : f32 to f64
%769 = arith.extf %734 : f32 to f64
%770 = arith.extf %735 : f32 to f64
%771 = arith.extf %736 : f32 to f64
%772 = llvm.mlir.constant(0 : i64) : i64
%773 = llvm.getelementptr %738[0, %772] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %740, %773 : f64, !llvm.ptr
%774 = llvm.mlir.constant(1 : i64) : i64
%775 = llvm.getelementptr %738[0, %774] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %741, %775 : f64, !llvm.ptr
%776 = llvm.mlir.constant(2 : i64) : i64
%777 = llvm.getelementptr %738[0, %776] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %742, %777 : f64, !llvm.ptr
%778 = llvm.mlir.constant(3 : i64) : i64
%779 = llvm.getelementptr %738[0, %778] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %743, %779 : f64, !llvm.ptr
%780 = llvm.mlir.constant(4 : i64) : i64
%781 = llvm.getelementptr %738[0, %780] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %744, %781 : f64, !llvm.ptr
%782 = llvm.mlir.constant(5 : i64) : i64
%783 = llvm.getelementptr %738[0, %782] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %745, %783 : f64, !llvm.ptr
%784 = llvm.mlir.constant(6 : i64) : i64
%785 = llvm.getelementptr %738[0, %784] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %746, %785 : f64, !llvm.ptr
%786 = llvm.mlir.constant(7 : i64) : i64
%787 = llvm.getelementptr %738[0, %786] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %747, %787 : f64, !llvm.ptr
%788 = llvm.mlir.constant(8 : i64) : i64
%789 = llvm.getelementptr %738[0, %788] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %748, %789 : f64, !llvm.ptr
%790 = llvm.mlir.constant(9 : i64) : i64
%791 = llvm.getelementptr %738[0, %790] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %749, %791 : f64, !llvm.ptr
%792 = llvm.mlir.constant(10 : i64) : i64
%793 = llvm.getelementptr %738[0, %792] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %750, %793 : f64, !llvm.ptr
%794 = llvm.mlir.constant(11 : i64) : i64
%795 = llvm.getelementptr %738[0, %794] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %751, %795 : f64, !llvm.ptr
%796 = llvm.mlir.constant(12 : i64) : i64
%797 = llvm.getelementptr %738[0, %796] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %752, %797 : f64, !llvm.ptr
%798 = llvm.mlir.constant(13 : i64) : i64
%799 = llvm.getelementptr %738[0, %798] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %753, %799 : f64, !llvm.ptr
%800 = llvm.mlir.constant(14 : i64) : i64
%801 = llvm.getelementptr %738[0, %800] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %754, %801 : f64, !llvm.ptr
%802 = llvm.mlir.constant(15 : i64) : i64
%803 = llvm.getelementptr %738[0, %802] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %755, %803 : f64, !llvm.ptr
%804 = llvm.mlir.constant(16 : i64) : i64
%805 = llvm.getelementptr %738[0, %804] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %756, %805 : f64, !llvm.ptr
%806 = llvm.mlir.constant(17 : i64) : i64
%807 = llvm.getelementptr %738[0, %806] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %757, %807 : f64, !llvm.ptr
%808 = llvm.mlir.constant(18 : i64) : i64
%809 = llvm.getelementptr %738[0, %808] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %758, %809 : f64, !llvm.ptr
%810 = llvm.mlir.constant(19 : i64) : i64
%811 = llvm.getelementptr %738[0, %810] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %759, %811 : f64, !llvm.ptr
%812 = llvm.mlir.constant(20 : i64) : i64
%813 = llvm.getelementptr %738[0, %812] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %760, %813 : f64, !llvm.ptr
%814 = llvm.mlir.constant(21 : i64) : i64
%815 = llvm.getelementptr %738[0, %814] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %761, %815 : f64, !llvm.ptr
%816 = llvm.mlir.constant(22 : i64) : i64
%817 = llvm.getelementptr %738[0, %816] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %762, %817 : f64, !llvm.ptr
%818 = llvm.mlir.constant(23 : i64) : i64
%819 = llvm.getelementptr %738[0, %818] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %763, %819 : f64, !llvm.ptr
%820 = llvm.mlir.constant(24 : i64) : i64
%821 = llvm.getelementptr %738[0, %820] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %764, %821 : f64, !llvm.ptr
%822 = llvm.mlir.constant(25 : i64) : i64
%823 = llvm.getelementptr %738[0, %822] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %765, %823 : f64, !llvm.ptr
%824 = llvm.mlir.constant(26 : i64) : i64
%825 = llvm.getelementptr %738[0, %824] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %766, %825 : f64, !llvm.ptr
%826 = llvm.mlir.constant(27 : i64) : i64
%827 = llvm.getelementptr %738[0, %826] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %767, %827 : f64, !llvm.ptr
%828 = llvm.mlir.constant(28 : i64) : i64
%829 = llvm.getelementptr %738[0, %828] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %768, %829 : f64, !llvm.ptr
%830 = llvm.mlir.constant(29 : i64) : i64
%831 = llvm.getelementptr %738[0, %830] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %769, %831 : f64, !llvm.ptr
%832 = llvm.mlir.constant(30 : i64) : i64
%833 = llvm.getelementptr %738[0, %832] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %770, %833 : f64, !llvm.ptr
%834 = llvm.mlir.constant(31 : i64) : i64
%835 = llvm.getelementptr %738[0, %834] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %771, %835 : f64, !llvm.ptr
%836 = arith.constant 0 : i32
%837 = llvm.mlir.constant(1 : i64) : i64
%838 = llvm.alloca %837 x i32 : (i64) -> !llvm.ptr
llvm.store %836, %838 : i32, !llvm.ptr
%839 = llvm.load %838 : !llvm.ptr -> i32
%840 = arith.constant 2 : i32
%841 = arith.muli %839, %840 : i32
%842 = arith.constant 0 : i32
%843 = arith.addi %841, %842 : i32
%844 = arith.extsi %843 : i32 to i64
%845 = llvm.getelementptr %738[0, %844] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %648, %845 : f64, !llvm.ptr
%846 = llvm.load %838 : !llvm.ptr -> i32
%847 = arith.constant 2 : i32
%848 = arith.muli %846, %847 : i32
%849 = arith.constant 1 : i32
%850 = arith.addi %848, %849 : i32
%851 = arith.extsi %850 : i32 to i64
%852 = llvm.getelementptr %738[0, %851] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %653, %852 : f64, !llvm.ptr
%853 = llvm.load %838 : !llvm.ptr -> i32
%854 = arith.constant 1 : i32
%855 = arith.addi %853, %854 : i32
llvm.store %855, %838 : i32, !llvm.ptr
%856 = llvm.load %838 : !llvm.ptr -> i32
%857 = arith.constant 2 : i32
%858 = arith.muli %856, %857 : i32
%859 = arith.constant 0 : i32
%860 = arith.addi %858, %859 : i32
%861 = arith.extsi %860 : i32 to i64
%862 = llvm.getelementptr %738[0, %861] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %666, %862 : f64, !llvm.ptr
%863 = llvm.load %838 : !llvm.ptr -> i32
%864 = arith.constant 2 : i32
%865 = arith.muli %863, %864 : i32
%866 = arith.constant 1 : i32
%867 = arith.addi %865, %866 : i32
%868 = arith.extsi %867 : i32 to i64
%869 = llvm.getelementptr %738[0, %868] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %676, %869 : f64, !llvm.ptr
%870 = llvm.load %838 : !llvm.ptr -> i32
%871 = arith.constant 1 : i32
%872 = arith.addi %870, %871 : i32
llvm.store %872, %838 : i32, !llvm.ptr
%873 = llvm.load %838 : !llvm.ptr -> i32
%874 = arith.constant 2 : i32
%875 = arith.muli %873, %874 : i32
%876 = arith.constant 0 : i32
%877 = arith.addi %875, %876 : i32
%878 = arith.extsi %877 : i32 to i64
%879 = llvm.getelementptr %738[0, %878] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %599, %879 : f64, !llvm.ptr
%880 = llvm.load %838 : !llvm.ptr -> i32
%881 = arith.constant 2 : i32
%882 = arith.muli %880, %881 : i32
%883 = arith.constant 1 : i32
%884 = arith.addi %882, %883 : i32
%885 = arith.extsi %884 : i32 to i64
%886 = llvm.getelementptr %738[0, %885] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %603, %886 : f64, !llvm.ptr
%887 = llvm.load %838 : !llvm.ptr -> i32
%888 = arith.constant 1 : i32
%889 = arith.addi %887, %888 : i32
llvm.store %889, %838 : i32, !llvm.ptr
%890 = llvm.load %838 : !llvm.ptr -> i32
%891 = arith.constant 2 : i32
%892 = arith.muli %890, %891 : i32
%893 = arith.constant 0 : i32
%894 = arith.addi %892, %893 : i32
%895 = arith.extsi %894 : i32 to i64
%896 = llvm.getelementptr %738[0, %895] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %607, %896 : f64, !llvm.ptr
%897 = llvm.load %838 : !llvm.ptr -> i32
%898 = arith.constant 2 : i32
%899 = arith.muli %897, %898 : i32
%900 = arith.constant 1 : i32
%901 = arith.addi %899, %900 : i32
%902 = arith.extsi %901 : i32 to i64
%903 = llvm.getelementptr %738[0, %902] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %611, %903 : f64, !llvm.ptr
%904 = llvm.load %838 : !llvm.ptr -> i32
%905 = arith.constant 1 : i32
%906 = arith.addi %904, %905 : i32
llvm.store %906, %838 : i32, !llvm.ptr
%907 = llvm.load %838 : !llvm.ptr -> i32
%908 = arith.constant 2 : i32
%909 = arith.muli %907, %908 : i32
%910 = arith.constant 0 : i32
%911 = arith.addi %909, %910 : i32
%912 = arith.extsi %911 : i32 to i64
%913 = llvm.getelementptr %738[0, %912] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %615, %913 : f64, !llvm.ptr
%914 = llvm.load %838 : !llvm.ptr -> i32
%915 = arith.constant 2 : i32
%916 = arith.muli %914, %915 : i32
%917 = arith.constant 1 : i32
%918 = arith.addi %916, %917 : i32
%919 = arith.extsi %918 : i32 to i64
%920 = llvm.getelementptr %738[0, %919] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %619, %920 : f64, !llvm.ptr
%921 = llvm.load %838 : !llvm.ptr -> i32
%922 = arith.constant 1 : i32
%923 = arith.addi %921, %922 : i32
llvm.store %923, %838 : i32, !llvm.ptr
%924 = arith.addf %599, %607 : f64
%925 = arith.constant 0.5 : f32
%927 = arith.extf %925 : f32 to f64
%926 = arith.mulf %924, %927 : f64
%928 = llvm.load %838 : !llvm.ptr -> i32
%929 = arith.constant 2 : i32
%930 = arith.muli %928, %929 : i32
%931 = arith.constant 0 : i32
%932 = arith.addi %930, %931 : i32
%933 = arith.extsi %932 : i32 to i64
%934 = llvm.getelementptr %738[0, %933] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %926, %934 : f64, !llvm.ptr
%935 = arith.addf %603, %611 : f64
%936 = arith.constant 0.5 : f32
%938 = arith.extf %936 : f32 to f64
%937 = arith.mulf %935, %938 : f64
%939 = llvm.load %838 : !llvm.ptr -> i32
%940 = arith.constant 2 : i32
%941 = arith.muli %939, %940 : i32
%942 = arith.constant 1 : i32
%943 = arith.addi %941, %942 : i32
%944 = arith.extsi %943 : i32 to i64
%945 = llvm.getelementptr %738[0, %944] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %937, %945 : f64, !llvm.ptr
%946 = llvm.load %838 : !llvm.ptr -> i32
%947 = arith.constant 1 : i32
%948 = arith.addi %946, %947 : i32
llvm.store %948, %838 : i32, !llvm.ptr
%949 = arith.addf %607, %615 : f64
%950 = arith.constant 0.5 : f32
%952 = arith.extf %950 : f32 to f64
%951 = arith.mulf %949, %952 : f64
%953 = llvm.load %838 : !llvm.ptr -> i32
%954 = arith.constant 2 : i32
%955 = arith.muli %953, %954 : i32
%956 = arith.constant 0 : i32
%957 = arith.addi %955, %956 : i32
%958 = arith.extsi %957 : i32 to i64
%959 = llvm.getelementptr %738[0, %958] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %951, %959 : f64, !llvm.ptr
%960 = arith.addf %611, %619 : f64
%961 = arith.constant 0.5 : f32
%963 = arith.extf %961 : f32 to f64
%962 = arith.mulf %960, %963 : f64
%964 = llvm.load %838 : !llvm.ptr -> i32
%965 = arith.constant 2 : i32
%966 = arith.muli %964, %965 : i32
%967 = arith.constant 1 : i32
%968 = arith.addi %966, %967 : i32
%969 = arith.extsi %968 : i32 to i64
%970 = llvm.getelementptr %738[0, %969] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %962, %970 : f64, !llvm.ptr
%971 = llvm.load %838 : !llvm.ptr -> i32
%972 = arith.constant 1 : i32
%973 = arith.addi %971, %972 : i32
llvm.store %973, %838 : i32, !llvm.ptr
%974 = arith.addf %615, %599 : f64
%975 = arith.constant 0.5 : f32
%977 = arith.extf %975 : f32 to f64
%976 = arith.mulf %974, %977 : f64
%978 = llvm.load %838 : !llvm.ptr -> i32
%979 = arith.constant 2 : i32
%980 = arith.muli %978, %979 : i32
%981 = arith.constant 0 : i32
%982 = arith.addi %980, %981 : i32
%983 = arith.extsi %982 : i32 to i64
%984 = llvm.getelementptr %738[0, %983] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %976, %984 : f64, !llvm.ptr
%985 = arith.addf %619, %603 : f64
%986 = arith.constant 0.5 : f32
%988 = arith.extf %986 : f32 to f64
%987 = arith.mulf %985, %988 : f64
%989 = llvm.load %838 : !llvm.ptr -> i32
%990 = arith.constant 2 : i32
%991 = arith.muli %989, %990 : i32
%992 = arith.constant 1 : i32
%993 = arith.addi %991, %992 : i32
%994 = arith.extsi %993 : i32 to i64
%995 = llvm.getelementptr %738[0, %994] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %987, %995 : f64, !llvm.ptr
%996 = llvm.load %838 : !llvm.ptr -> i32
%997 = arith.constant 1 : i32
%998 = arith.addi %996, %997 : i32
llvm.store %998, %838 : i32, !llvm.ptr
%999 = arith.constant 0 : i32
%1000 = arith.cmpi ne, %689, %999 : i32
cf.cond_br %1000, ^bb69, ^bb70
^bb69:
%1001 = llvm.load %838 : !llvm.ptr -> i32
%1002 = arith.constant 2 : i32
%1003 = arith.muli %1001, %1002 : i32
%1004 = arith.constant 0 : i32
%1005 = arith.addi %1003, %1004 : i32
%1006 = arith.extsi %1005 : i32 to i64
%1007 = llvm.getelementptr %738[0, %1006] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %696, %1007 : f64, !llvm.ptr
%1008 = llvm.load %838 : !llvm.ptr -> i32
%1009 = arith.constant 2 : i32
%1010 = arith.muli %1008, %1009 : i32
%1011 = arith.constant 1 : i32
%1012 = arith.addi %1010, %1011 : i32
%1013 = arith.extsi %1012 : i32 to i64
%1014 = llvm.getelementptr %738[0, %1013] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
llvm.store %700, %1014 : f64, !llvm.ptr
%1015 = llvm.load %838 : !llvm.ptr -> i32
%1016 = arith.constant 1 : i32
%1017 = arith.addi %1015, %1016 : i32
llvm.store %1017, %838 : i32, !llvm.ptr
cf.br ^bb71
^bb70:
cf.br ^bb71
^bb71:
%1018 = llvm.mlir.constant(1 : i64) : i64
%1019 = llvm.alloca %1018 x f64 : (i64) -> !llvm.ptr
llvm.store %648, %1019 : f64, !llvm.ptr
%1020 = llvm.mlir.constant(1 : i64) : i64
%1021 = llvm.alloca %1020 x f64 : (i64) -> !llvm.ptr
llvm.store %653, %1021 : f64, !llvm.ptr
%1022 = llvm.load %1019 : !llvm.ptr -> f64
%1023 = arith.cmpf olt, %1022, %635 : f64
cf.cond_br %1023, ^bb72, ^bb73
^bb72:
llvm.store %635, %1019 : f64, !llvm.ptr
cf.br ^bb74
^bb73:
cf.br ^bb74
^bb74:
%1024 = llvm.load %1019 : !llvm.ptr -> f64
%1025 = arith.cmpf ogt, %1024, %638 : f64
cf.cond_br %1025, ^bb75, ^bb76
^bb75:
llvm.store %638, %1019 : f64, !llvm.ptr
cf.br ^bb77
^bb76:
cf.br ^bb77
^bb77:
%1026 = llvm.load %1021 : !llvm.ptr -> f64
%1027 = arith.cmpf olt, %1026, %641 : f64
cf.cond_br %1027, ^bb78, ^bb79
^bb78:
llvm.store %641, %1021 : f64, !llvm.ptr
cf.br ^bb80
^bb79:
cf.br ^bb80
^bb80:
%1028 = llvm.load %1021 : !llvm.ptr -> f64
%1029 = arith.cmpf ogt, %1028, %644 : f64
cf.cond_br %1029, ^bb81, ^bb82
^bb81:
llvm.store %644, %1021 : f64, !llvm.ptr
cf.br ^bb83
^bb82:
cf.br ^bb83
^bb83:
%1031 = llvm.load %1019 : !llvm.ptr -> f64
%1032 = llvm.load %1021 : !llvm.ptr -> f64
%1030 = func.call @tri_circle_area(%599, %603, %607, %611, %615, %619, %1031, %1032, %632) : (f64, f64, f64, f64, f64, f64, f64, f64, f64) -> f64
%1033 = llvm.mlir.constant(1 : i64) : i64
%1034 = llvm.alloca %1033 x f64 : (i64) -> !llvm.ptr
llvm.store %1030, %1034 : f64, !llvm.ptr
%1035 = llvm.load %1034 : !llvm.ptr -> f64
%1036 = arith.constant 0.0 : f32
%1038 = arith.extf %1036 : f32 to f64
%1037 = arith.cmpf olt, %1035, %1038 : f64
cf.cond_br %1037, ^bb84, ^bb85
^bb84:
%1039 = arith.constant 0.0 : f32
%1040 = arith.extf %1039 : f32 to f64
llvm.store %1040, %1034 : f64, !llvm.ptr
cf.br ^bb86
^bb85:
cf.br ^bb86
^bb86:
%1041 = llvm.load %1034 : !llvm.ptr -> f64
%1042 = arith.cmpf ogt, %1041, %623 : f64
cf.cond_br %1042, ^bb87, ^bb88
^bb87:
llvm.store %623, %1034 : f64, !llvm.ptr
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
%1043 = arith.constant 0 : i32
%1044 = llvm.mlir.constant(1 : i64) : i64
%1045 = llvm.alloca %1044 x i32 : (i64) -> !llvm.ptr
llvm.store %1043, %1045 : i32, !llvm.ptr
cf.br ^bb90
^bb90:
%1046 = llvm.load %1045 : !llvm.ptr -> i32
%1047 = llvm.load %838 : !llvm.ptr -> i32
%1048 = arith.cmpi slt, %1046, %1047 : i32
cf.cond_br %1048, ^bb91, ^bb92
^bb91:
%1050 = llvm.load %1045 : !llvm.ptr -> i32
%1051 = arith.constant 2 : i32
%1052 = arith.muli %1050, %1051 : i32
%1053 = arith.constant 0 : i32
%1054 = arith.addi %1052, %1053 : i32
%1055 = arith.extsi %1054 : i32 to i64
%1056 = llvm.getelementptr %738[0, %1055] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
%1049 = llvm.load %1056 : !llvm.ptr -> f64
%1057 = llvm.mlir.constant(1 : i64) : i64
%1058 = llvm.alloca %1057 x f64 : (i64) -> !llvm.ptr
llvm.store %1049, %1058 : f64, !llvm.ptr
%1060 = llvm.load %1045 : !llvm.ptr -> i32
%1061 = arith.constant 2 : i32
%1062 = arith.muli %1060, %1061 : i32
%1063 = arith.constant 1 : i32
%1064 = arith.addi %1062, %1063 : i32
%1065 = arith.extsi %1064 : i32 to i64
%1066 = llvm.getelementptr %738[0, %1065] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x f64>
%1059 = llvm.load %1066 : !llvm.ptr -> f64
%1067 = llvm.mlir.constant(1 : i64) : i64
%1068 = llvm.alloca %1067 x f64 : (i64) -> !llvm.ptr
llvm.store %1059, %1068 : f64, !llvm.ptr
%1069 = llvm.load %1058 : !llvm.ptr -> f64
%1070 = arith.cmpf olt, %1069, %635 : f64
cf.cond_br %1070, ^bb93, ^bb94
^bb93:
llvm.store %635, %1058 : f64, !llvm.ptr
cf.br ^bb95
^bb94:
cf.br ^bb95
^bb95:
%1071 = llvm.load %1058 : !llvm.ptr -> f64
%1072 = arith.cmpf ogt, %1071, %638 : f64
cf.cond_br %1072, ^bb96, ^bb97
^bb96:
llvm.store %638, %1058 : f64, !llvm.ptr
cf.br ^bb98
^bb97:
cf.br ^bb98
^bb98:
%1073 = llvm.load %1068 : !llvm.ptr -> f64
%1074 = arith.cmpf olt, %1073, %641 : f64
cf.cond_br %1074, ^bb99, ^bb100
^bb99:
llvm.store %641, %1068 : f64, !llvm.ptr
cf.br ^bb101
^bb100:
cf.br ^bb101
^bb101:
%1075 = llvm.load %1068 : !llvm.ptr -> f64
%1076 = arith.cmpf ogt, %1075, %644 : f64
cf.cond_br %1076, ^bb102, ^bb103
^bb102:
llvm.store %644, %1068 : f64, !llvm.ptr
cf.br ^bb104
^bb103:
cf.br ^bb104
^bb104:
%1078 = llvm.load %1058 : !llvm.ptr -> f64
%1079 = llvm.load %1068 : !llvm.ptr -> f64
%1077 = func.call @tri_circle_area(%599, %603, %607, %611, %615, %619, %1078, %1079, %632) : (f64, f64, f64, f64, f64, f64, f64, f64, f64) -> f64
%1080 = llvm.mlir.constant(1 : i64) : i64
%1081 = llvm.alloca %1080 x f64 : (i64) -> !llvm.ptr
llvm.store %1077, %1081 : f64, !llvm.ptr
%1082 = llvm.load %1081 : !llvm.ptr -> f64
%1083 = arith.constant 0.0 : f32
%1085 = arith.extf %1083 : f32 to f64
%1084 = arith.cmpf olt, %1082, %1085 : f64
cf.cond_br %1084, ^bb105, ^bb106
^bb105:
%1086 = arith.constant 0.0 : f32
%1087 = arith.extf %1086 : f32 to f64
llvm.store %1087, %1081 : f64, !llvm.ptr
cf.br ^bb107
^bb106:
cf.br ^bb107
^bb107:
%1088 = llvm.load %1081 : !llvm.ptr -> f64
%1089 = arith.cmpf ogt, %1088, %623 : f64
cf.cond_br %1089, ^bb108, ^bb109
^bb108:
llvm.store %623, %1081 : f64, !llvm.ptr
cf.br ^bb110
^bb109:
cf.br ^bb110
^bb110:
%1090 = llvm.load %1081 : !llvm.ptr -> f64
%1091 = llvm.load %1034 : !llvm.ptr -> f64
%1092 = arith.cmpf ogt, %1090, %1091 : f64
cf.cond_br %1092, ^bb111, ^bb112
^bb111:
%1093 = llvm.load %1081 : !llvm.ptr -> f64
llvm.store %1093, %1034 : f64, !llvm.ptr
%1094 = llvm.load %1058 : !llvm.ptr -> f64
llvm.store %1094, %1019 : f64, !llvm.ptr
%1095 = llvm.load %1068 : !llvm.ptr -> f64
llvm.store %1095, %1021 : f64, !llvm.ptr
cf.br ^bb113
^bb112:
cf.br ^bb113
^bb113:
%1096 = llvm.load %1045 : !llvm.ptr -> i32
%1097 = arith.constant 1 : i32
%1098 = arith.addi %1096, %1097 : i32
llvm.store %1098, %1045 : i32, !llvm.ptr
cf.br ^bb90
^bb92:
%1100 = arith.subf %638, %635 : f64
%1101 = arith.subf %644, %641 : f64
%1099 = func.call @fmax_val(%1100, %1101) : (f64, f64) -> f64
%1102 = func.call @fmax_val(%1099, %632) : (f64, f64) -> f64
%1103 = llvm.mlir.constant(1 : i64) : i64
%1104 = llvm.alloca %1103 x f64 : (i64) -> !llvm.ptr
llvm.store %1102, %1104 : f64, !llvm.ptr
%1106 = arith.constant 1.0 : f32
%1107 = arith.constant 0.0 : f32
%1108 = arith.constant 0.0 : f32
%1109 = arith.constant 1.0 : f32
%1110 = arith.subf %1108, %1109 : f32
%1111 = arith.constant 0.0 : f32
%1112 = arith.constant 0.0 : f32
%1113 = arith.constant 1.0 : f32
%1114 = arith.constant 0.0 : f32
%1115 = arith.constant 0.0 : f32
%1116 = arith.constant 1.0 : f32
%1117 = arith.subf %1115, %1116 : f32
%1118 = arith.constant 1.0 : f32
%1119 = arith.constant 1.0 : f32
%1120 = arith.constant 1.0 : f32
%1121 = arith.constant 0.0 : f32
%1122 = arith.constant 1.0 : f32
%1123 = arith.subf %1121, %1122 : f32
%1124 = arith.constant 0.0 : f32
%1125 = arith.constant 1.0 : f32
%1126 = arith.subf %1124, %1125 : f32
%1127 = arith.constant 1.0 : f32
%1128 = arith.constant 0.0 : f32
%1129 = arith.constant 1.0 : f32
%1130 = arith.subf %1128, %1129 : f32
%1131 = arith.constant 0.0 : f32
%1132 = arith.constant 1.0 : f32
%1133 = arith.subf %1131, %1132 : f32
%1134 = llvm.mlir.constant(1 : i64) : i64
%1135 = llvm.alloca %1134 x !llvm.array<16 x f64> : (i64) -> !llvm.ptr
%1136 = llvm.mlir.zero : !llvm.array<16 x f64>
llvm.store %1136, %1135 : !llvm.array<16 x f64>, !llvm.ptr
%1137 = arith.extf %1106 : f32 to f64
%1138 = arith.extf %1107 : f32 to f64
%1139 = arith.extf %1110 : f32 to f64
%1140 = arith.extf %1111 : f32 to f64
%1141 = arith.extf %1112 : f32 to f64
%1142 = arith.extf %1113 : f32 to f64
%1143 = arith.extf %1114 : f32 to f64
%1144 = arith.extf %1117 : f32 to f64
%1145 = arith.extf %1118 : f32 to f64
%1146 = arith.extf %1119 : f32 to f64
%1147 = arith.extf %1120 : f32 to f64
%1148 = arith.extf %1123 : f32 to f64
%1149 = arith.extf %1126 : f32 to f64
%1150 = arith.extf %1127 : f32 to f64
%1151 = arith.extf %1130 : f32 to f64
%1152 = arith.extf %1133 : f32 to f64
%1153 = llvm.mlir.constant(0 : i64) : i64
%1154 = llvm.getelementptr %1135[0, %1153] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1137, %1154 : f64, !llvm.ptr
%1155 = llvm.mlir.constant(1 : i64) : i64
%1156 = llvm.getelementptr %1135[0, %1155] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1138, %1156 : f64, !llvm.ptr
%1157 = llvm.mlir.constant(2 : i64) : i64
%1158 = llvm.getelementptr %1135[0, %1157] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1139, %1158 : f64, !llvm.ptr
%1159 = llvm.mlir.constant(3 : i64) : i64
%1160 = llvm.getelementptr %1135[0, %1159] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1140, %1160 : f64, !llvm.ptr
%1161 = llvm.mlir.constant(4 : i64) : i64
%1162 = llvm.getelementptr %1135[0, %1161] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1141, %1162 : f64, !llvm.ptr
%1163 = llvm.mlir.constant(5 : i64) : i64
%1164 = llvm.getelementptr %1135[0, %1163] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1142, %1164 : f64, !llvm.ptr
%1165 = llvm.mlir.constant(6 : i64) : i64
%1166 = llvm.getelementptr %1135[0, %1165] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1143, %1166 : f64, !llvm.ptr
%1167 = llvm.mlir.constant(7 : i64) : i64
%1168 = llvm.getelementptr %1135[0, %1167] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1144, %1168 : f64, !llvm.ptr
%1169 = llvm.mlir.constant(8 : i64) : i64
%1170 = llvm.getelementptr %1135[0, %1169] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1145, %1170 : f64, !llvm.ptr
%1171 = llvm.mlir.constant(9 : i64) : i64
%1172 = llvm.getelementptr %1135[0, %1171] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1146, %1172 : f64, !llvm.ptr
%1173 = llvm.mlir.constant(10 : i64) : i64
%1174 = llvm.getelementptr %1135[0, %1173] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1147, %1174 : f64, !llvm.ptr
%1175 = llvm.mlir.constant(11 : i64) : i64
%1176 = llvm.getelementptr %1135[0, %1175] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1148, %1176 : f64, !llvm.ptr
%1177 = llvm.mlir.constant(12 : i64) : i64
%1178 = llvm.getelementptr %1135[0, %1177] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1149, %1178 : f64, !llvm.ptr
%1179 = llvm.mlir.constant(13 : i64) : i64
%1180 = llvm.getelementptr %1135[0, %1179] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1150, %1180 : f64, !llvm.ptr
%1181 = llvm.mlir.constant(14 : i64) : i64
%1182 = llvm.getelementptr %1135[0, %1181] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1151, %1182 : f64, !llvm.ptr
%1183 = llvm.mlir.constant(15 : i64) : i64
%1184 = llvm.getelementptr %1135[0, %1183] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
llvm.store %1152, %1184 : f64, !llvm.ptr
%1186 = arith.constant 0.0000001 : f32
%1187 = arith.constant 0.0000001 : f32
%1189 = arith.constant 1.0 : f32
%1190 = arith.extf %1189 : f32 to f64
%1188 = func.call @fmax_val(%1190, %632) : (f64, f64) -> f64
%1192 = arith.extf %1187 : f32 to f64
%1191 = arith.mulf %1192, %1188 : f64
%1193 = arith.extf %1186 : f32 to f64
%1185 = func.call @fmax_val(%1193, %1191) : (f64, f64) -> f64
cf.br ^bb114
^bb114:
%1194 = llvm.load %1104 : !llvm.ptr -> f64
%1195 = arith.cmpf ogt, %1194, %1185 : f64
cf.cond_br %1195, ^bb115, ^bb116
^bb115:
%1196 = arith.constant 0 : i32
%1197 = llvm.mlir.constant(1 : i64) : i64
%1198 = llvm.alloca %1197 x i32 : (i64) -> !llvm.ptr
llvm.store %1196, %1198 : i32, !llvm.ptr
%1199 = arith.constant 1 : i1
%1200 = llvm.mlir.constant(1 : i64) : i64
%1201 = llvm.alloca %1200 x i1 : (i64) -> !llvm.ptr
llvm.store %1199, %1201 : i1, !llvm.ptr
cf.br ^bb117
^bb117:
%1202 = llvm.load %1201 : !llvm.ptr -> i1
cf.cond_br %1202, ^bb118, ^bb119
^bb118:
%1203 = arith.constant 0 : i32
%1204 = llvm.mlir.constant(1 : i64) : i64
%1205 = llvm.alloca %1204 x i32 : (i64) -> !llvm.ptr
llvm.store %1203, %1205 : i32, !llvm.ptr
%1206 = llvm.load %1019 : !llvm.ptr -> f64
%1207 = llvm.mlir.constant(1 : i64) : i64
%1208 = llvm.alloca %1207 x f64 : (i64) -> !llvm.ptr
llvm.store %1206, %1208 : f64, !llvm.ptr
%1209 = llvm.load %1021 : !llvm.ptr -> f64
%1210 = llvm.mlir.constant(1 : i64) : i64
%1211 = llvm.alloca %1210 x f64 : (i64) -> !llvm.ptr
llvm.store %1209, %1211 : f64, !llvm.ptr
%1212 = llvm.load %1034 : !llvm.ptr -> f64
%1213 = llvm.mlir.constant(1 : i64) : i64
%1214 = llvm.alloca %1213 x f64 : (i64) -> !llvm.ptr
llvm.store %1212, %1214 : f64, !llvm.ptr
%1215 = arith.constant 0 : i32
%1216 = llvm.mlir.constant(1 : i64) : i64
%1217 = llvm.alloca %1216 x i32 : (i64) -> !llvm.ptr
llvm.store %1215, %1217 : i32, !llvm.ptr
cf.br ^bb120
^bb120:
%1218 = llvm.load %1217 : !llvm.ptr -> i32
%1219 = arith.constant 8 : i32
%1220 = arith.cmpi slt, %1218, %1219 : i32
cf.cond_br %1220, ^bb121, ^bb122
^bb121:
%1221 = llvm.load %1019 : !llvm.ptr -> f64
%1223 = llvm.load %1217 : !llvm.ptr -> i32
%1224 = arith.constant 2 : i32
%1225 = arith.muli %1223, %1224 : i32
%1226 = arith.constant 0 : i32
%1227 = arith.addi %1225, %1226 : i32
%1228 = arith.extsi %1227 : i32 to i64
%1229 = llvm.getelementptr %1135[0, %1228] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
%1222 = llvm.load %1229 : !llvm.ptr -> f64
%1230 = llvm.load %1104 : !llvm.ptr -> f64
%1231 = arith.mulf %1222, %1230 : f64
%1232 = arith.addf %1221, %1231 : f64
%1233 = llvm.mlir.constant(1 : i64) : i64
%1234 = llvm.alloca %1233 x f64 : (i64) -> !llvm.ptr
llvm.store %1232, %1234 : f64, !llvm.ptr
%1235 = llvm.load %1021 : !llvm.ptr -> f64
%1237 = llvm.load %1217 : !llvm.ptr -> i32
%1238 = arith.constant 2 : i32
%1239 = arith.muli %1237, %1238 : i32
%1240 = arith.constant 1 : i32
%1241 = arith.addi %1239, %1240 : i32
%1242 = arith.extsi %1241 : i32 to i64
%1243 = llvm.getelementptr %1135[0, %1242] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<16 x f64>
%1236 = llvm.load %1243 : !llvm.ptr -> f64
%1244 = llvm.load %1104 : !llvm.ptr -> f64
%1245 = arith.mulf %1236, %1244 : f64
%1246 = arith.addf %1235, %1245 : f64
%1247 = llvm.mlir.constant(1 : i64) : i64
%1248 = llvm.alloca %1247 x f64 : (i64) -> !llvm.ptr
llvm.store %1246, %1248 : f64, !llvm.ptr
%1249 = llvm.load %1234 : !llvm.ptr -> f64
%1250 = arith.cmpf olt, %1249, %635 : f64
cf.cond_br %1250, ^bb123, ^bb124
^bb123:
llvm.store %635, %1234 : f64, !llvm.ptr
cf.br ^bb125
^bb124:
cf.br ^bb125
^bb125:
%1251 = llvm.load %1234 : !llvm.ptr -> f64
%1252 = arith.cmpf ogt, %1251, %638 : f64
cf.cond_br %1252, ^bb126, ^bb127
^bb126:
llvm.store %638, %1234 : f64, !llvm.ptr
cf.br ^bb128
^bb127:
cf.br ^bb128
^bb128:
%1253 = llvm.load %1248 : !llvm.ptr -> f64
%1254 = arith.cmpf olt, %1253, %641 : f64
cf.cond_br %1254, ^bb129, ^bb130
^bb129:
llvm.store %641, %1248 : f64, !llvm.ptr
cf.br ^bb131
^bb130:
cf.br ^bb131
^bb131:
%1255 = llvm.load %1248 : !llvm.ptr -> f64
%1256 = arith.cmpf ogt, %1255, %644 : f64
cf.cond_br %1256, ^bb132, ^bb133
^bb132:
llvm.store %644, %1248 : f64, !llvm.ptr
cf.br ^bb134
^bb133:
cf.br ^bb134
^bb134:
%1258 = llvm.load %1234 : !llvm.ptr -> f64
%1259 = llvm.load %1248 : !llvm.ptr -> f64
%1257 = func.call @tri_circle_area(%599, %603, %607, %611, %615, %619, %1258, %1259, %632) : (f64, f64, f64, f64, f64, f64, f64, f64, f64) -> f64
%1260 = llvm.mlir.constant(1 : i64) : i64
%1261 = llvm.alloca %1260 x f64 : (i64) -> !llvm.ptr
llvm.store %1257, %1261 : f64, !llvm.ptr
%1262 = llvm.load %1261 : !llvm.ptr -> f64
%1263 = arith.constant 0.0 : f32
%1265 = arith.extf %1263 : f32 to f64
%1264 = arith.cmpf olt, %1262, %1265 : f64
cf.cond_br %1264, ^bb135, ^bb136
^bb135:
%1266 = arith.constant 0.0 : f32
%1267 = arith.extf %1266 : f32 to f64
llvm.store %1267, %1261 : f64, !llvm.ptr
cf.br ^bb137
^bb136:
cf.br ^bb137
^bb137:
%1268 = llvm.load %1261 : !llvm.ptr -> f64
%1269 = arith.cmpf ogt, %1268, %623 : f64
cf.cond_br %1269, ^bb138, ^bb139
^bb138:
llvm.store %623, %1261 : f64, !llvm.ptr
cf.br ^bb140
^bb139:
cf.br ^bb140
^bb140:
%1270 = llvm.load %1261 : !llvm.ptr -> f64
%1271 = llvm.load %1214 : !llvm.ptr -> f64
%1272 = arith.constant 0 : f32
%1274 = arith.extf %1272 : f32 to f64
%1273 = arith.addf %1271, %1274 : f64
%1275 = arith.cmpf ogt, %1270, %1273 : f64
cf.cond_br %1275, ^bb141, ^bb142
^bb141:
%1276 = llvm.load %1261 : !llvm.ptr -> f64
llvm.store %1276, %1214 : f64, !llvm.ptr
%1277 = llvm.load %1234 : !llvm.ptr -> f64
llvm.store %1277, %1208 : f64, !llvm.ptr
%1278 = llvm.load %1248 : !llvm.ptr -> f64
llvm.store %1278, %1211 : f64, !llvm.ptr
%1279 = arith.constant 1 : i32
llvm.store %1279, %1205 : i32, !llvm.ptr
cf.br ^bb143
^bb142:
cf.br ^bb143
^bb143:
%1280 = llvm.load %1217 : !llvm.ptr -> i32
%1281 = arith.constant 1 : i32
%1282 = arith.addi %1280, %1281 : i32
llvm.store %1282, %1217 : i32, !llvm.ptr
cf.br ^bb120
^bb122:
%1283 = llvm.load %1205 : !llvm.ptr -> i32
%1284 = arith.constant 0 : i32
%1285 = arith.cmpi ne, %1283, %1284 : i32
cf.cond_br %1285, ^bb144, ^bb145
^bb144:
%1286 = llvm.load %1214 : !llvm.ptr -> f64
llvm.store %1286, %1034 : f64, !llvm.ptr
%1287 = llvm.load %1208 : !llvm.ptr -> f64
llvm.store %1287, %1019 : f64, !llvm.ptr
%1288 = llvm.load %1211 : !llvm.ptr -> f64
llvm.store %1288, %1021 : f64, !llvm.ptr
%1289 = arith.constant 1 : i32
llvm.store %1289, %1198 : i32, !llvm.ptr
cf.br ^bb146
^bb145:
%1290 = arith.constant 0 : i1
llvm.store %1290, %1201 : i1, !llvm.ptr
cf.br ^bb146
^bb146:
cf.br ^bb117
^bb119:
%1291 = llvm.load %1198 : !llvm.ptr -> i32
%1292 = arith.constant 0 : i32
%1293 = arith.cmpi eq, %1291, %1292 : i32
cf.cond_br %1293, ^bb147, ^bb148
^bb147:
%1294 = llvm.load %1104 : !llvm.ptr -> f64
%1295 = arith.constant 0.5 : f32
%1297 = arith.extf %1295 : f32 to f64
%1296 = arith.mulf %1294, %1297 : f64
llvm.store %1296, %1104 : f64, !llvm.ptr
cf.br ^bb149
^bb148:
cf.br ^bb149
^bb149:
cf.br ^bb114
^bb116:
%1298 = llvm.load %1034 : !llvm.ptr -> f64
func.return %1298 : f64
}
func.func @tt_less(%arg0: !llvm.struct<(i32, i32, i32, i64)>, %arg1: !llvm.struct<(i32, i32, i32, i64)>) -> i1 {
%1299 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32, i64)>
%1300 = llvm.extractvalue %arg0[0] : !llvm.struct<(i32, i32, i32, i64)>
%1301 = llvm.insertvalue %1300, %1299[0] : !llvm.struct<(i32, i32, i32, i64)>
%1302 = llvm.extractvalue %arg0[1] : !llvm.struct<(i32, i32, i32, i64)>
%1303 = llvm.insertvalue %1302, %1301[1] : !llvm.struct<(i32, i32, i32, i64)>
%1304 = llvm.extractvalue %arg0[2] : !llvm.struct<(i32, i32, i32, i64)>
%1305 = llvm.insertvalue %1304, %1303[2] : !llvm.struct<(i32, i32, i32, i64)>
%1306 = llvm.extractvalue %arg0[3] : !llvm.struct<(i32, i32, i32, i64)>
%1307 = llvm.insertvalue %1306, %1305[3] : !llvm.struct<(i32, i32, i32, i64)>
%1308 = llvm.mlir.constant(1 : i64) : i64
%1309 = llvm.alloca %1308 x !llvm.struct<(i32, i32, i32, i64)> : (i64) -> !llvm.ptr
llvm.store %1307, %1309 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1310 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32, i64)>
%1311 = llvm.extractvalue %arg1[0] : !llvm.struct<(i32, i32, i32, i64)>
%1312 = llvm.insertvalue %1311, %1310[0] : !llvm.struct<(i32, i32, i32, i64)>
%1313 = llvm.extractvalue %arg1[1] : !llvm.struct<(i32, i32, i32, i64)>
%1314 = llvm.insertvalue %1313, %1312[1] : !llvm.struct<(i32, i32, i32, i64)>
%1315 = llvm.extractvalue %arg1[2] : !llvm.struct<(i32, i32, i32, i64)>
%1316 = llvm.insertvalue %1315, %1314[2] : !llvm.struct<(i32, i32, i32, i64)>
%1317 = llvm.extractvalue %arg1[3] : !llvm.struct<(i32, i32, i32, i64)>
%1318 = llvm.insertvalue %1317, %1316[3] : !llvm.struct<(i32, i32, i32, i64)>
%1319 = llvm.mlir.constant(1 : i64) : i64
%1320 = llvm.alloca %1319 x !llvm.struct<(i32, i32, i32, i64)> : (i64) -> !llvm.ptr
llvm.store %1318, %1320 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1321 = llvm.load %1309 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1322 = llvm.getelementptr %1309[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1323 = llvm.load %1322 : !llvm.ptr -> i32
%1324 = llvm.load %1320 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1325 = llvm.getelementptr %1320[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1326 = llvm.load %1325 : !llvm.ptr -> i32
%1327 = arith.cmpi ne, %1323, %1326 : i32
cf.cond_br %1327, ^bb150, ^bb151
^bb150:
%1328 = llvm.load %1309 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1329 = llvm.getelementptr %1309[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1330 = llvm.load %1329 : !llvm.ptr -> i32
%1331 = llvm.load %1320 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1332 = llvm.getelementptr %1320[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1333 = llvm.load %1332 : !llvm.ptr -> i32
%1334 = arith.cmpi slt, %1330, %1333 : i32
func.return %1334 : i1
^bb151:
cf.br ^bb152
^bb152:
%1335 = llvm.load %1309 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1336 = llvm.getelementptr %1309[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1337 = llvm.load %1336 : !llvm.ptr -> i32
%1338 = llvm.load %1320 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1339 = llvm.getelementptr %1320[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1340 = llvm.load %1339 : !llvm.ptr -> i32
%1341 = arith.cmpi ne, %1337, %1340 : i32
cf.cond_br %1341, ^bb153, ^bb154
^bb153:
%1342 = llvm.load %1309 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1343 = llvm.getelementptr %1309[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1344 = llvm.load %1343 : !llvm.ptr -> i32
%1345 = llvm.load %1320 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1346 = llvm.getelementptr %1320[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1347 = llvm.load %1346 : !llvm.ptr -> i32
%1348 = arith.cmpi slt, %1344, %1347 : i32
func.return %1348 : i1
^bb154:
cf.br ^bb155
^bb155:
%1349 = llvm.load %1309 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1350 = llvm.getelementptr %1309[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1351 = llvm.load %1350 : !llvm.ptr -> i32
%1352 = llvm.load %1320 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1353 = llvm.getelementptr %1320[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1354 = llvm.load %1353 : !llvm.ptr -> i32
%1355 = arith.cmpi slt, %1351, %1354 : i32
func.return %1355 : i1
}
func.func @tt_sift_down(%arg0: !llvm.ptr, %arg1: i32, %arg2: i32) -> () {
%1356 = llvm.mlir.constant(1 : i64) : i64
%1357 = llvm.alloca %1356 x i32 : (i64) -> !llvm.ptr
llvm.store %arg1, %1357 : i32, !llvm.ptr
%1358 = arith.constant 1 : i1
%1359 = llvm.mlir.constant(1 : i64) : i64
%1360 = llvm.alloca %1359 x i1 : (i64) -> !llvm.ptr
llvm.store %1358, %1360 : i1, !llvm.ptr
cf.br ^bb156
^bb156:
%1361 = llvm.load %1360 : !llvm.ptr -> i1
cf.cond_br %1361, ^bb157, ^bb158
^bb157:
%1362 = arith.constant 2 : i32
%1363 = llvm.load %1357 : !llvm.ptr -> i32
%1364 = arith.muli %1362, %1363 : i32
%1365 = arith.constant 1 : i32
%1366 = arith.addi %1364, %1365 : i32
%1367 = llvm.mlir.constant(1 : i64) : i64
%1368 = llvm.alloca %1367 x i32 : (i64) -> !llvm.ptr
llvm.store %1366, %1368 : i32, !llvm.ptr
%1369 = llvm.load %1368 : !llvm.ptr -> i32
%1370 = arith.cmpi sgt, %1369, %arg2 : i32
cf.cond_br %1370, ^bb159, ^bb160
^bb159:
%1371 = arith.constant 0 : i1
llvm.store %1371, %1360 : i1, !llvm.ptr
cf.br ^bb161
^bb160:
%1372 = llvm.load %1368 : !llvm.ptr -> i32
%1373 = arith.constant 1 : i32
%1374 = arith.addi %1372, %1373 : i32
%1375 = arith.cmpi sle, %1374, %arg2 : i32
%1376 = scf.if %1375 -> (i1) {
%1379 = llvm.load %1368 : !llvm.ptr -> i32
%1380 = arith.extsi %1379 : i32 to i64
%1381 = llvm.getelementptr %arg0[%1380] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1378 = llvm.load %1381 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1383 = llvm.load %1368 : !llvm.ptr -> i32
%1384 = arith.constant 1 : i32
%1385 = arith.addi %1383, %1384 : i32
%1386 = arith.extsi %1385 : i32 to i64
%1387 = llvm.getelementptr %arg0[%1386] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1382 = llvm.load %1387 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1377 = func.call @tt_less(%1378, %1382) : (!llvm.struct<(i32, i32, i32, i64)>, !llvm.struct<(i32, i32, i32, i64)>) -> i1
scf.yield %1377 : i1
} else {
%1388 = arith.constant false
scf.yield %1388 : i1
}
cf.cond_br %1376, ^bb162, ^bb163
^bb162:
%1389 = llvm.load %1368 : !llvm.ptr -> i32
%1390 = arith.constant 1 : i32
%1391 = arith.addi %1389, %1390 : i32
llvm.store %1391, %1368 : i32, !llvm.ptr
cf.br ^bb164
^bb163:
cf.br ^bb164
^bb164:
%1394 = llvm.load %1357 : !llvm.ptr -> i32
%1395 = arith.extsi %1394 : i32 to i64
%1396 = llvm.getelementptr %arg0[%1395] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1393 = llvm.load %1396 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1398 = llvm.load %1368 : !llvm.ptr -> i32
%1399 = arith.extsi %1398 : i32 to i64
%1400 = llvm.getelementptr %arg0[%1399] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1397 = llvm.load %1400 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1392 = func.call @tt_less(%1393, %1397) : (!llvm.struct<(i32, i32, i32, i64)>, !llvm.struct<(i32, i32, i32, i64)>) -> i1
cf.cond_br %1392, ^bb165, ^bb166
^bb165:
%1402 = llvm.load %1357 : !llvm.ptr -> i32
%1403 = arith.extsi %1402 : i32 to i64
%1404 = llvm.getelementptr %arg0[%1403] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1401 = llvm.load %1404 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1405 = llvm.mlir.constant(1 : i64) : i64
%1406 = llvm.alloca %1405 x !llvm.struct<(i32, i32, i32, i64)> : (i64) -> !llvm.ptr
llvm.store %1401, %1406 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1408 = llvm.load %1368 : !llvm.ptr -> i32
%1409 = arith.extsi %1408 : i32 to i64
%1410 = llvm.getelementptr %arg0[%1409] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1407 = llvm.load %1410 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1411 = llvm.load %1357 : !llvm.ptr -> i32
%1412 = arith.extsi %1411 : i32 to i64
%1413 = llvm.getelementptr %arg0[%1412] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
llvm.store %1407, %1413 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1414 = llvm.load %1406 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1415 = llvm.load %1368 : !llvm.ptr -> i32
%1416 = arith.extsi %1415 : i32 to i64
%1417 = llvm.getelementptr %arg0[%1416] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
llvm.store %1414, %1417 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1418 = llvm.load %1368 : !llvm.ptr -> i32
llvm.store %1418, %1357 : i32, !llvm.ptr
cf.br ^bb167
^bb166:
%1419 = arith.constant 0 : i1
llvm.store %1419, %1360 : i1, !llvm.ptr
cf.br ^bb167
^bb167:
cf.br ^bb161
^bb161:
cf.br ^bb156
^bb158:
func.return
}
func.func @heapsort_tt(%arg0: !llvm.ptr, %arg1: i32) -> () {
%1420 = arith.constant 1 : i32
%1421 = arith.cmpi sle, %arg1, %1420 : i32
cf.cond_br %1421, ^bb168, ^bb169
^bb168:
func.return
^bb169:
cf.br ^bb170
^bb170:
%1422 = arith.constant 2 : i32
%1423 = arith.divsi %arg1, %1422 : i32
%1424 = arith.constant 1 : i32
%1425 = arith.subi %1423, %1424 : i32
%1426 = llvm.mlir.constant(1 : i64) : i64
%1427 = llvm.alloca %1426 x i32 : (i64) -> !llvm.ptr
llvm.store %1425, %1427 : i32, !llvm.ptr
cf.br ^bb171
^bb171:
%1428 = llvm.load %1427 : !llvm.ptr -> i32
%1429 = arith.constant 0 : i32
%1430 = arith.cmpi sge, %1428, %1429 : i32
cf.cond_br %1430, ^bb172, ^bb173
^bb172:
%1432 = llvm.load %1427 : !llvm.ptr -> i32
%1433 = arith.constant 1 : i32
%1434 = arith.subi %arg1, %1433 : i32
func.call @tt_sift_down(%arg0, %1432, %1434) : (!llvm.ptr, i32, i32) -> ()
%1435 = llvm.load %1427 : !llvm.ptr -> i32
%1436 = arith.constant 1 : i32
%1437 = arith.subi %1435, %1436 : i32
llvm.store %1437, %1427 : i32, !llvm.ptr
cf.br ^bb171
^bb173:
%1438 = arith.constant 1 : i32
%1439 = arith.subi %arg1, %1438 : i32
%1440 = llvm.mlir.constant(1 : i64) : i64
%1441 = llvm.alloca %1440 x i32 : (i64) -> !llvm.ptr
llvm.store %1439, %1441 : i32, !llvm.ptr
cf.br ^bb174
^bb174:
%1442 = llvm.load %1441 : !llvm.ptr -> i32
%1443 = arith.constant 0 : i32
%1444 = arith.cmpi sgt, %1442, %1443 : i32
cf.cond_br %1444, ^bb175, ^bb176
^bb175:
%1446 = arith.constant 0 : i32
%1447 = arith.extsi %1446 : i32 to i64
%1448 = llvm.getelementptr %arg0[%1447] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1445 = llvm.load %1448 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1449 = llvm.mlir.constant(1 : i64) : i64
%1450 = llvm.alloca %1449 x !llvm.struct<(i32, i32, i32, i64)> : (i64) -> !llvm.ptr
llvm.store %1445, %1450 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1452 = llvm.load %1441 : !llvm.ptr -> i32
%1453 = arith.extsi %1452 : i32 to i64
%1454 = llvm.getelementptr %arg0[%1453] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1451 = llvm.load %1454 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1455 = arith.constant 0 : i32
%1456 = arith.extsi %1455 : i32 to i64
%1457 = llvm.getelementptr %arg0[%1456] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
llvm.store %1451, %1457 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1458 = llvm.load %1450 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1459 = llvm.load %1441 : !llvm.ptr -> i32
%1460 = arith.extsi %1459 : i32 to i64
%1461 = llvm.getelementptr %arg0[%1460] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
llvm.store %1458, %1461 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1462 = llvm.load %1441 : !llvm.ptr -> i32
%1463 = arith.constant 1 : i32
%1464 = arith.subi %1462, %1463 : i32
llvm.store %1464, %1441 : i32, !llvm.ptr
%1466 = arith.constant 0 : i32
%1467 = llvm.load %1441 : !llvm.ptr -> i32
func.call @tt_sift_down(%arg0, %1466, %1467) : (!llvm.ptr, i32, i32) -> ()
cf.br ^bb174
^bb176:
func.return
}
func.func @gcd_int(%arg0: i32, %arg1: i32) -> i32 {
%1468 = llvm.mlir.constant(1 : i64) : i64
%1469 = llvm.alloca %1468 x i32 : (i64) -> !llvm.ptr
llvm.store %arg0, %1469 : i32, !llvm.ptr
%1470 = llvm.mlir.constant(1 : i64) : i64
%1471 = llvm.alloca %1470 x i32 : (i64) -> !llvm.ptr
llvm.store %arg1, %1471 : i32, !llvm.ptr
cf.br ^bb177
^bb177:
%1472 = llvm.load %1471 : !llvm.ptr -> i32
%1473 = arith.constant 0 : i32
%1474 = arith.cmpi ne, %1472, %1473 : i32
cf.cond_br %1474, ^bb178, ^bb179
^bb178:
%1475 = llvm.load %1469 : !llvm.ptr -> i32
%1476 = llvm.load %1471 : !llvm.ptr -> i32
%1477 = arith.remsi %1475, %1476 : i32
%1478 = llvm.load %1471 : !llvm.ptr -> i32
llvm.store %1478, %1469 : i32, !llvm.ptr
llvm.store %1477, %1471 : i32, !llvm.ptr
cf.br ^bb177
^bb179:
%1479 = llvm.load %1469 : !llvm.ptr -> i32
func.return %1479 : i32
}
func.func @main() -> i32 {
%1481 = arith.constant 0.0 : f32
%1482 = arith.constant 1.0 : f32
%1483 = arith.subf %1481, %1482 : f32
%1484 = arith.extf %1483 : f32 to f64
%1480 = func.call @acos(%1484) : (f64) -> f64
%1485 = llvm.mlir.addressof @g_pi : !llvm.ptr
llvm.store %1480, %1485 : f64, !llvm.ptr
%1486 = arith.constant 200 : i32
%1487 = arith.constant 300000 : i32
%1489 = arith.extsi %1487 : i32 to i64
%1490 = arith.constant 24 : i32
%1491 = arith.extsi %1490 : i32 to i64
%1488 = func.call @calloc(%1489, %1491) : (i64, i64) -> !llvm.ptr
%1492 = arith.constant 0 : i32
%1493 = llvm.mlir.constant(1 : i64) : i64
%1494 = llvm.alloca %1493 x i32 : (i64) -> !llvm.ptr
llvm.store %1492, %1494 : i32, !llvm.ptr
%1495 = arith.constant 1 : i32
%1496 = llvm.mlir.constant(1 : i64) : i64
%1497 = llvm.alloca %1496 x i32 : (i64) -> !llvm.ptr
llvm.store %1495, %1497 : i32, !llvm.ptr
cf.br ^bb180
^bb180:
%1498 = llvm.load %1497 : !llvm.ptr -> i32
%1499 = arith.cmpi sle, %1498, %1486 : i32
cf.cond_br %1499, ^bb181, ^bb182
^bb181:
%1500 = llvm.load %1497 : !llvm.ptr -> i32
%1501 = llvm.mlir.constant(1 : i64) : i64
%1502 = llvm.alloca %1501 x i32 : (i64) -> !llvm.ptr
llvm.store %1500, %1502 : i32, !llvm.ptr
cf.br ^bb183
^bb183:
%1503 = llvm.load %1502 : !llvm.ptr -> i32
%1504 = arith.cmpi sle, %1503, %1486 : i32
cf.cond_br %1504, ^bb184, ^bb185
^bb184:
%1505 = llvm.load %1497 : !llvm.ptr -> i32
%1506 = llvm.load %1502 : !llvm.ptr -> i32
%1507 = arith.addi %1505, %1506 : i32
%1508 = arith.constant 1 : i32
%1509 = arith.subi %1507, %1508 : i32
%1510 = llvm.load %1497 : !llvm.ptr -> i32
%1511 = arith.subi %1486, %1510 : i32
%1512 = llvm.load %1502 : !llvm.ptr -> i32
%1513 = arith.subi %1511, %1512 : i32
%1514 = arith.cmpi slt, %1513, %1509 : i32
%1515 = scf.if %1514 -> (i32) {
scf.yield %1513 : i32
} else {
scf.yield %1509 : i32
}
%1516 = llvm.load %1502 : !llvm.ptr -> i32
%1517 = arith.cmpi sge, %1515, %1516 : i32
cf.cond_br %1517, ^bb186, ^bb187
^bb186:
%1518 = llvm.load %1502 : !llvm.ptr -> i32
%1519 = llvm.mlir.constant(1 : i64) : i64
%1520 = llvm.alloca %1519 x i32 : (i64) -> !llvm.ptr
llvm.store %1518, %1520 : i32, !llvm.ptr
cf.br ^bb189
^bb189:
%1521 = llvm.load %1520 : !llvm.ptr -> i32
%1522 = arith.cmpi sle, %1521, %1515 : i32
cf.cond_br %1522, ^bb190, ^bb191
^bb190:
%1525 = llvm.load %1497 : !llvm.ptr -> i32
%1526 = llvm.load %1502 : !llvm.ptr -> i32
%1524 = func.call @gcd_int(%1525, %1526) : (i32, i32) -> i32
%1527 = llvm.load %1520 : !llvm.ptr -> i32
%1523 = func.call @gcd_int(%1524, %1527) : (i32, i32) -> i32
%1528 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32, i64)>
%1529 = llvm.load %1497 : !llvm.ptr -> i32
%1530 = arith.divsi %1529, %1523 : i32
%1531 = llvm.insertvalue %1530, %1528[0] : !llvm.struct<(i32, i32, i32, i64)>
%1532 = llvm.load %1502 : !llvm.ptr -> i32
%1533 = arith.divsi %1532, %1523 : i32
%1534 = llvm.insertvalue %1533, %1531[1] : !llvm.struct<(i32, i32, i32, i64)>
%1535 = llvm.load %1520 : !llvm.ptr -> i32
%1536 = arith.divsi %1535, %1523 : i32
%1537 = llvm.insertvalue %1536, %1534[2] : !llvm.struct<(i32, i32, i32, i64)>
%1538 = arith.extsi %1523 : i32 to i64
%1539 = arith.extsi %1523 : i32 to i64
%1540 = arith.muli %1538, %1539 : i64
%1541 = llvm.insertvalue %1540, %1537[3] : !llvm.struct<(i32, i32, i32, i64)>
%1542 = llvm.load %1494 : !llvm.ptr -> i32
%1543 = arith.extsi %1542 : i32 to i64
%1544 = llvm.getelementptr %1488[%1543] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
llvm.store %1541, %1544 : !llvm.struct<(i32, i32, i32, i64)>, !llvm.ptr
%1545 = llvm.load %1494 : !llvm.ptr -> i32
%1546 = arith.constant 1 : i32
%1547 = arith.addi %1545, %1546 : i32
llvm.store %1547, %1494 : i32, !llvm.ptr
%1548 = llvm.load %1520 : !llvm.ptr -> i32
%1549 = arith.constant 1 : i32
%1550 = arith.addi %1548, %1549 : i32
llvm.store %1550, %1520 : i32, !llvm.ptr
cf.br ^bb189
^bb191:
cf.br ^bb188
^bb187:
cf.br ^bb188
^bb188:
%1551 = llvm.load %1502 : !llvm.ptr -> i32
%1552 = arith.constant 1 : i32
%1553 = arith.addi %1551, %1552 : i32
llvm.store %1553, %1502 : i32, !llvm.ptr
cf.br ^bb183
^bb185:
%1554 = llvm.load %1497 : !llvm.ptr -> i32
%1555 = arith.constant 1 : i32
%1556 = arith.addi %1554, %1555 : i32
llvm.store %1556, %1497 : i32, !llvm.ptr
cf.br ^bb180
^bb182:
%1558 = llvm.load %1494 : !llvm.ptr -> i32
func.call @heapsort_tt(%1488, %1558) : (!llvm.ptr, i32) -> ()
%1559 = arith.constant 0.0 : f32
%1560 = arith.extf %1559 : f32 to f64
%1561 = llvm.mlir.constant(1 : i64) : i64
%1562 = llvm.alloca %1561 x f64 : (i64) -> !llvm.ptr
llvm.store %1560, %1562 : f64, !llvm.ptr
%1563 = arith.constant 0.0 : f32
%1564 = arith.extf %1563 : f32 to f64
%1565 = llvm.mlir.constant(1 : i64) : i64
%1566 = llvm.alloca %1565 x f64 : (i64) -> !llvm.ptr
llvm.store %1564, %1566 : f64, !llvm.ptr
%1567 = arith.constant 0 : i32
%1568 = llvm.mlir.constant(1 : i64) : i64
%1569 = llvm.alloca %1568 x i32 : (i64) -> !llvm.ptr
llvm.store %1567, %1569 : i32, !llvm.ptr
cf.br ^bb192
^bb192:
%1570 = llvm.load %1569 : !llvm.ptr -> i32
%1571 = llvm.load %1494 : !llvm.ptr -> i32
%1572 = arith.cmpi slt, %1570, %1571 : i32
cf.cond_br %1572, ^bb193, ^bb194
^bb193:
%1574 = llvm.load %1569 : !llvm.ptr -> i32
%1575 = arith.extsi %1574 : i32 to i64
%1576 = llvm.getelementptr %1488[%1575] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1573 = llvm.load %1576 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1577 = llvm.load %1569 : !llvm.ptr -> i32
%1578 = arith.extsi %1577 : i32 to i64
%1579 = llvm.getelementptr %1488[%1578] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1580 = llvm.getelementptr %1579[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1581 = llvm.load %1580 : !llvm.ptr -> i32
%1583 = llvm.load %1569 : !llvm.ptr -> i32
%1584 = arith.extsi %1583 : i32 to i64
%1585 = llvm.getelementptr %1488[%1584] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1582 = llvm.load %1585 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1586 = llvm.load %1569 : !llvm.ptr -> i32
%1587 = arith.extsi %1586 : i32 to i64
%1588 = llvm.getelementptr %1488[%1587] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1589 = llvm.getelementptr %1588[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1590 = llvm.load %1589 : !llvm.ptr -> i32
%1592 = llvm.load %1569 : !llvm.ptr -> i32
%1593 = arith.extsi %1592 : i32 to i64
%1594 = llvm.getelementptr %1488[%1593] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1591 = llvm.load %1594 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1595 = llvm.load %1569 : !llvm.ptr -> i32
%1596 = arith.extsi %1595 : i32 to i64
%1597 = llvm.getelementptr %1488[%1596] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1598 = llvm.getelementptr %1597[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1599 = llvm.load %1598 : !llvm.ptr -> i32
%1600 = arith.constant 0 : i32
%1601 = arith.extsi %1600 : i32 to i64
%1602 = llvm.mlir.constant(1 : i64) : i64
%1603 = llvm.alloca %1602 x i64 : (i64) -> !llvm.ptr
llvm.store %1601, %1603 : i64, !llvm.ptr
cf.br ^bb195
^bb195:
%1604 = llvm.load %1569 : !llvm.ptr -> i32
%1605 = llvm.load %1494 : !llvm.ptr -> i32
%1606 = arith.cmpi slt, %1604, %1605 : i32
%1607 = scf.if %1606 -> (i1) {
%1609 = llvm.load %1569 : !llvm.ptr -> i32
%1610 = arith.extsi %1609 : i32 to i64
%1611 = llvm.getelementptr %1488[%1610] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1608 = llvm.load %1611 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1612 = llvm.load %1569 : !llvm.ptr -> i32
%1613 = arith.extsi %1612 : i32 to i64
%1614 = llvm.getelementptr %1488[%1613] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1615 = llvm.getelementptr %1614[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1616 = llvm.load %1615 : !llvm.ptr -> i32
%1617 = arith.cmpi eq, %1616, %1581 : i32
scf.yield %1617 : i1
} else {
%1618 = arith.constant false
scf.yield %1618 : i1
}
%1619 = scf.if %1607 -> (i1) {
%1621 = llvm.load %1569 : !llvm.ptr -> i32
%1622 = arith.extsi %1621 : i32 to i64
%1623 = llvm.getelementptr %1488[%1622] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1620 = llvm.load %1623 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1624 = llvm.load %1569 : !llvm.ptr -> i32
%1625 = arith.extsi %1624 : i32 to i64
%1626 = llvm.getelementptr %1488[%1625] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1627 = llvm.getelementptr %1626[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1628 = llvm.load %1627 : !llvm.ptr -> i32
%1629 = arith.cmpi eq, %1628, %1590 : i32
scf.yield %1629 : i1
} else {
%1630 = arith.constant false
scf.yield %1630 : i1
}
%1631 = scf.if %1619 -> (i1) {
%1633 = llvm.load %1569 : !llvm.ptr -> i32
%1634 = arith.extsi %1633 : i32 to i64
%1635 = llvm.getelementptr %1488[%1634] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1632 = llvm.load %1635 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1636 = llvm.load %1569 : !llvm.ptr -> i32
%1637 = arith.extsi %1636 : i32 to i64
%1638 = llvm.getelementptr %1488[%1637] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1639 = llvm.getelementptr %1638[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1640 = llvm.load %1639 : !llvm.ptr -> i32
%1641 = arith.cmpi eq, %1640, %1599 : i32
scf.yield %1641 : i1
} else {
%1642 = arith.constant false
scf.yield %1642 : i1
}
cf.cond_br %1631, ^bb196, ^bb197
^bb196:
%1643 = llvm.load %1603 : !llvm.ptr -> i64
%1645 = llvm.load %1569 : !llvm.ptr -> i32
%1646 = arith.extsi %1645 : i32 to i64
%1647 = llvm.getelementptr %1488[%1646] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1644 = llvm.load %1647 : !llvm.ptr -> !llvm.struct<(i32, i32, i32, i64)>
%1648 = llvm.load %1569 : !llvm.ptr -> i32
%1649 = arith.extsi %1648 : i32 to i64
%1650 = llvm.getelementptr %1488[%1649] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1651 = llvm.getelementptr %1650[0, 3] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32, i64)>
%1652 = llvm.load %1651 : !llvm.ptr -> i64
%1653 = arith.addi %1643, %1652 : i64
llvm.store %1653, %1603 : i64, !llvm.ptr
%1654 = llvm.load %1569 : !llvm.ptr -> i32
%1655 = arith.constant 1 : i32
%1656 = arith.addi %1654, %1655 : i32
llvm.store %1656, %1569 : i32, !llvm.ptr
cf.br ^bb195
^bb197:
%1657 = func.call @maximize_intersection(%1581, %1590, %1599) : (i32, i32, i32) -> f64
%1658 = llvm.load %1603 : !llvm.ptr -> i64
%1659 = arith.sitofp %1658 : i64 to f64
%1660 = arith.mulf %1657, %1659 : f64
%1661 = llvm.load %1566 : !llvm.ptr -> f64
%1662 = arith.subf %1660, %1661 : f64
%1663 = llvm.load %1562 : !llvm.ptr -> f64
%1664 = arith.addf %1663, %1662 : f64
%1665 = llvm.load %1562 : !llvm.ptr -> f64
%1666 = arith.subf %1664, %1665 : f64
%1667 = arith.subf %1666, %1662 : f64
llvm.store %1667, %1566 : f64, !llvm.ptr
llvm.store %1664, %1562 : f64, !llvm.ptr
cf.br ^bb192
^bb194:
func.call @free(%1488) : (!llvm.ptr) -> ()
%1669 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1670 = llvm.load %1562 : !llvm.ptr -> f64
%1671 = llvm.call @printf(%1669, %1670) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
%1672 = arith.constant 0 : i32
func.return %1672 : i32
}
}