// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x60(%rbp)
movq (%rsi), %rdi
testq %rdi, %rdi
je 0xcad3
callq 0x49e0
testb %al, %al
je 0xcad3
movq (%r15), %rsi
leaq -0x30(%rbp), %rdi
callq 0x5fc6
leaq -0xe0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movq %r14, %rdx
callq 0xc9d5
leaq -0x50(%rbp), %r12
leaq -0xe0(%rbp), %rsi
movq %r12, %rdi
callq 0x4354
leaq -0xd8(%rbp), %rdi
callq 0x3e82
leaq -0x28(%rbp), %rdi
callq 0x3e82
movq (%r12), %rdi
testq %rdi, %rdi
je 0xcae6
callq 0x4b64
testb %al, %al
je 0xcae6
movq -0x50(%rbp), %rax
movq (%rax), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x9271
leaq -0xe0(%rbp), %rdi
callq 0x3b56
testb %al, %al
je 0xcb42
movq (%r15), %rsi
leaq -0x70(%rbp), %rdi
callq 0x5f48
leaq -0x30(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movq %r14, %rdx
callq 0xc859
leaq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4354
leaq -0x28(%rbp), %rdi
callq 0x3e82
leaq -0x68(%rbp), %rdi
jmp 0xcb5f
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xb670
jmp 0xcbc6
movq 0xb4fb(%rip), %rdi      # 0x17fe8
leaq 0x3d23(%rip), %rsi      # 0x10817
callq 0x31f0
movq %rax, %r14
leaq -0x80(%rbp), %r15
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
callq 0x3e44
movq %r14, %rdi
movq %r15, %rsi
callq 0x8ebe
leaq 0x3d08(%rip), %rsi      # 0x10826
movq %rax, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3100
leaq -0x78(%rbp), %rdi
callq 0x3e82
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0xcbc6
movq (%r15), %rsi
leaq -0x30(%rbp), %rdi
callq 0x5f48
leaq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4354
leaq -0x28(%rbp), %rdi
callq 0x3e82
cmpq $0x0, -0x40(%rbp)
je 0xcbb4
leaq -0x30(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movq %r14, %rcx
callq 0x3c06
leaq -0x60(%rbp), %r14
leaq -0x30(%rbp), %rsi
movq %r14, %rdi
callq 0x4354
leaq -0x28(%rbp), %rdi
callq 0x3e82
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
andq $0x0, 0x8(%r14)
movq %rax, 0x8(%rbx)
andq $0x0, (%r14)
jmp 0xcbba
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
leaq -0xe0(%rbp), %rdi
callq 0x57a2
leaq -0x58(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
movq %rbx, %rax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3e82
jmp 0xcc0b
jmp 0xcc08
jmp 0xcc08
jmp 0xcc08
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x57a2
jmp 0xcc37
jmp 0xcc34
movq %rax, %rbx
leaq -0x28(%rbp), %rdi
jmp 0xcc2d
jmp 0xcc34
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3e82
jmp 0xcc37
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
movq %rbx, %rdi
callq 0x3330
nop