Problem 1002

Connections II: maximal above connections in bipartite chord diagram. Sweep over chords with parity DSU and leftist heaps, using a min-heap of candidate components ordered by right endpoint.

Answer55047
Output55047
StatusPASS
Native helperno
Runtime10 ms
Peak memory6672 KB
Time complexityO(n log n) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n log n)?
Space complexityO(n^2)?
ApproachFlow solutionNot curated
VerdictUnknown

Flow source

# Project Euler 1002
# Connections II: maximal above connections in bipartite chord diagram.
# Sweep over chords with parity DSU and leftist heaps, using a min-heap
# of candidate components ordered by right endpoint.

extern {
    function fopen(path: string, mode: string) -> ptr<void>
    function fclose(f: ptr<void>) -> i32
    function fseek(f: ptr<void>, off: i64, whence: i32) -> i32
    function ftell(f: ptr<void>) -> i64
    function fread(buf: ptr<void>, size: i64, nmemb: i64, f: ptr<void>) -> i64
    function calloc(n: i64, size: i64) -> ptr<void>
    function free(p: ptr<void>) -> void
}

struct Candidate {
    right_end: i32,
    node: i32,
    root: i32
}

# ---- candidates min-heap (ordered by right_end, then node, then root) ----

function cand_less(a: Candidate, b: Candidate) -> bool {
    if a.right_end != b.right_end { return a.right_end < b.right_end }
    if a.node != b.node { return a.node < b.node }
    return a.root < b.root
}

function cand_push(h: ptr<Candidate>, pn: ptr<i32>, c: Candidate) -> void {
    let n: i32 = pn[0]
    let i: i32 = n
    h[i] = c
    pn[0] = n + 1
    let mut ii: i32 = i
    while ii > 0 {
        let p: i32 = (ii - 1) / 2
        if cand_less(h[ii], h[p]) {
            let t: Candidate = h[ii]
            h[ii] = h[p]
            h[p] = t
            ii = p
        } else {
            ii = 0
        }
    }
}

function cand_pop(h: ptr<Candidate>, pn: ptr<i32>) -> Candidate {
    let top: Candidate = h[0]
    let n: i32 = pn[0] - 1
    pn[0] = n
    h[0] = h[n]
    let mut i: i32 = 0
    let mut cont: bool = true
    while cont {
        let l: i32 = 2 * i + 1
        let r: i32 = 2 * i + 2
        let sm: i32 = i
        if l < n && cand_less(h[l], h[sm]) { sm = l }
        if r < n && cand_less(h[r], h[sm]) { sm = r }
        if sm == i {
            cont = false
        } else {
            let t: Candidate = h[i]
            h[i] = h[sm]
            h[sm] = t
            i = sm
        }
    }
    return top
}

# ---- parity DSU (no path compression; union by size) ----
# Solver arrays passed as pointers.

function sol_root(parent: ptr<i32>, c0: i32) -> i32 {
    let mut c: i32 = c0
    while parent[c] != c {
        c = parent[c]
    }
    return c
}

function sol_parity(parent: ptr<i32>, x2p: ptr<i32>, c0: i32, par_out: ptr<i32>) -> i32 {
    let mut par: i32 = 0
    let mut c: i32 = c0
    while parent[c] != c {
        par = par ^ x2p[c]
        c = parent[c]
    }
    par_out[0] = par
    return c
}

# ---- leftist heap meld (recursive; depth bounded by O(log n) rank) ----

function sol_meld(right_arr: ptr<i32>, hl: ptr<i32>, hr: ptr<i32>, hrank: ptr<i32>,
                  a0: i32, b0: i32) -> i32 {
    let a: i32 = a0
    let b: i32 = b0
    if a < 0 { return b }
    if b < 0 { return a }
    if right_arr[a] > right_arr[b] {
        let t: i32 = a
        a = b
        b = t
    }
    hr[a] = sol_meld(right_arr, hl, hr, hrank, hr[a], b)
    let lc: i32 = hl[a]
    let rc: i32 = hr[a]
    let lr: i32 = 0
    if lc >= 0 { lr = hrank[lc] }
    let rr: i32 = 0
    if rc >= 0 { rr = hrank[rc] }
    if lr < rr {
        hl[a] = rc
        hr[a] = lc
        let t: i32 = lr
        lr = rr
        rr = t
    }
    hrank[a] = rr + 1
    return a
}

function sol_pop_heap(hl: ptr<i32>, hr: ptr<i32>, right_arr: ptr<i32>, hrank: ptr<i32>,
                      node: i32) -> i32 {
    return sol_meld(right_arr, hl, hr, hrank, hl[node], hr[node])
}

function sol_union_opposite(parent: ptr<i32>, sz: ptr<i32>, x2p: ptr<i32>,
                            cz: ptr<i32>, co: ptr<i32>,
                            hl: ptr<i32>, hr: ptr<i32>, hrank: ptr<i32>, ch: ptr<i32>,
                            right_arr: ptr<i32>,
                            first: i32, second: i32) -> i32 {
    let fp_ref: ptr<i32> = calloc(1, 4)
    let sp_ref: ptr<i32> = calloc(1, 4)
    let fr: i32 = sol_parity(parent, x2p, first, fp_ref)
    let sr: i32 = sol_parity(parent, x2p, second, sp_ref)
    let fp: i32 = fp_ref[0]
    let sp: i32 = sp_ref[0]
    free(fp_ref as ptr<void>)
    free(sp_ref as ptr<void>)

    if fr == sr {
        return fr
    }
    let mut fr2: i32 = fr
    let mut sr2: i32 = sr
    let mut fp2: i32 = fp
    let mut sp2: i32 = sp
    if sz[fr2] < sz[sr2] {
        let t: i32 = fr2
        fr2 = sr2
        sr2 = t
        t = fp2
        fp2 = sp2
        sp2 = t
    }
    let shift: i32 = fp2 ^ sp2 ^ 1
    parent[sr2] = fr2
    x2p[sr2] = shift
    sz[fr2] = sz[fr2] + sz[sr2]
    if shift == 0 {
        cz[fr2] = cz[fr2] + cz[sr2]
        co[fr2] = co[fr2] + co[sr2]
    } else {
        cz[fr2] = cz[fr2] + co[sr2]
        co[fr2] = co[fr2] + cz[sr2]
    }
    ch[fr2] = sol_meld(right_arr, hl, hr, hrank, ch[fr2], ch[sr2])
    ch[sr2] = -1
    return fr2
}

# ---- main sweep ----

function sol_solve(left: ptr<i32>, right_arr: ptr<i32>,
                   parent: ptr<i32>, sz: ptr<i32>, x2p: ptr<i32>,
                   cz: ptr<i32>, co: ptr<i32>,
                   hl: ptr<i32>, hr: ptr<i32>, hrank: ptr<i32>, ch: ptr<i32>,
                   cc: i32) -> i32 {
    let cand: ptr<Candidate> = calloc((cc + 1) as i64, 12)
    let cn_ref: ptr<i32> = calloc(1, 4)
    cn_ref[0] = 0

    let mut chord: i32 = 0
    while chord < cc {
        let le: i32 = left[chord]
        let re: i32 = right_arr[chord]
        let mut current: i32 = chord

        let mut inner: bool = true
        while inner {
            if cn_ref[0] == 0 {
                inner = false
            } else {
                let top: Candidate = cand[0]
                let rt: i32 = sol_root(parent, top.root)

                if rt != top.root {
                    cand_pop(cand, cn_ref)
                } else {
                    let chr: i32 = ch[rt]
                    if chr != top.node || right_arr[top.node] != top.right_end {
                        cand_pop(cand, cn_ref)
                    } else {
                        if rt == sol_root(parent, current) {
                            cand_pop(cand, cn_ref)
                        } else {
                            if top.right_end <= le {
                                cand_pop(cand, cn_ref)
                                while ch[rt] >= 0 && right_arr[ch[rt]] <= le {
                                    ch[rt] = sol_pop_heap(hl, hr, right_arr, hrank, ch[rt])
                                }
                                let nhr: i32 = ch[rt]
                                if nhr >= 0 {
                                    cand_push(cand, cn_ref, Candidate {
                                        right_end: right_arr[nhr],
                                        node: nhr,
                                        root: rt
                                    })
                                }
                            } else {
                                if top.right_end >= re {
                                    inner = false
                                } else {
                                    cand_pop(cand, cn_ref)
                                    current = sol_union_opposite(parent, sz, x2p, cz, co,
                                                                 hl, hr, hrank, ch, right_arr,
                                                                 chord, top.node)
                                }
                            }
                        }
                    }
                }
            }
        }

        current = sol_root(parent, current)
        let chr2: i32 = ch[current]
        if chr2 >= 0 {
            cand_push(cand, cn_ref, Candidate {
                right_end: right_arr[chr2],
                node: chr2,
                root: current
            })
        }
        chord = chord + 1
    }

    let mut answer: i32 = 0
    let mut i: i32 = 0
    while i < cc {
        if parent[i] == i {
            let z: i32 = cz[i]
            let o: i32 = co[i]
            if z > o {
                answer = answer + z
            } else {
                answer = answer + o
            }
        }
        i = i + 1
    }

    free(cand as ptr<void>)
    free(cn_ref as ptr<void>)
    return answer
}

