// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/specials.c
// Function: quasiquote
static JanetSlot quasiquote(JanetFopts opts, Janet x, int depth, int level) {
    if (depth == 0) {
        janetc_cerror(opts.compiler, "quasiquote too deeply nested");
        return janetc_cslot(janet_wrap_nil());
    }
    JanetSlot *slots = NULL;
    JanetFopts subopts = opts;
    subopts.flags &= ~JANET_FOPTS_HINT;
    switch (janet_type(x)) {
        default:
            return janetc_cslot(x);
        case JANET_TUPLE: {
            int32_t i, len;
            const Janet *tup = janet_unwrap_tuple(x);
            len = janet_tuple_length(tup);
            if (len > 1 && janet_checktype(tup[0], JANET_SYMBOL)) {
                const uint8_t *head = janet_unwrap_symbol(tup[0]);
                if (!janet_cstrcmp(head, "unquote")) {
                    if (level == 0) {
                        JanetFopts subopts = janetc_fopts_default(opts.compiler);
                        subopts.flags |= JANET_FOPTS_ACCEPT_SPLICE;
                        return janetc_value(subopts, tup[1]);
                    } else {
                        level--;
                    }
                } else if (!janet_cstrcmp(head, "quasiquote")) {
                    level++;
                }
            }
            for (i = 0; i < len; i++)
                janet_v_push(slots, quasiquote(subopts, tup[i], depth - 1, level));
            return qq_slots(opts, slots, (janet_tuple_flag(tup) & JANET_TUPLE_FLAG_BRACKETCTOR)
                            ? JOP_MAKE_BRACKET_TUPLE
                            : JOP_MAKE_TUPLE);
        }
        case JANET_ARRAY: {
            int32_t i;
            JanetArray *array = janet_unwrap_array(x);
            for (i = 0; i < array->count; i++)
                janet_v_push(slots, quasiquote(subopts, array->data[i], depth - 1, level));
            return qq_slots(opts, slots, JOP_MAKE_ARRAY);
        }
        case JANET_TABLE:
        case JANET_STRUCT: {
            const JanetKV *kv = NULL, *kvs = NULL;
            int32_t len, cap = 0;
            janet_dictionary_view(x, &kvs, &len, &cap);
            while ((kv = janet_dictionary_next(kvs, cap, kv))) {
                JanetSlot key = quasiquote(subopts, kv->key, depth - 1, level);
                JanetSlot value =  quasiquote(subopts, kv->value, depth - 1, level);
                key.flags &= ~JANET_SLOT_SPLICED;
                value.flags &= ~JANET_SLOT_SPLICED;
                janet_v_push(slots, key);
                janet_v_push(slots, value);
            }
            return qq_slots(opts, slots,
                            janet_checktype(x, JANET_TABLE) ? JOP_MAKE_TABLE : JOP_MAKE_STRUCT);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %r13
leaq 0x10(%rbp), %r14
testl %edx, %edx
je 0x408fb
movl %ecx, %r12d
movl %edx, %r15d
movq 0x20(%r14), %rax
movq %rax, -0x50(%rbp)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movaps %xmm1, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
andb $-0x3, -0x4e(%rbp)
movq %rsi, %xmm0
movq %rsi, %rdx
shrq $0x2f, %rdx
movl %edx, %ecx
andl $0xf, %ecx
xorl %eax, %eax
ucomisd %xmm0, %xmm0
cmovpl %ecx, %eax
leal -0x9(%rax), %ecx
cmpl $0x2, %ecx
jb 0x40924
cmpl $0x7, %eax
je 0x40ab6
cmpl $0x8, %eax
jne 0x40b9a
movq %rsi, %rdi
callq 0x4b1f1
movl -0x10(%rax), %ecx
movq %rcx, %rbx
cmpl $0x2, %ecx
movq %r13, -0x38(%rbp)
movq %rax, -0x40(%rbp)
jl 0x40bb6
movq (%rax), %rdi
movq %rdi, %rax
shrq $0x2f, %rax
cmpl $0x1fff5, %eax          # imm = 0x1FFF5
jne 0x40bb6
callq 0x4b1f1
movq %rax, %r13
leaq 0x22e28(%rip), %rsi     # 0x636f8
movq %rax, %rdi
callq 0x44ca9
testl %eax, %eax
je 0x40baa
leaq 0x242a2(%rip), %rsi     # 0x64b89
movq %r13, %rdi
callq 0x44ca9
cmpl $0x1, %eax
adcl $0x0, %r12d
jmp 0x40bb6
movq (%r14), %rdi
leaq 0x2428f(%rip), %rsi     # 0x64b94
callq 0x19fa9
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x4b313
movq %r13, %rdi
movq %rax, %rsi
jmp 0x40b9d
movq %rdx, -0x30(%rbp)
movl %r12d, %ebx
movq %r13, -0x38(%rbp)
leaq -0xa0(%rbp), %rax
andq $0x0, (%rax)
leaq -0x44(%rbp), %rcx
andl $0x0, (%rcx)
leaq -0xa4(%rbp), %rdx
movq %rsi, %rdi
movq %rax, %rsi
callq 0x45d86
decl %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
movq -0xa0(%rbp), %rdi
movl -0x44(%rbp), %esi
movq %r13, %rdx
callq 0x44c72
testq %rax, %rax
je 0x40a83
movq %rax, %r13
movq (%rax), %rsi
movq -0x50(%rbp), %rax
movq %rax, 0x20(%rsp)
movaps -0x70(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq -0x98(%rbp), %rdi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x4080f
movq 0x8(%r13), %rsi
movq -0x50(%rbp), %rax
movq %rax, 0x20(%rsp)
movaps -0x70(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq -0xc0(%rbp), %rdi
movl %r15d, %edx
movl %ebx, %ecx
callq 0x4080f
andb $-0x2, -0x85(%rbp)
andb $-0x2, -0xad(%rbp)
testq %r12, %r12
je 0x409f9
movl -0x4(%r12), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%r12), %ecx
jl 0x40a10
movq %r12, %rdi
pushq $0x1
popq %rsi
pushq $0x18
popq %rdx
callq 0x4799c
movq %rax, %r12
movl -0x4(%rax), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%r12)
cltq
imulq $0x18, %rax, %rax
movq -0x88(%rbp), %rcx
movq %rcx, 0x10(%r12,%rax)
movups -0x98(%rbp), %xmm0
movups %xmm0, (%r12,%rax)
movl -0x4(%r12), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%r12), %ecx
jl 0x40a59
movq %r12, %rdi
pushq $0x1
popq %rsi
pushq $0x18
popq %rdx
callq 0x4799c
movq %rax, %r12
movl -0x4(%rax), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%r12)
cltq
imulq $0x18, %rax, %rax
movq -0xb0(%rbp), %rcx
movq %rcx, 0x10(%r12,%rax)
movupd -0xc0(%rbp), %xmm0
movupd %xmm0, (%r12,%rax)
jmp 0x4095c
xorl %edx, %edx
cmpl $0x1fff9, -0x30(%rbp)   # imm = 0x1FFF9
sete %dl
addl $0x43, %edx
leaq 0x10(%rbp), %rcx
movq 0x20(%rcx), %rax
movq %rax, 0x20(%rsp)
movupd (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
jmp 0x40b8b
movl %r12d, -0x30(%rbp)
movq %r13, -0x38(%rbp)
movq %rsi, %rdi
callq 0x4b1f1
movq %rax, %rbx
decl %r15d
xorl %r13d, %r13d
xorl %r12d, %r12d
movslq 0x10(%rbx), %rax
cmpq %rax, %r13
jge 0x40b6b
testq %r12, %r12
je 0x40af3
movl -0x4(%r12), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%r12), %ecx
jl 0x40b0a
movq %r12, %rdi
pushq $0x1
popq %rsi
pushq $0x18
popq %rdx
callq 0x4799c
movq %rax, %r12
movl -0x4(%rax), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%r12)
cltq
imulq $0x18, %rax, %r14
movq 0x18(%rbx), %rax
movq (%rax,%r13,8), %rsi
movq -0x50(%rbp), %rax
movq %rax, 0x20(%rsp)
movaps -0x70(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq -0x98(%rbp), %rdi
movl %r15d, %edx
movl -0x30(%rbp), %ecx
callq 0x4080f
movq -0x88(%rbp), %rax
movq %rax, 0x10(%r12,%r14)
movupd -0x98(%rbp), %xmm0
movupd %xmm0, (%r12,%r14)
incq %r13
jmp 0x40ad2
leaq 0x10(%rbp), %rcx
movq 0x20(%rcx), %rax
movq %rax, 0x20(%rsp)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
pushq $0x40
popq %rdx
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
jmp 0x40c93
movq %r13, %rdi
callq 0x19f5c
movq %r13, %rax
jmp 0x40c9b
testl %r12d, %r12d
je 0x40cad
decl %r12d
movl %r12d, -0x30(%rbp)
decl %r15d
xorl %r12d, %r12d
testl %ebx, %ebx
cmovlel %r12d, %ebx
movq %rbx, %r14
xorl %ebx, %ebx
cmpq %r12, %r14
je 0x40c5a
testq %rbx, %rbx
je 0x40be4
movl -0x4(%rbx), %eax
leal 0x1(%rax), %ecx
cmpl -0x8(%rbx), %ecx
jl 0x40bfb
movq %rbx, %rdi
pushq $0x1
popq %rsi
pushq $0x18
popq %rdx
callq 0x4799c
movq %rax, %rbx
movl -0x4(%rax), %eax
leal 0x1(%rax), %ecx
movl %ecx, -0x4(%rbx)
cltq
imulq $0x18, %rax, %r13
movq -0x40(%rbp), %rax
movq (%rax,%r12,8), %rsi
movq -0x50(%rbp), %rax
movq %rax, 0x20(%rsp)
movaps -0x70(%rbp), %xmm0
movaps -0x60(%rbp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq -0x98(%rbp), %rdi
movl %r15d, %edx
movl -0x30(%rbp), %ecx
callq 0x4080f
movq -0x88(%rbp), %rax
movq %rax, 0x10(%rbx,%r13)
movupd -0x98(%rbp), %xmm0
movupd %xmm0, (%rbx,%r13)
incq %r12
jmp 0x40bcb
xorl %edx, %edx
movq -0x40(%rbp), %rax
btl $0x10, -0x20(%rax)
adcl $0x45, %edx
leaq 0x10(%rbp), %r14
movq 0x20(%r14), %rax
movq %rax, 0x20(%rsp)
movupd (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
movq %rdi, %rbx
callq 0x40cf4
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rsi
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x19f04
orb $0x8, 0x22(%rbx)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x20(%rbx), %rax
movq %rax, 0x20(%rsp)
movupd (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%rsp)
movupd %xmm0, (%rsp)
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x1abbf
jmp 0x40c98