// File: /workspace/github_cpp_makefile_star2_O2/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 0x4b80
cmpq $0x2, %rax
jb 0x786a
movq (%r15), %rdi
callq 0x4b80
cmpq $0x4, %rax
jb 0x7890
movq 0x10777(%rip), %rdi     # 0x17fe8
leaq 0x8bde(%rip), %rsi      # 0x10456
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x79ad
movq (%r15), %rsi
leaq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x5fc6
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xc9d5
leaq -0x28(%rbp), %rdi
callq 0x3e82
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x7912
callq 0x49a8
testb %al, %al
je 0x791d
movq (%r15), %rsi
leaq -0x40(%rbp), %rdi
callq 0x5f48
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x5f48
movq -0x30(%rbp), %rdi
callq 0x49a8
movl %eax, %r12d
leaq -0x28(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
callq 0x3e82
testb %r12b, %r12b
je 0x7954
movq %rbx, %rdi
callq 0x4d18
jmp 0x79a4
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x79a4
movq (%r15), %rsi
leaq -0x40(%rbp), %rdi
callq 0x5f48
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x5fc6
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xc9d5
leaq -0x28(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
jmp 0x799f
movq (%r15), %rsi
leaq -0x50(%rbp), %rdi
callq 0x5f48
movq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x5f48
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x5fc6
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xc9d5
leaq -0x28(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x58(%rbp), %rdi
callq 0x3e82
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x3e82
jmp 0x79ce
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x3e82
jmp 0x79dc
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0x79fd
jmp 0x7a08
jmp 0x79e6
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x3e82
jmp 0x79f9
jmp 0x79f6
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x3e82
jmp 0x7a0b
jmp 0x7a08
jmp 0x7a08
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
jmp 0x7a18
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
callq 0x3e82
movq %rbx, %rdi
callq 0x3330
nop