// File: /workspace/github_cpp_makefile_star2_O2/0x0584[P]scmin-plus/src/repl/parser.cpp
// Function: parse_cons_flavor(std::queue<token, std::deque<token, std::allocator<token>>>&, std::shared_ptr<sexpr>&)
sexpr_t parse_cons_flavor(queue<token>& q, sexpr_t& expr) {
    token tmp = tok;

    if (q.pop(); q.size() == 0 or tok.type == token::tok_r_paren) {
        cerr << "Err: malformed car/cdr" << endl;
        return nullptr;
    }
    sexpr_t e = parse_tokens(q);
    sexpr_t tail = nil();

    if (tmp.isset) {
        if ((q.size() == 0 or tok.type == token::tok_r_paren)) {
            cerr << "Err: malformed car/cdr" << endl;
            return nullptr;
        }
        tail = cons(parse_tokens(q), tail);
    }
    if (not e or e->isnil())
        return e;
    for (; tmp.cons_s.size() > 1; tmp.cons_s.pop())
        e = cons(symb(tmp.cons_s.top() == 'a' ? "car" : "cdr"),
                 cons(e, nil()));
    expr = cons(symb(tmp.cons_s.top() == 'a' ?
                     (tmp.isset ? "set-car!" : "car")
                     : (tmp.isset ? "set-cdr!" : "cdr")),
                cons(e, tail));
    return expr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rsi), %rsi
leaq -0x140(%rbp), %rdi
callq 0xda0e
movq %rbx, %rdi
callq 0xe554
movq %rbx, %rdi
callq 0xe5d8
testq %rax, %rax
je 0xd1bc
movq 0x10(%rbx), %rax
cmpl $0x1, 0x7c(%rax)
jne 0xd1e3
movq 0xae25(%rip), %rdi      # 0x17fe8
leaq 0x371f(%rip), %rsi      # 0x108e9
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0xd4b5
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xcdf2
leaq -0x80(%rbp), %rdi
callq 0x4d18
cmpb $0x1, -0xf0(%rbp)
jne 0xd28c
movq %rbx, %rdi
callq 0xe5d8
testq %rax, %rax
je 0xd21e
movq 0x10(%rbx), %rax
cmpl $0x1, 0x7c(%rax)
jne 0xd245
movq 0xadc3(%rip), %rdi      # 0x17fe8
leaq 0x36bd(%rip), %rsi      # 0x108e9
callq 0x31f0
movq %rax, %rdi
callq 0x3100
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0xd4a3
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xcdf2
leaq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x4dd5
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4354
leaq -0x98(%rbp), %rdi
callq 0x3e82
leaq -0x48(%rbp), %rdi
callq 0x3e82
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xd2a4
callq 0x49a8
testb %al, %al
je 0xd2c0
movq -0x40(%rbp), %rax
jmp 0xd2a6
xorl %eax, %eax
movq %rax, (%r14)
movq -0x38(%rbp), %rax
andq $0x0, -0x38(%rbp)
movq %rax, 0x8(%r14)
andq $0x0, -0x40(%rbp)
jmp 0xd4a3
movq %r15, -0xa8(%rbp)
movq %r14, -0xb0(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0xa0(%rbp), %rbx
leaq -0x50(%rbp), %r15
movq %rdi, %r14
callq 0xdc4e
cmpq $0x2, %rax
jb 0xd3bf
movq -0x110(%rbp), %rax
cmpq -0x108(%rbp), %rax
jne 0xd315
movq -0xf8(%rbp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
cmpb $0x61, -0x1(%rax)
leaq 0x35dc(%rip), %rsi      # 0x108fc
leaq 0x346d(%rip), %rax      # 0x10794
cmoveq %rax, %rsi
movq %rbx, %rdi
leaq -0x29(%rbp), %rdx
callq 0x6608
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x4d30
leaq -0xc0(%rbp), %r12
movq %r12, %rdi
callq 0x4d18
leaq -0x70(%rbp), %r13
movq %r13, %rdi
leaq -0x40(%rbp), %rsi
movq %r12, %rdx
callq 0x4dd5
movq %r15, %rdi
leaq -0x60(%rbp), %rsi
movq %r13, %rdx
callq 0x4dd5
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x4354
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x68(%rbp), %rdi
callq 0x3e82
leaq -0xb8(%rbp), %rdi
callq 0x3e82
leaq -0x58(%rbp), %rdi
callq 0x3e82
movq %rbx, %rdi
callq 0x30f0
movq %r14, %rdi
callq 0xe628
movq %r14, %rdi
jmp 0xd2e0
movq -0x110(%rbp), %rax
cmpq -0x108(%rbp), %rax
jne 0xd3df
movq -0xf8(%rbp), %rcx
movl $0x200, %eax            # imm = 0x200
addq -0x8(%rcx), %rax
leaq 0x33bb(%rip), %rcx      # 0x107a1
testb $0x1, -0xf0(%rbp)
leaq 0x33a0(%rip), %rdx      # 0x10794
cmovneq %rcx, %rdx
leaq 0x3399(%rip), %rcx      # 0x10798
leaq 0x34f6(%rip), %rsi      # 0x108fc
cmovneq %rcx, %rsi
cmpb $0x61, -0x1(%rax)
cmoveq %rdx, %rsi
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x6608
movq -0xb0(%rbp), %r14
movq -0xa8(%rbp), %rbx
leaq -0x60(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x4d30
leaq -0x70(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x4dd5
leaq -0x50(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x4dd5
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x4354
leaq -0x48(%rbp), %rdi
callq 0x3e82
leaq -0x68(%rbp), %rdi
callq 0x3e82
leaq -0x58(%rbp), %rdi
callq 0x3e82
leaq -0xa0(%rbp), %rdi
callq 0x30f0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3e44
leaq -0x78(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0x140(%rbp), %rdi
callq 0xda54
movq %r14, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x3e82
jmp 0xd544
jmp 0xd541
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0xd51b
jmp 0xd527
jmp 0xd522
jmp 0xd541
movq %rax, %rbx
jmp 0xd54d
jmp 0xd4fe
jmp 0xd541
movq %rax, %rbx
jmp 0xd556
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3e82
jmp 0xd514
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x3e82
jmp 0xd52a
movq %rax, %rbx
jmp 0xd533
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3e82
leaq -0xa0(%rbp), %rdi
callq 0x30f0
jmp 0xd544
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3e82
leaq -0x38(%rbp), %rdi
callq 0x3e82
leaq -0x140(%rbp), %rdi
callq 0xda54
movq %rbx, %rdi
callq 0x3330