Problem 818

SET — F(12) = sum over 12-card subsets C of S(C)^4 where S(C) is the number of SETs (affine lines) in C. Uses i128 for 81-bit masks and on-the-fly pair classification.

Answer11871909492066000
Output11871909492066000
StatusPASS
Native helperno
Runtime30 ms
Peak memory1136 KB
Time complexityO(n^4) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^4)O(n * sum)
Space complexityO(n^2)O(sum)
ApproachFlow solutionSubset sum DP
VerdictUnknown

Flow source

# Project Euler 818
# SET — F(12) = sum over 12-card subsets C of S(C)^4
# where S(C) is the number of SETs (affine lines) in C.
# Uses i128 for 81-bit masks and on-the-fly pair classification.

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

function popcount64(x: i64) -> i32 {
    let mut count: i32 = 0
    let mut v: i64 = x
    while v != 0 {
        count = count + 1
        v = v & (v - 1)
    }
    return count
}

function popcount128(x: i128) -> i32 {
    let lo: i64 = x as i64
    let hi: i64 = (x >> 64) as i64
    return popcount64(lo) + popcount64(hi)
}

function nCk(n: i32, k: i32) -> i64 {
    if k < 0 || k > n { return 0 }
    let mut kk: i32 = k
    if kk > n - kk { kk = n - kk }
    let mut r: i64 = 1
    let mut i: i32 = 0
    while i < kk {
        r = r * ((n - i) as i64) / ((i + 1) as i64)
        i = i + 1
    }
    return r
}

function vec_key(v0: i32, v1: i32, v2: i32, v3: i32) -> i32 {
    return v0 + 3 * v1 + 9 * v2 + 27 * v3
}

function third_point(i: i32, j: i32, d0: ptr<i32>, d1: ptr<i32>, d2: ptr<i32>, d3: ptr<i32>) -> i32 {
    let a0: i32 = (d0[i] + d0[j]) % 3
    let a1: i32 = (d1[i] + d1[j]) % 3
    let a2: i32 = (d2[i] + d2[j]) % 3
    let a3: i32 = (d3[i] + d3[j]) % 3
    let c0: i32 = (3 - a0) % 3
    let c1: i32 = (3 - a1) % 3
    let c2: i32 = (3 - a2) % 3
    let c3: i32 = (3 - a3) % 3
    return c0 + 3 * c1 + 9 * c2 + 27 * c3
}

struct Geometry {
    line_masks: ptr<i128>
    line_dirs: ptr<i32>
    nlines: i32
}

