Problem 252

Maximum area convex hole among 500 PRNG points.

Answer104924.0
Output104924.0
StatusPASS
Native helperno
Runtime3160 ms
Peak memory129504 KB
Time complexityO(n^3) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^3)O(n log n)
Space complexityO(n^2)O(n)
ApproachFlow solutionSearch with pruning or sieve
VerdictSuboptimal

Flow source

# Project Euler 252
# Maximum area convex hole among 500 PRNG points.

extern {
    function calloc(n: i64, size: i64) -> ptr<void>
    function free(p: ptr<void>) -> void
    function atan2(y: f64, x: f64) -> f64
}

function gcd_i(a0: i64, b0: i64) -> i64 {
    let mut a: i64 = a0
    let mut b: i64 = b0
    if a < 0 { a = -a }
    if b < 0 { b = -b }
    while b != 0 {
        let t: i64 = a % b
        a = b
        b = t
    }
    return a
}

function tri_empty(left1: ptr<i8>, n: i64, s: i64, a: i64, b: i64) -> bool {
    let mut w: i64 = 0
    while w < n {
        if left1[((s * n + a) * n) + w] != 0 && left1[((a * n + b) * n) + w] != 0 && left1[((b * n + s) * n) + w] != 0 {
            return false
        }
        w = w + 1
    }
    return true
}

function sort_by_angle(cand: ptr<i64>, ang: ptr<f64>, dist: ptr<f64>, m: i64) -> void {
    let mut i: i64 = 1
    while i < m {
        let key: i64 = cand[i]
        let key_a: f64 = ang[i]
        let key_d: f64 = dist[i]
        let mut j: i64 = i - 1
        while j >= 0 {
            if ang[j] < key_a { break }
            if ang[j] == key_a && dist[j] <= key_d { break }
            cand[j + 1] = cand[j]
            ang[j + 1] = ang[j]
            dist[j + 1] = dist[j]
            j = j - 1
        }
        cand[j + 1] = key
        ang[j + 1] = key_a
        dist[j + 1] = key_d
        i = i + 1
    }
}

