// File: /workspace/github_cpp_makefile_star2_O2/0x0584[P]scmin-plus/src/builtin/builtin.cpp
// Function: builtin::_let_astrk(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_astrk(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->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] = ::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, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rdi
callq 0x4b80
cmpq $0x1, %rax
ja 0x8642
movq 0xf9c8(%rip), %rdi      # 0x17fe8
leaq 0x7e90(%rip), %rsi      # 0x104b7
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, %rax
jmp 0x88f9
movq %rbx, -0x30(%rbp)
leaq -0xd8(%rbp), %rdi
movq %r14, %rsi
callq 0x591a
movq %r15, -0x90(%rbp)
movq (%r15), %rsi
leaq -0x50(%rbp), %rdi
callq 0x5fc6
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rax
movaps %xmm0, (%rax)
leaq -0xe0(%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 -0x78(%rbp), %r14
leaq -0x88(%rbp), %r15
leaq -0x130(%rbp), %rbx
leaq -0xd8(%rbp), %r12
movq -0x50(%rbp), %rdi
callq 0x49a8
testb %al, %al
jne 0x8874
movq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x5fc6
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x70(%rbp), %rdi
callq 0x3e82
movq -0x40(%rbp), %rdi
callq 0x49e0
testb %al, %al
je 0x8857
movq -0x40(%rbp), %rdi
callq 0x4b80
cmpq $0x2, %rax
jne 0x8857
movq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x5fc6
movq -0x78(%rbp), %rdi
callq 0x4b10
movl %eax, %r14d
leaq -0x70(%rbp), %rdi
callq 0x3e82
testb %r14b, %r14b
je 0x88a6
movq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x5fc6
movq -0x88(%rbp), %rax
movq (%rax), %rsi
leaq -0x78(%rbp), %r14
movq %r14, %rdi
callq 0x3d07
movq %rbx, %rdi
movq %r14, %rsi
callq 0x37cc
movq %r14, %rdi
callq 0x30f0
leaq -0x80(%rbp), %rdi
callq 0x3e82
leaq -0x110(%rbp), %rdi
movq %rbx, %rsi
callq 0x96d4
movl %edx, %r14d
testb $0x1, %dl
je 0x881b
movq %rbx, %r13
movq -0x40(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x5f48
movq -0xa0(%rbp), %rsi
movq %r15, %rbx
movq %r15, %rdi
callq 0x5fc6
leaq -0x78(%rbp), %rdi
movq %rbx, %rsi
movq %r12, %rbx
movq %r12, %rdx
callq 0xc9d5
movq %rbx, %rdi
movq %r13, %rbx
movq %r13, %rsi
callq 0x9466
movq %rax, %rdi
leaq -0x78(%rbp), %r13
movq %r13, %rsi
callq 0x4354
leaq -0x70(%rbp), %rdi
callq 0x3e82
leaq -0x80(%rbp), %rdi
callq 0x3e82
leaq -0x98(%rbp), %rdi
callq 0x3e82
movq -0x50(%rbp), %rsi
movq %r13, %rdi
callq 0x5f48
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0x4354
leaq -0x70(%rbp), %rdi
callq 0x3e82
jmp 0x883f
movq 0xf7c6(%rip), %rdi      # 0x17fe8
leaq 0x7d08(%rip), %rsi      # 0x10531
callq 0x31f0
movq %rax, %rdi
callq 0x3100
movq -0x30(%rbp), %rdi
callq 0x4d18
movq %rbx, %rdi
callq 0x30f0
testb $0x1, %r14b
leaq -0x78(%rbp), %r14
jne 0x86ad
jmp 0x88cb
movq 0xf78a(%rip), %rdi      # 0x17fe8
leaq 0x7c92(%rip), %rsi      # 0x104f7
callq 0x31f0
movq %rax, %rdi
callq 0x3100
jmp 0x88c1
movq -0x90(%rbp), %rax
movq (%rax), %rsi
leaq -0x78(%rbp), %rdi
callq 0x5f48
leaq -0x78(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
movq -0x30(%rbp), %rdi
callq 0x7a26
leaq -0x70(%rbp), %rdi
callq 0x3e82
jmp 0x88cb
movq 0xf73b(%rip), %rdi      # 0x17fe8
leaq 0x7c63(%rip), %rsi      # 0x10517
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movq -0x30(%rbp), %rax
movups %xmm0, (%rax)
leaq -0x110(%rbp), %rdi
callq 0x935a
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0xd8(%rbp), %rdi
callq 0x3d38
movq -0x30(%rbp), %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8965
jmp 0x8988
movq %rax, %rbx
jmp 0x89a9
jmp 0x8988
jmp 0x8977
jmp 0x8977
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x3e82
jmp 0x892e
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x3e82
jmp 0x893c
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x3e82
jmp 0x897a
movq %rax, %rbx
jmp 0x895f
jmp 0x8977
jmp 0x8988
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x30f0
leaq -0x80(%rbp), %rdi
jmp 0x896c
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x3e82
jmp 0x898b
jmp 0x8988
jmp 0x8988
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x30f0
jmp 0x898b
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0x935a
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0xd8(%rbp), %rdi
callq 0x3d38
movq %rbx, %rdi
callq 0x3330
nop