Problem 246

Lattice points with tangent angle > 45° to ellipse.

Answer810834388
Output810834388
StatusPASS
Native helperno
Runtime0 ms
Peak memory1104 KB
Time complexityO(n^2) (estimated)
Space complexityO(1) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(n^2)
Space complexityO(1)O(n^2)
ApproachFlow solutionCombinatorial or DP counting
VerdictOptimal

Flow source

# Project Euler 246
# Lattice points with tangent angle > 45° to ellipse.

import euler.nt { isqrt }

function angle_gt(u: i64, v: i64, a2: i64, b2: i64, ab: i64, A: i64) -> bool {
    let left: i64 = 4 * (b2 * u + a2 * v - ab)
    let t: i64 = u + v - A
    return left > t * t
}

function main() -> i32 {
    let a2: i64 = 7500 * 7500
    let c2: i64 = 5000 * 5000
    let b2: i64 = a2 - c2
    let R2: i64 = a2 + b2
    let ab: i64 = a2 * b2
    let A: i64 = R2
    let mut total: i64 = 0

    let y_max1: i64 = isqrt(R2 - 1)
    let mut y: i64 = 0
    while y <= y_max1 {
        let v: i64 = y * y
        let rem: i64 = R2 - v - 1
        if rem >= 0 {
            let x_max: i64 = isqrt(rem)
            let mut x_min: i64 = 0
            if v < b2 {
                let num: i64 = a2 * (b2 - v)
                x_min = isqrt(num / b2)
                while b2 * x_min * x_min <= num {
                    x_min = x_min + 1
                }
            }
            if x_min <= x_max {
                let mut count_x: i64 = 0
                if x_min == 0 { count_x = 1 + 2 * x_max }
                else { count_x = 2 * (x_max - x_min + 1) }
                let mut count_y: i64 = 1
                if y > 0 { count_y = 2 }
                total = total + count_x * count_y
            }
        }
        y = y + 1
    }

    let y_limit: i64 = 20000
    y = 0
    while y <= y_limit {
        let v: i64 = y * y
        let k: i64 = v - A
        let p: i64 = 2 * k - 4 * b2
        let q: i64 = k * k - 4 * a2 * v + 4 * ab
        let disc: i64 = p * p - 4 * q
        if disc > 0 {
            let s: i64 = isqrt(disc)
            let u1: i64 = (0 - p - s) / 2
            let u2: i64 = (0 - p + s) / 2
            if u2 >= 0 {
                let mut umax0: i64 = 0
                if u1 > 0 { umax0 = u1 }
                let mut x_min: i64 = isqrt(umax0)
                if x_min >= 3 { x_min = x_min - 3 } else { x_min = 0 }
                let mut x_max: i64 = isqrt(u2) + 3
                while x_min <= x_max && !angle_gt(x_min * x_min, v, a2, b2, ab, A) {
                    x_min = x_min + 1
                }
                if x_min <= x_max {
                    while angle_gt(x_max * x_max, v, a2, b2, ab, A) {
                        x_max = x_max + 1
                    }
                    x_max = x_max - 1
                    while x_max >= x_min && !angle_gt(x_max * x_max, v, a2, b2, ab, A) {
                        x_max = x_max - 1
                    }
                    if x_max >= x_min {
                        let t: i64 = R2 - v
                        if t >= 0 {
                            let x_out: i64 = isqrt(t) + 1
                            if x_out > x_min { x_min = x_out }
                        }
                        if x_min <= x_max {
                            let mut count_x: i64 = 0
                            if x_min == 0 { count_x = 1 + 2 * x_max }
                            else { count_x = 2 * (x_max - x_min + 1) }
                            let mut count_y: i64 = 1
                            if y > 0 { count_y = 2 }
                            total = total + count_x * count_y
                        }
                    }
                }
            }
        }
        y = y + 1
    }
    printf("%lld\n", total)
    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);
