Problem 212

Combined volume of 50000 cuboids via block decomposition.

Answer328968937309
Output328968937309
StatusPASS
Native helperno
Runtime160 ms
Peak memory10992 KB
Time complexityO(n^4) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^4)O(n)
Space complexityO(n^2)O(n)
ApproachFlow solutionEnumerate and count
VerdictSuboptimal

Flow source

# Project Euler 212
# Combined volume of 50000 cuboids via block decomposition.

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

function sort_i32(a: ptr<i32>, n0: i64) -> void {
    # insertion sort (n small)
    let mut i: i64 = 1
    while i < n0 {
        let key: i32 = a[i]
        let mut j: i64 = i
        while j > 0 && a[j - 1] > key {
            a[j] = a[j - 1]
            j = j - 1
        }
        a[j] = key
        i = i + 1
    }
}

function unique_sorted(a: ptr<i32>, n0: i64) -> i64 {
    sort_i32(a, n0)
    if n0 == 0 { return 0 }
    let mut w: i64 = 1
    let mut i: i64 = 1
    while i < n0 {
        if a[i] != a[w - 1] {
            a[w] = a[i]
            w = w + 1
        }
        i = i + 1
    }
    return w
}

function find_idx(a: ptr<i32>, n: i64, v: i32) -> i32 {
    let mut lo: i64 = 0
    let mut hi: i64 = n - 1
    while lo <= hi {
        let mid: i64 = (lo + hi) / 2
        if a[mid] == v { return mid as i32 }
        if a[mid] < v { lo = mid + 1 }
        else { hi = mid - 1 }
    }
    return 0
}

