// File: /workspace/github_cpp_makefile_star2_O2/SunriseFox[P]very-simple-c-compiler/./src/asm.cpp
// Function: storeVar(TreeNode*)
void storeVar(TreeNode* node) {
    if (node == nullptr) return;

    Symbol* ownSymbol = nullptr;

    if (node->nodeType == TreeNode::NODE_DECLARATION) {
        ownSymbol = static_cast<DeclarationNode*>(node)->symbol;
        cerr << "get dec " << ownSymbol << " " << ownSymbol->value << endl;
        varDeclare[ownSymbol] = string("temp") + to_string(tempVarCount++);
    } else if (node->nodeType == TreeNode::NODE_EXPRESSION) {
        ownSymbol = static_cast<ExprNode*>(node)->symbol;
        cerr << "get exp " << ownSymbol << " " << ownSymbol->value << endl;
        if (ownSymbol->symbolType == Symbol::SYMBOL_CONSTANT
                && ownSymbol->type == Symbol::VALUE_STRING) {
            varDeclare[ownSymbol] = string(".str") + to_string(tempVarCount++);
        }
    }

    auto children = node -> child;
    while (children) {
        storeVar(children);
        children = children -> sibling;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
testq %rdi, %rdi
je 0x40b2
movq %rdi, %rbx
andq $0x0, 0x10(%rsp)
movl 0x10(%rdi), %eax
cmpl $0x3, %eax
je 0x3fe8
cmpl $0x2, %eax
jne 0x4098
movq 0x28(%rbx), %r14
movq %r14, 0x10(%rsp)
movq 0xe0ca(%rip), %rdi      # 0x11ff0
leaq 0x73a2(%rip), %rsi      # 0xb2cf
callq 0x31d0
movq %rax, %rdi
movq %r14, %rsi
callq 0x3170
leaq 0x775c(%rip), %rsi      # 0xb6a0
movq %rax, %rdi
callq 0x31d0
addq $0x8, %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x31c0
movq %rax, %rdi
callq 0x3100
leaq 0x736e(%rip), %rsi      # 0xb2d8
leaq 0x38(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x615c
movl 0xe4fd(%rip), %esi      # 0x1247c
leal 0x1(%rsi), %eax
movl %eax, 0xe4f4(%rip)      # 0x1247c
leaq 0x18(%rsp), %rdi
callq 0x6272
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x620b
leaq 0xe28b(%rip), %rdi      # 0x12238
leaq 0x10(%rsp), %rsi
callq 0x6198
leaq 0x58(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x3280
movq %r14, %rdi
callq 0x30f0
leaq 0x18(%rsp), %rdi
callq 0x30f0
leaq 0x38(%rsp), %rdi
callq 0x30f0
jmp 0x4098
movq 0x28(%rbx), %r14
movq %r14, 0x10(%rsp)
movq 0xdff8(%rip), %rdi      # 0x11ff0
leaq 0x72de(%rip), %rsi      # 0xb2dd
callq 0x31d0
movq %rax, %rdi
movq %r14, %rsi
callq 0x3170
leaq 0x768a(%rip), %rsi      # 0xb6a0
movq %rax, %rdi
callq 0x31d0
leaq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
callq 0x3100
cmpl $0x0, 0x28(%r14)
jne 0x4098
cmpl $0x4, (%r14)
jne 0x4098
leaq 0x72a0(%rip), %rsi      # 0xb2e6
leaq 0x38(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x615c
movl 0xe421(%rip), %esi      # 0x1247c
leal 0x1(%rsi), %eax
movl %eax, 0xe418(%rip)      # 0x1247c
leaq 0x18(%rsp), %rdi
callq 0x6272
leaq 0x58(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x620b
leaq 0xe1af(%rip), %rdi      # 0x12238
leaq 0x10(%rsp), %rsi
callq 0x6198
jmp 0x3fb7
addq $0x18, %rbx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x40b2
movq %rbx, %rdi
callq 0x3ee8
addq $0x20, %rbx
jmp 0x409c
addq $0x78, %rsp
popq %rbx
popq %r14
retq
jmp 0x40c2
jmp 0x40d1
jmp 0x40e0
jmp 0x40ef
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x30f0
jmp 0x40d4
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x30f0
jmp 0x40e3
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x30f0
jmp 0x40f2
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3390