Luce / engineering
Learn Luce LuciaOS

Absence, errors, and traps

Dividing by a caller-supplied count can fail for an ordinary reason: the count is zero. Luce keeps that recoverable outcome separate from an absent value and from a trap caused by broken program logic.

Follow one handled error

divide either returns an integer or raises an error. catch -1 handles that second path. MIR gives success and error separate edges; LLVM carries a status alongside result storage; ARM64 tests the status and branches to the chosen handler.

Compiler traceFollow one program through four representations
compiler build information

Luce source. Names and indentation describe the program for a reader.

open source file

func divide(total: i64, count: i64) -> i64!:
    if count == 0:
        error("count cannot be zero")
    return total // count

func main(args: list[str]):
    let average = divide(42, len(args)) catch -1
    print(str(average))

Luce MIR. Types, registers, blocks, calls, and lifetime operations form the instruction plan sent to the LLVM backend.

open MIR file
MIR instruction guide hover, focus, or tap dotted terms

r7 is one typed intermediate value, %2 is a local storage slot, and b1 is a basic block. Read each block from top to bottom, then follow its final control-flow instruction.

Hover or focus a dotted term in the file for its explanation. On a touch screen, tap a term to keep the note open and tap elsewhere to close it. The list includes the operations that appear in this file.

func …
Starts one MIR function and lists the source-level parameters with their resolved types.
local %N
Reserves a typed local slot. The slot gives later blocks a stable place to read or replace.
b0, b1, …
Names a basic block. Control enters at the label and runs until a branch, jump, trap, or return chooses what happens next.
r0, r1, …
Names one typed intermediate result. Each register is assigned once, which makes data flow explicit.
local_get
Reads a local slot into a fresh MIR register so this use has a precise value and type.
local_set
Writes a register into a local slot. Later blocks read that slot after control-flow paths join.
const
Creates a typed literal such as 2 or 10 inside the instruction stream.
floor_divide.i64
Computes signed floor division, including the language's zero and overflow checks.
equal.i64
Tests two signed 64-bit values for equality.
intrinsic NAME
Invokes a language operation with runtime rules recorded by the compiler. The name identifies the operation.
intrinsic len
Reads the logical length defined by the value's type, such as argument count or Unicode-scalar count.
intrinsic str_value
Converts a typed value into owned text through Luce's string conversion rules.
intrinsic print
Sends text through the installed host output capability.
intrinsic drop_storage
Releases any reference held by a temporary value and leaves that temporary in its empty state.
intrinsic raise_error
Creates the recoverable error path declared by the current function.
intrinsic errored
Checks whether a fallible call returned through its error channel.
intrinsic forget
Clears a recoverable error after catch has selected and handled that path.
call NAME
Calls a resolved function directly. MIR already knows the target and argument order.
branch CONDITION, TRUE, FALSE
Chooses one of two basic blocks from a Boolean register.
jump BLOCK
Continues execution at one known basic block.
unwind
Returns through the recoverable-error channel after the error value has been recorded.
ret
Returns the current function's result to its caller and closes the current control-flow path.

func divide(total: i64, count: i64) -> i64!
  b0:
    r0 = local_get %1
    r1 = const 0
    r2 = equal.i64 r0, r1
    branch r2, b1, b2
  b1:
    r4 = const data#0
    intrinsic raise_error, r4
    unwind
  b2:
    r7 = local_get %0
    r8 = local_get %1
    r9 = floor_divide.i64 r7, r8
    ret r9
func main(args: list[str]) -> None
    local %1 (temporary): i64
    local %2 (temporary): i64
    local %3 average: i64
    local %4 (temporary): str
  b0:
    r0 = const 42
    r1 = local_get %0
    r2 = intrinsic len, r1
    r3 = call divide, r0, r2
    r4 = intrinsic errored, r3
    local_set %1, r3
    branch r4, b1, b2
  b1:
    intrinsic forget
    r11 = const -1
    local_set %2, r11
    jump b3
  b2:
    r7 = local_get %1
    local_set %2, r7
    jump b3
  b3:
    r14 = local_get %2
    local_set %3, r14
    r16 = local_get %3
    r17 = intrinsic str_value, r16
    local_set %4, r17
    intrinsic print, r17
    r20 = local_get %4
    r21 = intrinsic drop_storage, r20
    local_set %4, r21
    ret

LLVM IR. The backend expands MIR into typed memory operations, calls, checks, and control-flow blocks for LLVM.

open LLVM IR file
LLVM IR instruction guide hover, focus, or tap dotted terms

%7 is an SSA value, i64 is a 64-bit integer type, ptr is a pointer, and @name is a module symbol. Numbered labels divide the function into basic blocks.

Hover or focus a dotted term in the file for its explanation. On a touch screen, tap a term to keep the note open and tap elsewhere to close it. The list includes the operations that appear in this file.

