Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

WebAssembly text

WAT emission from the same MIR.

Part of the MIR lane. Every panel below is compiler output.

How to read it#

A stack machine, so the arithmetic reads inside out. Useful as a check on what actually crosses into a sandboxed runtime.

Measured support#

CapableAnalyzableCoverage
45057778%

From the target matrix: how many corpus exempla lower to this target. Coverage is not a quality score — an emitter can lower a term and still erase a distinction.

Not fully supported#

Terms the matrix records as partial, planned, or unsupported for this target. A term here is a measured gap, not an omission.

CategoryTerms
Keywords — systems lane<a id="ad"></a>call, <a id="argumenta"></a>args, <a id="clausura"></a>lambda, <a id="est"></a>is, <a id="ex"></a>from, <a id="functio"></a>fn, <a id="genus"></a>class, <a id="implendum"></a>interface, <a id="implet"></a>implements, <a id="importa"></a>import, <a id="instans"></a>instant, <a id="itera"></a>for, <a id="lege"></a>read, <a id="list-b8"></a>list<b8>, <a id="lista"></a>list, <a id="numerus"></a>int, <a id="tabula"></a>map
Operators — systems lane?(, ?., <a id="list-t-size-lo-hi"></a>list<T, size lo ‥ hi>, <a id="saturating-w-lo-hi"></a>saturating<W, lo ‥ hi>, <a id="trapping-w-lo-hi"></a>trapping<W, lo ‥ hi>, <a id="wrapping-w-lo-hi"></a>wrapping<W, lo ‥ hi>, ·, ‥, ↦, ∴, ⊘, ⊙

Typed tensors#

Builds two shaped matrices, multiplies them, and reduces the product to a scalar. Exercises shape-bearing types and a reduction.

Faber source

reader locale
faber convert --to en — English reader surface
main {
    let list<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    let list<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    let tf32[2, 3] a ← flat_a ↦ tensor<f32, [2, 3]>
    let tf32[3, 4] b ← flat_b ↦ tensor<f32, [3, 4]>
    let tf32[2, 4] product ← a.matmul(b)
    let f32 mean ← product.mean()
    print mean
}
faber convert --to la — canonical Faber
incipit {
    sit lista<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    sit lista<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    sit tf32[2, 3] a ← flat_a ↦ tensor<f32, [2, 3]>
    sit tf32[3, 4] b ← flat_b ↦ tensor<f32, [3, 4]>
    sit tf32[2, 4] product ← a.matmul(b)
    sit f32 mean ← product.media()
    nota mean
}
faber convert --to th-TH — Thai
เริ่ม {
    กำหนด รายการ<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    กำหนด รายการ<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    กำหนด tf32[2, 3] a ← flat_a ↦ เทนเซอร์<f32, [2, 3]>
    กำหนด tf32[3, 4] b ← flat_b ↦ เทนเซอร์<f32, [3, 4]>
    กำหนด tf32[2, 4] product ← a.คูณเมทริกซ์(b)
    กำหนด f32 mean ← product.ค่าเฉลี่ย()
    บันทึก mean
}
faber convert --to zh-Hans — Simplified Chinese
入口 {
    设 列表<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    设 列表<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    设 tf32[2, 3] a ← flat_a ↦ 张量<f32, [2, 3]>
    设 tf32[3, 4] b ← flat_b ↦ 张量<f32, [3, 4]>
    设 tf32[2, 4] product ← a.矩阵乘法(b)
    设 f32 mean ← product.均值()
    显示 mean
}
faber convert --to zh-Hant — Traditional Chinese
入口 {
    設為 列表<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    設為 列表<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    設為 tf32[2, 3] a ← flat_a ↦ 張量<f32, [2, 3]>
    設為 tf32[3, 4] b ← flat_b ↦ 張量<f32, [3, 4]>
    設為 tf32[2, 4] product ← a.矩陣乘法(b)
    設為 f32 mean ← product.平均值()
    註記 mean
}
faber convert --to vi — Vietnamese
bắt_đầu {
    đặt danh_sách<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    đặt danh_sách<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    đặt tf32[2, 3] a ← flat_a ↦ ten_xo<f32, [2, 3]>
    đặt tf32[3, 4] b ← flat_b ↦ ten_xo<f32, [3, 4]>
    đặt tf32[2, 4] product ← a.nhân_ma_trận(b)
    đặt f32 mean ← product.trung_bình()
    ghi_chú mean
}
faber convert --to ar — Arabic
بداية {
    ليكن قائمة<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    ليكن قائمة<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    ليكن tf32[2, 3] a ← flat_a ↦ موتر<f32, [2, 3]>
    ليكن tf32[3, 4] b ← flat_b ↦ موتر<f32, [3, 4]>
    ليكن tf32[2, 4] product ← a.ضرب_المصفوفات(b)
    ليكن f32 mean ← product.المتوسط()
    اعرض mean
}
faber convert --to hi — Hindi
आरंभ {
    बैठा सूची<f32> flat_a ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
    बैठा सूची<f32> flat_b ← [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
    बैठा tf32[2, 3] a ← flat_a ↦ टेंसर<f32, [2, 3]>
    बैठा tf32[3, 4] b ← flat_b ↦ टेंसर<f32, [3, 4]>
    बैठा tf32[2, 4] product ← a.आव्यूह_गुणन(b)
    बैठा f32 mean ← product.माध्य()
    दिखाओ mean
}

WebAssembly text — 9 lines in, 142 out (15.8×)

;; Generated by radix MIR WASM text probe - experimental artifact.
(module
    (import "faber_rt_v1" "__faber_rt_v1_text_concat" (func $__faber_rt_v1_text_concat (param i32 i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_array_new" (func $__faber_rt_v1_array_new__construct (param i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_array_push" (func $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (param i32 i64) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_tensor_new" (func $__faber_rt_v1_tensor_new__construct (param i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_tensor_from_flat" (func $__faber_rt_v1_tensor_from_flat__tensor_from_flat_3_aggregate_aggregate_aggregate_to_aggregate (param i32 i32 i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_tensor_matmul" (func $__faber_rt_v1_tensor_matmul__tensor_matmul_2_aggregate_aggregate_to_aggregate (param i32 i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_tensor_mean" (func $__faber_rt_v1_tensor_mean__tensor_mean_1_aggregate_to_f64 (param i32) (result f64)))
    (import "faber_rt_v1" "__faber_rt_v1_diagnostic_nota_f64" (func $__faber_rt_v1_diagnostic_nota_f64 (param f64)))
    (memory (export "memory") 1)
    (data (i32.const 0) ", ")
    (data (i32.const 2) "0")
    (data (i32.const 3) "0x")
    (data (i32.const 5) "1")
    (data (i32.const 6) "2")
    (data (i32.const 7) "3")
    (data (i32.const 8) "4")
    (data (i32.const 9) "5")
    (data (i32.const 10) "6")
    (data (i32.const 11) "7")
    (data (i32.const 12) "8")
    (data (i32.const 13) "9")
    (data (i32.const 14) "[")
    (data (i32.const 15) "]")
    (data (i32.const 16) "a")
    (data (i32.const 17) "b")
    (data (i32.const 18) "c")
    (data (i32.const 19) "d")
    (data (i32.const 20) "e")
    (data (i32.const 21) "f")
    (data (i32.const 22) "nihil")
    (data (i32.const 27) "\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\05\00\00\00\01\00\00\00\00\00\00\00\06\00\00\00\01\00\00\00\00\00\00\00\07\00\00\00\01\00\00\00\00\00\00\00\08\00\00\00\01\00\00\00\00\00\00\00\09\00\00\00\01\00\00\00\00\00\00\00\0A\00\00\00\01\00\00\00\00\00\00\00\0B\00\00\00\01\00\00\00\00\00\00\00\0C\00\00\00\01\00\00\00\00\00\00\00\0D\00\00\00\01\00\00\00\00\00\00\00\0E\00\00\00\01\00\00\00\00\00\00\00\0F\00\00\00\01\00\00\00\00\00\00\00\10\00\00\00\01\00\00\00\00\00\00\00\11\00\00\00\01\00\00\00\00\00\00\00\12\00\00\00\01\00\00\00\00\00\00\00\13\00\00\00\01\00\00\00\00\00\00\00\14\00\00\00\01\00\00\00\00\00\00\00\15\00\00\00\01\00\00\00\00\00\00\00\16\00\00\00\05\00\00\00")
    (global (export "__faber_rt_v1_literal_table_ptr") i32 (i32.const 27))
    (global (export "__faber_rt_v1_literal_table_count") i32 (i32.const 21))
    (func $main (export "incipit")
          (local $l0 i32)
          (local $l1 i32)
          (local $l2 i32)
          (local $l3 i32)
          (local $l4 i32)
          (local $l5 f64)
          (local $t0 f64)
          (local $t1 f64)
          (local $t2 f64)
          (local $t3 f64)
          (local $t4 f64)
          (local $t5 f64)
          (local $t6 i32)
          (local $t7 f64)
          (local $t8 f64)
          (local $t9 f64)
          (local $t10 f64)
          (local $t11 f64)
          (local $t12 f64)
          (local $t13 f64)
          (local $t14 f64)
          (local $t15 f64)
          (local $t16 f64)
          (local $t17 f64)
          (local $t18 f64)
          (local $t19 i32)
          (local $t20 i32)
          (local $t21 i32)
          (local $t22 i32)
          (local $t23 i32)
          (local $t24 i32)
          (local $t25 i32)
          (local $t26 i32)
          (local $t27 f64)
          (local.set $t0 (f64.const 1.0))
          (local.set $t1 (f64.const 2.0))
          (local.set $t2 (f64.const 3.0))
          (local.set $t3 (f64.const 4.0))
          (local.set $t4 (f64.const 5.0))
          (local.set $t5 (f64.const 6.0))
          (local.set $t6 (call $__faber_rt_v1_array_new__construct (i32.const 6)))
          (local.set $t6 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t6) (i64.reinterpret_f64 (local.get $t0))))
          (local.set $t6 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t6) (i64.reinterpret_f64 (local.get $t1))))
          (local.set $t6 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t6) (i64.reinterpret_f64 (local.get $t2))))
          (local.set $t6 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t6) (i64.reinterpret_f64 (local.get $t3))))
          (local.set $t6 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t6) (i64.reinterpret_f64 (local.get $t4))))
          (local.set $t6 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t6) (i64.reinterpret_f64 (local.get $t5))))
          (local.set $l0 (local.get $t6))
          (local.set $t7 (f64.const 1.0))
          (local.set $t8 (f64.const 2.0))
          (local.set $t9 (f64.const 3.0))
          (local.set $t10 (f64.const 4.0))
          (local.set $t11 (f64.const 5.0))
          (local.set $t12 (f64.const 6.0))
          (local.set $t13 (f64.const 7.0))
          (local.set $t14 (f64.const 8.0))
          (local.set $t15 (f64.const 9.0))
          (local.set $t16 (f64.const 10.0))
          (local.set $t17 (f64.const 11.0))
          (local.set $t18 (f64.const 12.0))
          (local.set $t19 (call $__faber_rt_v1_array_new__construct (i32.const 6)))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t7))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t8))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t9))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t10))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t11))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t12))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t13))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t14))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t15))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t16))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t17))))
          (local.set $t19 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t19) (i64.reinterpret_f64 (local.get $t18))))
          (local.set $l1 (local.get $t19))
          (local.set $t20 (call $__faber_rt_v1_array_new__construct (i32.const 4)))
          (local.set $t20 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t20) (i64.const 2)))
          (local.set $t20 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t20) (i64.const 3)))
          (local.set $t21 (call $__faber_rt_v1_tensor_new__construct (i32.const 6)))
          (local.set $t22 (call $__faber_rt_v1_tensor_from_flat__tensor_from_flat_3_aggregate_aggregate_aggregate_to_aggregate (local.get $t21) (local.get $l0) (local.get $t20)))
          (local.set $l2 (local.get $t22))
          (local.set $t23 (call $__faber_rt_v1_array_new__construct (i32.const 4)))
          (local.set $t23 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t23) (i64.const 3)))
          (local.set $t23 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t23) (i64.const 4)))
          (local.set $t24 (call $__faber_rt_v1_tensor_new__construct (i32.const 6)))
          (local.set $t25 (call $__faber_rt_v1_tensor_from_flat__tensor_from_flat_3_aggregate_aggregate_aggregate_to_aggregate (local.get $t24) (local.get $l1) (local.get $t23)))
          (local.set $l3 (local.get $t25))
          (local.set $t26 (call $__faber_rt_v1_tensor_matmul__tensor_matmul_2_aggregate_aggregate_to_aggregate (local.get $l2) (local.get $l3)))
          (local.set $l4 (local.get $t26))
          (local.set $t27 (call $__faber_rt_v1_tensor_mean__tensor_mean_1_aggregate_to_f64 (local.get $l4)))
          (local.set $l5 (local.get $t27))
          (call $__faber_rt_v1_diagnostic_nota_f64 (local.get $l5))
          (return)
    )
    (func $faber_bits_hex (param $v i64) (param $n i32) (result i32)
      (local $h i32) (local $i i32) (local $d i32)
      (local.set $h (i32.const 2))
      (local.set $i (local.get $n))
      (block $done
        (loop $next
          (br_if $done (i32.eqz (local.get $i)))
          (local.set $i (i32.sub (local.get $i) (i32.const 1)))
          (local.set $d (i32.wrap_i64 (i64.and (i64.shr_u (local.get $v) (i64.extend_i32_u (i32.shl (local.get $i) (i32.const 2)))) (i64.const 15))))
          (local.set $h (call $__faber_rt_v1_text_concat (local.get $h) (select (i32.const 19) (select (i32.const 18) (select (i32.const 17) (select (i32.const 16) (select (i32.const 15) (select (i32.const 14) (select (i32.const 11) (select (i32.const 10) (select (i32.const 9) (select (i32.const 8) (select (i32.const 7) (select (i32.const 6) (select (i32.const 5) (select (i32.const 4) (select (i32.const 3) (i32.const 1) (i32.eq (local.get $d) (i32.const 1))) (i32.eq (local.get $d) (i32.const 2))) (i32.eq (local.get $d) (i32.const 3))) (i32.eq (local.get $d) (i32.const 4))) (i32.eq (local.get $d) (i32.const 5))) (i32.eq (local.get $d) (i32.const 6))) (i32.eq (local.get $d) (i32.const 7))) (i32.eq (local.get $d) (i32.const 8))) (i32.eq (local.get $d) (i32.const 9))) (i32.eq (local.get $d) (i32.const 10))) (i32.eq (local.get $d) (i32.const 11))) (i32.eq (local.get $d) (i32.const 12))) (i32.eq (local.get $d) (i32.const 13))) (i32.eq (local.get $d) (i32.const 14))) (i32.eq (local.get $d) (i32.const 15)))))
          (br $next)))
      (local.get $h))
)

