// File: /workspace/github_cpp_makefile_star2_O1/JameyWoo[P]csmile/assembly.cpp
// Function: solveCompare(TreeNode*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<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::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>)
void solveCompare(TreeNode* root, string reg, map<string, string> var2stack) {
    // debug(root->nodekind);
    // TODO: 最好有一个通用处理的函数, 专门计算 exp等
    if (root->nodekind == "Const") {
        assout << "\tmovl\t$" << to_string(root->val) << ", " << reg << endl;
    } else if (root->nodekind == "Id") {
        assout << "\tmovl\t" << var2stack[root->name] << ", " << reg << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rdi), %r12
leaq 0x3564(%rip), %rsi      # 0x15265
movq %r12, %rdi
callq 0x2090
testl %eax, %eax
je 0x11dc2
leaq 0x3508(%rip), %rsi      # 0x15220
movq %r12, %rdi
callq 0x2090
testl %eax, %eax
jne 0x11eee
leaq 0x9eb1(%rip), %r12      # 0x1bbe0
leaq 0x39f7(%rip), %rsi      # 0x1572d
movl $0x6, %edx
movq %r12, %rdi
callq 0x2220
addq $0xc0, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xac76
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r12, %rdi
callq 0x2220
movq %rax, %r14
leaq 0x3ac0(%rip), %rsi      # 0x1582e
movl $0x2, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x2220
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2120
leaq 0x9e17(%rip), %rdi      # 0x1bbe0
leaq 0x39e6(%rip), %rsi      # 0x157b6
movl $0x7, %edx
callq 0x2220
movl 0xb8(%r14), %r13d
movl %r13d, %ebp
negl %ebp
cmovsl %r13d, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x11e3e
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x11e35
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x11e3b
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x11e3e
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x11e02
addl $-0x3, %r14d
jmp 0x11e3e
addl $-0x2, %r14d
jmp 0x11e3e
decl %r14d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r14d, %esi
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x2230
movq (%r15), %rdi
addq %r13, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0xb06f
movq (%r15), %rsi
movq 0x8(%r15), %rdx
leaq 0x9d5e(%rip), %rdi      # 0x1bbe0
callq 0x2220
movq %rax, %r14
leaq 0x399d(%rip), %rsi      # 0x1582e
movl $0x2, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x2220
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x11eee
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x11f17
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310