function main() -> i32 {
    let N: i64 = 50000
    let m: i64 = 6 * N
    let MOD: i64 = 1000000
    let S: ptr<i64> = calloc(m + 1, 8)
    if S == null { return 1 }
    let mut k: i64 = 1
    while k <= 55 && k <= m {
        S[k] = (100003 - 200003 * k + 300007 * k * k * k) % MOD
        if S[k] < 0 { S[k] = S[k] + MOD }
        k = k + 1
    }
    k = 56
    while k <= m {
        S[k] = (S[k - 24] + S[k - 55]) % MOD
        k = k + 1
    }

    let B: i32 = 400
    let max_coord: i32 = 10400
    let nb: i32 = (max_coord + B - 1) / B
    let nblocks: i64 = (nb as i64) * (nb as i64) * (nb as i64)

    # For each cuboid, distribute into blocks. Store all clipped cuboids in per-block arrays.
    # First count per block
    let bcount: ptr<i32> = calloc(nblocks, 4)
    let cx0: ptr<i32> = calloc(N, 4)
    let cx1: ptr<i32> = calloc(N, 4)
    let cy0: ptr<i32> = calloc(N, 4)
    let cy1: ptr<i32> = calloc(N, 4)
    let cz0: ptr<i32> = calloc(N, 4)
    let cz1: ptr<i32> = calloc(N, 4)
    if bcount == null || cx0 == null { return 1 }

    let mut i: i64 = 1
    while i <= N {
        let x0: i32 = (S[6 * i - 5] % 10000) as i32
        let y0: i32 = (S[6 * i - 4] % 10000) as i32
        let z0: i32 = (S[6 * i - 3] % 10000) as i32
        let dx: i32 = 1 + (S[6 * i - 2] % 399) as i32
        let dy: i32 = 1 + (S[6 * i - 1] % 399) as i32
        let dz: i32 = 1 + (S[6 * i] % 399) as i32
        cx0[i - 1] = x0; cx1[i - 1] = x0 + dx
        cy0[i - 1] = y0; cy1[i - 1] = y0 + dy
        cz0[i - 1] = z0; cz1[i - 1] = z0 + dz
        let bx0: i32 = x0 / B
        let bx1: i32 = (x0 + dx - 1) / B
        let by0: i32 = y0 / B
        let by1: i32 = (y0 + dy - 1) / B
        let bz0: i32 = z0 / B
        let bz1: i32 = (z0 + dz - 1) / B
        let mut bx: i32 = bx0
        while bx <= bx1 {
            let mut by: i32 = by0
            while by <= by1 {
                let mut bz: i32 = bz0
                while bz <= bz1 {
                    let idx: i64 = ((bx as i64) * (nb as i64) + (by as i64)) * (nb as i64) + (bz as i64)
                    bcount[idx] = bcount[idx] + 1
                    bz = bz + 1
                }
                by = by + 1
            }
            bx = bx + 1
        }
        i = i + 1
    }

    let boff: ptr<i32> = calloc(nblocks + 1, 4)
    let mut total_clips: i64 = 0
    i = 0
    while i < nblocks {
        boff[i] = total_clips as i32
        total_clips = total_clips + (bcount[i] as i64)
        i = i + 1
    }
    boff[nblocks] = total_clips as i32
    let rx0: ptr<i32> = calloc(total_clips, 4)
    let rx1: ptr<i32> = calloc(total_clips, 4)
    let ry0: ptr<i32> = calloc(total_clips, 4)
    let ry1: ptr<i32> = calloc(total_clips, 4)
    let rz0: ptr<i32> = calloc(total_clips, 4)
    let rz1: ptr<i32> = calloc(total_clips, 4)
    let cur: ptr<i32> = calloc(nblocks, 4)
    if rx0 == null { return 1 }
    i = 0
    while i < nblocks {
        cur[i] = boff[i]
        i = i + 1
    }

    i = 0
    while i < N {
        let x0: i32 = cx0[i]; let x1: i32 = cx1[i]
        let y0: i32 = cy0[i]; let y1: i32 = cy1[i]
        let z0: i32 = cz0[i]; let z1: i32 = cz1[i]
        let bx0: i32 = x0 / B
        let bx1: i32 = (x1 - 1) / B
        let by0: i32 = y0 / B
        let by1: i32 = (y1 - 1) / B
        let bz0: i32 = z0 / B
        let bz1: i32 = (z1 - 1) / B
        let mut bx: i32 = bx0
        while bx <= bx1 {
            let xL: i32 = bx * B
            let xR: i32 = xL + B
            let mut r0: i32 = 0
            let mut r1: i32 = B
            if x0 > xL { r0 = x0 - xL }
            if x1 < xR { r1 = x1 - xL }
            let mut by: i32 = by0
            while by <= by1 {
                let yL: i32 = by * B
                let yR: i32 = yL + B
                let mut s0: i32 = 0
                let mut s1: i32 = B
                if y0 > yL { s0 = y0 - yL }
                if y1 < yR { s1 = y1 - yL }
                let mut bz: i32 = bz0
                while bz <= bz1 {
                    let zL: i32 = bz * B
                    let zR: i32 = zL + B
                    let mut t0: i32 = 0
                    let mut t1: i32 = B
                    if z0 > zL { t0 = z0 - zL }
                    if z1 < zR { t1 = z1 - zL }
                    let bidx: i64 = ((bx as i64) * (nb as i64) + (by as i64)) * (nb as i64) + (bz as i64)
                    let pos: i32 = cur[bidx]
                    cur[bidx] = pos + 1
                    rx0[pos] = r0; rx1[pos] = r1
                    ry0[pos] = s0; ry1[pos] = s1
                    rz0[pos] = t0; rz1[pos] = t1
                    bz = bz + 1
                }
                by = by + 1
            }
            bx = bx + 1
        }
        i = i + 1
    }

    let mut volume: i64 = 0
    let mut bi: i64 = 0
    while bi < nblocks {
        let start: i32 = boff[bi]
        let end: i32 = boff[bi + 1]
        let cnt: i32 = end - start
        if cnt > 0 {
            let xs: ptr<i32> = calloc((cnt as i64) * 2 + 2, 4)
            let ys: ptr<i32> = calloc((cnt as i64) * 2 + 2, 4)
            let zs: ptr<i32> = calloc((cnt as i64) * 2 + 2, 4)
            xs[0] = 0; xs[1] = B
            ys[0] = 0; ys[1] = B
            zs[0] = 0; zs[1] = B
            let mut nx: i64 = 2
            let mut ny: i64 = 2
            let mut nz: i64 = 2
            let mut j: i32 = start
            while j < end {
                xs[nx] = rx0[j]; nx = nx + 1
                xs[nx] = rx1[j]; nx = nx + 1
                ys[ny] = ry0[j]; ny = ny + 1
                ys[ny] = ry1[j]; ny = ny + 1
                zs[nz] = rz0[j]; nz = nz + 1
                zs[nz] = rz1[j]; nz = nz + 1
                j = j + 1
            }
            nx = unique_sorted(xs, nx)
            ny = unique_sorted(ys, ny)
            nz = unique_sorted(zs, nz)
            let stride_y: i64 = nz
            let stride_x: i64 = ny * nz
            let size: i64 = nx * ny * nz
            let diff: ptr<i32> = calloc(size, 4)
            j = start
            while j < end {
                let x0i: i32 = find_idx(xs, nx, rx0[j])
                let x1i: i32 = find_idx(xs, nx, rx1[j])
                let y0i: i32 = find_idx(ys, ny, ry0[j])
                let y1i: i32 = find_idx(ys, ny, ry1[j])
                let z0i: i32 = find_idx(zs, nz, rz0[j])
                let z1i: i32 = find_idx(zs, nz, rz1[j])
                diff[(x0i as i64) * stride_x + (y0i as i64) * stride_y + (z0i as i64)] = diff[(x0i as i64) * stride_x + (y0i as i64) * stride_y + (z0i as i64)] + 1
                diff[(x1i as i64) * stride_x + (y0i as i64) * stride_y + (z0i as i64)] = diff[(x1i as i64) * stride_x + (y0i as i64) * stride_y + (z0i as i64)] - 1
                diff[(x0i as i64) * stride_x + (y1i as i64) * stride_y + (z0i as i64)] = diff[(x0i as i64) * stride_x + (y1i as i64) * stride_y + (z0i as i64)] - 1
                diff[(x0i as i64) * stride_x + (y0i as i64) * stride_y + (z1i as i64)] = diff[(x0i as i64) * stride_x + (y0i as i64) * stride_y + (z1i as i64)] - 1
                diff[(x1i as i64) * stride_x + (y1i as i64) * stride_y + (z0i as i64)] = diff[(x1i as i64) * stride_x + (y1i as i64) * stride_y + (z0i as i64)] + 1
                diff[(x1i as i64) * stride_x + (y0i as i64) * stride_y + (z1i as i64)] = diff[(x1i as i64) * stride_x + (y0i as i64) * stride_y + (z1i as i64)] + 1
                diff[(x0i as i64) * stride_x + (y1i as i64) * stride_y + (z1i as i64)] = diff[(x0i as i64) * stride_x + (y1i as i64) * stride_y + (z1i as i64)] + 1
                diff[(x1i as i64) * stride_x + (y1i as i64) * stride_y + (z1i as i64)] = diff[(x1i as i64) * stride_x + (y1i as i64) * stride_y + (z1i as i64)] - 1
                j = j + 1
            }
            # prefix x
            let mut ii: i64 = 1
            while ii < nx {
                let mut jj: i64 = 0
                while jj < ny {
                    let mut kk: i64 = 0
                    while kk < nz {
                        let off: i64 = ii * stride_x + jj * stride_y + kk
                        let offp: i64 = (ii - 1) * stride_x + jj * stride_y + kk
                        diff[off] = diff[off] + diff[offp]
                        kk = kk + 1
                    }
                    jj = jj + 1
                }
                ii = ii + 1
            }
            ii = 0
            while ii < nx {
                let mut jj: i64 = 1
                while jj < ny {
                    let mut kk: i64 = 0
                    while kk < nz {
                        let off: i64 = ii * stride_x + jj * stride_y + kk
                        let offp: i64 = ii * stride_x + (jj - 1) * stride_y + kk
                        diff[off] = diff[off] + diff[offp]
                        kk = kk + 1
                    }
                    jj = jj + 1
                }
                ii = ii + 1
            }
            ii = 0
            while ii + 1 < nx {
                let mut jj: i64 = 0
                while jj + 1 < ny {
                    let dxi: i64 = (xs[ii + 1] - xs[ii]) as i64
                    let dyj: i64 = (ys[jj + 1] - ys[jj]) as i64
                    let area: i64 = dxi * dyj
                    let mut run: i32 = 0
                    let mut kk: i64 = 0
                    while kk + 1 < nz {
                        run = run + diff[ii * stride_x + jj * stride_y + kk]
                        if run > 0 {
                            volume = volume + area * ((zs[kk + 1] - zs[kk]) as i64)
                        }
                        kk = kk + 1
                    }
                    jj = jj + 1
                }
                ii = ii + 1
            }
            free(xs); free(ys); free(zs); free(diff)
        }
        bi = bi + 1
    }
    printf("%lld\n", volume)
    return 0
}

