Problem 634

Count integers x ≤ 9*10^18 writable as a²*b³ with a,b > 1. F(n) = P - X1 - X2 - X3 + 1, where P = powerful count, X1 = squares of cubefree, X2 = cubes of squarefree, X3 = prime sixth powers.

Answer4019680944
Output4019680944
StatusPASS
Native helperno
Runtime10 ms
Peak memory3136 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n log log n)
Space complexityO(n^2)O(n)
ApproachFlow solutionMobius sieve
VerdictSuboptimal

Flow source

# Project Euler 634
# Count integers x ≤ 9*10^18 writable as a²*b³ with a,b > 1.
# F(n) = P - X1 - X2 - X3 + 1, where P = powerful count, X1 = squares of cubefree,
# X2 = cubes of squarefree, X3 = prime sixth powers.

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

function isqrt(n: i64) -> i64 {
    if n <= 0 { return 0 }
    let mut x: i64 = n
    let mut y: i64 = (x + 1) / 2
    while y < x { x = y; y = (x + n / x) / 2 }
    return x
}

function iroot3(n: i64) -> i64 {
    let mut lo: i64 = 0
    let mut hi: i64 = 2
    while true {
        let mut p: i128 = 1 as i128
        for _ in 0..3 { p = p * (hi as i128) }
        if p > (n as i128) { break }
        hi = hi * 2
    }
    while lo + 1 < hi {
        let mid: i64 = (lo + hi) / 2
        let mut p: i128 = 1 as i128
        for _ in 0..3 { p = p * (mid as i128) }
        if p <= (n as i128) { lo = mid } else { hi = mid }
    }
    return lo
}

function iroot6(n: i64) -> i64 {
    let mut lo: i64 = 0
    let mut hi: i64 = 2
    while true {
        let mut p: i128 = 1 as i128
        for _ in 0..6 { p = p * (hi as i128) }
        if p > (n as i128) { break }
        hi = hi * 2
    }
    while lo + 1 < hi {
        let mid: i64 = (lo + hi) / 2
        let m2: i128 = (mid as i128) * (mid as i128)
        let m3: i128 = m2 * m2 * m2
        if m3 <= (n as i128) { lo = mid } else { hi = mid }
    }
    return lo
}

# Count squarefree numbers ≤ m using Möbius
function squarefree_count(m: i64, mu: ptr<i8>) -> i64 {
    let mut s: i64 = 0
    let mut i: i64 = 1
    while i * i <= m {
        let mu_i: i64 = mu[i] as i64
        if mu_i != 0 {
            s = s + mu_i * (m / (i * i))
        }
        i = i + 1
    }
    return s
}

# Count cubefree numbers ≤ m: numbers not divisible by p³ for any prime p
function cubefree_count(m: i64, mu: ptr<i8>) -> i64 {
    # Cubefree count = sum_{d: d^3 | } mu(d) * floor(m / d^3)
    # where mu is Möbius. We need mu up to m^(1/3).
    let mut s: i64 = 0
    let mut d: i64 = 1
    while d * d * d <= m {
        let mu_d: i64 = mu[d] as i64
        if mu_d != 0 {
            s = s + mu_d * (m / (d * d * d))
        }
        d = d + 1
    }
    return s
}

