Problem 419

Ported from C++. Uses string manipulation and matrix exponentiation. Conway's cosmological theorem limits distinct elements to ~92.

Answer998567458,1046245404,43363922
Output998567458,1046245404,43363922
StatusPASS
Native helperno
Runtime130 ms
Peak memory5232 KB
Time complexityO(n^2) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^2)O(log n)
Space complexityO(n^2)O(n^2)
ApproachFlow solutionMatrix exponentiation
VerdictSuboptimal

Flow source

# Project Euler 419 — Look and Say via Conway element-decay matrices mod 2^30.
# Ported from C++. Uses string manipulation and matrix exponentiation.
# Conway's cosmological theorem limits distinct elements to ~92.

extern {
    function calloc(n: i64, size: i64) -> ptr<void>
    function free(p: ptr<void>)
    function printf(fmt: ptr<i8>, ...) -> i32
    function strlen(s: ptr<i8>) -> i64
    function strcmp(a: ptr<i8>, b: ptr<i8>) -> i32
    function strcpy(dst: ptr<i8>, src: ptr<i8>) -> ptr<i8>
    function strcat(dst: ptr<i8>, src: ptr<i8>) -> ptr<i8>
    function memcpy(dst: ptr<void>, src: ptr<void>, n: i64) -> ptr<void>
}

const MOD_MASK: u32 = 1073741823
const MAX_ELEMS: i32 = 200
const MAX_ELEM_LEN: i32 = 128
const MAX_STR: i32 = 70000
const MAX_SPLIT: i32 = 10000

# String buffer for look-and-say generation
let mut g_buf1: ptr<i8> = null
let mut g_buf2: ptr<i8> = null

# Element table: flat MAX_ELEMS * MAX_ELEM_LEN bytes
let mut g_elems: ptr<i8> = null
let mut g_nelems: i32 = 0

function elem_ptr(i: i32) -> ptr<i8> {
    return g_elems + ((i as i64) * (MAX_ELEM_LEN as i64))
}

function find_or_add(e: ptr<i8>) -> i32 {
    let mut i: i32 = 0
    while i < g_nelems {
        if strcmp(elem_ptr(i), e) == 0 { return i }
        i = i + 1
    }
    let j: i32 = g_nelems
    g_nelems = g_nelems + 1
    strcpy(elem_ptr(j), e)
    return j
}

# Look-and-say: read input, write output to out
function say(input: ptr<i8>, out: ptr<i8>) -> void {
    let n: i64 = strlen(input)
    let mut i: i64 = 0
    let mut op: i64 = 0
    while i < n {
        let ch: i8 = input[i]
        let mut j: i64 = i + 1
        while j < n && input[j] == ch { j = j + 1 }
        let count: i64 = j - i
        # Write count as decimal
        let digits: ptr<i8> = calloc(20, 1)
        let mut dc: i32 = 0
        let mut c: i64 = count
        if c == 0 {
            digits[0] = 48
            dc = 1
        }
        while c > 0 {
            digits[dc] = ((c % 10) as i8) + 48
            dc = dc + 1
            c = c / 10
        }
        # Reverse digits into out
        let mut d: i32 = dc - 1
        while d >= 0 {
            out[op] = digits[d]
            op = op + 1
            d = d - 1
        }
        free(digits as ptr<void>)
        out[op] = ch
        op = op + 1
        i = j
    }
    out[op] = 0
}

# spl00_at: check if position j is a split point for the "00" sub-pattern
function spl00_at(s: ptr<i8>, j: i64) -> i32 {
    let n: i64 = strlen(s)
    if j + 2 < n && s[j] == 49 && s[j + 1] == 49 && s[j + 2] == 49 { return 1 }
    if j == n - 1 && s[j] == 49 { return 0 }
    if j + 1 < n && s[j] == 49 && s[j + 1] == 49 { return 0 }
    if j + 2 < n && s[j] == 49 && s[j + 1] == 50 && s[j + 2] == 50 { return 0 }
    if j + 2 < n && s[j] == 49 && s[j + 1] == 51 && s[j + 2] == 51 { return 0 }
    if j < n && s[j] == 50 { return 0 }
    if j + 3 < n && s[j] == 51 && s[j + 1] == 49 && s[j + 2] == 49 && s[j + 3] == 49 { return 0 }
    if j + 3 < n && s[j] == 51 && s[j + 1] == 50 && s[j + 2] == 50 && s[j + 3] == 50 { return 0 }
    if j + 1 < n && s[j] == 51 && s[j + 1] == 51 { return 0 }
    return 1
}

function spl0_at(s: ptr<i8>, i: i64) -> i32 {
    let n: i64 = strlen(s)
    let ch: i8 = s[i]
    if ch == 49 && i == n - 1 { return 1 }
    if ch == 49 && i + 2 < n && s[i + 1] == 50 && s[i + 2] == 50 {
        return spl00_at(s, i + 3)
    }
    if ch == 50 { return spl00_at(s, i + 1) }
    if ch == 51 && i == n - 1 { return 1 }
    if ch == 51 && i + 2 < n && s[i + 1] == 50 && s[i + 2] == 50 {
        return spl00_at(s, i + 3)
    }
    return 0
}

# Split string into elements, return count and fill indices array
# Each element is written to the out_elems buffer as null-terminated strings
function split_elements(s: ptr<i8>, out_count: ptr<i32>, out_elems: ptr<i8>) -> void {
    let n: i64 = strlen(s)
    if n == 0 { out_count[0] = 0
        return
    }
    let mut start: i64 = 0
    let mut count: i32 = 0
    let mut i: i64 = 0
    while i < n {
        if spl0_at(s, i) == 1 {
            # Copy s[start..i+1] to out_elems[count]
            let dst: ptr<i8> = out_elems + ((count as i64) * (MAX_ELEM_LEN as i64))
            let mut k: i64 = start
            while k <= i {
                dst[k - start] = s[k]
                k = k + 1
            }
            dst[i + 1 - start] = 0
            count = count + 1
            start = i + 1
        }
        i = i + 1
    }
    if start < n {
        let dst2: ptr<i8> = out_elems + ((count as i64) * (MAX_ELEM_LEN as i64))
        let mut k2: i64 = start
        while k2 < n {
            dst2[k2 - start] = s[k2]
            k2 = k2 + 1
        }
        dst2[n - start] = 0
        count = count + 1
    }
    out_count[0] = count
}

# Matrix multiply mod 2^30. Matrices are flat m*m arrays of u32.
function mat_mul(A: ptr<u32>, B: ptr<u32>, out: ptr<u32>, m: i32) -> void {
    memset_zero_u32(out, (m as i64) * (m as i64))
    let mut i: i32 = 0
    while i < m {
        let mut k: i32 = 0
        while k < m {
            let a: u32 = A[i * m + k]
            if a == 0 { k = k + 1
                continue
            }
            let mut j: i32 = 0
            while j < m {
                out[i * m + j] = ((out[i * m + j] as u64) + ((a as u64) * (B[k * m + j] as u64))) as u32 & MOD_MASK
                j = j + 1
            }
            k = k + 1
        }
        i = i + 1
    }
}

# Vector * matrix mod 2^30
function vec_mul(v: ptr<u32>, M: ptr<u32>, out: ptr<u32>, m: i32) -> void {
    memset_zero_u32(out, m as i64)
    let mut i: i32 = 0
    while i < m {
        let a: u32 = v[i]
        if a == 0 { i = i + 1
            continue
        }
        let mut j: i32 = 0
        while j < m {
            out[j] = ((out[j] as u64) + ((a as u64) * (M[i * m + j] as u64))) as u32 & MOD_MASK
            j = j + 1
        }
        i = i + 1
    }
}

function memset_zero_u32(arr: ptr<u32>, n: i64) -> void {
    let mut i: i64 = 0
    while i < n {
        arr[i] = 0
        i = i + 1
    }
}

# Vector * M^exp using binary exponentiation
function vec_mul_pow(v: ptr<u32>, M: ptr<u32>, exp: i64, m: i32, out: ptr<u32>) -> void {
    let cur_v: ptr<u32> = calloc((m as i64), 4)
    memcpy(cur_v as ptr<void>, v as ptr<void>, (m as i64) * 4)
    let cur_M: ptr<u32> = calloc((m as i64) * (m as i64), 4)
    memcpy(cur_M as ptr<void>, M as ptr<void>, (m as i64) * (m as i64) * 4)
    let tmp_v: ptr<u32> = calloc((m as i64), 4)
    let tmp_M: ptr<u32> = calloc((m as i64) * (m as i64), 4)
    let mut e: i64 = exp
    while e > 0 {
        if (e & 1) == 1 {
            vec_mul(cur_v, cur_M, tmp_v, m)
            memcpy(cur_v as ptr<void>, tmp_v as ptr<void>, (m as i64) * 4)
        }
        e = e >> 1
        if e > 0 {
            mat_mul(cur_M, cur_M, tmp_M, m)
            memcpy(cur_M as ptr<void>, tmp_M as ptr<void>, (m as i64) * (m as i64) * 4)
        }
    }
    memcpy(out as ptr<void>, cur_v as ptr<void>, (m as i64) * 4)
    free(cur_v as ptr<void>)
    free(cur_M as ptr<void>)
    free(tmp_v as ptr<void>)
    free(tmp_M as ptr<void>)
}

function counts_in_term(term: ptr<i8>, outA: ptr<u32>, outB: ptr<u32>, outC: ptr<u32>) -> void {
    let mut A: u32 = 0
    let mut B: u32 = 0
    let mut C: u32 = 0
    let n: i64 = strlen(term)
    let mut i: i64 = 0
    while i < n {
        let ch: i8 = term[i]
        if ch == 49 { A = A + 1 }
        else {
            if ch == 50 { B = B + 1 }
            else {
                if ch == 51 { C = C + 1 }
            }
        }
        i = i + 1
    }
    outA[0] = A
    outB[0] = B
    outC[0] = C
}

function main() -> i32 {
    let n: i64 = 1000000000000

    g_buf1 = calloc((MAX_STR as i64), 1)
    g_buf2 = calloc((MAX_STR as i64), 1)
    g_elems = calloc((MAX_SPLIT as i64) * (MAX_ELEM_LEN as i64), 1)

    # Start with "1"
    g_buf1[0] = 49
    g_buf1[1] = 0

    let steps: i32 = 39
    if n - 1 < (steps as i64) { steps = (n - 1) as i32 }

    let mut i: i32 = 0
    while i < steps {
        say(g_buf1, g_buf2)
        memcpy(g_buf1 as ptr<void>, g_buf2 as ptr<void>, (MAX_STR as i64))
        i = i + 1
    }

    if n <= 40 {
        let Aptr: ptr<u32> = calloc(1, 4)
        let Bptr: ptr<u32> = calloc(1, 4)
        let Cptr: ptr<u32> = calloc(1, 4)
        counts_in_term(g_buf1, Aptr, Bptr, Cptr)
        printf("%u,%u,%u\n", Aptr[0], Bptr[0], Cptr[0])
        free(Aptr as ptr<void>)
        free(Bptr as ptr<void>)
        free(Cptr as ptr<void>)
        free(g_buf1 as ptr<void>)
        free(g_buf2 as ptr<void>)
        free(g_elems as ptr<void>)
        return 0
    }

    # Split seed elements
    let seed_buf: ptr<i8> = calloc((MAX_SPLIT as i64) * (MAX_ELEM_LEN as i64), 1)
    let seed_count_ptr: ptr<i32> = calloc(1, 4)
    split_elements(g_buf1, seed_count_ptr, seed_buf)
    let seed_count: i32 = seed_count_ptr[0]
    free(seed_count_ptr as ptr<void>)

    # Add seed elements to global table
    let mut si: i32 = 0
    while si < seed_count {
        let e: ptr<i8> = seed_buf + ((si as i64) * (MAX_ELEM_LEN as i64))
        find_or_add(e)
        si = si + 1
    }

    # Add children of each element
    let child_buf: ptr<i8> = calloc((MAX_SPLIT as i64) * (MAX_ELEM_LEN as i64), 1)
    let child_count_ptr: ptr<i32> = calloc(1, 4)
    let mut p: i32 = 0
    while p < g_nelems {
        let ep: ptr<i8> = elem_ptr(p)
        say(ep, g_buf2)
        split_elements(g_buf2, child_count_ptr, child_buf)
        let cc: i32 = child_count_ptr[0]
        let mut ci: i32 = 0
        while ci < cc {
            let ce: ptr<i8> = child_buf + ((ci as i64) * (MAX_ELEM_LEN as i64))
            find_or_add(ce)
            ci = ci + 1
        }
        p = p + 1
    }
    free(child_count_ptr as ptr<void>)
    free(child_buf as ptr<void>)

    let m: i32 = g_nelems

    # Build transition matrix M
    let M: ptr<u32> = calloc((m as i64) * (m as i64), 4)
    let dec_buf: ptr<i8> = calloc((MAX_SPLIT as i64) * (MAX_ELEM_LEN as i64), 1)
    let dec_count_ptr: ptr<i32> = calloc(1, 4)
    let mut mi: i32 = 0
    while mi < m {
        say(elem_ptr(mi), g_buf2)
        split_elements(g_buf2, dec_count_ptr, dec_buf)
        let dc: i32 = dec_count_ptr[0]
        let mut di: i32 = 0
        while di < dc {
            let de: ptr<i8> = dec_buf + ((di as i64) * (MAX_ELEM_LEN as i64))
            let idx: i32 = find_or_add(de)
            # But find_or_add may have increased m! We need to handle this.
            # Actually, all elements should already be in the table from the pre-pass.
            M[mi * m + idx] = M[mi * m + idx] + 1
            di = di + 1
        }
        mi = mi + 1
    }
    free(dec_count_ptr as ptr<void>)
    free(dec_buf as ptr<void>)

    # Recompute m in case new elements were added (shouldn't happen)
    let m2: i32 = g_nelems
    # If m2 != m, we'd need to rebuild. But cosmological theorem guarantees closure.

    # Count 1s, 2s, 3s in each element
    let ones: ptr<u32> = calloc((m as i64), 4)
    let twos: ptr<u32> = calloc((m as i64), 4)
    let threes: ptr<u32> = calloc((m as i64), 4)
    let mut ci2: i32 = 0
    while ci2 < m {
        let ep2: ptr<i8> = elem_ptr(ci2)
        let len: i64 = strlen(ep2)
        let mut k: i64 = 0
        while k < len {
            let ch: i8 = ep2[k]
            if ch == 49 { ones[ci2] = ones[ci2] + 1 }
            else {
                if ch == 50 { twos[ci2] = twos[ci2] + 1 }
                else {
                    if ch == 51 { threes[ci2] = threes[ci2] + 1 }
                }
            }
            k = k + 1
        }
        ci2 = ci2 + 1
    }

    # Build initial vector from seed elements
    let v: ptr<u32> = calloc((m as i64), 4)
    let mut si2: i32 = 0
    while si2 < seed_count {
        let e: ptr<i8> = seed_buf + ((si2 as i64) * (MAX_ELEM_LEN as i64))
        let found: i32 = find_or_add(e)
        v[found] = v[found] + 1
        si2 = si2 + 1
    }
    free(seed_buf as ptr<void>)

    # v = v * M^(n-40)
    let v_final: ptr<u32> = calloc((m as i64), 4)
    vec_mul_pow(v, M, n - 40, m, v_final)

    let mut A: u32 = 0
    let mut B: u32 = 0
    let mut C: u32 = 0
    let mut ri: i32 = 0
    while ri < m {
        if v_final[ri] != 0 {
            A = ((A as u64) + ((v_final[ri] as u64) * (ones[ri] as u64))) as u32 & MOD_MASK
            B = ((B as u64) + ((v_final[ri] as u64) * (twos[ri] as u64))) as u32 & MOD_MASK
            C = ((C as u64) + ((v_final[ri] as u64) * (threes[ri] as u64))) as u32 & MOD_MASK
        }
        ri = ri + 1
    }

    printf("%u,%u,%u\n", A, B, C)

    free(M as ptr<void>)
    free(ones as ptr<void>)
    free(twos as ptr<void>)
    free(threes as ptr<void>)
    free(v as ptr<void>)
    free(v_final as ptr<void>)
    free(g_buf1 as ptr<void>)
    free(g_buf2 as ptr<void>)
    free(g_elems as ptr<void>)
    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; }