bool angle_gt_i64_i64_i64_i64_i64_i64(int64_t u, int64_t v, int64_t a2, int64_t b2, int64_t ab, int64_t A);
int32_t main(void);

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;
}

bool angle_gt_i64_i64_i64_i64_i64_i64(int64_t u, int64_t v, int64_t a2, int64_t b2, int64_t ab, int64_t A) {
    int64_t left = (4 * (((b2 * u) + (a2 * v)) - ab));
    int64_t t = ((u + v) - A);
    return left > (t * t);
}

int32_t main(void) {
    int64_t a2 = (7500 * 7500);
    int64_t c2 = (5000 * 5000);
    int64_t b2 = (a2 - c2);
    int64_t R2 = (a2 + b2);
    int64_t ab = (a2 * b2);
    int64_t A = R2;
    int64_t total = 0;
    int64_t y_max1 = isqrt_i64((R2 - 1));
    int64_t y = 0;
    while (y <= y_max1) {
        int64_t v = (y * y);
        int64_t rem = ((R2 - v) - 1);
        if (rem >= 0) {
            int64_t x_max = isqrt_i64(rem);
            int64_t x_min = 0;
            if (v < b2) {
                int64_t num = (a2 * (b2 - v));
                x_min = isqrt_i64(FLOW_CHECKED_DIV((num), (b2)));
                while (((b2 * x_min) * x_min) <= num) {
                    x_min = (x_min + 1);
                }
            }
            if (x_min <= x_max) {
                int64_t count_x = 0;
                if (x_min == 0) {
                    count_x = (1 + (2 * x_max));
                } else {
                    count_x = (2 * ((x_max - x_min) + 1));
                }
                int64_t count_y = 1;
                if (y > 0) {
                    count_y = 2;
                }
                total = (total + (count_x * count_y));
            }
        }
        y = (y + 1);
    }
    int64_t y_limit = 20000;
    y = 0;
    while (y <= y_limit) {
        int64_t v = (y * y);
        int64_t k = (v - A);
        int64_t p = ((2 * k) - (4 * b2));
        int64_t q = (((k * k) - ((4 * a2) * v)) + (4 * ab));
        int64_t disc = ((p * p) - (4 * q));
        if (disc > 0) {
            int64_t s = isqrt_i64(disc);
            int64_t u1 = FLOW_CHECKED_DIV((((0 - p) - s)), (2));
            int64_t u2 = FLOW_CHECKED_DIV((((0 - p) + s)), (2));
            if (u2 >= 0) {
                int64_t umax0 = 0;
                if (u1 > 0) {
                    umax0 = u1;
                }
                int64_t x_min = isqrt_i64(umax0);
                if (x_min >= 3) {
                    x_min = (x_min - 3);
                } else {
                    x_min = 0;
                }
                int64_t x_max = (isqrt_i64(u2) + 3);
                while ((x_min <= x_max && (!(angle_gt_i64_i64_i64_i64_i64_i64((x_min * x_min), v, a2, b2, ab, A))))) {
                    x_min = (x_min + 1);
                }
                if (x_min <= x_max) {
                    while (angle_gt_i64_i64_i64_i64_i64_i64((x_max * x_max), v, a2, b2, ab, A)) {
                        x_max = (x_max + 1);
                    }
                    x_max = (x_max - 1);
                    while ((x_max >= x_min && (!(angle_gt_i64_i64_i64_i64_i64_i64((x_max * x_max), v, a2, b2, ab, A))))) {
                        x_max = (x_max - 1);
                    }
                    if (x_max >= x_min) {
                        int64_t t = (R2 - v);
                        if (t >= 0) {
                            int64_t x_out = (isqrt_i64(t) + 1);
                            if (x_out > x_min) {
                                x_min = x_out;
                            }
                        }
                        if (x_min <= x_max) {
                            int64_t count_x = 0;
                            if (x_min == 0) {
                                count_x = (1 + (2 * x_max));
                            } else {
                                count_x = (2 * ((x_max - x_min) + 1));
                            }
                            int64_t count_y = 1;
                            if (y > 0) {
                                count_y = 2;
                            }
                            total = (total + (count_x * count_y));
                        }
                    }
                }
            }
        }
        y = (y + 1);
    }
    printf("%lld\n", total);
    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
  }
  func.func @angle_gt(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i64, %arg4: i64, %arg5: i64) -> i1 {
    %175 = arith.constant 4 : i32
    %176 = arith.muli %arg3, %arg0 : i64
    %177 = arith.muli %arg2, %arg1 : i64
    %178 = arith.addi %176, %177 : i64
    %179 = arith.subi %178, %arg4 : i64
    %181 = arith.extsi %175 : i32 to i64
    %180 = arith.muli %181, %179 : i64
    %182 = arith.addi %arg0, %arg1 : i64
    %183 = arith.subi %182, %arg5 : i64
    %184 = arith.muli %183, %183 : i64
    %185 = arith.cmpi sgt, %180, %184 : i64
    func.return %185 : i1
  }
  func.func @main() -> i32 {
    %186 = arith.constant 7500 : i32
    %187 = arith.constant 7500 : i32
    %188 = arith.muli %186, %187 : i32
    %189 = arith.extsi %188 : i32 to i64
    %190 = arith.constant 5000 : i32
    %191 = arith.constant 5000 : i32
    %192 = arith.muli %190, %191 : i32
    %193 = arith.extsi %192 : i32 to i64
    %194 = arith.subi %189, %193 : i64
    %195 = arith.addi %189, %194 : i64
    %196 = arith.muli %189, %194 : i64
    %197 = arith.constant 0 : i32
    %198 = arith.extsi %197 : i32 to i64
    %199 = llvm.mlir.constant(1 : i64) : i64
    %200 = llvm.alloca %199 x i64 : (i64) -> !llvm.ptr
    llvm.store %198, %200 : i64, !llvm.ptr
    %202 = arith.constant 1 : i32
    %204 = arith.extsi %202 : i32 to i64
    %203 = arith.subi %195, %204 : i64
    %201 = func.call @isqrt(%203) : (i64) -> i64
    %205 = arith.constant 0 : i32
    %206 = arith.extsi %205 : i32 to i64
    %207 = llvm.mlir.constant(1 : i64) : i64
    %208 = llvm.alloca %207 x i64 : (i64) -> !llvm.ptr
    llvm.store %206, %208 : i64, !llvm.ptr
    cf.br ^bb42
    ^bb42:
    %209 = llvm.load %208 : !llvm.ptr -> i64
    %210 = arith.cmpi sle, %209, %201 : i64
    cf.cond_br %210, ^bb43, ^bb44
    ^bb43:
      %211 = llvm.load %208 : !llvm.ptr -> i64
      %212 = llvm.load %208 : !llvm.ptr -> i64
      %213 = arith.muli %211, %212 : i64
      %214 = arith.subi %195, %213 : i64
      %215 = arith.constant 1 : i32
      %217 = arith.extsi %215 : i32 to i64
      %216 = arith.subi %214, %217 : i64
      %218 = arith.constant 0 : i32
      %220 = arith.extsi %218 : i32 to i64
      %219 = arith.cmpi sge, %216, %220 : i64
      cf.cond_br %219, ^bb45, ^bb46
      ^bb45:
        %221 = func.call @isqrt(%216) : (i64) -> i64
        %222 = arith.constant 0 : i32
        %223 = arith.extsi %222 : i32 to i64
        %224 = llvm.mlir.constant(1 : i64) : i64
        %225 = llvm.alloca %224 x i64 : (i64) -> !llvm.ptr
        llvm.store %223, %225 : i64, !llvm.ptr
        %226 = arith.cmpi slt, %213, %194 : i64
        cf.cond_br %226, ^bb48, ^bb49
        ^bb48:
          %227 = arith.subi %194, %213 : i64
          %228 = arith.muli %189, %227 : i64
          %230 = arith.divsi %228, %194 : i64
          %229 = func.call @isqrt(%230) : (i64) -> i64
          llvm.store %229, %225 : i64, !llvm.ptr
          cf.br ^bb51
          ^bb51:
          %231 = llvm.load %225 : !llvm.ptr -> i64
          %232 = arith.muli %194, %231 : i64
          %233 = llvm.load %225 : !llvm.ptr -> i64
          %234 = arith.muli %232, %233 : i64
          %235 = arith.cmpi sle, %234, %228 : i64
          cf.cond_br %235, ^bb52, ^bb53
          ^bb52:
            %236 = llvm.load %225 : !llvm.ptr -> i64
            %237 = arith.constant 1 : i32
            %239 = arith.extsi %237 : i32 to i64
            %238 = arith.addi %236, %239 : i64
            llvm.store %238, %225 : i64, !llvm.ptr
            cf.br ^bb51
          ^bb53:
          cf.br ^bb50
        ^bb49:
          cf.br ^bb50
        ^bb50:
        %240 = llvm.load %225 : !llvm.ptr -> i64
        %241 = arith.cmpi sle, %240, %221 : i64
        cf.cond_br %241, ^bb54, ^bb55
        ^bb54:
          %242 = arith.constant 0 : i32
          %243 = arith.extsi %242 : i32 to i64
          %244 = llvm.mlir.constant(1 : i64) : i64
          %245 = llvm.alloca %244 x i64 : (i64) -> !llvm.ptr
          llvm.store %243, %245 : i64, !llvm.ptr
          %246 = llvm.load %225 : !llvm.ptr -> i64
          %247 = arith.constant 0 : i32
          %249 = arith.extsi %247 : i32 to i64
          %248 = arith.cmpi eq, %246, %249 : i64
          cf.cond_br %248, ^bb57, ^bb58
          ^bb57:
            %250 = arith.constant 1 : i32
            %251 = arith.constant 2 : i32
            %253 = arith.extsi %251 : i32 to i64
            %252 = arith.muli %253, %221 : i64
            %255 = arith.extsi %250 : i32 to i64
            %254 = arith.addi %255, %252 : i64
            llvm.store %254, %245 : i64, !llvm.ptr
            cf.br ^bb59
          ^bb58:
            %256 = arith.constant 2 : i32
            %257 = llvm.load %225 : !llvm.ptr -> i64
            %258 = arith.subi %221, %257 : i64
            %259 = arith.constant 1 : i32
            %261 = arith.extsi %259 : i32 to i64
            %260 = arith.addi %258, %261 : i64
            %263 = arith.extsi %256 : i32 to i64
            %262 = arith.muli %263, %260 : i64
            llvm.store %262, %245 : i64, !llvm.ptr
            cf.br ^bb59
          ^bb59:
          %264 = arith.constant 1 : i32
          %265 = arith.extsi %264 : i32 to i64
          %266 = llvm.mlir.constant(1 : i64) : i64
          %267 = llvm.alloca %266 x i64 : (i64) -> !llvm.ptr
          llvm.store %265, %267 : i64, !llvm.ptr
          %268 = llvm.load %208 : !llvm.ptr -> i64
          %269 = arith.constant 0 : i32
          %271 = arith.extsi %269 : i32 to i64
          %270 = arith.cmpi sgt, %268, %271 : i64
          cf.cond_br %270, ^bb60, ^bb61
          ^bb60:
            %272 = arith.constant 2 : i32
            %273 = arith.extsi %272 : i32 to i64
            llvm.store %273, %267 : i64, !llvm.ptr
            cf.br ^bb62
          ^bb61:
            cf.br ^bb62
          ^bb62:
          %274 = llvm.load %200 : !llvm.ptr -> i64
          %275 = llvm.load %245 : !llvm.ptr -> i64
          %276 = llvm.load %267 : !llvm.ptr -> i64
          %277 = arith.muli %275, %276 : i64
          %278 = arith.addi %274, %277 : i64
          llvm.store %278, %200 : i64, !llvm.ptr
          cf.br ^bb56
        ^bb55:
          cf.br ^bb56
        ^bb56:
        cf.br ^bb47
      ^bb46:
        cf.br ^bb47
      ^bb47:
      %279 = llvm.load %208 : !llvm.ptr -> i64
      %280 = arith.constant 1 : i32
      %282 = arith.extsi %280 : i32 to i64
      %281 = arith.addi %279, %282 : i64
      llvm.store %281, %208 : i64, !llvm.ptr
      cf.br ^bb42
    ^bb44:
    %283 = arith.constant 20000 : i32
    %284 = arith.extsi %283 : i32 to i64
    %285 = arith.constant 0 : i32
    %286 = arith.extsi %285 : i32 to i64
    llvm.store %286, %208 : i64, !llvm.ptr
    cf.br ^bb63
    ^bb63:
    %287 = llvm.load %208 : !llvm.ptr -> i64
    %288 = arith.cmpi sle, %287, %284 : i64
    cf.cond_br %288, ^bb64, ^bb65
    ^bb64:
      %289 = llvm.load %208 : !llvm.ptr -> i64
      %290 = llvm.load %208 : !llvm.ptr -> i64
      %291 = arith.muli %289, %290 : i64
      %292 = arith.subi %291, %195 : i64
      %293 = arith.constant 2 : i32
      %295 = arith.extsi %293 : i32 to i64
      %294 = arith.muli %295, %292 : i64
      %296 = arith.constant 4 : i32
      %298 = arith.extsi %296 : i32 to i64
      %297 = arith.muli %298, %194 : i64
      %299 = arith.subi %294, %297 : i64
      %300 = arith.muli %292, %292 : i64
      %301 = arith.constant 4 : i32
      %303 = arith.extsi %301 : i32 to i64
      %302 = arith.muli %303, %189 : i64
      %304 = arith.muli %302, %291 : i64
      %305 = arith.subi %300, %304 : i64
      %306 = arith.constant 4 : i32
      %308 = arith.extsi %306 : i32 to i64
      %307 = arith.muli %308, %196 : i64
      %309 = arith.addi %305, %307 : i64
      %310 = arith.muli %299, %299 : i64
      %311 = arith.constant 4 : i32
      %313 = arith.extsi %311 : i32 to i64
      %312 = arith.muli %313, %309 : i64
      %314 = arith.subi %310, %312 : i64
      %315 = arith.constant 0 : i32
      %317 = arith.extsi %315 : i32 to i64
      %316 = arith.cmpi sgt, %314, %317 : i64
      cf.cond_br %316, ^bb66, ^bb67
      ^bb66:
        %318 = func.call @isqrt(%314) : (i64) -> i64
        %319 = arith.constant 0 : i32
        %321 = arith.extsi %319 : i32 to i64
        %320 = arith.subi %321, %299 : i64
        %322 = arith.subi %320, %318 : i64
        %323 = arith.constant 2 : i32
        %325 = arith.extsi %323 : i32 to i64
        %324 = arith.divsi %322, %325 : i64
        %326 = arith.constant 0 : i32
        %328 = arith.extsi %326 : i32 to i64
        %327 = arith.subi %328, %299 : i64
        %329 = arith.addi %327, %318 : i64
        %330 = arith.constant 2 : i32
        %332 = arith.extsi %330 : i32 to i64
        %331 = arith.divsi %329, %332 : i64
        %333 = arith.constant 0 : i32
        %335 = arith.extsi %333 : i32 to i64
        %334 = arith.cmpi sge, %331, %335 : i64
        cf.cond_br %334, ^bb69, ^bb70
        ^bb69:
          %336 = arith.constant 0 : i32
          %337 = arith.extsi %336 : i32 to i64
          %338 = llvm.mlir.constant(1 : i64) : i64
          %339 = llvm.alloca %338 x i64 : (i64) -> !llvm.ptr
          llvm.store %337, %339 : i64, !llvm.ptr
          %340 = arith.constant 0 : i32
          %342 = arith.extsi %340 : i32 to i64
          %341 = arith.cmpi sgt, %324, %342 : i64
          cf.cond_br %341, ^bb72, ^bb73
          ^bb72:
            llvm.store %324, %339 : i64, !llvm.ptr
            cf.br ^bb74
          ^bb73:
            cf.br ^bb74
          ^bb74:
          %344 = llvm.load %339 : !llvm.ptr -> i64
          %343 = func.call @isqrt(%344) : (i64) -> i64
          %345 = llvm.mlir.constant(1 : i64) : i64
          %346 = llvm.alloca %345 x i64 : (i64) -> !llvm.ptr
          llvm.store %343, %346 : i64, !llvm.ptr
          %347 = llvm.load %346 : !llvm.ptr -> i64
          %348 = arith.constant 3 : i32
          %350 = arith.extsi %348 : i32 to i64
          %349 = arith.cmpi sge, %347, %350 : i64
          cf.cond_br %349, ^bb75, ^bb76
          ^bb75:
            %351 = llvm.load %346 : !llvm.ptr -> i64
            %352 = arith.constant 3 : i32
            %354 = arith.extsi %352 : i32 to i64
            %353 = arith.subi %351, %354 : i64
            llvm.store %353, %346 : i64, !llvm.ptr
            cf.br ^bb77
          ^bb76:
            %355 = arith.constant 0 : i32
            %356 = arith.extsi %355 : i32 to i64
            llvm.store %356, %346 : i64, !llvm.ptr
            cf.br ^bb77
          ^bb77:
          %357 = func.call @isqrt(%331) : (i64) -> i64
          %358 = arith.constant 3 : i32
          %360 = arith.extsi %358 : i32 to i64
          %359 = arith.addi %357, %360 : i64
          %361 = llvm.mlir.constant(1 : i64) : i64
          %362 = llvm.alloca %361 x i64 : (i64) -> !llvm.ptr
          llvm.store %359, %362 : i64, !llvm.ptr
          cf.br ^bb78
          ^bb78:
          %363 = llvm.load %346 : !llvm.ptr -> i64
          %364 = llvm.load %362 : !llvm.ptr -> i64
          %365 = arith.cmpi sle, %363, %364 : i64
          %366 = scf.if %365 -> (i1) {
            %368 = llvm.load %346 : !llvm.ptr -> i64
            %369 = llvm.load %346 : !llvm.ptr -> i64
            %370 = arith.muli %368, %369 : i64
            %367 = func.call @angle_gt(%370, %291, %189, %194, %196, %195) : (i64, i64, i64, i64, i64, i64) -> i1
            %372 = arith.constant 1 : i1
            %371 = arith.xori %367, %372 : i1
            scf.yield %371 : i1
          } else {
            %374 = arith.constant false
            scf.yield %374 : i1
          }
          cf.cond_br %366, ^bb79, ^bb80
          ^bb79:
            %375 = llvm.load %346 : !llvm.ptr -> i64
            %376 = arith.constant 1 : i32
            %378 = arith.extsi %376 : i32 to i64
            %377 = arith.addi %375, %378 : i64
            llvm.store %377, %346 : i64, !llvm.ptr
            cf.br ^bb78
          ^bb80:
          %379 = llvm.load %346 : !llvm.ptr -> i64
          %380 = llvm.load %362 : !llvm.ptr -> i64
          %381 = arith.cmpi sle, %379, %380 : i64
          cf.cond_br %381, ^bb81, ^bb82
          ^bb81:
            cf.br ^bb84
            ^bb84:
            %383 = llvm.load %362 : !llvm.ptr -> i64
            %384 = llvm.load %362 : !llvm.ptr -> i64
            %385 = arith.muli %383, %384 : i64
            %382 = func.call @angle_gt(%385, %291, %189, %194, %196, %195) : (i64, i64, i64, i64, i64, i64) -> i1
            cf.cond_br %382, ^bb85, ^bb86
            ^bb85:
              %386 = llvm.load %362 : !llvm.ptr -> i64
              %387 = arith.constant 1 : i32
              %389 = arith.extsi %387 : i32 to i64
              %388 = arith.addi %386, %389 : i64
              llvm.store %388, %362 : i64, !llvm.ptr
              cf.br ^bb84
            ^bb86:
            %390 = llvm.load %362 : !llvm.ptr -> i64
            %391 = arith.constant 1 : i32
            %393 = arith.extsi %391 : i32 to i64
            %392 = arith.subi %390, %393 : i64
            llvm.store %392, %362 : i64, !llvm.ptr
            cf.br ^bb87
            ^bb87:
            %394 = llvm.load %362 : !llvm.ptr -> i64
            %395 = llvm.load %346 : !llvm.ptr -> i64
            %396 = arith.cmpi sge, %394, %395 : i64
            %397 = scf.if %396 -> (i1) {
              %399 = llvm.load %362 : !llvm.ptr -> i64
              %400 = llvm.load %362 : !llvm.ptr -> i64
              %401 = arith.muli %399, %400 : i64
              %398 = func.call @angle_gt(%401, %291, %189, %194, %196, %195) : (i64, i64, i64, i64, i64, i64) -> i1
              %403 = arith.constant 1 : i1
              %402 = arith.xori %398, %403 : i1
              scf.yield %402 : i1
            } else {
              %405 = arith.constant false
              scf.yield %405 : i1
            }
            cf.cond_br %397, ^bb88, ^bb89
            ^bb88:
              %406 = llvm.load %362 : !llvm.ptr -> i64
              %407 = arith.constant 1 : i32
              %409 = arith.extsi %407 : i32 to i64
              %408 = arith.subi %406, %409 : i64
              llvm.store %408, %362 : i64, !llvm.ptr
              cf.br ^bb87
            ^bb89:
            %410 = llvm.load %362 : !llvm.ptr -> i64
            %411 = llvm.load %346 : !llvm.ptr -> i64
            %412 = arith.cmpi sge, %410, %411 : i64
            cf.cond_br %412, ^bb90, ^bb91
            ^bb90:
              %413 = arith.subi %195, %291 : i64
              %414 = arith.constant 0 : i32
              %416 = arith.extsi %414 : i32 to i64
              %415 = arith.cmpi sge, %413, %416 : i64
              cf.cond_br %415, ^bb93, ^bb94
              ^bb93:
                %417 = func.call @isqrt(%413) : (i64) -> i64
                %418 = arith.constant 1 : i32
                %420 = arith.extsi %418 : i32 to i64
                %419 = arith.addi %417, %420 : i64
                %421 = llvm.load %346 : !llvm.ptr -> i64
                %422 = arith.cmpi sgt, %419, %421 : i64
                cf.cond_br %422, ^bb96, ^bb97
                ^bb96:
                  llvm.store %419, %346 : i64, !llvm.ptr
                  cf.br ^bb98
                ^bb97:
                  cf.br ^bb98
                ^bb98:
                cf.br ^bb95
              ^bb94:
                cf.br ^bb95
              ^bb95:
              %423 = llvm.load %346 : !llvm.ptr -> i64
              %424 = llvm.load %362 : !llvm.ptr -> i64
              %425 = arith.cmpi sle, %423, %424 : i64
              cf.cond_br %425, ^bb99, ^bb100
              ^bb99:
                %426 = arith.constant 0 : i32
                %427 = arith.extsi %426 : i32 to i64
                %428 = llvm.mlir.constant(1 : i64) : i64
                %429 = llvm.alloca %428 x i64 : (i64) -> !llvm.ptr
                llvm.store %427, %429 : i64, !llvm.ptr
                %430 = llvm.load %346 : !llvm.ptr -> i64
                %431 = arith.constant 0 : i32
                %433 = arith.extsi %431 : i32 to i64
                %432 = arith.cmpi eq, %430, %433 : i64
                cf.cond_br %432, ^bb102, ^bb103
                ^bb102:
                  %434 = arith.constant 1 : i32
                  %435 = arith.constant 2 : i32
                  %436 = llvm.load %362 : !llvm.ptr -> i64
                  %438 = arith.extsi %435 : i32 to i64
                  %437 = arith.muli %438, %436 : i64
                  %440 = arith.extsi %434 : i32 to i64
                  %439 = arith.addi %440, %437 : i64
                  llvm.store %439, %429 : i64, !llvm.ptr
                  cf.br ^bb104
                ^bb103:
                  %441 = arith.constant 2 : i32
                  %442 = llvm.load %362 : !llvm.ptr -> i64
                  %443 = llvm.load %346 : !llvm.ptr -> i64
                  %444 = arith.subi %442, %443 : i64
                  %445 = arith.constant 1 : i32
                  %447 = arith.extsi %445 : i32 to i64
                  %446 = arith.addi %444, %447 : i64
                  %449 = arith.extsi %441 : i32 to i64
                  %448 = arith.muli %449, %446 : i64
                  llvm.store %448, %429 : i64, !llvm.ptr
                  cf.br ^bb104
                ^bb104:
                %450 = arith.constant 1 : i32
                %451 = arith.extsi %450 : i32 to i64
                %452 = llvm.mlir.constant(1 : i64) : i64
                %453 = llvm.alloca %452 x i64 : (i64) -> !llvm.ptr
                llvm.store %451, %453 : i64, !llvm.ptr
                %454 = llvm.load %208 : !llvm.ptr -> i64
                %455 = arith.constant 0 : i32
                %457 = arith.extsi %455 : i32 to i64
                %456 = arith.cmpi sgt, %454, %457 : i64
                cf.cond_br %456, ^bb105, ^bb106
                ^bb105:
                  %458 = arith.constant 2 : i32
                  %459 = arith.extsi %458 : i32 to i64
                  llvm.store %459, %453 : i64, !llvm.ptr
                  cf.br ^bb107
                ^bb106:
                  cf.br ^bb107
                ^bb107:
                %460 = llvm.load %200 : !llvm.ptr -> i64
                %461 = llvm.load %429 : !llvm.ptr -> i64
                %462 = llvm.load %453 : !llvm.ptr -> i64
                %463 = arith.muli %461, %462 : i64
                %464 = arith.addi %460, %463 : i64
                llvm.store %464, %200 : i64, !llvm.ptr
                cf.br ^bb101
              ^bb100:
                cf.br ^bb101
              ^bb101:
              cf.br ^bb92
            ^bb91:
              cf.br ^bb92
            ^bb92:
            cf.br ^bb83
          ^bb82:
            cf.br ^bb83
          ^bb83:
          cf.br ^bb71
        ^bb70:
          cf.br ^bb71
        ^bb71:
        cf.br ^bb68
      ^bb67:
        cf.br ^bb68
      ^bb68:
      %465 = llvm.load %208 : !llvm.ptr -> i64
      %466 = arith.constant 1 : i32
      %468 = arith.extsi %466 : i32 to i64
      %467 = arith.addi %465, %468 : i64
      llvm.store %467, %208 : i64, !llvm.ptr
      cf.br ^bb63
    ^bb65:
    %469 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %470 = llvm.load %200 : !llvm.ptr -> i64
    %471 = llvm.call @printf(%469, %470) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %472 = arith.constant 0 : i32
    func.return %472 : i32
  }
}