Problem 787

Bezout's Game -- H(10^9). Counts winning positions (a,b) with gcd(a,b)=1, a>0, b>0, a+b<=N. Derived rule: a+b even -> always winning a+b odd -> losing iff min(a,b) is even H(N) = total_coprime_pairs - losing_pairs Total coprime ordered pairs with sum<=N is sum_{s=2..N} phi(s) = S_phi(N)-1. Losing unordered pairs counted via Mobius inversion over odd d.

Answer202642367520564145
Output202642367520564145
StatusPASS
Native helperno
Runtime50 ms
Peak memory43472 KB
Time complexityO(n) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n)O(n log log n)
Space complexityO(n^2)O(n)
ApproachFlow solutionSieve-based totient computation
VerdictOptimal

Flow source

# Project Euler 787
# Bezout's Game -- H(10^9).
# Counts winning positions (a,b) with gcd(a,b)=1, a>0, b>0, a+b<=N.
#
# Derived rule:
#   a+b even  -> always winning
#   a+b odd   -> losing iff min(a,b) is even
#
# H(N) = total_coprime_pairs - losing_pairs
# Total coprime ordered pairs with sum<=N is sum_{s=2..N} phi(s) = S_phi(N)-1.
# Losing unordered pairs counted via Mobius inversion over odd d.

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

const HASH_SIZE: i64 = 262144
const HASH_MASK: i64 = 262143

let mut g_L: i64 = 0
let mut g_mu: ptr<i8> = null
let mut g_phi: ptr<i32> = null
let mut g_pre_mu: ptr<i64> = null
let mut g_pre_phi: ptr<i64> = null
let mut g_pre_mu_odd: ptr<i64> = null

let mut g_ht_mu_key: ptr<i64> = null
let mut g_ht_mu_val: ptr<i64> = null
let mut g_ht_mu_used: ptr<i8> = null
let mut g_ht_phi_key: ptr<i64> = null
let mut g_ht_phi_val: ptr<i64> = null
let mut g_ht_phi_used: ptr<i8> = null
let mut g_ht_mu_odd_key: ptr<i64> = null
let mut g_ht_mu_odd_val: ptr<i64> = null
let mut g_ht_mu_odd_used: ptr<i8> = null

function hash64(x: i64) -> i64 {
    let mut v: i64 = x
    v = v ^ (v >> 33)
    v = v * (-1718007120)  # 0xff51afd7ed558ccd as signed i64
    v = v ^ (v >> 33)
    v = v * (-434726454)   # 0xc4ceb9fe1a85ec53 as signed i64
    v = v ^ (v >> 33)
    return v & HASH_MASK
}

function ht_get(ht_key: ptr<i64>, ht_val: ptr<i64>, ht_used: ptr<i8>, key: i64, out: ptr<i64>) -> i64 {
    let mut h: i64 = hash64(key)
    while ht_used[h] != 0 {
        if ht_key[h] == key {
            out[0] = ht_val[h]
            return 1
        }
        h = (h + 1) & HASH_MASK
    }
    return 0
}

function ht_put(ht_key: ptr<i64>, ht_val: ptr<i64>, ht_used: ptr<i8>, key: i64, val: i64) -> void {
    let mut h: i64 = hash64(key)
    while ht_used[h] != 0 {
        if ht_key[h] == key {
            ht_val[h] = val
            return
        }
        h = (h + 1) & HASH_MASK
    }
    ht_key[h] = key
    ht_val[h] = val
    ht_used[h] = 1
}

function sieve(limit: i64) -> void {
    g_mu = calloc(limit + 1, 1) as ptr<i8>
    g_phi = calloc(limit + 1, 4) as ptr<i32>
    let is_comp: ptr<i8> = calloc(limit + 1, 1) as ptr<i8>
    let primes: ptr<i64> = malloc(limit * 8) as ptr<i64>
    let mut np: i64 = 0

    g_mu[1] = 1
    g_phi[1] = 1

    let mut i: i64 = 2
    while i <= limit {
        if is_comp[i] == 0 {
            primes[np] = i
            np = np + 1
            g_mu[i] = -1
            g_phi[i] = (i - 1) as i32
        }
        let mut j: i64 = 0
        while j < np {
            let p: i64 = primes[j]
            let v: i64 = i * p
            if v > limit { break }
            is_comp[v] = 1
            if i % p == 0 {
                g_mu[v] = 0
                g_phi[v] = (g_phi[i] as i64 * p) as i32
                break
            } else {
                g_mu[v] = -g_mu[i]
                g_phi[v] = (g_phi[i] as i64 * (p - 1)) as i32
            }
            j = j + 1
        }
        i = i + 1
    }

    g_pre_mu = calloc(limit + 1, 8) as ptr<i64>
    g_pre_phi = calloc(limit + 1, 8) as ptr<i64>
    g_pre_mu_odd = calloc(limit + 1, 8) as ptr<i64>

    let mut s_mu: i64 = 0
    let mut s_phi: i64 = 0
    let mut s_mu_odd: i64 = 0
    let mut k: i64 = 1
    while k <= limit {
        s_mu = s_mu + g_mu[k] as i64
        s_phi = s_phi + g_phi[k] as i64
        if (k & 1) != 0 {
            s_mu_odd = s_mu_odd + g_mu[k] as i64
        }
        g_pre_mu[k] = s_mu
        g_pre_phi[k] = s_phi
        g_pre_mu_odd[k] = s_mu_odd
        k = k + 1
    }

    free(is_comp)
    free(primes)
}

function S_mu(n: i64) -> i64 {
    if n <= g_L { return g_pre_mu[n] }
    let out: ptr<i64> = malloc(8) as ptr<i64>
    if ht_get(g_ht_mu_key, g_ht_mu_val, g_ht_mu_used, n, out) == 1 {
        let v: i64 = out[0]
        free(out)
        return v
    }
    free(out)
    let mut res: i64 = 1
    let mut i: i64 = 2
    while i <= n {
        let q: i64 = n / i
        let j: i64 = n / q
        res = res - (j - i + 1) * S_mu(q)
        i = j + 1
    }
    ht_put(g_ht_mu_key, g_ht_mu_val, g_ht_mu_used, n, res)
    return res
}

function S_phi(n: i64) -> i64 {
    if n <= g_L { return g_pre_phi[n] }
    let out: ptr<i64> = malloc(8) as ptr<i64>
    if ht_get(g_ht_phi_key, g_ht_phi_val, g_ht_phi_used, n, out) == 1 {
        let v: i64 = out[0]
        free(out)
        return v
    }
    free(out)
    let mut res: i64 = n * (n + 1) / 2
    let mut i: i64 = 2
    while i <= n {
        let q: i64 = n / i
        let j: i64 = n / q
        res = res - (j - i + 1) * S_phi(q)
        i = j + 1
    }
    ht_put(g_ht_phi_key, g_ht_phi_val, g_ht_phi_used, n, res)
    return res
}

function S_mu_odd(n: i64) -> i64 {
    if n <= g_L { return g_pre_mu_odd[n] }
    let out: ptr<i64> = malloc(8) as ptr<i64>
    if ht_get(g_ht_mu_odd_key, g_ht_mu_odd_val, g_ht_mu_odd_used, n, out) == 1 {
        let v: i64 = out[0]
        free(out)
        return v
    }
    free(out)
    let res: i64 = S_mu(n) + S_mu_odd(n / 2)
    ht_put(g_ht_mu_odd_key, g_ht_mu_odd_val, g_ht_mu_odd_used, n, res)
    return res
}

function C_count(M: i64) -> i64 {
    let t: i64 = (M - 1) / 4
    if t <= 0 { return 0 }
    return t * ((M + 1) / 2) - t * (t + 1)
}

function H(N: i64) -> i64 {
    # L = N^(2/3) + 10
    let mut L: i64 = exp(2.0 / 3.0 * log(N as f64)) as i64 + 10
    if L > N { L = N }

    g_L = L
    sieve(L)

    g_ht_mu_key = calloc(HASH_SIZE, 8) as ptr<i64>
    g_ht_mu_val = calloc(HASH_SIZE, 8) as ptr<i64>
    g_ht_mu_used = calloc(HASH_SIZE, 1) as ptr<i8>
    g_ht_phi_key = calloc(HASH_SIZE, 8) as ptr<i64>
    g_ht_phi_val = calloc(HASH_SIZE, 8) as ptr<i64>
    g_ht_phi_used = calloc(HASH_SIZE, 1) as ptr<i8>
    g_ht_mu_odd_key = calloc(HASH_SIZE, 8) as ptr<i64>
    g_ht_mu_odd_val = calloc(HASH_SIZE, 8) as ptr<i64>
    g_ht_mu_odd_used = calloc(HASH_SIZE, 1) as ptr<i8>

    # Force-fill S_mu memo for N
    S_mu(N)

    # Total coprime ordered pairs with sum<=N is sum_{s=2..N} phi(s)
    let total_positions: i64 = S_phi(N) - 1

    # Losing unordered pairs: sum_{d odd} mu(d) * C(floor(N/d))
    let mut losing_unordered: i64 = 0
    let mut d: i64 = 1
    while d <= N {
        let q: i64 = N / d
        let nd: i64 = N / q
        let mu_range_odd: i64 = S_mu_odd(nd) - S_mu_odd(d - 1)
        losing_unordered = losing_unordered + mu_range_odd * C_count(q)
        d = nd + 1
    }

    let losing_ordered: i64 = 2 * losing_unordered
    return total_positions - losing_ordered
}