@name = …
Defines module data such as text constants, source positions, function records, and the artifact identity tag.
define … @name
Begins a generated function. The parameter attributes tell LLVM which pointers are valid, writable, or read-only.
declare … @name
Declares a runtime or LLVM helper whose body is provided elsewhere.
numeric label
Starts an LLVM basic block. Every branch names one of these labels as its destination.
%0, %1, …
Names an SSA value. Each name is assigned once, allowing LLVM to trace definitions and uses directly.
alloca
Reserves a stack slot for a local value, return area, or temporary aggregate.
getelementptr
Calculates the address of a field or indexed element while preserving LLVM's type and bounds information.
load
Copies a typed value from memory into an SSA value.
store
Copies an SSA value into a stack slot, object field, return area, or runtime structure.
icmp
Compares integers or pointers and produces the one-bit condition consumed by a branch or select.
br
Transfers control to another block. With an i1 operand it chooses between two destinations.
select
Chooses one of two SSA values from a condition, which can become a branch-free machine instruction.
call
Invokes a generated function, a runtime helper, a host callback, or an LLVM intrinsic.
extractvalue
Reads one field from an SSA aggregate, such as the result and overflow bit returned together.
insertvalue
Builds an SSA aggregate one field at a time.
ptrtoint
Encodes a pointer as an integer field inside Luce's uniform runtime value representation.
inttoptr
Recovers a pointer from the integer field of Luce's uniform runtime value representation.
zext
Widens an unsigned value by filling the new high bits with zero.
trunc
Keeps the low bits while converting to a narrower integer representation.
lshr
Shifts bits right and fills the high side with zero; this is useful for unpacking handle fields.
and
Combines or masks bits, often to inspect a flag in a packed handle or status value.
or
Sets or combines bits in a packed value.
xor
Flips selected bits or combines Boolean conditions.
sub
Subtracts integer values; the generated entry code also uses it to update the call-depth budget.
mul
Multiplies integers after the language-specific checks have been represented.
sdiv
Performs signed integer division after the required trap conditions are handled.
srem
Computes the signed remainder used to implement the language's division rule.
ret
Returns a status or value and ends the current basic block.
@llvm.memcpy.inline
Copies a small fixed-size value representation; LLVM can expand it directly for the target.
@luce_rt_open
Creates the per-run runtime state and installs the table used to turn function numbers into source-aware traces.
@luce_rt_close
Closes the per-run runtime state after the final status and reports have been collected.
@luce_rt_args_list
Builds the owned list[str] passed to main from the host's argument callbacks.
@luce_rt_status
Combines the generated function result with runtime trap, error, exhaustion, and exit state.
@luce_rt_report_error
Sends an uncaught recoverable error through the host's error-report callback.
@luce_rt_report
Sends the completed trap report through the host callback selected by the entry wrapper.
@luce_rt_leaked
Reads the live-object count used to detect references that remain after program cleanup.
@luce_rt_exhaust
Records allocation exhaustion in the current run so the entry wrapper returns the corresponding status.
@luce_rt_raise_error
Stores a recoverable error value and source origin for propagation through a fallible call.
@luce_rt_forget_error
Clears a recoverable error after generated catch code has handled it.
@luce_rt_raise
Records a source-aware trap in the runtime so every execution path reports the same code and location.
@luce_rt_unwound
Adds one generated function frame while a trap or uncaught error travels toward the entry point.
@luce_rt_release
Removes a strong owner and triggers destruction at zero.
@luce_rt_drop_storage
Releases reference-bearing fields in a temporary runtime value.
@luce_rt_str
Converts a uniform runtime value into owned UTF-8 text.
@luce_rt_files_install
Copies file-related callbacks from the host table into the current runtime context.
@luce_rt_sockets_install
Copies network callbacks from the host table into the current runtime context.
@luce_rt_graphics_install
Copies window and graphics callbacks from the host table into the current runtime context.
!prof
Attaches branch-probability metadata so LLVM can place common and failure paths efficiently.

; ModuleID = '/Users/sedov/Dev/luciaos/www/lucelang/examples/failure.luc'
source_filename = "/Users/sedov/Dev/luciaos/www/lucelang/examples/failure.luc"
target triple = "arm64-apple-darwin24.6.0"

@luce.text.0 = private unnamed_addr constant [20 x i8] c"count cannot be zero"
@luce.text.1 = private unnamed_addr constant [16 x i8] c"division by zero"
@luce.text.2 = private unnamed_addr constant [16 x i8] c"integer overflow"
@luce.text.3 = private unnamed_addr constant [0 x i8] zeroinitializer
@luce.text.4 = private unnamed_addr constant [21 x i8] c"null object reference"
@luce.text.5 = private unnamed_addr constant [22 x i8] c"object used after free"
@luce.text.6 = private unnamed_addr constant [19 x i8] c"call depth exceeded"
@luce.text.7 = private unnamed_addr constant [24 x i8] c"host service unavailable"
@luce.text.8 = private unnamed_addr constant [6 x i8] c"divide"
@luce.text.9 = private unnamed_addr constant [58 x i8] c"/Users/sedov/Dev/luciaos/www/lucelang/examples/failure.luc"
@luce.origins.0 = private constant [11 x { i32, i32 }] [{ i32, i32 } { i32 2, i32 5 }, { i32, i32 } { i32 2, i32 5 }, { i32, i32 } { i32 2, i32 5 }, { i32, i32 } { i32 2, i32 5 }, { i32, i32 } { i32 3, i32 9 }, { i32, i32 } { i32 3, i32 9 }, { i32, i32 } { i32 3, i32 9 }, { i32, i32 } { i32 4, i32 5 }, { i32, i32 } { i32 4, i32 5 }, { i32, i32 } { i32 4, i32 5 }, { i32, i32 } { i32 4, i32 5 }]
@luce.text.10 = private unnamed_addr constant [4 x i8] c"main"
@luce.origins.1 = private constant [24 x { i32, i32 }] [{ i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 7, i32 5 }, { i32, i32 } { i32 8, i32 5 }, { i32, i32 } { i32 8, i32 5 }, { i32, i32 } { i32 8, i32 5 }, { i32, i32 } { i32 8, i32 5 }, { i32, i32 } { i32 8, i32 5 }, { i32, i32 } { i32 8, i32 5 }, { i32, i32 } { i32 8, i32 5 }, { i32, i32 } { i32 8, i32 5 }]
@luce.functions = private constant [2 x { ptr, i64, ptr, i64, ptr, i64 }] [{ ptr, i64, ptr, i64, ptr, i64 } { ptr @luce.text.8, i64 6, ptr @luce.text.9, i64 58, ptr @luce.origins.0, i64 11 }, { ptr, i64, ptr, i64, ptr, i64 } { ptr @luce.text.10, i64 4, ptr @luce.text.9, i64 58, ptr @luce.origins.1, i64 24 }]
@luce_artifact = constant { i64, i64, i64, i32, i32, i32, i32, { i32, [52 x i8] } } { i64 23734338332087628, i64 0, i64 -7092229304759745108, i32 3, i32 29, i32 1, i32 0, { i32, [52 x i8] } { i32 18, [52 x i8] c"aarch64-macos-none\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" } }