function main() -> i32 {
    let N: i64 = 9000000000000000000  # 9 * 10^18

    # Compute Möbius function up to cbrt(isqrt(N)) (only need for cubefree_count)
    # cubefree_count(R, mu) iterates d while d^3 <= R, so needs mu up to cbrt(R).
    # R = isqrt(N) ≈ 3*10^9, cbrt(R) ≈ 1442.  Use iroot6(N)+10 for safety margin.
    let L: i64 = iroot6(N) + 10
    let mu: ptr<i8> = calloc(L + 1, 1)
    let is_comp: ptr<i8> = calloc(L + 1, 1)
    let primes: ptr<i32> = calloc(L / 5 + 10, 4)
    if mu == null || is_comp == null || primes == null { return 1 }

    mu[1] = 1
    let mut pc: i64 = 0
    for i in 2..(L + 1) {
        if is_comp[i] == 0 {
            primes[pc] = i as i32
            pc = pc + 1
            mu[i] = -1
        }
        let mut j: i64 = 0
        while j < pc {
            let p: i64 = primes[j] as i64
            let ip: i64 = i * p
            if ip > L { break }
            is_comp[ip] = 1
            if i % p == 0 { mu[ip] = 0; break }
            mu[ip] = (0 - (mu[i] as i64)) as i8
            j = j + 1
        }
    }

    # P = powerful count = sum_{squarefree b ≤ N^(1/3)} floor(sqrt(N / b³))
    let m: i64 = iroot3(N)
    # Sieve squarefree up to m
    let sqfree: ptr<i8> = calloc(m + 1, 1)
    if sqfree == null { return 1 }
    for k in 0..(m + 1) { sqfree[k] = 1 }
    sqfree[0] = 0
    let mut p: i64 = 2
    while p * p <= m {
        if sqfree[p] == 1 {
            let sq: i64 = p * p
            let mut j2: i64 = sq
            while j2 <= m { sqfree[j2] = 0; j2 = j2 + sq }
        }
        p = p + 1
    }

    let mut P: i64 = 0
    let mut b: i64 = 1
    while b <= m {
        if sqfree[b] == 1 {
            let b3: i64 = b * b * b
            P = P + isqrt(N / b3)
        }
        b = b + 1
    }

    # X1 = count of cubefree numbers ≤ isqrt(N) (squares of cubefree)
    let R: i64 = isqrt(N)
    let X1: i64 = cubefree_count(R, mu)

    # X2 = count of squarefree numbers ≤ N^(1/3) (cubes of squarefree)
    let X2: i64 = 0
    for b in 1..(m + 1) {
        if sqfree[b] == 1 { X2 = X2 + 1 }
    }

    # X3 = count of primes p with p^6 ≤ N
    let r6: i64 = iroot6(N)
    # Count primes up to r6
    let sieve6: ptr<i8> = calloc(r6 + 1, 1)
    if sieve6 == null { return 1 }
    sieve6[0] = 1
    sieve6[1] = 1
    p = 2
    while p * p <= r6 {
        if sieve6[p] == 0 {
            let mut j3: i64 = p * p
            while j3 <= r6 { sieve6[j3] = 1; j3 = j3 + p }
        }
        p = p + 1
    }
    let mut X3: i64 = 0
    for p in 2..(r6 + 1) {
        if sieve6[p] == 0 { X3 = X3 + 1 }
    }

    let ans: i64 = P - X1 - X2 - X3 + 1
    printf("%lld\n", ans)

    free(sieve6)
    free(sqfree)
    free(primes)
    free(is_comp)
    free(mu)
    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 isqrt_i64(int64_t n);
int64_t iroot3_i64(int64_t n);
int64_t iroot6_i64(int64_t n);
int64_t squarefree_count_i64_ptr_i8(int64_t m, int8_t* mu);
int64_t cubefree_count_i64_ptr_i8(int64_t m, int8_t* mu);
int32_t main(void);



int64_t isqrt_i64(int64_t n) {
    if (n <= 0) {
        return 0;
    }
    int64_t x = n;
    int64_t y = FLOW_CHECKED_DIV(((x + 1)), (2));
    while (y < x) {
        x = y;
        y = FLOW_CHECKED_DIV(((x + FLOW_CHECKED_DIV((n), (x)))), (2));
    }
    return x;
}

int64_t iroot3_i64(int64_t n) {
    int64_t lo = 0;
    int64_t hi = 2;
    while (1) {
        __int128 p = ((__int128)(1));
        int32_t __flow_step_1 = 1;
        for (int32_t _ = 0; (0 <= 3) ? _ < 3 : _ > 3; _ += (0 <= 3) ? 1 : -1) {
            p = (p * ((__int128)(hi)));
        }
        if (p > ((__int128)(n))) {
            break;
        }
        hi = (hi * 2);
    }
    while ((lo + 1) < hi) {
        int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
        __int128 p = ((__int128)(1));
        int32_t __flow_step_2 = 1;
        for (int32_t _ = 0; (0 <= 3) ? _ < 3 : _ > 3; _ += (0 <= 3) ? 1 : -1) {
            p = (p * ((__int128)(mid)));
        }
        if (p <= ((__int128)(n))) {
            lo = mid;
        } else {
            hi = mid;
        }
    }
    return lo;
}

int64_t iroot6_i64(int64_t n) {
    int64_t lo = 0;
    int64_t hi = 2;
    while (1) {
        __int128 p = ((__int128)(1));
        int32_t __flow_step_3 = 1;
        for (int32_t _ = 0; (0 <= 6) ? _ < 6 : _ > 6; _ += (0 <= 6) ? 1 : -1) {
            p = (p * ((__int128)(hi)));
        }
        if (p > ((__int128)(n))) {
            break;
        }
        hi = (hi * 2);
    }
    while ((lo + 1) < hi) {
        int64_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
        __int128 m2 = (((__int128)(mid)) * ((__int128)(mid)));
        __int128 m3 = ((m2 * m2) * m2);
        if (m3 <= ((__int128)(n))) {
            lo = mid;
        } else {
            hi = mid;
        }
    }
    return lo;
}

int64_t squarefree_count_i64_ptr_i8(int64_t m, int8_t* mu) {
    int64_t s = 0;
    int64_t i = 1;
    while ((i * i) <= m) {
        int64_t mu_i = ((int64_t)(mu[i]));
        if (mu_i != 0) {
            s = (s + (mu_i * FLOW_CHECKED_DIV((m), ((i * i)))));
        }
        i = (i + 1);
    }
    return s;
}

int64_t cubefree_count_i64_ptr_i8(int64_t m, int8_t* mu) {
    int64_t s = 0;
    int64_t d = 1;
    while (((d * d) * d) <= m) {
        int64_t mu_d = ((int64_t)(mu[d]));
        if (mu_d != 0) {
            s = (s + (mu_d * FLOW_CHECKED_DIV((m), (((d * d) * d)))));
        }
        d = (d + 1);
    }
    return s;
}

int32_t main(void) {
    int64_t N = 9000000000000000000;
    int64_t L = (iroot6_i64(N) + 10);
    int8_t* mu = (int8_t*)(calloc((L + 1), 1));
    int8_t* is_comp = (int8_t*)(calloc((L + 1), 1));
    int32_t* primes = (int32_t*)(calloc((FLOW_CHECKED_DIV((L), (5)) + 10), 4));
    if (((mu == NULL || is_comp == NULL) || primes == NULL)) {
        return 1;
    }
    mu[1] = 1;
    int64_t pc = 0;
    int32_t __flow_step_4 = 1;
    for (int32_t i = 2; (2 <= (L + 1)) ? i < (L + 1) : i > (L + 1); i += (2 <= (L + 1)) ? 1 : -1) {
        if (is_comp[i] == 0) {
            primes[pc] = ((int32_t)(i));
            pc = (pc + 1);
            mu[i] = (-1);
        }
        int64_t j = 0;
        while (j < pc) {
            int64_t p = ((int64_t)(primes[j]));
            int64_t ip = (i * p);
            if (ip > L) {
                break;
            }
            is_comp[ip] = 1;
            if (FLOW_CHECKED_MOD((i), (p)) == 0) {
                mu[ip] = 0;
                break;
            }
            mu[ip] = ((int8_t)((0 - ((int64_t)(mu[i])))));
            j = (j + 1);
        }
    }
    int64_t m = iroot3_i64(N);
    int8_t* sqfree = (int8_t*)(calloc((m + 1), 1));
    if (sqfree == NULL) {
        return 1;
    }
    int32_t __flow_step_5 = 1;
    for (int32_t k = 0; (0 <= (m + 1)) ? k < (m + 1) : k > (m + 1); k += (0 <= (m + 1)) ? 1 : -1) {
        sqfree[k] = 1;
    }
    sqfree[0] = 0;
    int64_t p = 2;
    while ((p * p) <= m) {
        if (sqfree[p] == 1) {
            int64_t sq = (p * p);
            int64_t j2 = sq;
            while (j2 <= m) {
                sqfree[j2] = 0;
                j2 = (j2 + sq);
            }
        }
        p = (p + 1);
    }
    int64_t P = 0;
    int64_t b = 1;
    while (b <= m) {
        if (sqfree[b] == 1) {
            int64_t b3 = ((b * b) * b);
            P = (P + isqrt_i64(FLOW_CHECKED_DIV((N), (b3))));
        }
        b = (b + 1);
    }
    int64_t R = isqrt_i64(N);
    int64_t X1 = cubefree_count_i64_ptr_i8(R, mu);
    int64_t X2 = 0;
    int32_t __flow_step_6 = 1;
    for (int32_t b = 1; (1 <= (m + 1)) ? b < (m + 1) : b > (m + 1); b += (1 <= (m + 1)) ? 1 : -1) {
        if (sqfree[b] == 1) {
            X2 = (X2 + 1);
        }
    }
    int64_t r6 = iroot6_i64(N);
    int8_t* sieve6 = (int8_t*)(calloc((r6 + 1), 1));
    if (sieve6 == NULL) {
        return 1;
    }
    sieve6[0] = 1;
    sieve6[1] = 1;
    p = 2;
    while ((p * p) <= r6) {
        if (sieve6[p] == 0) {
            int64_t j3 = (p * p);
            while (j3 <= r6) {
                sieve6[j3] = 1;
                j3 = (j3 + p);
            }
        }
        p = (p + 1);
    }
    int64_t X3 = 0;
    int32_t __flow_step_7 = 1;
    for (int32_t p = 2; (2 <= (r6 + 1)) ? p < (r6 + 1) : p > (r6 + 1); p += (2 <= (r6 + 1)) ? 1 : -1) {
        if (sieve6[p] == 0) {
            X3 = (X3 + 1);
        }
    }
    int64_t ans = ((((P - X1) - X2) - X3) + 1);
    printf("%lld\n", ans);
    free(sieve6);
    free(sqfree);
    free(primes);
    free(is_comp);
    free(mu);
    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 @isqrt(%arg0: i64) -> i64 {
    %0 = arith.constant 0 : i32
    %2 = arith.extsi %0 : i32 to i64
    %1 = arith.cmpi sle, %arg0, %2 : i64
    cf.cond_br %1, ^bb0, ^bb1
    ^bb0:
      %3 = arith.constant 0 : i32
      %4 = arith.extsi %3 : i32 to i64
      func.return %4 : i64
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %5 = llvm.mlir.constant(1 : i64) : i64
    %6 = llvm.alloca %5 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg0, %6 : i64, !llvm.ptr
    %7 = llvm.load %6 : !llvm.ptr -> i64
    %8 = arith.constant 1 : i32
    %10 = arith.extsi %8 : i32 to i64
    %9 = arith.addi %7, %10 : i64
    %11 = arith.constant 2 : i32
    %13 = arith.extsi %11 : i32 to i64
    %12 = arith.divsi %9, %13 : i64
    %14 = llvm.mlir.constant(1 : i64) : i64
    %15 = llvm.alloca %14 x i64 : (i64) -> !llvm.ptr
    llvm.store %12, %15 : i64, !llvm.ptr
    cf.br ^bb3
    ^bb3:
    %16 = llvm.load %15 : !llvm.ptr -> i64
    %17 = llvm.load %6 : !llvm.ptr -> i64
    %18 = arith.cmpi slt, %16, %17 : i64
    cf.cond_br %18, ^bb4, ^bb5
    ^bb4:
      %19 = llvm.load %15 : !llvm.ptr -> i64
      llvm.store %19, %6 : i64, !llvm.ptr
      %20 = llvm.load %6 : !llvm.ptr -> i64
      %21 = llvm.load %6 : !llvm.ptr -> i64
      %22 = arith.divsi %arg0, %21 : i64
      %23 = arith.addi %20, %22 : i64
      %24 = arith.constant 2 : i32
      %26 = arith.extsi %24 : i32 to i64
      %25 = arith.divsi %23, %26 : i64
      llvm.store %25, %15 : i64, !llvm.ptr
      cf.br ^bb3
    ^bb5:
    %27 = llvm.load %6 : !llvm.ptr -> i64
    func.return %27 : i64
  }
  func.func @iroot3(%arg0: i64) -> i64 {
    %28 = arith.constant 0 : i32
    %29 = arith.extsi %28 : i32 to i64
    %30 = llvm.mlir.constant(1 : i64) : i64
    %31 = llvm.alloca %30 x i64 : (i64) -> !llvm.ptr
    llvm.store %29, %31 : i64, !llvm.ptr
    %32 = arith.constant 2 : i32
    %33 = arith.extsi %32 : i32 to i64
    %34 = llvm.mlir.constant(1 : i64) : i64
    %35 = llvm.alloca %34 x i64 : (i64) -> !llvm.ptr
    llvm.store %33, %35 : i64, !llvm.ptr
    cf.br ^bb6
    ^bb6:
    %36 = arith.constant 1 : i1
    cf.cond_br %36, ^bb7, ^bb8
    ^bb7:
      %37 = arith.constant 1 : i32
      %38 = arith.extsi %37 : i32 to i128
      %39 = llvm.mlir.constant(1 : i64) : i64
      %40 = llvm.alloca %39 x i128 : (i64) -> !llvm.ptr
      llvm.store %38, %40 : i128, !llvm.ptr
      %41 = arith.constant 0 : i32
      %42 = arith.constant 3 : i32
      %43 = arith.index_cast %41 : i32 to index
      %44 = arith.index_cast %42 : i32 to index
      %46 = arith.constant 1 : index
      %47 = arith.constant -1 : index
      %48 = arith.cmpi sle, %43, %44 : index
      %45 = arith.select %48, %46, %47 : index
      cf.br ^bb9(%43 : index)
      ^bb9(%49: index):
      %50 = arith.cmpi slt, %49, %44 : index
      %51 = arith.cmpi sgt, %49, %44 : index
      %52 = arith.select %48, %50, %51 : i1
      cf.cond_br %52, ^bb10(%49 : index), ^bb11(%49 : index)
      ^bb10(%53: index):
        %54 = llvm.load %40 : !llvm.ptr -> i128
        %55 = llvm.load %35 : !llvm.ptr -> i64
        %56 = arith.extsi %55 : i64 to i128
        %58 = arith.trunci %54 : i128 to i64
        %59 = arith.trunci %56 : i128 to i64
        %57 = arith.muli %58, %59 : i64
        %60 = arith.extsi %57 : i64 to i128
        llvm.store %60, %40 : i128, !llvm.ptr
        %61 = arith.addi %53, %45 : index
        cf.br ^bb9(%61 : index)
      ^bb11(%62: index):
      %63 = llvm.load %40 : !llvm.ptr -> i128
      %64 = arith.extsi %arg0 : i64 to i128
      %66 = arith.trunci %63 : i128 to i64
      %67 = arith.trunci %64 : i128 to i64
      %65 = arith.cmpi sgt, %66, %67 : i64
      cf.cond_br %65, ^bb12, ^bb13
      ^bb12:
        cf.br ^bb8
      ^bb13:
        cf.br ^bb14
      ^bb14:
      %68 = llvm.load %35 : !llvm.ptr -> i64
      %69 = arith.constant 2 : i32
      %71 = arith.extsi %69 : i32 to i64
      %70 = arith.muli %68, %71 : i64
      llvm.store %70, %35 : i64, !llvm.ptr
      cf.br ^bb6
    ^bb8:
    cf.br ^bb15
    ^bb15:
    %72 = llvm.load %31 : !llvm.ptr -> i64
    %73 = arith.constant 1 : i32
    %75 = arith.extsi %73 : i32 to i64
    %74 = arith.addi %72, %75 : i64
    %76 = llvm.load %35 : !llvm.ptr -> i64
    %77 = arith.cmpi slt, %74, %76 : i64
    cf.cond_br %77, ^bb16, ^bb17
    ^bb16:
      %78 = llvm.load %31 : !llvm.ptr -> i64
      %79 = llvm.load %35 : !llvm.ptr -> i64
      %80 = arith.addi %78, %79 : i64
      %81 = arith.constant 2 : i32
      %83 = arith.extsi %81 : i32 to i64
      %82 = arith.divsi %80, %83 : i64
      %84 = arith.constant 1 : i32
      %85 = arith.extsi %84 : i32 to i128
      %86 = llvm.mlir.constant(1 : i64) : i64
      %87 = llvm.alloca %86 x i128 : (i64) -> !llvm.ptr
      llvm.store %85, %87 : i128, !llvm.ptr
      %88 = arith.constant 0 : i32
      %89 = arith.constant 3 : i32
      %90 = arith.index_cast %88 : i32 to index
      %91 = arith.index_cast %89 : i32 to index
      %93 = arith.constant 1 : index
      %94 = arith.constant -1 : index
      %95 = arith.cmpi sle, %90, %91 : index
      %92 = arith.select %95, %93, %94 : index
      cf.br ^bb18(%90 : index)
      ^bb18(%96: index):
      %97 = arith.cmpi slt, %96, %91 : index
      %98 = arith.cmpi sgt, %96, %91 : index
      %99 = arith.select %95, %97, %98 : i1
      cf.cond_br %99, ^bb19(%96 : index), ^bb20(%96 : index)
      ^bb19(%100: index):
        %101 = llvm.load %87 : !llvm.ptr -> i128
        %102 = arith.extsi %82 : i64 to i128
        %104 = arith.trunci %101 : i128 to i64
        %105 = arith.trunci %102 : i128 to i64
        %103 = arith.muli %104, %105 : i64
        %106 = arith.extsi %103 : i64 to i128
        llvm.store %106, %87 : i128, !llvm.ptr
        %107 = arith.addi %100, %92 : index
        cf.br ^bb18(%107 : index)
      ^bb20(%108: index):
      %109 = llvm.load %87 : !llvm.ptr -> i128
      %110 = arith.extsi %arg0 : i64 to i128
      %112 = arith.trunci %109 : i128 to i64
      %113 = arith.trunci %110 : i128 to i64
      %111 = arith.cmpi sle, %112, %113 : i64
      cf.cond_br %111, ^bb21, ^bb22
      ^bb21:
        llvm.store %82, %31 : i64, !llvm.ptr
        cf.br ^bb23
      ^bb22:
        llvm.store %82, %35 : i64, !llvm.ptr
        cf.br ^bb23
      ^bb23:
      cf.br ^bb15
    ^bb17:
    %114 = llvm.load %31 : !llvm.ptr -> i64
    func.return %114 : i64
  }
  func.func @iroot6(%arg0: i64) -> i64 {
    %115 = arith.constant 0 : i32
    %116 = arith.extsi %115 : i32 to i64
    %117 = llvm.mlir.constant(1 : i64) : i64
    %118 = llvm.alloca %117 x i64 : (i64) -> !llvm.ptr
    llvm.store %116, %118 : i64, !llvm.ptr
    %119 = arith.constant 2 : i32
    %120 = arith.extsi %119 : i32 to i64
    %121 = llvm.mlir.constant(1 : i64) : i64
    %122 = llvm.alloca %121 x i64 : (i64) -> !llvm.ptr
    llvm.store %120, %122 : i64, !llvm.ptr
    cf.br ^bb24
    ^bb24:
    %123 = arith.constant 1 : i1
    cf.cond_br %123, ^bb25, ^bb26
    ^bb25:
      %124 = arith.constant 1 : i32
      %125 = arith.extsi %124 : i32 to i128
      %126 = llvm.mlir.constant(1 : i64) : i64
      %127 = llvm.alloca %126 x i128 : (i64) -> !llvm.ptr
      llvm.store %125, %127 : i128, !llvm.ptr
      %128 = arith.constant 0 : i32
      %129 = arith.constant 6 : i32
      %130 = arith.index_cast %128 : i32 to index
      %131 = arith.index_cast %129 : i32 to index
      %133 = arith.constant 1 : index
      %134 = arith.constant -1 : index
      %135 = arith.cmpi sle, %130, %131 : index
      %132 = arith.select %135, %133, %134 : index
      cf.br ^bb27(%130 : index)
      ^bb27(%136: index):
      %137 = arith.cmpi slt, %136, %131 : index
      %138 = arith.cmpi sgt, %136, %131 : index
      %139 = arith.select %135, %137, %138 : i1
      cf.cond_br %139, ^bb28(%136 : index), ^bb29(%136 : index)
      ^bb28(%140: index):
        %141 = llvm.load %127 : !llvm.ptr -> i128
        %142 = llvm.load %122 : !llvm.ptr -> i64
        %143 = arith.extsi %142 : i64 to i128
        %145 = arith.trunci %141 : i128 to i64
        %146 = arith.trunci %143 : i128 to i64
        %144 = arith.muli %145, %146 : i64
        %147 = arith.extsi %144 : i64 to i128
        llvm.store %147, %127 : i128, !llvm.ptr
        %148 = arith.addi %140, %132 : index
        cf.br ^bb27(%148 : index)
      ^bb29(%149: index):
      %150 = llvm.load %127 : !llvm.ptr -> i128
      %151 = arith.extsi %arg0 : i64 to i128
      %153 = arith.trunci %150 : i128 to i64
      %154 = arith.trunci %151 : i128 to i64
      %152 = arith.cmpi sgt, %153, %154 : i64
      cf.cond_br %152, ^bb30, ^bb31
      ^bb30:
        cf.br ^bb26
      ^bb31:
        cf.br ^bb32
      ^bb32:
      %155 = llvm.load %122 : !llvm.ptr -> i64
      %156 = arith.constant 2 : i32
      %158 = arith.extsi %156 : i32 to i64
      %157 = arith.muli %155, %158 : i64
      llvm.store %157, %122 : i64, !llvm.ptr
      cf.br ^bb24
    ^bb26:
    cf.br ^bb33
    ^bb33:
    %159 = llvm.load %118 : !llvm.ptr -> i64
    %160 = arith.constant 1 : i32
    %162 = arith.extsi %160 : i32 to i64
    %161 = arith.addi %159, %162 : i64
    %163 = llvm.load %122 : !llvm.ptr -> i64
    %164 = arith.cmpi slt, %161, %163 : i64
    cf.cond_br %164, ^bb34, ^bb35
    ^bb34:
      %165 = llvm.load %118 : !llvm.ptr -> i64
      %166 = llvm.load %122 : !llvm.ptr -> i64
      %167 = arith.addi %165, %166 : i64
      %168 = arith.constant 2 : i32
      %170 = arith.extsi %168 : i32 to i64
      %169 = arith.divsi %167, %170 : i64
      %171 = arith.extsi %169 : i64 to i128
      %172 = arith.extsi %169 : i64 to i128
      %174 = arith.trunci %171 : i128 to i64
      %175 = arith.trunci %172 : i128 to i64
      %173 = arith.muli %174, %175 : i64
      %176 = arith.extsi %173 : i64 to i128
      %178 = arith.trunci %176 : i128 to i64
      %179 = arith.trunci %176 : i128 to i64
      %177 = arith.muli %178, %179 : i64
      %181 = arith.trunci %176 : i128 to i64
      %180 = arith.muli %177, %181 : i64
      %182 = arith.extsi %180 : i64 to i128
      %183 = arith.extsi %arg0 : i64 to i128
      %185 = arith.trunci %182 : i128 to i64
      %186 = arith.trunci %183 : i128 to i64
      %184 = arith.cmpi sle, %185, %186 : i64
      cf.cond_br %184, ^bb36, ^bb37
      ^bb36:
        llvm.store %169, %118 : i64, !llvm.ptr
        cf.br ^bb38
      ^bb37:
        llvm.store %169, %122 : i64, !llvm.ptr
        cf.br ^bb38
      ^bb38:
      cf.br ^bb33
    ^bb35:
    %187 = llvm.load %118 : !llvm.ptr -> i64
    func.return %187 : i64
  }
  func.func @squarefree_count(%arg0: i64, %arg1: !llvm.ptr) -> i64 {
    %188 = arith.constant 0 : i32
    %189 = arith.extsi %188 : i32 to i64
    %190 = llvm.mlir.constant(1 : i64) : i64
    %191 = llvm.alloca %190 x i64 : (i64) -> !llvm.ptr
    llvm.store %189, %191 : i64, !llvm.ptr
    %192 = arith.constant 1 : i32
    %193 = arith.extsi %192 : i32 to i64
    %194 = llvm.mlir.constant(1 : i64) : i64
    %195 = llvm.alloca %194 x i64 : (i64) -> !llvm.ptr
    llvm.store %193, %195 : i64, !llvm.ptr
    cf.br ^bb39
    ^bb39:
    %196 = llvm.load %195 : !llvm.ptr -> i64
    %197 = llvm.load %195 : !llvm.ptr -> i64
    %198 = arith.muli %196, %197 : i64
    %199 = arith.cmpi sle, %198, %arg0 : i64
    cf.cond_br %199, ^bb40, ^bb41
    ^bb40:
      %201 = llvm.load %195 : !llvm.ptr -> i64
      %202 = llvm.getelementptr %arg1[%201] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %200 = llvm.load %202 : !llvm.ptr -> i8
      %203 = arith.extsi %200 : i8 to i64
      %204 = arith.constant 0 : i32
      %206 = arith.extsi %204 : i32 to i64
      %205 = arith.cmpi ne, %203, %206 : i64
      cf.cond_br %205, ^bb42, ^bb43
      ^bb42:
        %207 = llvm.load %191 : !llvm.ptr -> i64
        %208 = llvm.load %195 : !llvm.ptr -> i64
        %209 = llvm.load %195 : !llvm.ptr -> i64
        %210 = arith.muli %208, %209 : i64
        %211 = arith.divsi %arg0, %210 : i64
        %212 = arith.muli %203, %211 : i64
        %213 = arith.addi %207, %212 : i64
        llvm.store %213, %191 : i64, !llvm.ptr
        cf.br ^bb44
      ^bb43:
        cf.br ^bb44
      ^bb44:
      %214 = llvm.load %195 : !llvm.ptr -> i64
      %215 = arith.constant 1 : i32
      %217 = arith.extsi %215 : i32 to i64
      %216 = arith.addi %214, %217 : i64
      llvm.store %216, %195 : i64, !llvm.ptr
      cf.br ^bb39
    ^bb41:
    %218 = llvm.load %191 : !llvm.ptr -> i64
    func.return %218 : i64
  }
  func.func @cubefree_count(%arg0: i64, %arg1: !llvm.ptr) -> i64 {
    %219 = arith.constant 0 : i32
    %220 = arith.extsi %219 : i32 to i64
    %221 = llvm.mlir.constant(1 : i64) : i64
    %222 = llvm.alloca %221 x i64 : (i64) -> !llvm.ptr
    llvm.store %220, %222 : i64, !llvm.ptr
    %223 = arith.constant 1 : i32
    %224 = arith.extsi %223 : i32 to i64
    %225 = llvm.mlir.constant(1 : i64) : i64
    %226 = llvm.alloca %225 x i64 : (i64) -> !llvm.ptr
    llvm.store %224, %226 : i64, !llvm.ptr
    cf.br ^bb45
    ^bb45:
    %227 = llvm.load %226 : !llvm.ptr -> i64
    %228 = llvm.load %226 : !llvm.ptr -> i64
    %229 = arith.muli %227, %228 : i64
    %230 = llvm.load %226 : !llvm.ptr -> i64
    %231 = arith.muli %229, %230 : i64
    %232 = arith.cmpi sle, %231, %arg0 : i64
    cf.cond_br %232, ^bb46, ^bb47
    ^bb46:
      %234 = llvm.load %226 : !llvm.ptr -> i64
      %235 = llvm.getelementptr %arg1[%234] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %233 = llvm.load %235 : !llvm.ptr -> i8
      %236 = arith.extsi %233 : i8 to i64
      %237 = arith.constant 0 : i32
      %239 = arith.extsi %237 : i32 to i64
      %238 = arith.cmpi ne, %236, %239 : i64
      cf.cond_br %238, ^bb48, ^bb49
      ^bb48:
        %240 = llvm.load %222 : !llvm.ptr -> i64
        %241 = llvm.load %226 : !llvm.ptr -> i64
        %242 = llvm.load %226 : !llvm.ptr -> i64
        %243 = arith.muli %241, %242 : i64
        %244 = llvm.load %226 : !llvm.ptr -> i64
        %245 = arith.muli %243, %244 : i64
        %246 = arith.divsi %arg0, %245 : i64
        %247 = arith.muli %236, %246 : i64
        %248 = arith.addi %240, %247 : i64
        llvm.store %248, %222 : i64, !llvm.ptr
        cf.br ^bb50
      ^bb49:
        cf.br ^bb50
      ^bb50:
      %249 = llvm.load %226 : !llvm.ptr -> i64
      %250 = arith.constant 1 : i32
      %252 = arith.extsi %250 : i32 to i64
      %251 = arith.addi %249, %252 : i64
      llvm.store %251, %226 : i64, !llvm.ptr
      cf.br ^bb45
    ^bb47:
    %253 = llvm.load %222 : !llvm.ptr -> i64
    func.return %253 : i64
  }
  func.func @main() -> i32 {
    %254 = arith.constant 8999999995705032704 : i32
    %255 = arith.extsi %254 : i32 to i64
    %256 = func.call @iroot6(%255) : (i64) -> i64
    %257 = arith.constant 10 : i32
    %259 = arith.extsi %257 : i32 to i64
    %258 = arith.addi %256, %259 : i64
    %261 = arith.constant 1 : i32
    %263 = arith.extsi %261 : i32 to i64
    %262 = arith.addi %258, %263 : i64
    %264 = arith.constant 1 : i32
    %265 = arith.extsi %264 : i32 to i64
    %260 = func.call @calloc(%262, %265) : (i64, i64) -> !llvm.ptr
    %267 = arith.constant 1 : i32
    %269 = arith.extsi %267 : i32 to i64
    %268 = arith.addi %258, %269 : i64
    %270 = arith.constant 1 : i32
    %271 = arith.extsi %270 : i32 to i64
    %266 = func.call @calloc(%268, %271) : (i64, i64) -> !llvm.ptr
    %273 = arith.constant 5 : i32
    %275 = arith.extsi %273 : i32 to i64
    %274 = arith.divsi %258, %275 : i64
    %276 = arith.constant 10 : i32
    %278 = arith.extsi %276 : i32 to i64
    %277 = arith.addi %274, %278 : i64
    %279 = arith.constant 4 : i32
    %280 = arith.extsi %279 : i32 to i64
    %272 = func.call @calloc(%277, %280) : (i64, i64) -> !llvm.ptr
    %281 = llvm.mlir.zero : !llvm.ptr
    %282 = llvm.icmp "eq" %260, %281 : !llvm.ptr
    %283 = scf.if %282 -> (i1) {
      %284 = arith.constant true
      scf.yield %284 : i1
    } else {
      %285 = llvm.mlir.zero : !llvm.ptr
      %286 = llvm.icmp "eq" %266, %285 : !llvm.ptr
      scf.yield %286 : i1
    }
    %287 = scf.if %283 -> (i1) {
      %288 = arith.constant true
      scf.yield %288 : i1
    } else {
      %289 = llvm.mlir.zero : !llvm.ptr
      %290 = llvm.icmp "eq" %272, %289 : !llvm.ptr
      scf.yield %290 : i1
    }
    cf.cond_br %287, ^bb51, ^bb52
    ^bb51:
      %291 = arith.constant 1 : i32
      func.return %291 : i32
    ^bb52:
      cf.br ^bb53
    ^bb53:
    %292 = arith.constant 1 : i32
    %293 = arith.constant 1 : i32
    %294 = arith.trunci %292 : i32 to i8
    %295 = arith.extsi %293 : i32 to i64
    %296 = llvm.getelementptr %260[%295] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %294, %296 : i8, !llvm.ptr
    %297 = arith.constant 0 : i32
    %298 = arith.extsi %297 : i32 to i64
    %299 = llvm.mlir.constant(1 : i64) : i64
    %300 = llvm.alloca %299 x i64 : (i64) -> !llvm.ptr
    llvm.store %298, %300 : i64, !llvm.ptr
    %301 = arith.constant 2 : i32
    %302 = arith.constant 1 : i32
    %304 = arith.extsi %302 : i32 to i64
    %303 = arith.addi %258, %304 : i64
    %305 = arith.index_cast %301 : i32 to index
    %306 = arith.index_cast %303 : i32 to index
    %308 = arith.constant 1 : index
    %309 = arith.constant -1 : index
    %310 = arith.cmpi sle, %305, %306 : index
    %307 = arith.select %310, %308, %309 : index
    cf.br ^bb54(%305 : index)
    ^bb54(%311: index):
    %312 = arith.cmpi slt, %311, %306 : index
    %313 = arith.cmpi sgt, %311, %306 : index
    %314 = arith.select %310, %312, %313 : i1
    cf.cond_br %314, ^bb55(%311 : index), ^bb56(%311 : index)
    ^bb55(%315: index):
      %317 = arith.index_cast %315 : index to i64
      %318 = llvm.getelementptr %266[%317] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %316 = llvm.load %318 : !llvm.ptr -> i8
      %319 = arith.constant 0 : i32
      %321 = arith.extsi %316 : i8 to i32
      %320 = arith.cmpi eq, %321, %319 : i32
      cf.cond_br %320, ^bb57, ^bb58
      ^bb57:
        %322 = arith.index_cast %315 : index to i32
        %323 = llvm.load %300 : !llvm.ptr -> i64
        %324 = llvm.getelementptr %272[%323] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %322, %324 : i32, !llvm.ptr
        %325 = llvm.load %300 : !llvm.ptr -> i64
        %326 = arith.constant 1 : i32
        %328 = arith.extsi %326 : i32 to i64
        %327 = arith.addi %325, %328 : i64
        llvm.store %327, %300 : i64, !llvm.ptr
        %329 = arith.constant 1 : i32
        %331 = arith.constant 0 : i32
        %330 = arith.subi %331, %329 : i32
        %332 = arith.trunci %330 : i32 to i8
        %333 = arith.index_cast %315 : index to i64
        %334 = llvm.getelementptr %260[%333] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %332, %334 : i8, !llvm.ptr
        cf.br ^bb59
      ^bb58:
        cf.br ^bb59
      ^bb59:
      %335 = arith.constant 0 : i32
      %336 = arith.extsi %335 : i32 to i64
      %337 = llvm.mlir.constant(1 : i64) : i64
      %338 = llvm.alloca %337 x i64 : (i64) -> !llvm.ptr
      llvm.store %336, %338 : i64, !llvm.ptr
      cf.br ^bb60
      ^bb60:
      %339 = llvm.load %338 : !llvm.ptr -> i64
      %340 = llvm.load %300 : !llvm.ptr -> i64
      %341 = arith.cmpi slt, %339, %340 : i64
      cf.cond_br %341, ^bb61, ^bb62
      ^bb61:
        %343 = llvm.load %338 : !llvm.ptr -> i64
        %344 = llvm.getelementptr %272[%343] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %342 = llvm.load %344 : !llvm.ptr -> i32
        %345 = arith.extsi %342 : i32 to i64
        %347 = arith.index_cast %315 : index to i32
        %348 = arith.trunci %345 : i64 to i32
        %346 = arith.muli %347, %348 : i32
        %349 = arith.extsi %346 : i32 to i64
        %350 = arith.cmpi sgt, %349, %258 : i64
        cf.cond_br %350, ^bb63, ^bb64
        ^bb63:
          cf.br ^bb62
        ^bb64:
          cf.br ^bb65
        ^bb65:
        %351 = arith.constant 1 : i32
        %352 = arith.trunci %351 : i32 to i8
        %353 = llvm.getelementptr %266[%349] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %352, %353 : i8, !llvm.ptr
        %355 = arith.index_cast %315 : index to i32
        %356 = arith.trunci %345 : i64 to i32
        %354 = arith.remsi %355, %356 : i32
        %357 = arith.constant 0 : i32
        %358 = arith.cmpi eq, %354, %357 : i32
        cf.cond_br %358, ^bb66, ^bb67
        ^bb66:
          %359 = arith.constant 0 : i32
          %360 = arith.trunci %359 : i32 to i8
          %361 = llvm.getelementptr %260[%349] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %360, %361 : i8, !llvm.ptr
          cf.br ^bb62
        ^bb67:
          cf.br ^bb68
        ^bb68:
        %362 = arith.constant 0 : i32
        %364 = arith.index_cast %315 : index to i64
        %365 = llvm.getelementptr %260[%364] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %363 = llvm.load %365 : !llvm.ptr -> i8
        %366 = arith.extsi %363 : i8 to i64
        %368 = arith.extsi %362 : i32 to i64
        %367 = arith.subi %368, %366 : i64
        %369 = arith.trunci %367 : i64 to i8
        %370 = llvm.getelementptr %260[%349] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %369, %370 : i8, !llvm.ptr
        %371 = llvm.load %338 : !llvm.ptr -> i64
        %372 = arith.constant 1 : i32
        %374 = arith.extsi %372 : i32 to i64
        %373 = arith.addi %371, %374 : i64
        llvm.store %373, %338 : i64, !llvm.ptr
        cf.br ^bb60
      ^bb62:
      %375 = arith.addi %315, %307 : index
      cf.br ^bb54(%375 : index)
    ^bb56(%376: index):
    %377 = func.call @iroot3(%255) : (i64) -> i64
    %379 = arith.constant 1 : i32
    %381 = arith.extsi %379 : i32 to i64
    %380 = arith.addi %377, %381 : i64
    %382 = arith.constant 1 : i32
    %383 = arith.extsi %382 : i32 to i64
    %378 = func.call @calloc(%380, %383) : (i64, i64) -> !llvm.ptr
    %384 = llvm.mlir.zero : !llvm.ptr
    %385 = llvm.icmp "eq" %378, %384 : !llvm.ptr
    cf.cond_br %385, ^bb69, ^bb70
    ^bb69:
      %386 = arith.constant 1 : i32
      func.return %386 : i32
    ^bb70:
      cf.br ^bb71
    ^bb71:
    %387 = arith.constant 0 : i32
    %388 = arith.constant 1 : i32
    %390 = arith.extsi %388 : i32 to i64
    %389 = arith.addi %377, %390 : i64
    %391 = arith.index_cast %387 : i32 to index
    %392 = arith.index_cast %389 : i32 to index
    %394 = arith.constant 1 : index
    %395 = arith.constant -1 : index
    %396 = arith.cmpi sle, %391, %392 : index
    %393 = arith.select %396, %394, %395 : index
    cf.br ^bb72(%391 : index)
    ^bb72(%397: index):
    %398 = arith.cmpi slt, %397, %392 : index
    %399 = arith.cmpi sgt, %397, %392 : index
    %400 = arith.select %396, %398, %399 : i1
    cf.cond_br %400, ^bb73(%397 : index), ^bb74(%397 : index)
    ^bb73(%401: index):
      %402 = arith.constant 1 : i32
      %403 = arith.trunci %402 : i32 to i8
      %404 = arith.index_cast %401 : index to i64
      %405 = llvm.getelementptr %378[%404] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %403, %405 : i8, !llvm.ptr
      %406 = arith.addi %401, %393 : index
      cf.br ^bb72(%406 : index)
    ^bb74(%407: index):
    %408 = arith.constant 0 : i32
    %409 = arith.constant 0 : i32
    %410 = arith.trunci %408 : i32 to i8
    %411 = arith.extsi %409 : i32 to i64
    %412 = llvm.getelementptr %378[%411] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %410, %412 : i8, !llvm.ptr
    %413 = arith.constant 2 : i32
    %414 = arith.extsi %413 : i32 to i64
    %415 = llvm.mlir.constant(1 : i64) : i64
    %416 = llvm.alloca %415 x i64 : (i64) -> !llvm.ptr
    llvm.store %414, %416 : i64, !llvm.ptr
    cf.br ^bb75
    ^bb75:
    %417 = llvm.load %416 : !llvm.ptr -> i64
    %418 = llvm.load %416 : !llvm.ptr -> i64
    %419 = arith.muli %417, %418 : i64
    %420 = arith.cmpi sle, %419, %377 : i64
    cf.cond_br %420, ^bb76, ^bb77
    ^bb76:
      %422 = llvm.load %416 : !llvm.ptr -> i64
      %423 = llvm.getelementptr %378[%422] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %421 = llvm.load %423 : !llvm.ptr -> i8
      %424 = arith.constant 1 : i32
      %426 = arith.extsi %421 : i8 to i32
      %425 = arith.cmpi eq, %426, %424 : i32
      cf.cond_br %425, ^bb78, ^bb79
      ^bb78:
        %427 = llvm.load %416 : !llvm.ptr -> i64
        %428 = llvm.load %416 : !llvm.ptr -> i64
        %429 = arith.muli %427, %428 : i64
        %430 = llvm.mlir.constant(1 : i64) : i64
        %431 = llvm.alloca %430 x i64 : (i64) -> !llvm.ptr
        llvm.store %429, %431 : i64, !llvm.ptr
        cf.br ^bb81
        ^bb81:
        %432 = llvm.load %431 : !llvm.ptr -> i64
        %433 = arith.cmpi sle, %432, %377 : i64
        cf.cond_br %433, ^bb82, ^bb83
        ^bb82:
          %434 = arith.constant 0 : i32
          %435 = llvm.load %431 : !llvm.ptr -> i64
          %436 = arith.trunci %434 : i32 to i8
          %437 = llvm.getelementptr %378[%435] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %436, %437 : i8, !llvm.ptr
          %438 = llvm.load %431 : !llvm.ptr -> i64
          %439 = arith.addi %438, %429 : i64
          llvm.store %439, %431 : i64, !llvm.ptr
          cf.br ^bb81
        ^bb83:
        cf.br ^bb80
      ^bb79:
        cf.br ^bb80
      ^bb80:
      %440 = llvm.load %416 : !llvm.ptr -> i64
      %441 = arith.constant 1 : i32
      %443 = arith.extsi %441 : i32 to i64
      %442 = arith.addi %440, %443 : i64
      llvm.store %442, %416 : i64, !llvm.ptr
      cf.br ^bb75
    ^bb77:
    %444 = arith.constant 0 : i32
    %445 = arith.extsi %444 : i32 to i64
    %446 = llvm.mlir.constant(1 : i64) : i64
    %447 = llvm.alloca %446 x i64 : (i64) -> !llvm.ptr
    llvm.store %445, %447 : i64, !llvm.ptr
    %448 = arith.constant 1 : i32
    %449 = arith.extsi %448 : i32 to i64
    %450 = llvm.mlir.constant(1 : i64) : i64
    %451 = llvm.alloca %450 x i64 : (i64) -> !llvm.ptr
    llvm.store %449, %451 : i64, !llvm.ptr
    cf.br ^bb84
    ^bb84:
    %452 = llvm.load %451 : !llvm.ptr -> i64
    %453 = arith.cmpi sle, %452, %377 : i64
    cf.cond_br %453, ^bb85, ^bb86
    ^bb85:
      %455 = llvm.load %451 : !llvm.ptr -> i64
      %456 = llvm.getelementptr %378[%455] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %454 = llvm.load %456 : !llvm.ptr -> i8
      %457 = arith.constant 1 : i32
      %459 = arith.extsi %454 : i8 to i32
      %458 = arith.cmpi eq, %459, %457 : i32
      cf.cond_br %458, ^bb87, ^bb88
      ^bb87:
        %460 = llvm.load %451 : !llvm.ptr -> i64
        %461 = llvm.load %451 : !llvm.ptr -> i64
        %462 = arith.muli %460, %461 : i64
        %463 = llvm.load %451 : !llvm.ptr -> i64
        %464 = arith.muli %462, %463 : i64
        %465 = llvm.load %447 : !llvm.ptr -> i64
        %467 = arith.divsi %255, %464 : i64
        %466 = func.call @isqrt(%467) : (i64) -> i64
        %468 = arith.addi %465, %466 : i64
        llvm.store %468, %447 : i64, !llvm.ptr
        cf.br ^bb89
      ^bb88:
        cf.br ^bb89
      ^bb89:
      %469 = llvm.load %451 : !llvm.ptr -> i64
      %470 = arith.constant 1 : i32
      %472 = arith.extsi %470 : i32 to i64
      %471 = arith.addi %469, %472 : i64
      llvm.store %471, %451 : i64, !llvm.ptr
      cf.br ^bb84
    ^bb86:
    %473 = func.call @isqrt(%255) : (i64) -> i64
    %474 = func.call @cubefree_count(%473, %260) : (i64, !llvm.ptr) -> i64
    %475 = arith.constant 0 : i32
    %476 = arith.extsi %475 : i32 to i64
    %477 = arith.constant 1 : i32
    %478 = arith.constant 1 : i32
    %480 = arith.extsi %478 : i32 to i64
    %479 = arith.addi %377, %480 : i64
    %481 = arith.index_cast %477 : i32 to index
    %482 = arith.index_cast %479 : i32 to index
    %484 = arith.constant 1 : index
    %485 = arith.constant -1 : index
    %486 = arith.cmpi sle, %481, %482 : index
    %483 = arith.select %486, %484, %485 : index
    cf.br ^bb90(%481, %476 : index, i64)
    ^bb90(%487: index, %488: i64):
    %489 = arith.cmpi slt, %487, %482 : index
    %490 = arith.cmpi sgt, %487, %482 : index
    %491 = arith.select %486, %489, %490 : i1
    cf.cond_br %491, ^bb91(%487, %488 : index, i64), ^bb92(%487, %488 : index, i64)
    ^bb91(%492: index, %493: i64):
      %495 = arith.index_cast %492 : index to i64
      %496 = llvm.getelementptr %378[%495] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %494 = llvm.load %496 : !llvm.ptr -> i8
      %497 = arith.constant 1 : i32
      %499 = arith.extsi %494 : i8 to i32
      %498 = arith.cmpi eq, %499, %497 : i32
      %500 = scf.if %498 -> (i64) {
        %501 = arith.constant 1 : i32
        %503 = arith.extsi %501 : i32 to i64
        %502 = arith.addi %493, %503 : i64
        scf.yield %502 : i64
      } else {
        scf.yield %493 : i64
      }
      %504 = arith.addi %492, %483 : index
      cf.br ^bb90(%504, %500 : index, i64)
    ^bb92(%505: index, %506: i64):
    %507 = func.call @iroot6(%255) : (i64) -> i64
    %509 = arith.constant 1 : i32
    %511 = arith.extsi %509 : i32 to i64
    %510 = arith.addi %507, %511 : i64
    %512 = arith.constant 1 : i32
    %513 = arith.extsi %512 : i32 to i64
    %508 = func.call @calloc(%510, %513) : (i64, i64) -> !llvm.ptr
    %514 = llvm.mlir.zero : !llvm.ptr
    %515 = llvm.icmp "eq" %508, %514 : !llvm.ptr
    cf.cond_br %515, ^bb93, ^bb94
    ^bb93:
      %516 = arith.constant 1 : i32
      func.return %516 : i32
    ^bb94:
      cf.br ^bb95
    ^bb95:
    %517 = arith.constant 1 : i32
    %518 = arith.constant 0 : i32
    %519 = arith.trunci %517 : i32 to i8
    %520 = arith.extsi %518 : i32 to i64
    %521 = llvm.getelementptr %508[%520] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %519, %521 : i8, !llvm.ptr
    %522 = arith.constant 1 : i32
    %523 = arith.constant 1 : i32
    %524 = arith.trunci %522 : i32 to i8
    %525 = arith.extsi %523 : i32 to i64
    %526 = llvm.getelementptr %508[%525] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %524, %526 : i8, !llvm.ptr
    %527 = arith.constant 2 : i32
    %528 = arith.extsi %527 : i32 to i64
    llvm.store %528, %416 : i64, !llvm.ptr
    cf.br ^bb96
    ^bb96:
    %529 = llvm.load %416 : !llvm.ptr -> i64
    %530 = llvm.load %416 : !llvm.ptr -> i64
    %531 = arith.muli %529, %530 : i64
    %532 = arith.cmpi sle, %531, %507 : i64
    cf.cond_br %532, ^bb97, ^bb98
    ^bb97:
      %534 = llvm.load %416 : !llvm.ptr -> i64
      %535 = llvm.getelementptr %508[%534] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %533 = llvm.load %535 : !llvm.ptr -> i8
      %536 = arith.constant 0 : i32
      %538 = arith.extsi %533 : i8 to i32
      %537 = arith.cmpi eq, %538, %536 : i32
      cf.cond_br %537, ^bb99, ^bb100
      ^bb99:
        %539 = llvm.load %416 : !llvm.ptr -> i64
        %540 = llvm.load %416 : !llvm.ptr -> i64
        %541 = arith.muli %539, %540 : i64
        %542 = llvm.mlir.constant(1 : i64) : i64
        %543 = llvm.alloca %542 x i64 : (i64) -> !llvm.ptr
        llvm.store %541, %543 : i64, !llvm.ptr
        cf.br ^bb102
        ^bb102:
        %544 = llvm.load %543 : !llvm.ptr -> i64
        %545 = arith.cmpi sle, %544, %507 : i64
        cf.cond_br %545, ^bb103, ^bb104
        ^bb103:
          %546 = arith.constant 1 : i32
          %547 = llvm.load %543 : !llvm.ptr -> i64
          %548 = arith.trunci %546 : i32 to i8
          %549 = llvm.getelementptr %508[%547] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %548, %549 : i8, !llvm.ptr
          %550 = llvm.load %543 : !llvm.ptr -> i64
          %551 = llvm.load %416 : !llvm.ptr -> i64
          %552 = arith.addi %550, %551 : i64
          llvm.store %552, %543 : i64, !llvm.ptr
          cf.br ^bb102
        ^bb104:
        cf.br ^bb101
      ^bb100:
        cf.br ^bb101
      ^bb101:
      %553 = llvm.load %416 : !llvm.ptr -> i64
      %554 = arith.constant 1 : i32
      %556 = arith.extsi %554 : i32 to i64
      %555 = arith.addi %553, %556 : i64
      llvm.store %555, %416 : i64, !llvm.ptr
      cf.br ^bb96
    ^bb98:
    %557 = arith.constant 0 : i32
    %558 = arith.extsi %557 : i32 to i64
    %559 = llvm.mlir.constant(1 : i64) : i64
    %560 = llvm.alloca %559 x i64 : (i64) -> !llvm.ptr
    llvm.store %558, %560 : i64, !llvm.ptr
    %561 = arith.constant 2 : i32
    %562 = arith.constant 1 : i32
    %564 = arith.extsi %562 : i32 to i64
    %563 = arith.addi %507, %564 : i64
    %565 = arith.index_cast %561 : i32 to index
    %566 = arith.index_cast %563 : i32 to index
    %568 = arith.constant 1 : index
    %569 = arith.constant -1 : index
    %570 = arith.cmpi sle, %565, %566 : index
    %567 = arith.select %570, %568, %569 : index
    cf.br ^bb105(%565 : index)
    ^bb105(%571: index):
    %572 = arith.cmpi slt, %571, %566 : index
    %573 = arith.cmpi sgt, %571, %566 : index
    %574 = arith.select %570, %572, %573 : i1
    cf.cond_br %574, ^bb106(%571 : index), ^bb107(%571 : index)
    ^bb106(%575: index):
      %577 = arith.index_cast %575 : index to i64
      %578 = llvm.getelementptr %508[%577] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %576 = llvm.load %578 : !llvm.ptr -> i8
      %579 = arith.constant 0 : i32
      %581 = arith.extsi %576 : i8 to i32
      %580 = arith.cmpi eq, %581, %579 : i32
      cf.cond_br %580, ^bb108, ^bb109
      ^bb108:
        %582 = llvm.load %560 : !llvm.ptr -> i64
        %583 = arith.constant 1 : i32
        %585 = arith.extsi %583 : i32 to i64
        %584 = arith.addi %582, %585 : i64
        llvm.store %584, %560 : i64, !llvm.ptr
        cf.br ^bb110
      ^bb109:
        cf.br ^bb110
      ^bb110:
      %586 = arith.addi %575, %567 : index
      cf.br ^bb105(%586 : index)
    ^bb107(%587: index):
    %588 = llvm.load %447 : !llvm.ptr -> i64
    %589 = arith.subi %588, %474 : i64
    %590 = arith.subi %589, %506 : i64
    %591 = llvm.load %560 : !llvm.ptr -> i64
    %592 = arith.subi %590, %591 : i64
    %593 = arith.constant 1 : i32
    %595 = arith.extsi %593 : i32 to i64
    %594 = arith.addi %592, %595 : i64
    %596 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %597 = llvm.call @printf(%596, %594) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    func.call @free(%508) : (!llvm.ptr) -> ()
    func.call @free(%378) : (!llvm.ptr) -> ()
    func.call @free(%272) : (!llvm.ptr) -> ()
    func.call @free(%266) : (!llvm.ptr) -> ()
    func.call @free(%260) : (!llvm.ptr) -> ()
    %603 = arith.constant 0 : i32
    func.return %603 : i32
  }
}