Problem 413

Ported from C++. Uses sorted-array maps for DP states.

Answer3079418648040719
Output3079418648040719
StatusPASS
Native helperno
Runtime4280 ms
Peak memory278336 KB
Time complexityO(n^5) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

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

Flow source

# Project Euler 413: One-child numbers F(10^19).
# Ported from C++. Uses sorted-array maps for DP states.

extern {
    function calloc(n: i64, size: i64) -> ptr<void>
    function free(p: ptr<void>)
    function printf(fmt: ptr<i8>, ...) -> i32
}

const MAX_STATES: i32 = 2000000
const MAX_TRANS: i32 = 20000000

function sort_kv(keys: ptr<i64>, vals: ptr<i64>, lo: i32, hi: i32, tk: ptr<i64>, tv: ptr<i64>) -> void {
    if hi - lo <= 1 { return }
    let mid: i32 = (lo + hi) / 2
    sort_kv(keys, vals, lo, mid, tk, tv)
    sort_kv(keys, vals, mid, hi, tk, tv)
    let mut i: i32 = lo
    let mut j: i32 = mid
    let mut k: i32 = lo
    while i < mid && j < hi {
        if keys[i] <= keys[j] {
            tk[k] = keys[i]
            tv[k] = vals[i]
            i = i + 1
        } else {
            tk[k] = keys[j]
            tv[k] = vals[j]
            j = j + 1
        }
        k = k + 1
    }
    while i < mid {
        tk[k] = keys[i]
        tv[k] = vals[i]
        i = i + 1
        k = k + 1
    }
    while j < hi {
        tk[k] = keys[j]
        tv[k] = vals[j]
        j = j + 1
        k = k + 1
    }
    let mut x: i32 = lo
    while x < hi {
        keys[x] = tk[x]
        vals[x] = tv[x]
        x = x + 1
    }
}

function sort_and_merge(keys: ptr<i64>, vals: ptr<i64>, count: i32, tk: ptr<i64>, tv: ptr<i64>) -> i32 {
    if count <= 1 { return count }
    sort_kv(keys, vals, 0, count, tk, tv)
    let mut j: i32 = 0
    let mut i: i32 = 1
    while i < count {
        if keys[i] == keys[j] {
            vals[j] = vals[j] + vals[i]
        } else {
            j = j + 1
            keys[j] = keys[i]
            vals[j] = vals[i]
        }
        i = i + 1
    }
    return j + 1
}

function v_factor(n: i32, p: i32) -> i32 {
    let mut x: i32 = n
    let mut c: i32 = 0
    while x % p == 0 {
        x = x / p
        c = c + 1
    }
    return c
}

function mod_pow(a: i64, e: i64, mod: i64) -> i64 {
    let mut r: i64 = 1 % mod
    let mut x: i64 = a % mod
    let mut ee: i64 = e
    while ee > 0 {
        if (ee & 1) == 1 { r = r * x % mod }
        x = x * x % mod
        ee = ee >> 1
    }
    return r
}

function mod_inv(a: i64, mod: i64) -> i64 {
    return mod_pow(a, mod - 2, mod)
}

function compute_total3(m: i32) -> i32 {
    let mm: i32 = if m <= 0 { 1 } else { m }
    let mut total: i32 = 1
    let mut i: i32 = 0
    while i < mm {
        total = total * 3
        i = i + 1
    }
    return total
}

function precompute_counts(m: i32, count_val: ptr<i32>, inc_code: ptr<i32>) -> void {
    let mm: i32 = if m <= 0 { 1 } else { m }
    let mut total: i32 = 1
    let mut i: i32 = 0
    while i < mm {
        total = total * 3
        i = i + 1
    }
    let pow3: ptr<i32> = calloc((mm + 1) as i64, 4)
    pow3[0] = 1
    let mut i2: i32 = 1
    while i2 <= mm {
        pow3[i2] = pow3[i2 - 1] * 3
        i2 = i2 + 1
    }
    let counts: ptr<i32> = calloc(mm as i64, 4)
    let mut code: i32 = 0
    while code < total {
        let mut tmp: i32 = code
        let mut i3: i32 = 0
        while i3 < mm {
            counts[i3] = tmp % 3
            tmp = tmp / 3
            i3 = i3 + 1
        }
        let mut i4: i32 = 0
        while i4 < mm {
            count_val[code * mm + i4] = counts[i4]
            let neu: i32 = counts[i4] + 1
            let nn: i32 = if neu > 2 { 2 } else { neu }
            inc_code[code * mm + i4] = code + (nn - counts[i4]) * pow3[i4]
            i4 = i4 + 1
        }
        code = code + 1
    }
    free(pow3 as ptr<void>)
    free(counts as ptr<void>)
}

function count_one_child_coprime(d: i32) -> i64 {
    let inv10: i64 = mod_inv(10, d as i64)
    let w: ptr<i64> = calloc((d + 1) as i64, 8)
    w[1] = inv10 % (d as i64)
    let mut i: i32 = 2
    while i <= d {
        w[i] = w[i - 1] * inv10 % (d as i64)
        i = i + 1
    }

    let dc_delta: ptr<i32> = calloc((d * 10) as i64, 4)
    let dc_count: ptr<i32> = calloc((d * 10) as i64, 4)
    let dc_n: ptr<i32> = calloc(d as i64, 4)
    let mut pos: i32 = 1
    while pos <= d {
        let dmap: ptr<i32> = calloc(d as i64, 4)
        let lo: i32 = if pos == 1 { 1 } else { 0 }
        let mut digit: i32 = lo
        while digit <= 9 {
            let delta: i32 = ((digit as i64) * w[pos] % (d as i64)) as i32
            dmap[delta] = dmap[delta] + 1
            digit = digit + 1
        }
        let mut k: i32 = 0
        let mut delta_val: i32 = 0
        while delta_val < d {
            if dmap[delta_val] > 0 {
                dc_delta[(pos - 1) * 10 + k] = delta_val
                dc_count[(pos - 1) * 10 + k] = dmap[delta_val]
                k = k + 1
            }
            delta_val = delta_val + 1
        }
        dc_n[pos - 1] = k
        free(dmap as ptr<void>)
        pos = pos + 1
    }

    let dp0k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp0v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp0n: i32 = 0
    let dp1k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp1v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp1n: i32 = 0

    dp0k[0] = 32
    dp0v[0] = 1
    dp0n = 1

    let n0k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n0v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n1k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n1v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let tk: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let tv: ptr<i64> = calloc(MAX_TRANS as i64, 8)

    let mut step: i32 = 0
    while step < d {
        let mut nn0: i32 = 0
        let mut nn1: i32 = 0

        let mut si: i32 = 0
        while si < dp0n {
            let key: i64 = dp0k[si]
            let ways: i64 = dp0v[si]
            let mask: i64 = key >> 5
            let r: i32 = (key & 31) as i32
            let mut k: i32 = 0
            while k < dc_n[step] {
                let delta: i32 = dc_delta[step * 10 + k]
                let cnt: i32 = dc_count[step * 10 + k]
                let r2: i32 = r + delta
                if r2 >= d { r2 = r2 - d }
                let bit: i64 = 1 << r2
                if (mask & bit) != 0 {
                    n1k[nn1] = (mask << 5) | (r2 as i64)
                    n1v[nn1] = ways * (cnt as i64)
                    nn1 = nn1 + 1
                } else {
                    n0k[nn0] = ((mask | bit) << 5) | (r2 as i64)
                    n0v[nn0] = ways * (cnt as i64)
                    nn0 = nn0 + 1
                }
                k = k + 1
            }
            si = si + 1
        }

        let mut si2: i32 = 0
        while si2 < dp1n {
            let key: i64 = dp1k[si2]
            let ways: i64 = dp1v[si2]
            let mask: i64 = key >> 5
            let r: i32 = (key & 31) as i32
            let mut k: i32 = 0
            while k < dc_n[step] {
                let delta: i32 = dc_delta[step * 10 + k]
                let cnt: i32 = dc_count[step * 10 + k]
                let r2: i32 = r + delta
                if r2 >= d { r2 = r2 - d }
                let bit: i64 = 1 << r2
                if (mask & bit) != 0 {
                    k = k + 1
                    continue
                  }
                n1k[nn1] = ((mask | bit) << 5) | (r2 as i64)
                n1v[nn1] = ways * (cnt as i64)
                nn1 = nn1 + 1
                k = k + 1
            }
            si2 = si2 + 1
        }

        dp0n = sort_and_merge(n0k, n0v, nn0, tk, tv)
        dp1n = sort_and_merge(n1k, n1v, nn1, tk, tv)

        let mut ci: i32 = 0
        while ci < dp0n {
            dp0k[ci] = n0k[ci]
            dp0v[ci] = n0v[ci]
            ci = ci + 1
        }
        let mut ci2: i32 = 0
        while ci2 < dp1n {
            dp1k[ci2] = n1k[ci2]
            dp1v[ci2] = n1v[ci2]
            ci2 = ci2 + 1
        }

        step = step + 1
    }

    let mut total: i64 = 0
    let mut si3: i32 = 0
    while si3 < dp1n {
        total = total + dp1v[si3]
        si3 = si3 + 1
    }

    free(w as ptr<void>)
    free(dc_delta as ptr<void>)
    free(dc_count as ptr<void>)
    free(dc_n as ptr<void>)
    free(dp0k as ptr<void>)
    free(dp0v as ptr<void>)
    free(dp1k as ptr<void>)
    free(dp1v as ptr<void>)
    free(n0k as ptr<void>)
    free(n0v as ptr<void>)
    free(n1k as ptr<void>)
    free(n1v as ptr<void>)
    free(tk as ptr<void>)
    free(tv as ptr<void>)

    return total
}

# L == 1 case: 3 DP maps with key = (counts_code << 20) | q
function count_one_child_L1(d: i32, t: i32, m: i32) -> i64 {
    let mm: i32 = if m <= 0 { 1 } else { m }
    let total3: i32 = compute_total3(mm)
    let cv: ptr<i32> = calloc((total3 * mm) as i64, 4)
    let ic: ptr<i32> = calloc((total3 * mm) as i64, 4)
    precompute_counts(mm, cv, ic)

    let w: ptr<i64> = calloc((d + 1) as i64, 8)
    if m > 1 {
        let inv10: i64 = mod_inv(10, m as i64)
        w[1] = inv10 % (m as i64)
        let mut i: i32 = 2
        while i <= d {
            w[i] = w[i - 1] * inv10 % (m as i64)
            i = i + 1
        }
    }

    # 3 DP maps, each with its own keys/vals arrays
    let dp0k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp0v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp0n: i32 = 0
    let dp1k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp1v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp1n: i32 = 0
    let dp2k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp2v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp2n: i32 = 0

    let start_code: i32 = ic[0]
    dp0k[0] = (start_code as i64) << 20
    dp0v[0] = 1
    dp0n = 1

    let n0k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n0v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n1k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n1v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n2k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n2v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let tk: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let tv: ptr<i64> = calloc(MAX_TRANS as i64, 8)

    let mut pos: i32 = 1
    while pos <= d {
        let mut nn0: i32 = 0
        let mut nn1: i32 = 0
        let mut nn2: i32 = 0
        let lo: i32 = if pos == 1 { 1 } else { 0 }
        let wi: i64 = w[pos]

        # Process dp0
        let mut si: i32 = 0
        while si < dp0n {
            let key: i64 = dp0k[si]
            let ways: i64 = dp0v[si]
            let cc: i32 = (key >> 20) as i32
            let q: i32 = (key & 0xFFFFF) as i32
            let mut digit: i32 = lo
            while digit <= 9 {
                let qn: i32 = if m > 1 { ((q as i64 + (digit as i64) * wi) % (m as i64)) as i32 } else { 0 }
                let mut nd: i32 = 0
                if digit % t == 0 { nd = cv[cc * mm + qn] }
                let nt: i32 = nd
                if nt > 2 { nt = 2 }
                let ncc: i32 = ic[cc * mm + qn]
                let nkey: i64 = ((ncc as i64) << 20) | (qn as i64)
                if nt == 0 {
                    n0k[nn0] = nkey
                    n0v[nn0] = ways
                    nn0 = nn0 + 1
                  }
                if nt == 1 {
                    n1k[nn1] = nkey
                    n1v[nn1] = ways
                    nn1 = nn1 + 1
                  }
                if nt == 2 {
                    n2k[nn2] = nkey
                    n2v[nn2] = ways
                    nn2 = nn2 + 1
                  }
                digit = digit + 1
            }
            si = si + 1
        }

        # Process dp1
        let mut si2: i32 = 0
        while si2 < dp1n {
            let key: i64 = dp1k[si2]
            let ways: i64 = dp1v[si2]
            let cc: i32 = (key >> 20) as i32
            let q: i32 = (key & 0xFFFFF) as i32
            let mut digit: i32 = lo
            while digit <= 9 {
                let qn: i32 = if m > 1 { ((q as i64 + (digit as i64) * wi) % (m as i64)) as i32 } else { 0 }
                let mut nd: i32 = 0
                if digit % t == 0 { nd = cv[cc * mm + qn] }
                let nt: i32 = 1 + nd
                if nt > 2 { nt = 2 }
                let ncc: i32 = ic[cc * mm + qn]
                let nkey: i64 = ((ncc as i64) << 20) | (qn as i64)
                if nt == 1 {
                    n1k[nn1] = nkey
                    n1v[nn1] = ways
                    nn1 = nn1 + 1
                  }
                if nt == 2 {
                    n2k[nn2] = nkey
                    n2v[nn2] = ways
                    nn2 = nn2 + 1
                  }
                digit = digit + 1
            }
            si2 = si2 + 1
        }

        # Process dp2
        let mut si3: i32 = 0
        while si3 < dp2n {
            let key: i64 = dp2k[si3]
            let ways: i64 = dp2v[si3]
            let cc: i32 = (key >> 20) as i32
            let q: i32 = (key & 0xFFFFF) as i32
            let mut digit: i32 = lo
            while digit <= 9 {
                let qn: i32 = if m > 1 { ((q as i64 + (digit as i64) * wi) % (m as i64)) as i32 } else { 0 }
                let mut nd: i32 = 0
                if digit % t == 0 { nd = cv[cc * mm + qn] }
                let nt: i32 = 2 + nd
                if nt > 2 { nt = 2 }
                let ncc: i32 = ic[cc * mm + qn]
                let nkey: i64 = ((ncc as i64) << 20) | (qn as i64)
                n2k[nn2] = nkey
                n2v[nn2] = ways
                nn2 = nn2 + 1
                digit = digit + 1
            }
            si3 = si3 + 1
        }

        dp0n = sort_and_merge(n0k, n0v, nn0, tk, tv)
        dp1n = sort_and_merge(n1k, n1v, nn1, tk, tv)
        dp2n = sort_and_merge(n2k, n2v, nn2, tk, tv)

        let mut ci: i32 = 0
        while ci < dp0n {
            dp0k[ci] = n0k[ci]
            dp0v[ci] = n0v[ci]
            ci = ci + 1
          }
        let mut ci2: i32 = 0
        while ci2 < dp1n {
            dp1k[ci2] = n1k[ci2]
            dp1v[ci2] = n1v[ci2]
            ci2 = ci2 + 1
          }
        let mut ci3: i32 = 0
        while ci3 < dp2n {
            dp2k[ci3] = n2k[ci3]
            dp2v[ci3] = n2v[ci3]
            ci3 = ci3 + 1
          }

        pos = pos + 1
    }

    let mut total: i64 = 0
    let mut si4: i32 = 0
    while si4 < dp1n {
        total = total + dp1v[si4]
        si4 = si4 + 1
    }

    free(cv as ptr<void>)
    free(ic as ptr<void>)
    free(w as ptr<void>)
    free(dp0k as ptr<void>)
    free(dp0v as ptr<void>)
    free(dp1k as ptr<void>)
    free(dp1v as ptr<void>)
    free(dp2k as ptr<void>)
    free(dp2v as ptr<void>)
    free(n0k as ptr<void>)
    free(n0v as ptr<void>)
    free(n1k as ptr<void>)
    free(n1v as ptr<void>)
    free(n2k as ptr<void>)
    free(n2v as ptr<void>)
    free(tk as ptr<void>)
    free(tv as ptr<void>)

    return total
}

# L > 1 case: key = (counts_code << 40) | (recent << 10) | (rlen << 6) | tail
function count_one_child_Lgt1(d: i32, t: i32, m: i32, L: i32) -> i64 {
    let mm: i32 = if m <= 0 { 1 } else { m }
    let total3: i32 = compute_total3(mm)
    let cv: ptr<i32> = calloc((total3 * mm) as i64, 4)
    let ic: ptr<i32> = calloc((total3 * mm) as i64, 4)
    precompute_counts(mm, cv, ic)

    let w: ptr<i64> = calloc((d + 1) as i64, 8)
    if m > 1 {
        let inv10: i64 = mod_inv(10, m as i64)
        w[1] = inv10 % (m as i64)
        let mut i: i32 = 2
        while i <= d {
            w[i] = w[i - 1] * inv10 % (m as i64)
            i = i + 1
        }
    }

    let mut mod10L: i32 = 1
    let mut i2: i32 = 0
    while i2 < L {
        mod10L = mod10L * 10
        i2 = i2 + 1
    }

    let next_tail: ptr<i32> = calloc((mod10L * 10) as i64, 4)
    let short_mask: ptr<i32> = calloc(mod10L as i64, 4)
    let pow10: ptr<i32> = calloc((L + 1) as i64, 4)
    let long_ok: ptr<i8> = calloc(mod10L as i64, 1)
    pow10[0] = 1
    let mut i3: i32 = 1
    while i3 <= L {
        pow10[i3] = pow10[i3 - 1] * 10
        i3 = i3 + 1
    }

    let mut tail: i32 = 0
    while tail < mod10L {
        long_ok[tail] = if tail % t == 0 { 1 } else { 0 }
        let mut mask: i32 = 0
        let mut l: i32 = 1
        while l < L {
            if (tail % pow10[l]) % t == 0 { mask = mask | (1 << (l - 1)) }
            l = l + 1
        }
        short_mask[tail] = mask
        let base: i32 = (tail * 10) % mod10L
        let mut digit: i32 = 0
        while digit < 10 {
            next_tail[tail * 10 + digit] = (base + digit) % mod10L
            digit = digit + 1
        }
        tail = tail + 1
    }

    let dp0k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp0v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp0n: i32 = 0
    let dp1k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp1v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp1n: i32 = 0
    let dp2k: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let dp2v: ptr<i64> = calloc(MAX_STATES as i64, 8)
    let mut dp2n: i32 = 0

    # Initial: key = (0 << 40) | (0 << 10) | (1 << 6) | 0
    dp0k[0] = 1048576
    dp0v[0] = 1
    dp0n = 1

    let n0k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n0v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n1k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n1v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n2k: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let n2v: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let tk: ptr<i64> = calloc(MAX_TRANS as i64, 8)
    let tv: ptr<i64> = calloc(MAX_TRANS as i64, 8)

    let mut pos: i32 = 1
    while pos <= d {
        let mut nn0: i32 = 0
        let mut nn1: i32 = 0
        let mut nn2: i32 = 0
        let lo: i32 = if pos == 1 { 1 } else { 0 }
        let wi: i64 = w[pos]

        let mut dc: i32 = 0
        while dc < 3 {
            let dpn: i32 = if dc == 0 { dp0n } else { if dc == 1 { dp1n } else { dp2n } }
            let dpk: ptr<i64> = if dc == 0 { dp0k } else { if dc == 1 { dp1k } else { dp2k } }
            let dpv: ptr<i64> = if dc == 0 { dp0v } else { if dc == 1 { dp1v } else { dp2v } }

            let mut si: i32 = 0
            while si < dpn {
                let key: i64 = dpk[si]
                let ways: i64 = dpv[si]
                let cc: i32 = (key >> 54) as i32
                let recent: i64 = (key >> 24) & 0x3FFFFFFF
                let rlen: i32 = ((key >> 20) & 0xF) as i32
                let tail2: i32 = (key & 0xFFFFF) as i32
                let current_q: i32 = if rlen > 0 {
                    (recent % 32) as i32
                } else { 0 }
                let mut max_l: i32 = L - 1
                if pos < max_l { max_l = pos }

                let mut digit: i32 = lo
                while digit <= 9 {
                    let q_next: i32 = if m > 1 { ((current_q as i64 + (digit as i64) * wi) % (m as i64)) as i32 } else { 0 }
                    let new_tail: i32 = next_tail[tail2 * 10 + digit]
                    let mask: i32 = short_mask[new_tail]
                    let mut new_div: i32 = 0
                    if mask != 0 {
                        let mut l: i32 = 1
                        while l <= max_l {
                            if (mask & (1 << (l - 1))) != 0 {
                                let mut p: i64 = recent
                                let mut i7: i32 = 0
                                while i7 < l - 1 {
                                    p = p / 32
                                    i7 = i7 + 1
                                  }
                                if (p % 32) as i32 == q_next { new_div = new_div + 1 }
                            }
                            l = l + 1
                        }
                    }
                    if pos >= L && long_ok[new_tail] != 0 {
                        new_div = new_div + cv[cc * mm + q_next]
                    }
                    if new_div > 2 { new_div = 2 }
                    let new_total: i32 = dc + new_div
                    if new_total > 2 { new_total = 2 }

                    let new_recent: i64 = recent * 32 + (q_next as i64)
                    let new_rlen: i32 = rlen + 1
                    let mut final_recent: i64 = new_recent
                    let mut final_rlen: i32 = new_rlen
                    let mut final_cc: i32 = cc
                    if new_rlen > L - 1 {
                        let mut div: i64 = 1
                        let mut i8_idx: i32 = 1
                        while i8_idx < new_rlen {
                            div = div * 32
                            i8_idx = i8_idx + 1
                          }
                        let oldest: i32 = (new_recent / div) as i32
                        final_recent = new_recent % div
                        final_rlen = new_rlen - 1
                        final_cc = ic[cc * mm + oldest]
                    }

                    let nkey: i64 = ((final_cc as i64) << 54) | ((final_recent as i64) << 24) | ((final_rlen as i64) << 20) | (new_tail as i64)
                    if new_total == 0 {
                        n0k[nn0] = nkey
                        n0v[nn0] = ways
                        nn0 = nn0 + 1
                      }
                    if new_total == 1 {
                        n1k[nn1] = nkey
                        n1v[nn1] = ways
                        nn1 = nn1 + 1
                      }
                    if new_total == 2 {
                        n2k[nn2] = nkey
                        n2v[nn2] = ways
                        nn2 = nn2 + 1
                      }
                    digit = digit + 1
                }
                si = si + 1
            }
            dc = dc + 1
        }

        dp0n = sort_and_merge(n0k, n0v, nn0, tk, tv)
        dp1n = sort_and_merge(n1k, n1v, nn1, tk, tv)
        dp2n = sort_and_merge(n2k, n2v, nn2, tk, tv)

        let mut ci: i32 = 0
        while ci < dp0n {
            dp0k[ci] = n0k[ci]
            dp0v[ci] = n0v[ci]
            ci = ci + 1
          }
        let mut ci2: i32 = 0
        while ci2 < dp1n {
            dp1k[ci2] = n1k[ci2]
            dp1v[ci2] = n1v[ci2]
            ci2 = ci2 + 1
          }
        let mut ci3: i32 = 0
        while ci3 < dp2n {
            dp2k[ci3] = n2k[ci3]
            dp2v[ci3] = n2v[ci3]
            ci3 = ci3 + 1
          }

        pos = pos + 1
    }

    let mut total: i64 = 0
    let mut si4: i32 = 0
    while si4 < dp1n {
        total = total + dp1v[si4]
        si4 = si4 + 1
    }

    free(cv as ptr<void>)
    free(ic as ptr<void>)
    free(w as ptr<void>)
    free(next_tail as ptr<void>)
    free(short_mask as ptr<void>)
    free(pow10 as ptr<void>)
    free(long_ok as ptr<void>)
    free(dp0k as ptr<void>)
    free(dp0v as ptr<void>)
    free(dp1k as ptr<void>)
    free(dp1v as ptr<void>)
    free(dp2k as ptr<void>)
    free(dp2v as ptr<void>)
    free(n0k as ptr<void>)
    free(n0v as ptr<void>)
    free(n1k as ptr<void>)
    free(n1v as ptr<void>)
    free(n2k as ptr<void>)
    free(n2v as ptr<void>)
    free(tk as ptr<void>)
    free(tv as ptr<void>)

    return total
}

function count_one_child(d: i32) -> i64 {
    if d == 1 { return 9 }
    if d % 2 != 0 && d % 5 != 0 { return count_one_child_coprime(d) }
    let a: i32 = v_factor(d, 2)
    let b: i32 = v_factor(d, 5)
    let mut t: i32 = 1
    let mut i: i32 = 0
    while i < a {
        t = t * 2
        i = i + 1
      }
    let mut i2: i32 = 0
    while i2 < b {
        t = t * 5
        i2 = i2 + 1
      }
    let m: i32 = d / t
    let L: i32 = if a > b { a } else { b }
    if L == 1 { return count_one_child_L1(d, t, m) }
    return count_one_child_Lgt1(d, t, m, L)
}

function main() -> i32 {
    let mut total: i64 = 0
    let mut d: i32 = 1
    while d < 20 {
        total = total + count_one_child(d)
        d = d + 1
    }
    printf("%lld\n", total)
    return 0
}

Generated C

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
    while (flow_temp_head) {
        flow_temp_node* n = flow_temp_head;
        flow_temp_head = n->next;
        free(n);
    }
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
    flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
    if (!node) return NULL;
    node->next = flow_temp_head;
    flow_temp_head = node;
    if (!flow_temp_atexit_set) {
        flow_temp_atexit_set = 1;
        atexit(flow_temp_free_all);
    }
    return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
    size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
    char* r = (char*)flow_temp_alloc(la + lb + 1);
    if (!r) return NULL;
    if (la) memcpy(r, a, la);
    if (lb) memcpy(r + la, b, lb);
    r[la + lb] = '\0';
    return r;
}

#define __flow_in_arr(arr, val) __extension__ ({ \
    int _found = 0; \
    size_t _n = sizeof(arr)/sizeof((arr)[0]); \
    for (size_t _i = 0; _i < _n; _i++) { \
        if ((arr)[_i] == (val)) { _found = 1; break; } \
    } _found; })

/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
    fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
    abort();
#if defined(__GNUC__) || defined(__clang__)
    __builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")

#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif

#include <math.h>

void* _ui_state = NULL;

static inline float i32_to_f32(int32_t v) { return (float)v; }

/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }

void sort_kv_ptr_i64_ptr_i64_i32_i32_ptr_i64_ptr_i64(int64_t* keys, int64_t* vals, int32_t lo, int32_t hi, int64_t* tk, int64_t* tv);
int32_t sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(int64_t* keys, int64_t* vals, int32_t count, int64_t* tk, int64_t* tv);
int32_t v_factor_i32_i32(int32_t n, int32_t p);
int64_t mod_pow_i64_i64_i64(int64_t a, int64_t e, int64_t mod);
int64_t mod_inv_i64_i64(int64_t a, int64_t mod);
int32_t compute_total3_i32(int32_t m);
void precompute_counts_i32_ptr_i32_ptr_i32(int32_t m, int32_t* count_val, int32_t* inc_code);
int64_t count_one_child_coprime_i32(int32_t d);
int64_t count_one_child_L1_i32_i32_i32(int32_t d, int32_t t, int32_t m);
int64_t count_one_child_Lgt1_i32_i32_i32_i32(int32_t d, int32_t t, int32_t m, int32_t L);
int64_t count_one_child_i32(int32_t d);
int32_t main(void);

static const int32_t MAX_STATES = 2000000;
static const int32_t MAX_TRANS = 20000000;




void sort_kv_ptr_i64_ptr_i64_i32_i32_ptr_i64_ptr_i64(int64_t* keys, int64_t* vals, int32_t lo, int32_t hi, int64_t* tk, int64_t* tv) {
    if ((hi - lo) <= 1) {
        return;
    }
    int32_t mid = FLOW_CHECKED_DIV(((lo + hi)), (2));
    sort_kv_ptr_i64_ptr_i64_i32_i32_ptr_i64_ptr_i64(keys, vals, lo, mid, tk, tv);
    sort_kv_ptr_i64_ptr_i64_i32_i32_ptr_i64_ptr_i64(keys, vals, mid, hi, tk, tv);
    int32_t i = lo;
    int32_t j = mid;
    int32_t k = lo;
    while ((i < mid && j < hi)) {
        if (keys[i] <= keys[j]) {
            tk[k] = keys[i];
            tv[k] = vals[i];
            i = (i + 1);
        } else {
            tk[k] = keys[j];
            tv[k] = vals[j];
            j = (j + 1);
        }
        k = (k + 1);
    }
    while (i < mid) {
        tk[k] = keys[i];
        tv[k] = vals[i];
        i = (i + 1);
        k = (k + 1);
    }
    while (j < hi) {
        tk[k] = keys[j];
        tv[k] = vals[j];
        j = (j + 1);
        k = (k + 1);
    }
    int32_t x = lo;
    while (x < hi) {
        keys[x] = tk[x];
        vals[x] = tv[x];
        x = (x + 1);
    }
}