Generated C

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
    while (flow_temp_head) {
        flow_temp_node* n = flow_temp_head;
        flow_temp_head = n->next;
        free(n);
    }
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
    flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
    if (!node) return NULL;
    node->next = flow_temp_head;
    flow_temp_head = node;
    if (!flow_temp_atexit_set) {
        flow_temp_atexit_set = 1;
        atexit(flow_temp_free_all);
    }
    return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
    size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
    char* r = (char*)flow_temp_alloc(la + lb + 1);
    if (!r) return NULL;
    if (la) memcpy(r, a, la);
    if (lb) memcpy(r + la, b, lb);
    r[la + lb] = '\0';
    return r;
}

#define __flow_in_arr(arr, val) __extension__ ({ \
    int _found = 0; \
    size_t _n = sizeof(arr)/sizeof((arr)[0]); \
    for (size_t _i = 0; _i < _n; _i++) { \
        if ((arr)[_i] == (val)) { _found = 1; break; } \
    } _found; })

/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
    fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
    abort();
#if defined(__GNUC__) || defined(__clang__)
    __builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")

#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif

#include <math.h>

void* _ui_state = NULL;

static inline float i32_to_f32(int32_t v) { return (float)v; }

/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }

void sort_i32_ptr_i32_i64(int32_t* a, int64_t n0);
int64_t unique_sorted_ptr_i32_i64(int32_t* a, int64_t n0);
int32_t find_idx_ptr_i32_i64_i32(int32_t* a, int64_t n, int32_t v);
int32_t main(void);



