// File: /workspace/github_c_makefile_star2_O0/mtnygard[P]complisp/lisp.c
// Function: compile_labels_with_one_label
TEST compile_labels_with_one_label(Buffer *buf) {
  ASTNode *node = Reader_read("(labels ((const (code () 5))) 1)");
  int compile_result = Compile_entry(buf, node);
  ASSERT_EQ(compile_result, 0);
  // clang-format off
  byte expected[] = {
      // mov rsi, rdi
      0x48, 0x89, 0xfe,
      // jmp 0x08
      0xe9, 0x08, 0x00, 0x00, 0x00,
      // mov rax, compile(5)
      0x48, 0xc7, 0xc0, 0x14, 0x00, 0x00, 0x00,
      // ret
      0xc3,
      // mov rax, 0x2
      0x48, 0xc7, 0xc0, 0x04, 0x00, 0x00, 0x00,
      // ret
      0xc3,
  };
  // clang-format on
  EXPECT_EQUALS_BYTES(buf, expected);
  Buffer_make_executable(buf);
  uword result = Testing_execute_entry(buf, /*heap=*/NULL);
  ASSERT_EQ_FMT(Object_encode_integer(1), result, "0x%lx");
  AST_heap_free(node);
  PASS();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x604e(%rip), %rdi      # 0x167c1
callq 0x4e40
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4690
movl %eax, -0x1c(%rbp)
movl 0xa9b2(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa9a9(%rip)      # 0x1b144
cmpl $0x0, -0x1c(%rbp)
je 0x107e9
jmp 0x107a3
leaq 0x3ef9(%rip), %rax      # 0x146a3
movq %rax, 0xa99f(%rip)      # 0x1b150
movl $0x98b, 0xa98d(%rip)    # imm = 0x98B
leaq 0x58c3(%rip), %rax      # 0x16085
movq %rax, 0xa98f(%rip)      # 0x1b158
movzbl 0xa930(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x107dd
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10a32
jmp 0x107eb
movq 0x3dde(%rip), %rax      # 0x145d0
movq %rax, -0x40(%rbp)
movq 0x3ddb(%rip), %rax      # 0x145d8
movq %rax, -0x38(%rbp)
movq 0x3dd8(%rip), %rax      # 0x145e0
movq %rax, -0x30(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq $0x18, -0x48(%rbp)
leaq 0xa8ba(%rip), %rax      # 0x1b0e8
movq %rax, -0x60(%rbp)
movl 0xa90c(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa903(%rip)      # 0x1b144
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq -0x58(%rbp), %rcx
callq 0x11f00
cmpl $0x0, %eax
jne 0x10900
cmpq $0x0, -0x60(%rbp)
je 0x10870
movq -0x60(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x108b8
jmp 0x10872
leaq 0x3e2a(%rip), %rax      # 0x146a3
movq %rax, 0xa8d0(%rip)      # 0x1b150
movl $0x99c, 0xa8be(%rip)    # imm = 0x99C
leaq 0x524c(%rip), %rax      # 0x15add
movq %rax, 0xa8c0(%rip)      # 0x1b158
movzbl 0xa861(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x108ac
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10a32
jmp 0x108ba
leaq 0x3de2(%rip), %rax      # 0x146a3
movq %rax, 0xa888(%rip)      # 0x1b150
movl $0x99c, 0xa876(%rip)    # imm = 0x99C
leaq 0x5a6e(%rip), %rax      # 0x16347
movq %rax, 0xa878(%rip)      # 0x1b158
movzbl 0xa819(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x108f4
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10a32
jmp 0x10902
jmp 0x10904
movq -0x10(%rbp), %rdi
callq 0x1c50
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4e70
movq %rax, -0x68(%rbp)
movl 0xa820(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa817(%rip)      # 0x1b144
movl $0x1, %edi
callq 0x1290
cmpq -0x68(%rbp), %rax
je 0x10a15
movq 0xa688(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x4ddc(%rip), %rsi      # 0x1572e
movb $0x0, %al
callq 0x1100
movq 0xa670(%rip), %rax      # 0x1afd0
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x1, %edi
callq 0x1290
movq -0x70(%rbp), %rdi
movq %rax, %rdx
leaq 0x5949(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xa643(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x4da3(%rip), %rsi      # 0x1573a
movb $0x0, %al
callq 0x1100
movq 0xa62b(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
movq -0x68(%rbp), %rdx
leaq 0x5915(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xa60f(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x5ff1(%rip), %rsi      # 0x169bc
movb $0x0, %al
callq 0x1100
leaq 0x3cca(%rip), %rax      # 0x146a3
movq %rax, 0xa770(%rip)      # 0x1b150
movl $0x99f, 0xa75e(%rip)    # imm = 0x99F
leaq 0x5a32(%rip), %rax      # 0x16423
movq %rax, 0xa760(%rip)      # 0x1b158
movzbl 0xa701(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10a0c
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10a32
jmp 0x10a17
movq -0x18(%rbp), %rdi
callq 0x1800
movq $0x0, 0xa72d(%rip) # 0x1b158
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)