// File: /workspace/github_cpp_makefile_star2_O1/0x0584[P]scmin-plus/src/builtin/builtin.cpp
// Function: builtin::_if(std::shared_ptr<sexpr> const&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::shared_ptr<sexpr>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::shared_ptr<sexpr>>>>&)
sexpr_t builtin::_if(const sexpr_t& args, env_t& bindings) {
    if (args->length() < 2 or args->length() > 3) {
        cerr << "Err: if requires a condition and at most two expression" << endl;
        return nullptr;
    }
    sexpr_t s = ::eval(args->car(), bindings);
    if (not s) return nullptr;
    else if (not s->isnil())
        return ::eval(args->cdr()->car(), bindings);
    else if (not args->cdr()->cdr()->isnil())
        return ::eval(args->cdr()->cdr()->car(), bindings);
    return nil();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rdi
callq 0x4ff4
cmpq $0x2, %rax
jb 0x86da
movq (%r15), %rdi
callq 0x4ff4
cmpq $0x4, %rax
jb 0x8732
movq 0x11907(%rip), %r14     # 0x19fe8
leaq 0xad8c(%rip), %rsi      # 0x13474
movl $0x37, %edx
movq %r14, %rdi
callq 0x3210
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x31d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3160
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%r15), %rsi
leaq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x634a
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xf8dd
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x875e
callq 0x4114
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x87c3
callq 0x4c7c
testb %al, %al
je 0x87ce
movq (%r15), %rsi
leaq -0x40(%rbp), %rdi
callq 0x627a
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x627a
movq -0x30(%rbp), %rdi
callq 0x4c7c
movl %eax, %r12d
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x87a3
callq 0x4114
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x87b1
callq 0x4114
testb %r12b, %r12b
je 0x880a
movq %rbx, %rdi
callq 0x51b8
jmp 0x8869
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x8869
movq (%r15), %rsi
leaq -0x40(%rbp), %rdi
callq 0x627a
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x634a
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xf8dd
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x8804
callq 0x4114
movq -0x38(%rbp), %rdi
jmp 0x885f
movq (%r15), %rsi
leaq -0x50(%rbp), %rdi
callq 0x627a
movq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x627a
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x634a
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xf8dd
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x884d
callq 0x4114
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x885b
callq 0x4114
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x8869
callq 0x4114
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x8722
callq 0x4114
jmp 0x8722
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x8896
callq 0x4114
jmp 0x8896
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x88a9
callq 0x4114
jmp 0x88a9
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0x88cf
jmp 0x88df
jmp 0x88b3
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x88cb
callq 0x4114
jmp 0x88cb
jmp 0x88c8
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x88e2
callq 0x4114
jmp 0x88e2
jmp 0x88df
jmp 0x88df
movq %rax, %rbx
movq -0x58(%rbp), %rdi
jmp 0x88ef
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x88f9
callq 0x4114
movq %rbx, %rdi
callq 0x3310
nop