function main() -> i32 {
    let n: i64 = 500
    let xs: ptr<i64> = calloc(n, 8)
    let ys: ptr<i64> = calloc(n, 8)
    let left1: ptr<i8> = calloc(n * n * n, 1)
    let seg_clear: ptr<i8> = calloc(n * n, 1)
    let cand: ptr<i64> = calloc(n, 8)
    let ang: ptr<f64> = calloc(n, 8)
    let dist: ptr<f64> = calloc(n, 8)
    let succ_j: ptr<i64> = calloc(n * n, 8)
    let succ_w: ptr<i64> = calloc(n * n, 8)
    let succ_cnt: ptr<i64> = calloc(n, 8)
    let dp: ptr<i64> = calloc(n * n, 8)

    let MOD: i64 = 50515093
    let mut s0: i64 = 290797
    let mut ti: i64 = 0
    while ti < 2 * n {
        s0 = (s0 * s0) % MOD
        if ti % 2 == 0 {
            xs[ti / 2] = (s0 % 2000) - 1000
        } else {
            ys[ti / 2] = (s0 % 2000) - 1000
        }
        ti = ti + 1
    }

    let mut u: i64 = 0
    while u < n {
        let mut v: i64 = 0
        while v < n {
            if v != u {
                let vx: i64 = xs[v] - xs[u]
                let vy: i64 = ys[v] - ys[u]
                let base: i64 = (u * n + v) * n
                let mut w: i64 = 0
                while w < n {
                    if w != u && w != v {
                        let wx: i64 = xs[w] - xs[u]
                        let wy: i64 = ys[w] - ys[u]
                        let c: i64 = vx * wy - vy * wx
                        if c > 0 {
                            left1[base + w] = 1
                        }
                    }
                    w = w + 1
                }
            }
            v = v + 1
        }
        u = u + 1
    }

    let mut a: i64 = 0
    while a < n {
        let mut b: i64 = 0
        while b < n {
            if b != a {
                let dx: i64 = xs[b] - xs[a]
                let dy: i64 = ys[b] - ys[a]
                let g: i64 = gcd_i(dx, dy)
                let rdx: i64 = dx / g
                let rdy: i64 = dy / g
                let dist2: i64 = dx * dx + dy * dy
                let mut best: i64 = -1
                let mut bestd: i64 = 1000000000000
                let mut c: i64 = 0
                while c < n {
                    if c != a {
                        let cdx: i64 = xs[c] - xs[a]
                        let cdy: i64 = ys[c] - ys[a]
                        let gg: i64 = gcd_i(cdx, cdy)
                        if cdx / gg == rdx && cdy / gg == rdy {
                            let dd: i64 = cdx * cdx + cdy * cdy
                            if dd < dist2 && (best < 0 || dd < bestd) {
                                best = c
                                bestd = dd
                            }
                        }
                    }
                    c = c + 1
                }
                if best < 0 || best == b { seg_clear[a * n + b] = 1 }
            }
            b = b + 1
        }
        a = a + 1
    }

    let mut best2: i64 = 0
    let mut s: i64 = 0
    while s < n {
        let x_s: i64 = xs[s]
        let y_s: i64 = ys[s]
        let mut mc: i64 = 0
        let mut i: i64 = 0
        while i < n {
            if i != s && (ys[i] > y_s || (ys[i] == y_s && xs[i] > x_s)) {
                cand[mc] = i
                let dx: f64 = (xs[i] - x_s) as f64
                let dy: f64 = (ys[i] - y_s) as f64
                ang[mc] = atan2(dy, dx)
                dist[mc] = dx * dx + dy * dy
                mc = mc + 1
            }
            i = i + 1
        }
        if mc >= 2 {
            sort_by_angle(cand, ang, dist, mc)
            i = 0
            while i < mc { succ_cnt[i] = 0; i = i + 1 }

            let mut ai: i64 = 0
            while ai < mc - 1 {
                let aidx: i64 = cand[ai]
                let ax: i64 = xs[aidx] - x_s
                let ay: i64 = ys[aidx] - y_s
                let mut bi: i64 = ai + 1
                while bi < mc {
                    let bidx: i64 = cand[bi]
                    let c: i64 = ax * (ys[bidx] - y_s) - ay * (xs[bidx] - x_s)
                    if c > 0 {
                        if tri_empty(left1, n, s, aidx, bidx) {
                            let sc: i64 = succ_cnt[ai]
                            succ_j[ai * n + sc] = bi
                            succ_w[ai * n + sc] = c
                            succ_cnt[ai] = sc + 1
                        }
                    }
                    bi = bi + 1
                }
                ai = ai + 1
            }

            i = 0
            while i < mc * mc { dp[i] = -1; i = i + 1 }

            ai = 0
            while ai < mc - 1 {
                let sc: i64 = succ_cnt[ai]
                let mut si: i64 = 0
                while si < sc {
                    let jj: i64 = succ_j[ai * n + si]
                    let ww: i64 = succ_w[ai * n + si]
                    let slot: i64 = jj * mc + ai
                    if dp[slot] < ww { dp[slot] = ww }
                    si = si + 1
                }
                ai = ai + 1
            }

            let mut curr: i64 = 0
            while curr < mc {
                let c_idx: i64 = cand[curr]
                let x_c: i64 = xs[c_idx]
                let y_c: i64 = ys[c_idx]
                let mut prev: i64 = 0
                while prev < mc {
                    let val: i64 = dp[curr * mc + prev]
                    if val >= 0 {
                        let p_idx: i64 = cand[prev]
                        if (x_c - xs[p_idx]) * (y_s - y_c) - (y_c - ys[p_idx]) * (x_s - x_c) > 0 {
                            if val > best2 { best2 = val }
                        }
                    }
                    prev = prev + 1
                }
                if seg_clear[s * n + c_idx] != 0 {
                    prev = 0
                    while prev < mc {
                        let val: i64 = dp[curr * mc + prev]
                        if val >= 0 {
                            let p_idx: i64 = cand[prev]
                            let sc2: i64 = succ_cnt[curr]
                            let mut si2: i64 = 0
                            while si2 < sc2 {
                                let nxt: i64 = succ_j[curr * n + si2]
                                let w: i64 = succ_w[curr * n + si2]
                                let n_idx: i64 = cand[nxt]
                                if (x_c - xs[p_idx]) * (ys[n_idx] - y_c) - (y_c - ys[p_idx]) * (xs[n_idx] - x_c) > 0 {
                                    let nv: i64 = val + w
                                    let slot: i64 = nxt * mc + curr
                                    if dp[slot] < nv { dp[slot] = nv }
                                }
                                si2 = si2 + 1
                            }
                        }
                        prev = prev + 1
                    }
                }
                curr = curr + 1
            }
        }
        s = s + 1
    }

    let ans_half: f64 = (best2 as f64) * 0.5
    printf("%.1f\n", ans_half)
    free(xs); free(ys); free(left1); free(seg_clear); free(cand); free(ang); free(dist)
    free(succ_j); free(succ_w); free(succ_cnt); free(dp)
    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; }

