Problem 861

Bi-unitary divisors: sum_{k=2..10} Q_k(10^12). Ported from native C to pure Flow.

Answer672623540591
Output672623540591
StatusPASS
Native helperno
Runtime600 ms
Peak memory24976 KB
Time complexityO(n log n) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n log n)O(n log log n)
Space complexityO(n^2)O(n)
ApproachFlow solutionSieve-based divisor sums
VerdictSuboptimal

Flow source

# Project Euler 861
# Bi-unitary divisors: sum_{k=2..10} Q_k(10^12).
# Ported from native C to pure Flow.

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

const N_MAIN: i64 = 1000000000000

let mut g_is_prime_arr: ptr<i32> = null
let mut g_primes_list: ptr<i32> = null
let mut g_plen: i32 = 0
let mut g_pi_small: ptr<i32> = null
let mut g_S: i32 = 0

let mut g_table: ptr<i64> = null
let mut g_start_small: i32 = 0
let mut g_m_table: i32 = 0
let mut g_N_val: i64 = 0

let mut g_forb_count: i32 = 0
let mut g_forb_primes: ptr<i32> = null

let mut g_Q: ptr<i64> = null

function sieve_with_pi(limit: i32) -> void {
    g_is_prime_arr = calloc((limit + 1) as i64, 4)
    for i in 0..(limit + 1) {
        g_is_prime_arr[i] = 1
    }
    g_is_prime_arr[0] = 0
    g_is_prime_arr[1] = 0
    let r: i32 = sqrt(limit as f64) as i32
    for i in 2..(r + 1) {
        if g_is_prime_arr[i] != 0 {
            let mut j: i32 = i * i
            while j <= limit {
                g_is_prime_arr[j] = 0
                j = j + i
            }
        }
    }
    let mut cnt: i32 = 0
    for i in 0..(limit + 1) {
        if g_is_prime_arr[i] != 0 { cnt = cnt + 1 }
    }
    g_primes_list = calloc(cnt as i64, 4)
    g_plen = 0
    for i in 2..(limit + 1) {
        if g_is_prime_arr[i] != 0 {
            g_primes_list[g_plen] = i
            g_plen = g_plen + 1
        }
    }
    g_pi_small = calloc((limit + 1) as i64, 4)
    let mut c: i32 = 0
    for i in 0..(limit + 1) {
        if g_is_prime_arr[i] != 0 { c = c + 1 }
        g_pi_small[i] = c
    }
}

function build_prime_pi_table(N: i64, Sval: i32) -> void {
    g_N_val = N
    g_S = Sval
    if N / (Sval as i64) == (Sval as i64) {
        g_start_small = Sval - 1
    } else {
        g_start_small = Sval
    }
    g_m_table = Sval + g_start_small
    g_table = calloc(g_m_table as i64, 8)

    for i in 0..Sval {
        g_table[i] = N / ((i + 1) as i64) - 1
    }
    for v in 1..(g_start_small + 1) {
        g_table[g_m_table - v] = (v - 1) as i64
    }

    let mut pi: i32 = 0
    while pi < g_plen {
        let p: i64 = g_primes_list[pi] as i64
        let p2: i64 = p * p
        if p2 > N { break }

        let sp: i64 = g_table[g_m_table - ((p - 1) as i32)]

        if p2 <= (Sval as i64) {
            let mut j: i64 = p
            for i in 0..Sval {
                if j <= (Sval as i64) {
                    g_table[i] = g_table[i] - (g_table[(j as i32) - 1] - sp)
                } else {
                    g_table[i] = g_table[i] - (g_table[g_m_table - ((N / j) as i32)] - sp)
                }
                j = j + p
            }
            if p2 <= (g_start_small as i64) {
                let mut v: i32 = g_start_small
                while v >= (p2 as i32) {
                    g_table[g_m_table - v] = g_table[g_m_table - v] - (g_table[g_m_table - (v / (p as i32))] - sp)
                    v = v - 1
                }
            }
        } else {
            let mut endd: i64 = N / p2
            if endd > (Sval as i64) { endd = Sval as i64 }

            let mut j2: i64 = p
            for i in 0..(endd as i32) {
                if j2 <= (Sval as i64) {
                    g_table[i] = g_table[i] - (g_table[(j2 as i32) - 1] - sp)
                } else {
                    g_table[i] = g_table[i] - (g_table[g_m_table - ((N / j2) as i32)] - sp)
                }
                j2 = j2 + p
            }
        }
        pi = pi + 1
    }
}

