// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: identifier_list1(int, int, int)
void identifier_list1(int type, int k, int useFlag)
{
    TreeNode tNode= tree.node[k];
	TreeNode childNode;
	if (lookahead(k) == 105)//105是,
    {
        int id_position = tree.node[k].child[1];//将id节点在树中的下标值赋给id_position
        if (useFlag == 1)
        {
            //判断放入主符号表还是子符号表
            if(currentTable == "main")
                enterMain(id_position, type);
            else
                enterSub(id_position, type, currentTable, 0);//是子程序内定义的标识符
                
            code[currentLine].append(",");
			childNode=tree.node[tNode.child[1]];
			code[currentLine].append(childNode.value);
            identifier_list1(type, tree.node[k].child[2], 1);
        }
        else if (useFlag == 2)
        {
            enterSub(id_position, type, currentTable, 1);//是子程序参数标识符
            
            code[currentLine].append(",");
			appendIDType(type);
			childNode=tree.node[tNode.child[1]];
			code[currentLine].append(childNode.value);
            identifier_list1(type, tree.node[k].child[2], 2);
        }
        else if (useFlag == 3)
        {
            if(isDefined(id_position) != 0)//查看是否声明
             {
                int idType = checkIdType(id_position);
             	addReadType(idType);
            	childNode=tree.node[tNode.child[1]];
				code[currentLine].append(childNode.value);
				code[currentLine++].append(");\n ");
				identifier_list1(-1, tree.node[k].child[2], 3);
        	 	
			 }
        	 
			else
                cout<<"the id is not defined where identifier_list1"<<endl;
        }
    }
    else if (lookahead(k) == 106)//e
    {}
    else
        cout<<"identifier_list1 error!"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb8b72(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x14920
leaq -0x160(%rbp), %rdi
callq 0x149d0
movl -0x8(%rbp), %edi
callq 0xca50
movl %eax, -0x1b8(%rbp)
jmp 0xd5f3
movl -0x1b8(%rbp), %eax
cmpl $0x69, %eax
jne 0xd9e8
movslq -0x8(%rbp), %rcx
leaq 0xb8b2b(%rip), %rax     # 0xc6138
addq $0x8, %rax
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x170(%rbp)
cmpl $0x1, -0xc(%rbp)
jne 0xd790
leaq 0xb2343(%rip), %rdi     # 0xbf978
leaq 0x10e7e(%rip), %rsi     # 0x1e4ba
callq 0xc770
movb %al, -0x1b9(%rbp)
jmp 0xd649
movb -0x1b9(%rbp), %al
testb $0x1, %al
jne 0xd655
jmp 0xd681
movl -0x170(%rbp), %edi
movl -0x4(%rbp), %esi
callq 0xd230
jmp 0xd665
jmp 0xd6f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
jmp 0xda5b
movl -0x170(%rbp), %eax
movl %eax, -0x1c4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x1c0(%rbp)
leaq 0xb22db(%rip), %rsi     # 0xbf978
leaq -0x190(%rbp), %rdi
callq 0x30e0
jmp 0xd6ab
movl -0x1c0(%rbp), %esi
movl -0x1c4(%rbp), %edi
leaq -0x190(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd340
jmp 0xd6c7
leaq -0x190(%rbp), %rdi
callq 0x34c8
jmp 0xd6f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x34c8
jmp 0xda5b
movslq 0xb2f21(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xb2296(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0x112f7(%rip), %rsi     # 0x1ea0b
callq 0x3490
jmp 0xd71b
movslq -0xb0(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb8a08(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0x160(%rbp), %rdi
callq 0x14a10
jmp 0xd743
movslq 0xb2ed6(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xb224b(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x34a0
jmp 0xd766
movl -0x4(%rbp), %edi
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb89bd(%rip), %rax     # 0xc6138
movl 0x14(%rax,%rcx), %esi
movl $0x1, %edx
callq 0xd5a0
jmp 0xd78b
jmp 0xd9e6
cmpl $0x2, -0xc(%rbp)
jne 0xd8b4
movl -0x170(%rbp), %eax
movl %eax, -0x1cc(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x1c8(%rbp)
leaq 0xb21c2(%rip), %rsi     # 0xbf978
leaq -0x1b0(%rbp), %rdi
callq 0x30e0
jmp 0xd7c4
movl -0x1c8(%rbp), %esi
movl -0x1cc(%rbp), %edi
leaq -0x1b0(%rbp), %rdx
movl $0x1, %ecx
callq 0xd340
jmp 0xd7e3
leaq -0x1b0(%rbp), %rdi
callq 0x34c8
movslq 0xb2e2a(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xb219f(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0x11200(%rip), %rsi     # 0x1ea0b
callq 0x3490
jmp 0xd812
movl -0x4(%rbp), %edi
callq 0xe630
jmp 0xd81c
movslq -0xb0(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb8907(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0x160(%rbp), %rdi
callq 0x14a10
jmp 0xd844
movslq 0xb2dd5(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xb214a(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x34a0
jmp 0xd867
movl -0x4(%rbp), %edi
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb88bc(%rip), %rax     # 0xc6138
movl 0x14(%rax,%rcx), %esi
movl $0x2, %edx
callq 0xd5a0
jmp 0xd88c
jmp 0xd9e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x168(%rbp)
movl %eax, -0x16c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x34c8
jmp 0xda5b
cmpl $0x3, -0xc(%rbp)
jne 0xd9e2
movl -0x170(%rbp), %edi
callq 0xda80
movl %eax, -0x1d0(%rbp)
jmp 0xd8d1
movl -0x1d0(%rbp), %eax
cmpl $0x0, %eax
je 0xd9ad
movl -0x170(%rbp), %edi
callq 0xe0d0
movl %eax, -0x1d4(%rbp)
jmp 0xd8f3
movl -0x1d4(%rbp), %eax
movl %eax, -0x1b4(%rbp)
movl -0x1b4(%rbp), %edi
callq 0xe5c0
jmp 0xd90c
movslq -0xb0(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb8817(%rip), %rax     # 0xc6138
leaq 0x8(%rax,%rcx), %rsi
leaq -0x160(%rbp), %rdi
callq 0x14a10
jmp 0xd934
movslq 0xb2ce5(%rip), %rax     # 0xc0620
shlq $0x5, %rax
leaq 0xb205a(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x34a0
jmp 0xd957
movslq 0xb2cc2(%rip), %rax     # 0xc0620
movl %eax, %ecx
incl %ecx
movl %ecx, 0xb2cb8(%rip)     # 0xc0620
shlq $0x5, %rax
leaq 0xb202d(%rip), %rdi     # 0xbf9a0
addq %rax, %rdi
leaq 0x10b7b(%rip), %rsi     # 0x1e4f8
callq 0x3490
jmp 0xd984
movslq -0x8(%rbp), %rax
imulq $0xa8, %rax, %rcx
leaq 0xb87a2(%rip), %rax     # 0xc6138
movl 0x14(%rax,%rcx), %esi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x3, %edx
callq 0xd5a0
jmp 0xd9ab
jmp 0xd9e0
movq 0x18614(%rip), %rdi     # 0x25fc8
leaq 0x10bb4(%rip), %rsi     # 0x1e56f
callq 0x3280
movq %rax, -0x1e0(%rbp)
jmp 0xd9c9
movq -0x1e0(%rbp), %rdi
movq 0x185d9(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0xd9de
jmp 0xd9e0
jmp 0xd9e2
jmp 0xd9e4
jmp 0xd9e6
jmp 0xda3a
movl -0x8(%rbp), %edi
callq 0xca50
movl %eax, -0x1e4(%rbp)
jmp 0xd9f8
movl -0x1e4(%rbp), %eax
cmpl $0x6a, %eax
jne 0xda05
jmp 0xda38
movq 0x185bc(%rip), %rdi     # 0x25fc8
leaq 0x10b89(%rip), %rsi     # 0x1e59c
callq 0x3280
movq %rax, -0x1f0(%rbp)
jmp 0xda21
movq -0x1f0(%rbp), %rdi
movq 0x18581(%rip), %rsi     # 0x25fb0
callq 0x32b0
jmp 0xda36
jmp 0xda38
jmp 0xda3a
leaq -0x160(%rbp), %rdi
callq 0x14a90
leaq -0xb8(%rbp), %rdi
callq 0x14a90
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
leaq -0x160(%rbp), %rdi
callq 0x14a90
leaq -0xb8(%rbp), %rdi
callq 0x14a90
movq -0x168(%rbp), %rdi
callq 0x3450
nop