function build_geometry() -> Geometry {
    let d0: ptr<i32> = calloc(81, 4)
    let d1: ptr<i32> = calloc(81, 4)
    let d2: ptr<i32> = calloc(81, 4)
    let d3: ptr<i32> = calloc(81, 4)

    let mut pid: i32 = 0
    while pid < 81 {
        let mut x: i32 = pid
        d0[pid] = x % 3; x = x / 3
        d1[pid] = x % 3; x = x / 3
        d2[pid] = x % 3; x = x / 3
        d3[pid] = x % 3
        pid = pid + 1
    }

    # Negation keys
    let neg_key: ptr<i32> = calloc(81, 4)
    let mut key: i32 = 0
    while key < 81 {
        let v0: i32 = (2 * (key % 3)) % 3
        let v1: i32 = (2 * ((key / 3) % 3)) % 3
        let v2: i32 = (2 * ((key / 9) % 3)) % 3
        let v3: i32 = (2 * ((key / 27) % 3)) % 3
        neg_key[key] = vec_key(v0, v1, v2, v3)
        key = key + 1
    }

    # Direction index
    let dir_index: ptr<i32> = calloc(81, 4)
    let mut di: i32 = 0
    while di < 81 {
        dir_index[di] = -1
        di = di + 1
    }
    let dirs: ptr<i32> = calloc(40, 4)
    let mut ndirs: i32 = 0
    key = 1
    while key < 81 {
        let canon: i32 = key
        if neg_key[key] < canon { canon = neg_key[key] }
        if dir_index[canon] == -1 {
            dir_index[canon] = ndirs
            dirs[ndirs] = canon
            ndirs = ndirs + 1
        }
        key = key + 1
    }

    # Enumerate all triples from point pairs
    let triples_a: ptr<i32> = calloc(3240, 4)
    let triples_b: ptr<i32> = calloc(3240, 4)
    let triples_c: ptr<i32> = calloc(3240, 4)
    let mut ntriples: i32 = 0
    let mut i: i32 = 0
    while i < 81 {
        let mut j: i32 = i + 1
        while j < 81 {
            let k: i32 = third_point(i, j, d0, d1, d2, d3)
            if k == i || k == j {
                j = j + 1
                continue
            }
            # sort (i, j, k) into (a, b, c)
            let mut a: i32 = i
            let mut b: i32 = j
            let mut c: i32 = k
            if a > b { let t: i32 = a; a = b; b = t }
            if b > c { let t: i32 = b; b = c; c = t }
            if a > b { let t: i32 = a; a = b; b = t }
            triples_a[ntriples] = a
            triples_b[ntriples] = b
            triples_c[ntriples] = c
            ntriples = ntriples + 1
            j = j + 1
        }
        i = i + 1
    }

    # Shell sort triples by (a, b, c)
    let mut gap: i32 = ntriples / 2
    while gap > 0 {
        let mut i2: i32 = gap
        while i2 < ntriples {
            let ta: i32 = triples_a[i2]
            let tb: i32 = triples_b[i2]
            let tc: i32 = triples_c[i2]
            let mut j2: i32 = i2
            while j2 >= gap {
                let pa: i32 = triples_a[j2 - gap]
                let pb: i32 = triples_b[j2 - gap]
                let pc: i32 = triples_c[j2 - gap]
                let do_swap: bool = false
                if pa > ta {
                    do_swap = true
                } else {
                    if pa == ta {
                        if pb > tb {
                            do_swap = true
                        } else {
                            if pb == tb {
                                if pc > tc { do_swap = true }
                            }
                        }
                    }
                }
                if !do_swap { break }
                triples_a[j2] = pa
                triples_b[j2] = pb
                triples_c[j2] = pc
                j2 = j2 - gap
            }
            triples_a[j2] = ta
            triples_b[j2] = tb
            triples_c[j2] = tc
            i2 = i2 + 1
        }
        gap = gap / 2
    }

    # Deduplicate
    let mut unique: i32 = 0
    let mut ti: i32 = 0
    while ti < ntriples {
        if ti == 0 || triples_a[ti] != triples_a[ti - 1] || triples_b[ti] != triples_b[ti - 1] || triples_c[ti] != triples_c[ti - 1] {
            triples_a[unique] = triples_a[ti]
            triples_b[unique] = triples_b[ti]
            triples_c[unique] = triples_c[ti]
            unique = unique + 1
        }
        ti = ti + 1
    }
    ntriples = unique

    # Compute line masks and directions
    let line_masks: ptr<i128> = calloc(ntriples as i64, 16)
    let line_dirs: ptr<i32> = calloc(ntriples as i64, 4)

    let mut idx: i32 = 0
    while idx < ntriples {
        let a: i32 = triples_a[idx]
        let b: i32 = triples_b[idx]
        let c: i32 = triples_c[idx]
        line_masks[idx] = ((1 as i128) << a) | ((1 as i128) << b) | ((1 as i128) << c)

        # Direction from a -> b
        let v0: i32 = (d0[b] - d0[a] + 3) % 3
        let v1: i32 = (d1[b] - d1[a] + 3) % 3
        let v2: i32 = (d2[b] - d2[a] + 3) % 3
        let v3: i32 = (d3[b] - d3[a] + 3) % 3
        let dkey: i32 = vec_key(v0, v1, v2, v3)
        if dkey == 0 {
            let w0: i32 = (d0[c] - d0[a] + 3) % 3
            let w1: i32 = (d1[c] - d1[a] + 3) % 3
            let w2: i32 = (d2[c] - d2[a] + 3) % 3
            let w3: i32 = (d3[c] - d3[a] + 3) % 3
            dkey = vec_key(w0, w1, w2, w3)
        }
        let canon: i32 = dkey
        if neg_key[dkey] < canon { canon = neg_key[dkey] }
        line_dirs[idx] = dir_index[canon]

        idx = idx + 1
    }

    free(d0); free(d1); free(d2); free(d3)
    free(neg_key); free(dir_index); free(dirs)
    free(triples_a); free(triples_b); free(triples_c)

    return Geometry { line_masks: line_masks, line_dirs: line_dirs, nlines: ntriples }
}

