// File: /workspace/github_c_makefile_star2_O0/mtnygard[P]complisp/lisp.c
// Function: compile_if_with_true_cond
TEST compile_if_with_true_cond(Buffer *buf) {
  ASTNode *node = Reader_read("(if #t 1 2)");
  int compile_result = Compile_entry(buf, node);
  ASSERT_EQ(compile_result, 0);
  // clang-format off
  byte expected[] = {
    // mov rax, 0x9f
    0x48, 0xc7, 0xc0, 0x9f, 0x00, 0x00, 0x00,
    // cmp rax, 0x1f
    0x48, 0x3d, 0x1f, 0x00, 0x00, 0x00,
    // je alternate
    0x0f, 0x84, 0x0c, 0x00, 0x00, 0x00,
    // mov rax, compile (1)
    0x48, 0xc7, 0xc0, 0x04, 0x00, 0x00, 0x00,
    // jmp end
    0xe9, 0x07, 0x00, 0x00, 0x00,
    // alternate:
    // mov rax, compile (2)
    0x48, 0xc7, 0xc0, 0x08, 0x00, 0x00, 0x00};
  // clang-format on
  EXPECT_ENTRY_CONTAINS_CODE(buf, expected);
  Buffer_make_executable(buf);
  uword result = Testing_execute_expr(buf);
  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 0x7df4(%rip), %rdi      # 0x16417
callq 0x4e40
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4690
movl %eax, -0x1c(%rbp)
movl 0xcb02(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xcaf9(%rip)      # 0x1b144
cmpl $0x0, -0x1c(%rbp)
je 0xe699
jmp 0xe653
leaq 0x6049(%rip), %rax      # 0x146a3
movq %rax, 0xcaef(%rip)      # 0x1b150
movl $0x863, 0xcadd(%rip)    # imm = 0x863
leaq 0x7a13(%rip), %rax      # 0x16085
movq %rax, 0xcadf(%rip)      # 0x1b158
movzbl 0xca80(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0xe68d
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe802
jmp 0xe69b
leaq -0x50(%rbp), %rdi
leaq 0x5e0a(%rip), %rsi      # 0x144b0
movl $0x26, %edx
callq 0x1110
movq -0x10(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0x26, %edx
callq 0x12d40
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
je 0xe6d6
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe802
jmp 0xe6d8
movq -0x10(%rbp), %rdi
callq 0x1c50
movq -0x10(%rbp), %rdi
callq 0x4f20
movq %rax, -0x60(%rbp)
movl 0xca50(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xca47(%rip)      # 0x1b144
movl $0x1, %edi
callq 0x1290
cmpq -0x60(%rbp), %rax
je 0xe7e5
movq 0xc8b8(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x700c(%rip), %rsi      # 0x1572e
movb $0x0, %al
callq 0x1100
movq 0xc8a0(%rip), %rax      # 0x1afd0
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movl $0x1, %edi
callq 0x1290
movq -0x68(%rbp), %rdi
movq %rax, %rdx
leaq 0x7b79(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xc873(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x6fd3(%rip), %rsi      # 0x1573a
movb $0x0, %al
callq 0x1100
movq 0xc85b(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
movq -0x60(%rbp), %rdx
leaq 0x7b45(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xc83f(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x8221(%rip), %rsi      # 0x169bc
movb $0x0, %al
callq 0x1100
leaq 0x5efa(%rip), %rax      # 0x146a3
movq %rax, 0xc9a0(%rip)      # 0x1b150
movl $0x877, 0xc98e(%rip)    # imm = 0x877
leaq 0x7c62(%rip), %rax      # 0x16423
movq %rax, 0xc990(%rip)      # 0x1b158
movzbl 0xc931(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0xe7dc
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xe802
jmp 0xe7e7
movq -0x18(%rbp), %rdi
callq 0x1800
movq $0x0, 0xc95d(%rip) # 0x1b158
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)