function prime_pi(x: i64) -> i64 {
    if x <= (g_S as i64) { return g_pi_small[x as i32] as i64 }
    return g_table[(g_N_val / x) as i32 - 1]
}

function count_sqf(limit: i64, mleft: i32, start_idx: i32) -> i64 {
    if mleft == 0 { return 1 }
    if start_idx >= g_plen { return 0 }

    if mleft == 1 {
        if limit < (g_primes_list[start_idx] as i64) { return 0 }
        let mut base: i64 = prime_pi(limit)
        if start_idx > 0 {
            base = base - (g_pi_small[g_primes_list[start_idx - 1]] as i64)
        }
        let start_p: i32 = g_primes_list[start_idx]
        for q in 0..g_forb_count {
            let fp: i64 = g_forb_primes[q] as i64
            if fp >= (start_p as i64) && fp <= limit {
                base = base - 1
            }
        }
        return base
    }

    if mleft == 2 {
        let mut cnt: i64 = 0
        let mut i: i32 = start_idx
        while i < g_plen {
            let p: i64 = g_primes_list[i] as i64
            if p * p > limit { break }
            let mut skip: bool = false
            let mut q: i32 = 0
            while q < g_forb_count {
                if g_forb_primes[q] == (p as i32) { skip = true; break }
                q = q + 1
            }
            if skip { i = i + 1; continue }
            let lim: i64 = limit / p
            let mut total: i64 = prime_pi(lim) - (g_pi_small[p as i32] as i64)
            for q in 0..g_forb_count {
                let fp: i64 = g_forb_primes[q] as i64
                if fp > p && fp <= lim {
                    total = total - 1
                }
            }
            cnt = cnt + total
            i = i + 1
        }
        return cnt
    }

    if mleft == 3 {
        let mut cnt: i64 = 0
        let mut i: i32 = start_idx
        while i < g_plen {
            let p: i64 = g_primes_list[i] as i64
            if p * p * p > limit { break }
            let mut skip: bool = false
            let mut q: i32 = 0
            while q < g_forb_count {
                if g_forb_primes[q] == (p as i32) { skip = true; break }
                q = q + 1
            }
            if skip { i = i + 1; continue }
            cnt = cnt + count_sqf(limit / p, 2, i + 1)
            i = i + 1
        }
        return cnt
    }

    if mleft == 4 {
        let mut cnt: i64 = 0
        let mut i: i32 = start_idx
        while i < g_plen {
            let p: i64 = g_primes_list[i] as i64
            let p4: i64 = p * p * p * p
            if p4 > limit { break }
            let mut skip: bool = false
            let mut q: i32 = 0
            while q < g_forb_count {
                if g_forb_primes[q] == (p as i32) { skip = true; break }
                q = q + 1
            }
            if skip { i = i + 1; continue }
            cnt = cnt + count_sqf(limit / p, 3, i + 1)
            i = i + 1
        }
        return cnt
    }

    return 0
}

function process_powerful(a: i64, d: i32) -> void {
    let limit: i64 = N_MAIN / a
    let mut mleft: i32 = 0
    while mleft < 5 {
        let tau: i32 = d << mleft
        if tau > 20 { break }
        if tau >= 4 {
            let k: i32 = tau / 2
            if k >= 2 && k <= 10 {
                g_Q[k] = g_Q[k] + count_sqf(limit, mleft, 0)
            }
        }
        mleft = mleft + 1
    }
}

function dfs_powerful(start_idx: i32, a: i64, d: i32) -> void {
    process_powerful(a, d)

    let mut i: i32 = start_idx
    while i < g_plen {
        let p: i64 = g_primes_list[i] as i64
        if a * p * p > N_MAIN { break }

        let limit: i64 = N_MAIN / a
        let mut p_pow: i64 = p * p
        let mut e: i32 = 2
        while e <= 20 && p_pow <= limit {
            let f: i32 = 0
            if (e & 1) == 0 {
                f = e
            } else {
                f = e + 1
            }
            let new_d: i32 = d * f
            if new_d <= 20 {
                let old_fc: i32 = g_forb_count
                g_forb_primes[g_forb_count] = p as i32
                g_forb_count = g_forb_count + 1
                dfs_powerful(i + 1, a * p_pow, new_d)
                g_forb_count = old_fc
            }
            e = e + 1
            if e > 20 { break }
            p_pow = p_pow * p
        }
        i = i + 1
    }
}

