// File: /workspace/github_cpp_makefile_star2_O1/CHEN-Zhihan[P]Compiler/Node.cpp
// Function: FunctionNode::check(std::vector<int, std::allocator<int>>&, int)
void FunctionNode::check(vector<int>& sList, int functionID) {
    if (sList.back() != GLOBAL) {
        cerr << "Function " << reverseLookup[i] << " can only be defined in the global scope" << endl;
        exit(-1);
    }
    if (functionTable.count(i) != 0) {
        cerr << "Redefinition of function: " << reverseLookup[i] << endl;
        exit(-1);
    }
    variableTable[i] = unordered_set<int>();
    addressTable[i] ={0, unordered_map<int, unordered_map<ID, address> >()};
    int size = 0;
    functionTable[i] = this;
    unordered_set<int> duplicateSet;
    for (auto j = parameters.begin(); j != parameters.end(); ++j) {
        if (functionTable.count((*j)->getID()) != 0) {
            cerr << "Redefinition of function: " << reverseLookup[(*j)->getID()] << endl;
            exit(-1);
        }
        if (duplicateSet.count((*j)->getID()) != 0) {
            cerr << "duplicate parameter '" << reverseLookup[(*j)->getID()] << "' in function definition" << endl;
            exit(-1);
        }
        duplicateSet.insert((*j)->getID());
        variableTable[i].insert((*j)->getID());
        #if DEBUG
            cerr << "add variable " << reverseLookup[(*j)->getID()] << " to " << i << endl;
            cerr << "add variable of size " << (*j)->getDimensions() << " to " << i << " " << (*j)->getID() << endl;
        #endif
        addressTable[i].second[i][(*j)->getID()] = - 3 + (size++) - parameters.size();
        sizeMap[{i, (*j)->getID()}] = vector<int>((*j)->getDimensions());
    }
    #if DEBUG
        cerr << "adding function " << reverseLookup[this->i] << " to " << GLOBAL << endl;
    #endif
    variableTable[GLOBAL].insert(i);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq 0x8(%rsi), %rax
movl -0x4(%rax), %eax
cmpl 0xda71(%rip), %eax      # 0x1c4c4
jne 0xee21
movq %rdi, -0x48(%rbp)
leaq 0x8(%rdi), %rbx
leaq 0xd900(%rip), %rdi      # 0x1c368
movq %rbx, %rsi
callq 0x1229c
testq %rax, %rax
jne 0xee62
xorps %xmm0, %xmm0
leaq -0x90(%rbp), %r12
movaps %xmm0, -0x30(%r12)
movaps %xmm0, -0x10(%r12)
movaps %xmm0, -0x20(%r12)
movq $0x0, (%r12)
movq %r12, -0x30(%r12)
movq $0x1, -0x28(%r12)
movl $0x3f800000, -0x10(%r12) # imm = 0x3F800000
movups %xmm0, -0x8(%r12)
leaq 0xd8df(%rip), %rdi      # 0x1c3a0
movq %rbx, %rsi
callq 0xbe56
leaq -0xc0(%rbp), %rsi
movq %rax, %rdi
callq 0x4964
leaq -0xc0(%rbp), %r15
movq %r15, %rdi
callq 0xb170
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %rax
movaps %xmm0, -0x30(%rax)
movaps %xmm0, -0x10(%rax)
movaps %xmm0, -0x20(%rax)
movq $0x0, (%rax)
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movl $0x0, (%r15)
leaq -0xb8(%rbp), %r15
leaq -0x80(%rbp), %rdx
movq %r15, %rdi
movq %rdx, %rsi
callq 0x11522
leaq 0xd944(%rip), %rdi      # 0x1c480
movq %rbx, %rsi
callq 0xb5dc
leaq -0xc0(%rbp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0xad5c
movq %r15, %rdi
callq 0xb1e6
leaq -0x80(%rbp), %rdi
callq 0xb1e6
leaq 0xd7fa(%rip), %rdi      # 0x1c368
movq %rbx, -0x40(%rbp)
movq %rbx, %rsi
callq 0x12326
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq %r12, (%r14)
movq $0x1, 0x8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movl $0x3f800000, 0x20(%r14) # imm = 0x3F800000
movups %xmm0, 0x28(%r14)
movq 0x10(%rcx), %r15
cmpq 0x18(%rcx), %r15
je 0xed2b
movl $0xfffffffd, %r12d      # imm = 0xFFFFFFFD
leaq -0x80(%rbp), %rbx
movq (%r15), %rax
movl 0x8(%rax), %eax
movl %eax, -0x80(%rbp)
leaq 0xd79f(%rip), %rdi      # 0x1c368
movq %rbx, %rsi
callq 0x1229c
testq %rax, %rax
jne 0xedd5
movq (%r15), %rax
movl 0x8(%rax), %eax
movl %eax, -0x80(%rbp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12038
testq %rax, %rax
jne 0xed6f
movq (%r15), %rax
movl 0x8(%rax), %eax
movl %eax, -0x34(%rbp)
movq %r14, -0x80(%rbp)
movq %r14, %rdi
leaq -0x34(%rbp), %rsi
movq %rbx, %rdx
callq 0x125aa
leaq 0xd786(%rip), %rdi      # 0x1c3a0
movq -0x40(%rbp), %rsi
callq 0xbe56
movq (%r15), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, -0x34(%rbp)
movq %rax, -0x80(%rbp)
movq %rax, %rdi
leaq -0x34(%rbp), %rsi
movq %rbx, %rdx
callq 0x125aa
movq -0x48(%rbp), %rax
movq 0x18(%rax), %r14
subq 0x10(%rax), %r14
leaq 0xd82e(%rip), %rdi      # 0x1c480
movq -0x40(%rbp), %rsi
callq 0xb5dc
addq $0x8, %rax
movq %rax, %rdi
movq -0x40(%rbp), %rsi
callq 0x11870
movq (%r15), %rcx
movl 0x8(%rcx), %ecx
movl %ecx, -0x80(%rbp)
movq %rax, %rdi
movq %rbx, %r13
movq %rbx, %rsi
callq 0x1264c
shrq $0x4, %r14
movl %r12d, %ecx
subl %r14d, %ecx
movl %ecx, (%rax)
movq (%r15), %rax
movq 0x18(%rax), %rcx
subq 0x10(%rax), %rcx
shrq $0x4, %rcx
movslq %ecx, %rsi
movq %r13, %rdi
leaq -0x29(%rbp), %rdx
callq 0x10e54
movq (%r15), %rax
movl 0x8(%rax), %eax
movq -0x40(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, -0x34(%rbp)
movl %eax, -0x30(%rbp)
leaq 0xd803(%rip), %rdi      # 0x1c4c8
leaq -0x34(%rbp), %rsi
callq 0x10bf4
leaq -0xc0(%rbp), %r14
movq (%rax), %rdi
movq -0x80(%rbp), %rcx
movq %rcx, (%rax)
movq -0x78(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x70(%rbp), %rcx
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movq $0x0, -0x70(%rbp)
testq %rdi, %rdi
je 0xed08
callq 0x41e0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xed16
callq 0x41e0
addq $0x10, %r15
incl %r12d
movq -0x48(%rbp), %rax
cmpq 0x18(%rax), %r15
jne 0xebb9
leaq 0xd66e(%rip), %rdi      # 0x1c3a0
leaq 0xd78b(%rip), %rsi      # 0x1c4c4
callq 0xbe56
leaq -0x80(%rbp), %rdx
movq %rax, (%rdx)
movq %rax, %rdi
movq -0x40(%rbp), %rsi
callq 0xc186
leaq -0xc0(%rbp), %rdi
callq 0xb170
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd27a(%rip), %rdi      # 0x1bff0
leaq 0x5b66(%rip), %rsi      # 0x148e3
movl $0x15, %edx
callq 0x4260
movq (%r15), %rax
movslq 0x8(%rax), %rax
leaq 0xd59b(%rip), %rcx      # 0x1c330
movq (%rcx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq 0xd244(%rip), %rdi      # 0x1bff0
callq 0x4260
movq %rax, %rbx
leaq 0x5b3e(%rip), %rsi      # 0x148f9
movl $0x18, %edx
movq %rax, %rdi
callq 0x4260
movq %rbx, %rdi
callq 0x4120
jmp 0xee96
movq 0xd214(%rip), %rdi      # 0x1bff0
leaq 0x54b3(%rip), %rsi      # 0x14296
movl $0x1a, %edx
callq 0x4260
movq (%r15), %rax
movslq 0x8(%rax), %rax
leaq 0xd535(%rip), %rcx      # 0x1c330
movq (%rcx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq 0xd1de(%rip), %rdi      # 0x1bff0
callq 0x4260
movq %rax, %rdi
callq 0x4120
jmp 0xee96
movq %rdi, %rbx
movq 0xd1c5(%rip), %rdi      # 0x1bff0
leaq 0x5a7e(%rip), %rsi      # 0x148b0
callq 0x4200
movslq 0x8(%rbx), %rsi
leaq 0xd4ee(%rip), %rcx      # 0x1c330
shlq $0x5, %rsi
addq (%rcx), %rsi
movq %rax, %rdi
callq 0x41d0
leaq 0x5a62(%rip), %rsi      # 0x148ba
movq %rax, %rdi
callq 0x4200
jmp 0xee8e
movq 0xd187(%rip), %rdi      # 0x1bff0
leaq 0x5426(%rip), %rsi      # 0x14296
callq 0x4200
movslq (%rbx), %rsi
leaq 0xd4b1(%rip), %rcx      # 0x1c330
shlq $0x5, %rsi
addq (%rcx), %rsi
movq %rax, %rdi
callq 0x41d0
movq %rax, %rdi
callq 0x4120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x42a0
movq %rax, %rbx
movq %r15, %rdi
callq 0xb1e6
leaq -0x80(%rbp), %rdi
callq 0xb1e6
jmp 0xeef2
movq %rax, %rdi
callq 0x88cd
jmp 0xeee3
jmp 0xeee3
jmp 0xeee3
jmp 0xeee3
jmp 0xeee3
jmp 0xeee3
jmp 0xeee3
jmp 0xeee3
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xeee6
callq 0x41e0
jmp 0xeee6
jmp 0xeee3
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0xb170
movq %rbx, %rdi
callq 0x43b0