define internal i32 @luce.0.divide(ptr align 8 nocapture readonly nonnull dereferenceable(472) noundef %0, ptr align 8 nocapture nonnull noundef %1, i64 noundef %2, i64 %3, i64 %4, ptr align 8 nocapture nonnull dereferenceable(8) writeonly noundef %5) {
6:
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store i64 %3, ptr %7, align 8
  store i64 %4, ptr %8, align 8
  br label %9

9:
  %10 = load i64, ptr %8, align 8
  %11 = icmp eq i64 %10, 0
  br i1 %11, label %12, label %15

12:
  %13 = extractvalue { ptr, i64 } { ptr @luce.text.0, i64 20 }, 0
  %14 = extractvalue { ptr, i64 } { ptr @luce.text.0, i64 20 }, 1
  call void @luce_rt_raise_error(ptr %1, i32 1, ptr %13, i64 %14, i32 0, i32 5)
  store i64 0, ptr %5, align 8
  ret i32 2

15:
  %16 = load i64, ptr %7, align 8
  %17 = load i64, ptr %8, align 8
  %18 = icmp eq i64 %17, 0
  br i1 %18, label %19, label %22, !prof !0

19:
  %20 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 16 }, 0
  %21 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 16 }, 1
  call void @luce_rt_raise(ptr %1, i32 1, ptr %20, i64 %21)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 9)
  ret i32 1

22:
  %23 = icmp eq i64 %16, -9223372036854775808
  %24 = icmp eq i64 %17, -1
  %25 = and i1 %23, %24
  br i1 %25, label %26, label %29, !prof !0

26:
  %27 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 16 }, 0
  %28 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 16 }, 1
  call void @luce_rt_raise(ptr %1, i32 0, ptr %27, i64 %28)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 9)
  ret i32 1

29:
  %30 = sdiv i64 %16, %17
  %31 = srem i64 %16, %17
  %32 = icmp ne i64 %31, 0
  %33 = xor i64 %31, %17
  %34 = icmp slt i64 %33, 0
  %35 = and i1 %32, %34
  %36 = sub i64 %30, 1
  %37 = select i1 %35, i64 %36, i64 %30
  store i64 %37, ptr %5, align 8
  ret i32 0
}