double atan2(double y, double x);
int64_t gcd_i_i64_i64(int64_t a0, int64_t b0);
bool tri_empty_ptr_i8_i64_i64_i64_i64(int8_t* left1, int64_t n, int64_t s, int64_t a, int64_t b);
void sort_by_angle_ptr_i64_ptr_f64_ptr_f64_i64(int64_t* cand, double* ang, double* dist, int64_t m);
int32_t main(void);




int64_t gcd_i_i64_i64(int64_t a0, int64_t b0) {
    int64_t a = a0;
    int64_t b = b0;
    if (a < 0) {
        a = (-a);
    }
    if (b < 0) {
        b = (-b);
    }
    while (b != 0) {
        int64_t t = FLOW_CHECKED_MOD((a), (b));
        a = b;
        b = t;
    }
    return a;
}

bool tri_empty_ptr_i8_i64_i64_i64_i64(int8_t* left1, int64_t n, int64_t s, int64_t a, int64_t b) {
    int64_t w = 0;
    while (w < n) {
        if (((left1[((((s * n) + a) * n) + w)] != 0 && left1[((((a * n) + b) * n) + w)] != 0) && left1[((((b * n) + s) * n) + w)] != 0)) {
            return 0;
        }
        w = (w + 1);
    }
    return 1;
}

void sort_by_angle_ptr_i64_ptr_f64_ptr_f64_i64(int64_t* cand, double* ang, double* dist, int64_t m) {
    int64_t i = 1;
    while (i < m) {
        int64_t key = cand[i];
        double key_a = ang[i];
        double key_d = dist[i];
        int64_t j = (i - 1);
        while (j >= 0) {
            if (ang[j] < key_a) {
                break;
            }
            if ((ang[j] == key_a && dist[j] <= key_d)) {
                break;
            }
            cand[(j + 1)] = cand[j];
            ang[(j + 1)] = ang[j];
            dist[(j + 1)] = dist[j];
            j = (j - 1);
        }
        cand[(j + 1)] = key;
        ang[(j + 1)] = key_a;
        dist[(j + 1)] = key_d;
        i = (i + 1);
    }
}

