Problem 911

Geometric mean of k_infinity(rho_n) for 0 <= n <= 50. Uses Shallit's continued fraction recurrences (Theorems 1 and 11).

Answer5679.934966
Output5679.934966
StatusPASS
Native helperno
Runtime30 ms
Peak memory66880 KB
Time complexityO(n) (estimated)
Space complexityO(1) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n)O(sqrt(n))
Space complexityO(1)O(1)
ApproachFlow solutionContinued fraction convergents
VerdictSuboptimal

Flow source

# Project Euler 911: Khinchin Exceptions
# Geometric mean of k_infinity(rho_n) for 0 <= n <= 50.
# Uses Shallit's continued fraction recurrences (Theorems 1 and 11).

extern {
    function malloc(n: i64) -> ptr<void>
    function free(p: ptr<void>) -> void
    function memcpy(dst: ptr<void>, src: ptr<void>, n: i64) -> void
    function log(x: f64) -> f64
    function exp(x: f64) -> f64
    function fabs(x: f64) -> f64
}

struct LA {
    data: ptr<i64>
    len: i32
    cap: i32
}

function la_new(cap: i32) -> LA {
    return LA { data: malloc((cap as i64) * 8) as ptr<i64>, len: 0, cap: cap }
}

function la_push(a: ptr<LA>, v: i64) -> void {
    if a[0].len >= a[0].cap {
        let new_cap: i32 = a[0].cap * 2
        let new_data: ptr<i64> = malloc((new_cap as i64) * 8) as ptr<i64>
        memcpy(new_data as ptr<void>, a[0].data as ptr<void>, (a[0].len as i64) * 8)
        free(a[0].data as ptr<void>)
        a[0].data = new_data
        a[0].cap = new_cap
    }
    a[0].data[a[0].len] = v
    a[0].len = a[0].len + 1
}

function la_last(a: ptr<LA>) -> i64 {
    return a[0].data[a[0].len - 1]
}

function la_copy(src: ptr<LA>) -> LA {
    let r: LA = la_new(src[0].cap)
    r.len = src[0].len
    memcpy(r.data as ptr<void>, src[0].data as ptr<void>, (src[0].len as i64) * 8)
    return r
}

function la_free(a: ptr<LA>) -> void {
    free(a[0].data as ptr<void>)
    a[0].data = null
}

function canonicalize_tail(cf: ptr<LA>) -> void {
    if cf[0].len > 1 {
        if cf[0].data[cf[0].len - 1] == 1 {
            cf[0].data[cf[0].len - 2] = cf[0].data[cf[0].len - 2] + 1
            cf[0].len = cf[0].len - 1
        }
    }
}

function avg_log_positive(arr: ptr<i64>, start: i32, len: i32) -> f64 {
    let mut s: f64 = 0.0
    for i in 0..len {
        s = s + log(arr[start + i] as f64)
    }
    return s / (len as f64)
}

# One application of Shallit Theorem 1(B) for u=2
function extend_theorem1(coeffs: ptr<LA>) -> LA {
    let last: i64 = la_last(coeffs)
    let result: LA = la_new(coeffs[0].cap + coeffs[0].len)

    for i in 0..(coeffs[0].len - 1) {
        la_push(&result, coeffs[0].data[i])
    }

    if last > 1 {
        la_push(&result, last + 1)
        la_push(&result, last - 1)
        let mut i: i32 = coeffs[0].len - 2
        while i >= 1 {
            la_push(&result, coeffs[0].data[i])
            i = i - 1
        }
    } else {
        let prelast: i64 = coeffs[0].data[coeffs[0].len - 2]
        la_push(&result, 2 + prelast)
        let mut i: i32 = coeffs[0].len - 3
        while i >= 1 {
            la_push(&result, coeffs[0].data[i])
            i = i - 1
        }
    }
    return result
}

function log_khinchin_rho0() -> f64 {
    # seed_rho(0): coeffs = [0, 1, 3]
    let mut coeffs: LA = la_new(16)
    la_push(&coeffs, 0)
    la_push(&coeffs, 1)
    la_push(&coeffs, 3)
    canonicalize_tail(&coeffs)

    let mut mu1: f64 = 0.0
    let mut mu2: f64 = 0.0
    let mut L1: i32 = 0
    let mut L2: i32 = 0

    for step in 1..23 {
        let next: LA = extend_theorem1(&coeffs)
        la_free(&coeffs)
        coeffs = next
        canonicalize_tail(&coeffs)

        if step == 20 {
            L1 = coeffs.len - 1
            mu1 = avg_log_positive(coeffs.data, 1, L1)
        }
        if step == 22 {
            L2 = coeffs.len - 1
            mu2 = avg_log_positive(coeffs.data, 1, L2)
        }
    }
    la_free(&coeffs)

    return (mu2 * (L2 as f64) - mu1 * (L1 as f64)) / ((L2 - L1) as f64)
}

function khinchin_log_limit(n: i32, max_steps: i32) -> f64 {
    if n == 0 {
        return log_khinchin_rho0()
    }

    # seed_rho(n) for n >= 1
    let mut vprime: i32 = 0
    while (1 << vprime) <= n {
        vprime = vprime + 1
    }
    let d: i64 = ((1 as i64) << vprime) - (n as i64)
    let ut: i64 = (1 as i64) << n
    let ud: i64 = (1 as i64) << d
    let mut c: i64 = 0
    for k in 0..vprime {
        c = c + ((1 as i64) << (n - (1 << k)))
    }

    let mut coeffs: LA = la_new(16)
    la_push(&coeffs, c)
    la_push(&coeffs, ud - 1)
    la_push(&coeffs, 1)
    la_push(&coeffs, ut - 1)
    la_push(&coeffs, ud)
    let t2: i64 = ut - 1

    # tail = coeffs[1:]
    let mut L: f64 = (coeffs.len - 1) as f64
    let mut mu: f64 = 0.0
    for i in 1..coeffs.len {
        mu = mu + log(coeffs.data[i] as f64)
    }
    mu = mu / L

    let first: i64 = coeffs.data[1]
    let second: i64 = coeffs.data[2]
    let mut last: i64 = coeffs.data[coeffs.len - 1]
    let mut prelast: i64 = coeffs.data[coeffs.len - 2]

    for step in 0..max_steps {
        let mu_old: f64 = mu
        let L_new: f64
        let delta: f64
        if last > 1 {
            L_new = 2.0 * L + 2.0
            delta = (0.0 - log(last as f64)) + log(t2 as f64) + log((last - 1) as f64)
            mu = mu * (2.0 * L / L_new) + delta / L_new
        } else {
            L_new = 2.0 * L
            delta = (0.0 - log(prelast as f64)) + log(t2 as f64) + log((prelast + 1) as f64)
            mu = mu + delta / L_new
        }
        L = L_new
        prelast = second
        last = first
        if fabs(mu - mu_old) < 1e-15 {
            break
        }
    }

    la_free(&coeffs)
    return mu
}

function main() -> i32 {
    let mut total_log: f64 = 0.0
    for n in 0..51 {
        total_log = total_log + khinchin_log_limit(n, 80)
    }
    let avg_log: f64 = total_log / 51.0
    printf("%.6f\n", exp(avg_log))
    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; }

typedef struct LA LA;

struct LA {
    int64_t* data;
    int32_t len;
    int32_t cap;
};

LA la_new_i32(int32_t cap);
void la_push_ptr_LA_i64(LA* a, int64_t v);
int64_t la_last_ptr_LA(LA* a);
LA la_copy_ptr_LA(LA* src);
void la_free_ptr_LA(LA* a);
void canonicalize_tail_ptr_LA(LA* cf);
double avg_log_positive_ptr_i64_i32_i32(int64_t* arr, int32_t start, int32_t len);
LA extend_theorem1_ptr_LA(LA* coeffs);
double log_khinchin_rho0(void);
double khinchin_log_limit_i32_i32(int32_t n, int32_t max_steps);
int32_t main(void);







LA la_new_i32(int32_t cap) {
    return (LA){ .data = ((int64_t*)(malloc((((int64_t)(cap)) * 8)))), .len = 0, .cap = cap };
}

void la_push_ptr_LA_i64(LA* a, int64_t v) {
    if (a[0].len >= a[0].cap) {
        int32_t new_cap = (a[0].cap * 2);
        int64_t* new_data = (int64_t*)(((int64_t*)(malloc((((int64_t)(new_cap)) * 8)))));
        memcpy(((void*)(new_data)), ((void*)(a[0].data)), (((int64_t)(a[0].len)) * 8));
        free(((void*)(a[0].data)));
        a[0].data = new_data;
        a[0].cap = new_cap;
    }
    a[0].data[a[0].len] = v;
    a[0].len = (a[0].len + 1);
}

int64_t la_last_ptr_LA(LA* a) {
    return a[0].data[(a[0].len - 1)];
}

LA la_copy_ptr_LA(LA* src) {
    LA r = la_new_i32(src[0].cap);
    r.len = src[0].len;
    memcpy(((void*)(r.data)), ((void*)(src[0].data)), (((int64_t)(src[0].len)) * 8));
    return r;
}

void la_free_ptr_LA(LA* a) {
    free(((void*)(a[0].data)));
    a[0].data = NULL;
}

