Luce / engineering
Learn Luce LuciaOS

Memory management and ARC

The sample list has two names and one heap object. Luce keeps the object alive while either name can reach it, then destroys it after the last owner goes away. The compiler inserts the required retain and release operations from source scopes and types.

Follow one reference lifetime

MIR shows where the compiler transfers, retains, and drops reference storage. LLVM turns those into calls to the shared ARC runtime. ARM64 shows those calls and the status branches around the list append and final releases.

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 main(args: list[str]):
    let values = [len(args)]
    let shared = values
    shared.append(42)
    print(str(len(values)))

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.
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 append_value
Appends a value to a list and applies the element's ownership rule during storage.
intrinsic retain
Adds one strong owner before another place begins holding the same reference.
intrinsic release
Removes one strong owner and runs destruction when the count reaches zero.
intrinsic drop_storage
Releases any reference held by a temporary value and leaves that temporary in its empty state.
heap_new
Allocates a runtime object row for a class or other reference-backed value.
ret
Returns the current function's result to its caller and closes the current control-flow path.

func main(args: list[str]) -> None
    local %1 (temporary): list[i64]
    local %2 values: list[i64]
    local %3 shared: list[i64]
    local %4 (temporary): str
  b0:
    r0 = local_get %0
    r1 = intrinsic len, r0
    r2 = heap_new list[i64]
    intrinsic append_value, r2, r1
    local_set %2, r2
    r5 = local_get %2
    intrinsic retain, r5
    local_set %3, r5
    r8 = local_get %3
    r9 = const 42
    intrinsic append_value, r8, r9
    r11 = local_get %2
    r12 = intrinsic len, r11
    r13 = intrinsic str_value, r12
    local_set %4, r13
    intrinsic print, r13
    r16 = local_get %4
    r17 = intrinsic drop_storage, r16
    local_set %4, r17
    r19 = local_get %3
    intrinsic release, r19
    r21 = local_get %2
    intrinsic release, 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.
add
Adds integer values or address-related offsets under the flags attached to the instruction.
mul
Multiplies integers after the language-specific checks have been represented.
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
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_retain
Adds a strong owner to a runtime object handle.
@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_append
Appends an element through the runtime's list or builder storage and ownership rules.
@luce_rt_new_list
Allocates the runtime object that owns a list buffer.
@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/memory.luc'
source_filename = "/Users/sedov/Dev/luciaos/www/lucelang/examples/memory.luc"
target triple = "arm64-apple-darwin24.6.0"

@luce.text.0 = private unnamed_addr constant [0 x i8] zeroinitializer
@luce.text.1 = private unnamed_addr constant [21 x i8] c"null object reference"
@luce.text.2 = private unnamed_addr constant [22 x i8] c"object used after free"
@luce.text.3 = private unnamed_addr constant [24 x i8] c"host service unavailable"
@luce.text.4 = private unnamed_addr constant [4 x i8] c"main"
@luce.text.5 = private unnamed_addr constant [57 x i8] c"/Users/sedov/Dev/luciaos/www/lucelang/examples/memory.luc"
@luce.origins.0 = private constant [24 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 2, i32 5 }, { i32, i32 } { i32 3, i32 5 }, { i32, i32 } { i32 3, i32 5 }, { i32, i32 } { i32 3, i32 5 }, { i32, i32 } { i32 4, i32 5 }, { i32, i32 } { i32 4, i32 5 }, { i32, i32 } { i32 4, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }, { i32, i32 } { i32 5, i32 5 }]
@luce.functions = private constant [1 x { ptr, i64, ptr, i64, ptr, i64 }] [{ ptr, i64, ptr, i64, ptr, i64 } { ptr @luce.text.4, i64 4, ptr @luce.text.5, i64 57, ptr @luce.origins.0, i64 24 }]
@luce.text.6 = private unnamed_addr constant [19 x i8] c"call depth exceeded"
@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.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 4294967295, ptr %6, align 8
  store i64 4294967295, ptr %7, align 8
  store i64 4294967295, 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.0, 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.0, 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 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %18 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %17, i32 0, i32 0
  store i8 2, ptr %18, align 1
  %19 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %17, i32 0, i32 4
  store i64 0, ptr %19, align 8
  %20 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %21 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %22 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %21, i32 0, i32 0
  store i8 6, ptr %22, align 1
  %23 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %21, i32 0, i32 4
  store i64 0, ptr %23, align 8
  %24 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %25 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %24, i32 0, i32 0
  store i8 2, ptr %25, align 1
  %26 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %24, i32 0, i32 4
  store i64 0, ptr %26, align 8
  %27 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %28 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %27, i32 0, i32 0
  store i8 6, ptr %28, align 1
  %29 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %27, i32 0, i32 4
  store i64 0, ptr %29, align 8
  %30 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %31 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %30, i32 0, i32 0
  store i8 6, ptr %31, align 1
  %32 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %30, i32 0, i32 4
  store i64 0, ptr %32, align 8
  %33 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %34 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %33, i32 0, i32 0
  store i8 2, ptr %34, align 1
  %35 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %33, i32 0, i32 4
  store i64 0, ptr %35, align 8
  %36 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %37 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %36, i32 0, i32 0
  store i8 2, ptr %37, align 1
  %38 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %36, i32 0, i32 4
  store i64 0, ptr %38, align 8
  %39 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %40 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %41 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %42 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %41, i32 0, i32 0
  store i8 6, ptr %42, align 1
  %43 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %41, i32 0, i32 4
  store i64 0, ptr %43, align 8
  %44 = alloca { i8, i8, [6 x i8], i64, i64 }, align 8
  %45 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %44, i32 0, i32 0
  store i8 6, ptr %45, align 1
  %46 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %44, i32 0, i32 4
  store i64 0, ptr %46, align 8
  br label %47