function main() -> i32 {
    printf("%lld\n", H(1000000000))
    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; }

int64_t hash64_i64(int64_t x);
int64_t ht_get_ptr_i64_ptr_i64_ptr_i8_i64_ptr_i64(int64_t* ht_key, int64_t* ht_val, int8_t* ht_used, int64_t key, int64_t* out);
void ht_put_ptr_i64_ptr_i64_ptr_i8_i64_i64(int64_t* ht_key, int64_t* ht_val, int8_t* ht_used, int64_t key, int64_t val);
void sieve_i64(int64_t limit);
int64_t S_mu_i64(int64_t n);
int64_t S_phi_i64(int64_t n);
int64_t S_mu_odd_i64(int64_t n);
int64_t C_count_i64(int64_t M);
int64_t H_i64(int64_t N);
int32_t main(void);

static const int64_t HASH_SIZE = 262144;
static const int64_t HASH_MASK = 262143;

/* Module statics */
static int64_t g_L = 0;
static int8_t* g_mu = NULL;
static int32_t* g_phi = NULL;
static int64_t* g_pre_mu = NULL;
static int64_t* g_pre_phi = NULL;
static int64_t* g_pre_mu_odd = NULL;
static int64_t* g_ht_mu_key = NULL;
static int64_t* g_ht_mu_val = NULL;
static int8_t* g_ht_mu_used = NULL;
static int64_t* g_ht_phi_key = NULL;
static int64_t* g_ht_phi_val = NULL;
static int8_t* g_ht_phi_used = NULL;
static int64_t* g_ht_mu_odd_key = NULL;
static int64_t* g_ht_mu_odd_val = NULL;
static int8_t* g_ht_mu_odd_used = NULL;







int64_t hash64_i64(int64_t x) {
    int64_t v = x;
    v = (v ^ FLOW_CHECKED_SHR((v), (33)));
    v = (v * (-1718007120));
    v = (v ^ FLOW_CHECKED_SHR((v), (33)));
    v = (v * (-434726454));
    v = (v ^ FLOW_CHECKED_SHR((v), (33)));
    return (v & HASH_MASK);
}

int64_t ht_get_ptr_i64_ptr_i64_ptr_i8_i64_ptr_i64(int64_t* ht_key, int64_t* ht_val, int8_t* ht_used, int64_t key, int64_t* out) {
    int64_t h = hash64_i64(key);
    while (ht_used[h] != 0) {
        if (ht_key[h] == key) {
            out[0] = ht_val[h];
            return 1;
        }
        h = ((h + 1) & HASH_MASK);
    }
    return 0;
}

void ht_put_ptr_i64_ptr_i64_ptr_i8_i64_i64(int64_t* ht_key, int64_t* ht_val, int8_t* ht_used, int64_t key, int64_t val) {
    int64_t h = hash64_i64(key);
    while (ht_used[h] != 0) {
        if (ht_key[h] == key) {
            ht_val[h] = val;
            return;
        }
        h = ((h + 1) & HASH_MASK);
    }
    ht_key[h] = key;
    ht_val[h] = val;
    ht_used[h] = 1;
}

void sieve_i64(int64_t limit) {
    g_mu = ((int8_t*)(calloc((limit + 1), 1)));
    g_phi = ((int32_t*)(calloc((limit + 1), 4)));
    int8_t* is_comp = (int8_t*)(((int8_t*)(calloc((limit + 1), 1))));
    int64_t* primes = (int64_t*)(((int64_t*)(malloc((limit * 8)))));
    int64_t np = 0;
    g_mu[1] = 1;
    g_phi[1] = 1;
    int64_t i = 2;
    while (i <= limit) {
        if (is_comp[i] == 0) {
            primes[np] = i;
            np = (np + 1);
            g_mu[i] = (-1);
            g_phi[i] = ((int32_t)((i - 1)));
        }
        int64_t j = 0;
        while (j < np) {
            int64_t p = primes[j];
            int64_t v = (i * p);
            if (v > limit) {
                break;
            }
            is_comp[v] = 1;
            if (FLOW_CHECKED_MOD((i), (p)) == 0) {
                g_mu[v] = 0;
                g_phi[v] = ((int32_t)((((int64_t)(g_phi[i])) * p)));
                break;
            } else {
                g_mu[v] = (-g_mu[i]);
                g_phi[v] = ((int32_t)((((int64_t)(g_phi[i])) * (p - 1))));
            }
            j = (j + 1);
        }
        i = (i + 1);
    }
    g_pre_mu = ((int64_t*)(calloc((limit + 1), 8)));
    g_pre_phi = ((int64_t*)(calloc((limit + 1), 8)));
    g_pre_mu_odd = ((int64_t*)(calloc((limit + 1), 8)));
    int64_t s_mu = 0;
    int64_t s_phi = 0;
    int64_t s_mu_odd = 0;
    int64_t k = 1;
    while (k <= limit) {
        s_mu = (s_mu + ((int64_t)(g_mu[k])));
        s_phi = (s_phi + ((int64_t)(g_phi[k])));
        if ((k & 1) != 0) {
            s_mu_odd = (s_mu_odd + ((int64_t)(g_mu[k])));
        }
        g_pre_mu[k] = s_mu;
        g_pre_phi[k] = s_phi;
        g_pre_mu_odd[k] = s_mu_odd;
        k = (k + 1);
    }
    free(is_comp);
    free(primes);
}

int64_t S_mu_i64(int64_t n) {
    if (n <= g_L) {
        return g_pre_mu[n];
    }
    int64_t* out = (int64_t*)(((int64_t*)(malloc(8))));
    if (ht_get_ptr_i64_ptr_i64_ptr_i8_i64_ptr_i64(g_ht_mu_key, g_ht_mu_val, g_ht_mu_used, n, out) == 1) {
        int64_t v = out[0];
        free(out);
        return v;
    }
    free(out);
    int64_t res = 1;
    int64_t i = 2;
    while (i <= n) {
        int64_t q = FLOW_CHECKED_DIV((n), (i));
        int64_t j = FLOW_CHECKED_DIV((n), (q));
        res = (res - (((j - i) + 1) * S_mu_i64(q)));
        i = (j + 1);
    }
    ht_put_ptr_i64_ptr_i64_ptr_i8_i64_i64(g_ht_mu_key, g_ht_mu_val, g_ht_mu_used, n, res);
    return res;
}

int64_t S_phi_i64(int64_t n) {
    if (n <= g_L) {
        return g_pre_phi[n];
    }
    int64_t* out = (int64_t*)(((int64_t*)(malloc(8))));
    if (ht_get_ptr_i64_ptr_i64_ptr_i8_i64_ptr_i64(g_ht_phi_key, g_ht_phi_val, g_ht_phi_used, n, out) == 1) {
        int64_t v = out[0];
        free(out);
        return v;
    }
    free(out);
    int64_t res = FLOW_CHECKED_DIV(((n * (n + 1))), (2));
    int64_t i = 2;
    while (i <= n) {
        int64_t q = FLOW_CHECKED_DIV((n), (i));
        int64_t j = FLOW_CHECKED_DIV((n), (q));
        res = (res - (((j - i) + 1) * S_phi_i64(q)));
        i = (j + 1);
    }
    ht_put_ptr_i64_ptr_i64_ptr_i8_i64_i64(g_ht_phi_key, g_ht_phi_val, g_ht_phi_used, n, res);
    return res;
}

int64_t S_mu_odd_i64(int64_t n) {
    if (n <= g_L) {
        return g_pre_mu_odd[n];
    }
    int64_t* out = (int64_t*)(((int64_t*)(malloc(8))));
    if (ht_get_ptr_i64_ptr_i64_ptr_i8_i64_ptr_i64(g_ht_mu_odd_key, g_ht_mu_odd_val, g_ht_mu_odd_used, n, out) == 1) {
        int64_t v = out[0];
        free(out);
        return v;
    }
    free(out);
    int64_t res = (S_mu_i64(n) + S_mu_odd_i64(FLOW_CHECKED_DIV((n), (2))));
    ht_put_ptr_i64_ptr_i64_ptr_i8_i64_i64(g_ht_mu_odd_key, g_ht_mu_odd_val, g_ht_mu_odd_used, n, res);
    return res;
}

int64_t C_count_i64(int64_t M) {
    int64_t t = FLOW_CHECKED_DIV(((M - 1)), (4));
    if (t <= 0) {
        return 0;
    }
    return ((t * FLOW_CHECKED_DIV(((M + 1)), (2))) - (t * (t + 1)));
}