The error channel#

A function that may fail, and a caller that catches. Shows how the ⇥ channel becomes each target's own error idiom.

Faber source

reader locale
faber convert --to en — English reader surface
fn divide(int a, int b) → int ⇥ string {
    if b ≡ 0 {
        throw "division by zero"
    }
    return a / b
}

main {
    do {
        print divide(10, 2)
    }
    catch err {
        warn err
    }
}
faber convert --to la — canonical Faber
functio divide(numerus a, numerus b) → numerus ⇥ textus {
    si b ≡ 0 {
        iace "division by zero"
    }
    redde a / b
}

incipit {
    fac {
        nota divide(10, 2)
    }
    cape err {
        mone err
    }
}
faber convert --to th-TH — Thai
ฟังก์ชัน divide(จํานวน a, จํานวน b) → จํานวน ⇥ ข้อความ {
    ถ้า b ≡ 0 {
        โยน "division by zero"
    }
    คืน a / b
}

เริ่ม {
    ทำ {
        บันทึก divide(10, 2)
    }
    จับ err {
        เตือน err
    }
}
faber convert --to zh-Hans — Simplified Chinese
函数 divide(整数 a, 整数 b) → 整数 ⇥ 文本 {
    如果 b ≡ 0 {
        抛错 "division by zero"
    }
    返回 a / b
}

入口 {
    执行 {
        显示 divide(10, 2)
    }
    捕获 err {
        警告 err
    }
}
faber convert --to zh-Hant — Traditional Chinese
函式 divide(整數 a, 整數 b) → 整數 ⇥ 文字 {
    若 b ≡ 0 {
        拋出 "division by zero"
    }
    傳回 a / b
}

入口 {
    執行 {
        註記 divide(10, 2)
    }
    捕捉 err {
        警告 err
    }
}
faber convert --to vi — Vietnamese
hàm divide(số a, số b) → số ⇥ văn_bản {
    nếu b ≡ 0 {
        ném "division by zero"
    }
    trả a / b
}

bắt_đầu {
    làm {
        ghi_chú divide(10, 2)
    }
    bắt err {
        cảnh_báo err
    }
}
faber convert --to ar — Arabic
دالة divide(عدد a, عدد b) → عدد ⇥ نص {
    إذا b ≡ 0 {
        ارم "division by zero"
    }
    أعد a / b
}

بداية {
    افعل {
        اعرض divide(10, 2)
    }
    التقط err {
        نبه err
    }
}
faber convert --to hi — Hindi
फलन divide(संख्या a, संख्या b) → संख्या ⇥ पाठ {
    यदि b ≡ 0 {
        इधरफेंको "division by zero"
    }
    लौटाओ a / b
}

आरंभ {
    करो {
        दिखाओ divide(10, 2)
    }
    पकड़ो err {
        चेताओ err
    }
}

WebAssembly text — 13 lines in, 500 out (38.5×)