int8_t* elem_ptr_i32(int32_t i);
int32_t find_or_add_ptr_i8(int8_t* e);
void say_ptr_i8_ptr_i8(int8_t* input, int8_t* out);
int32_t spl00_at_ptr_i8_i64(int8_t* s, int64_t j);
int32_t spl0_at_ptr_i8_i64(int8_t* s, int64_t i);
void split_elements_ptr_i8_ptr_i32_ptr_i8(int8_t* s, int32_t* out_count, int8_t* out_elems);
void mat_mul_ptr_u32_ptr_u32_ptr_u32_i32(uint32_t* A, uint32_t* B, uint32_t* out, int32_t m);
void vec_mul_ptr_u32_ptr_u32_ptr_u32_i32(uint32_t* v, uint32_t* M, uint32_t* out, int32_t m);
void memset_zero_u32_ptr_u32_i64(uint32_t* arr, int64_t n);
void vec_mul_pow_ptr_u32_ptr_u32_i64_i32_ptr_u32(uint32_t* v, uint32_t* M, int64_t exp, int32_t m, uint32_t* out);
void counts_in_term_ptr_i8_ptr_u32_ptr_u32_ptr_u32(int8_t* term, uint32_t* outA, uint32_t* outB, uint32_t* outC);
int32_t main(void);

static const uint32_t MOD_MASK = 1073741823;
static const int32_t MAX_ELEMS = 200;
static const int32_t MAX_ELEM_LEN = 128;
static const int32_t MAX_STR = 70000;
static const int32_t MAX_SPLIT = 10000;

/* Module statics */
static int8_t* g_buf1 = NULL;
static int8_t* g_buf2 = NULL;
static int8_t* g_elems = NULL;
static int32_t g_nelems = 0;









int8_t* elem_ptr_i32(int32_t i) {
    return (g_elems + (((int64_t)(i)) * ((int64_t)(MAX_ELEM_LEN))));
}

int32_t find_or_add_ptr_i8(int8_t* e) {
    int32_t i = 0;
    while (i < g_nelems) {
        if (strcmp(elem_ptr_i32(i), e) == 0) {
            return i;
        }
        i = (i + 1);
    }
    int32_t j = g_nelems;
    g_nelems = (g_nelems + 1);
    strcpy(elem_ptr_i32(j), e);
    return j;
}

void say_ptr_i8_ptr_i8(int8_t* input, int8_t* out) {
    int64_t n = strlen(input);
    int64_t i = 0;
    int64_t op = 0;
    while (i < n) {
        int8_t ch = input[i];
        int64_t j = (i + 1);
        while ((j < n && input[j] == ch)) {
            j = (j + 1);
        }
        int64_t count = (j - i);
        int8_t* digits = (int8_t*)(calloc(20, 1));
        int32_t dc = 0;
        int64_t c = count;
        if (c == 0) {
            digits[0] = 48;
            dc = 1;
        }
        while (c > 0) {
            digits[dc] = (((int8_t)(FLOW_CHECKED_MOD((c), (10)))) + 48);
            dc = (dc + 1);
            c = FLOW_CHECKED_DIV((c), (10));
        }
        int32_t d = (dc - 1);
        while (d >= 0) {
            out[op] = digits[d];
            op = (op + 1);
            d = (d - 1);
        }
        free(((void*)(digits)));
        out[op] = ch;
        op = (op + 1);
        i = j;
    }
    out[op] = 0;
}

int32_t spl00_at_ptr_i8_i64(int8_t* s, int64_t j) {
    int64_t n = strlen(s);
    if (((((j + 2) < n && s[j] == 49) && s[(j + 1)] == 49) && s[(j + 2)] == 49)) {
        return 1;
    }
    if ((j == (n - 1) && s[j] == 49)) {
        return 0;
    }
    if ((((j + 1) < n && s[j] == 49) && s[(j + 1)] == 49)) {
        return 0;
    }
    if (((((j + 2) < n && s[j] == 49) && s[(j + 1)] == 50) && s[(j + 2)] == 50)) {
        return 0;
    }
    if (((((j + 2) < n && s[j] == 49) && s[(j + 1)] == 51) && s[(j + 2)] == 51)) {
        return 0;
    }
    if ((j < n && s[j] == 50)) {
        return 0;
    }
    if ((((((j + 3) < n && s[j] == 51) && s[(j + 1)] == 49) && s[(j + 2)] == 49) && s[(j + 3)] == 49)) {
        return 0;
    }
    if ((((((j + 3) < n && s[j] == 51) && s[(j + 1)] == 50) && s[(j + 2)] == 50) && s[(j + 3)] == 50)) {
        return 0;
    }
    if ((((j + 1) < n && s[j] == 51) && s[(j + 1)] == 51)) {
        return 0;
    }
    return 1;
}

int32_t spl0_at_ptr_i8_i64(int8_t* s, int64_t i) {
    int64_t n = strlen(s);
    int8_t ch = s[i];
    if ((ch == 49 && i == (n - 1))) {
        return 1;
    }
    if ((((ch == 49 && (i + 2) < n) && s[(i + 1)] == 50) && s[(i + 2)] == 50)) {
        return spl00_at_ptr_i8_i64(s, (i + 3));
    }
    if (ch == 50) {
        return spl00_at_ptr_i8_i64(s, (i + 1));
    }
    if ((ch == 51 && i == (n - 1))) {
        return 1;
    }
    if ((((ch == 51 && (i + 2) < n) && s[(i + 1)] == 50) && s[(i + 2)] == 50)) {
        return spl00_at_ptr_i8_i64(s, (i + 3));
    }
    return 0;
}

void split_elements_ptr_i8_ptr_i32_ptr_i8(int8_t* s, int32_t* out_count, int8_t* out_elems) {
    int64_t n = strlen(s);
    if (n == 0) {
        out_count[0] = 0;
        return;
    }
    int64_t start = 0;
    int32_t count = 0;
    int64_t i = 0;
    while (i < n) {
        if (spl0_at_ptr_i8_i64(s, i) == 1) {
            int8_t* dst = (int8_t*)((out_elems + (((int64_t)(count)) * ((int64_t)(MAX_ELEM_LEN)))));
            int64_t k = start;
            while (k <= i) {
                dst[(k - start)] = s[k];
                k = (k + 1);
            }
            dst[((i + 1) - start)] = 0;
            count = (count + 1);
            start = (i + 1);
        }
        i = (i + 1);
    }
    if (start < n) {
        int8_t* dst2 = (int8_t*)((out_elems + (((int64_t)(count)) * ((int64_t)(MAX_ELEM_LEN)))));
        int64_t k2 = start;
        while (k2 < n) {
            dst2[(k2 - start)] = s[k2];
            k2 = (k2 + 1);
        }
        dst2[(n - start)] = 0;
        count = (count + 1);
    }
    out_count[0] = count;
}

void mat_mul_ptr_u32_ptr_u32_ptr_u32_i32(uint32_t* A, uint32_t* B, uint32_t* out, int32_t m) {
    memset_zero_u32_ptr_u32_i64(out, (((int64_t)(m)) * ((int64_t)(m))));
    int32_t i = 0;
    while (i < m) {
        int32_t k = 0;
        while (k < m) {
            uint32_t a = A[((i * m) + k)];
            if (a == 0) {
                k = (k + 1);
                continue;
            }
            int32_t j = 0;
            while (j < m) {
                out[((i * m) + j)] = (((uint32_t)((((uint64_t)(out[((i * m) + j)])) + (((uint64_t)(a)) * ((uint64_t)(B[((k * m) + j)])))))) & MOD_MASK);
                j = (j + 1);
            }
            k = (k + 1);
        }
        i = (i + 1);
    }
}

void vec_mul_ptr_u32_ptr_u32_ptr_u32_i32(uint32_t* v, uint32_t* M, uint32_t* out, int32_t m) {
    memset_zero_u32_ptr_u32_i64(out, ((int64_t)(m)));
    int32_t i = 0;
    while (i < m) {
        uint32_t a = v[i];
        if (a == 0) {
            i = (i + 1);
            continue;
        }
        int32_t j = 0;
        while (j < m) {
            out[j] = (((uint32_t)((((uint64_t)(out[j])) + (((uint64_t)(a)) * ((uint64_t)(M[((i * m) + j)])))))) & MOD_MASK);
            j = (j + 1);
        }
        i = (i + 1);
    }
}

void memset_zero_u32_ptr_u32_i64(uint32_t* arr, int64_t n) {
    int64_t i = 0;
    while (i < n) {
        arr[i] = 0;
        i = (i + 1);
    }
}

void vec_mul_pow_ptr_u32_ptr_u32_i64_i32_ptr_u32(uint32_t* v, uint32_t* M, int64_t exp, int32_t m, uint32_t* out) {
    uint32_t* cur_v = (uint32_t*)(calloc(((int64_t)(m)), 4));
    memcpy(((void*)(cur_v)), ((void*)(v)), (((int64_t)(m)) * 4));
    uint32_t* cur_M = (uint32_t*)(calloc((((int64_t)(m)) * ((int64_t)(m))), 4));
    memcpy(((void*)(cur_M)), ((void*)(M)), ((((int64_t)(m)) * ((int64_t)(m))) * 4));
    uint32_t* tmp_v = (uint32_t*)(calloc(((int64_t)(m)), 4));
    uint32_t* tmp_M = (uint32_t*)(calloc((((int64_t)(m)) * ((int64_t)(m))), 4));
    int64_t e = exp;
    while (e > 0) {
        if ((e & 1) == 1) {
            vec_mul_ptr_u32_ptr_u32_ptr_u32_i32(cur_v, cur_M, tmp_v, m);
            memcpy(((void*)(cur_v)), ((void*)(tmp_v)), (((int64_t)(m)) * 4));
        }
        e = FLOW_CHECKED_SHR((e), (1));
        if (e > 0) {
            mat_mul_ptr_u32_ptr_u32_ptr_u32_i32(cur_M, cur_M, tmp_M, m);
            memcpy(((void*)(cur_M)), ((void*)(tmp_M)), ((((int64_t)(m)) * ((int64_t)(m))) * 4));
        }
    }
    memcpy(((void*)(out)), ((void*)(cur_v)), (((int64_t)(m)) * 4));
    free(((void*)(cur_v)));
    free(((void*)(cur_M)));
    free(((void*)(tmp_v)));
    free(((void*)(tmp_M)));
}

void counts_in_term_ptr_i8_ptr_u32_ptr_u32_ptr_u32(int8_t* term, uint32_t* outA, uint32_t* outB, uint32_t* outC) {
    uint32_t A = 0;
    uint32_t B = 0;
    uint32_t C = 0;
    int64_t n = strlen(term);
    int64_t i = 0;
    while (i < n) {
        int8_t ch = term[i];
        if (ch == 49) {
            A = (A + 1);
        } else {
            if (ch == 50) {
                B = (B + 1);
            } else {
                if (ch == 51) {
                    C = (C + 1);
                }
            }
        }
        i = (i + 1);
    }
    outA[0] = A;
    outB[0] = B;
    outC[0] = C;
}

