Problem 689

Binary Series: p(0.5) = P(sum d_i(x)/i^2 > 1/2) for uniform x, to 8 dp. The bits d_i are iid Bernoulli(1/2). Enumerate the first K = 26 bits exactly (pruning when the partial sum already exceeds 1/2 or cannot reach it). The tail sum X = sum_{i>K} d_i/i^2 has bounded support [0, T], so its periodised Fourier sine series is exact: P(X > a) = (mu + R - a)/(2R) - sum_k phi_k sin(pi k (a-mu)/R)/(pi k), phi_k = prod_{i>K} cos(pi k / (2 R i^2)), which decays fast. P(X > a) is tabulated on a 2^16 grid (interpolation error ~ 1e-16) and looked up per surviving bit pattern. Result is K-independent to 1e-10 for K = 22..28.

Answer0.56565454
Output0.56565454
StatusPASS
Native helperno
Runtime110 ms
Peak memory1728 KB
Time complexityO(2^n) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(2^n)?
Space complexityO(n^2)?
ApproachFlow solutionNot curated
VerdictUnknown

Flow source

# Project Euler 689
# Binary Series: p(0.5) = P(sum d_i(x)/i^2 > 1/2) for uniform x, to 8 dp.
#
# The bits d_i are iid Bernoulli(1/2).  Enumerate the first K = 26 bits
# exactly (pruning when the partial sum already exceeds 1/2 or cannot
# reach it).  The tail sum X = sum_{i>K} d_i/i^2 has bounded support
# [0, T], so its periodised Fourier sine series is exact:
#   P(X > a) = (mu + R - a)/(2R) - sum_k phi_k sin(pi k (a-mu)/R)/(pi k),
# phi_k = prod_{i>K} cos(pi k / (2 R i^2)), which decays fast.  P(X > a)
# is tabulated on a 2^16 grid (interpolation error ~ 1e-16) and looked up
# per surviving bit pattern.  Result is K-independent to 1e-10 for
# K = 22..28.

extern {
    function calloc(n: i64, size: i64) -> ptr<void>
    function free(p: ptr<void>) -> void
    function cos(x: f64) -> f64
    function sin(x: f64) -> f64
    function exp(x: f64) -> f64
}

const K: i64 = 26
const M: i64 = 400000
const NG: i64 = 65536
const PI: f64 = 3.14159265358979323846

# recursive enumeration over bits 1..K
function walk(i: i64, S: f64, prob: f64, w: ptr<f64>, Rk: ptr<f64>,
              Gv: ptr<f64>, mu: f64, R: f64, acc: ptr<f64>) -> void {
    let a: f64 = 0.5 - S
    if a < 0.0 {
        acc[0] = acc[0] + prob
        return
    }
    if i == K + 1 {
        # G(a) via table over x = a - mu in [-R, R]
        let x: f64 = a - mu
        if x <= 0.0 - R {
            acc[0] = acc[0] + prob
            return
        }
        if x >= R {
            return
        }
        let f: f64 = (x + R) / (2.0 * R) * (NG as f64)
        let mut j: i64 = f as i64
        if j >= NG {
            j = NG - 1
        }
        let fr: f64 = f - (j as f64)
        acc[0] = acc[0] + prob * (Gv[j] * (1.0 - fr) + Gv[j + 1] * fr)
        return
    }
    if a > Rk[i] {
        return
    }
    walk(i + 1, S, prob * 0.5, w, Rk, Gv, mu, R, acc)
    walk(i + 1, S + w[i - 1], prob * 0.5, w, Rk, Gv, mu, R, acc)
}

function main() -> i32 {
    let w: ptr<f64> = calloc(K + 1, 8)
    let mut i: i64 = 1
    while i <= K {
        w[i - 1] = 1.0 / ((i * i) as f64)
        i = i + 1
    }

    # tail support T = sum_{i=K+1..M} 1/i^2 + 1/M
    let mut T: f64 = 0.0
    i = K + 1
    while i <= M {
        T = T + 1.0 / ((i * i) as f64)
        i = i + 1
    }
    T = T + 1.0 / (M as f64)
    let mu: f64 = T / 2.0
    let R: f64 = T / 2.0

    # phi_k
    let KF: i64 = 300
    let phis: ptr<f64> = calloc(KF + 1, 8)
    let mut kmax: i64 = 0
    let mut k: i64 = 1
    while k <= KF && kmax == 0 {
        let t: f64 = PI * (k as f64) / R
        let mut val: f64 = 1.0
        let mut broke: i64 = 0
        i = K + 1
        while i <= M && broke == 0 {
            val = val * cos(t / (2.0 * ((i * i) as f64)))
            let mut av: f64 = val
            if av < 0.0 {
                av = 0.0 - av
            }
            if av < 0.000000000000000001 {
                broke = 1
            }
            i = i + 1
        }
        if broke == 0 {
            val = val * exp(0.0 - t * t / (24.0 * (M as f64) * (M as f64) * (M as f64)))
        }
        phis[k] = val
        let mut av2: f64 = val
        if av2 < 0.0 {
            av2 = 0.0 - av2
        }
        if av2 / (PI * (k as f64)) < 0.00000000000001 && k > 40 {
            kmax = k
        }
        k = k + 1
    }
    if kmax == 0 {
        kmax = KF
    }

    # G table over x in [-R, R]
    let Gv: ptr<f64> = calloc(NG + 1, 8)
    let mut j: i64 = 0
    while j <= NG {
        let x: f64 = 0.0 - R + 2.0 * R * (j as f64) / (NG as f64)
        let mut g: f64 = (R - x) / (2.0 * R)
        k = 1
        while k <= kmax {
            g = g - phis[k] * sin(PI * (k as f64) * x / R) / (PI * (k as f64))
            k = k + 1
        }
        if g < 0.0 {
            g = 0.0
        }
        if g > 1.0 {
            g = 1.0
        }
        Gv[j] = g
        j = j + 1
    }

    # Rk[i] = max achievable from bits i..K plus tail
    let Rk: ptr<f64> = calloc(K + 2, 8)
    Rk[K + 1] = T
    i = K
    while i >= 1 {
        Rk[i] = Rk[i + 1] + w[i - 1]
        i = i - 1
    }

    let acc: ptr<f64> = calloc(1, 8)
    walk(1, 0.0, 1.0, w, Rk, Gv, mu, R, acc)
    printf("%.8f\n", acc[0])

    free(w)
    free(phis)
    free(Gv)
    free(Rk)
    free(acc)
    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; }