void canonicalize_tail_ptr_LA(LA* cf) {
    if (cf[0].len > 1) {
        if (cf[0].data[(cf[0].len - 1)] == 1) {
            cf[0].data[(cf[0].len - 2)] = (cf[0].data[(cf[0].len - 2)] + 1);
            cf[0].len = (cf[0].len - 1);
        }
    }
}

double avg_log_positive_ptr_i64_i32_i32(int64_t* arr, int32_t start, int32_t len) {
    double s = 0.0;
    int32_t __flow_step_1 = 1;
    for (int32_t i = 0; (0 <= len) ? i < len : i > len; i += (0 <= len) ? 1 : -1) {
        s = (s + log(((double)(arr[(start + i)]))));
    }
    return (s / ((double)(len)));
}

LA extend_theorem1_ptr_LA(LA* coeffs) {
    int64_t last = la_last_ptr_LA(coeffs);
    LA result = la_new_i32((coeffs[0].cap + coeffs[0].len));
    int32_t __flow_step_2 = 1;
    for (int32_t i = 0; (0 <= (coeffs[0].len - 1)) ? i < (coeffs[0].len - 1) : i > (coeffs[0].len - 1); i += (0 <= (coeffs[0].len - 1)) ? 1 : -1) {
        la_push_ptr_LA_i64((&(result)), coeffs[0].data[i]);
    }
    if (last > 1) {
        la_push_ptr_LA_i64((&(result)), (last + 1));
        la_push_ptr_LA_i64((&(result)), (last - 1));
        int32_t i = (coeffs[0].len - 2);
        while (i >= 1) {
            la_push_ptr_LA_i64((&(result)), coeffs[0].data[i]);
            i = (i - 1);
        }
    } else {
        int64_t prelast = coeffs[0].data[(coeffs[0].len - 2)];
        la_push_ptr_LA_i64((&(result)), (2 + prelast));
        int32_t i = (coeffs[0].len - 3);
        while (i >= 1) {
            la_push_ptr_LA_i64((&(result)), coeffs[0].data[i]);
            i = (i - 1);
        }
    }
    return result;
}

double log_khinchin_rho0(void) {
    LA coeffs = la_new_i32(16);
    la_push_ptr_LA_i64((&(coeffs)), 0);
    la_push_ptr_LA_i64((&(coeffs)), 1);
    la_push_ptr_LA_i64((&(coeffs)), 3);
    canonicalize_tail_ptr_LA((&(coeffs)));
    double mu1 = 0.0;
    double mu2 = 0.0;
    int32_t L1 = 0;
    int32_t L2 = 0;
    int32_t __flow_step_3 = 1;
    for (int32_t step = 1; (1 <= 23) ? step < 23 : step > 23; step += (1 <= 23) ? 1 : -1) {
        LA next = extend_theorem1_ptr_LA((&(coeffs)));
        la_free_ptr_LA((&(coeffs)));
        coeffs = next;
        canonicalize_tail_ptr_LA((&(coeffs)));
        if (step == 20) {
            L1 = (coeffs.len - 1);
            mu1 = avg_log_positive_ptr_i64_i32_i32(coeffs.data, 1, L1);
        }
        if (step == 22) {
            L2 = (coeffs.len - 1);
            mu2 = avg_log_positive_ptr_i64_i32_i32(coeffs.data, 1, L2);
        }
    }
    la_free_ptr_LA((&(coeffs)));
    return (((mu2 * ((double)(L2))) - (mu1 * ((double)(L1)))) / ((double)((L2 - L1))));
}

double khinchin_log_limit_i32_i32(int32_t n, int32_t max_steps) {
    if (n == 0) {
        return log_khinchin_rho0();
    }
    int32_t vprime = 0;
    while (FLOW_CHECKED_SHL((1), (vprime)) <= n) {
        vprime = (vprime + 1);
    }
    int64_t d = (FLOW_CHECKED_SHL((((int64_t)(1))), (vprime)) - ((int64_t)(n)));
    int64_t ut = FLOW_CHECKED_SHL((((int64_t)(1))), (n));
    int64_t ud = FLOW_CHECKED_SHL((((int64_t)(1))), (d));
    int64_t c = 0;
    int32_t __flow_step_4 = 1;
    for (int32_t k = 0; (0 <= vprime) ? k < vprime : k > vprime; k += (0 <= vprime) ? 1 : -1) {
        c = (c + FLOW_CHECKED_SHL((((int64_t)(1))), ((n - FLOW_CHECKED_SHL((1), (k))))));
    }
    LA coeffs = la_new_i32(16);
    la_push_ptr_LA_i64((&(coeffs)), c);
    la_push_ptr_LA_i64((&(coeffs)), (ud - 1));
    la_push_ptr_LA_i64((&(coeffs)), 1);
    la_push_ptr_LA_i64((&(coeffs)), (ut - 1));
    la_push_ptr_LA_i64((&(coeffs)), ud);
    int64_t t2 = (ut - 1);
    double L = ((double)((coeffs.len - 1)));
    double mu = 0.0;
    int32_t __flow_step_5 = 1;
    for (int32_t i = 1; (1 <= coeffs.len) ? i < coeffs.len : i > coeffs.len; i += (1 <= coeffs.len) ? 1 : -1) {
        mu = (mu + log(((double)(coeffs.data[i]))));
    }
    mu = (mu / L);
    int64_t first = coeffs.data[1];
    int64_t second = coeffs.data[2];
    int64_t last = coeffs.data[(coeffs.len - 1)];
    int64_t prelast = coeffs.data[(coeffs.len - 2)];
    int32_t __flow_step_6 = 1;
    for (int32_t step = 0; (0 <= max_steps) ? step < max_steps : step > max_steps; step += (0 <= max_steps) ? 1 : -1) {
        double mu_old = mu;
        double L_new;
        double delta;
        if (last > 1) {
            L_new = ((2.0 * L) + 2.0);
            delta = (((0.0 - log(((double)(last)))) + log(((double)(t2)))) + log(((double)((last - 1)))));
            mu = ((mu * ((2.0 * L) / L_new)) + (delta / L_new));
        } else {
            L_new = (2.0 * L);
            delta = (((0.0 - log(((double)(prelast)))) + log(((double)(t2)))) + log(((double)((prelast + 1)))));
            mu = (mu + (delta / L_new));
        }
        L = L_new;
        prelast = second;
        last = first;
        if (fabs((mu - mu_old)) < 1e-15) {
            break;
        }
    }
    la_free_ptr_LA((&(coeffs)));
    return mu;
}