int32_t main(void) {
    int64_t n = 1000000000000;
    g_buf1 = calloc(((int64_t)(MAX_STR)), 1);
    g_buf2 = calloc(((int64_t)(MAX_STR)), 1);
    g_elems = calloc((((int64_t)(MAX_SPLIT)) * ((int64_t)(MAX_ELEM_LEN))), 1);
    g_buf1[0] = 49;
    g_buf1[1] = 0;
    int32_t steps = 39;
    if ((n - 1) < ((int64_t)(steps))) {
        steps = ((int32_t)((n - 1)));
    }
    int32_t i = 0;
    while (i < steps) {
        say_ptr_i8_ptr_i8(g_buf1, g_buf2);
        memcpy(((void*)(g_buf1)), ((void*)(g_buf2)), ((int64_t)(MAX_STR)));
        i = (i + 1);
    }
    if (n <= 40) {
        uint32_t* Aptr = (uint32_t*)(calloc(1, 4));
        uint32_t* Bptr = (uint32_t*)(calloc(1, 4));
        uint32_t* Cptr = (uint32_t*)(calloc(1, 4));
        counts_in_term_ptr_i8_ptr_u32_ptr_u32_ptr_u32(g_buf1, Aptr, Bptr, Cptr);
        printf("%u,%u,%u\n", Aptr[0], Bptr[0], Cptr[0]);
        free(((void*)(Aptr)));
        free(((void*)(Bptr)));
        free(((void*)(Cptr)));
        free(((void*)(g_buf1)));
        free(((void*)(g_buf2)));
        free(((void*)(g_elems)));
        return 0;
    }
    int8_t* seed_buf = (int8_t*)(calloc((((int64_t)(MAX_SPLIT)) * ((int64_t)(MAX_ELEM_LEN))), 1));
    int32_t* seed_count_ptr = (int32_t*)(calloc(1, 4));
    split_elements_ptr_i8_ptr_i32_ptr_i8(g_buf1, seed_count_ptr, seed_buf);
    int32_t seed_count = seed_count_ptr[0];
    free(((void*)(seed_count_ptr)));
    int32_t si = 0;
    while (si < seed_count) {
        int8_t* e = (int8_t*)((seed_buf + (((int64_t)(si)) * ((int64_t)(MAX_ELEM_LEN)))));
        find_or_add_ptr_i8(e);
        si = (si + 1);
    }
    int8_t* child_buf = (int8_t*)(calloc((((int64_t)(MAX_SPLIT)) * ((int64_t)(MAX_ELEM_LEN))), 1));
    int32_t* child_count_ptr = (int32_t*)(calloc(1, 4));
    int32_t p = 0;
    while (p < g_nelems) {
        int8_t* ep = (int8_t*)(elem_ptr_i32(p));
        say_ptr_i8_ptr_i8(ep, g_buf2);
        split_elements_ptr_i8_ptr_i32_ptr_i8(g_buf2, child_count_ptr, child_buf);
        int32_t cc = child_count_ptr[0];
        int32_t ci = 0;
        while (ci < cc) {
            int8_t* ce = (int8_t*)((child_buf + (((int64_t)(ci)) * ((int64_t)(MAX_ELEM_LEN)))));
            find_or_add_ptr_i8(ce);
            ci = (ci + 1);
        }
        p = (p + 1);
    }
    free(((void*)(child_count_ptr)));
    free(((void*)(child_buf)));
    int32_t m = g_nelems;
    uint32_t* M = (uint32_t*)(calloc((((int64_t)(m)) * ((int64_t)(m))), 4));
    int8_t* dec_buf = (int8_t*)(calloc((((int64_t)(MAX_SPLIT)) * ((int64_t)(MAX_ELEM_LEN))), 1));
    int32_t* dec_count_ptr = (int32_t*)(calloc(1, 4));
    int32_t mi = 0;
    while (mi < m) {
        say_ptr_i8_ptr_i8(elem_ptr_i32(mi), g_buf2);
        split_elements_ptr_i8_ptr_i32_ptr_i8(g_buf2, dec_count_ptr, dec_buf);
        int32_t dc = dec_count_ptr[0];
        int32_t di = 0;
        while (di < dc) {
            int8_t* de = (int8_t*)((dec_buf + (((int64_t)(di)) * ((int64_t)(MAX_ELEM_LEN)))));
            int32_t idx = find_or_add_ptr_i8(de);
            M[((mi * m) + idx)] = (M[((mi * m) + idx)] + 1);
            di = (di + 1);
        }
        mi = (mi + 1);
    }
    free(((void*)(dec_count_ptr)));
    free(((void*)(dec_buf)));
    int32_t m2 = g_nelems;
    uint32_t* ones = (uint32_t*)(calloc(((int64_t)(m)), 4));
    uint32_t* twos = (uint32_t*)(calloc(((int64_t)(m)), 4));
    uint32_t* threes = (uint32_t*)(calloc(((int64_t)(m)), 4));
    int32_t ci2 = 0;
    while (ci2 < m) {
        int8_t* ep2 = (int8_t*)(elem_ptr_i32(ci2));
        int64_t len = strlen(ep2);
        int64_t k = 0;
        while (k < len) {
            int8_t ch = ep2[k];
            if (ch == 49) {
                ones[ci2] = (ones[ci2] + 1);
            } else {
                if (ch == 50) {
                    twos[ci2] = (twos[ci2] + 1);
                } else {
                    if (ch == 51) {
                        threes[ci2] = (threes[ci2] + 1);
                    }
                }
            }
            k = (k + 1);
        }
        ci2 = (ci2 + 1);
    }
    uint32_t* v = (uint32_t*)(calloc(((int64_t)(m)), 4));
    int32_t si2 = 0;
    while (si2 < seed_count) {
        int8_t* e = (int8_t*)((seed_buf + (((int64_t)(si2)) * ((int64_t)(MAX_ELEM_LEN)))));
        int32_t found = find_or_add_ptr_i8(e);
        v[found] = (v[found] + 1);
        si2 = (si2 + 1);
    }
    free(((void*)(seed_buf)));
    uint32_t* v_final = (uint32_t*)(calloc(((int64_t)(m)), 4));
    vec_mul_pow_ptr_u32_ptr_u32_i64_i32_ptr_u32(v, M, (n - 40), m, v_final);
    uint32_t A = 0;
    uint32_t B = 0;
    uint32_t C = 0;
    int32_t ri = 0;
    while (ri < m) {
        if (v_final[ri] != 0) {
            A = (((uint32_t)((((uint64_t)(A)) + (((uint64_t)(v_final[ri])) * ((uint64_t)(ones[ri])))))) & MOD_MASK);
            B = (((uint32_t)((((uint64_t)(B)) + (((uint64_t)(v_final[ri])) * ((uint64_t)(twos[ri])))))) & MOD_MASK);
            C = (((uint32_t)((((uint64_t)(C)) + (((uint64_t)(v_final[ri])) * ((uint64_t)(threes[ri])))))) & MOD_MASK);
        }
        ri = (ri + 1);
    }
    printf("%u,%u,%u\n", A, B, C);
    free(((void*)(M)));
    free(((void*)(ones)));
    free(((void*)(twos)));
    free(((void*)(threes)));
    free(((void*)(v)));
    free(((void*)(v_final)));
    free(((void*)(g_buf1)));
    free(((void*)(g_buf2)));
    free(((void*)(g_elems)));
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%u,%u,%u\n\00") {addr_space = 0 : i32} : !llvm.array<10 x i8>
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()

  func.func private @strlen(!llvm.ptr) -> i64
  func.func private @strcmp(!llvm.ptr, !llvm.ptr) -> i32
  func.func private @strcpy(!llvm.ptr, !llvm.ptr) -> !llvm.ptr
  func.func private @strcat(!llvm.ptr, !llvm.ptr) -> !llvm.ptr
  func.func private @memcpy(!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
  // Constant: MOD_MASK
  llvm.mlir.global internal constant @MOD_MASK(1073741823 : i32) : i32
  // Constant: MAX_ELEMS
  llvm.mlir.global internal constant @MAX_ELEMS(200 : i32) : i32
  // Constant: MAX_ELEM_LEN
  llvm.mlir.global internal constant @MAX_ELEM_LEN(128 : i32) : i32
  // Constant: MAX_STR
  llvm.mlir.global internal constant @MAX_STR(70000 : i32) : i32
  // Constant: MAX_SPLIT
  llvm.mlir.global internal constant @MAX_SPLIT(10000 : i32) : i32
  // Module static: g_buf1
  llvm.mlir.global internal @g_buf1() {addr_space = 0 : i32} : !llvm.ptr {
    %0 = llvm.mlir.zero : !llvm.ptr
    llvm.return %0 : !llvm.ptr
  }
  // Module static: g_buf2
  llvm.mlir.global internal @g_buf2() {addr_space = 0 : i32} : !llvm.ptr {
    %1 = llvm.mlir.zero : !llvm.ptr
    llvm.return %1 : !llvm.ptr
  }
  // Module static: g_elems
  llvm.mlir.global internal @g_elems() {addr_space = 0 : i32} : !llvm.ptr {
    %2 = llvm.mlir.zero : !llvm.ptr
    llvm.return %2 : !llvm.ptr
  }
  // Module static: g_nelems
  llvm.mlir.global internal @g_nelems(0 : i32) : i32
  func.func @elem_ptr(%arg0: i32) -> !llvm.ptr {
    # String concatenation: !llvm.ptr + i64
    func.return %3 : !llvm.ptr
  }
  func.func @find_or_add(%arg0: !llvm.ptr) -> i32 {
    %4 = arith.constant 0 : i32
    %5 = llvm.mlir.constant(1 : i64) : i64
    %6 = llvm.alloca %5 x i32 : (i64) -> !llvm.ptr
    llvm.store %4, %6 : i32, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %7 = llvm.load %6 : !llvm.ptr -> i32
    %8 = llvm.mlir.addressof @g_nelems : !llvm.ptr
    %9 = llvm.load %8 : !llvm.ptr -> i32
    %10 = arith.cmpi slt, %7, %9 : i32
    cf.cond_br %10, ^bb1, ^bb2
    ^bb1:
      %13 = llvm.load %6 : !llvm.ptr -> i32
      %12 = func.call @elem_ptr(%13) : (i32) -> !llvm.ptr
      %11 = func.call @strcmp(%12, %arg0) : (!llvm.ptr, !llvm.ptr) -> i32
      %14 = arith.constant 0 : i32
      %15 = arith.cmpi eq, %11, %14 : i32
      cf.cond_br %15, ^bb3, ^bb4
      ^bb3:
        %16 = llvm.load %6 : !llvm.ptr -> i32
        func.return %16 : i32
      ^bb4:
        cf.br ^bb5
      ^bb5:
      %17 = llvm.load %6 : !llvm.ptr -> i32
      %18 = arith.constant 1 : i32
      %19 = arith.addi %17, %18 : i32
      llvm.store %19, %6 : i32, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    %20 = llvm.mlir.addressof @g_nelems : !llvm.ptr
    %21 = llvm.load %20 : !llvm.ptr -> i32
    %22 = llvm.mlir.addressof @g_nelems : !llvm.ptr
    %23 = llvm.load %22 : !llvm.ptr -> i32
    %24 = arith.constant 1 : i32
    %25 = arith.addi %23, %24 : i32
    %26 = llvm.mlir.addressof @g_nelems : !llvm.ptr
    llvm.store %25, %26 : i32, !llvm.ptr
    %28 = func.call @elem_ptr(%21) : (i32) -> !llvm.ptr
    %27 = func.call @strcpy(%28, %arg0) : (!llvm.ptr, !llvm.ptr) -> !llvm.ptr
    func.return %21 : i32
  }
  func.func @say(%arg0: !llvm.ptr, %arg1: !llvm.ptr) -> () {
    %29 = func.call @strlen(%arg0) : (!llvm.ptr) -> i64
    %30 = arith.constant 0 : i32
    %31 = arith.extsi %30 : i32 to i64
    %32 = llvm.mlir.constant(1 : i64) : i64
    %33 = llvm.alloca %32 x i64 : (i64) -> !llvm.ptr
    llvm.store %31, %33 : i64, !llvm.ptr
    %34 = arith.constant 0 : i32
    %35 = arith.extsi %34 : i32 to i64
    %36 = llvm.mlir.constant(1 : i64) : i64
    %37 = llvm.alloca %36 x i64 : (i64) -> !llvm.ptr
    llvm.store %35, %37 : i64, !llvm.ptr
    cf.br ^bb6
    ^bb6:
    %38 = llvm.load %33 : !llvm.ptr -> i64
    %39 = arith.cmpi slt, %38, %29 : i64
    cf.cond_br %39, ^bb7, ^bb8
    ^bb7:
      %41 = llvm.load %33 : !llvm.ptr -> i64
      %42 = llvm.getelementptr %arg0[%41] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %40 = llvm.load %42 : !llvm.ptr -> i8
      %43 = llvm.load %33 : !llvm.ptr -> i64
      %44 = arith.constant 1 : i32
      %46 = arith.extsi %44 : i32 to i64
      %45 = arith.addi %43, %46 : i64
      %47 = llvm.mlir.constant(1 : i64) : i64
      %48 = llvm.alloca %47 x i64 : (i64) -> !llvm.ptr
      llvm.store %45, %48 : i64, !llvm.ptr
      cf.br ^bb9
      ^bb9:
      %49 = llvm.load %48 : !llvm.ptr -> i64
      %50 = arith.cmpi slt, %49, %29 : i64
      %51 = scf.if %50 -> (i1) {
        %53 = llvm.load %48 : !llvm.ptr -> i64
        %54 = llvm.getelementptr %arg0[%53] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %52 = llvm.load %54 : !llvm.ptr -> i8
        %56 = arith.extsi %52 : i8 to i32
        %57 = arith.extsi %40 : i8 to i32
        %55 = arith.cmpi eq, %56, %57 : i32
        scf.yield %55 : i1
      } else {
        %58 = arith.constant false
        scf.yield %58 : i1
      }
      cf.cond_br %51, ^bb10, ^bb11
      ^bb10:
        %59 = llvm.load %48 : !llvm.ptr -> i64
        %60 = arith.constant 1 : i32
        %62 = arith.extsi %60 : i32 to i64
        %61 = arith.addi %59, %62 : i64
        llvm.store %61, %48 : i64, !llvm.ptr
        cf.br ^bb9
      ^bb11:
      %63 = llvm.load %48 : !llvm.ptr -> i64
      %64 = llvm.load %33 : !llvm.ptr -> i64
      %65 = arith.subi %63, %64 : i64
      %67 = arith.constant 20 : i32
      %68 = arith.constant 1 : i32
      %69 = arith.extsi %67 : i32 to i64
      %70 = arith.extsi %68 : i32 to i64
      %66 = func.call @calloc(%69, %70) : (i64, i64) -> !llvm.ptr
      %71 = arith.constant 0 : i32
      %72 = llvm.mlir.constant(1 : i64) : i64
      %73 = llvm.alloca %72 x i32 : (i64) -> !llvm.ptr
      llvm.store %71, %73 : i32, !llvm.ptr
      %74 = llvm.mlir.constant(1 : i64) : i64
      %75 = llvm.alloca %74 x i64 : (i64) -> !llvm.ptr
      llvm.store %65, %75 : i64, !llvm.ptr
      %76 = llvm.load %75 : !llvm.ptr -> i64
      %77 = arith.constant 0 : i32
      %79 = arith.extsi %77 : i32 to i64
      %78 = arith.cmpi eq, %76, %79 : i64
      cf.cond_br %78, ^bb12, ^bb13
      ^bb12:
        %80 = arith.constant 48 : i32
        %81 = arith.constant 0 : i32
        %82 = arith.trunci %80 : i32 to i8
        %83 = arith.extsi %81 : i32 to i64
        %84 = llvm.getelementptr %66[%83] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %82, %84 : i8, !llvm.ptr
        %85 = arith.constant 1 : i32
        llvm.store %85, %73 : i32, !llvm.ptr
        cf.br ^bb14
      ^bb13:
        cf.br ^bb14
      ^bb14:
      cf.br ^bb15
      ^bb15:
      %86 = llvm.load %75 : !llvm.ptr -> i64
      %87 = arith.constant 0 : i32
      %89 = arith.extsi %87 : i32 to i64
      %88 = arith.cmpi sgt, %86, %89 : i64
      cf.cond_br %88, ^bb16, ^bb17
      ^bb16:
        %90 = llvm.load %75 : !llvm.ptr -> i64
        %91 = arith.constant 10 : i32
        %93 = arith.extsi %91 : i32 to i64
        %92 = arith.remsi %90, %93 : i64
        %94 = arith.trunci %92 : i64 to i8
        %95 = arith.constant 48 : i32
        %97 = arith.extsi %94 : i8 to i32
        %96 = arith.addi %97, %95 : i32
        %98 = llvm.load %73 : !llvm.ptr -> i32
        %99 = arith.trunci %96 : i32 to i8
        %100 = arith.extsi %98 : i32 to i64
        %101 = llvm.getelementptr %66[%100] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %99, %101 : i8, !llvm.ptr
        %102 = llvm.load %73 : !llvm.ptr -> i32
        %103 = arith.constant 1 : i32
        %104 = arith.addi %102, %103 : i32
        llvm.store %104, %73 : i32, !llvm.ptr
        %105 = llvm.load %75 : !llvm.ptr -> i64
        %106 = arith.constant 10 : i32
        %108 = arith.extsi %106 : i32 to i64
        %107 = arith.divsi %105, %108 : i64
        llvm.store %107, %75 : i64, !llvm.ptr
        cf.br ^bb15
      ^bb17:
      %109 = llvm.load %73 : !llvm.ptr -> i32
      %110 = arith.constant 1 : i32
      %111 = arith.subi %109, %110 : i32
      %112 = llvm.mlir.constant(1 : i64) : i64
      %113 = llvm.alloca %112 x i32 : (i64) -> !llvm.ptr
      llvm.store %111, %113 : i32, !llvm.ptr
      cf.br ^bb18
      ^bb18:
      %114 = llvm.load %113 : !llvm.ptr -> i32
      %115 = arith.constant 0 : i32
      %116 = arith.cmpi sge, %114, %115 : i32
      cf.cond_br %116, ^bb19, ^bb20
      ^bb19:
        %118 = llvm.load %113 : !llvm.ptr -> i32
        %119 = arith.extsi %118 : i32 to i64
        %120 = llvm.getelementptr %66[%119] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %117 = llvm.load %120 : !llvm.ptr -> i8
        %121 = llvm.load %37 : !llvm.ptr -> i64
        %122 = llvm.getelementptr %arg1[%121] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %117, %122 : i8, !llvm.ptr
        %123 = llvm.load %37 : !llvm.ptr -> i64
        %124 = arith.constant 1 : i32
        %126 = arith.extsi %124 : i32 to i64
        %125 = arith.addi %123, %126 : i64
        llvm.store %125, %37 : i64, !llvm.ptr
        %127 = llvm.load %113 : !llvm.ptr -> i32
        %128 = arith.constant 1 : i32
        %129 = arith.subi %127, %128 : i32
        llvm.store %129, %113 : i32, !llvm.ptr
        cf.br ^bb18
      ^bb20:
      func.call @free(%66) : (!llvm.ptr) -> ()
      %131 = llvm.load %37 : !llvm.ptr -> i64
      %132 = llvm.getelementptr %arg1[%131] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %40, %132 : i8, !llvm.ptr
      %133 = llvm.load %37 : !llvm.ptr -> i64
      %134 = arith.constant 1 : i32
      %136 = arith.extsi %134 : i32 to i64
      %135 = arith.addi %133, %136 : i64
      llvm.store %135, %37 : i64, !llvm.ptr
      %137 = llvm.load %48 : !llvm.ptr -> i64
      llvm.store %137, %33 : i64, !llvm.ptr
      cf.br ^bb6
    ^bb8:
    %138 = arith.constant 0 : i32
    %139 = llvm.load %37 : !llvm.ptr -> i64
    %140 = arith.trunci %138 : i32 to i8
    %141 = llvm.getelementptr %arg1[%139] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %140, %141 : i8, !llvm.ptr
    func.return
  }
  func.func @spl00_at(%arg0: !llvm.ptr, %arg1: i64) -> i32 {
    %142 = func.call @strlen(%arg0) : (!llvm.ptr) -> i64
    %143 = arith.constant 2 : i32
    %145 = arith.extsi %143 : i32 to i64
    %144 = arith.addi %arg1, %145 : i64
    %146 = arith.cmpi slt, %144, %142 : i64
    %147 = scf.if %146 -> (i1) {
      %149 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %148 = llvm.load %149 : !llvm.ptr -> i8
      %150 = arith.constant 49 : i32
      %152 = arith.extsi %148 : i8 to i32
      %151 = arith.cmpi eq, %152, %150 : i32
      scf.yield %151 : i1
    } else {
      %153 = arith.constant false
      scf.yield %153 : i1
    }
    %154 = scf.if %147 -> (i1) {
      %156 = arith.constant 1 : i32
      %158 = arith.extsi %156 : i32 to i64
      %157 = arith.addi %arg1, %158 : i64
      %159 = llvm.getelementptr %arg0[%157] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %155 = llvm.load %159 : !llvm.ptr -> i8
      %160 = arith.constant 49 : i32
      %162 = arith.extsi %155 : i8 to i32
      %161 = arith.cmpi eq, %162, %160 : i32
      scf.yield %161 : i1
    } else {
      %163 = arith.constant false
      scf.yield %163 : i1
    }
    %164 = scf.if %154 -> (i1) {
      %166 = arith.constant 2 : i32
      %168 = arith.extsi %166 : i32 to i64
      %167 = arith.addi %arg1, %168 : i64
      %169 = llvm.getelementptr %arg0[%167] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %165 = llvm.load %169 : !llvm.ptr -> i8
      %170 = arith.constant 49 : i32
      %172 = arith.extsi %165 : i8 to i32
      %171 = arith.cmpi eq, %172, %170 : i32
      scf.yield %171 : i1
    } else {
      %173 = arith.constant false
      scf.yield %173 : i1
    }
    cf.cond_br %164, ^bb21, ^bb22
    ^bb21:
      %174 = arith.constant 1 : i32
      func.return %174 : i32
    ^bb22:
      cf.br ^bb23
    ^bb23:
    %175 = arith.constant 1 : i32
    %177 = arith.extsi %175 : i32 to i64
    %176 = arith.subi %142, %177 : i64
    %178 = arith.cmpi eq, %arg1, %176 : i64
    %179 = scf.if %178 -> (i1) {
      %181 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %180 = llvm.load %181 : !llvm.ptr -> i8
      %182 = arith.constant 49 : i32
      %184 = arith.extsi %180 : i8 to i32
      %183 = arith.cmpi eq, %184, %182 : i32
      scf.yield %183 : i1
    } else {
      %185 = arith.constant false
      scf.yield %185 : i1
    }
    cf.cond_br %179, ^bb24, ^bb25
    ^bb24:
      %186 = arith.constant 0 : i32
      func.return %186 : i32
    ^bb25:
      cf.br ^bb26
    ^bb26:
    %187 = arith.constant 1 : i32
    %189 = arith.extsi %187 : i32 to i64
    %188 = arith.addi %arg1, %189 : i64
    %190 = arith.cmpi slt, %188, %142 : i64
    %191 = scf.if %190 -> (i1) {
      %193 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %192 = llvm.load %193 : !llvm.ptr -> i8
      %194 = arith.constant 49 : i32
      %196 = arith.extsi %192 : i8 to i32
      %195 = arith.cmpi eq, %196, %194 : i32
      scf.yield %195 : i1
    } else {
      %197 = arith.constant false
      scf.yield %197 : i1
    }
    %198 = scf.if %191 -> (i1) {
      %200 = arith.constant 1 : i32
      %202 = arith.extsi %200 : i32 to i64
      %201 = arith.addi %arg1, %202 : i64
      %203 = llvm.getelementptr %arg0[%201] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %199 = llvm.load %203 : !llvm.ptr -> i8
      %204 = arith.constant 49 : i32
      %206 = arith.extsi %199 : i8 to i32
      %205 = arith.cmpi eq, %206, %204 : i32
      scf.yield %205 : i1
    } else {
      %207 = arith.constant false
      scf.yield %207 : i1
    }
    cf.cond_br %198, ^bb27, ^bb28
    ^bb27:
      %208 = arith.constant 0 : i32
      func.return %208 : i32
    ^bb28:
      cf.br ^bb29
    ^bb29:
    %209 = arith.constant 2 : i32
    %211 = arith.extsi %209 : i32 to i64
    %210 = arith.addi %arg1, %211 : i64
    %212 = arith.cmpi slt, %210, %142 : i64
    %213 = scf.if %212 -> (i1) {
      %215 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %214 = llvm.load %215 : !llvm.ptr -> i8
      %216 = arith.constant 49 : i32
      %218 = arith.extsi %214 : i8 to i32
      %217 = arith.cmpi eq, %218, %216 : i32
      scf.yield %217 : i1
    } else {
      %219 = arith.constant false
      scf.yield %219 : i1
    }
    %220 = scf.if %213 -> (i1) {
      %222 = arith.constant 1 : i32
      %224 = arith.extsi %222 : i32 to i64
      %223 = arith.addi %arg1, %224 : i64
      %225 = llvm.getelementptr %arg0[%223] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %221 = llvm.load %225 : !llvm.ptr -> i8
      %226 = arith.constant 50 : i32
      %228 = arith.extsi %221 : i8 to i32
      %227 = arith.cmpi eq, %228, %226 : i32
      scf.yield %227 : i1
    } else {
      %229 = arith.constant false
      scf.yield %229 : i1
    }
    %230 = scf.if %220 -> (i1) {
      %232 = arith.constant 2 : i32
      %234 = arith.extsi %232 : i32 to i64
      %233 = arith.addi %arg1, %234 : i64
      %235 = llvm.getelementptr %arg0[%233] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %231 = llvm.load %235 : !llvm.ptr -> i8
      %236 = arith.constant 50 : i32
      %238 = arith.extsi %231 : i8 to i32
      %237 = arith.cmpi eq, %238, %236 : i32
      scf.yield %237 : i1
    } else {
      %239 = arith.constant false
      scf.yield %239 : i1
    }
    cf.cond_br %230, ^bb30, ^bb31
    ^bb30:
      %240 = arith.constant 0 : i32
      func.return %240 : i32
    ^bb31:
      cf.br ^bb32
    ^bb32:
    %241 = arith.constant 2 : i32
    %243 = arith.extsi %241 : i32 to i64
    %242 = arith.addi %arg1, %243 : i64
    %244 = arith.cmpi slt, %242, %142 : i64
    %245 = scf.if %244 -> (i1) {
      %247 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %246 = llvm.load %247 : !llvm.ptr -> i8
      %248 = arith.constant 49 : i32
      %250 = arith.extsi %246 : i8 to i32
      %249 = arith.cmpi eq, %250, %248 : i32
      scf.yield %249 : i1
    } else {
      %251 = arith.constant false
      scf.yield %251 : i1
    }
    %252 = scf.if %245 -> (i1) {
      %254 = arith.constant 1 : i32
      %256 = arith.extsi %254 : i32 to i64
      %255 = arith.addi %arg1, %256 : i64
      %257 = llvm.getelementptr %arg0[%255] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %253 = llvm.load %257 : !llvm.ptr -> i8
      %258 = arith.constant 51 : i32
      %260 = arith.extsi %253 : i8 to i32
      %259 = arith.cmpi eq, %260, %258 : i32
      scf.yield %259 : i1
    } else {
      %261 = arith.constant false
      scf.yield %261 : i1
    }
    %262 = scf.if %252 -> (i1) {
      %264 = arith.constant 2 : i32
      %266 = arith.extsi %264 : i32 to i64
      %265 = arith.addi %arg1, %266 : i64
      %267 = llvm.getelementptr %arg0[%265] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %263 = llvm.load %267 : !llvm.ptr -> i8
      %268 = arith.constant 51 : i32
      %270 = arith.extsi %263 : i8 to i32
      %269 = arith.cmpi eq, %270, %268 : i32
      scf.yield %269 : i1
    } else {
      %271 = arith.constant false
      scf.yield %271 : i1
    }
    cf.cond_br %262, ^bb33, ^bb34
    ^bb33:
      %272 = arith.constant 0 : i32
      func.return %272 : i32
    ^bb34:
      cf.br ^bb35
    ^bb35:
    %273 = arith.cmpi slt, %arg1, %142 : i64
    %274 = scf.if %273 -> (i1) {
      %276 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %275 = llvm.load %276 : !llvm.ptr -> i8
      %277 = arith.constant 50 : i32
      %279 = arith.extsi %275 : i8 to i32
      %278 = arith.cmpi eq, %279, %277 : i32
      scf.yield %278 : i1
    } else {
      %280 = arith.constant false
      scf.yield %280 : i1
    }
    cf.cond_br %274, ^bb36, ^bb37
    ^bb36:
      %281 = arith.constant 0 : i32
      func.return %281 : i32
    ^bb37:
      cf.br ^bb38
    ^bb38:
    %282 = arith.constant 3 : i32
    %284 = arith.extsi %282 : i32 to i64
    %283 = arith.addi %arg1, %284 : i64
    %285 = arith.cmpi slt, %283, %142 : i64
    %286 = scf.if %285 -> (i1) {
      %288 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %287 = llvm.load %288 : !llvm.ptr -> i8
      %289 = arith.constant 51 : i32
      %291 = arith.extsi %287 : i8 to i32
      %290 = arith.cmpi eq, %291, %289 : i32
      scf.yield %290 : i1
    } else {
      %292 = arith.constant false
      scf.yield %292 : i1
    }
    %293 = scf.if %286 -> (i1) {
      %295 = arith.constant 1 : i32
      %297 = arith.extsi %295 : i32 to i64
      %296 = arith.addi %arg1, %297 : i64
      %298 = llvm.getelementptr %arg0[%296] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %294 = llvm.load %298 : !llvm.ptr -> i8
      %299 = arith.constant 49 : i32
      %301 = arith.extsi %294 : i8 to i32
      %300 = arith.cmpi eq, %301, %299 : i32
      scf.yield %300 : i1
    } else {
      %302 = arith.constant false
      scf.yield %302 : i1
    }
    %303 = scf.if %293 -> (i1) {
      %305 = arith.constant 2 : i32
      %307 = arith.extsi %305 : i32 to i64
      %306 = arith.addi %arg1, %307 : i64
      %308 = llvm.getelementptr %arg0[%306] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %304 = llvm.load %308 : !llvm.ptr -> i8
      %309 = arith.constant 49 : i32
      %311 = arith.extsi %304 : i8 to i32
      %310 = arith.cmpi eq, %311, %309 : i32
      scf.yield %310 : i1
    } else {
      %312 = arith.constant false
      scf.yield %312 : i1
    }
    %313 = scf.if %303 -> (i1) {
      %315 = arith.constant 3 : i32
      %317 = arith.extsi %315 : i32 to i64
      %316 = arith.addi %arg1, %317 : i64
      %318 = llvm.getelementptr %arg0[%316] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %314 = llvm.load %318 : !llvm.ptr -> i8
      %319 = arith.constant 49 : i32
      %321 = arith.extsi %314 : i8 to i32
      %320 = arith.cmpi eq, %321, %319 : i32
      scf.yield %320 : i1
    } else {
      %322 = arith.constant false
      scf.yield %322 : i1
    }
    cf.cond_br %313, ^bb39, ^bb40
    ^bb39:
      %323 = arith.constant 0 : i32
      func.return %323 : i32
    ^bb40:
      cf.br ^bb41
    ^bb41:
    %324 = arith.constant 3 : i32
    %326 = arith.extsi %324 : i32 to i64
    %325 = arith.addi %arg1, %326 : i64
    %327 = arith.cmpi slt, %325, %142 : i64
    %328 = scf.if %327 -> (i1) {
      %330 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %329 = llvm.load %330 : !llvm.ptr -> i8
      %331 = arith.constant 51 : i32
      %333 = arith.extsi %329 : i8 to i32
      %332 = arith.cmpi eq, %333, %331 : i32
      scf.yield %332 : i1
    } else {
      %334 = arith.constant false
      scf.yield %334 : i1
    }
    %335 = scf.if %328 -> (i1) {
      %337 = arith.constant 1 : i32
      %339 = arith.extsi %337 : i32 to i64
      %338 = arith.addi %arg1, %339 : i64
      %340 = llvm.getelementptr %arg0[%338] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %336 = llvm.load %340 : !llvm.ptr -> i8
      %341 = arith.constant 50 : i32
      %343 = arith.extsi %336 : i8 to i32
      %342 = arith.cmpi eq, %343, %341 : i32
      scf.yield %342 : i1
    } else {
      %344 = arith.constant false
      scf.yield %344 : i1
    }
    %345 = scf.if %335 -> (i1) {
      %347 = arith.constant 2 : i32
      %349 = arith.extsi %347 : i32 to i64
      %348 = arith.addi %arg1, %349 : i64
      %350 = llvm.getelementptr %arg0[%348] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %346 = llvm.load %350 : !llvm.ptr -> i8
      %351 = arith.constant 50 : i32
      %353 = arith.extsi %346 : i8 to i32
      %352 = arith.cmpi eq, %353, %351 : i32
      scf.yield %352 : i1
    } else {
      %354 = arith.constant false
      scf.yield %354 : i1
    }
    %355 = scf.if %345 -> (i1) {
      %357 = arith.constant 3 : i32
      %359 = arith.extsi %357 : i32 to i64
      %358 = arith.addi %arg1, %359 : i64
      %360 = llvm.getelementptr %arg0[%358] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %356 = llvm.load %360 : !llvm.ptr -> i8
      %361 = arith.constant 50 : i32
      %363 = arith.extsi %356 : i8 to i32
      %362 = arith.cmpi eq, %363, %361 : i32
      scf.yield %362 : i1
    } else {
      %364 = arith.constant false
      scf.yield %364 : i1
    }
    cf.cond_br %355, ^bb42, ^bb43
    ^bb42:
      %365 = arith.constant 0 : i32
      func.return %365 : i32
    ^bb43:
      cf.br ^bb44
    ^bb44:
    %366 = arith.constant 1 : i32
    %368 = arith.extsi %366 : i32 to i64
    %367 = arith.addi %arg1, %368 : i64
    %369 = arith.cmpi slt, %367, %142 : i64
    %370 = scf.if %369 -> (i1) {
      %372 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %371 = llvm.load %372 : !llvm.ptr -> i8
      %373 = arith.constant 51 : i32
      %375 = arith.extsi %371 : i8 to i32
      %374 = arith.cmpi eq, %375, %373 : i32
      scf.yield %374 : i1
    } else {
      %376 = arith.constant false
      scf.yield %376 : i1
    }
    %377 = scf.if %370 -> (i1) {
      %379 = arith.constant 1 : i32
      %381 = arith.extsi %379 : i32 to i64
      %380 = arith.addi %arg1, %381 : i64
      %382 = llvm.getelementptr %arg0[%380] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %378 = llvm.load %382 : !llvm.ptr -> i8
      %383 = arith.constant 51 : i32
      %385 = arith.extsi %378 : i8 to i32
      %384 = arith.cmpi eq, %385, %383 : i32
      scf.yield %384 : i1
    } else {
      %386 = arith.constant false
      scf.yield %386 : i1
    }
    cf.cond_br %377, ^bb45, ^bb46
    ^bb45:
      %387 = arith.constant 0 : i32
      func.return %387 : i32
    ^bb46:
      cf.br ^bb47
    ^bb47:
    %388 = arith.constant 1 : i32
    func.return %388 : i32
  }
  func.func @spl0_at(%arg0: !llvm.ptr, %arg1: i64) -> i32 {
    %389 = func.call @strlen(%arg0) : (!llvm.ptr) -> i64
    %391 = llvm.getelementptr %arg0[%arg1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    %390 = llvm.load %391 : !llvm.ptr -> i8
    %392 = arith.constant 49 : i32
    %394 = arith.extsi %390 : i8 to i32
    %393 = arith.cmpi eq, %394, %392 : i32
    %395 = scf.if %393 -> (i1) {
      %396 = arith.constant 1 : i32
      %398 = arith.extsi %396 : i32 to i64
      %397 = arith.subi %389, %398 : i64
      %399 = arith.cmpi eq, %arg1, %397 : i64
      scf.yield %399 : i1
    } else {
      %400 = arith.constant false
      scf.yield %400 : i1
    }
    cf.cond_br %395, ^bb48, ^bb49
    ^bb48:
      %401 = arith.constant 1 : i32
      func.return %401 : i32
    ^bb49:
      cf.br ^bb50
    ^bb50:
    %402 = arith.constant 49 : i32
    %404 = arith.extsi %390 : i8 to i32
    %403 = arith.cmpi eq, %404, %402 : i32
    %405 = scf.if %403 -> (i1) {
      %406 = arith.constant 2 : i32
      %408 = arith.extsi %406 : i32 to i64
      %407 = arith.addi %arg1, %408 : i64
      %409 = arith.cmpi slt, %407, %389 : i64
      scf.yield %409 : i1
    } else {
      %410 = arith.constant false
      scf.yield %410 : i1
    }
    %411 = scf.if %405 -> (i1) {
      %413 = arith.constant 1 : i32
      %415 = arith.extsi %413 : i32 to i64
      %414 = arith.addi %arg1, %415 : i64
      %416 = llvm.getelementptr %arg0[%414] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %412 = llvm.load %416 : !llvm.ptr -> i8
      %417 = arith.constant 50 : i32
      %419 = arith.extsi %412 : i8 to i32
      %418 = arith.cmpi eq, %419, %417 : i32
      scf.yield %418 : i1
    } else {
      %420 = arith.constant false
      scf.yield %420 : i1
    }
    %421 = scf.if %411 -> (i1) {
      %423 = arith.constant 2 : i32
      %425 = arith.extsi %423 : i32 to i64
      %424 = arith.addi %arg1, %425 : i64
      %426 = llvm.getelementptr %arg0[%424] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %422 = llvm.load %426 : !llvm.ptr -> i8
      %427 = arith.constant 50 : i32
      %429 = arith.extsi %422 : i8 to i32
      %428 = arith.cmpi eq, %429, %427 : i32
      scf.yield %428 : i1
    } else {
      %430 = arith.constant false
      scf.yield %430 : i1
    }
    cf.cond_br %421, ^bb51, ^bb52
    ^bb51:
      %432 = arith.constant 3 : i32
      %434 = arith.extsi %432 : i32 to i64
      %433 = arith.addi %arg1, %434 : i64
      %431 = func.call @spl00_at(%arg0, %433) : (!llvm.ptr, i64) -> i32
      func.return %431 : i32
    ^bb52:
      cf.br ^bb53
    ^bb53:
    %435 = arith.constant 50 : i32
    %437 = arith.extsi %390 : i8 to i32
    %436 = arith.cmpi eq, %437, %435 : i32
    cf.cond_br %436, ^bb54, ^bb55
    ^bb54:
      %439 = arith.constant 1 : i32
      %441 = arith.extsi %439 : i32 to i64
      %440 = arith.addi %arg1, %441 : i64
      %438 = func.call @spl00_at(%arg0, %440) : (!llvm.ptr, i64) -> i32
      func.return %438 : i32
    ^bb55:
      cf.br ^bb56
    ^bb56:
    %442 = arith.constant 51 : i32
    %444 = arith.extsi %390 : i8 to i32
    %443 = arith.cmpi eq, %444, %442 : i32
    %445 = scf.if %443 -> (i1) {
      %446 = arith.constant 1 : i32
      %448 = arith.extsi %446 : i32 to i64
      %447 = arith.subi %389, %448 : i64
      %449 = arith.cmpi eq, %arg1, %447 : i64
      scf.yield %449 : i1
    } else {
      %450 = arith.constant false
      scf.yield %450 : i1
    }
    cf.cond_br %445, ^bb57, ^bb58
    ^bb57:
      %451 = arith.constant 1 : i32
      func.return %451 : i32
    ^bb58:
      cf.br ^bb59
    ^bb59:
    %452 = arith.constant 51 : i32
    %454 = arith.extsi %390 : i8 to i32
    %453 = arith.cmpi eq, %454, %452 : i32
    %455 = scf.if %453 -> (i1) {
      %456 = arith.constant 2 : i32
      %458 = arith.extsi %456 : i32 to i64
      %457 = arith.addi %arg1, %458 : i64
      %459 = arith.cmpi slt, %457, %389 : i64
      scf.yield %459 : i1
    } else {
      %460 = arith.constant false
      scf.yield %460 : i1
    }
    %461 = scf.if %455 -> (i1) {
      %463 = arith.constant 1 : i32
      %465 = arith.extsi %463 : i32 to i64
      %464 = arith.addi %arg1, %465 : i64
      %466 = llvm.getelementptr %arg0[%464] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %462 = llvm.load %466 : !llvm.ptr -> i8
      %467 = arith.constant 50 : i32
      %469 = arith.extsi %462 : i8 to i32
      %468 = arith.cmpi eq, %469, %467 : i32
      scf.yield %468 : i1
    } else {
      %470 = arith.constant false
      scf.yield %470 : i1
    }
    %471 = scf.if %461 -> (i1) {
      %473 = arith.constant 2 : i32
      %475 = arith.extsi %473 : i32 to i64
      %474 = arith.addi %arg1, %475 : i64
      %476 = llvm.getelementptr %arg0[%474] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %472 = llvm.load %476 : !llvm.ptr -> i8
      %477 = arith.constant 50 : i32
      %479 = arith.extsi %472 : i8 to i32
      %478 = arith.cmpi eq, %479, %477 : i32
      scf.yield %478 : i1
    } else {
      %480 = arith.constant false
      scf.yield %480 : i1
    }
    cf.cond_br %471, ^bb60, ^bb61
    ^bb60:
      %482 = arith.constant 3 : i32
      %484 = arith.extsi %482 : i32 to i64
      %483 = arith.addi %arg1, %484 : i64
      %481 = func.call @spl00_at(%arg0, %483) : (!llvm.ptr, i64) -> i32
      func.return %481 : i32
    ^bb61:
      cf.br ^bb62
    ^bb62:
    %485 = arith.constant 0 : i32
    func.return %485 : i32
  }
  func.func @split_elements(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> () {
    %486 = func.call @strlen(%arg0) : (!llvm.ptr) -> i64
    %487 = arith.constant 0 : i32
    %489 = arith.extsi %487 : i32 to i64
    %488 = arith.cmpi eq, %486, %489 : i64
    cf.cond_br %488, ^bb63, ^bb64
    ^bb63:
      %490 = arith.constant 0 : i32
      %491 = arith.constant 0 : i32
      %492 = arith.extsi %491 : i32 to i64
      %493 = llvm.getelementptr %arg1[%492] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %490, %493 : i32, !llvm.ptr
      func.return
    ^bb64:
      cf.br ^bb65
    ^bb65:
    %494 = arith.constant 0 : i32
    %495 = arith.extsi %494 : i32 to i64
    %496 = llvm.mlir.constant(1 : i64) : i64
    %497 = llvm.alloca %496 x i64 : (i64) -> !llvm.ptr
    llvm.store %495, %497 : i64, !llvm.ptr
    %498 = arith.constant 0 : i32
    %499 = llvm.mlir.constant(1 : i64) : i64
    %500 = llvm.alloca %499 x i32 : (i64) -> !llvm.ptr
    llvm.store %498, %500 : i32, !llvm.ptr
    %501 = arith.constant 0 : i32
    %502 = arith.extsi %501 : i32 to i64
    %503 = llvm.mlir.constant(1 : i64) : i64
    %504 = llvm.alloca %503 x i64 : (i64) -> !llvm.ptr
    llvm.store %502, %504 : i64, !llvm.ptr
    cf.br ^bb66
    ^bb66:
    %505 = llvm.load %504 : !llvm.ptr -> i64
    %506 = arith.cmpi slt, %505, %486 : i64
    cf.cond_br %506, ^bb67, ^bb68
    ^bb67:
      %508 = llvm.load %504 : !llvm.ptr -> i64
      %507 = func.call @spl0_at(%arg0, %508) : (!llvm.ptr, i64) -> i32
      %509 = arith.constant 1 : i32
      %510 = arith.cmpi eq, %507, %509 : i32
      cf.cond_br %510, ^bb69, ^bb70
      ^bb69:
        # String concatenation: !llvm.ptr + i64
        %512 = llvm.load %497 : !llvm.ptr -> i64
        %513 = llvm.mlir.constant(1 : i64) : i64
        %514 = llvm.alloca %513 x i64 : (i64) -> !llvm.ptr
        llvm.store %512, %514 : i64, !llvm.ptr
        cf.br ^bb72
        ^bb72:
        %515 = llvm.load %514 : !llvm.ptr -> i64
        %516 = llvm.load %504 : !llvm.ptr -> i64
        %517 = arith.cmpi sle, %515, %516 : i64
        cf.cond_br %517, ^bb73, ^bb74
        ^bb73:
          %519 = llvm.load %514 : !llvm.ptr -> i64
          %520 = llvm.getelementptr %arg0[%519] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          %518 = llvm.load %520 : !llvm.ptr -> i8
          %521 = llvm.load %514 : !llvm.ptr -> i64
          %522 = llvm.load %497 : !llvm.ptr -> i64
          %523 = arith.subi %521, %522 : i64
          %524 = llvm.getelementptr %511[%523] : (!llvm.ptr, i64) -> !llvm.ptr, i8
          llvm.store %518, %524 : i8, !llvm.ptr
          %525 = llvm.load %514 : !llvm.ptr -> i64
          %526 = arith.constant 1 : i32
          %528 = arith.extsi %526 : i32 to i64
          %527 = arith.addi %525, %528 : i64
          llvm.store %527, %514 : i64, !llvm.ptr
          cf.br ^bb72
        ^bb74:
        %529 = arith.constant 0 : i32
        %530 = llvm.load %504 : !llvm.ptr -> i64
        %531 = arith.constant 1 : i32
        %533 = arith.extsi %531 : i32 to i64
        %532 = arith.addi %530, %533 : i64
        %534 = llvm.load %497 : !llvm.ptr -> i64
        %535 = arith.subi %532, %534 : i64
        %536 = arith.trunci %529 : i32 to i8
        %537 = llvm.getelementptr %511[%535] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %536, %537 : i8, !llvm.ptr
        %538 = llvm.load %500 : !llvm.ptr -> i32
        %539 = arith.constant 1 : i32
        %540 = arith.addi %538, %539 : i32
        llvm.store %540, %500 : i32, !llvm.ptr
        %541 = llvm.load %504 : !llvm.ptr -> i64
        %542 = arith.constant 1 : i32
        %544 = arith.extsi %542 : i32 to i64
        %543 = arith.addi %541, %544 : i64
        llvm.store %543, %497 : i64, !llvm.ptr
        cf.br ^bb71
      ^bb70:
        cf.br ^bb71
      ^bb71:
      %545 = llvm.load %504 : !llvm.ptr -> i64
      %546 = arith.constant 1 : i32
      %548 = arith.extsi %546 : i32 to i64
      %547 = arith.addi %545, %548 : i64
      llvm.store %547, %504 : i64, !llvm.ptr
      cf.br ^bb66
    ^bb68:
    %549 = llvm.load %497 : !llvm.ptr -> i64
    %550 = arith.cmpi slt, %549, %486 : i64
    cf.cond_br %550, ^bb75, ^bb76
    ^bb75:
      # String concatenation: !llvm.ptr + i64
      %552 = llvm.load %497 : !llvm.ptr -> i64
      %553 = llvm.mlir.constant(1 : i64) : i64
      %554 = llvm.alloca %553 x i64 : (i64) -> !llvm.ptr
      llvm.store %552, %554 : i64, !llvm.ptr
      cf.br ^bb78
      ^bb78:
      %555 = llvm.load %554 : !llvm.ptr -> i64
      %556 = arith.cmpi slt, %555, %486 : i64
      cf.cond_br %556, ^bb79, ^bb80
      ^bb79:
        %558 = llvm.load %554 : !llvm.ptr -> i64
        %559 = llvm.getelementptr %arg0[%558] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %557 = llvm.load %559 : !llvm.ptr -> i8
        %560 = llvm.load %554 : !llvm.ptr -> i64
        %561 = llvm.load %497 : !llvm.ptr -> i64
        %562 = arith.subi %560, %561 : i64
        %563 = llvm.getelementptr %551[%562] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        llvm.store %557, %563 : i8, !llvm.ptr
        %564 = llvm.load %554 : !llvm.ptr -> i64
        %565 = arith.constant 1 : i32
        %567 = arith.extsi %565 : i32 to i64
        %566 = arith.addi %564, %567 : i64
        llvm.store %566, %554 : i64, !llvm.ptr
        cf.br ^bb78
      ^bb80:
      %568 = arith.constant 0 : i32
      %569 = llvm.load %497 : !llvm.ptr -> i64
      %570 = arith.subi %486, %569 : i64
      %571 = arith.trunci %568 : i32 to i8
      %572 = llvm.getelementptr %551[%570] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %571, %572 : i8, !llvm.ptr
      %573 = llvm.load %500 : !llvm.ptr -> i32
      %574 = arith.constant 1 : i32
      %575 = arith.addi %573, %574 : i32
      llvm.store %575, %500 : i32, !llvm.ptr
      cf.br ^bb77
    ^bb76:
      cf.br ^bb77
    ^bb77:
    %576 = llvm.load %500 : !llvm.ptr -> i32
    %577 = arith.constant 0 : i32
    %578 = arith.extsi %577 : i32 to i64
    %579 = llvm.getelementptr %arg1[%578] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %576, %579 : i32, !llvm.ptr
    func.return
  }
  func.func @mat_mul(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i32) -> () {
    %581 = arith.extsi %arg3 : i32 to i64
    %582 = arith.extsi %arg3 : i32 to i64
    %583 = arith.muli %581, %582 : i64
    func.call @memset_zero_u32(%arg2, %583) : (!llvm.ptr, i64) -> ()
    %584 = arith.constant 0 : i32
    %585 = llvm.mlir.constant(1 : i64) : i64
    %586 = llvm.alloca %585 x i32 : (i64) -> !llvm.ptr
    llvm.store %584, %586 : i32, !llvm.ptr
    cf.br ^bb81
    ^bb81:
    %587 = llvm.load %586 : !llvm.ptr -> i32
    %588 = arith.cmpi slt, %587, %arg3 : i32
    cf.cond_br %588, ^bb82, ^bb83
    ^bb82:
      %589 = arith.constant 0 : i32
      %590 = llvm.mlir.constant(1 : i64) : i64
      %591 = llvm.alloca %590 x i32 : (i64) -> !llvm.ptr
      llvm.store %589, %591 : i32, !llvm.ptr
      cf.br ^bb84
      ^bb84:
      %592 = llvm.load %591 : !llvm.ptr -> i32
      %593 = arith.cmpi slt, %592, %arg3 : i32
      cf.cond_br %593, ^bb85, ^bb86
      ^bb85:
        %595 = llvm.load %586 : !llvm.ptr -> i32
        %596 = arith.muli %595, %arg3 : i32
        %597 = llvm.load %591 : !llvm.ptr -> i32
        %598 = arith.addi %596, %597 : i32
        %599 = arith.extsi %598 : i32 to i64
        %600 = llvm.getelementptr %arg0[%599] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %594 = llvm.load %600 : !llvm.ptr -> i32
        %601 = arith.constant 0 : i32
        %602 = arith.cmpi eq, %594, %601 : i32
        cf.cond_br %602, ^bb87, ^bb88
        ^bb87:
          %603 = llvm.load %591 : !llvm.ptr -> i32
          %604 = arith.constant 1 : i32
          %605 = arith.addi %603, %604 : i32
          llvm.store %605, %591 : i32, !llvm.ptr
          cf.br ^bb84
        ^bb88:
          cf.br ^bb89
        ^bb89:
        %606 = arith.constant 0 : i32
        %607 = llvm.mlir.constant(1 : i64) : i64
        %608 = llvm.alloca %607 x i32 : (i64) -> !llvm.ptr
        llvm.store %606, %608 : i32, !llvm.ptr
        cf.br ^bb90
        ^bb90:
        %609 = llvm.load %608 : !llvm.ptr -> i32
        %610 = arith.cmpi slt, %609, %arg3 : i32
        cf.cond_br %610, ^bb91, ^bb92
        ^bb91:
          %612 = llvm.load %586 : !llvm.ptr -> i32
          %613 = arith.muli %612, %arg3 : i32
          %614 = llvm.load %608 : !llvm.ptr -> i32
          %615 = arith.addi %613, %614 : i32
          %616 = arith.extsi %615 : i32 to i64
          %617 = llvm.getelementptr %arg2[%616] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %611 = llvm.load %617 : !llvm.ptr -> i32
          %618 = arith.extui %611 : i32 to i64
          %619 = arith.extui %594 : i32 to i64
          %621 = llvm.load %591 : !llvm.ptr -> i32
          %622 = arith.muli %621, %arg3 : i32
          %623 = llvm.load %608 : !llvm.ptr -> i32
          %624 = arith.addi %622, %623 : i32
          %625 = arith.extsi %624 : i32 to i64
          %626 = llvm.getelementptr %arg1[%625] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %620 = llvm.load %626 : !llvm.ptr -> i32
          %627 = arith.extui %620 : i32 to i64
          %628 = arith.muli %619, %627 : i64
          %629 = arith.addi %618, %628 : i64
          %630 = arith.trunci %629 : i64 to i32
          %631 = llvm.mlir.addressof @MOD_MASK : !llvm.ptr
          %632 = llvm.load %631 : !llvm.ptr -> i32
          %633 = arith.andi %630, %632 : i32
          %634 = llvm.load %586 : !llvm.ptr -> i32
          %635 = arith.muli %634, %arg3 : i32
          %636 = llvm.load %608 : !llvm.ptr -> i32
          %637 = arith.addi %635, %636 : i32
          %638 = arith.extsi %637 : i32 to i64
          %639 = llvm.getelementptr %arg2[%638] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %633, %639 : i32, !llvm.ptr
          %640 = llvm.load %608 : !llvm.ptr -> i32
          %641 = arith.constant 1 : i32
          %642 = arith.addi %640, %641 : i32
          llvm.store %642, %608 : i32, !llvm.ptr
          cf.br ^bb90
        ^bb92:
        %643 = llvm.load %591 : !llvm.ptr -> i32
        %644 = arith.constant 1 : i32
        %645 = arith.addi %643, %644 : i32
        llvm.store %645, %591 : i32, !llvm.ptr
        cf.br ^bb84
      ^bb86:
      %646 = llvm.load %586 : !llvm.ptr -> i32
      %647 = arith.constant 1 : i32
      %648 = arith.addi %646, %647 : i32
      llvm.store %648, %586 : i32, !llvm.ptr
      cf.br ^bb81
    ^bb83:
    func.return
  }
  func.func @vec_mul(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: i32) -> () {
    %650 = arith.extsi %arg3 : i32 to i64
    func.call @memset_zero_u32(%arg2, %650) : (!llvm.ptr, i64) -> ()
    %651 = arith.constant 0 : i32
    %652 = llvm.mlir.constant(1 : i64) : i64
    %653 = llvm.alloca %652 x i32 : (i64) -> !llvm.ptr
    llvm.store %651, %653 : i32, !llvm.ptr
    cf.br ^bb93
    ^bb93:
    %654 = llvm.load %653 : !llvm.ptr -> i32
    %655 = arith.cmpi slt, %654, %arg3 : i32
    cf.cond_br %655, ^bb94, ^bb95
    ^bb94:
      %657 = llvm.load %653 : !llvm.ptr -> i32
      %658 = arith.extsi %657 : i32 to i64
      %659 = llvm.getelementptr %arg0[%658] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %656 = llvm.load %659 : !llvm.ptr -> i32
      %660 = arith.constant 0 : i32
      %661 = arith.cmpi eq, %656, %660 : i32
      cf.cond_br %661, ^bb96, ^bb97
      ^bb96:
        %662 = llvm.load %653 : !llvm.ptr -> i32
        %663 = arith.constant 1 : i32
        %664 = arith.addi %662, %663 : i32
        llvm.store %664, %653 : i32, !llvm.ptr
        cf.br ^bb93
      ^bb97:
        cf.br ^bb98
      ^bb98:
      %665 = arith.constant 0 : i32
      %666 = llvm.mlir.constant(1 : i64) : i64
      %667 = llvm.alloca %666 x i32 : (i64) -> !llvm.ptr
      llvm.store %665, %667 : i32, !llvm.ptr
      cf.br ^bb99
      ^bb99:
      %668 = llvm.load %667 : !llvm.ptr -> i32
      %669 = arith.cmpi slt, %668, %arg3 : i32
      cf.cond_br %669, ^bb100, ^bb101
      ^bb100:
        %671 = llvm.load %667 : !llvm.ptr -> i32
        %672 = arith.extsi %671 : i32 to i64
        %673 = llvm.getelementptr %arg2[%672] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %670 = llvm.load %673 : !llvm.ptr -> i32
        %674 = arith.extui %670 : i32 to i64
        %675 = arith.extui %656 : i32 to i64
        %677 = llvm.load %653 : !llvm.ptr -> i32
        %678 = arith.muli %677, %arg3 : i32
        %679 = llvm.load %667 : !llvm.ptr -> i32
        %680 = arith.addi %678, %679 : i32
        %681 = arith.extsi %680 : i32 to i64
        %682 = llvm.getelementptr %arg1[%681] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %676 = llvm.load %682 : !llvm.ptr -> i32
        %683 = arith.extui %676 : i32 to i64
        %684 = arith.muli %675, %683 : i64
        %685 = arith.addi %674, %684 : i64
        %686 = arith.trunci %685 : i64 to i32
        %687 = llvm.mlir.addressof @MOD_MASK : !llvm.ptr
        %688 = llvm.load %687 : !llvm.ptr -> i32
        %689 = arith.andi %686, %688 : i32
        %690 = llvm.load %667 : !llvm.ptr -> i32
        %691 = arith.extsi %690 : i32 to i64
        %692 = llvm.getelementptr %arg2[%691] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %689, %692 : i32, !llvm.ptr
        %693 = llvm.load %667 : !llvm.ptr -> i32
        %694 = arith.constant 1 : i32
        %695 = arith.addi %693, %694 : i32
        llvm.store %695, %667 : i32, !llvm.ptr
        cf.br ^bb99
      ^bb101:
      %696 = llvm.load %653 : !llvm.ptr -> i32
      %697 = arith.constant 1 : i32
      %698 = arith.addi %696, %697 : i32
      llvm.store %698, %653 : i32, !llvm.ptr
      cf.br ^bb93
    ^bb95:
    func.return
  }
  func.func @memset_zero_u32(%arg0: !llvm.ptr, %arg1: i64) -> () {
    %699 = arith.constant 0 : i32
    %700 = arith.extsi %699 : i32 to i64
    %701 = llvm.mlir.constant(1 : i64) : i64
    %702 = llvm.alloca %701 x i64 : (i64) -> !llvm.ptr
    llvm.store %700, %702 : i64, !llvm.ptr
    cf.br ^bb102
    ^bb102:
    %703 = llvm.load %702 : !llvm.ptr -> i64
    %704 = arith.cmpi slt, %703, %arg1 : i64
    cf.cond_br %704, ^bb103, ^bb104
    ^bb103:
      %705 = arith.constant 0 : i32
      %706 = llvm.load %702 : !llvm.ptr -> i64
      %707 = llvm.getelementptr %arg0[%706] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %705, %707 : i32, !llvm.ptr
      %708 = llvm.load %702 : !llvm.ptr -> i64
      %709 = arith.constant 1 : i32
      %711 = arith.extsi %709 : i32 to i64
      %710 = arith.addi %708, %711 : i64
      llvm.store %710, %702 : i64, !llvm.ptr
      cf.br ^bb102
    ^bb104:
    func.return
  }
  func.func @vec_mul_pow(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i64, %arg3: i32, %arg4: !llvm.ptr) -> () {
    %713 = arith.extsi %arg3 : i32 to i64
    %714 = arith.constant 4 : i32
    %715 = arith.extsi %714 : i32 to i64
    %712 = func.call @calloc(%713, %715) : (i64, i64) -> !llvm.ptr
    %717 = arith.extsi %arg3 : i32 to i64
    %718 = arith.constant 4 : i32
    %720 = arith.extsi %718 : i32 to i64
    %719 = arith.muli %717, %720 : i64
    %716 = func.call @memcpy(%712, %arg0, %719) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
    %722 = arith.extsi %arg3 : i32 to i64
    %723 = arith.extsi %arg3 : i32 to i64
    %724 = arith.muli %722, %723 : i64
    %725 = arith.constant 4 : i32
    %726 = arith.extsi %725 : i32 to i64
    %721 = func.call @calloc(%724, %726) : (i64, i64) -> !llvm.ptr
    %728 = arith.extsi %arg3 : i32 to i64
    %729 = arith.extsi %arg3 : i32 to i64
    %730 = arith.muli %728, %729 : i64
    %731 = arith.constant 4 : i32
    %733 = arith.extsi %731 : i32 to i64
    %732 = arith.muli %730, %733 : i64
    %727 = func.call @memcpy(%721, %arg1, %732) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
    %735 = arith.extsi %arg3 : i32 to i64
    %736 = arith.constant 4 : i32
    %737 = arith.extsi %736 : i32 to i64
    %734 = func.call @calloc(%735, %737) : (i64, i64) -> !llvm.ptr
    %739 = arith.extsi %arg3 : i32 to i64
    %740 = arith.extsi %arg3 : i32 to i64
    %741 = arith.muli %739, %740 : i64
    %742 = arith.constant 4 : i32
    %743 = arith.extsi %742 : i32 to i64
    %738 = func.call @calloc(%741, %743) : (i64, i64) -> !llvm.ptr
    %744 = llvm.mlir.constant(1 : i64) : i64
    %745 = llvm.alloca %744 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg2, %745 : i64, !llvm.ptr
    cf.br ^bb105
    ^bb105:
    %746 = llvm.load %745 : !llvm.ptr -> i64
    %747 = arith.constant 0 : i32
    %749 = arith.extsi %747 : i32 to i64
    %748 = arith.cmpi sgt, %746, %749 : i64
    cf.cond_br %748, ^bb106, ^bb107
    ^bb106:
      %750 = llvm.load %745 : !llvm.ptr -> i64
      %751 = arith.constant 1 : i32
      %753 = arith.extsi %751 : i32 to i64
      %752 = arith.andi %750, %753 : i64
      %754 = arith.constant 1 : i32
      %756 = arith.extsi %754 : i32 to i64
      %755 = arith.cmpi eq, %752, %756 : i64
      cf.cond_br %755, ^bb108, ^bb109
      ^bb108:
        func.call @vec_mul(%712, %721, %734, %arg3) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> ()
        %759 = arith.extsi %arg3 : i32 to i64
        %760 = arith.constant 4 : i32
        %762 = arith.extsi %760 : i32 to i64
        %761 = arith.muli %759, %762 : i64
        %758 = func.call @memcpy(%712, %734, %761) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
        cf.br ^bb110
      ^bb109:
        cf.br ^bb110
      ^bb110:
      %763 = llvm.load %745 : !llvm.ptr -> i64
      %764 = arith.constant 1 : i32
      %766 = arith.extsi %764 : i32 to i64
      %765 = arith.shrsi %763, %766 : i64
      llvm.store %765, %745 : i64, !llvm.ptr
      %767 = llvm.load %745 : !llvm.ptr -> i64
      %768 = arith.constant 0 : i32
      %770 = arith.extsi %768 : i32 to i64
      %769 = arith.cmpi sgt, %767, %770 : i64
      cf.cond_br %769, ^bb111, ^bb112
      ^bb111:
        func.call @mat_mul(%721, %721, %738, %arg3) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> ()
        %773 = arith.extsi %arg3 : i32 to i64
        %774 = arith.extsi %arg3 : i32 to i64
        %775 = arith.muli %773, %774 : i64
        %776 = arith.constant 4 : i32
        %778 = arith.extsi %776 : i32 to i64
        %777 = arith.muli %775, %778 : i64
        %772 = func.call @memcpy(%721, %738, %777) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
        cf.br ^bb113
      ^bb112:
        cf.br ^bb113
      ^bb113:
      cf.br ^bb105
    ^bb107:
    %780 = arith.extsi %arg3 : i32 to i64
    %781 = arith.constant 4 : i32
    %783 = arith.extsi %781 : i32 to i64
    %782 = arith.muli %780, %783 : i64
    %779 = func.call @memcpy(%arg4, %712, %782) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
    func.call @free(%712) : (!llvm.ptr) -> ()
    func.call @free(%721) : (!llvm.ptr) -> ()
    func.call @free(%734) : (!llvm.ptr) -> ()
    func.call @free(%738) : (!llvm.ptr) -> ()
    func.return
  }
  func.func @counts_in_term(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr) -> () {
    %788 = arith.constant 0 : i32
    %789 = llvm.mlir.constant(1 : i64) : i64
    %790 = llvm.alloca %789 x i32 : (i64) -> !llvm.ptr
    llvm.store %788, %790 : i32, !llvm.ptr
    %791 = arith.constant 0 : i32
    %792 = llvm.mlir.constant(1 : i64) : i64
    %793 = llvm.alloca %792 x i32 : (i64) -> !llvm.ptr
    llvm.store %791, %793 : i32, !llvm.ptr
    %794 = arith.constant 0 : i32
    %795 = llvm.mlir.constant(1 : i64) : i64
    %796 = llvm.alloca %795 x i32 : (i64) -> !llvm.ptr
    llvm.store %794, %796 : i32, !llvm.ptr
    %797 = func.call @strlen(%arg0) : (!llvm.ptr) -> i64
    %798 = arith.constant 0 : i32
    %799 = arith.extsi %798 : i32 to i64
    %800 = llvm.mlir.constant(1 : i64) : i64
    %801 = llvm.alloca %800 x i64 : (i64) -> !llvm.ptr
    llvm.store %799, %801 : i64, !llvm.ptr
    cf.br ^bb114
    ^bb114:
    %802 = llvm.load %801 : !llvm.ptr -> i64
    %803 = arith.cmpi slt, %802, %797 : i64
    cf.cond_br %803, ^bb115, ^bb116
    ^bb115:
      %805 = llvm.load %801 : !llvm.ptr -> i64
      %806 = llvm.getelementptr %arg0[%805] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      %804 = llvm.load %806 : !llvm.ptr -> i8
      %807 = arith.constant 49 : i32
      %809 = arith.extsi %804 : i8 to i32
      %808 = arith.cmpi eq, %809, %807 : i32
      cf.cond_br %808, ^bb117, ^bb118
      ^bb117:
        %810 = llvm.load %790 : !llvm.ptr -> i32
        %811 = arith.constant 1 : i32
        %812 = arith.addi %810, %811 : i32
        llvm.store %812, %790 : i32, !llvm.ptr
        cf.br ^bb119
      ^bb118:
        %813 = arith.constant 50 : i32
        %815 = arith.extsi %804 : i8 to i32
        %814 = arith.cmpi eq, %815, %813 : i32
        cf.cond_br %814, ^bb120, ^bb121
        ^bb120:
          %816 = llvm.load %793 : !llvm.ptr -> i32
          %817 = arith.constant 1 : i32
          %818 = arith.addi %816, %817 : i32
          llvm.store %818, %793 : i32, !llvm.ptr
          cf.br ^bb122
        ^bb121:
          %819 = arith.constant 51 : i32
          %821 = arith.extsi %804 : i8 to i32
          %820 = arith.cmpi eq, %821, %819 : i32
          cf.cond_br %820, ^bb123, ^bb124
          ^bb123:
            %822 = llvm.load %796 : !llvm.ptr -> i32
            %823 = arith.constant 1 : i32
            %824 = arith.addi %822, %823 : i32
            llvm.store %824, %796 : i32, !llvm.ptr
            cf.br ^bb125
          ^bb124:
            cf.br ^bb125
          ^bb125:
          cf.br ^bb122
        ^bb122:
        cf.br ^bb119
      ^bb119:
      %825 = llvm.load %801 : !llvm.ptr -> i64
      %826 = arith.constant 1 : i32
      %828 = arith.extsi %826 : i32 to i64
      %827 = arith.addi %825, %828 : i64
      llvm.store %827, %801 : i64, !llvm.ptr
      cf.br ^bb114
    ^bb116:
    %829 = llvm.load %790 : !llvm.ptr -> i32
    %830 = arith.constant 0 : i32
    %831 = arith.extsi %830 : i32 to i64
    %832 = llvm.getelementptr %arg1[%831] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %829, %832 : i32, !llvm.ptr
    %833 = llvm.load %793 : !llvm.ptr -> i32
    %834 = arith.constant 0 : i32
    %835 = arith.extsi %834 : i32 to i64
    %836 = llvm.getelementptr %arg2[%835] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %833, %836 : i32, !llvm.ptr
    %837 = llvm.load %796 : !llvm.ptr -> i32
    %838 = arith.constant 0 : i32
    %839 = arith.extsi %838 : i32 to i64
    %840 = llvm.getelementptr %arg3[%839] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %837, %840 : i32, !llvm.ptr
    func.return
  }
  func.func @main() -> i32 {
    %841 = arith.constant 995705032704 : i32
    %842 = arith.extsi %841 : i32 to i64
    %844 = llvm.mlir.addressof @MAX_STR : !llvm.ptr
    %845 = llvm.load %844 : !llvm.ptr -> i32
    %846 = arith.extsi %845 : i32 to i64
    %847 = arith.constant 1 : i32
    %848 = arith.extsi %847 : i32 to i64
    %843 = func.call @calloc(%846, %848) : (i64, i64) -> !llvm.ptr
    %849 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
    llvm.store %843, %849 : !llvm.ptr, !llvm.ptr
    %851 = llvm.mlir.addressof @MAX_STR : !llvm.ptr
    %852 = llvm.load %851 : !llvm.ptr -> i32
    %853 = arith.extsi %852 : i32 to i64
    %854 = arith.constant 1 : i32
    %855 = arith.extsi %854 : i32 to i64
    %850 = func.call @calloc(%853, %855) : (i64, i64) -> !llvm.ptr
    %856 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
    llvm.store %850, %856 : !llvm.ptr, !llvm.ptr
    %858 = llvm.mlir.addressof @MAX_SPLIT : !llvm.ptr
    %859 = llvm.load %858 : !llvm.ptr -> i32
    %860 = arith.extsi %859 : i32 to i64
    %861 = llvm.mlir.addressof @MAX_ELEM_LEN : !llvm.ptr
    %862 = llvm.load %861 : !llvm.ptr -> i32
    %863 = arith.extsi %862 : i32 to i64
    %864 = arith.muli %860, %863 : i64
    %865 = arith.constant 1 : i32
    %866 = arith.extsi %865 : i32 to i64
    %857 = func.call @calloc(%864, %866) : (i64, i64) -> !llvm.ptr
    %867 = llvm.mlir.addressof @g_elems : !llvm.ptr
    llvm.store %857, %867 : !llvm.ptr, !llvm.ptr
    %868 = arith.constant 49 : i32
    %869 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
    %870 = llvm.load %869 : !llvm.ptr -> !llvm.ptr
    %871 = arith.constant 0 : i32
    %872 = arith.trunci %868 : i32 to i8
    %873 = arith.extsi %871 : i32 to i64
    %874 = llvm.getelementptr %870[%873] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %872, %874 : i8, !llvm.ptr
    %875 = arith.constant 0 : i32
    %876 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
    %877 = llvm.load %876 : !llvm.ptr -> !llvm.ptr
    %878 = arith.constant 1 : i32
    %879 = arith.trunci %875 : i32 to i8
    %880 = arith.extsi %878 : i32 to i64
    %881 = llvm.getelementptr %877[%880] : (!llvm.ptr, i64) -> !llvm.ptr, i8
    llvm.store %879, %881 : i8, !llvm.ptr
    %882 = arith.constant 39 : i32
    %883 = arith.constant 1 : i32
    %885 = arith.extsi %883 : i32 to i64
    %884 = arith.subi %842, %885 : i64
    %886 = arith.extsi %882 : i32 to i64
    %887 = arith.cmpi slt, %884, %886 : i64
    %888 = scf.if %887 -> (i32) {
      %889 = arith.constant 1 : i32
      %891 = arith.extsi %889 : i32 to i64
      %890 = arith.subi %842, %891 : i64
      %892 = arith.trunci %890 : i64 to i32
      scf.yield %892 : i32
    } else {
      scf.yield %882 : i32
    }
    %893 = arith.constant 0 : i32
    %894 = llvm.mlir.constant(1 : i64) : i64
    %895 = llvm.alloca %894 x i32 : (i64) -> !llvm.ptr
    llvm.store %893, %895 : i32, !llvm.ptr
    cf.br ^bb126
    ^bb126:
    %896 = llvm.load %895 : !llvm.ptr -> i32
    %897 = arith.cmpi slt, %896, %888 : i32
    cf.cond_br %897, ^bb127, ^bb128
    ^bb127:
      %899 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
      %900 = llvm.load %899 : !llvm.ptr -> !llvm.ptr
      %901 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
      %902 = llvm.load %901 : !llvm.ptr -> !llvm.ptr
      func.call @say(%900, %902) : (!llvm.ptr, !llvm.ptr) -> ()
      %904 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
      %905 = llvm.load %904 : !llvm.ptr -> !llvm.ptr
      %906 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
      %907 = llvm.load %906 : !llvm.ptr -> !llvm.ptr
      %908 = llvm.mlir.addressof @MAX_STR : !llvm.ptr
      %909 = llvm.load %908 : !llvm.ptr -> i32
      %910 = arith.extsi %909 : i32 to i64
      %903 = func.call @memcpy(%905, %907, %910) : (!llvm.ptr, !llvm.ptr, i64) -> !llvm.ptr
      %911 = llvm.load %895 : !llvm.ptr -> i32
      %912 = arith.constant 1 : i32
      %913 = arith.addi %911, %912 : i32
      llvm.store %913, %895 : i32, !llvm.ptr
      cf.br ^bb126
    ^bb128:
    %914 = arith.constant 40 : i32
    %916 = arith.extsi %914 : i32 to i64
    %915 = arith.cmpi sle, %842, %916 : i64
    cf.cond_br %915, ^bb129, ^bb130
    ^bb129:
      %918 = arith.constant 1 : i32
      %919 = arith.constant 4 : i32
      %920 = arith.extsi %918 : i32 to i64
      %921 = arith.extsi %919 : i32 to i64
      %917 = func.call @calloc(%920, %921) : (i64, i64) -> !llvm.ptr
      %923 = arith.constant 1 : i32
      %924 = arith.constant 4 : i32
      %925 = arith.extsi %923 : i32 to i64
      %926 = arith.extsi %924 : i32 to i64
      %922 = func.call @calloc(%925, %926) : (i64, i64) -> !llvm.ptr
      %928 = arith.constant 1 : i32
      %929 = arith.constant 4 : i32
      %930 = arith.extsi %928 : i32 to i64
      %931 = arith.extsi %929 : i32 to i64
      %927 = func.call @calloc(%930, %931) : (i64, i64) -> !llvm.ptr
      %933 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
      %934 = llvm.load %933 : !llvm.ptr -> !llvm.ptr
      func.call @counts_in_term(%934, %917, %922, %927) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
      %935 = llvm.mlir.addressof @str_0 : !llvm.ptr
      %937 = arith.constant 0 : i32
      %938 = arith.extsi %937 : i32 to i64
      %939 = llvm.getelementptr %917[%938] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %936 = llvm.load %939 : !llvm.ptr -> i32
      %941 = arith.constant 0 : i32
      %942 = arith.extsi %941 : i32 to i64
      %943 = llvm.getelementptr %922[%942] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %940 = llvm.load %943 : !llvm.ptr -> i32
      %945 = arith.constant 0 : i32
      %946 = arith.extsi %945 : i32 to i64
      %947 = llvm.getelementptr %927[%946] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %944 = llvm.load %947 : !llvm.ptr -> i32
      %948 = llvm.call @printf(%935, %936, %940, %944) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i32, i32, i32) -> i32
      func.call @free(%917) : (!llvm.ptr) -> ()
      func.call @free(%922) : (!llvm.ptr) -> ()
      func.call @free(%927) : (!llvm.ptr) -> ()
      %953 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
      %954 = llvm.load %953 : !llvm.ptr -> !llvm.ptr
      func.call @free(%954) : (!llvm.ptr) -> ()
      %956 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
      %957 = llvm.load %956 : !llvm.ptr -> !llvm.ptr
      func.call @free(%957) : (!llvm.ptr) -> ()
      %959 = llvm.mlir.addressof @g_elems : !llvm.ptr
      %960 = llvm.load %959 : !llvm.ptr -> !llvm.ptr
      func.call @free(%960) : (!llvm.ptr) -> ()
      %961 = arith.constant 0 : i32
      func.return %961 : i32
    ^bb130:
      cf.br ^bb131
    ^bb131:
    %963 = llvm.mlir.addressof @MAX_SPLIT : !llvm.ptr
    %964 = llvm.load %963 : !llvm.ptr -> i32
    %965 = arith.extsi %964 : i32 to i64
    %966 = llvm.mlir.addressof @MAX_ELEM_LEN : !llvm.ptr
    %967 = llvm.load %966 : !llvm.ptr -> i32
    %968 = arith.extsi %967 : i32 to i64
    %969 = arith.muli %965, %968 : i64
    %970 = arith.constant 1 : i32
    %971 = arith.extsi %970 : i32 to i64
    %962 = func.call @calloc(%969, %971) : (i64, i64) -> !llvm.ptr
    %973 = arith.constant 1 : i32
    %974 = arith.constant 4 : i32
    %975 = arith.extsi %973 : i32 to i64
    %976 = arith.extsi %974 : i32 to i64
    %972 = func.call @calloc(%975, %976) : (i64, i64) -> !llvm.ptr
    %978 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
    %979 = llvm.load %978 : !llvm.ptr -> !llvm.ptr
    func.call @split_elements(%979, %972, %962) : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
    %981 = arith.constant 0 : i32
    %982 = arith.extsi %981 : i32 to i64
    %983 = llvm.getelementptr %972[%982] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %980 = llvm.load %983 : !llvm.ptr -> i32
    func.call @free(%972) : (!llvm.ptr) -> ()
    %985 = arith.constant 0 : i32
    %986 = llvm.mlir.constant(1 : i64) : i64
    %987 = llvm.alloca %986 x i32 : (i64) -> !llvm.ptr
    llvm.store %985, %987 : i32, !llvm.ptr
    cf.br ^bb132
    ^bb132:
    %988 = llvm.load %987 : !llvm.ptr -> i32
    %989 = arith.cmpi slt, %988, %980 : i32
    cf.cond_br %989, ^bb133, ^bb134
    ^bb133:
      # String concatenation: !llvm.ptr + i64
      %991 = func.call @find_or_add(%990) : (!llvm.ptr) -> i32
      %992 = llvm.load %987 : !llvm.ptr -> i32
      %993 = arith.constant 1 : i32
      %994 = arith.addi %992, %993 : i32
      llvm.store %994, %987 : i32, !llvm.ptr
      cf.br ^bb132
    ^bb134:
    %996 = llvm.mlir.addressof @MAX_SPLIT : !llvm.ptr
    %997 = llvm.load %996 : !llvm.ptr -> i32
    %998 = arith.extsi %997 : i32 to i64
    %999 = llvm.mlir.addressof @MAX_ELEM_LEN : !llvm.ptr
    %1000 = llvm.load %999 : !llvm.ptr -> i32
    %1001 = arith.extsi %1000 : i32 to i64
    %1002 = arith.muli %998, %1001 : i64
    %1003 = arith.constant 1 : i32
    %1004 = arith.extsi %1003 : i32 to i64
    %995 = func.call @calloc(%1002, %1004) : (i64, i64) -> !llvm.ptr
    %1006 = arith.constant 1 : i32
    %1007 = arith.constant 4 : i32
    %1008 = arith.extsi %1006 : i32 to i64
    %1009 = arith.extsi %1007 : i32 to i64
    %1005 = func.call @calloc(%1008, %1009) : (i64, i64) -> !llvm.ptr
    %1010 = arith.constant 0 : i32
    %1011 = llvm.mlir.constant(1 : i64) : i64
    %1012 = llvm.alloca %1011 x i32 : (i64) -> !llvm.ptr
    llvm.store %1010, %1012 : i32, !llvm.ptr
    cf.br ^bb135
    ^bb135:
    %1013 = llvm.load %1012 : !llvm.ptr -> i32
    %1014 = llvm.mlir.addressof @g_nelems : !llvm.ptr
    %1015 = llvm.load %1014 : !llvm.ptr -> i32
    %1016 = arith.cmpi slt, %1013, %1015 : i32
    cf.cond_br %1016, ^bb136, ^bb137
    ^bb136:
      %1018 = llvm.load %1012 : !llvm.ptr -> i32
      %1017 = func.call @elem_ptr(%1018) : (i32) -> !llvm.ptr
      %1020 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
      %1021 = llvm.load %1020 : !llvm.ptr -> !llvm.ptr
      func.call @say(%1017, %1021) : (!llvm.ptr, !llvm.ptr) -> ()
      %1023 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
      %1024 = llvm.load %1023 : !llvm.ptr -> !llvm.ptr
      func.call @split_elements(%1024, %1005, %995) : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
      %1026 = arith.constant 0 : i32
      %1027 = arith.extsi %1026 : i32 to i64
      %1028 = llvm.getelementptr %1005[%1027] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1025 = llvm.load %1028 : !llvm.ptr -> i32
      %1029 = arith.constant 0 : i32
      %1030 = llvm.mlir.constant(1 : i64) : i64
      %1031 = llvm.alloca %1030 x i32 : (i64) -> !llvm.ptr
      llvm.store %1029, %1031 : i32, !llvm.ptr
      cf.br ^bb138
      ^bb138:
      %1032 = llvm.load %1031 : !llvm.ptr -> i32
      %1033 = arith.cmpi slt, %1032, %1025 : i32
      cf.cond_br %1033, ^bb139, ^bb140
      ^bb139:
        # String concatenation: !llvm.ptr + i64
        %1035 = func.call @find_or_add(%1034) : (!llvm.ptr) -> i32
        %1036 = llvm.load %1031 : !llvm.ptr -> i32
        %1037 = arith.constant 1 : i32
        %1038 = arith.addi %1036, %1037 : i32
        llvm.store %1038, %1031 : i32, !llvm.ptr
        cf.br ^bb138
      ^bb140:
      %1039 = llvm.load %1012 : !llvm.ptr -> i32
      %1040 = arith.constant 1 : i32
      %1041 = arith.addi %1039, %1040 : i32
      llvm.store %1041, %1012 : i32, !llvm.ptr
      cf.br ^bb135
    ^bb137:
    func.call @free(%1005) : (!llvm.ptr) -> ()
    func.call @free(%995) : (!llvm.ptr) -> ()
    %1044 = llvm.mlir.addressof @g_nelems : !llvm.ptr
    %1045 = llvm.load %1044 : !llvm.ptr -> i32
    %1047 = arith.extsi %1045 : i32 to i64
    %1048 = arith.extsi %1045 : i32 to i64
    %1049 = arith.muli %1047, %1048 : i64
    %1050 = arith.constant 4 : i32
    %1051 = arith.extsi %1050 : i32 to i64
    %1046 = func.call @calloc(%1049, %1051) : (i64, i64) -> !llvm.ptr
    %1053 = llvm.mlir.addressof @MAX_SPLIT : !llvm.ptr
    %1054 = llvm.load %1053 : !llvm.ptr -> i32
    %1055 = arith.extsi %1054 : i32 to i64
    %1056 = llvm.mlir.addressof @MAX_ELEM_LEN : !llvm.ptr
    %1057 = llvm.load %1056 : !llvm.ptr -> i32
    %1058 = arith.extsi %1057 : i32 to i64
    %1059 = arith.muli %1055, %1058 : i64
    %1060 = arith.constant 1 : i32
    %1061 = arith.extsi %1060 : i32 to i64
    %1052 = func.call @calloc(%1059, %1061) : (i64, i64) -> !llvm.ptr
    %1063 = arith.constant 1 : i32
    %1064 = arith.constant 4 : i32
    %1065 = arith.extsi %1063 : i32 to i64
    %1066 = arith.extsi %1064 : i32 to i64
    %1062 = func.call @calloc(%1065, %1066) : (i64, i64) -> !llvm.ptr
    %1067 = arith.constant 0 : i32
    %1068 = llvm.mlir.constant(1 : i64) : i64
    %1069 = llvm.alloca %1068 x i32 : (i64) -> !llvm.ptr
    llvm.store %1067, %1069 : i32, !llvm.ptr
    cf.br ^bb141
    ^bb141:
    %1070 = llvm.load %1069 : !llvm.ptr -> i32
    %1071 = arith.cmpi slt, %1070, %1045 : i32
    cf.cond_br %1071, ^bb142, ^bb143
    ^bb142:
      %1074 = llvm.load %1069 : !llvm.ptr -> i32
      %1073 = func.call @elem_ptr(%1074) : (i32) -> !llvm.ptr
      %1075 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
      %1076 = llvm.load %1075 : !llvm.ptr -> !llvm.ptr
      func.call @say(%1073, %1076) : (!llvm.ptr, !llvm.ptr) -> ()
      %1078 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
      %1079 = llvm.load %1078 : !llvm.ptr -> !llvm.ptr
      func.call @split_elements(%1079, %1062, %1052) : (!llvm.ptr, !llvm.ptr, !llvm.ptr) -> ()
      %1081 = arith.constant 0 : i32
      %1082 = arith.extsi %1081 : i32 to i64
      %1083 = llvm.getelementptr %1062[%1082] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1080 = llvm.load %1083 : !llvm.ptr -> i32
      %1084 = arith.constant 0 : i32
      %1085 = llvm.mlir.constant(1 : i64) : i64
      %1086 = llvm.alloca %1085 x i32 : (i64) -> !llvm.ptr
      llvm.store %1084, %1086 : i32, !llvm.ptr
      cf.br ^bb144
      ^bb144:
      %1087 = llvm.load %1086 : !llvm.ptr -> i32
      %1088 = arith.cmpi slt, %1087, %1080 : i32
      cf.cond_br %1088, ^bb145, ^bb146
      ^bb145:
        # String concatenation: !llvm.ptr + i64
        %1090 = func.call @find_or_add(%1089) : (!llvm.ptr) -> i32
        %1092 = llvm.load %1069 : !llvm.ptr -> i32
        %1093 = arith.muli %1092, %1045 : i32
        %1094 = arith.addi %1093, %1090 : i32
        %1095 = arith.extsi %1094 : i32 to i64
        %1096 = llvm.getelementptr %1046[%1095] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1091 = llvm.load %1096 : !llvm.ptr -> i32
        %1097 = arith.constant 1 : i32
        %1098 = arith.addi %1091, %1097 : i32
        %1099 = llvm.load %1069 : !llvm.ptr -> i32
        %1100 = arith.muli %1099, %1045 : i32
        %1101 = arith.addi %1100, %1090 : i32
        %1102 = arith.extsi %1101 : i32 to i64
        %1103 = llvm.getelementptr %1046[%1102] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %1098, %1103 : i32, !llvm.ptr
        %1104 = llvm.load %1086 : !llvm.ptr -> i32
        %1105 = arith.constant 1 : i32
        %1106 = arith.addi %1104, %1105 : i32
        llvm.store %1106, %1086 : i32, !llvm.ptr
        cf.br ^bb144
      ^bb146:
      %1107 = llvm.load %1069 : !llvm.ptr -> i32
      %1108 = arith.constant 1 : i32
      %1109 = arith.addi %1107, %1108 : i32
      llvm.store %1109, %1069 : i32, !llvm.ptr
      cf.br ^bb141
    ^bb143:
    func.call @free(%1062) : (!llvm.ptr) -> ()
    func.call @free(%1052) : (!llvm.ptr) -> ()
    %1112 = llvm.mlir.addressof @g_nelems : !llvm.ptr
    %1113 = llvm.load %1112 : !llvm.ptr -> i32
    %1115 = arith.extsi %1045 : i32 to i64
    %1116 = arith.constant 4 : i32
    %1117 = arith.extsi %1116 : i32 to i64
    %1114 = func.call @calloc(%1115, %1117) : (i64, i64) -> !llvm.ptr
    %1119 = arith.extsi %1045 : i32 to i64
    %1120 = arith.constant 4 : i32
    %1121 = arith.extsi %1120 : i32 to i64
    %1118 = func.call @calloc(%1119, %1121) : (i64, i64) -> !llvm.ptr
    %1123 = arith.extsi %1045 : i32 to i64
    %1124 = arith.constant 4 : i32
    %1125 = arith.extsi %1124 : i32 to i64
    %1122 = func.call @calloc(%1123, %1125) : (i64, i64) -> !llvm.ptr
    %1126 = arith.constant 0 : i32
    %1127 = llvm.mlir.constant(1 : i64) : i64
    %1128 = llvm.alloca %1127 x i32 : (i64) -> !llvm.ptr
    llvm.store %1126, %1128 : i32, !llvm.ptr
    cf.br ^bb147
    ^bb147:
    %1129 = llvm.load %1128 : !llvm.ptr -> i32
    %1130 = arith.cmpi slt, %1129, %1045 : i32
    cf.cond_br %1130, ^bb148, ^bb149
    ^bb148:
      %1132 = llvm.load %1128 : !llvm.ptr -> i32
      %1131 = func.call @elem_ptr(%1132) : (i32) -> !llvm.ptr
      %1133 = func.call @strlen(%1131) : (!llvm.ptr) -> i64
      %1134 = arith.constant 0 : i32
      %1135 = arith.extsi %1134 : i32 to i64
      %1136 = llvm.mlir.constant(1 : i64) : i64
      %1137 = llvm.alloca %1136 x i64 : (i64) -> !llvm.ptr
      llvm.store %1135, %1137 : i64, !llvm.ptr
      cf.br ^bb150
      ^bb150:
      %1138 = llvm.load %1137 : !llvm.ptr -> i64
      %1139 = arith.cmpi slt, %1138, %1133 : i64
      cf.cond_br %1139, ^bb151, ^bb152
      ^bb151:
        %1141 = llvm.load %1137 : !llvm.ptr -> i64
        %1142 = llvm.getelementptr %1131[%1141] : (!llvm.ptr, i64) -> !llvm.ptr, i8
        %1140 = llvm.load %1142 : !llvm.ptr -> i8
        %1143 = arith.constant 49 : i32
        %1145 = arith.extsi %1140 : i8 to i32
        %1144 = arith.cmpi eq, %1145, %1143 : i32
        cf.cond_br %1144, ^bb153, ^bb154
        ^bb153:
          %1147 = llvm.load %1128 : !llvm.ptr -> i32
          %1148 = arith.extsi %1147 : i32 to i64
          %1149 = llvm.getelementptr %1114[%1148] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %1146 = llvm.load %1149 : !llvm.ptr -> i32
          %1150 = arith.constant 1 : i32
          %1151 = arith.addi %1146, %1150 : i32
          %1152 = llvm.load %1128 : !llvm.ptr -> i32
          %1153 = arith.extsi %1152 : i32 to i64
          %1154 = llvm.getelementptr %1114[%1153] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %1151, %1154 : i32, !llvm.ptr
          cf.br ^bb155
        ^bb154:
          %1155 = arith.constant 50 : i32
          %1157 = arith.extsi %1140 : i8 to i32
          %1156 = arith.cmpi eq, %1157, %1155 : i32
          cf.cond_br %1156, ^bb156, ^bb157
          ^bb156:
            %1159 = llvm.load %1128 : !llvm.ptr -> i32
            %1160 = arith.extsi %1159 : i32 to i64
            %1161 = llvm.getelementptr %1118[%1160] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %1158 = llvm.load %1161 : !llvm.ptr -> i32
            %1162 = arith.constant 1 : i32
            %1163 = arith.addi %1158, %1162 : i32
            %1164 = llvm.load %1128 : !llvm.ptr -> i32
            %1165 = arith.extsi %1164 : i32 to i64
            %1166 = llvm.getelementptr %1118[%1165] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %1163, %1166 : i32, !llvm.ptr
            cf.br ^bb158
          ^bb157:
            %1167 = arith.constant 51 : i32
            %1169 = arith.extsi %1140 : i8 to i32
            %1168 = arith.cmpi eq, %1169, %1167 : i32
            cf.cond_br %1168, ^bb159, ^bb160
            ^bb159:
              %1171 = llvm.load %1128 : !llvm.ptr -> i32
              %1172 = arith.extsi %1171 : i32 to i64
              %1173 = llvm.getelementptr %1122[%1172] : (!llvm.ptr, i64) -> !llvm.ptr, i32
              %1170 = llvm.load %1173 : !llvm.ptr -> i32
              %1174 = arith.constant 1 : i32
              %1175 = arith.addi %1170, %1174 : i32
              %1176 = llvm.load %1128 : !llvm.ptr -> i32
              %1177 = arith.extsi %1176 : i32 to i64
              %1178 = llvm.getelementptr %1122[%1177] : (!llvm.ptr, i64) -> !llvm.ptr, i32
              llvm.store %1175, %1178 : i32, !llvm.ptr
              cf.br ^bb161
            ^bb160:
              cf.br ^bb161
            ^bb161:
            cf.br ^bb158
          ^bb158:
          cf.br ^bb155
        ^bb155:
        %1179 = llvm.load %1137 : !llvm.ptr -> i64
        %1180 = arith.constant 1 : i32
        %1182 = arith.extsi %1180 : i32 to i64
        %1181 = arith.addi %1179, %1182 : i64
        llvm.store %1181, %1137 : i64, !llvm.ptr
        cf.br ^bb150
      ^bb152:
      %1183 = llvm.load %1128 : !llvm.ptr -> i32
      %1184 = arith.constant 1 : i32
      %1185 = arith.addi %1183, %1184 : i32
      llvm.store %1185, %1128 : i32, !llvm.ptr
      cf.br ^bb147
    ^bb149:
    %1187 = arith.extsi %1045 : i32 to i64
    %1188 = arith.constant 4 : i32
    %1189 = arith.extsi %1188 : i32 to i64
    %1186 = func.call @calloc(%1187, %1189) : (i64, i64) -> !llvm.ptr
    %1190 = arith.constant 0 : i32
    %1191 = llvm.mlir.constant(1 : i64) : i64
    %1192 = llvm.alloca %1191 x i32 : (i64) -> !llvm.ptr
    llvm.store %1190, %1192 : i32, !llvm.ptr
    cf.br ^bb162
    ^bb162:
    %1193 = llvm.load %1192 : !llvm.ptr -> i32
    %1194 = arith.cmpi slt, %1193, %980 : i32
    cf.cond_br %1194, ^bb163, ^bb164
    ^bb163:
      # String concatenation: !llvm.ptr + i64
      %1196 = func.call @find_or_add(%1195) : (!llvm.ptr) -> i32
      %1198 = arith.extsi %1196 : i32 to i64
      %1199 = llvm.getelementptr %1186[%1198] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1197 = llvm.load %1199 : !llvm.ptr -> i32
      %1200 = arith.constant 1 : i32
      %1201 = arith.addi %1197, %1200 : i32
      %1202 = arith.extsi %1196 : i32 to i64
      %1203 = llvm.getelementptr %1186[%1202] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %1201, %1203 : i32, !llvm.ptr
      %1204 = llvm.load %1192 : !llvm.ptr -> i32
      %1205 = arith.constant 1 : i32
      %1206 = arith.addi %1204, %1205 : i32
      llvm.store %1206, %1192 : i32, !llvm.ptr
      cf.br ^bb162
    ^bb164:
    func.call @free(%962) : (!llvm.ptr) -> ()
    %1209 = arith.extsi %1045 : i32 to i64
    %1210 = arith.constant 4 : i32
    %1211 = arith.extsi %1210 : i32 to i64
    %1208 = func.call @calloc(%1209, %1211) : (i64, i64) -> !llvm.ptr
    %1213 = arith.constant 40 : i32
    %1215 = arith.extsi %1213 : i32 to i64
    %1214 = arith.subi %842, %1215 : i64
    func.call @vec_mul_pow(%1186, %1046, %1214, %1045, %1208) : (!llvm.ptr, !llvm.ptr, i64, i32, !llvm.ptr) -> ()
    %1216 = arith.constant 0 : i32
    %1217 = llvm.mlir.constant(1 : i64) : i64
    %1218 = llvm.alloca %1217 x i32 : (i64) -> !llvm.ptr
    llvm.store %1216, %1218 : i32, !llvm.ptr
    %1219 = arith.constant 0 : i32
    %1220 = llvm.mlir.constant(1 : i64) : i64
    %1221 = llvm.alloca %1220 x i32 : (i64) -> !llvm.ptr
    llvm.store %1219, %1221 : i32, !llvm.ptr
    %1222 = arith.constant 0 : i32
    %1223 = llvm.mlir.constant(1 : i64) : i64
    %1224 = llvm.alloca %1223 x i32 : (i64) -> !llvm.ptr
    llvm.store %1222, %1224 : i32, !llvm.ptr
    %1225 = arith.constant 0 : i32
    %1226 = llvm.mlir.constant(1 : i64) : i64
    %1227 = llvm.alloca %1226 x i32 : (i64) -> !llvm.ptr
    llvm.store %1225, %1227 : i32, !llvm.ptr
    cf.br ^bb165
    ^bb165:
    %1228 = llvm.load %1227 : !llvm.ptr -> i32
    %1229 = arith.cmpi slt, %1228, %1045 : i32
    cf.cond_br %1229, ^bb166, ^bb167
    ^bb166:
      %1231 = llvm.load %1227 : !llvm.ptr -> i32
      %1232 = arith.extsi %1231 : i32 to i64
      %1233 = llvm.getelementptr %1208[%1232] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1230 = llvm.load %1233 : !llvm.ptr -> i32
      %1234 = arith.constant 0 : i32
      %1235 = arith.cmpi ne, %1230, %1234 : i32
      cf.cond_br %1235, ^bb168, ^bb169
      ^bb168:
        %1236 = llvm.load %1218 : !llvm.ptr -> i32
        %1237 = arith.extui %1236 : i32 to i64
        %1239 = llvm.load %1227 : !llvm.ptr -> i32
        %1240 = arith.extsi %1239 : i32 to i64
        %1241 = llvm.getelementptr %1208[%1240] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1238 = llvm.load %1241 : !llvm.ptr -> i32
        %1242 = arith.extui %1238 : i32 to i64
        %1244 = llvm.load %1227 : !llvm.ptr -> i32
        %1245 = arith.extsi %1244 : i32 to i64
        %1246 = llvm.getelementptr %1114[%1245] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1243 = llvm.load %1246 : !llvm.ptr -> i32
        %1247 = arith.extui %1243 : i32 to i64
        %1248 = arith.muli %1242, %1247 : i64
        %1249 = arith.addi %1237, %1248 : i64
        %1250 = arith.trunci %1249 : i64 to i32
        %1251 = llvm.mlir.addressof @MOD_MASK : !llvm.ptr
        %1252 = llvm.load %1251 : !llvm.ptr -> i32
        %1253 = arith.andi %1250, %1252 : i32
        llvm.store %1253, %1218 : i32, !llvm.ptr
        %1254 = llvm.load %1221 : !llvm.ptr -> i32
        %1255 = arith.extui %1254 : i32 to i64
        %1257 = llvm.load %1227 : !llvm.ptr -> i32
        %1258 = arith.extsi %1257 : i32 to i64
        %1259 = llvm.getelementptr %1208[%1258] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1256 = llvm.load %1259 : !llvm.ptr -> i32
        %1260 = arith.extui %1256 : i32 to i64
        %1262 = llvm.load %1227 : !llvm.ptr -> i32
        %1263 = arith.extsi %1262 : i32 to i64
        %1264 = llvm.getelementptr %1118[%1263] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1261 = llvm.load %1264 : !llvm.ptr -> i32
        %1265 = arith.extui %1261 : i32 to i64
        %1266 = arith.muli %1260, %1265 : i64
        %1267 = arith.addi %1255, %1266 : i64
        %1268 = arith.trunci %1267 : i64 to i32
        %1269 = llvm.mlir.addressof @MOD_MASK : !llvm.ptr
        %1270 = llvm.load %1269 : !llvm.ptr -> i32
        %1271 = arith.andi %1268, %1270 : i32
        llvm.store %1271, %1221 : i32, !llvm.ptr
        %1272 = llvm.load %1224 : !llvm.ptr -> i32
        %1273 = arith.extui %1272 : i32 to i64
        %1275 = llvm.load %1227 : !llvm.ptr -> i32
        %1276 = arith.extsi %1275 : i32 to i64
        %1277 = llvm.getelementptr %1208[%1276] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1274 = llvm.load %1277 : !llvm.ptr -> i32
        %1278 = arith.extui %1274 : i32 to i64
        %1280 = llvm.load %1227 : !llvm.ptr -> i32
        %1281 = arith.extsi %1280 : i32 to i64
        %1282 = llvm.getelementptr %1122[%1281] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1279 = llvm.load %1282 : !llvm.ptr -> i32
        %1283 = arith.extui %1279 : i32 to i64
        %1284 = arith.muli %1278, %1283 : i64
        %1285 = arith.addi %1273, %1284 : i64
        %1286 = arith.trunci %1285 : i64 to i32
        %1287 = llvm.mlir.addressof @MOD_MASK : !llvm.ptr
        %1288 = llvm.load %1287 : !llvm.ptr -> i32
        %1289 = arith.andi %1286, %1288 : i32
        llvm.store %1289, %1224 : i32, !llvm.ptr
        cf.br ^bb170
      ^bb169:
        cf.br ^bb170
      ^bb170:
      %1290 = llvm.load %1227 : !llvm.ptr -> i32
      %1291 = arith.constant 1 : i32
      %1292 = arith.addi %1290, %1291 : i32
      llvm.store %1292, %1227 : i32, !llvm.ptr
      cf.br ^bb165
    ^bb167:
    %1293 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %1294 = llvm.load %1218 : !llvm.ptr -> i32
    %1295 = llvm.load %1221 : !llvm.ptr -> i32
    %1296 = llvm.load %1224 : !llvm.ptr -> i32
    %1297 = llvm.call @printf(%1293, %1294, %1295, %1296) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i32, i32, i32) -> i32
    func.call @free(%1046) : (!llvm.ptr) -> ()
    func.call @free(%1114) : (!llvm.ptr) -> ()
    func.call @free(%1118) : (!llvm.ptr) -> ()
    func.call @free(%1122) : (!llvm.ptr) -> ()
    func.call @free(%1186) : (!llvm.ptr) -> ()
    func.call @free(%1208) : (!llvm.ptr) -> ()
    %1305 = llvm.mlir.addressof @g_buf1 : !llvm.ptr
    %1306 = llvm.load %1305 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1306) : (!llvm.ptr) -> ()
    %1308 = llvm.mlir.addressof @g_buf2 : !llvm.ptr
    %1309 = llvm.load %1308 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1309) : (!llvm.ptr) -> ()
    %1311 = llvm.mlir.addressof @g_elems : !llvm.ptr
    %1312 = llvm.load %1311 : !llvm.ptr -> !llvm.ptr
    func.call @free(%1312) : (!llvm.ptr) -> ()
    %1313 = arith.constant 0 : i32
    func.return %1313 : i32
  }
}