// File: /workspace/github_cpp_makefile_star2_O2/0x0584[P]scmin-plus/src/builtin/builtin.cpp
// Function: builtin::_let_rec(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::_let_rec(const sexpr_t& args, env_t& bindings) {
    if (args->length() < 2) {
        cerr << "Err: let requires an env and sexpr(s)" << endl;
        return nullptr;
    }

    env_t local = bindings;
    sexpr_t walk = args->car(), curr;
    unordered_set<string> seen;

    while (not walk->isnil()) {
        curr = walk->car();
        if (not curr or not curr->islist() or curr->length() != 2) {
            cerr << "Err: let bound is mal formatted" << endl;
            return nullptr;
        }
        if (not curr->car()->issymb()) {
            cerr << "Err: cannot bind constant" << endl;
            return nullptr;
        }
        auto sy = any_cast<sexpr_text>(*curr->car()->blob).text();
        if (not seen.insert(sy).second) {
            cerr << "Err: variable appeared twice!" << endl;
            return nil();
        }
        local[sy] = nil();
        walk = walk->cdr();
    }
    walk = args->car();
    while (not walk->isnil()) {
        curr = walk->car();
        auto sy = any_cast<sexpr_text>(*curr->car()->blob).text();
        local[sy] = ::eval(curr->cdr()->car(), local);
        walk = walk->cdr();
    }
    return builtin::_begin(args->cdr(), local);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movq (%rsi), %rdi