void walk_i64_f64_f64_ptr_f64_ptr_f64_ptr_f64_f64_f64_ptr_f64(int64_t i, double S, double prob, double* w, double* Rk, double* Gv, double mu, double R, double* acc);
int32_t main(void);

static const int64_t K = 26;
static const int64_t M = 400000;
static const int64_t NG = 65536;
static const double PI = 3.14159265358979323846;






void walk_i64_f64_f64_ptr_f64_ptr_f64_ptr_f64_f64_f64_ptr_f64(int64_t i, double S, double prob, double* w, double* Rk, double* Gv, double mu, double R, double* acc) {
    double a = (0.5 - S);
    if (a < 0.0) {
        acc[0] = (acc[0] + prob);
        return;
    }
    if (i == (K + 1)) {
        double x = (a - mu);
        if (x <= (0.0 - R)) {
            acc[0] = (acc[0] + prob);
            return;
        }
        if (x >= R) {
            return;
        }
        double f = (((x + R) / (2.0 * R)) * ((double)(NG)));
        int64_t j = ((int64_t)(f));
        if (j >= NG) {
            j = (NG - 1);
        }
        double fr = (f - ((double)(j)));
        acc[0] = (acc[0] + (prob * ((Gv[j] * (1.0 - fr)) + (Gv[(j + 1)] * fr))));
        return;
    }
    if (a > Rk[i]) {
        return;
    }
    walk_i64_f64_f64_ptr_f64_ptr_f64_ptr_f64_f64_f64_ptr_f64((i + 1), S, (prob * 0.5), w, Rk, Gv, mu, R, acc);
    walk_i64_f64_f64_ptr_f64_ptr_f64_ptr_f64_f64_f64_ptr_f64((i + 1), (S + w[(i - 1)]), (prob * 0.5), w, Rk, Gv, mu, R, acc);
}

