// File: /workspace/github_c_makefile_star2_O0/mtnygard[P]complisp/lisp.c
// Function: compile_labelcall_with_no_params
TEST compile_labelcall_with_no_params(Buffer *buf) {
  ASTNode *node =
      Reader_read("(labels ((const (code () 5))) (labelcall const))");
  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,
      // call `const`
      0xe8, 0xf3, 0xff, 0xff, 0xff,
      // 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(5), result, "0x%lx");
  AST_heap_free(node);
  PASS();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x5d8f(%rip), %rdi      # 0x167e2
callq 0x4e40
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4690
movl %eax, -0x1c(%rbp)
movl 0xa6d2(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa6c9(%rip)      # 0x1b144
cmpl $0x0, -0x1c(%rbp)
je 0x10ac9
jmp 0x10a83
leaq 0x3c19(%rip), %rax      # 0x146a3
movq %rax, 0xa6bf(%rip)      # 0x1b150
movl $0x9a8, 0xa6ad(%rip)    # imm = 0x9A8
leaq 0x55e3(%rip), %rax      # 0x16085
movq %rax, 0xa6af(%rip)      # 0x1b158
movzbl 0xa650(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10abd
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10d1b
jmp 0x10acb
movq 0x3b1e(%rip), %rax      # 0x145f0
movq %rax, -0x40(%rbp)
movq 0x3b1b(%rip), %rax      # 0x145f8
movq %rax, -0x38(%rbp)
movl 0x3b19(%rip), %eax      # 0x14600
movl %eax, -0x30(%rbp)
movw 0x3b13(%rip), %ax       # 0x14604
movw %ax, -0x2c(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq $0x16, -0x48(%rbp)
leaq 0xa5d1(%rip), %rax      # 0x1b0e8
movq %rax, -0x60(%rbp)
movl 0xa623(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa61a(%rip)      # 0x1b144
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x60(%rbp), %rdx
leaq -0x58(%rbp), %rcx
callq 0x11f00
cmpl $0x0, %eax
jne 0x10be9
cmpq $0x0, -0x60(%rbp)
je 0x10b59
movq -0x60(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x10ba1
jmp 0x10b5b
leaq 0x3b41(%rip), %rax      # 0x146a3
movq %rax, 0xa5e7(%rip)      # 0x1b150
movl $0x9b9, 0xa5d5(%rip)    # imm = 0x9B9
leaq 0x4f63(%rip), %rax      # 0x15add
movq %rax, 0xa5d7(%rip)      # 0x1b158
movzbl 0xa578(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10b95
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10d1b
jmp 0x10ba3
leaq 0x3af9(%rip), %rax      # 0x146a3
movq %rax, 0xa59f(%rip)      # 0x1b150
movl $0x9b9, 0xa58d(%rip)    # imm = 0x9B9
leaq 0x5785(%rip), %rax      # 0x16347
movq %rax, 0xa58f(%rip)      # 0x1b158
movzbl 0xa530(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10bdd
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10d1b
jmp 0x10beb
jmp 0x10bed
movq -0x10(%rbp), %rdi
callq 0x1c50
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4e70
movq %rax, -0x68(%rbp)
movl 0xa537(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa52e(%rip)      # 0x1b144
movl $0x5, %edi
callq 0x1290
cmpq -0x68(%rbp), %rax
je 0x10cfe
movq 0xa39f(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x4af3(%rip), %rsi      # 0x1572e
movb $0x0, %al
callq 0x1100
movq 0xa387(%rip), %rax      # 0x1afd0
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x5, %edi
callq 0x1290
movq -0x70(%rbp), %rdi
movq %rax, %rdx
leaq 0x5660(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xa35a(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x4aba(%rip), %rsi      # 0x1573a
movb $0x0, %al
callq 0x1100
movq 0xa342(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
movq -0x68(%rbp), %rdx
leaq 0x562c(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xa326(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x5d08(%rip), %rsi      # 0x169bc
movb $0x0, %al
callq 0x1100
leaq 0x39e1(%rip), %rax      # 0x146a3
movq %rax, 0xa487(%rip)      # 0x1b150
movl $0x9bc, 0xa475(%rip)    # imm = 0x9BC
leaq 0x5b39(%rip), %rax      # 0x16813
movq %rax, 0xa477(%rip)      # 0x1b158
movzbl 0xa418(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10cf5
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10d1b
jmp 0x10d00
movq -0x18(%rbp), %rdi
callq 0x1800
movq $0x0, 0xa444(%rip) # 0x1b158
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)