function main() -> i32 {
    let geo: Geometry = build_geometry()
    let L: i32 = geo.nlines
    let line_masks: ptr<i128> = geo.line_masks
    let line_dirs: ptr<i32> = geo.line_dirs

    # Class sizes: 0=same(3), 1=intersecting(5), 2=parallel disjoint(6), 3=skew(6)
    let sizes: ptr<i32> = calloc(4, 4)
    sizes[0] = 3; sizes[1] = 5; sizes[2] = 6; sizes[3] = 6

    # Find reps and counts for each class
    let reps: ptr<i128> = calloc(4, 16)
    let counts: ptr<i64> = calloc(4, 8)
    let found: ptr<i8> = calloc(4, 1)

    let mut i: i32 = 0
    while i < L {
        let mi: i128 = line_masks[i]
        let mut j: i32 = 0
        while j < L {
            let cls: i32 = 0
            let mask: i128 = mi
            if i != j {
                let mj: i128 = line_masks[j]
                mask = mi | mj
                if (mi & mj) != (0 as i128) {
                    cls = 1
                } else {
                    if line_dirs[i] == line_dirs[j] {
                        cls = 2
                    } else {
                        cls = 3
                    }
                }
            }
            counts[cls] = counts[cls] + 1
            if found[cls] == 0 {
                reps[cls] = mask
                found[cls] = 1
            }
            j = j + 1
        }
        i = i + 1
    }

    # Compute A_k
    let A_k: ptr<i128> = calloc(13, 16)

    let mut a: i32 = 0
    while a < 4 {
        let repA: i128 = reps[a]
        let countA: i64 = counts[a]
        let sizeA: i32 = sizes[a]

        let mut b: i32 = 0
        while b < 4 {
            let sizeB: i32 = sizes[b]
            let dist: ptr<i64> = calloc(7, 8)

            let mut i2: i32 = 0
            while i2 < L {
                let mi: i128 = line_masks[i2]
                let mut j2: i32 = 0
                while j2 < L {
                    let cls: i32 = 0
                    let mask: i128 = mi
                    if i2 != j2 {
                        let mj: i128 = line_masks[j2]
                        mask = mi | mj
                        if (mi & mj) != (0 as i128) {
                            cls = 1
                        } else {
                            if line_dirs[i2] == line_dirs[j2] {
                                cls = 2
                            } else {
                                cls = 3
                            }
                        }
                    }
                    if cls == b {
                        let r: i32 = popcount128(repA & mask)
                        dist[r] = dist[r] + 1
                    }
                    j2 = j2 + 1
                }
                i2 = i2 + 1
            }

            let mut r: i32 = 0
            while r <= 6 {
                if dist[r] > 0 {
                    let k: i32 = sizeA + sizeB - r
                    A_k[k] = A_k[k] + (countA as i128) * (dist[r] as i128)
                }
                r = r + 1
            }
            free(dist)
            b = b + 1
        }
        a = a + 1
    }

    # F(12) = sum A_k[k] * C(81-k, 12-k)
    let mut tot: i128 = 0
    let mut k: i32 = 0
    while k <= 12 {
        if A_k[k] != (0 as i128) {
            tot = tot + A_k[k] * (nCk(81 - k, 12 - k) as i128)
        }
        k = k + 1
    }

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

    free(sizes); free(reps); free(counts); free(found)
    free(A_k)
    free(line_masks); free(line_dirs)
    return 0
}

Generated C

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

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

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

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

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

#include <math.h>

void* _ui_state = NULL;

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

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

typedef struct Geometry Geometry;

struct Geometry {
    __int128* line_masks;
    int32_t* line_dirs;
    int32_t nlines;
};

int32_t popcount64_i64(int64_t x);
int32_t popcount128_i128(__int128 x);
int64_t nCk_i32_i32(int32_t n, int32_t k);
int32_t vec_key_i32_i32_i32_i32(int32_t v0, int32_t v1, int32_t v2, int32_t v3);
int32_t third_point_i32_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32(int32_t i, int32_t j, int32_t* d0, int32_t* d1, int32_t* d2, int32_t* d3);
Geometry build_geometry(void);
int32_t main(void);



int32_t popcount64_i64(int64_t x) {
    int32_t count = 0;
    int64_t v = x;
    while (v != 0) {
        count = (count + 1);
        v = (v & (v - 1));
    }
    return count;
}

int32_t popcount128_i128(__int128 x) {
    int64_t lo = ((int64_t)(x));
    int64_t hi = ((int64_t)(FLOW_CHECKED_SHR((x), (64))));
    return (popcount64_i64(lo) + popcount64_i64(hi));
}

int64_t nCk_i32_i32(int32_t n, int32_t k) {
    if ((k < 0 || k > n)) {
        return 0;
    }
    int32_t kk = k;
    if (kk > (n - kk)) {
        kk = (n - kk);
    }
    int64_t r = 1;
    int32_t i = 0;
    while (i < kk) {
        r = FLOW_CHECKED_DIV(((r * ((int64_t)((n - i))))), (((int64_t)((i + 1)))));
        i = (i + 1);
    }
    return r;
}