callq 0x4b80
cmpq $0x1, %rax
ja 0x8a14
movq 0xf5f8(%rip), %rdi      # 0x17fe8
leaq 0x7ac0(%rip), %rsi      # 0x104b7
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq %r12, %rax
jmp 0x8dbc
leaq -0xf8(%rbp), %rdi
movq %rbx, %rsi
callq 0x591a
movq %r14, -0x90(%rbp)
movq (%r14), %rsi
leaq -0x38(%rbp), %rdi
callq 0x5fc6
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %r15
movaps %xmm0, (%r15)
leaq -0x100(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq -0x88(%rbp), %r14
leaq -0xc0(%rbp), %r13
movq %r12, %rbx
movq -0x38(%rbp), %rdi
callq 0x49a8
testb %al, %al
jne 0x8bf5
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x5fc6
movq %r15, %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x80(%rbp), %rdi
callq 0x3e82
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x8bd5
callq 0x49e0
testb %al, %al
je 0x8bd5
movq -0x50(%rbp), %rdi
callq 0x4b80
cmpq $0x2, %rax
jne 0x8bd5
movq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x5fc6
movq -0x88(%rbp), %rdi
callq 0x4b10
movl %eax, %ebx
leaq -0x80(%rbp), %rdi
callq 0x3e82
testb %bl, %bl
je 0x8d6b
movq -0x50(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x5fc6
movq -0x60(%rbp), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x3d07
movq %r13, %rdi
movq %r14, %rsi
callq 0x37cc
movq %r14, %rdi
callq 0x30f0
leaq -0x58(%rbp), %rdi
callq 0x3e82
leaq -0x130(%rbp), %rdi
movq %r13, %rsi
callq 0x96d4
movl %edx, %ebx
testb $0x1, %dl
je 0x8b99
movq %r14, %rdi
callq 0x4d18
leaq -0xf8(%rbp), %rdi
movq %r13, %rsi
callq 0x9466
movq %rax, %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x80(%rbp), %rdi
callq 0x3e82
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x5f48
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x80(%rbp), %rdi
callq 0x3e82
jmp 0x8bbc
movq 0xf448(%rip), %rdi      # 0x17fe8
leaq 0x798a(%rip), %rsi      # 0x10531
callq 0x31f0
movq %rax, %rdi
callq 0x3100
movq %r12, %rdi
callq 0x4d18
movq %r13, %rdi
callq 0x30f0
testb $0x1, %bl
movq %r12, %rbx
jne 0x8a74
jmp 0x8d8f
movq 0xf40c(%rip), %rdi      # 0x17fe8
leaq 0x7914(%rip), %rsi      # 0x104f7
callq 0x31f0
movq %rax, %rdi
callq 0x3100
jmp 0x8d89
movq -0x90(%rbp), %rax
movq (%rax), %rsi
leaq -0x88(%rbp), %rdi
callq 0x5fc6
leaq -0x38(%rbp), %rdi
leaq -0x88(%rbp), %r14
movq %r14, %rsi
callq 0x4354
leaq -0x80(%rbp), %rdi
callq 0x3e82
leaq -0x60(%rbp), %rbx
leaq -0xc0(%rbp), %r15
leaq -0xf8(%rbp), %r13
movq -0x38(%rbp), %rdi
callq 0x49a8
testb %al, %al
jne 0x8d31
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x5fc6
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x80(%rbp), %rdi
callq 0x3e82
movq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x5fc6
movq -0x60(%rbp), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x3d07
movq %r15, %rdi
movq %r14, %rsi
callq 0x37cc
movq %r14, %rdi
callq 0x30f0
leaq -0x58(%rbp), %rdi
callq 0x3e82
movq -0x50(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x5f48
movq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0x5fc6
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xc9d5
movq %r13, %rdi
movq %r15, %rsi
callq 0x9466
movq %rax, %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x80(%rbp), %rdi
callq 0x3e82
leaq -0x58(%rbp), %rdi
callq 0x3e82
leaq -0x98(%rbp), %rdi
callq 0x3e82
movq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x5f48
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x80(%rbp), %rdi
callq 0x3e82
movq %r15, %rdi
callq 0x30f0
jmp 0x8c39
movq -0x90(%rbp), %rax
movq (%rax), %rsi
leaq -0x88(%rbp), %rdi
callq 0x5f48
leaq -0x88(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
movq %r12, %rbx
movq %r12, %rdi
callq 0x7a26
leaq -0x80(%rbp), %rdi
callq 0x3e82
jmp 0x8d8f
movq 0xf276(%rip), %rdi      # 0x17fe8
leaq 0x779e(%rip), %rsi      # 0x10517
callq 0x31f0
movq %r12, %rbx
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
leaq -0x130(%rbp), %rdi
callq 0x935a
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x30(%rbp), %rdi
callq 0x3e82
leaq -0xf8(%rbp), %rdi
callq 0x3d38
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8dfc
jmp 0x8e70
jmp 0x8e70
movq %rax, %r14
jmp 0x8e91
jmp 0x8e70
jmp 0x8e5f
movq %rax, %r14
leaq -0x80(%rbp), %rdi
jmp 0x8e54
jmp 0x8e5f
jmp 0x8e5f
jmp 0x8e2e
jmp 0x8e29
jmp 0x8e70
movq %rax, %r14
leaq -0x80(%rbp), %rdi
jmp 0x8e41
jmp 0x8e70
movq %rax, %r14
jmp 0x8e18
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x3e82
leaq -0x58(%rbp), %rdi
callq 0x3e82
jmp 0x8e4d
jmp 0x8e5f
jmp 0x8e70
jmp 0x8e70
movq %rax, %r14
jmp 0x8e3d
movq %rax, %r14
leaq -0x88(%rbp), %rdi
callq 0x30f0
leaq -0x58(%rbp), %rdi
callq 0x3e82
jmp 0x8e73
jmp 0x8e5f
movq %rax, %r14
leaq -0x98(%rbp), %rdi
callq 0x3e82
jmp 0x8e62
jmp 0x8e70
jmp 0x8e70
movq %rax, %r14
leaq -0xc0(%rbp), %rdi
callq 0x30f0
jmp 0x8e73
movq %rax, %r14
leaq -0x130(%rbp), %rdi
callq 0x935a
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x30(%rbp), %rdi
callq 0x3e82
leaq -0xf8(%rbp), %rdi
callq 0x3d38
movq %r14, %rdi
callq 0x3330
nop