// File: 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
subq $0xe0, %rsp
movq %rdi, -0xc8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x75d0
cmpq $0x2, %rax
jb 0xe416
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x75d0
cmpq $0x3, %rax
jbe 0xe44d
movq 0x1fbd3(%rip), %rdi     # 0x2dff0
leaq 0x13032(%rip), %rsi     # 0x21456
callq 0x32c0
movq %rax, %rdi
movq 0x1fb5d(%rip), %rsi     # 0x2df90
callq 0x32f0
movq -0xc8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
jmp 0xe762
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0xb520
movq -0xd0(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x19aa0
jmp 0xe47f
leaq -0x38(%rbp), %rdi
callq 0x4450
leaq -0x28(%rbp), %rdi
callq 0xb5c0
testb $0x1, %al
jne 0xe4cb
movq -0xc8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
movl $0x1, -0x48(%rbp)
jmp 0xe74c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4450
jmp 0xe772
leaq -0x28(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x7270
movb %al, -0xd1(%rbp)
jmp 0xe4e4
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0xe598
jmp 0xe4f4
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x68(%rbp), %rdi
callq 0xb440
jmp 0xe50b
leaq -0x68(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0xb520
jmp 0xe522
movq -0xc8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x58(%rbp), %rsi
callq 0x19aa0
jmp 0xe538
leaq -0x58(%rbp), %rdi
callq 0x4450
leaq -0x68(%rbp), %rdi
callq 0x4450
movl $0x1, -0x48(%rbp)
jmp 0xe74c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xe757
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xe58a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4450
leaq -0x68(%rbp), %rdi
callq 0x4450
jmp 0xe757
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0xb440
jmp 0xe5b2
leaq -0x88(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0xb440
jmp 0xe5cc
leaq -0x78(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x7270
movb %al, -0xd2(%rbp)
jmp 0xe5e5
movb -0xd2(%rbp), %al
xorb $-0x1, %al
movb %al, -0xd3(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4450
leaq -0x88(%rbp), %rdi
callq 0x4450
movb -0xd3(%rbp), %al
testb $0x1, %al
jne 0xe617
jmp 0xe733
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0xb440
jmp 0xe631
leaq -0xb8(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
callq 0xb440
jmp 0xe64e
leaq -0xa8(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
callq 0xb520
jmp 0xe66b
movq -0xc8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x98(%rbp), %rsi
callq 0x19aa0
jmp 0xe684
leaq -0x98(%rbp), %rdi
callq 0x4450
leaq -0xa8(%rbp), %rdi
callq 0x4450
leaq -0xb8(%rbp), %rdi
callq 0x4450
movl $0x1, -0x48(%rbp)
jmp 0xe74c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xe6d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4450
leaq -0x88(%rbp), %rdi
callq 0x4450
jmp 0xe757
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xe725
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xe719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4450
leaq -0xa8(%rbp), %rdi
callq 0x4450
leaq -0xb8(%rbp), %rdi
callq 0x4450
jmp 0xe757
jmp 0xe735
jmp 0xe737
movq -0xc8(%rbp), %rdi
callq 0x78f0
jmp 0xe745
movl $0x1, -0x48(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4450
jmp 0xe762
leaq -0x28(%rbp), %rdi
callq 0x4450
jmp 0xe772
movq -0xc0(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x34f0
nopl (%rax,%rax)