// Wave-6 slice 6-assembler: macro assembler (.macro/.endm with params,
// .equ equates, .rep/.endr repeat) — asm_macro.c port
// Expected exit code: 42
.equ MAGIC, 40

.macro PROLOG
    push rbp
    mov rbp, rsp
.endm

.macro SETEAX val
    mov eax, \val
.endm

.macro ADDI32 reg, amount
    add \reg, \amount
.endm

section .text
global main
main:
    PROLOG
    SETEAX MAGIC
    .rep 4
    add eax, 1
    .endr
    ADDI32 eax, -2
    leave
    ret
