// File: /workspace/github_cpp_makefile_star2_O3/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 0x4fb6
cmpq $0x2, %rax
jb 0x8492
movq (%r15), %rdi
callq 0x4fb6
cmpq $0x4, %rax
jb 0x84ea
movq 0x11b4f(%rip), %r14     # 0x19fe8
leaq 0xafd4(%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 0x628e
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xf373
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x8516
callq 0x4104
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x857b
callq 0x4c74
testb %al, %al
je 0x8586
movq (%r15), %rsi
leaq -0x40(%rbp), %rdi
callq 0x61be
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x61be
movq -0x30(%rbp), %rdi
callq 0x4c74
movl %eax, %r12d
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x855b
callq 0x4104
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x8569
callq 0x4104
testb %r12b, %r12b
je 0x85c2
movq %rbx, %rdi
callq 0x514c
jmp 0x8621
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x8621
movq (%r15), %rsi
leaq -0x40(%rbp), %rdi
callq 0x61be
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x628e
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xf373
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x85bc
callq 0x4104
movq -0x38(%rbp), %rdi
jmp 0x8617
movq (%r15), %rsi
leaq -0x50(%rbp), %rdi
callq 0x61be
movq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x61be
movq -0x40(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x628e
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xf373
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x8605
callq 0x4104
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x8613
callq 0x4104
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x8621
callq 0x4104
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x84da
callq 0x4104
jmp 0x84da
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x864e
callq 0x4104
jmp 0x864e
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x8661
callq 0x4104
jmp 0x8661
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0x8687
jmp 0x8697
jmp 0x866b
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x8683
callq 0x4104
jmp 0x8683
jmp 0x8680
movq %rax, %rbx
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x869a
callq 0x4104
jmp 0x869a
jmp 0x8697
jmp 0x8697
movq %rax, %rbx
movq -0x58(%rbp), %rdi
jmp 0x86a7
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x86b1
callq 0x4104
movq %rbx, %rdi
callq 0x3310
nop