// File: /workspace/github_cpp_makefile_star2_O2/zhengwangsun[P]pas2c/semantics.cpp
// Function: procedure_call_statement1(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void  procedure_call_statement1(int k, string idValue)
{
	TreeNode tNode= tree.node[k];
	TreeNode childNode;
    if(lookahead(k) == 102)//102是(
    {
        int flag = 0;//标志作用
    	code[currentLine].append("(");
        expression_list(tree.node[k].child[1],3, idValue);
        code[currentLine].append(")");
        
        for(vector<subTableItem>::iterator it = subTable.begin(); it != subTable.end();it++)
        {
            if (it->name == idValue)
            {
                if (procArgument.size() != it->argument.size())
                {
                    cout<<"argument num wrong where procedure_call_statement1! line:"<<tree.node[k].row<<endl;
                    exit(1);
                }
                else
                {
                    int i = 1;//计数作用
                    for(vector<Tuple>::iterator it1 = it->argument.begin(); it1 != it->argument.end();it1++)
                    {
                        if (it1->type != procArgument[i-1])
                        {
                            cout<<"the argument no."<<i<<" type wrong where procedure_call_statement1! line:"<<tree.node[k].row<<endl;
                            cout<<"error in:"<<it->name<<endl;
                            exit(1);
                        }
                        i++;
                    }
                    procArgument.clear();//每用一次procA，就清空一次
                    flag = 1;
                    break;
                }
            }
        }
        if (flag == 0) {
            cout<<"this func/proc("<<idValue<<") is not define where pro_call! "<<tree.node[k].row<<endl;
            exit(1);
        }
    }
    else if(lookahead(k) == 106)//106是e
    {
        code[currentLine].append("(");//张英哲加的
        code[currentLine].append(")");
    }
    else
        cout<<"procedure_call_statement1 error!"<<endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %r15
movslq %edi, %r14
imulq $0xa8, %r14, %rax
leaq 0xab44a(%rip), %rcx     # 0xb4098
leaq (%rcx,%rax), %rbx
addq $0x8, %rbx
leaq 0xd0(%rsp), %rdi
movq %rbx, %rsi
callq 0xa562
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
movl %r14d, %edi
callq 0x603d
leaq 0xa4c63(%rip), %r14     # 0xad900
cmpl $0x6a, %eax
je 0x8d3b
cmpl $0x66, %eax
jne 0x8d74
movslq 0xa58ca(%rip), %rdi     # 0xae580
shlq $0x5, %rdi
addq %r14, %rdi
leaq 0x66d2(%rip), %rsi      # 0xf396
callq 0x2350
movl 0x8(%rbx), %ebp
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x2250
pushq $0x3
popq %rsi
movl %ebp, %edi
callq 0x8a61
leaq 0x8(%rsp), %rdi
callq 0x2388
movslq 0xa588c(%rip), %rax     # 0xae580
shlq $0x5, %rax
addq %rax, %r14
leaq 0x685a(%rip), %rsi      # 0xf55c
movq %r14, %rdi
callq 0x2350
movq 0xa4b97(%rip), %r14     # 0xad8a8
addq $0x30, %r14
leaq -0x30(%r14), %rax
cmpq 0xa4b90(%rip), %rax     # 0xad8b0
je 0x8e18
movq %r14, %rdi
movq %r15, %rsi
callq 0x5f9f
testb %al, %al
jne 0x8d91
addq $0x60, %r14
jmp 0x8d15
movslq 0xa583e(%rip), %rdi     # 0xae580
shlq $0x5, %rdi
addq %r14, %rdi
leaq 0x6646(%rip), %rsi      # 0xf396
callq 0x2350
movslq 0xa5824(%rip), %rax     # 0xae580
shlq $0x5, %rax
addq %rax, %r14
leaq 0x67f2(%rip), %rsi      # 0xf55c
movq %r14, %rdi
callq 0x2350
jmp 0x8df3
movq 0xb255(%rip), %rdi      # 0x13fd0
leaq 0x5cb5(%rip), %rsi      # 0xea37
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
jmp 0x8df3
movq 0xa4b30(%rip), %rsi     # 0xad8c8
movq 0xa4b21(%rip), %rcx     # 0xad8c0
movq %rsi, %r9
subq %rcx, %r9
sarq $0x2, %r9
movq -0x18(%r14), %rdi
movq -0x10(%r14), %r8
movq %r8, %rax
subq %rdi, %rax
pushq $0x50
popq %r10
cqto
idivq %r10
cmpq %rax, %r9
jne 0x8ed1
xorl %r15d, %r15d
cmpq %r8, %rdi
je 0x8de7
movl 0x20(%rdi), %eax
cmpl (%rcx,%r15,4), %eax
jne 0x8e63
addq $0x50, %rdi
incq %r15
jmp 0x8dcc
cmpq %rcx, %rsi
je 0x8df3
movq %rcx, 0xa4ad5(%rip)     # 0xad8c8
leaq 0x28(%rsp), %rdi
callq 0xa600
leaq 0xd0(%rsp), %rdi
callq 0xa600
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xb1b1(%rip), %rdi      # 0x13fd0
leaq 0x5be0(%rip), %rsi      # 0xea06
callq 0x21d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21c0
leaq 0x5bd9(%rip), %rsi      # 0xea16
movq %rax, %rdi
callq 0x21d0
movl 0xa4(%rbx), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x20f0
pushq $0x1
popq %rdi
callq 0x2220
movq 0xb166(%rip), %rdi      # 0x13fd0
leaq 0x5b47(%rip), %rsi      # 0xe9b8
callq 0x21d0
incl %r15d
movq %rax, %rdi
movl %r15d, %esi
callq 0x2320
leaq 0x5b3e(%rip), %rsi      # 0xe9c9
movq %rax, %rdi
callq 0x21d0
movl 0xa4(%rbx), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x20f0
movq 0xb120(%rip), %rdi      # 0x13fd0
leaq 0x5b45(%rip), %rsi      # 0xe9fc
callq 0x21d0
movq %rax, %rdi
movq %r14, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x20f0
jmp 0x8e5b
movq 0xb0f8(%rip), %rdi      # 0x13fd0
leaq 0x5a9f(%rip), %rsi      # 0xe97e
callq 0x21d0
movl 0xa4(%rbx), %esi
movq %rax, %rdi
callq 0x2320
movq %rax, %rdi
callq 0x20f0
jmp 0x8e5b
jmp 0x8f14
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2388
jmp 0x8f17
jmp 0x8f14
jmp 0x8f14
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xa600
leaq 0xd0(%rsp), %rdi
callq 0xa600
movq %rbx, %rdi
callq 0x2330