// File: Davidc2525[P]Leaf/parser/Parser.cpp
// Function: Parser::Statement(LEAF::AST::NODEU*&)
void Parser::Statement(ASTU&stat) {
		ASTU e_stat;
		switch (la->kind) {
		case _t_pointer: case _name: case 15 /* "(" */: case 24 /* ":" */: case 25 /* "," */: case 26 /* "[" */: {
			if (isVarDecl()) {
				stat = block_stat(); 
				VarDeclDef(stat);
				Expect(11 /* ";" */);
			} else {
				Designator(stat);
				if (la->kind == 12 /* "=" */) {
					Get();
					Expr(e_stat);
					if(!get_obj(stat)->type->equals(get_obj(e_stat)->type)  ){
					cout<<";error de asignacion, tipos diferentes."<<endl; 
					dump(get_obj(stat)->type,2);
					dump(get_obj(e_stat)->type,2);
					exit(1);
					}else{
					stat = assign(stat,e_stat);
					Obj*o = new Obj(1,new string(),new Struct()); 
					set_obj(stat,o);
					} 
					
					
				} else if (la->kind == 15 /* "(" */) {
					ActParams(stat,false);
				} else SynErr(51);
				Expect(11 /* ";" */);
			}
			break;
		}
		case 28 /* "extern" */: case 29 /* "fun" */: {
			FuncDecl(stat);
			break;
		}
		case 13 /* "class" */: {
			Get();
			Expect(_name);
			Expect(9 /* "{" */);
			stat = block_stat(); 
			if (isVarDecl()) {
				VarDeclDef(stat);
				Expect(11 /* ";" */);
			} else if (la->kind == 28 /* "extern" */ || la->kind == 29 /* "fun" */) {
				FuncDecl(stat);
				Expect(11 /* ";" */);
			} else SynErr(52);
			Expect(10 /* "}" */);
			break;
		}
		case 14 /* "print" */: {
			Get();
			Expect(15 /* "(" */);
			Expr(e_stat);
			Expect(16 /* ")" */);
			Expect(11 /* ";" */);
			stat = print_node(e_stat);
			break;
		}
		case 17 /* "sizeof" */: {
			Get();
			Expect(15 /* "(" */);
			Expr(e_stat);
			Expect(16 /* ")" */);
			break;
		}
		case 18 /* "ret" */: {
			Get();
			if (StartOf(2)) {
				Expr(e_stat);
				if(!  symbol_table::currMethod()->type->elemType->equals(get_obj(e_stat)->type) ){cout<<";El valor q retorna no coincide con la firma. "<<*symbol_table::currMethod()->name<<endl; exit(1);}
				stat = return_node(e_stat); set_obj(stat,get_obj(e_stat)); 
				
			} else if (la->kind == 11 /* ";" */) {
				stat = return_node();
			} else SynErr(53);
			Expect(11 /* ";" */);
			break;
		}
		case 19 /* "if" */: {
			Get();
			Expect(15 /* "(" */);
			Expr(e_stat);
			Expect(16 /* ")" */);
			stat = if_node(e_stat); 
			StatementBLock(stat);
			if (la->kind == 20 /* "else" */) {
				Get();
				StatementBLock(stat);
			}
			break;
		}
		case 21 /* "throw" */: {
			Get();
			Expr(e_stat);
			stat = new_throw(e_stat); 
			break;
		}
		case 22 /* "try" */: {
			TryCatchStatement(stat);
			break;
		}
		case 9 /* "{" */: {
			StatementBLock(stat);
			break;
		}
		case 11 /* ";" */: {
			Get();
			stat = empty_node(); 
			break;
		}
		default: SynErr(54); break;
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x30(%rax), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x1c, %eax
ja 0x13bac
movq -0x38(%rbp), %rax
leaq 0x2120b(%rip), %rcx     # 0x34858
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x40(%rbp), %rdi
callq 0x17360
testb $0x1, %al
jne 0x13665
jmp 0x13694
callq 0xe190
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
callq 0x13bd0
movq -0x40(%rbp), %rdi
movl $0xb, %esi
callq 0x133a0
jmp 0x13862
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14340
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0xc, (%rax)
jne 0x13826
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x146d0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xe2e0
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0xe2e0
movq -0x48(%rbp), %rdi
movq 0x18(%rax), %rsi
callq 0x1e9e0
testb $0x1, %al
jne 0x1375b
movq 0x368d3(%rip), %rdi     # 0x49fd0
leaq 0x212a0(%rip), %rsi     # 0x349a4
callq 0x62c0
movq %rax, %rdi
movq 0x3689d(%rip), %rsi     # 0x49fb0
callq 0x6320
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xe2e0
movq -0x40(%rbp), %rdi
movq 0x18(%rax), %rsi
movl $0x2, %edx
callq 0x17670
movq -0x18(%rbp), %rdi
callq 0xe2e0
movq -0x40(%rbp), %rdi
movq 0x18(%rax), %rsi
movl $0x2, %edx
callq 0x17670
movl $0x1, %edi
callq 0x63d0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0xe550
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x48, %edi
callq 0x62e0
movq %rax, -0x58(%rbp)
movl $0x20, %edi
callq 0x62e0
movq %rax, -0x50(%rbp)
jmp 0x13793
movq -0x50(%rbp), %rdi
callq 0x6430
movl $0x30, %edi
callq 0x62e0
movq %rax, -0x60(%rbp)
jmp 0x137ac
movq -0x60(%rbp), %rdi
callq 0xcab0
jmp 0x137b7
movq -0x60(%rbp), %rcx
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rdi
movl $0x1, %esi
callq 0x1fe10
jmp 0x137cf
movq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0xe300
jmp 0x13824
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x13811
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x30, %esi
callq 0x62f0
movq -0x58(%rbp), %rdi
movl $0x48, %esi
callq 0x62f0
jmp 0x13bc3
jmp 0x13854
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0xf, (%rax)
jne 0x13844
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x14700
jmp 0x13852
movq -0x40(%rbp), %rdi
movl $0x33, %esi
callq 0x12be0
jmp 0x13854
movq -0x40(%rbp), %rdi
movl $0xb, %esi
callq 0x133a0
jmp 0x13bba
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14870
jmp 0x13bba
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
movl $0x4, %esi
callq 0x133a0
movq -0x40(%rbp), %rdi
movl $0x9, %esi
callq 0x133a0
callq 0xe190
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
callq 0x17360
testb $0x1, %al
jne 0x138bc
jmp 0x138d9
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x13bd0
movq -0x40(%rbp), %rdi
movl $0xb, %esi
callq 0x133a0
jmp 0x13920
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0x1c, (%rax)
je 0x138f3
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0x1d, (%rax)
jne 0x13910
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14870
movq -0x40(%rbp), %rdi
movl $0xb, %esi
callq 0x133a0
jmp 0x1391e
movq -0x40(%rbp), %rdi
movl $0x34, %esi
callq 0x12be0
jmp 0x13920
movq -0x40(%rbp), %rdi
movl $0xa, %esi
callq 0x133a0
jmp 0x13bba
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
movl $0xf, %esi
callq 0x133a0
movq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x146d0
movq -0x40(%rbp), %rdi
movl $0x10, %esi
callq 0x133a0
movq -0x40(%rbp), %rdi
movl $0xb, %esi
callq 0x133a0
movq -0x18(%rbp), %rdi
callq 0xe600
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x13bba
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
movl $0xf, %esi
callq 0x133a0
movq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x146d0
movq -0x40(%rbp), %rdi
movl $0x10, %esi
callq 0x133a0
jmp 0x13bba
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
movl $0x2, %esi
callq 0x13450
testb $0x1, %al
jne 0x139e2
jmp 0x13a91
movq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x146d0
callq 0x20a10
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
callq 0xe2e0
movq -0x68(%rbp), %rdi
movq 0x18(%rax), %rsi
callq 0x1e9e0
testb $0x1, %al
jne 0x13a5c
movq 0x365af(%rip), %rdi     # 0x49fd0
leaq 0x20fa4(%rip), %rsi     # 0x349cc
callq 0x62c0
movq %rax, -0x70(%rbp)
callq 0x20a10
movq -0x70(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0x6280
movq %rax, %rdi
movq 0x36563(%rip), %rsi     # 0x49fb0
callq 0x6320
movl $0x1, %edi
callq 0x63d0
movq -0x18(%rbp), %rdi
callq 0xe530
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
callq 0xe2e0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0xe300
jmp 0x13abf
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0xb, (%rax)
jne 0x13aaf
callq 0xe540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x13abd
movq -0x40(%rbp), %rdi
movl $0x35, %esi
callq 0x12be0
jmp 0x13abf
movq -0x40(%rbp), %rdi
movl $0xb, %esi
callq 0x133a0
jmp 0x13bba
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
movl $0xf, %esi
callq 0x133a0
movq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x146d0
movq -0x40(%rbp), %rdi
movl $0x10, %esi
callq 0x133a0
movq -0x18(%rbp), %rdi
callq 0xe610
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
callq 0x15030
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
cmpl $0x14, (%rax)
jne 0x13b47
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15030
jmp 0x13bba
movq -0x40(%rbp), %rdi
callq 0x132b0
movq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x146d0
movq -0x18(%rbp), %rdi
callq 0xe630
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x13bba
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x150a0
jmp 0x13bba
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15030
jmp 0x13bba
movq -0x40(%rbp), %rdi
callq 0x132b0
callq 0xe5b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x13bba
movq -0x40(%rbp), %rdi
movl $0x36, %esi
callq 0x12be0
addq $0x80, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x64f0
nopl (%rax)