// File: CHEN-Zhihan[P]Compiler/Node.cpp
// Function: DeclareNode::ex(std::vector<int, std::allocator<int>>&, int, int, int) const
void DeclareNode::ex(vector<int>& sList, int functionID, int blbl, int clbl) const {
    if (initializer != nullptr) {
        auto dimension = sizeMap[{sList.back(), variable->getID()}];
        int address = addressTable[functionID].second[variable->getDefinitionScope(sList, functionID)][variable->getID()];        
        int size = accumulate(dimension.begin(), dimension.end(), 1, multiplies<int>());
        string base =(variable->isGlobal() or functionID == GLOBAL) ? "sb" : "fp";
        for (int i = 0; i != size; ++i) {
            initializer->ex(sList, functionID, blbl, clbl);
            cout << "\tpop\t" << base << "[" << address + i << "]\n";
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2a9d0
testb $0x1, %al
jne 0x288be
jmp 0x28bf5
movq -0x10(%rbp), %rdi
callq 0x29d50
movq -0xa8(%rbp), %rdi
movq %rax, -0xc0(%rbp)
addq $0x8, %rdi
callq 0x292f0
movq %rax, %rdi
callq 0x231c0
movq -0xc0(%rbp), %rsi
movl %eax, -0x44(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
leaq -0x44(%rbp), %rdx
callq 0x2a1c0
movq -0xb8(%rbp), %rsi
leaq 0x28bce(%rip), %rdi     # 0x514e0
callq 0x28f70
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x29080
leaq 0x28b6e(%rip), %rdi     # 0x51498
leaq -0x14(%rbp), %rsi
callq 0x16ef0
movq %rax, -0xb0(%rbp)
jmp 0x2893c
movq -0xa8(%rbp), %rdi
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xd0(%rbp)
addq $0x8, %rdi
callq 0x292f0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x230f0
movl %eax, -0xc4(%rbp)
jmp 0x28975
movq -0xd0(%rbp), %rdi
movl -0xc4(%rbp), %eax
movl %eax, -0x58(%rbp)
leaq -0x58(%rbp), %rsi
callq 0x2a8d0
movq %rax, -0xd8(%rbp)
jmp 0x28997
movq -0xa8(%rbp), %rdi
addq $0x8, %rdi
callq 0x292f0
movq %rax, %rdi
callq 0x231c0
movq -0xd8(%rbp), %rdi
movl %eax, -0x5c(%rbp)
leaq -0x5c(%rbp), %rsi
callq 0x2a120
movq %rax, -0xe0(%rbp)
jmp 0x289cb
movq -0xe0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x48(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x291d0
movq -0xf0(%rbp), %rdi
movq %rax, -0x68(%rbp)
callq 0x29200
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
movq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x29170
movl %eax, -0xe4(%rbp)
jmp 0x28a15
movq -0xa8(%rbp), %rdi
movl -0xe4(%rbp), %eax
movl %eax, -0x60(%rbp)
addq $0x8, %rdi
callq 0x292f0
movq %rax, %rdi
callq 0x285f0
testb $0x1, %al
jne 0x28a45
movl -0x14(%rbp), %eax
cmpl 0x28a99(%rip), %eax     # 0x514dc
jne 0x28a55
leaq 0xe0b8(%rip), %rax      # 0x36b04
movq %rax, -0xf8(%rbp)
jmp 0x28a65
leaq 0xe0ab(%rip), %rax      # 0x36b07
movq %rax, -0xf8(%rbp)
jmp 0x28a65
movq -0xf8(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x43e0
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0x4300
jmp 0x28aa2
leaq -0x99(%rbp), %rdi
callq 0x4260
movl $0x0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x60(%rbp), %eax
je 0x28bd3
movq -0xa8(%rbp), %rdi
addq $0x18, %rdi
callq 0x299a0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %r8d
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
jmp 0x28af2
movq 0x284c7(%rip), %rdi     # 0x50fc0
leaq 0xe00a(%rip), %rsi      # 0x36b0a
callq 0x4210
movq %rax, -0x110(%rbp)
jmp 0x28b0e
movq -0x110(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x41f0
movq %rax, -0x118(%rbp)
jmp 0x28b2a
movq -0x118(%rbp), %rdi
leaq 0xdea9(%rip), %rsi      # 0x369e1
callq 0x4210
movq %rax, -0x120(%rbp)
jmp 0x28b46
movq -0x120(%rbp), %rdi
movl -0x48(%rbp), %esi
movl -0xa0(%rbp), %eax
addl %eax, %esi
callq 0x43b0
movq %rax, -0x128(%rbp)
jmp 0x28b66
movq -0x128(%rbp), %rdi
leaq 0xde9d(%rip), %rsi      # 0x36a11
callq 0x4210
jmp 0x28b7b
jmp 0x28b7d
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x28ab8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x28bea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x99(%rbp), %rdi
callq 0x4260
jmp 0x28bea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4170
jmp 0x28bea
leaq -0x98(%rbp), %rdi
callq 0x4170
leaq -0x38(%rbp), %rdi
callq 0x16fe0
jmp 0x28bf5
leaq -0x38(%rbp), %rdi
callq 0x16fe0
jmp 0x28bfe
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x43d0
nopw (%rax,%rax)