void sort_i32_ptr_i32_i64(int32_t* a, int64_t n0) {
    int64_t i = 1;
    while (i < n0) {
        int32_t key = a[i];
        int64_t j = i;
        while ((j > 0 && a[(j - 1)] > key)) {
            a[j] = a[(j - 1)];
            j = (j - 1);
        }
        a[j] = key;
        i = (i + 1);
    }
}

int64_t unique_sorted_ptr_i32_i64(int32_t* a, int64_t n0) {
    sort_i32_ptr_i32_i64(a, n0);
    if (n0 == 0) {
        return 0;
    }
    int64_t w = 1;
    int64_t i = 1;
    while (i < n0) {
        if (a[i] != a[(w - 1)]) {
            a[w] = a[i];
            w = (w + 1);
        }
        i = (i + 1);
    }
    return w;
}

int32_t find_idx_ptr_i32_i64_i32(int32_t* a, int64_t n, int32_t v) {
    int64_t lo = 0;
    int64_t hi = (n - 1);
    while (lo <= hi) {
        int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
        if (a[mid] == v) {
            return ((int32_t)(mid));
        }
        if (a[mid] < v) {
            lo = (mid + 1);
        } else {
            hi = (mid - 1);
        }
    }
    return 0;
}

int32_t main(void) {
    int64_t N = 50000;
    int64_t m = (6 * N);
    int64_t MOD = 1000000;
    int64_t* S = (int64_t*)(calloc((m + 1), 8));
    if (S == NULL) {
        return 1;
    }
    int64_t k = 1;
    while ((k <= 55 && k <= m)) {
        S[k] = FLOW_CHECKED_MOD((((100003 - (200003 * k)) + (((300007 * k) * k) * k))), (MOD));
        if (S[k] < 0) {
            S[k] = (S[k] + MOD);
        }
        k = (k + 1);
    }
    k = 56;
    while (k <= m) {
        S[k] = FLOW_CHECKED_MOD(((S[(k - 24)] + S[(k - 55)])), (MOD));
        k = (k + 1);
    }
    int32_t B = 400;
    int32_t max_coord = 10400;
    int32_t nb = FLOW_CHECKED_DIV((((max_coord + B) - 1)), (B));
    int64_t nblocks = ((((int64_t)(nb)) * ((int64_t)(nb))) * ((int64_t)(nb)));
    int32_t* bcount = (int32_t*)(calloc(nblocks, 4));
    int32_t* cx0 = (int32_t*)(calloc(N, 4));
    int32_t* cx1 = (int32_t*)(calloc(N, 4));
    int32_t* cy0 = (int32_t*)(calloc(N, 4));
    int32_t* cy1 = (int32_t*)(calloc(N, 4));
    int32_t* cz0 = (int32_t*)(calloc(N, 4));
    int32_t* cz1 = (int32_t*)(calloc(N, 4));
    if ((bcount == NULL || cx0 == NULL)) {
        return 1;
    }
    int64_t i = 1;
    while (i <= N) {
        int32_t x0 = ((int32_t)(FLOW_CHECKED_MOD((S[((6 * i) - 5)]), (10000))));
        int32_t y0 = ((int32_t)(FLOW_CHECKED_MOD((S[((6 * i) - 4)]), (10000))));
        int32_t z0 = ((int32_t)(FLOW_CHECKED_MOD((S[((6 * i) - 3)]), (10000))));
        int32_t dx = (1 + ((int32_t)(FLOW_CHECKED_MOD((S[((6 * i) - 2)]), (399)))));
        int32_t dy = (1 + ((int32_t)(FLOW_CHECKED_MOD((S[((6 * i) - 1)]), (399)))));
        int32_t dz = (1 + ((int32_t)(FLOW_CHECKED_MOD((S[(6 * i)]), (399)))));
        cx0[(i - 1)] = x0;
        cx1[(i - 1)] = (x0 + dx);
        cy0[(i - 1)] = y0;
        cy1[(i - 1)] = (y0 + dy);
        cz0[(i - 1)] = z0;
        cz1[(i - 1)] = (z0 + dz);
        int32_t bx0 = FLOW_CHECKED_DIV((x0), (B));
        int32_t bx1 = FLOW_CHECKED_DIV((((x0 + dx) - 1)), (B));
        int32_t by0 = FLOW_CHECKED_DIV((y0), (B));
        int32_t by1 = FLOW_CHECKED_DIV((((y0 + dy) - 1)), (B));
        int32_t bz0 = FLOW_CHECKED_DIV((z0), (B));
        int32_t bz1 = FLOW_CHECKED_DIV((((z0 + dz) - 1)), (B));
        int32_t bx = bx0;
        while (bx <= bx1) {
            int32_t by = by0;
            while (by <= by1) {
                int32_t bz = bz0;
                while (bz <= bz1) {
                    int64_t idx = ((((((int64_t)(bx)) * ((int64_t)(nb))) + ((int64_t)(by))) * ((int64_t)(nb))) + ((int64_t)(bz)));
                    bcount[idx] = (bcount[idx] + 1);
                    bz = (bz + 1);
                }
                by = (by + 1);
            }
            bx = (bx + 1);
        }
        i = (i + 1);
    }
    int32_t* boff = (int32_t*)(calloc((nblocks + 1), 4));
    int64_t total_clips = 0;
    i = 0;
    while (i < nblocks) {
        boff[i] = ((int32_t)(total_clips));
        total_clips = (total_clips + ((int64_t)(bcount[i])));
        i = (i + 1);
    }
    boff[nblocks] = ((int32_t)(total_clips));
    int32_t* rx0 = (int32_t*)(calloc(total_clips, 4));
    int32_t* rx1 = (int32_t*)(calloc(total_clips, 4));
    int32_t* ry0 = (int32_t*)(calloc(total_clips, 4));
    int32_t* ry1 = (int32_t*)(calloc(total_clips, 4));
    int32_t* rz0 = (int32_t*)(calloc(total_clips, 4));
    int32_t* rz1 = (int32_t*)(calloc(total_clips, 4));
    int32_t* cur = (int32_t*)(calloc(nblocks, 4));
    if (rx0 == NULL) {
        return 1;
    }
    i = 0;
    while (i < nblocks) {
        cur[i] = boff[i];
        i = (i + 1);
    }
    i = 0;
    while (i < N) {
        int32_t x0 = cx0[i];
        int32_t x1 = cx1[i];
        int32_t y0 = cy0[i];
        int32_t y1 = cy1[i];
        int32_t z0 = cz0[i];
        int32_t z1 = cz1[i];
        int32_t bx0 = FLOW_CHECKED_DIV((x0), (B));
        int32_t bx1 = FLOW_CHECKED_DIV(((x1 - 1)), (B));
        int32_t by0 = FLOW_CHECKED_DIV((y0), (B));
        int32_t by1 = FLOW_CHECKED_DIV(((y1 - 1)), (B));
        int32_t bz0 = FLOW_CHECKED_DIV((z0), (B));
        int32_t bz1 = FLOW_CHECKED_DIV(((z1 - 1)), (B));
        int32_t bx = bx0;
        while (bx <= bx1) {
            int32_t xL = (bx * B);
            int32_t xR = (xL + B);
            int32_t r0 = 0;
            int32_t r1 = B;
            if (x0 > xL) {
                r0 = (x0 - xL);
            }
            if (x1 < xR) {
                r1 = (x1 - xL);
            }
            int32_t by = by0;
            while (by <= by1) {
                int32_t yL = (by * B);
                int32_t yR = (yL + B);
                int32_t s0 = 0;
                int32_t s1 = B;
                if (y0 > yL) {
                    s0 = (y0 - yL);
                }
                if (y1 < yR) {
                    s1 = (y1 - yL);
                }
                int32_t bz = bz0;
                while (bz <= bz1) {
                    int32_t zL = (bz * B);
                    int32_t zR = (zL + B);
                    int32_t t0 = 0;
                    int32_t t1 = B;
                    if (z0 > zL) {
                        t0 = (z0 - zL);
                    }
                    if (z1 < zR) {
                        t1 = (z1 - zL);
                    }
                    int64_t bidx = ((((((int64_t)(bx)) * ((int64_t)(nb))) + ((int64_t)(by))) * ((int64_t)(nb))) + ((int64_t)(bz)));
                    int32_t pos = cur[bidx];
                    cur[bidx] = (pos + 1);
                    rx0[pos] = r0;
                    rx1[pos] = r1;
                    ry0[pos] = s0;
                    ry1[pos] = s1;
                    rz0[pos] = t0;
                    rz1[pos] = t1;
                    bz = (bz + 1);
                }
                by = (by + 1);
            }
            bx = (bx + 1);
        }
        i = (i + 1);
    }
    int64_t volume = 0;
    int64_t bi = 0;
    while (bi < nblocks) {
        int32_t start = boff[bi];
        int32_t end = boff[(bi + 1)];
        int32_t cnt = (end - start);
        if (cnt > 0) {
            int32_t* xs = (int32_t*)(calloc(((((int64_t)(cnt)) * 2) + 2), 4));
            int32_t* ys = (int32_t*)(calloc(((((int64_t)(cnt)) * 2) + 2), 4));
            int32_t* zs = (int32_t*)(calloc(((((int64_t)(cnt)) * 2) + 2), 4));
            xs[0] = 0;
            xs[1] = B;
            ys[0] = 0;
            ys[1] = B;
            zs[0] = 0;
            zs[1] = B;
            int64_t nx = 2;
            int64_t ny = 2;
            int64_t nz = 2;
            int32_t j = start;
            while (j < end) {
                xs[nx] = rx0[j];
                nx = (nx + 1);
                xs[nx] = rx1[j];
                nx = (nx + 1);
                ys[ny] = ry0[j];
                ny = (ny + 1);
                ys[ny] = ry1[j];
                ny = (ny + 1);
                zs[nz] = rz0[j];
                nz = (nz + 1);
                zs[nz] = rz1[j];
                nz = (nz + 1);
                j = (j + 1);
            }
            nx = unique_sorted_ptr_i32_i64(xs, nx);
            ny = unique_sorted_ptr_i32_i64(ys, ny);
            nz = unique_sorted_ptr_i32_i64(zs, nz);
            int64_t stride_y = nz;
            int64_t stride_x = (ny * nz);
            int64_t size = ((nx * ny) * nz);
            int32_t* diff = (int32_t*)(calloc(size, 4));
            j = start;
            while (j < end) {
                int32_t x0i = find_idx_ptr_i32_i64_i32(xs, nx, rx0[j]);
                int32_t x1i = find_idx_ptr_i32_i64_i32(xs, nx, rx1[j]);
                int32_t y0i = find_idx_ptr_i32_i64_i32(ys, ny, ry0[j]);
                int32_t y1i = find_idx_ptr_i32_i64_i32(ys, ny, ry1[j]);
                int32_t z0i = find_idx_ptr_i32_i64_i32(zs, nz, rz0[j]);
                int32_t z1i = find_idx_ptr_i32_i64_i32(zs, nz, rz1[j]);
                diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z0i)))] = (diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z0i)))] + 1);
                diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z0i)))] = (diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z0i)))] - 1);
                diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z0i)))] = (diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z0i)))] - 1);
                diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z1i)))] = (diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z1i)))] - 1);
                diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z0i)))] = (diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z0i)))] + 1);
                diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z1i)))] = (diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y0i)) * stride_y)) + ((int64_t)(z1i)))] + 1);
                diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z1i)))] = (diff[(((((int64_t)(x0i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z1i)))] + 1);
                diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z1i)))] = (diff[(((((int64_t)(x1i)) * stride_x) + (((int64_t)(y1i)) * stride_y)) + ((int64_t)(z1i)))] - 1);
                j = (j + 1);
            }
            int64_t ii = 1;
            while (ii < nx) {
                int64_t jj = 0;
                while (jj < ny) {
                    int64_t kk = 0;
                    while (kk < nz) {
                        int64_t off = (((ii * stride_x) + (jj * stride_y)) + kk);
                        int64_t offp = ((((ii - 1) * stride_x) + (jj * stride_y)) + kk);
                        diff[off] = (diff[off] + diff[offp]);
                        kk = (kk + 1);
                    }
                    jj = (jj + 1);
                }
                ii = (ii + 1);
            }
            ii = 0;
            while (ii < nx) {
                int64_t jj = 1;
                while (jj < ny) {
                    int64_t kk = 0;
                    while (kk < nz) {
                        int64_t off = (((ii * stride_x) + (jj * stride_y)) + kk);
                        int64_t offp = (((ii * stride_x) + ((jj - 1) * stride_y)) + kk);
                        diff[off] = (diff[off] + diff[offp]);
                        kk = (kk + 1);
                    }
                    jj = (jj + 1);
                }
                ii = (ii + 1);
            }
            ii = 0;
            while ((ii + 1) < nx) {
                int64_t jj = 0;
                while ((jj + 1) < ny) {
                    int64_t dxi = ((int64_t)((xs[(ii + 1)] - xs[ii])));
                    int64_t dyj = ((int64_t)((ys[(jj + 1)] - ys[jj])));
                    int64_t area = (dxi * dyj);
                    int32_t run = 0;
                    int64_t kk = 0;
                    while ((kk + 1) < nz) {
                        run = (run + diff[(((ii * stride_x) + (jj * stride_y)) + kk)]);
                        if (run > 0) {
                            volume = (volume + (area * ((int64_t)((zs[(kk + 1)] - zs[kk])))));
                        }
                        kk = (kk + 1);
                    }
                    jj = (jj + 1);
                }
                ii = (ii + 1);
            }
            free(xs);
            free(ys);
            free(zs);
            free(diff);
        }
        bi = (bi + 1);
    }
    printf("%lld\n", volume);
    return 0;
}

Generated MLIR

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