Problem 584

Birthday Problem Revisited — EGF + Gauss–Laguerre + transfer matrix.

Answer32.83822408
Output32.83822408
StatusPASS
Native helperno
Runtime270 ms
Peak memory1792 KB
Time complexityO(n^4) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

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

Flow source

# Project Euler 584
# Birthday Problem Revisited — EGF + Gauss–Laguerre + transfer matrix.

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

function gauss_laguerre(n: i64, xs: ptr<f64>, ws: ptr<f64>) -> void {
    let mut z: f64 = 0.0
    let mut i: i64 = 1
    while i <= n {
        if i == 1 {
            z = 3.0 / (1.0 + 2.4 * (n as f64))
        } else {
            if i == 2 {
                z = z + 15.0 / (1.0 + 2.5 * (n as f64))
            } else {
                let ai: f64 = (i - 2) as f64
                z = z + ((1.0 + 2.55 * ai) / (1.9 * ai)) * (z - xs[i - 3])
            }
        }
        let mut it: i64 = 0
        while it < 100 {
            let mut L0: f64 = 1.0
            let mut L1: f64 = 1.0 - z
            let mut Ln: f64 = L1
            let mut Lnm1: f64 = L0
            if n == 1 {
                Ln = L1
                Lnm1 = L0
            } else {
                let mut k: i64 = 2
                while k <= n {
                    let L2: f64 = ((2.0 * (k as f64) - 1.0 - z) * L1 - ((k - 1) as f64) * L0) / (k as f64)
                    L0 = L1
                    L1 = L2
                    k = k + 1
                }
                Ln = L1
                Lnm1 = L0
            }
            let dLn: f64 = (n as f64) * (Ln - Lnm1) / z
            let dz: f64 = Ln / dLn
            z = z - dz
            if fabs(dz) < 1e-14 { break }
            it = it + 1
        }
        xs[i - 1] = z
        let mut L0b: f64 = 1.0
        let mut L1b: f64 = 1.0 - z
        let mut k2: i64 = 2
        while k2 <= n + 1 {
            let L2b: f64 = ((2.0 * (k2 as f64) - 1.0 - z) * L1b - ((k2 - 1) as f64) * L0b) / (k2 as f64)
            L0b = L1b
            L1b = L2b
            k2 = k2 + 1
        }
        let Ln1: f64 = L1b
        ws[i - 1] = z / (((n + 1) as f64) * ((n + 1) as f64) * Ln1 * Ln1)
        i = i + 1
    }
}

# Enumerate states: compositions of remaining into state_len buckets, sum <= max_total
# Store states as packed i64 with 4 bits per day count (max_total<=3 fits)

function pack_state(cur: ptr<i64>, len: i64) -> i64 {
    let mut key: i64 = 0
    let mut i: i64 = 0
    while i < len {
        key = (key << 4) | cur[i]
        i = i + 1
    }
    return key
}

function expected_people(N: i64, within_days: i64, target_people: i64, quad_n: i64) -> f64 {
    let window_len: i64 = within_days + 1
    let max_total: i64 = target_people - 1
    let state_len: i64 = window_len - 1
    # Max states: C(state_len + max_total, max_total) roughly <= 2000 for our params
    let max_states: i64 = 5000
    let states: ptr<i64> = calloc(max_states, 8)
    let keys: ptr<i64> = calloc(max_states, 8)
    let mut nstates: i64 = 0
    let cur: ptr<i64> = calloc(state_len, 8)

    nstates = enumerate_states(state_len, max_total, states, keys, max_states)
    # states layout: states[s * state_len + j]

    # Build transitions: for each state, for each c in 0..max_total-sum, next state
    let trans_to: ptr<i64> = calloc(max_states * (max_total + 1), 8)
    let trans_c: ptr<i64> = calloc(max_states * (max_total + 1), 8)
    let trans_n: ptr<i64> = calloc(max_states, 8)
    let mut s: i64 = 0
    while s < nstates {
        let mut ssum: i64 = 0
        let mut j: i64 = 0
        while j < state_len {
            ssum = ssum + states[s * state_len + j]
            j = j + 1
        }
        let mut c: i64 = 0
        let mut cnt: i64 = 0
        while c <= max_total - ssum {
            # next = shift + append c
            let mut key: i64 = 0
            j = 1
            while j < state_len {
                key = (key << 4) | states[s * state_len + j]
                j = j + 1
            }
            key = (key << 4) | c
            # find index
            let mut ns: i64 = 0
            while ns < nstates {
                if keys[ns] == key { break }
                ns = ns + 1
            }
            trans_to[s * (max_total + 1) + cnt] = ns
            trans_c[s * (max_total + 1) + cnt] = c
            cnt = cnt + 1
            c = c + 1
        }
        trans_n[s] = cnt
        s = s + 1
    }

    let xs: ptr<f64> = calloc(quad_n, 8)
    let ws: ptr<f64> = calloc(quad_n, 8)
    gauss_laguerre(quad_n, xs, ws)
    let mut acc: f64 = 0.0
    let mut qi: i64 = 0
    while qi < quad_n {
        let tval: f64 = xs[qi]
        let wgt: f64 = ws[qi]
        let g: f64 = trace_power(N, nstates, max_total, trans_to, trans_c, trans_n, tval)
        acc = acc + wgt * g
        qi = qi + 1
    }
    free(states)
    free(keys)
    free(cur)
    free(trans_to)
    free(trans_c)
    free(trans_n)
    free(xs)
    free(ws)
    return acc
}

function enumerate_states(state_len: i64, max_total: i64, states: ptr<i64>, keys: ptr<i64>, max_states: i64) -> i64 {
    let cur: ptr<i64> = calloc(state_len, 8)
    let n_ptr: ptr<i64> = calloc(1, 8)
    n_ptr[0] = 0
    enum_rec(0, max_total, state_len, max_total, cur, states, keys, n_ptr, max_states)
    let n: i64 = n_ptr[0]
    free(cur)
    free(n_ptr)
    return n
}

function enum_rec(pos: i64, remaining: i64, state_len: i64, max_total: i64, cur: ptr<i64>, states: ptr<i64>, keys: ptr<i64>, n_ptr: ptr<i64>, max_states: i64) -> void {
    if pos == state_len {
        let n: i64 = n_ptr[0]
        if n >= max_states { return }
        let mut key: i64 = 0
        let mut i: i64 = 0
        while i < state_len {
            states[n * state_len + i] = cur[i]
            key = (key << 4) | cur[i]
            i = i + 1
        }
        keys[n] = key
        n_ptr[0] = n + 1
        return
    }
    let mut v: i64 = 0
    while v <= remaining {
        cur[pos] = v
        enum_rec(pos + 1, remaining - v, state_len, max_total, cur, states, keys, n_ptr, max_states)
        v = v + 1
    }
}

function trace_power(N: i64, S: i64, max_total: i64, trans_to: ptr<i64>, trans_c: ptr<i64>, trans_n: ptr<i64>, t: f64) -> f64 {
    let ratio: f64 = t / (N as f64)
    let w0: f64 = 1.0
    let w1: f64 = ratio
    let mut w2: f64 = 0.0
    let mut w3: f64 = 0.0
    if max_total >= 2 { w2 = (ratio * ratio) * 0.5 }
    if max_total >= 3 { w3 = (ratio * ratio * ratio) / 6.0 }
    let w: ptr<f64> = calloc(4, 8)
    w[0] = w0
    w[1] = w1
    w[2] = w2
    w[3] = w3
    let mut total: f64 = 0.0
    let v: ptr<f64> = calloc(S, 8)
    let nv: ptr<f64> = calloc(S, 8)
    let mut start: i64 = 0
    while start < S {
        let mut i: i64 = 0
        while i < S {
            v[i] = 0.0
            i = i + 1
        }
        v[start] = 1.0
        let mut step: i64 = 0
        while step < N {
            i = 0
            while i < S {
                nv[i] = 0.0
                i = i + 1
            }
            i = 0
            while i < S {
                let val: f64 = v[i]
                if val != 0.0 {
                    let mut k: i64 = 0
                    while k < trans_n[i] {
                        let j: i64 = trans_to[i * (max_total + 1) + k]
                        let c: i64 = trans_c[i * (max_total + 1) + k]
                        nv[j] = nv[j] + val * w[c]
                        k = k + 1
                    }
                }
                i = i + 1
            }
            i = 0
            while i < S {
                v[i] = nv[i]
                i = i + 1
            }
            step = step + 1
        }
        total = total + v[start]
        start = start + 1
    }
    free(w)
    free(v)
    free(nv)
    return total
}