int32_t sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(int64_t* keys, int64_t* vals, int32_t count, int64_t* tk, int64_t* tv) {
    if (count <= 1) {
        return count;
    }
    sort_kv_ptr_i64_ptr_i64_i32_i32_ptr_i64_ptr_i64(keys, vals, 0, count, tk, tv);
    int32_t j = 0;
    int32_t i = 1;
    while (i < count) {
        if (keys[i] == keys[j]) {
            vals[j] = (vals[j] + vals[i]);
        } else {
            j = (j + 1);
            keys[j] = keys[i];
            vals[j] = vals[i];
        }
        i = (i + 1);
    }
    return (j + 1);
}

int32_t v_factor_i32_i32(int32_t n, int32_t p) {
    int32_t x = n;
    int32_t c = 0;
    while (FLOW_CHECKED_MOD((x), (p)) == 0) {
        x = FLOW_CHECKED_DIV((x), (p));
        c = (c + 1);
    }
    return c;
}

int64_t mod_pow_i64_i64_i64(int64_t a, int64_t e, int64_t mod) {
    int64_t r = FLOW_CHECKED_MOD((1), (mod));
    int64_t x = FLOW_CHECKED_MOD((a), (mod));
    int64_t ee = e;
    while (ee > 0) {
        if ((ee & 1) == 1) {
            r = FLOW_CHECKED_MOD(((r * x)), (mod));
        }
        x = FLOW_CHECKED_MOD(((x * x)), (mod));
        ee = FLOW_CHECKED_SHR((ee), (1));
    }
    return r;
}

int64_t mod_inv_i64_i64(int64_t a, int64_t mod) {
    return mod_pow_i64_i64_i64(a, (mod - 2), mod);
}

int32_t compute_total3_i32(int32_t m) {
    int32_t mm = ((m <= 0) ? (1) : (m));
    int32_t total = 1;
    int32_t i = 0;
    while (i < mm) {
        total = (total * 3);
        i = (i + 1);
    }
    return total;
}

void precompute_counts_i32_ptr_i32_ptr_i32(int32_t m, int32_t* count_val, int32_t* inc_code) {
    int32_t mm = ((m <= 0) ? (1) : (m));
    int32_t total = 1;
    int32_t i = 0;
    while (i < mm) {
        total = (total * 3);
        i = (i + 1);
    }
    int32_t* pow3 = (int32_t*)(calloc(((int64_t)((mm + 1))), 4));
    pow3[0] = 1;
    int32_t i2 = 1;
    while (i2 <= mm) {
        pow3[i2] = (pow3[(i2 - 1)] * 3);
        i2 = (i2 + 1);
    }
    int32_t* counts = (int32_t*)(calloc(((int64_t)(mm)), 4));
    int32_t code = 0;
    while (code < total) {
        int32_t tmp = code;
        int32_t i3 = 0;
        while (i3 < mm) {
            counts[i3] = FLOW_CHECKED_MOD((tmp), (3));
            tmp = FLOW_CHECKED_DIV((tmp), (3));
            i3 = (i3 + 1);
        }
        int32_t i4 = 0;
        while (i4 < mm) {
            count_val[((code * mm) + i4)] = counts[i4];
            int32_t neu = (counts[i4] + 1);
            int32_t nn = ((neu > 2) ? (2) : (neu));
            inc_code[((code * mm) + i4)] = (code + ((nn - counts[i4]) * pow3[i4]));
            i4 = (i4 + 1);
        }
        code = (code + 1);
    }
    free(((void*)(pow3)));
    free(((void*)(counts)));
}

int64_t count_one_child_coprime_i32(int32_t d) {
    int64_t inv10 = mod_inv_i64_i64(10, ((int64_t)(d)));
    int64_t* w = (int64_t*)(calloc(((int64_t)((d + 1))), 8));
    w[1] = FLOW_CHECKED_MOD((inv10), (((int64_t)(d))));
    int32_t i = 2;
    while (i <= d) {
        w[i] = FLOW_CHECKED_MOD(((w[(i - 1)] * inv10)), (((int64_t)(d))));
        i = (i + 1);
    }
    int32_t* dc_delta = (int32_t*)(calloc(((int64_t)((d * 10))), 4));
    int32_t* dc_count = (int32_t*)(calloc(((int64_t)((d * 10))), 4));
    int32_t* dc_n = (int32_t*)(calloc(((int64_t)(d)), 4));
    int32_t pos = 1;
    while (pos <= d) {
        int32_t* dmap = (int32_t*)(calloc(((int64_t)(d)), 4));
        int32_t lo = ((pos == 1) ? (1) : (0));
        int32_t digit = lo;
        while (digit <= 9) {
            int32_t delta = ((int32_t)(FLOW_CHECKED_MOD(((((int64_t)(digit)) * w[pos])), (((int64_t)(d))))));
            dmap[delta] = (dmap[delta] + 1);
            digit = (digit + 1);
        }
        int32_t k = 0;
        int32_t delta_val = 0;
        while (delta_val < d) {
            if (dmap[delta_val] > 0) {
                dc_delta[(((pos - 1) * 10) + k)] = delta_val;
                dc_count[(((pos - 1) * 10) + k)] = dmap[delta_val];
                k = (k + 1);
            }
            delta_val = (delta_val + 1);
        }
        dc_n[(pos - 1)] = k;
        free(((void*)(dmap)));
        pos = (pos + 1);
    }
    int64_t* dp0k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp0v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp0n = 0;
    int64_t* dp1k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp1v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp1n = 0;
    dp0k[0] = 32;
    dp0v[0] = 1;
    dp0n = 1;
    int64_t* n0k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n0v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n1k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n1v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* tk = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* tv = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int32_t step = 0;
    while (step < d) {
        int32_t nn0 = 0;
        int32_t nn1 = 0;
        int32_t si = 0;
        while (si < dp0n) {
            int64_t key = dp0k[si];
            int64_t ways = dp0v[si];
            int64_t mask = FLOW_CHECKED_SHR((key), (5));
            int32_t r = ((int32_t)((key & 31)));
            int32_t k = 0;
            while (k < dc_n[step]) {
                int32_t delta = dc_delta[((step * 10) + k)];
                int32_t cnt = dc_count[((step * 10) + k)];
                int32_t r2 = (r + delta);
                if (r2 >= d) {
                    r2 = (r2 - d);
                }
                int64_t bit = FLOW_CHECKED_SHL((1), (r2));
                if ((mask & bit) != 0) {
                    n1k[nn1] = (FLOW_CHECKED_SHL((mask), (5)) | ((int64_t)(r2)));
                    n1v[nn1] = (ways * ((int64_t)(cnt)));
                    nn1 = (nn1 + 1);
                } else {
                    n0k[nn0] = (FLOW_CHECKED_SHL(((mask | bit)), (5)) | ((int64_t)(r2)));
                    n0v[nn0] = (ways * ((int64_t)(cnt)));
                    nn0 = (nn0 + 1);
                }
                k = (k + 1);
            }
            si = (si + 1);
        }
        int32_t si2 = 0;
        while (si2 < dp1n) {
            int64_t key = dp1k[si2];
            int64_t ways = dp1v[si2];
            int64_t mask = FLOW_CHECKED_SHR((key), (5));
            int32_t r = ((int32_t)((key & 31)));
            int32_t k = 0;
            while (k < dc_n[step]) {
                int32_t delta = dc_delta[((step * 10) + k)];
                int32_t cnt = dc_count[((step * 10) + k)];
                int32_t r2 = (r + delta);
                if (r2 >= d) {
                    r2 = (r2 - d);
                }
                int64_t bit = FLOW_CHECKED_SHL((1), (r2));
                if ((mask & bit) != 0) {
                    k = (k + 1);
                    continue;
                }
                n1k[nn1] = (FLOW_CHECKED_SHL(((mask | bit)), (5)) | ((int64_t)(r2)));
                n1v[nn1] = (ways * ((int64_t)(cnt)));
                nn1 = (nn1 + 1);
                k = (k + 1);
            }
            si2 = (si2 + 1);
        }
        dp0n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n0k, n0v, nn0, tk, tv);
        dp1n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n1k, n1v, nn1, tk, tv);
        int32_t ci = 0;
        while (ci < dp0n) {
            dp0k[ci] = n0k[ci];
            dp0v[ci] = n0v[ci];
            ci = (ci + 1);
        }
        int32_t ci2 = 0;
        while (ci2 < dp1n) {
            dp1k[ci2] = n1k[ci2];
            dp1v[ci2] = n1v[ci2];
            ci2 = (ci2 + 1);
        }
        step = (step + 1);
    }
    int64_t total = 0;
    int32_t si3 = 0;
    while (si3 < dp1n) {
        total = (total + dp1v[si3]);
        si3 = (si3 + 1);
    }
    free(((void*)(w)));
    free(((void*)(dc_delta)));
    free(((void*)(dc_count)));
    free(((void*)(dc_n)));
    free(((void*)(dp0k)));
    free(((void*)(dp0v)));
    free(((void*)(dp1k)));
    free(((void*)(dp1v)));
    free(((void*)(n0k)));
    free(((void*)(n0v)));
    free(((void*)(n1k)));
    free(((void*)(n1v)));
    free(((void*)(tk)));
    free(((void*)(tv)));
    return total;
}

int64_t count_one_child_L1_i32_i32_i32(int32_t d, int32_t t, int32_t m) {
    int32_t mm = ((m <= 0) ? (1) : (m));
    int32_t total3 = compute_total3_i32(mm);
    int32_t* cv = (int32_t*)(calloc(((int64_t)((total3 * mm))), 4));
    int32_t* ic = (int32_t*)(calloc(((int64_t)((total3 * mm))), 4));
    precompute_counts_i32_ptr_i32_ptr_i32(mm, cv, ic);
    int64_t* w = (int64_t*)(calloc(((int64_t)((d + 1))), 8));
    if (m > 1) {
        int64_t inv10 = mod_inv_i64_i64(10, ((int64_t)(m)));
        w[1] = FLOW_CHECKED_MOD((inv10), (((int64_t)(m))));
        int32_t i = 2;
        while (i <= d) {
            w[i] = FLOW_CHECKED_MOD(((w[(i - 1)] * inv10)), (((int64_t)(m))));
            i = (i + 1);
        }
    }
    int64_t* dp0k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp0v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp0n = 0;
    int64_t* dp1k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp1v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp1n = 0;
    int64_t* dp2k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp2v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp2n = 0;
    int32_t start_code = ic[0];
    dp0k[0] = FLOW_CHECKED_SHL((((int64_t)(start_code))), (20));
    dp0v[0] = 1;
    dp0n = 1;
    int64_t* n0k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n0v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n1k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n1v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n2k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n2v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* tk = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* tv = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int32_t pos = 1;
    while (pos <= d) {
        int32_t nn0 = 0;
        int32_t nn1 = 0;
        int32_t nn2 = 0;
        int32_t lo = ((pos == 1) ? (1) : (0));
        int64_t wi = w[pos];
        int32_t si = 0;
        while (si < dp0n) {
            int64_t key = dp0k[si];
            int64_t ways = dp0v[si];
            int32_t cc = ((int32_t)(FLOW_CHECKED_SHR((key), (20))));
            int32_t q = ((int32_t)((key & 1048575)));
            int32_t digit = lo;
            while (digit <= 9) {
                int32_t qn = ((m > 1) ? (((int32_t)(FLOW_CHECKED_MOD(((((int64_t)(q)) + (((int64_t)(digit)) * wi))), (((int64_t)(m))))))) : (0));
                int32_t nd = 0;
                if (FLOW_CHECKED_MOD((digit), (t)) == 0) {
                    nd = cv[((cc * mm) + qn)];
                }
                int32_t nt = nd;
                if (nt > 2) {
                    nt = 2;
                }
                int32_t ncc = ic[((cc * mm) + qn)];
                int64_t nkey = (FLOW_CHECKED_SHL((((int64_t)(ncc))), (20)) | ((int64_t)(qn)));
                if (nt == 0) {
                    n0k[nn0] = nkey;
                    n0v[nn0] = ways;
                    nn0 = (nn0 + 1);
                }
                if (nt == 1) {
                    n1k[nn1] = nkey;
                    n1v[nn1] = ways;
                    nn1 = (nn1 + 1);
                }
                if (nt == 2) {
                    n2k[nn2] = nkey;
                    n2v[nn2] = ways;
                    nn2 = (nn2 + 1);
                }
                digit = (digit + 1);
            }
            si = (si + 1);
        }
        int32_t si2 = 0;
        while (si2 < dp1n) {
            int64_t key = dp1k[si2];
            int64_t ways = dp1v[si2];
            int32_t cc = ((int32_t)(FLOW_CHECKED_SHR((key), (20))));
            int32_t q = ((int32_t)((key & 1048575)));
            int32_t digit = lo;
            while (digit <= 9) {
                int32_t qn = ((m > 1) ? (((int32_t)(FLOW_CHECKED_MOD(((((int64_t)(q)) + (((int64_t)(digit)) * wi))), (((int64_t)(m))))))) : (0));
                int32_t nd = 0;
                if (FLOW_CHECKED_MOD((digit), (t)) == 0) {
                    nd = cv[((cc * mm) + qn)];
                }
                int32_t nt = (1 + nd);
                if (nt > 2) {
                    nt = 2;
                }
                int32_t ncc = ic[((cc * mm) + qn)];
                int64_t nkey = (FLOW_CHECKED_SHL((((int64_t)(ncc))), (20)) | ((int64_t)(qn)));
                if (nt == 1) {
                    n1k[nn1] = nkey;
                    n1v[nn1] = ways;
                    nn1 = (nn1 + 1);
                }
                if (nt == 2) {
                    n2k[nn2] = nkey;
                    n2v[nn2] = ways;
                    nn2 = (nn2 + 1);
                }
                digit = (digit + 1);
            }
            si2 = (si2 + 1);
        }
        int32_t si3 = 0;
        while (si3 < dp2n) {
            int64_t key = dp2k[si3];
            int64_t ways = dp2v[si3];
            int32_t cc = ((int32_t)(FLOW_CHECKED_SHR((key), (20))));
            int32_t q = ((int32_t)((key & 1048575)));
            int32_t digit = lo;
            while (digit <= 9) {
                int32_t qn = ((m > 1) ? (((int32_t)(FLOW_CHECKED_MOD(((((int64_t)(q)) + (((int64_t)(digit)) * wi))), (((int64_t)(m))))))) : (0));
                int32_t nd = 0;
                if (FLOW_CHECKED_MOD((digit), (t)) == 0) {
                    nd = cv[((cc * mm) + qn)];
                }
                int32_t nt = (2 + nd);
                if (nt > 2) {
                    nt = 2;
                }
                int32_t ncc = ic[((cc * mm) + qn)];
                int64_t nkey = (FLOW_CHECKED_SHL((((int64_t)(ncc))), (20)) | ((int64_t)(qn)));
                n2k[nn2] = nkey;
                n2v[nn2] = ways;
                nn2 = (nn2 + 1);
                digit = (digit + 1);
            }
            si3 = (si3 + 1);
        }
        dp0n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n0k, n0v, nn0, tk, tv);
        dp1n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n1k, n1v, nn1, tk, tv);
        dp2n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n2k, n2v, nn2, tk, tv);
        int32_t ci = 0;
        while (ci < dp0n) {
            dp0k[ci] = n0k[ci];
            dp0v[ci] = n0v[ci];
            ci = (ci + 1);
        }
        int32_t ci2 = 0;
        while (ci2 < dp1n) {
            dp1k[ci2] = n1k[ci2];
            dp1v[ci2] = n1v[ci2];
            ci2 = (ci2 + 1);
        }
        int32_t ci3 = 0;
        while (ci3 < dp2n) {
            dp2k[ci3] = n2k[ci3];
            dp2v[ci3] = n2v[ci3];
            ci3 = (ci3 + 1);
        }
        pos = (pos + 1);
    }
    int64_t total = 0;
    int32_t si4 = 0;
    while (si4 < dp1n) {
        total = (total + dp1v[si4]);
        si4 = (si4 + 1);
    }
    free(((void*)(cv)));
    free(((void*)(ic)));
    free(((void*)(w)));
    free(((void*)(dp0k)));
    free(((void*)(dp0v)));
    free(((void*)(dp1k)));
    free(((void*)(dp1v)));
    free(((void*)(dp2k)));
    free(((void*)(dp2v)));
    free(((void*)(n0k)));
    free(((void*)(n0v)));
    free(((void*)(n1k)));
    free(((void*)(n1v)));
    free(((void*)(n2k)));
    free(((void*)(n2v)));
    free(((void*)(tk)));
    free(((void*)(tv)));
    return total;
}

int64_t count_one_child_Lgt1_i32_i32_i32_i32(int32_t d, int32_t t, int32_t m, int32_t L) {
    int32_t mm = ((m <= 0) ? (1) : (m));
    int32_t total3 = compute_total3_i32(mm);
    int32_t* cv = (int32_t*)(calloc(((int64_t)((total3 * mm))), 4));
    int32_t* ic = (int32_t*)(calloc(((int64_t)((total3 * mm))), 4));
    precompute_counts_i32_ptr_i32_ptr_i32(mm, cv, ic);
    int64_t* w = (int64_t*)(calloc(((int64_t)((d + 1))), 8));
    if (m > 1) {
        int64_t inv10 = mod_inv_i64_i64(10, ((int64_t)(m)));
        w[1] = FLOW_CHECKED_MOD((inv10), (((int64_t)(m))));
        int32_t i = 2;
        while (i <= d) {
            w[i] = FLOW_CHECKED_MOD(((w[(i - 1)] * inv10)), (((int64_t)(m))));
            i = (i + 1);
        }
    }
    int32_t mod10L = 1;
    int32_t i2 = 0;
    while (i2 < L) {
        mod10L = (mod10L * 10);
        i2 = (i2 + 1);
    }
    int32_t* next_tail = (int32_t*)(calloc(((int64_t)((mod10L * 10))), 4));
    int32_t* short_mask = (int32_t*)(calloc(((int64_t)(mod10L)), 4));
    int32_t* pow10 = (int32_t*)(calloc(((int64_t)((L + 1))), 4));
    int8_t* long_ok = (int8_t*)(calloc(((int64_t)(mod10L)), 1));
    pow10[0] = 1;
    int32_t i3 = 1;
    while (i3 <= L) {
        pow10[i3] = (pow10[(i3 - 1)] * 10);
        i3 = (i3 + 1);
    }
    int32_t tail = 0;
    while (tail < mod10L) {
        long_ok[tail] = ((FLOW_CHECKED_MOD((tail), (t)) == 0) ? (1) : (0));
        int32_t mask = 0;
        int32_t l = 1;
        while (l < L) {
            if (FLOW_CHECKED_MOD((FLOW_CHECKED_MOD((tail), (pow10[l]))), (t)) == 0) {
                mask = (mask | FLOW_CHECKED_SHL((1), ((l - 1))));
            }
            l = (l + 1);
        }
        short_mask[tail] = mask;
        int32_t base = FLOW_CHECKED_MOD(((tail * 10)), (mod10L));
        int32_t digit = 0;
        while (digit < 10) {
            next_tail[((tail * 10) + digit)] = FLOW_CHECKED_MOD(((base + digit)), (mod10L));
            digit = (digit + 1);
        }
        tail = (tail + 1);
    }
    int64_t* dp0k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp0v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp0n = 0;
    int64_t* dp1k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp1v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp1n = 0;
    int64_t* dp2k = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int64_t* dp2v = (int64_t*)(calloc(((int64_t)(MAX_STATES)), 8));
    int32_t dp2n = 0;
    dp0k[0] = 1048576;
    dp0v[0] = 1;
    dp0n = 1;
    int64_t* n0k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n0v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n1k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n1v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n2k = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* n2v = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* tk = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int64_t* tv = (int64_t*)(calloc(((int64_t)(MAX_TRANS)), 8));
    int32_t pos = 1;
    while (pos <= d) {
        int32_t nn0 = 0;
        int32_t nn1 = 0;
        int32_t nn2 = 0;
        int32_t lo = ((pos == 1) ? (1) : (0));
        int64_t wi = w[pos];
        int32_t dc = 0;
        while (dc < 3) {
            int32_t dpn = ((dc == 0) ? (dp0n) : (((dc == 1) ? (dp1n) : (dp2n))));
            int64_t* dpk = (int64_t*)(((dc == 0) ? (dp0k) : (((dc == 1) ? (dp1k) : (dp2k)))));
            int64_t* dpv = (int64_t*)(((dc == 0) ? (dp0v) : (((dc == 1) ? (dp1v) : (dp2v)))));
            int32_t si = 0;
            while (si < dpn) {
                int64_t key = dpk[si];
                int64_t ways = dpv[si];
                int32_t cc = ((int32_t)(FLOW_CHECKED_SHR((key), (54))));
                int64_t recent = (FLOW_CHECKED_SHR((key), (24)) & 1073741823);
                int32_t rlen = ((int32_t)((FLOW_CHECKED_SHR((key), (20)) & 15)));
                int32_t tail2 = ((int32_t)((key & 1048575)));
                int32_t current_q = ((rlen > 0) ? (((int32_t)(FLOW_CHECKED_MOD((recent), (32))))) : (0));
                int32_t max_l = (L - 1);
                if (pos < max_l) {
                    max_l = pos;
                }
                int32_t digit = lo;
                while (digit <= 9) {
                    int32_t q_next = ((m > 1) ? (((int32_t)(FLOW_CHECKED_MOD(((((int64_t)(current_q)) + (((int64_t)(digit)) * wi))), (((int64_t)(m))))))) : (0));
                    int32_t new_tail = next_tail[((tail2 * 10) + digit)];
                    int32_t mask = short_mask[new_tail];
                    int32_t new_div = 0;
                    if (mask != 0) {
                        int32_t l = 1;
                        while (l <= max_l) {
                            if ((mask & FLOW_CHECKED_SHL((1), ((l - 1)))) != 0) {
                                int64_t p = recent;
                                int32_t i7 = 0;
                                while (i7 < (l - 1)) {
                                    p = FLOW_CHECKED_DIV((p), (32));
                                    i7 = (i7 + 1);
                                }
                                if (((int32_t)(FLOW_CHECKED_MOD((p), (32)))) == q_next) {
                                    new_div = (new_div + 1);
                                }
                            }
                            l = (l + 1);
                        }
                    }
                    if ((pos >= L && long_ok[new_tail] != 0)) {
                        new_div = (new_div + cv[((cc * mm) + q_next)]);
                    }
                    if (new_div > 2) {
                        new_div = 2;
                    }
                    int32_t new_total = (dc + new_div);
                    if (new_total > 2) {
                        new_total = 2;
                    }
                    int64_t new_recent = ((recent * 32) + ((int64_t)(q_next)));
                    int32_t new_rlen = (rlen + 1);
                    int64_t final_recent = new_recent;
                    int32_t final_rlen = new_rlen;
                    int32_t final_cc = cc;
                    if (new_rlen > (L - 1)) {
                        int64_t div = 1;
                        int32_t i8_idx = 1;
                        while (i8_idx < new_rlen) {
                            div = (div * 32);
                            i8_idx = (i8_idx + 1);
                        }
                        int32_t oldest = ((int32_t)(FLOW_CHECKED_DIV((new_recent), (div))));
                        final_recent = FLOW_CHECKED_MOD((new_recent), (div));
                        final_rlen = (new_rlen - 1);
                        final_cc = ic[((cc * mm) + oldest)];
                    }
                    int64_t nkey = (((FLOW_CHECKED_SHL((((int64_t)(final_cc))), (54)) | FLOW_CHECKED_SHL((((int64_t)(final_recent))), (24))) | FLOW_CHECKED_SHL((((int64_t)(final_rlen))), (20))) | ((int64_t)(new_tail)));
                    if (new_total == 0) {
                        n0k[nn0] = nkey;
                        n0v[nn0] = ways;
                        nn0 = (nn0 + 1);
                    }
                    if (new_total == 1) {
                        n1k[nn1] = nkey;
                        n1v[nn1] = ways;
                        nn1 = (nn1 + 1);
                    }
                    if (new_total == 2) {
                        n2k[nn2] = nkey;
                        n2v[nn2] = ways;
                        nn2 = (nn2 + 1);
                    }
                    digit = (digit + 1);
                }
                si = (si + 1);
            }
            dc = (dc + 1);
        }
        dp0n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n0k, n0v, nn0, tk, tv);
        dp1n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n1k, n1v, nn1, tk, tv);
        dp2n = sort_and_merge_ptr_i64_ptr_i64_i32_ptr_i64_ptr_i64(n2k, n2v, nn2, tk, tv);
        int32_t ci = 0;
        while (ci < dp0n) {
            dp0k[ci] = n0k[ci];
            dp0v[ci] = n0v[ci];
            ci = (ci + 1);
        }
        int32_t ci2 = 0;
        while (ci2 < dp1n) {
            dp1k[ci2] = n1k[ci2];
            dp1v[ci2] = n1v[ci2];
            ci2 = (ci2 + 1);
        }
        int32_t ci3 = 0;
        while (ci3 < dp2n) {
            dp2k[ci3] = n2k[ci3];
            dp2v[ci3] = n2v[ci3];
            ci3 = (ci3 + 1);
        }
        pos = (pos + 1);
    }
    int64_t total = 0;
    int32_t si4 = 0;
    while (si4 < dp1n) {
        total = (total + dp1v[si4]);
        si4 = (si4 + 1);
    }
    free(((void*)(cv)));
    free(((void*)(ic)));
    free(((void*)(w)));
    free(((void*)(next_tail)));
    free(((void*)(short_mask)));
    free(((void*)(pow10)));
    free(((void*)(long_ok)));
    free(((void*)(dp0k)));
    free(((void*)(dp0v)));
    free(((void*)(dp1k)));
    free(((void*)(dp1v)));
    free(((void*)(dp2k)));
    free(((void*)(dp2v)));
    free(((void*)(n0k)));
    free(((void*)(n0v)));
    free(((void*)(n1k)));
    free(((void*)(n1v)));
    free(((void*)(n2k)));
    free(((void*)(n2v)));
    free(((void*)(tk)));
    free(((void*)(tv)));
    return total;
}

int64_t count_one_child_i32(int32_t d) {
    if (d == 1) {
        return 9;
    }
    if ((FLOW_CHECKED_MOD((d), (2)) != 0 && FLOW_CHECKED_MOD((d), (5)) != 0)) {
        return count_one_child_coprime_i32(d);
    }
    int32_t a = v_factor_i32_i32(d, 2);
    int32_t b = v_factor_i32_i32(d, 5);
    int32_t t = 1;
    int32_t i = 0;
    while (i < a) {
        t = (t * 2);
        i = (i + 1);
    }
    int32_t i2 = 0;
    while (i2 < b) {
        t = (t * 5);
        i2 = (i2 + 1);
    }
    int32_t m = FLOW_CHECKED_DIV((d), (t));
    int32_t L = ((a > b) ? (a) : (b));
    if (L == 1) {
        return count_one_child_L1_i32_i32_i32(d, t, m);
    }
    return count_one_child_Lgt1_i32_i32_i32_i32(d, t, m, L);
}

int32_t main(void) {
    int64_t total = 0;
    int32_t d = 1;
    while (d < 20) {
        total = (total + count_one_child_i32(d));
        d = (d + 1);
    }
    printf("%lld\n", total);
    return 0;
}