int32_t main(void) {
    int64_t n = 500;
    int64_t* xs = (int64_t*)(calloc(n, 8));
    int64_t* ys = (int64_t*)(calloc(n, 8));
    int8_t* left1 = (int8_t*)(calloc(((n * n) * n), 1));
    int8_t* seg_clear = (int8_t*)(calloc((n * n), 1));
    int64_t* cand = (int64_t*)(calloc(n, 8));
    double* ang = (double*)(calloc(n, 8));
    double* dist = (double*)(calloc(n, 8));
    int64_t* succ_j = (int64_t*)(calloc((n * n), 8));
    int64_t* succ_w = (int64_t*)(calloc((n * n), 8));
    int64_t* succ_cnt = (int64_t*)(calloc(n, 8));
    int64_t* dp = (int64_t*)(calloc((n * n), 8));
    int64_t MOD = 50515093;
    int64_t s0 = 290797;
    int64_t ti = 0;
    while (ti < (2 * n)) {
        s0 = FLOW_CHECKED_MOD(((s0 * s0)), (MOD));
        if (FLOW_CHECKED_MOD((ti), (2)) == 0) {
            xs[FLOW_CHECKED_DIV((ti), (2))] = (FLOW_CHECKED_MOD((s0), (2000)) - 1000);
        } else {
            ys[FLOW_CHECKED_DIV((ti), (2))] = (FLOW_CHECKED_MOD((s0), (2000)) - 1000);
        }
        ti = (ti + 1);
    }
    int64_t u = 0;
    while (u < n) {
        int64_t v = 0;
        while (v < n) {
            if (v != u) {
                int64_t vx = (xs[v] - xs[u]);
                int64_t vy = (ys[v] - ys[u]);
                int64_t base = (((u * n) + v) * n);
                int64_t w = 0;
                while (w < n) {
                    if ((w != u && w != v)) {
                        int64_t wx = (xs[w] - xs[u]);
                        int64_t wy = (ys[w] - ys[u]);
                        int64_t c = ((vx * wy) - (vy * wx));
                        if (c > 0) {
                            left1[(base + w)] = 1;
                        }
                    }
                    w = (w + 1);
                }
            }
            v = (v + 1);
        }
        u = (u + 1);
    }
    int64_t a = 0;
    while (a < n) {
        int64_t b = 0;
        while (b < n) {
            if (b != a) {
                int64_t dx = (xs[b] - xs[a]);
                int64_t dy = (ys[b] - ys[a]);
                int64_t g = gcd_i_i64_i64(dx, dy);
                int64_t rdx = FLOW_CHECKED_DIV((dx), (g));
                int64_t rdy = FLOW_CHECKED_DIV((dy), (g));
                int64_t dist2 = ((dx * dx) + (dy * dy));
                int64_t best = (-1);
                int64_t bestd = 1000000000000;
                int64_t c = 0;
                while (c < n) {
                    if (c != a) {
                        int64_t cdx = (xs[c] - xs[a]);
                        int64_t cdy = (ys[c] - ys[a]);
                        int64_t gg = gcd_i_i64_i64(cdx, cdy);
                        if ((FLOW_CHECKED_DIV((cdx), (gg)) == rdx && FLOW_CHECKED_DIV((cdy), (gg)) == rdy)) {
                            int64_t dd = ((cdx * cdx) + (cdy * cdy));
                            if ((dd < dist2 && (best < 0 || dd < bestd))) {
                                best = c;
                                bestd = dd;
                            }
                        }
                    }
                    c = (c + 1);
                }
                if ((best < 0 || best == b)) {
                    seg_clear[((a * n) + b)] = 1;
                }
            }
            b = (b + 1);
        }
        a = (a + 1);
    }
    int64_t best2 = 0;
    int64_t s = 0;
    while (s < n) {
        int64_t x_s = xs[s];
        int64_t y_s = ys[s];
        int64_t mc = 0;
        int64_t i = 0;
        while (i < n) {
            if ((i != s && (ys[i] > y_s || (ys[i] == y_s && xs[i] > x_s)))) {
                cand[mc] = i;
                double dx = ((double)((xs[i] - x_s)));
                double dy = ((double)((ys[i] - y_s)));
                ang[mc] = atan2(dy, dx);
                dist[mc] = ((dx * dx) + (dy * dy));
                mc = (mc + 1);
            }
            i = (i + 1);
        }
        if (mc >= 2) {
            sort_by_angle_ptr_i64_ptr_f64_ptr_f64_i64(cand, ang, dist, mc);
            i = 0;
            while (i < mc) {
                succ_cnt[i] = 0;
                i = (i + 1);
            }
            int64_t ai = 0;
            while (ai < (mc - 1)) {
                int64_t aidx = cand[ai];
                int64_t ax = (xs[aidx] - x_s);
                int64_t ay = (ys[aidx] - y_s);
                int64_t bi = (ai + 1);
                while (bi < mc) {
                    int64_t bidx = cand[bi];
                    int64_t c = ((ax * (ys[bidx] - y_s)) - (ay * (xs[bidx] - x_s)));
                    if (c > 0) {
                        if (tri_empty_ptr_i8_i64_i64_i64_i64(left1, n, s, aidx, bidx)) {
                            int64_t sc = succ_cnt[ai];
                            succ_j[((ai * n) + sc)] = bi;
                            succ_w[((ai * n) + sc)] = c;
                            succ_cnt[ai] = (sc + 1);
                        }
                    }
                    bi = (bi + 1);
                }
                ai = (ai + 1);
            }
            i = 0;
            while (i < (mc * mc)) {
                dp[i] = (-1);
                i = (i + 1);
            }
            ai = 0;
            while (ai < (mc - 1)) {
                int64_t sc = succ_cnt[ai];
                int64_t si = 0;
                while (si < sc) {
                    int64_t jj = succ_j[((ai * n) + si)];
                    int64_t ww = succ_w[((ai * n) + si)];
                    int64_t slot = ((jj * mc) + ai);
                    if (dp[slot] < ww) {
                        dp[slot] = ww;
                    }
                    si = (si + 1);
                }
                ai = (ai + 1);
            }
            int64_t curr = 0;
            while (curr < mc) {
                int64_t c_idx = cand[curr];
                int64_t x_c = xs[c_idx];
                int64_t y_c = ys[c_idx];
                int64_t prev = 0;
                while (prev < mc) {
                    int64_t val = dp[((curr * mc) + prev)];
                    if (val >= 0) {
                        int64_t p_idx = cand[prev];
                        if ((((x_c - xs[p_idx]) * (y_s - y_c)) - ((y_c - ys[p_idx]) * (x_s - x_c))) > 0) {
                            if (val > best2) {
                                best2 = val;
                            }
                        }
                    }
                    prev = (prev + 1);
                }
                if (seg_clear[((s * n) + c_idx)] != 0) {
                    prev = 0;
                    while (prev < mc) {
                        int64_t val = dp[((curr * mc) + prev)];
                        if (val >= 0) {
                            int64_t p_idx = cand[prev];
                            int64_t sc2 = succ_cnt[curr];
                            int64_t si2 = 0;
                            while (si2 < sc2) {
                                int64_t nxt = succ_j[((curr * n) + si2)];
                                int64_t w = succ_w[((curr * n) + si2)];
                                int64_t n_idx = cand[nxt];
                                if ((((x_c - xs[p_idx]) * (ys[n_idx] - y_c)) - ((y_c - ys[p_idx]) * (xs[n_idx] - x_c))) > 0) {
                                    int64_t nv = (val + w);
                                    int64_t slot = ((nxt * mc) + curr);
                                    if (dp[slot] < nv) {
                                        dp[slot] = nv;
                                    }
                                }
                                si2 = (si2 + 1);
                            }
                        }
                        prev = (prev + 1);
                    }
                }
                curr = (curr + 1);
            }
        }
        s = (s + 1);
    }
    double ans_half = (((double)(best2)) * 0.5);
    printf("%.1f\n", ans_half);
    free(xs);
    free(ys);
    free(left1);
    free(seg_clear);
    free(cand);
    free(ang);
    free(dist);
    free(succ_j);
    free(succ_w);
    free(succ_cnt);
    free(dp);
    return 0;
}

Generated MLIR

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