// File: zhengwangsun[P]pas2c/semantics.cpp
// Function: isTheArray(int)
bool isTheArray(int id_position)
{
    if(currentTable == "main")//若当前符号表为主表
    {
        for(vector<Tuple>::iterator it = mainTable.begin(); it != mainTable.end();it++)//遍历查重
        {
            if(it->name == tree.node[id_position].value)
            {
                if (it->isArray == 1)
                {
                    return true;
                }
                else
                    return false;
            }
        }
        cout<<"the id("<<tree.node[id_position].value<<")is not defined where isTheArray1!"<<endl;
        exit(1);
        return false;
    }
    else//若当前符号表是子表
    {
        //先遍历子表序列
        for(vector<subTableItem>::iterator it = subTable.begin(); it != subTable.end();it++)
        {
            if(it->name == currentTable)//找到当前子表
            {
                for(vector<Tuple>::iterator it0 = it->item.begin(); it0 != it->item.end();it0++)//遍历子表中的item
                {
                    if(it0->name == tree.node[id_position].value)
                    {
                        if (it0->isArray == 1)
                        {
                            return true;
                        }
                        else
                            return false;
                    }
                }
                
                for(vector<Tuple>::iterator it1 = it->argument.begin(); it1 != it->argument.end();it1++)//遍历子表中的argument
                {
                    if(it1->name == tree.node[id_position].value)
                    {
                        if (it1->isArray == 1)
                        {
                            return true;
                        }
                        else
                            return false;
                    }
                }
            }
        }
        cout<<"the id("<<tree.node[id_position].value<<")is not defined where isTheArray2!"<<endl;
        exit(1);
        return false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0x8(%rbp)
leaq 0xaba76(%rip), %rdi     # 0xbf978
leaq 0xa5b1(%rip), %rsi      # 0x1e4ba
callq 0xc770
testb $0x1, %al
jne 0x13f17
jmp 0x1401b
leaq 0xaba12(%rip), %rdi     # 0xbf930
callq 0x14c50
movq %rax, -0x10(%rbp)
leaq 0xaba02(%rip), %rdi     # 0xbf930
callq 0x14cc0
movq %rax, -0x18(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x14c80
testb $0x1, %al
jne 0x13f4a
jmp 0x13fb8
leaq -0x10(%rbp), %rdi
callq 0x14cf0
movq %rax, %rdi
movslq -0x8(%rbp), %rax
leaq 0xb21d7(%rip), %rsi     # 0xc6138
addq $0x8, %rsi
imulq $0xa8, %rax, %rax
addq %rax, %rsi
addq $0x80, %rsi
callq 0xc840
testb $0x1, %al
jne 0x13f81
jmp 0x13fa2
leaq -0x10(%rbp), %rdi
callq 0x14cf0
cmpl $0x1, 0x48(%rax)
jne 0x13f99
movb $0x1, -0x1(%rbp)
jmp 0x1424f
movb $0x0, -0x1(%rbp)
jmp 0x1424f
jmp 0x13fa4
leaq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x14d30
movq %rax, -0x20(%rbp)
jmp 0x13f27
movq 0x12009(%rip), %rdi     # 0x25fc8
leaq 0xad81(%rip), %rsi      # 0x1ed47
callq 0x3280
movq %rax, %rdi
movslq -0x8(%rbp), %rax
leaq 0xb215f(%rip), %rsi     # 0xc6138
addq $0x8, %rsi
imulq $0xa8, %rax, %rax
addq %rax, %rsi
addq $0x80, %rsi
callq 0x3260
movq %rax, %rdi
leaq 0xad52(%rip), %rsi      # 0x1ed4f
callq 0x3280
movq %rax, %rdi
movq 0x11fa4(%rip), %rsi     # 0x25fb0
callq 0x32b0
movl $0x1, %edi
callq 0x3340
leaq 0xab926(%rip), %rdi     # 0xbf948
callq 0x14b00
movq %rax, -0x28(%rbp)
leaq 0xab916(%rip), %rdi     # 0xbf948
callq 0x14b70
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x14b30
testb $0x1, %al
jne 0x14051
jmp 0x141ec
leaq -0x28(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
addq $0x30, %rdi
leaq 0xab910(%rip), %rsi     # 0xbf978
callq 0xc840
testb $0x1, %al
jne 0x14076
jmp 0x141d6
leaq -0x28(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
callq 0x14c50
movq %rax, -0x38(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
callq 0x14cc0
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x14c80
testb $0x1, %al
jne 0x140b3
jmp 0x14121
leaq -0x38(%rbp), %rdi
callq 0x14cf0
movq %rax, %rdi
movslq -0x8(%rbp), %rax
leaq 0xb206e(%rip), %rsi     # 0xc6138
addq $0x8, %rsi
imulq $0xa8, %rax, %rax
addq %rax, %rsi
addq $0x80, %rsi
callq 0xc840
testb $0x1, %al
jne 0x140ea
jmp 0x1410b
leaq -0x38(%rbp), %rdi
callq 0x14cf0
cmpl $0x1, 0x48(%rax)
jne 0x14102
movb $0x1, -0x1(%rbp)
jmp 0x1424f
movb $0x0, -0x1(%rbp)
jmp 0x1424f
jmp 0x1410d
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x14d30
movq %rax, -0x48(%rbp)
jmp 0x1408b
leaq -0x28(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x14c50
movq %rax, -0x50(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x14ba0
movq %rax, %rdi
addq $0x18, %rdi
callq 0x14cc0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x14c80
testb $0x1, %al
jne 0x14166
jmp 0x141d4
leaq -0x50(%rbp), %rdi
callq 0x14cf0
movq %rax, %rdi
movslq -0x8(%rbp), %rax
leaq 0xb1fbb(%rip), %rsi     # 0xc6138
addq $0x8, %rsi
imulq $0xa8, %rax, %rax
addq %rax, %rsi
addq $0x80, %rsi
callq 0xc840
testb $0x1, %al
jne 0x1419d
jmp 0x141be
leaq -0x50(%rbp), %rdi
callq 0x14cf0
cmpl $0x1, 0x48(%rax)
jne 0x141b5
movb $0x1, -0x1(%rbp)
jmp 0x1424f
movb $0x0, -0x1(%rbp)
jmp 0x1424f
jmp 0x141c0
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x14d30
movq %rax, -0x60(%rbp)
jmp 0x1413a
jmp 0x141d6
jmp 0x141d8
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x14bc0
movq %rax, -0x68(%rbp)
jmp 0x1402b
movq 0x11dd5(%rip), %rdi     # 0x25fc8
leaq 0xab4d(%rip), %rsi      # 0x1ed47
callq 0x3280
movq %rax, %rdi
movslq -0x8(%rbp), %rax
leaq 0xb1f2b(%rip), %rsi     # 0xc6138
addq $0x8, %rsi
imulq $0xa8, %rax, %rax
addq %rax, %rsi
addq $0x80, %rsi
callq 0x3260
movq %rax, %rdi
leaq 0xab41(%rip), %rsi      # 0x1ed72
callq 0x3280
movq %rax, %rdi
movq 0x11d70(%rip), %rsi     # 0x25fb0
callq 0x32b0
movl $0x1, %edi
callq 0x3340
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)