int64_t H_i64(int64_t N) {
    int64_t L = (((int64_t)(exp(((2.0 / 3.0) * log(((double)(N))))))) + 10);
    if (L > N) {
        L = N;
    }
    g_L = L;
    sieve_i64(L);
    g_ht_mu_key = ((int64_t*)(calloc(HASH_SIZE, 8)));
    g_ht_mu_val = ((int64_t*)(calloc(HASH_SIZE, 8)));
    g_ht_mu_used = ((int8_t*)(calloc(HASH_SIZE, 1)));
    g_ht_phi_key = ((int64_t*)(calloc(HASH_SIZE, 8)));
    g_ht_phi_val = ((int64_t*)(calloc(HASH_SIZE, 8)));
    g_ht_phi_used = ((int8_t*)(calloc(HASH_SIZE, 1)));
    g_ht_mu_odd_key = ((int64_t*)(calloc(HASH_SIZE, 8)));
    g_ht_mu_odd_val = ((int64_t*)(calloc(HASH_SIZE, 8)));
    g_ht_mu_odd_used = ((int8_t*)(calloc(HASH_SIZE, 1)));
    S_mu_i64(N);
    int64_t total_positions = (S_phi_i64(N) - 1);
    int64_t losing_unordered = 0;
    int64_t d = 1;
    while (d <= N) {
        int64_t q = FLOW_CHECKED_DIV((N), (d));
        int64_t nd = FLOW_CHECKED_DIV((N), (q));
        int64_t mu_range_odd = (S_mu_odd_i64(nd) - S_mu_odd_i64((d - 1)));
        losing_unordered = (losing_unordered + (mu_range_odd * C_count_i64(q)));
        d = (nd + 1);
    }
    int64_t losing_ordered = (2 * losing_unordered);
    return (total_positions - losing_ordered);
}

