// File: marxn[P]pupp/src/parser/statement.cpp
// Function: AssignStatement::Check()
bool AssignStatement::Check()
{
        unsigned long layer = 1;
        
        Node * parent = this->GetParentNode();
        this->VarDef = parent->FindVariable(this->Reference->GetVarName(), &layer);
        
        if(this->VarDef==NULL)
        {
                cerr<<"pupp provision error: Variable "<<this->Reference->GetVarName()<<"has not defined"<<endl;
                return false;
        }
        
        this->VarLayer = layer;
        
        list<list<Expression*>*>* exprslist = this->Reference->GetExpsList();
        
        for(list<list<Expression*>*>::iterator gitor = exprslist->begin(); gitor!=exprslist->end(); gitor++)
        {
                list<Expression*>* exprlist = *gitor;
                for(list<Expression*>::iterator i = exprlist->begin(); i!=exprlist->end(); i++)
                {
                        if((*i)->Check()==false)
                        {
                                return false;
                        }
                }
        }
        
        if(this->Expr->Check()==false)
        {
                return false;
        }

        return true;

}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xe8(%rsp)
movq 0xe8(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq $0x1, 0xe0(%rsp)
callq 0x14170
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0xd8(%rsp)
movq 0xd8(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq 0x68(%rax), %rsi
leaq 0xb8(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x2cb90
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x143e0
movq %rax, 0x40(%rsp)
jmp 0x2de2e
movq 0x28(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %rcx, 0x78(%rax)
leaq 0xb8(%rsp), %rdi
callq 0x61e0
movq 0x28(%rsp), %rax
cmpq $0x0, 0x78(%rax)
jne 0x2df36
movq 0x48190(%rip), %rdi     # 0x75ff0
leaq 0x31373(%rip), %rsi     # 0x5f1da
callq 0x62d0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rsp)
movq 0x68(%rax), %rsi
leaq 0x88(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x2cb90
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x62a0
movq %rax, 0x20(%rsp)
jmp 0x2dea5
movq 0x20(%rsp), %rdi
leaq 0x33104(%rip), %rsi     # 0x60fb5
callq 0x62d0
movq %rax, 0x8(%rsp)
jmp 0x2debd
movq 0x8(%rsp), %rdi
movq 0x480ef(%rip), %rsi     # 0x75fb8
callq 0x6320
jmp 0x2ded0
leaq 0x88(%rsp), %rdi
callq 0x61e0
movb $0x0, 0xf7(%rsp)
jmp 0x2e05b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x61e0
jmp 0x2e06c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x61e0
jmp 0x2e06c
movq 0x28(%rsp), %rax
movq 0xe0(%rsp), %rcx
movq %rcx, 0x80(%rax)
movq 0x68(%rax), %rdi
callq 0x2cbc0
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x11500
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rdi
callq 0x11550
movq %rax, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x11530
testb $0x1, %al
jne 0x2df97
jmp 0x2e030
leaq 0x78(%rsp), %rdi
callq 0x11580
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x11290
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
callq 0x112e0
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x112c0
testb $0x1, %al
jne 0x2dfdc
jmp 0x2e018
leaq 0x60(%rsp), %rdi
callq 0x11310
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2e003
movb $0x0, 0xf7(%rsp)
jmp 0x2e05b
jmp 0x2e005
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
callq 0x11380
movq %rax, 0x50(%rsp)
jmp 0x2dfb8
jmp 0x2e01a
leaq 0x78(%rsp), %rdi
xorl %esi, %esi
callq 0x11600
movq %rax, 0x48(%rsp)
jmp 0x2df6d
movq 0x28(%rsp), %rax
movq 0x70(%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2e053
movb $0x0, 0xf7(%rsp)
jmp 0x2e05b
movb $0x1, 0xf7(%rsp)
movb 0xf7(%rsp), %al
andb $0x1, %al
addq $0xf8, %rsp
retq
movq 0xb0(%rsp), %rdi
callq 0x6550
nopl (%rax)