int32_t main(void) {
    double* w = (double*)(calloc((K + 1), 8));
    int64_t i = 1;
    while (i <= K) {
        w[(i - 1)] = (1.0 / ((double)((i * i))));
        i = (i + 1);
    }
    double T = 0.0;
    i = (K + 1);
    while (i <= M) {
        T = (T + (1.0 / ((double)((i * i)))));
        i = (i + 1);
    }
    T = (T + (1.0 / ((double)(M))));
    double mu = (T / 2.0);
    double R = (T / 2.0);
    int64_t KF = 300;
    double* phis = (double*)(calloc((KF + 1), 8));
    int64_t kmax = 0;
    int64_t k = 1;
    while ((k <= KF && kmax == 0)) {
        double t = ((PI * ((double)(k))) / R);
        double val = 1.0;
        int64_t broke = 0;
        i = (K + 1);
        while ((i <= M && broke == 0)) {
            val = (val * cos((t / (2.0 * ((double)((i * i)))))));
            double av = val;
            if (av < 0.0) {
                av = (0.0 - av);
            }
            if (av < 0.000000000000000001) {
                broke = 1;
            }
            i = (i + 1);
        }
        if (broke == 0) {
            val = (val * exp((0.0 - ((t * t) / (((24.0 * ((double)(M))) * ((double)(M))) * ((double)(M)))))));
        }
        phis[k] = val;
        double av2 = val;
        if (av2 < 0.0) {
            av2 = (0.0 - av2);
        }
        if (((av2 / (PI * ((double)(k)))) < 0.00000000000001 && k > 40)) {
            kmax = k;
        }
        k = (k + 1);
    }
    if (kmax == 0) {
        kmax = KF;
    }
    double* Gv = (double*)(calloc((NG + 1), 8));
    int64_t j = 0;
    while (j <= NG) {
        double x = ((0.0 - R) + (((2.0 * R) * ((double)(j))) / ((double)(NG))));
        double g = ((R - x) / (2.0 * R));
        k = 1;
        while (k <= kmax) {
            g = (g - ((phis[k] * sin((((PI * ((double)(k))) * x) / R))) / (PI * ((double)(k)))));
            k = (k + 1);
        }
        if (g < 0.0) {
            g = 0.0;
        }
        if (g > 1.0) {
            g = 1.0;
        }
        Gv[j] = g;
        j = (j + 1);
    }
    double* Rk = (double*)(calloc((K + 2), 8));
    Rk[(K + 1)] = T;
    i = K;
    while (i >= 1) {
        Rk[i] = (Rk[(i + 1)] + w[(i - 1)]);
        i = (i - 1);
    }
    double* acc = (double*)(calloc(1, 8));
    walk_i64_f64_f64_ptr_f64_ptr_f64_ptr_f64_f64_f64_ptr_f64(1, 0.0, 1.0, w, Rk, Gv, mu, R, acc);
    printf("%.8f\n", acc[0]);
    free(w);
    free(phis);
    free(Gv);
    free(Rk);
    free(acc);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%.8f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  func.func private @cos(f64) -> f64
  func.func private @sin(f64) -> f64
  func.func private @exp(f64) -> f64
  // Constant: K
  llvm.mlir.global internal constant @K(26 : i64) : i64
  // Constant: M
  llvm.mlir.global internal constant @M(400000 : i64) : i64
  // Constant: NG
  llvm.mlir.global internal constant @NG(65536 : i64) : i64
  // Constant: PI
  llvm.mlir.global internal constant @PI(3.14159265358979323846 : f64) : f64
  func.func @walk(%arg0: i64, %arg1: f64, %arg2: f64, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg6: f64, %arg7: f64, %arg8: !llvm.ptr) -> () {
    %0 = arith.constant 0.5 : f32
    %2 = arith.extf %0 : f32 to f64
    %1 = arith.subf %2, %arg1 : f64
    %3 = arith.constant 0.0 : f32
    %5 = arith.extf %3 : f32 to f64
    %4 = arith.cmpf olt, %1, %5 : f64
    cf.cond_br %4, ^bb0, ^bb1
    ^bb0:
      %7 = arith.constant 0 : i32
      %8 = arith.extsi %7 : i32 to i64
      %9 = llvm.getelementptr %arg8[%8] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %6 = llvm.load %9 : !llvm.ptr -> f64
      %10 = arith.addf %6, %arg2 : f64
      %11 = arith.constant 0 : i32
      %12 = arith.extsi %11 : i32 to i64
      %13 = llvm.getelementptr %arg8[%12] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %10, %13 : f64, !llvm.ptr
      func.return
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %14 = llvm.mlir.addressof @K : !llvm.ptr
    %15 = llvm.load %14 : !llvm.ptr -> i64
    %16 = arith.constant 1 : i32
    %18 = arith.extsi %16 : i32 to i64
    %17 = arith.addi %15, %18 : i64
    %19 = arith.cmpi eq, %arg0, %17 : i64
    cf.cond_br %19, ^bb3, ^bb4
    ^bb3:
      %20 = arith.subf %1, %arg6 : f64
      %21 = arith.constant 0.0 : f32
      %23 = arith.extf %21 : f32 to f64
      %22 = arith.subf %23, %arg7 : f64
      %24 = arith.cmpf ole, %20, %22 : f64
      cf.cond_br %24, ^bb6, ^bb7
      ^bb6:
        %26 = arith.constant 0 : i32
        %27 = arith.extsi %26 : i32 to i64
        %28 = llvm.getelementptr %arg8[%27] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        %25 = llvm.load %28 : !llvm.ptr -> f64
        %29 = arith.addf %25, %arg2 : f64
        %30 = arith.constant 0 : i32
        %31 = arith.extsi %30 : i32 to i64
        %32 = llvm.getelementptr %arg8[%31] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        llvm.store %29, %32 : f64, !llvm.ptr
        func.return
      ^bb7:
        cf.br ^bb8
      ^bb8:
      %33 = arith.cmpf oge, %20, %arg7 : f64
      cf.cond_br %33, ^bb9, ^bb10
      ^bb9:
        func.return
      ^bb10:
        cf.br ^bb11
      ^bb11:
      %34 = arith.addf %20, %arg7 : f64
      %35 = arith.constant 2.0 : f32
      %37 = arith.extf %35 : f32 to f64
      %36 = arith.mulf %37, %arg7 : f64
      %38 = arith.divf %34, %36 : f64
      %39 = llvm.mlir.addressof @NG : !llvm.ptr
      %40 = llvm.load %39 : !llvm.ptr -> i64
      %41 = arith.sitofp %40 : i64 to f64
      %42 = arith.mulf %38, %41 : f64
      %43 = arith.fptosi %42 : f64 to i64
      %44 = llvm.mlir.constant(1 : i64) : i64
      %45 = llvm.alloca %44 x i64 : (i64) -> !llvm.ptr
      llvm.store %43, %45 : i64, !llvm.ptr
      %46 = llvm.load %45 : !llvm.ptr -> i64
      %47 = llvm.mlir.addressof @NG : !llvm.ptr
      %48 = llvm.load %47 : !llvm.ptr -> i64
      %49 = arith.cmpi sge, %46, %48 : i64
      cf.cond_br %49, ^bb12, ^bb13
      ^bb12:
        %50 = llvm.mlir.addressof @NG : !llvm.ptr
        %51 = llvm.load %50 : !llvm.ptr -> i64
        %52 = arith.constant 1 : i32
        %54 = arith.extsi %52 : i32 to i64
        %53 = arith.subi %51, %54 : i64
        llvm.store %53, %45 : i64, !llvm.ptr
        cf.br ^bb14
      ^bb13:
        cf.br ^bb14
      ^bb14:
      %55 = llvm.load %45 : !llvm.ptr -> i64
      %56 = arith.sitofp %55 : i64 to f64
      %57 = arith.subf %42, %56 : f64
      %59 = arith.constant 0 : i32
      %60 = arith.extsi %59 : i32 to i64
      %61 = llvm.getelementptr %arg8[%60] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %58 = llvm.load %61 : !llvm.ptr -> f64
      %63 = llvm.load %45 : !llvm.ptr -> i64
      %64 = llvm.getelementptr %arg5[%63] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %62 = llvm.load %64 : !llvm.ptr -> f64
      %65 = arith.constant 1.0 : f32
      %67 = arith.extf %65 : f32 to f64
      %66 = arith.subf %67, %57 : f64
      %68 = arith.mulf %62, %66 : f64
      %70 = llvm.load %45 : !llvm.ptr -> i64
      %71 = arith.constant 1 : i32
      %73 = arith.extsi %71 : i32 to i64
      %72 = arith.addi %70, %73 : i64
      %74 = llvm.getelementptr %arg5[%72] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %69 = llvm.load %74 : !llvm.ptr -> f64
      %75 = arith.mulf %69, %57 : f64
      %76 = arith.addf %68, %75 : f64
      %77 = arith.mulf %arg2, %76 : f64
      %78 = arith.addf %58, %77 : f64
      %79 = arith.constant 0 : i32
      %80 = arith.extsi %79 : i32 to i64
      %81 = llvm.getelementptr %arg8[%80] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %78, %81 : f64, !llvm.ptr
      func.return
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %83 = llvm.getelementptr %arg4[%arg0] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %82 = llvm.load %83 : !llvm.ptr -> f64
    %84 = arith.cmpf ogt, %1, %82 : f64
    cf.cond_br %84, ^bb15, ^bb16
    ^bb15:
      func.return
    ^bb16:
      cf.br ^bb17
    ^bb17:
    %86 = arith.constant 1 : i32
    %88 = arith.extsi %86 : i32 to i64
    %87 = arith.addi %arg0, %88 : i64
    %89 = arith.constant 0.5 : f32
    %91 = arith.extf %89 : f32 to f64
    %90 = arith.mulf %arg2, %91 : f64
    func.call @walk(%87, %arg1, %90, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8) : (i64, f64, f64, !llvm.ptr, !llvm.ptr, !llvm.ptr, f64, f64, !llvm.ptr) -> ()
    %93 = arith.constant 1 : i32
    %95 = arith.extsi %93 : i32 to i64
    %94 = arith.addi %arg0, %95 : i64
    %97 = arith.constant 1 : i32
    %99 = arith.extsi %97 : i32 to i64
    %98 = arith.subi %arg0, %99 : i64
    %100 = llvm.getelementptr %arg3[%98] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %96 = llvm.load %100 : !llvm.ptr -> f64
    %101 = arith.addf %arg1, %96 : f64
    %102 = arith.constant 0.5 : f32
    %104 = arith.extf %102 : f32 to f64
    %103 = arith.mulf %arg2, %104 : f64
    func.call @walk(%94, %101, %103, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8) : (i64, f64, f64, !llvm.ptr, !llvm.ptr, !llvm.ptr, f64, f64, !llvm.ptr) -> ()
    func.return
  }
  func.func @main() -> i32 {
    %106 = llvm.mlir.addressof @K : !llvm.ptr
    %107 = llvm.load %106 : !llvm.ptr -> i64
    %108 = arith.constant 1 : i32
    %110 = arith.extsi %108 : i32 to i64
    %109 = arith.addi %107, %110 : i64
    %111 = arith.constant 8 : i32
    %112 = arith.extsi %111 : i32 to i64
    %105 = func.call @calloc(%109, %112) : (i64, i64) -> !llvm.ptr
    %113 = arith.constant 1 : i32
    %114 = arith.extsi %113 : i32 to i64
    %115 = llvm.mlir.constant(1 : i64) : i64
    %116 = llvm.alloca %115 x i64 : (i64) -> !llvm.ptr
    llvm.store %114, %116 : i64, !llvm.ptr
    cf.br ^bb18
    ^bb18:
    %117 = llvm.load %116 : !llvm.ptr -> i64
    %118 = llvm.mlir.addressof @K : !llvm.ptr
    %119 = llvm.load %118 : !llvm.ptr -> i64
    %120 = arith.cmpi sle, %117, %119 : i64
    cf.cond_br %120, ^bb19, ^bb20
    ^bb19:
      %121 = arith.constant 1.0 : f32
      %122 = llvm.load %116 : !llvm.ptr -> i64
      %123 = llvm.load %116 : !llvm.ptr -> i64
      %124 = arith.muli %122, %123 : i64
      %125 = arith.sitofp %124 : i64 to f64
      %127 = arith.extf %121 : f32 to f64
      %126 = arith.divf %127, %125 : f64
      %128 = llvm.load %116 : !llvm.ptr -> i64
      %129 = arith.constant 1 : i32
      %131 = arith.extsi %129 : i32 to i64
      %130 = arith.subi %128, %131 : i64
      %132 = llvm.getelementptr %105[%130] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %126, %132 : f64, !llvm.ptr
      %133 = llvm.load %116 : !llvm.ptr -> i64
      %134 = arith.constant 1 : i32
      %136 = arith.extsi %134 : i32 to i64
      %135 = arith.addi %133, %136 : i64
      llvm.store %135, %116 : i64, !llvm.ptr
      cf.br ^bb18
    ^bb20:
    %137 = arith.constant 0.0 : f32
    %138 = arith.extf %137 : f32 to f64
    %139 = llvm.mlir.constant(1 : i64) : i64
    %140 = llvm.alloca %139 x f64 : (i64) -> !llvm.ptr
    llvm.store %138, %140 : f64, !llvm.ptr
    %141 = llvm.mlir.addressof @K : !llvm.ptr
    %142 = llvm.load %141 : !llvm.ptr -> i64
    %143 = arith.constant 1 : i32
    %145 = arith.extsi %143 : i32 to i64
    %144 = arith.addi %142, %145 : i64
    llvm.store %144, %116 : i64, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %146 = llvm.load %116 : !llvm.ptr -> i64
    %147 = llvm.mlir.addressof @M : !llvm.ptr
    %148 = llvm.load %147 : !llvm.ptr -> i64
    %149 = arith.cmpi sle, %146, %148 : i64
    cf.cond_br %149, ^bb22, ^bb23
    ^bb22:
      %150 = llvm.load %140 : !llvm.ptr -> f64
      %151 = arith.constant 1.0 : f32
      %152 = llvm.load %116 : !llvm.ptr -> i64
      %153 = llvm.load %116 : !llvm.ptr -> i64
      %154 = arith.muli %152, %153 : i64
      %155 = arith.sitofp %154 : i64 to f64
      %157 = arith.extf %151 : f32 to f64
      %156 = arith.divf %157, %155 : f64
      %158 = arith.addf %150, %156 : f64
      llvm.store %158, %140 : f64, !llvm.ptr
      %159 = llvm.load %116 : !llvm.ptr -> i64
      %160 = arith.constant 1 : i32
      %162 = arith.extsi %160 : i32 to i64
      %161 = arith.addi %159, %162 : i64
      llvm.store %161, %116 : i64, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %163 = llvm.load %140 : !llvm.ptr -> f64
    %164 = arith.constant 1.0 : f32
    %165 = llvm.mlir.addressof @M : !llvm.ptr
    %166 = llvm.load %165 : !llvm.ptr -> i64
    %167 = arith.sitofp %166 : i64 to f64
    %169 = arith.extf %164 : f32 to f64
    %168 = arith.divf %169, %167 : f64
    %170 = arith.addf %163, %168 : f64
    llvm.store %170, %140 : f64, !llvm.ptr
    %171 = llvm.load %140 : !llvm.ptr -> f64
    %172 = arith.constant 2.0 : f32
    %174 = arith.extf %172 : f32 to f64
    %173 = arith.divf %171, %174 : f64
    %175 = llvm.load %140 : !llvm.ptr -> f64
    %176 = arith.constant 2.0 : f32
    %178 = arith.extf %176 : f32 to f64
    %177 = arith.divf %175, %178 : f64
    %179 = arith.constant 300 : i32
    %180 = arith.extsi %179 : i32 to i64
    %182 = arith.constant 1 : i32
    %184 = arith.extsi %182 : i32 to i64
    %183 = arith.addi %180, %184 : i64
    %185 = arith.constant 8 : i32
    %186 = arith.extsi %185 : i32 to i64
    %181 = func.call @calloc(%183, %186) : (i64, i64) -> !llvm.ptr
    %187 = arith.constant 0 : i32
    %188 = arith.extsi %187 : i32 to i64
    %189 = llvm.mlir.constant(1 : i64) : i64
    %190 = llvm.alloca %189 x i64 : (i64) -> !llvm.ptr
    llvm.store %188, %190 : i64, !llvm.ptr
    %191 = arith.constant 1 : i32
    %192 = arith.extsi %191 : i32 to i64
    %193 = llvm.mlir.constant(1 : i64) : i64
    %194 = llvm.alloca %193 x i64 : (i64) -> !llvm.ptr
    llvm.store %192, %194 : i64, !llvm.ptr
    cf.br ^bb24
    ^bb24:
    %195 = llvm.load %194 : !llvm.ptr -> i64
    %196 = arith.cmpi sle, %195, %180 : i64
    %197 = scf.if %196 -> (i1) {
      %198 = llvm.load %190 : !llvm.ptr -> i64
      %199 = arith.constant 0 : i32
      %201 = arith.extsi %199 : i32 to i64
      %200 = arith.cmpi eq, %198, %201 : i64
      scf.yield %200 : i1
    } else {
      %202 = arith.constant false
      scf.yield %202 : i1
    }
    cf.cond_br %197, ^bb25, ^bb26
    ^bb25:
      %203 = llvm.mlir.addressof @PI : !llvm.ptr
      %204 = llvm.load %203 : !llvm.ptr -> f64
      %205 = llvm.load %194 : !llvm.ptr -> i64
      %206 = arith.sitofp %205 : i64 to f64
      %207 = arith.mulf %204, %206 : f64
      %208 = arith.divf %207, %177 : f64
      %209 = arith.constant 1.0 : f32
      %210 = arith.extf %209 : f32 to f64
      %211 = llvm.mlir.constant(1 : i64) : i64
      %212 = llvm.alloca %211 x f64 : (i64) -> !llvm.ptr
      llvm.store %210, %212 : f64, !llvm.ptr
      %213 = arith.constant 0 : i32
      %214 = arith.extsi %213 : i32 to i64
      %215 = llvm.mlir.constant(1 : i64) : i64
      %216 = llvm.alloca %215 x i64 : (i64) -> !llvm.ptr
      llvm.store %214, %216 : i64, !llvm.ptr
      %217 = llvm.mlir.addressof @K : !llvm.ptr
      %218 = llvm.load %217 : !llvm.ptr -> i64
      %219 = arith.constant 1 : i32
      %221 = arith.extsi %219 : i32 to i64
      %220 = arith.addi %218, %221 : i64
      llvm.store %220, %116 : i64, !llvm.ptr
      cf.br ^bb27
      ^bb27:
      %222 = llvm.load %116 : !llvm.ptr -> i64
      %223 = llvm.mlir.addressof @M : !llvm.ptr
      %224 = llvm.load %223 : !llvm.ptr -> i64
      %225 = arith.cmpi sle, %222, %224 : i64
      %226 = scf.if %225 -> (i1) {
        %227 = llvm.load %216 : !llvm.ptr -> i64
        %228 = arith.constant 0 : i32
        %230 = arith.extsi %228 : i32 to i64
        %229 = arith.cmpi eq, %227, %230 : i64
        scf.yield %229 : i1
      } else {
        %231 = arith.constant false
        scf.yield %231 : i1
      }
      cf.cond_br %226, ^bb28, ^bb29
      ^bb28:
        %232 = llvm.load %212 : !llvm.ptr -> f64
        %233 = arith.constant 2.0 : f32
        %234 = llvm.load %116 : !llvm.ptr -> i64
        %235 = llvm.load %116 : !llvm.ptr -> i64
        %236 = arith.muli %234, %235 : i64
        %237 = arith.sitofp %236 : i64 to f64
        %239 = arith.extf %233 : f32 to f64
        %238 = arith.mulf %239, %237 : f64
        %240 = arith.divf %208, %238 : f64
        %241 = math.cos %240 : f64
        %242 = arith.mulf %232, %241 : f64
        llvm.store %242, %212 : f64, !llvm.ptr
        %243 = llvm.load %212 : !llvm.ptr -> f64
        %244 = llvm.mlir.constant(1 : i64) : i64
        %245 = llvm.alloca %244 x f64 : (i64) -> !llvm.ptr
        llvm.store %243, %245 : f64, !llvm.ptr
        %246 = llvm.load %245 : !llvm.ptr -> f64
        %247 = arith.constant 0.0 : f32
        %249 = arith.extf %247 : f32 to f64
        %248 = arith.cmpf olt, %246, %249 : f64
        cf.cond_br %248, ^bb30, ^bb31
        ^bb30:
          %250 = arith.constant 0.0 : f32
          %251 = llvm.load %245 : !llvm.ptr -> f64
          %253 = arith.extf %250 : f32 to f64
          %252 = arith.subf %253, %251 : f64
          llvm.store %252, %245 : f64, !llvm.ptr
          cf.br ^bb32
        ^bb31:
          cf.br ^bb32
        ^bb32:
        %254 = llvm.load %245 : !llvm.ptr -> f64
        %255 = arith.constant 0.000000000000000001 : f32
        %257 = arith.extf %255 : f32 to f64
        %256 = arith.cmpf olt, %254, %257 : f64
        cf.cond_br %256, ^bb33, ^bb34
        ^bb33:
          %258 = arith.constant 1 : i32
          %259 = arith.extsi %258 : i32 to i64
          llvm.store %259, %216 : i64, !llvm.ptr
          cf.br ^bb35
        ^bb34:
          cf.br ^bb35
        ^bb35:
        %260 = llvm.load %116 : !llvm.ptr -> i64
        %261 = arith.constant 1 : i32
        %263 = arith.extsi %261 : i32 to i64
        %262 = arith.addi %260, %263 : i64
        llvm.store %262, %116 : i64, !llvm.ptr
        cf.br ^bb27
      ^bb29:
      %264 = llvm.load %216 : !llvm.ptr -> i64
      %265 = arith.constant 0 : i32
      %267 = arith.extsi %265 : i32 to i64
      %266 = arith.cmpi eq, %264, %267 : i64
      cf.cond_br %266, ^bb36, ^bb37
      ^bb36:
        %268 = llvm.load %212 : !llvm.ptr -> f64
        %269 = arith.constant 0.0 : f32
        %270 = arith.mulf %208, %208 : f64
        %271 = arith.constant 24.0 : f32
        %272 = llvm.mlir.addressof @M : !llvm.ptr
        %273 = llvm.load %272 : !llvm.ptr -> i64
        %274 = arith.sitofp %273 : i64 to f64
        %276 = arith.extf %271 : f32 to f64
        %275 = arith.mulf %276, %274 : f64
        %277 = llvm.mlir.addressof @M : !llvm.ptr
        %278 = llvm.load %277 : !llvm.ptr -> i64
        %279 = arith.sitofp %278 : i64 to f64
        %280 = arith.mulf %275, %279 : f64
        %281 = llvm.mlir.addressof @M : !llvm.ptr
        %282 = llvm.load %281 : !llvm.ptr -> i64
        %283 = arith.sitofp %282 : i64 to f64
        %284 = arith.mulf %280, %283 : f64
        %285 = arith.divf %270, %284 : f64
        %287 = arith.extf %269 : f32 to f64
        %286 = arith.subf %287, %285 : f64
        %288 = math.exp %286 : f64
        %289 = arith.mulf %268, %288 : f64
        llvm.store %289, %212 : f64, !llvm.ptr
        cf.br ^bb38
      ^bb37:
        cf.br ^bb38
      ^bb38:
      %290 = llvm.load %212 : !llvm.ptr -> f64
      %291 = llvm.load %194 : !llvm.ptr -> i64
      %292 = llvm.getelementptr %181[%291] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %290, %292 : f64, !llvm.ptr
      %293 = llvm.load %212 : !llvm.ptr -> f64
      %294 = llvm.mlir.constant(1 : i64) : i64
      %295 = llvm.alloca %294 x f64 : (i64) -> !llvm.ptr
      llvm.store %293, %295 : f64, !llvm.ptr
      %296 = llvm.load %295 : !llvm.ptr -> f64
      %297 = arith.constant 0.0 : f32
      %299 = arith.extf %297 : f32 to f64
      %298 = arith.cmpf olt, %296, %299 : f64
      cf.cond_br %298, ^bb39, ^bb40
      ^bb39:
        %300 = arith.constant 0.0 : f32
        %301 = llvm.load %295 : !llvm.ptr -> f64
        %303 = arith.extf %300 : f32 to f64
        %302 = arith.subf %303, %301 : f64
        llvm.store %302, %295 : f64, !llvm.ptr
        cf.br ^bb41
      ^bb40:
        cf.br ^bb41
      ^bb41:
      %304 = llvm.load %295 : !llvm.ptr -> f64
      %305 = llvm.mlir.addressof @PI : !llvm.ptr
      %306 = llvm.load %305 : !llvm.ptr -> f64
      %307 = llvm.load %194 : !llvm.ptr -> i64
      %308 = arith.sitofp %307 : i64 to f64
      %309 = arith.mulf %306, %308 : f64
      %310 = arith.divf %304, %309 : f64
      %311 = arith.constant 0.00000000000001 : f32
      %313 = arith.extf %311 : f32 to f64
      %312 = arith.cmpf olt, %310, %313 : f64
      %314 = scf.if %312 -> (i1) {
        %315 = llvm.load %194 : !llvm.ptr -> i64
        %316 = arith.constant 40 : i32
        %318 = arith.extsi %316 : i32 to i64
        %317 = arith.cmpi sgt, %315, %318 : i64
        scf.yield %317 : i1
      } else {
        %319 = arith.constant false
        scf.yield %319 : i1
      }
      cf.cond_br %314, ^bb42, ^bb43
      ^bb42:
        %320 = llvm.load %194 : !llvm.ptr -> i64
        llvm.store %320, %190 : i64, !llvm.ptr
        cf.br ^bb44
      ^bb43:
        cf.br ^bb44
      ^bb44:
      %321 = llvm.load %194 : !llvm.ptr -> i64
      %322 = arith.constant 1 : i32
      %324 = arith.extsi %322 : i32 to i64
      %323 = arith.addi %321, %324 : i64
      llvm.store %323, %194 : i64, !llvm.ptr
      cf.br ^bb24
    ^bb26:
    %325 = llvm.load %190 : !llvm.ptr -> i64
    %326 = arith.constant 0 : i32
    %328 = arith.extsi %326 : i32 to i64
    %327 = arith.cmpi eq, %325, %328 : i64
    cf.cond_br %327, ^bb45, ^bb46
    ^bb45:
      llvm.store %180, %190 : i64, !llvm.ptr
      cf.br ^bb47
    ^bb46:
      cf.br ^bb47
    ^bb47:
    %330 = llvm.mlir.addressof @NG : !llvm.ptr
    %331 = llvm.load %330 : !llvm.ptr -> i64
    %332 = arith.constant 1 : i32
    %334 = arith.extsi %332 : i32 to i64
    %333 = arith.addi %331, %334 : i64
    %335 = arith.constant 8 : i32
    %336 = arith.extsi %335 : i32 to i64
    %329 = func.call @calloc(%333, %336) : (i64, i64) -> !llvm.ptr
    %337 = arith.constant 0 : i32
    %338 = arith.extsi %337 : i32 to i64
    %339 = llvm.mlir.constant(1 : i64) : i64
    %340 = llvm.alloca %339 x i64 : (i64) -> !llvm.ptr
    llvm.store %338, %340 : i64, !llvm.ptr
    cf.br ^bb48
    ^bb48:
    %341 = llvm.load %340 : !llvm.ptr -> i64
    %342 = llvm.mlir.addressof @NG : !llvm.ptr
    %343 = llvm.load %342 : !llvm.ptr -> i64
    %344 = arith.cmpi sle, %341, %343 : i64
    cf.cond_br %344, ^bb49, ^bb50
    ^bb49:
      %345 = arith.constant 0.0 : f32
      %347 = arith.extf %345 : f32 to f64
      %346 = arith.subf %347, %177 : f64
      %348 = arith.constant 2.0 : f32
      %350 = arith.extf %348 : f32 to f64
      %349 = arith.mulf %350, %177 : f64
      %351 = llvm.load %340 : !llvm.ptr -> i64
      %352 = arith.sitofp %351 : i64 to f64
      %353 = arith.mulf %349, %352 : f64
      %354 = llvm.mlir.addressof @NG : !llvm.ptr
      %355 = llvm.load %354 : !llvm.ptr -> i64
      %356 = arith.sitofp %355 : i64 to f64
      %357 = arith.divf %353, %356 : f64
      %358 = arith.addf %346, %357 : f64
      %359 = arith.subf %177, %358 : f64
      %360 = arith.constant 2.0 : f32
      %362 = arith.extf %360 : f32 to f64
      %361 = arith.mulf %362, %177 : f64
      %363 = arith.divf %359, %361 : f64
      %364 = llvm.mlir.constant(1 : i64) : i64
      %365 = llvm.alloca %364 x f64 : (i64) -> !llvm.ptr
      llvm.store %363, %365 : f64, !llvm.ptr
      %366 = arith.constant 1 : i32
      %367 = arith.extsi %366 : i32 to i64
      llvm.store %367, %194 : i64, !llvm.ptr
      cf.br ^bb51
      ^bb51:
      %368 = llvm.load %194 : !llvm.ptr -> i64
      %369 = llvm.load %190 : !llvm.ptr -> i64
      %370 = arith.cmpi sle, %368, %369 : i64
      cf.cond_br %370, ^bb52, ^bb53
      ^bb52:
        %371 = llvm.load %365 : !llvm.ptr -> f64
        %373 = llvm.load %194 : !llvm.ptr -> i64
        %374 = llvm.getelementptr %181[%373] : (!llvm.ptr, i64) -> !llvm.ptr, f64
        %372 = llvm.load %374 : !llvm.ptr -> f64
        %375 = llvm.mlir.addressof @PI : !llvm.ptr
        %376 = llvm.load %375 : !llvm.ptr -> f64
        %377 = llvm.load %194 : !llvm.ptr -> i64
        %378 = arith.sitofp %377 : i64 to f64
        %379 = arith.mulf %376, %378 : f64
        %380 = arith.mulf %379, %358 : f64
        %381 = arith.divf %380, %177 : f64
        %382 = math.sin %381 : f64
        %383 = arith.mulf %372, %382 : f64
        %384 = llvm.mlir.addressof @PI : !llvm.ptr
        %385 = llvm.load %384 : !llvm.ptr -> f64
        %386 = llvm.load %194 : !llvm.ptr -> i64
        %387 = arith.sitofp %386 : i64 to f64
        %388 = arith.mulf %385, %387 : f64
        %389 = arith.divf %383, %388 : f64
        %390 = arith.subf %371, %389 : f64
        llvm.store %390, %365 : f64, !llvm.ptr
        %391 = llvm.load %194 : !llvm.ptr -> i64
        %392 = arith.constant 1 : i32
        %394 = arith.extsi %392 : i32 to i64
        %393 = arith.addi %391, %394 : i64
        llvm.store %393, %194 : i64, !llvm.ptr
        cf.br ^bb51
      ^bb53:
      %395 = llvm.load %365 : !llvm.ptr -> f64
      %396 = arith.constant 0.0 : f32
      %398 = arith.extf %396 : f32 to f64
      %397 = arith.cmpf olt, %395, %398 : f64
      cf.cond_br %397, ^bb54, ^bb55
      ^bb54:
        %399 = arith.constant 0.0 : f32
        %400 = arith.extf %399 : f32 to f64
        llvm.store %400, %365 : f64, !llvm.ptr
        cf.br ^bb56
      ^bb55:
        cf.br ^bb56
      ^bb56:
      %401 = llvm.load %365 : !llvm.ptr -> f64
      %402 = arith.constant 1.0 : f32
      %404 = arith.extf %402 : f32 to f64
      %403 = arith.cmpf ogt, %401, %404 : f64
      cf.cond_br %403, ^bb57, ^bb58
      ^bb57:
        %405 = arith.constant 1.0 : f32
        %406 = arith.extf %405 : f32 to f64
        llvm.store %406, %365 : f64, !llvm.ptr
        cf.br ^bb59
      ^bb58:
        cf.br ^bb59
      ^bb59:
      %407 = llvm.load %365 : !llvm.ptr -> f64
      %408 = llvm.load %340 : !llvm.ptr -> i64
      %409 = llvm.getelementptr %329[%408] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %407, %409 : f64, !llvm.ptr
      %410 = llvm.load %340 : !llvm.ptr -> i64
      %411 = arith.constant 1 : i32
      %413 = arith.extsi %411 : i32 to i64
      %412 = arith.addi %410, %413 : i64
      llvm.store %412, %340 : i64, !llvm.ptr
      cf.br ^bb48
    ^bb50:
    %415 = llvm.mlir.addressof @K : !llvm.ptr
    %416 = llvm.load %415 : !llvm.ptr -> i64
    %417 = arith.constant 2 : i32
    %419 = arith.extsi %417 : i32 to i64
    %418 = arith.addi %416, %419 : i64
    %420 = arith.constant 8 : i32
    %421 = arith.extsi %420 : i32 to i64
    %414 = func.call @calloc(%418, %421) : (i64, i64) -> !llvm.ptr
    %422 = llvm.load %140 : !llvm.ptr -> f64
    %423 = llvm.mlir.addressof @K : !llvm.ptr
    %424 = llvm.load %423 : !llvm.ptr -> i64
    %425 = arith.constant 1 : i32
    %427 = arith.extsi %425 : i32 to i64
    %426 = arith.addi %424, %427 : i64
    %428 = llvm.getelementptr %414[%426] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    llvm.store %422, %428 : f64, !llvm.ptr
    %429 = llvm.mlir.addressof @K : !llvm.ptr
    %430 = llvm.load %429 : !llvm.ptr -> i64
    llvm.store %430, %116 : i64, !llvm.ptr
    cf.br ^bb60
    ^bb60:
    %431 = llvm.load %116 : !llvm.ptr -> i64
    %432 = arith.constant 1 : i32
    %434 = arith.extsi %432 : i32 to i64
    %433 = arith.cmpi sge, %431, %434 : i64
    cf.cond_br %433, ^bb61, ^bb62
    ^bb61:
      %436 = llvm.load %116 : !llvm.ptr -> i64
      %437 = arith.constant 1 : i32
      %439 = arith.extsi %437 : i32 to i64
      %438 = arith.addi %436, %439 : i64
      %440 = llvm.getelementptr %414[%438] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %435 = llvm.load %440 : !llvm.ptr -> f64
      %442 = llvm.load %116 : !llvm.ptr -> i64
      %443 = arith.constant 1 : i32
      %445 = arith.extsi %443 : i32 to i64
      %444 = arith.subi %442, %445 : i64
      %446 = llvm.getelementptr %105[%444] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      %441 = llvm.load %446 : !llvm.ptr -> f64
      %447 = arith.addf %435, %441 : f64
      %448 = llvm.load %116 : !llvm.ptr -> i64
      %449 = llvm.getelementptr %414[%448] : (!llvm.ptr, i64) -> !llvm.ptr, f64
      llvm.store %447, %449 : f64, !llvm.ptr
      %450 = llvm.load %116 : !llvm.ptr -> i64
      %451 = arith.constant 1 : i32
      %453 = arith.extsi %451 : i32 to i64
      %452 = arith.subi %450, %453 : i64
      llvm.store %452, %116 : i64, !llvm.ptr
      cf.br ^bb60
    ^bb62:
    %455 = arith.constant 1 : i32
    %456 = arith.constant 8 : i32
    %457 = arith.extsi %455 : i32 to i64
    %458 = arith.extsi %456 : i32 to i64
    %454 = func.call @calloc(%457, %458) : (i64, i64) -> !llvm.ptr
    %460 = arith.constant 1 : i32
    %461 = arith.constant 0.0 : f32
    %462 = arith.constant 1.0 : f32
    %463 = arith.extsi %460 : i32 to i64
    %464 = arith.extf %461 : f32 to f64
    %465 = arith.extf %462 : f32 to f64
    func.call @walk(%463, %464, %465, %105, %414, %329, %173, %177, %454) : (i64, f64, f64, !llvm.ptr, !llvm.ptr, !llvm.ptr, f64, f64, !llvm.ptr) -> ()
    %466 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %468 = arith.constant 0 : i32
    %469 = arith.extsi %468 : i32 to i64
    %470 = llvm.getelementptr %454[%469] : (!llvm.ptr, i64) -> !llvm.ptr, f64
    %467 = llvm.load %470 : !llvm.ptr -> f64
    %471 = llvm.call @printf(%466, %467) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
    func.call @free(%105) : (!llvm.ptr) -> ()
    func.call @free(%181) : (!llvm.ptr) -> ()
    func.call @free(%329) : (!llvm.ptr) -> ()
    func.call @free(%414) : (!llvm.ptr) -> ()
    func.call @free(%454) : (!llvm.ptr) -> ()
    %477 = arith.constant 0 : i32
    func.return %477 : i32
  }
}