← All problems
Problem 619
Square subsets: GF(2) rank of squarefree kernels on [1e6,1234567]. Pure Flow port of the native C helper. __builtin_ctzll is replaced by a Flow clz/ctz helper. MOD = 1e9+7 so i64 products are safe.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n^3)O(n log log n)
Space complexity O(n^2)O(n)
Approach Flow solution Mobius sieve
Verdict Suboptimal
Flow source
# Project Euler 619
# Square subsets: GF(2) rank of squarefree kernels on [1e6,1234567].
# Pure Flow port of the native C helper. __builtin_ctzll is replaced by a
# Flow clz/ctz helper. MOD = 1e9+7 so i64 products are safe.
import euler.nt { mod_pow }
const MOD: i64 = 1000000007
const PIVCAP: i32 = 1048576
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 ctzll(x: i64) -> i32 {
if x == 0 {
return 64
}
let mut n: i32 = 0
let mut v: i64 = x
while v % 2 == 0 {
n = n + 1
v = v / 2
}
return n
}
# Small-basis state (parallel arrays for the 3-word masks).
let mut g_basis_w0: ptr<i64> = null
let mut g_basis_w1: ptr<i64> = null
let mut g_basis_w2: ptr<i64> = null
let mut g_basis_used: ptr<i8> = null
let mut g_rank_small: i32 = 0
function mask_any(w0: i64, w1: i64, w2: i64) -> i32 {
if (w0 | w1 | w2) != 0 {
return 1
}
return 0
}
function mask_lsb(w0: i64, w1: i64, w2: i64) -> i32 {
if w0 != 0 {
return ctzll(w0)
}
if w1 != 0 {
return 64 + ctzll(w1)
}
if w2 != 0 {
return 128 + ctzll(w2)
}
return -1
}
function mask_setbit(w0: i64, w1: i64, w2: i64, bit: i32) -> i64 {
if bit < 64 {
return w0 | ((1 as i64) << bit)
}
if bit < 128 {
return w1 | ((1 as i64) << (bit - 64))
}
return w2 | ((1 as i64) << (bit - 128))
}
function add_small_vector(v0: i64, v1: i64, v2: i64) {
let mut w0: i64 = v0
let mut w1: i64 = v1
let mut w2: i64 = v2
while mask_any(w0, w1, w2) != 0 {
let lb: i32 = mask_lsb(w0, w1, w2)
if lb < 0 {
return
}
if g_basis_used[lb] != 0 {
w0 = w0 ^ g_basis_w0[lb]
w1 = w1 ^ g_basis_w1[lb]
w2 = w2 ^ g_basis_w2[lb]
} else {
g_basis_w0[lb] = w0
g_basis_w1[lb] = w1
g_basis_w2[lb] = w2
g_basis_used[lb] = 1
g_rank_small = g_rank_small + 1
return
}
}
}
# Pivot hash table (open addressing, power-of-two cap).
let mut g_pivot_p: ptr<i32> = null
let mut g_pivot_w0: ptr<i64> = null
let mut g_pivot_w1: ptr<i64> = null
let mut g_pivot_w2: ptr<i64> = null
let mut g_pused: ptr<i8> = null
let mut g_pivot_count: i32 = 0
function hash_index(p: i32) -> i32 {
let prod: i64 = (p as i64) * 11400714819323198485
let shifted: i64 = (prod >> 44) & ((PIVCAP as i64) - 1)
return (shifted as i32)
}
function pivot_get(p: i32, out_w0: ptr<i64>, out_w1: ptr<i64>, out_w2: ptr<i64>) -> i32 {
let mut i: i32 = hash_index(p)
while g_pused[i] != 0 {
if g_pivot_p[i] == p {
out_w0[0] = g_pivot_w0[i]
out_w1[0] = g_pivot_w1[i]
out_w2[0] = g_pivot_w2[i]
return 1
}
i = (i + 1) & (PIVCAP - 1)
}
return 0
}
function pivot_set(p: i32, w0: i64, w1: i64, w2: i64) {
let mut i: i32 = hash_index(p)
while g_pused[i] != 0 {
if g_pivot_p[i] == p {
g_pivot_w0[i] = w0
g_pivot_w1[i] = w1
g_pivot_w2[i] = w2
return
}
i = (i + 1) & (PIVCAP - 1)
}
g_pused[i] = 1
g_pivot_p[i] = p
g_pivot_w0[i] = w0
g_pivot_w1[i] = w1
g_pivot_w2[i] = w2
g_pivot_count = g_pivot_count + 1
}
function main() -> i32 {
let a: i32 = 1000000
let b: i32 = 1234567
let m: i32 = b - a + 1
let T: i32 = (sqrt((b as f64))) as i32
let is_prime: ptr<i8> = calloc((T + 1) as i64, 1)
let small_primes: ptr<i32> = calloc((T + 1) as i64, 4)
let mut spc: i32 = 0
let mut ii: i32 = 0
while ii <= T {
is_prime[ii] = 1
ii = ii + 1
}
is_prime[0] = 0
is_prime[1] = 0
let mut i: i32 = 2
while (i as i64) * (i as i64) <= (T as i64) {
if is_prime[i] != 0 {
let mut j: i32 = i * i
while j <= T {
is_prime[j] = 0
j = j + i
}
}
i = i + 1
}
let mut i2: i32 = 2
while i2 <= T {
if is_prime[i2] != 0 {
small_primes[spc] = i2
spc = spc + 1
}
i2 = i2 + 1
}
let small_bit_idx: ptr<i32> = calloc((T + 1) as i64, 4)
let mut i3: i32 = 0
while i3 < spc {
small_bit_idx[small_primes[i3]] = i3
i3 = i3 + 1
}
# Linear sieve for smallest prime factor up to b.
let spf: ptr<i32> = calloc(((b + 1) as i64), 4)
let primes: ptr<i32> = calloc(((b / 5 + 10) as i64), 4)
let mut pc: i32 = 0
let mut i4: i32 = 2
while i4 <= b {
if spf[i4] == 0 {
spf[i4] = i4
primes[pc] = i4
pc = pc + 1
}
let mut j: i32 = 0
while j < pc {
let v: i64 = (i4 as i64) * (primes[j] as i64)
if v > (b as i64) {
break
}
spf[(v as i32)] = primes[j]
if primes[j] == spf[i4] {
break
}
j = j + 1
}
i4 = i4 + 1
}
g_basis_w0 = calloc((spc + 1) as i64, 8)
g_basis_w1 = calloc((spc + 1) as i64, 8)
g_basis_w2 = calloc((spc + 1) as i64, 8)
g_basis_used = calloc((spc + 1) as i64, 1)
g_rank_small = 0
g_pivot_p = calloc(PIVCAP as i64, 4)
g_pivot_w0 = calloc(PIVCAP as i64, 8)
g_pivot_w1 = calloc(PIVCAP as i64, 8)
g_pivot_w2 = calloc(PIVCAP as i64, 8)
g_pused = calloc(PIVCAP as i64, 1)
g_pivot_count = 0
let mut n: i32 = a
while n <= b {
let mut x: i32 = n
let mut sm0: i64 = 0
let mut sm1: i64 = 0
let mut sm2: i64 = 0
let mut big_prime: i32 = 0
while x > 1 {
let p: i32 = spf[x]
let mut e: i32 = 0
while x % p == 0 {
x = x / p
e = e + 1
}
if e % 2 == 1 {
if p <= T {
let bit: i32 = small_bit_idx[p]
if bit < 64 {
sm0 = sm0 | ((1 as i64) << bit)
} else {
if bit < 128 {
sm1 = sm1 | ((1 as i64) << (bit - 64))
} else {
sm2 = sm2 | ((1 as i64) << (bit - 128))
}
}
} else {
big_prime = p
}
}
}
if big_prime == 0 {
add_small_vector(sm0, sm1, sm2)
} else {
let pw0: ptr<i64> = malloc(8)
let pw1: ptr<i64> = malloc(8)
let pw2: ptr<i64> = malloc(8)
let found: i32 = pivot_get(big_prime, pw0, pw1, pw2)
if found == 0 {
pivot_set(big_prime, sm0, sm1, sm2)
} else {
add_small_vector(pw0[0] ^ sm0, pw1[0] ^ sm1, pw2[0] ^ sm2)
}
free(pw0)
free(pw1)
free(pw2)
}
n = n + 1
}
let rank: i32 = g_pivot_count + g_rank_small
let mut ans: i64 = mod_pow(2, (m - rank) as i64, MOD) - 1
if ans < 0 {
ans = ans + MOD
}
printf("%lld\n", ans)
free(is_prime)
free(small_primes)
free(small_bit_idx)
free(spf)
free(primes)
free(g_basis_w0)
free(g_basis_w1)
free(g_basis_w2)
free(g_basis_used)
free(g_pivot_p)
free(g_pivot_w0)
free(g_pivot_w1)
free(g_pivot_w2)
free(g_pused)
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 gcd_i64_i64(int64_t a0, int64_t b0);
int64_t lcm_i64_i64(int64_t a, int64_t b);
int64_t isqrt_i64(int64_t n);
int64_t mulmod_i64_i64_i64(int64_t a0, int64_t b0, int64_t mod);
int64_t mod_pow_i64_i64_i64(int64_t base, int64_t exp, int64_t mod);
bool is_prime_i64(int64_t n);
int32_t ctzll_i64(int64_t x);
int32_t mask_any_i64_i64_i64(int64_t w0, int64_t w1, int64_t w2);
int32_t mask_lsb_i64_i64_i64(int64_t w0, int64_t w1, int64_t w2);
int64_t mask_setbit_i64_i64_i64_i32(int64_t w0, int64_t w1, int64_t w2, int32_t bit);
void add_small_vector_i64_i64_i64(int64_t v0, int64_t v1, int64_t v2);
int32_t hash_index_i32(int32_t p);
int32_t pivot_get_i32_ptr_i64_ptr_i64_ptr_i64(int32_t p, int64_t* out_w0, int64_t* out_w1, int64_t* out_w2);
void pivot_set_i32_i64_i64_i64(int32_t p, int64_t w0, int64_t w1, int64_t w2);
int32_t main(void);
static const int64_t MOD = 1000000007;
static const int32_t PIVCAP = 1048576;
/* Module statics */
static int64_t* g_basis_w0 = NULL;
static int64_t* g_basis_w1 = NULL;
static int64_t* g_basis_w2 = NULL;
static int8_t* g_basis_used = NULL;
static int32_t g_rank_small = 0;
static int32_t* g_pivot_p = NULL;
static int64_t* g_pivot_w0 = NULL;
static int64_t* g_pivot_w1 = NULL;
static int64_t* g_pivot_w2 = NULL;
static int8_t* g_pused = NULL;
static int32_t g_pivot_count = 0;
int64_t gcd_i64_i64(int64_t a0, int64_t b0) {
int64_t a = a0;
int64_t b = b0;
while (b != 0) {
int64_t t = FLOW_CHECKED_MOD((a), (b));
a = b;
b = t;
}
return a;
}
int64_t lcm_i64_i64(int64_t a, int64_t b) {
if ((a == 0 || b == 0)) {
return 0;
}
return (FLOW_CHECKED_DIV((a), (gcd_i64_i64(a, b))) * b);
}
int64_t isqrt_i64(int64_t n) {
if (n < 2) {
return n;
}
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 mulmod_i64_i64_i64(int64_t a0, int64_t b0, int64_t mod) {
int64_t a = FLOW_CHECKED_MOD((a0), (mod));
int64_t b = FLOW_CHECKED_MOD((b0), (mod));
int64_t result = 0;
while (b > 0) {
if (FLOW_CHECKED_MOD((b), (2)) == 1) {
result = FLOW_CHECKED_MOD(((result + a)), (mod));
}
a = FLOW_CHECKED_MOD(((a * 2)), (mod));
b = FLOW_CHECKED_DIV((b), (2));
}
return result;
}
int64_t mod_pow_i64_i64_i64(int64_t base, int64_t exp, int64_t mod) {
if (mod == 1) {
return 0;
}
int64_t result = 1;
int64_t b = FLOW_CHECKED_MOD((base), (mod));
int64_t e = exp;
while (e > 0) {
if (FLOW_CHECKED_MOD((e), (2)) == 1) {
result = mulmod_i64_i64_i64(result, b, mod);
}
b = mulmod_i64_i64_i64(b, b, mod);
e = FLOW_CHECKED_DIV((e), (2));
}
return result;
}
bool is_prime_i64(int64_t n) {
if (n < 2) {
return 0;
}
if (n < 4) {
return 1;
}
if ((FLOW_CHECKED_MOD((n), (2)) == 0 || FLOW_CHECKED_MOD((n), (3)) == 0)) {
return 0;
}
int64_t i = 5;
while ((i * i) <= n) {
if ((FLOW_CHECKED_MOD((n), (i)) == 0 || FLOW_CHECKED_MOD((n), ((i + 2))) == 0)) {
return 0;
}
i = (i + 6);
}
return 1;
}
int32_t ctzll_i64(int64_t x) {
if (x == 0) {
return 64;
}
int32_t n = 0;
int64_t v = x;
while (FLOW_CHECKED_MOD((v), (2)) == 0) {
n = (n + 1);
v = FLOW_CHECKED_DIV((v), (2));
}
return n;
}
int32_t mask_any_i64_i64_i64(int64_t w0, int64_t w1, int64_t w2) {
if (((w0 | w1) | w2) != 0) {
return 1;
}
return 0;
}
int32_t mask_lsb_i64_i64_i64(int64_t w0, int64_t w1, int64_t w2) {
if (w0 != 0) {
return ctzll_i64(w0);
}
if (w1 != 0) {
return (64 + ctzll_i64(w1));
}
if (w2 != 0) {
return (128 + ctzll_i64(w2));
}
return (-1);
}
int64_t mask_setbit_i64_i64_i64_i32(int64_t w0, int64_t w1, int64_t w2, int32_t bit) {
if (bit < 64) {
return (w0 | FLOW_CHECKED_SHL((((int64_t)(1))), (bit)));
}
if (bit < 128) {
return (w1 | FLOW_CHECKED_SHL((((int64_t)(1))), ((bit - 64))));
}
return (w2 | FLOW_CHECKED_SHL((((int64_t)(1))), ((bit - 128))));
}
void add_small_vector_i64_i64_i64(int64_t v0, int64_t v1, int64_t v2) {
int64_t w0 = v0;
int64_t w1 = v1;
int64_t w2 = v2;
while (mask_any_i64_i64_i64(w0, w1, w2) != 0) {
int32_t lb = mask_lsb_i64_i64_i64(w0, w1, w2);
if (lb < 0) {
return;
}
if (g_basis_used[lb] != 0) {
w0 = (w0 ^ g_basis_w0[lb]);
w1 = (w1 ^ g_basis_w1[lb]);
w2 = (w2 ^ g_basis_w2[lb]);
} else {
g_basis_w0[lb] = w0;
g_basis_w1[lb] = w1;
g_basis_w2[lb] = w2;
g_basis_used[lb] = 1;
g_rank_small = (g_rank_small + 1);
return;
}
}
}
int32_t hash_index_i32(int32_t p) {
int64_t prod = (((int64_t)(p)) * ((__int128)0x9E3779B97F4A7C15ULL));
int64_t shifted = (FLOW_CHECKED_SHR((prod), (44)) & (((int64_t)(PIVCAP)) - 1));
return ((int32_t)(shifted));
}
int32_t pivot_get_i32_ptr_i64_ptr_i64_ptr_i64(int32_t p, int64_t* out_w0, int64_t* out_w1, int64_t* out_w2) {
int32_t i = hash_index_i32(p);
while (g_pused[i] != 0) {
if (g_pivot_p[i] == p) {
out_w0[0] = g_pivot_w0[i];
out_w1[0] = g_pivot_w1[i];
out_w2[0] = g_pivot_w2[i];
return 1;
}
i = ((i + 1) & (PIVCAP - 1));
}
return 0;
}
void pivot_set_i32_i64_i64_i64(int32_t p, int64_t w0, int64_t w1, int64_t w2) {
int32_t i = hash_index_i32(p);
while (g_pused[i] != 0) {
if (g_pivot_p[i] == p) {
g_pivot_w0[i] = w0;
g_pivot_w1[i] = w1;
g_pivot_w2[i] = w2;
return;
}
i = ((i + 1) & (PIVCAP - 1));
}
g_pused[i] = 1;
g_pivot_p[i] = p;
g_pivot_w0[i] = w0;
g_pivot_w1[i] = w1;
g_pivot_w2[i] = w2;
g_pivot_count = (g_pivot_count + 1);
}
int32_t main(void) {
int32_t a = 1000000;
int32_t b = 1234567;
int32_t m = ((b - a) + 1);
int32_t T = ((int32_t)(sqrt(((double)(b)))));
int8_t* is_prime = (int8_t*)(calloc(((int64_t)((T + 1))), 1));
int32_t* small_primes = (int32_t*)(calloc(((int64_t)((T + 1))), 4));
int32_t spc = 0;
int32_t ii = 0;
while (ii <= T) {
is_prime[ii] = 1;
ii = (ii + 1);
}
is_prime[0] = 0;
is_prime[1] = 0;
int32_t i = 2;
while ((((int64_t)(i)) * ((int64_t)(i))) <= ((int64_t)(T))) {
if (is_prime[i] != 0) {
int32_t j = (i * i);
while (j <= T) {
is_prime[j] = 0;
j = (j + i);
}
}
i = (i + 1);
}
int32_t i2 = 2;
while (i2 <= T) {
if (is_prime[i2] != 0) {
small_primes[spc] = i2;
spc = (spc + 1);
}
i2 = (i2 + 1);
}
int32_t* small_bit_idx = (int32_t*)(calloc(((int64_t)((T + 1))), 4));
int32_t i3 = 0;
while (i3 < spc) {
small_bit_idx[small_primes[i3]] = i3;
i3 = (i3 + 1);
}
int32_t* spf = (int32_t*)(calloc(((int64_t)((b + 1))), 4));
int32_t* primes = (int32_t*)(calloc(((int64_t)((FLOW_CHECKED_DIV((b), (5)) + 10))), 4));
int32_t pc = 0;
int32_t i4 = 2;
while (i4 <= b) {
if (spf[i4] == 0) {
spf[i4] = i4;
primes[pc] = i4;
pc = (pc + 1);
}
int32_t j = 0;
while (j < pc) {
int64_t v = (((int64_t)(i4)) * ((int64_t)(primes[j])));
if (v > ((int64_t)(b))) {
break;
}
spf[((int32_t)(v))] = primes[j];
if (primes[j] == spf[i4]) {
break;
}
j = (j + 1);
}
i4 = (i4 + 1);
}
g_basis_w0 = calloc(((int64_t)((spc + 1))), 8);
g_basis_w1 = calloc(((int64_t)((spc + 1))), 8);
g_basis_w2 = calloc(((int64_t)((spc + 1))), 8);
g_basis_used = calloc(((int64_t)((spc + 1))), 1);
g_rank_small = 0;
g_pivot_p = calloc(((int64_t)(PIVCAP)), 4);
g_pivot_w0 = calloc(((int64_t)(PIVCAP)), 8);
g_pivot_w1 = calloc(((int64_t)(PIVCAP)), 8);
g_pivot_w2 = calloc(((int64_t)(PIVCAP)), 8);
g_pused = calloc(((int64_t)(PIVCAP)), 1);
g_pivot_count = 0;
int32_t n = a;
while (n <= b) {
int32_t x = n;
int64_t sm0 = 0;
int64_t sm1 = 0;
int64_t sm2 = 0;
int32_t big_prime = 0;
while (x > 1) {
int32_t p = spf[x];
int32_t e = 0;
while (FLOW_CHECKED_MOD((x), (p)) == 0) {
x = FLOW_CHECKED_DIV((x), (p));
e = (e + 1);
}
if (FLOW_CHECKED_MOD((e), (2)) == 1) {
if (p <= T) {
int32_t bit = small_bit_idx[p];
if (bit < 64) {
sm0 = (sm0 | FLOW_CHECKED_SHL((((int64_t)(1))), (bit)));
} else {
if (bit < 128) {
sm1 = (sm1 | FLOW_CHECKED_SHL((((int64_t)(1))), ((bit - 64))));
} else {
sm2 = (sm2 | FLOW_CHECKED_SHL((((int64_t)(1))), ((bit - 128))));
}
}
} else {
big_prime = p;
}
}
}
if (big_prime == 0) {
add_small_vector_i64_i64_i64(sm0, sm1, sm2);
} else {
int64_t* pw0 = (int64_t*)(malloc(8));
int64_t* pw1 = (int64_t*)(malloc(8));
int64_t* pw2 = (int64_t*)(malloc(8));
int32_t found = pivot_get_i32_ptr_i64_ptr_i64_ptr_i64(big_prime, pw0, pw1, pw2);
if (found == 0) {
pivot_set_i32_i64_i64_i64(big_prime, sm0, sm1, sm2);
} else {
add_small_vector_i64_i64_i64((pw0[0] ^ sm0), (pw1[0] ^ sm1), (pw2[0] ^ sm2));
}
free(pw0);
free(pw1);
free(pw2);
}
n = (n + 1);
}
int32_t rank = (g_pivot_count + g_rank_small);
int64_t ans = (mod_pow_i64_i64_i64(2, ((int64_t)((m - rank))), MOD) - 1);
if (ans < 0) {
ans = (ans + MOD);
}
printf("%lld\n", ans);
free(is_prime);
free(small_primes);
free(small_bit_idx);
free(spf);
free(primes);
free(g_basis_w0);
free(g_basis_w1);
free(g_basis_w2);
free(g_basis_used);
free(g_pivot_p);
free(g_pivot_w0);
free(g_pivot_w1);
free(g_pivot_w2);
free(g_pused);
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 @gcd(%arg0: i64, %arg1: i64) -> i64 {
%0 = llvm.mlir.constant(1 : i64) : i64
%1 = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %1 : i64, !llvm.ptr
%2 = llvm.mlir.constant(1 : i64) : i64
%3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %3 : i64, !llvm.ptr
cf.br ^bb0
^bb0:
%4 = llvm.load %3 : !llvm.ptr -> i64
%5 = arith.constant 0 : i32
%7 = arith.extsi %5 : i32 to i64
%6 = arith.cmpi ne, %4, %7 : i64
cf.cond_br %6, ^bb1, ^bb2
^bb1:
%8 = llvm.load %1 : !llvm.ptr -> i64
%9 = llvm.load %3 : !llvm.ptr -> i64
%10 = arith.remsi %8, %9 : i64
%11 = llvm.load %3 : !llvm.ptr -> i64
llvm.store %11, %1 : i64, !llvm.ptr
llvm.store %10, %3 : i64, !llvm.ptr
cf.br ^bb0
^bb2:
%12 = llvm.load %1 : !llvm.ptr -> i64
func.return %12 : i64
}
func.func @lcm(%arg0: i64, %arg1: i64) -> i64 {
%13 = arith.constant 0 : i32
%15 = arith.extsi %13 : i32 to i64
%14 = arith.cmpi eq, %arg0, %15 : i64
%16 = scf.if %14 -> (i1) {
%17 = arith.constant true
scf.yield %17 : i1
} else {
%18 = arith.constant 0 : i32
%20 = arith.extsi %18 : i32 to i64
%19 = arith.cmpi eq, %arg1, %20 : i64
scf.yield %19 : i1
}
cf.cond_br %16, ^bb3, ^bb4
^bb3:
%21 = arith.constant 0 : i32
%22 = arith.extsi %21 : i32 to i64
func.return %22 : i64
^bb4:
cf.br ^bb5
^bb5:
%23 = func.call @gcd(%arg0, %arg1) : (i64, i64) -> i64
%24 = arith.divsi %arg0, %23 : i64
%25 = arith.muli %24, %arg1 : i64
func.return %25 : i64
}
func.func @isqrt(%arg0: i64) -> i64 {
%26 = arith.constant 2 : i32
%28 = arith.extsi %26 : i32 to i64
%27 = arith.cmpi slt, %arg0, %28 : i64
cf.cond_br %27, ^bb6, ^bb7
^bb6:
func.return %arg0 : i64
^bb7:
cf.br ^bb8
^bb8:
%29 = llvm.mlir.constant(1 : i64) : i64
%30 = llvm.alloca %29 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %30 : i64, !llvm.ptr
%31 = llvm.load %30 : !llvm.ptr -> i64
%32 = arith.constant 1 : i32
%34 = arith.extsi %32 : i32 to i64
%33 = arith.addi %31, %34 : i64
%35 = arith.constant 2 : i32
%37 = arith.extsi %35 : i32 to i64
%36 = arith.divsi %33, %37 : i64
%38 = llvm.mlir.constant(1 : i64) : i64
%39 = llvm.alloca %38 x i64 : (i64) -> !llvm.ptr
llvm.store %36, %39 : i64, !llvm.ptr
cf.br ^bb9
^bb9:
%40 = llvm.load %39 : !llvm.ptr -> i64
%41 = llvm.load %30 : !llvm.ptr -> i64
%42 = arith.cmpi slt, %40, %41 : i64
cf.cond_br %42, ^bb10, ^bb11
^bb10:
%43 = llvm.load %39 : !llvm.ptr -> i64
llvm.store %43, %30 : i64, !llvm.ptr
%44 = llvm.load %30 : !llvm.ptr -> i64
%45 = llvm.load %30 : !llvm.ptr -> i64
%46 = arith.divsi %arg0, %45 : i64
%47 = arith.addi %44, %46 : i64
%48 = arith.constant 2 : i32
%50 = arith.extsi %48 : i32 to i64
%49 = arith.divsi %47, %50 : i64
llvm.store %49, %39 : i64, !llvm.ptr
cf.br ^bb9
^bb11:
%51 = llvm.load %30 : !llvm.ptr -> i64
func.return %51 : i64
}
func.func @mulmod(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
%52 = arith.remsi %arg0, %arg2 : i64
%53 = llvm.mlir.constant(1 : i64) : i64
%54 = llvm.alloca %53 x i64 : (i64) -> !llvm.ptr
llvm.store %52, %54 : i64, !llvm.ptr
%55 = arith.remsi %arg1, %arg2 : i64
%56 = llvm.mlir.constant(1 : i64) : i64
%57 = llvm.alloca %56 x i64 : (i64) -> !llvm.ptr
llvm.store %55, %57 : i64, !llvm.ptr
%58 = arith.constant 0 : i32
%59 = arith.extsi %58 : i32 to i64
%60 = llvm.mlir.constant(1 : i64) : i64
%61 = llvm.alloca %60 x i64 : (i64) -> !llvm.ptr
llvm.store %59, %61 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%62 = llvm.load %57 : !llvm.ptr -> i64
%63 = arith.constant 0 : i32
%65 = arith.extsi %63 : i32 to i64
%64 = arith.cmpi sgt, %62, %65 : i64
cf.cond_br %64, ^bb13, ^bb14
^bb13:
%66 = llvm.load %57 : !llvm.ptr -> i64
%67 = arith.constant 2 : i32
%69 = arith.extsi %67 : i32 to i64
%68 = arith.remsi %66, %69 : i64
%70 = arith.constant 1 : i32
%72 = arith.extsi %70 : i32 to i64
%71 = arith.cmpi eq, %68, %72 : i64
cf.cond_br %71, ^bb15, ^bb16
^bb15:
%73 = llvm.load %61 : !llvm.ptr -> i64
%74 = llvm.load %54 : !llvm.ptr -> i64
%75 = arith.addi %73, %74 : i64
%76 = arith.remsi %75, %arg2 : i64
llvm.store %76, %61 : i64, !llvm.ptr
cf.br ^bb17
^bb16:
cf.br ^bb17
^bb17:
%77 = llvm.load %54 : !llvm.ptr -> i64
%78 = arith.constant 2 : i32
%80 = arith.extsi %78 : i32 to i64
%79 = arith.muli %77, %80 : i64
%81 = arith.remsi %79, %arg2 : i64
llvm.store %81, %54 : i64, !llvm.ptr
%82 = llvm.load %57 : !llvm.ptr -> i64
%83 = arith.constant 2 : i32
%85 = arith.extsi %83 : i32 to i64
%84 = arith.divsi %82, %85 : i64
llvm.store %84, %57 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%86 = llvm.load %61 : !llvm.ptr -> i64
func.return %86 : i64
}
func.func @mod_pow(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
%87 = arith.constant 1 : i32
%89 = arith.extsi %87 : i32 to i64
%88 = arith.cmpi eq, %arg2, %89 : i64
cf.cond_br %88, ^bb18, ^bb19
^bb18:
%90 = arith.constant 0 : i32
%91 = arith.extsi %90 : i32 to i64
func.return %91 : i64
^bb19:
cf.br ^bb20
^bb20:
%92 = arith.constant 1 : i32
%93 = arith.extsi %92 : i32 to i64
%94 = llvm.mlir.constant(1 : i64) : i64
%95 = llvm.alloca %94 x i64 : (i64) -> !llvm.ptr
llvm.store %93, %95 : i64, !llvm.ptr
%96 = arith.remsi %arg0, %arg2 : i64
%97 = llvm.mlir.constant(1 : i64) : i64
%98 = llvm.alloca %97 x i64 : (i64) -> !llvm.ptr
llvm.store %96, %98 : i64, !llvm.ptr
%99 = llvm.mlir.constant(1 : i64) : i64
%100 = llvm.alloca %99 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %100 : i64, !llvm.ptr
cf.br ^bb21
^bb21:
%101 = llvm.load %100 : !llvm.ptr -> i64
%102 = arith.constant 0 : i32
%104 = arith.extsi %102 : i32 to i64
%103 = arith.cmpi sgt, %101, %104 : i64
cf.cond_br %103, ^bb22, ^bb23
^bb22:
%105 = llvm.load %100 : !llvm.ptr -> i64
%106 = arith.constant 2 : i32
%108 = arith.extsi %106 : i32 to i64
%107 = arith.remsi %105, %108 : i64
%109 = arith.constant 1 : i32
%111 = arith.extsi %109 : i32 to i64
%110 = arith.cmpi eq, %107, %111 : i64
cf.cond_br %110, ^bb24, ^bb25
^bb24:
%113 = llvm.load %95 : !llvm.ptr -> i64
%114 = llvm.load %98 : !llvm.ptr -> i64
%112 = func.call @mulmod(%113, %114, %arg2) : (i64, i64, i64) -> i64
llvm.store %112, %95 : i64, !llvm.ptr
cf.br ^bb26
^bb25:
cf.br ^bb26
^bb26:
%116 = llvm.load %98 : !llvm.ptr -> i64
%117 = llvm.load %98 : !llvm.ptr -> i64
%115 = func.call @mulmod(%116, %117, %arg2) : (i64, i64, i64) -> i64
llvm.store %115, %98 : i64, !llvm.ptr
%118 = llvm.load %100 : !llvm.ptr -> i64
%119 = arith.constant 2 : i32
%121 = arith.extsi %119 : i32 to i64
%120 = arith.divsi %118, %121 : i64
llvm.store %120, %100 : i64, !llvm.ptr
cf.br ^bb21
^bb23:
%122 = llvm.load %95 : !llvm.ptr -> i64
func.return %122 : i64
}
func.func @is_prime(%arg0: i64) -> i1 {
%123 = arith.constant 2 : i32
%125 = arith.extsi %123 : i32 to i64
%124 = arith.cmpi slt, %arg0, %125 : i64
cf.cond_br %124, ^bb27, ^bb28
^bb27:
%126 = arith.constant 0 : i1
func.return %126 : i1
^bb28:
cf.br ^bb29
^bb29:
%127 = arith.constant 4 : i32
%129 = arith.extsi %127 : i32 to i64
%128 = arith.cmpi slt, %arg0, %129 : i64
cf.cond_br %128, ^bb30, ^bb31
^bb30:
%130 = arith.constant 1 : i1
func.return %130 : i1
^bb31:
cf.br ^bb32
^bb32:
%131 = arith.constant 2 : i32
%133 = arith.extsi %131 : i32 to i64
%132 = arith.remsi %arg0, %133 : i64
%134 = arith.constant 0 : i32
%136 = arith.extsi %134 : i32 to i64
%135 = arith.cmpi eq, %132, %136 : i64
%137 = scf.if %135 -> (i1) {
%138 = arith.constant true
scf.yield %138 : i1
} else {
%139 = arith.constant 3 : i32
%141 = arith.extsi %139 : i32 to i64
%140 = arith.remsi %arg0, %141 : i64
%142 = arith.constant 0 : i32
%144 = arith.extsi %142 : i32 to i64
%143 = arith.cmpi eq, %140, %144 : i64
scf.yield %143 : i1
}
cf.cond_br %137, ^bb33, ^bb34
^bb33:
%145 = arith.constant 0 : i1
func.return %145 : i1
^bb34:
cf.br ^bb35
^bb35:
%146 = arith.constant 5 : i32
%147 = arith.extsi %146 : i32 to i64
%148 = llvm.mlir.constant(1 : i64) : i64
%149 = llvm.alloca %148 x i64 : (i64) -> !llvm.ptr
llvm.store %147, %149 : i64, !llvm.ptr
cf.br ^bb36
^bb36:
%150 = llvm.load %149 : !llvm.ptr -> i64
%151 = llvm.load %149 : !llvm.ptr -> i64
%152 = arith.muli %150, %151 : i64
%153 = arith.cmpi sle, %152, %arg0 : i64
cf.cond_br %153, ^bb37, ^bb38
^bb37:
%154 = llvm.load %149 : !llvm.ptr -> i64
%155 = arith.remsi %arg0, %154 : i64
%156 = arith.constant 0 : i32
%158 = arith.extsi %156 : i32 to i64
%157 = arith.cmpi eq, %155, %158 : i64
%159 = scf.if %157 -> (i1) {
%160 = arith.constant true
scf.yield %160 : i1
} else {
%161 = llvm.load %149 : !llvm.ptr -> i64
%162 = arith.constant 2 : i32
%164 = arith.extsi %162 : i32 to i64
%163 = arith.addi %161, %164 : i64
%165 = arith.remsi %arg0, %163 : i64
%166 = arith.constant 0 : i32
%168 = arith.extsi %166 : i32 to i64
%167 = arith.cmpi eq, %165, %168 : i64
scf.yield %167 : i1
}
cf.cond_br %159, ^bb39, ^bb40
^bb39:
%169 = arith.constant 0 : i1
func.return %169 : i1
^bb40:
cf.br ^bb41
^bb41:
%170 = llvm.load %149 : !llvm.ptr -> i64
%171 = arith.constant 6 : i32
%173 = arith.extsi %171 : i32 to i64
%172 = arith.addi %170, %173 : i64
llvm.store %172, %149 : i64, !llvm.ptr
cf.br ^bb36
^bb38:
%174 = arith.constant 1 : i1
func.return %174 : i1
}
// Constant: MOD
llvm.mlir.global internal constant @MOD(1000000007 : i64) : i64
// Constant: PIVCAP
llvm.mlir.global internal constant @PIVCAP(1048576 : i32) : i32
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 @ctzll(%arg0: i64) -> i32 {
%175 = arith.constant 0 : i32
%177 = arith.extsi %175 : i32 to i64
%176 = arith.cmpi eq, %arg0, %177 : i64
cf.cond_br %176, ^bb42, ^bb43
^bb42:
%178 = arith.constant 64 : i32
func.return %178 : i32
^bb43:
cf.br ^bb44
^bb44:
%179 = arith.constant 0 : i32
%180 = llvm.mlir.constant(1 : i64) : i64
%181 = llvm.alloca %180 x i32 : (i64) -> !llvm.ptr
llvm.store %179, %181 : i32, !llvm.ptr
%182 = llvm.mlir.constant(1 : i64) : i64
%183 = llvm.alloca %182 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %183 : i64, !llvm.ptr
cf.br ^bb45
^bb45:
%184 = llvm.load %183 : !llvm.ptr -> i64
%185 = arith.constant 2 : i32
%187 = arith.extsi %185 : i32 to i64
%186 = arith.remsi %184, %187 : i64
%188 = arith.constant 0 : i32
%190 = arith.extsi %188 : i32 to i64
%189 = arith.cmpi eq, %186, %190 : i64
cf.cond_br %189, ^bb46, ^bb47
^bb46:
%191 = llvm.load %181 : !llvm.ptr -> i32
%192 = arith.constant 1 : i32
%193 = arith.addi %191, %192 : i32
llvm.store %193, %181 : i32, !llvm.ptr
%194 = llvm.load %183 : !llvm.ptr -> i64
%195 = arith.constant 2 : i32
%197 = arith.extsi %195 : i32 to i64
%196 = arith.divsi %194, %197 : i64
llvm.store %196, %183 : i64, !llvm.ptr
cf.br ^bb45
^bb47:
%198 = llvm.load %181 : !llvm.ptr -> i32
func.return %198 : i32
}
// Module static: g_basis_w0
llvm.mlir.global internal @g_basis_w0() {addr_space = 0 : i32} : !llvm.ptr {
%199 = llvm.mlir.zero : !llvm.ptr
llvm.return %199 : !llvm.ptr
}
// Module static: g_basis_w1
llvm.mlir.global internal @g_basis_w1() {addr_space = 0 : i32} : !llvm.ptr {
%200 = llvm.mlir.zero : !llvm.ptr
llvm.return %200 : !llvm.ptr
}
// Module static: g_basis_w2
llvm.mlir.global internal @g_basis_w2() {addr_space = 0 : i32} : !llvm.ptr {
%201 = llvm.mlir.zero : !llvm.ptr
llvm.return %201 : !llvm.ptr
}
// Module static: g_basis_used
llvm.mlir.global internal @g_basis_used() {addr_space = 0 : i32} : !llvm.ptr {
%202 = llvm.mlir.zero : !llvm.ptr
llvm.return %202 : !llvm.ptr
}
// Module static: g_rank_small
llvm.mlir.global internal @g_rank_small(0 : i32) : i32
func.func @mask_any(%arg0: i64, %arg1: i64, %arg2: i64) -> i32 {
%203 = arith.ori %arg0, %arg1 : i64
%204 = arith.ori %203, %arg2 : i64
%205 = arith.constant 0 : i32
%207 = arith.extsi %205 : i32 to i64
%206 = arith.cmpi ne, %204, %207 : i64
cf.cond_br %206, ^bb48, ^bb49
^bb48:
%208 = arith.constant 1 : i32
func.return %208 : i32
^bb49:
cf.br ^bb50
^bb50:
%209 = arith.constant 0 : i32
func.return %209 : i32
}
func.func @mask_lsb(%arg0: i64, %arg1: i64, %arg2: i64) -> i32 {
%210 = arith.constant 0 : i32
%212 = arith.extsi %210 : i32 to i64
%211 = arith.cmpi ne, %arg0, %212 : i64
cf.cond_br %211, ^bb51, ^bb52
^bb51:
%213 = func.call @ctzll(%arg0) : (i64) -> i32
func.return %213 : i32
^bb52:
cf.br ^bb53
^bb53:
%214 = arith.constant 0 : i32
%216 = arith.extsi %214 : i32 to i64
%215 = arith.cmpi ne, %arg1, %216 : i64
cf.cond_br %215, ^bb54, ^bb55
^bb54:
%217 = arith.constant 64 : i32
%218 = func.call @ctzll(%arg1) : (i64) -> i32
%219 = arith.addi %217, %218 : i32
func.return %219 : i32
^bb55:
cf.br ^bb56
^bb56:
%220 = arith.constant 0 : i32
%222 = arith.extsi %220 : i32 to i64
%221 = arith.cmpi ne, %arg2, %222 : i64
cf.cond_br %221, ^bb57, ^bb58
^bb57:
%223 = arith.constant 128 : i32
%224 = func.call @ctzll(%arg2) : (i64) -> i32
%225 = arith.addi %223, %224 : i32
func.return %225 : i32
^bb58:
cf.br ^bb59
^bb59:
%226 = arith.constant 1 : i32
%228 = arith.constant 0 : i32
%227 = arith.subi %228, %226 : i32
func.return %227 : i32
}
func.func @mask_setbit(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i32) -> i64 {
%229 = arith.constant 64 : i32
%230 = arith.cmpi slt, %arg3, %229 : i32
cf.cond_br %230, ^bb60, ^bb61
^bb60:
%231 = arith.constant 1 : i32
%232 = arith.extsi %231 : i32 to i64
%234 = arith.extsi %arg3 : i32 to i64
%233 = arith.shli %232, %234 : i64
%235 = arith.ori %arg0, %233 : i64
func.return %235 : i64
^bb61:
cf.br ^bb62
^bb62:
%236 = arith.constant 128 : i32
%237 = arith.cmpi slt, %arg3, %236 : i32
cf.cond_br %237, ^bb63, ^bb64
^bb63:
%238 = arith.constant 1 : i32
%239 = arith.extsi %238 : i32 to i64
%240 = arith.constant 64 : i32
%241 = arith.subi %arg3, %240 : i32
%243 = arith.extsi %241 : i32 to i64
%242 = arith.shli %239, %243 : i64
%244 = arith.ori %arg1, %242 : i64
func.return %244 : i64
^bb64:
cf.br ^bb65
^bb65:
%245 = arith.constant 1 : i32
%246 = arith.extsi %245 : i32 to i64
%247 = arith.constant 128 : i32
%248 = arith.subi %arg3, %247 : i32
%250 = arith.extsi %248 : i32 to i64
%249 = arith.shli %246, %250 : i64
%251 = arith.ori %arg2, %249 : i64
func.return %251 : i64
}
func.func @add_small_vector(%arg0: i64, %arg1: i64, %arg2: i64) -> () {
%252 = llvm.mlir.constant(1 : i64) : i64
%253 = llvm.alloca %252 x i64 : (i64) -> !llvm.ptr
llvm.store %arg0, %253 : i64, !llvm.ptr
%254 = llvm.mlir.constant(1 : i64) : i64
%255 = llvm.alloca %254 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %255 : i64, !llvm.ptr
%256 = llvm.mlir.constant(1 : i64) : i64
%257 = llvm.alloca %256 x i64 : (i64) -> !llvm.ptr
llvm.store %arg2, %257 : i64, !llvm.ptr
cf.br ^bb66
^bb66:
%259 = llvm.load %253 : !llvm.ptr -> i64
%260 = llvm.load %255 : !llvm.ptr -> i64
%261 = llvm.load %257 : !llvm.ptr -> i64
%258 = func.call @mask_any(%259, %260, %261) : (i64, i64, i64) -> i32
%262 = arith.constant 0 : i32
%263 = arith.cmpi ne, %258, %262 : i32
cf.cond_br %263, ^bb67, ^bb68
^bb67:
%265 = llvm.load %253 : !llvm.ptr -> i64
%266 = llvm.load %255 : !llvm.ptr -> i64
%267 = llvm.load %257 : !llvm.ptr -> i64
%264 = func.call @mask_lsb(%265, %266, %267) : (i64, i64, i64) -> i32
%268 = arith.constant 0 : i32
%269 = arith.cmpi slt, %264, %268 : i32
cf.cond_br %269, ^bb69, ^bb70
^bb69:
func.return
^bb70:
cf.br ^bb71
^bb71:
%271 = llvm.mlir.addressof @g_basis_used : !llvm.ptr
%272 = llvm.load %271 : !llvm.ptr -> !llvm.ptr
%273 = arith.extsi %264 : i32 to i64
%274 = llvm.getelementptr %272[%273] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%270 = llvm.load %274 : !llvm.ptr -> i8
%275 = arith.constant 0 : i32
%277 = arith.extsi %270 : i8 to i32
%276 = arith.cmpi ne, %277, %275 : i32
cf.cond_br %276, ^bb72, ^bb73
^bb72:
%278 = llvm.load %253 : !llvm.ptr -> i64
%280 = llvm.mlir.addressof @g_basis_w0 : !llvm.ptr
%281 = llvm.load %280 : !llvm.ptr -> !llvm.ptr
%282 = arith.extsi %264 : i32 to i64
%283 = llvm.getelementptr %281[%282] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%279 = llvm.load %283 : !llvm.ptr -> i64
%284 = arith.xori %278, %279 : i64
llvm.store %284, %253 : i64, !llvm.ptr
%285 = llvm.load %255 : !llvm.ptr -> i64
%287 = llvm.mlir.addressof @g_basis_w1 : !llvm.ptr
%288 = llvm.load %287 : !llvm.ptr -> !llvm.ptr
%289 = arith.extsi %264 : i32 to i64
%290 = llvm.getelementptr %288[%289] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%286 = llvm.load %290 : !llvm.ptr -> i64
%291 = arith.xori %285, %286 : i64
llvm.store %291, %255 : i64, !llvm.ptr
%292 = llvm.load %257 : !llvm.ptr -> i64
%294 = llvm.mlir.addressof @g_basis_w2 : !llvm.ptr
%295 = llvm.load %294 : !llvm.ptr -> !llvm.ptr
%296 = arith.extsi %264 : i32 to i64
%297 = llvm.getelementptr %295[%296] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%293 = llvm.load %297 : !llvm.ptr -> i64
%298 = arith.xori %292, %293 : i64
llvm.store %298, %257 : i64, !llvm.ptr
cf.br ^bb74
^bb73:
%299 = llvm.load %253 : !llvm.ptr -> i64
%300 = llvm.mlir.addressof @g_basis_w0 : !llvm.ptr
%301 = llvm.load %300 : !llvm.ptr -> !llvm.ptr
%302 = arith.extsi %264 : i32 to i64
%303 = llvm.getelementptr %301[%302] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %299, %303 : i64, !llvm.ptr
%304 = llvm.load %255 : !llvm.ptr -> i64
%305 = llvm.mlir.addressof @g_basis_w1 : !llvm.ptr
%306 = llvm.load %305 : !llvm.ptr -> !llvm.ptr
%307 = arith.extsi %264 : i32 to i64
%308 = llvm.getelementptr %306[%307] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %304, %308 : i64, !llvm.ptr
%309 = llvm.load %257 : !llvm.ptr -> i64
%310 = llvm.mlir.addressof @g_basis_w2 : !llvm.ptr
%311 = llvm.load %310 : !llvm.ptr -> !llvm.ptr
%312 = arith.extsi %264 : i32 to i64
%313 = llvm.getelementptr %311[%312] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %309, %313 : i64, !llvm.ptr
%314 = arith.constant 1 : i32
%315 = llvm.mlir.addressof @g_basis_used : !llvm.ptr
%316 = llvm.load %315 : !llvm.ptr -> !llvm.ptr
%317 = arith.trunci %314 : i32 to i8
%318 = arith.extsi %264 : i32 to i64
%319 = llvm.getelementptr %316[%318] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %317, %319 : i8, !llvm.ptr
%320 = llvm.mlir.addressof @g_rank_small : !llvm.ptr
%321 = llvm.load %320 : !llvm.ptr -> i32
%322 = arith.constant 1 : i32
%323 = arith.addi %321, %322 : i32
%324 = llvm.mlir.addressof @g_rank_small : !llvm.ptr
llvm.store %323, %324 : i32, !llvm.ptr
func.return
^bb74:
cf.br ^bb66
^bb68:
func.return
}
// Module static: g_pivot_p
llvm.mlir.global internal @g_pivot_p() {addr_space = 0 : i32} : !llvm.ptr {
%325 = llvm.mlir.zero : !llvm.ptr
llvm.return %325 : !llvm.ptr
}
// Module static: g_pivot_w0
llvm.mlir.global internal @g_pivot_w0() {addr_space = 0 : i32} : !llvm.ptr {
%326 = llvm.mlir.zero : !llvm.ptr
llvm.return %326 : !llvm.ptr
}
// Module static: g_pivot_w1
llvm.mlir.global internal @g_pivot_w1() {addr_space = 0 : i32} : !llvm.ptr {
%327 = llvm.mlir.zero : !llvm.ptr
llvm.return %327 : !llvm.ptr
}
// Module static: g_pivot_w2
llvm.mlir.global internal @g_pivot_w2() {addr_space = 0 : i32} : !llvm.ptr {
%328 = llvm.mlir.zero : !llvm.ptr
llvm.return %328 : !llvm.ptr
}
// Module static: g_pused
llvm.mlir.global internal @g_pused() {addr_space = 0 : i32} : !llvm.ptr {
%329 = llvm.mlir.zero : !llvm.ptr
llvm.return %329 : !llvm.ptr
}
// Module static: g_pivot_count
llvm.mlir.global internal @g_pivot_count(0 : i32) : i32
func.func @hash_index(%arg0: i32) -> i32 {
%330 = arith.extsi %arg0 : i32 to i64
%331 = arith.constant 11400714815028231189 : i32
%333 = arith.extsi %331 : i32 to i64
%332 = arith.muli %330, %333 : i64
%334 = arith.constant 44 : i32
%336 = arith.extsi %334 : i32 to i64
%335 = arith.shrsi %332, %336 : i64
%337 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%338 = llvm.load %337 : !llvm.ptr -> i32
%339 = arith.extsi %338 : i32 to i64
%340 = arith.constant 1 : i32
%342 = arith.extsi %340 : i32 to i64
%341 = arith.subi %339, %342 : i64
%343 = arith.andi %335, %341 : i64
%344 = arith.trunci %343 : i64 to i32
func.return %344 : i32
}
func.func @pivot_get(%arg0: i32, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr) -> i32 {
%345 = func.call @hash_index(%arg0) : (i32) -> i32
%346 = llvm.mlir.constant(1 : i64) : i64
%347 = llvm.alloca %346 x i32 : (i64) -> !llvm.ptr
llvm.store %345, %347 : i32, !llvm.ptr
cf.br ^bb75
^bb75:
%349 = llvm.mlir.addressof @g_pused : !llvm.ptr
%350 = llvm.load %349 : !llvm.ptr -> !llvm.ptr
%351 = llvm.load %347 : !llvm.ptr -> i32
%352 = arith.extsi %351 : i32 to i64
%353 = llvm.getelementptr %350[%352] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%348 = llvm.load %353 : !llvm.ptr -> i8
%354 = arith.constant 0 : i32
%356 = arith.extsi %348 : i8 to i32
%355 = arith.cmpi ne, %356, %354 : i32
cf.cond_br %355, ^bb76, ^bb77
^bb76:
%358 = llvm.mlir.addressof @g_pivot_p : !llvm.ptr
%359 = llvm.load %358 : !llvm.ptr -> !llvm.ptr
%360 = llvm.load %347 : !llvm.ptr -> i32
%361 = arith.extsi %360 : i32 to i64
%362 = llvm.getelementptr %359[%361] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%357 = llvm.load %362 : !llvm.ptr -> i32
%363 = arith.cmpi eq, %357, %arg0 : i32
cf.cond_br %363, ^bb78, ^bb79
^bb78:
%365 = llvm.mlir.addressof @g_pivot_w0 : !llvm.ptr
%366 = llvm.load %365 : !llvm.ptr -> !llvm.ptr
%367 = llvm.load %347 : !llvm.ptr -> i32
%368 = arith.extsi %367 : i32 to i64
%369 = llvm.getelementptr %366[%368] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%364 = llvm.load %369 : !llvm.ptr -> i64
%370 = arith.constant 0 : i32
%371 = arith.extsi %370 : i32 to i64
%372 = llvm.getelementptr %arg1[%371] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %364, %372 : i64, !llvm.ptr
%374 = llvm.mlir.addressof @g_pivot_w1 : !llvm.ptr
%375 = llvm.load %374 : !llvm.ptr -> !llvm.ptr
%376 = llvm.load %347 : !llvm.ptr -> i32
%377 = arith.extsi %376 : i32 to i64
%378 = llvm.getelementptr %375[%377] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%373 = llvm.load %378 : !llvm.ptr -> i64
%379 = arith.constant 0 : i32
%380 = arith.extsi %379 : i32 to i64
%381 = llvm.getelementptr %arg2[%380] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %373, %381 : i64, !llvm.ptr
%383 = llvm.mlir.addressof @g_pivot_w2 : !llvm.ptr
%384 = llvm.load %383 : !llvm.ptr -> !llvm.ptr
%385 = llvm.load %347 : !llvm.ptr -> i32
%386 = arith.extsi %385 : i32 to i64
%387 = llvm.getelementptr %384[%386] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%382 = llvm.load %387 : !llvm.ptr -> i64
%388 = arith.constant 0 : i32
%389 = arith.extsi %388 : i32 to i64
%390 = llvm.getelementptr %arg3[%389] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %382, %390 : i64, !llvm.ptr
%391 = arith.constant 1 : i32
func.return %391 : i32
^bb79:
cf.br ^bb80
^bb80:
%392 = llvm.load %347 : !llvm.ptr -> i32
%393 = arith.constant 1 : i32
%394 = arith.addi %392, %393 : i32
%395 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%396 = llvm.load %395 : !llvm.ptr -> i32
%397 = arith.constant 1 : i32
%398 = arith.subi %396, %397 : i32
%399 = arith.andi %394, %398 : i32
llvm.store %399, %347 : i32, !llvm.ptr
cf.br ^bb75
^bb77:
%400 = arith.constant 0 : i32
func.return %400 : i32
}
func.func @pivot_set(%arg0: i32, %arg1: i64, %arg2: i64, %arg3: i64) -> () {
%401 = func.call @hash_index(%arg0) : (i32) -> i32
%402 = llvm.mlir.constant(1 : i64) : i64
%403 = llvm.alloca %402 x i32 : (i64) -> !llvm.ptr
llvm.store %401, %403 : i32, !llvm.ptr
cf.br ^bb81
^bb81:
%405 = llvm.mlir.addressof @g_pused : !llvm.ptr
%406 = llvm.load %405 : !llvm.ptr -> !llvm.ptr
%407 = llvm.load %403 : !llvm.ptr -> i32
%408 = arith.extsi %407 : i32 to i64
%409 = llvm.getelementptr %406[%408] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%404 = llvm.load %409 : !llvm.ptr -> i8
%410 = arith.constant 0 : i32
%412 = arith.extsi %404 : i8 to i32
%411 = arith.cmpi ne, %412, %410 : i32
cf.cond_br %411, ^bb82, ^bb83
^bb82:
%414 = llvm.mlir.addressof @g_pivot_p : !llvm.ptr
%415 = llvm.load %414 : !llvm.ptr -> !llvm.ptr
%416 = llvm.load %403 : !llvm.ptr -> i32
%417 = arith.extsi %416 : i32 to i64
%418 = llvm.getelementptr %415[%417] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%413 = llvm.load %418 : !llvm.ptr -> i32
%419 = arith.cmpi eq, %413, %arg0 : i32
cf.cond_br %419, ^bb84, ^bb85
^bb84:
%420 = llvm.mlir.addressof @g_pivot_w0 : !llvm.ptr
%421 = llvm.load %420 : !llvm.ptr -> !llvm.ptr
%422 = llvm.load %403 : !llvm.ptr -> i32
%423 = arith.extsi %422 : i32 to i64
%424 = llvm.getelementptr %421[%423] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg1, %424 : i64, !llvm.ptr
%425 = llvm.mlir.addressof @g_pivot_w1 : !llvm.ptr
%426 = llvm.load %425 : !llvm.ptr -> !llvm.ptr
%427 = llvm.load %403 : !llvm.ptr -> i32
%428 = arith.extsi %427 : i32 to i64
%429 = llvm.getelementptr %426[%428] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg2, %429 : i64, !llvm.ptr
%430 = llvm.mlir.addressof @g_pivot_w2 : !llvm.ptr
%431 = llvm.load %430 : !llvm.ptr -> !llvm.ptr
%432 = llvm.load %403 : !llvm.ptr -> i32
%433 = arith.extsi %432 : i32 to i64
%434 = llvm.getelementptr %431[%433] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg3, %434 : i64, !llvm.ptr
func.return
^bb85:
cf.br ^bb86
^bb86:
%435 = llvm.load %403 : !llvm.ptr -> i32
%436 = arith.constant 1 : i32
%437 = arith.addi %435, %436 : i32
%438 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%439 = llvm.load %438 : !llvm.ptr -> i32
%440 = arith.constant 1 : i32
%441 = arith.subi %439, %440 : i32
%442 = arith.andi %437, %441 : i32
llvm.store %442, %403 : i32, !llvm.ptr
cf.br ^bb81
^bb83:
%443 = arith.constant 1 : i32
%444 = llvm.mlir.addressof @g_pused : !llvm.ptr
%445 = llvm.load %444 : !llvm.ptr -> !llvm.ptr
%446 = llvm.load %403 : !llvm.ptr -> i32
%447 = arith.trunci %443 : i32 to i8
%448 = arith.extsi %446 : i32 to i64
%449 = llvm.getelementptr %445[%448] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %447, %449 : i8, !llvm.ptr
%450 = llvm.mlir.addressof @g_pivot_p : !llvm.ptr
%451 = llvm.load %450 : !llvm.ptr -> !llvm.ptr
%452 = llvm.load %403 : !llvm.ptr -> i32
%453 = arith.extsi %452 : i32 to i64
%454 = llvm.getelementptr %451[%453] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %arg0, %454 : i32, !llvm.ptr
%455 = llvm.mlir.addressof @g_pivot_w0 : !llvm.ptr
%456 = llvm.load %455 : !llvm.ptr -> !llvm.ptr
%457 = llvm.load %403 : !llvm.ptr -> i32
%458 = arith.extsi %457 : i32 to i64
%459 = llvm.getelementptr %456[%458] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg1, %459 : i64, !llvm.ptr
%460 = llvm.mlir.addressof @g_pivot_w1 : !llvm.ptr
%461 = llvm.load %460 : !llvm.ptr -> !llvm.ptr
%462 = llvm.load %403 : !llvm.ptr -> i32
%463 = arith.extsi %462 : i32 to i64
%464 = llvm.getelementptr %461[%463] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg2, %464 : i64, !llvm.ptr
%465 = llvm.mlir.addressof @g_pivot_w2 : !llvm.ptr
%466 = llvm.load %465 : !llvm.ptr -> !llvm.ptr
%467 = llvm.load %403 : !llvm.ptr -> i32
%468 = arith.extsi %467 : i32 to i64
%469 = llvm.getelementptr %466[%468] : (!llvm.ptr, i64) -> !llvm.ptr, i64
llvm.store %arg3, %469 : i64, !llvm.ptr
%470 = llvm.mlir.addressof @g_pivot_count : !llvm.ptr
%471 = llvm.load %470 : !llvm.ptr -> i32
%472 = arith.constant 1 : i32
%473 = arith.addi %471, %472 : i32
%474 = llvm.mlir.addressof @g_pivot_count : !llvm.ptr
llvm.store %473, %474 : i32, !llvm.ptr
func.return
}
func.func @main() -> i32 {
%475 = arith.constant 1000000 : i32
%476 = arith.constant 1234567 : i32
%477 = arith.subi %476, %475 : i32
%478 = arith.constant 1 : i32
%479 = arith.addi %477, %478 : i32
%480 = arith.sitofp %476 : i32 to f64
%481 = math.sqrt %480 : f64
%482 = arith.fptosi %481 : f64 to i32
%484 = arith.constant 1 : i32
%485 = arith.addi %482, %484 : i32
%486 = arith.extsi %485 : i32 to i64
%487 = arith.constant 1 : i32
%488 = arith.extsi %487 : i32 to i64
%483 = func.call @calloc(%486, %488) : (i64, i64) -> !llvm.ptr
%490 = arith.constant 1 : i32
%491 = arith.addi %482, %490 : i32
%492 = arith.extsi %491 : i32 to i64
%493 = arith.constant 4 : i32
%494 = arith.extsi %493 : i32 to i64
%489 = func.call @calloc(%492, %494) : (i64, i64) -> !llvm.ptr
%495 = arith.constant 0 : i32
%496 = llvm.mlir.constant(1 : i64) : i64
%497 = llvm.alloca %496 x i32 : (i64) -> !llvm.ptr
llvm.store %495, %497 : i32, !llvm.ptr
%498 = arith.constant 0 : i32
%499 = llvm.mlir.constant(1 : i64) : i64
%500 = llvm.alloca %499 x i32 : (i64) -> !llvm.ptr
llvm.store %498, %500 : i32, !llvm.ptr
cf.br ^bb87
^bb87:
%501 = llvm.load %500 : !llvm.ptr -> i32
%502 = arith.cmpi sle, %501, %482 : i32
cf.cond_br %502, ^bb88, ^bb89
^bb88:
%503 = arith.constant 1 : i32
%504 = llvm.load %500 : !llvm.ptr -> i32
%505 = arith.trunci %503 : i32 to i8
%506 = arith.extsi %504 : i32 to i64
%507 = llvm.getelementptr %483[%506] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %505, %507 : i8, !llvm.ptr
%508 = llvm.load %500 : !llvm.ptr -> i32
%509 = arith.constant 1 : i32
%510 = arith.addi %508, %509 : i32
llvm.store %510, %500 : i32, !llvm.ptr
cf.br ^bb87
^bb89:
%511 = arith.constant 0 : i32
%512 = arith.constant 0 : i32
%513 = arith.trunci %511 : i32 to i8
%514 = arith.extsi %512 : i32 to i64
%515 = llvm.getelementptr %483[%514] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %513, %515 : i8, !llvm.ptr
%516 = arith.constant 0 : i32
%517 = arith.constant 1 : i32
%518 = arith.trunci %516 : i32 to i8
%519 = arith.extsi %517 : i32 to i64
%520 = llvm.getelementptr %483[%519] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %518, %520 : i8, !llvm.ptr
%521 = arith.constant 2 : i32
%522 = llvm.mlir.constant(1 : i64) : i64
%523 = llvm.alloca %522 x i32 : (i64) -> !llvm.ptr
llvm.store %521, %523 : i32, !llvm.ptr
cf.br ^bb90
^bb90:
%524 = llvm.load %523 : !llvm.ptr -> i32
%525 = arith.extsi %524 : i32 to i64
%526 = llvm.load %523 : !llvm.ptr -> i32
%527 = arith.extsi %526 : i32 to i64
%528 = arith.muli %525, %527 : i64
%529 = arith.extsi %482 : i32 to i64
%530 = arith.cmpi sle, %528, %529 : i64
cf.cond_br %530, ^bb91, ^bb92
^bb91:
%532 = llvm.load %523 : !llvm.ptr -> i32
%533 = arith.extsi %532 : i32 to i64
%534 = llvm.getelementptr %483[%533] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%531 = llvm.load %534 : !llvm.ptr -> i8
%535 = arith.constant 0 : i32
%537 = arith.extsi %531 : i8 to i32
%536 = arith.cmpi ne, %537, %535 : i32
cf.cond_br %536, ^bb93, ^bb94
^bb93:
%538 = llvm.load %523 : !llvm.ptr -> i32
%539 = llvm.load %523 : !llvm.ptr -> i32
%540 = arith.muli %538, %539 : i32
%541 = llvm.mlir.constant(1 : i64) : i64
%542 = llvm.alloca %541 x i32 : (i64) -> !llvm.ptr
llvm.store %540, %542 : i32, !llvm.ptr
cf.br ^bb96
^bb96:
%543 = llvm.load %542 : !llvm.ptr -> i32
%544 = arith.cmpi sle, %543, %482 : i32
cf.cond_br %544, ^bb97, ^bb98
^bb97:
%545 = arith.constant 0 : i32
%546 = llvm.load %542 : !llvm.ptr -> i32
%547 = arith.trunci %545 : i32 to i8
%548 = arith.extsi %546 : i32 to i64
%549 = llvm.getelementptr %483[%548] : (!llvm.ptr, i64) -> !llvm.ptr, i8
llvm.store %547, %549 : i8, !llvm.ptr
%550 = llvm.load %542 : !llvm.ptr -> i32
%551 = llvm.load %523 : !llvm.ptr -> i32
%552 = arith.addi %550, %551 : i32
llvm.store %552, %542 : i32, !llvm.ptr
cf.br ^bb96
^bb98:
cf.br ^bb95
^bb94:
cf.br ^bb95
^bb95:
%553 = llvm.load %523 : !llvm.ptr -> i32
%554 = arith.constant 1 : i32
%555 = arith.addi %553, %554 : i32
llvm.store %555, %523 : i32, !llvm.ptr
cf.br ^bb90
^bb92:
%556 = arith.constant 2 : i32
%557 = llvm.mlir.constant(1 : i64) : i64
%558 = llvm.alloca %557 x i32 : (i64) -> !llvm.ptr
llvm.store %556, %558 : i32, !llvm.ptr
cf.br ^bb99
^bb99:
%559 = llvm.load %558 : !llvm.ptr -> i32
%560 = arith.cmpi sle, %559, %482 : i32
cf.cond_br %560, ^bb100, ^bb101
^bb100:
%562 = llvm.load %558 : !llvm.ptr -> i32
%563 = arith.extsi %562 : i32 to i64
%564 = llvm.getelementptr %483[%563] : (!llvm.ptr, i64) -> !llvm.ptr, i8
%561 = llvm.load %564 : !llvm.ptr -> i8
%565 = arith.constant 0 : i32
%567 = arith.extsi %561 : i8 to i32
%566 = arith.cmpi ne, %567, %565 : i32
cf.cond_br %566, ^bb102, ^bb103
^bb102:
%568 = llvm.load %558 : !llvm.ptr -> i32
%569 = llvm.load %497 : !llvm.ptr -> i32
%570 = arith.extsi %569 : i32 to i64
%571 = llvm.getelementptr %489[%570] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %568, %571 : i32, !llvm.ptr
%572 = llvm.load %497 : !llvm.ptr -> i32
%573 = arith.constant 1 : i32
%574 = arith.addi %572, %573 : i32
llvm.store %574, %497 : i32, !llvm.ptr
cf.br ^bb104
^bb103:
cf.br ^bb104
^bb104:
%575 = llvm.load %558 : !llvm.ptr -> i32
%576 = arith.constant 1 : i32
%577 = arith.addi %575, %576 : i32
llvm.store %577, %558 : i32, !llvm.ptr
cf.br ^bb99
^bb101:
%579 = arith.constant 1 : i32
%580 = arith.addi %482, %579 : i32
%581 = arith.extsi %580 : i32 to i64
%582 = arith.constant 4 : i32
%583 = arith.extsi %582 : i32 to i64
%578 = func.call @calloc(%581, %583) : (i64, i64) -> !llvm.ptr
%584 = arith.constant 0 : i32
%585 = llvm.mlir.constant(1 : i64) : i64
%586 = llvm.alloca %585 x i32 : (i64) -> !llvm.ptr
llvm.store %584, %586 : i32, !llvm.ptr
cf.br ^bb105
^bb105:
%587 = llvm.load %586 : !llvm.ptr -> i32
%588 = llvm.load %497 : !llvm.ptr -> i32
%589 = arith.cmpi slt, %587, %588 : i32
cf.cond_br %589, ^bb106, ^bb107
^bb106:
%590 = llvm.load %586 : !llvm.ptr -> i32
%592 = llvm.load %586 : !llvm.ptr -> i32
%593 = arith.extsi %592 : i32 to i64
%594 = llvm.getelementptr %489[%593] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%591 = llvm.load %594 : !llvm.ptr -> i32
%595 = arith.extsi %591 : i32 to i64
%596 = llvm.getelementptr %578[%595] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %590, %596 : i32, !llvm.ptr
%597 = llvm.load %586 : !llvm.ptr -> i32
%598 = arith.constant 1 : i32
%599 = arith.addi %597, %598 : i32
llvm.store %599, %586 : i32, !llvm.ptr
cf.br ^bb105
^bb107:
%601 = arith.constant 1 : i32
%602 = arith.addi %476, %601 : i32
%603 = arith.extsi %602 : i32 to i64
%604 = arith.constant 4 : i32
%605 = arith.extsi %604 : i32 to i64
%600 = func.call @calloc(%603, %605) : (i64, i64) -> !llvm.ptr
%607 = arith.constant 5 : i32
%608 = arith.divsi %476, %607 : i32
%609 = arith.constant 10 : i32
%610 = arith.addi %608, %609 : i32
%611 = arith.extsi %610 : i32 to i64
%612 = arith.constant 4 : i32
%613 = arith.extsi %612 : i32 to i64
%606 = func.call @calloc(%611, %613) : (i64, i64) -> !llvm.ptr
%614 = arith.constant 0 : i32
%615 = llvm.mlir.constant(1 : i64) : i64
%616 = llvm.alloca %615 x i32 : (i64) -> !llvm.ptr
llvm.store %614, %616 : i32, !llvm.ptr
%617 = arith.constant 2 : i32
%618 = llvm.mlir.constant(1 : i64) : i64
%619 = llvm.alloca %618 x i32 : (i64) -> !llvm.ptr
llvm.store %617, %619 : i32, !llvm.ptr
cf.br ^bb108
^bb108:
%620 = llvm.load %619 : !llvm.ptr -> i32
%621 = arith.cmpi sle, %620, %476 : i32
cf.cond_br %621, ^bb109, ^bb110
^bb109:
%623 = llvm.load %619 : !llvm.ptr -> i32
%624 = arith.extsi %623 : i32 to i64
%625 = llvm.getelementptr %600[%624] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%622 = llvm.load %625 : !llvm.ptr -> i32
%626 = arith.constant 0 : i32
%627 = arith.cmpi eq, %622, %626 : i32
cf.cond_br %627, ^bb111, ^bb112
^bb111:
%628 = llvm.load %619 : !llvm.ptr -> i32
%629 = llvm.load %619 : !llvm.ptr -> i32
%630 = arith.extsi %629 : i32 to i64
%631 = llvm.getelementptr %600[%630] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %628, %631 : i32, !llvm.ptr
%632 = llvm.load %619 : !llvm.ptr -> i32
%633 = llvm.load %616 : !llvm.ptr -> i32
%634 = arith.extsi %633 : i32 to i64
%635 = llvm.getelementptr %606[%634] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %632, %635 : i32, !llvm.ptr
%636 = llvm.load %616 : !llvm.ptr -> i32
%637 = arith.constant 1 : i32
%638 = arith.addi %636, %637 : i32
llvm.store %638, %616 : i32, !llvm.ptr
cf.br ^bb113
^bb112:
cf.br ^bb113
^bb113:
%639 = arith.constant 0 : i32
%640 = llvm.mlir.constant(1 : i64) : i64
%641 = llvm.alloca %640 x i32 : (i64) -> !llvm.ptr
llvm.store %639, %641 : i32, !llvm.ptr
cf.br ^bb114
^bb114:
%642 = llvm.load %641 : !llvm.ptr -> i32
%643 = llvm.load %616 : !llvm.ptr -> i32
%644 = arith.cmpi slt, %642, %643 : i32
cf.cond_br %644, ^bb115, ^bb116
^bb115:
%645 = llvm.load %619 : !llvm.ptr -> i32
%646 = arith.extsi %645 : i32 to i64
%648 = llvm.load %641 : !llvm.ptr -> i32
%649 = arith.extsi %648 : i32 to i64
%650 = llvm.getelementptr %606[%649] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%647 = llvm.load %650 : !llvm.ptr -> i32
%651 = arith.extsi %647 : i32 to i64
%652 = arith.muli %646, %651 : i64
%653 = arith.extsi %476 : i32 to i64
%654 = arith.cmpi sgt, %652, %653 : i64
cf.cond_br %654, ^bb117, ^bb118
^bb117:
cf.br ^bb116
^bb118:
cf.br ^bb119
^bb119:
%656 = llvm.load %641 : !llvm.ptr -> i32
%657 = arith.extsi %656 : i32 to i64
%658 = llvm.getelementptr %606[%657] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%655 = llvm.load %658 : !llvm.ptr -> i32
%659 = arith.trunci %652 : i64 to i32
%660 = arith.extsi %659 : i32 to i64
%661 = llvm.getelementptr %600[%660] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %655, %661 : i32, !llvm.ptr
%663 = llvm.load %641 : !llvm.ptr -> i32
%664 = arith.extsi %663 : i32 to i64
%665 = llvm.getelementptr %606[%664] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%662 = llvm.load %665 : !llvm.ptr -> i32
%667 = llvm.load %619 : !llvm.ptr -> i32
%668 = arith.extsi %667 : i32 to i64
%669 = llvm.getelementptr %600[%668] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%666 = llvm.load %669 : !llvm.ptr -> i32
%670 = arith.cmpi eq, %662, %666 : i32
cf.cond_br %670, ^bb120, ^bb121
^bb120:
cf.br ^bb116
^bb121:
cf.br ^bb122
^bb122:
%671 = llvm.load %641 : !llvm.ptr -> i32
%672 = arith.constant 1 : i32
%673 = arith.addi %671, %672 : i32
llvm.store %673, %641 : i32, !llvm.ptr
cf.br ^bb114
^bb116:
%674 = llvm.load %619 : !llvm.ptr -> i32
%675 = arith.constant 1 : i32
%676 = arith.addi %674, %675 : i32
llvm.store %676, %619 : i32, !llvm.ptr
cf.br ^bb108
^bb110:
%678 = llvm.load %497 : !llvm.ptr -> i32
%679 = arith.constant 1 : i32
%680 = arith.addi %678, %679 : i32
%681 = arith.extsi %680 : i32 to i64
%682 = arith.constant 8 : i32
%683 = arith.extsi %682 : i32 to i64
%677 = func.call @calloc(%681, %683) : (i64, i64) -> !llvm.ptr
%684 = llvm.mlir.addressof @g_basis_w0 : !llvm.ptr
llvm.store %677, %684 : !llvm.ptr, !llvm.ptr
%686 = llvm.load %497 : !llvm.ptr -> i32
%687 = arith.constant 1 : i32
%688 = arith.addi %686, %687 : i32
%689 = arith.extsi %688 : i32 to i64
%690 = arith.constant 8 : i32
%691 = arith.extsi %690 : i32 to i64
%685 = func.call @calloc(%689, %691) : (i64, i64) -> !llvm.ptr
%692 = llvm.mlir.addressof @g_basis_w1 : !llvm.ptr
llvm.store %685, %692 : !llvm.ptr, !llvm.ptr
%694 = llvm.load %497 : !llvm.ptr -> i32
%695 = arith.constant 1 : i32
%696 = arith.addi %694, %695 : i32
%697 = arith.extsi %696 : i32 to i64
%698 = arith.constant 8 : i32
%699 = arith.extsi %698 : i32 to i64
%693 = func.call @calloc(%697, %699) : (i64, i64) -> !llvm.ptr
%700 = llvm.mlir.addressof @g_basis_w2 : !llvm.ptr
llvm.store %693, %700 : !llvm.ptr, !llvm.ptr
%702 = llvm.load %497 : !llvm.ptr -> i32
%703 = arith.constant 1 : i32
%704 = arith.addi %702, %703 : i32
%705 = arith.extsi %704 : i32 to i64
%706 = arith.constant 1 : i32
%707 = arith.extsi %706 : i32 to i64
%701 = func.call @calloc(%705, %707) : (i64, i64) -> !llvm.ptr
%708 = llvm.mlir.addressof @g_basis_used : !llvm.ptr
llvm.store %701, %708 : !llvm.ptr, !llvm.ptr
%709 = arith.constant 0 : i32
%710 = llvm.mlir.addressof @g_rank_small : !llvm.ptr
llvm.store %709, %710 : i32, !llvm.ptr
%712 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%713 = llvm.load %712 : !llvm.ptr -> i32
%714 = arith.extsi %713 : i32 to i64
%715 = arith.constant 4 : i32
%716 = arith.extsi %715 : i32 to i64
%711 = func.call @calloc(%714, %716) : (i64, i64) -> !llvm.ptr
%717 = llvm.mlir.addressof @g_pivot_p : !llvm.ptr
llvm.store %711, %717 : !llvm.ptr, !llvm.ptr
%719 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%720 = llvm.load %719 : !llvm.ptr -> i32
%721 = arith.extsi %720 : i32 to i64
%722 = arith.constant 8 : i32
%723 = arith.extsi %722 : i32 to i64
%718 = func.call @calloc(%721, %723) : (i64, i64) -> !llvm.ptr
%724 = llvm.mlir.addressof @g_pivot_w0 : !llvm.ptr
llvm.store %718, %724 : !llvm.ptr, !llvm.ptr
%726 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%727 = llvm.load %726 : !llvm.ptr -> i32
%728 = arith.extsi %727 : i32 to i64
%729 = arith.constant 8 : i32
%730 = arith.extsi %729 : i32 to i64
%725 = func.call @calloc(%728, %730) : (i64, i64) -> !llvm.ptr
%731 = llvm.mlir.addressof @g_pivot_w1 : !llvm.ptr
llvm.store %725, %731 : !llvm.ptr, !llvm.ptr
%733 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%734 = llvm.load %733 : !llvm.ptr -> i32
%735 = arith.extsi %734 : i32 to i64
%736 = arith.constant 8 : i32
%737 = arith.extsi %736 : i32 to i64
%732 = func.call @calloc(%735, %737) : (i64, i64) -> !llvm.ptr
%738 = llvm.mlir.addressof @g_pivot_w2 : !llvm.ptr
llvm.store %732, %738 : !llvm.ptr, !llvm.ptr
%740 = llvm.mlir.addressof @PIVCAP : !llvm.ptr
%741 = llvm.load %740 : !llvm.ptr -> i32
%742 = arith.extsi %741 : i32 to i64
%743 = arith.constant 1 : i32
%744 = arith.extsi %743 : i32 to i64
%739 = func.call @calloc(%742, %744) : (i64, i64) -> !llvm.ptr
%745 = llvm.mlir.addressof @g_pused : !llvm.ptr
llvm.store %739, %745 : !llvm.ptr, !llvm.ptr
%746 = arith.constant 0 : i32
%747 = llvm.mlir.addressof @g_pivot_count : !llvm.ptr
llvm.store %746, %747 : i32, !llvm.ptr
%748 = llvm.mlir.constant(1 : i64) : i64
%749 = llvm.alloca %748 x i32 : (i64) -> !llvm.ptr
llvm.store %475, %749 : i32, !llvm.ptr
cf.br ^bb123
^bb123:
%750 = llvm.load %749 : !llvm.ptr -> i32
%751 = arith.cmpi sle, %750, %476 : i32
cf.cond_br %751, ^bb124, ^bb125
^bb124:
%752 = llvm.load %749 : !llvm.ptr -> i32
%753 = llvm.mlir.constant(1 : i64) : i64
%754 = llvm.alloca %753 x i32 : (i64) -> !llvm.ptr
llvm.store %752, %754 : i32, !llvm.ptr
%755 = arith.constant 0 : i32
%756 = arith.extsi %755 : i32 to i64
%757 = llvm.mlir.constant(1 : i64) : i64
%758 = llvm.alloca %757 x i64 : (i64) -> !llvm.ptr
llvm.store %756, %758 : i64, !llvm.ptr
%759 = arith.constant 0 : i32
%760 = arith.extsi %759 : i32 to i64
%761 = llvm.mlir.constant(1 : i64) : i64
%762 = llvm.alloca %761 x i64 : (i64) -> !llvm.ptr
llvm.store %760, %762 : i64, !llvm.ptr
%763 = arith.constant 0 : i32
%764 = arith.extsi %763 : i32 to i64
%765 = llvm.mlir.constant(1 : i64) : i64
%766 = llvm.alloca %765 x i64 : (i64) -> !llvm.ptr
llvm.store %764, %766 : i64, !llvm.ptr
%767 = arith.constant 0 : i32
%768 = llvm.mlir.constant(1 : i64) : i64
%769 = llvm.alloca %768 x i32 : (i64) -> !llvm.ptr
llvm.store %767, %769 : i32, !llvm.ptr
cf.br ^bb126
^bb126:
%770 = llvm.load %754 : !llvm.ptr -> i32
%771 = arith.constant 1 : i32
%772 = arith.cmpi sgt, %770, %771 : i32
cf.cond_br %772, ^bb127, ^bb128
^bb127:
%774 = llvm.load %754 : !llvm.ptr -> i32
%775 = arith.extsi %774 : i32 to i64
%776 = llvm.getelementptr %600[%775] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%773 = llvm.load %776 : !llvm.ptr -> i32
%777 = arith.constant 0 : i32
%778 = llvm.mlir.constant(1 : i64) : i64
%779 = llvm.alloca %778 x i32 : (i64) -> !llvm.ptr
llvm.store %777, %779 : i32, !llvm.ptr
cf.br ^bb129
^bb129:
%780 = llvm.load %754 : !llvm.ptr -> i32
%781 = arith.remsi %780, %773 : i32
%782 = arith.constant 0 : i32
%783 = arith.cmpi eq, %781, %782 : i32
cf.cond_br %783, ^bb130, ^bb131
^bb130:
%784 = llvm.load %754 : !llvm.ptr -> i32
%785 = arith.divsi %784, %773 : i32
llvm.store %785, %754 : i32, !llvm.ptr
%786 = llvm.load %779 : !llvm.ptr -> i32
%787 = arith.constant 1 : i32
%788 = arith.addi %786, %787 : i32
llvm.store %788, %779 : i32, !llvm.ptr
cf.br ^bb129
^bb131:
%789 = llvm.load %779 : !llvm.ptr -> i32
%790 = arith.constant 2 : i32
%791 = arith.remsi %789, %790 : i32
%792 = arith.constant 1 : i32
%793 = arith.cmpi eq, %791, %792 : i32
cf.cond_br %793, ^bb132, ^bb133
^bb132:
%794 = arith.cmpi sle, %773, %482 : i32
cf.cond_br %794, ^bb135, ^bb136
^bb135:
%796 = arith.extsi %773 : i32 to i64
%797 = llvm.getelementptr %578[%796] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%795 = llvm.load %797 : !llvm.ptr -> i32
%798 = arith.constant 64 : i32
%799 = arith.cmpi slt, %795, %798 : i32
cf.cond_br %799, ^bb138, ^bb139
^bb138:
%800 = llvm.load %758 : !llvm.ptr -> i64
%801 = arith.constant 1 : i32
%802 = arith.extsi %801 : i32 to i64
%804 = arith.extsi %795 : i32 to i64
%803 = arith.shli %802, %804 : i64
%805 = arith.ori %800, %803 : i64
llvm.store %805, %758 : i64, !llvm.ptr
cf.br ^bb140
^bb139:
%806 = arith.constant 128 : i32
%807 = arith.cmpi slt, %795, %806 : i32
cf.cond_br %807, ^bb141, ^bb142
^bb141:
%808 = llvm.load %762 : !llvm.ptr -> i64
%809 = arith.constant 1 : i32
%810 = arith.extsi %809 : i32 to i64
%811 = arith.constant 64 : i32
%812 = arith.subi %795, %811 : i32
%814 = arith.extsi %812 : i32 to i64
%813 = arith.shli %810, %814 : i64
%815 = arith.ori %808, %813 : i64
llvm.store %815, %762 : i64, !llvm.ptr
cf.br ^bb143
^bb142:
%816 = llvm.load %766 : !llvm.ptr -> i64
%817 = arith.constant 1 : i32
%818 = arith.extsi %817 : i32 to i64
%819 = arith.constant 128 : i32
%820 = arith.subi %795, %819 : i32
%822 = arith.extsi %820 : i32 to i64
%821 = arith.shli %818, %822 : i64
%823 = arith.ori %816, %821 : i64
llvm.store %823, %766 : i64, !llvm.ptr
cf.br ^bb143
^bb143:
cf.br ^bb140
^bb140:
cf.br ^bb137
^bb136:
llvm.store %773, %769 : i32, !llvm.ptr
cf.br ^bb137
^bb137:
cf.br ^bb134
^bb133:
cf.br ^bb134
^bb134:
cf.br ^bb126
^bb128:
%824 = llvm.load %769 : !llvm.ptr -> i32
%825 = arith.constant 0 : i32
%826 = arith.cmpi eq, %824, %825 : i32
cf.cond_br %826, ^bb144, ^bb145
^bb144:
%828 = llvm.load %758 : !llvm.ptr -> i64
%829 = llvm.load %762 : !llvm.ptr -> i64
%830 = llvm.load %766 : !llvm.ptr -> i64
func.call @add_small_vector(%828, %829, %830) : (i64, i64, i64) -> ()
cf.br ^bb146
^bb145:
%832 = arith.constant 8 : i32
%833 = arith.extsi %832 : i32 to i64
%831 = func.call @malloc(%833) : (i64) -> !llvm.ptr
%835 = arith.constant 8 : i32
%836 = arith.extsi %835 : i32 to i64
%834 = func.call @malloc(%836) : (i64) -> !llvm.ptr
%838 = arith.constant 8 : i32
%839 = arith.extsi %838 : i32 to i64
%837 = func.call @malloc(%839) : (i64) -> !llvm.ptr
%841 = llvm.load %769 : !llvm.ptr -> i32
%840 = func.call @pivot_get(%841, %831, %834, %837) : (i32, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> i32
%842 = arith.constant 0 : i32
%843 = arith.cmpi eq, %840, %842 : i32
cf.cond_br %843, ^bb147, ^bb148
^bb147:
%845 = llvm.load %769 : !llvm.ptr -> i32
%846 = llvm.load %758 : !llvm.ptr -> i64
%847 = llvm.load %762 : !llvm.ptr -> i64
%848 = llvm.load %766 : !llvm.ptr -> i64
func.call @pivot_set(%845, %846, %847, %848) : (i32, i64, i64, i64) -> ()
cf.br ^bb149
^bb148:
%851 = arith.constant 0 : i32
%852 = arith.extsi %851 : i32 to i64
%853 = llvm.getelementptr %831[%852] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%850 = llvm.load %853 : !llvm.ptr -> i64
%854 = llvm.load %758 : !llvm.ptr -> i64
%855 = arith.xori %850, %854 : i64
%857 = arith.constant 0 : i32
%858 = arith.extsi %857 : i32 to i64
%859 = llvm.getelementptr %834[%858] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%856 = llvm.load %859 : !llvm.ptr -> i64
%860 = llvm.load %762 : !llvm.ptr -> i64
%861 = arith.xori %856, %860 : i64
%863 = arith.constant 0 : i32
%864 = arith.extsi %863 : i32 to i64
%865 = llvm.getelementptr %837[%864] : (!llvm.ptr, i64) -> !llvm.ptr, i64
%862 = llvm.load %865 : !llvm.ptr -> i64
%866 = llvm.load %766 : !llvm.ptr -> i64
%867 = arith.xori %862, %866 : i64
func.call @add_small_vector(%855, %861, %867) : (i64, i64, i64) -> ()
cf.br ^bb149
^bb149:
func.call @free(%831) : (!llvm.ptr) -> ()
func.call @free(%834) : (!llvm.ptr) -> ()
func.call @free(%837) : (!llvm.ptr) -> ()
cf.br ^bb146
^bb146:
%871 = llvm.load %749 : !llvm.ptr -> i32
%872 = arith.constant 1 : i32
%873 = arith.addi %871, %872 : i32
llvm.store %873, %749 : i32, !llvm.ptr
cf.br ^bb123
^bb125:
%874 = llvm.mlir.addressof @g_pivot_count : !llvm.ptr
%875 = llvm.load %874 : !llvm.ptr -> i32
%876 = llvm.mlir.addressof @g_rank_small : !llvm.ptr
%877 = llvm.load %876 : !llvm.ptr -> i32
%878 = arith.addi %875, %877 : i32
%880 = arith.constant 2 : i32
%881 = arith.subi %479, %878 : i32
%882 = arith.extsi %881 : i32 to i64
%883 = llvm.mlir.addressof @MOD : !llvm.ptr
%884 = llvm.load %883 : !llvm.ptr -> i64
%885 = arith.extsi %880 : i32 to i64
%879 = func.call @mod_pow(%885, %882, %884) : (i64, i64, i64) -> i64
%886 = arith.constant 1 : i32
%888 = arith.extsi %886 : i32 to i64
%887 = arith.subi %879, %888 : i64
%889 = llvm.mlir.constant(1 : i64) : i64
%890 = llvm.alloca %889 x i64 : (i64) -> !llvm.ptr
llvm.store %887, %890 : i64, !llvm.ptr
%891 = llvm.load %890 : !llvm.ptr -> i64
%892 = arith.constant 0 : i32
%894 = arith.extsi %892 : i32 to i64
%893 = arith.cmpi slt, %891, %894 : i64
cf.cond_br %893, ^bb150, ^bb151
^bb150:
%895 = llvm.load %890 : !llvm.ptr -> i64
%896 = llvm.mlir.addressof @MOD : !llvm.ptr
%897 = llvm.load %896 : !llvm.ptr -> i64
%898 = arith.addi %895, %897 : i64
llvm.store %898, %890 : i64, !llvm.ptr
cf.br ^bb152
^bb151:
cf.br ^bb152
^bb152:
%899 = llvm.mlir.addressof @str_0 : !llvm.ptr
%900 = llvm.load %890 : !llvm.ptr -> i64
%901 = llvm.call @printf(%899, %900) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%483) : (!llvm.ptr) -> ()
func.call @free(%489) : (!llvm.ptr) -> ()
func.call @free(%578) : (!llvm.ptr) -> ()
func.call @free(%600) : (!llvm.ptr) -> ()
func.call @free(%606) : (!llvm.ptr) -> ()
%908 = llvm.mlir.addressof @g_basis_w0 : !llvm.ptr
%909 = llvm.load %908 : !llvm.ptr -> !llvm.ptr
func.call @free(%909) : (!llvm.ptr) -> ()
%911 = llvm.mlir.addressof @g_basis_w1 : !llvm.ptr
%912 = llvm.load %911 : !llvm.ptr -> !llvm.ptr
func.call @free(%912) : (!llvm.ptr) -> ()
%914 = llvm.mlir.addressof @g_basis_w2 : !llvm.ptr
%915 = llvm.load %914 : !llvm.ptr -> !llvm.ptr
func.call @free(%915) : (!llvm.ptr) -> ()
%917 = llvm.mlir.addressof @g_basis_used : !llvm.ptr
%918 = llvm.load %917 : !llvm.ptr -> !llvm.ptr
func.call @free(%918) : (!llvm.ptr) -> ()
%920 = llvm.mlir.addressof @g_pivot_p : !llvm.ptr
%921 = llvm.load %920 : !llvm.ptr -> !llvm.ptr
func.call @free(%921) : (!llvm.ptr) -> ()
%923 = llvm.mlir.addressof @g_pivot_w0 : !llvm.ptr
%924 = llvm.load %923 : !llvm.ptr -> !llvm.ptr
func.call @free(%924) : (!llvm.ptr) -> ()
%926 = llvm.mlir.addressof @g_pivot_w1 : !llvm.ptr
%927 = llvm.load %926 : !llvm.ptr -> !llvm.ptr
func.call @free(%927) : (!llvm.ptr) -> ()
%929 = llvm.mlir.addressof @g_pivot_w2 : !llvm.ptr
%930 = llvm.load %929 : !llvm.ptr -> !llvm.ptr
func.call @free(%930) : (!llvm.ptr) -> ()
%932 = llvm.mlir.addressof @g_pused : !llvm.ptr
%933 = llvm.load %932 : !llvm.ptr -> !llvm.ptr
func.call @free(%933) : (!llvm.ptr) -> ()
%934 = arith.constant 0 : i32
func.return %934 : i32
}
}