function main() -> i32 {
    let f: ptr<void> = fopen("data/p1002_input.txt", "r")
    if f == null {
        printf("failed to open data/p1002_input.txt\n")
        return 1
    }
    fseek(f, 0, 2)
    let fsz: i64 = ftell(f)
    fseek(f, 0, 0)
    let buf: ptr<i8> = calloc(fsz + 1, 1) as ptr<i8>
    fread(buf as ptr<void>, 1, fsz, f)
    buf[fsz] = 0
    fclose(f)

    let cap: i32 = 200000
    let vals: ptr<i32> = calloc(cap as i64, 4)
    let nv_ref: ptr<i32> = calloc(1, 4)
    nv_ref[0] = 0

    let mut p: i64 = 0
    let mut ch: i8 = buf[p]
    while ch != 0 {
        # skip non-digit, non-minus
        while ch != 0 {
            if ch >= 48 && ch <= 57 { break }
            if ch == 45 { break }
            p = p + 1
            ch = buf[p]
        }
        if ch == 0 { break }
        let mut neg: bool = false
        if ch == 45 {
            neg = true
            p = p + 1
            ch = buf[p]
        }
        let mut v: i32 = 0
        while ch >= 48 && ch <= 57 {
            v = v * 10 + (ch - 48) as i32
            p = p + 1
            ch = buf[p]
        }
        if neg { v = 0 - v }
        if nv_ref[0] >= cap {
            # grow (simplified: just abort if too many)
            printf("too many values\n")
            free(buf as ptr<void>)
            free(vals as ptr<void>)
            free(nv_ref as ptr<void>)
            return 1
        }
        vals[nv_ref[0]] = v
        nv_ref[0] = nv_ref[0] + 1
    }
    free(buf as ptr<void>)

    let nv: i32 = nv_ref[0]
    free(nv_ref as ptr<void>)

    let mut maxv: i32 = 0
    let mut i: i32 = 0
    while i < nv {
        if vals[i] > maxv { maxv = vals[i] }
        i = i + 1
    }

    let cc: i32 = nv / 2
    let left: ptr<i32> = calloc(cc as i64, 4)
    let right_arr: ptr<i32> = calloc(cc as i64, 4)
    let oc: ptr<i32> = calloc((maxv + 1) as i64, 4)
    let mut j: i32 = 0
    while j <= maxv {
        oc[j] = -1
        j = j + 1
    }

    let nc_ref: ptr<i32> = calloc(1, 4)
    nc_ref[0] = 0
    let mut pos: i32 = 0
    while pos < nv {
        let val: i32 = vals[pos]
        let chord_idx: i32 = oc[val]
        if chord_idx < 0 {
            let ch2: i32 = nc_ref[0]
            oc[val] = ch2
            left[ch2] = pos
            right_arr[ch2] = -1
            nc_ref[0] = ch2 + 1
        } else {
            right_arr[chord_idx] = pos
            oc[val] = -1
        }
        pos = pos + 1
    }
    free(oc as ptr<void>)
    free(vals as ptr<void>)
    free(nc_ref as ptr<void>)

    let parent: ptr<i32> = calloc(cc as i64, 4)
    let sz: ptr<i32> = calloc(cc as i64, 4)
    let x2p: ptr<i32> = calloc(cc as i64, 4)
    let cz: ptr<i32> = calloc(cc as i64, 4)
    let co: ptr<i32> = calloc(cc as i64, 4)
    let hl: ptr<i32> = calloc(cc as i64, 4)
    let hr: ptr<i32> = calloc(cc as i64, 4)
    let hrank: ptr<i32> = calloc(cc as i64, 4)
    let ch_arr: ptr<i32> = calloc(cc as i64, 4)

    let mut k: i32 = 0
    while k < cc {
        parent[k] = k
        sz[k] = 1
        x2p[k] = 0
        cz[k] = 1
        co[k] = 0
        hl[k] = -1
        hr[k] = -1
        hrank[k] = 1
        ch_arr[k] = k
        k = k + 1
    }

    let ans: i32 = sol_solve(left, right_arr, parent, sz, x2p, cz, co,
                              hl, hr, hrank, ch_arr, cc)

    printf("%lld\n", ans as i64)

    free(parent as ptr<void>)
    free(sz as ptr<void>)
    free(x2p as ptr<void>)
    free(cz as ptr<void>)
    free(co as ptr<void>)
    free(hl as ptr<void>)
    free(hr as ptr<void>)
    free(hrank as ptr<void>)
    free(ch_arr as ptr<void>)
    free(left as ptr<void>)
    free(right_arr as ptr<void>)
    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 Candidate Candidate;

struct Candidate {
    int32_t right_end;
    int32_t node;
    int32_t root;
};

bool cand_less_Candidate_Candidate(Candidate a, Candidate b);
void cand_push_ptr_Candidate_ptr_i32_Candidate(Candidate* h, int32_t* pn, Candidate c);
Candidate cand_pop_ptr_Candidate_ptr_i32(Candidate* h, int32_t* pn);
int32_t sol_root_ptr_i32_i32(int32_t* parent, int32_t c0);
int32_t sol_parity_ptr_i32_ptr_i32_i32_ptr_i32(int32_t* parent, int32_t* x2p, int32_t c0, int32_t* par_out);
int32_t sol_meld_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(int32_t* right_arr, int32_t* hl, int32_t* hr, int32_t* hrank, int32_t a0, int32_t b0);
int32_t sol_pop_heap_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32(int32_t* hl, int32_t* hr, int32_t* right_arr, int32_t* hrank, int32_t node);
int32_t sol_union_opposite_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(int32_t* parent, int32_t* sz, int32_t* x2p, int32_t* cz, int32_t* co, int32_t* hl, int32_t* hr, int32_t* hrank, int32_t* ch, int32_t* right_arr, int32_t first, int32_t second);
int32_t sol_solve_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32(int32_t* left, int32_t* right_arr, int32_t* parent, int32_t* sz, int32_t* x2p, int32_t* cz, int32_t* co, int32_t* hl, int32_t* hr, int32_t* hrank, int32_t* ch, int32_t cc);
int32_t main(void);








bool cand_less_Candidate_Candidate(Candidate a, Candidate b) {
    if (a.right_end != b.right_end) {
        return a.right_end < b.right_end;
    }
    if (a.node != b.node) {
        return a.node < b.node;
    }
    return a.root < b.root;
}

void cand_push_ptr_Candidate_ptr_i32_Candidate(Candidate* h, int32_t* pn, Candidate c) {
    int32_t n = pn[0];
    int32_t i = n;
    h[i] = c;
    pn[0] = (n + 1);
    int32_t ii = i;
    while (ii > 0) {
        int32_t p = FLOW_CHECKED_DIV(((ii - 1)), (2));
        if (cand_less_Candidate_Candidate(h[ii], h[p])) {
            Candidate t = h[ii];
            h[ii] = h[p];
            h[p] = t;
            ii = p;
        } else {
            ii = 0;
        }
    }
}

Candidate cand_pop_ptr_Candidate_ptr_i32(Candidate* h, int32_t* pn) {
    Candidate top = h[0];
    int32_t n = (pn[0] - 1);
    pn[0] = n;
    h[0] = h[n];
    int32_t i = 0;
    bool cont = 1;
    while (cont) {
        int32_t l = ((2 * i) + 1);
        int32_t r = ((2 * i) + 2);
        int32_t sm = i;
        if ((l < n && cand_less_Candidate_Candidate(h[l], h[sm]))) {
            sm = l;
        }
        if ((r < n && cand_less_Candidate_Candidate(h[r], h[sm]))) {
            sm = r;
        }
        if (sm == i) {
            cont = 0;
        } else {
            Candidate t = h[i];
            h[i] = h[sm];
            h[sm] = t;
            i = sm;
        }
    }
    return top;
}

int32_t sol_root_ptr_i32_i32(int32_t* parent, int32_t c0) {
    int32_t c = c0;
    while (parent[c] != c) {
        c = parent[c];
    }
    return c;
}

int32_t sol_parity_ptr_i32_ptr_i32_i32_ptr_i32(int32_t* parent, int32_t* x2p, int32_t c0, int32_t* par_out) {
    int32_t par = 0;
    int32_t c = c0;
    while (parent[c] != c) {
        par = (par ^ x2p[c]);
        c = parent[c];
    }
    par_out[0] = par;
    return c;
}

int32_t sol_meld_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(int32_t* right_arr, int32_t* hl, int32_t* hr, int32_t* hrank, int32_t a0, int32_t b0) {
    int32_t a = a0;
    int32_t b = b0;
    if (a < 0) {
        return b;
    }
    if (b < 0) {
        return a;
    }
    if (right_arr[a] > right_arr[b]) {
        int32_t t = a;
        a = b;
        b = t;
    }
    hr[a] = sol_meld_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(right_arr, hl, hr, hrank, hr[a], b);
    int32_t lc = hl[a];
    int32_t rc = hr[a];
    int32_t lr = 0;
    if (lc >= 0) {
        lr = hrank[lc];
    }
    int32_t rr = 0;
    if (rc >= 0) {
        rr = hrank[rc];
    }
    if (lr < rr) {
        hl[a] = rc;
        hr[a] = lc;
        int32_t t = lr;
        lr = rr;
        rr = t;
    }
    hrank[a] = (rr + 1);
    return a;
}

int32_t sol_pop_heap_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32(int32_t* hl, int32_t* hr, int32_t* right_arr, int32_t* hrank, int32_t node) {
    return sol_meld_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(right_arr, hl, hr, hrank, hl[node], hr[node]);
}

int32_t sol_union_opposite_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(int32_t* parent, int32_t* sz, int32_t* x2p, int32_t* cz, int32_t* co, int32_t* hl, int32_t* hr, int32_t* hrank, int32_t* ch, int32_t* right_arr, int32_t first, int32_t second) {
    int32_t* fp_ref = (int32_t*)(calloc(1, 4));
    int32_t* sp_ref = (int32_t*)(calloc(1, 4));
    int32_t fr = sol_parity_ptr_i32_ptr_i32_i32_ptr_i32(parent, x2p, first, fp_ref);
    int32_t sr = sol_parity_ptr_i32_ptr_i32_i32_ptr_i32(parent, x2p, second, sp_ref);
    int32_t fp = fp_ref[0];
    int32_t sp = sp_ref[0];
    free(((void*)(fp_ref)));
    free(((void*)(sp_ref)));
    if (fr == sr) {
        return fr;
    }
    int32_t fr2 = fr;
    int32_t sr2 = sr;
    int32_t fp2 = fp;
    int32_t sp2 = sp;
    if (sz[fr2] < sz[sr2]) {
        int32_t t = fr2;
        fr2 = sr2;
        sr2 = t;
        t = fp2;
        fp2 = sp2;
        sp2 = t;
    }
    int32_t shift = ((fp2 ^ sp2) ^ 1);
    parent[sr2] = fr2;
    x2p[sr2] = shift;
    sz[fr2] = (sz[fr2] + sz[sr2]);
    if (shift == 0) {
        cz[fr2] = (cz[fr2] + cz[sr2]);
        co[fr2] = (co[fr2] + co[sr2]);
    } else {
        cz[fr2] = (cz[fr2] + co[sr2]);
        co[fr2] = (co[fr2] + cz[sr2]);
    }
    ch[fr2] = sol_meld_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(right_arr, hl, hr, hrank, ch[fr2], ch[sr2]);
    ch[sr2] = (-1);
    return fr2;
}

int32_t sol_solve_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32(int32_t* left, int32_t* right_arr, int32_t* parent, int32_t* sz, int32_t* x2p, int32_t* cz, int32_t* co, int32_t* hl, int32_t* hr, int32_t* hrank, int32_t* ch, int32_t cc) {
    Candidate* cand = (Candidate*)(calloc(((int64_t)((cc + 1))), 12));
    int32_t* cn_ref = (int32_t*)(calloc(1, 4));
    cn_ref[0] = 0;
    int32_t chord = 0;
    while (chord < cc) {
        int32_t le = left[chord];
        int32_t re = right_arr[chord];
        int32_t current = chord;
        bool inner = 1;
        while (inner) {
            if (cn_ref[0] == 0) {
                inner = 0;
            } else {
                Candidate top = cand[0];
                int32_t rt = sol_root_ptr_i32_i32(parent, top.root);
                if (rt != top.root) {
                    cand_pop_ptr_Candidate_ptr_i32(cand, cn_ref);
                } else {
                    int32_t chr = ch[rt];
                    if ((chr != top.node || right_arr[top.node] != top.right_end)) {
                        cand_pop_ptr_Candidate_ptr_i32(cand, cn_ref);
                    } else {
                        if (rt == sol_root_ptr_i32_i32(parent, current)) {
                            cand_pop_ptr_Candidate_ptr_i32(cand, cn_ref);
                        } else {
                            if (top.right_end <= le) {
                                cand_pop_ptr_Candidate_ptr_i32(cand, cn_ref);
                                while ((ch[rt] >= 0 && right_arr[ch[rt]] <= le)) {
                                    ch[rt] = sol_pop_heap_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32(hl, hr, right_arr, hrank, ch[rt]);
                                }
                                int32_t nhr = ch[rt];
                                if (nhr >= 0) {
                                    cand_push_ptr_Candidate_ptr_i32_Candidate(cand, cn_ref, (Candidate){ .right_end = right_arr[nhr], .node = nhr, .root = rt });
                                }
                            } else {
                                if (top.right_end >= re) {
                                    inner = 0;
                                } else {
                                    cand_pop_ptr_Candidate_ptr_i32(cand, cn_ref);
                                    current = sol_union_opposite_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32_i32(parent, sz, x2p, cz, co, hl, hr, hrank, ch, right_arr, chord, top.node);
                                }
                            }
                        }
                    }
                }
            }
        }
        current = sol_root_ptr_i32_i32(parent, current);
        int32_t chr2 = ch[current];
        if (chr2 >= 0) {
            cand_push_ptr_Candidate_ptr_i32_Candidate(cand, cn_ref, (Candidate){ .right_end = right_arr[chr2], .node = chr2, .root = current });
        }
        chord = (chord + 1);
    }
    int32_t answer = 0;
    int32_t i = 0;
    while (i < cc) {
        if (parent[i] == i) {
            int32_t z = cz[i];
            int32_t o = co[i];
            if (z > o) {
                answer = (answer + z);
            } else {
                answer = (answer + o);
            }
        }
        i = (i + 1);
    }
    free(((void*)(cand)));
    free(((void*)(cn_ref)));
    return answer;
}

int32_t main(void) {
    void* f = (void*)(fopen("data/p1002_input.txt", "r"));
    if (f == NULL) {
        printf("failed to open data/p1002_input.txt\n");
        return 1;
    }
    fseek(f, 0, 2);
    int64_t fsz = ftell(f);
    fseek(f, 0, 0);
    int8_t* buf = (int8_t*)(((int8_t*)(calloc((fsz + 1), 1))));
    fread(((void*)(buf)), 1, fsz, f);
    buf[fsz] = 0;
    fclose(f);
    int32_t cap = 200000;
    int32_t* vals = (int32_t*)(calloc(((int64_t)(cap)), 4));
    int32_t* nv_ref = (int32_t*)(calloc(1, 4));
    nv_ref[0] = 0;
    int64_t p = 0;
    int8_t ch = buf[p];
    while (ch != 0) {
        while (ch != 0) {
            if ((ch >= 48 && ch <= 57)) {
                break;
            }
            if (ch == 45) {
                break;
            }
            p = (p + 1);
            ch = buf[p];
        }
        if (ch == 0) {
            break;
        }
        bool neg = 0;
        if (ch == 45) {
            neg = 1;
            p = (p + 1);
            ch = buf[p];
        }
        int32_t v = 0;
        while ((ch >= 48 && ch <= 57)) {
            v = ((v * 10) + ((int32_t)((ch - 48))));
            p = (p + 1);
            ch = buf[p];
        }
        if (neg) {
            v = (0 - v);
        }
        if (nv_ref[0] >= cap) {
            printf("too many values\n");
            free(((void*)(buf)));
            free(((void*)(vals)));
            free(((void*)(nv_ref)));
            return 1;
        }
        vals[nv_ref[0]] = v;
        nv_ref[0] = (nv_ref[0] + 1);
    }
    free(((void*)(buf)));
    int32_t nv = nv_ref[0];
    free(((void*)(nv_ref)));
    int32_t maxv = 0;
    int32_t i = 0;
    while (i < nv) {
        if (vals[i] > maxv) {
            maxv = vals[i];
        }
        i = (i + 1);
    }
    int32_t cc = FLOW_CHECKED_DIV((nv), (2));
    int32_t* left = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* right_arr = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* oc = (int32_t*)(calloc(((int64_t)((maxv + 1))), 4));
    int32_t j = 0;
    while (j <= maxv) {
        oc[j] = (-1);
        j = (j + 1);
    }
    int32_t* nc_ref = (int32_t*)(calloc(1, 4));
    nc_ref[0] = 0;
    int32_t pos = 0;
    while (pos < nv) {
        int32_t val = vals[pos];
        int32_t chord_idx = oc[val];
        if (chord_idx < 0) {
            int32_t ch2 = nc_ref[0];
            oc[val] = ch2;
            left[ch2] = pos;
            right_arr[ch2] = (-1);
            nc_ref[0] = (ch2 + 1);
        } else {
            right_arr[chord_idx] = pos;
            oc[val] = (-1);
        }
        pos = (pos + 1);
    }
    free(((void*)(oc)));
    free(((void*)(vals)));
    free(((void*)(nc_ref)));
    int32_t* parent = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* sz = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* x2p = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* cz = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* co = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* hl = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* hr = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* hrank = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t* ch_arr = (int32_t*)(calloc(((int64_t)(cc)), 4));
    int32_t k = 0;
    while (k < cc) {
        parent[k] = k;
        sz[k] = 1;
        x2p[k] = 0;
        cz[k] = 1;
        co[k] = 0;
        hl[k] = (-1);
        hr[k] = (-1);
        hrank[k] = 1;
        ch_arr[k] = k;
        k = (k + 1);
    }
    int32_t ans = sol_solve_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32_i32(left, right_arr, parent, sz, x2p, cz, co, hl, hr, hrank, ch_arr, cc);
    printf("%lld\n", ((int64_t)(ans)));
    free(((void*)(parent)));
    free(((void*)(sz)));
    free(((void*)(x2p)));
    free(((void*)(cz)));
    free(((void*)(co)));
    free(((void*)(hl)));
    free(((void*)(hr)));
    free(((void*)(hrank)));
    free(((void*)(ch_arr)));
    free(((void*)(left)));
    free(((void*)(right_arr)));
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("data/p1002_input.txt\00") {addr_space = 0 : i32} : !llvm.array<21 x i8>
  llvm.mlir.global internal constant @str_1("r\00") {addr_space = 0 : i32} : !llvm.array<2 x i8>
  llvm.mlir.global internal constant @str_2("failed to open data/p1002_input.txt\n\00") {addr_space = 0 : i32} : !llvm.array<37 x i8>
  llvm.mlir.global internal constant @str_3("too many values\n\00") {addr_space = 0 : i32} : !llvm.array<17 x i8>
  llvm.mlir.global internal constant @str_4("%lld\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func private @fopen(!llvm.ptr, !llvm.ptr) -> !llvm.ptr
  func.func private @fclose(!llvm.ptr) -> i32
  func.func private @fseek(!llvm.ptr, i64, i32) -> i32
  func.func private @ftell(!llvm.ptr) -> i64
  func.func private @fread(!llvm.ptr, i64, i64, !llvm.ptr) -> i64
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  // Struct: Candidate
  // Fields:
  //   right_end: i32
  //   node: i32
  //   root: i32
  func.func @cand_less(%arg0: !llvm.struct<(i32, i32, i32)>, %arg1: !llvm.struct<(i32, i32, i32)>) -> i1 {
    %0 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
    %1 = llvm.extractvalue %arg0[0] : !llvm.struct<(i32, i32, i32)>
    %2 = llvm.insertvalue %1, %0[0] : !llvm.struct<(i32, i32, i32)>
    %3 = llvm.extractvalue %arg0[1] : !llvm.struct<(i32, i32, i32)>
    %4 = llvm.insertvalue %3, %2[1] : !llvm.struct<(i32, i32, i32)>
    %5 = llvm.extractvalue %arg0[2] : !llvm.struct<(i32, i32, i32)>
    %6 = llvm.insertvalue %5, %4[2] : !llvm.struct<(i32, i32, i32)>
    %7 = llvm.mlir.constant(1 : i64) : i64
    %8 = llvm.alloca %7 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %6, %8 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
    %9 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
    %10 = llvm.extractvalue %arg1[0] : !llvm.struct<(i32, i32, i32)>
    %11 = llvm.insertvalue %10, %9[0] : !llvm.struct<(i32, i32, i32)>
    %12 = llvm.extractvalue %arg1[1] : !llvm.struct<(i32, i32, i32)>
    %13 = llvm.insertvalue %12, %11[1] : !llvm.struct<(i32, i32, i32)>
    %14 = llvm.extractvalue %arg1[2] : !llvm.struct<(i32, i32, i32)>
    %15 = llvm.insertvalue %14, %13[2] : !llvm.struct<(i32, i32, i32)>
    %16 = llvm.mlir.constant(1 : i64) : i64
    %17 = llvm.alloca %16 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %15, %17 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
    %18 = llvm.load %8 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %19 = llvm.getelementptr %8[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %20 = llvm.load %19 : !llvm.ptr -> i32
    %21 = llvm.load %17 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %22 = llvm.getelementptr %17[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %23 = llvm.load %22 : !llvm.ptr -> i32
    %24 = arith.cmpi ne, %20, %23 : i32
    cf.cond_br %24, ^bb0, ^bb1
    ^bb0:
      %25 = llvm.load %8 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
      %26 = llvm.getelementptr %8[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
      %27 = llvm.load %26 : !llvm.ptr -> i32
      %28 = llvm.load %17 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
      %29 = llvm.getelementptr %17[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
      %30 = llvm.load %29 : !llvm.ptr -> i32
      %31 = arith.cmpi slt, %27, %30 : i32
      func.return %31 : i1
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %32 = llvm.load %8 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %33 = llvm.getelementptr %8[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %34 = llvm.load %33 : !llvm.ptr -> i32
    %35 = llvm.load %17 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %36 = llvm.getelementptr %17[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %37 = llvm.load %36 : !llvm.ptr -> i32
    %38 = arith.cmpi ne, %34, %37 : i32
    cf.cond_br %38, ^bb3, ^bb4
    ^bb3:
      %39 = llvm.load %8 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
      %40 = llvm.getelementptr %8[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
      %41 = llvm.load %40 : !llvm.ptr -> i32
      %42 = llvm.load %17 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
      %43 = llvm.getelementptr %17[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
      %44 = llvm.load %43 : !llvm.ptr -> i32
      %45 = arith.cmpi slt, %41, %44 : i32
      func.return %45 : i1
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %46 = llvm.load %8 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %47 = llvm.getelementptr %8[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %48 = llvm.load %47 : !llvm.ptr -> i32
    %49 = llvm.load %17 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %50 = llvm.getelementptr %17[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %51 = llvm.load %50 : !llvm.ptr -> i32
    %52 = arith.cmpi slt, %48, %51 : i32
    func.return %52 : i1
  }
  func.func @cand_push(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.struct<(i32, i32, i32)>) -> () {
    %53 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
    %54 = llvm.extractvalue %arg2[0] : !llvm.struct<(i32, i32, i32)>
    %55 = llvm.insertvalue %54, %53[0] : !llvm.struct<(i32, i32, i32)>
    %56 = llvm.extractvalue %arg2[1] : !llvm.struct<(i32, i32, i32)>
    %57 = llvm.insertvalue %56, %55[1] : !llvm.struct<(i32, i32, i32)>
    %58 = llvm.extractvalue %arg2[2] : !llvm.struct<(i32, i32, i32)>
    %59 = llvm.insertvalue %58, %57[2] : !llvm.struct<(i32, i32, i32)>
    %60 = llvm.mlir.constant(1 : i64) : i64
    %61 = llvm.alloca %60 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %59, %61 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
    %63 = arith.constant 0 : i32
    %64 = arith.extsi %63 : i32 to i64
    %65 = llvm.getelementptr %arg1[%64] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %62 = llvm.load %65 : !llvm.ptr -> i32
    %66 = llvm.load %61 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %67 = arith.extsi %62 : i32 to i64
    %68 = llvm.getelementptr %arg0[%67] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    llvm.store %66, %68 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
    %69 = arith.constant 1 : i32
    %70 = arith.addi %62, %69 : i32
    %71 = arith.constant 0 : i32
    %72 = arith.extsi %71 : i32 to i64
    %73 = llvm.getelementptr %arg1[%72] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %70, %73 : i32, !llvm.ptr
    %74 = llvm.mlir.constant(1 : i64) : i64
    %75 = llvm.alloca %74 x i32 : (i64) -> !llvm.ptr
    llvm.store %62, %75 : i32, !llvm.ptr
    cf.br ^bb6
    ^bb6:
    %76 = llvm.load %75 : !llvm.ptr -> i32
    %77 = arith.constant 0 : i32
    %78 = arith.cmpi sgt, %76, %77 : i32
    cf.cond_br %78, ^bb7, ^bb8
    ^bb7:
      %79 = llvm.load %75 : !llvm.ptr -> i32
      %80 = arith.constant 1 : i32
      %81 = arith.subi %79, %80 : i32
      %82 = arith.constant 2 : i32
      %83 = arith.divsi %81, %82 : i32
      %86 = llvm.load %75 : !llvm.ptr -> i32
      %87 = arith.extsi %86 : i32 to i64
      %88 = llvm.getelementptr %arg0[%87] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
      %85 = llvm.load %88 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
      %90 = arith.extsi %83 : i32 to i64
      %91 = llvm.getelementptr %arg0[%90] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
      %89 = llvm.load %91 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
      %84 = func.call @cand_less(%85, %89) : (!llvm.struct<(i32, i32, i32)>, !llvm.struct<(i32, i32, i32)>) -> i1
      cf.cond_br %84, ^bb9, ^bb10
      ^bb9:
        %93 = llvm.load %75 : !llvm.ptr -> i32
        %94 = arith.extsi %93 : i32 to i64
        %95 = llvm.getelementptr %arg0[%94] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %92 = llvm.load %95 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %96 = llvm.mlir.constant(1 : i64) : i64
        %97 = llvm.alloca %96 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
        llvm.store %92, %97 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
        %99 = arith.extsi %83 : i32 to i64
        %100 = llvm.getelementptr %arg0[%99] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %98 = llvm.load %100 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %101 = llvm.load %75 : !llvm.ptr -> i32
        %102 = arith.extsi %101 : i32 to i64
        %103 = llvm.getelementptr %arg0[%102] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        llvm.store %98, %103 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
        %104 = llvm.load %97 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %105 = arith.extsi %83 : i32 to i64
        %106 = llvm.getelementptr %arg0[%105] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        llvm.store %104, %106 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
        llvm.store %83, %75 : i32, !llvm.ptr
        cf.br ^bb11
      ^bb10:
        %107 = arith.constant 0 : i32
        llvm.store %107, %75 : i32, !llvm.ptr
        cf.br ^bb11
      ^bb11:
      cf.br ^bb6
    ^bb8:
    func.return
  }
  func.func @cand_pop(%arg0: !llvm.ptr, %arg1: !llvm.ptr) -> !llvm.struct<(i32, i32, i32)> {
    %109 = arith.constant 0 : i32
    %110 = arith.extsi %109 : i32 to i64
    %111 = llvm.getelementptr %arg0[%110] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %108 = llvm.load %111 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %112 = llvm.mlir.constant(1 : i64) : i64
    %113 = llvm.alloca %112 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %108, %113 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
    %115 = arith.constant 0 : i32
    %116 = arith.extsi %115 : i32 to i64
    %117 = llvm.getelementptr %arg1[%116] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %114 = llvm.load %117 : !llvm.ptr -> i32
    %118 = arith.constant 1 : i32
    %119 = arith.subi %114, %118 : i32
    %120 = arith.constant 0 : i32
    %121 = arith.extsi %120 : i32 to i64
    %122 = llvm.getelementptr %arg1[%121] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %119, %122 : i32, !llvm.ptr
    %124 = arith.extsi %119 : i32 to i64
    %125 = llvm.getelementptr %arg0[%124] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    %123 = llvm.load %125 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %126 = arith.constant 0 : i32
    %127 = arith.extsi %126 : i32 to i64
    %128 = llvm.getelementptr %arg0[%127] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
    llvm.store %123, %128 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
    %129 = arith.constant 0 : i32
    %130 = llvm.mlir.constant(1 : i64) : i64
    %131 = llvm.alloca %130 x i32 : (i64) -> !llvm.ptr
    llvm.store %129, %131 : i32, !llvm.ptr
    %132 = arith.constant 1 : i1
    %133 = llvm.mlir.constant(1 : i64) : i64
    %134 = llvm.alloca %133 x i1 : (i64) -> !llvm.ptr
    llvm.store %132, %134 : i1, !llvm.ptr
    cf.br ^bb12
    ^bb12:
    %135 = llvm.load %134 : !llvm.ptr -> i1
    cf.cond_br %135, ^bb13, ^bb14
    ^bb13:
      %136 = arith.constant 2 : i32
      %137 = llvm.load %131 : !llvm.ptr -> i32
      %138 = arith.muli %136, %137 : i32
      %139 = arith.constant 1 : i32
      %140 = arith.addi %138, %139 : i32
      %141 = arith.constant 2 : i32
      %142 = llvm.load %131 : !llvm.ptr -> i32
      %143 = arith.muli %141, %142 : i32
      %144 = arith.constant 2 : i32
      %145 = arith.addi %143, %144 : i32
      %146 = llvm.load %131 : !llvm.ptr -> i32
      %147 = arith.cmpi slt, %140, %119 : i32
      %148 = scf.if %147 -> (i1) {
        %151 = arith.extsi %140 : i32 to i64
        %152 = llvm.getelementptr %arg0[%151] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %150 = llvm.load %152 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %154 = arith.extsi %146 : i32 to i64
        %155 = llvm.getelementptr %arg0[%154] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %153 = llvm.load %155 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %149 = func.call @cand_less(%150, %153) : (!llvm.struct<(i32, i32, i32)>, !llvm.struct<(i32, i32, i32)>) -> i1
        scf.yield %149 : i1
      } else {
        %156 = arith.constant false
        scf.yield %156 : i1
      }
      %157 = scf.if %148 -> (i32) {
        scf.yield %140 : i32
      } else {
        scf.yield %146 : i32
      }
      %158 = arith.cmpi slt, %145, %119 : i32
      %159 = scf.if %158 -> (i1) {
        %162 = arith.extsi %145 : i32 to i64
        %163 = llvm.getelementptr %arg0[%162] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %161 = llvm.load %163 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %165 = arith.extsi %157 : i32 to i64
        %166 = llvm.getelementptr %arg0[%165] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %164 = llvm.load %166 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %160 = func.call @cand_less(%161, %164) : (!llvm.struct<(i32, i32, i32)>, !llvm.struct<(i32, i32, i32)>) -> i1
        scf.yield %160 : i1
      } else {
        %167 = arith.constant false
        scf.yield %167 : i1
      }
      %168 = scf.if %159 -> (i32) {
        scf.yield %145 : i32
      } else {
        scf.yield %157 : i32
      }
      %169 = llvm.load %131 : !llvm.ptr -> i32
      %170 = arith.cmpi eq, %168, %169 : i32
      cf.cond_br %170, ^bb15, ^bb16
      ^bb15:
        %171 = arith.constant 0 : i1
        llvm.store %171, %134 : i1, !llvm.ptr
        cf.br ^bb17
      ^bb16:
        %173 = llvm.load %131 : !llvm.ptr -> i32
        %174 = arith.extsi %173 : i32 to i64
        %175 = llvm.getelementptr %arg0[%174] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %172 = llvm.load %175 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %176 = llvm.mlir.constant(1 : i64) : i64
        %177 = llvm.alloca %176 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
        llvm.store %172, %177 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
        %179 = arith.extsi %168 : i32 to i64
        %180 = llvm.getelementptr %arg0[%179] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        %178 = llvm.load %180 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %181 = llvm.load %131 : !llvm.ptr -> i32
        %182 = arith.extsi %181 : i32 to i64
        %183 = llvm.getelementptr %arg0[%182] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        llvm.store %178, %183 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
        %184 = llvm.load %177 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
        %185 = arith.extsi %168 : i32 to i64
        %186 = llvm.getelementptr %arg0[%185] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
        llvm.store %184, %186 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
        llvm.store %168, %131 : i32, !llvm.ptr
        cf.br ^bb17
      ^bb17:
      cf.br ^bb12
    ^bb14:
    %187 = llvm.load %113 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    %188 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
    %189 = llvm.extractvalue %187[0] : !llvm.struct<(i32, i32, i32)>
    %190 = llvm.insertvalue %189, %188[0] : !llvm.struct<(i32, i32, i32)>
    %191 = llvm.extractvalue %187[1] : !llvm.struct<(i32, i32, i32)>
    %192 = llvm.insertvalue %191, %190[1] : !llvm.struct<(i32, i32, i32)>
    %193 = llvm.extractvalue %187[2] : !llvm.struct<(i32, i32, i32)>
    %194 = llvm.insertvalue %193, %192[2] : !llvm.struct<(i32, i32, i32)>
    %195 = llvm.mlir.constant(1 : i64) : i64
    %196 = llvm.alloca %195 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %194, %196 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
    %197 = llvm.load %196 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
    func.return %197 : !llvm.struct<(i32, i32, i32)>
  }
  func.func @sol_root(%arg0: !llvm.ptr, %arg1: i32) -> i32 {
    %198 = llvm.mlir.constant(1 : i64) : i64
    %199 = llvm.alloca %198 x i32 : (i64) -> !llvm.ptr
    llvm.store %arg1, %199 : i32, !llvm.ptr
    cf.br ^bb18
    ^bb18:
    %201 = llvm.load %199 : !llvm.ptr -> i32
    %202 = arith.extsi %201 : i32 to i64
    %203 = llvm.getelementptr %arg0[%202] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %200 = llvm.load %203 : !llvm.ptr -> i32
    %204 = llvm.load %199 : !llvm.ptr -> i32
    %205 = arith.cmpi ne, %200, %204 : i32
    cf.cond_br %205, ^bb19, ^bb20
    ^bb19:
      %207 = llvm.load %199 : !llvm.ptr -> i32
      %208 = arith.extsi %207 : i32 to i64
      %209 = llvm.getelementptr %arg0[%208] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %206 = llvm.load %209 : !llvm.ptr -> i32
      llvm.store %206, %199 : i32, !llvm.ptr
      cf.br ^bb18
    ^bb20:
    %210 = llvm.load %199 : !llvm.ptr -> i32
    func.return %210 : i32
  }
  func.func @sol_parity(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i32, %arg3: !llvm.ptr) -> i32 {
    %211 = arith.constant 0 : i32
    %212 = llvm.mlir.constant(1 : i64) : i64
    %213 = llvm.alloca %212 x i32 : (i64) -> !llvm.ptr
    llvm.store %211, %213 : i32, !llvm.ptr
    %214 = llvm.mlir.constant(1 : i64) : i64
    %215 = llvm.alloca %214 x i32 : (i64) -> !llvm.ptr
    llvm.store %arg2, %215 : i32, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %217 = llvm.load %215 : !llvm.ptr -> i32
    %218 = arith.extsi %217 : i32 to i64
    %219 = llvm.getelementptr %arg0[%218] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %216 = llvm.load %219 : !llvm.ptr -> i32
    %220 = llvm.load %215 : !llvm.ptr -> i32
    %221 = arith.cmpi ne, %216, %220 : i32
    cf.cond_br %221, ^bb22, ^bb23
    ^bb22:
      %222 = llvm.load %213 : !llvm.ptr -> i32
      %224 = llvm.load %215 : !llvm.ptr -> i32
      %225 = arith.extsi %224 : i32 to i64
      %226 = llvm.getelementptr %arg1[%225] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %223 = llvm.load %226 : !llvm.ptr -> i32
      %227 = arith.xori %222, %223 : i32
      llvm.store %227, %213 : i32, !llvm.ptr
      %229 = llvm.load %215 : !llvm.ptr -> i32
      %230 = arith.extsi %229 : i32 to i64
      %231 = llvm.getelementptr %arg0[%230] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %228 = llvm.load %231 : !llvm.ptr -> i32
      llvm.store %228, %215 : i32, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %232 = llvm.load %213 : !llvm.ptr -> i32
    %233 = arith.constant 0 : i32
    %234 = arith.extsi %233 : i32 to i64
    %235 = llvm.getelementptr %arg3[%234] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %232, %235 : i32, !llvm.ptr
    %236 = llvm.load %215 : !llvm.ptr -> i32
    func.return %236 : i32
  }
  func.func @sol_meld(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: i32, %arg5: i32) -> i32 {
    %237 = arith.constant 0 : i32
    %238 = arith.cmpi slt, %arg4, %237 : i32
    cf.cond_br %238, ^bb24, ^bb25
    ^bb24:
      func.return %arg5 : i32
    ^bb25:
      cf.br ^bb26
    ^bb26:
    %239 = arith.constant 0 : i32
    %240 = arith.cmpi slt, %arg5, %239 : i32
    cf.cond_br %240, ^bb27, ^bb28
    ^bb27:
      func.return %arg4 : i32
    ^bb28:
      cf.br ^bb29
    ^bb29:
    %242 = arith.extsi %arg4 : i32 to i64
    %243 = llvm.getelementptr %arg0[%242] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %241 = llvm.load %243 : !llvm.ptr -> i32
    %245 = arith.extsi %arg5 : i32 to i64
    %246 = llvm.getelementptr %arg0[%245] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %244 = llvm.load %246 : !llvm.ptr -> i32
    %247 = arith.cmpi sgt, %241, %244 : i32
    %248, %249 = scf.if %247 -> (i32, i32) {
      scf.yield %arg5, %arg4 : i32, i32
    } else {
      scf.yield %arg4, %arg5 : i32, i32
    }
    %252 = arith.extsi %248 : i32 to i64
    %253 = llvm.getelementptr %arg2[%252] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %251 = llvm.load %253 : !llvm.ptr -> i32
    %250 = func.call @sol_meld(%arg0, %arg1, %arg2, %arg3, %251, %249) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i32, i32) -> i32
    %254 = arith.extsi %248 : i32 to i64
    %255 = llvm.getelementptr %arg2[%254] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %250, %255 : i32, !llvm.ptr
    %257 = arith.extsi %248 : i32 to i64
    %258 = llvm.getelementptr %arg1[%257] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %256 = llvm.load %258 : !llvm.ptr -> i32
    %260 = arith.extsi %248 : i32 to i64
    %261 = llvm.getelementptr %arg2[%260] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %259 = llvm.load %261 : !llvm.ptr -> i32
    %262 = arith.constant 0 : i32
    %263 = arith.constant 0 : i32
    %264 = arith.cmpi sge, %256, %263 : i32
    %265 = scf.if %264 -> (i32) {
      %267 = arith.extsi %256 : i32 to i64
      %268 = llvm.getelementptr %arg3[%267] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %266 = llvm.load %268 : !llvm.ptr -> i32
      scf.yield %266 : i32
    } else {
      scf.yield %262 : i32
    }
    %269 = arith.constant 0 : i32
    %270 = arith.constant 0 : i32
    %271 = arith.cmpi sge, %259, %270 : i32
    %272 = scf.if %271 -> (i32) {
      %274 = arith.extsi %259 : i32 to i64
      %275 = llvm.getelementptr %arg3[%274] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %273 = llvm.load %275 : !llvm.ptr -> i32
      scf.yield %273 : i32
    } else {
      scf.yield %269 : i32
    }
    %276 = arith.cmpi slt, %265, %272 : i32
    %277, %278 = scf.if %276 -> (i32, i32) {
      %279 = arith.extsi %248 : i32 to i64
      %280 = llvm.getelementptr %arg1[%279] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %259, %280 : i32, !llvm.ptr
      %281 = arith.extsi %248 : i32 to i64
      %282 = llvm.getelementptr %arg2[%281] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %256, %282 : i32, !llvm.ptr
      scf.yield %272, %265 : i32, i32
    } else {
      scf.yield %265, %272 : i32, i32
    }
    %283 = arith.constant 1 : i32
    %284 = arith.addi %278, %283 : i32
    %285 = arith.extsi %248 : i32 to i64
    %286 = llvm.getelementptr %arg3[%285] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %284, %286 : i32, !llvm.ptr
    func.return %248 : i32
  }
  func.func @sol_pop_heap(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: i32) -> i32 {
    %289 = arith.extsi %arg4 : i32 to i64
    %290 = llvm.getelementptr %arg0[%289] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %288 = llvm.load %290 : !llvm.ptr -> i32
    %292 = arith.extsi %arg4 : i32 to i64
    %293 = llvm.getelementptr %arg1[%292] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %291 = llvm.load %293 : !llvm.ptr -> i32
    %287 = func.call @sol_meld(%arg2, %arg0, %arg1, %arg3, %288, %291) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i32, i32) -> i32
    func.return %287 : i32
  }
  func.func @sol_union_opposite(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: !llvm.ptr, %arg9: !llvm.ptr, %arg10: i32, %arg11: i32) -> i32 {
    %295 = arith.constant 1 : i32
    %296 = arith.constant 4 : i32
    %297 = arith.extsi %295 : i32 to i64
    %298 = arith.extsi %296 : i32 to i64
    %294 = func.call @calloc(%297, %298) : (i64, i64) -> !llvm.ptr
    %300 = arith.constant 1 : i32
    %301 = arith.constant 4 : i32
    %302 = arith.extsi %300 : i32 to i64
    %303 = arith.extsi %301 : i32 to i64
    %299 = func.call @calloc(%302, %303) : (i64, i64) -> !llvm.ptr
    %304 = func.call @sol_parity(%arg0, %arg2, %arg10, %294) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr) -> i32
    %305 = func.call @sol_parity(%arg0, %arg2, %arg11, %299) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr) -> i32
    %307 = arith.constant 0 : i32
    %308 = arith.extsi %307 : i32 to i64
    %309 = llvm.getelementptr %294[%308] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %306 = llvm.load %309 : !llvm.ptr -> i32
    %311 = arith.constant 0 : i32
    %312 = arith.extsi %311 : i32 to i64
    %313 = llvm.getelementptr %299[%312] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %310 = llvm.load %313 : !llvm.ptr -> i32
    func.call @free(%294) : (!llvm.ptr) -> ()
    func.call @free(%299) : (!llvm.ptr) -> ()
    %316 = arith.cmpi eq, %304, %305 : i32
    cf.cond_br %316, ^bb30, ^bb31
    ^bb30:
      func.return %304 : i32
    ^bb31:
      cf.br ^bb32
    ^bb32:
    %317 = llvm.mlir.constant(1 : i64) : i64
    %318 = llvm.alloca %317 x i32 : (i64) -> !llvm.ptr
    llvm.store %304, %318 : i32, !llvm.ptr
    %319 = llvm.mlir.constant(1 : i64) : i64
    %320 = llvm.alloca %319 x i32 : (i64) -> !llvm.ptr
    llvm.store %305, %320 : i32, !llvm.ptr
    %321 = llvm.mlir.constant(1 : i64) : i64
    %322 = llvm.alloca %321 x i32 : (i64) -> !llvm.ptr
    llvm.store %306, %322 : i32, !llvm.ptr
    %323 = llvm.mlir.constant(1 : i64) : i64
    %324 = llvm.alloca %323 x i32 : (i64) -> !llvm.ptr
    llvm.store %310, %324 : i32, !llvm.ptr
    %326 = llvm.load %318 : !llvm.ptr -> i32
    %327 = arith.extsi %326 : i32 to i64
    %328 = llvm.getelementptr %arg1[%327] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %325 = llvm.load %328 : !llvm.ptr -> i32
    %330 = llvm.load %320 : !llvm.ptr -> i32
    %331 = arith.extsi %330 : i32 to i64
    %332 = llvm.getelementptr %arg1[%331] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %329 = llvm.load %332 : !llvm.ptr -> i32
    %333 = arith.cmpi slt, %325, %329 : i32
    cf.cond_br %333, ^bb33, ^bb34
    ^bb33:
      %334 = llvm.load %318 : !llvm.ptr -> i32
      %335 = llvm.load %320 : !llvm.ptr -> i32
      llvm.store %335, %318 : i32, !llvm.ptr
      llvm.store %334, %320 : i32, !llvm.ptr
      %336 = llvm.load %322 : !llvm.ptr -> i32
      %337 = llvm.load %324 : !llvm.ptr -> i32
      llvm.store %337, %322 : i32, !llvm.ptr
      llvm.store %336, %324 : i32, !llvm.ptr
      cf.br ^bb35
    ^bb34:
      cf.br ^bb35
    ^bb35:
    %338 = llvm.load %322 : !llvm.ptr -> i32
    %339 = llvm.load %324 : !llvm.ptr -> i32
    %340 = arith.xori %338, %339 : i32
    %341 = arith.constant 1 : i32
    %342 = arith.xori %340, %341 : i32
    %343 = llvm.load %318 : !llvm.ptr -> i32
    %344 = llvm.load %320 : !llvm.ptr -> i32
    %345 = arith.extsi %344 : i32 to i64
    %346 = llvm.getelementptr %arg0[%345] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %343, %346 : i32, !llvm.ptr
    %347 = llvm.load %320 : !llvm.ptr -> i32
    %348 = arith.extsi %347 : i32 to i64
    %349 = llvm.getelementptr %arg2[%348] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %342, %349 : i32, !llvm.ptr
    %351 = llvm.load %318 : !llvm.ptr -> i32
    %352 = arith.extsi %351 : i32 to i64
    %353 = llvm.getelementptr %arg1[%352] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %350 = llvm.load %353 : !llvm.ptr -> i32
    %355 = llvm.load %320 : !llvm.ptr -> i32
    %356 = arith.extsi %355 : i32 to i64
    %357 = llvm.getelementptr %arg1[%356] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %354 = llvm.load %357 : !llvm.ptr -> i32
    %358 = arith.addi %350, %354 : i32
    %359 = llvm.load %318 : !llvm.ptr -> i32
    %360 = arith.extsi %359 : i32 to i64
    %361 = llvm.getelementptr %arg1[%360] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %358, %361 : i32, !llvm.ptr
    %362 = arith.constant 0 : i32
    %363 = arith.cmpi eq, %342, %362 : i32
    cf.cond_br %363, ^bb36, ^bb37
    ^bb36:
      %365 = llvm.load %318 : !llvm.ptr -> i32
      %366 = arith.extsi %365 : i32 to i64
      %367 = llvm.getelementptr %arg3[%366] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %364 = llvm.load %367 : !llvm.ptr -> i32
      %369 = llvm.load %320 : !llvm.ptr -> i32
      %370 = arith.extsi %369 : i32 to i64
      %371 = llvm.getelementptr %arg3[%370] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %368 = llvm.load %371 : !llvm.ptr -> i32
      %372 = arith.addi %364, %368 : i32
      %373 = llvm.load %318 : !llvm.ptr -> i32
      %374 = arith.extsi %373 : i32 to i64
      %375 = llvm.getelementptr %arg3[%374] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %372, %375 : i32, !llvm.ptr
      %377 = llvm.load %318 : !llvm.ptr -> i32
      %378 = arith.extsi %377 : i32 to i64
      %379 = llvm.getelementptr %arg4[%378] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %376 = llvm.load %379 : !llvm.ptr -> i32
      %381 = llvm.load %320 : !llvm.ptr -> i32
      %382 = arith.extsi %381 : i32 to i64
      %383 = llvm.getelementptr %arg4[%382] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %380 = llvm.load %383 : !llvm.ptr -> i32
      %384 = arith.addi %376, %380 : i32
      %385 = llvm.load %318 : !llvm.ptr -> i32
      %386 = arith.extsi %385 : i32 to i64
      %387 = llvm.getelementptr %arg4[%386] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %384, %387 : i32, !llvm.ptr
      cf.br ^bb38
    ^bb37:
      %389 = llvm.load %318 : !llvm.ptr -> i32
      %390 = arith.extsi %389 : i32 to i64
      %391 = llvm.getelementptr %arg3[%390] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %388 = llvm.load %391 : !llvm.ptr -> i32
      %393 = llvm.load %320 : !llvm.ptr -> i32
      %394 = arith.extsi %393 : i32 to i64
      %395 = llvm.getelementptr %arg4[%394] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %392 = llvm.load %395 : !llvm.ptr -> i32
      %396 = arith.addi %388, %392 : i32
      %397 = llvm.load %318 : !llvm.ptr -> i32
      %398 = arith.extsi %397 : i32 to i64
      %399 = llvm.getelementptr %arg3[%398] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %396, %399 : i32, !llvm.ptr
      %401 = llvm.load %318 : !llvm.ptr -> i32
      %402 = arith.extsi %401 : i32 to i64
      %403 = llvm.getelementptr %arg4[%402] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %400 = llvm.load %403 : !llvm.ptr -> i32
      %405 = llvm.load %320 : !llvm.ptr -> i32
      %406 = arith.extsi %405 : i32 to i64
      %407 = llvm.getelementptr %arg3[%406] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %404 = llvm.load %407 : !llvm.ptr -> i32
      %408 = arith.addi %400, %404 : i32
      %409 = llvm.load %318 : !llvm.ptr -> i32
      %410 = arith.extsi %409 : i32 to i64
      %411 = llvm.getelementptr %arg4[%410] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %408, %411 : i32, !llvm.ptr
      cf.br ^bb38
    ^bb38:
    %414 = llvm.load %318 : !llvm.ptr -> i32
    %415 = arith.extsi %414 : i32 to i64
    %416 = llvm.getelementptr %arg8[%415] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %413 = llvm.load %416 : !llvm.ptr -> i32
    %418 = llvm.load %320 : !llvm.ptr -> i32
    %419 = arith.extsi %418 : i32 to i64
    %420 = llvm.getelementptr %arg8[%419] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %417 = llvm.load %420 : !llvm.ptr -> i32
    %412 = func.call @sol_meld(%arg9, %arg5, %arg6, %arg7, %413, %417) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i32, i32) -> i32
    %421 = llvm.load %318 : !llvm.ptr -> i32
    %422 = arith.extsi %421 : i32 to i64
    %423 = llvm.getelementptr %arg8[%422] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %412, %423 : i32, !llvm.ptr
    %424 = arith.constant 1 : i32
    %426 = arith.constant 0 : i32
    %425 = arith.subi %426, %424 : i32
    %427 = llvm.load %320 : !llvm.ptr -> i32
    %428 = arith.extsi %427 : i32 to i64
    %429 = llvm.getelementptr %arg8[%428] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %425, %429 : i32, !llvm.ptr
    %430 = llvm.load %318 : !llvm.ptr -> i32
    func.return %430 : i32
  }
  func.func @sol_solve(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: !llvm.ptr, %arg9: !llvm.ptr, %arg10: !llvm.ptr, %arg11: i32) -> i32 {
    %432 = arith.constant 1 : i32
    %433 = arith.addi %arg11, %432 : i32
    %434 = arith.extsi %433 : i32 to i64
    %435 = arith.constant 12 : i32
    %436 = arith.extsi %435 : i32 to i64
    %431 = func.call @calloc(%434, %436) : (i64, i64) -> !llvm.ptr
    %438 = arith.constant 1 : i32
    %439 = arith.constant 4 : i32
    %440 = arith.extsi %438 : i32 to i64
    %441 = arith.extsi %439 : i32 to i64
    %437 = func.call @calloc(%440, %441) : (i64, i64) -> !llvm.ptr
    %442 = arith.constant 0 : i32
    %443 = arith.constant 0 : i32
    %444 = arith.extsi %443 : i32 to i64
    %445 = llvm.getelementptr %437[%444] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %442, %445 : i32, !llvm.ptr
    %446 = arith.constant 0 : i32
    %447 = llvm.mlir.constant(1 : i64) : i64
    %448 = llvm.alloca %447 x i32 : (i64) -> !llvm.ptr
    llvm.store %446, %448 : i32, !llvm.ptr
    cf.br ^bb39
    ^bb39:
    %449 = llvm.load %448 : !llvm.ptr -> i32
    %450 = arith.cmpi slt, %449, %arg11 : i32
    cf.cond_br %450, ^bb40, ^bb41
    ^bb40:
      %452 = llvm.load %448 : !llvm.ptr -> i32
      %453 = arith.extsi %452 : i32 to i64
      %454 = llvm.getelementptr %arg0[%453] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %451 = llvm.load %454 : !llvm.ptr -> i32
      %456 = llvm.load %448 : !llvm.ptr -> i32
      %457 = arith.extsi %456 : i32 to i64
      %458 = llvm.getelementptr %arg1[%457] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %455 = llvm.load %458 : !llvm.ptr -> i32
      %459 = llvm.load %448 : !llvm.ptr -> i32
      %460 = llvm.mlir.constant(1 : i64) : i64
      %461 = llvm.alloca %460 x i32 : (i64) -> !llvm.ptr
      llvm.store %459, %461 : i32, !llvm.ptr
      %462 = arith.constant 1 : i1
      %463 = llvm.mlir.constant(1 : i64) : i64
      %464 = llvm.alloca %463 x i1 : (i64) -> !llvm.ptr
      llvm.store %462, %464 : i1, !llvm.ptr
      cf.br ^bb42
      ^bb42:
      %465 = llvm.load %464 : !llvm.ptr -> i1
      cf.cond_br %465, ^bb43, ^bb44
      ^bb43:
        %467 = arith.constant 0 : i32
        %468 = arith.extsi %467 : i32 to i64
        %469 = llvm.getelementptr %437[%468] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %466 = llvm.load %469 : !llvm.ptr -> i32
        %470 = arith.constant 0 : i32
        %471 = arith.cmpi eq, %466, %470 : i32
        cf.cond_br %471, ^bb45, ^bb46
        ^bb45:
          %472 = arith.constant 0 : i1
          llvm.store %472, %464 : i1, !llvm.ptr
          cf.br ^bb47
        ^bb46:
          %474 = arith.constant 0 : i32
          %475 = arith.extsi %474 : i32 to i64
          %476 = llvm.getelementptr %431[%475] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
          %473 = llvm.load %476 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
          %477 = llvm.mlir.constant(1 : i64) : i64
          %478 = llvm.alloca %477 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
          llvm.store %473, %478 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
          %480 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
          %481 = llvm.getelementptr %478[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
          %482 = llvm.load %481 : !llvm.ptr -> i32
          %479 = func.call @sol_root(%arg2, %482) : (!llvm.ptr, i32) -> i32
          %483 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
          %484 = llvm.getelementptr %478[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
          %485 = llvm.load %484 : !llvm.ptr -> i32
          %486 = arith.cmpi ne, %479, %485 : i32
          cf.cond_br %486, ^bb48, ^bb49
          ^bb48:
            %487 = func.call @cand_pop(%431, %437) : (!llvm.ptr, !llvm.ptr) -> !llvm.struct<(i32, i32, i32)>
            %488 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
            %489 = llvm.extractvalue %487[0] : !llvm.struct<(i32, i32, i32)>
            %490 = llvm.insertvalue %489, %488[0] : !llvm.struct<(i32, i32, i32)>
            %491 = llvm.extractvalue %487[1] : !llvm.struct<(i32, i32, i32)>
            %492 = llvm.insertvalue %491, %490[1] : !llvm.struct<(i32, i32, i32)>
            %493 = llvm.extractvalue %487[2] : !llvm.struct<(i32, i32, i32)>
            %494 = llvm.insertvalue %493, %492[2] : !llvm.struct<(i32, i32, i32)>
            %495 = llvm.mlir.constant(1 : i64) : i64
            %496 = llvm.alloca %495 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
            llvm.store %494, %496 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
            %497 = llvm.load %496 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
            cf.br ^bb50
          ^bb49:
            %499 = arith.extsi %479 : i32 to i64
            %500 = llvm.getelementptr %arg10[%499] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %498 = llvm.load %500 : !llvm.ptr -> i32
            %501 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
            %502 = llvm.getelementptr %478[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
            %503 = llvm.load %502 : !llvm.ptr -> i32
            %504 = arith.cmpi ne, %498, %503 : i32
            %505 = scf.if %504 -> (i1) {
              %506 = arith.constant true
              scf.yield %506 : i1
            } else {
              %508 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
              %509 = llvm.getelementptr %478[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
              %510 = llvm.load %509 : !llvm.ptr -> i32
              %511 = arith.extsi %510 : i32 to i64
              %512 = llvm.getelementptr %arg1[%511] : (!llvm.ptr, i64) -> !llvm.ptr, i32
              %507 = llvm.load %512 : !llvm.ptr -> i32
              %513 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
              %514 = llvm.getelementptr %478[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
              %515 = llvm.load %514 : !llvm.ptr -> i32
              %516 = arith.cmpi ne, %507, %515 : i32
              scf.yield %516 : i1
            }
            cf.cond_br %505, ^bb51, ^bb52
            ^bb51:
              %517 = func.call @cand_pop(%431, %437) : (!llvm.ptr, !llvm.ptr) -> !llvm.struct<(i32, i32, i32)>
              %518 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
              %519 = llvm.extractvalue %517[0] : !llvm.struct<(i32, i32, i32)>
              %520 = llvm.insertvalue %519, %518[0] : !llvm.struct<(i32, i32, i32)>
              %521 = llvm.extractvalue %517[1] : !llvm.struct<(i32, i32, i32)>
              %522 = llvm.insertvalue %521, %520[1] : !llvm.struct<(i32, i32, i32)>
              %523 = llvm.extractvalue %517[2] : !llvm.struct<(i32, i32, i32)>
              %524 = llvm.insertvalue %523, %522[2] : !llvm.struct<(i32, i32, i32)>
              %525 = llvm.mlir.constant(1 : i64) : i64
              %526 = llvm.alloca %525 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
              llvm.store %524, %526 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
              %527 = llvm.load %526 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
              cf.br ^bb53
            ^bb52:
              %529 = llvm.load %461 : !llvm.ptr -> i32
              %528 = func.call @sol_root(%arg2, %529) : (!llvm.ptr, i32) -> i32
              %530 = arith.cmpi eq, %479, %528 : i32
              cf.cond_br %530, ^bb54, ^bb55
              ^bb54:
                %531 = func.call @cand_pop(%431, %437) : (!llvm.ptr, !llvm.ptr) -> !llvm.struct<(i32, i32, i32)>
                %532 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
                %533 = llvm.extractvalue %531[0] : !llvm.struct<(i32, i32, i32)>
                %534 = llvm.insertvalue %533, %532[0] : !llvm.struct<(i32, i32, i32)>
                %535 = llvm.extractvalue %531[1] : !llvm.struct<(i32, i32, i32)>
                %536 = llvm.insertvalue %535, %534[1] : !llvm.struct<(i32, i32, i32)>
                %537 = llvm.extractvalue %531[2] : !llvm.struct<(i32, i32, i32)>
                %538 = llvm.insertvalue %537, %536[2] : !llvm.struct<(i32, i32, i32)>
                %539 = llvm.mlir.constant(1 : i64) : i64
                %540 = llvm.alloca %539 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
                llvm.store %538, %540 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
                %541 = llvm.load %540 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
                cf.br ^bb56
              ^bb55:
                %542 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
                %543 = llvm.getelementptr %478[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
                %544 = llvm.load %543 : !llvm.ptr -> i32
                %545 = arith.cmpi sle, %544, %451 : i32
                cf.cond_br %545, ^bb57, ^bb58
                ^bb57:
                  %546 = func.call @cand_pop(%431, %437) : (!llvm.ptr, !llvm.ptr) -> !llvm.struct<(i32, i32, i32)>
                  %547 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
                  %548 = llvm.extractvalue %546[0] : !llvm.struct<(i32, i32, i32)>
                  %549 = llvm.insertvalue %548, %547[0] : !llvm.struct<(i32, i32, i32)>
                  %550 = llvm.extractvalue %546[1] : !llvm.struct<(i32, i32, i32)>
                  %551 = llvm.insertvalue %550, %549[1] : !llvm.struct<(i32, i32, i32)>
                  %552 = llvm.extractvalue %546[2] : !llvm.struct<(i32, i32, i32)>
                  %553 = llvm.insertvalue %552, %551[2] : !llvm.struct<(i32, i32, i32)>
                  %554 = llvm.mlir.constant(1 : i64) : i64
                  %555 = llvm.alloca %554 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
                  llvm.store %553, %555 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
                  %556 = llvm.load %555 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
                  cf.br ^bb60
                  ^bb60:
                  %558 = arith.extsi %479 : i32 to i64
                  %559 = llvm.getelementptr %arg10[%558] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                  %557 = llvm.load %559 : !llvm.ptr -> i32
                  %560 = arith.constant 0 : i32
                  %561 = arith.cmpi sge, %557, %560 : i32
                  %562 = scf.if %561 -> (i1) {
                    %565 = arith.extsi %479 : i32 to i64
                    %566 = llvm.getelementptr %arg10[%565] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                    %564 = llvm.load %566 : !llvm.ptr -> i32
                    %567 = arith.extsi %564 : i32 to i64
                    %568 = llvm.getelementptr %arg1[%567] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                    %563 = llvm.load %568 : !llvm.ptr -> i32
                    %569 = arith.cmpi sle, %563, %451 : i32
                    scf.yield %569 : i1
                  } else {
                    %570 = arith.constant false
                    scf.yield %570 : i1
                  }
                  cf.cond_br %562, ^bb61, ^bb62
                  ^bb61:
                    %573 = arith.extsi %479 : i32 to i64
                    %574 = llvm.getelementptr %arg10[%573] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                    %572 = llvm.load %574 : !llvm.ptr -> i32
                    %571 = func.call @sol_pop_heap(%arg7, %arg8, %arg1, %arg9, %572) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> i32
                    %575 = arith.extsi %479 : i32 to i64
                    %576 = llvm.getelementptr %arg10[%575] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                    llvm.store %571, %576 : i32, !llvm.ptr
                    cf.br ^bb60
                  ^bb62:
                  %578 = arith.extsi %479 : i32 to i64
                  %579 = llvm.getelementptr %arg10[%578] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                  %577 = llvm.load %579 : !llvm.ptr -> i32
                  %580 = arith.constant 0 : i32
                  %581 = arith.cmpi sge, %577, %580 : i32
                  cf.cond_br %581, ^bb63, ^bb64
                  ^bb63:
                    %583 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
                    %585 = arith.extsi %577 : i32 to i64
                    %586 = llvm.getelementptr %arg1[%585] : (!llvm.ptr, i64) -> !llvm.ptr, i32
                    %584 = llvm.load %586 : !llvm.ptr -> i32
                    %587 = llvm.insertvalue %584, %583[0] : !llvm.struct<(i32, i32, i32)>
                    %588 = llvm.insertvalue %577, %587[1] : !llvm.struct<(i32, i32, i32)>
                    %589 = llvm.insertvalue %479, %588[2] : !llvm.struct<(i32, i32, i32)>
                    func.call @cand_push(%431, %437, %589) : (!llvm.ptr, !llvm.ptr, !llvm.struct<(i32, i32, i32)>) -> ()
                    cf.br ^bb65
                  ^bb64:
                    cf.br ^bb65
                  ^bb65:
                  cf.br ^bb59
                ^bb58:
                  %590 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
                  %591 = llvm.getelementptr %478[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
                  %592 = llvm.load %591 : !llvm.ptr -> i32
                  %593 = arith.cmpi sge, %592, %455 : i32
                  cf.cond_br %593, ^bb66, ^bb67
                  ^bb66:
                    %594 = arith.constant 0 : i1
                    llvm.store %594, %464 : i1, !llvm.ptr
                    cf.br ^bb68
                  ^bb67:
                    %595 = func.call @cand_pop(%431, %437) : (!llvm.ptr, !llvm.ptr) -> !llvm.struct<(i32, i32, i32)>
                    %596 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
                    %597 = llvm.extractvalue %595[0] : !llvm.struct<(i32, i32, i32)>
                    %598 = llvm.insertvalue %597, %596[0] : !llvm.struct<(i32, i32, i32)>
                    %599 = llvm.extractvalue %595[1] : !llvm.struct<(i32, i32, i32)>
                    %600 = llvm.insertvalue %599, %598[1] : !llvm.struct<(i32, i32, i32)>
                    %601 = llvm.extractvalue %595[2] : !llvm.struct<(i32, i32, i32)>
                    %602 = llvm.insertvalue %601, %600[2] : !llvm.struct<(i32, i32, i32)>
                    %603 = llvm.mlir.constant(1 : i64) : i64
                    %604 = llvm.alloca %603 x !llvm.struct<(i32, i32, i32)> : (i64) -> !llvm.ptr
                    llvm.store %602, %604 : !llvm.struct<(i32, i32, i32)>, !llvm.ptr
                    %605 = llvm.load %604 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
                    %607 = llvm.load %448 : !llvm.ptr -> i32
                    %608 = llvm.load %478 : !llvm.ptr -> !llvm.struct<(i32, i32, i32)>
                    %609 = llvm.getelementptr %478[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, i32, i32)>
                    %610 = llvm.load %609 : !llvm.ptr -> i32
                    %606 = func.call @sol_union_opposite(%arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10, %arg1, %607, %610) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i32, i32) -> i32
                    llvm.store %606, %461 : i32, !llvm.ptr
                    cf.br ^bb68
                  ^bb68:
                  cf.br ^bb59
                ^bb59:
                cf.br ^bb56
              ^bb56:
              cf.br ^bb53
            ^bb53:
            cf.br ^bb50
          ^bb50:
          cf.br ^bb47
        ^bb47:
        cf.br ^bb42
      ^bb44:
      %612 = llvm.load %461 : !llvm.ptr -> i32
      %611 = func.call @sol_root(%arg2, %612) : (!llvm.ptr, i32) -> i32
      llvm.store %611, %461 : i32, !llvm.ptr
      %614 = llvm.load %461 : !llvm.ptr -> i32
      %615 = arith.extsi %614 : i32 to i64
      %616 = llvm.getelementptr %arg10[%615] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %613 = llvm.load %616 : !llvm.ptr -> i32
      %617 = arith.constant 0 : i32
      %618 = arith.cmpi sge, %613, %617 : i32
      cf.cond_br %618, ^bb69, ^bb70
      ^bb69:
        %620 = llvm.mlir.undef : !llvm.struct<(i32, i32, i32)>
        %622 = arith.extsi %613 : i32 to i64
        %623 = llvm.getelementptr %arg1[%622] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %621 = llvm.load %623 : !llvm.ptr -> i32
        %624 = llvm.insertvalue %621, %620[0] : !llvm.struct<(i32, i32, i32)>
        %625 = llvm.insertvalue %613, %624[1] : !llvm.struct<(i32, i32, i32)>
        %626 = llvm.load %461 : !llvm.ptr -> i32
        %627 = llvm.insertvalue %626, %625[2] : !llvm.struct<(i32, i32, i32)>
        func.call @cand_push(%431, %437, %627) : (!llvm.ptr, !llvm.ptr, !llvm.struct<(i32, i32, i32)>) -> ()
        cf.br ^bb71
      ^bb70:
        cf.br ^bb71
      ^bb71:
      %628 = llvm.load %448 : !llvm.ptr -> i32
      %629 = arith.constant 1 : i32
      %630 = arith.addi %628, %629 : i32
      llvm.store %630, %448 : i32, !llvm.ptr
      cf.br ^bb39
    ^bb41:
    %631 = arith.constant 0 : i32
    %632 = llvm.mlir.constant(1 : i64) : i64
    %633 = llvm.alloca %632 x i32 : (i64) -> !llvm.ptr
    llvm.store %631, %633 : i32, !llvm.ptr
    %634 = arith.constant 0 : i32
    %635 = llvm.mlir.constant(1 : i64) : i64
    %636 = llvm.alloca %635 x i32 : (i64) -> !llvm.ptr
    llvm.store %634, %636 : i32, !llvm.ptr
    cf.br ^bb72
    ^bb72:
    %637 = llvm.load %636 : !llvm.ptr -> i32
    %638 = arith.cmpi slt, %637, %arg11 : i32
    cf.cond_br %638, ^bb73, ^bb74
    ^bb73:
      %640 = llvm.load %636 : !llvm.ptr -> i32
      %641 = arith.extsi %640 : i32 to i64
      %642 = llvm.getelementptr %arg2[%641] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %639 = llvm.load %642 : !llvm.ptr -> i32
      %643 = llvm.load %636 : !llvm.ptr -> i32
      %644 = arith.cmpi eq, %639, %643 : i32
      cf.cond_br %644, ^bb75, ^bb76
      ^bb75:
        %646 = llvm.load %636 : !llvm.ptr -> i32
        %647 = arith.extsi %646 : i32 to i64
        %648 = llvm.getelementptr %arg5[%647] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %645 = llvm.load %648 : !llvm.ptr -> i32
        %650 = llvm.load %636 : !llvm.ptr -> i32
        %651 = arith.extsi %650 : i32 to i64
        %652 = llvm.getelementptr %arg6[%651] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %649 = llvm.load %652 : !llvm.ptr -> i32
        %653 = arith.cmpi sgt, %645, %649 : i32
        cf.cond_br %653, ^bb78, ^bb79
        ^bb78:
          %654 = llvm.load %633 : !llvm.ptr -> i32
          %655 = arith.addi %654, %645 : i32
          llvm.store %655, %633 : i32, !llvm.ptr
          cf.br ^bb80
        ^bb79:
          %656 = llvm.load %633 : !llvm.ptr -> i32
          %657 = arith.addi %656, %649 : i32
          llvm.store %657, %633 : i32, !llvm.ptr
          cf.br ^bb80
        ^bb80:
        cf.br ^bb77
      ^bb76:
        cf.br ^bb77
      ^bb77:
      %658 = llvm.load %636 : !llvm.ptr -> i32
      %659 = arith.constant 1 : i32
      %660 = arith.addi %658, %659 : i32
      llvm.store %660, %636 : i32, !llvm.ptr
      cf.br ^bb72
    ^bb74:
    func.call @free(%431) : (!llvm.ptr) -> ()
    func.call @free(%437) : (!llvm.ptr) -> ()
    %663 = llvm.load %633 : !llvm.ptr -> i32
    func.return %663 : i32
  }
  func.func @main() -> i32 {
    %665 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %666 = llvm.mlir.addressof @str_1 : !llvm.ptr
    %664 = func.call @fopen(%665, %666) : (!llvm.ptr, !llvm.ptr) -> !llvm.ptr
    %667 = llvm.mlir.zero : !llvm.ptr
    %668 = llvm.icmp "eq" %664, %667 : !llvm.ptr
    cf.cond_br %668, ^bb81, ^bb82
    ^bb81:
      %669 = llvm.mlir.addressof @str_2 : !llvm.ptr
      %670 = llvm.call @printf(%669) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr) -> i32
      %671 = arith.constant 1 : i32
      func.return %671 : i32
    ^bb82:
      cf.br ^bb83
    ^bb83:
    %673 = arith.constant 0 : i32
    %674 = arith.constant 2 : i32
    %675 = arith.extsi %673 : i32 to i64
    %672 = func.call @fseek(%664, %675, %674) : (!llvm.ptr, i64, i32) -> i32
    %676 = func.call @ftell(%664) : (!llvm.ptr) -> i64
    %678 = arith.constant 0 : i32
    %679 = arith.constant 0 : i32
    %680 = arith.extsi %678 : i32 to i64
    %677 = func.call @fseek(%664, %680, %679) : (!llvm.ptr, i64, i32) -> i32
    %682 = arith.constant 1 : i32
    %684 = arith.extsi %682 : i32 to i64
    %683 = arith.addi %676, %684 : i64
    %685 = arith.constant 1 : i32
    %686 = arith.extsi %685 : i32 to i64
    %681 = func.call @calloc(%683, %686) : (i64, i64) -> !llvm.ptr
    %688 = arith.constant 1 : i32
    %689 = arith.extsi %688 : i32 to i64
    %687 = func.call @fread(%681, %689, %676, %664) : (!llvm.ptr, i64, i64, !llvm.ptr) -> i64
    %690 = arith.constant 0 : i32
    %691 = arith.trunci %690 : i32 to i8
    %692 = llvm.getelementptr %681[%676] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %691, %692 : i8, !llvm.ptr
    %693 = func.call @fclose(%664) : (!llvm.ptr) -> i32
    %694 = arith.constant 200000 : i32
    %696 = arith.extsi %694 : i32 to i64
    %697 = arith.constant 4 : i32
    %698 = arith.extsi %697 : i32 to i64
    %695 = func.call @calloc(%696, %698) : (i64, i64) -> !llvm.ptr
    %700 = arith.constant 1 : i32
    %701 = arith.constant 4 : i32
    %702 = arith.extsi %700 : i32 to i64
    %703 = arith.extsi %701 : i32 to i64
    %699 = func.call @calloc(%702, %703) : (i64, i64) -> !llvm.ptr
    %704 = arith.constant 0 : i32
    %705 = arith.constant 0 : i32
    %706 = arith.extsi %705 : i32 to i64
    %707 = llvm.getelementptr %699[%706] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %704, %707 : i32, !llvm.ptr
    %708 = arith.constant 0 : i32
    %709 = arith.extsi %708 : i32 to i64
    %710 = llvm.mlir.constant(1 : i64) : i64
    %711 = llvm.alloca %710 x i64 : (i64) -> !llvm.ptr
    llvm.store %709, %711 : i64, !llvm.ptr
    %713 = llvm.load %711 : !llvm.ptr -> i64
    %714 = llvm.getelementptr %681[%713] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %712 = llvm.load %714 : !llvm.ptr -> i8
    %715 = llvm.mlir.constant(1 : i64) : i64
    %716 = llvm.alloca %715 x i8 : (i64) -> !llvm.ptr
    llvm.store %712, %716 : i8, !llvm.ptr
    cf.br ^bb84
    ^bb84:
    %717 = llvm.load %716 : !llvm.ptr -> i8
    %718 = arith.constant 0 : i32
    %720 = arith.extsi %717 : i8 to i32
    %719 = arith.cmpi ne, %720, %718 : i32
    cf.cond_br %719, ^bb85, ^bb86
    ^bb85:
      cf.br ^bb87
      ^bb87:
      %721 = llvm.load %716 : !llvm.ptr -> i8
      %722 = arith.constant 0 : i32
      %724 = arith.extsi %721 : i8 to i32
      %723 = arith.cmpi ne, %724, %722 : i32
      cf.cond_br %723, ^bb88, ^bb89
      ^bb88:
        %725 = llvm.load %716 : !llvm.ptr -> i8
        %726 = arith.constant 48 : i32
        %728 = arith.extsi %725 : i8 to i32
        %727 = arith.cmpi sge, %728, %726 : i32
        %729 = scf.if %727 -> (i1) {
          %730 = llvm.load %716 : !llvm.ptr -> i8
          %731 = arith.constant 57 : i32
          %733 = arith.extsi %730 : i8 to i32
          %732 = arith.cmpi sle, %733, %731 : i32
          scf.yield %732 : i1
        } else {
          %734 = arith.constant false
          scf.yield %734 : i1
        }
        cf.cond_br %729, ^bb90, ^bb91
        ^bb90:
          cf.br ^bb89
        ^bb91:
          cf.br ^bb92
        ^bb92:
        %735 = llvm.load %716 : !llvm.ptr -> i8
        %736 = arith.constant 45 : i32
        %738 = arith.extsi %735 : i8 to i32
        %737 = arith.cmpi eq, %738, %736 : i32
        cf.cond_br %737, ^bb93, ^bb94
        ^bb93:
          cf.br ^bb89
        ^bb94:
          cf.br ^bb95
        ^bb95:
        %739 = llvm.load %711 : !llvm.ptr -> i64
        %740 = arith.constant 1 : i32
        %742 = arith.extsi %740 : i32 to i64
        %741 = arith.addi %739, %742 : i64
        llvm.store %741, %711 : i64, !llvm.ptr
        %744 = llvm.load %711 : !llvm.ptr -> i64
        %745 = llvm.getelementptr %681[%744] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %743 = llvm.load %745 : !llvm.ptr -> i8
        llvm.store %743, %716 : i8, !llvm.ptr
        cf.br ^bb87
      ^bb89:
      %746 = llvm.load %716 : !llvm.ptr -> i8
      %747 = arith.constant 0 : i32
      %749 = arith.extsi %746 : i8 to i32
      %748 = arith.cmpi eq, %749, %747 : i32
      cf.cond_br %748, ^bb96, ^bb97
      ^bb96:
        cf.br ^bb86
      ^bb97:
        cf.br ^bb98
      ^bb98:
      %750 = arith.constant 0 : i1
      %751 = llvm.mlir.constant(1 : i64) : i64
      %752 = llvm.alloca %751 x i1 : (i64) -> !llvm.ptr
      llvm.store %750, %752 : i1, !llvm.ptr
      %753 = llvm.load %716 : !llvm.ptr -> i8
      %754 = arith.constant 45 : i32
      %756 = arith.extsi %753 : i8 to i32
      %755 = arith.cmpi eq, %756, %754 : i32
      cf.cond_br %755, ^bb99, ^bb100
      ^bb99:
        %757 = arith.constant 1 : i1
        llvm.store %757, %752 : i1, !llvm.ptr
        %758 = llvm.load %711 : !llvm.ptr -> i64
        %759 = arith.constant 1 : i32
        %761 = arith.extsi %759 : i32 to i64
        %760 = arith.addi %758, %761 : i64
        llvm.store %760, %711 : i64, !llvm.ptr
        %763 = llvm.load %711 : !llvm.ptr -> i64
        %764 = llvm.getelementptr %681[%763] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %762 = llvm.load %764 : !llvm.ptr -> i8
        llvm.store %762, %716 : i8, !llvm.ptr
        cf.br ^bb101
      ^bb100:
        cf.br ^bb101
      ^bb101:
      %765 = arith.constant 0 : i32
      %766 = llvm.mlir.constant(1 : i64) : i64
      %767 = llvm.alloca %766 x i32 : (i64) -> !llvm.ptr
      llvm.store %765, %767 : i32, !llvm.ptr
      cf.br ^bb102
      ^bb102:
      %768 = llvm.load %716 : !llvm.ptr -> i8
      %769 = arith.constant 48 : i32
      %771 = arith.extsi %768 : i8 to i32
      %770 = arith.cmpi sge, %771, %769 : i32
      %772 = scf.if %770 -> (i1) {
        %773 = llvm.load %716 : !llvm.ptr -> i8
        %774 = arith.constant 57 : i32
        %776 = arith.extsi %773 : i8 to i32
        %775 = arith.cmpi sle, %776, %774 : i32
        scf.yield %775 : i1
      } else {
        %777 = arith.constant false
        scf.yield %777 : i1
      }
      cf.cond_br %772, ^bb103, ^bb104
      ^bb103:
        %778 = llvm.load %767 : !llvm.ptr -> i32
        %779 = arith.constant 10 : i32
        %780 = arith.muli %778, %779 : i32
        %781 = llvm.load %716 : !llvm.ptr -> i8
        %782 = arith.constant 48 : i32
        %784 = arith.extsi %781 : i8 to i32
        %783 = arith.subi %784, %782 : i32
        %785 = arith.addi %780, %783 : i32
        llvm.store %785, %767 : i32, !llvm.ptr
        %786 = llvm.load %711 : !llvm.ptr -> i64
        %787 = arith.constant 1 : i32
        %789 = arith.extsi %787 : i32 to i64
        %788 = arith.addi %786, %789 : i64
        llvm.store %788, %711 : i64, !llvm.ptr
        %791 = llvm.load %711 : !llvm.ptr -> i64
        %792 = llvm.getelementptr %681[%791] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %790 = llvm.load %792 : !llvm.ptr -> i8
        llvm.store %790, %716 : i8, !llvm.ptr
        cf.br ^bb102
      ^bb104:
      %793 = llvm.load %752 : !llvm.ptr -> i1
      cf.cond_br %793, ^bb105, ^bb106
      ^bb105:
        %794 = arith.constant 0 : i32
        %795 = llvm.load %767 : !llvm.ptr -> i32
        %796 = arith.subi %794, %795 : i32
        llvm.store %796, %767 : i32, !llvm.ptr
        cf.br ^bb107
      ^bb106:
        cf.br ^bb107
      ^bb107:
      %798 = arith.constant 0 : i32
      %799 = arith.extsi %798 : i32 to i64
      %800 = llvm.getelementptr %699[%799] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %797 = llvm.load %800 : !llvm.ptr -> i32
      %801 = arith.cmpi sge, %797, %694 : i32
      cf.cond_br %801, ^bb108, ^bb109
      ^bb108:
        %802 = llvm.mlir.addressof @str_3 : !llvm.ptr
        %803 = llvm.call @printf(%802) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr) -> i32
        func.call @free(%681) : (!llvm.ptr) -> ()
        func.call @free(%695) : (!llvm.ptr) -> ()
        func.call @free(%699) : (!llvm.ptr) -> ()
        %807 = arith.constant 1 : i32
        func.return %807 : i32
      ^bb109:
        cf.br ^bb110
      ^bb110:
      %808 = llvm.load %767 : !llvm.ptr -> i32
      %810 = arith.constant 0 : i32
      %811 = arith.extsi %810 : i32 to i64
      %812 = llvm.getelementptr %699[%811] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %809 = llvm.load %812 : !llvm.ptr -> i32
      %813 = arith.extsi %809 : i32 to i64
      %814 = llvm.getelementptr %695[%813] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %808, %814 : i32, !llvm.ptr
      %816 = arith.constant 0 : i32
      %817 = arith.extsi %816 : i32 to i64
      %818 = llvm.getelementptr %699[%817] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %815 = llvm.load %818 : !llvm.ptr -> i32
      %819 = arith.constant 1 : i32
      %820 = arith.addi %815, %819 : i32
      %821 = arith.constant 0 : i32
      %822 = arith.extsi %821 : i32 to i64
      %823 = llvm.getelementptr %699[%822] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %820, %823 : i32, !llvm.ptr
      cf.br ^bb84
    ^bb86:
    func.call @free(%681) : (!llvm.ptr) -> ()
    %826 = arith.constant 0 : i32
    %827 = arith.extsi %826 : i32 to i64
    %828 = llvm.getelementptr %699[%827] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %825 = llvm.load %828 : !llvm.ptr -> i32
    func.call @free(%699) : (!llvm.ptr) -> ()
    %830 = arith.constant 0 : i32
    %831 = llvm.mlir.constant(1 : i64) : i64
    %832 = llvm.alloca %831 x i32 : (i64) -> !llvm.ptr
    llvm.store %830, %832 : i32, !llvm.ptr
    %833 = arith.constant 0 : i32
    %834 = llvm.mlir.constant(1 : i64) : i64
    %835 = llvm.alloca %834 x i32 : (i64) -> !llvm.ptr
    llvm.store %833, %835 : i32, !llvm.ptr
    cf.br ^bb111
    ^bb111:
    %836 = llvm.load %835 : !llvm.ptr -> i32
    %837 = arith.cmpi slt, %836, %825 : i32
    cf.cond_br %837, ^bb112, ^bb113
    ^bb112:
      %839 = llvm.load %835 : !llvm.ptr -> i32
      %840 = arith.extsi %839 : i32 to i64
      %841 = llvm.getelementptr %695[%840] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %838 = llvm.load %841 : !llvm.ptr -> i32
      %842 = llvm.load %832 : !llvm.ptr -> i32
      %843 = arith.cmpi sgt, %838, %842 : i32
      cf.cond_br %843, ^bb114, ^bb115
      ^bb114:
        %845 = llvm.load %835 : !llvm.ptr -> i32
        %846 = arith.extsi %845 : i32 to i64
        %847 = llvm.getelementptr %695[%846] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %844 = llvm.load %847 : !llvm.ptr -> i32
        llvm.store %844, %832 : i32, !llvm.ptr
        cf.br ^bb116
      ^bb115:
        cf.br ^bb116
      ^bb116:
      %848 = llvm.load %835 : !llvm.ptr -> i32
      %849 = arith.constant 1 : i32
      %850 = arith.addi %848, %849 : i32
      llvm.store %850, %835 : i32, !llvm.ptr
      cf.br ^bb111
    ^bb113:
    %851 = arith.constant 2 : i32
    %852 = arith.divsi %825, %851 : i32
    %854 = arith.extsi %852 : i32 to i64
    %855 = arith.constant 4 : i32
    %856 = arith.extsi %855 : i32 to i64
    %853 = func.call @calloc(%854, %856) : (i64, i64) -> !llvm.ptr
    %858 = arith.extsi %852 : i32 to i64
    %859 = arith.constant 4 : i32
    %860 = arith.extsi %859 : i32 to i64
    %857 = func.call @calloc(%858, %860) : (i64, i64) -> !llvm.ptr
    %862 = llvm.load %832 : !llvm.ptr -> i32
    %863 = arith.constant 1 : i32
    %864 = arith.addi %862, %863 : i32
    %865 = arith.extsi %864 : i32 to i64
    %866 = arith.constant 4 : i32
    %867 = arith.extsi %866 : i32 to i64
    %861 = func.call @calloc(%865, %867) : (i64, i64) -> !llvm.ptr
    %868 = arith.constant 0 : i32
    %869 = llvm.mlir.constant(1 : i64) : i64
    %870 = llvm.alloca %869 x i32 : (i64) -> !llvm.ptr
    llvm.store %868, %870 : i32, !llvm.ptr
    cf.br ^bb117
    ^bb117:
    %871 = llvm.load %870 : !llvm.ptr -> i32
    %872 = llvm.load %832 : !llvm.ptr -> i32
    %873 = arith.cmpi sle, %871, %872 : i32
    cf.cond_br %873, ^bb118, ^bb119
    ^bb118:
      %874 = arith.constant 1 : i32
      %876 = arith.constant 0 : i32
      %875 = arith.subi %876, %874 : i32
      %877 = llvm.load %870 : !llvm.ptr -> i32
      %878 = arith.extsi %877 : i32 to i64
      %879 = llvm.getelementptr %861[%878] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %875, %879 : i32, !llvm.ptr
      %880 = llvm.load %870 : !llvm.ptr -> i32
      %881 = arith.constant 1 : i32
      %882 = arith.addi %880, %881 : i32
      llvm.store %882, %870 : i32, !llvm.ptr
      cf.br ^bb117
    ^bb119:
    %884 = arith.constant 1 : i32
    %885 = arith.constant 4 : i32
    %886 = arith.extsi %884 : i32 to i64
    %887 = arith.extsi %885 : i32 to i64
    %883 = func.call @calloc(%886, %887) : (i64, i64) -> !llvm.ptr
    %888 = arith.constant 0 : i32
    %889 = arith.constant 0 : i32
    %890 = arith.extsi %889 : i32 to i64
    %891 = llvm.getelementptr %883[%890] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %888, %891 : i32, !llvm.ptr
    %892 = arith.constant 0 : i32
    %893 = llvm.mlir.constant(1 : i64) : i64
    %894 = llvm.alloca %893 x i32 : (i64) -> !llvm.ptr
    llvm.store %892, %894 : i32, !llvm.ptr
    cf.br ^bb120
    ^bb120:
    %895 = llvm.load %894 : !llvm.ptr -> i32
    %896 = arith.cmpi slt, %895, %825 : i32
    cf.cond_br %896, ^bb121, ^bb122
    ^bb121:
      %898 = llvm.load %894 : !llvm.ptr -> i32
      %899 = arith.extsi %898 : i32 to i64
      %900 = llvm.getelementptr %695[%899] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %897 = llvm.load %900 : !llvm.ptr -> i32
      %902 = arith.extsi %897 : i32 to i64
      %903 = llvm.getelementptr %861[%902] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %901 = llvm.load %903 : !llvm.ptr -> i32
      %904 = arith.constant 0 : i32
      %905 = arith.cmpi slt, %901, %904 : i32
      cf.cond_br %905, ^bb123, ^bb124
      ^bb123:
        %907 = arith.constant 0 : i32
        %908 = arith.extsi %907 : i32 to i64
        %909 = llvm.getelementptr %883[%908] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %906 = llvm.load %909 : !llvm.ptr -> i32
        %910 = arith.extsi %897 : i32 to i64
        %911 = llvm.getelementptr %861[%910] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %906, %911 : i32, !llvm.ptr
        %912 = llvm.load %894 : !llvm.ptr -> i32
        %913 = arith.extsi %906 : i32 to i64
        %914 = llvm.getelementptr %853[%913] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %912, %914 : i32, !llvm.ptr
        %915 = arith.constant 1 : i32
        %917 = arith.constant 0 : i32
        %916 = arith.subi %917, %915 : i32
        %918 = arith.extsi %906 : i32 to i64
        %919 = llvm.getelementptr %857[%918] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %916, %919 : i32, !llvm.ptr
        %920 = arith.constant 1 : i32
        %921 = arith.addi %906, %920 : i32
        %922 = arith.constant 0 : i32
        %923 = arith.extsi %922 : i32 to i64
        %924 = llvm.getelementptr %883[%923] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %921, %924 : i32, !llvm.ptr
        cf.br ^bb125
      ^bb124:
        %925 = llvm.load %894 : !llvm.ptr -> i32
        %926 = arith.extsi %901 : i32 to i64
        %927 = llvm.getelementptr %857[%926] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %925, %927 : i32, !llvm.ptr
        %928 = arith.constant 1 : i32
        %930 = arith.constant 0 : i32
        %929 = arith.subi %930, %928 : i32
        %931 = arith.extsi %897 : i32 to i64
        %932 = llvm.getelementptr %861[%931] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %929, %932 : i32, !llvm.ptr
        cf.br ^bb125
      ^bb125:
      %933 = llvm.load %894 : !llvm.ptr -> i32
      %934 = arith.constant 1 : i32
      %935 = arith.addi %933, %934 : i32
      llvm.store %935, %894 : i32, !llvm.ptr
      cf.br ^bb120
    ^bb122:
    func.call @free(%861) : (!llvm.ptr) -> ()
    func.call @free(%695) : (!llvm.ptr) -> ()
    func.call @free(%883) : (!llvm.ptr) -> ()
    %940 = arith.extsi %852 : i32 to i64
    %941 = arith.constant 4 : i32
    %942 = arith.extsi %941 : i32 to i64
    %939 = func.call @calloc(%940, %942) : (i64, i64) -> !llvm.ptr
    %944 = arith.extsi %852 : i32 to i64
    %945 = arith.constant 4 : i32
    %946 = arith.extsi %945 : i32 to i64
    %943 = func.call @calloc(%944, %946) : (i64, i64) -> !llvm.ptr
    %948 = arith.extsi %852 : i32 to i64
    %949 = arith.constant 4 : i32
    %950 = arith.extsi %949 : i32 to i64
    %947 = func.call @calloc(%948, %950) : (i64, i64) -> !llvm.ptr
    %952 = arith.extsi %852 : i32 to i64
    %953 = arith.constant 4 : i32
    %954 = arith.extsi %953 : i32 to i64
    %951 = func.call @calloc(%952, %954) : (i64, i64) -> !llvm.ptr
    %956 = arith.extsi %852 : i32 to i64
    %957 = arith.constant 4 : i32
    %958 = arith.extsi %957 : i32 to i64
    %955 = func.call @calloc(%956, %958) : (i64, i64) -> !llvm.ptr
    %960 = arith.extsi %852 : i32 to i64
    %961 = arith.constant 4 : i32
    %962 = arith.extsi %961 : i32 to i64
    %959 = func.call @calloc(%960, %962) : (i64, i64) -> !llvm.ptr
    %964 = arith.extsi %852 : i32 to i64
    %965 = arith.constant 4 : i32
    %966 = arith.extsi %965 : i32 to i64
    %963 = func.call @calloc(%964, %966) : (i64, i64) -> !llvm.ptr
    %968 = arith.extsi %852 : i32 to i64
    %969 = arith.constant 4 : i32
    %970 = arith.extsi %969 : i32 to i64
    %967 = func.call @calloc(%968, %970) : (i64, i64) -> !llvm.ptr
    %972 = arith.extsi %852 : i32 to i64
    %973 = arith.constant 4 : i32
    %974 = arith.extsi %973 : i32 to i64
    %971 = func.call @calloc(%972, %974) : (i64, i64) -> !llvm.ptr
    %975 = arith.constant 0 : i32
    %976 = llvm.mlir.constant(1 : i64) : i64
    %977 = llvm.alloca %976 x i32 : (i64) -> !llvm.ptr
    llvm.store %975, %977 : i32, !llvm.ptr
    cf.br ^bb126
    ^bb126:
    %978 = llvm.load %977 : !llvm.ptr -> i32
    %979 = arith.cmpi slt, %978, %852 : i32
    cf.cond_br %979, ^bb127, ^bb128
    ^bb127:
      %980 = llvm.load %977 : !llvm.ptr -> i32
      %981 = llvm.load %977 : !llvm.ptr -> i32
      %982 = arith.extsi %981 : i32 to i64
      %983 = llvm.getelementptr %939[%982] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %980, %983 : i32, !llvm.ptr
      %984 = arith.constant 1 : i32
      %985 = llvm.load %977 : !llvm.ptr -> i32
      %986 = arith.extsi %985 : i32 to i64
      %987 = llvm.getelementptr %943[%986] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %984, %987 : i32, !llvm.ptr
      %988 = arith.constant 0 : i32
      %989 = llvm.load %977 : !llvm.ptr -> i32
      %990 = arith.extsi %989 : i32 to i64
      %991 = llvm.getelementptr %947[%990] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %988, %991 : i32, !llvm.ptr
      %992 = arith.constant 1 : i32
      %993 = llvm.load %977 : !llvm.ptr -> i32
      %994 = arith.extsi %993 : i32 to i64
      %995 = llvm.getelementptr %951[%994] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %992, %995 : i32, !llvm.ptr
      %996 = arith.constant 0 : i32
      %997 = llvm.load %977 : !llvm.ptr -> i32
      %998 = arith.extsi %997 : i32 to i64
      %999 = llvm.getelementptr %955[%998] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %996, %999 : i32, !llvm.ptr
      %1000 = arith.constant 1 : i32
      %1002 = arith.constant 0 : i32
      %1001 = arith.subi %1002, %1000 : i32
      %1003 = llvm.load %977 : !llvm.ptr -> i32
      %1004 = arith.extsi %1003 : i32 to i64
      %1005 = llvm.getelementptr %959[%1004] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %1001, %1005 : i32, !llvm.ptr
      %1006 = arith.constant 1 : i32
      %1008 = arith.constant 0 : i32
      %1007 = arith.subi %1008, %1006 : i32
      %1009 = llvm.load %977 : !llvm.ptr -> i32
      %1010 = arith.extsi %1009 : i32 to i64
      %1011 = llvm.getelementptr %963[%1010] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %1007, %1011 : i32, !llvm.ptr
      %1012 = arith.constant 1 : i32
      %1013 = llvm.load %977 : !llvm.ptr -> i32
      %1014 = arith.extsi %1013 : i32 to i64
      %1015 = llvm.getelementptr %967[%1014] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %1012, %1015 : i32, !llvm.ptr
      %1016 = llvm.load %977 : !llvm.ptr -> i32
      %1017 = llvm.load %977 : !llvm.ptr -> i32
      %1018 = arith.extsi %1017 : i32 to i64
      %1019 = llvm.getelementptr %971[%1018] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %1016, %1019 : i32, !llvm.ptr
      %1020 = llvm.load %977 : !llvm.ptr -> i32
      %1021 = arith.constant 1 : i32
      %1022 = arith.addi %1020, %1021 : i32
      llvm.store %1022, %977 : i32, !llvm.ptr
      cf.br ^bb126
    ^bb128:
    %1023 = func.call @sol_solve(%853, %857, %939, %943, %947, %951, %955, %959, %963, %967, %971, %852) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> i32
    %1024 = llvm.mlir.addressof @str_4 : !llvm.ptr
    %1025 = arith.extsi %1023 : i32 to i64
    %1026 = llvm.call @printf(%1024, %1025) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%939) : (!llvm.ptr) -> ()
    func.call @free(%943) : (!llvm.ptr) -> ()
    func.call @free(%947) : (!llvm.ptr) -> ()
    func.call @free(%951) : (!llvm.ptr) -> ()
    func.call @free(%955) : (!llvm.ptr) -> ()
    func.call @free(%959) : (!llvm.ptr) -> ()
    func.call @free(%963) : (!llvm.ptr) -> ()
    func.call @free(%967) : (!llvm.ptr) -> ()
    func.call @free(%971) : (!llvm.ptr) -> ()
    func.call @free(%853) : (!llvm.ptr) -> ()
    func.call @free(%857) : (!llvm.ptr) -> ()
    %1038 = arith.constant 0 : i32
    func.return %1038 : i32
  }
}