// File: /workspace/github_cpp_makefile_star2_O2/zhengwangsun[P]pas2c/semantics.cpp
// Function: identifier_list(int, int, int)
void identifier_list(int type, int k, int useFlag)
{
	TreeNode tNode= tree.node[k];
	TreeNode childNode;
    if(lookahead(k) == 101)//101是id
    {
        int id_position = tree.node[k].child[0];//将id节点在树中的下标值赋给id_position
        if (useFlag == 1)
        {
            //判断放入主符号表还是子符号表
            if(currentTable == "main")
                enterMain(id_position, type);
            else
                enterSub(id_position, type, currentTable, 0);//是子程序内定义的标识符，0代表放入item
        	
        	childNode=tree.node[tNode.child[0]];
            if(isArray==1) //修改 array
            {
                code[currentLine].insert(3, " ");
                code[currentLine++].insert(4, childNode.value.c_str());
                
                identifier_list1(type, tree.node[k].child[1], 1);
                isArray=0;
            }
            else
            {
                code[currentLine].append(childNode.value);
                identifier_list1(type, tree.node[k].child[1], 1);
            }
        }
        else if (useFlag == 2)//parameter
        {
            enterSub(id_position, type, currentTable, 1);//是子程序参数标识符

			childNode=tree.node[tNode.child[0]];
			code[currentLine].append(childNode.value);
            
            identifier_list1(type, tree.node[k].child[1], 2);
        }
        else if (useFlag == 3)
        { 
            if(isDefined(id_position) != 0)
			{
			//查看是否声明，张英哲改动
                int idType = checkIdType(id_position);
            	addReadType(idType);
            	childNode=tree.node[tNode.child[0]];
				code[currentLine].append(childNode.value);
				code[currentLine++].append(");\n ");
                identifier_list1(-1, tree.node[k].child[1], 3);
                
        	}
			else
                cout<<"the id is not defined where identifier_list"<<endl;
        }
    }
    else
        cout<<"identifier_list error!"<<endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %edx, %r15d
movl %edi, %ebp
movslq %esi, %r14
imulq $0xa8, %r14, %rax
leaq 0xade82(%rip), %r13     # 0xb4098
leaq (%rax,%r13), %rbx
addq $0x8, %rbx
leaq 0xf0(%rsp), %rdi
movq %rbx, %rsi
callq 0xa562
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
movl %r14d, %edi
callq 0x603d
cmpl $0x65, %eax
jne 0x62b3
leaq 0xc8(%rsp), %r14
movl 0x4(%rbx), %r12d
cmpl $0x3, %r15d
je 0x633b
cmpl $0x2, %r15d
je 0x62d3
cmpl $0x1, %r15d
jne 0x64bd
leaq 0xa7648(%rip), %rdi     # 0xad8d8
leaq 0x82e9(%rip), %rsi      # 0xe580
callq 0x5f92
testb %al, %al
je 0x63d1
movl %r12d, %edi
movl %ebp, %esi
callq 0x6525
jmp 0x63fd
movq 0xdd16(%rip), %rdi      # 0x13fd0
leaq 0x832e(%rip), %rsi      # 0xe5ef
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
jmp 0x64bd
leaq 0xa75fe(%rip), %rsi     # 0xad8d8
leaq 0x8(%rsp), %rdi
callq 0x2250
leaq 0x8(%rsp), %rdx
pushq $0x1
popq %rcx
movl %r12d, %edi
movl %ebp, %esi
callq 0x6618
leaq 0x8(%rsp), %rdi
callq 0x2388
movslq 0xf4(%rsp), %rax
imulq $0xa8, %rax, %rax
leaq (%rax,%r13), %rsi
addq $0x8, %rsi
leaq 0x48(%rsp), %rdi
callq 0xa5ba
movslq 0xa8258(%rip), %rax     # 0xae580
shlq $0x5, %rax
leaq 0xa75cd(%rip), %rdi     # 0xad900
addq %rax, %rdi
jmp 0x648b
movl %r12d, %edi
callq 0x6ab8
testl %eax, %eax
je 0x64a2
movl %r12d, %edi
callq 0x6cc0
movl %eax, %edi
callq 0x6eb2
movslq 0xf4(%rsp), %rax
imulq $0xa8, %rax, %rax
leaq (%rax,%r13), %rsi
addq $0x8, %rsi
leaq 0x48(%rsp), %rdi
callq 0xa5ba
movslq 0xa81fe(%rip), %rdi     # 0xae580
shlq $0x5, %rdi
leaq 0xa7573(%rip), %r15     # 0xad900
addq %r15, %rdi
movq %r14, %rsi
callq 0x2370
movslq 0xa81e1(%rip), %rax     # 0xae580
leal 0x1(%rax), %ecx
movl %ecx, 0xa81d8(%rip)     # 0xae580
shlq $0x5, %rax
addq %rax, %r15
leaq 0x8208(%rip), %rsi      # 0xe5be
movq %r15, %rdi
callq 0x2350
movl 0x8(%rbx), %esi
pushq $-0x1
popq %rdi
pushq $0x3
popq %rdx
callq 0x67bd
jmp 0x64bd
leaq 0xa7500(%rip), %rsi     # 0xad8d8
leaq 0x28(%rsp), %rdi
callq 0x2250
leaq 0x28(%rsp), %rdx
movl %r12d, %edi
movl %ebp, %esi
xorl %ecx, %ecx
callq 0x6618
leaq 0x28(%rsp), %rdi
callq 0x2388
movslq 0xf4(%rsp), %rax
imulq $0xa8, %rax, %rax
leaq (%rax,%r13), %rsi
addq $0x8, %rsi
leaq 0x48(%rsp), %rdi
callq 0xa5ba
movslq 0xa815b(%rip), %rdi     # 0xae580
shlq $0x5, %rdi
leaq 0xa74d0(%rip), %r12     # 0xad900
addq %r12, %rdi
cmpl $0x1, 0xa74be(%rip)     # 0xad8f8
jne 0x648b
leaq 0x817e(%rip), %rdx      # 0xe5c1
pushq $0x3
popq %rsi
callq 0x2060
movslq 0xa812e(%rip), %rax     # 0xae580
leal 0x1(%rax), %ecx
movl %ecx, 0xa8125(%rip)     # 0xae580
shlq $0x5, %rax
addq %rax, %r12
movq 0xc8(%rsp), %rdx
pushq $0x4
popq %rsi
movq %r12, %rdi
callq 0x2060
movl 0x8(%rbx), %esi
pushq $0x1
popq %rdx
movl %ebp, %edi
callq 0x67bd
andl $0x0, 0xa746f(%rip)     # 0xad8f8
jmp 0x64bd
movq %r14, %rsi
callq 0x2370
movl 0x8(%rbx), %esi
movl %ebp, %edi
movl %r15d, %edx
callq 0x67bd
jmp 0x64bd
movq 0xdb27(%rip), %rdi      # 0x13fd0
leaq 0x8113(%rip), %rsi      # 0xe5c3
callq 0x21d0
movq %rax, %rdi
callq 0x20f0
leaq 0x48(%rsp), %rdi
callq 0xa600
leaq 0xf0(%rsp), %rdi
callq 0xa600
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x64f8
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2388
jmp 0x6506
jmp 0x6503
jmp 0x6503
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xa600
leaq 0xf0(%rsp), %rdi
callq 0xa600
movq %rbx, %rdi
callq 0x2330