define internal i32 @luce.1.main(ptr align 8 nocapture readonly nonnull dereferenceable(472) noundef %0, ptr align 8 nocapture nonnull noundef %1, i64 noundef %2, i64 %3) {
4:
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  store i64 %3, ptr %5, align 8
  store i64 0, ptr %6, align 8
  store i64 0, ptr %7, align 8
  store i64 0, ptr %8, align 8
  %10 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 0
  store i8 4, ptr %10, align 1
  %11 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 1
  store i8 -1, ptr %11, align 1
  %12 = extractvalue { ptr, i64 } { ptr @luce.text.3, i64 0 }, 0
  %13 = ptrtoint ptr %12 to i64
  %14 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 3
  store i64 %13, ptr %14, align 8
  %15 = extractvalue { ptr, i64 } { ptr @luce.text.3, i64 0 }, 1
  %16 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 4
  store i64 %15, ptr %16, align 8
  %17 = sub nsw i64 %2, 1
  %18 = alloca i64, align 8
  %19 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %20 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %19, i32 0, i32 0
  store i8 2, ptr %20, align 1
  %21 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %19, i32 0, i32 4
  store i64 0, ptr %21, align 8
  %22 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %23 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  br label %24

24:
  %25 = load i64, ptr %5, align 8
  %26 = trunc i64 %25 to i32
  %27 = lshr i64 %25, 32
  %28 = trunc i64 %27 to i32
  %29 = icmp eq i32 %26, -1
  br i1 %29, label %39, label %42, !prof !0

30:
  call void @luce_rt_forget_error(ptr %1)
  store i64 -1, ptr %7, align 8
  br label %33

31:
  %32 = load i64, ptr %6, align 8
  store i64 %32, ptr %7, align 8
  br label %33

33:
  %34 = load i64, ptr %7, align 8
  store i64 %34, ptr %8, align 8
  %35 = load i64, ptr %8, align 8
  %36 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %19, i32 0, i32 3
  store i64 %35, ptr %36, align 8
  %37 = call i32 @luce_rt_str(ptr %1, ptr %19, ptr %22)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %75, label %76, !prof !0

39:
  %40 = extractvalue { ptr, i64 } { ptr @luce.text.4, i64 21 }, 0
  %41 = extractvalue { ptr, i64 } { ptr @luce.text.4, i64 21 }, 1
  call void @luce_rt_raise(ptr %1, i32 14, ptr %40, i64 %41)
  call void @luce_rt_unwound(ptr %1, i32 1, i32 2)
  ret i32 1

42:
  %43 = getelementptr inbounds i8, ptr %1, i64 96
  %44 = load ptr, ptr %43, align 8!alias.scope !1, !noalias !2
  %45 = zext i32 %26 to i64
  %46 = mul nsw i64 %45, 112
  %47 = getelementptr inbounds i8, ptr %44, i64 %46
  %48 = getelementptr inbounds i8, ptr %47, i64 96
  %49 = load i32, ptr %48, align 4, !alias.scope !1, !noalias !2
  %50 = icmp ne i32 %49, %28
  br i1 %50, label %51, label %54, !prof !0

51:
  %52 = extractvalue { ptr, i64 } { ptr @luce.text.5, i64 22 }, 0
  %53 = extractvalue { ptr, i64 } { ptr @luce.text.5, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %52, i64 %53)
  call void @luce_rt_unwound(ptr %1, i32 1, i32 2)
  ret i32 1

54:
  %55 = and i32 %49, 1
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %60, !prof !0

57:
  %58 = extractvalue { ptr, i64 } { ptr @luce.text.5, i64 22 }, 0
  %59 = extractvalue { ptr, i64 } { ptr @luce.text.5, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %58, i64 %59)
  call void @luce_rt_unwound(ptr %1, i32 1, i32 2)
  ret i32 1

60:
  %61 = getelementptr inbounds i8, ptr %47, i64 16
  %62 = load i64, ptr %61, align 8!alias.scope !1, !noalias !2
  %63 = load ptr, ptr %47, align 8, !alias.scope !1, !noalias !2
  %64 = icmp slt i64 %17, 1
  br i1 %64, label %65, label %68, !prof !0

65:
  %66 = extractvalue { ptr, i64 } { ptr @luce.text.6, i64 19 }, 0
  %67 = extractvalue { ptr, i64 } { ptr @luce.text.6, i64 19 }, 1
  call void @luce_rt_raise(ptr %1, i32 6, ptr %66, i64 %67)
  call void @luce_rt_unwound(ptr %1, i32 1, i32 3)
  ret i32 1

68:
  %69 = call i32 @luce.0.divide(ptr %0, ptr %1, i64 %17, i64 42, i64 %62, ptr %18)
  %70 = icmp eq i32 %69, 1
  br i1 %70, label %71, label %72, !prof !0

71:
  call void @luce_rt_unwound(ptr %1, i32 1, i32 3)
  ret i32 1

72:
  %73 = load i64, ptr %18, align 8
  %74 = icmp eq i32 %69, 2
  store i64 %73, ptr %6, align 8
  br i1 %74, label %30, label %31

75:
  call void @luce_rt_unwound(ptr %1, i32 1, i32 17)
  ret i32 1

76:
  %77 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %22, i32 0, i32 3
  %78 = load i64, ptr %77, align 8
  %79 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %22, i32 0, i32 1
  %80 = load i8, ptr %79, align 1
  %81 = icmp eq i8 %80, -1
  %82 = inttoptr i64 %78 to ptr
  %83 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %22, i32 0, i32 2
  %84 = select i1 %81, ptr %82, ptr %83
  %85 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %22, i32 0, i32 4
  %86 = load i64, ptr %85, align 8
  %87 = zext i8 %80 to i64
  %88 = select i1 %81, i64 %86, i64 %87
  %89 = insertvalue { ptr, i64 } poison, ptr %84, 0
  %90 = insertvalue { ptr, i64 } %89, i64 %88, 1
  call void @llvm.memcpy.inline.p0.p0.i64(ptr align 8 %9, ptr align 8 %22, i64 24, i1 false)
  %91 = extractvalue { ptr, i64 } %90, 0
  %92 = extractvalue { ptr, i64 } %90, 1
  %93 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 1
  %94 = load ptr, ptr %93, align 8
  %95 = icmp eq ptr %94, null
  br i1 %95, label %96, label %99, !prof !0

96:
  %97 = extractvalue { ptr, i64 } { ptr @luce.text.7, i64 24 }, 0
  %98 = extractvalue { ptr, i64 } { ptr @luce.text.7, i64 24 }, 1
  call void @luce_rt_raise(ptr %1, i32 9, ptr %97, i64 %98)
  call void @luce_rt_unwound(ptr %1, i32 1, i32 19)
  ret i32 1

99:
  %100 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8
  %102 = call i32 %94(ptr %101, ptr %91, i64 %92)
  %103 = icmp eq i32 %102, -1
  br i1 %103, label %104, label %105, !prof !0

104:
  call void @luce_rt_exhaust(ptr %1)
  ret i32 1

105:
  %106 = icmp ne i32 %102, 0
  %107 = icmp ne i32 %102, 1
  %108 = and i1 %106, %107
  br i1 %108, label %109, label %112, !prof !0

109:
  %110 = extractvalue { ptr, i64 } { ptr @luce.text.7, i64 24 }, 0
  %111 = extractvalue { ptr, i64 } { ptr @luce.text.7, i64 24 }, 1
  call void @luce_rt_raise(ptr %1, i32 9, ptr %110, i64 %111)
  call void @luce_rt_unwound(ptr %1, i32 1, i32 19)
  ret i32 1

112:
  %113 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 3
  %114 = load i64, ptr %113, align 8
  %115 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 1
  %116 = load i8, ptr %115, align 1
  %117 = icmp eq i8 %116, -1
  %118 = inttoptr i64 %114 to ptr
  %119 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 2
  %120 = select i1 %117, ptr %118, ptr %119
  %121 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 4
  %122 = load i64, ptr %121, align 8
  %123 = zext i8 %116 to i64
  %124 = select i1 %117, i64 %122, i64 %123
  %125 = insertvalue { ptr, i64 } poison, ptr %120, 0
  %126 = insertvalue { ptr, i64 } %125, i64 %124, 1
  call void @luce_rt_drop_storage(ptr %1, ptr %9, ptr %23)
  %127 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %23, i32 0, i32 3
  %128 = load i64, ptr %127, align 8
  %129 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %23, i32 0, i32 1
  %130 = load i8, ptr %129, align 1
  %131 = icmp eq i8 %130, -1
  %132 = inttoptr i64 %128 to ptr
  %133 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %23, i32 0, i32 2
  %134 = select i1 %131, ptr %132, ptr %133
  %135 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %23, i32 0, i32 4
  %136 = load i64, ptr %135, align 8
  %137 = zext i8 %130 to i64
  %138 = select i1 %131, i64 %136, i64 %137
  %139 = insertvalue { ptr, i64 } poison, ptr %134, 0
  %140 = insertvalue { ptr, i64 } %139, i64 %138, 1
  call void @llvm.memcpy.inline.p0.p0.i64(ptr align 8 %9, ptr align 8 %23, i64 24, i1 false)
  ret i32 0
}

; Function Attrs: nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @luce_rt_raise_error(ptr nocapture nonnull noundef %0, i32 %1, ptr nocapture readonly %2, i64 %3, i32 %4, i32 %5) #0

; Function Attrs: nounwind cold willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @luce_rt_raise(ptr nocapture nonnull noundef %0, i32 %1, ptr nocapture readonly %2, i64 %3) #1

; Function Attrs: nounwind cold willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @luce_rt_unwound(ptr nocapture nonnull noundef %0, i32 %1, i32 %2) #1

; Function Attrs: nounwind willreturn memory(argmem: write)
declare void @luce_rt_forget_error(ptr nocapture nonnull noundef %0) #2

; Function Attrs: nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: readwrite)
declare i32 @luce_rt_str(ptr nocapture nonnull noundef %0, ptr align 8 nocapture readonly nonnull dereferenceable(24) noundef %1, ptr align 8 nocapture nonnull dereferenceable(24) writeonly noundef %2) #3

; Function Attrs: nounwind willreturn nofree nocallback memory(argmem: readwrite)
declare void @llvm.memcpy.inline.p0.p0.i64(ptr noalias nocapture writeonly %0, ptr noalias nocapture readonly %1, i64 %2, i1 immarg %3) #4

; Function Attrs: nounwind cold willreturn memory(argmem: write)
declare void @luce_rt_exhaust(ptr nocapture nonnull noundef %0) #5

; Function Attrs: nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @luce_rt_drop_storage(ptr nocapture nonnull noundef %0, ptr align 8 nocapture readonly nonnull dereferenceable(24) noundef %1, ptr align 8 nocapture nonnull dereferenceable(24) writeonly noundef %2) #0