47:
  %48 = load i64, ptr %5, align 8
  %49 = trunc i64 %48 to i32
  %50 = lshr i64 %48, 32
  %51 = trunc i64 %50 to i32
  %52 = icmp eq i32 %49, -1
  br i1 %52, label %53, label %56, !prof !0

53:
  %54 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 0
  %55 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 1
  call void @luce_rt_raise(ptr %1, i32 14, ptr %54, i64 %55)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 1)
  ret i32 1

56:
  %57 = getelementptr inbounds i8, ptr %1, i64 96
  %58 = load ptr, ptr %57, align 8!alias.scope !1, !noalias !2
  %59 = zext i32 %49 to i64
  %60 = mul nsw i64 %59, 112
  %61 = getelementptr inbounds i8, ptr %58, i64 %60
  %62 = getelementptr inbounds i8, ptr %61, i64 96
  %63 = load i32, ptr %62, align 4, !alias.scope !1, !noalias !2
  %64 = icmp ne i32 %63, %51
  br i1 %64, label %65, label %68, !prof !0

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

68:
  %69 = and i32 %63, 1
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %74, !prof !0

71:
  %72 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 0
  %73 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %72, i64 %73)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 1)
  ret i32 1

74:
  %75 = getelementptr inbounds i8, ptr %61, i64 16
  %76 = load i64, ptr %75, align 8!alias.scope !1, !noalias !2
  %77 = load ptr, ptr %61, align 8, !alias.scope !1, !noalias !2
  %78 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %17, i32 0, i32 3
  store i64 0, ptr %78, align 8
  %79 = call i32 @luce_rt_new_list(ptr %1, ptr %17, ptr %20)
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %82, !prof !0

81:
  call void @luce_rt_unwound(ptr %1, i32 0, i32 2)
  ret i32 1

82:
  %83 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %20, i32 0, i32 3
  %84 = load i64, ptr %83, align 8
  %85 = trunc i64 %84 to i32
  %86 = lshr i64 %84, 32
  %87 = trunc i64 %86 to i32
  %88 = icmp eq i32 %85, -1
  br i1 %88, label %89, label %92, !prof !0

89:
  %90 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 0
  %91 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 1
  call void @luce_rt_raise(ptr %1, i32 14, ptr %90, i64 %91)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 3)
  ret i32 1

92:
  %93 = getelementptr inbounds i8, ptr %1, i64 96
  %94 = load ptr, ptr %93, align 8!alias.scope !1, !noalias !2
  %95 = zext i32 %85 to i64
  %96 = mul nsw i64 %95, 112
  %97 = getelementptr inbounds i8, ptr %94, i64 %96
  %98 = getelementptr inbounds i8, ptr %97, i64 96
  %99 = load i32, ptr %98, align 4, !alias.scope !1, !noalias !2
  %100 = icmp ne i32 %99, %87
  br i1 %100, label %101, label %104, !prof !0

101:
  %102 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 0
  %103 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %102, i64 %103)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 3)
  ret i32 1

104:
  %105 = and i32 %99, 1
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %110, !prof !0

107:
  %108 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 0
  %109 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %108, i64 %109)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 3)
  ret i32 1

110:
  %111 = getelementptr inbounds i8, ptr %97, i64 16
  %112 = load i64, ptr %111, align 8!alias.scope !1, !noalias !2
  %113 = getelementptr inbounds i8, ptr %97, i64 8
  %114 = load i64, ptr %113, align 8, !alias.scope !1, !noalias !2
  %115 = add nuw i64 %112, 1
  %116 = mul nuw i64 %115, 8
  %117 = icmp ule i64 %116, %114
  br i1 %117, label %118, label %121, !prof !3

118:
  %119 = load ptr, ptr %97, align 8!alias.scope !1, !noalias !2
  %120 = getelementptr inbounds i64, ptr %119, i64 %112
  store i64 %76, ptr %120, align 8, !alias.scope !2, !noalias !1
  store i64 %115, ptr %111, align 8, !alias.scope !1, !noalias !2
  br label %126

121:
  %122 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %21, i32 0, i32 3
  store i64 %84, ptr %122, align 8
  %123 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %24, i32 0, i32 3
  store i64 %76, ptr %123, align 8
  %124 = call i32 @luce_rt_append(ptr %1, ptr %21, ptr %24)
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %131, label %132, !prof !0

126:
  store i64 %84, ptr %7, align 8
  %127 = load i64, ptr %7, align 8
  %128 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %27, i32 0, i32 3
  store i64 %127, ptr %128, align 8
  %129 = call i32 @luce_rt_retain(ptr %1, ptr %27)
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %133, label %134, !prof !0

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

132:
  br label %126

133:
  call void @luce_rt_unwound(ptr %1, i32 0, i32 6)
  ret i32 1