int32_t vec_key_i32_i32_i32_i32(int32_t v0, int32_t v1, int32_t v2, int32_t v3) {
    return (((v0 + (3 * v1)) + (9 * v2)) + (27 * v3));
}

int32_t third_point_i32_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32(int32_t i, int32_t j, int32_t* d0, int32_t* d1, int32_t* d2, int32_t* d3) {
    int32_t a0 = FLOW_CHECKED_MOD(((d0[i] + d0[j])), (3));
    int32_t a1 = FLOW_CHECKED_MOD(((d1[i] + d1[j])), (3));
    int32_t a2 = FLOW_CHECKED_MOD(((d2[i] + d2[j])), (3));
    int32_t a3 = FLOW_CHECKED_MOD(((d3[i] + d3[j])), (3));
    int32_t c0 = FLOW_CHECKED_MOD(((3 - a0)), (3));
    int32_t c1 = FLOW_CHECKED_MOD(((3 - a1)), (3));
    int32_t c2 = FLOW_CHECKED_MOD(((3 - a2)), (3));
    int32_t c3 = FLOW_CHECKED_MOD(((3 - a3)), (3));
    return (((c0 + (3 * c1)) + (9 * c2)) + (27 * c3));
}

Geometry build_geometry(void) {
    int32_t* d0 = (int32_t*)(calloc(81, 4));
    int32_t* d1 = (int32_t*)(calloc(81, 4));
    int32_t* d2 = (int32_t*)(calloc(81, 4));
    int32_t* d3 = (int32_t*)(calloc(81, 4));
    int32_t pid = 0;
    while (pid < 81) {
        int32_t x = pid;
        d0[pid] = FLOW_CHECKED_MOD((x), (3));
        x = FLOW_CHECKED_DIV((x), (3));
        d1[pid] = FLOW_CHECKED_MOD((x), (3));
        x = FLOW_CHECKED_DIV((x), (3));
        d2[pid] = FLOW_CHECKED_MOD((x), (3));
        x = FLOW_CHECKED_DIV((x), (3));
        d3[pid] = FLOW_CHECKED_MOD((x), (3));
        pid = (pid + 1);
    }
    int32_t* neg_key = (int32_t*)(calloc(81, 4));
    int32_t key = 0;
    while (key < 81) {
        int32_t v0 = FLOW_CHECKED_MOD(((2 * FLOW_CHECKED_MOD((key), (3)))), (3));
        int32_t v1 = FLOW_CHECKED_MOD(((2 * FLOW_CHECKED_MOD((FLOW_CHECKED_DIV((key), (3))), (3)))), (3));
        int32_t v2 = FLOW_CHECKED_MOD(((2 * FLOW_CHECKED_MOD((FLOW_CHECKED_DIV((key), (9))), (3)))), (3));
        int32_t v3 = FLOW_CHECKED_MOD(((2 * FLOW_CHECKED_MOD((FLOW_CHECKED_DIV((key), (27))), (3)))), (3));
        neg_key[key] = vec_key_i32_i32_i32_i32(v0, v1, v2, v3);
        key = (key + 1);
    }
    int32_t* dir_index = (int32_t*)(calloc(81, 4));
    int32_t di = 0;
    while (di < 81) {
        dir_index[di] = (-1);
        di = (di + 1);
    }
    int32_t* dirs = (int32_t*)(calloc(40, 4));
    int32_t ndirs = 0;
    key = 1;
    while (key < 81) {
        int32_t canon = key;
        if (neg_key[key] < canon) {
            canon = neg_key[key];
        }
        if (dir_index[canon] == (-1)) {
            dir_index[canon] = ndirs;
            dirs[ndirs] = canon;
            ndirs = (ndirs + 1);
        }
        key = (key + 1);
    }
    int32_t* triples_a = (int32_t*)(calloc(3240, 4));
    int32_t* triples_b = (int32_t*)(calloc(3240, 4));
    int32_t* triples_c = (int32_t*)(calloc(3240, 4));
    int32_t ntriples = 0;
    int32_t i = 0;
    while (i < 81) {
        int32_t j = (i + 1);
        while (j < 81) {
            int32_t k = third_point_i32_i32_ptr_i32_ptr_i32_ptr_i32_ptr_i32(i, j, d0, d1, d2, d3);
            if ((k == i || k == j)) {
                j = (j + 1);
                continue;
            }
            int32_t a = i;
            int32_t b = j;
            int32_t c = k;
            if (a > b) {
                int32_t t = a;
                a = b;
                b = t;
            }
            if (b > c) {
                int32_t t = b;
                b = c;
                c = t;
            }
            if (a > b) {
                int32_t t = a;
                a = b;
                b = t;
            }
            triples_a[ntriples] = a;
            triples_b[ntriples] = b;
            triples_c[ntriples] = c;
            ntriples = (ntriples + 1);
            j = (j + 1);
        }
        i = (i + 1);
    }
    int32_t gap = FLOW_CHECKED_DIV((ntriples), (2));
    while (gap > 0) {
        int32_t i2 = gap;
        while (i2 < ntriples) {
            int32_t ta = triples_a[i2];
            int32_t tb = triples_b[i2];
            int32_t tc = triples_c[i2];
            int32_t j2 = i2;
            while (j2 >= gap) {
                int32_t pa = triples_a[(j2 - gap)];
                int32_t pb = triples_b[(j2 - gap)];
                int32_t pc = triples_c[(j2 - gap)];
                bool do_swap = 0;
                if (pa > ta) {
                    do_swap = 1;
                } else {
                    if (pa == ta) {
                        if (pb > tb) {
                            do_swap = 1;
                        } else {
                            if (pb == tb) {
                                if (pc > tc) {
                                    do_swap = 1;
                                }
                            }
                        }
                    }
                }
                if ((!(do_swap))) {
                    break;
                }
                triples_a[j2] = pa;
                triples_b[j2] = pb;
                triples_c[j2] = pc;
                j2 = (j2 - gap);
            }
            triples_a[j2] = ta;
            triples_b[j2] = tb;
            triples_c[j2] = tc;
            i2 = (i2 + 1);
        }
        gap = FLOW_CHECKED_DIV((gap), (2));
    }
    int32_t unique = 0;
    int32_t ti = 0;
    while (ti < ntriples) {
        if ((((ti == 0 || triples_a[ti] != triples_a[(ti - 1)]) || triples_b[ti] != triples_b[(ti - 1)]) || triples_c[ti] != triples_c[(ti - 1)])) {
            triples_a[unique] = triples_a[ti];
            triples_b[unique] = triples_b[ti];
            triples_c[unique] = triples_c[ti];
            unique = (unique + 1);
        }
        ti = (ti + 1);
    }
    ntriples = unique;
    __int128* line_masks = (__int128*)(calloc(((int64_t)(ntriples)), 16));
    int32_t* line_dirs = (int32_t*)(calloc(((int64_t)(ntriples)), 4));
    int32_t idx = 0;
    while (idx < ntriples) {
        int32_t a = triples_a[idx];
        int32_t b = triples_b[idx];
        int32_t c = triples_c[idx];
        line_masks[idx] = ((FLOW_CHECKED_SHL((((__int128)(1))), (a)) | FLOW_CHECKED_SHL((((__int128)(1))), (b))) | FLOW_CHECKED_SHL((((__int128)(1))), (c)));
        int32_t v0 = FLOW_CHECKED_MOD((((d0[b] - d0[a]) + 3)), (3));
        int32_t v1 = FLOW_CHECKED_MOD((((d1[b] - d1[a]) + 3)), (3));
        int32_t v2 = FLOW_CHECKED_MOD((((d2[b] - d2[a]) + 3)), (3));
        int32_t v3 = FLOW_CHECKED_MOD((((d3[b] - d3[a]) + 3)), (3));
        int32_t dkey = vec_key_i32_i32_i32_i32(v0, v1, v2, v3);
        if (dkey == 0) {
            int32_t w0 = FLOW_CHECKED_MOD((((d0[c] - d0[a]) + 3)), (3));
            int32_t w1 = FLOW_CHECKED_MOD((((d1[c] - d1[a]) + 3)), (3));
            int32_t w2 = FLOW_CHECKED_MOD((((d2[c] - d2[a]) + 3)), (3));
            int32_t w3 = FLOW_CHECKED_MOD((((d3[c] - d3[a]) + 3)), (3));
            dkey = vec_key_i32_i32_i32_i32(w0, w1, w2, w3);
        }
        int32_t canon = dkey;
        if (neg_key[dkey] < canon) {
            canon = neg_key[dkey];
        }
        line_dirs[idx] = dir_index[canon];
        idx = (idx + 1);
    }
    free(d0);
    free(d1);
    free(d2);
    free(d3);
    free(neg_key);
    free(dir_index);
    free(dirs);
    free(triples_a);
    free(triples_b);
    free(triples_c);
    return (Geometry){ .line_masks = line_masks, .line_dirs = line_dirs, .nlines = ntriples };
}

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