// File: /workspace/github_c_makefile_star2_O0/mtnygard[P]complisp/lisp.c
// Function: compile_symbol_in_env_returns_value
TEST compile_symbol_in_env_returns_value(Buffer *buf) {
  ASTNode *node = AST_new_symbol("hello");
  Env env0 = Env_bind("hello", 33, /*prev=*/NULL);
  Env env1 = Env_bind("world", 66, &env0);
  int compile_result = Compile_expr(buf, node, -kWordSize, &env1, NULL);
  ASSERT_EQ(compile_result, 0);
  // clang-format off
  byte expected[] = {
    // mov rax, [rbp+33]
    0x48, 0x8b, 0x44, 0x24, 33};
  // clang-format on
  EXPECT_EQUALS_BYTES(buf, expected);
  AST_heap_free(node);
  PASS();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x8363(%rip), %rdi      # 0x15d19
callq 0x19d0
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
leaq 0x834f(%rip), %rsi      # 0x15d19
movl $0x21, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x1520
leaq -0x48(%rbp), %rdi
leaq 0x835e(%rip), %rsi      # 0x15d41
movl $0x42, %edx
leaq -0x30(%rbp), %rcx
callq 0x1520
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq $-0x8, %rdx
leaq -0x48(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x29f0
movl %eax, -0x4c(%rbp)
movl 0xd72d(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xd724(%rip)      # 0x1b144
cmpl $0x0, -0x4c(%rbp)
je 0xda6e
jmp 0xda28
leaq 0x6c74(%rip), %rax      # 0x146a3
movq %rax, 0xd71a(%rip)      # 0x1b150
movl $0x809, 0xd708(%rip)    # imm = 0x809
leaq 0x863e(%rip), %rax      # 0x16085
movq %rax, 0xd70a(%rip)      # 0x1b158
movzbl 0xd6ab(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0xda62
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdb8f
jmp 0xda70
movl 0x6a24(%rip), %eax      # 0x1449a
movl %eax, -0x51(%rbp)
movb 0x6a1f(%rip), %al       # 0x1449e
movb %al, -0x4d(%rbp)
leaq -0x51(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq $0x5, -0x60(%rbp)
leaq 0xd644(%rip), %rax      # 0x1b0e8
movq %rax, -0x78(%rbp)
movl 0xd696(%rip), %eax      # 0x1b144
addl $0x1, %eax
movl %eax, 0xd68d(%rip)      # 0x1b144
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x78(%rbp), %rdx
leaq -0x70(%rbp), %rcx
callq 0x11f00
cmpl $0x0, %eax
jne 0xdb70
cmpq $0x0, -0x78(%rbp)
je 0xdae6
movq -0x78(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xdb2b
jmp 0xdae8
leaq 0x6bb4(%rip), %rax      # 0x146a3
movq %rax, 0xd65a(%rip)      # 0x1b150
movl $0x80f, 0xd648(%rip)    # imm = 0x80F
leaq 0x7fd6(%rip), %rax      # 0x15add
movq %rax, 0xd64a(%rip)      # 0x1b158
movzbl 0xd5eb(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0xdb22
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdb8f
jmp 0xdb2d
leaq 0x6b6f(%rip), %rax      # 0x146a3
movq %rax, 0xd615(%rip)      # 0x1b150
movl $0x80f, 0xd603(%rip)    # imm = 0x80F
leaq 0x87fb(%rip), %rax      # 0x16347
movq %rax, 0xd605(%rip)      # 0x1b158
movzbl 0xd5a6(%rip), %eax      # 0x1b100
andl $0x4, %eax
cmpl $0x0, %eax
je 0xdb67
callq 0x1040
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdb8f
jmp 0xdb72
jmp 0xdb74
movq -0x18(%rbp), %rdi
callq 0x1800
movq $0x0, 0xd5d0(%rip) # 0x1b158
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)