define i32 @luce_main(ptr align 8 nocapture readonly nonnull dereferenceable(472) noundef %0) {
1:
  %2 = alloca i64, align 8
  %3 = alloca i32, align 8
  store i64 256, ptr %2, align 8
  %4 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 0
  %5 = load ptr, ptr %4, align 8
  %6 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 14
  %7 = load ptr, ptr %6, align 8
  %8 = icmp eq ptr %7, null
  br i1 %8, label %11, label %9

9:
  %10 = call i64 %7(ptr %5)
  store i64 %10, ptr %2, align 8
  br label %11

11:
  %12 = load i64, ptr %2, align 8
  %13 = call ptr @luce_rt_open(ptr @luce.functions, i64 2)
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16, !prof !0

15:
  ret i32 2

16:
  %17 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 28
  %18 = load ptr, ptr %17, align 8
  %19 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 54
  %20 = load ptr, ptr %19, align 8
  %21 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 55
  %22 = load ptr, ptr %21, align 8
  %23 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 56
  %24 = load ptr, ptr %23, align 8
  %25 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 57
  %26 = load ptr, ptr %25, align 8
  %27 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 58
  %28 = load ptr, ptr %27, align 8
  %29 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 29
  %30 = load ptr, ptr %29, align 8
  %31 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 30
  %32 = load ptr, ptr %31, align 8
  %33 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 31
  %34 = load ptr, ptr %33, align 8
  %35 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 32
  %36 = load ptr, ptr %35, align 8
  call void @luce_rt_files_install(ptr %13, ptr %5, ptr %18, ptr %20, ptr %22, ptr %24, ptr %26, ptr %28, ptr %30, ptr %32, ptr %34, ptr %36)
  %37 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 48
  %38 = load ptr, ptr %37, align 8
  %39 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 49
  %40 = load ptr, ptr %39, align 8
  %41 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 50
  %42 = load ptr, ptr %41, align 8
  %43 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 51
  %44 = load ptr, ptr %43, align 8
  %45 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 52
  %46 = load ptr, ptr %45, align 8
  call void @luce_rt_sockets_install(ptr %13, ptr %5, ptr %38, ptr %40, ptr %42, ptr %44, ptr %46)
  %47 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 40
  %48 = load ptr, ptr %47, align 8
  %49 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 41
  %50 = load ptr, ptr %49, align 8
  %51 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 42
  %52 = load ptr, ptr %51, align 8
  %53 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 43
  %54 = load ptr, ptr %53, align 8
  %55 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 44
  %56 = load ptr, ptr %55, align 8
  %57 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 45
  %58 = load ptr, ptr %57, align 8
  %59 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 46
  %60 = load ptr, ptr %59, align 8
  %61 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 47
  %62 = load ptr, ptr %61, align 8
  call void @luce_rt_graphics_install(ptr %13, ptr %5, ptr %48, ptr %50, ptr %52, ptr %54, ptr %56, ptr %58, ptr %60, ptr %62)
  %63 = icmp slt i64 %12, 1
  br i1 %63, label %64, label %65, !prof !0

64:
  call void @luce_rt_raise(ptr %13, i32 6, ptr @luce.text.6, i64 19)
  store i32 1, ptr %3, align 8
  br label %73

65:
  %66 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %67 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 4
  %68 = load ptr, ptr %67, align 8
  %69 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 5
  %70 = load ptr, ptr %69, align 8
  %71 = call i32 @luce_rt_args_list(ptr %13, ptr %5, ptr %68, ptr %70, ptr %66)
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %77, label %78, !prof !0

73:
  %74 = load i32, ptr %3, align 8
  %75 = icmp eq i32 %74, 1
  %76 = icmp eq i32 %74, 2
  br i1 %75, label %83, label %86, !prof !0

77:
  store i32 1, ptr %3, align 8
  br label %73

78:
  %79 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %66, i32 0, i32 3
  %80 = load i64, ptr %79, align 8
  %81 = call i32 @luce.1.main(ptr %0, ptr %13, i64 %12, i64 %80)
  store i32 %81, ptr %3, align 8
  %82 = call i32 @luce_rt_release(ptr %13, ptr %66)
  br label %73

83:
  %84 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8
  call void @luce_rt_report(ptr %13, ptr %5, ptr %85)
  br label %86

86:
  br i1 %76, label %87, label %90, !prof !0

87:
  %88 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 15
  %89 = load ptr, ptr %88, align 8
  call void @luce_rt_report_error(ptr %13, ptr %5, ptr %89)
  br label %90

90:
  %91 = call i32 @luce_rt_status(ptr %13, i32 %74)
  %92 = icmp eq i32 %91, 2
  %93 = getelementptr inbounds { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }, ptr %0, i32 0, i32 3
  %94 = load ptr, ptr %93, align 8
  %95 = icmp eq ptr %94, null
  %96 = or i1 %95, %92
  br i1 %96, label %97, label %98

97:
  call void @luce_rt_close(ptr %13)
  ret i32 %91

98:
  %99 = call i64 @luce_rt_leaked(ptr %13)
  call void %94(ptr %5, i64 %99)
  br label %97
}

; Function Attrs: nounwind willreturn memory(argmem: read, inaccessiblemem: readwrite)
declare noalias ptr @luce_rt_open(ptr readonly %0, i64 %1) #6

; Function Attrs: nounwind willreturn memory(argmem: readwrite)
declare void @luce_rt_files_install(ptr nocapture nonnull noundef %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr %5, ptr %6, ptr %7, ptr %8, ptr %9, ptr %10, ptr %11) #7

; Function Attrs: nounwind willreturn memory(readwrite)
declare void @luce_rt_sockets_install(ptr nocapture nonnull noundef %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr %5, ptr %6) #8

; Function Attrs: nounwind willreturn memory(argmem: readwrite)
declare void @luce_rt_graphics_install(ptr nocapture nonnull noundef %0, ptr %1, ptr %2, ptr %3, ptr %4, ptr %5, ptr %6, ptr %7, ptr %8, ptr %9) #7

; Function Attrs: nounwind memory(readwrite)
declare i32 @luce_rt_args_list(ptr nocapture nonnull noundef %0, ptr %1, ptr %2, ptr %3, ptr align 8 nocapture nonnull dereferenceable(24) writeonly noundef %4) #9

