// File: 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
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x1b8(%rbp)
movq %rdi, %rax
movq %rax, -0x1b0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1b7a0
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
callq 0x1b9e0
movq -0x10(%rbp), %rdi
callq 0x1b7c0
jmp 0x1a89b
movq -0x10(%rbp), %rdi
callq 0x1b7e0
movq %rax, -0x1c0(%rbp)
jmp 0x1a8ad
movq -0x1c0(%rbp), %rax
cmpq $0x0, %rax
je 0x1a8d9
movq -0x10(%rbp), %rdi
callq 0x1b7a0
movq %rax, -0x1c8(%rbp)
jmp 0x1a8cc
movq -0x1c8(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jne 0x1a940
movq 0x13710(%rip), %rdi     # 0x2dff0
leaq 0x6fea(%rip), %rsi      # 0x218d1
callq 0x32c0
movq %rax, -0x1d0(%rbp)
jmp 0x1a8f5
movq -0x1d0(%rbp), %rdi
movq 0x1368d(%rip), %rsi     # 0x2df90
callq 0x32f0
jmp 0x1a90a
movq -0x1b8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
movl $0x1, -0xa8(%rbp)
jmp 0x1af26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1af42
movq -0x10(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
xorl %edx, %edx
callq 0x1a190
jmp 0x1a954
leaq -0xc8(%rbp), %rdi
callq 0x78f0
jmp 0x1a962
testb $0x1, -0x48(%rbp)
je 0x1aaa8
movq -0x10(%rbp), %rdi
callq 0x1b7e0
movq %rax, -0x1d8(%rbp)
jmp 0x1a97e
movq -0x1d8(%rbp), %rax
cmpq $0x0, %rax
je 0x1a9aa
movq -0x10(%rbp), %rdi
callq 0x1b7a0
movq %rax, -0x1e0(%rbp)
jmp 0x1a99d
movq -0x1e0(%rbp), %rax
cmpl $0x1, 0x7c(%rax)
jne 0x1aa28
movq 0x1363f(%rip), %rdi     # 0x2dff0
leaq 0x6f19(%rip), %rsi      # 0x218d1
callq 0x32c0
movq %rax, -0x1e8(%rbp)
jmp 0x1a9c6
movq -0x1e8(%rbp), %rdi
movq 0x135bc(%rip), %rsi     # 0x2df90
callq 0x32f0
jmp 0x1a9db
movq -0x1b8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4570
movl $0x1, -0xa8(%rbp)
jmp 0x1aef2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1af18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1af0c
movq -0x10(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
xorl %edx, %edx
callq 0x1a190
jmp 0x1aa3c
leaq -0xd8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x7a40
jmp 0x1aa58
leaq -0xc8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x4420
leaq -0xd8(%rbp), %rdi
callq 0x4450
leaq -0xe8(%rbp), %rdi
callq 0x4450
jmp 0x1aaa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4450
jmp 0x1af0c
leaq -0xb8(%rbp), %rdi
callq 0xb5c0
testb $0x1, %al
jne 0x1aaba
jmp 0x1aae2
leaq -0xb8(%rbp), %rdi
callq 0x4400
movq %rax, %rdi
callq 0x7270
movb %al, -0x1e9(%rbp)
jmp 0x1aad6
movb -0x1e9(%rbp), %al
testb $0x1, %al
jne 0x1aae2
jmp 0x1ab04
movq -0x1b8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xa6f0
movl $0x1, -0xa8(%rbp)
jmp 0x1aef2
jmp 0x1ab06
leaq -0x98(%rbp), %rdi
callq 0x1ba60
movq %rax, -0x1f8(%rbp)
jmp 0x1ab1b
movq -0x1f8(%rbp), %rax
cmpq $0x1, %rax
jbe 0x1ad19
leaq -0x98(%rbp), %rdi
callq 0x1ba80
movq %rax, -0x200(%rbp)
jmp 0x1ab41
movq -0x200(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jne 0x1ab60
leaq 0x6c2d(%rip), %rax      # 0x21784
movq %rax, -0x208(%rbp)
jmp 0x1ab70
leaq 0x6d7d(%rip), %rax      # 0x218e4
movq %rax, -0x208(%rbp)
jmp 0x1ab70
movq -0x208(%rbp), %rax
movq %rax, -0x218(%rbp)
leaq -0x129(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x3500
movq -0x218(%rbp), %rsi
movq -0x210(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xc230
jmp 0x1abad
leaq -0x108(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x7920
jmp 0x1abc2
leaq -0x150(%rbp), %rdi
callq 0x78f0
jmp 0x1abd0
leaq -0x140(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x7a40
jmp 0x1abec
leaq -0xf8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
leaq -0x140(%rbp), %rdx
callq 0x7a40
jmp 0x1ac08
leaq -0xb8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x4420
leaq -0xf8(%rbp), %rdi
callq 0x4450
leaq -0x140(%rbp), %rdi
callq 0x4450
leaq -0x150(%rbp), %rdi
callq 0x4450
leaq -0x108(%rbp), %rdi
callq 0x4450
leaq -0x128(%rbp), %rdi
callq 0x31d0
leaq -0x129(%rbp), %rdi
callq 0x3310
leaq -0x98(%rbp), %rdi
callq 0x1baa0
jmp 0x1ac71
jmp 0x1ab06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1ad08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1acfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1acf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1ace4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x4450
leaq -0x150(%rbp), %rdi
callq 0x4450
leaq -0x108(%rbp), %rdi
callq 0x4450
leaq -0x128(%rbp), %rdi
callq 0x31d0
leaq -0x129(%rbp), %rdi
callq 0x3310
jmp 0x1af0c
leaq -0x98(%rbp), %rdi
callq 0x1ba80
movq %rax, -0x220(%rbp)
jmp 0x1ad2e
movq -0x220(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jne 0x1ad5e
movb -0x48(%rbp), %dl
leaq 0x6a3d(%rip), %rax      # 0x21784
leaq 0x6a43(%rip), %rcx      # 0x21791
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x228(%rbp)
jmp 0x1ad7d
movb -0x48(%rbp), %dl
leaq 0x6b7c(%rip), %rax      # 0x218e4
leaq 0x6a19(%rip), %rcx      # 0x21788
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rax
movq %rax, -0x238(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x3500
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdx
leaq -0x190(%rbp), %rdi
callq 0xc230
jmp 0x1adba
leaq -0x170(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x7920
jmp 0x1adcf
leaq -0x1a8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x7a40
jmp 0x1adeb
leaq -0x160(%rbp), %rdi
leaq -0x170(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
callq 0x7a40
jmp 0x1ae07
movq -0x18(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x4420
leaq -0x160(%rbp), %rdi
callq 0x4450
leaq -0x1a8(%rbp), %rdi
callq 0x4450
leaq -0x170(%rbp), %rdi
callq 0x4450
leaq -0x190(%rbp), %rdi
callq 0x31d0
leaq -0x191(%rbp), %rdi
callq 0x3310
movq -0x1b8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43d0
movl $0x1, -0xa8(%rbp)
jmp 0x1aef2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1aee4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1aed8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x1aecc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x4450
leaq -0x170(%rbp), %rdi
callq 0x4450
leaq -0x190(%rbp), %rdi
callq 0x31d0
leaq -0x191(%rbp), %rdi
callq 0x3310
jmp 0x1af0c
leaq -0xc8(%rbp), %rdi
callq 0x4450
leaq -0xb8(%rbp), %rdi
callq 0x4450
jmp 0x1af26
leaq -0xc8(%rbp), %rdi
callq 0x4450
leaq -0xb8(%rbp), %rdi
callq 0x4450
jmp 0x1af42
leaq -0x98(%rbp), %rdi
callq 0x1bac0
movq -0x1b0(%rbp), %rax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
leaq -0x98(%rbp), %rdi
callq 0x1bac0
movq -0xa0(%rbp), %rdi
callq 0x34f0
nopw (%rax,%rax)