← All problems
Problem 450
Hypocycloid lattice points T(10^6): Mobius axis sums + Gaussian powers.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^4)O(n log log n)
Space complexity O(n^2)O(n)
Approach Flow solution Mobius sieve
Verdict Suboptimal
Flow source
# Project Euler 450
# Hypocycloid lattice points T(10^6): Mobius axis sums + Gaussian powers.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
function malloc(n: i64) -> ptr<void>
function sqrt(x: f64) -> f64
function pow(base: f64, exp: f64) -> f64
}
const N: i64 = 1000000
let mut g_mu: ptr<i32> = null
let mut g_pref_mui: ptr<i64> = null
let mut g_pref_mui_odd: ptr<i64> = null
let mut g_f_cache: ptr<i64> = null
let mut g_f_computed: ptr<i8> = null
let mut g_triple_a: ptr<i64> = null
let mut g_triple_b: ptr<i64> = null
let mut g_triple_c: ptr<i64> = null
let mut g_triple_count: i64 = 0
function igcd(a0: i64, b0: i64) -> i64 {
let mut a: i64 = a0
let mut b: i64 = b0
if a < 0 { a = 0 - a }
if b < 0 { b = 0 - b }
while b != 0 {
let t: i64 = a % b
a = b
b = t
}
return a
}
function llabs(x: i64) -> i64 {
if x < 0 { return 0 - x }
return x
}
function ipow(b0: i64, e0: i32) -> i64 {
let mut r: i64 = 1
let mut b: i64 = b0
let mut e: i32 = e0
while e > 0 {
if (e & 1) == 1 { r = r * b }
b = b * b
e = e >> 1
}
return r
}
function mobius_sieve(n: i64) -> void {
g_mu = calloc(n + 1, 4) as ptr<i32>
let comp: ptr<i8> = calloc(n + 1, 1) as ptr<i8>
let primes: ptr<i32> = calloc(n + 1, 4) as ptr<i32>
let mut prime_count: i64 = 0
g_mu[1] = 1
let mut i: i64 = 2
while i <= n {
if comp[i] == 0 {
primes[prime_count] = i as i32
prime_count = prime_count + 1
g_mu[i] = -1
}
let mut pi: i64 = 0
while pi < prime_count {
let p: i64 = primes[pi] as i64
let ip: i64 = i * p
if ip > n { break }
comp[ip] = 1
if i % p == 0 {
g_mu[ip] = 0
break
}
g_mu[ip] = 0 - g_mu[i]
pi = pi + 1
}
i = i + 1
}
free(comp)
free(primes)
}
function build_prefix(n: i64) -> void {
g_pref_mui = calloc(n + 1, 8) as ptr<i64>
g_pref_mui_odd = calloc(n + 1, 8) as ptr<i64>
let mut s1: i64 = 0
let mut so1: i64 = 0
let mut i: i64 = 1
while i <= n {
s1 = s1 + (g_mu[i] as i64) * i
if (i & 1) == 1 { so1 = so1 + (g_mu[i] as i64) * i }
g_pref_mui[i] = s1
g_pref_mui_odd[i] = so1
i = i + 1
}
}
function G0(n: i64) -> i64 {
if n <= 2 { return 0 }
let m: i64 = (n - 1) / 2
return m * (n - m - 1)
}
function GA(n: i64) -> i64 {
return (n + 1) * G0(n) / 2
}
function GB(n: i64) -> i64 {
if n <= 2 { return 0 }
let m: i64 = (n - 1) / 2
let term: i64 = m * (m + 1)
return term * (3 * n - 4 * m - 2) / 6
}
function HB(n: i64) -> i64 {
let M: i64 = (n - 2) / 2
if M <= 0 { return 0 }
let m0: i64 = (M - 1) / 2
if m0 < 0 { return 0 }
let s_y: i64 = m0 * (m0 + 1) / 2
let s_y2: i64 = m0 * (m0 + 1) * (2 * m0 + 1) / 6
return M * (m0 + 1) * (m0 + 1) - 4 * s_y2 - 2 * s_y
}
function KB(n: i64) -> i64 {
let mut res: i64 = 0
let M1: i64 = (n - 2) / 4
if M1 > 0 {
let m1: i64 = (M1 - 1) / 2
if m1 >= 0 {
let s_y: i64 = m1 * (m1 + 1) / 2
let s_y2: i64 = m1 * (m1 + 1) * (2 * m1 + 1) / 6
let sum_4y1: i64 = (m1 + 1) * (2 * m1 + 1)
res = res + M1 * sum_4y1 - 8 * s_y2 - 2 * s_y
}
}
let M3: i64 = (n - 6) / 4
if M3 > 0 {
let m3: i64 = (M3 - 1) / 2
if m3 >= 0 {
let s_y: i64 = m3 * (m3 + 1) / 2
let s_y2: i64 = m3 * (m3 + 1) * (2 * m3 + 1) / 6
let sum_4y3: i64 = (m3 + 1) * (2 * m3 + 3)
res = res + M3 * sum_4y3 - 8 * s_y2 - 6 * s_y
}
}
return res
}
function mobius_sum_weighted(m: i64, pref: ptr<i64>, base_type: i32) -> i64 {
let mut res: i64 = 0
let mut l: i64 = 1
while l <= m {
let q: i64 = m / l
let r: i64 = m / q
let mut bv: i64 = 0
if base_type == 0 { bv = GA(q) }
else { if base_type == 1 { bv = GB(q) }
else { if base_type == 2 { bv = HB(q) }
else { bv = KB(q) } } }
res = res + (pref[r] - pref[l - 1]) * bv
l = r + 1
}
return res
}
function f_cached(m: i64) -> i64 {
if g_f_computed[m] != 0 { return g_f_cache[m] }
let SA: i64 = mobius_sum_weighted(m, g_pref_mui, 0)
let SB: i64 = mobius_sum_weighted(m, g_pref_mui, 1)
let P2: i64 = mobius_sum_weighted(m, g_pref_mui_odd, 2)
let P4: i64 = mobius_sum_weighted(m, g_pref_mui_odd, 3)
let val: i64 = 4 * SA + 2 * SB + 2 * P2 - 4 * P4
g_f_cache[m] = val
g_f_computed[m] = 1
return val
}
function axis_total(n: i64) -> i64 {
let mut tot: i64 = 0
let mut l: i64 = 1
while l <= n {
let q: i64 = n / l
let r: i64 = n / q
let sum_d: i64 = (l + r) * (r - l + 1) / 2
tot = tot + sum_d * f_cached(q)
l = r + 1
}
return tot
}
function primitive_triples(cmax: i64) -> void {
g_triple_a = malloc(50000 * 8) as ptr<i64>
g_triple_b = malloc(50000 * 8) as ptr<i64>
g_triple_c = malloc(50000 * 8) as ptr<i64>
g_triple_count = 0
let m_limit: i64 = (sqrt((cmax * 2) as f64) as i64) + 3
let mut m: i64 = 2
while m <= m_limit {
let mm: i64 = m * m
let mut nn: i64 = 1
while nn < m {
if ((m - nn) & 1) != 0 {
if igcd(m, nn) == 1 {
let c: i64 = mm + nn * nn
if c > cmax { break }
g_triple_a[g_triple_count] = mm - nn * nn
g_triple_b[g_triple_count] = 2 * m * nn
g_triple_c[g_triple_count] = c
g_triple_count = g_triple_count + 1
}
}
nn = nn + 1
}
m = m + 1
}
}
function gauss_pow(re0: i64, im0: i64, exp0: i32, out: ptr<i64>) -> void {
out[0] = 1
out[1] = 0
let mut br: i64 = re0
let mut bi: i64 = im0
let mut e: i32 = exp0
while e > 0 {
if (e & 1) == 1 {
let nr: i64 = out[0] * br - out[1] * bi
let ni: i64 = out[0] * bi + out[1] * br
out[0] = nr
out[1] = ni
}
let nbr: i64 = br * br - bi * bi
let nbi: i64 = br * bi + bi * br
br = nbr
bi = nbi
e = e >> 1
}
}
function non_axis_total(n: i64) -> i64 {
let mut total: i64 = 0
let mut maxA: i32 = 1
while ipow(3, maxA + 1) <= n { maxA = maxA + 1 }
let Ap: i32 = 2
while Ap <= maxA {
let mut cmax: i64 = (pow((n as f64), 1.0 / (Ap as f64)) as i64) + 2
while ipow(cmax, Ap) > n { cmax = cmax - 1 }
primitive_triples(cmax)
let Bp: i32 = 1
while Bp < Ap {
if igcd((Ap as i64), (Bp as i64)) == 1 {
let mut ti: i64 = 0
while ti < g_triple_count {
let ta: i64 = g_triple_a[ti]
let tb: i64 = g_triple_b[ti]
let tc: i64 = g_triple_c[ti]
let den: i64 = ipow(tc, Ap)
if den * (Ap as i64 + Bp as i64) > n { ti = ti + 1; continue }
# variants: up to 16 pairs (u, v)
let variants: array<i64, 32> = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let mut nv: i32 = 0
# pairs[0] = (a, b), pairs[1] = (b, a)
let pairs: array<i64, 4> = [ta, tb, tb, ta]
let mut pi: i32 = 0
while pi < 2 {
let pa: i64 = pairs[pi * 2]
let pb: i64 = pairs[pi * 2 + 1]
let mut sui: i32 = 0
while sui < 2 {
let su: i64 = if sui == 0 { 1 } else { -1 }
let mut svi: i32 = 0
while svi < 2 {
let sv: i64 = if svi == 0 { 1 } else { -1 }
let u: i64 = su * pa
let v: i64 = sv * pb
# Check for duplicate
let mut dup: i32 = 0
let mut k: i32 = 0
while k < nv {
if variants[k * 2] == u && variants[k * 2 + 1] == v {
dup = 1
break
}
k = k + 1
}
if dup == 0 {
variants[nv * 2] = u
variants[nv * 2 + 1] = v
nv = nv + 1
}
svi = svi + 1
}
sui = sui + 1
}
pi = pi + 1
}
let mut vi: i32 = 0
while vi < nv {
let re_val: i64 = variants[vi * 2]
let im_val: i64 = variants[vi * 2 + 1]
let uA_out: array<i64, 2> = [0, 0]
let uB_out: array<i64, 2> = [0, 0]
gauss_pow(re_val, im_val, Ap, uA_out as ptr<i64>)
gauss_pow(re_val, im_val, Bp, uB_out as ptr<i64>)
let uA: i64 = uA_out[0]
let vA: i64 = uA_out[1]
let uB: i64 = uB_out[0]
let vB: i64 = uB_out[1]
let scale: i64 = ipow(tc, Ap - Bp)
let numX: i64 = (Ap as i64) * uB * scale + (Bp as i64) * uA
let numY: i64 = (Ap as i64) * vB * scale - (Bp as i64) * vA
let g: i64 = igcd(den, igcd(llabs(numX), llabs(numY)))
let d0: i64 = den / g
if d0 * (Ap as i64 + Bp as i64) > n { vi = vi + 1; continue }
let x0: i64 = numX / g
let y0: i64 = numY / g
let kmax: i64 = n / (d0 * (Ap as i64 + Bp as i64))
total = total + (llabs(x0) + llabs(y0)) * (kmax * (kmax + 1) / 2)
vi = vi + 1
}
ti = ti + 1
}
}
Bp = Bp + 1
}
free(g_triple_a)
free(g_triple_b)
free(g_triple_c)
g_triple_a = null
g_triple_b = null
g_triple_c = null
Ap = Ap + 1
}
return total
}
function main() -> i32 {
mobius_sieve(N)
build_prefix(N)
g_f_cache = calloc(N + 1, 8) as ptr<i64>
g_f_computed = calloc(N + 1, 1) as ptr<i8>
let axis: i64 = axis_total(N)
let non_axis: i64 = non_axis_total(N)
let ans: i64 = axis + non_axis
printf("%lld\n", ans)
free(g_mu)
free(g_pref_mui)
free(g_pref_mui_odd)
free(g_f_cache)
free(g_f_computed)
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 igcd_i64_i64(int64_t a0, int64_t b0);
int64_t llabs_i64(int64_t x);
int64_t ipow_i64_i32(int64_t b0, int32_t e0);
void mobius_sieve_i64(int64_t n);
void build_prefix_i64(int64_t n);
int64_t G0_i64(int64_t n);
int64_t GA_i64(int64_t n);
int64_t GB_i64(int64_t n);
int64_t HB_i64(int64_t n);
int64_t KB_i64(int64_t n);
int64_t mobius_sum_weighted_i64_ptr_i64_i32(int64_t m, int64_t* pref, int32_t base_type);
int64_t f_cached_i64(int64_t m);
int64_t axis_total_i64(int64_t n);
void primitive_triples_i64(int64_t cmax);
void gauss_pow_i64_i64_i32_ptr_i64(int64_t re0, int64_t im0, int32_t exp0, int64_t* out);
int64_t non_axis_total_i64(int64_t n);
int32_t main(void);
static const int64_t N = 1000000;
/* Module statics */
static int32_t* g_mu = NULL;
static int64_t* g_pref_mui = NULL;
static int64_t* g_pref_mui_odd = NULL;
static int64_t* g_f_cache = NULL;
static int8_t* g_f_computed = NULL;
static int64_t* g_triple_a = NULL;
static int64_t* g_triple_b = NULL;
static int64_t* g_triple_c = NULL;
static int64_t g_triple_count = 0;
int64_t igcd_i64_i64(int64_t a0, int64_t b0) {
int64_t a = a0;
int64_t b = b0;
if (a < 0) {
a = (0 - a);
}
if (b < 0) {
b = (0 - b);
}
while (b != 0) {
int64_t t = FLOW_CHECKED_MOD((a), (b));
a = b;
b = t;
}
return a;
}
int64_t llabs_i64(int64_t x) {
if (x < 0) {
return (0 - x);
}
return x;
}
int64_t ipow_i64_i32(int64_t b0, int32_t e0) {
int64_t r = 1;
int64_t b = b0;
int32_t e = e0;
while (e > 0) {
if ((e & 1) == 1) {
r = (r * b);
}
b = (b * b);
e = FLOW_CHECKED_SHR((e), (1));
}
return r;
}
void mobius_sieve_i64(int64_t n) {
g_mu = ((int32_t*)(calloc((n + 1), 4)));
int8_t* comp = (int8_t*)(((int8_t*)(calloc((n + 1), 1))));
int32_t* primes = (int32_t*)(((int32_t*)(calloc((n + 1), 4))));
int64_t prime_count = 0;
g_mu[1] = 1;
int64_t i = 2;
while (i <= n) {
if (comp[i] == 0) {
primes[prime_count] = ((int32_t)(i));
prime_count = (prime_count + 1);
g_mu[i] = (-1);
}
int64_t pi = 0;
while (pi < prime_count) {
int64_t p = ((int64_t)(primes[pi]));
int64_t ip = (i * p);
if (ip > n) {
break;
}
comp[ip] = 1;
if (FLOW_CHECKED_MOD((i), (p)) == 0) {
g_mu[ip] = 0;
break;
}
g_mu[ip] = (0 - g_mu[i]);
pi = (pi + 1);
}
i = (i + 1);
}
free(comp);
free(primes);
}
void build_prefix_i64(int64_t n) {
g_pref_mui = ((int64_t*)(calloc((n + 1), 8)));
g_pref_mui_odd = ((int64_t*)(calloc((n + 1), 8)));
int64_t s1 = 0;
int64_t so1 = 0;
int64_t i = 1;
while (i <= n) {
s1 = (s1 + (((int64_t)(g_mu[i])) * i));
if ((i & 1) == 1) {
so1 = (so1 + (((int64_t)(g_mu[i])) * i));
}
g_pref_mui[i] = s1;
g_pref_mui_odd[i] = so1;
i = (i + 1);
}
}
int64_t G0_i64(int64_t n) {
if (n <= 2) {
return 0;
}
int64_t m = FLOW_CHECKED_DIV(((n - 1)), (2));
return (m * ((n - m) - 1));
}
int64_t GA_i64(int64_t n) {
return FLOW_CHECKED_DIV((((n + 1) * G0_i64(n))), (2));
}
int64_t GB_i64(int64_t n) {
if (n <= 2) {
return 0;
}
int64_t m = FLOW_CHECKED_DIV(((n - 1)), (2));
int64_t term = (m * (m + 1));
return FLOW_CHECKED_DIV(((term * (((3 * n) - (4 * m)) - 2))), (6));
}
int64_t HB_i64(int64_t n) {
int64_t M = FLOW_CHECKED_DIV(((n - 2)), (2));
if (M <= 0) {
return 0;
}
int64_t m0 = FLOW_CHECKED_DIV(((M - 1)), (2));
if (m0 < 0) {
return 0;
}
int64_t s_y = FLOW_CHECKED_DIV(((m0 * (m0 + 1))), (2));
int64_t s_y2 = FLOW_CHECKED_DIV((((m0 * (m0 + 1)) * ((2 * m0) + 1))), (6));
return ((((M * (m0 + 1)) * (m0 + 1)) - (4 * s_y2)) - (2 * s_y));
}
int64_t KB_i64(int64_t n) {
int64_t res = 0;
int64_t M1 = FLOW_CHECKED_DIV(((n - 2)), (4));
if (M1 > 0) {
int64_t m1 = FLOW_CHECKED_DIV(((M1 - 1)), (2));
if (m1 >= 0) {
int64_t s_y = FLOW_CHECKED_DIV(((m1 * (m1 + 1))), (2));
int64_t s_y2 = FLOW_CHECKED_DIV((((m1 * (m1 + 1)) * ((2 * m1) + 1))), (6));
int64_t sum_4y1 = ((m1 + 1) * ((2 * m1) + 1));
res = (((res + (M1 * sum_4y1)) - (8 * s_y2)) - (2 * s_y));
}
}
int64_t M3 = FLOW_CHECKED_DIV(((n - 6)), (4));
if (M3 > 0) {
int64_t m3 = FLOW_CHECKED_DIV(((M3 - 1)), (2));
if (m3 >= 0) {
int64_t s_y = FLOW_CHECKED_DIV(((m3 * (m3 + 1))), (2));
int64_t s_y2 = FLOW_CHECKED_DIV((((m3 * (m3 + 1)) * ((2 * m3) + 1))), (6));
int64_t sum_4y3 = ((m3 + 1) * ((2 * m3) + 3));
res = (((res + (M3 * sum_4y3)) - (8 * s_y2)) - (6 * s_y));
}
}
return res;
}
int64_t mobius_sum_weighted_i64_ptr_i64_i32(int64_t m, int64_t* pref, int32_t base_type) {
int64_t res = 0;
int64_t l = 1;
while (l <= m) {
int64_t q = FLOW_CHECKED_DIV((m), (l));
int64_t r = FLOW_CHECKED_DIV((m), (q));
int64_t bv = 0;
if (base_type == 0) {
bv = GA_i64(q);
} else {
if (base_type == 1) {
bv = GB_i64(q);
} else {
if (base_type == 2) {
bv = HB_i64(q);
} else {
bv = KB_i64(q);
}
}
}
res = (res + ((pref[r] - pref[(l - 1)]) * bv));
l = (r + 1);
}
return res;
}
int64_t f_cached_i64(int64_t m) {
if (g_f_computed[m] != 0) {
return g_f_cache[m];
}
int64_t SA = mobius_sum_weighted_i64_ptr_i64_i32(m, g_pref_mui, 0);
int64_t SB = mobius_sum_weighted_i64_ptr_i64_i32(m, g_pref_mui, 1);
int64_t P2 = mobius_sum_weighted_i64_ptr_i64_i32(m, g_pref_mui_odd, 2);
int64_t P4 = mobius_sum_weighted_i64_ptr_i64_i32(m, g_pref_mui_odd, 3);
int64_t val = ((((4 * SA) + (2 * SB)) + (2 * P2)) - (4 * P4));
g_f_cache[m] = val;
g_f_computed[m] = 1;
return val;
}
int64_t axis_total_i64(int64_t n) {
int64_t tot = 0;
int64_t l = 1;
while (l <= n) {
int64_t q = FLOW_CHECKED_DIV((n), (l));
int64_t r = FLOW_CHECKED_DIV((n), (q));
int64_t sum_d = FLOW_CHECKED_DIV((((l + r) * ((r - l) + 1))), (2));
tot = (tot + (sum_d * f_cached_i64(q)));
l = (r + 1);
}
return tot;
}
void primitive_triples_i64(int64_t cmax) {
g_triple_a = ((int64_t*)(malloc((50000 * 8))));
g_triple_b = ((int64_t*)(malloc((50000 * 8))));
g_triple_c = ((int64_t*)(malloc((50000 * 8))));
g_triple_count = 0;
int64_t m_limit = (((int64_t)(sqrt(((double)((cmax * 2)))))) + 3);
int64_t m = 2;
while (m <= m_limit) {
int64_t mm = (m * m);
int64_t nn = 1;
while (nn < m) {
if (((m - nn) & 1) != 0) {
if (igcd_i64_i64(m, nn) == 1) {
int64_t c = (mm + (nn * nn));
if (c > cmax) {
break;
}
g_triple_a[g_triple_count] = (mm - (nn * nn));
g_triple_b[g_triple_count] = ((2 * m) * nn);
g_triple_c[g_triple_count] = c;
g_triple_count = (g_triple_count + 1);
}
}
nn = (nn + 1);
}
m = (m + 1);
}
}
void gauss_pow_i64_i64_i32_ptr_i64(int64_t re0, int64_t im0, int32_t exp0, int64_t* out) {
out[0] = 1;
out[1] = 0;
int64_t br = re0;
int64_t bi = im0;
int32_t e = exp0;
while (e > 0) {
if ((e & 1) == 1) {
int64_t nr = ((out[0] * br) - (out[1] * bi));
int64_t ni = ((out[0] * bi) + (out[1] * br));
out[0] = nr;
out[1] = ni;
}
int64_t nbr = ((br * br) - (bi * bi));
int64_t nbi = ((br * bi) + (bi * br));
br = nbr;
bi = nbi;
e = FLOW_CHECKED_SHR((e), (1));
}
}
int64_t non_axis_total_i64(int64_t n) {
int64_t total = 0;
int32_t maxA = 1;
while (ipow_i64_i32(3, (maxA + 1)) <= n) {
maxA = (maxA + 1);
}
int32_t Ap = 2;
while (Ap <= maxA) {
int64_t cmax = (((int64_t)(pow(((double)(n)), (1.0 / ((double)(Ap)))))) + 2);
while (ipow_i64_i32(cmax, Ap) > n) {
cmax = (cmax - 1);
}
primitive_triples_i64(cmax);
int32_t Bp = 1;
while (Bp < Ap) {
if (igcd_i64_i64(((int64_t)(Ap)), ((int64_t)(Bp))) == 1) {
int64_t ti = 0;
while (ti < g_triple_count) {
int64_t ta = g_triple_a[ti];
int64_t tb = g_triple_b[ti];
int64_t tc = g_triple_c[ti];
int64_t den = ipow_i64_i32(tc, Ap);
if ((den * (((int64_t)(Ap)) + ((int64_t)(Bp)))) > n) {
ti = (ti + 1);
continue;
}
int64_t variants[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int32_t nv = 0;
int64_t pairs[4] = { ta, tb, tb, ta };
int32_t pi = 0;
while (pi < 2) {
int64_t pa = (((unsigned)((pi * 2)) < 4) ? pairs[(pi * 2)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)((pi * 2)), 4), flow_fault_handler("array index out of bounds"), pairs[0]));
int64_t pb = (((unsigned)(((pi * 2) + 1)) < 4) ? pairs[((pi * 2) + 1)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((pi * 2) + 1)), 4), flow_fault_handler("array index out of bounds"), pairs[0]));
int32_t sui = 0;
while (sui < 2) {
int64_t su = ((sui == 0) ? (1) : ((-1)));
int32_t svi = 0;
while (svi < 2) {
int64_t sv = ((svi == 0) ? (1) : ((-1)));
int64_t u = (su * pa);
int64_t v = (sv * pb);
int32_t dup = 0;
int32_t k = 0;
while (k < nv) {
if (((((unsigned)((k * 2)) < 32) ? variants[(k * 2)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)((k * 2)), 32), flow_fault_handler("array index out of bounds"), variants[0])) == u && (((unsigned)(((k * 2) + 1)) < 32) ? variants[((k * 2) + 1)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((k * 2) + 1)), 32), flow_fault_handler("array index out of bounds"), variants[0])) == v)) {
dup = 1;
break;
}
k = (k + 1);
}
if (dup == 0) {
variants[(nv * 2)] = u;
variants[((nv * 2) + 1)] = v;
nv = (nv + 1);
}
svi = (svi + 1);
}
sui = (sui + 1);
}
pi = (pi + 1);
}
int32_t vi = 0;
while (vi < nv) {
int64_t re_val = (((unsigned)((vi * 2)) < 32) ? variants[(vi * 2)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)((vi * 2)), 32), flow_fault_handler("array index out of bounds"), variants[0]));
int64_t im_val = (((unsigned)(((vi * 2) + 1)) < 32) ? variants[((vi * 2) + 1)] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(((vi * 2) + 1)), 32), flow_fault_handler("array index out of bounds"), variants[0]));
int64_t uA_out[2] = { 0, 0 };
int64_t uB_out[2] = { 0, 0 };
gauss_pow_i64_i64_i32_ptr_i64(re_val, im_val, Ap, ((int64_t*)(uA_out)));
gauss_pow_i64_i64_i32_ptr_i64(re_val, im_val, Bp, ((int64_t*)(uB_out)));
int64_t uA = (((unsigned)(0) < 2) ? uA_out[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), uA_out[0]));
int64_t vA = (((unsigned)(1) < 2) ? uA_out[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 2), flow_fault_handler("array index out of bounds"), uA_out[0]));
int64_t uB = (((unsigned)(0) < 2) ? uB_out[0] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(0), 2), flow_fault_handler("array index out of bounds"), uB_out[0]));
int64_t vB = (((unsigned)(1) < 2) ? uB_out[1] : (fprintf(stderr, "array index %d out of bounds (size %d)\n", (int)(1), 2), flow_fault_handler("array index out of bounds"), uB_out[0]));
int64_t scale = ipow_i64_i32(tc, (Ap - Bp));
int64_t numX = (((((int64_t)(Ap)) * uB) * scale) + (((int64_t)(Bp)) * uA));
int64_t numY = (((((int64_t)(Ap)) * vB) * scale) - (((int64_t)(Bp)) * vA));
int64_t g = igcd_i64_i64(den, igcd_i64_i64(llabs_i64(numX), llabs_i64(numY)));
int64_t d0 = FLOW_CHECKED_DIV((den), (g));
if ((d0 * (((int64_t)(Ap)) + ((int64_t)(Bp)))) > n) {
vi = (vi + 1);
continue;
}
int64_t x0 = FLOW_CHECKED_DIV((numX), (g));
int64_t y0 = FLOW_CHECKED_DIV((numY), (g));
int64_t kmax = FLOW_CHECKED_DIV((n), ((d0 * (((int64_t)(Ap)) + ((int64_t)(Bp))))));
total = (total + ((llabs_i64(x0) + llabs_i64(y0)) * FLOW_CHECKED_DIV(((kmax * (kmax + 1))), (2))));
vi = (vi + 1);
}
ti = (ti + 1);
}
}
Bp = (Bp + 1);
}
free(g_triple_a);
free(g_triple_b);
free(g_triple_c);
g_triple_a = NULL;
g_triple_b = NULL;
g_triple_c = NULL;
Ap = (Ap + 1);
}
return total;
}
int32_t main(void) {
mobius_sieve_i64(N);
build_prefix_i64(N);
g_f_cache = ((int64_t*)(calloc((N + 1), 8)));
g_f_computed = ((int8_t*)(calloc((N + 1), 1)));
int64_t axis = axis_total_i64(N);
int64_t non_axis = non_axis_total_i64(N);
int64_t ans = (axis + non_axis);
printf("%lld\n", ans);
free(g_mu);
free(g_pref_mui);
free(g_pref_mui_odd);
free(g_f_cache);
free(g_f_computed);
return 0;
}
Generated MLIR
module {
llvm.func @printf(!llvm.ptr, ...) -> i32
llvm.mlir.global internal constant @str_0("%lld\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
func.func private @calloc(i64, i64) -> !llvm.ptr
func.func private @free(!llvm.ptr) -> ()
func.func private @malloc(i64) -> !llvm.ptr
func.func private @sqrt(f64) -> f64
func.func private @pow(f64, f64) -> f64
// Constant: N
llvm.mlir.global internal constant @N(1000000 : i64) : i64
// Module static: g_mu
llvm.mlir.global internal @g_mu() {addr_space = 0 : i32} : !llvm.ptr {
%0 = llvm.mlir.zero : !llvm.ptr
llvm.return %0 : !llvm.ptr
}
// Module static: g_pref_mui
llvm.mlir.global internal @g_pref_mui() {addr_space = 0 : i32} : !llvm.ptr {
%1 = llvm.mlir.zero : !llvm.ptr
llvm.return %1 : !llvm.ptr
}
// Module static: g_pref_mui_odd
llvm.mlir.global internal @g_pref_mui_odd() {addr_space = 0 : i32} : !llvm.ptr {
%2 = llvm.mlir.zero : !llvm.ptr
llvm.return %2 : !llvm.ptr
}
// Module static: g_f_cache
llvm.mlir.global internal @g_f_cache() {addr_space = 0 : i32} : !llvm.ptr {
%3 = llvm.mlir.zero : !llvm.ptr
llvm.return %3 : !llvm.ptr
}
// Module static: g_f_computed
llvm.mlir.global internal @g_f_computed() {addr_space = 0 : i32} : !llvm.ptr {
%4 = llvm.mlir.zero : !llvm.ptr
llvm.return %4 : !llvm.ptr
}
// Module static: g_triple_a
llvm.mlir.global internal @g_triple_a() {addr_space = 0 : i32} : !llvm.ptr {
%5 = llvm.mlir.zero : !llvm.ptr
llvm.return %5 : !llvm.ptr
}
// Module static: g_triple_b
llvm.mlir.global internal @g_triple_b() {addr_space = 0 : i32} : !llvm.ptr {
%6 = llvm.mlir.zero : !llvm.ptr
llvm.return %6 : !llvm.ptr
}
// Module static: g_triple_c
llvm.mlir.global internal @g_triple_c() {addr_space = 0 : i32} : !llvm.ptr {
%7 = llvm.mlir.zero : !llvm.ptr
llvm.return %7 : !llvm.ptr
}
// Module static: g_triple_count
llvm.mlir.global internal @g_triple_count(0 : i64) : i64
func.func @igcd(%arg0: i64, %arg1: i64) -> i64 {
%8 = llvm.mlir.constant(1 : i64) : i64
%9 = llvm.alloca %8 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %9 : i64, !llvm.ptr
%10 = llvm.mlir.constant(1 : i64) : i64
%11 = llvm.alloca %10 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %11 : i64, !llvm.ptr
%12 = llvm.load %9 : !llvm.ptr -> i64
%13 = arith.constant 0 : i32
%15 = arith.extsi %13 : i32 to i64
%14 = arith.cmpi slt, %12, %15 : i64
cf.cond_br %14, ^bb0, ^bb1
^bb0:
%16 = arith.constant 0 : i32
%17 = llvm.load %9 : !llvm.ptr -> i64
%19 = arith.extsi %16 : i32 to i64
%18 = arith.subi %19, %17 : i64
llvm.store %18, %9 : i64, !llvm.ptr
cf.br ^bb2
^bb1:
cf.br ^bb2
^bb2:
%20 = llvm.load %11 : !llvm.ptr -> i64
%21 = arith.constant 0 : i32
%23 = arith.extsi %21 : i32 to i64
%22 = arith.cmpi slt, %20, %23 : i64
cf.cond_br %22, ^bb3, ^bb4
^bb3:
%24 = arith.constant 0 : i32
%25 = llvm.load %11 : !llvm.ptr -> i64
%27 = arith.extsi %24 : i32 to i64
%26 = arith.subi %27, %25 : i64
llvm.store %26, %11 : i64, !llvm.ptr
cf.br ^bb5
^bb4:
cf.br ^bb5
^bb5:
cf.br ^bb6
^bb6:
%28 = llvm.load %11 : !llvm.ptr -> i64
%29 = arith.constant 0 : i32
%31 = arith.extsi %29 : i32 to i64
%30 = arith.cmpi ne, %28, %31 : i64
cf.cond_br %30, ^bb7, ^bb8
^bb7:
%32 = llvm.load %9 : !llvm.ptr -> i64
%33 = llvm.load %11 : !llvm.ptr -> i64
%34 = arith.remsi %32, %33 : i64
%35 = llvm.load %11 : !llvm.ptr -> i64
llvm.store %35, %9 : i64, !llvm.ptr
llvm.store %34, %11 : i64, !llvm.ptr
cf.br ^bb6
^bb8:
%36 = llvm.load %9 : !llvm.ptr -> i64
func.return %36 : i64
}
func.func @llabs(%arg0: i64) -> i64 {
%37 = arith.constant 0 : i32
%39 = arith.extsi %37 : i32 to i64
%38 = arith.cmpi slt, %arg0, %39 : i64
cf.cond_br %38, ^bb9, ^bb10
^bb9:
%40 = arith.constant 0 : i32
%42 = arith.extsi %40 : i32 to i64
%41 = arith.subi %42, %arg0 : i64
func.return %41 : i64
^bb10:
cf.br ^bb11
^bb11:
func.return %arg0 : i64
}
func.func @ipow(%arg0: i64, %arg1: i32) -> i64 {
%43 = arith.constant 1 : i32
%44 = arith.extsi %43 : i32 to i64
%45 = llvm.mlir.constant(1 : i64) : i64
%46 = llvm.alloca %45 x i64 : (i64) -> !llvm.ptr
llvm.store %44, %46 : i64, !llvm.ptr
%47 = llvm.mlir.constant(1 : i64) : i64
%48 = llvm.alloca %47 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %48 : i64, !llvm.ptr
%49 = llvm.mlir.constant(1 : i64) : i64
%50 = llvm.alloca %49 x i32 : (i64) -> !llvm.ptr
llvm.store %arg1, %50 : i32, !llvm.ptr
cf.br ^bb12
^bb12:
%51 = llvm.load %50 : !llvm.ptr -> i32
%52 = arith.constant 0 : i32
%53 = arith.cmpi sgt, %51, %52 : i32
cf.cond_br %53, ^bb13, ^bb14
^bb13:
%54 = llvm.load %50 : !llvm.ptr -> i32
%55 = arith.constant 1 : i32
%56 = arith.andi %54, %55 : i32
%57 = arith.constant 1 : i32
%58 = arith.cmpi eq, %56, %57 : i32
cf.cond_br %58, ^bb15, ^bb16
^bb15:
%59 = llvm.load %46 : !llvm.ptr -> i64
%60 = llvm.load %48 : !llvm.ptr -> i64
%61 = arith.muli %59, %60 : i64
llvm.store %61, %46 : i64, !llvm.ptr
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%62 = llvm.load %48 : !llvm.ptr -> i64
%63 = llvm.load %48 : !llvm.ptr -> i64
%64 = arith.muli %62, %63 : i64
llvm.store %64, %48 : i64, !llvm.ptr
%65 = llvm.load %50 : !llvm.ptr -> i32
%66 = arith.constant 1 : i32
%67 = arith.shrsi %65, %66 : i32
llvm.store %67, %50 : i32, !llvm.ptr
cf.br ^bb12
^bb14:
%68 = llvm.load %46 : !llvm.ptr -> i64
func.return %68 : i64
}
func.func @mobius_sieve(%arg0: i64) -> () {
%70 = arith.constant 1 : i32
%72 = arith.extsi %70 : i32 to i64
%71 = arith.addi %arg0, %72 : i64
%73 = arith.constant 4 : i32
%74 = arith.extsi %73 : i32 to i64
%69 = func.call @calloc(%71, %74) : (i64, i64) -> !llvm.ptr
%75 = llvm.mlir.addressof @g_mu : !llvm.ptr
llvm.store %69, %75 : !llvm.ptr, !llvm.ptr
%77 = arith.constant 1 : i32
%79 = arith.extsi %77 : i32 to i64
%78 = arith.addi %arg0, %79 : i64
%80 = arith.constant 1 : i32
%81 = arith.extsi %80 : i32 to i64
%76 = func.call @calloc(%78, %81) : (i64, i64) -> !llvm.ptr
%83 = arith.constant 1 : i32
%85 = arith.extsi %83 : i32 to i64
%84 = arith.addi %arg0, %85 : i64
%86 = arith.constant 4 : i32
%87 = arith.extsi %86 : i32 to i64
%82 = func.call @calloc(%84, %87) : (i64, i64) -> !llvm.ptr
%88 = arith.constant 0 : i32
%89 = arith.extsi %88 : i32 to i64
%90 = llvm.mlir.constant(1 : i64) : i64
%91 = llvm.alloca %90 x i64 : (i64) -> !llvm.ptr
llvm.store %89, %91 : i64, !llvm.ptr
%92 = arith.constant 1 : i32
%93 = llvm.mlir.addressof @g_mu : !llvm.ptr
%94 = llvm.load %93 : !llvm.ptr -> !llvm.ptr
%95 = arith.constant 1 : i32
%96 = arith.extsi %95 : i32 to i64
%97 = llvm.getelementptr %94[%96] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %92, %97 : i32, !llvm.ptr
%98 = arith.constant 2 : i32
%99 = arith.extsi %98 : i32 to i64
%100 = llvm.mlir.constant(1 : i64) : i64
%101 = llvm.alloca %100 x i64 : (i64) -> !llvm.ptr
llvm.store %99, %101 : i64, !llvm.ptr
cf.br ^bb18
^bb18:
%102 = llvm.load %101 : !llvm.ptr -> i64
%103 = arith.cmpi sle, %102, %arg0 : i64
cf.cond_br %103, ^bb19, ^bb20
^bb19:
%105 = llvm.load %101 : !llvm.ptr -> i64
%106 = llvm.getelementptr %76[%105] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%104 = llvm.load %106 : !llvm.ptr -> i8
%107 = arith.constant 0 : i32
%109 = arith.extsi %104 : i8 to i32
%108 = arith.cmpi eq, %109, %107 : i32
cf.cond_br %108, ^bb21, ^bb22
^bb21:
%110 = llvm.load %101 : !llvm.ptr -> i64
%111 = arith.trunci %110 : i64 to i32
%112 = llvm.load %91 : !llvm.ptr -> i64
%113 = llvm.getelementptr %82[%112] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %111, %113 : i32, !llvm.ptr
%114 = llvm.load %91 : !llvm.ptr -> i64
%115 = arith.constant 1 : i32
%117 = arith.extsi %115 : i32 to i64
%116 = arith.addi %114, %117 : i64
llvm.store %116, %91 : i64, !llvm.ptr
%118 = arith.constant 1 : i32
%120 = arith.constant 0 : i32
%119 = arith.subi %120, %118 : i32
%121 = llvm.mlir.addressof @g_mu : !llvm.ptr
%122 = llvm.load %121 : !llvm.ptr -> !llvm.ptr
%123 = llvm.load %101 : !llvm.ptr -> i64
%124 = llvm.getelementptr %122[%123] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %119, %124 : i32, !llvm.ptr
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
%125 = arith.constant 0 : i32
%126 = arith.extsi %125 : i32 to i64
%127 = llvm.mlir.constant(1 : i64) : i64
%128 = llvm.alloca %127 x i64 : (i64) -> !llvm.ptr
llvm.store %126, %128 : i64, !llvm.ptr
cf.br ^bb24
^bb24:
%129 = llvm.load %128 : !llvm.ptr -> i64
%130 = llvm.load %91 : !llvm.ptr -> i64
%131 = arith.cmpi slt, %129, %130 : i64
cf.cond_br %131, ^bb25, ^bb26
^bb25:
%133 = llvm.load %128 : !llvm.ptr -> i64
%134 = llvm.getelementptr %82[%133] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%132 = llvm.load %134 : !llvm.ptr -> i32
%135 = arith.extsi %132 : i32 to i64
%136 = llvm.load %101 : !llvm.ptr -> i64
%137 = arith.muli %136, %135 : i64
%138 = arith.cmpi sgt, %137, %arg0 : i64
cf.cond_br %138, ^bb27, ^bb28
^bb27:
cf.br ^bb26
^bb28:
cf.br ^bb29
^bb29:
%139 = arith.constant 1 : i32
%140 = arith.trunci %139 : i32 to i8
%141 = llvm.getelementptr %76[%137] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %140, %141 : i8, !llvm.ptr
%142 = llvm.load %101 : !llvm.ptr -> i64
%143 = arith.remsi %142, %135 : i64
%144 = arith.constant 0 : i32
%146 = arith.extsi %144 : i32 to i64
%145 = arith.cmpi eq, %143, %146 : i64
cf.cond_br %145, ^bb30, ^bb31
^bb30:
%147 = arith.constant 0 : i32
%148 = llvm.mlir.addressof @g_mu : !llvm.ptr
%149 = llvm.load %148 : !llvm.ptr -> !llvm.ptr
%150 = llvm.getelementptr %149[%137] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %147, %150 : i32, !llvm.ptr
cf.br ^bb26
^bb31:
cf.br ^bb32
^bb32:
%151 = arith.constant 0 : i32
%153 = llvm.mlir.addressof @g_mu : !llvm.ptr
%154 = llvm.load %153 : !llvm.ptr -> !llvm.ptr
%155 = llvm.load %101 : !llvm.ptr -> i64
%156 = llvm.getelementptr %154[%155] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%152 = llvm.load %156 : !llvm.ptr -> i32
%157 = arith.subi %151, %152 : i32
%158 = llvm.mlir.addressof @g_mu : !llvm.ptr
%159 = llvm.load %158 : !llvm.ptr -> !llvm.ptr
%160 = llvm.getelementptr %159[%137] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %157, %160 : i32, !llvm.ptr
%161 = llvm.load %128 : !llvm.ptr -> i64
%162 = arith.constant 1 : i32
%164 = arith.extsi %162 : i32 to i64
%163 = arith.addi %161, %164 : i64
llvm.store %163, %128 : i64, !llvm.ptr
cf.br ^bb24
^bb26:
%165 = llvm.load %101 : !llvm.ptr -> i64
%166 = arith.constant 1 : i32
%168 = arith.extsi %166 : i32 to i64
%167 = arith.addi %165, %168 : i64
llvm.store %167, %101 : i64, !llvm.ptr
cf.br ^bb18
^bb20:
func.call @free(%76) : (!llvm.ptr) -> ()
func.call @free(%82) : (!llvm.ptr) -> ()
func.return
}
func.func @build_prefix(%arg0: i64) -> () {
%172 = arith.constant 1 : i32
%174 = arith.extsi %172 : i32 to i64
%173 = arith.addi %arg0, %174 : i64
%175 = arith.constant 8 : i32
%176 = arith.extsi %175 : i32 to i64
%171 = func.call @calloc(%173, %176) : (i64, i64) -> !llvm.ptr
%177 = llvm.mlir.addressof @g_pref_mui : !llvm.ptr
llvm.store %171, %177 : !llvm.ptr, !llvm.ptr
%179 = arith.constant 1 : i32
%181 = arith.extsi %179 : i32 to i64
%180 = arith.addi %arg0, %181 : i64
%182 = arith.constant 8 : i32
%183 = arith.extsi %182 : i32 to i64
%178 = func.call @calloc(%180, %183) : (i64, i64) -> !llvm.ptr
%184 = llvm.mlir.addressof @g_pref_mui_odd : !llvm.ptr
llvm.store %178, %184 : !llvm.ptr, !llvm.ptr
%185 = arith.constant 0 : i32
%186 = arith.extsi %185 : i32 to i64
%187 = llvm.mlir.constant(1 : i64) : i64
%188 = llvm.alloca %187 x i64 : (i64) -> !llvm.ptr
llvm.store %186, %188 : i64, !llvm.ptr
%189 = arith.constant 0 : i32
%190 = arith.extsi %189 : i32 to i64
%191 = llvm.mlir.constant(1 : i64) : i64
%192 = llvm.alloca %191 x i64 : (i64) -> !llvm.ptr
llvm.store %190, %192 : i64, !llvm.ptr
%193 = arith.constant 1 : i32
%194 = arith.extsi %193 : i32 to i64
%195 = llvm.mlir.constant(1 : i64) : i64
%196 = llvm.alloca %195 x i64 : (i64) -> !llvm.ptr
llvm.store %194, %196 : i64, !llvm.ptr
cf.br ^bb33
^bb33:
%197 = llvm.load %196 : !llvm.ptr -> i64
%198 = arith.cmpi sle, %197, %arg0 : i64
cf.cond_br %198, ^bb34, ^bb35
^bb34:
%199 = llvm.load %188 : !llvm.ptr -> i64
%201 = llvm.mlir.addressof @g_mu : !llvm.ptr
%202 = llvm.load %201 : !llvm.ptr -> !llvm.ptr
%203 = llvm.load %196 : !llvm.ptr -> i64
%204 = llvm.getelementptr %202[%203] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%200 = llvm.load %204 : !llvm.ptr -> i32
%205 = arith.extsi %200 : i32 to i64
%206 = llvm.load %196 : !llvm.ptr -> i64
%207 = arith.muli %205, %206 : i64
%208 = arith.addi %199, %207 : i64
llvm.store %208, %188 : i64, !llvm.ptr
%209 = llvm.load %196 : !llvm.ptr -> i64
%210 = arith.constant 1 : i32
%212 = arith.extsi %210 : i32 to i64
%211 = arith.andi %209, %212 : i64
%213 = arith.constant 1 : i32
%215 = arith.extsi %213 : i32 to i64
%214 = arith.cmpi eq, %211, %215 : i64
cf.cond_br %214, ^bb36, ^bb37
^bb36:
%216 = llvm.load %192 : !llvm.ptr -> i64
%218 = llvm.mlir.addressof @g_mu : !llvm.ptr
%219 = llvm.load %218 : !llvm.ptr -> !llvm.ptr
%220 = llvm.load %196 : !llvm.ptr -> i64
%221 = llvm.getelementptr %219[%220] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%217 = llvm.load %221 : !llvm.ptr -> i32
%222 = arith.extsi %217 : i32 to i64
%223 = llvm.load %196 : !llvm.ptr -> i64
%224 = arith.muli %222, %223 : i64
%225 = arith.addi %216, %224 : i64
llvm.store %225, %192 : i64, !llvm.ptr
cf.br ^bb38
^bb37:
cf.br ^bb38
^bb38:
%226 = llvm.load %188 : !llvm.ptr -> i64
%227 = llvm.mlir.addressof @g_pref_mui : !llvm.ptr
%228 = llvm.load %227 : !llvm.ptr -> !llvm.ptr
%229 = llvm.load %196 : !llvm.ptr -> i64
%230 = llvm.getelementptr %228[%229] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %226, %230 : i64, !llvm.ptr
%231 = llvm.load %192 : !llvm.ptr -> i64
%232 = llvm.mlir.addressof @g_pref_mui_odd : !llvm.ptr
%233 = llvm.load %232 : !llvm.ptr -> !llvm.ptr
%234 = llvm.load %196 : !llvm.ptr -> i64
%235 = llvm.getelementptr %233[%234] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %231, %235 : i64, !llvm.ptr
%236 = llvm.load %196 : !llvm.ptr -> i64
%237 = arith.constant 1 : i32
%239 = arith.extsi %237 : i32 to i64
%238 = arith.addi %236, %239 : i64
llvm.store %238, %196 : i64, !llvm.ptr
cf.br ^bb33
^bb35:
func.return
}
func.func @G0(%arg0: i64) -> i64 {
%240 = arith.constant 2 : i32
%242 = arith.extsi %240 : i32 to i64
%241 = arith.cmpi sle, %arg0, %242 : i64
cf.cond_br %241, ^bb39, ^bb40
^bb39:
%243 = arith.constant 0 : i32
%244 = arith.extsi %243 : i32 to i64
func.return %244 : i64
^bb40:
cf.br ^bb41
^bb41:
%245 = arith.constant 1 : i32
%247 = arith.extsi %245 : i32 to i64
%246 = arith.subi %arg0, %247 : i64
%248 = arith.constant 2 : i32
%250 = arith.extsi %248 : i32 to i64
%249 = arith.divsi %246, %250 : i64
%251 = arith.subi %arg0, %249 : i64
%252 = arith.constant 1 : i32
%254 = arith.extsi %252 : i32 to i64
%253 = arith.subi %251, %254 : i64
%255 = arith.muli %249, %253 : i64
func.return %255 : i64
}
func.func @GA(%arg0: i64) -> i64 {
%256 = arith.constant 1 : i32
%258 = arith.extsi %256 : i32 to i64
%257 = arith.addi %arg0, %258 : i64
%259 = func.call @G0(%arg0) : (i64) -> i64
%260 = arith.muli %257, %259 : i64
%261 = arith.constant 2 : i32
%263 = arith.extsi %261 : i32 to i64
%262 = arith.divsi %260, %263 : i64
func.return %262 : i64
}
func.func @GB(%arg0: i64) -> i64 {
%264 = arith.constant 2 : i32
%266 = arith.extsi %264 : i32 to i64
%265 = arith.cmpi sle, %arg0, %266 : i64
cf.cond_br %265, ^bb42, ^bb43
^bb42:
%267 = arith.constant 0 : i32
%268 = arith.extsi %267 : i32 to i64
func.return %268 : i64
^bb43:
cf.br ^bb44
^bb44:
%269 = arith.constant 1 : i32
%271 = arith.extsi %269 : i32 to i64
%270 = arith.subi %arg0, %271 : i64
%272 = arith.constant 2 : i32
%274 = arith.extsi %272 : i32 to i64
%273 = arith.divsi %270, %274 : i64
%275 = arith.constant 1 : i32
%277 = arith.extsi %275 : i32 to i64
%276 = arith.addi %273, %277 : i64
%278 = arith.muli %273, %276 : i64
%279 = arith.constant 3 : i32
%281 = arith.extsi %279 : i32 to i64
%280 = arith.muli %281, %arg0 : i64
%282 = arith.constant 4 : i32
%284 = arith.extsi %282 : i32 to i64
%283 = arith.muli %284, %273 : i64
%285 = arith.subi %280, %283 : i64
%286 = arith.constant 2 : i32
%288 = arith.extsi %286 : i32 to i64
%287 = arith.subi %285, %288 : i64
%289 = arith.muli %278, %287 : i64
%290 = arith.constant 6 : i32
%292 = arith.extsi %290 : i32 to i64
%291 = arith.divsi %289, %292 : i64
func.return %291 : i64
}
func.func @HB(%arg0: i64) -> i64 {
%293 = arith.constant 2 : i32
%295 = arith.extsi %293 : i32 to i64
%294 = arith.subi %arg0, %295 : i64
%296 = arith.constant 2 : i32
%298 = arith.extsi %296 : i32 to i64
%297 = arith.divsi %294, %298 : i64
%299 = arith.constant 0 : i32
%301 = arith.extsi %299 : i32 to i64
%300 = arith.cmpi sle, %297, %301 : i64
cf.cond_br %300, ^bb45, ^bb46
^bb45:
%302 = arith.constant 0 : i32
%303 = arith.extsi %302 : i32 to i64
func.return %303 : i64
^bb46:
cf.br ^bb47
^bb47:
%304 = arith.constant 1 : i32
%306 = arith.extsi %304 : i32 to i64
%305 = arith.subi %297, %306 : i64
%307 = arith.constant 2 : i32
%309 = arith.extsi %307 : i32 to i64
%308 = arith.divsi %305, %309 : i64
%310 = arith.constant 0 : i32
%312 = arith.extsi %310 : i32 to i64
%311 = arith.cmpi slt, %308, %312 : i64
cf.cond_br %311, ^bb48, ^bb49
^bb48:
%313 = arith.constant 0 : i32
%314 = arith.extsi %313 : i32 to i64
func.return %314 : i64
^bb49:
cf.br ^bb50
^bb50:
%315 = arith.constant 1 : i32
%317 = arith.extsi %315 : i32 to i64
%316 = arith.addi %308, %317 : i64
%318 = arith.muli %308, %316 : i64
%319 = arith.constant 2 : i32
%321 = arith.extsi %319 : i32 to i64
%320 = arith.divsi %318, %321 : i64
%322 = arith.constant 1 : i32
%324 = arith.extsi %322 : i32 to i64
%323 = arith.addi %308, %324 : i64
%325 = arith.muli %308, %323 : i64
%326 = arith.constant 2 : i32
%328 = arith.extsi %326 : i32 to i64
%327 = arith.muli %328, %308 : i64
%329 = arith.constant 1 : i32
%331 = arith.extsi %329 : i32 to i64
%330 = arith.addi %327, %331 : i64
%332 = arith.muli %325, %330 : i64
%333 = arith.constant 6 : i32
%335 = arith.extsi %333 : i32 to i64
%334 = arith.divsi %332, %335 : i64
%336 = arith.constant 1 : i32
%338 = arith.extsi %336 : i32 to i64
%337 = arith.addi %308, %338 : i64
%339 = arith.muli %297, %337 : i64
%340 = arith.constant 1 : i32
%342 = arith.extsi %340 : i32 to i64
%341 = arith.addi %308, %342 : i64
%343 = arith.muli %339, %341 : i64
%344 = arith.constant 4 : i32
%346 = arith.extsi %344 : i32 to i64
%345 = arith.muli %346, %334 : i64
%347 = arith.subi %343, %345 : i64
%348 = arith.constant 2 : i32
%350 = arith.extsi %348 : i32 to i64
%349 = arith.muli %350, %320 : i64
%351 = arith.subi %347, %349 : i64
func.return %351 : i64
}
func.func @KB(%arg0: i64) -> i64 {
%352 = arith.constant 0 : i32
%353 = arith.extsi %352 : i32 to i64
%354 = llvm.mlir.constant(1 : i64) : i64
%355 = llvm.alloca %354 x i64 : (i64) -> !llvm.ptr
llvm.store %353, %355 : i64, !llvm.ptr
%356 = arith.constant 2 : i32
%358 = arith.extsi %356 : i32 to i64
%357 = arith.subi %arg0, %358 : i64
%359 = arith.constant 4 : i32
%361 = arith.extsi %359 : i32 to i64
%360 = arith.divsi %357, %361 : i64
%362 = arith.constant 0 : i32
%364 = arith.extsi %362 : i32 to i64
%363 = arith.cmpi sgt, %360, %364 : i64
cf.cond_br %363, ^bb51, ^bb52
^bb51:
%365 = arith.constant 1 : i32
%367 = arith.extsi %365 : i32 to i64
%366 = arith.subi %360, %367 : i64
%368 = arith.constant 2 : i32
%370 = arith.extsi %368 : i32 to i64
%369 = arith.divsi %366, %370 : i64
%371 = arith.constant 0 : i32
%373 = arith.extsi %371 : i32 to i64
%372 = arith.cmpi sge, %369, %373 : i64
cf.cond_br %372, ^bb54, ^bb55
^bb54:
%374 = arith.constant 1 : i32
%376 = arith.extsi %374 : i32 to i64
%375 = arith.addi %369, %376 : i64
%377 = arith.muli %369, %375 : i64
%378 = arith.constant 2 : i32
%380 = arith.extsi %378 : i32 to i64
%379 = arith.divsi %377, %380 : i64
%381 = arith.constant 1 : i32
%383 = arith.extsi %381 : i32 to i64
%382 = arith.addi %369, %383 : i64
%384 = arith.muli %369, %382 : i64
%385 = arith.constant 2 : i32
%387 = arith.extsi %385 : i32 to i64
%386 = arith.muli %387, %369 : i64
%388 = arith.constant 1 : i32
%390 = arith.extsi %388 : i32 to i64
%389 = arith.addi %386, %390 : i64
%391 = arith.muli %384, %389 : i64
%392 = arith.constant 6 : i32
%394 = arith.extsi %392 : i32 to i64
%393 = arith.divsi %391, %394 : i64
%395 = arith.constant 1 : i32
%397 = arith.extsi %395 : i32 to i64
%396 = arith.addi %369, %397 : i64
%398 = arith.constant 2 : i32
%400 = arith.extsi %398 : i32 to i64
%399 = arith.muli %400, %369 : i64
%401 = arith.constant 1 : i32
%403 = arith.extsi %401 : i32 to i64
%402 = arith.addi %399, %403 : i64
%404 = arith.muli %396, %402 : i64
%405 = llvm.load %355 : !llvm.ptr -> i64
%406 = arith.muli %360, %404 : i64
%407 = arith.addi %405, %406 : i64
%408 = arith.constant 8 : i32
%410 = arith.extsi %408 : i32 to i64
%409 = arith.muli %410, %393 : i64
%411 = arith.subi %407, %409 : i64
%412 = arith.constant 2 : i32
%414 = arith.extsi %412 : i32 to i64
%413 = arith.muli %414, %379 : i64
%415 = arith.subi %411, %413 : i64
llvm.store %415, %355 : i64, !llvm.ptr
cf.br ^bb56
^bb55:
cf.br ^bb56
^bb56:
cf.br ^bb53
^bb52:
cf.br ^bb53
^bb53:
%416 = arith.constant 6 : i32
%418 = arith.extsi %416 : i32 to i64
%417 = arith.subi %arg0, %418 : i64
%419 = arith.constant 4 : i32
%421 = arith.extsi %419 : i32 to i64
%420 = arith.divsi %417, %421 : i64
%422 = arith.constant 0 : i32
%424 = arith.extsi %422 : i32 to i64
%423 = arith.cmpi sgt, %420, %424 : i64
cf.cond_br %423, ^bb57, ^bb58
^bb57:
%425 = arith.constant 1 : i32
%427 = arith.extsi %425 : i32 to i64
%426 = arith.subi %420, %427 : i64
%428 = arith.constant 2 : i32
%430 = arith.extsi %428 : i32 to i64
%429 = arith.divsi %426, %430 : i64
%431 = arith.constant 0 : i32
%433 = arith.extsi %431 : i32 to i64
%432 = arith.cmpi sge, %429, %433 : i64
cf.cond_br %432, ^bb60, ^bb61
^bb60:
%434 = arith.constant 1 : i32
%436 = arith.extsi %434 : i32 to i64
%435 = arith.addi %429, %436 : i64
%437 = arith.muli %429, %435 : i64
%438 = arith.constant 2 : i32
%440 = arith.extsi %438 : i32 to i64
%439 = arith.divsi %437, %440 : i64
%441 = arith.constant 1 : i32
%443 = arith.extsi %441 : i32 to i64
%442 = arith.addi %429, %443 : i64
%444 = arith.muli %429, %442 : i64
%445 = arith.constant 2 : i32
%447 = arith.extsi %445 : i32 to i64
%446 = arith.muli %447, %429 : i64
%448 = arith.constant 1 : i32
%450 = arith.extsi %448 : i32 to i64
%449 = arith.addi %446, %450 : i64
%451 = arith.muli %444, %449 : i64
%452 = arith.constant 6 : i32
%454 = arith.extsi %452 : i32 to i64
%453 = arith.divsi %451, %454 : i64
%455 = arith.constant 1 : i32
%457 = arith.extsi %455 : i32 to i64
%456 = arith.addi %429, %457 : i64
%458 = arith.constant 2 : i32
%460 = arith.extsi %458 : i32 to i64
%459 = arith.muli %460, %429 : i64
%461 = arith.constant 3 : i32
%463 = arith.extsi %461 : i32 to i64
%462 = arith.addi %459, %463 : i64
%464 = arith.muli %456, %462 : i64
%465 = llvm.load %355 : !llvm.ptr -> i64
%466 = arith.muli %420, %464 : i64
%467 = arith.addi %465, %466 : i64
%468 = arith.constant 8 : i32
%470 = arith.extsi %468 : i32 to i64
%469 = arith.muli %470, %453 : i64
%471 = arith.subi %467, %469 : i64
%472 = arith.constant 6 : i32
%474 = arith.extsi %472 : i32 to i64
%473 = arith.muli %474, %439 : i64
%475 = arith.subi %471, %473 : i64
llvm.store %475, %355 : i64, !llvm.ptr
cf.br ^bb62
^bb61:
cf.br ^bb62
^bb62:
cf.br ^bb59
^bb58:
cf.br ^bb59
^bb59:
%476 = llvm.load %355 : !llvm.ptr -> i64
func.return %476 : i64
}
func.func @mobius_sum_weighted(%arg0: i64, %arg1: !llvm.ptr, %arg2: i32) -> i64 {
%477 = arith.constant 0 : i32
%478 = arith.extsi %477 : i32 to i64
%479 = llvm.mlir.constant(1 : i64) : i64
%480 = llvm.alloca %479 x i64 : (i64) -> !llvm.ptr
llvm.store %478, %480 : i64, !llvm.ptr
%481 = arith.constant 1 : i32
%482 = arith.extsi %481 : i32 to i64
%483 = llvm.mlir.constant(1 : i64) : i64
%484 = llvm.alloca %483 x i64 : (i64) -> !llvm.ptr
llvm.store %482, %484 : i64, !llvm.ptr
cf.br ^bb63
^bb63:
%485 = llvm.load %484 : !llvm.ptr -> i64
%486 = arith.cmpi sle, %485, %arg0 : i64
cf.cond_br %486, ^bb64, ^bb65
^bb64:
%487 = llvm.load %484 : !llvm.ptr -> i64
%488 = arith.divsi %arg0, %487 : i64
%489 = arith.divsi %arg0, %488 : i64
%490 = arith.constant 0 : i32
%491 = arith.extsi %490 : i32 to i64
%492 = llvm.mlir.constant(1 : i64) : i64
%493 = llvm.alloca %492 x i64 : (i64) -> !llvm.ptr
llvm.store %491, %493 : i64, !llvm.ptr
%494 = arith.constant 0 : i32
%495 = arith.cmpi eq, %arg2, %494 : i32
cf.cond_br %495, ^bb66, ^bb67
^bb66:
%496 = func.call @GA(%488) : (i64) -> i64
llvm.store %496, %493 : i64, !llvm.ptr
cf.br ^bb68
^bb67:
%497 = arith.constant 1 : i32
%498 = arith.cmpi eq, %arg2, %497 : i32
cf.cond_br %498, ^bb69, ^bb70
^bb69:
%499 = func.call @GB(%488) : (i64) -> i64
llvm.store %499, %493 : i64, !llvm.ptr
cf.br ^bb71
^bb70:
%500 = arith.constant 2 : i32
%501 = arith.cmpi eq, %arg2, %500 : i32
cf.cond_br %501, ^bb72, ^bb73
^bb72:
%502 = func.call @HB(%488) : (i64) -> i64
llvm.store %502, %493 : i64, !llvm.ptr
cf.br ^bb74
^bb73:
%503 = func.call @KB(%488) : (i64) -> i64
llvm.store %503, %493 : i64, !llvm.ptr
cf.br ^bb74
^bb74:
cf.br ^bb71
^bb71:
cf.br ^bb68
^bb68:
%504 = llvm.load %480 : !llvm.ptr -> i64
%506 = llvm.getelementptr %arg1[%489] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%505 = llvm.load %506 : !llvm.ptr -> i64
%508 = llvm.load %484 : !llvm.ptr -> i64
%509 = arith.constant 1 : i32
%511 = arith.extsi %509 : i32 to i64
%510 = arith.subi %508, %511 : i64
%512 = llvm.getelementptr %arg1[%510] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%507 = llvm.load %512 : !llvm.ptr -> i64
%513 = arith.subi %505, %507 : i64
%514 = llvm.load %493 : !llvm.ptr -> i64
%515 = arith.muli %513, %514 : i64
%516 = arith.addi %504, %515 : i64
llvm.store %516, %480 : i64, !llvm.ptr
%517 = arith.constant 1 : i32
%519 = arith.extsi %517 : i32 to i64
%518 = arith.addi %489, %519 : i64
llvm.store %518, %484 : i64, !llvm.ptr
cf.br ^bb63
^bb65:
%520 = llvm.load %480 : !llvm.ptr -> i64
func.return %520 : i64
}
func.func @f_cached(%arg0: i64) -> i64 {
%522 = llvm.mlir.addressof @g_f_computed : !llvm.ptr
%523 = llvm.load %522 : !llvm.ptr -> !llvm.ptr
%524 = llvm.getelementptr %523[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%521 = llvm.load %524 : !llvm.ptr -> i8
%525 = arith.constant 0 : i32
%527 = arith.extsi %521 : i8 to i32
%526 = arith.cmpi ne, %527, %525 : i32
cf.cond_br %526, ^bb75, ^bb76
^bb75:
%529 = llvm.mlir.addressof @g_f_cache : !llvm.ptr
%530 = llvm.load %529 : !llvm.ptr -> !llvm.ptr
%531 = llvm.getelementptr %530[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%528 = llvm.load %531 : !llvm.ptr -> i64
func.return %528 : i64
^bb76:
cf.br ^bb77
^bb77:
%533 = llvm.mlir.addressof @g_pref_mui : !llvm.ptr
%534 = llvm.load %533 : !llvm.ptr -> !llvm.ptr
%535 = arith.constant 0 : i32
%532 = func.call @mobius_sum_weighted(%arg0, %534, %535) : (i64, !llvm.ptr, i32) -> i64
%537 = llvm.mlir.addressof @g_pref_mui : !llvm.ptr
%538 = llvm.load %537 : !llvm.ptr -> !llvm.ptr
%539 = arith.constant 1 : i32
%536 = func.call @mobius_sum_weighted(%arg0, %538, %539) : (i64, !llvm.ptr, i32) -> i64
%541 = llvm.mlir.addressof @g_pref_mui_odd : !llvm.ptr
%542 = llvm.load %541 : !llvm.ptr -> !llvm.ptr
%543 = arith.constant 2 : i32
%540 = func.call @mobius_sum_weighted(%arg0, %542, %543) : (i64, !llvm.ptr, i32) -> i64
%545 = llvm.mlir.addressof @g_pref_mui_odd : !llvm.ptr
%546 = llvm.load %545 : !llvm.ptr -> !llvm.ptr
%547 = arith.constant 3 : i32
%544 = func.call @mobius_sum_weighted(%arg0, %546, %547) : (i64, !llvm.ptr, i32) -> i64
%548 = arith.constant 4 : i32
%550 = arith.extsi %548 : i32 to i64
%549 = arith.muli %550, %532 : i64
%551 = arith.constant 2 : i32
%553 = arith.extsi %551 : i32 to i64
%552 = arith.muli %553, %536 : i64
%554 = arith.addi %549, %552 : i64
%555 = arith.constant 2 : i32
%557 = arith.extsi %555 : i32 to i64
%556 = arith.muli %557, %540 : i64
%558 = arith.addi %554, %556 : i64
%559 = arith.constant 4 : i32
%561 = arith.extsi %559 : i32 to i64
%560 = arith.muli %561, %544 : i64
%562 = arith.subi %558, %560 : i64
%563 = llvm.mlir.addressof @g_f_cache : !llvm.ptr
%564 = llvm.load %563 : !llvm.ptr -> !llvm.ptr
%565 = llvm.getelementptr %564[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %562, %565 : i64, !llvm.ptr
%566 = arith.constant 1 : i32
%567 = llvm.mlir.addressof @g_f_computed : !llvm.ptr
%568 = llvm.load %567 : !llvm.ptr -> !llvm.ptr
%569 = arith.trunci %566 : i32 to i8
%570 = llvm.getelementptr %568[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %569, %570 : i8, !llvm.ptr
func.return %562 : i64
}
func.func @axis_total(%arg0: i64) -> i64 {
%571 = arith.constant 0 : i32
%572 = arith.extsi %571 : i32 to i64
%573 = llvm.mlir.constant(1 : i64) : i64
%574 = llvm.alloca %573 x i64 : (i64) -> !llvm.ptr
llvm.store %572, %574 : i64, !llvm.ptr
%575 = arith.constant 1 : i32
%576 = arith.extsi %575 : i32 to i64
%577 = llvm.mlir.constant(1 : i64) : i64
%578 = llvm.alloca %577 x i64 : (i64) -> !llvm.ptr
llvm.store %576, %578 : i64, !llvm.ptr
cf.br ^bb78
^bb78:
%579 = llvm.load %578 : !llvm.ptr -> i64
%580 = arith.cmpi sle, %579, %arg0 : i64
cf.cond_br %580, ^bb79, ^bb80
^bb79:
%581 = llvm.load %578 : !llvm.ptr -> i64
%582 = arith.divsi %arg0, %581 : i64
%583 = arith.divsi %arg0, %582 : i64
%584 = llvm.load %578 : !llvm.ptr -> i64
%585 = arith.addi %584, %583 : i64
%586 = llvm.load %578 : !llvm.ptr -> i64
%587 = arith.subi %583, %586 : i64
%588 = arith.constant 1 : i32
%590 = arith.extsi %588 : i32 to i64
%589 = arith.addi %587, %590 : i64
%591 = arith.muli %585, %589 : i64
%592 = arith.constant 2 : i32
%594 = arith.extsi %592 : i32 to i64
%593 = arith.divsi %591, %594 : i64
%595 = llvm.load %574 : !llvm.ptr -> i64
%596 = func.call @f_cached(%582) : (i64) -> i64
%597 = arith.muli %593, %596 : i64
%598 = arith.addi %595, %597 : i64
llvm.store %598, %574 : i64, !llvm.ptr
%599 = arith.constant 1 : i32
%601 = arith.extsi %599 : i32 to i64
%600 = arith.addi %583, %601 : i64
llvm.store %600, %578 : i64, !llvm.ptr
cf.br ^bb78
^bb80:
%602 = llvm.load %574 : !llvm.ptr -> i64
func.return %602 : i64
}
func.func @primitive_triples(%arg0: i64) -> () {
%604 = arith.constant 50000 : i32
%605 = arith.constant 8 : i32
%606 = arith.muli %604, %605 : i32
%607 = arith.extsi %606 : i32 to i64
%603 = func.call @malloc(%607) : (i64) -> !llvm.ptr
%608 = llvm.mlir.addressof @g_triple_a : !llvm.ptr
llvm.store %603, %608 : !llvm.ptr, !llvm.ptr
%610 = arith.constant 50000 : i32
%611 = arith.constant 8 : i32
%612 = arith.muli %610, %611 : i32
%613 = arith.extsi %612 : i32 to i64
%609 = func.call @malloc(%613) : (i64) -> !llvm.ptr
%614 = llvm.mlir.addressof @g_triple_b : !llvm.ptr
llvm.store %609, %614 : !llvm.ptr, !llvm.ptr
%616 = arith.constant 50000 : i32
%617 = arith.constant 8 : i32
%618 = arith.muli %616, %617 : i32
%619 = arith.extsi %618 : i32 to i64
%615 = func.call @malloc(%619) : (i64) -> !llvm.ptr
%620 = llvm.mlir.addressof @g_triple_c : !llvm.ptr
llvm.store %615, %620 : !llvm.ptr, !llvm.ptr
%621 = arith.constant 0 : i32
%622 = arith.extsi %621 : i32 to i64
%623 = llvm.mlir.addressof @g_triple_count : !llvm.ptr
llvm.store %622, %623 : i64, !llvm.ptr
%624 = arith.constant 2 : i32
%626 = arith.extsi %624 : i32 to i64
%625 = arith.muli %arg0, %626 : i64
%627 = arith.sitofp %625 : i64 to f64
%628 = math.sqrt %627 : f64
%629 = arith.fptosi %628 : f64 to i64
%630 = arith.constant 3 : i32
%632 = arith.extsi %630 : i32 to i64
%631 = arith.addi %629, %632 : i64
%633 = arith.constant 2 : i32
%634 = arith.extsi %633 : i32 to i64
%635 = llvm.mlir.constant(1 : i64) : i64
%636 = llvm.alloca %635 x i64 : (i64) -> !llvm.ptr
llvm.store %634, %636 : i64, !llvm.ptr
cf.br ^bb81
^bb81:
%637 = llvm.load %636 : !llvm.ptr -> i64
%638 = arith.cmpi sle, %637, %631 : i64
cf.cond_br %638, ^bb82, ^bb83
^bb82:
%639 = llvm.load %636 : !llvm.ptr -> i64
%640 = llvm.load %636 : !llvm.ptr -> i64
%641 = arith.muli %639, %640 : i64
%642 = arith.constant 1 : i32
%643 = arith.extsi %642 : i32 to i64
%644 = llvm.mlir.constant(1 : i64) : i64
%645 = llvm.alloca %644 x i64 : (i64) -> !llvm.ptr
llvm.store %643, %645 : i64, !llvm.ptr
cf.br ^bb84
^bb84:
%646 = llvm.load %645 : !llvm.ptr -> i64
%647 = llvm.load %636 : !llvm.ptr -> i64
%648 = arith.cmpi slt, %646, %647 : i64
cf.cond_br %648, ^bb85, ^bb86
^bb85:
%649 = llvm.load %636 : !llvm.ptr -> i64
%650 = llvm.load %645 : !llvm.ptr -> i64
%651 = arith.subi %649, %650 : i64
%652 = arith.constant 1 : i32
%654 = arith.extsi %652 : i32 to i64
%653 = arith.andi %651, %654 : i64
%655 = arith.constant 0 : i32
%657 = arith.extsi %655 : i32 to i64
%656 = arith.cmpi ne, %653, %657 : i64
cf.cond_br %656, ^bb87, ^bb88
^bb87:
%659 = llvm.load %636 : !llvm.ptr -> i64
%660 = llvm.load %645 : !llvm.ptr -> i64
%658 = func.call @igcd(%659, %660) : (i64, i64) -> i64
%661 = arith.constant 1 : i32
%663 = arith.extsi %661 : i32 to i64
%662 = arith.cmpi eq, %658, %663 : i64
cf.cond_br %662, ^bb90, ^bb91
^bb90:
%664 = llvm.load %645 : !llvm.ptr -> i64
%665 = llvm.load %645 : !llvm.ptr -> i64
%666 = arith.muli %664, %665 : i64
%667 = arith.addi %641, %666 : i64
%668 = arith.cmpi sgt, %667, %arg0 : i64
cf.cond_br %668, ^bb93, ^bb94
^bb93:
cf.br ^bb86
^bb94:
cf.br ^bb95
^bb95:
%669 = llvm.load %645 : !llvm.ptr -> i64
%670 = llvm.load %645 : !llvm.ptr -> i64
%671 = arith.muli %669, %670 : i64
%672 = arith.subi %641, %671 : i64
%673 = llvm.mlir.addressof @g_triple_a : !llvm.ptr
%674 = llvm.load %673 : !llvm.ptr -> !llvm.ptr
%675 = llvm.mlir.addressof @g_triple_count : !llvm.ptr
%676 = llvm.load %675 : !llvm.ptr -> i64
%677 = llvm.getelementptr %674[%676] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %672, %677 : i64, !llvm.ptr
%678 = arith.constant 2 : i32
%679 = llvm.load %636 : !llvm.ptr -> i64
%681 = arith.extsi %678 : i32 to i64
%680 = arith.muli %681, %679 : i64
%682 = llvm.load %645 : !llvm.ptr -> i64
%683 = arith.muli %680, %682 : i64
%684 = llvm.mlir.addressof @g_triple_b : !llvm.ptr
%685 = llvm.load %684 : !llvm.ptr -> !llvm.ptr
%686 = llvm.mlir.addressof @g_triple_count : !llvm.ptr
%687 = llvm.load %686 : !llvm.ptr -> i64
%688 = llvm.getelementptr %685[%687] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %683, %688 : i64, !llvm.ptr
%689 = llvm.mlir.addressof @g_triple_c : !llvm.ptr
%690 = llvm.load %689 : !llvm.ptr -> !llvm.ptr
%691 = llvm.mlir.addressof @g_triple_count : !llvm.ptr
%692 = llvm.load %691 : !llvm.ptr -> i64
%693 = llvm.getelementptr %690[%692] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %667, %693 : i64, !llvm.ptr
%694 = llvm.mlir.addressof @g_triple_count : !llvm.ptr
%695 = llvm.load %694 : !llvm.ptr -> i64
%696 = arith.constant 1 : i32
%698 = arith.extsi %696 : i32 to i64
%697 = arith.addi %695, %698 : i64
%699 = llvm.mlir.addressof @g_triple_count : !llvm.ptr
llvm.store %697, %699 : i64, !llvm.ptr
cf.br ^bb92
^bb91:
cf.br ^bb92
^bb92:
cf.br ^bb89
^bb88:
cf.br ^bb89
^bb89:
%700 = llvm.load %645 : !llvm.ptr -> i64
%701 = arith.constant 1 : i32
%703 = arith.extsi %701 : i32 to i64
%702 = arith.addi %700, %703 : i64
llvm.store %702, %645 : i64, !llvm.ptr
cf.br ^bb84
^bb86:
%704 = llvm.load %636 : !llvm.ptr -> i64
%705 = arith.constant 1 : i32
%707 = arith.extsi %705 : i32 to i64
%706 = arith.addi %704, %707 : i64
llvm.store %706, %636 : i64, !llvm.ptr
cf.br ^bb81
^bb83:
func.return
}
func.func @gauss_pow(%arg0: i64, %arg1: i64, %arg2: i32, %arg3: !llvm.ptr) -> () {
%708 = arith.constant 1 : i32
%709 = arith.constant 0 : i32
%710 = arith.extsi %708 : i32 to i64
%711 = arith.extsi %709 : i32 to i64
%712 = llvm.getelementptr %arg3[%711] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %710, %712 : i64, !llvm.ptr
%713 = arith.constant 0 : i32
%714 = arith.constant 1 : i32
%715 = arith.extsi %713 : i32 to i64
%716 = arith.extsi %714 : i32 to i64
%717 = llvm.getelementptr %arg3[%716] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %715, %717 : i64, !llvm.ptr
%718 = llvm.mlir.constant(1 : i64) : i64
%719 = llvm.alloca %718 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %719 : i64, !llvm.ptr
%720 = llvm.mlir.constant(1 : i64) : i64
%721 = llvm.alloca %720 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %721 : i64, !llvm.ptr
%722 = llvm.mlir.constant(1 : i64) : i64
%723 = llvm.alloca %722 x i32 : (i64) -> !llvm.ptr
llvm.store %arg2, %723 : i32, !llvm.ptr
cf.br ^bb96
^bb96:
%724 = llvm.load %723 : !llvm.ptr -> i32
%725 = arith.constant 0 : i32
%726 = arith.cmpi sgt, %724, %725 : i32
cf.cond_br %726, ^bb97, ^bb98
^bb97:
%727 = llvm.load %723 : !llvm.ptr -> i32
%728 = arith.constant 1 : i32
%729 = arith.andi %727, %728 : i32
%730 = arith.constant 1 : i32
%731 = arith.cmpi eq, %729, %730 : i32
cf.cond_br %731, ^bb99, ^bb100
^bb99:
%733 = arith.constant 0 : i32
%734 = arith.extsi %733 : i32 to i64
%735 = llvm.getelementptr %arg3[%734] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%732 = llvm.load %735 : !llvm.ptr -> i64
%736 = llvm.load %719 : !llvm.ptr -> i64
%737 = arith.muli %732, %736 : i64
%739 = arith.constant 1 : i32
%740 = arith.extsi %739 : i32 to i64
%741 = llvm.getelementptr %arg3[%740] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%738 = llvm.load %741 : !llvm.ptr -> i64
%742 = llvm.load %721 : !llvm.ptr -> i64
%743 = arith.muli %738, %742 : i64
%744 = arith.subi %737, %743 : i64
%746 = arith.constant 0 : i32
%747 = arith.extsi %746 : i32 to i64
%748 = llvm.getelementptr %arg3[%747] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%745 = llvm.load %748 : !llvm.ptr -> i64
%749 = llvm.load %721 : !llvm.ptr -> i64
%750 = arith.muli %745, %749 : i64
%752 = arith.constant 1 : i32
%753 = arith.extsi %752 : i32 to i64
%754 = llvm.getelementptr %arg3[%753] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%751 = llvm.load %754 : !llvm.ptr -> i64
%755 = llvm.load %719 : !llvm.ptr -> i64
%756 = arith.muli %751, %755 : i64
%757 = arith.addi %750, %756 : i64
%758 = arith.constant 0 : i32
%759 = arith.extsi %758 : i32 to i64
%760 = llvm.getelementptr %arg3[%759] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %744, %760 : i64, !llvm.ptr
%761 = arith.constant 1 : i32
%762 = arith.extsi %761 : i32 to i64
%763 = llvm.getelementptr %arg3[%762] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %757, %763 : i64, !llvm.ptr
cf.br ^bb101
^bb100:
cf.br ^bb101
^bb101:
%764 = llvm.load %719 : !llvm.ptr -> i64
%765 = llvm.load %719 : !llvm.ptr -> i64
%766 = arith.muli %764, %765 : i64
%767 = llvm.load %721 : !llvm.ptr -> i64
%768 = llvm.load %721 : !llvm.ptr -> i64
%769 = arith.muli %767, %768 : i64
%770 = arith.subi %766, %769 : i64
%771 = llvm.load %719 : !llvm.ptr -> i64
%772 = llvm.load %721 : !llvm.ptr -> i64
%773 = arith.muli %771, %772 : i64
%774 = llvm.load %721 : !llvm.ptr -> i64
%775 = llvm.load %719 : !llvm.ptr -> i64
%776 = arith.muli %774, %775 : i64
%777 = arith.addi %773, %776 : i64
llvm.store %770, %719 : i64, !llvm.ptr
llvm.store %777, %721 : i64, !llvm.ptr
%778 = llvm.load %723 : !llvm.ptr -> i32
%779 = arith.constant 1 : i32
%780 = arith.shrsi %778, %779 : i32
llvm.store %780, %723 : i32, !llvm.ptr
cf.br ^bb96
^bb98:
func.return
}
func.func @non_axis_total(%arg0: i64) -> i64 {
%781 = arith.constant 0 : i32
%782 = arith.extsi %781 : i32 to i64
%783 = llvm.mlir.constant(1 : i64) : i64
%784 = llvm.alloca %783 x i64 : (i64) -> !llvm.ptr
llvm.store %782, %784 : i64, !llvm.ptr
%785 = arith.constant 1 : i32
%786 = llvm.mlir.constant(1 : i64) : i64
%787 = llvm.alloca %786 x i32 : (i64) -> !llvm.ptr
llvm.store %785, %787 : i32, !llvm.ptr
cf.br ^bb102
^bb102:
%789 = arith.constant 3 : i32
%790 = llvm.load %787 : !llvm.ptr -> i32
%791 = arith.constant 1 : i32
%792 = arith.addi %790, %791 : i32
%793 = arith.extsi %789 : i32 to i64
%788 = func.call @ipow(%793, %792) : (i64, i32) -> i64
%794 = arith.cmpi sle, %788, %arg0 : i64
cf.cond_br %794, ^bb103, ^bb104
^bb103:
%795 = llvm.load %787 : !llvm.ptr -> i32
%796 = arith.constant 1 : i32
%797 = arith.addi %795, %796 : i32
llvm.store %797, %787 : i32, !llvm.ptr
cf.br ^bb102
^bb104:
%798 = arith.constant 2 : i32
cf.br ^bb105(%798 : i32)
^bb105(%799: i32):
%800 = llvm.load %787 : !llvm.ptr -> i32
%801 = arith.cmpi sle, %799, %800 : i32
cf.cond_br %801, ^bb106(%799 : i32), ^bb107(%799 : i32)
^bb106(%802: i32):
%804 = arith.sitofp %arg0 : i64 to f64
%805 = arith.constant 1.0 : f32
%806 = arith.sitofp %802 : i32 to f64
%808 = arith.extf %805 : f32 to f64
%807 = arith.divf %808, %806 : f64
%803 = func.call @pow(%804, %807) : (f64, f64) -> f64
%809 = arith.fptosi %803 : f64 to i64
%810 = arith.constant 2 : i32
%812 = arith.extsi %810 : i32 to i64
%811 = arith.addi %809, %812 : i64
%813 = llvm.mlir.constant(1 : i64) : i64
%814 = llvm.alloca %813 x i64 : (i64) -> !llvm.ptr
llvm.store %811, %814 : i64, !llvm.ptr
cf.br ^bb108
^bb108:
%816 = llvm.load %814 : !llvm.ptr -> i64
%815 = func.call @ipow(%816, %802) : (i64, i32) -> i64
%817 = arith.cmpi sgt, %815, %arg0 : i64
cf.cond_br %817, ^bb109, ^bb110
^bb109:
%818 = llvm.load %814 : !llvm.ptr -> i64
%819 = arith.constant 1 : i32
%821 = arith.extsi %819 : i32 to i64
%820 = arith.subi %818, %821 : i64
llvm.store %820, %814 : i64, !llvm.ptr
cf.br ^bb108
^bb110:
%823 = llvm.load %814 : !llvm.ptr -> i64
func.call @primitive_triples(%823) : (i64) -> ()
%824 = arith.constant 1 : i32
cf.br ^bb111(%824 : i32)
^bb111(%825: i32):
%826 = arith.cmpi slt, %825, %802 : i32
cf.cond_br %826, ^bb112(%825 : i32), ^bb113(%825 : i32)
^bb112(%827: i32):
%829 = arith.extsi %802 : i32 to i64
%830 = arith.extsi %827 : i32 to i64
%828 = func.call @igcd(%829, %830) : (i64, i64) -> i64
%831 = arith.constant 1 : i32
%833 = arith.extsi %831 : i32 to i64
%832 = arith.cmpi eq, %828, %833 : i64
cf.cond_br %832, ^bb114, ^bb115
^bb114:
%834 = arith.constant 0 : i32
%835 = arith.extsi %834 : i32 to i64
%836 = llvm.mlir.constant(1 : i64) : i64
%837 = llvm.alloca %836 x i64 : (i64) -> !llvm.ptr
llvm.store %835, %837 : i64, !llvm.ptr
cf.br ^bb117
^bb117:
%838 = llvm.load %837 : !llvm.ptr -> i64
%839 = llvm.mlir.addressof @g_triple_count : !llvm.ptr
%840 = llvm.load %839 : !llvm.ptr -> i64
%841 = arith.cmpi slt, %838, %840 : i64
cf.cond_br %841, ^bb118, ^bb119
^bb118:
%843 = llvm.mlir.addressof @g_triple_a : !llvm.ptr
%844 = llvm.load %843 : !llvm.ptr -> !llvm.ptr
%845 = llvm.load %837 : !llvm.ptr -> i64
%846 = llvm.getelementptr %844[%845] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%842 = llvm.load %846 : !llvm.ptr -> i64
%848 = llvm.mlir.addressof @g_triple_b : !llvm.ptr
%849 = llvm.load %848 : !llvm.ptr -> !llvm.ptr
%850 = llvm.load %837 : !llvm.ptr -> i64
%851 = llvm.getelementptr %849[%850] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%847 = llvm.load %851 : !llvm.ptr -> i64
%853 = llvm.mlir.addressof @g_triple_c : !llvm.ptr
%854 = llvm.load %853 : !llvm.ptr -> !llvm.ptr
%855 = llvm.load %837 : !llvm.ptr -> i64
%856 = llvm.getelementptr %854[%855] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%852 = llvm.load %856 : !llvm.ptr -> i64
%857 = func.call @ipow(%852, %802) : (i64, i32) -> i64
%858 = arith.extsi %802 : i32 to i64
%859 = arith.extsi %827 : i32 to i64
%860 = arith.addi %858, %859 : i64
%861 = arith.muli %857, %860 : i64
%862 = arith.cmpi sgt, %861, %arg0 : i64
cf.cond_br %862, ^bb120, ^bb121
^bb120:
%863 = llvm.load %837 : !llvm.ptr -> i64
%864 = arith.constant 1 : i32
%866 = arith.extsi %864 : i32 to i64
%865 = arith.addi %863, %866 : i64
llvm.store %865, %837 : i64, !llvm.ptr
cf.br ^bb117
^bb121:
cf.br ^bb122
^bb122:
%868 = arith.constant 0 : i32
%869 = arith.constant 0 : i32
%870 = arith.constant 0 : i32
%871 = arith.constant 0 : i32
%872 = arith.constant 0 : i32
%873 = arith.constant 0 : i32
%874 = arith.constant 0 : i32
%875 = arith.constant 0 : i32
%876 = arith.constant 0 : i32
%877 = arith.constant 0 : i32
%878 = arith.constant 0 : i32
%879 = arith.constant 0 : i32
%880 = arith.constant 0 : i32
%881 = arith.constant 0 : i32
%882 = arith.constant 0 : i32
%883 = arith.constant 0 : i32
%884 = arith.constant 0 : i32
%885 = arith.constant 0 : i32
%886 = arith.constant 0 : i32
%887 = arith.constant 0 : i32
%888 = arith.constant 0 : i32
%889 = arith.constant 0 : i32
%890 = arith.constant 0 : i32
%891 = arith.constant 0 : i32
%892 = arith.constant 0 : i32
%893 = arith.constant 0 : i32
%894 = arith.constant 0 : i32
%895 = arith.constant 0 : i32
%896 = arith.constant 0 : i32
%897 = arith.constant 0 : i32
%898 = arith.constant 0 : i32
%899 = arith.constant 0 : i32
%900 = llvm.mlir.constant(1 : i64) : i64
%901 = llvm.alloca %900 x !llvm.array<32 x i64> : (i64) -> !llvm.ptr
%902 = llvm.mlir.zero : !llvm.array<32 x i64>
llvm.store %902, %901 : !llvm.array<32 x i64>, !llvm.ptr
%903 = arith.extsi %868 : i32 to i64
%904 = arith.extsi %869 : i32 to i64
%905 = arith.extsi %870 : i32 to i64
%906 = arith.extsi %871 : i32 to i64
%907 = arith.extsi %872 : i32 to i64
%908 = arith.extsi %873 : i32 to i64
%909 = arith.extsi %874 : i32 to i64
%910 = arith.extsi %875 : i32 to i64
%911 = arith.extsi %876 : i32 to i64
%912 = arith.extsi %877 : i32 to i64
%913 = arith.extsi %878 : i32 to i64
%914 = arith.extsi %879 : i32 to i64
%915 = arith.extsi %880 : i32 to i64
%916 = arith.extsi %881 : i32 to i64
%917 = arith.extsi %882 : i32 to i64
%918 = arith.extsi %883 : i32 to i64
%919 = arith.extsi %884 : i32 to i64
%920 = arith.extsi %885 : i32 to i64
%921 = arith.extsi %886 : i32 to i64
%922 = arith.extsi %887 : i32 to i64
%923 = arith.extsi %888 : i32 to i64
%924 = arith.extsi %889 : i32 to i64
%925 = arith.extsi %890 : i32 to i64
%926 = arith.extsi %891 : i32 to i64
%927 = arith.extsi %892 : i32 to i64
%928 = arith.extsi %893 : i32 to i64
%929 = arith.extsi %894 : i32 to i64
%930 = arith.extsi %895 : i32 to i64
%931 = arith.extsi %896 : i32 to i64
%932 = arith.extsi %897 : i32 to i64
%933 = arith.extsi %898 : i32 to i64
%934 = arith.extsi %899 : i32 to i64
%935 = llvm.mlir.constant(0 : i64) : i64
%936 = llvm.getelementptr %901[0, %935] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %903, %936 : i64, !llvm.ptr
%937 = llvm.mlir.constant(1 : i64) : i64
%938 = llvm.getelementptr %901[0, %937] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %904, %938 : i64, !llvm.ptr
%939 = llvm.mlir.constant(2 : i64) : i64
%940 = llvm.getelementptr %901[0, %939] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %905, %940 : i64, !llvm.ptr
%941 = llvm.mlir.constant(3 : i64) : i64
%942 = llvm.getelementptr %901[0, %941] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %906, %942 : i64, !llvm.ptr
%943 = llvm.mlir.constant(4 : i64) : i64
%944 = llvm.getelementptr %901[0, %943] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %907, %944 : i64, !llvm.ptr
%945 = llvm.mlir.constant(5 : i64) : i64
%946 = llvm.getelementptr %901[0, %945] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %908, %946 : i64, !llvm.ptr
%947 = llvm.mlir.constant(6 : i64) : i64
%948 = llvm.getelementptr %901[0, %947] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %909, %948 : i64, !llvm.ptr
%949 = llvm.mlir.constant(7 : i64) : i64
%950 = llvm.getelementptr %901[0, %949] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %910, %950 : i64, !llvm.ptr
%951 = llvm.mlir.constant(8 : i64) : i64
%952 = llvm.getelementptr %901[0, %951] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %911, %952 : i64, !llvm.ptr
%953 = llvm.mlir.constant(9 : i64) : i64
%954 = llvm.getelementptr %901[0, %953] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %912, %954 : i64, !llvm.ptr
%955 = llvm.mlir.constant(10 : i64) : i64
%956 = llvm.getelementptr %901[0, %955] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %913, %956 : i64, !llvm.ptr
%957 = llvm.mlir.constant(11 : i64) : i64
%958 = llvm.getelementptr %901[0, %957] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %914, %958 : i64, !llvm.ptr
%959 = llvm.mlir.constant(12 : i64) : i64
%960 = llvm.getelementptr %901[0, %959] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %915, %960 : i64, !llvm.ptr
%961 = llvm.mlir.constant(13 : i64) : i64
%962 = llvm.getelementptr %901[0, %961] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %916, %962 : i64, !llvm.ptr
%963 = llvm.mlir.constant(14 : i64) : i64
%964 = llvm.getelementptr %901[0, %963] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %917, %964 : i64, !llvm.ptr
%965 = llvm.mlir.constant(15 : i64) : i64
%966 = llvm.getelementptr %901[0, %965] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %918, %966 : i64, !llvm.ptr
%967 = llvm.mlir.constant(16 : i64) : i64
%968 = llvm.getelementptr %901[0, %967] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %919, %968 : i64, !llvm.ptr
%969 = llvm.mlir.constant(17 : i64) : i64
%970 = llvm.getelementptr %901[0, %969] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %920, %970 : i64, !llvm.ptr
%971 = llvm.mlir.constant(18 : i64) : i64
%972 = llvm.getelementptr %901[0, %971] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %921, %972 : i64, !llvm.ptr
%973 = llvm.mlir.constant(19 : i64) : i64
%974 = llvm.getelementptr %901[0, %973] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %922, %974 : i64, !llvm.ptr
%975 = llvm.mlir.constant(20 : i64) : i64
%976 = llvm.getelementptr %901[0, %975] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %923, %976 : i64, !llvm.ptr
%977 = llvm.mlir.constant(21 : i64) : i64
%978 = llvm.getelementptr %901[0, %977] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %924, %978 : i64, !llvm.ptr
%979 = llvm.mlir.constant(22 : i64) : i64
%980 = llvm.getelementptr %901[0, %979] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %925, %980 : i64, !llvm.ptr
%981 = llvm.mlir.constant(23 : i64) : i64
%982 = llvm.getelementptr %901[0, %981] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %926, %982 : i64, !llvm.ptr
%983 = llvm.mlir.constant(24 : i64) : i64
%984 = llvm.getelementptr %901[0, %983] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %927, %984 : i64, !llvm.ptr
%985 = llvm.mlir.constant(25 : i64) : i64
%986 = llvm.getelementptr %901[0, %985] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %928, %986 : i64, !llvm.ptr
%987 = llvm.mlir.constant(26 : i64) : i64
%988 = llvm.getelementptr %901[0, %987] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %929, %988 : i64, !llvm.ptr
%989 = llvm.mlir.constant(27 : i64) : i64
%990 = llvm.getelementptr %901[0, %989] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %930, %990 : i64, !llvm.ptr
%991 = llvm.mlir.constant(28 : i64) : i64
%992 = llvm.getelementptr %901[0, %991] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %931, %992 : i64, !llvm.ptr
%993 = llvm.mlir.constant(29 : i64) : i64
%994 = llvm.getelementptr %901[0, %993] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %932, %994 : i64, !llvm.ptr
%995 = llvm.mlir.constant(30 : i64) : i64
%996 = llvm.getelementptr %901[0, %995] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %933, %996 : i64, !llvm.ptr
%997 = llvm.mlir.constant(31 : i64) : i64
%998 = llvm.getelementptr %901[0, %997] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %934, %998 : i64, !llvm.ptr
%999 = arith.constant 0 : i32
%1000 = llvm.mlir.constant(1 : i64) : i64
%1001 = llvm.alloca %1000 x i32 : (i64) -> !llvm.ptr
llvm.store %999, %1001 : i32, !llvm.ptr
%1003 = llvm.mlir.constant(1 : i64) : i64
%1004 = llvm.alloca %1003 x !llvm.array<4 x i64> : (i64) -> !llvm.ptr
%1005 = llvm.mlir.zero : !llvm.array<4 x i64>
llvm.store %1005, %1004 : !llvm.array<4 x i64>, !llvm.ptr
%1006 = llvm.mlir.constant(0 : i64) : i64
%1007 = llvm.getelementptr %1004[0, %1006] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i64>
llvm.store %842, %1007 : i64, !llvm.ptr
%1008 = llvm.mlir.constant(1 : i64) : i64
%1009 = llvm.getelementptr %1004[0, %1008] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i64>
llvm.store %847, %1009 : i64, !llvm.ptr
%1010 = llvm.mlir.constant(2 : i64) : i64
%1011 = llvm.getelementptr %1004[0, %1010] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i64>
llvm.store %847, %1011 : i64, !llvm.ptr
%1012 = llvm.mlir.constant(3 : i64) : i64
%1013 = llvm.getelementptr %1004[0, %1012] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i64>
llvm.store %842, %1013 : i64, !llvm.ptr
%1014 = arith.constant 0 : i32
%1015 = llvm.mlir.constant(1 : i64) : i64
%1016 = llvm.alloca %1015 x i32 : (i64) -> !llvm.ptr
llvm.store %1014, %1016 : i32, !llvm.ptr
cf.br ^bb123
^bb123:
%1017 = llvm.load %1016 : !llvm.ptr -> i32
%1018 = arith.constant 2 : i32
%1019 = arith.cmpi slt, %1017, %1018 : i32
cf.cond_br %1019, ^bb124, ^bb125
^bb124:
%1021 = llvm.load %1016 : !llvm.ptr -> i32
%1022 = arith.constant 2 : i32
%1023 = arith.muli %1021, %1022 : i32
%1024 = arith.extsi %1023 : i32 to i64
%1025 = llvm.getelementptr %1004[0, %1024] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i64>
%1020 = llvm.load %1025 : !llvm.ptr -> i64
%1027 = llvm.load %1016 : !llvm.ptr -> i32
%1028 = arith.constant 2 : i32
%1029 = arith.muli %1027, %1028 : i32
%1030 = arith.constant 1 : i32
%1031 = arith.addi %1029, %1030 : i32
%1032 = arith.extsi %1031 : i32 to i64
%1033 = llvm.getelementptr %1004[0, %1032] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i64>
%1026 = llvm.load %1033 : !llvm.ptr -> i64
%1034 = arith.constant 0 : i32
%1035 = llvm.mlir.constant(1 : i64) : i64
%1036 = llvm.alloca %1035 x i32 : (i64) -> !llvm.ptr
llvm.store %1034, %1036 : i32, !llvm.ptr
cf.br ^bb126
^bb126:
%1037 = llvm.load %1036 : !llvm.ptr -> i32
%1038 = arith.constant 2 : i32
%1039 = arith.cmpi slt, %1037, %1038 : i32
cf.cond_br %1039, ^bb127, ^bb128
^bb127:
%1040 = llvm.load %1036 : !llvm.ptr -> i32
%1041 = arith.constant 0 : i32
%1042 = arith.cmpi eq, %1040, %1041 : i32
%1043 = scf.if %1042 -> (i32) {
%1044 = arith.constant 1 : i32
scf.yield %1044 : i32
} else {
%1045 = arith.constant 1 : i32
%1047 = arith.constant 0 : i32
%1046 = arith.subi %1047, %1045 : i32
scf.yield %1046 : i32
}
%1048 = arith.extsi %1043 : i32 to i64
%1049 = arith.constant 0 : i32
%1050 = llvm.mlir.constant(1 : i64) : i64
%1051 = llvm.alloca %1050 x i32 : (i64) -> !llvm.ptr
llvm.store %1049, %1051 : i32, !llvm.ptr
cf.br ^bb129
^bb129:
%1052 = llvm.load %1051 : !llvm.ptr -> i32
%1053 = arith.constant 2 : i32
%1054 = arith.cmpi slt, %1052, %1053 : i32
cf.cond_br %1054, ^bb130, ^bb131
^bb130:
%1055 = llvm.load %1051 : !llvm.ptr -> i32
%1056 = arith.constant 0 : i32
%1057 = arith.cmpi eq, %1055, %1056 : i32
%1058 = scf.if %1057 -> (i32) {
%1059 = arith.constant 1 : i32
scf.yield %1059 : i32
} else {
%1060 = arith.constant 1 : i32
%1062 = arith.constant 0 : i32
%1061 = arith.subi %1062, %1060 : i32
scf.yield %1061 : i32
}
%1063 = arith.extsi %1058 : i32 to i64
%1064 = arith.muli %1048, %1020 : i64
%1065 = arith.muli %1063, %1026 : i64
%1066 = arith.constant 0 : i32
%1067 = llvm.mlir.constant(1 : i64) : i64
%1068 = llvm.alloca %1067 x i32 : (i64) -> !llvm.ptr
llvm.store %1066, %1068 : i32, !llvm.ptr
%1069 = arith.constant 0 : i32
%1070 = llvm.mlir.constant(1 : i64) : i64
%1071 = llvm.alloca %1070 x i32 : (i64) -> !llvm.ptr
llvm.store %1069, %1071 : i32, !llvm.ptr
cf.br ^bb132
^bb132:
%1072 = llvm.load %1071 : !llvm.ptr -> i32
%1073 = llvm.load %1001 : !llvm.ptr -> i32
%1074 = arith.cmpi slt, %1072, %1073 : i32
cf.cond_br %1074, ^bb133, ^bb134
^bb133:
%1076 = llvm.load %1071 : !llvm.ptr -> i32
%1077 = arith.constant 2 : i32
%1078 = arith.muli %1076, %1077 : i32
%1079 = arith.extsi %1078 : i32 to i64
%1080 = llvm.getelementptr %901[0, %1079] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
%1075 = llvm.load %1080 : !llvm.ptr -> i64
%1081 = arith.cmpi eq, %1075, %1064 : i64
%1082 = scf.if %1081 -> (i1) {
%1084 = llvm.load %1071 : !llvm.ptr -> i32
%1085 = arith.constant 2 : i32
%1086 = arith.muli %1084, %1085 : i32
%1087 = arith.constant 1 : i32
%1088 = arith.addi %1086, %1087 : i32
%1089 = arith.extsi %1088 : i32 to i64
%1090 = llvm.getelementptr %901[0, %1089] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
%1083 = llvm.load %1090 : !llvm.ptr -> i64
%1091 = arith.cmpi eq, %1083, %1065 : i64
scf.yield %1091 : i1
} else {
%1092 = arith.constant false
scf.yield %1092 : i1
}
cf.cond_br %1082, ^bb135, ^bb136
^bb135:
%1093 = arith.constant 1 : i32
llvm.store %1093, %1068 : i32, !llvm.ptr
cf.br ^bb134
^bb136:
cf.br ^bb137
^bb137:
%1094 = llvm.load %1071 : !llvm.ptr -> i32
%1095 = arith.constant 1 : i32
%1096 = arith.addi %1094, %1095 : i32
llvm.store %1096, %1071 : i32, !llvm.ptr
cf.br ^bb132
^bb134:
%1097 = llvm.load %1068 : !llvm.ptr -> i32
%1098 = arith.constant 0 : i32
%1099 = arith.cmpi eq, %1097, %1098 : i32
cf.cond_br %1099, ^bb138, ^bb139
^bb138:
%1100 = llvm.load %1001 : !llvm.ptr -> i32
%1101 = arith.constant 2 : i32
%1102 = arith.muli %1100, %1101 : i32
%1103 = arith.extsi %1102 : i32 to i64
%1104 = llvm.getelementptr %901[0, %1103] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %1064, %1104 : i64, !llvm.ptr
%1105 = llvm.load %1001 : !llvm.ptr -> i32
%1106 = arith.constant 2 : i32
%1107 = arith.muli %1105, %1106 : i32
%1108 = arith.constant 1 : i32
%1109 = arith.addi %1107, %1108 : i32
%1110 = arith.extsi %1109 : i32 to i64
%1111 = llvm.getelementptr %901[0, %1110] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
llvm.store %1065, %1111 : i64, !llvm.ptr
%1112 = llvm.load %1001 : !llvm.ptr -> i32
%1113 = arith.constant 1 : i32
%1114 = arith.addi %1112, %1113 : i32
llvm.store %1114, %1001 : i32, !llvm.ptr
cf.br ^bb140
^bb139:
cf.br ^bb140
^bb140:
%1115 = llvm.load %1051 : !llvm.ptr -> i32
%1116 = arith.constant 1 : i32
%1117 = arith.addi %1115, %1116 : i32
llvm.store %1117, %1051 : i32, !llvm.ptr
cf.br ^bb129
^bb131:
%1118 = llvm.load %1036 : !llvm.ptr -> i32
%1119 = arith.constant 1 : i32
%1120 = arith.addi %1118, %1119 : i32
llvm.store %1120, %1036 : i32, !llvm.ptr
cf.br ^bb126
^bb128:
%1121 = llvm.load %1016 : !llvm.ptr -> i32
%1122 = arith.constant 1 : i32
%1123 = arith.addi %1121, %1122 : i32
llvm.store %1123, %1016 : i32, !llvm.ptr
cf.br ^bb123
^bb125:
%1124 = arith.constant 0 : i32
%1125 = llvm.mlir.constant(1 : i64) : i64
%1126 = llvm.alloca %1125 x i32 : (i64) -> !llvm.ptr
llvm.store %1124, %1126 : i32, !llvm.ptr
cf.br ^bb141
^bb141:
%1127 = llvm.load %1126 : !llvm.ptr -> i32
%1128 = llvm.load %1001 : !llvm.ptr -> i32
%1129 = arith.cmpi slt, %1127, %1128 : i32
cf.cond_br %1129, ^bb142, ^bb143
^bb142:
%1131 = llvm.load %1126 : !llvm.ptr -> i32
%1132 = arith.constant 2 : i32
%1133 = arith.muli %1131, %1132 : i32
%1134 = arith.extsi %1133 : i32 to i64
%1135 = llvm.getelementptr %901[0, %1134] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
%1130 = llvm.load %1135 : !llvm.ptr -> i64
%1137 = llvm.load %1126 : !llvm.ptr -> i32
%1138 = arith.constant 2 : i32
%1139 = arith.muli %1137, %1138 : i32
%1140 = arith.constant 1 : i32
%1141 = arith.addi %1139, %1140 : i32
%1142 = arith.extsi %1141 : i32 to i64
%1143 = llvm.getelementptr %901[0, %1142] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<32 x i64>
%1136 = llvm.load %1143 : !llvm.ptr -> i64
%1145 = arith.constant 0 : i32
%1146 = arith.constant 0 : i32
%1147 = llvm.mlir.constant(1 : i64) : i64
%1148 = llvm.alloca %1147 x !llvm.array<2 x i64> : (i64) -> !llvm.ptr
%1149 = llvm.mlir.zero : !llvm.array<2 x i64>
llvm.store %1149, %1148 : !llvm.array<2 x i64>, !llvm.ptr
%1150 = arith.extsi %1145 : i32 to i64
%1151 = arith.extsi %1146 : i32 to i64
%1152 = llvm.mlir.constant(0 : i64) : i64
%1153 = llvm.getelementptr %1148[0, %1152] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
llvm.store %1150, %1153 : i64, !llvm.ptr
%1154 = llvm.mlir.constant(1 : i64) : i64
%1155 = llvm.getelementptr %1148[0, %1154] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
llvm.store %1151, %1155 : i64, !llvm.ptr
%1157 = arith.constant 0 : i32
%1158 = arith.constant 0 : i32
%1159 = llvm.mlir.constant(1 : i64) : i64
%1160 = llvm.alloca %1159 x !llvm.array<2 x i64> : (i64) -> !llvm.ptr
%1161 = llvm.mlir.zero : !llvm.array<2 x i64>
llvm.store %1161, %1160 : !llvm.array<2 x i64>, !llvm.ptr
%1162 = arith.extsi %1157 : i32 to i64
%1163 = arith.extsi %1158 : i32 to i64
%1164 = llvm.mlir.constant(0 : i64) : i64
%1165 = llvm.getelementptr %1160[0, %1164] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
llvm.store %1162, %1165 : i64, !llvm.ptr
%1166 = llvm.mlir.constant(1 : i64) : i64
%1167 = llvm.getelementptr %1160[0, %1166] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
llvm.store %1163, %1167 : i64, !llvm.ptr
func.call @gauss_pow(%1130, %1136, %802, %1148) : (i64, i64, i32, !llvm.ptr) -> ()
func.call @gauss_pow(%1130, %1136, %827, %1160) : (i64, i64, i32, !llvm.ptr) -> ()
%1171 = arith.constant 0 : i32
%1172 = arith.extsi %1171 : i32 to i64
%1173 = llvm.getelementptr %1148[0, %1172] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
%1170 = llvm.load %1173 : !llvm.ptr -> i64
%1175 = arith.constant 1 : i32
%1176 = arith.extsi %1175 : i32 to i64
%1177 = llvm.getelementptr %1148[0, %1176] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
%1174 = llvm.load %1177 : !llvm.ptr -> i64
%1179 = arith.constant 0 : i32
%1180 = arith.extsi %1179 : i32 to i64
%1181 = llvm.getelementptr %1160[0, %1180] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
%1178 = llvm.load %1181 : !llvm.ptr -> i64
%1183 = arith.constant 1 : i32
%1184 = arith.extsi %1183 : i32 to i64
%1185 = llvm.getelementptr %1160[0, %1184] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<2 x i64>
%1182 = llvm.load %1185 : !llvm.ptr -> i64
%1187 = arith.subi %802, %827 : i32
%1186 = func.call @ipow(%852, %1187) : (i64, i32) -> i64
%1188 = arith.extsi %802 : i32 to i64
%1189 = arith.muli %1188, %1178 : i64
%1190 = arith.muli %1189, %1186 : i64
%1191 = arith.extsi %827 : i32 to i64
%1192 = arith.muli %1191, %1170 : i64
%1193 = arith.addi %1190, %1192 : i64
%1194 = arith.extsi %802 : i32 to i64
%1195 = arith.muli %1194, %1182 : i64
%1196 = arith.muli %1195, %1186 : i64
%1197 = arith.extsi %827 : i32 to i64
%1198 = arith.muli %1197, %1174 : i64
%1199 = arith.subi %1196, %1198 : i64
%1202 = func.call @llabs(%1193) : (i64) -> i64
%1203 = func.call @llabs(%1199) : (i64) -> i64
%1201 = func.call @igcd(%1202, %1203) : (i64, i64) -> i64
%1200 = func.call @igcd(%857, %1201) : (i64, i64) -> i64
%1204 = arith.divsi %857, %1200 : i64
%1205 = arith.extsi %802 : i32 to i64
%1206 = arith.extsi %827 : i32 to i64
%1207 = arith.addi %1205, %1206 : i64
%1208 = arith.muli %1204, %1207 : i64
%1209 = arith.cmpi sgt, %1208, %arg0 : i64
cf.cond_br %1209, ^bb144, ^bb145
^bb144:
%1210 = llvm.load %1126 : !llvm.ptr -> i32
%1211 = arith.constant 1 : i32
%1212 = arith.addi %1210, %1211 : i32
llvm.store %1212, %1126 : i32, !llvm.ptr
cf.br ^bb141
^bb145:
cf.br ^bb146
^bb146:
%1213 = arith.divsi %1193, %1200 : i64
%1214 = arith.divsi %1199, %1200 : i64
%1215 = arith.extsi %802 : i32 to i64
%1216 = arith.extsi %827 : i32 to i64
%1217 = arith.addi %1215, %1216 : i64
%1218 = arith.muli %1204, %1217 : i64
%1219 = arith.divsi %arg0, %1218 : i64
%1220 = llvm.load %784 : !llvm.ptr -> i64
%1221 = func.call @llabs(%1213) : (i64) -> i64
%1222 = func.call @llabs(%1214) : (i64) -> i64
%1223 = arith.addi %1221, %1222 : i64
%1224 = arith.constant 1 : i32
%1226 = arith.extsi %1224 : i32 to i64
%1225 = arith.addi %1219, %1226 : i64
%1227 = arith.muli %1219, %1225 : i64
%1228 = arith.constant 2 : i32
%1230 = arith.extsi %1228 : i32 to i64
%1229 = arith.divsi %1227, %1230 : i64
%1231 = arith.muli %1223, %1229 : i64
%1232 = arith.addi %1220, %1231 : i64
llvm.store %1232, %784 : i64, !llvm.ptr
%1233 = llvm.load %1126 : !llvm.ptr -> i32
%1234 = arith.constant 1 : i32
%1235 = arith.addi %1233, %1234 : i32
llvm.store %1235, %1126 : i32, !llvm.ptr
cf.br ^bb141
^bb143:
%1236 = llvm.load %837 : !llvm.ptr -> i64
%1237 = arith.constant 1 : i32
%1239 = arith.extsi %1237 : i32 to i64
%1238 = arith.addi %1236, %1239 : i64
llvm.store %1238, %837 : i64, !llvm.ptr
cf.br ^bb117
^bb119:
cf.br ^bb116
^bb115:
cf.br ^bb116
^bb116:
%1240 = arith.constant 1 : i32
%1241 = arith.addi %827, %1240 : i32
cf.br ^bb111(%1241 : i32)
^bb113(%1242: i32):
%1244 = llvm.mlir.addressof @g_triple_a : !llvm.ptr
%1245 = llvm.load %1244 : !llvm.ptr -> !llvm.ptr
func.call @free(%1245) : (!llvm.ptr) -> ()
%1247 = llvm.mlir.addressof @g_triple_b : !llvm.ptr
%1248 = llvm.load %1247 : !llvm.ptr -> !llvm.ptr
func.call @free(%1248) : (!llvm.ptr) -> ()
%1250 = llvm.mlir.addressof @g_triple_c : !llvm.ptr
%1251 = llvm.load %1250 : !llvm.ptr -> !llvm.ptr
func.call @free(%1251) : (!llvm.ptr) -> ()
%1252 = llvm.mlir.zero : !llvm.ptr
%1253 = llvm.mlir.addressof @g_triple_a : !llvm.ptr
llvm.store %1252, %1253 : !llvm.ptr, !llvm.ptr
%1254 = llvm.mlir.zero : !llvm.ptr
%1255 = llvm.mlir.addressof @g_triple_b : !llvm.ptr
llvm.store %1254, %1255 : !llvm.ptr, !llvm.ptr
%1256 = llvm.mlir.zero : !llvm.ptr
%1257 = llvm.mlir.addressof @g_triple_c : !llvm.ptr
llvm.store %1256, %1257 : !llvm.ptr, !llvm.ptr
%1258 = arith.constant 1 : i32
%1259 = arith.addi %802, %1258 : i32
cf.br ^bb105(%1259 : i32)
^bb107(%1260: i32):
%1261 = llvm.load %784 : !llvm.ptr -> i64
func.return %1261 : i64
}
func.func @main() -> i32 {
%1263 = llvm.mlir.addressof @N : !llvm.ptr
%1264 = llvm.load %1263 : !llvm.ptr -> i64
func.call @mobius_sieve(%1264) : (i64) -> ()
%1266 = llvm.mlir.addressof @N : !llvm.ptr
%1267 = llvm.load %1266 : !llvm.ptr -> i64
func.call @build_prefix(%1267) : (i64) -> ()
%1269 = llvm.mlir.addressof @N : !llvm.ptr
%1270 = llvm.load %1269 : !llvm.ptr -> i64
%1271 = arith.constant 1 : i32
%1273 = arith.extsi %1271 : i32 to i64
%1272 = arith.addi %1270, %1273 : i64
%1274 = arith.constant 8 : i32
%1275 = arith.extsi %1274 : i32 to i64
%1268 = func.call @calloc(%1272, %1275) : (i64, i64) -> !llvm.ptr
%1276 = llvm.mlir.addressof @g_f_cache : !llvm.ptr
llvm.store %1268, %1276 : !llvm.ptr, !llvm.ptr
%1278 = llvm.mlir.addressof @N : !llvm.ptr
%1279 = llvm.load %1278 : !llvm.ptr -> i64
%1280 = arith.constant 1 : i32
%1282 = arith.extsi %1280 : i32 to i64
%1281 = arith.addi %1279, %1282 : i64
%1283 = arith.constant 1 : i32
%1284 = arith.extsi %1283 : i32 to i64
%1277 = func.call @calloc(%1281, %1284) : (i64, i64) -> !llvm.ptr
%1285 = llvm.mlir.addressof @g_f_computed : !llvm.ptr
llvm.store %1277, %1285 : !llvm.ptr, !llvm.ptr
%1287 = llvm.mlir.addressof @N : !llvm.ptr
%1288 = llvm.load %1287 : !llvm.ptr -> i64
%1286 = func.call @axis_total(%1288) : (i64) -> i64
%1290 = llvm.mlir.addressof @N : !llvm.ptr
%1291 = llvm.load %1290 : !llvm.ptr -> i64
%1289 = func.call @non_axis_total(%1291) : (i64) -> i64
%1292 = arith.addi %1286, %1289 : i64
%1293 = llvm.mlir.addressof @str_0 : !llvm.ptr
%1294 = llvm.call @printf(%1293, %1292) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
%1296 = llvm.mlir.addressof @g_mu : !llvm.ptr
%1297 = llvm.load %1296 : !llvm.ptr -> !llvm.ptr
func.call @free(%1297) : (!llvm.ptr) -> ()
%1299 = llvm.mlir.addressof @g_pref_mui : !llvm.ptr
%1300 = llvm.load %1299 : !llvm.ptr -> !llvm.ptr
func.call @free(%1300) : (!llvm.ptr) -> ()
%1302 = llvm.mlir.addressof @g_pref_mui_odd : !llvm.ptr
%1303 = llvm.load %1302 : !llvm.ptr -> !llvm.ptr
func.call @free(%1303) : (!llvm.ptr) -> ()
%1305 = llvm.mlir.addressof @g_f_cache : !llvm.ptr
%1306 = llvm.load %1305 : !llvm.ptr -> !llvm.ptr
func.call @free(%1306) : (!llvm.ptr) -> ()
%1308 = llvm.mlir.addressof @g_f_computed : !llvm.ptr
%1309 = llvm.load %1308 : !llvm.ptr -> !llvm.ptr
func.call @free(%1309) : (!llvm.ptr) -> ()
%1310 = arith.constant 0 : i32
func.return %1310 : i32
}
}