; Function Attrs: nounwind memory(readwrite)
declare i32 @luce_rt_release(ptr nocapture nonnull noundef %0, ptr align 8 nocapture readonly nonnull dereferenceable(24) noundef %1) #9

; Function Attrs: cold
declare void @luce_rt_report(ptr nocapture nonnull noundef %0, ptr %1, ptr %2) #10

; Function Attrs: cold
declare void @luce_rt_report_error(ptr nocapture nonnull noundef %0, ptr %1, ptr %2) #10

; Function Attrs: nounwind willreturn memory(argmem: read)
declare i32 @luce_rt_status(ptr nocapture nonnull noundef %0, i32 %1) #11

; Function Attrs: nounwind willreturn memory(argmem: read)
declare i64 @luce_rt_leaked(ptr nocapture nonnull noundef %0) #11

; Function Attrs: nounwind memory(readwrite)
declare void @luce_rt_close(ptr nocapture nonnull noundef %0) #9

attributes #0 = { nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
attributes #1 = { nounwind cold willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) }
attributes #2 = { nounwind willreturn memory(argmem: write) }
attributes #3 = { nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: readwrite) }
attributes #4 = { nounwind willreturn nofree nocallback memory(argmem: readwrite) }
attributes #5 = { nounwind cold willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn memory(argmem: read, inaccessiblemem: readwrite) }
attributes #7 = { nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind willreturn memory(readwrite) }
attributes #9 = { nounwind memory(readwrite) }
attributes #10 = { cold }
attributes #11 = { nounwind willreturn memory(argmem: read) }

!0 = !{!"branch_weights", i32 1, i32 2000}
!1 = !{!3}
!2 = !{!4}
!3 = !{!"luce.rows", !5}
!4 = !{!"luce.elements", !5}
!5 = !{!"luce.alias"}

ARM64 object code. LLVM selected these instructions, registers, calls, and branch conditions for this target.

open assembly file
ARM64 instruction guide hover, focus, or tap dotted terms

x8 is a 64-bit register; w8 is its low 32 bits. A leading # marks a constant, brackets describe a memory address, and conditional instructions read the processor flags set by the preceding arithmetic or comparison.

Hover or focus a dotted term in the file for its explanation. On a touch screen, tap a term to keep the note open and tap elsewhere to close it. The list includes the operations that appear in this file.

mov
Copies a register value or loads a small constant. Calls also use it to place arguments in the required registers.
add
Adds registers or a constant. Address setup and stack restoration frequently use this instruction.
sub
Subtracts registers or a constant. Function prologues use it to reserve stack space.
cmp
Performs a subtraction solely to set condition flags; a following branch or select consumes those flags.
cmn
Performs an addition solely to set condition flags. The checked multiply-by-two path uses it to recognize unsafe inputs.
ccmp
Runs a comparison only when an earlier condition holds, allowing several tests to share one later branch.
csel
Selects one of two registers from the current condition flags. The clamp uses it to choose the doubled value or limit.
cset
Writes 1 or 0 according to a condition, producing a Boolean value from processor flags.
ldr
Loads a register from memory using a scaled address offset.
str
Stores one register into memory using a scaled address offset.
ldp
Loads two adjacent registers, often restoring saved registers or reading neighboring fields.
stp
Stores two adjacent registers, often saving the caller's registers in a function prologue.
ldur
Loads from an unscaled byte offset, which is useful for stack slots below the frame pointer.
stur
Stores to an unscaled byte offset, which is useful for stack slots below the frame pointer.
ldurb
Loads one byte using an unscaled byte offset.
sturb
Stores one byte using an unscaled byte offset.
adrp
Loads the page address of a symbol. The linker fills in the final page-relative relocation.
bl
Calls a direct target and records the return address in x30.
blr
Calls the function address held in a register, as required for host callbacks and function values.
b
Jumps to another instruction address.
b.eq
Branches when the previous comparison reported equality.
b.ne
Branches when the previous comparison reported different values.
b.le
Branches when the signed left operand was smaller or equal.
b.hs
Branches when an unsigned comparison found higher-or-same, represented by a set carry flag.
cbz
Compares a register with zero and branches when it is zero.
cbnz
Compares a register with zero and branches when it contains a nonzero value.
tbnz
Tests one selected bit and branches when that bit is set; packed runtime flags use this form.
lsr
Shifts bits right and fills with zero, often extracting the upper field of a packed handle.
mul
Multiplies the low 64-bit operands and writes the low 64-bit result.
umaddl
Widens two 32-bit unsigned operands, multiplies them, and adds a 64-bit base address.
sdiv
Performs signed integer division after zero and overflow cases have been handled.
orr
Combines bits, commonly setting tag or flag bits in a packed value.
ret
Returns to the address in x30 and ends the current machine function.


/Users/sedov/Dev/luciaos/www/lucelang/out/traces/failure.o:	file format mach-o arm64

Disassembly of section __TEXT,__text:

0000000000000000 <ltmp0>:
; luce_main():
       0:      	stp	x24, x23, [sp, #-0x40]!
       4:      	stp	x22, x21, [sp, #0x10]
       8:      	stp	x20, x19, [sp, #0x20]
       c:      	stp	x29, x30, [sp, #0x30]
      10:      	add	x29, sp, #0x30
      14:      	sub	sp, sp, #0x70
      18:      	ldr	x8, [x0, #0x70]
      1c:      	ldr	x19, [x0]
      20:      	mov	x20, x0
      24:      	cbz	x8, 0x50 <ltmp0+0x50>
      28:      	mov	x0, x19
      2c:      	blr	x8
      30:      	mov	x23, x0
      34:      	adrp	x0, 0x0 <ltmp0>
      38:      	add	x0, x0, #0x0
      3c:      	mov	w1, #0x2                ; =2
      40:      	mov	w22, #0x2               ; =2
      44:      	bl	0x44 <ltmp0+0x44>
      48:      	cbnz	x0, 0x6c <ltmp0+0x6c>
      4c:      	b	0x220 <ltmp0+0x220>
      50:      	mov	w23, #0x100             ; =256
      54:      	adrp	x0, 0x0 <ltmp0>
      58:      	add	x0, x0, #0x0
      5c:      	mov	w1, #0x2                ; =2
      60:      	mov	w22, #0x2               ; =2
      64:      	bl	0x64 <ltmp0+0x64>
      68:      	cbz	x0, 0x220 <ltmp0+0x220>
      6c:      	ldp	x3, x4, [x20, #0x1b0]
      70:      	mov	x21, x0
      74:      	ldp	x5, x6, [x20, #0x1c0]
      78:      	ldr	x2, [x20, #0xe0]
      7c:      	ldp	x8, x9, [x20, #0xf8]
      80:      	ldr	x7, [x20, #0x1d0]
      84:      	ldur	q0, [x20, #0xe8]
      88:      	sub	sp, sp, #0x20
      8c:      	mov	x1, x19
      90:      	stp	x8, x9, [sp, #0x10]
      94:      	str	q0, [sp]
      98:      	bl	0x98 <ltmp0+0x98>
      9c:      	add	sp, sp, #0x20
      a0:      	ldp	x2, x3, [x20, #0x180]
      a4:      	mov	x0, x21
      a8:      	ldp	x4, x5, [x20, #0x190]
      ac:      	mov	x1, x19
      b0:      	ldr	x6, [x20, #0x1a0]
      b4:      	bl	0xb4 <ltmp0+0xb4>
      b8:      	ldp	x8, x9, [x20, #0x170]
      bc:      	ldp	x2, x3, [x20, #0x140]
      c0:      	ldp	x4, x5, [x20, #0x150]
      c4:      	ldp	x6, x7, [x20, #0x160]
      c8:      	stp	x8, x9, [sp, #-0x10]!
      cc:      	mov	x0, x21
      d0:      	mov	x1, x19
      d4:      	bl	0xd4 <ltmp0+0xd4>
      d8:      	add	sp, sp, #0x10
      dc:      	cmp	x23, #0x0
      e0:      	b.le	0x2d0 <ltmp0+0x2d0>
      e4:      	sub	x22, sp, #0x20
      e8:      	mov	sp, x22
      ec:      	ldp	x2, x3, [x20, #0x20]
      f0:      	mov	x0, x21
      f4:      	mov	x1, x19
      f8:      	mov	x4, x22
      fc:      	bl	0xfc <ltmp0+0xfc>
     100:      	cbnz	w0, 0x348 <ltmp0+0x348>
     104:      	ldr	x8, [x22, #0x8]
     108:      	mov	w9, #0x2                ; =2
     10c:      	stur	xzr, [x29, #-0x58]
     110:      	sturb	w9, [x29, #-0x68]
     114:      	cmn	w8, #0x1
     118:      	b.eq	0x2ec <ltmp0+0x2ec>
     11c:      	mov	w9, #0x70               ; =112
     120:      	ldr	x10, [x21, #0x60]
     124:      	umaddl	x9, w8, w9, x10
     128:      	lsr	x8, x8, #32
     12c:      	ldr	w10, [x9, #0x60]
     130:      	cmp	w10, w8
     134:      	b.ne	0x290 <ltmp0+0x290>
     138:      	tbnz	w8, #0x0, 0x290 <ltmp0+0x290>
     13c:      	cmp	x23, #0x1
     140:      	b.eq	0x314 <ltmp0+0x314>
     144:      	ldr	x8, [x9, #0x10]
     148:      	cbz	x8, 0x23c <ltmp0+0x23c>
     14c:      	mov	w9, #0x2a               ; =42
     150:      	cmp	x8, #0x0
     154:      	sdiv	x10, x9, x8
     158:      	mul	x11, x10, x8
     15c:      	ccmp	x11, x9, #0x4, mi
     160:      	cset	w8, ne
     164:      	sub	x8, x10, x8
     168:      	sub	x1, x29, #0x68
     16c:      	sub	x2, x29, #0x80
     170:      	mov	x0, x21
     174:      	stur	x8, [x29, #-0x60]
     178:      	bl	0x178 <ltmp0+0x178>
     17c:      	cbnz	w0, 0x280 <ltmp0+0x280>
     180:      	ldp	x9, x10, [x29, #-0x78]
     184:      	ldur	q0, [x29, #-0x80]
     188:      	ldr	x8, [x20, #0x8]
     18c:      	ldurb	w11, [x29, #-0x7f]
     190:      	stur	q0, [x29, #-0x50]
     194:      	stur	x10, [x29, #-0x40]
     198:      	cbz	x8, 0x2a8 <ltmp0+0x2a8>
     19c:      	sub	x12, x29, #0x80
     1a0:      	cmp	w11, #0xff
     1a4:      	ldr	x0, [x20]
     1a8:      	orr	x12, x12, #0x2
     1ac:      	csel	x2, x10, x11, eq
     1b0:      	csel	x1, x9, x12, eq
     1b4:      	blr	x8
     1b8:      	cmn	w0, #0x1
     1bc:      	b.eq	0x374 <ltmp0+0x374>
     1c0:      	cmp	w0, #0x2
     1c4:      	b.hs	0x2a8 <ltmp0+0x2a8>
     1c8:      	sub	x1, x29, #0x50
     1cc:      	sub	x2, x29, #0x98
     1d0:      	mov	x0, x21
     1d4:      	bl	0x1d4 <ltmp0+0x1d4>
     1d8:      	mov	x0, x21
     1dc:      	mov	x1, x22
     1e0:      	bl	0x1e0 <ltmp0+0x1e0>
     1e4:      	mov	w1, wzr
     1e8:      	mov	x0, x21
     1ec:      	bl	0x1ec <ltmp0+0x1ec>
     1f0:      	mov	w22, w0
     1f4:      	cmp	w0, #0x2
     1f8:      	b.eq	0x218 <ltmp0+0x218>
     1fc:      	ldr	x20, [x20, #0x18]
     200:      	cbz	x20, 0x218 <ltmp0+0x218>
     204:      	mov	x0, x21
     208:      	bl	0x208 <ltmp0+0x208>
     20c:      	mov	x1, x0
     210:      	mov	x0, x19
     214:      	blr	x20
     218:      	mov	x0, x21
     21c:      	bl	0x21c <ltmp0+0x21c>
     220:      	mov	w0, w22
     224:      	sub	sp, x29, #0x30
     228:      	ldp	x29, x30, [sp, #0x30]
     22c:      	ldp	x20, x19, [sp, #0x20]
     230:      	ldp	x22, x21, [sp, #0x10]
     234:      	ldp	x24, x23, [sp], #0x40
     238:      	ret
     23c:      	adrp	x2, 0x0 <ltmp0>
     240:      	add	x2, x2, #0x0
     244:      	mov	x0, x21
     248:      	mov	w1, #0x1                ; =1
     24c:      	mov	w3, #0x14               ; =20
     250:      	mov	w4, wzr
     254:      	mov	w5, #0x5                ; =5
     258:      	bl	0x258 <ltmp0+0x258>
     25c:      	mov	x0, x21
     260:      	bl	0x260 <ltmp0+0x260>
     264:      	mov	x8, #-0x1               ; =-1
     268:      	sub	x1, x29, #0x68
     26c:      	sub	x2, x29, #0x80
     270:      	mov	x0, x21
     274:      	stur	x8, [x29, #-0x60]
     278:      	bl	0x278 <ltmp0+0x278>
     27c:      	cbz	w0, 0x180 <ltmp0+0x180>
     280:      	mov	x0, x21
     284:      	mov	w1, #0x1                ; =1
     288:      	mov	w2, #0x11               ; =17
     28c:      	b	0x338 <ltmp0+0x338>
     290:      	adrp	x2, 0x0 <ltmp0>
     294:      	add	x2, x2, #0x0
     298:      	mov	x0, x21
     29c:      	mov	w1, #0xd                ; =13
     2a0:      	mov	w3, #0x16               ; =22
     2a4:      	b	0x300 <ltmp0+0x300>
     2a8:      	adrp	x2, 0x0 <ltmp0>
     2ac:      	add	x2, x2, #0x0
     2b0:      	mov	x0, x21
     2b4:      	mov	w1, #0x9                ; =9
     2b8:      	mov	w3, #0x18               ; =24
     2bc:      	bl	0x2bc <ltmp0+0x2bc>
     2c0:      	mov	x0, x21
     2c4:      	mov	w1, #0x1                ; =1
     2c8:      	mov	w2, #0x13               ; =19
     2cc:      	b	0x338 <ltmp0+0x338>
     2d0:      	adrp	x2, 0x0 <ltmp0>
     2d4:      	add	x2, x2, #0x0
     2d8:      	mov	x0, x21
     2dc:      	mov	w1, #0x6                ; =6
     2e0:      	mov	w3, #0x13               ; =19
     2e4:      	bl	0x2e4 <ltmp0+0x2e4>
     2e8:      	b	0x348 <ltmp0+0x348>
     2ec:      	adrp	x2, 0x0 <ltmp0>
     2f0:      	add	x2, x2, #0x0
     2f4:      	mov	x0, x21
     2f8:      	mov	w1, #0xe                ; =14
     2fc:      	mov	w3, #0x15               ; =21
     300:      	bl	0x300 <ltmp0+0x300>
     304:      	mov	x0, x21
     308:      	mov	w1, #0x1                ; =1
     30c:      	mov	w2, #0x2                ; =2
     310:      	b	0x338 <ltmp0+0x338>
     314:      	adrp	x2, 0x0 <ltmp0>
     318:      	add	x2, x2, #0x0
     31c:      	mov	x0, x21
     320:      	mov	w1, #0x6                ; =6
     324:      	mov	w3, #0x13               ; =19
     328:      	bl	0x328 <ltmp0+0x328>
     32c:      	mov	x0, x21
     330:      	mov	w1, #0x1                ; =1
     334:      	mov	w2, #0x3                ; =3
     338:      	bl	0x338 <ltmp0+0x338>
     33c:      	mov	x0, x21
     340:      	mov	x1, x22
     344:      	bl	0x344 <ltmp0+0x344>
     348:      	ldr	x2, [x20, #0x10]
     34c:      	mov	x0, x21
     350:      	mov	x1, x19
     354:      	bl	0x354 <ltmp0+0x354>
     358:      	mov	w1, #0x1                ; =1
     35c:      	mov	x0, x21
     360:      	bl	0x360 <ltmp0+0x360>
     364:      	mov	w22, w0
     368:      	cmp	w0, #0x2
     36c:      	b.ne	0x1fc <ltmp0+0x1fc>
     370:      	b	0x218 <ltmp0+0x218>
     374:      	mov	x0, x21
     378:      	bl	0x378 <ltmp0+0x378>
     37c:      	b	0x33c <ltmp0+0x33c>

Three channels

Absence · T?

Ordinary data. The value is either absent or carries one T. Narrow or provide an else fallback.

Recoverable · T!

A declared call effect. Handle with catch or propagate with try.

Trap

A terminal violation: overflow, bounds, invalid conversion, call depth, explicit trap, or unavailable host capability.

Optional is payload beside presence

T? is the optional type and none is its absent value. One presence bit distinguishes absence from a present payload, including a reference payload whose bits equal the reference type’s zero value.

Conceptual T?Presence is independent of the payload bits
presentone Boolean fact
payloadordinary storage for T, owned only when present

Errors travel beside results

A fallible function advertises the effect. Ignoring a fallible result is a compile error. try branches on the outcome and returns the error through the current fallible function; catch converts the error side into a value or block result. Every propagation edge releases the scopes it exits.

A non-fallible interface witness may satisfy a fallible requirement because it implements a subset of the promised outcomes. A non-fallible requirement accepts implementations whose call convention has no recoverable-error outcome.

Traps preserve diagnosis

A trap carries a stable code, message, and call trace, then ends the run through the runtime trap channel. catch handles the separate recoverable-error channel. Generated code and the interpreter use the same trap path; each unwinding frame contributes its origin before the host receives the finished trace once.

violationruntime records code and words
unwindeach frame records origin
luce_mainrun stops with trap status
hostrenders one complete report

Cleanup differs by channel

Recoverable propagation is ordinary structured control and releases every exited local. A terminal trap stops the run and unwinds through the trap protocol; the execution record includes the live-object census. The differential suite compares the reported outcome and the cleanup state.

One recoverable-error channel

T! carries recoverable errors through try and catch. T? carries ordinary absence. Traps end a run after a violated language rule. File-not-found can therefore be optional data or a recoverable I/O event according to the API, while overflow follows the trap path defined by checked arithmetic.