Generated MLIR

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

  // Constant: MAX_STATES
  llvm.mlir.global internal constant @MAX_STATES(2000000 : i32) : i32
  // Constant: MAX_TRANS
  llvm.mlir.global internal constant @MAX_TRANS(20000000 : i32) : i32
  func.func @sort_kv(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i32, %arg3: i32, %arg4: !llvm.ptr, %arg5: !llvm.ptr) -> () {
    %0 = arith.subi %arg3, %arg2 : i32
    %1 = arith.constant 1 : i32
    %2 = arith.cmpi sle, %0, %1 : i32
    cf.cond_br %2, ^bb0, ^bb1
    ^bb0:
      func.return
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %3 = arith.addi %arg2, %arg3 : i32
    %4 = arith.constant 2 : i32
    %5 = arith.divsi %3, %4 : i32
    func.call @sort_kv(%arg0, %arg1, %arg2, %5, %arg4, %arg5) : (!llvm.ptr, !llvm.ptr, i32, i32, !llvm.ptr, !llvm.ptr) -> ()
    func.call @sort_kv(%arg0, %arg1, %5, %arg3, %arg4, %arg5) : (!llvm.ptr, !llvm.ptr, i32, i32, !llvm.ptr, !llvm.ptr) -> ()
    %8 = llvm.mlir.constant(1 : i64) : i64
    %9 = llvm.alloca %8 x i32 : (i64) -> !llvm.ptr
    llvm.store %arg2, %9 : i32, !llvm.ptr
    %10 = llvm.mlir.constant(1 : i64) : i64
    %11 = llvm.alloca %10 x i32 : (i64) -> !llvm.ptr
    llvm.store %5, %11 : i32, !llvm.ptr
    %12 = llvm.mlir.constant(1 : i64) : i64
    %13 = llvm.alloca %12 x i32 : (i64) -> !llvm.ptr
    llvm.store %arg2, %13 : i32, !llvm.ptr
    cf.br ^bb3
    ^bb3:
    %14 = llvm.load %9 : !llvm.ptr -> i32
    %15 = arith.cmpi slt, %14, %5 : i32
    %16 = scf.if %15 -> (i1) {
      %17 = llvm.load %11 : !llvm.ptr -> i32
      %18 = arith.cmpi slt, %17, %arg3 : i32
      scf.yield %18 : i1
    } else {
      %19 = arith.constant false
      scf.yield %19 : i1
    }
    cf.cond_br %16, ^bb4, ^bb5
    ^bb4:
      %21 = llvm.load %9 : !llvm.ptr -> i32
      %22 = arith.extsi %21 : i32 to i64
      %23 = llvm.getelementptr %arg0[%22] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %20 = llvm.load %23 : !llvm.ptr -> i64
      %25 = llvm.load %11 : !llvm.ptr -> i32
      %26 = arith.extsi %25 : i32 to i64
      %27 = llvm.getelementptr %arg0[%26] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %24 = llvm.load %27 : !llvm.ptr -> i64
      %28 = arith.cmpi sle, %20, %24 : i64
      cf.cond_br %28, ^bb6, ^bb7
      ^bb6:
        %30 = llvm.load %9 : !llvm.ptr -> i32
        %31 = arith.extsi %30 : i32 to i64
        %32 = llvm.getelementptr %arg0[%31] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %29 = llvm.load %32 : !llvm.ptr -> i64
        %33 = llvm.load %13 : !llvm.ptr -> i32
        %34 = arith.extsi %33 : i32 to i64
        %35 = llvm.getelementptr %arg4[%34] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %29, %35 : i64, !llvm.ptr
        %37 = llvm.load %9 : !llvm.ptr -> i32
        %38 = arith.extsi %37 : i32 to i64
        %39 = llvm.getelementptr %arg1[%38] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %36 = llvm.load %39 : !llvm.ptr -> i64
        %40 = llvm.load %13 : !llvm.ptr -> i32
        %41 = arith.extsi %40 : i32 to i64
        %42 = llvm.getelementptr %arg5[%41] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %36, %42 : i64, !llvm.ptr
        %43 = llvm.load %9 : !llvm.ptr -> i32
        %44 = arith.constant 1 : i32
        %45 = arith.addi %43, %44 : i32
        llvm.store %45, %9 : i32, !llvm.ptr
        cf.br ^bb8
      ^bb7:
        %47 = llvm.load %11 : !llvm.ptr -> i32
        %48 = arith.extsi %47 : i32 to i64
        %49 = llvm.getelementptr %arg0[%48] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %46 = llvm.load %49 : !llvm.ptr -> i64
        %50 = llvm.load %13 : !llvm.ptr -> i32
        %51 = arith.extsi %50 : i32 to i64
        %52 = llvm.getelementptr %arg4[%51] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %46, %52 : i64, !llvm.ptr
        %54 = llvm.load %11 : !llvm.ptr -> i32
        %55 = arith.extsi %54 : i32 to i64
        %56 = llvm.getelementptr %arg1[%55] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %53 = llvm.load %56 : !llvm.ptr -> i64
        %57 = llvm.load %13 : !llvm.ptr -> i32
        %58 = arith.extsi %57 : i32 to i64
        %59 = llvm.getelementptr %arg5[%58] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %53, %59 : i64, !llvm.ptr
        %60 = llvm.load %11 : !llvm.ptr -> i32
        %61 = arith.constant 1 : i32
        %62 = arith.addi %60, %61 : i32
        llvm.store %62, %11 : i32, !llvm.ptr
        cf.br ^bb8
      ^bb8:
      %63 = llvm.load %13 : !llvm.ptr -> i32
      %64 = arith.constant 1 : i32
      %65 = arith.addi %63, %64 : i32
      llvm.store %65, %13 : i32, !llvm.ptr
      cf.br ^bb3
    ^bb5:
    cf.br ^bb9
    ^bb9:
    %66 = llvm.load %9 : !llvm.ptr -> i32
    %67 = arith.cmpi slt, %66, %5 : i32
    cf.cond_br %67, ^bb10, ^bb11
    ^bb10:
      %69 = llvm.load %9 : !llvm.ptr -> i32
      %70 = arith.extsi %69 : i32 to i64
      %71 = llvm.getelementptr %arg0[%70] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %68 = llvm.load %71 : !llvm.ptr -> i64
      %72 = llvm.load %13 : !llvm.ptr -> i32
      %73 = arith.extsi %72 : i32 to i64
      %74 = llvm.getelementptr %arg4[%73] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %68, %74 : i64, !llvm.ptr
      %76 = llvm.load %9 : !llvm.ptr -> i32
      %77 = arith.extsi %76 : i32 to i64
      %78 = llvm.getelementptr %arg1[%77] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %75 = llvm.load %78 : !llvm.ptr -> i64
      %79 = llvm.load %13 : !llvm.ptr -> i32
      %80 = arith.extsi %79 : i32 to i64
      %81 = llvm.getelementptr %arg5[%80] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %75, %81 : i64, !llvm.ptr
      %82 = llvm.load %9 : !llvm.ptr -> i32
      %83 = arith.constant 1 : i32
      %84 = arith.addi %82, %83 : i32
      llvm.store %84, %9 : i32, !llvm.ptr
      %85 = llvm.load %13 : !llvm.ptr -> i32
      %86 = arith.constant 1 : i32
      %87 = arith.addi %85, %86 : i32
      llvm.store %87, %13 : i32, !llvm.ptr
      cf.br ^bb9
    ^bb11:
    cf.br ^bb12
    ^bb12:
    %88 = llvm.load %11 : !llvm.ptr -> i32
    %89 = arith.cmpi slt, %88, %arg3 : i32
    cf.cond_br %89, ^bb13, ^bb14
    ^bb13:
      %91 = llvm.load %11 : !llvm.ptr -> i32
      %92 = arith.extsi %91 : i32 to i64
      %93 = llvm.getelementptr %arg0[%92] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %90 = llvm.load %93 : !llvm.ptr -> i64
      %94 = llvm.load %13 : !llvm.ptr -> i32
      %95 = arith.extsi %94 : i32 to i64
      %96 = llvm.getelementptr %arg4[%95] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %90, %96 : i64, !llvm.ptr
      %98 = llvm.load %11 : !llvm.ptr -> i32
      %99 = arith.extsi %98 : i32 to i64
      %100 = llvm.getelementptr %arg1[%99] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %97 = llvm.load %100 : !llvm.ptr -> i64
      %101 = llvm.load %13 : !llvm.ptr -> i32
      %102 = arith.extsi %101 : i32 to i64
      %103 = llvm.getelementptr %arg5[%102] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %97, %103 : i64, !llvm.ptr
      %104 = llvm.load %11 : !llvm.ptr -> i32
      %105 = arith.constant 1 : i32
      %106 = arith.addi %104, %105 : i32
      llvm.store %106, %11 : i32, !llvm.ptr
      %107 = llvm.load %13 : !llvm.ptr -> i32
      %108 = arith.constant 1 : i32
      %109 = arith.addi %107, %108 : i32
      llvm.store %109, %13 : i32, !llvm.ptr
      cf.br ^bb12
    ^bb14:
    %110 = llvm.mlir.constant(1 : i64) : i64
    %111 = llvm.alloca %110 x i32 : (i64) -> !llvm.ptr
    llvm.store %arg2, %111 : i32, !llvm.ptr
    cf.br ^bb15
    ^bb15:
    %112 = llvm.load %111 : !llvm.ptr -> i32
    %113 = arith.cmpi slt, %112, %arg3 : i32
    cf.cond_br %113, ^bb16, ^bb17
    ^bb16:
      %115 = llvm.load %111 : !llvm.ptr -> i32
      %116 = arith.extsi %115 : i32 to i64
      %117 = llvm.getelementptr %arg4[%116] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %114 = llvm.load %117 : !llvm.ptr -> i64
      %118 = llvm.load %111 : !llvm.ptr -> i32
      %119 = arith.extsi %118 : i32 to i64
      %120 = llvm.getelementptr %arg0[%119] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %114, %120 : i64, !llvm.ptr
      %122 = llvm.load %111 : !llvm.ptr -> i32
      %123 = arith.extsi %122 : i32 to i64
      %124 = llvm.getelementptr %arg5[%123] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %121 = llvm.load %124 : !llvm.ptr -> i64
      %125 = llvm.load %111 : !llvm.ptr -> i32
      %126 = arith.extsi %125 : i32 to i64
      %127 = llvm.getelementptr %arg1[%126] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %121, %127 : i64, !llvm.ptr
      %128 = llvm.load %111 : !llvm.ptr -> i32
      %129 = arith.constant 1 : i32
      %130 = arith.addi %128, %129 : i32
      llvm.store %130, %111 : i32, !llvm.ptr
      cf.br ^bb15
    ^bb17:
    func.return
  }
  func.func @sort_and_merge(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: i32, %arg3: !llvm.ptr, %arg4: !llvm.ptr) -> i32 {
    %131 = arith.constant 1 : i32
    %132 = arith.cmpi sle, %arg2, %131 : i32
    cf.cond_br %132, ^bb18, ^bb19
    ^bb18:
      func.return %arg2 : i32
    ^bb19:
      cf.br ^bb20
    ^bb20:
    %134 = arith.constant 0 : i32
    func.call @sort_kv(%arg0, %arg1, %134, %arg2, %arg3, %arg4) : (!llvm.ptr, !llvm.ptr, i32, i32, !llvm.ptr, !llvm.ptr) -> ()
    %135 = arith.constant 0 : i32
    %136 = llvm.mlir.constant(1 : i64) : i64
    %137 = llvm.alloca %136 x i32 : (i64) -> !llvm.ptr
    llvm.store %135, %137 : i32, !llvm.ptr
    %138 = arith.constant 1 : i32
    %139 = llvm.mlir.constant(1 : i64) : i64
    %140 = llvm.alloca %139 x i32 : (i64) -> !llvm.ptr
    llvm.store %138, %140 : i32, !llvm.ptr
    cf.br ^bb21
    ^bb21:
    %141 = llvm.load %140 : !llvm.ptr -> i32
    %142 = arith.cmpi slt, %141, %arg2 : i32
    cf.cond_br %142, ^bb22, ^bb23
    ^bb22:
      %144 = llvm.load %140 : !llvm.ptr -> i32
      %145 = arith.extsi %144 : i32 to i64
      %146 = llvm.getelementptr %arg0[%145] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %143 = llvm.load %146 : !llvm.ptr -> i64
      %148 = llvm.load %137 : !llvm.ptr -> i32
      %149 = arith.extsi %148 : i32 to i64
      %150 = llvm.getelementptr %arg0[%149] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %147 = llvm.load %150 : !llvm.ptr -> i64
      %151 = arith.cmpi eq, %143, %147 : i64
      cf.cond_br %151, ^bb24, ^bb25
      ^bb24:
        %153 = llvm.load %137 : !llvm.ptr -> i32
        %154 = arith.extsi %153 : i32 to i64
        %155 = llvm.getelementptr %arg1[%154] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %152 = llvm.load %155 : !llvm.ptr -> i64
        %157 = llvm.load %140 : !llvm.ptr -> i32
        %158 = arith.extsi %157 : i32 to i64
        %159 = llvm.getelementptr %arg1[%158] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %156 = llvm.load %159 : !llvm.ptr -> i64
        %160 = arith.addi %152, %156 : i64
        %161 = llvm.load %137 : !llvm.ptr -> i32
        %162 = arith.extsi %161 : i32 to i64
        %163 = llvm.getelementptr %arg1[%162] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %160, %163 : i64, !llvm.ptr
        cf.br ^bb26
      ^bb25:
        %164 = llvm.load %137 : !llvm.ptr -> i32
        %165 = arith.constant 1 : i32
        %166 = arith.addi %164, %165 : i32
        llvm.store %166, %137 : i32, !llvm.ptr
        %168 = llvm.load %140 : !llvm.ptr -> i32
        %169 = arith.extsi %168 : i32 to i64
        %170 = llvm.getelementptr %arg0[%169] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %167 = llvm.load %170 : !llvm.ptr -> i64
        %171 = llvm.load %137 : !llvm.ptr -> i32
        %172 = arith.extsi %171 : i32 to i64
        %173 = llvm.getelementptr %arg0[%172] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %167, %173 : i64, !llvm.ptr
        %175 = llvm.load %140 : !llvm.ptr -> i32
        %176 = arith.extsi %175 : i32 to i64
        %177 = llvm.getelementptr %arg1[%176] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %174 = llvm.load %177 : !llvm.ptr -> i64
        %178 = llvm.load %137 : !llvm.ptr -> i32
        %179 = arith.extsi %178 : i32 to i64
        %180 = llvm.getelementptr %arg1[%179] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %174, %180 : i64, !llvm.ptr
        cf.br ^bb26
      ^bb26:
      %181 = llvm.load %140 : !llvm.ptr -> i32
      %182 = arith.constant 1 : i32
      %183 = arith.addi %181, %182 : i32
      llvm.store %183, %140 : i32, !llvm.ptr
      cf.br ^bb21
    ^bb23:
    %184 = llvm.load %137 : !llvm.ptr -> i32
    %185 = arith.constant 1 : i32
    %186 = arith.addi %184, %185 : i32
    func.return %186 : i32
  }
  func.func @v_factor(%arg0: i32, %arg1: i32) -> i32 {
    %187 = llvm.mlir.constant(1 : i64) : i64
    %188 = llvm.alloca %187 x i32 : (i64) -> !llvm.ptr
    llvm.store %arg0, %188 : i32, !llvm.ptr
    %189 = arith.constant 0 : i32
    %190 = llvm.mlir.constant(1 : i64) : i64
    %191 = llvm.alloca %190 x i32 : (i64) -> !llvm.ptr
    llvm.store %189, %191 : i32, !llvm.ptr
    cf.br ^bb27
    ^bb27:
    %192 = llvm.load %188 : !llvm.ptr -> i32
    %193 = arith.remsi %192, %arg1 : i32
    %194 = arith.constant 0 : i32
    %195 = arith.cmpi eq, %193, %194 : i32
    cf.cond_br %195, ^bb28, ^bb29
    ^bb28:
      %196 = llvm.load %188 : !llvm.ptr -> i32
      %197 = arith.divsi %196, %arg1 : i32
      llvm.store %197, %188 : i32, !llvm.ptr
      %198 = llvm.load %191 : !llvm.ptr -> i32
      %199 = arith.constant 1 : i32
      %200 = arith.addi %198, %199 : i32
      llvm.store %200, %191 : i32, !llvm.ptr
      cf.br ^bb27
    ^bb29:
    %201 = llvm.load %191 : !llvm.ptr -> i32
    func.return %201 : i32
  }
  func.func @mod_pow(%arg0: i64, %arg1: i64, %arg2: i64) -> i64 {
    %202 = arith.constant 1 : i32
    %204 = arith.extsi %202 : i32 to i64
    %203 = arith.remsi %204, %arg2 : i64
    %205 = llvm.mlir.constant(1 : i64) : i64
    %206 = llvm.alloca %205 x i64 : (i64) -> !llvm.ptr
    llvm.store %203, %206 : i64, !llvm.ptr
    %207 = arith.remsi %arg0, %arg2 : i64
    %208 = llvm.mlir.constant(1 : i64) : i64
    %209 = llvm.alloca %208 x i64 : (i64) -> !llvm.ptr
    llvm.store %207, %209 : i64, !llvm.ptr
    %210 = llvm.mlir.constant(1 : i64) : i64
    %211 = llvm.alloca %210 x i64 : (i64) -> !llvm.ptr
    llvm.store %arg1, %211 : i64, !llvm.ptr
    cf.br ^bb30
    ^bb30:
    %212 = llvm.load %211 : !llvm.ptr -> i64
    %213 = arith.constant 0 : i32
    %215 = arith.extsi %213 : i32 to i64
    %214 = arith.cmpi sgt, %212, %215 : i64
    cf.cond_br %214, ^bb31, ^bb32
    ^bb31:
      %216 = llvm.load %211 : !llvm.ptr -> i64
      %217 = arith.constant 1 : i32
      %219 = arith.extsi %217 : i32 to i64
      %218 = arith.andi %216, %219 : i64
      %220 = arith.constant 1 : i32
      %222 = arith.extsi %220 : i32 to i64
      %221 = arith.cmpi eq, %218, %222 : i64
      cf.cond_br %221, ^bb33, ^bb34
      ^bb33:
        %223 = llvm.load %206 : !llvm.ptr -> i64
        %224 = llvm.load %209 : !llvm.ptr -> i64
        %225 = arith.muli %223, %224 : i64
        %226 = arith.remsi %225, %arg2 : i64
        llvm.store %226, %206 : i64, !llvm.ptr
        cf.br ^bb35
      ^bb34:
        cf.br ^bb35
      ^bb35:
      %227 = llvm.load %209 : !llvm.ptr -> i64
      %228 = llvm.load %209 : !llvm.ptr -> i64
      %229 = arith.muli %227, %228 : i64
      %230 = arith.remsi %229, %arg2 : i64
      llvm.store %230, %209 : i64, !llvm.ptr
      %231 = llvm.load %211 : !llvm.ptr -> i64
      %232 = arith.constant 1 : i32
      %234 = arith.extsi %232 : i32 to i64
      %233 = arith.shrsi %231, %234 : i64
      llvm.store %233, %211 : i64, !llvm.ptr
      cf.br ^bb30
    ^bb32:
    %235 = llvm.load %206 : !llvm.ptr -> i64
    func.return %235 : i64
  }
  func.func @mod_inv(%arg0: i64, %arg1: i64) -> i64 {
    %237 = arith.constant 2 : i32
    %239 = arith.extsi %237 : i32 to i64
    %238 = arith.subi %arg1, %239 : i64
    %236 = func.call @mod_pow(%arg0, %238, %arg1) : (i64, i64, i64) -> i64
    func.return %236 : i64
  }
  func.func @compute_total3(%arg0: i32) -> i32 {
    %240 = arith.constant 0 : i32
    %241 = arith.cmpi sle, %arg0, %240 : i32
    %242 = scf.if %241 -> (i32) {
      %243 = arith.constant 1 : i32
      scf.yield %243 : i32
    } else {
      scf.yield %arg0 : i32
    }
    %244 = arith.constant 1 : i32
    %245 = llvm.mlir.constant(1 : i64) : i64
    %246 = llvm.alloca %245 x i32 : (i64) -> !llvm.ptr
    llvm.store %244, %246 : i32, !llvm.ptr
    %247 = arith.constant 0 : i32
    %248 = llvm.mlir.constant(1 : i64) : i64
    %249 = llvm.alloca %248 x i32 : (i64) -> !llvm.ptr
    llvm.store %247, %249 : i32, !llvm.ptr
    cf.br ^bb36
    ^bb36:
    %250 = llvm.load %249 : !llvm.ptr -> i32
    %251 = arith.cmpi slt, %250, %242 : i32
    cf.cond_br %251, ^bb37, ^bb38
    ^bb37:
      %252 = llvm.load %246 : !llvm.ptr -> i32
      %253 = arith.constant 3 : i32
      %254 = arith.muli %252, %253 : i32
      llvm.store %254, %246 : i32, !llvm.ptr
      %255 = llvm.load %249 : !llvm.ptr -> i32
      %256 = arith.constant 1 : i32
      %257 = arith.addi %255, %256 : i32
      llvm.store %257, %249 : i32, !llvm.ptr
      cf.br ^bb36
    ^bb38:
    %258 = llvm.load %246 : !llvm.ptr -> i32
    func.return %258 : i32
  }
  func.func @precompute_counts(%arg0: i32, %arg1: !llvm.ptr, %arg2: !llvm.ptr) -> () {
    %259 = arith.constant 0 : i32
    %260 = arith.cmpi sle, %arg0, %259 : i32
    %261 = scf.if %260 -> (i32) {
      %262 = arith.constant 1 : i32
      scf.yield %262 : i32
    } else {
      scf.yield %arg0 : i32
    }
    %263 = arith.constant 1 : i32
    %264 = llvm.mlir.constant(1 : i64) : i64
    %265 = llvm.alloca %264 x i32 : (i64) -> !llvm.ptr
    llvm.store %263, %265 : i32, !llvm.ptr
    %266 = arith.constant 0 : i32
    %267 = llvm.mlir.constant(1 : i64) : i64
    %268 = llvm.alloca %267 x i32 : (i64) -> !llvm.ptr
    llvm.store %266, %268 : i32, !llvm.ptr
    cf.br ^bb39
    ^bb39:
    %269 = llvm.load %268 : !llvm.ptr -> i32
    %270 = arith.cmpi slt, %269, %261 : i32
    cf.cond_br %270, ^bb40, ^bb41
    ^bb40:
      %271 = llvm.load %265 : !llvm.ptr -> i32
      %272 = arith.constant 3 : i32
      %273 = arith.muli %271, %272 : i32
      llvm.store %273, %265 : i32, !llvm.ptr
      %274 = llvm.load %268 : !llvm.ptr -> i32
      %275 = arith.constant 1 : i32
      %276 = arith.addi %274, %275 : i32
      llvm.store %276, %268 : i32, !llvm.ptr
      cf.br ^bb39
    ^bb41:
    %278 = arith.constant 1 : i32
    %279 = arith.addi %261, %278 : i32
    %280 = arith.extsi %279 : i32 to i64
    %281 = arith.constant 4 : i32
    %282 = arith.extsi %281 : i32 to i64
    %277 = func.call @calloc(%280, %282) : (i64, i64) -> !llvm.ptr
    %283 = arith.constant 1 : i32
    %284 = arith.constant 0 : i32
    %285 = arith.extsi %284 : i32 to i64
    %286 = llvm.getelementptr %277[%285] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %283, %286 : i32, !llvm.ptr
    %287 = arith.constant 1 : i32
    %288 = llvm.mlir.constant(1 : i64) : i64
    %289 = llvm.alloca %288 x i32 : (i64) -> !llvm.ptr
    llvm.store %287, %289 : i32, !llvm.ptr
    cf.br ^bb42
    ^bb42:
    %290 = llvm.load %289 : !llvm.ptr -> i32
    %291 = arith.cmpi sle, %290, %261 : i32
    cf.cond_br %291, ^bb43, ^bb44
    ^bb43:
      %293 = llvm.load %289 : !llvm.ptr -> i32
      %294 = arith.constant 1 : i32
      %295 = arith.subi %293, %294 : i32
      %296 = arith.extsi %295 : i32 to i64
      %297 = llvm.getelementptr %277[%296] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %292 = llvm.load %297 : !llvm.ptr -> i32
      %298 = arith.constant 3 : i32
      %299 = arith.muli %292, %298 : i32
      %300 = llvm.load %289 : !llvm.ptr -> i32
      %301 = arith.extsi %300 : i32 to i64
      %302 = llvm.getelementptr %277[%301] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %299, %302 : i32, !llvm.ptr
      %303 = llvm.load %289 : !llvm.ptr -> i32
      %304 = arith.constant 1 : i32
      %305 = arith.addi %303, %304 : i32
      llvm.store %305, %289 : i32, !llvm.ptr
      cf.br ^bb42
    ^bb44:
    %307 = arith.extsi %261 : i32 to i64
    %308 = arith.constant 4 : i32
    %309 = arith.extsi %308 : i32 to i64
    %306 = func.call @calloc(%307, %309) : (i64, i64) -> !llvm.ptr
    %310 = arith.constant 0 : i32
    %311 = llvm.mlir.constant(1 : i64) : i64
    %312 = llvm.alloca %311 x i32 : (i64) -> !llvm.ptr
    llvm.store %310, %312 : i32, !llvm.ptr
    cf.br ^bb45
    ^bb45:
    %313 = llvm.load %312 : !llvm.ptr -> i32
    %314 = llvm.load %265 : !llvm.ptr -> i32
    %315 = arith.cmpi slt, %313, %314 : i32
    cf.cond_br %315, ^bb46, ^bb47
    ^bb46:
      %316 = llvm.load %312 : !llvm.ptr -> i32
      %317 = llvm.mlir.constant(1 : i64) : i64
      %318 = llvm.alloca %317 x i32 : (i64) -> !llvm.ptr
      llvm.store %316, %318 : i32, !llvm.ptr
      %319 = arith.constant 0 : i32
      %320 = llvm.mlir.constant(1 : i64) : i64
      %321 = llvm.alloca %320 x i32 : (i64) -> !llvm.ptr
      llvm.store %319, %321 : i32, !llvm.ptr
      cf.br ^bb48
      ^bb48:
      %322 = llvm.load %321 : !llvm.ptr -> i32
      %323 = arith.cmpi slt, %322, %261 : i32
      cf.cond_br %323, ^bb49, ^bb50
      ^bb49:
        %324 = llvm.load %318 : !llvm.ptr -> i32
        %325 = arith.constant 3 : i32
        %326 = arith.remsi %324, %325 : i32
        %327 = llvm.load %321 : !llvm.ptr -> i32
        %328 = arith.extsi %327 : i32 to i64
        %329 = llvm.getelementptr %306[%328] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %326, %329 : i32, !llvm.ptr
        %330 = llvm.load %318 : !llvm.ptr -> i32
        %331 = arith.constant 3 : i32
        %332 = arith.divsi %330, %331 : i32
        llvm.store %332, %318 : i32, !llvm.ptr
        %333 = llvm.load %321 : !llvm.ptr -> i32
        %334 = arith.constant 1 : i32
        %335 = arith.addi %333, %334 : i32
        llvm.store %335, %321 : i32, !llvm.ptr
        cf.br ^bb48
      ^bb50:
      %336 = arith.constant 0 : i32
      %337 = llvm.mlir.constant(1 : i64) : i64
      %338 = llvm.alloca %337 x i32 : (i64) -> !llvm.ptr
      llvm.store %336, %338 : i32, !llvm.ptr
      cf.br ^bb51
      ^bb51:
      %339 = llvm.load %338 : !llvm.ptr -> i32
      %340 = arith.cmpi slt, %339, %261 : i32
      cf.cond_br %340, ^bb52, ^bb53
      ^bb52:
        %342 = llvm.load %338 : !llvm.ptr -> i32
        %343 = arith.extsi %342 : i32 to i64
        %344 = llvm.getelementptr %306[%343] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %341 = llvm.load %344 : !llvm.ptr -> i32
        %345 = llvm.load %312 : !llvm.ptr -> i32
        %346 = arith.muli %345, %261 : i32
        %347 = llvm.load %338 : !llvm.ptr -> i32
        %348 = arith.addi %346, %347 : i32
        %349 = arith.extsi %348 : i32 to i64
        %350 = llvm.getelementptr %arg1[%349] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %341, %350 : i32, !llvm.ptr
        %352 = llvm.load %338 : !llvm.ptr -> i32
        %353 = arith.extsi %352 : i32 to i64
        %354 = llvm.getelementptr %306[%353] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %351 = llvm.load %354 : !llvm.ptr -> i32
        %355 = arith.constant 1 : i32
        %356 = arith.addi %351, %355 : i32
        %357 = arith.constant 2 : i32
        %358 = arith.cmpi sgt, %356, %357 : i32
        %359 = scf.if %358 -> (i32) {
          %360 = arith.constant 2 : i32
          scf.yield %360 : i32
        } else {
          scf.yield %356 : i32
        }
        %361 = llvm.load %312 : !llvm.ptr -> i32
        %363 = llvm.load %338 : !llvm.ptr -> i32
        %364 = arith.extsi %363 : i32 to i64
        %365 = llvm.getelementptr %306[%364] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %362 = llvm.load %365 : !llvm.ptr -> i32
        %366 = arith.subi %359, %362 : i32
        %368 = llvm.load %338 : !llvm.ptr -> i32
        %369 = arith.extsi %368 : i32 to i64
        %370 = llvm.getelementptr %277[%369] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %367 = llvm.load %370 : !llvm.ptr -> i32
        %371 = arith.muli %366, %367 : i32
        %372 = arith.addi %361, %371 : i32
        %373 = llvm.load %312 : !llvm.ptr -> i32
        %374 = arith.muli %373, %261 : i32
        %375 = llvm.load %338 : !llvm.ptr -> i32
        %376 = arith.addi %374, %375 : i32
        %377 = arith.extsi %376 : i32 to i64
        %378 = llvm.getelementptr %arg2[%377] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %372, %378 : i32, !llvm.ptr
        %379 = llvm.load %338 : !llvm.ptr -> i32
        %380 = arith.constant 1 : i32
        %381 = arith.addi %379, %380 : i32
        llvm.store %381, %338 : i32, !llvm.ptr
        cf.br ^bb51
      ^bb53:
      %382 = llvm.load %312 : !llvm.ptr -> i32
      %383 = arith.constant 1 : i32
      %384 = arith.addi %382, %383 : i32
      llvm.store %384, %312 : i32, !llvm.ptr
      cf.br ^bb45
    ^bb47:
    func.call @free(%277) : (!llvm.ptr) -> ()
    func.call @free(%306) : (!llvm.ptr) -> ()
    func.return
  }
  func.func @count_one_child_coprime(%arg0: i32) -> i64 {
    %388 = arith.constant 10 : i32
    %389 = arith.extsi %arg0 : i32 to i64
    %390 = arith.extsi %388 : i32 to i64
    %387 = func.call @mod_inv(%390, %389) : (i64, i64) -> i64
    %392 = arith.constant 1 : i32
    %393 = arith.addi %arg0, %392 : i32
    %394 = arith.extsi %393 : i32 to i64
    %395 = arith.constant 8 : i32
    %396 = arith.extsi %395 : i32 to i64
    %391 = func.call @calloc(%394, %396) : (i64, i64) -> !llvm.ptr
    %397 = arith.extsi %arg0 : i32 to i64
    %398 = arith.remsi %387, %397 : i64
    %399 = arith.constant 1 : i32
    %400 = arith.extsi %399 : i32 to i64
    %401 = llvm.getelementptr %391[%400] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %398, %401 : i64, !llvm.ptr
    %402 = arith.constant 2 : i32
    %403 = llvm.mlir.constant(1 : i64) : i64
    %404 = llvm.alloca %403 x i32 : (i64) -> !llvm.ptr
    llvm.store %402, %404 : i32, !llvm.ptr
    cf.br ^bb54
    ^bb54:
    %405 = llvm.load %404 : !llvm.ptr -> i32
    %406 = arith.cmpi sle, %405, %arg0 : i32
    cf.cond_br %406, ^bb55, ^bb56
    ^bb55:
      %408 = llvm.load %404 : !llvm.ptr -> i32
      %409 = arith.constant 1 : i32
      %410 = arith.subi %408, %409 : i32
      %411 = arith.extsi %410 : i32 to i64
      %412 = llvm.getelementptr %391[%411] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %407 = llvm.load %412 : !llvm.ptr -> i64
      %413 = arith.muli %407, %387 : i64
      %414 = arith.extsi %arg0 : i32 to i64
      %415 = arith.remsi %413, %414 : i64
      %416 = llvm.load %404 : !llvm.ptr -> i32
      %417 = arith.extsi %416 : i32 to i64
      %418 = llvm.getelementptr %391[%417] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %415, %418 : i64, !llvm.ptr
      %419 = llvm.load %404 : !llvm.ptr -> i32
      %420 = arith.constant 1 : i32
      %421 = arith.addi %419, %420 : i32
      llvm.store %421, %404 : i32, !llvm.ptr
      cf.br ^bb54
    ^bb56:
    %423 = arith.constant 10 : i32
    %424 = arith.muli %arg0, %423 : i32
    %425 = arith.extsi %424 : i32 to i64
    %426 = arith.constant 4 : i32
    %427 = arith.extsi %426 : i32 to i64
    %422 = func.call @calloc(%425, %427) : (i64, i64) -> !llvm.ptr
    %429 = arith.constant 10 : i32
    %430 = arith.muli %arg0, %429 : i32
    %431 = arith.extsi %430 : i32 to i64
    %432 = arith.constant 4 : i32
    %433 = arith.extsi %432 : i32 to i64
    %428 = func.call @calloc(%431, %433) : (i64, i64) -> !llvm.ptr
    %435 = arith.extsi %arg0 : i32 to i64
    %436 = arith.constant 4 : i32
    %437 = arith.extsi %436 : i32 to i64
    %434 = func.call @calloc(%435, %437) : (i64, i64) -> !llvm.ptr
    %438 = arith.constant 1 : i32
    %439 = llvm.mlir.constant(1 : i64) : i64
    %440 = llvm.alloca %439 x i32 : (i64) -> !llvm.ptr
    llvm.store %438, %440 : i32, !llvm.ptr
    cf.br ^bb57
    ^bb57:
    %441 = llvm.load %440 : !llvm.ptr -> i32
    %442 = arith.cmpi sle, %441, %arg0 : i32
    cf.cond_br %442, ^bb58, ^bb59
    ^bb58:
      %444 = arith.extsi %arg0 : i32 to i64
      %445 = arith.constant 4 : i32
      %446 = arith.extsi %445 : i32 to i64
      %443 = func.call @calloc(%444, %446) : (i64, i64) -> !llvm.ptr
      %447 = llvm.load %440 : !llvm.ptr -> i32
      %448 = arith.constant 1 : i32
      %449 = arith.cmpi eq, %447, %448 : i32
      %450 = scf.if %449 -> (i32) {
        %451 = arith.constant 1 : i32
        scf.yield %451 : i32
      } else {
        %452 = arith.constant 0 : i32
        scf.yield %452 : i32
      }
      %453 = llvm.mlir.constant(1 : i64) : i64
      %454 = llvm.alloca %453 x i32 : (i64) -> !llvm.ptr
      llvm.store %450, %454 : i32, !llvm.ptr
      cf.br ^bb60
      ^bb60:
      %455 = llvm.load %454 : !llvm.ptr -> i32
      %456 = arith.constant 9 : i32
      %457 = arith.cmpi sle, %455, %456 : i32
      cf.cond_br %457, ^bb61, ^bb62
      ^bb61:
        %458 = llvm.load %454 : !llvm.ptr -> i32
        %459 = arith.extsi %458 : i32 to i64
        %461 = llvm.load %440 : !llvm.ptr -> i32
        %462 = arith.extsi %461 : i32 to i64
        %463 = llvm.getelementptr %391[%462] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %460 = llvm.load %463 : !llvm.ptr -> i64
        %464 = arith.muli %459, %460 : i64
        %465 = arith.extsi %arg0 : i32 to i64
        %466 = arith.remsi %464, %465 : i64
        %467 = arith.trunci %466 : i64 to i32
        %469 = arith.extsi %467 : i32 to i64
        %470 = llvm.getelementptr %443[%469] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %468 = llvm.load %470 : !llvm.ptr -> i32
        %471 = arith.constant 1 : i32
        %472 = arith.addi %468, %471 : i32
        %473 = arith.extsi %467 : i32 to i64
        %474 = llvm.getelementptr %443[%473] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %472, %474 : i32, !llvm.ptr
        %475 = llvm.load %454 : !llvm.ptr -> i32
        %476 = arith.constant 1 : i32
        %477 = arith.addi %475, %476 : i32
        llvm.store %477, %454 : i32, !llvm.ptr
        cf.br ^bb60
      ^bb62:
      %478 = arith.constant 0 : i32
      %479 = llvm.mlir.constant(1 : i64) : i64
      %480 = llvm.alloca %479 x i32 : (i64) -> !llvm.ptr
      llvm.store %478, %480 : i32, !llvm.ptr
      %481 = arith.constant 0 : i32
      %482 = llvm.mlir.constant(1 : i64) : i64
      %483 = llvm.alloca %482 x i32 : (i64) -> !llvm.ptr
      llvm.store %481, %483 : i32, !llvm.ptr
      cf.br ^bb63
      ^bb63:
      %484 = llvm.load %483 : !llvm.ptr -> i32
      %485 = arith.cmpi slt, %484, %arg0 : i32
      cf.cond_br %485, ^bb64, ^bb65
      ^bb64:
        %487 = llvm.load %483 : !llvm.ptr -> i32
        %488 = arith.extsi %487 : i32 to i64
        %489 = llvm.getelementptr %443[%488] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %486 = llvm.load %489 : !llvm.ptr -> i32
        %490 = arith.constant 0 : i32
        %491 = arith.cmpi sgt, %486, %490 : i32
        cf.cond_br %491, ^bb66, ^bb67
        ^bb66:
          %492 = llvm.load %483 : !llvm.ptr -> i32
          %493 = llvm.load %440 : !llvm.ptr -> i32
          %494 = arith.constant 1 : i32
          %495 = arith.subi %493, %494 : i32
          %496 = arith.constant 10 : i32
          %497 = arith.muli %495, %496 : i32
          %498 = llvm.load %480 : !llvm.ptr -> i32
          %499 = arith.addi %497, %498 : i32
          %500 = arith.extsi %499 : i32 to i64
          %501 = llvm.getelementptr %422[%500] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %492, %501 : i32, !llvm.ptr
          %503 = llvm.load %483 : !llvm.ptr -> i32
          %504 = arith.extsi %503 : i32 to i64
          %505 = llvm.getelementptr %443[%504] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %502 = llvm.load %505 : !llvm.ptr -> i32
          %506 = llvm.load %440 : !llvm.ptr -> i32
          %507 = arith.constant 1 : i32
          %508 = arith.subi %506, %507 : i32
          %509 = arith.constant 10 : i32
          %510 = arith.muli %508, %509 : i32
          %511 = llvm.load %480 : !llvm.ptr -> i32
          %512 = arith.addi %510, %511 : i32
          %513 = arith.extsi %512 : i32 to i64
          %514 = llvm.getelementptr %428[%513] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %502, %514 : i32, !llvm.ptr
          %515 = llvm.load %480 : !llvm.ptr -> i32
          %516 = arith.constant 1 : i32
          %517 = arith.addi %515, %516 : i32
          llvm.store %517, %480 : i32, !llvm.ptr
          cf.br ^bb68
        ^bb67:
          cf.br ^bb68
        ^bb68:
        %518 = llvm.load %483 : !llvm.ptr -> i32
        %519 = arith.constant 1 : i32
        %520 = arith.addi %518, %519 : i32
        llvm.store %520, %483 : i32, !llvm.ptr
        cf.br ^bb63
      ^bb65:
      %521 = llvm.load %480 : !llvm.ptr -> i32
      %522 = llvm.load %440 : !llvm.ptr -> i32
      %523 = arith.constant 1 : i32
      %524 = arith.subi %522, %523 : i32
      %525 = arith.extsi %524 : i32 to i64
      %526 = llvm.getelementptr %434[%525] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %521, %526 : i32, !llvm.ptr
      func.call @free(%443) : (!llvm.ptr) -> ()
      %528 = llvm.load %440 : !llvm.ptr -> i32
      %529 = arith.constant 1 : i32
      %530 = arith.addi %528, %529 : i32
      llvm.store %530, %440 : i32, !llvm.ptr
      cf.br ^bb57
    ^bb59:
    %532 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %533 = llvm.load %532 : !llvm.ptr -> i32
    %534 = arith.extsi %533 : i32 to i64
    %535 = arith.constant 8 : i32
    %536 = arith.extsi %535 : i32 to i64
    %531 = func.call @calloc(%534, %536) : (i64, i64) -> !llvm.ptr
    %538 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %539 = llvm.load %538 : !llvm.ptr -> i32
    %540 = arith.extsi %539 : i32 to i64
    %541 = arith.constant 8 : i32
    %542 = arith.extsi %541 : i32 to i64
    %537 = func.call @calloc(%540, %542) : (i64, i64) -> !llvm.ptr
    %543 = arith.constant 0 : i32
    %544 = llvm.mlir.constant(1 : i64) : i64
    %545 = llvm.alloca %544 x i32 : (i64) -> !llvm.ptr
    llvm.store %543, %545 : i32, !llvm.ptr
    %547 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %548 = llvm.load %547 : !llvm.ptr -> i32
    %549 = arith.extsi %548 : i32 to i64
    %550 = arith.constant 8 : i32
    %551 = arith.extsi %550 : i32 to i64
    %546 = func.call @calloc(%549, %551) : (i64, i64) -> !llvm.ptr
    %553 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %554 = llvm.load %553 : !llvm.ptr -> i32
    %555 = arith.extsi %554 : i32 to i64
    %556 = arith.constant 8 : i32
    %557 = arith.extsi %556 : i32 to i64
    %552 = func.call @calloc(%555, %557) : (i64, i64) -> !llvm.ptr
    %558 = arith.constant 0 : i32
    %559 = llvm.mlir.constant(1 : i64) : i64
    %560 = llvm.alloca %559 x i32 : (i64) -> !llvm.ptr
    llvm.store %558, %560 : i32, !llvm.ptr
    %561 = arith.constant 32 : i32
    %562 = arith.constant 0 : i32
    %563 = arith.extsi %561 : i32 to i64
    %564 = arith.extsi %562 : i32 to i64
    %565 = llvm.getelementptr %531[%564] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %563, %565 : i64, !llvm.ptr
    %566 = arith.constant 1 : i32
    %567 = arith.constant 0 : i32
    %568 = arith.extsi %566 : i32 to i64
    %569 = arith.extsi %567 : i32 to i64
    %570 = llvm.getelementptr %537[%569] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %568, %570 : i64, !llvm.ptr
    %571 = arith.constant 1 : i32
    llvm.store %571, %545 : i32, !llvm.ptr
    %573 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %574 = llvm.load %573 : !llvm.ptr -> i32
    %575 = arith.extsi %574 : i32 to i64
    %576 = arith.constant 8 : i32
    %577 = arith.extsi %576 : i32 to i64
    %572 = func.call @calloc(%575, %577) : (i64, i64) -> !llvm.ptr
    %579 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %580 = llvm.load %579 : !llvm.ptr -> i32
    %581 = arith.extsi %580 : i32 to i64
    %582 = arith.constant 8 : i32
    %583 = arith.extsi %582 : i32 to i64
    %578 = func.call @calloc(%581, %583) : (i64, i64) -> !llvm.ptr
    %585 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %586 = llvm.load %585 : !llvm.ptr -> i32
    %587 = arith.extsi %586 : i32 to i64
    %588 = arith.constant 8 : i32
    %589 = arith.extsi %588 : i32 to i64
    %584 = func.call @calloc(%587, %589) : (i64, i64) -> !llvm.ptr
    %591 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %592 = llvm.load %591 : !llvm.ptr -> i32
    %593 = arith.extsi %592 : i32 to i64
    %594 = arith.constant 8 : i32
    %595 = arith.extsi %594 : i32 to i64
    %590 = func.call @calloc(%593, %595) : (i64, i64) -> !llvm.ptr
    %597 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %598 = llvm.load %597 : !llvm.ptr -> i32
    %599 = arith.extsi %598 : i32 to i64
    %600 = arith.constant 8 : i32
    %601 = arith.extsi %600 : i32 to i64
    %596 = func.call @calloc(%599, %601) : (i64, i64) -> !llvm.ptr
    %603 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %604 = llvm.load %603 : !llvm.ptr -> i32
    %605 = arith.extsi %604 : i32 to i64
    %606 = arith.constant 8 : i32
    %607 = arith.extsi %606 : i32 to i64
    %602 = func.call @calloc(%605, %607) : (i64, i64) -> !llvm.ptr
    %608 = arith.constant 0 : i32
    %609 = llvm.mlir.constant(1 : i64) : i64
    %610 = llvm.alloca %609 x i32 : (i64) -> !llvm.ptr
    llvm.store %608, %610 : i32, !llvm.ptr
    cf.br ^bb69
    ^bb69:
    %611 = llvm.load %610 : !llvm.ptr -> i32
    %612 = arith.cmpi slt, %611, %arg0 : i32
    cf.cond_br %612, ^bb70, ^bb71
    ^bb70:
      %613 = arith.constant 0 : i32
      %614 = llvm.mlir.constant(1 : i64) : i64
      %615 = llvm.alloca %614 x i32 : (i64) -> !llvm.ptr
      llvm.store %613, %615 : i32, !llvm.ptr
      %616 = arith.constant 0 : i32
      %617 = llvm.mlir.constant(1 : i64) : i64
      %618 = llvm.alloca %617 x i32 : (i64) -> !llvm.ptr
      llvm.store %616, %618 : i32, !llvm.ptr
      %619 = arith.constant 0 : i32
      %620 = llvm.mlir.constant(1 : i64) : i64
      %621 = llvm.alloca %620 x i32 : (i64) -> !llvm.ptr
      llvm.store %619, %621 : i32, !llvm.ptr
      cf.br ^bb72
      ^bb72:
      %622 = llvm.load %621 : !llvm.ptr -> i32
      %623 = llvm.load %545 : !llvm.ptr -> i32
      %624 = arith.cmpi slt, %622, %623 : i32
      cf.cond_br %624, ^bb73, ^bb74
      ^bb73:
        %626 = llvm.load %621 : !llvm.ptr -> i32
        %627 = arith.extsi %626 : i32 to i64
        %628 = llvm.getelementptr %531[%627] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %625 = llvm.load %628 : !llvm.ptr -> i64
        %630 = llvm.load %621 : !llvm.ptr -> i32
        %631 = arith.extsi %630 : i32 to i64
        %632 = llvm.getelementptr %537[%631] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %629 = llvm.load %632 : !llvm.ptr -> i64
        %633 = arith.constant 5 : i32
        %635 = arith.extsi %633 : i32 to i64
        %634 = arith.shrsi %625, %635 : i64
        %636 = arith.constant 31 : i32
        %638 = arith.extsi %636 : i32 to i64
        %637 = arith.andi %625, %638 : i64
        %639 = arith.trunci %637 : i64 to i32
        %640 = arith.constant 0 : i32
        %641 = llvm.mlir.constant(1 : i64) : i64
        %642 = llvm.alloca %641 x i32 : (i64) -> !llvm.ptr
        llvm.store %640, %642 : i32, !llvm.ptr
        cf.br ^bb75
        ^bb75:
        %643 = llvm.load %642 : !llvm.ptr -> i32
        %645 = llvm.load %610 : !llvm.ptr -> i32
        %646 = arith.extsi %645 : i32 to i64
        %647 = llvm.getelementptr %434[%646] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %644 = llvm.load %647 : !llvm.ptr -> i32
        %648 = arith.cmpi slt, %643, %644 : i32
        cf.cond_br %648, ^bb76, ^bb77
        ^bb76:
          %650 = llvm.load %610 : !llvm.ptr -> i32
          %651 = arith.constant 10 : i32
          %652 = arith.muli %650, %651 : i32
          %653 = llvm.load %642 : !llvm.ptr -> i32
          %654 = arith.addi %652, %653 : i32
          %655 = arith.extsi %654 : i32 to i64
          %656 = llvm.getelementptr %422[%655] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %649 = llvm.load %656 : !llvm.ptr -> i32
          %658 = llvm.load %610 : !llvm.ptr -> i32
          %659 = arith.constant 10 : i32
          %660 = arith.muli %658, %659 : i32
          %661 = llvm.load %642 : !llvm.ptr -> i32
          %662 = arith.addi %660, %661 : i32
          %663 = arith.extsi %662 : i32 to i64
          %664 = llvm.getelementptr %428[%663] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %657 = llvm.load %664 : !llvm.ptr -> i32
          %665 = arith.addi %639, %649 : i32
          %666 = arith.cmpi sge, %665, %arg0 : i32
          %667 = scf.if %666 -> (i32) {
            %668 = arith.subi %665, %arg0 : i32
            scf.yield %668 : i32
          } else {
            scf.yield %665 : i32
          }
          %669 = arith.constant 1 : i32
          %670 = arith.shli %669, %667 : i32
          %671 = arith.extsi %670 : i32 to i64
          %672 = arith.andi %634, %671 : i64
          %673 = arith.constant 0 : i32
          %675 = arith.extsi %673 : i32 to i64
          %674 = arith.cmpi ne, %672, %675 : i64
          cf.cond_br %674, ^bb78, ^bb79
          ^bb78:
            %676 = arith.constant 5 : i32
            %678 = arith.extsi %676 : i32 to i64
            %677 = arith.shli %634, %678 : i64
            %679 = arith.extsi %667 : i32 to i64
            %680 = arith.ori %677, %679 : i64
            %681 = llvm.load %618 : !llvm.ptr -> i32
            %682 = arith.extsi %681 : i32 to i64
            %683 = llvm.getelementptr %584[%682] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %680, %683 : i64, !llvm.ptr
            %684 = arith.extsi %657 : i32 to i64
            %685 = arith.muli %629, %684 : i64
            %686 = llvm.load %618 : !llvm.ptr -> i32
            %687 = arith.extsi %686 : i32 to i64
            %688 = llvm.getelementptr %590[%687] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %685, %688 : i64, !llvm.ptr
            %689 = llvm.load %618 : !llvm.ptr -> i32
            %690 = arith.constant 1 : i32
            %691 = arith.addi %689, %690 : i32
            llvm.store %691, %618 : i32, !llvm.ptr
            cf.br ^bb80
          ^bb79:
            %692 = arith.ori %634, %671 : i64
            %693 = arith.constant 5 : i32
            %695 = arith.extsi %693 : i32 to i64
            %694 = arith.shli %692, %695 : i64
            %696 = arith.extsi %667 : i32 to i64
            %697 = arith.ori %694, %696 : i64
            %698 = llvm.load %615 : !llvm.ptr -> i32
            %699 = arith.extsi %698 : i32 to i64
            %700 = llvm.getelementptr %572[%699] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %697, %700 : i64, !llvm.ptr
            %701 = arith.extsi %657 : i32 to i64
            %702 = arith.muli %629, %701 : i64
            %703 = llvm.load %615 : !llvm.ptr -> i32
            %704 = arith.extsi %703 : i32 to i64
            %705 = llvm.getelementptr %578[%704] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %702, %705 : i64, !llvm.ptr
            %706 = llvm.load %615 : !llvm.ptr -> i32
            %707 = arith.constant 1 : i32
            %708 = arith.addi %706, %707 : i32
            llvm.store %708, %615 : i32, !llvm.ptr
            cf.br ^bb80
          ^bb80:
          %709 = llvm.load %642 : !llvm.ptr -> i32
          %710 = arith.constant 1 : i32
          %711 = arith.addi %709, %710 : i32
          llvm.store %711, %642 : i32, !llvm.ptr
          cf.br ^bb75
        ^bb77:
        %712 = llvm.load %621 : !llvm.ptr -> i32
        %713 = arith.constant 1 : i32
        %714 = arith.addi %712, %713 : i32
        llvm.store %714, %621 : i32, !llvm.ptr
        cf.br ^bb72
      ^bb74:
      %715 = arith.constant 0 : i32
      %716 = llvm.mlir.constant(1 : i64) : i64
      %717 = llvm.alloca %716 x i32 : (i64) -> !llvm.ptr
      llvm.store %715, %717 : i32, !llvm.ptr
      cf.br ^bb81
      ^bb81:
      %718 = llvm.load %717 : !llvm.ptr -> i32
      %719 = llvm.load %560 : !llvm.ptr -> i32
      %720 = arith.cmpi slt, %718, %719 : i32
      cf.cond_br %720, ^bb82, ^bb83
      ^bb82:
        %722 = llvm.load %717 : !llvm.ptr -> i32
        %723 = arith.extsi %722 : i32 to i64
        %724 = llvm.getelementptr %546[%723] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %721 = llvm.load %724 : !llvm.ptr -> i64
        %726 = llvm.load %717 : !llvm.ptr -> i32
        %727 = arith.extsi %726 : i32 to i64
        %728 = llvm.getelementptr %552[%727] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %725 = llvm.load %728 : !llvm.ptr -> i64
        %729 = arith.constant 5 : i32
        %731 = arith.extsi %729 : i32 to i64
        %730 = arith.shrsi %721, %731 : i64
        %732 = arith.constant 31 : i32
        %734 = arith.extsi %732 : i32 to i64
        %733 = arith.andi %721, %734 : i64
        %735 = arith.trunci %733 : i64 to i32
        %736 = arith.constant 0 : i32
        %737 = llvm.mlir.constant(1 : i64) : i64
        %738 = llvm.alloca %737 x i32 : (i64) -> !llvm.ptr
        llvm.store %736, %738 : i32, !llvm.ptr
        cf.br ^bb84
        ^bb84:
        %739 = llvm.load %738 : !llvm.ptr -> i32
        %741 = llvm.load %610 : !llvm.ptr -> i32
        %742 = arith.extsi %741 : i32 to i64
        %743 = llvm.getelementptr %434[%742] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %740 = llvm.load %743 : !llvm.ptr -> i32
        %744 = arith.cmpi slt, %739, %740 : i32
        cf.cond_br %744, ^bb85, ^bb86
        ^bb85:
          %746 = llvm.load %610 : !llvm.ptr -> i32
          %747 = arith.constant 10 : i32
          %748 = arith.muli %746, %747 : i32
          %749 = llvm.load %738 : !llvm.ptr -> i32
          %750 = arith.addi %748, %749 : i32
          %751 = arith.extsi %750 : i32 to i64
          %752 = llvm.getelementptr %422[%751] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %745 = llvm.load %752 : !llvm.ptr -> i32
          %754 = llvm.load %610 : !llvm.ptr -> i32
          %755 = arith.constant 10 : i32
          %756 = arith.muli %754, %755 : i32
          %757 = llvm.load %738 : !llvm.ptr -> i32
          %758 = arith.addi %756, %757 : i32
          %759 = arith.extsi %758 : i32 to i64
          %760 = llvm.getelementptr %428[%759] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %753 = llvm.load %760 : !llvm.ptr -> i32
          %761 = arith.addi %735, %745 : i32
          %762 = arith.cmpi sge, %761, %arg0 : i32
          %763 = scf.if %762 -> (i32) {
            %764 = arith.subi %761, %arg0 : i32
            scf.yield %764 : i32
          } else {
            scf.yield %761 : i32
          }
          %765 = arith.constant 1 : i32
          %766 = arith.shli %765, %763 : i32
          %767 = arith.extsi %766 : i32 to i64
          %768 = arith.andi %730, %767 : i64
          %769 = arith.constant 0 : i32
          %771 = arith.extsi %769 : i32 to i64
          %770 = arith.cmpi ne, %768, %771 : i64
          cf.cond_br %770, ^bb87, ^bb88
          ^bb87:
            %772 = llvm.load %738 : !llvm.ptr -> i32
            %773 = arith.constant 1 : i32
            %774 = arith.addi %772, %773 : i32
            llvm.store %774, %738 : i32, !llvm.ptr
            cf.br ^bb84
          ^bb88:
            cf.br ^bb89
          ^bb89:
          %775 = arith.ori %730, %767 : i64
          %776 = arith.constant 5 : i32
          %778 = arith.extsi %776 : i32 to i64
          %777 = arith.shli %775, %778 : i64
          %779 = arith.extsi %763 : i32 to i64
          %780 = arith.ori %777, %779 : i64
          %781 = llvm.load %618 : !llvm.ptr -> i32
          %782 = arith.extsi %781 : i32 to i64
          %783 = llvm.getelementptr %584[%782] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %780, %783 : i64, !llvm.ptr
          %784 = arith.extsi %753 : i32 to i64
          %785 = arith.muli %725, %784 : i64
          %786 = llvm.load %618 : !llvm.ptr -> i32
          %787 = arith.extsi %786 : i32 to i64
          %788 = llvm.getelementptr %590[%787] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %785, %788 : i64, !llvm.ptr
          %789 = llvm.load %618 : !llvm.ptr -> i32
          %790 = arith.constant 1 : i32
          %791 = arith.addi %789, %790 : i32
          llvm.store %791, %618 : i32, !llvm.ptr
          %792 = llvm.load %738 : !llvm.ptr -> i32
          %793 = arith.constant 1 : i32
          %794 = arith.addi %792, %793 : i32
          llvm.store %794, %738 : i32, !llvm.ptr
          cf.br ^bb84
        ^bb86:
        %795 = llvm.load %717 : !llvm.ptr -> i32
        %796 = arith.constant 1 : i32
        %797 = arith.addi %795, %796 : i32
        llvm.store %797, %717 : i32, !llvm.ptr
        cf.br ^bb81
      ^bb83:
      %799 = llvm.load %615 : !llvm.ptr -> i32
      %798 = func.call @sort_and_merge(%572, %578, %799, %596, %602) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %798, %545 : i32, !llvm.ptr
      %801 = llvm.load %618 : !llvm.ptr -> i32
      %800 = func.call @sort_and_merge(%584, %590, %801, %596, %602) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %800, %560 : i32, !llvm.ptr
      %802 = arith.constant 0 : i32
      %803 = llvm.mlir.constant(1 : i64) : i64
      %804 = llvm.alloca %803 x i32 : (i64) -> !llvm.ptr
      llvm.store %802, %804 : i32, !llvm.ptr
      cf.br ^bb90
      ^bb90:
      %805 = llvm.load %804 : !llvm.ptr -> i32
      %806 = llvm.load %545 : !llvm.ptr -> i32
      %807 = arith.cmpi slt, %805, %806 : i32
      cf.cond_br %807, ^bb91, ^bb92
      ^bb91:
        %809 = llvm.load %804 : !llvm.ptr -> i32
        %810 = arith.extsi %809 : i32 to i64
        %811 = llvm.getelementptr %572[%810] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %808 = llvm.load %811 : !llvm.ptr -> i64
        %812 = llvm.load %804 : !llvm.ptr -> i32
        %813 = arith.extsi %812 : i32 to i64
        %814 = llvm.getelementptr %531[%813] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %808, %814 : i64, !llvm.ptr
        %816 = llvm.load %804 : !llvm.ptr -> i32
        %817 = arith.extsi %816 : i32 to i64
        %818 = llvm.getelementptr %578[%817] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %815 = llvm.load %818 : !llvm.ptr -> i64
        %819 = llvm.load %804 : !llvm.ptr -> i32
        %820 = arith.extsi %819 : i32 to i64
        %821 = llvm.getelementptr %537[%820] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %815, %821 : i64, !llvm.ptr
        %822 = llvm.load %804 : !llvm.ptr -> i32
        %823 = arith.constant 1 : i32
        %824 = arith.addi %822, %823 : i32
        llvm.store %824, %804 : i32, !llvm.ptr
        cf.br ^bb90
      ^bb92:
      %825 = arith.constant 0 : i32
      %826 = llvm.mlir.constant(1 : i64) : i64
      %827 = llvm.alloca %826 x i32 : (i64) -> !llvm.ptr
      llvm.store %825, %827 : i32, !llvm.ptr
      cf.br ^bb93
      ^bb93:
      %828 = llvm.load %827 : !llvm.ptr -> i32
      %829 = llvm.load %560 : !llvm.ptr -> i32
      %830 = arith.cmpi slt, %828, %829 : i32
      cf.cond_br %830, ^bb94, ^bb95
      ^bb94:
        %832 = llvm.load %827 : !llvm.ptr -> i32
        %833 = arith.extsi %832 : i32 to i64
        %834 = llvm.getelementptr %584[%833] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %831 = llvm.load %834 : !llvm.ptr -> i64
        %835 = llvm.load %827 : !llvm.ptr -> i32
        %836 = arith.extsi %835 : i32 to i64
        %837 = llvm.getelementptr %546[%836] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %831, %837 : i64, !llvm.ptr
        %839 = llvm.load %827 : !llvm.ptr -> i32
        %840 = arith.extsi %839 : i32 to i64
        %841 = llvm.getelementptr %590[%840] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %838 = llvm.load %841 : !llvm.ptr -> i64
        %842 = llvm.load %827 : !llvm.ptr -> i32
        %843 = arith.extsi %842 : i32 to i64
        %844 = llvm.getelementptr %552[%843] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %838, %844 : i64, !llvm.ptr
        %845 = llvm.load %827 : !llvm.ptr -> i32
        %846 = arith.constant 1 : i32
        %847 = arith.addi %845, %846 : i32
        llvm.store %847, %827 : i32, !llvm.ptr
        cf.br ^bb93
      ^bb95:
      %848 = llvm.load %610 : !llvm.ptr -> i32
      %849 = arith.constant 1 : i32
      %850 = arith.addi %848, %849 : i32
      llvm.store %850, %610 : i32, !llvm.ptr
      cf.br ^bb69
    ^bb71:
    %851 = arith.constant 0 : i32
    %852 = arith.extsi %851 : i32 to i64
    %853 = llvm.mlir.constant(1 : i64) : i64
    %854 = llvm.alloca %853 x i64 : (i64) -> !llvm.ptr
    llvm.store %852, %854 : i64, !llvm.ptr
    %855 = arith.constant 0 : i32
    %856 = llvm.mlir.constant(1 : i64) : i64
    %857 = llvm.alloca %856 x i32 : (i64) -> !llvm.ptr
    llvm.store %855, %857 : i32, !llvm.ptr
    cf.br ^bb96
    ^bb96:
    %858 = llvm.load %857 : !llvm.ptr -> i32
    %859 = llvm.load %560 : !llvm.ptr -> i32
    %860 = arith.cmpi slt, %858, %859 : i32
    cf.cond_br %860, ^bb97, ^bb98
    ^bb97:
      %861 = llvm.load %854 : !llvm.ptr -> i64
      %863 = llvm.load %857 : !llvm.ptr -> i32
      %864 = arith.extsi %863 : i32 to i64
      %865 = llvm.getelementptr %552[%864] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %862 = llvm.load %865 : !llvm.ptr -> i64
      %866 = arith.addi %861, %862 : i64
      llvm.store %866, %854 : i64, !llvm.ptr
      %867 = llvm.load %857 : !llvm.ptr -> i32
      %868 = arith.constant 1 : i32
      %869 = arith.addi %867, %868 : i32
      llvm.store %869, %857 : i32, !llvm.ptr
      cf.br ^bb96
    ^bb98:
    func.call @free(%391) : (!llvm.ptr) -> ()
    func.call @free(%422) : (!llvm.ptr) -> ()
    func.call @free(%428) : (!llvm.ptr) -> ()
    func.call @free(%434) : (!llvm.ptr) -> ()
    func.call @free(%531) : (!llvm.ptr) -> ()
    func.call @free(%537) : (!llvm.ptr) -> ()
    func.call @free(%546) : (!llvm.ptr) -> ()
    func.call @free(%552) : (!llvm.ptr) -> ()
    func.call @free(%572) : (!llvm.ptr) -> ()
    func.call @free(%578) : (!llvm.ptr) -> ()
    func.call @free(%584) : (!llvm.ptr) -> ()
    func.call @free(%590) : (!llvm.ptr) -> ()
    func.call @free(%596) : (!llvm.ptr) -> ()
    func.call @free(%602) : (!llvm.ptr) -> ()
    %884 = llvm.load %854 : !llvm.ptr -> i64
    func.return %884 : i64
  }
  func.func @count_one_child_L1(%arg0: i32, %arg1: i32, %arg2: i32) -> i64 {
    %885 = arith.constant 0 : i32
    %886 = arith.cmpi sle, %arg2, %885 : i32
    %887 = scf.if %886 -> (i32) {
      %888 = arith.constant 1 : i32
      scf.yield %888 : i32
    } else {
      scf.yield %arg2 : i32
    }
    %889 = func.call @compute_total3(%887) : (i32) -> i32
    %891 = arith.muli %889, %887 : i32
    %892 = arith.extsi %891 : i32 to i64
    %893 = arith.constant 4 : i32
    %894 = arith.extsi %893 : i32 to i64
    %890 = func.call @calloc(%892, %894) : (i64, i64) -> !llvm.ptr
    %896 = arith.muli %889, %887 : i32
    %897 = arith.extsi %896 : i32 to i64
    %898 = arith.constant 4 : i32
    %899 = arith.extsi %898 : i32 to i64
    %895 = func.call @calloc(%897, %899) : (i64, i64) -> !llvm.ptr
    func.call @precompute_counts(%887, %890, %895) : (i32, !llvm.ptr, !llvm.ptr) -> ()
    %902 = arith.constant 1 : i32
    %903 = arith.addi %arg0, %902 : i32
    %904 = arith.extsi %903 : i32 to i64
    %905 = arith.constant 8 : i32
    %906 = arith.extsi %905 : i32 to i64
    %901 = func.call @calloc(%904, %906) : (i64, i64) -> !llvm.ptr
    %907 = arith.constant 1 : i32
    %908 = arith.cmpi sgt, %arg2, %907 : i32
    cf.cond_br %908, ^bb99, ^bb100
    ^bb99:
      %910 = arith.constant 10 : i32
      %911 = arith.extsi %arg2 : i32 to i64
      %912 = arith.extsi %910 : i32 to i64
      %909 = func.call @mod_inv(%912, %911) : (i64, i64) -> i64
      %913 = arith.extsi %arg2 : i32 to i64
      %914 = arith.remsi %909, %913 : i64
      %915 = arith.constant 1 : i32
      %916 = arith.extsi %915 : i32 to i64
      %917 = llvm.getelementptr %901[%916] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %914, %917 : i64, !llvm.ptr
      %918 = arith.constant 2 : i32
      %919 = llvm.mlir.constant(1 : i64) : i64
      %920 = llvm.alloca %919 x i32 : (i64) -> !llvm.ptr
      llvm.store %918, %920 : i32, !llvm.ptr
      cf.br ^bb102
      ^bb102:
      %921 = llvm.load %920 : !llvm.ptr -> i32
      %922 = arith.cmpi sle, %921, %arg0 : i32
      cf.cond_br %922, ^bb103, ^bb104
      ^bb103:
        %924 = llvm.load %920 : !llvm.ptr -> i32
        %925 = arith.constant 1 : i32
        %926 = arith.subi %924, %925 : i32
        %927 = arith.extsi %926 : i32 to i64
        %928 = llvm.getelementptr %901[%927] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %923 = llvm.load %928 : !llvm.ptr -> i64
        %929 = arith.muli %923, %909 : i64
        %930 = arith.extsi %arg2 : i32 to i64
        %931 = arith.remsi %929, %930 : i64
        %932 = llvm.load %920 : !llvm.ptr -> i32
        %933 = arith.extsi %932 : i32 to i64
        %934 = llvm.getelementptr %901[%933] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %931, %934 : i64, !llvm.ptr
        %935 = llvm.load %920 : !llvm.ptr -> i32
        %936 = arith.constant 1 : i32
        %937 = arith.addi %935, %936 : i32
        llvm.store %937, %920 : i32, !llvm.ptr
        cf.br ^bb102
      ^bb104:
      cf.br ^bb101
    ^bb100:
      cf.br ^bb101
    ^bb101:
    %939 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %940 = llvm.load %939 : !llvm.ptr -> i32
    %941 = arith.extsi %940 : i32 to i64
    %942 = arith.constant 8 : i32
    %943 = arith.extsi %942 : i32 to i64
    %938 = func.call @calloc(%941, %943) : (i64, i64) -> !llvm.ptr
    %945 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %946 = llvm.load %945 : !llvm.ptr -> i32
    %947 = arith.extsi %946 : i32 to i64
    %948 = arith.constant 8 : i32
    %949 = arith.extsi %948 : i32 to i64
    %944 = func.call @calloc(%947, %949) : (i64, i64) -> !llvm.ptr
    %950 = arith.constant 0 : i32
    %951 = llvm.mlir.constant(1 : i64) : i64
    %952 = llvm.alloca %951 x i32 : (i64) -> !llvm.ptr
    llvm.store %950, %952 : i32, !llvm.ptr
    %954 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %955 = llvm.load %954 : !llvm.ptr -> i32
    %956 = arith.extsi %955 : i32 to i64
    %957 = arith.constant 8 : i32
    %958 = arith.extsi %957 : i32 to i64
    %953 = func.call @calloc(%956, %958) : (i64, i64) -> !llvm.ptr
    %960 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %961 = llvm.load %960 : !llvm.ptr -> i32
    %962 = arith.extsi %961 : i32 to i64
    %963 = arith.constant 8 : i32
    %964 = arith.extsi %963 : i32 to i64
    %959 = func.call @calloc(%962, %964) : (i64, i64) -> !llvm.ptr
    %965 = arith.constant 0 : i32
    %966 = llvm.mlir.constant(1 : i64) : i64
    %967 = llvm.alloca %966 x i32 : (i64) -> !llvm.ptr
    llvm.store %965, %967 : i32, !llvm.ptr
    %969 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %970 = llvm.load %969 : !llvm.ptr -> i32
    %971 = arith.extsi %970 : i32 to i64
    %972 = arith.constant 8 : i32
    %973 = arith.extsi %972 : i32 to i64
    %968 = func.call @calloc(%971, %973) : (i64, i64) -> !llvm.ptr
    %975 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %976 = llvm.load %975 : !llvm.ptr -> i32
    %977 = arith.extsi %976 : i32 to i64
    %978 = arith.constant 8 : i32
    %979 = arith.extsi %978 : i32 to i64
    %974 = func.call @calloc(%977, %979) : (i64, i64) -> !llvm.ptr
    %980 = arith.constant 0 : i32
    %981 = llvm.mlir.constant(1 : i64) : i64
    %982 = llvm.alloca %981 x i32 : (i64) -> !llvm.ptr
    llvm.store %980, %982 : i32, !llvm.ptr
    %984 = arith.constant 0 : i32
    %985 = arith.extsi %984 : i32 to i64
    %986 = llvm.getelementptr %895[%985] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    %983 = llvm.load %986 : !llvm.ptr -> i32
    %987 = arith.extsi %983 : i32 to i64
    %988 = arith.constant 20 : i32
    %990 = arith.extsi %988 : i32 to i64
    %989 = arith.shli %987, %990 : i64
    %991 = arith.constant 0 : i32
    %992 = arith.extsi %991 : i32 to i64
    %993 = llvm.getelementptr %938[%992] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %989, %993 : i64, !llvm.ptr
    %994 = arith.constant 1 : i32
    %995 = arith.constant 0 : i32
    %996 = arith.extsi %994 : i32 to i64
    %997 = arith.extsi %995 : i32 to i64
    %998 = llvm.getelementptr %944[%997] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %996, %998 : i64, !llvm.ptr
    %999 = arith.constant 1 : i32
    llvm.store %999, %952 : i32, !llvm.ptr
    %1001 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1002 = llvm.load %1001 : !llvm.ptr -> i32
    %1003 = arith.extsi %1002 : i32 to i64
    %1004 = arith.constant 8 : i32
    %1005 = arith.extsi %1004 : i32 to i64
    %1000 = func.call @calloc(%1003, %1005) : (i64, i64) -> !llvm.ptr
    %1007 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1008 = llvm.load %1007 : !llvm.ptr -> i32
    %1009 = arith.extsi %1008 : i32 to i64
    %1010 = arith.constant 8 : i32
    %1011 = arith.extsi %1010 : i32 to i64
    %1006 = func.call @calloc(%1009, %1011) : (i64, i64) -> !llvm.ptr
    %1013 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1014 = llvm.load %1013 : !llvm.ptr -> i32
    %1015 = arith.extsi %1014 : i32 to i64
    %1016 = arith.constant 8 : i32
    %1017 = arith.extsi %1016 : i32 to i64
    %1012 = func.call @calloc(%1015, %1017) : (i64, i64) -> !llvm.ptr
    %1019 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1020 = llvm.load %1019 : !llvm.ptr -> i32
    %1021 = arith.extsi %1020 : i32 to i64
    %1022 = arith.constant 8 : i32
    %1023 = arith.extsi %1022 : i32 to i64
    %1018 = func.call @calloc(%1021, %1023) : (i64, i64) -> !llvm.ptr
    %1025 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1026 = llvm.load %1025 : !llvm.ptr -> i32
    %1027 = arith.extsi %1026 : i32 to i64
    %1028 = arith.constant 8 : i32
    %1029 = arith.extsi %1028 : i32 to i64
    %1024 = func.call @calloc(%1027, %1029) : (i64, i64) -> !llvm.ptr
    %1031 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1032 = llvm.load %1031 : !llvm.ptr -> i32
    %1033 = arith.extsi %1032 : i32 to i64
    %1034 = arith.constant 8 : i32
    %1035 = arith.extsi %1034 : i32 to i64
    %1030 = func.call @calloc(%1033, %1035) : (i64, i64) -> !llvm.ptr
    %1037 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1038 = llvm.load %1037 : !llvm.ptr -> i32
    %1039 = arith.extsi %1038 : i32 to i64
    %1040 = arith.constant 8 : i32
    %1041 = arith.extsi %1040 : i32 to i64
    %1036 = func.call @calloc(%1039, %1041) : (i64, i64) -> !llvm.ptr
    %1043 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1044 = llvm.load %1043 : !llvm.ptr -> i32
    %1045 = arith.extsi %1044 : i32 to i64
    %1046 = arith.constant 8 : i32
    %1047 = arith.extsi %1046 : i32 to i64
    %1042 = func.call @calloc(%1045, %1047) : (i64, i64) -> !llvm.ptr
    %1048 = arith.constant 1 : i32
    %1049 = llvm.mlir.constant(1 : i64) : i64
    %1050 = llvm.alloca %1049 x i32 : (i64) -> !llvm.ptr
    llvm.store %1048, %1050 : i32, !llvm.ptr
    cf.br ^bb105
    ^bb105:
    %1051 = llvm.load %1050 : !llvm.ptr -> i32
    %1052 = arith.cmpi sle, %1051, %arg0 : i32
    cf.cond_br %1052, ^bb106, ^bb107
    ^bb106:
      %1053 = arith.constant 0 : i32
      %1054 = llvm.mlir.constant(1 : i64) : i64
      %1055 = llvm.alloca %1054 x i32 : (i64) -> !llvm.ptr
      llvm.store %1053, %1055 : i32, !llvm.ptr
      %1056 = arith.constant 0 : i32
      %1057 = llvm.mlir.constant(1 : i64) : i64
      %1058 = llvm.alloca %1057 x i32 : (i64) -> !llvm.ptr
      llvm.store %1056, %1058 : i32, !llvm.ptr
      %1059 = arith.constant 0 : i32
      %1060 = llvm.mlir.constant(1 : i64) : i64
      %1061 = llvm.alloca %1060 x i32 : (i64) -> !llvm.ptr
      llvm.store %1059, %1061 : i32, !llvm.ptr
      %1062 = llvm.load %1050 : !llvm.ptr -> i32
      %1063 = arith.constant 1 : i32
      %1064 = arith.cmpi eq, %1062, %1063 : i32
      %1065 = scf.if %1064 -> (i32) {
        %1066 = arith.constant 1 : i32
        scf.yield %1066 : i32
      } else {
        %1067 = arith.constant 0 : i32
        scf.yield %1067 : i32
      }
      %1069 = llvm.load %1050 : !llvm.ptr -> i32
      %1070 = arith.extsi %1069 : i32 to i64
      %1071 = llvm.getelementptr %901[%1070] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1068 = llvm.load %1071 : !llvm.ptr -> i64
      %1072 = arith.constant 0 : i32
      %1073 = llvm.mlir.constant(1 : i64) : i64
      %1074 = llvm.alloca %1073 x i32 : (i64) -> !llvm.ptr
      llvm.store %1072, %1074 : i32, !llvm.ptr
      cf.br ^bb108
      ^bb108:
      %1075 = llvm.load %1074 : !llvm.ptr -> i32
      %1076 = llvm.load %952 : !llvm.ptr -> i32
      %1077 = arith.cmpi slt, %1075, %1076 : i32
      cf.cond_br %1077, ^bb109, ^bb110
      ^bb109:
        %1079 = llvm.load %1074 : !llvm.ptr -> i32
        %1080 = arith.extsi %1079 : i32 to i64
        %1081 = llvm.getelementptr %938[%1080] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1078 = llvm.load %1081 : !llvm.ptr -> i64
        %1083 = llvm.load %1074 : !llvm.ptr -> i32
        %1084 = arith.extsi %1083 : i32 to i64
        %1085 = llvm.getelementptr %944[%1084] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1082 = llvm.load %1085 : !llvm.ptr -> i64
        %1086 = arith.constant 20 : i32
        %1088 = arith.extsi %1086 : i32 to i64
        %1087 = arith.shrsi %1078, %1088 : i64
        %1089 = arith.trunci %1087 : i64 to i32
        %1090 = arith.constant 1048575 : i32
        %1092 = arith.extsi %1090 : i32 to i64
        %1091 = arith.andi %1078, %1092 : i64
        %1093 = arith.trunci %1091 : i64 to i32
        %1094 = llvm.mlir.constant(1 : i64) : i64
        %1095 = llvm.alloca %1094 x i32 : (i64) -> !llvm.ptr
        llvm.store %1065, %1095 : i32, !llvm.ptr
        cf.br ^bb111
        ^bb111:
        %1096 = llvm.load %1095 : !llvm.ptr -> i32
        %1097 = arith.constant 9 : i32
        %1098 = arith.cmpi sle, %1096, %1097 : i32
        cf.cond_br %1098, ^bb112, ^bb113
        ^bb112:
          %1099 = arith.constant 1 : i32
          %1100 = arith.cmpi sgt, %arg2, %1099 : i32
          %1101 = scf.if %1100 -> (i32) {
            %1102 = arith.extsi %1093 : i32 to i64
            %1103 = llvm.load %1095 : !llvm.ptr -> i32
            %1104 = arith.extsi %1103 : i32 to i64
            %1105 = arith.muli %1104, %1068 : i64
            %1106 = arith.addi %1102, %1105 : i64
            %1107 = arith.extsi %arg2 : i32 to i64
            %1108 = arith.remsi %1106, %1107 : i64
            %1109 = arith.trunci %1108 : i64 to i32
            scf.yield %1109 : i32
          } else {
            %1110 = arith.constant 0 : i32
            scf.yield %1110 : i32
          }
          %1111 = arith.constant 0 : i32
          %1112 = llvm.mlir.constant(1 : i64) : i64
          %1113 = llvm.alloca %1112 x i32 : (i64) -> !llvm.ptr
          llvm.store %1111, %1113 : i32, !llvm.ptr
          %1114 = llvm.load %1095 : !llvm.ptr -> i32
          %1115 = arith.remsi %1114, %arg1 : i32
          %1116 = arith.constant 0 : i32
          %1117 = arith.cmpi eq, %1115, %1116 : i32
          cf.cond_br %1117, ^bb114, ^bb115
          ^bb114:
            %1119 = arith.muli %1089, %887 : i32
            %1120 = arith.addi %1119, %1101 : i32
            %1121 = arith.extsi %1120 : i32 to i64
            %1122 = llvm.getelementptr %890[%1121] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %1118 = llvm.load %1122 : !llvm.ptr -> i32
            llvm.store %1118, %1113 : i32, !llvm.ptr
            cf.br ^bb116
          ^bb115:
            cf.br ^bb116
          ^bb116:
          %1123 = llvm.load %1113 : !llvm.ptr -> i32
          %1124 = arith.constant 2 : i32
          %1125 = arith.cmpi sgt, %1123, %1124 : i32
          %1126 = scf.if %1125 -> (i32) {
            %1127 = arith.constant 2 : i32
            scf.yield %1127 : i32
          } else {
            scf.yield %1123 : i32
          }
          %1129 = arith.muli %1089, %887 : i32
          %1130 = arith.addi %1129, %1101 : i32
          %1131 = arith.extsi %1130 : i32 to i64
          %1132 = llvm.getelementptr %895[%1131] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %1128 = llvm.load %1132 : !llvm.ptr -> i32
          %1133 = arith.extsi %1128 : i32 to i64
          %1134 = arith.constant 20 : i32
          %1136 = arith.extsi %1134 : i32 to i64
          %1135 = arith.shli %1133, %1136 : i64
          %1137 = arith.extsi %1101 : i32 to i64
          %1138 = arith.ori %1135, %1137 : i64
          %1139 = arith.constant 0 : i32
          %1140 = arith.cmpi eq, %1126, %1139 : i32
          cf.cond_br %1140, ^bb117, ^bb118
          ^bb117:
            %1141 = llvm.load %1055 : !llvm.ptr -> i32
            %1142 = arith.extsi %1141 : i32 to i64
            %1143 = llvm.getelementptr %1000[%1142] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1138, %1143 : i64, !llvm.ptr
            %1144 = llvm.load %1055 : !llvm.ptr -> i32
            %1145 = arith.extsi %1144 : i32 to i64
            %1146 = llvm.getelementptr %1006[%1145] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1082, %1146 : i64, !llvm.ptr
            %1147 = llvm.load %1055 : !llvm.ptr -> i32
            %1148 = arith.constant 1 : i32
            %1149 = arith.addi %1147, %1148 : i32
            llvm.store %1149, %1055 : i32, !llvm.ptr
            cf.br ^bb119
          ^bb118:
            cf.br ^bb119
          ^bb119:
          %1150 = arith.constant 1 : i32
          %1151 = arith.cmpi eq, %1126, %1150 : i32
          cf.cond_br %1151, ^bb120, ^bb121
          ^bb120:
            %1152 = llvm.load %1058 : !llvm.ptr -> i32
            %1153 = arith.extsi %1152 : i32 to i64
            %1154 = llvm.getelementptr %1012[%1153] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1138, %1154 : i64, !llvm.ptr
            %1155 = llvm.load %1058 : !llvm.ptr -> i32
            %1156 = arith.extsi %1155 : i32 to i64
            %1157 = llvm.getelementptr %1018[%1156] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1082, %1157 : i64, !llvm.ptr
            %1158 = llvm.load %1058 : !llvm.ptr -> i32
            %1159 = arith.constant 1 : i32
            %1160 = arith.addi %1158, %1159 : i32
            llvm.store %1160, %1058 : i32, !llvm.ptr
            cf.br ^bb122
          ^bb121:
            cf.br ^bb122
          ^bb122:
          %1161 = arith.constant 2 : i32
          %1162 = arith.cmpi eq, %1126, %1161 : i32
          cf.cond_br %1162, ^bb123, ^bb124
          ^bb123:
            %1163 = llvm.load %1061 : !llvm.ptr -> i32
            %1164 = arith.extsi %1163 : i32 to i64
            %1165 = llvm.getelementptr %1024[%1164] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1138, %1165 : i64, !llvm.ptr
            %1166 = llvm.load %1061 : !llvm.ptr -> i32
            %1167 = arith.extsi %1166 : i32 to i64
            %1168 = llvm.getelementptr %1030[%1167] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1082, %1168 : i64, !llvm.ptr
            %1169 = llvm.load %1061 : !llvm.ptr -> i32
            %1170 = arith.constant 1 : i32
            %1171 = arith.addi %1169, %1170 : i32
            llvm.store %1171, %1061 : i32, !llvm.ptr
            cf.br ^bb125
          ^bb124:
            cf.br ^bb125
          ^bb125:
          %1172 = llvm.load %1095 : !llvm.ptr -> i32
          %1173 = arith.constant 1 : i32
          %1174 = arith.addi %1172, %1173 : i32
          llvm.store %1174, %1095 : i32, !llvm.ptr
          cf.br ^bb111
        ^bb113:
        %1175 = llvm.load %1074 : !llvm.ptr -> i32
        %1176 = arith.constant 1 : i32
        %1177 = arith.addi %1175, %1176 : i32
        llvm.store %1177, %1074 : i32, !llvm.ptr
        cf.br ^bb108
      ^bb110:
      %1178 = arith.constant 0 : i32
      %1179 = llvm.mlir.constant(1 : i64) : i64
      %1180 = llvm.alloca %1179 x i32 : (i64) -> !llvm.ptr
      llvm.store %1178, %1180 : i32, !llvm.ptr
      cf.br ^bb126
      ^bb126:
      %1181 = llvm.load %1180 : !llvm.ptr -> i32
      %1182 = llvm.load %967 : !llvm.ptr -> i32
      %1183 = arith.cmpi slt, %1181, %1182 : i32
      cf.cond_br %1183, ^bb127, ^bb128
      ^bb127:
        %1185 = llvm.load %1180 : !llvm.ptr -> i32
        %1186 = arith.extsi %1185 : i32 to i64
        %1187 = llvm.getelementptr %953[%1186] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1184 = llvm.load %1187 : !llvm.ptr -> i64
        %1189 = llvm.load %1180 : !llvm.ptr -> i32
        %1190 = arith.extsi %1189 : i32 to i64
        %1191 = llvm.getelementptr %959[%1190] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1188 = llvm.load %1191 : !llvm.ptr -> i64
        %1192 = arith.constant 20 : i32
        %1194 = arith.extsi %1192 : i32 to i64
        %1193 = arith.shrsi %1184, %1194 : i64
        %1195 = arith.trunci %1193 : i64 to i32
        %1196 = arith.constant 1048575 : i32
        %1198 = arith.extsi %1196 : i32 to i64
        %1197 = arith.andi %1184, %1198 : i64
        %1199 = arith.trunci %1197 : i64 to i32
        %1200 = llvm.mlir.constant(1 : i64) : i64
        %1201 = llvm.alloca %1200 x i32 : (i64) -> !llvm.ptr
        llvm.store %1065, %1201 : i32, !llvm.ptr
        cf.br ^bb129
        ^bb129:
        %1202 = llvm.load %1201 : !llvm.ptr -> i32
        %1203 = arith.constant 9 : i32
        %1204 = arith.cmpi sle, %1202, %1203 : i32
        cf.cond_br %1204, ^bb130, ^bb131
        ^bb130:
          %1205 = arith.constant 1 : i32
          %1206 = arith.cmpi sgt, %arg2, %1205 : i32
          %1207 = scf.if %1206 -> (i32) {
            %1208 = arith.extsi %1199 : i32 to i64
            %1209 = llvm.load %1201 : !llvm.ptr -> i32
            %1210 = arith.extsi %1209 : i32 to i64
            %1211 = arith.muli %1210, %1068 : i64
            %1212 = arith.addi %1208, %1211 : i64
            %1213 = arith.extsi %arg2 : i32 to i64
            %1214 = arith.remsi %1212, %1213 : i64
            %1215 = arith.trunci %1214 : i64 to i32
            scf.yield %1215 : i32
          } else {
            %1216 = arith.constant 0 : i32
            scf.yield %1216 : i32
          }
          %1217 = arith.constant 0 : i32
          %1218 = llvm.mlir.constant(1 : i64) : i64
          %1219 = llvm.alloca %1218 x i32 : (i64) -> !llvm.ptr
          llvm.store %1217, %1219 : i32, !llvm.ptr
          %1220 = llvm.load %1201 : !llvm.ptr -> i32
          %1221 = arith.remsi %1220, %arg1 : i32
          %1222 = arith.constant 0 : i32
          %1223 = arith.cmpi eq, %1221, %1222 : i32
          cf.cond_br %1223, ^bb132, ^bb133
          ^bb132:
            %1225 = arith.muli %1195, %887 : i32
            %1226 = arith.addi %1225, %1207 : i32
            %1227 = arith.extsi %1226 : i32 to i64
            %1228 = llvm.getelementptr %890[%1227] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %1224 = llvm.load %1228 : !llvm.ptr -> i32
            llvm.store %1224, %1219 : i32, !llvm.ptr
            cf.br ^bb134
          ^bb133:
            cf.br ^bb134
          ^bb134:
          %1229 = arith.constant 1 : i32
          %1230 = llvm.load %1219 : !llvm.ptr -> i32
          %1231 = arith.addi %1229, %1230 : i32
          %1232 = arith.constant 2 : i32
          %1233 = arith.cmpi sgt, %1231, %1232 : i32
          %1234 = scf.if %1233 -> (i32) {
            %1235 = arith.constant 2 : i32
            scf.yield %1235 : i32
          } else {
            scf.yield %1231 : i32
          }
          %1237 = arith.muli %1195, %887 : i32
          %1238 = arith.addi %1237, %1207 : i32
          %1239 = arith.extsi %1238 : i32 to i64
          %1240 = llvm.getelementptr %895[%1239] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %1236 = llvm.load %1240 : !llvm.ptr -> i32
          %1241 = arith.extsi %1236 : i32 to i64
          %1242 = arith.constant 20 : i32
          %1244 = arith.extsi %1242 : i32 to i64
          %1243 = arith.shli %1241, %1244 : i64
          %1245 = arith.extsi %1207 : i32 to i64
          %1246 = arith.ori %1243, %1245 : i64
          %1247 = arith.constant 1 : i32
          %1248 = arith.cmpi eq, %1234, %1247 : i32
          cf.cond_br %1248, ^bb135, ^bb136
          ^bb135:
            %1249 = llvm.load %1058 : !llvm.ptr -> i32
            %1250 = arith.extsi %1249 : i32 to i64
            %1251 = llvm.getelementptr %1012[%1250] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1246, %1251 : i64, !llvm.ptr
            %1252 = llvm.load %1058 : !llvm.ptr -> i32
            %1253 = arith.extsi %1252 : i32 to i64
            %1254 = llvm.getelementptr %1018[%1253] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1188, %1254 : i64, !llvm.ptr
            %1255 = llvm.load %1058 : !llvm.ptr -> i32
            %1256 = arith.constant 1 : i32
            %1257 = arith.addi %1255, %1256 : i32
            llvm.store %1257, %1058 : i32, !llvm.ptr
            cf.br ^bb137
          ^bb136:
            cf.br ^bb137
          ^bb137:
          %1258 = arith.constant 2 : i32
          %1259 = arith.cmpi eq, %1234, %1258 : i32
          cf.cond_br %1259, ^bb138, ^bb139
          ^bb138:
            %1260 = llvm.load %1061 : !llvm.ptr -> i32
            %1261 = arith.extsi %1260 : i32 to i64
            %1262 = llvm.getelementptr %1024[%1261] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1246, %1262 : i64, !llvm.ptr
            %1263 = llvm.load %1061 : !llvm.ptr -> i32
            %1264 = arith.extsi %1263 : i32 to i64
            %1265 = llvm.getelementptr %1030[%1264] : (!llvm.ptr, i64) -> !llvm.ptr, i64
            llvm.store %1188, %1265 : i64, !llvm.ptr
            %1266 = llvm.load %1061 : !llvm.ptr -> i32
            %1267 = arith.constant 1 : i32
            %1268 = arith.addi %1266, %1267 : i32
            llvm.store %1268, %1061 : i32, !llvm.ptr
            cf.br ^bb140
          ^bb139:
            cf.br ^bb140
          ^bb140:
          %1269 = llvm.load %1201 : !llvm.ptr -> i32
          %1270 = arith.constant 1 : i32
          %1271 = arith.addi %1269, %1270 : i32
          llvm.store %1271, %1201 : i32, !llvm.ptr
          cf.br ^bb129
        ^bb131:
        %1272 = llvm.load %1180 : !llvm.ptr -> i32
        %1273 = arith.constant 1 : i32
        %1274 = arith.addi %1272, %1273 : i32
        llvm.store %1274, %1180 : i32, !llvm.ptr
        cf.br ^bb126
      ^bb128:
      %1275 = arith.constant 0 : i32
      %1276 = llvm.mlir.constant(1 : i64) : i64
      %1277 = llvm.alloca %1276 x i32 : (i64) -> !llvm.ptr
      llvm.store %1275, %1277 : i32, !llvm.ptr
      cf.br ^bb141
      ^bb141:
      %1278 = llvm.load %1277 : !llvm.ptr -> i32
      %1279 = llvm.load %982 : !llvm.ptr -> i32
      %1280 = arith.cmpi slt, %1278, %1279 : i32
      cf.cond_br %1280, ^bb142, ^bb143
      ^bb142:
        %1282 = llvm.load %1277 : !llvm.ptr -> i32
        %1283 = arith.extsi %1282 : i32 to i64
        %1284 = llvm.getelementptr %968[%1283] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1281 = llvm.load %1284 : !llvm.ptr -> i64
        %1286 = llvm.load %1277 : !llvm.ptr -> i32
        %1287 = arith.extsi %1286 : i32 to i64
        %1288 = llvm.getelementptr %974[%1287] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1285 = llvm.load %1288 : !llvm.ptr -> i64
        %1289 = arith.constant 20 : i32
        %1291 = arith.extsi %1289 : i32 to i64
        %1290 = arith.shrsi %1281, %1291 : i64
        %1292 = arith.trunci %1290 : i64 to i32
        %1293 = arith.constant 1048575 : i32
        %1295 = arith.extsi %1293 : i32 to i64
        %1294 = arith.andi %1281, %1295 : i64
        %1296 = arith.trunci %1294 : i64 to i32
        %1297 = llvm.mlir.constant(1 : i64) : i64
        %1298 = llvm.alloca %1297 x i32 : (i64) -> !llvm.ptr
        llvm.store %1065, %1298 : i32, !llvm.ptr
        cf.br ^bb144
        ^bb144:
        %1299 = llvm.load %1298 : !llvm.ptr -> i32
        %1300 = arith.constant 9 : i32
        %1301 = arith.cmpi sle, %1299, %1300 : i32
        cf.cond_br %1301, ^bb145, ^bb146
        ^bb145:
          %1302 = arith.constant 1 : i32
          %1303 = arith.cmpi sgt, %arg2, %1302 : i32
          %1304 = scf.if %1303 -> (i32) {
            %1305 = arith.extsi %1296 : i32 to i64
            %1306 = llvm.load %1298 : !llvm.ptr -> i32
            %1307 = arith.extsi %1306 : i32 to i64
            %1308 = arith.muli %1307, %1068 : i64
            %1309 = arith.addi %1305, %1308 : i64
            %1310 = arith.extsi %arg2 : i32 to i64
            %1311 = arith.remsi %1309, %1310 : i64
            %1312 = arith.trunci %1311 : i64 to i32
            scf.yield %1312 : i32
          } else {
            %1313 = arith.constant 0 : i32
            scf.yield %1313 : i32
          }
          %1314 = arith.constant 0 : i32
          %1315 = llvm.mlir.constant(1 : i64) : i64
          %1316 = llvm.alloca %1315 x i32 : (i64) -> !llvm.ptr
          llvm.store %1314, %1316 : i32, !llvm.ptr
          %1317 = llvm.load %1298 : !llvm.ptr -> i32
          %1318 = arith.remsi %1317, %arg1 : i32
          %1319 = arith.constant 0 : i32
          %1320 = arith.cmpi eq, %1318, %1319 : i32
          cf.cond_br %1320, ^bb147, ^bb148
          ^bb147:
            %1322 = arith.muli %1292, %887 : i32
            %1323 = arith.addi %1322, %1304 : i32
            %1324 = arith.extsi %1323 : i32 to i64
            %1325 = llvm.getelementptr %890[%1324] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %1321 = llvm.load %1325 : !llvm.ptr -> i32
            llvm.store %1321, %1316 : i32, !llvm.ptr
            cf.br ^bb149
          ^bb148:
            cf.br ^bb149
          ^bb149:
          %1326 = arith.constant 2 : i32
          %1327 = llvm.load %1316 : !llvm.ptr -> i32
          %1328 = arith.addi %1326, %1327 : i32
          %1329 = arith.constant 2 : i32
          %1330 = arith.cmpi sgt, %1328, %1329 : i32
          %1331 = scf.if %1330 -> (i32) {
            %1332 = arith.constant 2 : i32
            scf.yield %1332 : i32
          } else {
            scf.yield %1328 : i32
          }
          %1334 = arith.muli %1292, %887 : i32
          %1335 = arith.addi %1334, %1304 : i32
          %1336 = arith.extsi %1335 : i32 to i64
          %1337 = llvm.getelementptr %895[%1336] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %1333 = llvm.load %1337 : !llvm.ptr -> i32
          %1338 = arith.extsi %1333 : i32 to i64
          %1339 = arith.constant 20 : i32
          %1341 = arith.extsi %1339 : i32 to i64
          %1340 = arith.shli %1338, %1341 : i64
          %1342 = arith.extsi %1304 : i32 to i64
          %1343 = arith.ori %1340, %1342 : i64
          %1344 = llvm.load %1061 : !llvm.ptr -> i32
          %1345 = arith.extsi %1344 : i32 to i64
          %1346 = llvm.getelementptr %1024[%1345] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %1343, %1346 : i64, !llvm.ptr
          %1347 = llvm.load %1061 : !llvm.ptr -> i32
          %1348 = arith.extsi %1347 : i32 to i64
          %1349 = llvm.getelementptr %1030[%1348] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          llvm.store %1285, %1349 : i64, !llvm.ptr
          %1350 = llvm.load %1061 : !llvm.ptr -> i32
          %1351 = arith.constant 1 : i32
          %1352 = arith.addi %1350, %1351 : i32
          llvm.store %1352, %1061 : i32, !llvm.ptr
          %1353 = llvm.load %1298 : !llvm.ptr -> i32
          %1354 = arith.constant 1 : i32
          %1355 = arith.addi %1353, %1354 : i32
          llvm.store %1355, %1298 : i32, !llvm.ptr
          cf.br ^bb144
        ^bb146:
        %1356 = llvm.load %1277 : !llvm.ptr -> i32
        %1357 = arith.constant 1 : i32
        %1358 = arith.addi %1356, %1357 : i32
        llvm.store %1358, %1277 : i32, !llvm.ptr
        cf.br ^bb141
      ^bb143:
      %1360 = llvm.load %1055 : !llvm.ptr -> i32
      %1359 = func.call @sort_and_merge(%1000, %1006, %1360, %1036, %1042) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %1359, %952 : i32, !llvm.ptr
      %1362 = llvm.load %1058 : !llvm.ptr -> i32
      %1361 = func.call @sort_and_merge(%1012, %1018, %1362, %1036, %1042) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %1361, %967 : i32, !llvm.ptr
      %1364 = llvm.load %1061 : !llvm.ptr -> i32
      %1363 = func.call @sort_and_merge(%1024, %1030, %1364, %1036, %1042) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %1363, %982 : i32, !llvm.ptr
      %1365 = arith.constant 0 : i32
      %1366 = llvm.mlir.constant(1 : i64) : i64
      %1367 = llvm.alloca %1366 x i32 : (i64) -> !llvm.ptr
      llvm.store %1365, %1367 : i32, !llvm.ptr
      cf.br ^bb150
      ^bb150:
      %1368 = llvm.load %1367 : !llvm.ptr -> i32
      %1369 = llvm.load %952 : !llvm.ptr -> i32
      %1370 = arith.cmpi slt, %1368, %1369 : i32
      cf.cond_br %1370, ^bb151, ^bb152
      ^bb151:
        %1372 = llvm.load %1367 : !llvm.ptr -> i32
        %1373 = arith.extsi %1372 : i32 to i64
        %1374 = llvm.getelementptr %1000[%1373] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1371 = llvm.load %1374 : !llvm.ptr -> i64
        %1375 = llvm.load %1367 : !llvm.ptr -> i32
        %1376 = arith.extsi %1375 : i32 to i64
        %1377 = llvm.getelementptr %938[%1376] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1371, %1377 : i64, !llvm.ptr
        %1379 = llvm.load %1367 : !llvm.ptr -> i32
        %1380 = arith.extsi %1379 : i32 to i64
        %1381 = llvm.getelementptr %1006[%1380] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1378 = llvm.load %1381 : !llvm.ptr -> i64
        %1382 = llvm.load %1367 : !llvm.ptr -> i32
        %1383 = arith.extsi %1382 : i32 to i64
        %1384 = llvm.getelementptr %944[%1383] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1378, %1384 : i64, !llvm.ptr
        %1385 = llvm.load %1367 : !llvm.ptr -> i32
        %1386 = arith.constant 1 : i32
        %1387 = arith.addi %1385, %1386 : i32
        llvm.store %1387, %1367 : i32, !llvm.ptr
        cf.br ^bb150
      ^bb152:
      %1388 = arith.constant 0 : i32
      %1389 = llvm.mlir.constant(1 : i64) : i64
      %1390 = llvm.alloca %1389 x i32 : (i64) -> !llvm.ptr
      llvm.store %1388, %1390 : i32, !llvm.ptr
      cf.br ^bb153
      ^bb153:
      %1391 = llvm.load %1390 : !llvm.ptr -> i32
      %1392 = llvm.load %967 : !llvm.ptr -> i32
      %1393 = arith.cmpi slt, %1391, %1392 : i32
      cf.cond_br %1393, ^bb154, ^bb155
      ^bb154:
        %1395 = llvm.load %1390 : !llvm.ptr -> i32
        %1396 = arith.extsi %1395 : i32 to i64
        %1397 = llvm.getelementptr %1012[%1396] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1394 = llvm.load %1397 : !llvm.ptr -> i64
        %1398 = llvm.load %1390 : !llvm.ptr -> i32
        %1399 = arith.extsi %1398 : i32 to i64
        %1400 = llvm.getelementptr %953[%1399] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1394, %1400 : i64, !llvm.ptr
        %1402 = llvm.load %1390 : !llvm.ptr -> i32
        %1403 = arith.extsi %1402 : i32 to i64
        %1404 = llvm.getelementptr %1018[%1403] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1401 = llvm.load %1404 : !llvm.ptr -> i64
        %1405 = llvm.load %1390 : !llvm.ptr -> i32
        %1406 = arith.extsi %1405 : i32 to i64
        %1407 = llvm.getelementptr %959[%1406] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1401, %1407 : i64, !llvm.ptr
        %1408 = llvm.load %1390 : !llvm.ptr -> i32
        %1409 = arith.constant 1 : i32
        %1410 = arith.addi %1408, %1409 : i32
        llvm.store %1410, %1390 : i32, !llvm.ptr
        cf.br ^bb153
      ^bb155:
      %1411 = arith.constant 0 : i32
      %1412 = llvm.mlir.constant(1 : i64) : i64
      %1413 = llvm.alloca %1412 x i32 : (i64) -> !llvm.ptr
      llvm.store %1411, %1413 : i32, !llvm.ptr
      cf.br ^bb156
      ^bb156:
      %1414 = llvm.load %1413 : !llvm.ptr -> i32
      %1415 = llvm.load %982 : !llvm.ptr -> i32
      %1416 = arith.cmpi slt, %1414, %1415 : i32
      cf.cond_br %1416, ^bb157, ^bb158
      ^bb157:
        %1418 = llvm.load %1413 : !llvm.ptr -> i32
        %1419 = arith.extsi %1418 : i32 to i64
        %1420 = llvm.getelementptr %1024[%1419] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1417 = llvm.load %1420 : !llvm.ptr -> i64
        %1421 = llvm.load %1413 : !llvm.ptr -> i32
        %1422 = arith.extsi %1421 : i32 to i64
        %1423 = llvm.getelementptr %968[%1422] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1417, %1423 : i64, !llvm.ptr
        %1425 = llvm.load %1413 : !llvm.ptr -> i32
        %1426 = arith.extsi %1425 : i32 to i64
        %1427 = llvm.getelementptr %1030[%1426] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1424 = llvm.load %1427 : !llvm.ptr -> i64
        %1428 = llvm.load %1413 : !llvm.ptr -> i32
        %1429 = arith.extsi %1428 : i32 to i64
        %1430 = llvm.getelementptr %974[%1429] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1424, %1430 : i64, !llvm.ptr
        %1431 = llvm.load %1413 : !llvm.ptr -> i32
        %1432 = arith.constant 1 : i32
        %1433 = arith.addi %1431, %1432 : i32
        llvm.store %1433, %1413 : i32, !llvm.ptr
        cf.br ^bb156
      ^bb158:
      %1434 = llvm.load %1050 : !llvm.ptr -> i32
      %1435 = arith.constant 1 : i32
      %1436 = arith.addi %1434, %1435 : i32
      llvm.store %1436, %1050 : i32, !llvm.ptr
      cf.br ^bb105
    ^bb107:
    %1437 = arith.constant 0 : i32
    %1438 = arith.extsi %1437 : i32 to i64
    %1439 = llvm.mlir.constant(1 : i64) : i64
    %1440 = llvm.alloca %1439 x i64 : (i64) -> !llvm.ptr
    llvm.store %1438, %1440 : i64, !llvm.ptr
    %1441 = arith.constant 0 : i32
    %1442 = llvm.mlir.constant(1 : i64) : i64
    %1443 = llvm.alloca %1442 x i32 : (i64) -> !llvm.ptr
    llvm.store %1441, %1443 : i32, !llvm.ptr
    cf.br ^bb159
    ^bb159:
    %1444 = llvm.load %1443 : !llvm.ptr -> i32
    %1445 = llvm.load %967 : !llvm.ptr -> i32
    %1446 = arith.cmpi slt, %1444, %1445 : i32
    cf.cond_br %1446, ^bb160, ^bb161
    ^bb160:
      %1447 = llvm.load %1440 : !llvm.ptr -> i64
      %1449 = llvm.load %1443 : !llvm.ptr -> i32
      %1450 = arith.extsi %1449 : i32 to i64
      %1451 = llvm.getelementptr %959[%1450] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1448 = llvm.load %1451 : !llvm.ptr -> i64
      %1452 = arith.addi %1447, %1448 : i64
      llvm.store %1452, %1440 : i64, !llvm.ptr
      %1453 = llvm.load %1443 : !llvm.ptr -> i32
      %1454 = arith.constant 1 : i32
      %1455 = arith.addi %1453, %1454 : i32
      llvm.store %1455, %1443 : i32, !llvm.ptr
      cf.br ^bb159
    ^bb161:
    func.call @free(%890) : (!llvm.ptr) -> ()
    func.call @free(%895) : (!llvm.ptr) -> ()
    func.call @free(%901) : (!llvm.ptr) -> ()
    func.call @free(%938) : (!llvm.ptr) -> ()
    func.call @free(%944) : (!llvm.ptr) -> ()
    func.call @free(%953) : (!llvm.ptr) -> ()
    func.call @free(%959) : (!llvm.ptr) -> ()
    func.call @free(%968) : (!llvm.ptr) -> ()
    func.call @free(%974) : (!llvm.ptr) -> ()
    func.call @free(%1000) : (!llvm.ptr) -> ()
    func.call @free(%1006) : (!llvm.ptr) -> ()
    func.call @free(%1012) : (!llvm.ptr) -> ()
    func.call @free(%1018) : (!llvm.ptr) -> ()
    func.call @free(%1024) : (!llvm.ptr) -> ()
    func.call @free(%1030) : (!llvm.ptr) -> ()
    func.call @free(%1036) : (!llvm.ptr) -> ()
    func.call @free(%1042) : (!llvm.ptr) -> ()
    %1473 = llvm.load %1440 : !llvm.ptr -> i64
    func.return %1473 : i64
  }
  func.func @count_one_child_Lgt1(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32) -> i64 {
    %1474 = arith.constant 0 : i32
    %1475 = arith.cmpi sle, %arg2, %1474 : i32
    %1476 = scf.if %1475 -> (i32) {
      %1477 = arith.constant 1 : i32
      scf.yield %1477 : i32
    } else {
      scf.yield %arg2 : i32
    }
    %1478 = func.call @compute_total3(%1476) : (i32) -> i32
    %1480 = arith.muli %1478, %1476 : i32
    %1481 = arith.extsi %1480 : i32 to i64
    %1482 = arith.constant 4 : i32
    %1483 = arith.extsi %1482 : i32 to i64
    %1479 = func.call @calloc(%1481, %1483) : (i64, i64) -> !llvm.ptr
    %1485 = arith.muli %1478, %1476 : i32
    %1486 = arith.extsi %1485 : i32 to i64
    %1487 = arith.constant 4 : i32
    %1488 = arith.extsi %1487 : i32 to i64
    %1484 = func.call @calloc(%1486, %1488) : (i64, i64) -> !llvm.ptr
    func.call @precompute_counts(%1476, %1479, %1484) : (i32, !llvm.ptr, !llvm.ptr) -> ()
    %1491 = arith.constant 1 : i32
    %1492 = arith.addi %arg0, %1491 : i32
    %1493 = arith.extsi %1492 : i32 to i64
    %1494 = arith.constant 8 : i32
    %1495 = arith.extsi %1494 : i32 to i64
    %1490 = func.call @calloc(%1493, %1495) : (i64, i64) -> !llvm.ptr
    %1496 = arith.constant 1 : i32
    %1497 = arith.cmpi sgt, %arg2, %1496 : i32
    cf.cond_br %1497, ^bb162, ^bb163
    ^bb162:
      %1499 = arith.constant 10 : i32
      %1500 = arith.extsi %arg2 : i32 to i64
      %1501 = arith.extsi %1499 : i32 to i64
      %1498 = func.call @mod_inv(%1501, %1500) : (i64, i64) -> i64
      %1502 = arith.extsi %arg2 : i32 to i64
      %1503 = arith.remsi %1498, %1502 : i64
      %1504 = arith.constant 1 : i32
      %1505 = arith.extsi %1504 : i32 to i64
      %1506 = llvm.getelementptr %1490[%1505] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %1503, %1506 : i64, !llvm.ptr
      %1507 = arith.constant 2 : i32
      %1508 = llvm.mlir.constant(1 : i64) : i64
      %1509 = llvm.alloca %1508 x i32 : (i64) -> !llvm.ptr
      llvm.store %1507, %1509 : i32, !llvm.ptr
      cf.br ^bb165
      ^bb165:
      %1510 = llvm.load %1509 : !llvm.ptr -> i32
      %1511 = arith.cmpi sle, %1510, %arg0 : i32
      cf.cond_br %1511, ^bb166, ^bb167
      ^bb166:
        %1513 = llvm.load %1509 : !llvm.ptr -> i32
        %1514 = arith.constant 1 : i32
        %1515 = arith.subi %1513, %1514 : i32
        %1516 = arith.extsi %1515 : i32 to i64
        %1517 = llvm.getelementptr %1490[%1516] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %1512 = llvm.load %1517 : !llvm.ptr -> i64
        %1518 = arith.muli %1512, %1498 : i64
        %1519 = arith.extsi %arg2 : i32 to i64
        %1520 = arith.remsi %1518, %1519 : i64
        %1521 = llvm.load %1509 : !llvm.ptr -> i32
        %1522 = arith.extsi %1521 : i32 to i64
        %1523 = llvm.getelementptr %1490[%1522] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %1520, %1523 : i64, !llvm.ptr
        %1524 = llvm.load %1509 : !llvm.ptr -> i32
        %1525 = arith.constant 1 : i32
        %1526 = arith.addi %1524, %1525 : i32
        llvm.store %1526, %1509 : i32, !llvm.ptr
        cf.br ^bb165
      ^bb167:
      cf.br ^bb164
    ^bb163:
      cf.br ^bb164
    ^bb164:
    %1527 = arith.constant 1 : i32
    %1528 = llvm.mlir.constant(1 : i64) : i64
    %1529 = llvm.alloca %1528 x i32 : (i64) -> !llvm.ptr
    llvm.store %1527, %1529 : i32, !llvm.ptr
    %1530 = arith.constant 0 : i32
    %1531 = llvm.mlir.constant(1 : i64) : i64
    %1532 = llvm.alloca %1531 x i32 : (i64) -> !llvm.ptr
    llvm.store %1530, %1532 : i32, !llvm.ptr
    cf.br ^bb168
    ^bb168:
    %1533 = llvm.load %1532 : !llvm.ptr -> i32
    %1534 = arith.cmpi slt, %1533, %arg3 : i32
    cf.cond_br %1534, ^bb169, ^bb170
    ^bb169:
      %1535 = llvm.load %1529 : !llvm.ptr -> i32
      %1536 = arith.constant 10 : i32
      %1537 = arith.muli %1535, %1536 : i32
      llvm.store %1537, %1529 : i32, !llvm.ptr
      %1538 = llvm.load %1532 : !llvm.ptr -> i32
      %1539 = arith.constant 1 : i32
      %1540 = arith.addi %1538, %1539 : i32
      llvm.store %1540, %1532 : i32, !llvm.ptr
      cf.br ^bb168
    ^bb170:
    %1542 = llvm.load %1529 : !llvm.ptr -> i32
    %1543 = arith.constant 10 : i32
    %1544 = arith.muli %1542, %1543 : i32
    %1545 = arith.extsi %1544 : i32 to i64
    %1546 = arith.constant 4 : i32
    %1547 = arith.extsi %1546 : i32 to i64
    %1541 = func.call @calloc(%1545, %1547) : (i64, i64) -> !llvm.ptr
    %1549 = llvm.load %1529 : !llvm.ptr -> i32
    %1550 = arith.extsi %1549 : i32 to i64
    %1551 = arith.constant 4 : i32
    %1552 = arith.extsi %1551 : i32 to i64
    %1548 = func.call @calloc(%1550, %1552) : (i64, i64) -> !llvm.ptr
    %1554 = arith.constant 1 : i32
    %1555 = arith.addi %arg3, %1554 : i32
    %1556 = arith.extsi %1555 : i32 to i64
    %1557 = arith.constant 4 : i32
    %1558 = arith.extsi %1557 : i32 to i64
    %1553 = func.call @calloc(%1556, %1558) : (i64, i64) -> !llvm.ptr
    %1560 = llvm.load %1529 : !llvm.ptr -> i32
    %1561 = arith.extsi %1560 : i32 to i64
    %1562 = arith.constant 1 : i32
    %1563 = arith.extsi %1562 : i32 to i64
    %1559 = func.call @calloc(%1561, %1563) : (i64, i64) -> !llvm.ptr
    %1564 = arith.constant 1 : i32
    %1565 = arith.constant 0 : i32
    %1566 = arith.extsi %1565 : i32 to i64
    %1567 = llvm.getelementptr %1553[%1566] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %1564, %1567 : i32, !llvm.ptr
    %1568 = arith.constant 1 : i32
    %1569 = llvm.mlir.constant(1 : i64) : i64
    %1570 = llvm.alloca %1569 x i32 : (i64) -> !llvm.ptr
    llvm.store %1568, %1570 : i32, !llvm.ptr
    cf.br ^bb171
    ^bb171:
    %1571 = llvm.load %1570 : !llvm.ptr -> i32
    %1572 = arith.cmpi sle, %1571, %arg3 : i32
    cf.cond_br %1572, ^bb172, ^bb173
    ^bb172:
      %1574 = llvm.load %1570 : !llvm.ptr -> i32
      %1575 = arith.constant 1 : i32
      %1576 = arith.subi %1574, %1575 : i32
      %1577 = arith.extsi %1576 : i32 to i64
      %1578 = llvm.getelementptr %1553[%1577] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %1573 = llvm.load %1578 : !llvm.ptr -> i32
      %1579 = arith.constant 10 : i32
      %1580 = arith.muli %1573, %1579 : i32
      %1581 = llvm.load %1570 : !llvm.ptr -> i32
      %1582 = arith.extsi %1581 : i32 to i64
      %1583 = llvm.getelementptr %1553[%1582] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %1580, %1583 : i32, !llvm.ptr
      %1584 = llvm.load %1570 : !llvm.ptr -> i32
      %1585 = arith.constant 1 : i32
      %1586 = arith.addi %1584, %1585 : i32
      llvm.store %1586, %1570 : i32, !llvm.ptr
      cf.br ^bb171
    ^bb173:
    %1587 = arith.constant 0 : i32
    %1588 = llvm.mlir.constant(1 : i64) : i64
    %1589 = llvm.alloca %1588 x i32 : (i64) -> !llvm.ptr
    llvm.store %1587, %1589 : i32, !llvm.ptr
    cf.br ^bb174
    ^bb174:
    %1590 = llvm.load %1589 : !llvm.ptr -> i32
    %1591 = llvm.load %1529 : !llvm.ptr -> i32
    %1592 = arith.cmpi slt, %1590, %1591 : i32
    cf.cond_br %1592, ^bb175, ^bb176
    ^bb175:
      %1593 = llvm.load %1589 : !llvm.ptr -> i32
      %1594 = arith.remsi %1593, %arg1 : i32
      %1595 = arith.constant 0 : i32
      %1596 = arith.cmpi eq, %1594, %1595 : i32
      %1597 = scf.if %1596 -> (i32) {
        %1598 = arith.constant 1 : i32
        scf.yield %1598 : i32
      } else {
        %1599 = arith.constant 0 : i32
        scf.yield %1599 : i32
      }
      %1600 = llvm.load %1589 : !llvm.ptr -> i32
      %1601 = arith.trunci %1597 : i32 to i8
      %1602 = arith.extsi %1600 : i32 to i64
      %1603 = llvm.getelementptr %1559[%1602] : (!llvm.ptr, i64) -> !llvm.ptr, i8
      llvm.store %1601, %1603 : i8, !llvm.ptr
      %1604 = arith.constant 0 : i32
      %1605 = llvm.mlir.constant(1 : i64) : i64
      %1606 = llvm.alloca %1605 x i32 : (i64) -> !llvm.ptr
      llvm.store %1604, %1606 : i32, !llvm.ptr
      %1607 = arith.constant 1 : i32
      %1608 = llvm.mlir.constant(1 : i64) : i64
      %1609 = llvm.alloca %1608 x i32 : (i64) -> !llvm.ptr
      llvm.store %1607, %1609 : i32, !llvm.ptr
      cf.br ^bb177
      ^bb177:
      %1610 = llvm.load %1609 : !llvm.ptr -> i32
      %1611 = arith.cmpi slt, %1610, %arg3 : i32
      cf.cond_br %1611, ^bb178, ^bb179
      ^bb178:
        %1612 = llvm.load %1589 : !llvm.ptr -> i32
        %1614 = llvm.load %1609 : !llvm.ptr -> i32
        %1615 = arith.extsi %1614 : i32 to i64
        %1616 = llvm.getelementptr %1553[%1615] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %1613 = llvm.load %1616 : !llvm.ptr -> i32
        %1617 = arith.remsi %1612, %1613 : i32
        %1618 = arith.remsi %1617, %arg1 : i32
        %1619 = arith.constant 0 : i32
        %1620 = arith.cmpi eq, %1618, %1619 : i32
        cf.cond_br %1620, ^bb180, ^bb181
        ^bb180:
          %1621 = llvm.load %1606 : !llvm.ptr -> i32
          %1622 = arith.constant 1 : i32
          %1623 = llvm.load %1609 : !llvm.ptr -> i32
          %1624 = arith.constant 1 : i32
          %1625 = arith.subi %1623, %1624 : i32
          %1626 = arith.shli %1622, %1625 : i32
          %1627 = arith.ori %1621, %1626 : i32
          llvm.store %1627, %1606 : i32, !llvm.ptr
          cf.br ^bb182
        ^bb181:
          cf.br ^bb182
        ^bb182:
        %1628 = llvm.load %1609 : !llvm.ptr -> i32
        %1629 = arith.constant 1 : i32
        %1630 = arith.addi %1628, %1629 : i32
        llvm.store %1630, %1609 : i32, !llvm.ptr
        cf.br ^bb177
      ^bb179:
      %1631 = llvm.load %1606 : !llvm.ptr -> i32
      %1632 = llvm.load %1589 : !llvm.ptr -> i32
      %1633 = arith.extsi %1632 : i32 to i64
      %1634 = llvm.getelementptr %1548[%1633] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %1631, %1634 : i32, !llvm.ptr
      %1635 = llvm.load %1589 : !llvm.ptr -> i32
      %1636 = arith.constant 10 : i32
      %1637 = arith.muli %1635, %1636 : i32
      %1638 = llvm.load %1529 : !llvm.ptr -> i32
      %1639 = arith.remsi %1637, %1638 : i32
      %1640 = arith.constant 0 : i32
      %1641 = llvm.mlir.constant(1 : i64) : i64
      %1642 = llvm.alloca %1641 x i32 : (i64) -> !llvm.ptr
      llvm.store %1640, %1642 : i32, !llvm.ptr
      cf.br ^bb183
      ^bb183:
      %1643 = llvm.load %1642 : !llvm.ptr -> i32
      %1644 = arith.constant 10 : i32
      %1645 = arith.cmpi slt, %1643, %1644 : i32
      cf.cond_br %1645, ^bb184, ^bb185
      ^bb184:
        %1646 = llvm.load %1642 : !llvm.ptr -> i32
        %1647 = arith.addi %1639, %1646 : i32
        %1648 = llvm.load %1529 : !llvm.ptr -> i32
        %1649 = arith.remsi %1647, %1648 : i32
        %1650 = llvm.load %1589 : !llvm.ptr -> i32
        %1651 = arith.constant 10 : i32
        %1652 = arith.muli %1650, %1651 : i32
        %1653 = llvm.load %1642 : !llvm.ptr -> i32
        %1654 = arith.addi %1652, %1653 : i32
        %1655 = arith.extsi %1654 : i32 to i64
        %1656 = llvm.getelementptr %1541[%1655] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %1649, %1656 : i32, !llvm.ptr
        %1657 = llvm.load %1642 : !llvm.ptr -> i32
        %1658 = arith.constant 1 : i32
        %1659 = arith.addi %1657, %1658 : i32
        llvm.store %1659, %1642 : i32, !llvm.ptr
        cf.br ^bb183
      ^bb185:
      %1660 = llvm.load %1589 : !llvm.ptr -> i32
      %1661 = arith.constant 1 : i32
      %1662 = arith.addi %1660, %1661 : i32
      llvm.store %1662, %1589 : i32, !llvm.ptr
      cf.br ^bb174
    ^bb176:
    %1664 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %1665 = llvm.load %1664 : !llvm.ptr -> i32
    %1666 = arith.extsi %1665 : i32 to i64
    %1667 = arith.constant 8 : i32
    %1668 = arith.extsi %1667 : i32 to i64
    %1663 = func.call @calloc(%1666, %1668) : (i64, i64) -> !llvm.ptr
    %1670 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %1671 = llvm.load %1670 : !llvm.ptr -> i32
    %1672 = arith.extsi %1671 : i32 to i64
    %1673 = arith.constant 8 : i32
    %1674 = arith.extsi %1673 : i32 to i64
    %1669 = func.call @calloc(%1672, %1674) : (i64, i64) -> !llvm.ptr
    %1675 = arith.constant 0 : i32
    %1676 = llvm.mlir.constant(1 : i64) : i64
    %1677 = llvm.alloca %1676 x i32 : (i64) -> !llvm.ptr
    llvm.store %1675, %1677 : i32, !llvm.ptr
    %1679 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %1680 = llvm.load %1679 : !llvm.ptr -> i32
    %1681 = arith.extsi %1680 : i32 to i64
    %1682 = arith.constant 8 : i32
    %1683 = arith.extsi %1682 : i32 to i64
    %1678 = func.call @calloc(%1681, %1683) : (i64, i64) -> !llvm.ptr
    %1685 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %1686 = llvm.load %1685 : !llvm.ptr -> i32
    %1687 = arith.extsi %1686 : i32 to i64
    %1688 = arith.constant 8 : i32
    %1689 = arith.extsi %1688 : i32 to i64
    %1684 = func.call @calloc(%1687, %1689) : (i64, i64) -> !llvm.ptr
    %1690 = arith.constant 0 : i32
    %1691 = llvm.mlir.constant(1 : i64) : i64
    %1692 = llvm.alloca %1691 x i32 : (i64) -> !llvm.ptr
    llvm.store %1690, %1692 : i32, !llvm.ptr
    %1694 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %1695 = llvm.load %1694 : !llvm.ptr -> i32
    %1696 = arith.extsi %1695 : i32 to i64
    %1697 = arith.constant 8 : i32
    %1698 = arith.extsi %1697 : i32 to i64
    %1693 = func.call @calloc(%1696, %1698) : (i64, i64) -> !llvm.ptr
    %1700 = llvm.mlir.addressof @MAX_STATES : !llvm.ptr
    %1701 = llvm.load %1700 : !llvm.ptr -> i32
    %1702 = arith.extsi %1701 : i32 to i64
    %1703 = arith.constant 8 : i32
    %1704 = arith.extsi %1703 : i32 to i64
    %1699 = func.call @calloc(%1702, %1704) : (i64, i64) -> !llvm.ptr
    %1705 = arith.constant 0 : i32
    %1706 = llvm.mlir.constant(1 : i64) : i64
    %1707 = llvm.alloca %1706 x i32 : (i64) -> !llvm.ptr
    llvm.store %1705, %1707 : i32, !llvm.ptr
    %1708 = arith.constant 1048576 : i32
    %1709 = arith.constant 0 : i32
    %1710 = arith.extsi %1708 : i32 to i64
    %1711 = arith.extsi %1709 : i32 to i64
    %1712 = llvm.getelementptr %1663[%1711] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1710, %1712 : i64, !llvm.ptr
    %1713 = arith.constant 1 : i32
    %1714 = arith.constant 0 : i32
    %1715 = arith.extsi %1713 : i32 to i64
    %1716 = arith.extsi %1714 : i32 to i64
    %1717 = llvm.getelementptr %1669[%1716] : (!llvm.ptr, i64) -> !llvm.ptr, i64
    llvm.store %1715, %1717 : i64, !llvm.ptr
    %1718 = arith.constant 1 : i32
    llvm.store %1718, %1677 : i32, !llvm.ptr
    %1720 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1721 = llvm.load %1720 : !llvm.ptr -> i32
    %1722 = arith.extsi %1721 : i32 to i64
    %1723 = arith.constant 8 : i32
    %1724 = arith.extsi %1723 : i32 to i64
    %1719 = func.call @calloc(%1722, %1724) : (i64, i64) -> !llvm.ptr
    %1726 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1727 = llvm.load %1726 : !llvm.ptr -> i32
    %1728 = arith.extsi %1727 : i32 to i64
    %1729 = arith.constant 8 : i32
    %1730 = arith.extsi %1729 : i32 to i64
    %1725 = func.call @calloc(%1728, %1730) : (i64, i64) -> !llvm.ptr
    %1732 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1733 = llvm.load %1732 : !llvm.ptr -> i32
    %1734 = arith.extsi %1733 : i32 to i64
    %1735 = arith.constant 8 : i32
    %1736 = arith.extsi %1735 : i32 to i64
    %1731 = func.call @calloc(%1734, %1736) : (i64, i64) -> !llvm.ptr
    %1738 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1739 = llvm.load %1738 : !llvm.ptr -> i32
    %1740 = arith.extsi %1739 : i32 to i64
    %1741 = arith.constant 8 : i32
    %1742 = arith.extsi %1741 : i32 to i64
    %1737 = func.call @calloc(%1740, %1742) : (i64, i64) -> !llvm.ptr
    %1744 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1745 = llvm.load %1744 : !llvm.ptr -> i32
    %1746 = arith.extsi %1745 : i32 to i64
    %1747 = arith.constant 8 : i32
    %1748 = arith.extsi %1747 : i32 to i64
    %1743 = func.call @calloc(%1746, %1748) : (i64, i64) -> !llvm.ptr
    %1750 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1751 = llvm.load %1750 : !llvm.ptr -> i32
    %1752 = arith.extsi %1751 : i32 to i64
    %1753 = arith.constant 8 : i32
    %1754 = arith.extsi %1753 : i32 to i64
    %1749 = func.call @calloc(%1752, %1754) : (i64, i64) -> !llvm.ptr
    %1756 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1757 = llvm.load %1756 : !llvm.ptr -> i32
    %1758 = arith.extsi %1757 : i32 to i64
    %1759 = arith.constant 8 : i32
    %1760 = arith.extsi %1759 : i32 to i64
    %1755 = func.call @calloc(%1758, %1760) : (i64, i64) -> !llvm.ptr
    %1762 = llvm.mlir.addressof @MAX_TRANS : !llvm.ptr
    %1763 = llvm.load %1762 : !llvm.ptr -> i32
    %1764 = arith.extsi %1763 : i32 to i64
    %1765 = arith.constant 8 : i32
    %1766 = arith.extsi %1765 : i32 to i64
    %1761 = func.call @calloc(%1764, %1766) : (i64, i64) -> !llvm.ptr
    %1767 = arith.constant 1 : i32
    %1768 = llvm.mlir.constant(1 : i64) : i64
    %1769 = llvm.alloca %1768 x i32 : (i64) -> !llvm.ptr
    llvm.store %1767, %1769 : i32, !llvm.ptr
    cf.br ^bb186
    ^bb186:
    %1770 = llvm.load %1769 : !llvm.ptr -> i32
    %1771 = arith.cmpi sle, %1770, %arg0 : i32
    cf.cond_br %1771, ^bb187, ^bb188
    ^bb187:
      %1772 = arith.constant 0 : i32
      %1773 = llvm.mlir.constant(1 : i64) : i64
      %1774 = llvm.alloca %1773 x i32 : (i64) -> !llvm.ptr
      llvm.store %1772, %1774 : i32, !llvm.ptr
      %1775 = arith.constant 0 : i32
      %1776 = llvm.mlir.constant(1 : i64) : i64
      %1777 = llvm.alloca %1776 x i32 : (i64) -> !llvm.ptr
      llvm.store %1775, %1777 : i32, !llvm.ptr
      %1778 = arith.constant 0 : i32
      %1779 = llvm.mlir.constant(1 : i64) : i64
      %1780 = llvm.alloca %1779 x i32 : (i64) -> !llvm.ptr
      llvm.store %1778, %1780 : i32, !llvm.ptr
      %1781 = llvm.load %1769 : !llvm.ptr -> i32
      %1782 = arith.constant 1 : i32
      %1783 = arith.cmpi eq, %1781, %1782 : i32
      %1784 = scf.if %1783 -> (i32) {
        %1785 = arith.constant 1 : i32
        scf.yield %1785 : i32
      } else {
        %1786 = arith.constant 0 : i32
        scf.yield %1786 : i32
      }
      %1788 = llvm.load %1769 : !llvm.ptr -> i32
      %1789 = arith.extsi %1788 : i32 to i64
      %1790 = llvm.getelementptr %1490[%1789] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %1787 = llvm.load %1790 : !llvm.ptr -> i64
      %1791 = arith.constant 0 : i32
      %1792 = llvm.mlir.constant(1 : i64) : i64
      %1793 = llvm.alloca %1792 x i32 : (i64) -> !llvm.ptr
      llvm.store %1791, %1793 : i32, !llvm.ptr
      cf.br ^bb189
      ^bb189:
      %1794 = llvm.load %1793 : !llvm.ptr -> i32
      %1795 = arith.constant 3 : i32
      %1796 = arith.cmpi slt, %1794, %1795 : i32
      cf.cond_br %1796, ^bb190, ^bb191
      ^bb190:
        %1797 = llvm.load %1793 : !llvm.ptr -> i32
        %1798 = arith.constant 0 : i32
        %1799 = arith.cmpi eq, %1797, %1798 : i32
        %1800 = scf.if %1799 -> (i32) {
          %1801 = llvm.load %1677 : !llvm.ptr -> i32
          scf.yield %1801 : i32
        } else {
          %1802 = llvm.load %1793 : !llvm.ptr -> i32
          %1803 = arith.constant 1 : i32
          %1804 = arith.cmpi eq, %1802, %1803 : i32
          %1805 = scf.if %1804 -> (i32) {
            %1806 = llvm.load %1692 : !llvm.ptr -> i32
            scf.yield %1806 : i32
          } else {
            %1807 = llvm.load %1707 : !llvm.ptr -> i32
            scf.yield %1807 : i32
          }
          scf.yield %1805 : i32
        }
        %1808 = llvm.load %1793 : !llvm.ptr -> i32
        %1809 = arith.constant 0 : i32
        %1810 = arith.cmpi eq, %1808, %1809 : i32
        %1811 = scf.if %1810 -> (!llvm.ptr) {
          scf.yield %1663 : !llvm.ptr
        } else {
          %1812 = llvm.load %1793 : !llvm.ptr -> i32
          %1813 = arith.constant 1 : i32
          %1814 = arith.cmpi eq, %1812, %1813 : i32
          %1815 = scf.if %1814 -> (!llvm.ptr) {
            scf.yield %1678 : !llvm.ptr
          } else {
            scf.yield %1693 : !llvm.ptr
          }
          scf.yield %1815 : !llvm.ptr
        }
        %1816 = llvm.load %1793 : !llvm.ptr -> i32
        %1817 = arith.constant 0 : i32
        %1818 = arith.cmpi eq, %1816, %1817 : i32
        %1819 = scf.if %1818 -> (!llvm.ptr) {
          scf.yield %1669 : !llvm.ptr
        } else {
          %1820 = llvm.load %1793 : !llvm.ptr -> i32
          %1821 = arith.constant 1 : i32
          %1822 = arith.cmpi eq, %1820, %1821 : i32
          %1823 = scf.if %1822 -> (!llvm.ptr) {
            scf.yield %1684 : !llvm.ptr
          } else {
            scf.yield %1699 : !llvm.ptr
          }
          scf.yield %1823 : !llvm.ptr
        }
        %1824 = arith.constant 0 : i32
        %1825 = llvm.mlir.constant(1 : i64) : i64
        %1826 = llvm.alloca %1825 x i32 : (i64) -> !llvm.ptr
        llvm.store %1824, %1826 : i32, !llvm.ptr
        cf.br ^bb192
        ^bb192:
        %1827 = llvm.load %1826 : !llvm.ptr -> i32
        %1828 = arith.cmpi slt, %1827, %1800 : i32
        cf.cond_br %1828, ^bb193, ^bb194
        ^bb193:
          %1830 = llvm.load %1826 : !llvm.ptr -> i32
          %1831 = arith.extsi %1830 : i32 to i64
          %1832 = llvm.getelementptr %1811[%1831] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %1829 = llvm.load %1832 : !llvm.ptr -> i64
          %1834 = llvm.load %1826 : !llvm.ptr -> i32
          %1835 = arith.extsi %1834 : i32 to i64
          %1836 = llvm.getelementptr %1819[%1835] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %1833 = llvm.load %1836 : !llvm.ptr -> i64
          %1837 = arith.constant 54 : i32
          %1839 = arith.extsi %1837 : i32 to i64
          %1838 = arith.shrsi %1829, %1839 : i64
          %1840 = arith.trunci %1838 : i64 to i32
          %1841 = arith.constant 24 : i32
          %1843 = arith.extsi %1841 : i32 to i64
          %1842 = arith.shrsi %1829, %1843 : i64
          %1844 = arith.constant 1073741823 : i32
          %1846 = arith.extsi %1844 : i32 to i64
          %1845 = arith.andi %1842, %1846 : i64
          %1847 = arith.constant 20 : i32
          %1849 = arith.extsi %1847 : i32 to i64
          %1848 = arith.shrsi %1829, %1849 : i64
          %1850 = arith.constant 15 : i32
          %1852 = arith.extsi %1850 : i32 to i64
          %1851 = arith.andi %1848, %1852 : i64
          %1853 = arith.trunci %1851 : i64 to i32
          %1854 = arith.constant 1048575 : i32
          %1856 = arith.extsi %1854 : i32 to i64
          %1855 = arith.andi %1829, %1856 : i64
          %1857 = arith.trunci %1855 : i64 to i32
          %1858 = arith.constant 0 : i32
          %1859 = arith.cmpi sgt, %1853, %1858 : i32
          %1860 = scf.if %1859 -> (i32) {
            %1861 = arith.constant 32 : i32
            %1863 = arith.extsi %1861 : i32 to i64
            %1862 = arith.remsi %1845, %1863 : i64
            %1864 = arith.trunci %1862 : i64 to i32
            scf.yield %1864 : i32
          } else {
            %1865 = arith.constant 0 : i32
            scf.yield %1865 : i32
          }
          %1866 = arith.constant 1 : i32
          %1867 = arith.subi %arg3, %1866 : i32
          %1868 = llvm.mlir.constant(1 : i64) : i64
          %1869 = llvm.alloca %1868 x i32 : (i64) -> !llvm.ptr
          llvm.store %1867, %1869 : i32, !llvm.ptr
          %1870 = llvm.load %1769 : !llvm.ptr -> i32
          %1871 = llvm.load %1869 : !llvm.ptr -> i32
          %1872 = arith.cmpi slt, %1870, %1871 : i32
          cf.cond_br %1872, ^bb195, ^bb196
          ^bb195:
            %1873 = llvm.load %1769 : !llvm.ptr -> i32
            llvm.store %1873, %1869 : i32, !llvm.ptr
            cf.br ^bb197
          ^bb196:
            cf.br ^bb197
          ^bb197:
          %1874 = llvm.mlir.constant(1 : i64) : i64
          %1875 = llvm.alloca %1874 x i32 : (i64) -> !llvm.ptr
          llvm.store %1784, %1875 : i32, !llvm.ptr
          cf.br ^bb198
          ^bb198:
          %1876 = llvm.load %1875 : !llvm.ptr -> i32
          %1877 = arith.constant 9 : i32
          %1878 = arith.cmpi sle, %1876, %1877 : i32
          cf.cond_br %1878, ^bb199, ^bb200
          ^bb199:
            %1879 = arith.constant 1 : i32
            %1880 = arith.cmpi sgt, %arg2, %1879 : i32
            %1881 = scf.if %1880 -> (i32) {
              %1882 = arith.extsi %1860 : i32 to i64
              %1883 = llvm.load %1875 : !llvm.ptr -> i32
              %1884 = arith.extsi %1883 : i32 to i64
              %1885 = arith.muli %1884, %1787 : i64
              %1886 = arith.addi %1882, %1885 : i64
              %1887 = arith.extsi %arg2 : i32 to i64
              %1888 = arith.remsi %1886, %1887 : i64
              %1889 = arith.trunci %1888 : i64 to i32
              scf.yield %1889 : i32
            } else {
              %1890 = arith.constant 0 : i32
              scf.yield %1890 : i32
            }
            %1892 = arith.constant 10 : i32
            %1893 = arith.muli %1857, %1892 : i32
            %1894 = llvm.load %1875 : !llvm.ptr -> i32
            %1895 = arith.addi %1893, %1894 : i32
            %1896 = arith.extsi %1895 : i32 to i64
            %1897 = llvm.getelementptr %1541[%1896] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %1891 = llvm.load %1897 : !llvm.ptr -> i32
            %1899 = arith.extsi %1891 : i32 to i64
            %1900 = llvm.getelementptr %1548[%1899] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            %1898 = llvm.load %1900 : !llvm.ptr -> i32
            %1901 = arith.constant 0 : i32
            %1902 = llvm.mlir.constant(1 : i64) : i64
            %1903 = llvm.alloca %1902 x i32 : (i64) -> !llvm.ptr
            llvm.store %1901, %1903 : i32, !llvm.ptr
            %1904 = arith.constant 0 : i32
            %1905 = arith.cmpi ne, %1898, %1904 : i32
            cf.cond_br %1905, ^bb201, ^bb202
            ^bb201:
              %1906 = arith.constant 1 : i32
              %1907 = llvm.mlir.constant(1 : i64) : i64
              %1908 = llvm.alloca %1907 x i32 : (i64) -> !llvm.ptr
              llvm.store %1906, %1908 : i32, !llvm.ptr
              cf.br ^bb204
              ^bb204:
              %1909 = llvm.load %1908 : !llvm.ptr -> i32
              %1910 = llvm.load %1869 : !llvm.ptr -> i32
              %1911 = arith.cmpi sle, %1909, %1910 : i32
              cf.cond_br %1911, ^bb205, ^bb206
              ^bb205:
                %1912 = arith.constant 1 : i32
                %1913 = llvm.load %1908 : !llvm.ptr -> i32
                %1914 = arith.constant 1 : i32
                %1915 = arith.subi %1913, %1914 : i32
                %1916 = arith.shli %1912, %1915 : i32
                %1917 = arith.andi %1898, %1916 : i32
                %1918 = arith.constant 0 : i32
                %1919 = arith.cmpi ne, %1917, %1918 : i32
                cf.cond_br %1919, ^bb207, ^bb208
                ^bb207:
                  %1920 = llvm.mlir.constant(1 : i64) : i64
                  %1921 = llvm.alloca %1920 x i64 : (i64) -> !llvm.ptr
                  llvm.store %1845, %1921 : i64, !llvm.ptr
                  %1922 = arith.constant 0 : i32
                  %1923 = llvm.mlir.constant(1 : i64) : i64
                  %1924 = llvm.alloca %1923 x i32 : (i64) -> !llvm.ptr
                  llvm.store %1922, %1924 : i32, !llvm.ptr
                  cf.br ^bb210
                  ^bb210:
                  %1925 = llvm.load %1924 : !llvm.ptr -> i32
                  %1926 = llvm.load %1908 : !llvm.ptr -> i32
                  %1927 = arith.constant 1 : i32
                  %1928 = arith.subi %1926, %1927 : i32
                  %1929 = arith.cmpi slt, %1925, %1928 : i32
                  cf.cond_br %1929, ^bb211, ^bb212
                  ^bb211:
                    %1930 = llvm.load %1921 : !llvm.ptr -> i64
                    %1931 = arith.constant 32 : i32
                    %1933 = arith.extsi %1931 : i32 to i64
                    %1932 = arith.divsi %1930, %1933 : i64
                    llvm.store %1932, %1921 : i64, !llvm.ptr
                    %1934 = llvm.load %1924 : !llvm.ptr -> i32
                    %1935 = arith.constant 1 : i32
                    %1936 = arith.addi %1934, %1935 : i32
                    llvm.store %1936, %1924 : i32, !llvm.ptr
                    cf.br ^bb210
                  ^bb212:
                  %1937 = llvm.load %1921 : !llvm.ptr -> i64
                  %1938 = arith.constant 32 : i32
                  %1940 = arith.extsi %1938 : i32 to i64
                  %1939 = arith.remsi %1937, %1940 : i64
                  %1941 = arith.trunci %1939 : i64 to i32
                  %1942 = arith.cmpi eq, %1941, %1881 : i32
                  cf.cond_br %1942, ^bb213, ^bb214
                  ^bb213:
                    %1943 = llvm.load %1903 : !llvm.ptr -> i32
                    %1944 = arith.constant 1 : i32
                    %1945 = arith.addi %1943, %1944 : i32
                    llvm.store %1945, %1903 : i32, !llvm.ptr
                    cf.br ^bb215
                  ^bb214:
                    cf.br ^bb215
                  ^bb215:
                  cf.br ^bb209
                ^bb208:
                  cf.br ^bb209
                ^bb209:
                %1946 = llvm.load %1908 : !llvm.ptr -> i32
                %1947 = arith.constant 1 : i32
                %1948 = arith.addi %1946, %1947 : i32
                llvm.store %1948, %1908 : i32, !llvm.ptr
                cf.br ^bb204
              ^bb206:
              cf.br ^bb203
            ^bb202:
              cf.br ^bb203
            ^bb203:
            %1949 = llvm.load %1769 : !llvm.ptr -> i32
            %1950 = arith.cmpi sge, %1949, %arg3 : i32
            %1951 = scf.if %1950 -> (i1) {
              %1953 = arith.extsi %1891 : i32 to i64
              %1954 = llvm.getelementptr %1559[%1953] : (!llvm.ptr, i64) -> !llvm.ptr, i8
              %1952 = llvm.load %1954 : !llvm.ptr -> i8
              %1955 = arith.constant 0 : i32
              %1957 = arith.extsi %1952 : i8 to i32
              %1956 = arith.cmpi ne, %1957, %1955 : i32
              scf.yield %1956 : i1
            } else {
              %1958 = arith.constant false
              scf.yield %1958 : i1
            }
            cf.cond_br %1951, ^bb216, ^bb217
            ^bb216:
              %1959 = llvm.load %1903 : !llvm.ptr -> i32
              %1961 = arith.muli %1840, %1476 : i32
              %1962 = arith.addi %1961, %1881 : i32
              %1963 = arith.extsi %1962 : i32 to i64
              %1964 = llvm.getelementptr %1479[%1963] : (!llvm.ptr, i64) -> !llvm.ptr, i32
              %1960 = llvm.load %1964 : !llvm.ptr -> i32
              %1965 = arith.addi %1959, %1960 : i32
              llvm.store %1965, %1903 : i32, !llvm.ptr
              cf.br ^bb218
            ^bb217:
              cf.br ^bb218
            ^bb218:
            %1966 = llvm.load %1903 : !llvm.ptr -> i32
            %1967 = arith.constant 2 : i32
            %1968 = arith.cmpi sgt, %1966, %1967 : i32
            cf.cond_br %1968, ^bb219, ^bb220
            ^bb219:
              %1969 = arith.constant 2 : i32
              llvm.store %1969, %1903 : i32, !llvm.ptr
              cf.br ^bb221
            ^bb220:
              cf.br ^bb221
            ^bb221:
            %1970 = llvm.load %1793 : !llvm.ptr -> i32
            %1971 = llvm.load %1903 : !llvm.ptr -> i32
            %1972 = arith.addi %1970, %1971 : i32
            %1973 = arith.constant 2 : i32
            %1974 = arith.cmpi sgt, %1972, %1973 : i32
            %1975 = scf.if %1974 -> (i32) {
              %1976 = arith.constant 2 : i32
              scf.yield %1976 : i32
            } else {
              scf.yield %1972 : i32
            }
            %1977 = arith.constant 32 : i32
            %1979 = arith.extsi %1977 : i32 to i64
            %1978 = arith.muli %1845, %1979 : i64
            %1980 = arith.extsi %1881 : i32 to i64
            %1981 = arith.addi %1978, %1980 : i64
            %1982 = arith.constant 1 : i32
            %1983 = arith.addi %1853, %1982 : i32
            %1984 = llvm.mlir.constant(1 : i64) : i64
            %1985 = llvm.alloca %1984 x i64 : (i64) -> !llvm.ptr
            llvm.store %1981, %1985 : i64, !llvm.ptr
            %1986 = llvm.mlir.constant(1 : i64) : i64
            %1987 = llvm.alloca %1986 x i32 : (i64) -> !llvm.ptr
            llvm.store %1983, %1987 : i32, !llvm.ptr
            %1988 = llvm.mlir.constant(1 : i64) : i64
            %1989 = llvm.alloca %1988 x i32 : (i64) -> !llvm.ptr
            llvm.store %1840, %1989 : i32, !llvm.ptr
            %1990 = arith.constant 1 : i32
            %1991 = arith.subi %arg3, %1990 : i32
            %1992 = arith.cmpi sgt, %1983, %1991 : i32
            cf.cond_br %1992, ^bb222, ^bb223
            ^bb222:
              %1993 = arith.constant 1 : i32
              %1994 = arith.extsi %1993 : i32 to i64
              %1995 = llvm.mlir.constant(1 : i64) : i64
              %1996 = llvm.alloca %1995 x i64 : (i64) -> !llvm.ptr
              llvm.store %1994, %1996 : i64, !llvm.ptr
              %1997 = arith.constant 1 : i32
              %1998 = llvm.mlir.constant(1 : i64) : i64
              %1999 = llvm.alloca %1998 x i32 : (i64) -> !llvm.ptr
              llvm.store %1997, %1999 : i32, !llvm.ptr
              cf.br ^bb225
              ^bb225:
              %2000 = llvm.load %1999 : !llvm.ptr -> i32
              %2001 = arith.cmpi slt, %2000, %1983 : i32
              cf.cond_br %2001, ^bb226, ^bb227
              ^bb226:
                %2002 = llvm.load %1996 : !llvm.ptr -> i64
                %2003 = arith.constant 32 : i32
                %2005 = arith.extsi %2003 : i32 to i64
                %2004 = arith.muli %2002, %2005 : i64
                llvm.store %2004, %1996 : i64, !llvm.ptr
                %2006 = llvm.load %1999 : !llvm.ptr -> i32
                %2007 = arith.constant 1 : i32
                %2008 = arith.addi %2006, %2007 : i32
                llvm.store %2008, %1999 : i32, !llvm.ptr
                cf.br ^bb225
              ^bb227:
              %2009 = llvm.load %1996 : !llvm.ptr -> i64
              %2010 = arith.divsi %1981, %2009 : i64
              %2011 = arith.trunci %2010 : i64 to i32
              %2012 = llvm.load %1996 : !llvm.ptr -> i64
              %2013 = arith.remsi %1981, %2012 : i64
              llvm.store %2013, %1985 : i64, !llvm.ptr
              %2014 = arith.constant 1 : i32
              %2015 = arith.subi %1983, %2014 : i32
              llvm.store %2015, %1987 : i32, !llvm.ptr
              %2017 = arith.muli %1840, %1476 : i32
              %2018 = arith.addi %2017, %2011 : i32
              %2019 = arith.extsi %2018 : i32 to i64
              %2020 = llvm.getelementptr %1484[%2019] : (!llvm.ptr, i64) -> !llvm.ptr, i32
              %2016 = llvm.load %2020 : !llvm.ptr -> i32
              llvm.store %2016, %1989 : i32, !llvm.ptr
              cf.br ^bb224
            ^bb223:
              cf.br ^bb224
            ^bb224:
            %2021 = llvm.load %1989 : !llvm.ptr -> i32
            %2022 = arith.extsi %2021 : i32 to i64
            %2023 = arith.constant 54 : i32
            %2025 = arith.extsi %2023 : i32 to i64
            %2024 = arith.shli %2022, %2025 : i64
            %2026 = llvm.load %1985 : !llvm.ptr -> i64
            %2027 = arith.constant 24 : i32
            %2029 = arith.extsi %2027 : i32 to i64
            %2028 = arith.shli %2026, %2029 : i64
            %2030 = arith.ori %2024, %2028 : i64
            %2031 = llvm.load %1987 : !llvm.ptr -> i32
            %2032 = arith.extsi %2031 : i32 to i64
            %2033 = arith.constant 20 : i32
            %2035 = arith.extsi %2033 : i32 to i64
            %2034 = arith.shli %2032, %2035 : i64
            %2036 = arith.ori %2030, %2034 : i64
            %2037 = arith.extsi %1891 : i32 to i64
            %2038 = arith.ori %2036, %2037 : i64
            %2039 = arith.constant 0 : i32
            %2040 = arith.cmpi eq, %1975, %2039 : i32
            cf.cond_br %2040, ^bb228, ^bb229
            ^bb228:
              %2041 = llvm.load %1774 : !llvm.ptr -> i32
              %2042 = arith.extsi %2041 : i32 to i64
              %2043 = llvm.getelementptr %1719[%2042] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %2038, %2043 : i64, !llvm.ptr
              %2044 = llvm.load %1774 : !llvm.ptr -> i32
              %2045 = arith.extsi %2044 : i32 to i64
              %2046 = llvm.getelementptr %1725[%2045] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %1833, %2046 : i64, !llvm.ptr
              %2047 = llvm.load %1774 : !llvm.ptr -> i32
              %2048 = arith.constant 1 : i32
              %2049 = arith.addi %2047, %2048 : i32
              llvm.store %2049, %1774 : i32, !llvm.ptr
              cf.br ^bb230
            ^bb229:
              cf.br ^bb230
            ^bb230:
            %2050 = arith.constant 1 : i32
            %2051 = arith.cmpi eq, %1975, %2050 : i32
            cf.cond_br %2051, ^bb231, ^bb232
            ^bb231:
              %2052 = llvm.load %1777 : !llvm.ptr -> i32
              %2053 = arith.extsi %2052 : i32 to i64
              %2054 = llvm.getelementptr %1731[%2053] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %2038, %2054 : i64, !llvm.ptr
              %2055 = llvm.load %1777 : !llvm.ptr -> i32
              %2056 = arith.extsi %2055 : i32 to i64
              %2057 = llvm.getelementptr %1737[%2056] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %1833, %2057 : i64, !llvm.ptr
              %2058 = llvm.load %1777 : !llvm.ptr -> i32
              %2059 = arith.constant 1 : i32
              %2060 = arith.addi %2058, %2059 : i32
              llvm.store %2060, %1777 : i32, !llvm.ptr
              cf.br ^bb233
            ^bb232:
              cf.br ^bb233
            ^bb233:
            %2061 = arith.constant 2 : i32
            %2062 = arith.cmpi eq, %1975, %2061 : i32
            cf.cond_br %2062, ^bb234, ^bb235
            ^bb234:
              %2063 = llvm.load %1780 : !llvm.ptr -> i32
              %2064 = arith.extsi %2063 : i32 to i64
              %2065 = llvm.getelementptr %1743[%2064] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %2038, %2065 : i64, !llvm.ptr
              %2066 = llvm.load %1780 : !llvm.ptr -> i32
              %2067 = arith.extsi %2066 : i32 to i64
              %2068 = llvm.getelementptr %1749[%2067] : (!llvm.ptr, i64) -> !llvm.ptr, i64
              llvm.store %1833, %2068 : i64, !llvm.ptr
              %2069 = llvm.load %1780 : !llvm.ptr -> i32
              %2070 = arith.constant 1 : i32
              %2071 = arith.addi %2069, %2070 : i32
              llvm.store %2071, %1780 : i32, !llvm.ptr
              cf.br ^bb236
            ^bb235:
              cf.br ^bb236
            ^bb236:
            %2072 = llvm.load %1875 : !llvm.ptr -> i32
            %2073 = arith.constant 1 : i32
            %2074 = arith.addi %2072, %2073 : i32
            llvm.store %2074, %1875 : i32, !llvm.ptr
            cf.br ^bb198
          ^bb200:
          %2075 = llvm.load %1826 : !llvm.ptr -> i32
          %2076 = arith.constant 1 : i32
          %2077 = arith.addi %2075, %2076 : i32
          llvm.store %2077, %1826 : i32, !llvm.ptr
          cf.br ^bb192
        ^bb194:
        %2078 = llvm.load %1793 : !llvm.ptr -> i32
        %2079 = arith.constant 1 : i32
        %2080 = arith.addi %2078, %2079 : i32
        llvm.store %2080, %1793 : i32, !llvm.ptr
        cf.br ^bb189
      ^bb191:
      %2082 = llvm.load %1774 : !llvm.ptr -> i32
      %2081 = func.call @sort_and_merge(%1719, %1725, %2082, %1755, %1761) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %2081, %1677 : i32, !llvm.ptr
      %2084 = llvm.load %1777 : !llvm.ptr -> i32
      %2083 = func.call @sort_and_merge(%1731, %1737, %2084, %1755, %1761) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %2083, %1692 : i32, !llvm.ptr
      %2086 = llvm.load %1780 : !llvm.ptr -> i32
      %2085 = func.call @sort_and_merge(%1743, %1749, %2086, %1755, %1761) : (!llvm.ptr, !llvm.ptr, i32, !llvm.ptr, !llvm.ptr) -> i32
      llvm.store %2085, %1707 : i32, !llvm.ptr
      %2087 = arith.constant 0 : i32
      %2088 = llvm.mlir.constant(1 : i64) : i64
      %2089 = llvm.alloca %2088 x i32 : (i64) -> !llvm.ptr
      llvm.store %2087, %2089 : i32, !llvm.ptr
      cf.br ^bb237
      ^bb237:
      %2090 = llvm.load %2089 : !llvm.ptr -> i32
      %2091 = llvm.load %1677 : !llvm.ptr -> i32
      %2092 = arith.cmpi slt, %2090, %2091 : i32
      cf.cond_br %2092, ^bb238, ^bb239
      ^bb238:
        %2094 = llvm.load %2089 : !llvm.ptr -> i32
        %2095 = arith.extsi %2094 : i32 to i64
        %2096 = llvm.getelementptr %1719[%2095] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %2093 = llvm.load %2096 : !llvm.ptr -> i64
        %2097 = llvm.load %2089 : !llvm.ptr -> i32
        %2098 = arith.extsi %2097 : i32 to i64
        %2099 = llvm.getelementptr %1663[%2098] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %2093, %2099 : i64, !llvm.ptr
        %2101 = llvm.load %2089 : !llvm.ptr -> i32
        %2102 = arith.extsi %2101 : i32 to i64
        %2103 = llvm.getelementptr %1725[%2102] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %2100 = llvm.load %2103 : !llvm.ptr -> i64
        %2104 = llvm.load %2089 : !llvm.ptr -> i32
        %2105 = arith.extsi %2104 : i32 to i64
        %2106 = llvm.getelementptr %1669[%2105] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %2100, %2106 : i64, !llvm.ptr
        %2107 = llvm.load %2089 : !llvm.ptr -> i32
        %2108 = arith.constant 1 : i32
        %2109 = arith.addi %2107, %2108 : i32
        llvm.store %2109, %2089 : i32, !llvm.ptr
        cf.br ^bb237
      ^bb239:
      %2110 = arith.constant 0 : i32
      %2111 = llvm.mlir.constant(1 : i64) : i64
      %2112 = llvm.alloca %2111 x i32 : (i64) -> !llvm.ptr
      llvm.store %2110, %2112 : i32, !llvm.ptr
      cf.br ^bb240
      ^bb240:
      %2113 = llvm.load %2112 : !llvm.ptr -> i32
      %2114 = llvm.load %1692 : !llvm.ptr -> i32
      %2115 = arith.cmpi slt, %2113, %2114 : i32
      cf.cond_br %2115, ^bb241, ^bb242
      ^bb241:
        %2117 = llvm.load %2112 : !llvm.ptr -> i32
        %2118 = arith.extsi %2117 : i32 to i64
        %2119 = llvm.getelementptr %1731[%2118] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %2116 = llvm.load %2119 : !llvm.ptr -> i64
        %2120 = llvm.load %2112 : !llvm.ptr -> i32
        %2121 = arith.extsi %2120 : i32 to i64
        %2122 = llvm.getelementptr %1678[%2121] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %2116, %2122 : i64, !llvm.ptr
        %2124 = llvm.load %2112 : !llvm.ptr -> i32
        %2125 = arith.extsi %2124 : i32 to i64
        %2126 = llvm.getelementptr %1737[%2125] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %2123 = llvm.load %2126 : !llvm.ptr -> i64
        %2127 = llvm.load %2112 : !llvm.ptr -> i32
        %2128 = arith.extsi %2127 : i32 to i64
        %2129 = llvm.getelementptr %1684[%2128] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %2123, %2129 : i64, !llvm.ptr
        %2130 = llvm.load %2112 : !llvm.ptr -> i32
        %2131 = arith.constant 1 : i32
        %2132 = arith.addi %2130, %2131 : i32
        llvm.store %2132, %2112 : i32, !llvm.ptr
        cf.br ^bb240
      ^bb242:
      %2133 = arith.constant 0 : i32
      %2134 = llvm.mlir.constant(1 : i64) : i64
      %2135 = llvm.alloca %2134 x i32 : (i64) -> !llvm.ptr
      llvm.store %2133, %2135 : i32, !llvm.ptr
      cf.br ^bb243
      ^bb243:
      %2136 = llvm.load %2135 : !llvm.ptr -> i32
      %2137 = llvm.load %1707 : !llvm.ptr -> i32
      %2138 = arith.cmpi slt, %2136, %2137 : i32
      cf.cond_br %2138, ^bb244, ^bb245
      ^bb244:
        %2140 = llvm.load %2135 : !llvm.ptr -> i32
        %2141 = arith.extsi %2140 : i32 to i64
        %2142 = llvm.getelementptr %1743[%2141] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %2139 = llvm.load %2142 : !llvm.ptr -> i64
        %2143 = llvm.load %2135 : !llvm.ptr -> i32
        %2144 = arith.extsi %2143 : i32 to i64
        %2145 = llvm.getelementptr %1693[%2144] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %2139, %2145 : i64, !llvm.ptr
        %2147 = llvm.load %2135 : !llvm.ptr -> i32
        %2148 = arith.extsi %2147 : i32 to i64
        %2149 = llvm.getelementptr %1749[%2148] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %2146 = llvm.load %2149 : !llvm.ptr -> i64
        %2150 = llvm.load %2135 : !llvm.ptr -> i32
        %2151 = arith.extsi %2150 : i32 to i64
        %2152 = llvm.getelementptr %1699[%2151] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %2146, %2152 : i64, !llvm.ptr
        %2153 = llvm.load %2135 : !llvm.ptr -> i32
        %2154 = arith.constant 1 : i32
        %2155 = arith.addi %2153, %2154 : i32
        llvm.store %2155, %2135 : i32, !llvm.ptr
        cf.br ^bb243
      ^bb245:
      %2156 = llvm.load %1769 : !llvm.ptr -> i32
      %2157 = arith.constant 1 : i32
      %2158 = arith.addi %2156, %2157 : i32
      llvm.store %2158, %1769 : i32, !llvm.ptr
      cf.br ^bb186
    ^bb188:
    %2159 = arith.constant 0 : i32
    %2160 = arith.extsi %2159 : i32 to i64
    %2161 = llvm.mlir.constant(1 : i64) : i64
    %2162 = llvm.alloca %2161 x i64 : (i64) -> !llvm.ptr
    llvm.store %2160, %2162 : i64, !llvm.ptr
    %2163 = arith.constant 0 : i32
    %2164 = llvm.mlir.constant(1 : i64) : i64
    %2165 = llvm.alloca %2164 x i32 : (i64) -> !llvm.ptr
    llvm.store %2163, %2165 : i32, !llvm.ptr
    cf.br ^bb246
    ^bb246:
    %2166 = llvm.load %2165 : !llvm.ptr -> i32
    %2167 = llvm.load %1692 : !llvm.ptr -> i32
    %2168 = arith.cmpi slt, %2166, %2167 : i32
    cf.cond_br %2168, ^bb247, ^bb248
    ^bb247:
      %2169 = llvm.load %2162 : !llvm.ptr -> i64
      %2171 = llvm.load %2165 : !llvm.ptr -> i32
      %2172 = arith.extsi %2171 : i32 to i64
      %2173 = llvm.getelementptr %1684[%2172] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %2170 = llvm.load %2173 : !llvm.ptr -> i64
      %2174 = arith.addi %2169, %2170 : i64
      llvm.store %2174, %2162 : i64, !llvm.ptr
      %2175 = llvm.load %2165 : !llvm.ptr -> i32
      %2176 = arith.constant 1 : i32
      %2177 = arith.addi %2175, %2176 : i32
      llvm.store %2177, %2165 : i32, !llvm.ptr
      cf.br ^bb246
    ^bb248:
    func.call @free(%1479) : (!llvm.ptr) -> ()
    func.call @free(%1484) : (!llvm.ptr) -> ()
    func.call @free(%1490) : (!llvm.ptr) -> ()
    func.call @free(%1541) : (!llvm.ptr) -> ()
    func.call @free(%1548) : (!llvm.ptr) -> ()
    func.call @free(%1553) : (!llvm.ptr) -> ()
    func.call @free(%1559) : (!llvm.ptr) -> ()
    func.call @free(%1663) : (!llvm.ptr) -> ()
    func.call @free(%1669) : (!llvm.ptr) -> ()
    func.call @free(%1678) : (!llvm.ptr) -> ()
    func.call @free(%1684) : (!llvm.ptr) -> ()
    func.call @free(%1693) : (!llvm.ptr) -> ()
    func.call @free(%1699) : (!llvm.ptr) -> ()
    func.call @free(%1719) : (!llvm.ptr) -> ()
    func.call @free(%1725) : (!llvm.ptr) -> ()
    func.call @free(%1731) : (!llvm.ptr) -> ()
    func.call @free(%1737) : (!llvm.ptr) -> ()
    func.call @free(%1743) : (!llvm.ptr) -> ()
    func.call @free(%1749) : (!llvm.ptr) -> ()
    func.call @free(%1755) : (!llvm.ptr) -> ()
    func.call @free(%1761) : (!llvm.ptr) -> ()
    %2199 = llvm.load %2162 : !llvm.ptr -> i64
    func.return %2199 : i64
  }
  func.func @count_one_child(%arg0: i32) -> i64 {
    %2200 = arith.constant 1 : i32
    %2201 = arith.cmpi eq, %arg0, %2200 : i32
    cf.cond_br %2201, ^bb249, ^bb250
    ^bb249:
      %2202 = arith.constant 9 : i32
      %2203 = arith.extsi %2202 : i32 to i64
      func.return %2203 : i64
    ^bb250:
      cf.br ^bb251
    ^bb251:
    %2204 = arith.constant 2 : i32
    %2205 = arith.remsi %arg0, %2204 : i32
    %2206 = arith.constant 0 : i32
    %2207 = arith.cmpi ne, %2205, %2206 : i32
    %2208 = scf.if %2207 -> (i1) {
      %2209 = arith.constant 5 : i32
      %2210 = arith.remsi %arg0, %2209 : i32
      %2211 = arith.constant 0 : i32
      %2212 = arith.cmpi ne, %2210, %2211 : i32
      scf.yield %2212 : i1
    } else {
      %2213 = arith.constant false
      scf.yield %2213 : i1
    }
    cf.cond_br %2208, ^bb252, ^bb253
    ^bb252:
      %2214 = func.call @count_one_child_coprime(%arg0) : (i32) -> i64
      func.return %2214 : i64
    ^bb253:
      cf.br ^bb254
    ^bb254:
    %2216 = arith.constant 2 : i32
    %2215 = func.call @v_factor(%arg0, %2216) : (i32, i32) -> i32
    %2218 = arith.constant 5 : i32
    %2217 = func.call @v_factor(%arg0, %2218) : (i32, i32) -> i32
    %2219 = arith.constant 1 : i32
    %2220 = llvm.mlir.constant(1 : i64) : i64
    %2221 = llvm.alloca %2220 x i32 : (i64) -> !llvm.ptr
    llvm.store %2219, %2221 : i32, !llvm.ptr
    %2222 = arith.constant 0 : i32
    %2223 = llvm.mlir.constant(1 : i64) : i64
    %2224 = llvm.alloca %2223 x i32 : (i64) -> !llvm.ptr
    llvm.store %2222, %2224 : i32, !llvm.ptr
    cf.br ^bb255
    ^bb255:
    %2225 = llvm.load %2224 : !llvm.ptr -> i32
    %2226 = arith.cmpi slt, %2225, %2215 : i32
    cf.cond_br %2226, ^bb256, ^bb257
    ^bb256:
      %2227 = llvm.load %2221 : !llvm.ptr -> i32
      %2228 = arith.constant 2 : i32
      %2229 = arith.muli %2227, %2228 : i32
      llvm.store %2229, %2221 : i32, !llvm.ptr
      %2230 = llvm.load %2224 : !llvm.ptr -> i32
      %2231 = arith.constant 1 : i32
      %2232 = arith.addi %2230, %2231 : i32
      llvm.store %2232, %2224 : i32, !llvm.ptr
      cf.br ^bb255
    ^bb257:
    %2233 = arith.constant 0 : i32
    %2234 = llvm.mlir.constant(1 : i64) : i64
    %2235 = llvm.alloca %2234 x i32 : (i64) -> !llvm.ptr
    llvm.store %2233, %2235 : i32, !llvm.ptr
    cf.br ^bb258
    ^bb258:
    %2236 = llvm.load %2235 : !llvm.ptr -> i32
    %2237 = arith.cmpi slt, %2236, %2217 : i32
    cf.cond_br %2237, ^bb259, ^bb260
    ^bb259:
      %2238 = llvm.load %2221 : !llvm.ptr -> i32
      %2239 = arith.constant 5 : i32
      %2240 = arith.muli %2238, %2239 : i32
      llvm.store %2240, %2221 : i32, !llvm.ptr
      %2241 = llvm.load %2235 : !llvm.ptr -> i32
      %2242 = arith.constant 1 : i32
      %2243 = arith.addi %2241, %2242 : i32
      llvm.store %2243, %2235 : i32, !llvm.ptr
      cf.br ^bb258
    ^bb260:
    %2244 = llvm.load %2221 : !llvm.ptr -> i32
    %2245 = arith.divsi %arg0, %2244 : i32
    %2246 = arith.cmpi sgt, %2215, %2217 : i32
    %2247 = scf.if %2246 -> (i32) {
      scf.yield %2215 : i32
    } else {
      scf.yield %2217 : i32
    }
    %2248 = arith.constant 1 : i32
    %2249 = arith.cmpi eq, %2247, %2248 : i32
    cf.cond_br %2249, ^bb261, ^bb262
    ^bb261:
      %2251 = llvm.load %2221 : !llvm.ptr -> i32
      %2250 = func.call @count_one_child_L1(%arg0, %2251, %2245) : (i32, i32, i32) -> i64
      func.return %2250 : i64
    ^bb262:
      cf.br ^bb263
    ^bb263:
    %2253 = llvm.load %2221 : !llvm.ptr -> i32
    %2252 = func.call @count_one_child_Lgt1(%arg0, %2253, %2245, %2247) : (i32, i32, i32, i32) -> i64
    func.return %2252 : i64
  }
  func.func @main() -> i32 {
    %2254 = arith.constant 0 : i32
    %2255 = arith.extsi %2254 : i32 to i64
    %2256 = llvm.mlir.constant(1 : i64) : i64
    %2257 = llvm.alloca %2256 x i64 : (i64) -> !llvm.ptr
    llvm.store %2255, %2257 : i64, !llvm.ptr
    %2258 = arith.constant 1 : i32
    %2259 = llvm.mlir.constant(1 : i64) : i64
    %2260 = llvm.alloca %2259 x i32 : (i64) -> !llvm.ptr
    llvm.store %2258, %2260 : i32, !llvm.ptr
    cf.br ^bb264
    ^bb264:
    %2261 = llvm.load %2260 : !llvm.ptr -> i32
    %2262 = arith.constant 20 : i32
    %2263 = arith.cmpi slt, %2261, %2262 : i32
    cf.cond_br %2263, ^bb265, ^bb266
    ^bb265:
      %2264 = llvm.load %2257 : !llvm.ptr -> i64
      %2266 = llvm.load %2260 : !llvm.ptr -> i32
      %2265 = func.call @count_one_child(%2266) : (i32) -> i64
      %2267 = arith.addi %2264, %2265 : i64
      llvm.store %2267, %2257 : i64, !llvm.ptr
      %2268 = llvm.load %2260 : !llvm.ptr -> i32
      %2269 = arith.constant 1 : i32
      %2270 = arith.addi %2268, %2269 : i32
      llvm.store %2270, %2260 : i32, !llvm.ptr
      cf.br ^bb264
    ^bb266:
    %2271 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %2272 = llvm.load %2257 : !llvm.ptr -> i64
    %2273 = llvm.call @printf(%2271, %2272) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %2274 = arith.constant 0 : i32
    func.return %2274 : i32
  }
}