// File: /workspace/github_c_makefile_star2_O0/mtnygard[P]complisp/lisp.c
// Function: compile_labelcall_with_no_params_and_locals
TEST compile_labelcall_with_no_params_and_locals(Buffer *buf) {
  ASTNode *node = Reader_read(
      "(labels ((const (code () 5))) (let ((a 1)) (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,
      // mov rax, compile(1)
      0x48, 0xc7, 0xc0, 0x04, 0x00, 0x00, 0x00,
      // mov [rsp-8], rax
      0x48, 0x89, 0x44, 0x24, 0xf8,
      // sub rsp, 8
      0x48, 0x81, 0xec, 0x08, 0x00, 0x00, 0x00,
      // call `const`
      0xe8, 0xe0, 0xff, 0xff, 0xff,
      // add rsp, 8
      0x48, 0x81, 0xc4, 0x08, 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(5), result, "0x%lx");
  AST_heap_free(node);
  PASS();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x5af0(%rip), %rdi      # 0x16836
callq 0x4e40
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4690
movl %eax, -0x1c(%rbp)
movl 0xa3df(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa3d6(%rip)      # 0x1b144
cmpl $0x0, -0x1c(%rbp)
je 0x10dbc
jmp 0x10d76
leaq 0x3926(%rip), %rax      # 0x146a3
movq %rax, 0xa3cc(%rip)      # 0x1b150
movl $0x9c5, 0xa3ba(%rip)    # imm = 0x9C5
leaq 0x52f0(%rip), %rax      # 0x16085
movq %rax, 0xa3bc(%rip)      # 0x1b158
movzbl 0xa35d(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10db0
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10ff9
jmp 0x10dbe
leaq -0x50(%rbp), %rdi
leaq 0x3847(%rip), %rsi      # 0x14610
movl $0x30, %edx
callq 0x1110
leaq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x60(%rbp)
movq $0x30, -0x58(%rbp)
leaq 0xa2f3(%rip), %rax      # 0x1b0e8
movq %rax, -0x70(%rbp)
movl 0xa345(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa33c(%rip)      # 0x1b144
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0x11f00
cmpl $0x0, %eax
jne 0x10ec7
cmpq $0x0, -0x70(%rbp)
je 0x10e37
movq -0x70(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x10e7f
jmp 0x10e39
leaq 0x3863(%rip), %rax      # 0x146a3
movq %rax, 0xa309(%rip)      # 0x1b150
movl $0x9de, 0xa2f7(%rip)    # imm = 0x9DE
leaq 0x4c85(%rip), %rax      # 0x15add
movq %rax, 0xa2f9(%rip)      # 0x1b158
movzbl 0xa29a(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10e73
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10ff9
jmp 0x10e81
leaq 0x381b(%rip), %rax      # 0x146a3
movq %rax, 0xa2c1(%rip)      # 0x1b150
movl $0x9de, 0xa2af(%rip)    # imm = 0x9DE
leaq 0x54a7(%rip), %rax      # 0x16347
movq %rax, 0xa2b1(%rip)      # 0x1b158
movzbl 0xa252(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10ebb
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10ff9
jmp 0x10ec9
jmp 0x10ecb
movq -0x10(%rbp), %rdi
callq 0x1c50
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4e70
movq %rax, -0x78(%rbp)
movl 0xa259(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xa250(%rip)      # 0x1b144
movl $0x5, %edi
callq 0x1290
cmpq -0x78(%rbp), %rax
je 0x10fdc
movq 0xa0c1(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x4815(%rip), %rsi      # 0x1572e
movb $0x0, %al
callq 0x1100
movq 0xa0a9(%rip), %rax      # 0x1afd0
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movl $0x5, %edi
callq 0x1290
movq -0x80(%rbp), %rdi
movq %rax, %rdx
leaq 0x5382(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xa07c(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x47dc(%rip), %rsi      # 0x1573a
movb $0x0, %al
callq 0x1100
movq 0xa064(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
movq -0x78(%rbp), %rdx
leaq 0x534e(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xa048(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x5a2a(%rip), %rsi      # 0x169bc
movb $0x0, %al
callq 0x1100
leaq 0x3703(%rip), %rax      # 0x146a3
movq %rax, 0xa1a9(%rip)      # 0x1b150
movl $0x9e1, 0xa197(%rip)    # imm = 0x9E1
leaq 0x585b(%rip), %rax      # 0x16813
movq %rax, 0xa199(%rip)      # 0x1b158
movzbl 0xa13a(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0x10fd3
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10ff9
jmp 0x10fde
movq -0x18(%rbp), %rdi
callq 0x1800
movq $0x0, 0xa166(%rip) # 0x1b158
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)