// File: /workspace/github_cpp_makefile_star2_O2/0x0584[P]scmin-plus/src/builtin/builtin.cpp
// Function: builtin::_quasiquote(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::_quasiquote(const sexpr_t& args, env_t& bindings) {
    if (args->length() != 1) {
        cerr << "quasiquote expects only one argument" << endl;
        return nullptr;
    }
    sexpr_t e, tail, walk;

    if (not args->car()->islist())
        return args->car();
    walk = args->car();
    while (not walk->isnil()) {
        sexpr_t tmp = cons(walk->car(), nil());

        if (walk->car()->islist() and walk->car()->car()->issymb()) {
            auto sy = any_cast<sexpr_text>(*walk->car()->car()->blob).text();
            if (sy == "unquote" or sy == "unquote-splicing") {
                tmp = builtin::_unquote(walk->car()->cdr(), bindings);
                if (sy == "unquote")
                    tmp = cons(tmp, nil());
            }
        }
        if (not e)
            tail = e = tmp;
        else {
            tail->setcdr(tmp);
            tail = tail->cdr();
        }
        walk = walk->cdr();
    }
    return e;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, -0xc0(%rbp)
movq %rsi, %rbx
movq %rdi, %r15
movq (%rsi), %rdi
callq 0x4b80
cmpq $0x1, %rax
jne 0x6ec5
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0x40(%rbp)
movq (%rbx), %rsi
leaq -0x98(%rbp), %rdi
callq 0x5fc6
movq -0x98(%rbp), %rdi
callq 0x49e0
movl %eax, %r14d
leaq -0x90(%rbp), %rdi
callq 0x3e82
testb %r14b, %r14b
je 0x6ee9
movq %r15, -0xb8(%rbp)
movq (%rbx), %rsi
leaq -0x98(%rbp), %rdi
callq 0x5fc6
leaq -0x40(%rbp), %rdi
leaq -0x98(%rbp), %r14
movq %r14, %rsi
callq 0x4354
leaq -0x90(%rbp), %rdi
callq 0x3e82
leaq -0xc8(%rbp), %r12
leaq -0xf0(%rbp), %r13
leaq -0xd0(%rbp), %rbx
leaq -0x50(%rbp), %r15
movq -0x40(%rbp), %rdi
callq 0x49a8
testb %al, %al
jne 0x6ef6
movq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x5fc6
movq %r13, %rdi
callq 0x4d18
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x4dd5
leaq -0xe8(%rbp), %rdi
callq 0x3e82
leaq -0x90(%rbp), %rdi
callq 0x3e82
movq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x5fc6
movq -0x98(%rbp), %rdi
callq 0x49e0
testb %al, %al
je 0x6e0f
movq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x5fc6
movq -0x50(%rbp), %rsi
movq %r13, %rdi
callq 0x5fc6
movq -0xf0(%rbp), %rdi
callq 0x4b10
movl %eax, %r12d
leaq -0xe8(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x90(%rbp), %rdi
callq 0x3e82
testb %r12b, %r12b
leaq -0xc8(%rbp), %r12
je 0x6e1b
movq -0x40(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x5fc6
movq -0x70(%rbp), %rsi
movq %r15, %rdi
callq 0x5fc6
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq %r14, %rdi
callq 0x3d07
movq %r13, %rdi
movq %r14, %rsi
callq 0x37cc
movq %r14, %rdi
callq 0x30f0
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x68(%rbp), %rdi
callq 0x3e82
movq %r13, %rdi
leaq 0x95ea(%rip), %rsi      # 0x10332
callq 0x8ffa
testb %al, %al
jne 0x6d68
movq %r13, %rdi
leaq 0x95df(%rip), %rsi      # 0x1033a
callq 0x8ffa
testb %al, %al
je 0x6e05
movq -0x40(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x5fc6
movq -0x70(%rbp), %rsi
movq %r15, %rdi
callq 0x5f48
movq %r14, %rdi
movq %r15, %rsi
movq -0xc0(%rbp), %rdx
callq 0x6a86
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x90(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x68(%rbp), %rdi
callq 0x3e82
movq %r13, %rdi
leaq 0x956c(%rip), %rsi      # 0x10332
callq 0x8ffa
testb %al, %al
je 0x6e05
movq %r15, %rdi
callq 0x4d18
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x4dd5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x90(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
movq %r13, %rdi
callq 0x30f0
jmp 0x6e1b
leaq -0x90(%rbp), %rdi
callq 0x3e82
cmpq $0x0, -0x60(%rbp)
je 0x6e5d
movq -0xb0(%rbp), %rdi
movq %rbx, %rsi
callq 0x5f06
movq -0xb0(%rbp), %rsi
movq %r14, %rdi
callq 0x5f48
leaq -0xb0(%rbp), %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x90(%rbp), %rdi
callq 0x3e82
jmp 0x6e94
movq %r13, %r14
movq %r12, %r13
movq %r15, %r12
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x6002
leaq -0xb0(%rbp), %rdi
movq %r15, %rsi
movq %r12, %r15
movq %r13, %r12
movq %r14, %r13
leaq -0x98(%rbp), %r14
callq 0x6002
movq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x5f48
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x4354
leaq -0x90(%rbp), %rdi
callq 0x3e82
movq %r12, %rdi
callq 0x3e82
jmp 0x6c2e
movq 0x1111c(%rip), %rdi     # 0x17fe8
leaq 0x943a(%rip), %rsi      # 0x1030d
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
jmp 0x6f34
movq (%rbx), %rsi
movq %r15, %rdi
callq 0x5fc6
jmp 0x6f16
movq -0x60(%rbp), %rax
movq -0xb8(%rbp), %r15
movq %rax, (%r15)
movq -0x58(%rbp), %rax
andq $0x0, -0x58(%rbp)
movq %rax, 0x8(%r15)
andq $0x0, -0x60(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0xa8(%rbp), %rdi
callq 0x3e82
leaq -0x58(%rbp), %rdi
callq 0x3e82
movq %r15, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x704e
jmp 0x704e
jmp 0x6fe9
jmp 0x704e
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0x6f7d
jmp 0x6f84
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x3e82
jmp 0x6f79
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3e82
jmp 0x6f87
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x30f0
jmp 0x701c
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x30f0
jmp 0x6fac
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x3e82
jmp 0x6fba
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0x7017
jmp 0x7008
movq %rax, %rbx
jmp 0x6fd8
jmp 0x700d
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
jmp 0x7010
jmp 0x7008
jmp 0x7008
jmp 0x704e
movq %rax, %rbx
jmp 0x6fff
jmp 0x7008
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x3e82
leaq -0x90(%rbp), %rdi
jmp 0x7023
movq %rax, %rbx
jmp 0x701c
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x3e82
leaq -0xc8(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0xa8(%rbp), %rdi
callq 0x3e82
leaq -0x58(%rbp), %rdi
callq 0x3e82
movq %rbx, %rdi
callq 0x3330
movq %rax, %rbx
jmp 0x7028
nop