134:
  store i64 %127, ptr %8, align 8
  %135 = load i64, ptr %8, align 8
  %136 = trunc i64 %135 to i32
  %137 = lshr i64 %135, 32
  %138 = trunc i64 %137 to i32
  %139 = icmp eq i32 %136, -1
  br i1 %139, label %140, label %143, !prof !0

140:
  %141 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 0
  %142 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 1
  call void @luce_rt_raise(ptr %1, i32 14, ptr %141, i64 %142)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 10)
  ret i32 1

143:
  %144 = getelementptr inbounds i8, ptr %1, i64 96
  %145 = load ptr, ptr %144, align 8!alias.scope !1, !noalias !2
  %146 = zext i32 %136 to i64
  %147 = mul nsw i64 %146, 112
  %148 = getelementptr inbounds i8, ptr %145, i64 %147
  %149 = getelementptr inbounds i8, ptr %148, i64 96
  %150 = load i32, ptr %149, align 4, !alias.scope !1, !noalias !2
  %151 = icmp ne i32 %150, %138
  br i1 %151, label %152, label %155, !prof !0

152:
  %153 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 0
  %154 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %153, i64 %154)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 10)
  ret i32 1

155:
  %156 = and i32 %150, 1
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %158, label %161, !prof !0

158:
  %159 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 0
  %160 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %159, i64 %160)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 10)
  ret i32 1

161:
  %162 = getelementptr inbounds i8, ptr %148, i64 16
  %163 = load i64, ptr %162, align 8!alias.scope !1, !noalias !2
  %164 = getelementptr inbounds i8, ptr %148, i64 8
  %165 = load i64, ptr %164, align 8, !alias.scope !1, !noalias !2
  %166 = add nuw i64 %163, 1
  %167 = mul nuw i64 %166, 8
  %168 = icmp ule i64 %167, %165
  br i1 %168, label %169, label %172, !prof !3

169:
  %170 = load ptr, ptr %148, align 8!alias.scope !1, !noalias !2
  %171 = getelementptr inbounds i64, ptr %170, i64 %163
  store i64 42, ptr %171, align 8, !alias.scope !2, !noalias !1
  store i64 %166, ptr %162, align 8, !alias.scope !1, !noalias !2
  br label %177

172:
  %173 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %30, i32 0, i32 3
  store i64 %135, ptr %173, align 8
  %174 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %33, i32 0, i32 3
  store i64 42, ptr %174, align 8
  %175 = call i32 @luce_rt_append(ptr %1, ptr %30, ptr %33)
  %176 = icmp ne i32 %175, 0
  br i1 %176, label %183, label %184, !prof !0

177:
  %178 = load i64, ptr %7, align 8
  %179 = trunc i64 %178 to i32
  %180 = lshr i64 %178, 32
  %181 = trunc i64 %180 to i32
  %182 = icmp eq i32 %179, -1
  br i1 %182, label %185, label %188, !prof !0

183:
  call void @luce_rt_unwound(ptr %1, i32 0, i32 10)
  ret i32 1

184:
  br label %177

185:
  %186 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 0
  %187 = extractvalue { ptr, i64 } { ptr @luce.text.1, i64 21 }, 1
  call void @luce_rt_raise(ptr %1, i32 14, ptr %186, i64 %187)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 12)
  ret i32 1

188:
  %189 = getelementptr inbounds i8, ptr %1, i64 96
  %190 = load ptr, ptr %189, align 8!alias.scope !1, !noalias !2
  %191 = zext i32 %179 to i64
  %192 = mul nsw i64 %191, 112
  %193 = getelementptr inbounds i8, ptr %190, i64 %192
  %194 = getelementptr inbounds i8, ptr %193, i64 96
  %195 = load i32, ptr %194, align 4, !alias.scope !1, !noalias !2
  %196 = icmp ne i32 %195, %181
  br i1 %196, label %197, label %200, !prof !0

197:
  %198 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 0
  %199 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %198, i64 %199)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 12)
  ret i32 1

200:
  %201 = and i32 %195, 1
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %203, label %206, !prof !0

203:
  %204 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 0
  %205 = extractvalue { ptr, i64 } { ptr @luce.text.2, i64 22 }, 1
  call void @luce_rt_raise(ptr %1, i32 13, ptr %204, i64 %205)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 12)
  ret i32 1

206:
  %207 = getelementptr inbounds i8, ptr %193, i64 16
  %208 = load i64, ptr %207, align 8!alias.scope !1, !noalias !2
  %209 = load ptr, ptr %193, align 8, !alias.scope !1, !noalias !2
  %210 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %36, i32 0, i32 3
  store i64 %208, ptr %210, align 8
  %211 = call i32 @luce_rt_str(ptr %1, ptr %36, ptr %39)
  %212 = icmp ne i32 %211, 0
  br i1 %212, label %213, label %214, !prof !0

213:
  call void @luce_rt_unwound(ptr %1, i32 0, i32 13)
  ret i32 1

