// File: 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
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rsi, -0x1d8(%rbp)
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb4b5d(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x14920
leaq -0x160(%rbp), %rdi
callq 0x149d0
movl -0x4(%rbp), %edi
callq 0xca50
movl %eax, -0x1cc(%rbp)
jmp 0x11608
movl -0x1cc(%rbp), %eax
cmpl $0x66, %eax
jne 0x11ab3
movl $0x0, -0x170(%rbp)
movslq 0xaeff8(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xae36d(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0xdaf9(%rip), %rsi      # 0x1f136
callq 0x3490
jmp 0x11644
movq -0x1d8(%rbp), %rsi
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb4adb(%rip), %rax     # 0xc6138
movl 0x10(%rax,%rcx), %eax
movl %eax, -0x1dc(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x30e0
jmp 0x11675
movl -0x1dc(%rbp), %edi
movl $0x3, %esi
leaq -0x190(%rbp), %rdx
callq 0x112f0
jmp 0x1168e
leaq -0x190(%rbp), %rdi
callq 0x34c8
movslq 0xaef7f(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xae2f4(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0xdc46(%rip), %rsi      # 0x1f2fc
callq 0x3490
jmp 0x116bd
leaq 0xae284(%rip), %rdi     # 0xbf948
callq 0x14b00
movq %rax, -0x198(%rbp)
leaq 0xae271(%rip), %rdi     # 0xbf948
callq 0x14b70
movq %rax, -0x1a0(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x14b30
testb $0x1, %al
jne 0x116ff
jmp 0x11a00
leaq -0x198(%rbp), %rdi
callq 0x14ba0
movq -0x1d8(%rbp), %rsi
movq %rax, %rdi
addq $0x30, %rdi
callq 0xc840
testb $0x1, %al
jne 0x11727
jmp 0x119e4
leaq 0xae232(%rip), %rdi     # 0xbf960
callq 0x14c00
movq %rax, -0x1e8(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x14c20
movq %rax, %rcx
movq -0x1e8(%rbp), %rax
cmpq %rcx, %rax
je 0x11808
movq 0x1485c(%rip), %rdi     # 0x25fc8
leaq 0xd145(%rip), %rsi      # 0x1e8b8
callq 0x3280
movq %rax, -0x1f0(%rbp)
jmp 0x11781
movq -0x1f0(%rbp), %rdi
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb499e(%rip), %rax     # 0xc6138
movl 0xac(%rax,%rcx), %esi
callq 0x3440
movq %rax, -0x1f8(%rbp)
jmp 0x117af
movq -0x1f8(%rbp), %rdi
movq 0x147f3(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x117c4
movl $0x1, %edi
callq 0x3340
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
jmp 0x11b6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x34c8
jmp 0x11b6c
movl $0x1, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x14c50
movq %rax, -0x1b0(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x14cc0
movq %rax, -0x1b8(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x14c80
testb $0x1, %al
jne 0x1186c
jmp 0x119cc
leaq -0x1b0(%rbp), %rdi
callq 0x14cf0
movl 0x20(%rax), %eax
movl %eax, -0x1fc(%rbp)
movl -0x1a4(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
leaq 0xae0cc(%rip), %rdi     # 0xbf960
callq 0x14d10
movq %rax, %rcx
movl -0x1fc(%rbp), %eax
cmpl (%rcx), %eax
je 0x119a3
movq 0x14717(%rip), %rdi     # 0x25fc8
leaq 0xd03a(%rip), %rsi      # 0x1e8f2
callq 0x3280
movq %rax, -0x208(%rbp)
jmp 0x118c6
movq -0x208(%rbp), %rdi
movl -0x1a4(%rbp), %esi
callq 0x3440
movq %rax, -0x210(%rbp)
jmp 0x118e1
movq -0x210(%rbp), %rdi
leaq 0xd014(%rip), %rsi      # 0x1e903
callq 0x3280
movq %rax, -0x218(%rbp)
jmp 0x118fd
movq -0x218(%rbp), %rdi
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb4822(%rip), %rax     # 0xc6138
movl 0xac(%rax,%rcx), %esi
callq 0x3440
movq %rax, -0x220(%rbp)
jmp 0x1192b
movq -0x220(%rbp), %rdi
movq 0x14677(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x11940
movq 0x14681(%rip), %rdi     # 0x25fc8
leaq 0xcfe8(%rip), %rsi      # 0x1e936
callq 0x3280
movq %rax, -0x228(%rbp)
jmp 0x1195c
leaq -0x198(%rbp), %rdi
callq 0x14ba0
movq -0x228(%rbp), %rdi
movq %rax, %rsi
addq $0x30, %rsi
callq 0x3260
movq %rax, -0x230(%rbp)
jmp 0x11984
movq -0x230(%rbp), %rdi
movq 0x1461e(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x11999
movl $0x1, %edi
callq 0x3340
movl -0x1a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a4(%rbp)
leaq -0x1b0(%rbp), %rdi
xorl %esi, %esi
callq 0x14d30
movq %rax, -0x1c0(%rbp)
jmp 0x11831
leaq 0xadf8d(%rip), %rdi     # 0xbf960
callq 0x14d70
movl $0x1, -0x170(%rbp)
jmp 0x11a00
jmp 0x119e6
leaq -0x198(%rbp), %rdi
xorl %esi, %esi
callq 0x14bc0
movq %rax, -0x1c8(%rbp)
jmp 0x116d0
cmpl $0x0, -0x170(%rbp)
jne 0x11aae
movq 0x145b4(%rip), %rdi     # 0x25fc8
leaq 0xcf25(%rip), %rsi      # 0x1e940
callq 0x3280
movq %rax, -0x238(%rbp)
jmp 0x11a29
movq -0x1d8(%rbp), %rsi
movq -0x238(%rbp), %rdi
callq 0x3260
movq %rax, -0x240(%rbp)
jmp 0x11a45
movq -0x240(%rbp), %rdi
leaq 0xcefd(%rip), %rsi      # 0x1e950
callq 0x3280
movq %rax, -0x248(%rbp)
jmp 0x11a61
movq -0x248(%rbp), %rdi
movslq -0x4(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb46be(%rip), %rax     # 0xc6138
movl 0xac(%rax,%rcx), %esi
callq 0x3440
movq %rax, -0x250(%rbp)
jmp 0x11a8f
movq -0x250(%rbp), %rdi
movq 0x14513(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x11aa4
movl $0x1, %edi
callq 0x3340
jmp 0x11b4b
movl -0x4(%rbp), %edi
callq 0xca50
movl %eax, -0x254(%rbp)
jmp 0x11ac3
movl -0x254(%rbp), %eax
cmpl $0x6a, %eax
jne 0x11b16
movslq 0xaeb4b(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xadec0(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0xd64c(%rip), %rsi      # 0x1f136
callq 0x3490
jmp 0x11af1
movslq 0xaeb28(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xade9d(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0xd7ef(%rip), %rsi      # 0x1f2fc
callq 0x3490
jmp 0x11b14
jmp 0x11b49
movq 0x144ab(%rip), %rdi     # 0x25fc8
leaq 0xce4d(%rip), %rsi      # 0x1e971
callq 0x3280
movq %rax, -0x260(%rbp)
jmp 0x11b32
movq -0x260(%rbp), %rdi
movq 0x14470(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0x11b47
jmp 0x11b49
jmp 0x11b4b
leaq -0x160(%rbp), %rdi
callq 0x14a90
leaq -0xb8(%rbp), %rdi
callq 0x14a90
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
leaq -0x160(%rbp), %rdi
callq 0x14a90
leaq -0xb8(%rbp), %rdi
callq 0x14a90
movq -0x168(%rbp), %rdi
callq 0x3450