int32_t main(void) {
    printf("%lld\n", H_i64(1000000000));
    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 private @malloc(i64) -> !llvm.ptr
  func.func private @sqrt(f64) -> f64
  func.func private @exp(f64) -> f64
  func.func private @log(f64) -> f64
  // Constant: HASH_SIZE
  llvm.mlir.global internal constant @HASH_SIZE(262144 : i64) : i64
  // Constant: HASH_MASK
  llvm.mlir.global internal constant @HASH_MASK(262143 : i64) : i64
  // Module static: g_L
  llvm.mlir.global internal @g_L(0 : i64) : i64
  // Module static: g_mu
  llvm.mlir.global internal @g_mu() {addr_space = 0 : i32} : !llvm.ptr {
    %0 = llvm.mlir.zero : !llvm.ptr
    llvm.return %0 : !llvm.ptr
  }
  // Module static: g_phi
  llvm.mlir.global internal @g_phi() {addr_space = 0 : i32} : !llvm.ptr {
    %1 = llvm.mlir.zero : !llvm.ptr
    llvm.return %1 : !llvm.ptr
  }
  // Module static: g_pre_mu
  llvm.mlir.global internal @g_pre_mu() {addr_space = 0 : i32} : !llvm.ptr {
    %2 = llvm.mlir.zero : !llvm.ptr
    llvm.return %2 : !llvm.ptr
  }
  // Module static: g_pre_phi
  llvm.mlir.global internal @g_pre_phi() {addr_space = 0 : i32} : !llvm.ptr {
    %3 = llvm.mlir.zero : !llvm.ptr
    llvm.return %3 : !llvm.ptr
  }
  // Module static: g_pre_mu_odd
  llvm.mlir.global internal @g_pre_mu_odd() {addr_space = 0 : i32} : !llvm.ptr {
    %4 = llvm.mlir.zero : !llvm.ptr
    llvm.return %4 : !llvm.ptr
  }
  // Module static: g_ht_mu_key
  llvm.mlir.global internal @g_ht_mu_key() {addr_space = 0 : i32} : !llvm.ptr {
    %5 = llvm.mlir.zero : !llvm.ptr
    llvm.return %5 : !llvm.ptr
  }
  // Module static: g_ht_mu_val
  llvm.mlir.global internal @g_ht_mu_val() {addr_space = 0 : i32} : !llvm.ptr {
    %6 = llvm.mlir.zero : !llvm.ptr
    llvm.return %6 : !llvm.ptr
  }
  // Module static: g_ht_mu_used
  llvm.mlir.global internal @g_ht_mu_used() {addr_space = 0 : i32} : !llvm.ptr {
    %7 = llvm.mlir.zero : !llvm.ptr
    llvm.return %7 : !llvm.ptr
  }
  // Module static: g_ht_phi_key
  llvm.mlir.global internal @g_ht_phi_key() {addr_space = 0 : i32} : !llvm.ptr {
    %8 = llvm.mlir.zero : !llvm.ptr
    llvm.return %8 : !llvm.ptr
  }
  // Module static: g_ht_phi_val
  llvm.mlir.global internal @g_ht_phi_val() {addr_space = 0 : i32} : !llvm.ptr {
    %9 = llvm.mlir.zero : !llvm.ptr
    llvm.return %9 : !llvm.ptr
  }
  // Module static: g_ht_phi_used
  llvm.mlir.global internal @g_ht_phi_used() {addr_space = 0 : i32} : !llvm.ptr {
    %10 = llvm.mlir.zero : !llvm.ptr
    llvm.return %10 : !llvm.ptr
  }
  // Module static: g_ht_mu_odd_key
  llvm.mlir.global internal @g_ht_mu_odd_key() {addr_space = 0 : i32} : !llvm.ptr {
    %11 = llvm.mlir.zero : !llvm.ptr
    llvm.return %11 : !llvm.ptr
  }
  // Module static: g_ht_mu_odd_val
  llvm.mlir.global internal @g_ht_mu_odd_val() {addr_space = 0 : i32} : !llvm.ptr {
    %12 = llvm.mlir.zero : !llvm.ptr
    llvm.return %12 : !llvm.ptr
  }
  // Module static: g_ht_mu_odd_used
  llvm.mlir.global internal @g_ht_mu_odd_used() {addr_space = 0 : i32} : !llvm.ptr {
    %13 = llvm.mlir.zero : !llvm.ptr
    llvm.return %13 : !llvm.ptr
  }
  func.func @hash64(%arg0: i64) -> i64 {
    %14 = llvm.mlir.constant(1 : i64) : i64
    %15 = llvm.alloca %14 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %15 : i64, !llvm.ptr
    %16 = llvm.load %15 : !llvm.ptr -> i64
    %17 = llvm.load %15 : !llvm.ptr -> i64
    %18 = arith.constant 33 : i32
    %20 = arith.extsi %18 : i32 to i64
    %19 = arith.shrsi %17, %20 : i64
    %21 = arith.xori %16, %19 : i64
    llvm.store %21, %15 : i64, !llvm.ptr
    %22 = llvm.load %15 : !llvm.ptr -> i64
    %23 = arith.constant 1718007120 : i32
    %25 = arith.constant 0 : i32
    %24 = arith.subi %25, %23 : i32
    %27 = arith.extsi %24 : i32 to i64
    %26 = arith.muli %22, %27 : i64
    llvm.store %26, %15 : i64, !llvm.ptr
    %28 = llvm.load %15 : !llvm.ptr -> i64
    %29 = llvm.load %15 : !llvm.ptr -> i64
    %30 = arith.constant 33 : i32
    %32 = arith.extsi %30 : i32 to i64
    %31 = arith.shrsi %29, %32 : i64
    %33 = arith.xori %28, %31 : i64
    llvm.store %33, %15 : i64, !llvm.ptr
    %34 = llvm.load %15 : !llvm.ptr -> i64
    %35 = arith.constant 434726454 : i32
    %37 = arith.constant 0 : i32
    %36 = arith.subi %37, %35 : i32
    %39 = arith.extsi %36 : i32 to i64
    %38 = arith.muli %34, %39 : i64
    llvm.store %38, %15 : i64, !llvm.ptr
    %40 = llvm.load %15 : !llvm.ptr -> i64
    %41 = llvm.load %15 : !llvm.ptr -> i64
    %42 = arith.constant 33 : i32
    %44 = arith.extsi %42 : i32 to i64
    %43 = arith.shrsi %41, %44 : i64
    %45 = arith.xori %40, %43 : i64
    llvm.store %45, %15 : i64, !llvm.ptr
    %46 = llvm.load %15 : !llvm.ptr -> i64
    %47 = llvm.mlir.addressof @HASH_MASK : !llvm.ptr
    %48 = llvm.load %47 : !llvm.ptr -> i64
    %49 = arith.andi %46, %48 : i64
    func.return %49 : i64
  }
  func.func @ht_get(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i64, %arg4: !llvm.ptr) -> i64 {
    %50 = func.call @hash64(%arg3) : (i64) -> i64
    %51 = llvm.mlir.constant(1 : i64) : i64
    %52 = llvm.alloca %51 x i64 : (i64) -> !llvm.ptr
    llvm.store %50, %52 : i64, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %54 = llvm.load %52 : !llvm.ptr -> i64
    %55 = llvm.getelementptr %arg2[%54] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %53 = llvm.load %55 : !llvm.ptr -> i8
    %56 = arith.constant 0 : i32
    %58 = arith.extsi %53 : i8 to i32
    %57 = arith.cmpi ne, %58, %56 : i32
    cf.cond_br %57, ^bb1, ^bb2
    ^bb1:
      %60 = llvm.load %52 : !llvm.ptr -> i64
      %61 = llvm.getelementptr %arg0[%60] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %59 = llvm.load %61 : !llvm.ptr -> i64
      %62 = arith.cmpi eq, %59, %arg3 : i64
      cf.cond_br %62, ^bb3, ^bb4
      ^bb3:
        %64 = llvm.load %52 : !llvm.ptr -> i64
        %65 = llvm.getelementptr %arg1[%64] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %63 = llvm.load %65 : !llvm.ptr -> i64
        %66 = arith.constant 0 : i32
        %67 = arith.extsi %66 : i32 to i64
        %68 = llvm.getelementptr %arg4[%67] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %63, %68 : i64, !llvm.ptr
        %69 = arith.constant 1 : i32
        %70 = arith.extsi %69 : i32 to i64
        func.return %70 : i64
      ^bb4:
        cf.br ^bb5
      ^bb5:
      %71 = llvm.load %52 : !llvm.ptr -> i64
      %72 = arith.constant 1 : i32
      %74 = arith.extsi %72 : i32 to i64
      %73 = arith.addi %71, %74 : i64
      %75 = llvm.mlir.addressof @HASH_MASK : !llvm.ptr
      %76 = llvm.load %75 : !llvm.ptr -> i64
      %77 = arith.andi %73, %76 : i64
      llvm.store %77, %52 : i64, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    %78 = arith.constant 0 : i32
    %79 = arith.extsi %78 : i32 to i64
    func.return %79 : i64
  }
  func.func @ht_put(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i64, %arg4: i64) -> () {
    %80 = func.call @hash64(%arg3) : (i64) -> i64
    %81 = llvm.mlir.constant(1 : i64) : i64
    %82 = llvm.alloca %81 x i64 : (i64) -> !llvm.ptr
    llvm.store %80, %82 : i64, !llvm.ptr
    cf.br ^bb6
    ^bb6:
    %84 = llvm.load %82 : !llvm.ptr -> i64
    %85 = llvm.getelementptr %arg2[%84] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %83 = llvm.load %85 : !llvm.ptr -> i8
    %86 = arith.constant 0 : i32
    %88 = arith.extsi %83 : i8 to i32
    %87 = arith.cmpi ne, %88, %86 : i32
    cf.cond_br %87, ^bb7, ^bb8
    ^bb7:
      %90 = llvm.load %82 : !llvm.ptr -> i64
      %91 = llvm.getelementptr %arg0[%90] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %89 = llvm.load %91 : !llvm.ptr -> i64
      %92 = arith.cmpi eq, %89, %arg3 : i64
      cf.cond_br %92, ^bb9, ^bb10
      ^bb9:
        %93 = llvm.load %82 : !llvm.ptr -> i64
        %94 = llvm.getelementptr %arg1[%93] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %arg4, %94 : i64, !llvm.ptr
        func.return
      ^bb10:
        cf.br ^bb11
      ^bb11:
      %95 = llvm.load %82 : !llvm.ptr -> i64
      %96 = arith.constant 1 : i32
      %98 = arith.extsi %96 : i32 to i64
      %97 = arith.addi %95, %98 : i64
      %99 = llvm.mlir.addressof @HASH_MASK : !llvm.ptr
      %100 = llvm.load %99 : !llvm.ptr -> i64
      %101 = arith.andi %97, %100 : i64
      llvm.store %101, %82 : i64, !llvm.ptr
      cf.br ^bb6
    ^bb8:
    %102 = llvm.load %82 : !llvm.ptr -> i64
    %103 = llvm.getelementptr %arg0[%102] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg3, %103 : i64, !llvm.ptr
    %104 = llvm.load %82 : !llvm.ptr -> i64
    %105 = llvm.getelementptr %arg1[%104] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg4, %105 : i64, !llvm.ptr
    %106 = arith.constant 1 : i32
    %107 = llvm.load %82 : !llvm.ptr -> i64
    %108 = arith.trunci %106 : i32 to i8
    %109 = llvm.getelementptr %arg2[%107] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %108, %109 : i8, !llvm.ptr
    func.return
  }
  func.func @sieve(%arg0: i64) -> () {
    %111 = arith.constant 1 : i32
    %113 = arith.extsi %111 : i32 to i64
    %112 = arith.addi %arg0, %113 : i64
    %114 = arith.constant 1 : i32
    %115 = arith.extsi %114 : i32 to i64
    %110 = func.call @calloc(%112, %115) : (i64, i64) -> !llvm.ptr
    %116 = llvm.mlir.addressof @g_mu : !llvm.ptr
    llvm.store %110, %116 : !llvm.ptr, !llvm.ptr
    %118 = arith.constant 1 : i32
    %120 = arith.extsi %118 : i32 to i64
    %119 = arith.addi %arg0, %120 : i64
    %121 = arith.constant 4 : i32
    %122 = arith.extsi %121 : i32 to i64
    %117 = func.call @calloc(%119, %122) : (i64, i64) -> !llvm.ptr
    %123 = llvm.mlir.addressof @g_phi : !llvm.ptr
    llvm.store %117, %123 : !llvm.ptr, !llvm.ptr
    %125 = arith.constant 1 : i32
    %127 = arith.extsi %125 : i32 to i64
    %126 = arith.addi %arg0, %127 : i64
    %128 = arith.constant 1 : i32
    %129 = arith.extsi %128 : i32 to i64
    %124 = func.call @calloc(%126, %129) : (i64, i64) -> !llvm.ptr
    %131 = arith.constant 8 : i32
    %133 = arith.extsi %131 : i32 to i64
    %132 = arith.muli %arg0, %133 : i64
    %130 = func.call @malloc(%132) : (i64) -> !llvm.ptr
    %134 = arith.constant 0 : i32
    %135 = arith.extsi %134 : i32 to i64
    %136 = llvm.mlir.constant(1 : i64) : i64
    %137 = llvm.alloca %136 x i64 : (i64) -> !llvm.ptr
    llvm.store %135, %137 : i64, !llvm.ptr
    %138 = arith.constant 1 : i32
    %139 = llvm.mlir.addressof @g_mu : !llvm.ptr
    %140 = llvm.load %139 : !llvm.ptr -> !llvm.ptr
    %141 = arith.constant 1 : i32
    %142 = arith.trunci %138 : i32 to i8
    %143 = arith.extsi %141 : i32 to i64
    %144 = llvm.getelementptr %140[%143] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %142, %144 : i8, !llvm.ptr
    %145 = arith.constant 1 : i32
    %146 = llvm.mlir.addressof @g_phi : !llvm.ptr
    %147 = llvm.load %146 : !llvm.ptr -> !llvm.ptr
    %148 = arith.constant 1 : i32
    %149 = arith.extsi %148 : i32 to i64
    %150 = llvm.getelementptr %147[%149] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %145, %150 : i32, !llvm.ptr
    %151 = arith.constant 2 : i32
    %152 = arith.extsi %151 : i32 to i64
    %153 = llvm.mlir.constant(1 : i64) : i64
    %154 = llvm.alloca %153 x i64 : (i64) -> !llvm.ptr
    llvm.store %152, %154 : i64, !llvm.ptr
    cf.br ^bb12
    ^bb12:
    %155 = llvm.load %154 : !llvm.ptr -> i64
    %156 = arith.cmpi sle, %155, %arg0 : i64
    cf.cond_br %156, ^bb13, ^bb14
    ^bb13:
      %158 = llvm.load %154 : !llvm.ptr -> i64
      %159 = llvm.getelementptr %124[%158] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %157 = llvm.load %159 : !llvm.ptr -> i8
      %160 = arith.constant 0 : i32
      %162 = arith.extsi %157 : i8 to i32
      %161 = arith.cmpi eq, %162, %160 : i32
      cf.cond_br %161, ^bb15, ^bb16
      ^bb15:
        %163 = llvm.load %154 : !llvm.ptr -> i64
        %164 = llvm.load %137 : !llvm.ptr -> i64
        %165 = llvm.getelementptr %130[%164] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %163, %165 : i64, !llvm.ptr
        %166 = llvm.load %137 : !llvm.ptr -> i64
        %167 = arith.constant 1 : i32
        %169 = arith.extsi %167 : i32 to i64
        %168 = arith.addi %166, %169 : i64
        llvm.store %168, %137 : i64, !llvm.ptr
        %170 = arith.constant 1 : i32
        %172 = arith.constant 0 : i32
        %171 = arith.subi %172, %170 : i32
        %173 = llvm.mlir.addressof @g_mu : !llvm.ptr
        %174 = llvm.load %173 : !llvm.ptr -> !llvm.ptr
        %175 = llvm.load %154 : !llvm.ptr -> i64
        %176 = arith.trunci %171 : i32 to i8
        %177 = llvm.getelementptr %174[%175] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %176, %177 : i8, !llvm.ptr
        %178 = llvm.load %154 : !llvm.ptr -> i64
        %179 = arith.constant 1 : i32
        %181 = arith.extsi %179 : i32 to i64
        %180 = arith.subi %178, %181 : i64
        %182 = arith.trunci %180 : i64 to i32
        %183 = llvm.mlir.addressof @g_phi : !llvm.ptr
        %184 = llvm.load %183 : !llvm.ptr -> !llvm.ptr
        %185 = llvm.load %154 : !llvm.ptr -> i64
        %186 = llvm.getelementptr %184[%185] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %182, %186 : i32, !llvm.ptr
        cf.br ^bb17
      ^bb16:
        cf.br ^bb17
      ^bb17:
      %187 = arith.constant 0 : i32
      %188 = arith.extsi %187 : i32 to i64
      %189 = llvm.mlir.constant(1 : i64) : i64
      %190 = llvm.alloca %189 x i64 : (i64) -> !llvm.ptr
      llvm.store %188, %190 : i64, !llvm.ptr
      cf.br ^bb18
      ^bb18:
      %191 = llvm.load %190 : !llvm.ptr -> i64
      %192 = llvm.load %137 : !llvm.ptr -> i64
      %193 = arith.cmpi slt, %191, %192 : i64
      cf.cond_br %193, ^bb19, ^bb20
      ^bb19:
        %195 = llvm.load %190 : !llvm.ptr -> i64
        %196 = llvm.getelementptr %130[%195] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %194 = llvm.load %196 : !llvm.ptr -> i64
        %197 = llvm.load %154 : !llvm.ptr -> i64
        %198 = arith.muli %197, %194 : i64
        %199 = arith.cmpi sgt, %198, %arg0 : i64
        cf.cond_br %199, ^bb21, ^bb22
        ^bb21:
          cf.br ^bb20
        ^bb22:
          cf.br ^bb23
        ^bb23:
        %200 = arith.constant 1 : i32
        %201 = arith.trunci %200 : i32 to i8
        %202 = llvm.getelementptr %124[%198] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %201, %202 : i8, !llvm.ptr
        %203 = llvm.load %154 : !llvm.ptr -> i64
        %204 = arith.remsi %203, %194 : i64
        %205 = arith.constant 0 : i32
        %207 = arith.extsi %205 : i32 to i64
        %206 = arith.cmpi eq, %204, %207 : i64
        cf.cond_br %206, ^bb24, ^bb25
        ^bb24:
          %208 = arith.constant 0 : i32
          %209 = llvm.mlir.addressof @g_mu : !llvm.ptr
          %210 = llvm.load %209 : !llvm.ptr -> !llvm.ptr
          %211 = arith.trunci %208 : i32 to i8
          %212 = llvm.getelementptr %210[%198] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %211, %212 : i8, !llvm.ptr
          %214 = llvm.mlir.addressof @g_phi : !llvm.ptr
          %215 = llvm.load %214 : !llvm.ptr -> !llvm.ptr
          %216 = llvm.load %154 : !llvm.ptr -> i64
          %217 = llvm.getelementptr %215[%216] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %213 = llvm.load %217 : !llvm.ptr -> i32
          %218 = arith.extsi %213 : i32 to i64
          %219 = arith.muli %218, %194 : i64
          %220 = arith.trunci %219 : i64 to i32
          %221 = llvm.mlir.addressof @g_phi : !llvm.ptr
          %222 = llvm.load %221 : !llvm.ptr -> !llvm.ptr
          %223 = llvm.getelementptr %222[%198] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %220, %223 : i32, !llvm.ptr
          cf.br ^bb20
        ^bb25:
          %225 = llvm.mlir.addressof @g_mu : !llvm.ptr
          %226 = llvm.load %225 : !llvm.ptr -> !llvm.ptr
          %227 = llvm.load %154 : !llvm.ptr -> i64
          %228 = llvm.getelementptr %226[%227] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %224 = llvm.load %228 : !llvm.ptr -> i8
          %230 = arith.constant 0 : i8
          %229 = arith.subi %230, %224 : i8
          %231 = llvm.mlir.addressof @g_mu : !llvm.ptr
          %232 = llvm.load %231 : !llvm.ptr -> !llvm.ptr
          %233 = llvm.getelementptr %232[%198] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %229, %233 : i8, !llvm.ptr
          %235 = llvm.mlir.addressof @g_phi : !llvm.ptr
          %236 = llvm.load %235 : !llvm.ptr -> !llvm.ptr
          %237 = llvm.load %154 : !llvm.ptr -> i64
          %238 = llvm.getelementptr %236[%237] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %234 = llvm.load %238 : !llvm.ptr -> i32
          %239 = arith.extsi %234 : i32 to i64
          %240 = arith.constant 1 : i32
          %242 = arith.extsi %240 : i32 to i64
          %241 = arith.subi %194, %242 : i64
          %243 = arith.muli %239, %241 : i64
          %244 = arith.trunci %243 : i64 to i32
          %245 = llvm.mlir.addressof @g_phi : !llvm.ptr
          %246 = llvm.load %245 : !llvm.ptr -> !llvm.ptr
          %247 = llvm.getelementptr %246[%198] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %244, %247 : i32, !llvm.ptr
          cf.br ^bb26
        ^bb26:
        %248 = llvm.load %190 : !llvm.ptr -> i64
        %249 = arith.constant 1 : i32
        %251 = arith.extsi %249 : i32 to i64
        %250 = arith.addi %248, %251 : i64
        llvm.store %250, %190 : i64, !llvm.ptr
        cf.br ^bb18
      ^bb20:
      %252 = llvm.load %154 : !llvm.ptr -> i64
      %253 = arith.constant 1 : i32
      %255 = arith.extsi %253 : i32 to i64
      %254 = arith.addi %252, %255 : i64
      llvm.store %254, %154 : i64, !llvm.ptr
      cf.br ^bb12
    ^bb14:
    %257 = arith.constant 1 : i32
    %259 = arith.extsi %257 : i32 to i64
    %258 = arith.addi %arg0, %259 : i64
    %260 = arith.constant 8 : i32
    %261 = arith.extsi %260 : i32 to i64
    %256 = func.call @calloc(%258, %261) : (i64, i64) -> !llvm.ptr
    %262 = llvm.mlir.addressof @g_pre_mu : !llvm.ptr
    llvm.store %256, %262 : !llvm.ptr, !llvm.ptr
    %264 = arith.constant 1 : i32
    %266 = arith.extsi %264 : i32 to i64
    %265 = arith.addi %arg0, %266 : i64
    %267 = arith.constant 8 : i32
    %268 = arith.extsi %267 : i32 to i64
    %263 = func.call @calloc(%265, %268) : (i64, i64) -> !llvm.ptr
    %269 = llvm.mlir.addressof @g_pre_phi : !llvm.ptr
    llvm.store %263, %269 : !llvm.ptr, !llvm.ptr
    %271 = arith.constant 1 : i32
    %273 = arith.extsi %271 : i32 to i64
    %272 = arith.addi %arg0, %273 : i64
    %274 = arith.constant 8 : i32
    %275 = arith.extsi %274 : i32 to i64
    %270 = func.call @calloc(%272, %275) : (i64, i64) -> !llvm.ptr
    %276 = llvm.mlir.addressof @g_pre_mu_odd : !llvm.ptr
    llvm.store %270, %276 : !llvm.ptr, !llvm.ptr
    %277 = arith.constant 0 : i32
    %278 = arith.extsi %277 : i32 to i64
    %279 = llvm.mlir.constant(1 : i64) : i64
    %280 = llvm.alloca %279 x i64 : (i64) -> !llvm.ptr
    llvm.store %278, %280 : i64, !llvm.ptr
    %281 = arith.constant 0 : i32
    %282 = arith.extsi %281 : i32 to i64
    %283 = llvm.mlir.constant(1 : i64) : i64
    %284 = llvm.alloca %283 x i64 : (i64) -> !llvm.ptr
    llvm.store %282, %284 : i64, !llvm.ptr
    %285 = arith.constant 0 : i32
    %286 = arith.extsi %285 : i32 to i64
    %287 = llvm.mlir.constant(1 : i64) : i64
    %288 = llvm.alloca %287 x i64 : (i64) -> !llvm.ptr
    llvm.store %286, %288 : i64, !llvm.ptr
    %289 = arith.constant 1 : i32
    %290 = arith.extsi %289 : i32 to i64
    %291 = llvm.mlir.constant(1 : i64) : i64
    %292 = llvm.alloca %291 x i64 : (i64) -> !llvm.ptr
    llvm.store %290, %292 : i64, !llvm.ptr
    cf.br ^bb27
    ^bb27:
    %293 = llvm.load %292 : !llvm.ptr -> i64
    %294 = arith.cmpi sle, %293, %arg0 : i64
    cf.cond_br %294, ^bb28, ^bb29
    ^bb28:
      %295 = llvm.load %280 : !llvm.ptr -> i64
      %297 = llvm.mlir.addressof @g_mu : !llvm.ptr
      %298 = llvm.load %297 : !llvm.ptr -> !llvm.ptr
      %299 = llvm.load %292 : !llvm.ptr -> i64
      %300 = llvm.getelementptr %298[%299] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %296 = llvm.load %300 : !llvm.ptr -> i8
      %301 = arith.extsi %296 : i8 to i64
      %302 = arith.addi %295, %301 : i64
      llvm.store %302, %280 : i64, !llvm.ptr
      %303 = llvm.load %284 : !llvm.ptr -> i64
      %305 = llvm.mlir.addressof @g_phi : !llvm.ptr
      %306 = llvm.load %305 : !llvm.ptr -> !llvm.ptr
      %307 = llvm.load %292 : !llvm.ptr -> i64
      %308 = llvm.getelementptr %306[%307] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %304 = llvm.load %308 : !llvm.ptr -> i32
      %309 = arith.extsi %304 : i32 to i64
      %310 = arith.addi %303, %309 : i64
      llvm.store %310, %284 : i64, !llvm.ptr
      %311 = llvm.load %292 : !llvm.ptr -> i64
      %312 = arith.constant 1 : i32
      %314 = arith.extsi %312 : i32 to i64
      %313 = arith.andi %311, %314 : i64
      %315 = arith.constant 0 : i32
      %317 = arith.extsi %315 : i32 to i64
      %316 = arith.cmpi ne, %313, %317 : i64
      cf.cond_br %316, ^bb30, ^bb31
      ^bb30:
        %318 = llvm.load %288 : !llvm.ptr -> i64
        %320 = llvm.mlir.addressof @g_mu : !llvm.ptr
        %321 = llvm.load %320 : !llvm.ptr -> !llvm.ptr
        %322 = llvm.load %292 : !llvm.ptr -> i64
        %323 = llvm.getelementptr %321[%322] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %319 = llvm.load %323 : !llvm.ptr -> i8
        %324 = arith.extsi %319 : i8 to i64
        %325 = arith.addi %318, %324 : i64
        llvm.store %325, %288 : i64, !llvm.ptr
        cf.br ^bb32
      ^bb31:
        cf.br ^bb32
      ^bb32:
      %326 = llvm.load %280 : !llvm.ptr -> i64
      %327 = llvm.mlir.addressof @g_pre_mu : !llvm.ptr
      %328 = llvm.load %327 : !llvm.ptr -> !llvm.ptr
      %329 = llvm.load %292 : !llvm.ptr -> i64
      %330 = llvm.getelementptr %328[%329] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %326, %330 : i64, !llvm.ptr
      %331 = llvm.load %284 : !llvm.ptr -> i64
      %332 = llvm.mlir.addressof @g_pre_phi : !llvm.ptr
      %333 = llvm.load %332 : !llvm.ptr -> !llvm.ptr
      %334 = llvm.load %292 : !llvm.ptr -> i64
      %335 = llvm.getelementptr %333[%334] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %331, %335 : i64, !llvm.ptr
      %336 = llvm.load %288 : !llvm.ptr -> i64
      %337 = llvm.mlir.addressof @g_pre_mu_odd : !llvm.ptr
      %338 = llvm.load %337 : !llvm.ptr -> !llvm.ptr
      %339 = llvm.load %292 : !llvm.ptr -> i64
      %340 = llvm.getelementptr %338[%339] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %336, %340 : i64, !llvm.ptr
      %341 = llvm.load %292 : !llvm.ptr -> i64
      %342 = arith.constant 1 : i32
      %344 = arith.extsi %342 : i32 to i64
      %343 = arith.addi %341, %344 : i64
      llvm.store %343, %292 : i64, !llvm.ptr
      cf.br ^bb27
    ^bb29:
    func.call @free(%124) : (!llvm.ptr) -> ()
    func.call @free(%130) : (!llvm.ptr) -> ()
    func.return
  }
  func.func @S_mu(%arg0: i64) -> i64 {
    %347 = llvm.mlir.addressof @g_L : !llvm.ptr
    %348 = llvm.load %347 : !llvm.ptr -> i64
    %349 = arith.cmpi sle, %arg0, %348 : i64
    cf.cond_br %349, ^bb33, ^bb34
    ^bb33:
      %351 = llvm.mlir.addressof @g_pre_mu : !llvm.ptr
      %352 = llvm.load %351 : !llvm.ptr -> !llvm.ptr
      %353 = llvm.getelementptr %352[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %350 = llvm.load %353 : !llvm.ptr -> i64
      func.return %350 : i64
    ^bb34:
      cf.br ^bb35
    ^bb35:
    %355 = arith.constant 8 : i32
    %356 = arith.extsi %355 : i32 to i64
    %354 = func.call @malloc(%356) : (i64) -> !llvm.ptr
    %358 = llvm.mlir.addressof @g_ht_mu_key : !llvm.ptr
    %359 = llvm.load %358 : !llvm.ptr -> !llvm.ptr
    %360 = llvm.mlir.addressof @g_ht_mu_val : !llvm.ptr
    %361 = llvm.load %360 : !llvm.ptr -> !llvm.ptr
    %362 = llvm.mlir.addressof @g_ht_mu_used : !llvm.ptr
    %363 = llvm.load %362 : !llvm.ptr -> !llvm.ptr
    %357 = func.call @ht_get(%359, %361, %363, %arg0, %354) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64, !llvm.ptr) -> i64
    %364 = arith.constant 1 : i32
    %366 = arith.extsi %364 : i32 to i64
    %365 = arith.cmpi eq, %357, %366 : i64
    cf.cond_br %365, ^bb36, ^bb37
    ^bb36:
      %368 = arith.constant 0 : i32
      %369 = arith.extsi %368 : i32 to i64
      %370 = llvm.getelementptr %354[%369] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %367 = llvm.load %370 : !llvm.ptr -> i64
      func.call @free(%354) : (!llvm.ptr) -> ()
      func.return %367 : i64
    ^bb37:
      cf.br ^bb38
    ^bb38:
    func.call @free(%354) : (!llvm.ptr) -> ()
    %373 = arith.constant 1 : i32
    %374 = arith.extsi %373 : i32 to i64
    %375 = llvm.mlir.constant(1 : i64) : i64
    %376 = llvm.alloca %375 x i64 : (i64) -> !llvm.ptr
    llvm.store %374, %376 : i64, !llvm.ptr
    %377 = arith.constant 2 : i32
    %378 = arith.extsi %377 : i32 to i64
    %379 = llvm.mlir.constant(1 : i64) : i64
    %380 = llvm.alloca %379 x i64 : (i64) -> !llvm.ptr
    llvm.store %378, %380 : i64, !llvm.ptr
    cf.br ^bb39
    ^bb39:
    %381 = llvm.load %380 : !llvm.ptr -> i64
    %382 = arith.cmpi sle, %381, %arg0 : i64
    cf.cond_br %382, ^bb40, ^bb41
    ^bb40:
      %383 = llvm.load %380 : !llvm.ptr -> i64
      %384 = arith.divsi %arg0, %383 : i64
      %385 = arith.divsi %arg0, %384 : i64
      %386 = llvm.load %376 : !llvm.ptr -> i64
      %387 = llvm.load %380 : !llvm.ptr -> i64
      %388 = arith.subi %385, %387 : i64
      %389 = arith.constant 1 : i32
      %391 = arith.extsi %389 : i32 to i64
      %390 = arith.addi %388, %391 : i64
      %392 = func.call @S_mu(%384) : (i64) -> i64
      %393 = arith.muli %390, %392 : i64
      %394 = arith.subi %386, %393 : i64
      llvm.store %394, %376 : i64, !llvm.ptr
      %395 = arith.constant 1 : i32
      %397 = arith.extsi %395 : i32 to i64
      %396 = arith.addi %385, %397 : i64
      llvm.store %396, %380 : i64, !llvm.ptr
      cf.br ^bb39
    ^bb41:
    %399 = llvm.mlir.addressof @g_ht_mu_key : !llvm.ptr
    %400 = llvm.load %399 : !llvm.ptr -> !llvm.ptr
    %401 = llvm.mlir.addressof @g_ht_mu_val : !llvm.ptr
    %402 = llvm.load %401 : !llvm.ptr -> !llvm.ptr
    %403 = llvm.mlir.addressof @g_ht_mu_used : !llvm.ptr
    %404 = llvm.load %403 : !llvm.ptr -> !llvm.ptr
    %405 = llvm.load %376 : !llvm.ptr -> i64
    func.call @ht_put(%400, %402, %404, %arg0, %405) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64, i64) -> ()
    %406 = llvm.load %376 : !llvm.ptr -> i64
    func.return %406 : i64
  }
  func.func @S_phi(%arg0: i64) -> i64 {
    %407 = llvm.mlir.addressof @g_L : !llvm.ptr
    %408 = llvm.load %407 : !llvm.ptr -> i64
    %409 = arith.cmpi sle, %arg0, %408 : i64
    cf.cond_br %409, ^bb42, ^bb43
    ^bb42:
      %411 = llvm.mlir.addressof @g_pre_phi : !llvm.ptr
      %412 = llvm.load %411 : !llvm.ptr -> !llvm.ptr
      %413 = llvm.getelementptr %412[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %410 = llvm.load %413 : !llvm.ptr -> i64
      func.return %410 : i64
    ^bb43:
      cf.br ^bb44
    ^bb44:
    %415 = arith.constant 8 : i32
    %416 = arith.extsi %415 : i32 to i64
    %414 = func.call @malloc(%416) : (i64) -> !llvm.ptr
    %418 = llvm.mlir.addressof @g_ht_phi_key : !llvm.ptr
    %419 = llvm.load %418 : !llvm.ptr -> !llvm.ptr
    %420 = llvm.mlir.addressof @g_ht_phi_val : !llvm.ptr
    %421 = llvm.load %420 : !llvm.ptr -> !llvm.ptr
    %422 = llvm.mlir.addressof @g_ht_phi_used : !llvm.ptr
    %423 = llvm.load %422 : !llvm.ptr -> !llvm.ptr
    %417 = func.call @ht_get(%419, %421, %423, %arg0, %414) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64, !llvm.ptr) -> i64
    %424 = arith.constant 1 : i32
    %426 = arith.extsi %424 : i32 to i64
    %425 = arith.cmpi eq, %417, %426 : i64
    cf.cond_br %425, ^bb45, ^bb46
    ^bb45:
      %428 = arith.constant 0 : i32
      %429 = arith.extsi %428 : i32 to i64
      %430 = llvm.getelementptr %414[%429] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %427 = llvm.load %430 : !llvm.ptr -> i64
      func.call @free(%414) : (!llvm.ptr) -> ()
      func.return %427 : i64
    ^bb46:
      cf.br ^bb47
    ^bb47:
    func.call @free(%414) : (!llvm.ptr) -> ()
    %433 = arith.constant 1 : i32
    %435 = arith.extsi %433 : i32 to i64
    %434 = arith.addi %arg0, %435 : i64
    %436 = arith.muli %arg0, %434 : i64
    %437 = arith.constant 2 : i32
    %439 = arith.extsi %437 : i32 to i64
    %438 = arith.divsi %436, %439 : i64
    %440 = llvm.mlir.constant(1 : i64) : i64
    %441 = llvm.alloca %440 x i64 : (i64) -> !llvm.ptr
    llvm.store %438, %441 : i64, !llvm.ptr
    %442 = arith.constant 2 : i32
    %443 = arith.extsi %442 : i32 to i64
    %444 = llvm.mlir.constant(1 : i64) : i64
    %445 = llvm.alloca %444 x i64 : (i64) -> !llvm.ptr
    llvm.store %443, %445 : i64, !llvm.ptr
    cf.br ^bb48
    ^bb48:
    %446 = llvm.load %445 : !llvm.ptr -> i64
    %447 = arith.cmpi sle, %446, %arg0 : i64
    cf.cond_br %447, ^bb49, ^bb50
    ^bb49:
      %448 = llvm.load %445 : !llvm.ptr -> i64
      %449 = arith.divsi %arg0, %448 : i64
      %450 = arith.divsi %arg0, %449 : i64
      %451 = llvm.load %441 : !llvm.ptr -> i64
      %452 = llvm.load %445 : !llvm.ptr -> i64
      %453 = arith.subi %450, %452 : i64
      %454 = arith.constant 1 : i32
      %456 = arith.extsi %454 : i32 to i64
      %455 = arith.addi %453, %456 : i64
      %457 = func.call @S_phi(%449) : (i64) -> i64
      %458 = arith.muli %455, %457 : i64
      %459 = arith.subi %451, %458 : i64
      llvm.store %459, %441 : i64, !llvm.ptr
      %460 = arith.constant 1 : i32
      %462 = arith.extsi %460 : i32 to i64
      %461 = arith.addi %450, %462 : i64
      llvm.store %461, %445 : i64, !llvm.ptr
      cf.br ^bb48
    ^bb50:
    %464 = llvm.mlir.addressof @g_ht_phi_key : !llvm.ptr
    %465 = llvm.load %464 : !llvm.ptr -> !llvm.ptr
    %466 = llvm.mlir.addressof @g_ht_phi_val : !llvm.ptr
    %467 = llvm.load %466 : !llvm.ptr -> !llvm.ptr
    %468 = llvm.mlir.addressof @g_ht_phi_used : !llvm.ptr
    %469 = llvm.load %468 : !llvm.ptr -> !llvm.ptr
    %470 = llvm.load %441 : !llvm.ptr -> i64
    func.call @ht_put(%465, %467, %469, %arg0, %470) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64, i64) -> ()
    %471 = llvm.load %441 : !llvm.ptr -> i64
    func.return %471 : i64
  }
  func.func @S_mu_odd(%arg0: i64) -> i64 {
    %472 = llvm.mlir.addressof @g_L : !llvm.ptr
    %473 = llvm.load %472 : !llvm.ptr -> i64
    %474 = arith.cmpi sle, %arg0, %473 : i64
    cf.cond_br %474, ^bb51, ^bb52
    ^bb51:
      %476 = llvm.mlir.addressof @g_pre_mu_odd : !llvm.ptr
      %477 = llvm.load %476 : !llvm.ptr -> !llvm.ptr
      %478 = llvm.getelementptr %477[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %475 = llvm.load %478 : !llvm.ptr -> i64
      func.return %475 : i64
    ^bb52:
      cf.br ^bb53
    ^bb53:
    %480 = arith.constant 8 : i32
    %481 = arith.extsi %480 : i32 to i64
    %479 = func.call @malloc(%481) : (i64) -> !llvm.ptr
    %483 = llvm.mlir.addressof @g_ht_mu_odd_key : !llvm.ptr
    %484 = llvm.load %483 : !llvm.ptr -> !llvm.ptr
    %485 = llvm.mlir.addressof @g_ht_mu_odd_val : !llvm.ptr
    %486 = llvm.load %485 : !llvm.ptr -> !llvm.ptr
    %487 = llvm.mlir.addressof @g_ht_mu_odd_used : !llvm.ptr
    %488 = llvm.load %487 : !llvm.ptr -> !llvm.ptr
    %482 = func.call @ht_get(%484, %486, %488, %arg0, %479) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64, !llvm.ptr) -> i64
    %489 = arith.constant 1 : i32
    %491 = arith.extsi %489 : i32 to i64
    %490 = arith.cmpi eq, %482, %491 : i64
    cf.cond_br %490, ^bb54, ^bb55
    ^bb54:
      %493 = arith.constant 0 : i32
      %494 = arith.extsi %493 : i32 to i64
      %495 = llvm.getelementptr %479[%494] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %492 = llvm.load %495 : !llvm.ptr -> i64
      func.call @free(%479) : (!llvm.ptr) -> ()
      func.return %492 : i64
    ^bb55:
      cf.br ^bb56
    ^bb56:
    func.call @free(%479) : (!llvm.ptr) -> ()
    %498 = func.call @S_mu(%arg0) : (i64) -> i64
    %500 = arith.constant 2 : i32
    %502 = arith.extsi %500 : i32 to i64
    %501 = arith.divsi %arg0, %502 : i64
    %499 = func.call @S_mu_odd(%501) : (i64) -> i64
    %503 = arith.addi %498, %499 : i64
    %505 = llvm.mlir.addressof @g_ht_mu_odd_key : !llvm.ptr
    %506 = llvm.load %505 : !llvm.ptr -> !llvm.ptr
    %507 = llvm.mlir.addressof @g_ht_mu_odd_val : !llvm.ptr
    %508 = llvm.load %507 : !llvm.ptr -> !llvm.ptr
    %509 = llvm.mlir.addressof @g_ht_mu_odd_used : !llvm.ptr
    %510 = llvm.load %509 : !llvm.ptr -> !llvm.ptr
    func.call @ht_put(%506, %508, %510, %arg0, %503) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i64, i64) -> ()
    func.return %503 : i64
  }
  func.func @C_count(%arg0: i64) -> i64 {
    %511 = arith.constant 1 : i32
    %513 = arith.extsi %511 : i32 to i64
    %512 = arith.subi %arg0, %513 : i64
    %514 = arith.constant 4 : i32
    %516 = arith.extsi %514 : i32 to i64
    %515 = arith.divsi %512, %516 : i64
    %517 = arith.constant 0 : i32
    %519 = arith.extsi %517 : i32 to i64
    %518 = arith.cmpi sle, %515, %519 : i64
    cf.cond_br %518, ^bb57, ^bb58
    ^bb57:
      %520 = arith.constant 0 : i32
      %521 = arith.extsi %520 : i32 to i64
      func.return %521 : i64
    ^bb58:
      cf.br ^bb59
    ^bb59:
    %522 = arith.constant 1 : i32
    %524 = arith.extsi %522 : i32 to i64
    %523 = arith.addi %arg0, %524 : i64
    %525 = arith.constant 2 : i32
    %527 = arith.extsi %525 : i32 to i64
    %526 = arith.divsi %523, %527 : i64
    %528 = arith.muli %515, %526 : i64
    %529 = arith.constant 1 : i32
    %531 = arith.extsi %529 : i32 to i64
    %530 = arith.addi %515, %531 : i64
    %532 = arith.muli %515, %530 : i64
    %533 = arith.subi %528, %532 : i64
    func.return %533 : i64
  }
  func.func @H(%arg0: i64) -> i64 {
    %534 = arith.constant 2.0 : f32
    %535 = arith.constant 3.0 : f32
    %536 = arith.divf %534, %535 : f32
    %537 = arith.sitofp %arg0 : i64 to f64
    %538 = math.log %537 : f64
    %540 = arith.extf %536 : f32 to f64
    %539 = arith.mulf %540, %538 : f64
    %541 = math.exp %539 : f64
    %542 = arith.fptosi %541 : f64 to i64
    %543 = arith.constant 10 : i32
    %545 = arith.extsi %543 : i32 to i64
    %544 = arith.addi %542, %545 : i64
    %546 = llvm.mlir.constant(1 : i64) : i64
    %547 = llvm.alloca %546 x i64 : (i64) -> !llvm.ptr
    llvm.store %544, %547 : i64, !llvm.ptr
    %548 = llvm.load %547 : !llvm.ptr -> i64
    %549 = arith.cmpi sgt, %548, %arg0 : i64
    cf.cond_br %549, ^bb60, ^bb61
    ^bb60:
      llvm.store %arg0, %547 : i64, !llvm.ptr
      cf.br ^bb62
    ^bb61:
      cf.br ^bb62
    ^bb62:
    %550 = llvm.load %547 : !llvm.ptr -> i64
    %551 = llvm.mlir.addressof @g_L : !llvm.ptr
    llvm.store %550, %551 : i64, !llvm.ptr
    %553 = llvm.load %547 : !llvm.ptr -> i64
    func.call @sieve(%553) : (i64) -> ()
    %555 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %556 = llvm.load %555 : !llvm.ptr -> i64
    %557 = arith.constant 8 : i32
    %558 = arith.extsi %557 : i32 to i64
    %554 = func.call @calloc(%556, %558) : (i64, i64) -> !llvm.ptr
    %559 = llvm.mlir.addressof @g_ht_mu_key : !llvm.ptr
    llvm.store %554, %559 : !llvm.ptr, !llvm.ptr
    %561 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %562 = llvm.load %561 : !llvm.ptr -> i64
    %563 = arith.constant 8 : i32
    %564 = arith.extsi %563 : i32 to i64
    %560 = func.call @calloc(%562, %564) : (i64, i64) -> !llvm.ptr
    %565 = llvm.mlir.addressof @g_ht_mu_val : !llvm.ptr
    llvm.store %560, %565 : !llvm.ptr, !llvm.ptr
    %567 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %568 = llvm.load %567 : !llvm.ptr -> i64
    %569 = arith.constant 1 : i32
    %570 = arith.extsi %569 : i32 to i64
    %566 = func.call @calloc(%568, %570) : (i64, i64) -> !llvm.ptr
    %571 = llvm.mlir.addressof @g_ht_mu_used : !llvm.ptr
    llvm.store %566, %571 : !llvm.ptr, !llvm.ptr
    %573 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %574 = llvm.load %573 : !llvm.ptr -> i64
    %575 = arith.constant 8 : i32
    %576 = arith.extsi %575 : i32 to i64
    %572 = func.call @calloc(%574, %576) : (i64, i64) -> !llvm.ptr
    %577 = llvm.mlir.addressof @g_ht_phi_key : !llvm.ptr
    llvm.store %572, %577 : !llvm.ptr, !llvm.ptr
    %579 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %580 = llvm.load %579 : !llvm.ptr -> i64
    %581 = arith.constant 8 : i32
    %582 = arith.extsi %581 : i32 to i64
    %578 = func.call @calloc(%580, %582) : (i64, i64) -> !llvm.ptr
    %583 = llvm.mlir.addressof @g_ht_phi_val : !llvm.ptr
    llvm.store %578, %583 : !llvm.ptr, !llvm.ptr
    %585 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %586 = llvm.load %585 : !llvm.ptr -> i64
    %587 = arith.constant 1 : i32
    %588 = arith.extsi %587 : i32 to i64
    %584 = func.call @calloc(%586, %588) : (i64, i64) -> !llvm.ptr
    %589 = llvm.mlir.addressof @g_ht_phi_used : !llvm.ptr
    llvm.store %584, %589 : !llvm.ptr, !llvm.ptr
    %591 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %592 = llvm.load %591 : !llvm.ptr -> i64
    %593 = arith.constant 8 : i32
    %594 = arith.extsi %593 : i32 to i64
    %590 = func.call @calloc(%592, %594) : (i64, i64) -> !llvm.ptr
    %595 = llvm.mlir.addressof @g_ht_mu_odd_key : !llvm.ptr
    llvm.store %590, %595 : !llvm.ptr, !llvm.ptr
    %597 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %598 = llvm.load %597 : !llvm.ptr -> i64
    %599 = arith.constant 8 : i32
    %600 = arith.extsi %599 : i32 to i64
    %596 = func.call @calloc(%598, %600) : (i64, i64) -> !llvm.ptr
    %601 = llvm.mlir.addressof @g_ht_mu_odd_val : !llvm.ptr
    llvm.store %596, %601 : !llvm.ptr, !llvm.ptr
    %603 = llvm.mlir.addressof @HASH_SIZE : !llvm.ptr
    %604 = llvm.load %603 : !llvm.ptr -> i64
    %605 = arith.constant 1 : i32
    %606 = arith.extsi %605 : i32 to i64
    %602 = func.call @calloc(%604, %606) : (i64, i64) -> !llvm.ptr
    %607 = llvm.mlir.addressof @g_ht_mu_odd_used : !llvm.ptr
    llvm.store %602, %607 : !llvm.ptr, !llvm.ptr
    %608 = func.call @S_mu(%arg0) : (i64) -> i64
    %609 = func.call @S_phi(%arg0) : (i64) -> i64
    %610 = arith.constant 1 : i32
    %612 = arith.extsi %610 : i32 to i64
    %611 = arith.subi %609, %612 : i64
    %613 = arith.constant 0 : i32
    %614 = arith.extsi %613 : i32 to i64
    %615 = llvm.mlir.constant(1 : i64) : i64
    %616 = llvm.alloca %615 x i64 : (i64) -> !llvm.ptr
    llvm.store %614, %616 : i64, !llvm.ptr
    %617 = arith.constant 1 : i32
    %618 = arith.extsi %617 : i32 to i64
    %619 = llvm.mlir.constant(1 : i64) : i64
    %620 = llvm.alloca %619 x i64 : (i64) -> !llvm.ptr
    llvm.store %618, %620 : i64, !llvm.ptr
    cf.br ^bb63
    ^bb63:
    %621 = llvm.load %620 : !llvm.ptr -> i64
    %622 = arith.cmpi sle, %621, %arg0 : i64
    cf.cond_br %622, ^bb64, ^bb65
    ^bb64:
      %623 = llvm.load %620 : !llvm.ptr -> i64
      %624 = arith.divsi %arg0, %623 : i64
      %625 = arith.divsi %arg0, %624 : i64
      %626 = func.call @S_mu_odd(%625) : (i64) -> i64
      %628 = llvm.load %620 : !llvm.ptr -> i64
      %629 = arith.constant 1 : i32
      %631 = arith.extsi %629 : i32 to i64
      %630 = arith.subi %628, %631 : i64
      %627 = func.call @S_mu_odd(%630) : (i64) -> i64
      %632 = arith.subi %626, %627 : i64
      %633 = llvm.load %616 : !llvm.ptr -> i64
      %634 = func.call @C_count(%624) : (i64) -> i64
      %635 = arith.muli %632, %634 : i64
      %636 = arith.addi %633, %635 : i64
      llvm.store %636, %616 : i64, !llvm.ptr
      %637 = arith.constant 1 : i32
      %639 = arith.extsi %637 : i32 to i64
      %638 = arith.addi %625, %639 : i64
      llvm.store %638, %620 : i64, !llvm.ptr
      cf.br ^bb63
    ^bb65:
    %640 = arith.constant 2 : i32
    %641 = llvm.load %616 : !llvm.ptr -> i64
    %643 = arith.extsi %640 : i32 to i64
    %642 = arith.muli %643, %641 : i64
    %644 = arith.subi %611, %642 : i64
    func.return %644 : i64
  }
  func.func @main() -> i32 {
    %645 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %647 = arith.constant 1000000000 : i32
    %648 = arith.extsi %647 : i32 to i64
    %646 = func.call @H(%648) : (i64) -> i64
    %649 = llvm.call @printf(%645, %646) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %650 = arith.constant 0 : i32
    func.return %650 : i32
  }
}