214:
  %215 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %39, i32 0, i32 3
  %216 = load i64, ptr %215, align 8
  %217 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %39, i32 0, i32 1
  %218 = load i8, ptr %217, align 1
  %219 = icmp eq i8 %218, -1
  %220 = inttoptr i64 %216 to ptr
  %221 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %39, i32 0, i32 2
  %222 = select i1 %219, ptr %220, ptr %221
  %223 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %39, i32 0, i32 4
  %224 = load i64, ptr %223, align 8
  %225 = zext i8 %218 to i64
  %226 = select i1 %219, i64 %224, i64 %225
  %227 = insertvalue { ptr, i64 } poison, ptr %222, 0
  %228 = insertvalue { ptr, i64 } %227, i64 %226, 1
  call void @llvm.memcpy.inline.p0.p0.i64(ptr align 8 %9, ptr align 8 %39, i64 24, i1 false)
  %229 = extractvalue { ptr, i64 } %228, 0
  %230 = extractvalue { ptr, i64 } %228, 1
  %231 = 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
  %232 = load ptr, ptr %231, align 8
  %233 = icmp eq ptr %232, null
  br i1 %233, label %234, label %237, !prof !0

234:
  %235 = extractvalue { ptr, i64 } { ptr @luce.text.3, i64 24 }, 0
  %236 = extractvalue { ptr, i64 } { ptr @luce.text.3, i64 24 }, 1
  call void @luce_rt_raise(ptr %1, i32 9, ptr %235, i64 %236)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 15)
  ret i32 1

237:
  %238 = 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
  %239 = load ptr, ptr %238, align 8
  %240 = call i32 %232(ptr %239, ptr %229, i64 %230)
  %241 = icmp eq i32 %240, -1
  br i1 %241, label %242, label %243, !prof !0

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

243:
  %244 = icmp ne i32 %240, 0
  %245 = icmp ne i32 %240, 1
  %246 = and i1 %244, %245
  br i1 %246, label %247, label %250, !prof !0

247:
  %248 = extractvalue { ptr, i64 } { ptr @luce.text.3, i64 24 }, 0
  %249 = extractvalue { ptr, i64 } { ptr @luce.text.3, i64 24 }, 1
  call void @luce_rt_raise(ptr %1, i32 9, ptr %248, i64 %249)
  call void @luce_rt_unwound(ptr %1, i32 0, i32 15)
  ret i32 1

250:
  %251 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 3
  %252 = load i64, ptr %251, align 8
  %253 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 1
  %254 = load i8, ptr %253, align 1
  %255 = icmp eq i8 %254, -1
  %256 = inttoptr i64 %252 to ptr
  %257 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 2
  %258 = select i1 %255, ptr %256, ptr %257
  %259 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %9, i32 0, i32 4
  %260 = load i64, ptr %259, align 8
  %261 = zext i8 %254 to i64
  %262 = select i1 %255, i64 %260, i64 %261
  %263 = insertvalue { ptr, i64 } poison, ptr %258, 0
  %264 = insertvalue { ptr, i64 } %263, i64 %262, 1
  call void @luce_rt_drop_storage(ptr %1, ptr %9, ptr %40)
  %265 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %40, i32 0, i32 3
  %266 = load i64, ptr %265, align 8
  %267 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %40, i32 0, i32 1
  %268 = load i8, ptr %267, align 1
  %269 = icmp eq i8 %268, -1
  %270 = inttoptr i64 %266 to ptr
  %271 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %40, i32 0, i32 2
  %272 = select i1 %269, ptr %270, ptr %271
  %273 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %40, i32 0, i32 4
  %274 = load i64, ptr %273, align 8
  %275 = zext i8 %268 to i64
  %276 = select i1 %269, i64 %274, i64 %275
  %277 = insertvalue { ptr, i64 } poison, ptr %272, 0
  %278 = insertvalue { ptr, i64 } %277, i64 %276, 1
  call void @llvm.memcpy.inline.p0.p0.i64(ptr align 8 %9, ptr align 8 %40, i64 24, i1 false)
  %279 = load i64, ptr %8, align 8
  %280 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %41, i32 0, i32 3
  store i64 %279, ptr %280, align 8
  %281 = call i32 @luce_rt_release(ptr %1, ptr %41)
  %282 = icmp ne i32 %281, 0
  br i1 %282, label %283, label %284, !prof !0

283:
  call void @luce_rt_unwound(ptr %1, i32 0, i32 20)
  ret i32 1

284:
  %285 = load i64, ptr %7, align 8
  %286 = getelementptr inbounds { i8, i8, [6 x i8], i64, i64 }, ptr %44, i32 0, i32 3
  store i64 %285, ptr %286, align 8
  %287 = call i32 @luce_rt_release(ptr %1, ptr %44)
  %288 = icmp ne i32 %287, 0
  br i1 %288, label %289, label %290, !prof !0

289:
  call void @luce_rt_unwound(ptr %1, i32 0, i32 22)
  ret i32 1

290:
  ret i32 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) #0

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

; Function Attrs: nounwind willreturn memory(readwrite)
declare i32 @luce_rt_new_list(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) #1

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

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

; 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) #2

; 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) #3

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

; 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) #5

; 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) #6

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 1)
  %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.0.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) #7

; 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) #8

; 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) #1

; 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) #8

; 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) #6

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

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

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

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

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

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

