← All problems
Problem 522
Hilbert's Blackout — F(12344321) mod 135707531.
View problem on Project Euler
Performance comparison
Metric Our solution Best known
Time complexity O(n)?
Space complexity O(n)?
Approach Flow solution Not curated
Verdict Unknown
Flow source
# Project Euler 522
# Hilbert's Blackout — F(12344321) mod 135707531.
extern {
function calloc(n: i64, size: i64) -> ptr<void>
function free(p: ptr<void>) -> void
}
const MOD: i64 = 135707531
function modpow(base0: i64, exp0: i64, mod: i64) -> i64 {
let mut r: i64 = 1
let mut b: i64 = base0 % mod
if b < 0 { b = b + mod }
let mut e: i64 = exp0
while e > 0 {
if (e & 1) == 1 {
let t: i128 = (r as i128) * (b as i128) % (mod as i128)
r = t as i64
}
let t2: i128 = (b as i128) * (b as i128) % (mod as i128)
b = t2 as i64
e = e / 2
}
return r
}
function main() -> i32 {
let n: i64 = 12344321
let inv: ptr<i32> = calloc(n + 1, 4)
if inv == null { return 1 }
inv[1] = 1
let mut fact_n: i64 = 1
let mut i: i64 = 2
while i <= n {
let t: i64 = (MOD - (MOD / i) * (inv[MOD % i] as i64) % MOD) % MOD
inv[i] = t as i32
fact_n = (fact_n * i) % MOD
i = i + 1
}
let mut total_z: i64 = (n % MOD) * ((n - 1) % MOD) % MOD
total_z = total_z * modpow(n - 2, n - 1, MOD) % MOD
let mut inv_fact: i64 = 1
let mut S: i64 = 0
let mut m: i64 = 1
while m <= n - 2 {
inv_fact = (inv_fact * (inv[m] as i64)) % MOD
if m >= 2 {
let mut term: i64 = modpow(m - 1, m, MOD)
term = (term * inv_fact) % MOD
term = (term * (inv[n - m] as i64)) % MOD
S = S + term
if S >= MOD { S = S % MOD }
}
m = m + 1
}
let extra_p: i64 = (fact_n * (S % MOD)) % MOD
let ans: i64 = (total_z + extra_p) % MOD
printf("%lld\n", ans)
free(inv)
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 modpow_i64_i64_i64(int64_t base0, int64_t exp0, int64_t mod);
int32_t main(void);
static const int64_t MOD = 135707531;
int64_t modpow_i64_i64_i64(int64_t base0, int64_t exp0, int64_t mod) {
int64_t r = 1;
int64_t b = FLOW_CHECKED_MOD((base0), (mod));
if (b < 0) {
b = (b + mod);
}
int64_t e = exp0;
while (e > 0) {
if ((e & 1) == 1) {
__int128 t = FLOW_CHECKED_MOD(((((__int128)(r)) * ((__int128)(b)))), (((__int128)(mod))));
r = ((int64_t)(t));
}
__int128 t2 = FLOW_CHECKED_MOD(((((__int128)(b)) * ((__int128)(b)))), (((__int128)(mod))));
b = ((int64_t)(t2));
e = FLOW_CHECKED_DIV((e), (2));
}
return r;
}
int32_t main(void) {
int64_t n = 12344321;
int32_t* inv = (int32_t*)(calloc((n + 1), 4));
if (inv == NULL) {
return 1;
}
inv[1] = 1;
int64_t fact_n = 1;
int64_t i = 2;
while (i <= n) {
int64_t t = FLOW_CHECKED_MOD(((MOD - FLOW_CHECKED_MOD(((FLOW_CHECKED_DIV((MOD), (i)) * ((int64_t)(inv[FLOW_CHECKED_MOD((MOD), (i))])))), (MOD)))), (MOD));
inv[i] = ((int32_t)(t));
fact_n = FLOW_CHECKED_MOD(((fact_n * i)), (MOD));
i = (i + 1);
}
int64_t total_z = FLOW_CHECKED_MOD(((FLOW_CHECKED_MOD((n), (MOD)) * FLOW_CHECKED_MOD(((n - 1)), (MOD)))), (MOD));
total_z = FLOW_CHECKED_MOD(((total_z * modpow_i64_i64_i64((n - 2), (n - 1), MOD))), (MOD));
int64_t inv_fact = 1;
int64_t S = 0;
int64_t m = 1;
while (m <= (n - 2)) {
inv_fact = FLOW_CHECKED_MOD(((inv_fact * ((int64_t)(inv[m])))), (MOD));
if (m >= 2) {
int64_t term = modpow_i64_i64_i64((m - 1), m, MOD);
term = FLOW_CHECKED_MOD(((term * inv_fact)), (MOD));
term = FLOW_CHECKED_MOD(((term * ((int64_t)(inv[(n - m)])))), (MOD));
S = (S + term);
if (S >= MOD) {
S = FLOW_CHECKED_MOD((S), (MOD));
}
}
m = (m + 1);
}
int64_t extra_p = FLOW_CHECKED_MOD(((fact_n * FLOW_CHECKED_MOD((S), (MOD)))), (MOD));
int64_t ans = FLOW_CHECKED_MOD(((total_z + extra_p)), (MOD));
printf("%lld\n", ans);
free(inv);
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) -> ()
// Constant: MOD
llvm.mlir.global internal constant @MOD(135707531 : i64) : i64
func.func @modpow(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
%0 = arith.constant 1 : i32
%1 = arith.extsi %0 : i32 to i64
%2 = llvm.mlir.constant(1 : i64) : i64
%3 = llvm.alloca %2 x i64 : (i64) -> !llvm.ptr
llvm.store %1, %3 : i64, !llvm.ptr
%4 = arith.remsi %arg0, %arg2 : i64
%5 = llvm.mlir.constant(1 : i64) : i64
%6 = llvm.alloca %5 x i64 : (i64) -> !llvm.ptr
llvm.store %4, %6 : i64, !llvm.ptr
%7 = llvm.load %6 : !llvm.ptr -> i64
%8 = arith.constant 0 : i32
%10 = arith.extsi %8 : i32 to i64
%9 = arith.cmpi slt, %7, %10 : i64
cf.cond_br %9, ^bb0, ^bb1
^bb0:
%11 = llvm.load %6 : !llvm.ptr -> i64
%12 = arith.addi %11, %arg2 : i64
llvm.store %12, %6 : i64, !llvm.ptr
cf.br ^bb2
^bb1:
cf.br ^bb2
^bb2:
%13 = llvm.mlir.constant(1 : i64) : i64
%14 = llvm.alloca %13 x i64 : (i64) -> !llvm.ptr
llvm.store %arg1, %14 : i64, !llvm.ptr
cf.br ^bb3
^bb3:
%15 = llvm.load %14 : !llvm.ptr -> i64
%16 = arith.constant 0 : i32
%18 = arith.extsi %16 : i32 to i64
%17 = arith.cmpi sgt, %15, %18 : i64
cf.cond_br %17, ^bb4, ^bb5
^bb4:
%19 = llvm.load %14 : !llvm.ptr -> i64
%20 = arith.constant 1 : i32
%22 = arith.extsi %20 : i32 to i64
%21 = arith.andi %19, %22 : i64
%23 = arith.constant 1 : i32
%25 = arith.extsi %23 : i32 to i64
%24 = arith.cmpi eq, %21, %25 : i64
cf.cond_br %24, ^bb6, ^bb7
^bb6:
%26 = llvm.load %3 : !llvm.ptr -> i64
%27 = arith.extsi %26 : i64 to i128
%28 = llvm.load %6 : !llvm.ptr -> i64
%29 = arith.extsi %28 : i64 to i128
%31 = arith.trunci %27 : i128 to i64
%32 = arith.trunci %29 : i128 to i64
%30 = arith.muli %31, %32 : i64
%33 = arith.extsi %arg2 : i64 to i128
%35 = arith.trunci %33 : i128 to i64
%34 = arith.remsi %30, %35 : i64
%36 = arith.extsi %34 : i64 to i128
%37 = arith.trunci %36 : i128 to i64
llvm.store %37, %3 : i64, !llvm.ptr
cf.br ^bb8
^bb7:
cf.br ^bb8
^bb8:
%38 = llvm.load %6 : !llvm.ptr -> i64
%39 = arith.extsi %38 : i64 to i128
%40 = llvm.load %6 : !llvm.ptr -> i64
%41 = arith.extsi %40 : i64 to i128
%43 = arith.trunci %39 : i128 to i64
%44 = arith.trunci %41 : i128 to i64
%42 = arith.muli %43, %44 : i64
%45 = arith.extsi %arg2 : i64 to i128
%47 = arith.trunci %45 : i128 to i64
%46 = arith.remsi %42, %47 : i64
%48 = arith.extsi %46 : i64 to i128
%49 = arith.trunci %48 : i128 to i64
llvm.store %49, %6 : i64, !llvm.ptr
%50 = llvm.load %14 : !llvm.ptr -> i64
%51 = arith.constant 2 : i32
%53 = arith.extsi %51 : i32 to i64
%52 = arith.divsi %50, %53 : i64
llvm.store %52, %14 : i64, !llvm.ptr
cf.br ^bb3
^bb5:
%54 = llvm.load %3 : !llvm.ptr -> i64
func.return %54 : i64
}
func.func @main() -> i32 {
%55 = arith.constant 12344321 : i32
%56 = arith.extsi %55 : i32 to i64
%58 = arith.constant 1 : i32
%60 = arith.extsi %58 : i32 to i64
%59 = arith.addi %56, %60 : i64
%61 = arith.constant 4 : i32
%62 = arith.extsi %61 : i32 to i64
%57 = func.call @calloc(%59, %62) : (i64, i64) -> !llvm.ptr
%63 = llvm.mlir.zero : !llvm.ptr
%64 = llvm.icmp "eq" %57, %63 : !llvm.ptr
cf.cond_br %64, ^bb9, ^bb10
^bb9:
%65 = arith.constant 1 : i32
func.return %65 : i32
^bb10:
cf.br ^bb11
^bb11:
%66 = arith.constant 1 : i32
%67 = arith.constant 1 : i32
%68 = arith.extsi %67 : i32 to i64
%69 = llvm.getelementptr %57[%68] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %66, %69 : i32, !llvm.ptr
%70 = arith.constant 1 : i32
%71 = arith.extsi %70 : i32 to i64
%72 = llvm.mlir.constant(1 : i64) : i64
%73 = llvm.alloca %72 x i64 : (i64) -> !llvm.ptr
llvm.store %71, %73 : i64, !llvm.ptr
%74 = arith.constant 2 : i32
%75 = arith.extsi %74 : i32 to i64
%76 = llvm.mlir.constant(1 : i64) : i64
%77 = llvm.alloca %76 x i64 : (i64) -> !llvm.ptr
llvm.store %75, %77 : i64, !llvm.ptr
cf.br ^bb12
^bb12:
%78 = llvm.load %77 : !llvm.ptr -> i64
%79 = arith.cmpi sle, %78, %56 : i64
cf.cond_br %79, ^bb13, ^bb14
^bb13:
%80 = llvm.mlir.addressof @MOD : !llvm.ptr
%81 = llvm.load %80 : !llvm.ptr -> i64
%82 = llvm.mlir.addressof @MOD : !llvm.ptr
%83 = llvm.load %82 : !llvm.ptr -> i64
%84 = llvm.load %77 : !llvm.ptr -> i64
%85 = arith.divsi %83, %84 : i64
%87 = llvm.mlir.addressof @MOD : !llvm.ptr
%88 = llvm.load %87 : !llvm.ptr -> i64
%89 = llvm.load %77 : !llvm.ptr -> i64
%90 = arith.remsi %88, %89 : i64
%91 = llvm.getelementptr %57[%90] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%86 = llvm.load %91 : !llvm.ptr -> i32
%92 = arith.extsi %86 : i32 to i64
%93 = arith.muli %85, %92 : i64
%94 = llvm.mlir.addressof @MOD : !llvm.ptr
%95 = llvm.load %94 : !llvm.ptr -> i64
%96 = arith.remsi %93, %95 : i64
%97 = arith.subi %81, %96 : i64
%98 = llvm.mlir.addressof @MOD : !llvm.ptr
%99 = llvm.load %98 : !llvm.ptr -> i64
%100 = arith.remsi %97, %99 : i64
%101 = arith.trunci %100 : i64 to i32
%102 = llvm.load %77 : !llvm.ptr -> i64
%103 = llvm.getelementptr %57[%102] : (!llvm.ptr, i64) -> !llvm.ptr, i32
llvm.store %101, %103 : i32, !llvm.ptr
%104 = llvm.load %73 : !llvm.ptr -> i64
%105 = llvm.load %77 : !llvm.ptr -> i64
%106 = arith.muli %104, %105 : i64
%107 = llvm.mlir.addressof @MOD : !llvm.ptr
%108 = llvm.load %107 : !llvm.ptr -> i64
%109 = arith.remsi %106, %108 : i64
llvm.store %109, %73 : i64, !llvm.ptr
%110 = llvm.load %77 : !llvm.ptr -> i64
%111 = arith.constant 1 : i32
%113 = arith.extsi %111 : i32 to i64
%112 = arith.addi %110, %113 : i64
llvm.store %112, %77 : i64, !llvm.ptr
cf.br ^bb12
^bb14:
%114 = llvm.mlir.addressof @MOD : !llvm.ptr
%115 = llvm.load %114 : !llvm.ptr -> i64
%116 = arith.remsi %56, %115 : i64
%117 = arith.constant 1 : i32
%119 = arith.extsi %117 : i32 to i64
%118 = arith.subi %56, %119 : i64
%120 = llvm.mlir.addressof @MOD : !llvm.ptr
%121 = llvm.load %120 : !llvm.ptr -> i64
%122 = arith.remsi %118, %121 : i64
%123 = arith.muli %116, %122 : i64
%124 = llvm.mlir.addressof @MOD : !llvm.ptr
%125 = llvm.load %124 : !llvm.ptr -> i64
%126 = arith.remsi %123, %125 : i64
%127 = llvm.mlir.constant(1 : i64) : i64
%128 = llvm.alloca %127 x i64 : (i64) -> !llvm.ptr
llvm.store %126, %128 : i64, !llvm.ptr
%129 = llvm.load %128 : !llvm.ptr -> i64
%131 = arith.constant 2 : i32
%133 = arith.extsi %131 : i32 to i64
%132 = arith.subi %56, %133 : i64
%134 = arith.constant 1 : i32
%136 = arith.extsi %134 : i32 to i64
%135 = arith.subi %56, %136 : i64
%137 = llvm.mlir.addressof @MOD : !llvm.ptr
%138 = llvm.load %137 : !llvm.ptr -> i64
%130 = func.call @modpow(%132, %135, %138) : (i64, i64, i64) -> i64
%139 = arith.muli %129, %130 : i64
%140 = llvm.mlir.addressof @MOD : !llvm.ptr
%141 = llvm.load %140 : !llvm.ptr -> i64
%142 = arith.remsi %139, %141 : i64
llvm.store %142, %128 : i64, !llvm.ptr
%143 = arith.constant 1 : i32
%144 = arith.extsi %143 : i32 to i64
%145 = llvm.mlir.constant(1 : i64) : i64
%146 = llvm.alloca %145 x i64 : (i64) -> !llvm.ptr
llvm.store %144, %146 : i64, !llvm.ptr
%147 = arith.constant 0 : i32
%148 = arith.extsi %147 : i32 to i64
%149 = llvm.mlir.constant(1 : i64) : i64
%150 = llvm.alloca %149 x i64 : (i64) -> !llvm.ptr
llvm.store %148, %150 : i64, !llvm.ptr
%151 = arith.constant 1 : i32
%152 = arith.extsi %151 : i32 to i64
%153 = llvm.mlir.constant(1 : i64) : i64
%154 = llvm.alloca %153 x i64 : (i64) -> !llvm.ptr
llvm.store %152, %154 : i64, !llvm.ptr
cf.br ^bb15
^bb15:
%155 = llvm.load %154 : !llvm.ptr -> i64
%156 = arith.constant 2 : i32
%158 = arith.extsi %156 : i32 to i64
%157 = arith.subi %56, %158 : i64
%159 = arith.cmpi sle, %155, %157 : i64
cf.cond_br %159, ^bb16, ^bb17
^bb16:
%160 = llvm.load %146 : !llvm.ptr -> i64
%162 = llvm.load %154 : !llvm.ptr -> i64
%163 = llvm.getelementptr %57[%162] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%161 = llvm.load %163 : !llvm.ptr -> i32
%164 = arith.extsi %161 : i32 to i64
%165 = arith.muli %160, %164 : i64
%166 = llvm.mlir.addressof @MOD : !llvm.ptr
%167 = llvm.load %166 : !llvm.ptr -> i64
%168 = arith.remsi %165, %167 : i64
llvm.store %168, %146 : i64, !llvm.ptr
%169 = llvm.load %154 : !llvm.ptr -> i64
%170 = arith.constant 2 : i32
%172 = arith.extsi %170 : i32 to i64
%171 = arith.cmpi sge, %169, %172 : i64
cf.cond_br %171, ^bb18, ^bb19
^bb18:
%174 = llvm.load %154 : !llvm.ptr -> i64
%175 = arith.constant 1 : i32
%177 = arith.extsi %175 : i32 to i64
%176 = arith.subi %174, %177 : i64
%178 = llvm.load %154 : !llvm.ptr -> i64
%179 = llvm.mlir.addressof @MOD : !llvm.ptr
%180 = llvm.load %179 : !llvm.ptr -> i64
%173 = func.call @modpow(%176, %178, %180) : (i64, i64, i64) -> i64
%181 = llvm.mlir.constant(1 : i64) : i64
%182 = llvm.alloca %181 x i64 : (i64) -> !llvm.ptr
llvm.store %173, %182 : i64, !llvm.ptr
%183 = llvm.load %182 : !llvm.ptr -> i64
%184 = llvm.load %146 : !llvm.ptr -> i64
%185 = arith.muli %183, %184 : i64
%186 = llvm.mlir.addressof @MOD : !llvm.ptr
%187 = llvm.load %186 : !llvm.ptr -> i64
%188 = arith.remsi %185, %187 : i64
llvm.store %188, %182 : i64, !llvm.ptr
%189 = llvm.load %182 : !llvm.ptr -> i64
%191 = llvm.load %154 : !llvm.ptr -> i64
%192 = arith.subi %56, %191 : i64
%193 = llvm.getelementptr %57[%192] : (!llvm.ptr, i64) -> !llvm.ptr, i32
%190 = llvm.load %193 : !llvm.ptr -> i32
%194 = arith.extsi %190 : i32 to i64
%195 = arith.muli %189, %194 : i64
%196 = llvm.mlir.addressof @MOD : !llvm.ptr
%197 = llvm.load %196 : !llvm.ptr -> i64
%198 = arith.remsi %195, %197 : i64
llvm.store %198, %182 : i64, !llvm.ptr
%199 = llvm.load %150 : !llvm.ptr -> i64
%200 = llvm.load %182 : !llvm.ptr -> i64
%201 = arith.addi %199, %200 : i64
llvm.store %201, %150 : i64, !llvm.ptr
%202 = llvm.load %150 : !llvm.ptr -> i64
%203 = llvm.mlir.addressof @MOD : !llvm.ptr
%204 = llvm.load %203 : !llvm.ptr -> i64
%205 = arith.cmpi sge, %202, %204 : i64
cf.cond_br %205, ^bb21, ^bb22
^bb21:
%206 = llvm.load %150 : !llvm.ptr -> i64
%207 = llvm.mlir.addressof @MOD : !llvm.ptr
%208 = llvm.load %207 : !llvm.ptr -> i64
%209 = arith.remsi %206, %208 : i64
llvm.store %209, %150 : i64, !llvm.ptr
cf.br ^bb23
^bb22:
cf.br ^bb23
^bb23:
cf.br ^bb20
^bb19:
cf.br ^bb20
^bb20:
%210 = llvm.load %154 : !llvm.ptr -> i64
%211 = arith.constant 1 : i32
%213 = arith.extsi %211 : i32 to i64
%212 = arith.addi %210, %213 : i64
llvm.store %212, %154 : i64, !llvm.ptr
cf.br ^bb15
^bb17:
%214 = llvm.load %73 : !llvm.ptr -> i64
%215 = llvm.load %150 : !llvm.ptr -> i64
%216 = llvm.mlir.addressof @MOD : !llvm.ptr
%217 = llvm.load %216 : !llvm.ptr -> i64
%218 = arith.remsi %215, %217 : i64
%219 = arith.muli %214, %218 : i64
%220 = llvm.mlir.addressof @MOD : !llvm.ptr
%221 = llvm.load %220 : !llvm.ptr -> i64
%222 = arith.remsi %219, %221 : i64
%223 = llvm.load %128 : !llvm.ptr -> i64
%224 = arith.addi %223, %222 : i64
%225 = llvm.mlir.addressof @MOD : !llvm.ptr
%226 = llvm.load %225 : !llvm.ptr -> i64
%227 = arith.remsi %224, %226 : i64
%228 = llvm.mlir.addressof @str_0 : !llvm.ptr
%229 = llvm.call @printf(%228, %227) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
func.call @free(%57) : (!llvm.ptr) -> ()
%231 = arith.constant 0 : i32
func.return %231 : i32
}
}