;; Generated by radix MIR WASM text probe - experimental artifact.
(module
    (import "faber_rt_v1" "__faber_rt_v1_text_concat" (func $__faber_rt_v1_text_concat (param i32 i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_diagnostic_mone_ptr" (func $__faber_rt_v1_diagnostic_mone_ptr__text_handle (param i32)))
    (import "faber_rt_v1" "__faber_rt_v1_diagnostic_nota_i64" (func $__faber_rt_v1_diagnostic_nota_i64 (param i64)))
    (import "faber_rt_v1" "__faber_rt_v1_assert_message" (func $__faber_rt_v1_assert_message (param i32 i32)))
    (import "faber_rt_v1" "__faber_rt_v1_format_i64" (func $__faber_rt_v1_format_i64 (param i32 i64) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_format_i64_i64" (func $__faber_rt_v1_format_i64_i64 (param i32 i64 i64) (result i32)))
    (memory (export "memory") 1)
    (data (i32.const 0) ", ")
    (data (i32.const 2) "0")
    (data (i32.const 3) "0x")
    (data (i32.const 5) "1")
    (data (i32.const 6) "2")
    (data (i32.const 7) "3")
    (data (i32.const 8) "4")
    (data (i32.const 9) "5")
    (data (i32.const 10) "6")
    (data (i32.const 11) "7")
    (data (i32.const 12) "8")
    (data (i32.const 13) "9")
    (data (i32.const 14) "[")
    (data (i32.const 15) "]")
    (data (i32.const 16) "a")
    (data (i32.const 17) "b")
    (data (i32.const 18) "c")
    (data (i32.const 19) "d")
    (data (i32.const 20) "division by zero")
    (data (i32.const 36) "e")
    (data (i32.const 37) "f")
    (data (i32.const 38) "fractus to numerus conversion out of range")
    (data (i32.const 80) "modulus division failed")
    (data (i32.const 103) "negative shift count")
    (data (i32.const 123) "nihil")
    (data (i32.const 128) "numerus division failed")
    (data (i32.const 151) "numerus overflow")
    (data (i32.const 167) "numerus to numerus conversion out of range")
    (data (i32.const 209) "\C2\A7 does not fit in `i64` (return)")
    (data (i32.const 242) "\C2\A7\C2\A7 does not fit in `i64` (return)")
    (data (i32.const 277) "\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\05\00\00\00\01\00\00\00\00\00\00\00\06\00\00\00\01\00\00\00\00\00\00\00\07\00\00\00\01\00\00\00\00\00\00\00\08\00\00\00\01\00\00\00\00\00\00\00\09\00\00\00\01\00\00\00\00\00\00\00\0A\00\00\00\01\00\00\00\00\00\00\00\0B\00\00\00\01\00\00\00\00\00\00\00\0C\00\00\00\01\00\00\00\00\00\00\00\0D\00\00\00\01\00\00\00\00\00\00\00\0E\00\00\00\01\00\00\00\00\00\00\00\0F\00\00\00\01\00\00\00\00\00\00\00\10\00\00\00\01\00\00\00\00\00\00\00\11\00\00\00\01\00\00\00\00\00\00\00\12\00\00\00\01\00\00\00\00\00\00\00\13\00\00\00\01\00\00\00\00\00\00\00\14\00\00\00\10\00\00\00\00\00\00\00\24\00\00\00\01\00\00\00\00\00\00\00\25\00\00\00\01\00\00\00\00\00\00\00\26\00\00\00\2A\00\00\00\00\00\00\00\50\00\00\00\17\00\00\00\00\00\00\00\67\00\00\00\14\00\00\00\00\00\00\00\7B\00\00\00\05\00\00\00\00\00\00\00\80\00\00\00\17\00\00\00\00\00\00\00\97\00\00\00\10\00\00\00\00\00\00\00\A7\00\00\00\2A\00\00\00\00\00\00\00\D1\00\00\00\21\00\00\00\00\00\00\00\F2\00\00\00\23\00\00\00")
    (global (export "__faber_rt_v1_literal_table_ptr") i32 (i32.const 277))
    (global (export "__faber_rt_v1_literal_table_count") i32 (i32.const 30))
    (global $__faber_error_flag (mut i32) (i32.const 0))
    (global $__faber_error_i32 (mut i32) (i32.const 0))
    (func $divide (export "divide") (param $l0 i64) (param $l1 i64) (result i64)
          (local $t0 i32)
          (local $t1 i32)
          (local $t2 i64)
          (local $t2_x i64)
          (local $t2_h i32)
          (local $t3 i64)
          (local $p0 i32)
          (local.set $p0 (i32.const 0))
          (loop $dispatch
              (if (i32.eq (local.get $p0) (i32.const 0))
                  (then
                      ;; v0 = (i64.eq (local.get $l1) (i64.const 0))
                      (local.set $t0 (i64.eq (local.get $l1) (i64.const 0)))
                      (if (local.get $t0)
                          (then
                              (local.set $p0 (i32.const 1))
                              (br $dispatch)
                          )
                          (else
                              (local.set $p0 (i32.const 2))
                              (br $dispatch)
                          )
                      )
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 1))
                  (then
                      (local.set $t1 (i32.const 18))
                      (global.set $__faber_error_i32 (local.get $t1))
                      (global.set $__faber_error_flag (i32.const 1))
                      (return (i64.const 0))
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 2))
                  (then
                      ;; v2 = (call $faber_x_bin (i32.const 3) (local.get $l0) (i32.const 0) (local.get $l1) (i32.const 0) (i32.const 0) (i32.const 1))
                      (local.set $t2_x (call $faber_x_bin (i32.const 3) (local.get $l0) (i32.const 0) (local.get $l1) (i32.const 0) (i32.const 0) (i32.const 1)))
                      (local.set $t2_h (global.get $faber_x_hi))
                      (local.set $t3 (call $faber_x_store_t (local.get $t2_x) (local.get $t2_h) (i32.const 64) (i32.const 1) (i32.const 28) (i32.const 29) (i32.const 28)))
                      (return (local.get $t3))
                  )
              )
              (unreachable)
          )
          (unreachable)
    )
    (func $main (export "incipit")
          (local $l0 i32)
          (local $t0 i64)
          (local $p0 i32)
          (local.set $p0 (i32.const 0))
          (loop $dispatch
              (if (i32.eq (local.get $p0) (i32.const 0))
                  (then
                      (local.set $t0 (call $divide (i64.const 10) (i64.const 2)))
                      (if (global.get $__faber_error_flag)
                          (then
                              (global.set $__faber_error_flag (i32.const 0))
                              (local.set $l0 (global.get $__faber_error_i32))
                              (local.set $p0 (i32.const 1))
                              (br $dispatch)
                          )
                      )
                      (local.set $p0 (i32.const 4))
                      (br $dispatch)
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 1))
                  (then
                      (call $__faber_rt_v1_diagnostic_mone_ptr__text_handle (local.get $l0))
                      (local.set $p0 (i32.const 2))
                      (br $dispatch)
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 2))
                  (then
                      (return)
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 3))
                  (then
                      (local.set $p0 (i32.const 2))
                      (br $dispatch)
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 4))
                  (then
                      (call $__faber_rt_v1_diagnostic_nota_i64 (local.get $t0))
                      (local.set $p0 (i32.const 3))
                      (br $dispatch)
                  )
              )
              (unreachable)
          )
          (unreachable)
    )

    (global $faber_x_hi (mut i32) (i32.const 0))
    (func $faber_x_neg (param $a i64) (param $u i32) (result i32)
      (i32.and (i32.eqz (local.get $u)) (i64.lt_s (local.get $a) (i64.const 0))))
    (func $faber_x_mag (param $a i64) (param $u i32) (result i64)
      (if (result i64) (call $faber_x_neg (local.get $a) (local.get $u))
        (then (i64.sub (i64.const 0) (local.get $a)))
        (else (local.get $a))))
    (func $faber_x_pack (param $mag i64) (param $neg i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $limit i64)
      (if (i64.eqz (local.get $mag)) (then (local.set $neg (i32.const 0))))
      (if (i32.eqz (local.get $rbits))
        (then
          (if (local.get $neg)
            (then
              (if (i64.gt_u (local.get $mag) (i64.const -9223372036854775808)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (global.set $faber_x_hi (i32.const 0))
              (return (i64.sub (i64.const 0) (local.get $mag)))))
          (global.set $faber_x_hi (i64.lt_s (local.get $mag) (i64.const 0)))
          (return (local.get $mag))))
      (if (local.get $neg)
        (then
          (if (i32.eqz (local.get $rsigned)) (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable)))
          (if (i64.gt_u (local.get $mag)
                (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1)))))
            (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable)))
          (return (i64.sub (i64.const 0) (local.get $mag)))))
      (if (i32.and (i32.eq (local.get $rbits) (i32.const 64)) (local.get $rsigned))
        (then (if (i64.lt_s (local.get $mag) (i64.const 0)) (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable))))
        (else
          (if (i32.lt_u (local.get $rbits) (i32.const 64))
            (then
              (local.set $limit
                (i64.sub
                  (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (local.get $rsigned))))
                  (i64.const 1)))
              (if (i64.gt_u (local.get $mag) (local.get $limit)) (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable)))))))
      (local.get $mag))
    (func $faber_x_bin (param $op i32) (param $a i64) (param $au i32) (param $b i64) (param $bu i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $an i32) (local $bn i32) (local $am i64) (local $bm i64) (local $m i64) (local $n i32)
      (local $q i64) (local $r i64) (local $ahi i64) (local $bhi i64) (local $hi i64) (local $lo i64)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $bn (call $faber_x_neg (local.get $b) (local.get $bu)))
      (local.set $am (call $faber_x_mag (local.get $a) (local.get $au)))
      (local.set $bm (call $faber_x_mag (local.get $b) (local.get $bu)))
      (if (i32.le_u (local.get $op) (i32.const 1))
        (then
          (if (i32.eq (local.get $op) (i32.const 1)) (then (local.set $bn (i32.eqz (local.get $bn)))))
          (if (i32.eq (local.get $an) (local.get $bn))
            (then
              (local.set $m (i64.add (local.get $am) (local.get $bm)))
              (if (i64.lt_u (local.get $m) (local.get $am)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (local.set $n (local.get $an)))
            (else
              (if (i64.ge_u (local.get $am) (local.get $bm))
                (then
                  (local.set $m (i64.sub (local.get $am) (local.get $bm)))
                  (local.set $n (local.get $an)))
                (else
                  (local.set $m (i64.sub (local.get $bm) (local.get $am)))
                  (local.set $n (local.get $bn))))))
          (return (call $faber_x_pack (local.get $m) (local.get $n) (local.get $rbits) (local.get $rsigned)))))
      (if (i32.eq (local.get $op) (i32.const 2))
        (then
          (if (i32.and (i64.ne (local.get $am) (i64.const 0)) (i64.ne (local.get $bm) (i64.const 0)))
            (then
              (if (i64.gt_u (local.get $am) (i64.div_u (i64.const -1) (local.get $bm)))
                (then (call $faber_x_trap (i32.const 0)) (unreachable)))))
          (return (call $faber_x_pack (i64.mul (local.get $am) (local.get $bm))
            (i32.xor (local.get $an) (local.get $bn)) (local.get $rbits) (local.get $rsigned)))))
      (if (i32.or (i32.eq (local.get $op) (i32.const 3)) (i32.eq (local.get $op) (i32.const 4)))
        (then
          (if (i64.eqz (local.get $bm)) (then (call $faber_x_trap (i32.const 1)) (unreachable)))
          (local.set $q (i64.div_u (local.get $am) (local.get $bm)))
          (local.set $r (i64.rem_u (local.get $am) (local.get $bm)))
          (if (i32.eq (local.get $op) (i32.const 3))
            (then
              (local.set $n (i32.xor (local.get $an) (local.get $bn)))
              (if (i32.and (local.get $n) (i64.ne (local.get $r) (i64.const 0)))
                (then (local.set $q (i64.add (local.get $q) (i64.const 1)))))
              (return (call $faber_x_pack (local.get $q) (local.get $n) (local.get $rbits) (local.get $rsigned))))
            (else
              (if (i64.eqz (local.get $r))
                (then (return (call $faber_x_pack (i64.const 0) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
              (if (i32.eq (local.get $an) (local.get $bn))
                (then (return (call $faber_x_pack (local.get $r) (local.get $bn) (local.get $rbits) (local.get $rsigned)))))
              (return (call $faber_x_pack (i64.sub (local.get $bm) (local.get $r)) (local.get $bn)
                (local.get $rbits) (local.get $rsigned)))))))
      (if (i32.and (i32.ge_u (local.get $op) (i32.const 5)) (i32.le_u (local.get $op) (i32.const 7)))
        (then
          (local.set $ahi (select (i64.const 0) (i64.shr_s (local.get $a) (i64.const 63)) (local.get $au)))
          (local.set $bhi (select (i64.const 0) (i64.shr_s (local.get $b) (i64.const 63)) (local.get $bu)))
          (if (i32.eq (local.get $op) (i32.const 5))
            (then
              (local.set $lo (i64.and (local.get $a) (local.get $b)))
              (local.set $hi (i64.and (local.get $ahi) (local.get $bhi))))
            (else
              (if (i32.eq (local.get $op) (i32.const 6))
                (then
                  (local.set $lo (i64.or (local.get $a) (local.get $b)))
                  (local.set $hi (i64.or (local.get $ahi) (local.get $bhi))))
                (else
                  (local.set $lo (i64.xor (local.get $a) (local.get $b)))
                  (local.set $hi (i64.xor (local.get $ahi) (local.get $bhi)))))))
          (if (i64.eqz (local.get $hi))
            (then (return (call $faber_x_pack (local.get $lo) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
          (if (i32.and (i64.eq (local.get $hi) (i64.const -1)) (i64.lt_s (local.get $lo) (i64.const 0)))
            (then (return (call $faber_x_pack (i64.sub (i64.const 0) (local.get $lo)) (i32.const 1)
              (local.get $rbits) (local.get $rsigned)))))
          (call $faber_x_trap (i32.const 0)) (unreachable)))
      (if (i32.ge_u (local.get $op) (i32.const 8))
        (then
          (if (local.get $bn) (then (call $faber_x_trap (i32.const 2)) (unreachable)))
          (if (i32.eq (local.get $op) (i32.const 8))
            (then
              (if (i64.eqz (local.get $am))
                (then (return (call $faber_x_pack (i64.const 0) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
              (if (i64.ge_u (local.get $bm) (i64.const 64)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (local.set $m (i64.shl (local.get $am) (local.get $bm)))
              (if (i64.ne (i64.shr_u (local.get $m) (local.get $bm)) (local.get $am)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (return (call $faber_x_pack (local.get $m) (local.get $an) (local.get $rbits) (local.get $rsigned))))
            (else
              (if (i32.eqz (local.get $an))
                (then
                  (return (call $faber_x_pack
                    (select (i64.const 0) (i64.shr_u (local.get $am) (local.get $bm))
                      (i64.ge_u (local.get $bm) (i64.const 64)))
                    (i32.const 0) (local.get $rbits) (local.get $rsigned))))
                (else
                  (if (i64.ge_u (local.get $bm) (i64.const 64))
                    (then (return (call $faber_x_pack (i64.const 1) (i32.const 1) (local.get $rbits) (local.get $rsigned)))))
                  (return (call $faber_x_pack
                    (i64.add (i64.shr_u (i64.sub (local.get $am) (i64.const 1)) (local.get $bm)) (i64.const 1))
                    (i32.const 1) (local.get $rbits) (local.get $rsigned)))))))))
      (unreachable))
    (func $faber_x_un (param $op i32) (param $a i64) (param $au i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $an i32) (local $am i64)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $am (call $faber_x_mag (local.get $a) (local.get $au)))
      (if (i32.eqz (local.get $op))
        (then (return (call $faber_x_pack (local.get $am) (i32.eqz (local.get $an)) (local.get $rbits) (local.get $rsigned)))))
      (if (local.get $an)
        (then (return (call $faber_x_pack (i64.sub (local.get $am) (i64.const 1)) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (if (i64.eq (local.get $am) (i64.const -1)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
      (call $faber_x_pack (i64.add (local.get $am) (i64.const 1)) (i32.const 1) (local.get $rbits) (local.get $rsigned)))
    (func $faber_x_clamp (param $m i64) (param $n i32) (param $ovf i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $lim i64)
      (if (i32.and (local.get $n) (i64.ne (local.get $m) (i64.const 0)))
        (then
          (if (i32.eqz (local.get $rsigned)) (then (return (i64.const 0))))
          (local.set $lim
            (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1)))))
          (if (i32.or (local.get $ovf) (i64.gt_u (local.get $m) (local.get $lim)))
            (then (return (i64.sub (i64.const 0) (local.get $lim)))))
          (return (i64.sub (i64.const 0) (local.get $m)))))
      (if (local.get $rsigned)
        (then
          (local.set $lim
            (i64.sub
              (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1))))
              (i64.const 1))))
        (else
          (if (i32.eq (local.get $rbits) (i32.const 64))
            (then (local.set $lim (i64.const -1)))
            (else
              (local.set $lim
                (i64.sub (i64.shl (i64.const 1) (i64.extend_i32_u (local.get $rbits))) (i64.const 1)))))))
      (if (i32.or (local.get $ovf) (i64.gt_u (local.get $m) (local.get $lim)))
        (then (return (local.get $lim))))
      (local.get $m))
    (func $faber_x_sbin (param $op i32) (param $a i64) (param $au i32) (param $b i64) (param $bu i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $an i32) (local $bn i32) (local $am i64) (local $bm i64) (local $m i64) (local $n i32)
      (local $ovf i32) (local $q i64) (local $r i64)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $bn (call $faber_x_neg (local.get $b) (local.get $bu)))
      (local.set $am (call $faber_x_mag (local.get $a) (local.get $au)))
      (local.set $bm (call $faber_x_mag (local.get $b) (local.get $bu)))
      (if (i32.le_u (local.get $op) (i32.const 1))
        (then
          (if (i32.eq (local.get $op) (i32.const 1)) (then (local.set $bn (i32.eqz (local.get $bn)))))
          (if (i32.eq (local.get $an) (local.get $bn))
            (then
              (local.set $m (i64.add (local.get $am) (local.get $bm)))
              (if (i64.lt_u (local.get $m) (local.get $am))
                (then (local.set $ovf (i32.const 1)) (local.set $m (i64.const 1))))
              (local.set $n (local.get $an)))
            (else
              (if (i64.ge_u (local.get $am) (local.get $bm))
                (then
                  (local.set $m (i64.sub (local.get $am) (local.get $bm)))
                  (local.set $n (local.get $an)))
                (else
                  (local.set $m (i64.sub (local.get $bm) (local.get $am)))
                  (local.set $n (local.get $bn))))))
          (return (call $faber_x_clamp (local.get $m) (local.get $n) (local.get $ovf) (local.get $rbits) (local.get $rsigned)))))
      (if (i32.eq (local.get $op) (i32.const 2))
        (then
          (local.set $m (i64.mul (local.get $am) (local.get $bm)))
          (if (i32.and (i64.ne (local.get $am) (i64.const 0)) (i64.ne (local.get $bm) (i64.const 0)))
            (then
              (if (i64.gt_u (local.get $am) (i64.div_u (i64.const -1) (local.get $bm)))
                (then (local.set $ovf (i32.const 1)) (local.set $m (i64.const 1))))))
          (return (call $faber_x_clamp (local.get $m) (i32.xor (local.get $an) (local.get $bn)) (local.get $ovf) (local.get $rbits) (local.get $rsigned)))))
      (if (i64.eqz (local.get $bm)) (then (call $faber_x_trap (i32.const 1)) (unreachable)))
      (local.set $q (i64.div_u (local.get $am) (local.get $bm)))
      (local.set $r (i64.rem_u (local.get $am) (local.get $bm)))
      (if (i32.eq (local.get $op) (i32.const 3))
        (then
          (local.set $n (i32.xor (local.get $an) (local.get $bn)))
          (if (i32.and (local.get $n) (i64.ne (local.get $r) (i64.const 0)))
            (then (local.set $q (i64.add (local.get $q) (i64.const 1)))))
          (return (call $faber_x_clamp (local.get $q) (local.get $n) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (if (i64.eqz (local.get $r))
        (then (return (i64.const 0))))
      (if (i32.eq (local.get $an) (local.get $bn))
        (then (return (call $faber_x_clamp (local.get $r) (local.get $bn) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (call $faber_x_clamp (i64.sub (local.get $bm) (local.get $r)) (local.get $bn) (i32.const 0) (local.get $rbits) (local.get $rsigned)))
    (func $faber_x_store (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (param $policy i32) (result i64)
      (if (i32.eq (local.get $policy) (i32.const 1))
        (then
          (if (i32.lt_u (local.get $rbits) (i32.const 64))
            (then
              (if (local.get $rsigned)
                (then (return (i64.shr_s
                  (i64.shl (local.get $v) (i64.extend_i32_u (i32.sub (i32.const 64) (local.get $rbits))))
                  (i64.extend_i32_u (i32.sub (i32.const 64) (local.get $rbits)))))))
              (return (i64.and (local.get $v)
                (i64.sub (i64.shl (i64.const 1) (i64.extend_i32_u (local.get $rbits))) (i64.const 1))))))
          (return (local.get $v))))
      (if (i32.eq (local.get $policy) (i32.const 2))
        (then
          (return (call $faber_x_clamp (call $faber_x_mag (local.get $v) (local.get $vu))
            (call $faber_x_neg (local.get $v) (local.get $vu)) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (call $faber_x_pack (call $faber_x_mag (local.get $v) (local.get $vu))
        (call $faber_x_neg (local.get $v) (local.get $vu)) (local.get $rbits) (local.get $rsigned)))
    (func $faber_x_cmp (param $a i64) (param $au i32) (param $b i64) (param $bu i32) (result i32)
      (local $an i32) (local $bn i32)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $bn (call $faber_x_neg (local.get $b) (local.get $bu)))
      (if (i32.ne (local.get $an) (local.get $bn))
        (then (return (select (i32.const -1) (i32.const 1) (local.get $an)))))
      (if (local.get $an)
        (then
          (if (i64.lt_s (local.get $a) (local.get $b)) (then (return (i32.const -1))))
          (return (i64.gt_s (local.get $a) (local.get $b)))))
      (if (i64.lt_u (local.get $a) (local.get $b)) (then (return (i32.const -1))))
      (i64.gt_u (local.get $a) (local.get $b)))
    (func $faber_x_cmpf (param $a i64) (param $au i32) (param $f f64) (result i32)
      (local $whole f64) (local $frac f64) (local $wbits i64) (local $wu i32) (local $c i32)
      (if (f64.ne (local.get $f) (local.get $f)) (then (return (i32.const 2))))
      (if (f64.ge (local.get $f) (f64.const 18446744073709551616)) (then (return (i32.const -1))))
      (if (f64.lt (local.get $f) (f64.const -9223372036854775808)) (then (return (i32.const 1))))
      (local.set $whole (f64.trunc (local.get $f)))
      (local.set $frac (f64.sub (local.get $f) (local.get $whole)))
      (if (f64.ge (local.get $whole) (f64.const 9223372036854775808))
        (then
          (local.set $wbits (i64.trunc_f64_u (local.get $whole)))
          (local.set $wu (i32.const 1)))
        (else
          (local.set $wbits (i64.trunc_f64_s (local.get $whole)))))
      (local.set $c (call $faber_x_cmp (local.get $a) (local.get $au) (local.get $wbits) (local.get $wu)))
      (if (local.get $c) (then (return (local.get $c))))
      (if (f64.gt (local.get $frac) (f64.const 0)) (then (return (i32.const -1))))
      (select (i32.const 1) (i32.const 0) (f64.lt (local.get $frac) (f64.const 0))))
    (global $faber_x_site (mut i32) (i32.const -1))
    (global $faber_x_site_big (mut i32) (i32.const -1))
    (global $faber_x_site_neg (mut i32) (i32.const -1))
    (func $faber_x_store_t (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (param $tpl i32) (param $big i32) (param $negtpl i32) (result i64)
      (local $r i64)
      (global.set $faber_x_site (local.get $tpl))
      (global.set $faber_x_site_big (local.get $big))
      (global.set $faber_x_site_neg (local.get $negtpl))
      (local.set $r (call $faber_x_store (local.get $v) (local.get $vu) (local.get $rbits) (local.get $rsigned) (i32.const 0)))
      (global.set $faber_x_site (i32.const -1))
      (local.get $r))
    (func $faber_x_conv (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $r i64)
      (global.set $faber_x_site (i32.const -2))
      (local.set $r (call $faber_x_store (local.get $v) (local.get $vu) (local.get $rbits) (local.get $rsigned) (i32.const 0)))
      (global.set $faber_x_site (i32.const -1))
      (local.get $r))
    (func $faber_x_conv_ok (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (result i32)
      (local $c i64) (local $cu i32)
      ;; Policy 2 clamps with the same limits `$faber_x_store` traps on and never
      ;; traps itself, so the clamped value differs from the original exactly when
      ;; the original does not fit the target range. `$faber_x_cmp` compares the
      ;; two exact values; the clamped `u64` boundary above 2^63 reads unsigned.
      (local.set $c (call $faber_x_store (local.get $v) (local.get $vu) (local.get $rbits) (local.get $rsigned) (i32.const 2)))
      (local.set $cu (i32.and (i32.eq (local.get $rbits) (i32.const 64))
        (i32.and (i32.eqz (local.get $rsigned)) (i64.lt_s (local.get $c) (i64.const 0)))))
      (i32.eqz (call $faber_x_cmp (local.get $v) (local.get $vu) (local.get $c) (local.get $cu))))
    (func $faber_x_f2i (param $f f64) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $t f64) (local $half f64)
      (if (f64.ne (local.get $f) (local.get $f))
        (then (call $faber_x_trap (i32.const 4)) (unreachable)))
      (local.set $t (f64.trunc (local.get $f)))
      (local.set $half
        (f64.convert_i64_u (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1))))))
      (if (local.get $rsigned)
        (then
          (if (i32.or (f64.lt (local.get $t) (f64.neg (local.get $half))) (f64.ge (local.get $t) (local.get $half)))
            (then (call $faber_x_trap (i32.const 4)) (unreachable)))
          (return (i64.trunc_f64_s (local.get $t)))))
      (if (i32.or (f64.lt (local.get $t) (f64.const 0)) (f64.ge (local.get $t) (f64.mul (local.get $half) (f64.const 2))))
        (then (call $faber_x_trap (i32.const 4)) (unreachable)))
      (i64.trunc_f64_u (local.get $t)))
    (func $faber_x_f2i_ok (param $f f64) (param $rbits i32) (param $rsigned i32) (result i32)
      (local $t f64) (local $half f64)
      ;; The non-trapping twin of `$faber_x_f2i`: 0 exactly on its three trap
      ;; conditions (NaN, below the signed/unsigned minimum, at or above the
      ;; maximum), 1 otherwise. A guarded recovery probe must never trap.
      (if (f64.ne (local.get $f) (local.get $f))
        (then (return (i32.const 0))))
      (local.set $t (f64.trunc (local.get $f)))
      (local.set $half
        (f64.convert_i64_u (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1))))))
      (if (local.get $rsigned)
        (then
          (if (i32.or (f64.lt (local.get $t) (f64.neg (local.get $half))) (f64.ge (local.get $t) (local.get $half)))
            (then (return (i32.const 0)))))
        (else
          (if (i32.or (f64.lt (local.get $t) (f64.const 0)) (f64.ge (local.get $t) (f64.mul (local.get $half) (f64.const 2))))
            (then (return (i32.const 0))))))
      (i32.const 1))
    (func $faber_x_trap (param $k i32)
      (if (i32.eq (local.get $k) (i32.const 0)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 26))))
      (if (i32.eq (local.get $k) (i32.const 1)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 25))))
      (if (i32.eq (local.get $k) (i32.const 2)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 23))))
      (if (i32.eq (local.get $k) (i32.const 3)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 27))))
      (if (i32.eq (local.get $k) (i32.const 4)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 21))))
      (if (i32.eq (local.get $k) (i32.const 5)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 22))))
      (unreachable))
    (func $faber_x_range_fail (param $mag i64) (param $neg i32)
      (local $h i32)
      (if (i32.eq (global.get $faber_x_site) (i32.const -2))
        (then (call $faber_x_trap (i32.const 3))))
      (if (i32.lt_s (global.get $faber_x_site) (i32.const 0))
        (then (call $faber_x_trap (i32.const 0))))
      (if (local.get $neg)
        (then (local.set $h (call $__faber_rt_v1_format_i64 (global.get $faber_x_site_neg) (i64.sub (i64.const 0) (local.get $mag)))))
        (else
          (if (i64.lt_s (local.get $mag) (i64.const 0))
            (then (local.set $h (call $__faber_rt_v1_format_i64_i64 (global.get $faber_x_site_big) (i64.div_u (local.get $mag) (i64.const 10)) (i64.rem_u (local.get $mag) (i64.const 10)))))
            (else (local.set $h (call $__faber_rt_v1_format_i64 (global.get $faber_x_site) (local.get $mag)))))))
      (call $__faber_rt_v1_assert_message (i32.const 0) (local.get $h))
      (unreachable))
    (func $faber_bits_hex (param $v i64) (param $n i32) (result i32)
      (local $h i32) (local $i i32) (local $d i32)
      (local.set $h (i32.const 2))
      (local.set $i (local.get $n))
      (block $done
        (loop $next
          (br_if $done (i32.eqz (local.get $i)))
          (local.set $i (i32.sub (local.get $i) (i32.const 1)))
          (local.set $d (i32.wrap_i64 (i64.and (i64.shr_u (local.get $v) (i64.extend_i32_u (i32.shl (local.get $i) (i32.const 2)))) (i64.const 15))))
          (local.set $h (call $__faber_rt_v1_text_concat (local.get $h) (select (i32.const 20) (select (i32.const 19) (select (i32.const 17) (select (i32.const 16) (select (i32.const 15) (select (i32.const 14) (select (i32.const 11) (select (i32.const 10) (select (i32.const 9) (select (i32.const 8) (select (i32.const 7) (select (i32.const 6) (select (i32.const 5) (select (i32.const 4) (select (i32.const 3) (i32.const 1) (i32.eq (local.get $d) (i32.const 1))) (i32.eq (local.get $d) (i32.const 2))) (i32.eq (local.get $d) (i32.const 3))) (i32.eq (local.get $d) (i32.const 4))) (i32.eq (local.get $d) (i32.const 5))) (i32.eq (local.get $d) (i32.const 6))) (i32.eq (local.get $d) (i32.const 7))) (i32.eq (local.get $d) (i32.const 8))) (i32.eq (local.get $d) (i32.const 9))) (i32.eq (local.get $d) (i32.const 10))) (i32.eq (local.get $d) (i32.const 11))) (i32.eq (local.get $d) (i32.const 12))) (i32.eq (local.get $d) (i32.const 13))) (i32.eq (local.get $d) (i32.const 14))) (i32.eq (local.get $d) (i32.const 15)))))
          (br $next)))
      (local.get $h))
)

Collections and iteration#

A list folded to a total with for from. The plainest possible read on how loops lower.

Faber source

fn sum(list<int> numeri) → int {
    mut int total ← 0
    for from numeri let n {
        total ← total + n
    }
    return total
}

main {
    let list<int> valores ← [1, 2, 3, 4, 5]
    print sum(valores)
}

WebAssembly text — 12 lines in, 490 out (40.8×)

;; Generated by radix MIR WASM text probe - experimental artifact.
(module
    (import "faber_rt_v1" "__faber_rt_v1_text_concat" (func $__faber_rt_v1_text_concat (param i32 i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_array_new" (func $__faber_rt_v1_array_new__construct (param i32) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_array_push" (func $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (param i32 i64) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_array_get" (func $__faber_rt_v1_array_get__index_2_aggregate_i64_to_i64 (param i32 i64) (result i64)))
    (import "faber_rt_v1" "__faber_rt_v1_array_length" (func $__faber_rt_v1_array_length__length_1_aggregate_to_i64 (param i32) (result i64)))
    (import "faber_rt_v1" "__faber_rt_v1_diagnostic_nota_i64" (func $__faber_rt_v1_diagnostic_nota_i64 (param i64)))
    (import "faber_rt_v1" "__faber_rt_v1_assert_message" (func $__faber_rt_v1_assert_message (param i32 i32)))
    (import "faber_rt_v1" "__faber_rt_v1_format_i64" (func $__faber_rt_v1_format_i64 (param i32 i64) (result i32)))
    (import "faber_rt_v1" "__faber_rt_v1_format_i64_i64" (func $__faber_rt_v1_format_i64_i64 (param i32 i64 i64) (result i32)))
    (memory (export "memory") 1)
    (data (i32.const 0) ", ")
    (data (i32.const 2) "0")
    (data (i32.const 3) "0x")
    (data (i32.const 5) "1")
    (data (i32.const 6) "2")
    (data (i32.const 7) "3")
    (data (i32.const 8) "4")
    (data (i32.const 9) "5")
    (data (i32.const 10) "6")
    (data (i32.const 11) "7")
    (data (i32.const 12) "8")
    (data (i32.const 13) "9")
    (data (i32.const 14) "[")
    (data (i32.const 15) "]")
    (data (i32.const 16) "a")
    (data (i32.const 17) "b")
    (data (i32.const 18) "c")
    (data (i32.const 19) "d")
    (data (i32.const 20) "e")
    (data (i32.const 21) "f")
    (data (i32.const 22) "fractus to numerus conversion out of range")
    (data (i32.const 64) "modulus division failed")
    (data (i32.const 87) "negative shift count")
    (data (i32.const 107) "nihil")
    (data (i32.const 112) "numerus division failed")
    (data (i32.const 135) "numerus overflow")
    (data (i32.const 151) "numerus to numerus conversion out of range")
    (data (i32.const 193) "\C2\A7 does not fit in `i64` (assignment to `total`)")
    (data (i32.const 241) "\C2\A7\C2\A7 does not fit in `i64` (assignment to `total`)")
    (data (i32.const 291) "\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\00\00\00\00\05\00\00\00\01\00\00\00\00\00\00\00\06\00\00\00\01\00\00\00\00\00\00\00\07\00\00\00\01\00\00\00\00\00\00\00\08\00\00\00\01\00\00\00\00\00\00\00\09\00\00\00\01\00\00\00\00\00\00\00\0A\00\00\00\01\00\00\00\00\00\00\00\0B\00\00\00\01\00\00\00\00\00\00\00\0C\00\00\00\01\00\00\00\00\00\00\00\0D\00\00\00\01\00\00\00\00\00\00\00\0E\00\00\00\01\00\00\00\00\00\00\00\0F\00\00\00\01\00\00\00\00\00\00\00\10\00\00\00\01\00\00\00\00\00\00\00\11\00\00\00\01\00\00\00\00\00\00\00\12\00\00\00\01\00\00\00\00\00\00\00\13\00\00\00\01\00\00\00\00\00\00\00\14\00\00\00\01\00\00\00\00\00\00\00\15\00\00\00\01\00\00\00\00\00\00\00\16\00\00\00\2A\00\00\00\00\00\00\00\40\00\00\00\17\00\00\00\00\00\00\00\57\00\00\00\14\00\00\00\00\00\00\00\6B\00\00\00\05\00\00\00\00\00\00\00\70\00\00\00\17\00\00\00\00\00\00\00\87\00\00\00\10\00\00\00\00\00\00\00\97\00\00\00\2A\00\00\00\00\00\00\00\C1\00\00\00\30\00\00\00\00\00\00\00\F1\00\00\00\32\00\00\00")
    (global (export "__faber_rt_v1_literal_table_ptr") i32 (i32.const 291))
    (global (export "__faber_rt_v1_literal_table_count") i32 (i32.const 29))
    (func $sum (export "summa") (param $l0 i32) (result i64)
          (local $l1 i64)
          (local $l2 i64)
          (local $l3 i64)
          (local $t0 i64)
          (local $t1 i32)
          (local $t2 i64)
          (local $t2_x i64)
          (local $t2_h i32)
          (local $t3 i64)
          (local $t4 i64)
          (local $t4_x i64)
          (local $t4_h i32)
          (local $p0 i32)
          (local.set $p0 (i32.const 0))
          (loop $dispatch
              (if (i32.eq (local.get $p0) (i32.const 0))
                  (then
                      (local.set $l1 (i64.const 0))
                      (local.set $l2 (i64.const 0))
                      (local.set $t0 (call $__faber_rt_v1_array_length__length_1_aggregate_to_i64 (local.get $l0)))
                      (local.set $p0 (i32.const 1))
                      (br $dispatch)
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 1))
                  (then
                      ;; v2 = (i64.lt_s (local.get $l2) (local.get $t0))
                      (local.set $t1 (i64.lt_s (local.get $l2) (local.get $t0)))
                      (if (local.get $t1)
                          (then
                              (local.set $p0 (i32.const 2))
                              (br $dispatch)
                          )
                          (else
                              (local.set $p0 (i32.const 4))
                              (br $dispatch)
                          )
                      )
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 2))
                  (then
                      (local.set $l3 (call $__faber_rt_v1_array_get__index_2_aggregate_i64_to_i64 (local.get $l0) (local.get $l2)))
                      ;; v4 = (call $faber_x_bin (i32.const 0) (local.get $l1) (i32.const 0) (local.get $l3) (i32.const 0) (i32.const 0) (i32.const 1))
                      (local.set $t2_x (call $faber_x_bin (i32.const 0) (local.get $l1) (i32.const 0) (local.get $l3) (i32.const 0) (i32.const 0) (i32.const 1)))
                      (local.set $t2_h (global.get $faber_x_hi))
                      (local.set $t3 (call $faber_x_store_t (local.get $t2_x) (local.get $t2_h) (i32.const 64) (i32.const 1) (i32.const 27) (i32.const 28) (i32.const 27)))
                      (local.set $l1 (local.get $t3))
                      (local.set $p0 (i32.const 3))
                      (br $dispatch)
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 3))
                  (then
                      ;; v6 = (call $faber_x_bin (i32.const 0) (local.get $l2) (i32.const 0) (i64.const 1) (i32.const 0) (i32.const 0) (i32.const 1))
                      (local.set $t4_x (call $faber_x_bin (i32.const 0) (local.get $l2) (i32.const 0) (i64.const 1) (i32.const 0) (i32.const 0) (i32.const 1)))
                      (local.set $t4_h (global.get $faber_x_hi))
                      (local.set $l2 (call $faber_x_store (local.get $t4_x) (local.get $t4_h) (i32.const 64) (i32.const 1) (i32.const 0)))
                      (local.set $p0 (i32.const 1))
                      (br $dispatch)
                  )
              )
              (if (i32.eq (local.get $p0) (i32.const 4))
                  (then
                      (return (local.get $l1))
                  )
              )
              (unreachable)
          )
          (unreachable)
    )
    (func $main (export "incipit")
          (local $l0 i32)
          (local $t0 i32)
          (local $t1 i64)
          (local.set $t0 (call $__faber_rt_v1_array_new__construct (i32.const 4)))
          (local.set $t0 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t0) (i64.const 1)))
          (local.set $t0 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t0) (i64.const 2)))
          (local.set $t0 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t0) (i64.const 3)))
          (local.set $t0 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t0) (i64.const 4)))
          (local.set $t0 (call $__faber_rt_v1_array_push__construct_2_aggregate_i64_to_aggregate (local.get $t0) (i64.const 5)))
          (local.set $l0 (local.get $t0))
          (local.set $t1 (call $sum (local.get $l0)))
          (call $__faber_rt_v1_diagnostic_nota_i64 (local.get $t1))
          (return)
    )

    (global $faber_x_hi (mut i32) (i32.const 0))
    (func $faber_x_neg (param $a i64) (param $u i32) (result i32)
      (i32.and (i32.eqz (local.get $u)) (i64.lt_s (local.get $a) (i64.const 0))))
    (func $faber_x_mag (param $a i64) (param $u i32) (result i64)
      (if (result i64) (call $faber_x_neg (local.get $a) (local.get $u))
        (then (i64.sub (i64.const 0) (local.get $a)))
        (else (local.get $a))))
    (func $faber_x_pack (param $mag i64) (param $neg i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $limit i64)
      (if (i64.eqz (local.get $mag)) (then (local.set $neg (i32.const 0))))
      (if (i32.eqz (local.get $rbits))
        (then
          (if (local.get $neg)
            (then
              (if (i64.gt_u (local.get $mag) (i64.const -9223372036854775808)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (global.set $faber_x_hi (i32.const 0))
              (return (i64.sub (i64.const 0) (local.get $mag)))))
          (global.set $faber_x_hi (i64.lt_s (local.get $mag) (i64.const 0)))
          (return (local.get $mag))))
      (if (local.get $neg)
        (then
          (if (i32.eqz (local.get $rsigned)) (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable)))
          (if (i64.gt_u (local.get $mag)
                (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1)))))
            (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable)))
          (return (i64.sub (i64.const 0) (local.get $mag)))))
      (if (i32.and (i32.eq (local.get $rbits) (i32.const 64)) (local.get $rsigned))
        (then (if (i64.lt_s (local.get $mag) (i64.const 0)) (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable))))
        (else
          (if (i32.lt_u (local.get $rbits) (i32.const 64))
            (then
              (local.set $limit
                (i64.sub
                  (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (local.get $rsigned))))
                  (i64.const 1)))
              (if (i64.gt_u (local.get $mag) (local.get $limit)) (then (call $faber_x_range_fail (local.get $mag) (local.get $neg)) (unreachable)))))))
      (local.get $mag))
    (func $faber_x_bin (param $op i32) (param $a i64) (param $au i32) (param $b i64) (param $bu i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $an i32) (local $bn i32) (local $am i64) (local $bm i64) (local $m i64) (local $n i32)
      (local $q i64) (local $r i64) (local $ahi i64) (local $bhi i64) (local $hi i64) (local $lo i64)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $bn (call $faber_x_neg (local.get $b) (local.get $bu)))
      (local.set $am (call $faber_x_mag (local.get $a) (local.get $au)))
      (local.set $bm (call $faber_x_mag (local.get $b) (local.get $bu)))
      (if (i32.le_u (local.get $op) (i32.const 1))
        (then
          (if (i32.eq (local.get $op) (i32.const 1)) (then (local.set $bn (i32.eqz (local.get $bn)))))
          (if (i32.eq (local.get $an) (local.get $bn))
            (then
              (local.set $m (i64.add (local.get $am) (local.get $bm)))
              (if (i64.lt_u (local.get $m) (local.get $am)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (local.set $n (local.get $an)))
            (else
              (if (i64.ge_u (local.get $am) (local.get $bm))
                (then
                  (local.set $m (i64.sub (local.get $am) (local.get $bm)))
                  (local.set $n (local.get $an)))
                (else
                  (local.set $m (i64.sub (local.get $bm) (local.get $am)))
                  (local.set $n (local.get $bn))))))
          (return (call $faber_x_pack (local.get $m) (local.get $n) (local.get $rbits) (local.get $rsigned)))))
      (if (i32.eq (local.get $op) (i32.const 2))
        (then
          (if (i32.and (i64.ne (local.get $am) (i64.const 0)) (i64.ne (local.get $bm) (i64.const 0)))
            (then
              (if (i64.gt_u (local.get $am) (i64.div_u (i64.const -1) (local.get $bm)))
                (then (call $faber_x_trap (i32.const 0)) (unreachable)))))
          (return (call $faber_x_pack (i64.mul (local.get $am) (local.get $bm))
            (i32.xor (local.get $an) (local.get $bn)) (local.get $rbits) (local.get $rsigned)))))
      (if (i32.or (i32.eq (local.get $op) (i32.const 3)) (i32.eq (local.get $op) (i32.const 4)))
        (then
          (if (i64.eqz (local.get $bm)) (then (call $faber_x_trap (i32.const 1)) (unreachable)))
          (local.set $q (i64.div_u (local.get $am) (local.get $bm)))
          (local.set $r (i64.rem_u (local.get $am) (local.get $bm)))
          (if (i32.eq (local.get $op) (i32.const 3))
            (then
              (local.set $n (i32.xor (local.get $an) (local.get $bn)))
              (if (i32.and (local.get $n) (i64.ne (local.get $r) (i64.const 0)))
                (then (local.set $q (i64.add (local.get $q) (i64.const 1)))))
              (return (call $faber_x_pack (local.get $q) (local.get $n) (local.get $rbits) (local.get $rsigned))))
            (else
              (if (i64.eqz (local.get $r))
                (then (return (call $faber_x_pack (i64.const 0) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
              (if (i32.eq (local.get $an) (local.get $bn))
                (then (return (call $faber_x_pack (local.get $r) (local.get $bn) (local.get $rbits) (local.get $rsigned)))))
              (return (call $faber_x_pack (i64.sub (local.get $bm) (local.get $r)) (local.get $bn)
                (local.get $rbits) (local.get $rsigned)))))))
      (if (i32.and (i32.ge_u (local.get $op) (i32.const 5)) (i32.le_u (local.get $op) (i32.const 7)))
        (then
          (local.set $ahi (select (i64.const 0) (i64.shr_s (local.get $a) (i64.const 63)) (local.get $au)))
          (local.set $bhi (select (i64.const 0) (i64.shr_s (local.get $b) (i64.const 63)) (local.get $bu)))
          (if (i32.eq (local.get $op) (i32.const 5))
            (then
              (local.set $lo (i64.and (local.get $a) (local.get $b)))
              (local.set $hi (i64.and (local.get $ahi) (local.get $bhi))))
            (else
              (if (i32.eq (local.get $op) (i32.const 6))
                (then
                  (local.set $lo (i64.or (local.get $a) (local.get $b)))
                  (local.set $hi (i64.or (local.get $ahi) (local.get $bhi))))
                (else
                  (local.set $lo (i64.xor (local.get $a) (local.get $b)))
                  (local.set $hi (i64.xor (local.get $ahi) (local.get $bhi)))))))
          (if (i64.eqz (local.get $hi))
            (then (return (call $faber_x_pack (local.get $lo) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
          (if (i32.and (i64.eq (local.get $hi) (i64.const -1)) (i64.lt_s (local.get $lo) (i64.const 0)))
            (then (return (call $faber_x_pack (i64.sub (i64.const 0) (local.get $lo)) (i32.const 1)
              (local.get $rbits) (local.get $rsigned)))))
          (call $faber_x_trap (i32.const 0)) (unreachable)))
      (if (i32.ge_u (local.get $op) (i32.const 8))
        (then
          (if (local.get $bn) (then (call $faber_x_trap (i32.const 2)) (unreachable)))
          (if (i32.eq (local.get $op) (i32.const 8))
            (then
              (if (i64.eqz (local.get $am))
                (then (return (call $faber_x_pack (i64.const 0) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
              (if (i64.ge_u (local.get $bm) (i64.const 64)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (local.set $m (i64.shl (local.get $am) (local.get $bm)))
              (if (i64.ne (i64.shr_u (local.get $m) (local.get $bm)) (local.get $am)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
              (return (call $faber_x_pack (local.get $m) (local.get $an) (local.get $rbits) (local.get $rsigned))))
            (else
              (if (i32.eqz (local.get $an))
                (then
                  (return (call $faber_x_pack
                    (select (i64.const 0) (i64.shr_u (local.get $am) (local.get $bm))
                      (i64.ge_u (local.get $bm) (i64.const 64)))
                    (i32.const 0) (local.get $rbits) (local.get $rsigned))))
                (else
                  (if (i64.ge_u (local.get $bm) (i64.const 64))
                    (then (return (call $faber_x_pack (i64.const 1) (i32.const 1) (local.get $rbits) (local.get $rsigned)))))
                  (return (call $faber_x_pack
                    (i64.add (i64.shr_u (i64.sub (local.get $am) (i64.const 1)) (local.get $bm)) (i64.const 1))
                    (i32.const 1) (local.get $rbits) (local.get $rsigned)))))))))
      (unreachable))
    (func $faber_x_un (param $op i32) (param $a i64) (param $au i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $an i32) (local $am i64)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $am (call $faber_x_mag (local.get $a) (local.get $au)))
      (if (i32.eqz (local.get $op))
        (then (return (call $faber_x_pack (local.get $am) (i32.eqz (local.get $an)) (local.get $rbits) (local.get $rsigned)))))
      (if (local.get $an)
        (then (return (call $faber_x_pack (i64.sub (local.get $am) (i64.const 1)) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (if (i64.eq (local.get $am) (i64.const -1)) (then (call $faber_x_trap (i32.const 0)) (unreachable)))
      (call $faber_x_pack (i64.add (local.get $am) (i64.const 1)) (i32.const 1) (local.get $rbits) (local.get $rsigned)))
    (func $faber_x_clamp (param $m i64) (param $n i32) (param $ovf i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $lim i64)
      (if (i32.and (local.get $n) (i64.ne (local.get $m) (i64.const 0)))
        (then
          (if (i32.eqz (local.get $rsigned)) (then (return (i64.const 0))))
          (local.set $lim
            (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1)))))
          (if (i32.or (local.get $ovf) (i64.gt_u (local.get $m) (local.get $lim)))
            (then (return (i64.sub (i64.const 0) (local.get $lim)))))
          (return (i64.sub (i64.const 0) (local.get $m)))))
      (if (local.get $rsigned)
        (then
          (local.set $lim
            (i64.sub
              (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1))))
              (i64.const 1))))
        (else
          (if (i32.eq (local.get $rbits) (i32.const 64))
            (then (local.set $lim (i64.const -1)))
            (else
              (local.set $lim
                (i64.sub (i64.shl (i64.const 1) (i64.extend_i32_u (local.get $rbits))) (i64.const 1)))))))
      (if (i32.or (local.get $ovf) (i64.gt_u (local.get $m) (local.get $lim)))
        (then (return (local.get $lim))))
      (local.get $m))
    (func $faber_x_sbin (param $op i32) (param $a i64) (param $au i32) (param $b i64) (param $bu i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $an i32) (local $bn i32) (local $am i64) (local $bm i64) (local $m i64) (local $n i32)
      (local $ovf i32) (local $q i64) (local $r i64)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $bn (call $faber_x_neg (local.get $b) (local.get $bu)))
      (local.set $am (call $faber_x_mag (local.get $a) (local.get $au)))
      (local.set $bm (call $faber_x_mag (local.get $b) (local.get $bu)))
      (if (i32.le_u (local.get $op) (i32.const 1))
        (then
          (if (i32.eq (local.get $op) (i32.const 1)) (then (local.set $bn (i32.eqz (local.get $bn)))))
          (if (i32.eq (local.get $an) (local.get $bn))
            (then
              (local.set $m (i64.add (local.get $am) (local.get $bm)))
              (if (i64.lt_u (local.get $m) (local.get $am))
                (then (local.set $ovf (i32.const 1)) (local.set $m (i64.const 1))))
              (local.set $n (local.get $an)))
            (else
              (if (i64.ge_u (local.get $am) (local.get $bm))
                (then
                  (local.set $m (i64.sub (local.get $am) (local.get $bm)))
                  (local.set $n (local.get $an)))
                (else
                  (local.set $m (i64.sub (local.get $bm) (local.get $am)))
                  (local.set $n (local.get $bn))))))
          (return (call $faber_x_clamp (local.get $m) (local.get $n) (local.get $ovf) (local.get $rbits) (local.get $rsigned)))))
      (if (i32.eq (local.get $op) (i32.const 2))
        (then
          (local.set $m (i64.mul (local.get $am) (local.get $bm)))
          (if (i32.and (i64.ne (local.get $am) (i64.const 0)) (i64.ne (local.get $bm) (i64.const 0)))
            (then
              (if (i64.gt_u (local.get $am) (i64.div_u (i64.const -1) (local.get $bm)))
                (then (local.set $ovf (i32.const 1)) (local.set $m (i64.const 1))))))
          (return (call $faber_x_clamp (local.get $m) (i32.xor (local.get $an) (local.get $bn)) (local.get $ovf) (local.get $rbits) (local.get $rsigned)))))
      (if (i64.eqz (local.get $bm)) (then (call $faber_x_trap (i32.const 1)) (unreachable)))
      (local.set $q (i64.div_u (local.get $am) (local.get $bm)))
      (local.set $r (i64.rem_u (local.get $am) (local.get $bm)))
      (if (i32.eq (local.get $op) (i32.const 3))
        (then
          (local.set $n (i32.xor (local.get $an) (local.get $bn)))
          (if (i32.and (local.get $n) (i64.ne (local.get $r) (i64.const 0)))
            (then (local.set $q (i64.add (local.get $q) (i64.const 1)))))
          (return (call $faber_x_clamp (local.get $q) (local.get $n) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (if (i64.eqz (local.get $r))
        (then (return (i64.const 0))))
      (if (i32.eq (local.get $an) (local.get $bn))
        (then (return (call $faber_x_clamp (local.get $r) (local.get $bn) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (call $faber_x_clamp (i64.sub (local.get $bm) (local.get $r)) (local.get $bn) (i32.const 0) (local.get $rbits) (local.get $rsigned)))
    (func $faber_x_store (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (param $policy i32) (result i64)
      (if (i32.eq (local.get $policy) (i32.const 1))
        (then
          (if (i32.lt_u (local.get $rbits) (i32.const 64))
            (then
              (if (local.get $rsigned)
                (then (return (i64.shr_s
                  (i64.shl (local.get $v) (i64.extend_i32_u (i32.sub (i32.const 64) (local.get $rbits))))
                  (i64.extend_i32_u (i32.sub (i32.const 64) (local.get $rbits)))))))
              (return (i64.and (local.get $v)
                (i64.sub (i64.shl (i64.const 1) (i64.extend_i32_u (local.get $rbits))) (i64.const 1))))))
          (return (local.get $v))))
      (if (i32.eq (local.get $policy) (i32.const 2))
        (then
          (return (call $faber_x_clamp (call $faber_x_mag (local.get $v) (local.get $vu))
            (call $faber_x_neg (local.get $v) (local.get $vu)) (i32.const 0) (local.get $rbits) (local.get $rsigned)))))
      (call $faber_x_pack (call $faber_x_mag (local.get $v) (local.get $vu))
        (call $faber_x_neg (local.get $v) (local.get $vu)) (local.get $rbits) (local.get $rsigned)))
    (func $faber_x_cmp (param $a i64) (param $au i32) (param $b i64) (param $bu i32) (result i32)
      (local $an i32) (local $bn i32)
      (local.set $an (call $faber_x_neg (local.get $a) (local.get $au)))
      (local.set $bn (call $faber_x_neg (local.get $b) (local.get $bu)))
      (if (i32.ne (local.get $an) (local.get $bn))
        (then (return (select (i32.const -1) (i32.const 1) (local.get $an)))))
      (if (local.get $an)
        (then
          (if (i64.lt_s (local.get $a) (local.get $b)) (then (return (i32.const -1))))
          (return (i64.gt_s (local.get $a) (local.get $b)))))
      (if (i64.lt_u (local.get $a) (local.get $b)) (then (return (i32.const -1))))
      (i64.gt_u (local.get $a) (local.get $b)))
    (func $faber_x_cmpf (param $a i64) (param $au i32) (param $f f64) (result i32)
      (local $whole f64) (local $frac f64) (local $wbits i64) (local $wu i32) (local $c i32)
      (if (f64.ne (local.get $f) (local.get $f)) (then (return (i32.const 2))))
      (if (f64.ge (local.get $f) (f64.const 18446744073709551616)) (then (return (i32.const -1))))
      (if (f64.lt (local.get $f) (f64.const -9223372036854775808)) (then (return (i32.const 1))))
      (local.set $whole (f64.trunc (local.get $f)))
      (local.set $frac (f64.sub (local.get $f) (local.get $whole)))
      (if (f64.ge (local.get $whole) (f64.const 9223372036854775808))
        (then
          (local.set $wbits (i64.trunc_f64_u (local.get $whole)))
          (local.set $wu (i32.const 1)))
        (else
          (local.set $wbits (i64.trunc_f64_s (local.get $whole)))))
      (local.set $c (call $faber_x_cmp (local.get $a) (local.get $au) (local.get $wbits) (local.get $wu)))
      (if (local.get $c) (then (return (local.get $c))))
      (if (f64.gt (local.get $frac) (f64.const 0)) (then (return (i32.const -1))))
      (select (i32.const 1) (i32.const 0) (f64.lt (local.get $frac) (f64.const 0))))
    (global $faber_x_site (mut i32) (i32.const -1))
    (global $faber_x_site_big (mut i32) (i32.const -1))
    (global $faber_x_site_neg (mut i32) (i32.const -1))
    (func $faber_x_store_t (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (param $tpl i32) (param $big i32) (param $negtpl i32) (result i64)
      (local $r i64)
      (global.set $faber_x_site (local.get $tpl))
      (global.set $faber_x_site_big (local.get $big))
      (global.set $faber_x_site_neg (local.get $negtpl))
      (local.set $r (call $faber_x_store (local.get $v) (local.get $vu) (local.get $rbits) (local.get $rsigned) (i32.const 0)))
      (global.set $faber_x_site (i32.const -1))
      (local.get $r))
    (func $faber_x_conv (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $r i64)
      (global.set $faber_x_site (i32.const -2))
      (local.set $r (call $faber_x_store (local.get $v) (local.get $vu) (local.get $rbits) (local.get $rsigned) (i32.const 0)))
      (global.set $faber_x_site (i32.const -1))
      (local.get $r))
    (func $faber_x_conv_ok (param $v i64) (param $vu i32) (param $rbits i32) (param $rsigned i32) (result i32)
      (local $c i64) (local $cu i32)
      ;; Policy 2 clamps with the same limits `$faber_x_store` traps on and never
      ;; traps itself, so the clamped value differs from the original exactly when
      ;; the original does not fit the target range. `$faber_x_cmp` compares the
      ;; two exact values; the clamped `u64` boundary above 2^63 reads unsigned.
      (local.set $c (call $faber_x_store (local.get $v) (local.get $vu) (local.get $rbits) (local.get $rsigned) (i32.const 2)))
      (local.set $cu (i32.and (i32.eq (local.get $rbits) (i32.const 64))
        (i32.and (i32.eqz (local.get $rsigned)) (i64.lt_s (local.get $c) (i64.const 0)))))
      (i32.eqz (call $faber_x_cmp (local.get $v) (local.get $vu) (local.get $c) (local.get $cu))))
    (func $faber_x_f2i (param $f f64) (param $rbits i32) (param $rsigned i32) (result i64)
      (local $t f64) (local $half f64)
      (if (f64.ne (local.get $f) (local.get $f))
        (then (call $faber_x_trap (i32.const 4)) (unreachable)))
      (local.set $t (f64.trunc (local.get $f)))
      (local.set $half
        (f64.convert_i64_u (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1))))))
      (if (local.get $rsigned)
        (then
          (if (i32.or (f64.lt (local.get $t) (f64.neg (local.get $half))) (f64.ge (local.get $t) (local.get $half)))
            (then (call $faber_x_trap (i32.const 4)) (unreachable)))
          (return (i64.trunc_f64_s (local.get $t)))))
      (if (i32.or (f64.lt (local.get $t) (f64.const 0)) (f64.ge (local.get $t) (f64.mul (local.get $half) (f64.const 2))))
        (then (call $faber_x_trap (i32.const 4)) (unreachable)))
      (i64.trunc_f64_u (local.get $t)))
    (func $faber_x_f2i_ok (param $f f64) (param $rbits i32) (param $rsigned i32) (result i32)
      (local $t f64) (local $half f64)
      ;; The non-trapping twin of `$faber_x_f2i`: 0 exactly on its three trap
      ;; conditions (NaN, below the signed/unsigned minimum, at or above the
      ;; maximum), 1 otherwise. A guarded recovery probe must never trap.
      (if (f64.ne (local.get $f) (local.get $f))
        (then (return (i32.const 0))))
      (local.set $t (f64.trunc (local.get $f)))
      (local.set $half
        (f64.convert_i64_u (i64.shl (i64.const 1) (i64.extend_i32_u (i32.sub (local.get $rbits) (i32.const 1))))))
      (if (local.get $rsigned)
        (then
          (if (i32.or (f64.lt (local.get $t) (f64.neg (local.get $half))) (f64.ge (local.get $t) (local.get $half)))
            (then (return (i32.const 0)))))
        (else
          (if (i32.or (f64.lt (local.get $t) (f64.const 0)) (f64.ge (local.get $t) (f64.mul (local.get $half) (f64.const 2))))
            (then (return (i32.const 0))))))
      (i32.const 1))
    (func $faber_x_trap (param $k i32)
      (if (i32.eq (local.get $k) (i32.const 0)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 25))))
      (if (i32.eq (local.get $k) (i32.const 1)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 24))))
      (if (i32.eq (local.get $k) (i32.const 2)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 22))))
      (if (i32.eq (local.get $k) (i32.const 3)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 26))))
      (if (i32.eq (local.get $k) (i32.const 4)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 20))))
      (if (i32.eq (local.get $k) (i32.const 5)) (then (call $__faber_rt_v1_assert_message (i32.const 0) (i32.const 21))))
      (unreachable))
    (func $faber_x_range_fail (param $mag i64) (param $neg i32)
      (local $h i32)
      (if (i32.eq (global.get $faber_x_site) (i32.const -2))
        (then (call $faber_x_trap (i32.const 3))))
      (if (i32.lt_s (global.get $faber_x_site) (i32.const 0))
        (then (call $faber_x_trap (i32.const 0))))
      (if (local.get $neg)
        (then (local.set $h (call $__faber_rt_v1_format_i64 (global.get $faber_x_site_neg) (i64.sub (i64.const 0) (local.get $mag)))))
        (else
          (if (i64.lt_s (local.get $mag) (i64.const 0))
            (then (local.set $h (call $__faber_rt_v1_format_i64_i64 (global.get $faber_x_site_big) (i64.div_u (local.get $mag) (i64.const 10)) (i64.rem_u (local.get $mag) (i64.const 10)))))
            (else (local.set $h (call $__faber_rt_v1_format_i64 (global.get $faber_x_site) (local.get $mag)))))))
      (call $__faber_rt_v1_assert_message (i32.const 0) (local.get $h))
      (unreachable))
    (func $faber_bits_hex (param $v i64) (param $n i32) (result i32)
      (local $h i32) (local $i i32) (local $d i32)
      (local.set $h (i32.const 2))
      (local.set $i (local.get $n))
      (block $done
        (loop $next
          (br_if $done (i32.eqz (local.get $i)))
          (local.set $i (i32.sub (local.get $i) (i32.const 1)))
          (local.set $d (i32.wrap_i64 (i64.and (i64.shr_u (local.get $v) (i64.extend_i32_u (i32.shl (local.get $i) (i32.const 2)))) (i64.const 15))))
          (local.set $h (call $__faber_rt_v1_text_concat (local.get $h) (select (i32.const 19) (select (i32.const 18) (select (i32.const 17) (select (i32.const 16) (select (i32.const 15) (select (i32.const 14) (select (i32.const 11) (select (i32.const 10) (select (i32.const 9) (select (i32.const 8) (select (i32.const 7) (select (i32.const 6) (select (i32.const 5) (select (i32.const 4) (select (i32.const 3) (i32.const 1) (i32.eq (local.get $d) (i32.const 1))) (i32.eq (local.get $d) (i32.const 2))) (i32.eq (local.get $d) (i32.const 3))) (i32.eq (local.get $d) (i32.const 4))) (i32.eq (local.get $d) (i32.const 5))) (i32.eq (local.get $d) (i32.const 6))) (i32.eq (local.get $d) (i32.const 7))) (i32.eq (local.get $d) (i32.const 8))) (i32.eq (local.get $d) (i32.const 9))) (i32.eq (local.get $d) (i32.const 10))) (i32.eq (local.get $d) (i32.const 11))) (i32.eq (local.get $d) (i32.const 12))) (i32.eq (local.get $d) (i32.const 13))) (i32.eq (local.get $d) (i32.const 14))) (i32.eq (local.get $d) (i32.const 15)))))
          (br $next)))
      (local.get $h))
)

---

All targets · Measured support per term