!0 = !{!"branch_weights", i32 1, i32 2000}
!1 = !{!4}
!2 = !{!5}
!3 = !{!"branch_weights", i32 2000, i32 1}
!4 = !{!"luce.rows", !6}
!5 = !{!"luce.elements", !6}
!6 = !{!"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.
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.
ldrb
Loads one byte and widens it into a register.
strb
Stores the low byte of a register.
sturb
Stores one byte using an unscaled byte offset.
sturh
Stores 16 bits 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.hs
Branches when an unsigned comparison found higher-or-same, represented by a set carry flag.
b.lo
Branches when an unsigned comparison found lower, represented by a clear 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.
lsl
Shifts bits left. A shift by one multiplies by two after the overflow check has established a safe range.
lsr
Shifts bits right and fills with zero, often extracting the upper field of a packed handle.
umaddl
Widens two 32-bit unsigned operands, multiplies them, and adds a 64-bit base address.
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/memory.o:	file format mach-o arm64

Disassembly of section __TEXT,__text:

0000000000000000 <ltmp0>:
; luce_main():
       0:      	stp	x28, x27, [sp, #-0x60]!
       4:      	stp	x26, x25, [sp, #0x10]
       8:      	stp	x24, x23, [sp, #0x20]
       c:      	stp	x22, x21, [sp, #0x30]
      10:      	stp	x20, x19, [sp, #0x40]
      14:      	stp	x29, x30, [sp, #0x50]
      18:      	add	x29, sp, #0x50
      1c:      	sub	sp, sp, #0x140
      20:      	mov	x19, sp
      24:      	ldr	x8, [x0, #0x70]
      28:      	ldr	x20, [x0]
      2c:      	mov	x21, x0
      30:      	cbz	x8, 0x33c <ltmp0+0x33c>
      34:      	mov	x0, x20
      38:      	blr	x8
      3c:      	cmp	x0, #0x1
      40:      	cset	w23, lt
      44:      	adrp	x0, 0x0 <ltmp0>
      48:      	add	x0, x0, #0x0
      4c:      	mov	w1, #0x1                ; =1
      50:      	bl	0x50 <ltmp0+0x50>
      54:      	cbz	x0, 0x354 <ltmp0+0x354>
      58:      	ldp	x3, x4, [x21, #0x1b0]
      5c:      	mov	x22, x0
      60:      	ldp	x5, x6, [x21, #0x1c0]
      64:      	ldr	x2, [x21, #0xe0]
      68:      	ldp	x8, x9, [x21, #0xf8]
      6c:      	ldr	x7, [x21, #0x1d0]
      70:      	ldur	q0, [x21, #0xe8]
      74:      	sub	sp, sp, #0x20
      78:      	mov	x1, x20
      7c:      	stp	x8, x9, [sp, #0x10]
      80:      	str	q0, [sp]
      84:      	bl	0x84 <ltmp0+0x84>
      88:      	add	sp, sp, #0x20
      8c:      	ldp	x2, x3, [x21, #0x180]
      90:      	mov	x0, x22
      94:      	ldp	x4, x5, [x21, #0x190]
      98:      	mov	x1, x20
      9c:      	ldr	x6, [x21, #0x1a0]
      a0:      	bl	0xa0 <ltmp0+0xa0>
      a4:      	ldp	x8, x9, [x21, #0x170]
      a8:      	ldp	x2, x3, [x21, #0x140]
      ac:      	ldp	x4, x5, [x21, #0x150]
      b0:      	ldp	x6, x7, [x21, #0x160]
      b4:      	stp	x8, x9, [sp, #-0x10]!
      b8:      	mov	x0, x22
      bc:      	mov	x1, x20
      c0:      	bl	0xc0 <ltmp0+0xc0>
      c4:      	add	sp, sp, #0x10
      c8:      	cbnz	w23, 0x3b4 <ltmp0+0x3b4>
      cc:      	sub	x23, sp, #0x20
      d0:      	mov	sp, x23
      d4:      	ldp	x2, x3, [x21, #0x20]
      d8:      	mov	x0, x22
      dc:      	mov	x1, x20
      e0:      	mov	x4, x23
      e4:      	bl	0xe4 <ltmp0+0xe4>
      e8:      	cbnz	w0, 0x52c <ltmp0+0x52c>
      ec:      	mov	w8, #0xff04             ; =65284
      f0:      	mov	w9, #0x6                ; =6
      f4:      	stur	xzr, [x29, #-0x78]
      f8:      	sturh	w8, [x29, #-0x70]
      fc:      	adrp	x8, 0x0 <ltmp0>
     100:      	add	x8, x8, #0x0
     104:      	stp	x8, xzr, [x29, #-0x68]
     108:      	mov	w8, #0x2                ; =2
     10c:      	sturb	w8, [x29, #-0x88]
     110:      	strb	w8, [x19, #0xc0]
     114:      	strb	w8, [x19, #0x78]
     118:      	strb	w8, [x19, #0x60]
     11c:      	ldr	x8, [x23, #0x8]
     120:      	sturb	w9, [x29, #-0xb8]
     124:      	cmn	w8, #0x1
     128:      	stur	xzr, [x29, #-0xa8]
     12c:      	str	xzr, [x19, #0xd0]
     130:      	strb	w9, [x19, #0xa8]
     134:      	str	xzr, [x19, #0xb8]
     138:      	strb	w9, [x19, #0x90]
     13c:      	str	xzr, [x19, #0xa0]
     140:      	str	xzr, [x19, #0x88]
     144:      	str	xzr, [x19, #0x70]
     148:      	strb	w9, [x19, #0x18]
     14c:      	str	xzr, [x19, #0x28]
     150:      	strb	w9, [x19]
     154:      	str	xzr, [x19, #0x10]
     158:      	b.eq	0x3d0 <ltmp0+0x3d0>
     15c:      	mov	w9, #0x70               ; =112
     160:      	ldr	x10, [x22, #0x60]
     164:      	umaddl	x9, w8, w9, x10
     168:      	lsr	x8, x8, #32
     16c:      	ldr	w10, [x9, #0x60]
     170:      	cmp	w10, w8
     174:      	b.ne	0x35c <ltmp0+0x35c>
     178:      	tbnz	w8, #0x0, 0x35c <ltmp0+0x35c>
     17c:      	ldr	x27, [x9, #0x10]
     180:      	sub	x1, x29, #0x88
     184:      	sub	x2, x29, #0xa0
     188:      	mov	x0, x22
     18c:      	stur	xzr, [x29, #-0x80]
     190:      	bl	0x190 <ltmp0+0x190>
     194:      	cbnz	w0, 0x3f8 <ltmp0+0x3f8>
     198:      	ldur	x24, [x29, #-0x98]
     19c:      	cmn	w24, #0x1
     1a0:      	b.eq	0x408 <ltmp0+0x408>
     1a4:      	mov	w8, w24
     1a8:      	ldr	x9, [x22, #0x60]
     1ac:      	lsr	x26, x24, #32
     1b0:      	lsl	x8, x8, #7
     1b4:      	sub	x25, x8, w24, uxtw #4
     1b8:      	add	x8, x9, x25
     1bc:      	ldr	w9, [x8, #0x60]
     1c0:      	cmp	w9, w26
     1c4:      	b.ne	0x374 <ltmp0+0x374>
     1c8:      	tbnz	w26, #0x0, 0x374 <ltmp0+0x374>
     1cc:      	ldp	x11, x9, [x8, #0x8]
     1d0:      	add	x10, x9, #0x1
     1d4:      	cmp	x11, x10, lsl #3
     1d8:      	b.lo	0x430 <ltmp0+0x430>
     1dc:      	ldr	x11, [x8]
     1e0:      	str	x10, [x8, #0x10]
     1e4:      	str	x27, [x11, x9, lsl #3]
     1e8:      	add	x1, x19, #0xa8
     1ec:      	mov	x0, x22
     1f0:      	str	x24, [x19, #0xb0]
     1f4:      	bl	0x1f4 <ltmp0+0x1f4>
     1f8:      	cbnz	w0, 0x450 <ltmp0+0x450>
     1fc:      	ldr	x8, [x22, #0x60]
     200:      	add	x9, x8, x25
     204:      	ldr	w10, [x9, #0x60]
     208:      	cmp	w10, w26
     20c:      	b.ne	0x460 <ltmp0+0x460>
     210:      	ldp	x12, x10, [x9, #0x8]
     214:      	add	x11, x10, #0x1
     218:      	cmp	x12, x11, lsl #3
     21c:      	b.lo	0x488 <ltmp0+0x488>
     220:      	ldr	x12, [x9]
     224:      	mov	w13, #0x2a              ; =42
     228:      	str	x11, [x9, #0x10]
     22c:      	str	x13, [x12, x10, lsl #3]
     230:      	add	x8, x8, x25
     234:      	add	x1, x19, #0x60
     238:      	add	x2, x19, #0x48
     23c:      	ldr	x8, [x8, #0x10]
     240:      	mov	x0, x22
     244:      	str	x8, [x19, #0x68]
     248:      	bl	0x248 <ltmp0+0x248>
     24c:      	cbnz	w0, 0x4e4 <ltmp0+0x4e4>
     250:      	ldp	x9, x10, [x19, #0x50]
     254:      	ldur	q0, [x19, #0x48]
     258:      	ldr	x8, [x21, #0x8]
     25c:      	ldrb	w11, [x19, #0x49]
     260:      	stur	q0, [x29, #-0x70]
     264:      	stur	x10, [x29, #-0x60]
     268:      	cbz	x8, 0x38c <ltmp0+0x38c>
     26c:      	add	x12, x19, #0x48
     270:      	cmp	w11, #0xff
     274:      	ldr	x0, [x21]
     278:      	orr	x12, x12, #0x2
     27c:      	csel	x2, x10, x11, eq
     280:      	csel	x1, x9, x12, eq
     284:      	blr	x8
     288:      	cmn	w0, #0x1
     28c:      	b.eq	0x4f4 <ltmp0+0x4f4>
     290:      	cmp	w0, #0x2
     294:      	b.hs	0x38c <ltmp0+0x38c>
     298:      	sub	x1, x29, #0x70
     29c:      	add	x2, x19, #0x30
     2a0:      	mov	x0, x22
     2a4:      	bl	0x2a4 <ltmp0+0x2a4>
     2a8:      	add	x1, x19, #0x18
     2ac:      	mov	x0, x22
     2b0:      	str	x24, [x19, #0x20]
     2b4:      	bl	0x2b4 <ltmp0+0x2b4>
     2b8:      	cbnz	w0, 0x500 <ltmp0+0x500>
     2bc:      	add	x1, x19, #0x0
     2c0:      	mov	x0, x22
     2c4:      	str	x24, [x19, #0x8]
     2c8:      	bl	0x2c8 <ltmp0+0x2c8>
     2cc:      	cbnz	w0, 0x510 <ltmp0+0x510>
     2d0:      	mov	x0, x22
     2d4:      	mov	x1, x23
     2d8:      	bl	0x2d8 <ltmp0+0x2d8>
     2dc:      	mov	w1, wzr
     2e0:      	mov	x0, x22
     2e4:      	bl	0x2e4 <ltmp0+0x2e4>
     2e8:      	mov	w23, w0
     2ec:      	cmp	w0, #0x2
     2f0:      	b.eq	0x310 <ltmp0+0x310>
     2f4:      	ldr	x21, [x21, #0x18]
     2f8:      	cbz	x21, 0x310 <ltmp0+0x310>
     2fc:      	mov	x0, x22
     300:      	bl	0x300 <ltmp0+0x300>
     304:      	mov	x1, x0
     308:      	mov	x0, x20
     30c:      	blr	x21
     310:      	mov	x0, x22
     314:      	bl	0x314 <ltmp0+0x314>
     318:      	mov	w0, w23
     31c:      	sub	sp, x29, #0x50
     320:      	ldp	x29, x30, [sp, #0x50]
     324:      	ldp	x20, x19, [sp, #0x40]
     328:      	ldp	x22, x21, [sp, #0x30]
     32c:      	ldp	x24, x23, [sp, #0x20]
     330:      	ldp	x26, x25, [sp, #0x10]
     334:      	ldp	x28, x27, [sp], #0x60
     338:      	ret
     33c:      	mov	w23, wzr
     340:      	adrp	x0, 0x0 <ltmp0>
     344:      	add	x0, x0, #0x0
     348:      	mov	w1, #0x1                ; =1
     34c:      	bl	0x34c <ltmp0+0x34c>
     350:      	cbnz	x0, 0x58 <ltmp0+0x58>
     354:      	mov	w23, #0x2               ; =2
     358:      	b	0x318 <ltmp0+0x318>
     35c:      	adrp	x2, 0x0 <ltmp0>
     360:      	add	x2, x2, #0x0
     364:      	mov	x0, x22
     368:      	mov	w1, #0xd                ; =13
     36c:      	mov	w3, #0x16               ; =22
     370:      	b	0x3e4 <ltmp0+0x3e4>
     374:      	adrp	x2, 0x0 <ltmp0>
     378:      	add	x2, x2, #0x0
     37c:      	mov	x0, x22
     380:      	mov	w1, #0xd                ; =13
     384:      	mov	w3, #0x16               ; =22
     388:      	b	0x41c <ltmp0+0x41c>
     38c:      	adrp	x2, 0x0 <ltmp0>
     390:      	add	x2, x2, #0x0
     394:      	mov	x0, x22
     398:      	mov	w1, #0x9                ; =9
     39c:      	mov	w3, #0x18               ; =24
     3a0:      	bl	0x3a0 <ltmp0+0x3a0>
     3a4:      	mov	x0, x22
     3a8:      	mov	w1, wzr
     3ac:      	mov	w2, #0xf                ; =15
     3b0:      	b	0x51c <ltmp0+0x51c>
     3b4:      	adrp	x2, 0x0 <ltmp0>
     3b8:      	add	x2, x2, #0x0
     3bc:      	mov	x0, x22
     3c0:      	mov	w1, #0x6                ; =6
     3c4:      	mov	w3, #0x13               ; =19
     3c8:      	bl	0x3c8 <ltmp0+0x3c8>
     3cc:      	b	0x52c <ltmp0+0x52c>
     3d0:      	adrp	x2, 0x0 <ltmp0>
     3d4:      	add	x2, x2, #0x0
     3d8:      	mov	x0, x22
     3dc:      	mov	w1, #0xe                ; =14
     3e0:      	mov	w3, #0x15               ; =21
     3e4:      	bl	0x3e4 <ltmp0+0x3e4>
     3e8:      	mov	x0, x22
     3ec:      	mov	w1, wzr
     3f0:      	mov	w2, #0x1                ; =1
     3f4:      	b	0x51c <ltmp0+0x51c>
     3f8:      	mov	x0, x22
     3fc:      	mov	w1, wzr
     400:      	mov	w2, #0x2                ; =2
     404:      	b	0x51c <ltmp0+0x51c>
     408:      	adrp	x2, 0x0 <ltmp0>
     40c:      	add	x2, x2, #0x0
     410:      	mov	x0, x22
     414:      	mov	w1, #0xe                ; =14
     418:      	mov	w3, #0x15               ; =21
     41c:      	bl	0x41c <ltmp0+0x41c>
     420:      	mov	x0, x22
     424:      	mov	w1, wzr
     428:      	mov	w2, #0x3                ; =3
     42c:      	b	0x51c <ltmp0+0x51c>
     430:      	sub	x1, x29, #0xb8
     434:      	add	x2, x19, #0xc0
     438:      	mov	x0, x22
     43c:      	stur	x24, [x29, #-0xb0]
     440:      	str	x27, [x19, #0xc8]
     444:      	bl	0x444 <ltmp0+0x444>
     448:      	cbz	w0, 0x1e8 <ltmp0+0x1e8>
     44c:      	b	0x420 <ltmp0+0x420>
     450:      	mov	x0, x22
     454:      	mov	w1, wzr
     458:      	mov	w2, #0x6                ; =6
     45c:      	b	0x51c <ltmp0+0x51c>
     460:      	adrp	x2, 0x0 <ltmp0>
     464:      	add	x2, x2, #0x0
     468:      	mov	x0, x22
     46c:      	mov	w1, #0xd                ; =13
     470:      	mov	w3, #0x16               ; =22
     474:      	bl	0x474 <ltmp0+0x474>
     478:      	mov	x0, x22
     47c:      	mov	w1, wzr
     480:      	mov	w2, #0xa                ; =10
     484:      	b	0x51c <ltmp0+0x51c>
     488:      	mov	w8, #0x2a               ; =42
     48c:      	add	x1, x19, #0x90
     490:      	add	x2, x19, #0x78
     494:      	mov	x0, x22
     498:      	str	x24, [x19, #0x98]
     49c:      	str	x8, [x19, #0x80]
     4a0:      	bl	0x4a0 <ltmp0+0x4a0>
     4a4:      	cbnz	w0, 0x478 <ltmp0+0x478>
     4a8:      	ldr	x8, [x22, #0x60]
     4ac:      	add	x9, x8, x25
     4b0:      	ldr	w9, [x9, #0x60]
     4b4:      	cmp	w9, w26
     4b8:      	b.eq	0x230 <ltmp0+0x230>
     4bc:      	adrp	x2, 0x0 <ltmp0>
     4c0:      	add	x2, x2, #0x0
     4c4:      	mov	x0, x22
     4c8:      	mov	w1, #0xd                ; =13
     4cc:      	mov	w3, #0x16               ; =22
     4d0:      	bl	0x4d0 <ltmp0+0x4d0>
     4d4:      	mov	x0, x22
     4d8:      	mov	w1, wzr
     4dc:      	mov	w2, #0xc                ; =12
     4e0:      	b	0x51c <ltmp0+0x51c>
     4e4:      	mov	x0, x22
     4e8:      	mov	w1, wzr
     4ec:      	mov	w2, #0xd                ; =13
     4f0:      	b	0x51c <ltmp0+0x51c>
     4f4:      	mov	x0, x22
     4f8:      	bl	0x4f8 <ltmp0+0x4f8>
     4fc:      	b	0x520 <ltmp0+0x520>
     500:      	mov	x0, x22
     504:      	mov	w1, wzr
     508:      	mov	w2, #0x14               ; =20
     50c:      	b	0x51c <ltmp0+0x51c>
     510:      	mov	x0, x22
     514:      	mov	w1, wzr
     518:      	mov	w2, #0x16               ; =22
     51c:      	bl	0x51c <ltmp0+0x51c>
     520:      	mov	x0, x22
     524:      	mov	x1, x23
     528:      	bl	0x528 <ltmp0+0x528>
     52c:      	ldr	x2, [x21, #0x10]
     530:      	mov	x0, x22
     534:      	mov	x1, x20
     538:      	bl	0x538 <ltmp0+0x538>
     53c:      	mov	w1, #0x1                ; =1
     540:      	mov	x0, x22
     544:      	bl	0x544 <ltmp0+0x544>
     548:      	mov	w23, w0
     54c:      	cmp	w0, #0x2
     550:      	b.ne	0x2f4 <ltmp0+0x2f4>
     554:      	b	0x310 <ltmp0+0x310>

Value or reference

CategoryExamplesAssignmentEnd of lifetime
Valuenumbers, bool, char, str, bytes, struct, enum, unioncopy representation; retain contained reference fieldsrelease contained ownership
Referenceclass, list, map, array, builder, closure environmentretain and share identitylast strong release destroys object
Resource referencetask and std-owned raw handlesretain and share resource identitylast release joins, closes, or releases once

Walk one ARC lifetime

List identity through four eventsThe handle stays stable while aliases enter and leave scope
first

owns handle #12:g4

list row #12:g4

buffer [1, 2]

strong 1
first + second

both carry handle #12:g4

same list row

either alias mutates the buffer

strong 2
second

first left scope

same list row

object remains live

strong 1
no strong binding

final owner left

row cleared

elements released; buffer freed; generation protects stale weak handles

strong 0

Where retains and releases come from

Semantics knows each type, lexical scope, and control-flow edge. It records ownership stores and temporary parks, then HIR lowering emits the corresponding MIR retains and releases. The runtime executes that plan by updating counts and destroying rows at zero.

static typevalue or reference facts
HIR planstore, temporary, exit
MIR opsretain and release
runtime rowcount and destroy

Weak handles and generations

A weak place stores an object index and the generation observed at assignment. It owns nothing. A read checks that the row is live and the generation still matches; on success it increments the strong count and returns an owned optional snapshot. On failure it returns none.

When a row is reused, its generation changes. A weak handle carrying the former generation returns none instead of resolving to the new occupant. Rows retire before generation wrap could make an old handle match again.

How strong cycles keep counts above zero

Strong cycle versus weak back-edgeOnly ownership arrows contribute to the count

Strong A ↔ B

Each object keeps the other above zero after external roots leave, so both rows remain live.

Strong A → B · weak B ⇢ A

A reaches zero, releases B, and both are destroyed. The back-edge upgrades only while A is live.

The compiler diagnoses the direct case where a class stores a closure that strongly captures that same self. Indirect application graph cycles still require an intentional weak edge from the program.

Destruction is observable

Last release can run class deinit, close a file handle, join an unfinished task, release an interface payload, or tear down a container graph. The optimizer preserves the order of ownership operations whenever a different order would change these effects.

The zero-object gate

Every successful differential specification ends with zero live runtime objects. Runtime unit tests additionally assert exact counts and destruction order across error, trap, rollback, worker transfer, and teardown paths.