// File: /workspace/github_cpp_makefile_star2_O1/CHEN-Zhihan[P]Compiler/Node.cpp
// Function: FunctionNode::match(std::vector<std::shared_ptr<ExprNode>, std::allocator<std::shared_ptr<ExprNode>>> const&, std::vector<int, std::allocator<int>> const&, int) const
void FunctionNode::match(const vector<shared_ptr<ExprNode> >& arguments, const vector<int>& sList, int base) const {
    for (int i = 0; i != arguments.size(); ++i) {
        auto parameter = parameters[i];
        auto argument = arguments[i];
        if (parameter->getDimensions() != 0) {
            if (argument->oper != VAR) {
                cerr << "Invalid " << i << " th argument for function " << reverseLookup[this->i] << endl;
                exit(-1);
            }
            auto v = dynamic_pointer_cast<VarNode>(argument->op[0]);
            auto dimension = sizeMap[{v->getDefinitionScope(sList, base), v->getID()}];
            if (parameter->getDimensions() != dimension.size()) {
                #if DEBUG
                    cerr << "expect " << parameter->getDimensions() <<
                    " got " << dimension.size() << " for function " << reverseLookup[this->i] << endl;
                #endif
                cerr << "Invalid " << i << " th argument for function " << reverseLookup[this->i] << endl;
                exit(-1);
            }
            auto pDimension = parameter->getDimension();
            for (auto j = 1; j != pDimension.size(); ++j) {
                if (pDimension[j] != dimension[j]) {
                    cerr << "Invalid " << i << " th argument for function, dimension not match" << endl;
                    exit(-1);
                }
            }
            v->match();
            sizeMap[{this->i, parameter->getID()}] = dimension;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, -0x44(%rbp)
movq %rdx, -0x88(%rbp)
movq 0x8(%rsi), %rax
cmpq (%rsi), %rax
je 0xf130
movq %rsi, %r15
movq %rdi, %rbx
xorl %r13d, %r13d
movq %rdi, -0x40(%rbp)
movq 0x10(%rbx), %rcx
movq %r13, %rax
shlq $0x4, %rax
movq (%rcx,%rax), %r12
movq 0x8(%rcx,%rax), %rcx
testq %rcx, %rcx
je 0xef5d
movq 0xd071(%rip), %rdx      # 0x1bfc0
cmpb $0x0, (%rdx)
je 0xef59
incl 0x8(%rcx)
jmp 0xef5d
lock
incl 0x8(%rcx)
movq %rcx, -0x38(%rbp)
movq (%r15), %rcx
movq (%rcx,%rax), %r14
movq 0x8(%rcx,%rax), %rax
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xef93
movq 0xd043(%rip), %rax      # 0x1bfc0
cmpb $0x0, (%rax)
je 0xef8b
movq -0x30(%rbp), %rax
incl 0x8(%rax)
jmp 0xef93
movq -0x30(%rbp), %rax
lock
incl 0x8(%rax)
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
shrq $0x4, %rax
testl %eax, %eax
je 0xf0fd
cmpl $-0x5, 0x8(%r14)
jne 0xf18f
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0xefd7
leaq 0xc98c(%rip), %rsi      # 0x1b950
leaq 0xcd1d(%rip), %rdx      # 0x1bce8
xorl %ecx, %ecx
callq 0x4250
movq %rax, %rbx
jmp 0xefd9
xorl %ebx, %ebx
testq %rbx, %rbx
je 0xeffc
movq 0x20(%r14), %rax
movq %rax, %r14
testq %rax, %rax
je 0xf008
movq 0xcfcf(%rip), %rax      # 0x1bfc0
cmpb $0x0, (%rax)
je 0xf003
incl 0x8(%r14)
jmp 0xf008
xorl %r14d, %r14d
xorl %ebx, %ebx
jmp 0xf008
lock
incl 0x8(%r14)
movq %rbx, %rdi
movq -0x88(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0xd3b6
movl 0x8(%rbx), %ecx
movl %eax, -0x68(%rbp)
movl %ecx, -0x64(%rbp)
leaq 0xd49e(%rip), %rdi      # 0x1c4c8
leaq -0x68(%rbp), %rsi
callq 0x10bf4
leaq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x10c84
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
shrq $0x4, %rax
cltq
movq -0x78(%rbp), %rcx
subq -0x80(%rbp), %rcx
sarq $0x2, %rcx
cmpq %rax, %rcx
jne 0xf1fe
leaq -0x68(%rbp), %rdi
movq %r12, %rsi
callq 0xf2ec
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
je 0xf0a2
sarq $0x2, %rcx
movl $0x1, %edx
movq -0x80(%rbp), %rsi
movl (%rax,%rdx,4), %edi
cmpl (%rsi,%rdx,4), %edi
jne 0xf13f
incq %rdx
cmpq %rdx, %rcx
jne 0xf08e
movb $0x1, 0xd(%rbx)
movl 0x8(%r12), %eax
movq -0x40(%rbp), %rbx
movl 0x8(%rbx), %ecx
movl %ecx, -0x4c(%rbp)
movl %eax, -0x48(%rbp)
leaq 0xd409(%rip), %rdi      # 0x1c4c8
leaq -0x4c(%rbp), %rsi
callq 0x10bf4
movq %rax, %rdi
leaq -0x80(%rbp), %rsi
callq 0x10ee8
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xf0e2
callq 0x41e0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xf0f0
callq 0x41e0
testq %r14, %r14
je 0xf0fd
movq %r14, %rdi
callq 0x896e
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xf10b
callq 0x896e
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xf119
callq 0x896e
incq %r13
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x4, %rax
cmpq %r13, %rax
jne 0xef2f
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xceaa(%rip), %rdi      # 0x1bff0
leaq 0x57c5(%rip), %rsi      # 0x14912
movl $0x8, %edx
callq 0x4260
movq 0xce92(%rip), %rdi      # 0x1bff0
movl %r13d, %esi
callq 0x4390
movq %rax, %rbx
leaq 0x57c6(%rip), %rsi      # 0x14936
movl $0x2e, %edx
movq %rax, %rdi
callq 0x4260
movq %rbx, %rdi
callq 0x4120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x42a0
movq 0xce5a(%rip), %rdi      # 0x1bff0
leaq 0x5775(%rip), %rsi      # 0x14912
movl $0x8, %edx
callq 0x4260
movq 0xce42(%rip), %rdi      # 0x1bff0
movl %r13d, %esi
callq 0x4390
movq %rax, %rbx
leaq 0x575b(%rip), %rsi      # 0x1491b
movl $0x1a, %edx
movq %rax, %rdi
callq 0x4260
movq -0x40(%rbp), %rax
movslq 0x8(%rax), %rax
leaq 0xd154(%rip), %rcx      # 0x1c330
movq (%rcx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4120
jmp 0xf185
movq 0xcdeb(%rip), %rdi      # 0x1bff0
leaq 0x5706(%rip), %rsi      # 0x14912
movl $0x8, %edx
callq 0x4260
movq 0xcdd3(%rip), %rdi      # 0x1bff0
movl %r13d, %esi
callq 0x4390
movq %rax, %rbx
leaq 0x56ec(%rip), %rsi      # 0x1491b
movl $0x1a, %edx
movq %rax, %rdi
callq 0x4260
movq -0x40(%rbp), %rax
movslq 0x8(%rax), %rax
leaq 0xd0e5(%rip), %rcx      # 0x1c330
movq (%rcx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4120
jmp 0xf185
jmp 0xf27f
movq %rax, %rbx
movq -0x38(%rbp), %r14
movq -0x30(%rbp), %r15
jmp 0xf2c9
movq %rax, %rbx
movq -0x30(%rbp), %r15
jmp 0xf2aa
jmp 0xf28c
jmp 0xf295
movq %rax, %rbx
movq -0x30(%rbp), %r15
jmp 0xf2b8
movq %rax, %rbx
movq -0x30(%rbp), %r15
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xf2aa
callq 0x41e0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0xf2b8
callq 0x41e0
testq %r14, %r14
je 0xf2c5
movq %r14, %rdi
callq 0x896e
movq -0x38(%rbp), %r14
testq %r15, %r15
je 0xf2d6
movq %r15, %rdi
callq 0x896e
testq %r14, %r14
je 0xf2e3
movq %r14, %rdi
callq 0x896e
movq %rbx, %rdi
callq 0x43b0
nop