// File: /workspace/github_cpp_makefile_star2_O3/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, -0x90(%rbp)
movq (%rsi), %rax
cmpq %rax, 0x8(%rsi)
je 0xec02
movq %rsi, %r14
movq %rdi, %r15
xorl %r13d, %r13d
movq %rdi, -0x40(%rbp)
movq 0x10(%r15), %rdx
movq %r13, %rcx
shlq $0x4, %rcx
movq (%rdx,%rcx), %r12
movq 0x8(%rdx,%rcx), %rdx
testq %rdx, %rdx
movq %rdx, -0x50(%rbp)
je 0xea04
movq 0xd5c5(%rip), %rsi      # 0x1bfb8
cmpb $0x0, (%rsi)
je 0xe9fd
incl 0x8(%rdx)
jmp 0xea04
lock
incl 0x8(%rdx)
movq (%r14), %rax
movq (%rax,%rcx), %rbx
movq 0x8(%rax,%rcx), %rax
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xea33
movq 0xd59b(%rip), %rax      # 0x1bfb8
cmpb $0x0, (%rax)
je 0xea2b
movq -0x30(%rbp), %rax
incl 0x8(%rax)
jmp 0xea33
movq -0x30(%rbp), %rax
lock
incl 0x8(%rax)
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
shrq $0x4, %rax
testl %eax, %eax
je 0xebcc
cmpl $-0x5, 0x8(%rbx)
jne 0xec61
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xeaa3
leaq 0xcee5(%rip), %rsi      # 0x1b948
leaq 0xd276(%rip), %rdx      # 0x1bce0
xorl %ecx, %ecx
callq 0x4250
movl $0x0, %ecx
movq %rcx, -0x38(%rbp)
movl $0x0, %r15d
testq %rax, %rax
je 0xeac1
movq 0x20(%rbx), %rcx
testq %rcx, %rcx
je 0xeab0
movq 0xd523(%rip), %rdx      # 0x1bfb8
cmpb $0x0, (%rdx)
movq %rcx, -0x38(%rbp)
je 0xeaba
incl 0x8(%rcx)
jmp 0xeabe
movq $0x0, -0x38(%rbp)
xorl %r15d, %r15d
jmp 0xeac1
movq $0x0, -0x38(%rbp)
jmp 0xeabe
lock
incl 0x8(%rcx)
movq %rax, %r15
movq %r15, %rdi
movq -0x90(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0xce4e
movl 0x8(%r15), %ecx
movl %eax, -0x70(%rbp)
movl %ecx, -0x6c(%rbp)
leaq 0xd9e4(%rip), %rdi      # 0x1c4c8
leaq -0x70(%rbp), %rsi
movq -0x38(%rbp), %rbx
callq 0x10704
leaq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x10790
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
shrq $0x4, %rax
cltq
movq -0x80(%rbp), %rcx
subq -0x88(%rbp), %rcx
sarq $0x2, %rcx
cmpq %rax, %rcx
jne 0xecd0
leaq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0xedc8
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
je 0xeb69
sarq $0x2, %rcx
movl $0x1, %edx
movq -0x88(%rbp), %rsi
movl (%rax,%rdx,4), %edi
cmpl (%rsi,%rdx,4), %edi
jne 0xec11
incq %rdx
cmpq %rdx, %rcx
jne 0xeb55
movb $0x1, 0xd(%r15)
movl 0x8(%r12), %eax
movq -0x40(%rbp), %r15
movl 0x8(%r15), %ecx
movl %ecx, -0x58(%rbp)
movl %eax, -0x54(%rbp)
leaq 0xd940(%rip), %rdi      # 0x1c4c8
leaq -0x58(%rbp), %rsi
callq 0x10704
movq %rax, %rdi
leaq -0x88(%rbp), %rsi
callq 0x109f6
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xebae
callq 0x41e0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0xebbf
callq 0x41e0
testq %rbx, %rbx
je 0xebcc
movq %rbx, %rdi
callq 0x864c
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xebda
callq 0x864c
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xebe8
callq 0x864c
incq %r13
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
cmpq %r13, %rcx
jne 0xe9cf
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd3d0(%rip), %rdi      # 0x1bfe8
leaq 0x5cf3(%rip), %rsi      # 0x14912
movl $0x8, %edx
callq 0x4260
movq 0xd3b8(%rip), %rdi      # 0x1bfe8
movl %r13d, %esi
callq 0x4390
movq %rax, %r15
leaq 0x5cf4(%rip), %rsi      # 0x14936
movl $0x2e, %edx
movq %rax, %rdi
callq 0x4260
movq %r15, %rdi
callq 0x4120
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x42a0
movq 0xd380(%rip), %rdi      # 0x1bfe8
leaq 0x5ca3(%rip), %rsi      # 0x14912
movl $0x8, %edx
callq 0x4260
movq 0xd368(%rip), %rdi      # 0x1bfe8
movl %r13d, %esi
callq 0x4390
movq %rax, %r15
leaq 0x5c89(%rip), %rsi      # 0x1491b
movl $0x1a, %edx
movq %rax, %rdi
callq 0x4260
movq -0x40(%rbp), %rax
movslq 0x8(%rax), %rax
leaq 0xd682(%rip), %rcx      # 0x1c330
movq (%rcx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq %r15, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4120
jmp 0xec57
movq 0xd311(%rip), %rdi      # 0x1bfe8
leaq 0x5c34(%rip), %rsi      # 0x14912
movl $0x8, %edx
callq 0x4260
movq 0xd2f9(%rip), %rdi      # 0x1bfe8
movl %r13d, %esi
callq 0x4390
movq %rax, %r15
leaq 0x5c1a(%rip), %rsi      # 0x1491b
movl $0x1a, %edx
movq %rax, %rdi
callq 0x4260
movq -0x40(%rbp), %rax
movslq 0x8(%rax), %rax
leaq 0xd613(%rip), %rcx      # 0x1c330
movq (%rcx), %rcx
shlq $0x5, %rax
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
movq %r15, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4120
jmp 0xec57
movq %rax, %r15
movq -0x38(%rbp), %rbx
jmp 0xed57
movq %rax, %r15
movq -0x30(%rbp), %r14
jmp 0xeda4
movq %rax, %r15
movq -0x30(%rbp), %r14
jmp 0xed86
movq %rax, %r15
movq -0x38(%rbp), %rbx
jmp 0xed6b
jmp 0xed71
movq %rax, %r15
movq -0x30(%rbp), %r14
jmp 0xed97
movq %rax, %r15
movq -0x30(%rbp), %r14
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0xed86
callq 0x41e0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0xed97
callq 0x41e0
testq %rbx, %rbx
je 0xeda4
movq %rbx, %rdi
callq 0x864c
testq %r14, %r14
je 0xedb1
movq %r14, %rdi
callq 0x864c
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xedbf
callq 0x864c
movq %r15, %rdi
callq 0x43b0
nop