function main() -> i32 {
    let ans: f64 = expected_people(365, 7, 4, 28)
    printf("%.8f\n", ans)
    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 gauss_laguerre_i64_ptr_f64_ptr_f64(int64_t n, double* xs, double* ws);
int64_t pack_state_ptr_i64_i64(int64_t* cur, int64_t len);
double expected_people_i64_i64_i64_i64(int64_t N, int64_t within_days, int64_t target_people, int64_t quad_n);
int64_t enumerate_states_i64_i64_ptr_i64_ptr_i64_i64(int64_t state_len, int64_t max_total, int64_t* states, int64_t* keys, int64_t max_states);
void enum_rec_i64_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64(int64_t pos, int64_t remaining, int64_t state_len, int64_t max_total, int64_t* cur, int64_t* states, int64_t* keys, int64_t* n_ptr, int64_t max_states);
double trace_power_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_f64(int64_t N, int64_t S, int64_t max_total, int64_t* trans_to, int64_t* trans_c, int64_t* trans_n, double t);
int32_t main(void);




void gauss_laguerre_i64_ptr_f64_ptr_f64(int64_t n, double* xs, double* ws) {
    double z = 0.0;
    int64_t i = 1;
    while (i <= n) {
        if (i == 1) {
            z = (3.0 / (1.0 + (2.4 * ((double)(n)))));
        } else {
            if (i == 2) {
                z = (z + (15.0 / (1.0 + (2.5 * ((double)(n))))));
            } else {
                double ai = ((double)((i - 2)));
                z = (z + (((1.0 + (2.55 * ai)) / (1.9 * ai)) * (z - xs[(i - 3)])));
            }
        }
        int64_t it = 0;
        while (it < 100) {
            double L0 = 1.0;
            double L1 = (1.0 - z);
            double Ln = L1;
            double Lnm1 = L0;
            if (n == 1) {
                Ln = L1;
                Lnm1 = L0;
            } else {
                int64_t k = 2;
                while (k <= n) {
                    double L2 = ((((((2.0 * ((double)(k))) - 1.0) - z) * L1) - (((double)((k - 1))) * L0)) / ((double)(k)));
                    L0 = L1;
                    L1 = L2;
                    k = (k + 1);
                }
                Ln = L1;
                Lnm1 = L0;
            }
            double dLn = ((((double)(n)) * (Ln - Lnm1)) / z);
            double dz = (Ln / dLn);
            z = (z - dz);
            if (fabs(dz) < 1e-14) {
                break;
            }
            it = (it + 1);
        }
        xs[(i - 1)] = z;
        double L0b = 1.0;
        double L1b = (1.0 - z);
        int64_t k2 = 2;
        while (k2 <= (n + 1)) {
            double L2b = ((((((2.0 * ((double)(k2))) - 1.0) - z) * L1b) - (((double)((k2 - 1))) * L0b)) / ((double)(k2)));
            L0b = L1b;
            L1b = L2b;
            k2 = (k2 + 1);
        }
        double Ln1 = L1b;
        ws[(i - 1)] = (z / (((((double)((n + 1))) * ((double)((n + 1)))) * Ln1) * Ln1));
        i = (i + 1);
    }
}

int64_t pack_state_ptr_i64_i64(int64_t* cur, int64_t len) {
    int64_t key = 0;
    int64_t i = 0;
    while (i < len) {
        key = (FLOW_CHECKED_SHL((key), (4)) | cur[i]);
        i = (i + 1);
    }
    return key;
}

double expected_people_i64_i64_i64_i64(int64_t N, int64_t within_days, int64_t target_people, int64_t quad_n) {
    int64_t window_len = (within_days + 1);
    int64_t max_total = (target_people - 1);
    int64_t state_len = (window_len - 1);
    int64_t max_states = 5000;
    int64_t* states = (int64_t*)(calloc(max_states, 8));
    int64_t* keys = (int64_t*)(calloc(max_states, 8));
    int64_t nstates = 0;
    int64_t* cur = (int64_t*)(calloc(state_len, 8));
    nstates = enumerate_states_i64_i64_ptr_i64_ptr_i64_i64(state_len, max_total, states, keys, max_states);
    int64_t* trans_to = (int64_t*)(calloc((max_states * (max_total + 1)), 8));
    int64_t* trans_c = (int64_t*)(calloc((max_states * (max_total + 1)), 8));
    int64_t* trans_n = (int64_t*)(calloc(max_states, 8));
    int64_t s = 0;
    while (s < nstates) {
        int64_t ssum = 0;
        int64_t j = 0;
        while (j < state_len) {
            ssum = (ssum + states[((s * state_len) + j)]);
            j = (j + 1);
        }
        int64_t c = 0;
        int64_t cnt = 0;
        while (c <= (max_total - ssum)) {
            int64_t key = 0;
            j = 1;
            while (j < state_len) {
                key = (FLOW_CHECKED_SHL((key), (4)) | states[((s * state_len) + j)]);
                j = (j + 1);
            }
            key = (FLOW_CHECKED_SHL((key), (4)) | c);
            int64_t ns = 0;
            while (ns < nstates) {
                if (keys[ns] == key) {
                    break;
                }
                ns = (ns + 1);
            }
            trans_to[((s * (max_total + 1)) + cnt)] = ns;
            trans_c[((s * (max_total + 1)) + cnt)] = c;
            cnt = (cnt + 1);
            c = (c + 1);
        }
        trans_n[s] = cnt;
        s = (s + 1);
    }
    double* xs = (double*)(calloc(quad_n, 8));
    double* ws = (double*)(calloc(quad_n, 8));
    gauss_laguerre_i64_ptr_f64_ptr_f64(quad_n, xs, ws);
    double acc = 0.0;
    int64_t qi = 0;
    while (qi < quad_n) {
        double tval = xs[qi];
        double wgt = ws[qi];
        double g = trace_power_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_f64(N, nstates, max_total, trans_to, trans_c, trans_n, tval);
        acc = (acc + (wgt * g));
        qi = (qi + 1);
    }
    free(states);
    free(keys);
    free(cur);
    free(trans_to);
    free(trans_c);
    free(trans_n);
    free(xs);
    free(ws);
    return acc;
}

int64_t enumerate_states_i64_i64_ptr_i64_ptr_i64_i64(int64_t state_len, int64_t max_total, int64_t* states, int64_t* keys, int64_t max_states) {
    int64_t* cur = (int64_t*)(calloc(state_len, 8));
    int64_t* n_ptr = (int64_t*)(calloc(1, 8));
    n_ptr[0] = 0;
    enum_rec_i64_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64(0, max_total, state_len, max_total, cur, states, keys, n_ptr, max_states);
    int64_t n = n_ptr[0];
    free(cur);
    free(n_ptr);
    return n;
}

void enum_rec_i64_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64(int64_t pos, int64_t remaining, int64_t state_len, int64_t max_total, int64_t* cur, int64_t* states, int64_t* keys, int64_t* n_ptr, int64_t max_states) {
    if (pos == state_len) {
        int64_t n = n_ptr[0];
        if (n >= max_states) {
            return;
        }
        int64_t key = 0;
        int64_t i = 0;
        while (i < state_len) {
            states[((n * state_len) + i)] = cur[i];
            key = (FLOW_CHECKED_SHL((key), (4)) | cur[i]);
            i = (i + 1);
        }
        keys[n] = key;
        n_ptr[0] = (n + 1);
        return;
    }
    int64_t v = 0;
    while (v <= remaining) {
        cur[pos] = v;
        enum_rec_i64_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_ptr_i64_i64((pos + 1), (remaining - v), state_len, max_total, cur, states, keys, n_ptr, max_states);
        v = (v + 1);
    }
}

double trace_power_i64_i64_i64_ptr_i64_ptr_i64_ptr_i64_f64(int64_t N, int64_t S, int64_t max_total, int64_t* trans_to, int64_t* trans_c, int64_t* trans_n, double t) {
    double ratio = (t / ((double)(N)));
    double w0 = 1.0;
    double w1 = ratio;
    double w2 = 0.0;
    double w3 = 0.0;
    if (max_total >= 2) {
        w2 = ((ratio * ratio) * 0.5);
    }
    if (max_total >= 3) {
        w3 = (((ratio * ratio) * ratio) / 6.0);
    }
    double* w = (double*)(calloc(4, 8));
    w[0] = w0;
    w[1] = w1;
    w[2] = w2;
    w[3] = w3;
    double total = 0.0;
    double* v = (double*)(calloc(S, 8));
    double* nv = (double*)(calloc(S, 8));
    int64_t start = 0;
    while (start < S) {
        int64_t i = 0;
        while (i < S) {
            v[i] = 0.0;
            i = (i + 1);
        }
        v[start] = 1.0;
        int64_t step = 0;
        while (step < N) {
            i = 0;
            while (i < S) {
                nv[i] = 0.0;
                i = (i + 1);
            }
            i = 0;
            while (i < S) {
                double val = v[i];
                if (val != 0.0) {
                    int64_t k = 0;
                    while (k < trans_n[i]) {
                        int64_t j = trans_to[((i * (max_total + 1)) + k)];
                        int64_t c = trans_c[((i * (max_total + 1)) + k)];
                        nv[j] = (nv[j] + (val * w[c]));
                        k = (k + 1);
                    }
                }
                i = (i + 1);
            }
            i = 0;
            while (i < S) {
                v[i] = nv[i];
                i = (i + 1);
            }
            step = (step + 1);
        }
        total = (total + v[start]);
        start = (start + 1);
    }
    free(w);
    free(v);
    free(nv);
    return total;
}

int32_t main(void) {
    double ans = expected_people_i64_i64_i64_i64(365, 7, 4, 28);
    printf("%.8f\n", ans);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%.8f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  func.func private @fabs(f64) -> f64
  func.func @gauss_laguerre(%arg0: i64, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> () {
    %0 = arith.constant 0.0 : f32
    %1 = arith.extf %0 : f32 to f64
    %2 = llvm.mlir.constant(1 : i64) : i64
    %3 = llvm.alloca %2 x f64 : (i64) -> !llvm.ptr
    llvm.store %1, %3 : f64, !llvm.ptr
    %4 = arith.constant 1 : i32
    %5 = arith.extsi %4 : i32 to i64
    %6 = llvm.mlir.constant(1 : i64) : i64
    %7 = llvm.alloca %6 x i64 : (i64) -> !llvm.ptr
    llvm.store %5, %7 : i64, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %8 = llvm.load %7 : !llvm.ptr -> i64
    %9 = arith.cmpi sle, %8, %arg0 : i64
    cf.cond_br %9, ^bb1, ^bb2
    ^bb1:
      %10 = llvm.load %7 : !llvm.ptr -> i64
      %11 = arith.constant 1 : i32
      %13 = arith.extsi %11 : i32 to i64
      %12 = arith.cmpi eq, %10, %13 : i64
      cf.cond_br %12, ^bb3, ^bb4
      ^bb3:
        %14 = arith.constant 3.0 : f32
        %15 = arith.constant 1.0 : f32
        %16 = arith.constant 2.4 : f32
        %17 = arith.sitofp %arg0 : i64 to f64
        %19 = arith.extf %16 : f32 to f64
        %18 = arith.mulf %19, %17 : f64
        %21 = arith.extf %15 : f32 to f64
        %20 = arith.addf %21, %18 : f64
        %23 = arith.extf %14 : f32 to f64
        %22 = arith.divf %23, %20 : f64
        llvm.store %22, %3 : f64, !llvm.ptr
        cf.br ^bb5
      ^bb4:
        %24 = llvm.load %7 : !llvm.ptr -> i64
        %25 = arith.constant 2 : i32
        %27 = arith.extsi %25 : i32 to i64
        %26 = arith.cmpi eq, %24, %27 : i64
        cf.cond_br %26, ^bb6, ^bb7
        ^bb6:
          %28 = llvm.load %3 : !llvm.ptr -> f64
          %29 = arith.constant 15.0 : f32
          %30 = arith.constant 1.0 : f32
          %31 = arith.constant 2.5 : f32
          %32 = arith.sitofp %arg0 : i64 to f64
          %34 = arith.extf %31 : f32 to f64
          %33 = arith.mulf %34, %32 : f64
          %36 = arith.extf %30 : f32 to f64
          %35 = arith.addf %36, %33 : f64
          %38 = arith.extf %29 : f32 to f64
          %37 = arith.divf %38, %35 : f64
          %39 = arith.addf %28, %37 : f64
          llvm.store %39, %3 : f64, !llvm.ptr
          cf.br ^bb8
        ^bb7:
          %40 = llvm.load %7 : !llvm.ptr -> i64
          %41 = arith.constant 2 : i32
          %43 = arith.extsi %41 : i32 to i64
          %42 = arith.subi %40, %43 : i64
          %44 = arith.sitofp %42 : i64 to f64
          %45 = llvm.load %3 : !llvm.ptr -> f64
          %46 = arith.constant 1.0 : f32
          %47 = arith.constant 2.55 : f32
          %49 = arith.extf %47 : f32 to f64
          %48 = arith.mulf %49, %44 : f64
          %51 = arith.extf %46 : f32 to f64
          %50 = arith.addf %51, %48 : f64
          %52 = arith.constant 1.9 : f32
          %54 = arith.extf %52 : f32 to f64
          %53 = arith.mulf %54, %44 : f64
          %55 = arith.divf %50, %53 : f64
          %56 = llvm.load %3 : !llvm.ptr -> f64
          %58 = llvm.load %7 : !llvm.ptr -> i64
          %59 = arith.constant 3 : i32
          %61 = arith.extsi %59 : i32 to i64
          %60 = arith.subi %58, %61 : i64
          %62 = llvm.getelementptr %arg1[%60] : (!llvm.ptr, i64) -> !llvm.ptr, f64
          %57 = llvm.load %62 : !llvm.ptr -> f64
          %63 = arith.subf %56, %57 : f64
          %64 = arith.mulf %55, %63 : f64
          %65 = arith.addf %45, %64 : f64
          llvm.store %65, %3 : f64, !llvm.ptr
          cf.br ^bb8
        ^bb8:
        cf.br ^bb5
      ^bb5:
      %66 = arith.constant 0 : i32
      %67 = arith.extsi %66 : i32 to i64
      %68 = llvm.mlir.constant(1 : i64) : i64
      %69 = llvm.alloca %68 x i64 : (i64) -> !llvm.ptr
      llvm.store %67, %69 : i64, !llvm.ptr
      cf.br ^bb9
      ^bb9:
      %70 = llvm.load %69 : !llvm.ptr -> i64
      %71 = arith.constant 100 : i32
      %73 = arith.extsi %71 : i32 to i64
      %72 = arith.cmpi slt, %70, %73 : i64
      cf.cond_br %72, ^bb10, ^bb11
      ^bb10:
        %74 = arith.constant 1.0 : f32
        %75 = arith.extf %74 : f32 to f64
        %76 = llvm.mlir.constant(1 : i64) : i64
        %77 = llvm.alloca %76 x f64 : (i64) -> !llvm.ptr
        llvm.store %75, %77 : f64, !llvm.ptr
        %78 = arith.constant 1.0 : f32
        %79 = llvm.load %3 : !llvm.ptr -> f64
        %81 = arith.extf %78 : f32 to f64
        %80 = arith.subf %81, %79 : f64
        %82 = llvm.mlir.constant(1 : i64) : i64
        %83 = llvm.alloca %82 x f64 : (i64) -> !llvm.ptr
        llvm.store %80, %83 : f64, !llvm.ptr
        %84 = llvm.load %83 : !llvm.ptr -> f64
        %85 = llvm.mlir.constant(1 : i64) : i64
        %86 = llvm.alloca %85 x f64 : (i64) -> !llvm.ptr
        llvm.store %84, %86 : f64, !llvm.ptr
        %87 = llvm.load %77 : !llvm.ptr -> f64
        %88 = llvm.mlir.constant(1 : i64) : i64
        %89 = llvm.alloca %88 x f64 : (i64) -> !llvm.ptr
        llvm.store %87, %89 : f64, !llvm.ptr
        %90 = arith.constant 1 : i32
        %92 = arith.extsi %90 : i32 to i64
        %91 = arith.cmpi eq, %arg0, %92 : i64
        cf.cond_br %91, ^bb12, ^bb13
        ^bb12:
          %93 = llvm.load %83 : !llvm.ptr -> f64
          llvm.store %93, %86 : f64, !llvm.ptr
          %94 = llvm.load %77 : !llvm.ptr -> f64
          llvm.store %94, %89 : f64, !llvm.ptr
          cf.br ^bb14
        ^bb13:
          %95 = arith.constant 2 : i32
          %96 = arith.extsi %95 : i32 to i64
          %97 = llvm.mlir.constant(1 : i64) : i64
          %98 = llvm.alloca %97 x i64 : (i64) -> !llvm.ptr
          llvm.store %96, %98 : i64, !llvm.ptr
          cf.br ^bb15
          ^bb15:
          %99 = llvm.load %98 : !llvm.ptr -> i64
          %100 = arith.cmpi sle, %99, %arg0 : i64
          cf.cond_br %100, ^bb16, ^bb17
          ^bb16:
            %101 = arith.constant 2.0 : f32
            %102 = llvm.load %98 : !llvm.ptr -> i64
            %103 = arith.sitofp %102 : i64 to f64
            %105 = arith.extf %101 : f32 to f64
            %104 = arith.mulf %105, %103 : f64
            %106 = arith.constant 1.0 : f32
            %108 = arith.extf %106 : f32 to f64
            %107 = arith.subf %104, %108 : f64
            %109 = llvm.load %3 : !llvm.ptr -> f64
            %110 = arith.subf %107, %109 : f64
            %111 = llvm.load %83 : !llvm.ptr -> f64
            %112 = arith.mulf %110, %111 : f64
            %113 = llvm.load %98 : !llvm.ptr -> i64
            %114 = arith.constant 1 : i32
            %116 = arith.extsi %114 : i32 to i64
            %115 = arith.subi %113, %116 : i64
            %117 = arith.sitofp %115 : i64 to f64
            %118 = llvm.load %77 : !llvm.ptr -> f64
            %119 = arith.mulf %117, %118 : f64
            %120 = arith.subf %112, %119 : f64
            %121 = llvm.load %98 : !llvm.ptr -> i64
            %122 = arith.sitofp %121 : i64 to f64
            %123 = arith.divf %120, %122 : f64
            %124 = llvm.load %83 : !llvm.ptr -> f64
            llvm.store %124, %77 : f64, !llvm.ptr
            llvm.store %123, %83 : f64, !llvm.ptr
            %125 = llvm.load %98 : !llvm.ptr -> i64
            %126 = arith.constant 1 : i32
            %128 = arith.extsi %126 : i32 to i64
            %127 = arith.addi %125, %128 : i64
            llvm.store %127, %98 : i64, !llvm.ptr
            cf.br ^bb15
          ^bb17:
          %129 = llvm.load %83 : !llvm.ptr -> f64
          llvm.store %129, %86 : f64, !llvm.ptr
          %130 = llvm.load %77 : !llvm.ptr -> f64
          llvm.store %130, %89 : f64, !llvm.ptr
          cf.br ^bb14
        ^bb14:
        %131 = arith.sitofp %arg0 : i64 to f64
        %132 = llvm.load %86 : !llvm.ptr -> f64
        %133 = llvm.load %89 : !llvm.ptr -> f64
        %134 = arith.subf %132, %133 : f64
        %135 = arith.mulf %131, %134 : f64
        %136 = llvm.load %3 : !llvm.ptr -> f64
        %137 = arith.divf %135, %136 : f64
        %138 = llvm.load %86 : !llvm.ptr -> f64
        %139 = arith.divf %138, %137 : f64
        %140 = llvm.load %3 : !llvm.ptr -> f64
        %141 = arith.subf %140, %139 : f64
        llvm.store %141, %3 : f64, !llvm.ptr
        %142 = math.absf %139 : f64
        %143 = arith.constant 0 : f32
        %145 = arith.extf %143 : f32 to f64
        %144 = arith.cmpf olt, %142, %145 : f64
        cf.cond_br %144, ^bb18, ^bb19
        ^bb18:
          cf.br ^bb11
        ^bb19:
          cf.br ^bb20
        ^bb20:
        %146 = llvm.load %69 : !llvm.ptr -> i64
        %147 = arith.constant 1 : i32
        %149 = arith.extsi %147 : i32 to i64
        %148 = arith.addi %146, %149 : i64
        llvm.store %148, %69 : i64, !llvm.ptr
        cf.br ^bb9
      ^bb11:
      %150 = llvm.load %3 : !llvm.ptr -> f64
      %151 = llvm.load %7 : !llvm.ptr -> i64
      %152 = arith.constant 1 : i32
      %154 = arith.extsi %152 : i32 to i64
      %153 = arith.subi %151, %154 : i64
      %155 = llvm.getelementptr %arg1[%153] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %150, %155 : f64, !llvm.ptr
      %156 = arith.constant 1.0 : f32
      %157 = arith.extf %156 : f32 to f64
      %158 = llvm.mlir.constant(1 : i64) : i64
      %159 = llvm.alloca %158 x f64 : (i64) -> !llvm.ptr
      llvm.store %157, %159 : f64, !llvm.ptr
      %160 = arith.constant 1.0 : f32
      %161 = llvm.load %3 : !llvm.ptr -> f64
      %163 = arith.extf %160 : f32 to f64
      %162 = arith.subf %163, %161 : f64
      %164 = llvm.mlir.constant(1 : i64) : i64
      %165 = llvm.alloca %164 x f64 : (i64) -> !llvm.ptr
      llvm.store %162, %165 : f64, !llvm.ptr
      %166 = arith.constant 2 : i32
      %167 = arith.extsi %166 : i32 to i64
      %168 = llvm.mlir.constant(1 : i64) : i64
      %169 = llvm.alloca %168 x i64 : (i64) -> !llvm.ptr
      llvm.store %167, %169 : i64, !llvm.ptr
      cf.br ^bb21
      ^bb21:
      %170 = llvm.load %169 : !llvm.ptr -> i64
      %171 = arith.constant 1 : i32
      %173 = arith.extsi %171 : i32 to i64
      %172 = arith.addi %arg0, %173 : i64
      %174 = arith.cmpi sle, %170, %172 : i64
      cf.cond_br %174, ^bb22, ^bb23
      ^bb22:
        %175 = arith.constant 2.0 : f32
        %176 = llvm.load %169 : !llvm.ptr -> i64
        %177 = arith.sitofp %176 : i64 to f64
        %179 = arith.extf %175 : f32 to f64
        %178 = arith.mulf %179, %177 : f64
        %180 = arith.constant 1.0 : f32
        %182 = arith.extf %180 : f32 to f64
        %181 = arith.subf %178, %182 : f64
        %183 = llvm.load %3 : !llvm.ptr -> f64
        %184 = arith.subf %181, %183 : f64
        %185 = llvm.load %165 : !llvm.ptr -> f64
        %186 = arith.mulf %184, %185 : f64
        %187 = llvm.load %169 : !llvm.ptr -> i64
        %188 = arith.constant 1 : i32
        %190 = arith.extsi %188 : i32 to i64
        %189 = arith.subi %187, %190 : i64
        %191 = arith.sitofp %189 : i64 to f64
        %192 = llvm.load %159 : !llvm.ptr -> f64
        %193 = arith.mulf %191, %192 : f64
        %194 = arith.subf %186, %193 : f64
        %195 = llvm.load %169 : !llvm.ptr -> i64
        %196 = arith.sitofp %195 : i64 to f64
        %197 = arith.divf %194, %196 : f64
        %198 = llvm.load %165 : !llvm.ptr -> f64
        llvm.store %198, %159 : f64, !llvm.ptr
        llvm.store %197, %165 : f64, !llvm.ptr
        %199 = llvm.load %169 : !llvm.ptr -> i64
        %200 = arith.constant 1 : i32
        %202 = arith.extsi %200 : i32 to i64
        %201 = arith.addi %199, %202 : i64
        llvm.store %201, %169 : i64, !llvm.ptr
        cf.br ^bb21
      ^bb23:
      %203 = llvm.load %165 : !llvm.ptr -> f64
      %204 = llvm.load %3 : !llvm.ptr -> f64
      %205 = arith.constant 1 : i32
      %207 = arith.extsi %205 : i32 to i64
      %206 = arith.addi %arg0, %207 : i64
      %208 = arith.sitofp %206 : i64 to f64
      %209 = arith.constant 1 : i32
      %211 = arith.extsi %209 : i32 to i64
      %210 = arith.addi %arg0, %211 : i64
      %212 = arith.sitofp %210 : i64 to f64
      %213 = arith.mulf %208, %212 : f64
      %214 = arith.mulf %213, %203 : f64
      %215 = arith.mulf %214, %203 : f64
      %216 = arith.divf %204, %215 : f64
      %217 = llvm.load %7 : !llvm.ptr -> i64
      %218 = arith.constant 1 : i32
      %220 = arith.extsi %218 : i32 to i64
      %219 = arith.subi %217, %220 : i64
      %221 = llvm.getelementptr %arg2[%219] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %216, %221 : f64, !llvm.ptr
      %222 = llvm.load %7 : !llvm.ptr -> i64
      %223 = arith.constant 1 : i32
      %225 = arith.extsi %223 : i32 to i64
      %224 = arith.addi %222, %225 : i64
      llvm.store %224, %7 : i64, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    func.return
  }
  func.func @pack_state(%arg0: !llvm.ptr, %arg1: i64) -> i64 {
    %226 = arith.constant 0 : i32
    %227 = arith.extsi %226 : i32 to i64
    %228 = llvm.mlir.constant(1 : i64) : i64
    %229 = llvm.alloca %228 x i64 : (i64) -> !llvm.ptr
    llvm.store %227, %229 : i64, !llvm.ptr
    %230 = arith.constant 0 : i32
    %231 = arith.extsi %230 : i32 to i64
    %232 = llvm.mlir.constant(1 : i64) : i64
    %233 = llvm.alloca %232 x i64 : (i64) -> !llvm.ptr
    llvm.store %231, %233 : i64, !llvm.ptr
    cf.br ^bb24
    ^bb24:
    %234 = llvm.load %233 : !llvm.ptr -> i64
    %235 = arith.cmpi slt, %234, %arg1 : i64
    cf.cond_br %235, ^bb25, ^bb26
    ^bb25:
      %236 = llvm.load %229 : !llvm.ptr -> i64
      %237 = arith.constant 4 : i32
      %239 = arith.extsi %237 : i32 to i64
      %238 = arith.shli %236, %239 : i64
      %241 = llvm.load %233 : !llvm.ptr -> i64
      %242 = llvm.getelementptr %arg0[%241] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %240 = llvm.load %242 : !llvm.ptr -> i64
      %243 = arith.ori %238, %240 : i64
      llvm.store %243, %229 : i64, !llvm.ptr
      %244 = llvm.load %233 : !llvm.ptr -> i64
      %245 = arith.constant 1 : i32
      %247 = arith.extsi %245 : i32 to i64
      %246 = arith.addi %244, %247 : i64
      llvm.store %246, %233 : i64, !llvm.ptr
      cf.br ^bb24
    ^bb26:
    %248 = llvm.load %229 : !llvm.ptr -> i64
    func.return %248 : i64
  }
  func.func @expected_people(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i64) -> f64 {
    %249 = arith.constant 1 : i32
    %251 = arith.extsi %249 : i32 to i64
    %250 = arith.addi %arg1, %251 : i64
    %252 = arith.constant 1 : i32
    %254 = arith.extsi %252 : i32 to i64
    %253 = arith.subi %arg2, %254 : i64
    %255 = arith.constant 1 : i32
    %257 = arith.extsi %255 : i32 to i64
    %256 = arith.subi %250, %257 : i64
    %258 = arith.constant 5000 : i32
    %259 = arith.extsi %258 : i32 to i64
    %261 = arith.constant 8 : i32
    %262 = arith.extsi %261 : i32 to i64
    %260 = func.call @calloc(%259, %262) : (i64, i64) -> !llvm.ptr
    %264 = arith.constant 8 : i32
    %265 = arith.extsi %264 : i32 to i64
    %263 = func.call @calloc(%259, %265) : (i64, i64) -> !llvm.ptr
    %266 = arith.constant 0 : i32
    %267 = arith.extsi %266 : i32 to i64
    %268 = llvm.mlir.constant(1 : i64) : i64
    %269 = llvm.alloca %268 x i64 : (i64) -> !llvm.ptr
    llvm.store %267, %269 : i64, !llvm.ptr
    %271 = arith.constant 8 : i32
    %272 = arith.extsi %271 : i32 to i64
    %270 = func.call @calloc(%256, %272) : (i64, i64) -> !llvm.ptr
    %273 = func.call @enumerate_states(%256, %253, %260, %263, %259) : (i64, i64, !llvm.ptr, !llvm.ptr, i64) -> i64
    llvm.store %273, %269 : i64, !llvm.ptr
    %275 = arith.constant 1 : i32
    %277 = arith.extsi %275 : i32 to i64
    %276 = arith.addi %253, %277 : i64
    %278 = arith.muli %259, %276 : i64
    %279 = arith.constant 8 : i32
    %280 = arith.extsi %279 : i32 to i64
    %274 = func.call @calloc(%278, %280) : (i64, i64) -> !llvm.ptr
    %282 = arith.constant 1 : i32
    %284 = arith.extsi %282 : i32 to i64
    %283 = arith.addi %253, %284 : i64
    %285 = arith.muli %259, %283 : i64
    %286 = arith.constant 8 : i32
    %287 = arith.extsi %286 : i32 to i64
    %281 = func.call @calloc(%285, %287) : (i64, i64) -> !llvm.ptr
    %289 = arith.constant 8 : i32
    %290 = arith.extsi %289 : i32 to i64
    %288 = func.call @calloc(%259, %290) : (i64, i64) -> !llvm.ptr
    %291 = arith.constant 0 : i32
    %292 = arith.extsi %291 : i32 to i64
    %293 = llvm.mlir.constant(1 : i64) : i64
    %294 = llvm.alloca %293 x i64 : (i64) -> !llvm.ptr
    llvm.store %292, %294 : i64, !llvm.ptr
    cf.br ^bb27
    ^bb27:
    %295 = llvm.load %294 : !llvm.ptr -> i64
    %296 = llvm.load %269 : !llvm.ptr -> i64
    %297 = arith.cmpi slt, %295, %296 : i64
    cf.cond_br %297, ^bb28, ^bb29
    ^bb28:
      %298 = arith.constant 0 : i32
      %299 = arith.extsi %298 : i32 to i64
      %300 = llvm.mlir.constant(1 : i64) : i64
      %301 = llvm.alloca %300 x i64 : (i64) -> !llvm.ptr
      llvm.store %299, %301 : i64, !llvm.ptr
      %302 = arith.constant 0 : i32
      %303 = arith.extsi %302 : i32 to i64
      %304 = llvm.mlir.constant(1 : i64) : i64
      %305 = llvm.alloca %304 x i64 : (i64) -> !llvm.ptr
      llvm.store %303, %305 : i64, !llvm.ptr
      cf.br ^bb30
      ^bb30:
      %306 = llvm.load %305 : !llvm.ptr -> i64
      %307 = arith.cmpi slt, %306, %256 : i64
      cf.cond_br %307, ^bb31, ^bb32
      ^bb31:
        %308 = llvm.load %301 : !llvm.ptr -> i64
        %310 = llvm.load %294 : !llvm.ptr -> i64
        %311 = arith.muli %310, %256 : i64
        %312 = llvm.load %305 : !llvm.ptr -> i64
        %313 = arith.addi %311, %312 : i64
        %314 = llvm.getelementptr %260[%313] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %309 = llvm.load %314 : !llvm.ptr -> i64
        %315 = arith.addi %308, %309 : i64
        llvm.store %315, %301 : i64, !llvm.ptr
        %316 = llvm.load %305 : !llvm.ptr -> i64
        %317 = arith.constant 1 : i32
        %319 = arith.extsi %317 : i32 to i64
        %318 = arith.addi %316, %319 : i64
        llvm.store %318, %305 : i64, !llvm.ptr
        cf.br ^bb30
      ^bb32:
      %320 = arith.constant 0 : i32
      %321 = arith.extsi %320 : i32 to i64
      %322 = llvm.mlir.constant(1 : i64) : i64
      %323 = llvm.alloca %322 x i64 : (i64) -> !llvm.ptr
      llvm.store %321, %323 : i64, !llvm.ptr
      %324 = arith.constant 0 : i32
      %325 = arith.extsi %324 : i32 to i64
      %326 = llvm.mlir.constant(1 : i64) : i64
      %327 = llvm.alloca %326 x i64 : (i64) -> !llvm.ptr
      llvm.store %325, %327 : i64, !llvm.ptr
      cf.br ^bb33
      ^bb33:
      %328 = llvm.load %323 : !llvm.ptr -> i64
      %329 = llvm.load %301 : !llvm.ptr -> i64
      %330 = arith.subi %253, %329 : i64
      %331 = arith.cmpi sle, %328, %330 : i64
      cf.cond_br %331, ^bb34, ^bb35
      ^bb34:
        %332 = arith.constant 0 : i32
        %333 = arith.extsi %332 : i32 to i64
        %334 = llvm.mlir.constant(1 : i64) : i64
        %335 = llvm.alloca %334 x i64 : (i64) -> !llvm.ptr
        llvm.store %333, %335 : i64, !llvm.ptr
        %336 = arith.constant 1 : i32
        %337 = arith.extsi %336 : i32 to i64
        llvm.store %337, %305 : i64, !llvm.ptr
        cf.br ^bb36
        ^bb36:
        %338 = llvm.load %305 : !llvm.ptr -> i64
        %339 = arith.cmpi slt, %338, %256 : i64
        cf.cond_br %339, ^bb37, ^bb38
        ^bb37:
          %340 = llvm.load %335 : !llvm.ptr -> i64
          %341 = arith.constant 4 : i32
          %343 = arith.extsi %341 : i32 to i64
          %342 = arith.shli %340, %343 : i64
          %345 = llvm.load %294 : !llvm.ptr -> i64
          %346 = arith.muli %345, %256 : i64
          %347 = llvm.load %305 : !llvm.ptr -> i64
          %348 = arith.addi %346, %347 : i64
          %349 = llvm.getelementptr %260[%348] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %344 = llvm.load %349 : !llvm.ptr -> i64
          %350 = arith.ori %342, %344 : i64
          llvm.store %350, %335 : i64, !llvm.ptr
          %351 = llvm.load %305 : !llvm.ptr -> i64
          %352 = arith.constant 1 : i32
          %354 = arith.extsi %352 : i32 to i64
          %353 = arith.addi %351, %354 : i64
          llvm.store %353, %305 : i64, !llvm.ptr
          cf.br ^bb36
        ^bb38:
        %355 = llvm.load %335 : !llvm.ptr -> i64
        %356 = arith.constant 4 : i32
        %358 = arith.extsi %356 : i32 to i64
        %357 = arith.shli %355, %358 : i64
        %359 = llvm.load %323 : !llvm.ptr -> i64
        %360 = arith.ori %357, %359 : i64
        llvm.store %360, %335 : i64, !llvm.ptr
        %361 = arith.constant 0 : i32
        %362 = arith.extsi %361 : i32 to i64
        %363 = llvm.mlir.constant(1 : i64) : i64
        %364 = llvm.alloca %363 x i64 : (i64) -> !llvm.ptr
        llvm.store %362, %364 : i64, !llvm.ptr
        cf.br ^bb39
        ^bb39:
        %365 = llvm.load %364 : !llvm.ptr -> i64
        %366 = llvm.load %269 : !llvm.ptr -> i64
        %367 = arith.cmpi slt, %365, %366 : i64
        cf.cond_br %367, ^bb40, ^bb41
        ^bb40:
          %369 = llvm.load %364 : !llvm.ptr -> i64
          %370 = llvm.getelementptr %263[%369] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %368 = llvm.load %370 : !llvm.ptr -> i64
          %371 = llvm.load %335 : !llvm.ptr -> i64
          %372 = arith.cmpi eq, %368, %371 : i64
          cf.cond_br %372, ^bb42, ^bb43
          ^bb42:
            cf.br ^bb41
          ^bb43:
            cf.br ^bb44
          ^bb44:
          %373 = llvm.load %364 : !llvm.ptr -> i64
          %374 = arith.constant 1 : i32
          %376 = arith.extsi %374 : i32 to i64
          %375 = arith.addi %373, %376 : i64
          llvm.store %375, %364 : i64, !llvm.ptr
          cf.br ^bb39
        ^bb41:
        %377 = llvm.load %364 : !llvm.ptr -> i64
        %378 = llvm.load %294 : !llvm.ptr -> i64
        %379 = arith.constant 1 : i32
        %381 = arith.extsi %379 : i32 to i64
        %380 = arith.addi %253, %381 : i64
        %382 = arith.muli %378, %380 : i64
        %383 = llvm.load %327 : !llvm.ptr -> i64
        %384 = arith.addi %382, %383 : i64
        %385 = llvm.getelementptr %274[%384] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %377, %385 : i64, !llvm.ptr
        %386 = llvm.load %323 : !llvm.ptr -> i64
        %387 = llvm.load %294 : !llvm.ptr -> i64
        %388 = arith.constant 1 : i32
        %390 = arith.extsi %388 : i32 to i64
        %389 = arith.addi %253, %390 : i64
        %391 = arith.muli %387, %389 : i64
        %392 = llvm.load %327 : !llvm.ptr -> i64
        %393 = arith.addi %391, %392 : i64
        %394 = llvm.getelementptr %281[%393] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %386, %394 : i64, !llvm.ptr
        %395 = llvm.load %327 : !llvm.ptr -> i64
        %396 = arith.constant 1 : i32
        %398 = arith.extsi %396 : i32 to i64
        %397 = arith.addi %395, %398 : i64
        llvm.store %397, %327 : i64, !llvm.ptr
        %399 = llvm.load %323 : !llvm.ptr -> i64
        %400 = arith.constant 1 : i32
        %402 = arith.extsi %400 : i32 to i64
        %401 = arith.addi %399, %402 : i64
        llvm.store %401, %323 : i64, !llvm.ptr
        cf.br ^bb33
      ^bb35:
      %403 = llvm.load %327 : !llvm.ptr -> i64
      %404 = llvm.load %294 : !llvm.ptr -> i64
      %405 = llvm.getelementptr %288[%404] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %403, %405 : i64, !llvm.ptr
      %406 = llvm.load %294 : !llvm.ptr -> i64
      %407 = arith.constant 1 : i32
      %409 = arith.extsi %407 : i32 to i64
      %408 = arith.addi %406, %409 : i64
      llvm.store %408, %294 : i64, !llvm.ptr
      cf.br ^bb27
    ^bb29:
    %411 = arith.constant 8 : i32
    %412 = arith.extsi %411 : i32 to i64
    %410 = func.call @calloc(%arg3, %412) : (i64, i64) -> !llvm.ptr
    %414 = arith.constant 8 : i32
    %415 = arith.extsi %414 : i32 to i64
    %413 = func.call @calloc(%arg3, %415) : (i64, i64) -> !llvm.ptr
    func.call @gauss_laguerre(%arg3, %410, %413) : (i64, !llvm.ptr, !llvm.ptr) -> ()
    %417 = arith.constant 0.0 : f32
    %418 = arith.extf %417 : f32 to f64
    %419 = llvm.mlir.constant(1 : i64) : i64
    %420 = llvm.alloca %419 x f64 : (i64) -> !llvm.ptr
    llvm.store %418, %420 : f64, !llvm.ptr
    %421 = arith.constant 0 : i32
    %422 = arith.extsi %421 : i32 to i64
    %423 = llvm.mlir.constant(1 : i64) : i64
    %424 = llvm.alloca %423 x i64 : (i64) -> !llvm.ptr
    llvm.store %422, %424 : i64, !llvm.ptr
    cf.br ^bb45
    ^bb45:
    %425 = llvm.load %424 : !llvm.ptr -> i64
    %426 = arith.cmpi slt, %425, %arg3 : i64
    cf.cond_br %426, ^bb46, ^bb47
    ^bb46:
      %428 = llvm.load %424 : !llvm.ptr -> i64
      %429 = llvm.getelementptr %410[%428] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %427 = llvm.load %429 : !llvm.ptr -> f64
      %431 = llvm.load %424 : !llvm.ptr -> i64
      %432 = llvm.getelementptr %413[%431] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %430 = llvm.load %432 : !llvm.ptr -> f64
      %434 = llvm.load %269 : !llvm.ptr -> i64
      %433 = func.call @trace_power(%arg0, %434, %253, %274, %281, %288, %427) : (i64, i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr, f64) -> f64
      %435 = llvm.load %420 : !llvm.ptr -> f64
      %436 = arith.mulf %430, %433 : f64
      %437 = arith.addf %435, %436 : f64
      llvm.store %437, %420 : f64, !llvm.ptr
      %438 = llvm.load %424 : !llvm.ptr -> i64
      %439 = arith.constant 1 : i32
      %441 = arith.extsi %439 : i32 to i64
      %440 = arith.addi %438, %441 : i64
      llvm.store %440, %424 : i64, !llvm.ptr
      cf.br ^bb45
    ^bb47:
    func.call @free(%260) : (!llvm.ptr) -> ()
    func.call @free(%263) : (!llvm.ptr) -> ()
    func.call @free(%270) : (!llvm.ptr) -> ()
    func.call @free(%274) : (!llvm.ptr) -> ()
    func.call @free(%281) : (!llvm.ptr) -> ()
    func.call @free(%288) : (!llvm.ptr) -> ()
    func.call @free(%410) : (!llvm.ptr) -> ()
    func.call @free(%413) : (!llvm.ptr) -> ()
    %450 = llvm.load %420 : !llvm.ptr -> f64
    func.return %450 : f64
  }
  func.func @enumerate_states(%arg0: i64, %arg1: i64, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: i64) -> i64 {
    %452 = arith.constant 8 : i32
    %453 = arith.extsi %452 : i32 to i64
    %451 = func.call @calloc(%arg0, %453) : (i64, i64) -> !llvm.ptr
    %455 = arith.constant 1 : i32
    %456 = arith.constant 8 : i32
    %457 = arith.extsi %455 : i32 to i64
    %458 = arith.extsi %456 : i32 to i64
    %454 = func.call @calloc(%457, %458) : (i64, i64) -> !llvm.ptr
    %459 = arith.constant 0 : i32
    %460 = arith.constant 0 : i32
    %461 = arith.extsi %459 : i32 to i64
    %462 = arith.extsi %460 : i32 to i64
    %463 = llvm.getelementptr %454[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %461, %463 : i64, !llvm.ptr
    %465 = arith.constant 0 : i32
    %466 = arith.extsi %465 : i32 to i64
    func.call @enum_rec(%466, %arg1, %arg0, %arg1, %451, %arg2, %arg3, %454, %arg4) : (i64, i64, i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> ()
    %468 = arith.constant 0 : i32
    %469 = arith.extsi %468 : i32 to i64
    %470 = llvm.getelementptr %454[%469] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %467 = llvm.load %470 : !llvm.ptr -> i64
    func.call @free(%451) : (!llvm.ptr) -> ()
    func.call @free(%454) : (!llvm.ptr) -> ()
    func.return %467 : i64
  }
  func.func @enum_rec(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i64, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: !llvm.ptr, %arg7: !llvm.ptr, %arg8: i64) -> () {
    %473 = arith.cmpi eq, %arg0, %arg2 : i64
    cf.cond_br %473, ^bb48, ^bb49
    ^bb48:
      %475 = arith.constant 0 : i32
      %476 = arith.extsi %475 : i32 to i64
      %477 = llvm.getelementptr %arg7[%476] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %474 = llvm.load %477 : !llvm.ptr -> i64
      %478 = arith.cmpi sge, %474, %arg8 : i64
      cf.cond_br %478, ^bb51, ^bb52
      ^bb51:
        func.return
      ^bb52:
        cf.br ^bb53
      ^bb53:
      %479 = arith.constant 0 : i32
      %480 = arith.extsi %479 : i32 to i64
      %481 = llvm.mlir.constant(1 : i64) : i64
      %482 = llvm.alloca %481 x i64 : (i64) -> !llvm.ptr
      llvm.store %480, %482 : i64, !llvm.ptr
      %483 = arith.constant 0 : i32
      %484 = arith.extsi %483 : i32 to i64
      %485 = llvm.mlir.constant(1 : i64) : i64
      %486 = llvm.alloca %485 x i64 : (i64) -> !llvm.ptr
      llvm.store %484, %486 : i64, !llvm.ptr
      cf.br ^bb54
      ^bb54:
      %487 = llvm.load %486 : !llvm.ptr -> i64
      %488 = arith.cmpi slt, %487, %arg2 : i64
      cf.cond_br %488, ^bb55, ^bb56
      ^bb55:
        %490 = llvm.load %486 : !llvm.ptr -> i64
        %491 = llvm.getelementptr %arg4[%490] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %489 = llvm.load %491 : !llvm.ptr -> i64
        %492 = arith.muli %474, %arg2 : i64
        %493 = llvm.load %486 : !llvm.ptr -> i64
        %494 = arith.addi %492, %493 : i64
        %495 = llvm.getelementptr %arg5[%494] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %489, %495 : i64, !llvm.ptr
        %496 = llvm.load %482 : !llvm.ptr -> i64
        %497 = arith.constant 4 : i32
        %499 = arith.extsi %497 : i32 to i64
        %498 = arith.shli %496, %499 : i64
        %501 = llvm.load %486 : !llvm.ptr -> i64
        %502 = llvm.getelementptr %arg4[%501] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %500 = llvm.load %502 : !llvm.ptr -> i64
        %503 = arith.ori %498, %500 : i64
        llvm.store %503, %482 : i64, !llvm.ptr
        %504 = llvm.load %486 : !llvm.ptr -> i64
        %505 = arith.constant 1 : i32
        %507 = arith.extsi %505 : i32 to i64
        %506 = arith.addi %504, %507 : i64
        llvm.store %506, %486 : i64, !llvm.ptr
        cf.br ^bb54
      ^bb56:
      %508 = llvm.load %482 : !llvm.ptr -> i64
      %509 = llvm.getelementptr %arg6[%474] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %508, %509 : i64, !llvm.ptr
      %510 = arith.constant 1 : i32
      %512 = arith.extsi %510 : i32 to i64
      %511 = arith.addi %474, %512 : i64
      %513 = arith.constant 0 : i32
      %514 = arith.extsi %513 : i32 to i64
      %515 = llvm.getelementptr %arg7[%514] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %511, %515 : i64, !llvm.ptr
      func.return
    ^bb49:
      cf.br ^bb50
    ^bb50:
    %516 = arith.constant 0 : i32
    %517 = arith.extsi %516 : i32 to i64
    %518 = llvm.mlir.constant(1 : i64) : i64
    %519 = llvm.alloca %518 x i64 : (i64) -> !llvm.ptr
    llvm.store %517, %519 : i64, !llvm.ptr
    cf.br ^bb57
    ^bb57:
    %520 = llvm.load %519 : !llvm.ptr -> i64
    %521 = arith.cmpi sle, %520, %arg1 : i64
    cf.cond_br %521, ^bb58, ^bb59
    ^bb58:
      %522 = llvm.load %519 : !llvm.ptr -> i64
      %523 = llvm.getelementptr %arg4[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %522, %523 : i64, !llvm.ptr
      %525 = arith.constant 1 : i32
      %527 = arith.extsi %525 : i32 to i64
      %526 = arith.addi %arg0, %527 : i64
      %528 = llvm.load %519 : !llvm.ptr -> i64
      %529 = arith.subi %arg1, %528 : i64
      func.call @enum_rec(%526, %529, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8) : (i64, i64, i64, i64, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, i64) -> ()
      %530 = llvm.load %519 : !llvm.ptr -> i64
      %531 = arith.constant 1 : i32
      %533 = arith.extsi %531 : i32 to i64
      %532 = arith.addi %530, %533 : i64
      llvm.store %532, %519 : i64, !llvm.ptr
      cf.br ^bb57
    ^bb59:
    func.return
  }
  func.func @trace_power(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: f64) -> f64 {
    %534 = arith.sitofp %arg0 : i64 to f64
    %535 = arith.divf %arg6, %534 : f64
    %536 = arith.constant 1.0 : f32
    %537 = arith.extf %536 : f32 to f64
    %538 = arith.constant 0.0 : f32
    %539 = arith.extf %538 : f32 to f64
    %540 = llvm.mlir.constant(1 : i64) : i64
    %541 = llvm.alloca %540 x f64 : (i64) -> !llvm.ptr
    llvm.store %539, %541 : f64, !llvm.ptr
    %542 = arith.constant 0.0 : f32
    %543 = arith.extf %542 : f32 to f64
    %544 = llvm.mlir.constant(1 : i64) : i64
    %545 = llvm.alloca %544 x f64 : (i64) -> !llvm.ptr
    llvm.store %543, %545 : f64, !llvm.ptr
    %546 = arith.constant 2 : i32
    %548 = arith.extsi %546 : i32 to i64
    %547 = arith.cmpi sge, %arg2, %548 : i64
    cf.cond_br %547, ^bb60, ^bb61
    ^bb60:
      %549 = arith.mulf %535, %535 : f64
      %550 = arith.constant 0.5 : f32
      %552 = arith.extf %550 : f32 to f64
      %551 = arith.mulf %549, %552 : f64
      llvm.store %551, %541 : f64, !llvm.ptr
      cf.br ^bb62
    ^bb61:
      cf.br ^bb62
    ^bb62:
    %553 = arith.constant 3 : i32
    %555 = arith.extsi %553 : i32 to i64
    %554 = arith.cmpi sge, %arg2, %555 : i64
    cf.cond_br %554, ^bb63, ^bb64
    ^bb63:
      %556 = arith.mulf %535, %535 : f64
      %557 = arith.mulf %556, %535 : f64
      %558 = arith.constant 6.0 : f32
      %560 = arith.extf %558 : f32 to f64
      %559 = arith.divf %557, %560 : f64
      llvm.store %559, %545 : f64, !llvm.ptr
      cf.br ^bb65
    ^bb64:
      cf.br ^bb65
    ^bb65:
    %562 = arith.constant 4 : i32
    %563 = arith.constant 8 : i32
    %564 = arith.extsi %562 : i32 to i64
    %565 = arith.extsi %563 : i32 to i64
    %561 = func.call @calloc(%564, %565) : (i64, i64) -> !llvm.ptr
    %566 = arith.constant 0 : i32
    %567 = arith.extsi %566 : i32 to i64
    %568 = llvm.getelementptr %561[%567] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    llvm.store %537, %568 : f64, !llvm.ptr
    %569 = arith.constant 1 : i32
    %570 = arith.extsi %569 : i32 to i64
    %571 = llvm.getelementptr %561[%570] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    llvm.store %535, %571 : f64, !llvm.ptr
    %572 = llvm.load %541 : !llvm.ptr -> f64
    %573 = arith.constant 2 : i32
    %574 = arith.extsi %573 : i32 to i64
    %575 = llvm.getelementptr %561[%574] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    llvm.store %572, %575 : f64, !llvm.ptr
    %576 = llvm.load %545 : !llvm.ptr -> f64
    %577 = arith.constant 3 : i32
    %578 = arith.extsi %577 : i32 to i64
    %579 = llvm.getelementptr %561[%578] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    llvm.store %576, %579 : f64, !llvm.ptr
    %580 = arith.constant 0.0 : f32
    %581 = arith.extf %580 : f32 to f64
    %582 = llvm.mlir.constant(1 : i64) : i64
    %583 = llvm.alloca %582 x f64 : (i64) -> !llvm.ptr
    llvm.store %581, %583 : f64, !llvm.ptr
    %585 = arith.constant 8 : i32
    %586 = arith.extsi %585 : i32 to i64
    %584 = func.call @calloc(%arg1, %586) : (i64, i64) -> !llvm.ptr
    %588 = arith.constant 8 : i32
    %589 = arith.extsi %588 : i32 to i64
    %587 = func.call @calloc(%arg1, %589) : (i64, i64) -> !llvm.ptr
    %590 = arith.constant 0 : i32
    %591 = arith.extsi %590 : i32 to i64
    %592 = llvm.mlir.constant(1 : i64) : i64
    %593 = llvm.alloca %592 x i64 : (i64) -> !llvm.ptr
    llvm.store %591, %593 : i64, !llvm.ptr
    cf.br ^bb66
    ^bb66:
    %594 = llvm.load %593 : !llvm.ptr -> i64
    %595 = arith.cmpi slt, %594, %arg1 : i64
    cf.cond_br %595, ^bb67, ^bb68
    ^bb67:
      %596 = arith.constant 0 : i32
      %597 = arith.extsi %596 : i32 to i64
      %598 = llvm.mlir.constant(1 : i64) : i64
      %599 = llvm.alloca %598 x i64 : (i64) -> !llvm.ptr
      llvm.store %597, %599 : i64, !llvm.ptr
      cf.br ^bb69
      ^bb69:
      %600 = llvm.load %599 : !llvm.ptr -> i64
      %601 = arith.cmpi slt, %600, %arg1 : i64
      cf.cond_br %601, ^bb70, ^bb71
      ^bb70:
        %602 = arith.constant 0.0 : f32
        %603 = llvm.load %599 : !llvm.ptr -> i64
        %604 = arith.extf %602 : f32 to f64
        %605 = llvm.getelementptr %584[%603] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        llvm.store %604, %605 : f64, !llvm.ptr
        %606 = llvm.load %599 : !llvm.ptr -> i64
        %607 = arith.constant 1 : i32
        %609 = arith.extsi %607 : i32 to i64
        %608 = arith.addi %606, %609 : i64
        llvm.store %608, %599 : i64, !llvm.ptr
        cf.br ^bb69
      ^bb71:
      %610 = arith.constant 1.0 : f32
      %611 = llvm.load %593 : !llvm.ptr -> i64
      %612 = arith.extf %610 : f32 to f64
      %613 = llvm.getelementptr %584[%611] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %612, %613 : f64, !llvm.ptr
      %614 = arith.constant 0 : i32
      %615 = arith.extsi %614 : i32 to i64
      %616 = llvm.mlir.constant(1 : i64) : i64
      %617 = llvm.alloca %616 x i64 : (i64) -> !llvm.ptr
      llvm.store %615, %617 : i64, !llvm.ptr
      cf.br ^bb72
      ^bb72:
      %618 = llvm.load %617 : !llvm.ptr -> i64
      %619 = arith.cmpi slt, %618, %arg0 : i64
      cf.cond_br %619, ^bb73, ^bb74
      ^bb73:
        %620 = arith.constant 0 : i32
        %621 = arith.extsi %620 : i32 to i64
        llvm.store %621, %599 : i64, !llvm.ptr
        cf.br ^bb75
        ^bb75:
        %622 = llvm.load %599 : !llvm.ptr -> i64
        %623 = arith.cmpi slt, %622, %arg1 : i64
        cf.cond_br %623, ^bb76, ^bb77
        ^bb76:
          %624 = arith.constant 0.0 : f32
          %625 = llvm.load %599 : !llvm.ptr -> i64
          %626 = arith.extf %624 : f32 to f64
          %627 = llvm.getelementptr %587[%625] : (!llvm.ptr, i64) -> !llvm.ptr, f64
          llvm.store %626, %627 : f64, !llvm.ptr
          %628 = llvm.load %599 : !llvm.ptr -> i64
          %629 = arith.constant 1 : i32
          %631 = arith.extsi %629 : i32 to i64
          %630 = arith.addi %628, %631 : i64
          llvm.store %630, %599 : i64, !llvm.ptr
          cf.br ^bb75
        ^bb77:
        %632 = arith.constant 0 : i32
        %633 = arith.extsi %632 : i32 to i64
        llvm.store %633, %599 : i64, !llvm.ptr
        cf.br ^bb78
        ^bb78:
        %634 = llvm.load %599 : !llvm.ptr -> i64
        %635 = arith.cmpi slt, %634, %arg1 : i64
        cf.cond_br %635, ^bb79, ^bb80
        ^bb79:
          %637 = llvm.load %599 : !llvm.ptr -> i64
          %638 = llvm.getelementptr %584[%637] : (!llvm.ptr, i64) -> !llvm.ptr, f64
          %636 = llvm.load %638 : !llvm.ptr -> f64
          %639 = arith.constant 0.0 : f32
          %641 = arith.extf %639 : f32 to f64
          %640 = arith.cmpf one, %636, %641 : f64
          cf.cond_br %640, ^bb81, ^bb82
          ^bb81:
            %642 = arith.constant 0 : i32
            %643 = arith.extsi %642 : i32 to i64
            %644 = llvm.mlir.constant(1 : i64) : i64
            %645 = llvm.alloca %644 x i64 : (i64) -> !llvm.ptr
            llvm.store %643, %645 : i64, !llvm.ptr
            cf.br ^bb84
            ^bb84:
            %646 = llvm.load %645 : !llvm.ptr -> i64
            %648 = llvm.load %599 : !llvm.ptr -> i64
            %649 = llvm.getelementptr %arg5[%648] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            %647 = llvm.load %649 : !llvm.ptr -> i64
            %650 = arith.cmpi slt, %646, %647 : i64
            cf.cond_br %650, ^bb85, ^bb86
            ^bb85:
              %652 = llvm.load %599 : !llvm.ptr -> i64
              %653 = arith.constant 1 : i32
              %655 = arith.extsi %653 : i32 to i64
              %654 = arith.addi %arg2, %655 : i64
              %656 = arith.muli %652, %654 : i64
              %657 = llvm.load %645 : !llvm.ptr -> i64
              %658 = arith.addi %656, %657 : i64
              %659 = llvm.getelementptr %arg3[%658] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %651 = llvm.load %659 : !llvm.ptr -> i64
              %661 = llvm.load %599 : !llvm.ptr -> i64
              %662 = arith.constant 1 : i32
              %664 = arith.extsi %662 : i32 to i64
              %663 = arith.addi %arg2, %664 : i64
              %665 = arith.muli %661, %663 : i64
              %666 = llvm.load %645 : !llvm.ptr -> i64
              %667 = arith.addi %665, %666 : i64
              %668 = llvm.getelementptr %arg4[%667] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              %660 = llvm.load %668 : !llvm.ptr -> i64
              %670 = llvm.getelementptr %587[%651] : (!llvm.ptr, i64) -> !llvm.ptr, f64
              %669 = llvm.load %670 : !llvm.ptr -> f64
              %672 = llvm.getelementptr %561[%660] : (!llvm.ptr, i64) -> !llvm.ptr, f64
              %671 = llvm.load %672 : !llvm.ptr -> f64
              %673 = arith.mulf %636, %671 : f64
              %674 = arith.addf %669, %673 : f64
              %675 = llvm.getelementptr %587[%651] : (!llvm.ptr, i64) -> !llvm.ptr, f64
              llvm.store %674, %675 : f64, !llvm.ptr
              %676 = llvm.load %645 : !llvm.ptr -> i64
              %677 = arith.constant 1 : i32
              %679 = arith.extsi %677 : i32 to i64
              %678 = arith.addi %676, %679 : i64
              llvm.store %678, %645 : i64, !llvm.ptr
              cf.br ^bb84
            ^bb86:
            cf.br ^bb83
          ^bb82:
            cf.br ^bb83
          ^bb83:
          %680 = llvm.load %599 : !llvm.ptr -> i64
          %681 = arith.constant 1 : i32
          %683 = arith.extsi %681 : i32 to i64
          %682 = arith.addi %680, %683 : i64
          llvm.store %682, %599 : i64, !llvm.ptr
          cf.br ^bb78
        ^bb80:
        %684 = arith.constant 0 : i32
        %685 = arith.extsi %684 : i32 to i64
        llvm.store %685, %599 : i64, !llvm.ptr
        cf.br ^bb87
        ^bb87:
        %686 = llvm.load %599 : !llvm.ptr -> i64
        %687 = arith.cmpi slt, %686, %arg1 : i64
        cf.cond_br %687, ^bb88, ^bb89
        ^bb88:
          %689 = llvm.load %599 : !llvm.ptr -> i64
          %690 = llvm.getelementptr %587[%689] : (!llvm.ptr, i64) -> !llvm.ptr, f64
          %688 = llvm.load %690 : !llvm.ptr -> f64
          %691 = llvm.load %599 : !llvm.ptr -> i64
          %692 = llvm.getelementptr %584[%691] : (!llvm.ptr, i64) -> !llvm.ptr, f64
          llvm.store %688, %692 : f64, !llvm.ptr
          %693 = llvm.load %599 : !llvm.ptr -> i64
          %694 = arith.constant 1 : i32
          %696 = arith.extsi %694 : i32 to i64
          %695 = arith.addi %693, %696 : i64
          llvm.store %695, %599 : i64, !llvm.ptr
          cf.br ^bb87
        ^bb89:
        %697 = llvm.load %617 : !llvm.ptr -> i64
        %698 = arith.constant 1 : i32
        %700 = arith.extsi %698 : i32 to i64
        %699 = arith.addi %697, %700 : i64
        llvm.store %699, %617 : i64, !llvm.ptr
        cf.br ^bb72
      ^bb74:
      %701 = llvm.load %583 : !llvm.ptr -> f64
      %703 = llvm.load %593 : !llvm.ptr -> i64
      %704 = llvm.getelementptr %584[%703] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %702 = llvm.load %704 : !llvm.ptr -> f64
      %705 = arith.addf %701, %702 : f64
      llvm.store %705, %583 : f64, !llvm.ptr
      %706 = llvm.load %593 : !llvm.ptr -> i64
      %707 = arith.constant 1 : i32
      %709 = arith.extsi %707 : i32 to i64
      %708 = arith.addi %706, %709 : i64
      llvm.store %708, %593 : i64, !llvm.ptr
      cf.br ^bb66
    ^bb68:
    func.call @free(%561) : (!llvm.ptr) -> ()
    func.call @free(%584) : (!llvm.ptr) -> ()
    func.call @free(%587) : (!llvm.ptr) -> ()
    %713 = llvm.load %583 : !llvm.ptr -> f64
    func.return %713 : f64
  }
  func.func @main() -> i32 {
    %715 = arith.constant 365 : i32
    %716 = arith.constant 7 : i32
    %717 = arith.constant 4 : i32
    %718 = arith.constant 28 : i32
    %719 = arith.extsi %715 : i32 to i64
    %720 = arith.extsi %716 : i32 to i64
    %721 = arith.extsi %717 : i32 to i64
    %722 = arith.extsi %718 : i32 to i64
    %714 = func.call @expected_people(%719, %720, %721, %722) : (i64, i64, i64, i64) -> f64
    %723 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %724 = llvm.call @printf(%723, %714) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
    %725 = arith.constant 0 : i32
    func.return %725 : i32
  }
}