function main() -> i32 {
    let mut Sval: i32 = sqrt(N_MAIN as f64) as i32
    while (Sval as i64) * (Sval as i64) > N_MAIN { Sval = Sval - 1 }
    while ((Sval + 1) as i64) * ((Sval + 1) as i64) <= N_MAIN { Sval = Sval + 1 }

    sieve_with_pi(Sval)
    build_prime_pi_table(N_MAIN, Sval)

    g_Q = calloc(11, 8)
    for i in 0..11 {
        g_Q[i] = 0
    }
    g_forb_count = 0
    g_forb_primes = calloc(16, 4)

    dfs_powerful(0, 1, 1)

    let mut ans: i64 = 0
    for i in 2..11 {
        ans = ans + g_Q[i]
    }

    printf("%lld\n", ans)

    free(g_is_prime_arr)
    free(g_primes_list)
    free(g_pi_small)
    free(g_table)
    free(g_forb_primes)
    free(g_Q)
    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 sieve_with_pi_i32(int32_t limit);
void build_prime_pi_table_i64_i32(int64_t N, int32_t Sval);
int64_t prime_pi_i64(int64_t x);
int64_t count_sqf_i64_i32_i32(int64_t limit, int32_t mleft, int32_t start_idx);
void process_powerful_i64_i32(int64_t a, int32_t d);
void dfs_powerful_i32_i64_i32(int32_t start_idx, int64_t a, int32_t d);
int32_t main(void);

static const int64_t N_MAIN = 1000000000000;

/* Module statics */
static int32_t* g_is_prime_arr = NULL;
static int32_t* g_primes_list = NULL;
static int32_t g_plen = 0;
static int32_t* g_pi_small = NULL;
static int32_t g_S = 0;
static int64_t* g_table = NULL;
static int32_t g_start_small = 0;
static int32_t g_m_table = 0;
static int64_t g_N_val = 0;
static int32_t g_forb_count = 0;
static int32_t* g_forb_primes = NULL;
static int64_t* g_Q = NULL;




void sieve_with_pi_i32(int32_t limit) {
    g_is_prime_arr = calloc(((int64_t)((limit + 1))), 4);
    int32_t __flow_step_1 = 1;
    for (int32_t i = 0; (0 <= (limit + 1)) ? i < (limit + 1) : i > (limit + 1); i += (0 <= (limit + 1)) ? 1 : -1) {
        g_is_prime_arr[i] = 1;
    }
    g_is_prime_arr[0] = 0;
    g_is_prime_arr[1] = 0;
    int32_t r = ((int32_t)(sqrt(((double)(limit)))));
    int32_t __flow_step_2 = 1;
    for (int32_t i = 2; (2 <= (r + 1)) ? i < (r + 1) : i > (r + 1); i += (2 <= (r + 1)) ? 1 : -1) {
        if (g_is_prime_arr[i] != 0) {
            int32_t j = (i * i);
            while (j <= limit) {
                g_is_prime_arr[j] = 0;
                j = (j + i);
            }
        }
    }
    int32_t cnt = 0;
    int32_t __flow_step_3 = 1;
    for (int32_t i = 0; (0 <= (limit + 1)) ? i < (limit + 1) : i > (limit + 1); i += (0 <= (limit + 1)) ? 1 : -1) {
        if (g_is_prime_arr[i] != 0) {
            cnt = (cnt + 1);
        }
    }
    g_primes_list = calloc(((int64_t)(cnt)), 4);
    g_plen = 0;
    int32_t __flow_step_4 = 1;
    for (int32_t i = 2; (2 <= (limit + 1)) ? i < (limit + 1) : i > (limit + 1); i += (2 <= (limit + 1)) ? 1 : -1) {
        if (g_is_prime_arr[i] != 0) {
            g_primes_list[g_plen] = i;
            g_plen = (g_plen + 1);
        }
    }
    g_pi_small = calloc(((int64_t)((limit + 1))), 4);
    int32_t c = 0;
    int32_t __flow_step_5 = 1;
    for (int32_t i = 0; (0 <= (limit + 1)) ? i < (limit + 1) : i > (limit + 1); i += (0 <= (limit + 1)) ? 1 : -1) {
        if (g_is_prime_arr[i] != 0) {
            c = (c + 1);
        }
        g_pi_small[i] = c;
    }
}

void build_prime_pi_table_i64_i32(int64_t N, int32_t Sval) {
    g_N_val = N;
    g_S = Sval;
    if (FLOW_CHECKED_DIV((N), (((int64_t)(Sval)))) == ((int64_t)(Sval))) {
        g_start_small = (Sval - 1);
    } else {
        g_start_small = Sval;
    }
    g_m_table = (Sval + g_start_small);
    g_table = calloc(((int64_t)(g_m_table)), 8);
    int32_t __flow_step_6 = 1;
    for (int32_t i = 0; (0 <= Sval) ? i < Sval : i > Sval; i += (0 <= Sval) ? 1 : -1) {
        g_table[i] = (FLOW_CHECKED_DIV((N), (((int64_t)((i + 1))))) - 1);
    }
    int32_t __flow_step_7 = 1;
    for (int32_t v = 1; (1 <= (g_start_small + 1)) ? v < (g_start_small + 1) : v > (g_start_small + 1); v += (1 <= (g_start_small + 1)) ? 1 : -1) {
        g_table[(g_m_table - v)] = ((int64_t)((v - 1)));
    }
    int32_t pi = 0;
    while (pi < g_plen) {
        int64_t p = ((int64_t)(g_primes_list[pi]));
        int64_t p2 = (p * p);
        if (p2 > N) {
            break;
        }
        int64_t sp = g_table[(g_m_table - ((int32_t)((p - 1))))];
        if (p2 <= ((int64_t)(Sval))) {
            int64_t j = p;
            int32_t __flow_step_8 = 1;
            for (int32_t i = 0; (0 <= Sval) ? i < Sval : i > Sval; i += (0 <= Sval) ? 1 : -1) {
                if (j <= ((int64_t)(Sval))) {
                    g_table[i] = (g_table[i] - (g_table[(((int32_t)(j)) - 1)] - sp));
                } else {
                    g_table[i] = (g_table[i] - (g_table[(g_m_table - ((int32_t)(FLOW_CHECKED_DIV((N), (j)))))] - sp));
                }
                j = (j + p);
            }
            if (p2 <= ((int64_t)(g_start_small))) {
                int32_t v = g_start_small;
                while (v >= ((int32_t)(p2))) {
                    g_table[(g_m_table - v)] = (g_table[(g_m_table - v)] - (g_table[(g_m_table - FLOW_CHECKED_DIV((v), (((int32_t)(p)))))] - sp));
                    v = (v - 1);
                }
            }
        } else {
            int64_t endd = FLOW_CHECKED_DIV((N), (p2));
            if (endd > ((int64_t)(Sval))) {
                endd = ((int64_t)(Sval));
            }
            int64_t j2 = p;
            int32_t __flow_step_9 = 1;
            for (int32_t i = 0; (0 <= ((int32_t)(endd))) ? i < ((int32_t)(endd)) : i > ((int32_t)(endd)); i += (0 <= ((int32_t)(endd))) ? 1 : -1) {
                if (j2 <= ((int64_t)(Sval))) {
                    g_table[i] = (g_table[i] - (g_table[(((int32_t)(j2)) - 1)] - sp));
                } else {
                    g_table[i] = (g_table[i] - (g_table[(g_m_table - ((int32_t)(FLOW_CHECKED_DIV((N), (j2)))))] - sp));
                }
                j2 = (j2 + p);
            }
        }
        pi = (pi + 1);
    }
}

int64_t prime_pi_i64(int64_t x) {
    if (x <= ((int64_t)(g_S))) {
        return ((int64_t)(g_pi_small[((int32_t)(x))]));
    }
    return g_table[(((int32_t)(FLOW_CHECKED_DIV((g_N_val), (x)))) - 1)];
}

int64_t count_sqf_i64_i32_i32(int64_t limit, int32_t mleft, int32_t start_idx) {
    if (mleft == 0) {
        return 1;
    }
    if (start_idx >= g_plen) {
        return 0;
    }
    if (mleft == 1) {
        if (limit < ((int64_t)(g_primes_list[start_idx]))) {
            return 0;
        }
        int64_t base = prime_pi_i64(limit);
        if (start_idx > 0) {
            base = (base - ((int64_t)(g_pi_small[g_primes_list[(start_idx - 1)]])));
        }
        int32_t start_p = g_primes_list[start_idx];
        int32_t __flow_step_10 = 1;
        for (int32_t q = 0; (0 <= g_forb_count) ? q < g_forb_count : q > g_forb_count; q += (0 <= g_forb_count) ? 1 : -1) {
            int64_t fp = ((int64_t)(g_forb_primes[q]));
            if ((fp >= ((int64_t)(start_p)) && fp <= limit)) {
                base = (base - 1);
            }
        }
        return base;
    }
    if (mleft == 2) {
        int64_t cnt = 0;
        int32_t i = start_idx;
        while (i < g_plen) {
            int64_t p = ((int64_t)(g_primes_list[i]));
            if ((p * p) > limit) {
                break;
            }
            bool skip = 0;
            int32_t q = 0;
            while (q < g_forb_count) {
                if (g_forb_primes[q] == ((int32_t)(p))) {
                    skip = 1;
                    break;
                }
                q = (q + 1);
            }
            if (skip) {
                i = (i + 1);
                continue;
            }
            int64_t lim = FLOW_CHECKED_DIV((limit), (p));
            int64_t total = (prime_pi_i64(lim) - ((int64_t)(g_pi_small[((int32_t)(p))])));
            int32_t __flow_step_11 = 1;
            for (int32_t q = 0; (0 <= g_forb_count) ? q < g_forb_count : q > g_forb_count; q += (0 <= g_forb_count) ? 1 : -1) {
                int64_t fp = ((int64_t)(g_forb_primes[q]));
                if ((fp > p && fp <= lim)) {
                    total = (total - 1);
                }
            }
            cnt = (cnt + total);
            i = (i + 1);
        }
        return cnt;
    }
    if (mleft == 3) {
        int64_t cnt = 0;
        int32_t i = start_idx;
        while (i < g_plen) {
            int64_t p = ((int64_t)(g_primes_list[i]));
            if (((p * p) * p) > limit) {
                break;
            }
            bool skip = 0;
            int32_t q = 0;
            while (q < g_forb_count) {
                if (g_forb_primes[q] == ((int32_t)(p))) {
                    skip = 1;
                    break;
                }
                q = (q + 1);
            }
            if (skip) {
                i = (i + 1);
                continue;
            }
            cnt = (cnt + count_sqf_i64_i32_i32(FLOW_CHECKED_DIV((limit), (p)), 2, (i + 1)));
            i = (i + 1);
        }
        return cnt;
    }
    if (mleft == 4) {
        int64_t cnt = 0;
        int32_t i = start_idx;
        while (i < g_plen) {
            int64_t p = ((int64_t)(g_primes_list[i]));
            int64_t p4 = (((p * p) * p) * p);
            if (p4 > limit) {
                break;
            }
            bool skip = 0;
            int32_t q = 0;
            while (q < g_forb_count) {
                if (g_forb_primes[q] == ((int32_t)(p))) {
                    skip = 1;
                    break;
                }
                q = (q + 1);
            }
            if (skip) {
                i = (i + 1);
                continue;
            }
            cnt = (cnt + count_sqf_i64_i32_i32(FLOW_CHECKED_DIV((limit), (p)), 3, (i + 1)));
            i = (i + 1);
        }
        return cnt;
    }
    return 0;
}

void process_powerful_i64_i32(int64_t a, int32_t d) {
    int64_t limit = FLOW_CHECKED_DIV((N_MAIN), (a));
    int32_t mleft = 0;
    while (mleft < 5) {
        int32_t tau = FLOW_CHECKED_SHL((d), (mleft));
        if (tau > 20) {
            break;
        }
        if (tau >= 4) {
            int32_t k = FLOW_CHECKED_DIV((tau), (2));
            if ((k >= 2 && k <= 10)) {
                g_Q[k] = (g_Q[k] + count_sqf_i64_i32_i32(limit, mleft, 0));
            }
        }
        mleft = (mleft + 1);
    }
}

void dfs_powerful_i32_i64_i32(int32_t start_idx, int64_t a, int32_t d) {
    process_powerful_i64_i32(a, d);
    int32_t i = start_idx;
    while (i < g_plen) {
        int64_t p = ((int64_t)(g_primes_list[i]));
        if (((a * p) * p) > N_MAIN) {
            break;
        }
        int64_t limit = FLOW_CHECKED_DIV((N_MAIN), (a));
        int64_t p_pow = (p * p);
        int32_t e = 2;
        while ((e <= 20 && p_pow <= limit)) {
            int32_t f = 0;
            if ((e & 1) == 0) {
                f = e;
            } else {
                f = (e + 1);
            }
            int32_t new_d = (d * f);
            if (new_d <= 20) {
                int32_t old_fc = g_forb_count;
                g_forb_primes[g_forb_count] = ((int32_t)(p));
                g_forb_count = (g_forb_count + 1);
                dfs_powerful_i32_i64_i32((i + 1), (a * p_pow), new_d);
                g_forb_count = old_fc;
            }
            e = (e + 1);
            if (e > 20) {
                break;
            }
            p_pow = (p_pow * p);
        }
        i = (i + 1);
    }
}

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