// File: 0x0584[P]scmin-plus/src/repl/eval.cpp
// Function: eval(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 eval(const sexpr_t& expr, env_t& parent) {
    sexpr_t op, args, res;

    if (not (expr and expr->islist()))
        return sexpr::resolve(expr, parent);
    op = eval(expr->car(), parent);
    if (not op or not op->islambda()) {
        cerr << "Err: operator " << op << " is not a lambda" << endl;
        return nullptr;
    }
    auto lamb = any_cast<sexpr::sexpr_lambda>(*op->blob);
    if (not lamb.require_evaled_args()) args = expr->cdr();
    else args = eval_args(expr->cdr(), parent);
    if (not args) return nullptr;
    res = lamb.eval(args, parent);
    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x138(%rbp)
movq %rdi, %rax
movq %rax, -0x130(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x6ef0
leaq -0x38(%rbp), %rdi
callq 0x6ef0
leaq -0x48(%rbp), %rdi
callq 0x6ef0
movq -0x10(%rbp), %rdi
callq 0xb5c0
testb $0x1, %al
jne 0x19af2
jmp 0x19b17
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x72f0
movb %al, -0x139(%rbp)
jmp 0x19b0b
movb -0x139(%rbp), %al
testb $0x1, %al
jne 0x19b4a
jmp 0x19b17
movq -0x138(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x16bd0
jmp 0x19b2d
movl $0x1, -0x58(%rbp)
jmp 0x19e51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x19e7c
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0xb520
jmp 0x19b61
movq -0x18(%rbp), %rdx
leaq -0x68(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x19aa0
jmp 0x19b74
leaq -0x28(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4420
leaq -0x68(%rbp), %rdi
callq 0x4450
leaq -0x78(%rbp), %rdi
callq 0x4450
leaq -0x28(%rbp), %rdi
callq 0xb5c0
testb $0x1, %al
jne 0x19ba2
jmp 0x19bcb
leaq -0x28(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x7590
movb %al, -0x13a(%rbp)
jmp 0x19bbb
movb -0x13a(%rbp), %al
testb $0x1, %al
jne 0x19caa
jmp 0x19bcb
movq 0x1441e(%rip), %rdi     # 0x2dff0
leaq 0x7c2e(%rip), %rsi      # 0x21807
callq 0x32c0
movq %rax, -0x148(%rbp)
jmp 0x19be7
leaq -0x88(%rbp), %rdi
movq %rdi, -0x158(%rbp)
leaq -0x28(%rbp), %rsi
callq 0x43d0
movq -0x148(%rbp), %rdi
movq -0x158(%rbp), %rsi
callq 0x10b90
movq %rax, -0x150(%rbp)
jmp 0x19c1a
movq -0x150(%rbp), %rdi
leaq 0x7bee(%rip), %rsi      # 0x21816
callq 0x32c0
movq %rax, -0x160(%rbp)
jmp 0x19c36
movq -0x160(%rbp), %rdi
movq 0x1434c(%rip), %rsi     # 0x2df90
callq 0x32f0
jmp 0x19c4b
leaq -0x88(%rbp), %rdi
callq 0x4450
movq -0x138(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
movl $0x1, -0x58(%rbp)
jmp 0x19e51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4450
jmp 0x19e7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4450
jmp 0x19e7c
leaq -0x28(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x4520
movq %rax, -0x168(%rbp)
jmp 0x19cc4
movq -0x168(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x11330
jmp 0x19cd9
leaq -0xe8(%rbp), %rdi
callq 0x4050
movb %al, -0x169(%rbp)
jmp 0x19ced
movb -0x169(%rbp), %al
testb $0x1, %al
jne 0x19d45
jmp 0x19cf9
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0xf8(%rbp), %rdi
callq 0xb440
jmp 0x19d13
leaq -0x38(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x4420
leaq -0xf8(%rbp), %rdi
callq 0x4450
jmp 0x19dbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x19e43
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x118(%rbp), %rdi
callq 0xb440
jmp 0x19d5f
movq -0x18(%rbp), %rdx
leaq -0x108(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x19870
jmp 0x19d78
leaq -0x38(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x4420
leaq -0x108(%rbp), %rdi
callq 0x4450
leaq -0x118(%rbp), %rdi
callq 0x4450
jmp 0x19dbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x4450
jmp 0x19e43
leaq -0x38(%rbp), %rdi
callq 0xb5c0
testb $0x1, %al
jne 0x19de5
movq -0x138(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
movl $0x1, -0x58(%rbp)
jmp 0x19e35
movq -0x18(%rbp), %rcx
leaq -0x128(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0x41a0
jmp 0x19e02
leaq -0x48(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x4420
leaq -0x128(%rbp), %rdi
callq 0x4450
movq -0x138(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xa6f0
movl $0x1, -0x58(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x9f80
jmp 0x19e51
leaq -0xe8(%rbp), %rdi
callq 0x9f80
jmp 0x19e7c
leaq -0x48(%rbp), %rdi
callq 0x4450
leaq -0x38(%rbp), %rdi
callq 0x4450
leaq -0x28(%rbp), %rdi
callq 0x4450
movq -0x130(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x4450
leaq -0x38(%rbp), %rdi
callq 0x4450
leaq -0x28(%rbp), %rdi
callq 0x4450
movq -0x50(%rbp), %rdi
callq 0x34f0