// File: /workspace/github_c_makefile_star2_O0/mtnygard[P]complisp/lisp.c
// Function: compile_if_with_false_cond
TEST compile_if_with_false_cond(Buffer *buf) {
  ASTNode *node = Reader_read("(if #f 1 2)");
  int compile_result = Compile_entry(buf, node);
  ASSERT_EQ(compile_result, 0);
  // clang-format off
  byte expected[] = {
    // mov rax, 0x1f
    0x48, 0xc7, 0xc0, 0x1f, 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
    // end:
  };
  // 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(2), result, "0x%lx");
  AST_heap_free(node);
  PASS();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x7c23(%rip), %rdi      # 0x16446
callq 0x4e40
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4690
movl %eax, -0x1c(%rbp)
movl 0xc902(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xc8f9(%rip)      # 0x1b144
cmpl $0x0, -0x1c(%rbp)
je 0xe899
jmp 0xe853
leaq 0x5e49(%rip), %rax      # 0x146a3
movq %rax, 0xc8ef(%rip)      # 0x1b150
movl $0x87f, 0xc8dd(%rip)    # imm = 0x87F
leaq 0x7813(%rip), %rax      # 0x16085
movq %rax, 0xc8df(%rip)      # 0x1b158
movzbl 0xc880(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0xe88d
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xea02
jmp 0xe89b
leaq -0x50(%rbp), %rdi
leaq 0x5c3a(%rip), %rsi      # 0x144e0
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 0xe8d6
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xea02
jmp 0xe8d8
movq -0x10(%rbp), %rdi
callq 0x1c50
movq -0x10(%rbp), %rdi
callq 0x4f20
movq %rax, -0x60(%rbp)
movl 0xc850(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xc847(%rip)      # 0x1b144
movl $0x2, %edi
callq 0x1290
cmpq -0x60(%rbp), %rax
je 0xe9e5
movq 0xc6b8(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x6e0c(%rip), %rsi      # 0x1572e
movb $0x0, %al
callq 0x1100
movq 0xc6a0(%rip), %rax      # 0x1afd0
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movl $0x2, %edi
callq 0x1290
movq -0x68(%rbp), %rdi
movq %rax, %rdx
leaq 0x7979(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xc673(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x6dd3(%rip), %rsi      # 0x1573a
movb $0x0, %al
callq 0x1100
movq 0xc65b(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
movq -0x60(%rbp), %rdx
leaq 0x7945(%rip), %rsi      # 0x162c8
movb $0x0, %al
callq 0x1100
movq 0xc63f(%rip), %rax      # 0x1afd0
movq (%rax), %rdi
leaq 0x8021(%rip), %rsi      # 0x169bc
movb $0x0, %al
callq 0x1100
leaq 0x5cfa(%rip), %rax      # 0x146a3
movq %rax, 0xc7a0(%rip)      # 0x1b150
movl $0x895, 0xc78e(%rip)    # imm = 0x895
leaq 0x7a91(%rip), %rax      # 0x16452
movq %rax, 0xc790(%rip)      # 0x1b158
movzbl 0xc731(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0xe9dc
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xea02
jmp 0xe9e7
movq -0x18(%rbp), %rdi
callq 0x1800
movq $0x0, 0xc75d(%rip) # 0x1b158
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)