int32_t main(void) {
    double total_log = 0.0;
    int32_t __flow_step_7 = 1;
    for (int32_t n = 0; (0 <= 51) ? n < 51 : n > 51; n += (0 <= 51) ? 1 : -1) {
        total_log = (total_log + khinchin_log_limit_i32_i32(n, 80));
    }
    double avg_log = (total_log / 51.0);
    printf("%.6f\n", exp(avg_log));
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%.6f\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func private @malloc(i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  func.func private @memcpy(!llvm.ptr, !llvm.ptr, i64) -> ()
  func.func private @log(f64) -> f64
  func.func private @exp(f64) -> f64
  func.func private @fabs(f64) -> f64
  // Struct: LA
  // Fields:
  //   data: !llvm.ptr
  //   len: i32
  //   cap: i32
  func.func @la_new(%arg0: i32) -> !llvm.struct<(!llvm.ptr, i32, i32)> {
    %0 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %2 = arith.extsi %arg0 : i32 to i64
    %3 = arith.constant 8 : i32
    %5 = arith.extsi %3 : i32 to i64
    %4 = arith.muli %2, %5 : i64
    %1 = func.call @malloc(%4) : (i64) -> !llvm.ptr
    %6 = llvm.insertvalue %1, %0[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %7 = arith.constant 0 : i32
    %8 = llvm.insertvalue %7, %6[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %9 = llvm.insertvalue %arg0, %8[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %10 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %11 = llvm.extractvalue %9[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %12 = llvm.insertvalue %11, %10[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %13 = llvm.extractvalue %9[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %14 = llvm.insertvalue %13, %12[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %15 = llvm.extractvalue %9[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %16 = llvm.insertvalue %15, %14[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %17 = llvm.mlir.constant(1 : i64) : i64
    %18 = llvm.alloca %17 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %16, %18 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %19 = llvm.load %18 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    func.return %19 : !llvm.struct<(!llvm.ptr, i32, i32)>
  }
  func.func @la_push(%arg0: !llvm.ptr, %arg1: i64) -> () {
    %21 = arith.constant 0 : i32
    %22 = arith.extsi %21 : i32 to i64
    %23 = llvm.getelementptr %arg0[%22] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %20 = llvm.load %23 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %24 = arith.constant 0 : i32
    %25 = arith.extsi %24 : i32 to i64
    %26 = llvm.getelementptr %arg0[%25] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %27 = llvm.getelementptr %26[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %28 = llvm.load %27 : !llvm.ptr -> i32
    %30 = arith.constant 0 : i32
    %31 = arith.extsi %30 : i32 to i64
    %32 = llvm.getelementptr %arg0[%31] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %29 = llvm.load %32 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %33 = arith.constant 0 : i32
    %34 = arith.extsi %33 : i32 to i64
    %35 = llvm.getelementptr %arg0[%34] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %36 = llvm.getelementptr %35[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %37 = llvm.load %36 : !llvm.ptr -> i32
    %38 = arith.cmpi sge, %28, %37 : i32
    cf.cond_br %38, ^bb0, ^bb1
    ^bb0:
      %40 = arith.constant 0 : i32
      %41 = arith.extsi %40 : i32 to i64
      %42 = llvm.getelementptr %arg0[%41] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %39 = llvm.load %42 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %43 = arith.constant 0 : i32
      %44 = arith.extsi %43 : i32 to i64
      %45 = llvm.getelementptr %arg0[%44] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %46 = llvm.getelementptr %45[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %47 = llvm.load %46 : !llvm.ptr -> i32
      %48 = arith.constant 2 : i32
      %49 = arith.muli %47, %48 : i32
      %51 = arith.extsi %49 : i32 to i64
      %52 = arith.constant 8 : i32
      %54 = arith.extsi %52 : i32 to i64
      %53 = arith.muli %51, %54 : i64
      %50 = func.call @malloc(%53) : (i64) -> !llvm.ptr
      %57 = arith.constant 0 : i32
      %58 = arith.extsi %57 : i32 to i64
      %59 = llvm.getelementptr %arg0[%58] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %56 = llvm.load %59 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %60 = arith.constant 0 : i32
      %61 = arith.extsi %60 : i32 to i64
      %62 = llvm.getelementptr %arg0[%61] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %63 = llvm.getelementptr %62[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %64 = llvm.load %63 : !llvm.ptr -> !llvm.ptr
      %66 = arith.constant 0 : i32
      %67 = arith.extsi %66 : i32 to i64
      %68 = llvm.getelementptr %arg0[%67] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %65 = llvm.load %68 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %69 = arith.constant 0 : i32
      %70 = arith.extsi %69 : i32 to i64
      %71 = llvm.getelementptr %arg0[%70] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %72 = llvm.getelementptr %71[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %73 = llvm.load %72 : !llvm.ptr -> i32
      %74 = arith.extsi %73 : i32 to i64
      %75 = arith.constant 8 : i32
      %77 = arith.extsi %75 : i32 to i64
      %76 = arith.muli %74, %77 : i64
      func.call @memcpy(%50, %64, %76) : (!llvm.ptr, !llvm.ptr, i64) -> ()
      %80 = arith.constant 0 : i32
      %81 = arith.extsi %80 : i32 to i64
      %82 = llvm.getelementptr %arg0[%81] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %79 = llvm.load %82 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %83 = arith.constant 0 : i32
      %84 = arith.extsi %83 : i32 to i64
      %85 = llvm.getelementptr %arg0[%84] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %86 = llvm.getelementptr %85[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %87 = llvm.load %86 : !llvm.ptr -> !llvm.ptr
      func.call @free(%87) : (!llvm.ptr) -> ()
      %88 = arith.constant 0 : i32
      %89 = arith.extsi %88 : i32 to i64
      %90 = llvm.getelementptr %arg0[%89] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %91 = llvm.getelementptr %90[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      llvm.store %50, %91 : !llvm.ptr, !llvm.ptr
      %92 = arith.constant 0 : i32
      %93 = arith.extsi %92 : i32 to i64
      %94 = llvm.getelementptr %arg0[%93] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %95 = llvm.getelementptr %94[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      llvm.store %49, %95 : i32, !llvm.ptr
      cf.br ^bb2
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %97 = arith.constant 0 : i32
    %98 = arith.extsi %97 : i32 to i64
    %99 = llvm.getelementptr %arg0[%98] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %96 = llvm.load %99 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %100 = arith.constant 0 : i32
    %101 = arith.extsi %100 : i32 to i64
    %102 = llvm.getelementptr %arg0[%101] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %103 = llvm.getelementptr %102[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %104 = llvm.load %103 : !llvm.ptr -> !llvm.ptr
    %106 = arith.constant 0 : i32
    %107 = arith.extsi %106 : i32 to i64
    %108 = llvm.getelementptr %arg0[%107] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %105 = llvm.load %108 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %109 = arith.constant 0 : i32
    %110 = arith.extsi %109 : i32 to i64
    %111 = llvm.getelementptr %arg0[%110] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %112 = llvm.getelementptr %111[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %113 = llvm.load %112 : !llvm.ptr -> i32
    %114 = arith.extsi %113 : i32 to i64
    %115 = llvm.getelementptr %104[%114] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %arg1, %115 : i64, !llvm.ptr
    %117 = arith.constant 0 : i32
    %118 = arith.extsi %117 : i32 to i64
    %119 = llvm.getelementptr %arg0[%118] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %116 = llvm.load %119 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %120 = arith.constant 0 : i32
    %121 = arith.extsi %120 : i32 to i64
    %122 = llvm.getelementptr %arg0[%121] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %123 = llvm.getelementptr %122[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %124 = llvm.load %123 : !llvm.ptr -> i32
    %125 = arith.constant 1 : i32
    %126 = arith.addi %124, %125 : i32
    %127 = arith.constant 0 : i32
    %128 = arith.extsi %127 : i32 to i64
    %129 = llvm.getelementptr %arg0[%128] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %130 = llvm.getelementptr %129[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    llvm.store %126, %130 : i32, !llvm.ptr
    func.return
  }
  func.func @la_last(%arg0: !llvm.ptr) -> i64 {
    %133 = arith.constant 0 : i32
    %134 = arith.extsi %133 : i32 to i64
    %135 = llvm.getelementptr %arg0[%134] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %132 = llvm.load %135 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %136 = arith.constant 0 : i32
    %137 = arith.extsi %136 : i32 to i64
    %138 = llvm.getelementptr %arg0[%137] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %139 = llvm.getelementptr %138[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %140 = llvm.load %139 : !llvm.ptr -> !llvm.ptr
    %142 = arith.constant 0 : i32
    %143 = arith.extsi %142 : i32 to i64
    %144 = llvm.getelementptr %arg0[%143] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %141 = llvm.load %144 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %145 = arith.constant 0 : i32
    %146 = arith.extsi %145 : i32 to i64
    %147 = llvm.getelementptr %arg0[%146] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %148 = llvm.getelementptr %147[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %149 = llvm.load %148 : !llvm.ptr -> i32
    %150 = arith.constant 1 : i32
    %151 = arith.subi %149, %150 : i32
    %152 = arith.extsi %151 : i32 to i64
    %153 = llvm.getelementptr %140[%152] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %131 = llvm.load %153 : !llvm.ptr -> i64
    func.return %131 : i64
  }
  func.func @la_copy(%arg0: !llvm.ptr) -> !llvm.struct<(!llvm.ptr, i32, i32)> {
    %156 = arith.constant 0 : i32
    %157 = arith.extsi %156 : i32 to i64
    %158 = llvm.getelementptr %arg0[%157] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %155 = llvm.load %158 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %159 = arith.constant 0 : i32
    %160 = arith.extsi %159 : i32 to i64
    %161 = llvm.getelementptr %arg0[%160] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %162 = llvm.getelementptr %161[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %163 = llvm.load %162 : !llvm.ptr -> i32
    %154 = func.call @la_new(%163) : (i32) -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %164 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %165 = llvm.extractvalue %154[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %166 = llvm.insertvalue %165, %164[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %167 = llvm.extractvalue %154[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %168 = llvm.insertvalue %167, %166[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %169 = llvm.extractvalue %154[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %170 = llvm.insertvalue %169, %168[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %171 = llvm.mlir.constant(1 : i64) : i64
    %172 = llvm.alloca %171 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %170, %172 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %173 = llvm.load %172 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %174 = llvm.mlir.constant(1 : i64) : i64
    %175 = llvm.alloca %174 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %173, %175 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %177 = arith.constant 0 : i32
    %178 = arith.extsi %177 : i32 to i64
    %179 = llvm.getelementptr %arg0[%178] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %176 = llvm.load %179 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %180 = arith.constant 0 : i32
    %181 = arith.extsi %180 : i32 to i64
    %182 = llvm.getelementptr %arg0[%181] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %183 = llvm.getelementptr %182[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %184 = llvm.load %183 : !llvm.ptr -> i32
    %185 = llvm.getelementptr %175[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    llvm.store %184, %185 : i32, !llvm.ptr
    %187 = llvm.load %175 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %188 = llvm.getelementptr %175[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %189 = llvm.load %188 : !llvm.ptr -> !llvm.ptr
    %191 = arith.constant 0 : i32
    %192 = arith.extsi %191 : i32 to i64
    %193 = llvm.getelementptr %arg0[%192] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %190 = llvm.load %193 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %194 = arith.constant 0 : i32
    %195 = arith.extsi %194 : i32 to i64
    %196 = llvm.getelementptr %arg0[%195] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %197 = llvm.getelementptr %196[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %198 = llvm.load %197 : !llvm.ptr -> !llvm.ptr
    %200 = arith.constant 0 : i32
    %201 = arith.extsi %200 : i32 to i64
    %202 = llvm.getelementptr %arg0[%201] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %199 = llvm.load %202 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %203 = arith.constant 0 : i32
    %204 = arith.extsi %203 : i32 to i64
    %205 = llvm.getelementptr %arg0[%204] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %206 = llvm.getelementptr %205[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %207 = llvm.load %206 : !llvm.ptr -> i32
    %208 = arith.extsi %207 : i32 to i64
    %209 = arith.constant 8 : i32
    %211 = arith.extsi %209 : i32 to i64
    %210 = arith.muli %208, %211 : i64
    func.call @memcpy(%189, %198, %210) : (!llvm.ptr, !llvm.ptr, i64) -> ()
    %212 = llvm.load %175 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %213 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %214 = llvm.extractvalue %212[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %215 = llvm.insertvalue %214, %213[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %216 = llvm.extractvalue %212[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %217 = llvm.insertvalue %216, %215[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %218 = llvm.extractvalue %212[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %219 = llvm.insertvalue %218, %217[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %220 = llvm.mlir.constant(1 : i64) : i64
    %221 = llvm.alloca %220 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %219, %221 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %222 = llvm.load %221 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    func.return %222 : !llvm.struct<(!llvm.ptr, i32, i32)>
  }
  func.func @la_free(%arg0: !llvm.ptr) -> () {
    %225 = arith.constant 0 : i32
    %226 = arith.extsi %225 : i32 to i64
    %227 = llvm.getelementptr %arg0[%226] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %224 = llvm.load %227 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %228 = arith.constant 0 : i32
    %229 = arith.extsi %228 : i32 to i64
    %230 = llvm.getelementptr %arg0[%229] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %231 = llvm.getelementptr %230[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %232 = llvm.load %231 : !llvm.ptr -> !llvm.ptr
    func.call @free(%232) : (!llvm.ptr) -> ()
    %233 = llvm.mlir.zero : !llvm.ptr
    %234 = arith.constant 0 : i32
    %235 = arith.extsi %234 : i32 to i64
    %236 = llvm.getelementptr %arg0[%235] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %237 = llvm.getelementptr %236[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    llvm.store %233, %237 : !llvm.ptr, !llvm.ptr
    func.return
  }
  func.func @canonicalize_tail(%arg0: !llvm.ptr) -> () {
    %239 = arith.constant 0 : i32
    %240 = arith.extsi %239 : i32 to i64
    %241 = llvm.getelementptr %arg0[%240] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %238 = llvm.load %241 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %242 = arith.constant 0 : i32
    %243 = arith.extsi %242 : i32 to i64
    %244 = llvm.getelementptr %arg0[%243] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %245 = llvm.getelementptr %244[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %246 = llvm.load %245 : !llvm.ptr -> i32
    %247 = arith.constant 1 : i32
    %248 = arith.cmpi sgt, %246, %247 : i32
    cf.cond_br %248, ^bb3, ^bb4
    ^bb3:
      %251 = arith.constant 0 : i32
      %252 = arith.extsi %251 : i32 to i64
      %253 = llvm.getelementptr %arg0[%252] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %250 = llvm.load %253 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %254 = arith.constant 0 : i32
      %255 = arith.extsi %254 : i32 to i64
      %256 = llvm.getelementptr %arg0[%255] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %257 = llvm.getelementptr %256[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %258 = llvm.load %257 : !llvm.ptr -> !llvm.ptr
      %260 = arith.constant 0 : i32
      %261 = arith.extsi %260 : i32 to i64
      %262 = llvm.getelementptr %arg0[%261] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %259 = llvm.load %262 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %263 = arith.constant 0 : i32
      %264 = arith.extsi %263 : i32 to i64
      %265 = llvm.getelementptr %arg0[%264] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %266 = llvm.getelementptr %265[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %267 = llvm.load %266 : !llvm.ptr -> i32
      %268 = arith.constant 1 : i32
      %269 = arith.subi %267, %268 : i32
      %270 = arith.extsi %269 : i32 to i64
      %271 = llvm.getelementptr %258[%270] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %249 = llvm.load %271 : !llvm.ptr -> i64
      %272 = arith.constant 1 : i32
      %274 = arith.extsi %272 : i32 to i64
      %273 = arith.cmpi eq, %249, %274 : i64
      cf.cond_br %273, ^bb6, ^bb7
      ^bb6:
        %277 = arith.constant 0 : i32
        %278 = arith.extsi %277 : i32 to i64
        %279 = llvm.getelementptr %arg0[%278] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %276 = llvm.load %279 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %280 = arith.constant 0 : i32
        %281 = arith.extsi %280 : i32 to i64
        %282 = llvm.getelementptr %arg0[%281] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %283 = llvm.getelementptr %282[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %284 = llvm.load %283 : !llvm.ptr -> !llvm.ptr
        %286 = arith.constant 0 : i32
        %287 = arith.extsi %286 : i32 to i64
        %288 = llvm.getelementptr %arg0[%287] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %285 = llvm.load %288 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %289 = arith.constant 0 : i32
        %290 = arith.extsi %289 : i32 to i64
        %291 = llvm.getelementptr %arg0[%290] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %292 = llvm.getelementptr %291[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %293 = llvm.load %292 : !llvm.ptr -> i32
        %294 = arith.constant 2 : i32
        %295 = arith.subi %293, %294 : i32
        %296 = arith.extsi %295 : i32 to i64
        %297 = llvm.getelementptr %284[%296] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %275 = llvm.load %297 : !llvm.ptr -> i64
        %298 = arith.constant 1 : i32
        %300 = arith.extsi %298 : i32 to i64
        %299 = arith.addi %275, %300 : i64
        %302 = arith.constant 0 : i32
        %303 = arith.extsi %302 : i32 to i64
        %304 = llvm.getelementptr %arg0[%303] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %301 = llvm.load %304 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %305 = arith.constant 0 : i32
        %306 = arith.extsi %305 : i32 to i64
        %307 = llvm.getelementptr %arg0[%306] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %308 = llvm.getelementptr %307[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %309 = llvm.load %308 : !llvm.ptr -> !llvm.ptr
        %311 = arith.constant 0 : i32
        %312 = arith.extsi %311 : i32 to i64
        %313 = llvm.getelementptr %arg0[%312] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %310 = llvm.load %313 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %314 = arith.constant 0 : i32
        %315 = arith.extsi %314 : i32 to i64
        %316 = llvm.getelementptr %arg0[%315] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %317 = llvm.getelementptr %316[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %318 = llvm.load %317 : !llvm.ptr -> i32
        %319 = arith.constant 2 : i32
        %320 = arith.subi %318, %319 : i32
        %321 = arith.extsi %320 : i32 to i64
        %322 = llvm.getelementptr %309[%321] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %299, %322 : i64, !llvm.ptr
        %324 = arith.constant 0 : i32
        %325 = arith.extsi %324 : i32 to i64
        %326 = llvm.getelementptr %arg0[%325] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %323 = llvm.load %326 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %327 = arith.constant 0 : i32
        %328 = arith.extsi %327 : i32 to i64
        %329 = llvm.getelementptr %arg0[%328] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %330 = llvm.getelementptr %329[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %331 = llvm.load %330 : !llvm.ptr -> i32
        %332 = arith.constant 1 : i32
        %333 = arith.subi %331, %332 : i32
        %334 = arith.constant 0 : i32
        %335 = arith.extsi %334 : i32 to i64
        %336 = llvm.getelementptr %arg0[%335] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %337 = llvm.getelementptr %336[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        llvm.store %333, %337 : i32, !llvm.ptr
        cf.br ^bb8
      ^bb7:
        cf.br ^bb8
      ^bb8:
      cf.br ^bb5
    ^bb4:
      cf.br ^bb5
    ^bb5:
    func.return
  }
  func.func @avg_log_positive(%arg0: !llvm.ptr, %arg1: i32, %arg2: i32) -> f64 {
    %338 = arith.constant 0.0 : f32
    %339 = arith.extf %338 : f32 to f64
    %340 = llvm.mlir.constant(1 : i64) : i64
    %341 = llvm.alloca %340 x f64 : (i64) -> !llvm.ptr
    llvm.store %339, %341 : f64, !llvm.ptr
    %342 = arith.constant 0 : i32
    %343 = arith.index_cast %342 : i32 to index
    %344 = arith.index_cast %arg2 : i32 to index
    %346 = arith.constant 1 : index
    %347 = arith.constant -1 : index
    %348 = arith.cmpi sle, %343, %344 : index
    %345 = arith.select %348, %346, %347 : index
    cf.br ^bb9(%343 : index)
    ^bb9(%349: index):
    %350 = arith.cmpi slt, %349, %344 : index
    %351 = arith.cmpi sgt, %349, %344 : index
    %352 = arith.select %348, %350, %351 : i1
    cf.cond_br %352, ^bb10(%349 : index), ^bb11(%349 : index)
    ^bb10(%353: index):
      %354 = llvm.load %341 : !llvm.ptr -> f64
      %357 = arith.index_cast %353 : index to i32
      %356 = arith.addi %arg1, %357 : i32
      %358 = arith.extsi %356 : i32 to i64
      %359 = llvm.getelementptr %arg0[%358] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %355 = llvm.load %359 : !llvm.ptr -> i64
      %360 = arith.sitofp %355 : i64 to f64
      %361 = math.log %360 : f64
      %362 = arith.addf %354, %361 : f64
      llvm.store %362, %341 : f64, !llvm.ptr
      %363 = arith.addi %353, %345 : index
      cf.br ^bb9(%363 : index)
    ^bb11(%364: index):
    %365 = llvm.load %341 : !llvm.ptr -> f64
    %366 = arith.sitofp %arg2 : i32 to f64
    %367 = arith.divf %365, %366 : f64
    func.return %367 : f64
  }
  func.func @extend_theorem1(%arg0: !llvm.ptr) -> !llvm.struct<(!llvm.ptr, i32, i32)> {
    %368 = func.call @la_last(%arg0) : (!llvm.ptr) -> i64
    %371 = arith.constant 0 : i32
    %372 = arith.extsi %371 : i32 to i64
    %373 = llvm.getelementptr %arg0[%372] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %370 = llvm.load %373 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %374 = arith.constant 0 : i32
    %375 = arith.extsi %374 : i32 to i64
    %376 = llvm.getelementptr %arg0[%375] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %377 = llvm.getelementptr %376[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %378 = llvm.load %377 : !llvm.ptr -> i32
    %380 = arith.constant 0 : i32
    %381 = arith.extsi %380 : i32 to i64
    %382 = llvm.getelementptr %arg0[%381] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %379 = llvm.load %382 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %383 = arith.constant 0 : i32
    %384 = arith.extsi %383 : i32 to i64
    %385 = llvm.getelementptr %arg0[%384] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %386 = llvm.getelementptr %385[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %387 = llvm.load %386 : !llvm.ptr -> i32
    %388 = arith.addi %378, %387 : i32
    %369 = func.call @la_new(%388) : (i32) -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %389 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %390 = llvm.extractvalue %369[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %391 = llvm.insertvalue %390, %389[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %392 = llvm.extractvalue %369[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %393 = llvm.insertvalue %392, %391[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %394 = llvm.extractvalue %369[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %395 = llvm.insertvalue %394, %393[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %396 = llvm.mlir.constant(1 : i64) : i64
    %397 = llvm.alloca %396 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %395, %397 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %398 = llvm.load %397 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %399 = llvm.mlir.constant(1 : i64) : i64
    %400 = llvm.alloca %399 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %398, %400 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %401 = arith.constant 0 : i32
    %403 = arith.constant 0 : i32
    %404 = arith.extsi %403 : i32 to i64
    %405 = llvm.getelementptr %arg0[%404] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %402 = llvm.load %405 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %406 = arith.constant 0 : i32
    %407 = arith.extsi %406 : i32 to i64
    %408 = llvm.getelementptr %arg0[%407] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %409 = llvm.getelementptr %408[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %410 = llvm.load %409 : !llvm.ptr -> i32
    %411 = arith.constant 1 : i32
    %412 = arith.subi %410, %411 : i32
    %413 = arith.index_cast %401 : i32 to index
    %414 = arith.index_cast %412 : i32 to index
    %416 = arith.constant 1 : index
    %417 = arith.constant -1 : index
    %418 = arith.cmpi sle, %413, %414 : index
    %415 = arith.select %418, %416, %417 : index
    cf.br ^bb12(%413 : index)
    ^bb12(%419: index):
    %420 = arith.cmpi slt, %419, %414 : index
    %421 = arith.cmpi sgt, %419, %414 : index
    %422 = arith.select %418, %420, %421 : i1
    cf.cond_br %422, ^bb13(%419 : index), ^bb14(%419 : index)
    ^bb13(%423: index):
      %427 = arith.constant 0 : i32
      %428 = arith.extsi %427 : i32 to i64
      %429 = llvm.getelementptr %arg0[%428] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %426 = llvm.load %429 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %430 = arith.constant 0 : i32
      %431 = arith.extsi %430 : i32 to i64
      %432 = llvm.getelementptr %arg0[%431] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %433 = llvm.getelementptr %432[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %434 = llvm.load %433 : !llvm.ptr -> !llvm.ptr
      %435 = arith.index_cast %423 : index to i64
      %436 = llvm.getelementptr %434[%435] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %425 = llvm.load %436 : !llvm.ptr -> i64
      func.call @la_push(%400, %425) : (!llvm.ptr, i64) -> ()
      %437 = arith.addi %423, %415 : index
      cf.br ^bb12(%437 : index)
    ^bb14(%438: index):
    %439 = arith.constant 1 : i32
    %441 = arith.extsi %439 : i32 to i64
    %440 = arith.cmpi sgt, %368, %441 : i64
    cf.cond_br %440, ^bb15, ^bb16
    ^bb15:
      %443 = arith.constant 1 : i32
      %445 = arith.extsi %443 : i32 to i64
      %444 = arith.addi %368, %445 : i64
      func.call @la_push(%400, %444) : (!llvm.ptr, i64) -> ()
      %447 = arith.constant 1 : i32
      %449 = arith.extsi %447 : i32 to i64
      %448 = arith.subi %368, %449 : i64
      func.call @la_push(%400, %448) : (!llvm.ptr, i64) -> ()
      %451 = arith.constant 0 : i32
      %452 = arith.extsi %451 : i32 to i64
      %453 = llvm.getelementptr %arg0[%452] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %450 = llvm.load %453 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %454 = arith.constant 0 : i32
      %455 = arith.extsi %454 : i32 to i64
      %456 = llvm.getelementptr %arg0[%455] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %457 = llvm.getelementptr %456[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %458 = llvm.load %457 : !llvm.ptr -> i32
      %459 = arith.constant 2 : i32
      %460 = arith.subi %458, %459 : i32
      %461 = llvm.mlir.constant(1 : i64) : i64
      %462 = llvm.alloca %461 x i32 : (i64) -> !llvm.ptr
      llvm.store %460, %462 : i32, !llvm.ptr
      cf.br ^bb18
      ^bb18:
      %463 = llvm.load %462 : !llvm.ptr -> i32
      %464 = arith.constant 1 : i32
      %465 = arith.cmpi sge, %463, %464 : i32
      cf.cond_br %465, ^bb19, ^bb20
      ^bb19:
        %469 = arith.constant 0 : i32
        %470 = arith.extsi %469 : i32 to i64
        %471 = llvm.getelementptr %arg0[%470] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %468 = llvm.load %471 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %472 = arith.constant 0 : i32
        %473 = arith.extsi %472 : i32 to i64
        %474 = llvm.getelementptr %arg0[%473] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %475 = llvm.getelementptr %474[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %476 = llvm.load %475 : !llvm.ptr -> !llvm.ptr
        %477 = llvm.load %462 : !llvm.ptr -> i32
        %478 = arith.extsi %477 : i32 to i64
        %479 = llvm.getelementptr %476[%478] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %467 = llvm.load %479 : !llvm.ptr -> i64
        func.call @la_push(%400, %467) : (!llvm.ptr, i64) -> ()
        %480 = llvm.load %462 : !llvm.ptr -> i32
        %481 = arith.constant 1 : i32
        %482 = arith.subi %480, %481 : i32
        llvm.store %482, %462 : i32, !llvm.ptr
        cf.br ^bb18
      ^bb20:
      cf.br ^bb17(%423 : index)
    ^bb16:
      %485 = arith.constant 0 : i32
      %486 = arith.extsi %485 : i32 to i64
      %487 = llvm.getelementptr %arg0[%486] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %484 = llvm.load %487 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %488 = arith.constant 0 : i32
      %489 = arith.extsi %488 : i32 to i64
      %490 = llvm.getelementptr %arg0[%489] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %491 = llvm.getelementptr %490[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %492 = llvm.load %491 : !llvm.ptr -> !llvm.ptr
      %494 = arith.constant 0 : i32
      %495 = arith.extsi %494 : i32 to i64
      %496 = llvm.getelementptr %arg0[%495] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %493 = llvm.load %496 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %497 = arith.constant 0 : i32
      %498 = arith.extsi %497 : i32 to i64
      %499 = llvm.getelementptr %arg0[%498] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %500 = llvm.getelementptr %499[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %501 = llvm.load %500 : !llvm.ptr -> i32
      %502 = arith.constant 2 : i32
      %503 = arith.subi %501, %502 : i32
      %504 = arith.extsi %503 : i32 to i64
      %505 = llvm.getelementptr %492[%504] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %483 = llvm.load %505 : !llvm.ptr -> i64
      %507 = arith.constant 2 : i32
      %509 = arith.extsi %507 : i32 to i64
      %508 = arith.addi %509, %483 : i64
      func.call @la_push(%400, %508) : (!llvm.ptr, i64) -> ()
      %511 = arith.constant 0 : i32
      %512 = arith.extsi %511 : i32 to i64
      %513 = llvm.getelementptr %arg0[%512] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %510 = llvm.load %513 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %514 = arith.constant 0 : i32
      %515 = arith.extsi %514 : i32 to i64
      %516 = llvm.getelementptr %arg0[%515] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %517 = llvm.getelementptr %516[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %518 = llvm.load %517 : !llvm.ptr -> i32
      %519 = arith.constant 3 : i32
      %520 = arith.subi %518, %519 : i32
      %521 = llvm.mlir.constant(1 : i64) : i64
      %522 = llvm.alloca %521 x i32 : (i64) -> !llvm.ptr
      llvm.store %520, %522 : i32, !llvm.ptr
      cf.br ^bb21
      ^bb21:
      %523 = llvm.load %522 : !llvm.ptr -> i32
      %524 = arith.constant 1 : i32
      %525 = arith.cmpi sge, %523, %524 : i32
      cf.cond_br %525, ^bb22, ^bb23
      ^bb22:
        %529 = arith.constant 0 : i32
        %530 = arith.extsi %529 : i32 to i64
        %531 = llvm.getelementptr %arg0[%530] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %528 = llvm.load %531 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %532 = arith.constant 0 : i32
        %533 = arith.extsi %532 : i32 to i64
        %534 = llvm.getelementptr %arg0[%533] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %535 = llvm.getelementptr %534[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %536 = llvm.load %535 : !llvm.ptr -> !llvm.ptr
        %537 = llvm.load %522 : !llvm.ptr -> i32
        %538 = arith.extsi %537 : i32 to i64
        %539 = llvm.getelementptr %536[%538] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %527 = llvm.load %539 : !llvm.ptr -> i64
        func.call @la_push(%400, %527) : (!llvm.ptr, i64) -> ()
        %540 = llvm.load %522 : !llvm.ptr -> i32
        %541 = arith.constant 1 : i32
        %542 = arith.subi %540, %541 : i32
        llvm.store %542, %522 : i32, !llvm.ptr
        cf.br ^bb21
      ^bb23:
      cf.br ^bb17(%423 : index)
    ^bb17(%543: index):
    %544 = llvm.load %400 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %545 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %546 = llvm.extractvalue %544[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %547 = llvm.insertvalue %546, %545[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %548 = llvm.extractvalue %544[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %549 = llvm.insertvalue %548, %547[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %550 = llvm.extractvalue %544[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %551 = llvm.insertvalue %550, %549[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %552 = llvm.mlir.constant(1 : i64) : i64
    %553 = llvm.alloca %552 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %551, %553 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %554 = llvm.load %553 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    func.return %554 : !llvm.struct<(!llvm.ptr, i32, i32)>
  }
  func.func @log_khinchin_rho0() -> f64 {
    %556 = arith.constant 16 : i32
    %555 = func.call @la_new(%556) : (i32) -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %557 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %558 = llvm.extractvalue %555[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %559 = llvm.insertvalue %558, %557[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %560 = llvm.extractvalue %555[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %561 = llvm.insertvalue %560, %559[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %562 = llvm.extractvalue %555[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %563 = llvm.insertvalue %562, %561[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %564 = llvm.mlir.constant(1 : i64) : i64
    %565 = llvm.alloca %564 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %563, %565 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %566 = llvm.load %565 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %567 = llvm.mlir.constant(1 : i64) : i64
    %568 = llvm.alloca %567 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %566, %568 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %570 = arith.constant 0 : i32
    %571 = arith.extsi %570 : i32 to i64
    func.call @la_push(%568, %571) : (!llvm.ptr, i64) -> ()
    %573 = arith.constant 1 : i32
    %574 = arith.extsi %573 : i32 to i64
    func.call @la_push(%568, %574) : (!llvm.ptr, i64) -> ()
    %576 = arith.constant 3 : i32
    %577 = arith.extsi %576 : i32 to i64
    func.call @la_push(%568, %577) : (!llvm.ptr, i64) -> ()
    func.call @canonicalize_tail(%568) : (!llvm.ptr) -> ()
    %579 = arith.constant 0.0 : f32
    %580 = arith.extf %579 : f32 to f64
    %581 = llvm.mlir.constant(1 : i64) : i64
    %582 = llvm.alloca %581 x f64 : (i64) -> !llvm.ptr
    llvm.store %580, %582 : f64, !llvm.ptr
    %583 = arith.constant 0.0 : f32
    %584 = arith.extf %583 : f32 to f64
    %585 = llvm.mlir.constant(1 : i64) : i64
    %586 = llvm.alloca %585 x f64 : (i64) -> !llvm.ptr
    llvm.store %584, %586 : f64, !llvm.ptr
    %587 = arith.constant 0 : i32
    %588 = llvm.mlir.constant(1 : i64) : i64
    %589 = llvm.alloca %588 x i32 : (i64) -> !llvm.ptr
    llvm.store %587, %589 : i32, !llvm.ptr
    %590 = arith.constant 0 : i32
    %591 = llvm.mlir.constant(1 : i64) : i64
    %592 = llvm.alloca %591 x i32 : (i64) -> !llvm.ptr
    llvm.store %590, %592 : i32, !llvm.ptr
    %593 = arith.constant 1 : i32
    %594 = arith.constant 23 : i32
    %595 = arith.index_cast %593 : i32 to index
    %596 = arith.index_cast %594 : i32 to index
    %598 = arith.constant 1 : index
    %599 = arith.constant -1 : index
    %600 = arith.cmpi sle, %595, %596 : index
    %597 = arith.select %600, %598, %599 : index
    cf.br ^bb24(%595 : index)
    ^bb24(%601: index):
    %602 = arith.cmpi slt, %601, %596 : index
    %603 = arith.cmpi sgt, %601, %596 : index
    %604 = arith.select %600, %602, %603 : i1
    cf.cond_br %604, ^bb25(%601 : index), ^bb26(%601 : index)
    ^bb25(%605: index):
      %606 = func.call @extend_theorem1(%568) : (!llvm.ptr) -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %607 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
      %608 = llvm.extractvalue %606[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
      %609 = llvm.insertvalue %608, %607[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
      %610 = llvm.extractvalue %606[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
      %611 = llvm.insertvalue %610, %609[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
      %612 = llvm.extractvalue %606[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
      %613 = llvm.insertvalue %612, %611[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
      %614 = llvm.mlir.constant(1 : i64) : i64
      %615 = llvm.alloca %614 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
      llvm.store %613, %615 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
      %616 = llvm.load %615 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %617 = llvm.mlir.constant(1 : i64) : i64
      %618 = llvm.alloca %617 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
      llvm.store %616, %618 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
      func.call @la_free(%568) : (!llvm.ptr) -> ()
      %620 = llvm.load %618 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      llvm.store %620, %568 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
      func.call @canonicalize_tail(%568) : (!llvm.ptr) -> ()
      %622 = arith.constant 20 : i32
      %624 = arith.index_cast %605 : index to i32
      %623 = arith.cmpi eq, %624, %622 : i32
      cf.cond_br %623, ^bb27, ^bb28
      ^bb27:
        %625 = llvm.load %568 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %626 = llvm.getelementptr %568[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %627 = llvm.load %626 : !llvm.ptr -> i32
        %628 = arith.constant 1 : i32
        %629 = arith.subi %627, %628 : i32
        llvm.store %629, %589 : i32, !llvm.ptr
        %631 = llvm.load %568 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %632 = llvm.getelementptr %568[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %633 = llvm.load %632 : !llvm.ptr -> !llvm.ptr
        %634 = arith.constant 1 : i32
        %635 = llvm.load %589 : !llvm.ptr -> i32
        %630 = func.call @avg_log_positive(%633, %634, %635) : (!llvm.ptr, i32, i32) -> f64
        llvm.store %630, %582 : f64, !llvm.ptr
        cf.br ^bb29
      ^bb28:
        cf.br ^bb29
      ^bb29:
      %636 = arith.constant 22 : i32
      %638 = arith.index_cast %605 : index to i32
      %637 = arith.cmpi eq, %638, %636 : i32
      cf.cond_br %637, ^bb30, ^bb31
      ^bb30:
        %639 = llvm.load %568 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %640 = llvm.getelementptr %568[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %641 = llvm.load %640 : !llvm.ptr -> i32
        %642 = arith.constant 1 : i32
        %643 = arith.subi %641, %642 : i32
        llvm.store %643, %592 : i32, !llvm.ptr
        %645 = llvm.load %568 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
        %646 = llvm.getelementptr %568[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
        %647 = llvm.load %646 : !llvm.ptr -> !llvm.ptr
        %648 = arith.constant 1 : i32
        %649 = llvm.load %592 : !llvm.ptr -> i32
        %644 = func.call @avg_log_positive(%647, %648, %649) : (!llvm.ptr, i32, i32) -> f64
        llvm.store %644, %586 : f64, !llvm.ptr
        cf.br ^bb32
      ^bb31:
        cf.br ^bb32
      ^bb32:
      %650 = arith.addi %605, %597 : index
      cf.br ^bb24(%650 : index)
    ^bb26(%651: index):
    func.call @la_free(%568) : (!llvm.ptr) -> ()
    %653 = llvm.load %586 : !llvm.ptr -> f64
    %654 = llvm.load %592 : !llvm.ptr -> i32
    %655 = arith.sitofp %654 : i32 to f64
    %656 = arith.mulf %653, %655 : f64
    %657 = llvm.load %582 : !llvm.ptr -> f64
    %658 = llvm.load %589 : !llvm.ptr -> i32
    %659 = arith.sitofp %658 : i32 to f64
    %660 = arith.mulf %657, %659 : f64
    %661 = arith.subf %656, %660 : f64
    %662 = llvm.load %592 : !llvm.ptr -> i32
    %663 = llvm.load %589 : !llvm.ptr -> i32
    %664 = arith.subi %662, %663 : i32
    %665 = arith.sitofp %664 : i32 to f64
    %666 = arith.divf %661, %665 : f64
    func.return %666 : f64
  }
  func.func @khinchin_log_limit(%arg0: i32, %arg1: i32) -> f64 {
    %667 = arith.constant 0 : i32
    %668 = arith.cmpi eq, %arg0, %667 : i32
    cf.cond_br %668, ^bb33, ^bb34
    ^bb33:
      %669 = func.call @log_khinchin_rho0() : () -> f64
      func.return %669 : f64
    ^bb34:
      cf.br ^bb35
    ^bb35:
    %670 = arith.constant 0 : i32
    %671 = llvm.mlir.constant(1 : i64) : i64
    %672 = llvm.alloca %671 x i32 : (i64) -> !llvm.ptr
    llvm.store %670, %672 : i32, !llvm.ptr
    cf.br ^bb36
    ^bb36:
    %673 = arith.constant 1 : i32
    %674 = llvm.load %672 : !llvm.ptr -> i32
    %675 = arith.shli %673, %674 : i32
    %676 = arith.cmpi sle, %675, %arg0 : i32
    cf.cond_br %676, ^bb37, ^bb38
    ^bb37:
      %677 = llvm.load %672 : !llvm.ptr -> i32
      %678 = arith.constant 1 : i32
      %679 = arith.addi %677, %678 : i32
      llvm.store %679, %672 : i32, !llvm.ptr
      cf.br ^bb36
    ^bb38:
    %680 = arith.constant 1 : i32
    %681 = arith.extsi %680 : i32 to i64
    %682 = llvm.load %672 : !llvm.ptr -> i32
    %684 = arith.extsi %682 : i32 to i64
    %683 = arith.shli %681, %684 : i64
    %685 = arith.extsi %arg0 : i32 to i64
    %686 = arith.subi %683, %685 : i64
    %687 = arith.constant 1 : i32
    %688 = arith.extsi %687 : i32 to i64
    %690 = arith.extsi %arg0 : i32 to i64
    %689 = arith.shli %688, %690 : i64
    %691 = arith.constant 1 : i32
    %692 = arith.extsi %691 : i32 to i64
    %693 = arith.shli %692, %686 : i64
    %694 = arith.constant 0 : i32
    %695 = arith.extsi %694 : i32 to i64
    %696 = llvm.mlir.constant(1 : i64) : i64
    %697 = llvm.alloca %696 x i64 : (i64) -> !llvm.ptr
    llvm.store %695, %697 : i64, !llvm.ptr
    %698 = arith.constant 0 : i32
    %699 = llvm.load %672 : !llvm.ptr -> i32
    %700 = arith.index_cast %698 : i32 to index
    %701 = arith.index_cast %699 : i32 to index
    %703 = arith.constant 1 : index
    %704 = arith.constant -1 : index
    %705 = arith.cmpi sle, %700, %701 : index
    %702 = arith.select %705, %703, %704 : index
    cf.br ^bb39(%700 : index)
    ^bb39(%706: index):
    %707 = arith.cmpi slt, %706, %701 : index
    %708 = arith.cmpi sgt, %706, %701 : index
    %709 = arith.select %705, %707, %708 : i1
    cf.cond_br %709, ^bb40(%706 : index), ^bb41(%706 : index)
    ^bb40(%710: index):
      %711 = llvm.load %697 : !llvm.ptr -> i64
      %712 = arith.constant 1 : i32
      %713 = arith.extsi %712 : i32 to i64
      %714 = arith.constant 1 : i32
      %716 = arith.index_cast %710 : index to i32
      %715 = arith.shli %714, %716 : i32
      %717 = arith.subi %arg0, %715 : i32
      %719 = arith.extsi %717 : i32 to i64
      %718 = arith.shli %713, %719 : i64
      %720 = arith.addi %711, %718 : i64
      llvm.store %720, %697 : i64, !llvm.ptr
      %721 = arith.addi %710, %702 : index
      cf.br ^bb39(%721 : index)
    ^bb41(%722: index):
    %724 = arith.constant 16 : i32
    %723 = func.call @la_new(%724) : (i32) -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %725 = llvm.mlir.undef : !llvm.struct<(!llvm.ptr, i32, i32)>
    %726 = llvm.extractvalue %723[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %727 = llvm.insertvalue %726, %725[0] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %728 = llvm.extractvalue %723[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %729 = llvm.insertvalue %728, %727[1] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %730 = llvm.extractvalue %723[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %731 = llvm.insertvalue %730, %729[2] : !llvm.struct<(!llvm.ptr, i32, i32)>
    %732 = llvm.mlir.constant(1 : i64) : i64
    %733 = llvm.alloca %732 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %731, %733 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %734 = llvm.load %733 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %735 = llvm.mlir.constant(1 : i64) : i64
    %736 = llvm.alloca %735 x !llvm.struct<(!llvm.ptr, i32, i32)> : (i64) -> !llvm.ptr
    llvm.store %734, %736 : !llvm.struct<(!llvm.ptr, i32, i32)>, !llvm.ptr
    %738 = llvm.load %697 : !llvm.ptr -> i64
    func.call @la_push(%736, %738) : (!llvm.ptr, i64) -> ()
    %740 = arith.constant 1 : i32
    %742 = arith.extsi %740 : i32 to i64
    %741 = arith.subi %693, %742 : i64
    func.call @la_push(%736, %741) : (!llvm.ptr, i64) -> ()
    %744 = arith.constant 1 : i32
    %745 = arith.extsi %744 : i32 to i64
    func.call @la_push(%736, %745) : (!llvm.ptr, i64) -> ()
    %747 = arith.constant 1 : i32
    %749 = arith.extsi %747 : i32 to i64
    %748 = arith.subi %689, %749 : i64
    func.call @la_push(%736, %748) : (!llvm.ptr, i64) -> ()
    func.call @la_push(%736, %693) : (!llvm.ptr, i64) -> ()
    %751 = arith.constant 1 : i32
    %753 = arith.extsi %751 : i32 to i64
    %752 = arith.subi %689, %753 : i64
    %754 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %755 = llvm.getelementptr %736[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %756 = llvm.load %755 : !llvm.ptr -> i32
    %757 = arith.constant 1 : i32
    %758 = arith.subi %756, %757 : i32
    %759 = arith.sitofp %758 : i32 to f64
    %760 = llvm.mlir.constant(1 : i64) : i64
    %761 = llvm.alloca %760 x f64 : (i64) -> !llvm.ptr
    llvm.store %759, %761 : f64, !llvm.ptr
    %762 = arith.constant 0.0 : f32
    %763 = arith.extf %762 : f32 to f64
    %764 = llvm.mlir.constant(1 : i64) : i64
    %765 = llvm.alloca %764 x f64 : (i64) -> !llvm.ptr
    llvm.store %763, %765 : f64, !llvm.ptr
    %766 = arith.constant 1 : i32
    %767 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %768 = llvm.getelementptr %736[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %769 = llvm.load %768 : !llvm.ptr -> i32
    %770 = arith.index_cast %766 : i32 to index
    %771 = arith.index_cast %769 : i32 to index
    %773 = arith.constant 1 : index
    %774 = arith.constant -1 : index
    %775 = arith.cmpi sle, %770, %771 : index
    %772 = arith.select %775, %773, %774 : index
    cf.br ^bb42(%770 : index)
    ^bb42(%776: index):
    %777 = arith.cmpi slt, %776, %771 : index
    %778 = arith.cmpi sgt, %776, %771 : index
    %779 = arith.select %775, %777, %778 : i1
    cf.cond_br %779, ^bb43(%776 : index), ^bb44(%776 : index)
    ^bb43(%780: index):
      %781 = llvm.load %765 : !llvm.ptr -> f64
      %783 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
      %784 = llvm.getelementptr %736[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
      %785 = llvm.load %784 : !llvm.ptr -> !llvm.ptr
      %786 = arith.index_cast %780 : index to i64
      %787 = llvm.getelementptr %785[%786] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %782 = llvm.load %787 : !llvm.ptr -> i64
      %788 = arith.sitofp %782 : i64 to f64
      %789 = math.log %788 : f64
      %790 = arith.addf %781, %789 : f64
      llvm.store %790, %765 : f64, !llvm.ptr
      %791 = arith.addi %780, %772 : index
      cf.br ^bb42(%791 : index)
    ^bb44(%792: index):
    %793 = llvm.load %765 : !llvm.ptr -> f64
    %794 = llvm.load %761 : !llvm.ptr -> f64
    %795 = arith.divf %793, %794 : f64
    llvm.store %795, %765 : f64, !llvm.ptr
    %797 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %798 = llvm.getelementptr %736[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %799 = llvm.load %798 : !llvm.ptr -> !llvm.ptr
    %800 = arith.constant 1 : i32
    %801 = arith.extsi %800 : i32 to i64
    %802 = llvm.getelementptr %799[%801] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %796 = llvm.load %802 : !llvm.ptr -> i64
    %804 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %805 = llvm.getelementptr %736[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %806 = llvm.load %805 : !llvm.ptr -> !llvm.ptr
    %807 = arith.constant 2 : i32
    %808 = arith.extsi %807 : i32 to i64
    %809 = llvm.getelementptr %806[%808] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %803 = llvm.load %809 : !llvm.ptr -> i64
    %811 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %812 = llvm.getelementptr %736[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %813 = llvm.load %812 : !llvm.ptr -> !llvm.ptr
    %814 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %815 = llvm.getelementptr %736[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %816 = llvm.load %815 : !llvm.ptr -> i32
    %817 = arith.constant 1 : i32
    %818 = arith.subi %816, %817 : i32
    %819 = arith.extsi %818 : i32 to i64
    %820 = llvm.getelementptr %813[%819] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %810 = llvm.load %820 : !llvm.ptr -> i64
    %821 = llvm.mlir.constant(1 : i64) : i64
    %822 = llvm.alloca %821 x i64 : (i64) -> !llvm.ptr
    llvm.store %810, %822 : i64, !llvm.ptr
    %824 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %825 = llvm.getelementptr %736[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %826 = llvm.load %825 : !llvm.ptr -> !llvm.ptr
    %827 = llvm.load %736 : !llvm.ptr -> !llvm.struct<(!llvm.ptr, i32, i32)>
    %828 = llvm.getelementptr %736[0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(!llvm.ptr, i32, i32)>
    %829 = llvm.load %828 : !llvm.ptr -> i32
    %830 = arith.constant 2 : i32
    %831 = arith.subi %829, %830 : i32
    %832 = arith.extsi %831 : i32 to i64
    %833 = llvm.getelementptr %826[%832] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    %823 = llvm.load %833 : !llvm.ptr -> i64
    %834 = llvm.mlir.constant(1 : i64) : i64
    %835 = llvm.alloca %834 x i64 : (i64) -> !llvm.ptr
    llvm.store %823, %835 : i64, !llvm.ptr
    %836 = arith.constant 0 : i32
    %837 = arith.index_cast %836 : i32 to index
    %838 = arith.index_cast %arg1 : i32 to index
    %840 = arith.constant 1 : index
    %841 = arith.constant -1 : index
    %842 = arith.cmpi sle, %837, %838 : index
    %839 = arith.select %842, %840, %841 : index
    cf.br ^bb45(%837 : index)
    ^bb45(%843: index):
    %844 = arith.cmpi slt, %843, %838 : index
    %845 = arith.cmpi sgt, %843, %838 : index
    %846 = arith.select %842, %844, %845 : i1
    cf.cond_br %846, ^bb46(%843 : index), ^bb47(%843 : index)
    ^bb46(%847: index):
      %848 = llvm.load %765 : !llvm.ptr -> f64
      %849 = llvm.mlir.undef : f64
      %850 = llvm.mlir.undef : f64
      %851 = llvm.load %822 : !llvm.ptr -> i64
      %852 = arith.constant 1 : i32
      %854 = arith.extsi %852 : i32 to i64
      %853 = arith.cmpi sgt, %851, %854 : i64
      %855, %856 = scf.if %853 -> (f64, f64) {
        %857 = arith.constant 2.0 : f32
        %858 = llvm.load %761 : !llvm.ptr -> f64
        %860 = arith.extf %857 : f32 to f64
        %859 = arith.mulf %860, %858 : f64
        %861 = arith.constant 2.0 : f32
        %863 = arith.extf %861 : f32 to f64
        %862 = arith.addf %859, %863 : f64
        %864 = arith.constant 0.0 : f32
        %865 = llvm.load %822 : !llvm.ptr -> i64
        %866 = arith.sitofp %865 : i64 to f64
        %867 = math.log %866 : f64
        %869 = arith.extf %864 : f32 to f64
        %868 = arith.subf %869, %867 : f64
        %870 = arith.sitofp %752 : i64 to f64
        %871 = math.log %870 : f64
        %872 = arith.addf %868, %871 : f64
        %873 = llvm.load %822 : !llvm.ptr -> i64
        %874 = arith.constant 1 : i32
        %876 = arith.extsi %874 : i32 to i64
        %875 = arith.subi %873, %876 : i64
        %877 = arith.sitofp %875 : i64 to f64
        %878 = math.log %877 : f64
        %879 = arith.addf %872, %878 : f64
        %880 = llvm.load %765 : !llvm.ptr -> f64
        %881 = arith.constant 2.0 : f32
        %882 = llvm.load %761 : !llvm.ptr -> f64
        %884 = arith.extf %881 : f32 to f64
        %883 = arith.mulf %884, %882 : f64
        %885 = arith.divf %883, %862 : f64
        %886 = arith.mulf %880, %885 : f64
        %887 = arith.divf %879, %862 : f64
        %888 = arith.addf %886, %887 : f64
        llvm.store %888, %765 : f64, !llvm.ptr
        scf.yield %862, %879 : f64, f64
      } else {
        %889 = arith.constant 2.0 : f32
        %890 = llvm.load %761 : !llvm.ptr -> f64
        %892 = arith.extf %889 : f32 to f64
        %891 = arith.mulf %892, %890 : f64
        %893 = arith.constant 0.0 : f32
        %894 = llvm.load %835 : !llvm.ptr -> i64
        %895 = arith.sitofp %894 : i64 to f64
        %896 = math.log %895 : f64
        %898 = arith.extf %893 : f32 to f64
        %897 = arith.subf %898, %896 : f64
        %899 = arith.sitofp %752 : i64 to f64
        %900 = math.log %899 : f64
        %901 = arith.addf %897, %900 : f64
        %902 = llvm.load %835 : !llvm.ptr -> i64
        %903 = arith.constant 1 : i32
        %905 = arith.extsi %903 : i32 to i64
        %904 = arith.addi %902, %905 : i64
        %906 = arith.sitofp %904 : i64 to f64
        %907 = math.log %906 : f64
        %908 = arith.addf %901, %907 : f64
        %909 = llvm.load %765 : !llvm.ptr -> f64
        %910 = arith.divf %908, %891 : f64
        %911 = arith.addf %909, %910 : f64
        llvm.store %911, %765 : f64, !llvm.ptr
        scf.yield %891, %908 : f64, f64
      }
      llvm.store %855, %761 : f64, !llvm.ptr
      llvm.store %803, %835 : i64, !llvm.ptr
      llvm.store %796, %822 : i64, !llvm.ptr
      %912 = llvm.load %765 : !llvm.ptr -> f64
      %913 = arith.subf %912, %848 : f64
      %914 = math.absf %913 : f64
      %915 = arith.constant 0 : f32
      %917 = arith.extf %915 : f32 to f64
      %916 = arith.cmpf olt, %914, %917 : f64
      cf.cond_br %916, ^bb48, ^bb49
      ^bb48:
        cf.br ^bb47(%847 : index)
      ^bb49:
        cf.br ^bb50
      ^bb50:
      %918 = arith.addi %847, %839 : index
      cf.br ^bb45(%918 : index)
    ^bb47(%919: index):
    func.call @la_free(%736) : (!llvm.ptr) -> ()
    %921 = llvm.load %765 : !llvm.ptr -> f64
    func.return %921 : f64
  }
  func.func @main() -> i32 {
    %922 = arith.constant 0.0 : f32
    %923 = arith.extf %922 : f32 to f64
    %924 = llvm.mlir.constant(1 : i64) : i64
    %925 = llvm.alloca %924 x f64 : (i64) -> !llvm.ptr
    llvm.store %923, %925 : f64, !llvm.ptr
    %926 = arith.constant 0 : i32
    %927 = arith.constant 51 : i32
    %928 = arith.index_cast %926 : i32 to index
    %929 = arith.index_cast %927 : i32 to index
    %931 = arith.constant 1 : index
    %932 = arith.constant -1 : index
    %933 = arith.cmpi sle, %928, %929 : index
    %930 = arith.select %933, %931, %932 : index
    cf.br ^bb51(%928 : index)
    ^bb51(%934: index):
    %935 = arith.cmpi slt, %934, %929 : index
    %936 = arith.cmpi sgt, %934, %929 : index
    %937 = arith.select %933, %935, %936 : i1
    cf.cond_br %937, ^bb52(%934 : index), ^bb53(%934 : index)
    ^bb52(%938: index):
      %939 = llvm.load %925 : !llvm.ptr -> f64
      %941 = arith.constant 80 : i32
      %942 = arith.index_cast %938 : index to i32
      %940 = func.call @khinchin_log_limit(%942, %941) : (i32, i32) -> f64
      %943 = arith.addf %939, %940 : f64
      llvm.store %943, %925 : f64, !llvm.ptr
      %944 = arith.addi %938, %930 : index
      cf.br ^bb51(%944 : index)
    ^bb53(%945: index):
    %946 = llvm.load %925 : !llvm.ptr -> f64
    %947 = arith.constant 51.0 : f32
    %949 = arith.extf %947 : f32 to f64
    %948 = arith.divf %946, %949 : f64
    %950 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %951 = math.exp %948 : f64
    %952 = llvm.call @printf(%950, %951) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, f64) -> i32
    %953 = arith.constant 0 : i32
    func.return %953 : i32
  }
}