// File: 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
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdi, -0x250(%rbp)
movq %rdi, %rax
movq %rax, -0x248(%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
jae 0x10296
movq 0x1dd8a(%rip), %rdi     # 0x2dff0
leaq 0x1124a(%rip), %rsi     # 0x214b7
callq 0x32c0
movq %rax, %rdi
movq 0x1dd14(%rip), %rsi     # 0x2df90
callq 0x32f0
movq -0x250(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
jmp 0x10a79
movq -0x18(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0xa1d0
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0xb520
jmp 0x102ba
leaq -0x80(%rbp), %rdi
callq 0x6ef0
leaq -0xb8(%rbp), %rdi
callq 0x10ec0
leaq -0x60(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x7270
movb %al, -0x251(%rbp)
jmp 0x102e8
movb -0x251(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x102f9
jmp 0x10712
leaq -0x60(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0xc8(%rbp), %rdi
callq 0xb520
jmp 0x10313
leaq -0x80(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x4420
leaq -0xc8(%rbp), %rdi
callq 0x4450
leaq -0x80(%rbp), %rdi
callq 0xb5c0
testb $0x1, %al
jne 0x1033e
jmp 0x1038a
leaq -0x80(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x72f0
movb %al, -0x252(%rbp)
jmp 0x10357
movb -0x252(%rbp), %al
testb $0x1, %al
jne 0x10363
jmp 0x1038a
leaq -0x80(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x75d0
movq %rax, -0x260(%rbp)
jmp 0x1037d
movq -0x260(%rbp), %rax
cmpq $0x2, %rax
je 0x103fc
movq 0x1dc5f(%rip), %rdi     # 0x2dff0
leaq 0x1115f(%rip), %rsi     # 0x214f7
callq 0x32c0
movq %rax, -0x268(%rbp)
jmp 0x103a6
movq -0x268(%rbp), %rdi
movq 0x1dbdc(%rip), %rsi     # 0x2df90
callq 0x32f0
jmp 0x103bb
movq -0x250(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
movl $0x1, -0xcc(%rbp)
jmp 0x10a27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x10a6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x10a50
leaq -0x80(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0xe0(%rbp), %rdi
callq 0xb520
jmp 0x10416
leaq -0xe0(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x7500
movb %al, -0x269(%rbp)
jmp 0x10432
movb -0x269(%rbp), %al
xorb $-0x1, %al
movb %al, -0x26a(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x4450
movb -0x26a(%rbp), %al
testb $0x1, %al
jne 0x10458
jmp 0x104c5
movq 0x1db91(%rip), %rdi     # 0x2dff0
leaq 0x110b1(%rip), %rsi     # 0x21517
callq 0x32c0
movq %rax, -0x278(%rbp)
jmp 0x10474
movq -0x278(%rbp), %rdi
movq 0x1db0e(%rip), %rsi     # 0x2df90
callq 0x32f0
jmp 0x10489
movq -0x250(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
movl $0x1, -0xcc(%rbp)
jmp 0x10a27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x4450
jmp 0x10a50
leaq -0x80(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x138(%rbp), %rdi
callq 0xb520
jmp 0x104df
leaq -0x138(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x4520
movq %rax, -0x280(%rbp)
jmp 0x104fc
movq -0x280(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x44d0
jmp 0x10511
leaq -0x100(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x3a60
jmp 0x10526
leaq -0x128(%rbp), %rdi
callq 0x4550
leaq -0x138(%rbp), %rdi
callq 0x4450
leaq -0xb8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x10ee0
movb %dl, -0x289(%rbp)
movq %rax, -0x288(%rbp)
jmp 0x10560
movb -0x289(%rbp), %al
movq -0x288(%rbp), %rcx
movq %rcx, -0x158(%rbp)
movb %al, -0x150(%rbp)
movq -0x158(%rbp), %rax
movq %rax, -0x148(%rbp)
movb -0x150(%rbp), %al
movb %al, -0x140(%rbp)
movb -0x140(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x105a5
jmp 0x1063b
movq 0x1da44(%rip), %rdi     # 0x2dff0
leaq 0x10f7e(%rip), %rsi     # 0x21531
callq 0x32c0
movq %rax, -0x298(%rbp)
jmp 0x105c1
movq -0x298(%rbp), %rdi
movq 0x1d9c1(%rip), %rsi     # 0x2df90
callq 0x32f0
jmp 0x105d6
movq -0x250(%rbp), %rdi
callq 0x78f0
jmp 0x105e4
movl $0x1, -0xcc(%rbp)
jmp 0x106c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x10619
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x4550
leaq -0x138(%rbp), %rdi
callq 0x4450
jmp 0x10a50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x10701
leaq -0x168(%rbp), %rdi
callq 0x78f0
jmp 0x10649
leaq -0x50(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x10b60
movq %rax, -0x2a0(%rbp)
jmp 0x10662
movq -0x2a0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
movq %rsi, -0x2a8(%rbp)
callq 0x4420
movq -0x2a8(%rbp), %rdi
callq 0x4450
leaq -0x60(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x178(%rbp), %rdi
callq 0xb440
jmp 0x106a2
leaq -0x60(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x4420
leaq -0x178(%rbp), %rdi
callq 0x4450
movl $0x0, -0xcc(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x31d0
movl -0xcc(%rbp), %eax
testl %eax, %eax
jne 0x10a27
jmp 0x106e4
jmp 0x102cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x4450
leaq -0x100(%rbp), %rdi
callq 0x31d0
jmp 0x10a50
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x188(%rbp), %rdi
callq 0xb520
jmp 0x1072c
leaq -0x60(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x4420
leaq -0x188(%rbp), %rdi
callq 0x4450
leaq -0x60(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x7270
movb %al, -0x2a9(%rbp)
jmp 0x10761
movb -0x2a9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x10772
jmp 0x109c2
leaq -0x60(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x198(%rbp), %rdi
callq 0xb520
jmp 0x1078c
leaq -0x80(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
leaq -0x198(%rbp), %rsi
movq %rsi, -0x2c0(%rbp)
callq 0x4420
movq -0x2c0(%rbp), %rdi
callq 0x4450
movq -0x2b8(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x1f0(%rbp), %rdi
callq 0xb520
jmp 0x107d3
leaq -0x1f0(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x4520
movq %rax, -0x2c8(%rbp)
jmp 0x107f0
movq -0x2c8(%rbp), %rsi
leaq -0x1e0(%rbp), %rdi
callq 0x44d0
jmp 0x10805
leaq -0x1b8(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x3a60
jmp 0x1081a
leaq -0x1e0(%rbp), %rdi
callq 0x4550
leaq -0x1f0(%rbp), %rdi
callq 0x4450
leaq -0x80(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x220(%rbp), %rdi
callq 0xb440
jmp 0x1084c
leaq -0x220(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
callq 0xb520
jmp 0x10869
leaq -0x200(%rbp), %rdi
leaq -0x210(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x19aa0
jmp 0x10882
leaq -0x50(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x10b60
movq %rax, -0x2d0(%rbp)
jmp 0x1089b
movq -0x2d0(%rbp), %rdi
leaq -0x200(%rbp), %rsi
movq %rsi, -0x2d8(%rbp)
callq 0x4420
movq -0x2d8(%rbp), %rdi
callq 0x4450
leaq -0x210(%rbp), %rdi
callq 0x4450
leaq -0x220(%rbp), %rdi
callq 0x4450
leaq -0x60(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x230(%rbp), %rdi
callq 0xb440
jmp 0x108f3
leaq -0x60(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x4420
leaq -0x230(%rbp), %rdi
callq 0x4450
leaq -0x1b8(%rbp), %rdi
callq 0x31d0
jmp 0x10748
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x10946
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x4550
leaq -0x1f0(%rbp), %rdi
callq 0x4450
jmp 0x10a50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x109b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x109a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x10999
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x4450
leaq -0x210(%rbp), %rdi
callq 0x4450
leaq -0x220(%rbp), %rdi
callq 0x4450
leaq -0x1b8(%rbp), %rdi
callq 0x31d0
jmp 0x10a50
movq -0x10(%rbp), %rdi
callq 0x4400
movq %rax, %rsi
leaq -0x240(%rbp), %rdi
callq 0xb440
jmp 0x109dc
movq -0x250(%rbp), %rdi
leaq -0x240(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0xe780
jmp 0x109f5
leaq -0x240(%rbp), %rdi
callq 0x4450
movl $0x1, -0xcc(%rbp)
jmp 0x10a27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x4450
jmp 0x10a50
leaq -0xb8(%rbp), %rdi
callq 0x10f20
leaq -0x80(%rbp), %rdi
callq 0x4450
leaq -0x60(%rbp), %rdi
callq 0x4450
leaq -0x50(%rbp), %rdi
callq 0x4250
jmp 0x10a79
leaq -0xb8(%rbp), %rdi
callq 0x10f20
leaq -0x80(%rbp), %rdi
callq 0x4450
leaq -0x60(%rbp), %rdi
callq 0x4450
leaq -0x50(%rbp), %rdi
callq 0x4250
jmp 0x10a89
movq -0x248(%rbp), %rax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x34f0
nopw %cs:(%rax,%rax)