// File: /workspace/github_cpp_makefile_star2_O1/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, %r14d
movl %edi, %r13d
movslq %esi, %rax
imulq $0xa8, %rax, %rax
leaq 0xb25bb(%rip), %r15     # 0xba0c8
leaq (%r15,%rax), %rbx
addq $0x8, %rbx
leaq 0xf0(%rsp), %rax
movl $0xb, %ecx
movq %rax, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movb 0x58(%rbx), %cl
movb %cl, 0x58(%rax)
leaq 0x150(%rsp), %rdi
leaq 0x160(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
addq %rsi, %rdx
callq 0x768e
leaq 0x170(%rsp), %rdi
leaq 0x180(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x80(%rbx), %rsi
movq 0x88(%rbx), %rdx
addq %rsi, %rdx
callq 0x768e
movq 0xa0(%rbx), %rax
movq %rax, 0x190(%rsp)
leaq 0xb8(%rsp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0xd8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq %rax, -0x8(%rbp)
movb %al, (%rbp)
cmpl $0x0, (%rbx)
jle 0x7c77
movslq 0x4(%rbx), %rax
imulq $0xa8, %rax, %rax
cmpl $0x65, 0x5c(%r15,%rax)
jne 0x7c77
movl %r13d, 0x4(%rsp)
movl 0x4(%rbx), %r13d
cmpl $0x3, %r14d
je 0x7e41
cmpl $0x2, %r14d
je 0x7d53
cmpl $0x1, %r14d
jne 0x7cbd
leaq 0xabd01(%rip), %rdi     # 0xb3908
leaq 0xc912(%rip), %rsi      # 0x14520
callq 0x2090
testl %eax, %eax
je 0x7f30
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0xabcdd(%rip), %rsi     # 0xb3908
movq 0xabcde(%rip), %rdx     # 0xb3910
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x768e
leaq 0x28(%rsp), %rdx
movl %r13d, %edi
movl 0x4(%rsp), %esi
xorl %ecx, %ecx
callq 0x8278
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x7f3c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x7f3c
movq 0x12352(%rip), %rbx     # 0x19fd0
leaq 0xc90a(%rip), %rsi      # 0x1458f
movl $0x16, %edx
movq %rbx, %rdi
callq 0x2280
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0x12320(%rip), %rdi     # 0x19fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0xc8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7cda
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0xa8(%rsp), %rdi
cmpq %r12, %rdi
je 0x7cf7
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x170(%rsp), %rdi
leaq 0x180(%rsp), %rax
cmpq %rax, %rdi
je 0x7d1c
movq 0x180(%rsp), %rsi
incq %rsi
callq 0x2230
movq 0x150(%rsp), %rdi
leaq 0x160(%rsp), %rax
cmpq %rax, %rdi
je 0x7d41
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x2230
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0xabba5(%rip), %rsi     # 0xb3908
movq 0xabba6(%rip), %rdx     # 0xb3910
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x768e
leaq 0x8(%rsp), %rdx
movl %r13d, %edi
movl 0x4(%rsp), %esi
movl $0x1, %ecx
callq 0x8278
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7da9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
movslq 0xf4(%rsp), %rax
imulq $0xa8, %rax, %rdx
leaq (%r15,%rdx), %r13
addq $0x8, %r13
leaq 0x48(%rsp), %rax
movl $0xb, %ecx
movq %rax, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movb 0x58(%r13), %cl
movb %cl, 0x58(%rax)
leaq (%r15,%rdx), %rsi
addq $0x68, %rsi
leaq 0xa8(%rsp), %rdi
callq 0x2110
leaq 0x80(%r13), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x2110
movq 0xa0(%r13), %rax
movq %rax, 0xe8(%rsp)
movslq 0xac797(%rip), %rax     # 0xb45b0
shlq $0x5, %rax
leaq 0xabb0c(%rip), %rdi     # 0xb3930
addq %rax, %rdi
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
callq 0x20a0
jmp 0x804d
movl %r13d, %edi
callq 0x8b17
testl %eax, %eax
je 0x8061
movl %r13d, %edi
callq 0x8edc
movl %eax, %edi
callq 0x9244
movslq 0xf4(%rsp), %rax
imulq $0xa8, %rax, %rdx
leaq (%r15,%rdx), %r14
addq $0x8, %r14
leaq 0x48(%rsp), %rax
movl $0xb, %ecx
movq %rax, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movb 0x58(%r14), %cl
movb %cl, 0x58(%rax)
leaq (%r15,%rdx), %rsi
addq $0x68, %rsi
leaq 0xa8(%rsp), %rdi
callq 0x2110
leaq 0x80(%r14), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x2110
movq 0xa0(%r14), %rax
movq %rax, 0xe8(%rsp)
movslq 0xac6e0(%rip), %rdi     # 0xb45b0
shlq $0x5, %rdi
leaq 0xaba55(%rip), %r14     # 0xb3930
addq %r14, %rdi
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
callq 0x20a0
movslq 0xac6b6(%rip), %rax     # 0xb45b0
leal 0x1(%rax), %ecx
movl %ecx, 0xac6ad(%rip)     # 0xb45b0
shlq $0x5, %rax
addq %rax, %r14
leaq 0xc64d(%rip), %rsi      # 0x1455e
movq %r14, %rdi
callq 0x23d0
movl 0x8(%rbx), %esi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x3, %edx
callq 0x84fb
jmp 0x7cbd
movl %r13d, %edi
movl 0x4(%rsp), %esi
callq 0x8136
movslq 0xf4(%rsp), %rax
imulq $0xa8, %rax, %rdx
leaq (%r15,%rdx), %r13
addq $0x8, %r13
leaq 0x48(%rsp), %rax
movl $0xb, %ecx
movq %rax, %rdi
movq %r13, %rsi
rep  movsq (%rsi), %es:(%rdi)
movb 0x58(%r13), %cl
movb %cl, 0x58(%rax)
leaq (%r15,%rdx), %rsi
addq $0x68, %rsi
leaq 0xa8(%rsp), %rdi
callq 0x2110
leaq 0x80(%r13), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x2110
movq 0xa0(%r13), %rax
movq %rax, 0xe8(%rsp)
movslq 0xac604(%rip), %rdi     # 0xb45b0
shlq $0x5, %rdi
leaq 0xab979(%rip), %r15     # 0xb3930
addq %r15, %rdi
cmpl $0x1, 0xab967(%rip)     # 0xb3928
jne 0x8038
leaq 0xc597(%rip), %rcx      # 0x14561
movl $0x3, %esi
movl $0x1, %r8d
xorl %edx, %edx
callq 0x2260
movslq 0xac5cd(%rip), %rax     # 0xb45b0
leal 0x1(%rax), %ecx
movl %ecx, 0xac5c4(%rip)     # 0xb45b0
shlq $0x5, %rax
addq %rax, %r15
movq 0xc8(%rsp), %r14
movq %r14, %rdi
callq 0x20e0
movl $0x4, %esi
movq %r15, %rdi
xorl %edx, %edx
movq %r14, %rcx
movq %rax, %r8
callq 0x2260
movl 0x8(%rbx), %esi
movl 0x4(%rsp), %edi
movl $0x1, %edx
callq 0x84fb
movl $0x0, 0xab8f5(%rip)     # 0xb3928
jmp 0x7cbd
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
callq 0x20a0
movl 0x8(%rbx), %esi
movl 0x4(%rsp), %edi
movl %r14d, %edx
callq 0x84fb
jmp 0x7cbd
movq 0x11f68(%rip), %rbx     # 0x19fd0
leaq 0xc4f4(%rip), %rsi      # 0x14563
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x2280
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0x11f36(%rip), %rdi     # 0x19fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
jmp 0x7cbd
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x8117
movq 0x38(%rsp), %rsi
jmp 0x80dc
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8117
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x8117
jmp 0x8114
movq %rax, %rbx
movq 0x150(%rsp), %rdi
leaq 0x160(%rsp), %rax
cmpq %rax, %rdi
je 0x812e
movq 0x160(%rsp), %rsi
incq %rsi
callq 0x2230
jmp 0x812e
jmp 0x8114
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xf7a8
leaq 0xf0(%rsp), %rdi
callq 0xf7a8
movq %rbx, %rdi
callq 0x23a0