// File: /workspace/github_cpp_makefile_star2_O1/Davidc2525[P]Leaf/parser/Parser.cpp
// Function: Parser::FuncDecl(LEAF::AST::NODEU*&)
void Parser::FuncDecl(ASTU&f_node) {
		int np=0; 
		bool extern_s = false;
		Obj *obj = new Obj();
		MetaData *fd = new MetaData();
		string * FName = new string("anonima_"); 
		FName->append(to_string(++cout_annon_func).c_str()); 
		string * Tipe = new string(""); 
		int anon = 1;
		if (la->kind == 28 /* "extern" */) {
			Get();
			extern_s = true;
		}
		Expect(29 /* "fun" */);
		cout << "; fun "; 
		if (la->kind == _name) {
			Get();
			anon=0; FName = new string(""); LexString(FName);  
		}
		if(anon==1){
		cout<<" anonima retorna "<<*Tipe<<" " ;
		}else{
		cout<<*FName<<" retorna "; 
		} 
		
		obj = symbol_table::insert(4,FName,new Struct()); 
		
		
		symbol_table::pushCurrMethod(obj); 
		symbol_table::openScope(); 
		
		
		if (la->kind == 15 /* "(" */) {
			Get();
			if (StartOf(4)) {
				VarDecl();
				np++;
				while (la->kind == 25 /* "," */) {
					Get();
					VarDecl();
					np++;
				}
			}
			Expect(16 /* ")" */);
		}
		if (StartOf(5)) {
			FuncDcl(fd);
		}
		Expect(24 /* ":" */);
		Expect(_name);
		Tipe = new string(""); LexString(Tipe); *last(fd->type) = *symbol_table::find(Tipe)->type; cout<<";"<< *Tipe << endl; 
		funcion(fd->type); dump(fd->type,1); 
		
		obj->type = fd->type;
		(*obj).nPars = np;
		if(extern_s){
			obj->_extern = true;
			//ss->add(obj->name);
		}
		
		f_node = func_decl(FName);
		set_obj(f_node,obj);
		
		
		
		cout<<";nPars "<<np<<endl;
		
		obj->nPars=np;;
		cout<<";nPars "<<obj->nPars<<endl;
		
		if (!extern_s) {
			StatementBLock(f_node);
		} else if (la->kind == 11 /* ";" */) {
			Get();
		} else SynErr(57);
		symbol_table::currMethod()->locals = symbol_table::curScope->locals;
		symbol_table::currMethod()->type->size = symbol_table::curScope->offset-8;
		
		symbol_table::popCurrMethod(); 
		symbol_table::closeScope(); 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movl $0x20, %edi
callq 0x5290
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0xeb92
movl $0x20, %edi
callq 0x5290
movq %rax, %r12
addq $0x10, %rax
movq %rax, (%r12)
movabsq $0x5f616d696e6f6e61, %rax # imm = 0x5F616D696E6F6E61
movq %rax, 0x10(%r12)
movq $0x8, 0x8(%r12)
movb $0x0, 0x18(%r12)
movl 0x40(%rbx), %r13d
incl %r13d
movl %r13d, 0x40(%rbx)
movl %r13d, %ebp
negl %ebp
cmovsl %r13d, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0xcdcc
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0xcdc3
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xcdc9
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xcdcc
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xcd90
addl $-0x3, %r14d
jmp 0xcdcc
addl $-0x2, %r14d
jmp 0xcdcc
decl %r14d
movq %r15, 0x18(%rsp)
shrl $0x1f, %r13d
leal (%r14,%r13), %esi
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x5310
addq (%r15), %r13
movq %r13, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x7d81
movq (%r15), %rsi
movq %r12, %rdi
callq 0x54b0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xce2b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x52a0
movl $0x20, %edi
callq 0x5290
movq %rax, %r13
addq $0x10, %rax
movq %rax, (%r13)
movq $0x0, 0x8(%r13)
movb $0x0, 0x10(%r13)
movq 0x30(%rbx), %rax
movl (%rax), %eax
movl %eax, 0x14(%rsp)
cmpl $0x1c, %eax
jne 0xce64
movq %rbx, %rdi
callq 0xbde8
movq %rbx, %rdi
movl $0x1d, %esi
callq 0xbe68
movq 0x19160(%rip), %rdi     # 0x25fd8
leaq 0xcdea(%rip), %rsi      # 0x19c69
movl $0x6, %edx
callq 0x5300
movq 0x30(%rbx), %rax
movl (%rax), %ebp
cmpl $0x4, %ebp
jne 0xcecb
movq %rbx, %rdi
callq 0xbde8
movl $0x20, %edi
callq 0x5290
movq %rax, %r12
addq $0x10, %rax
movq %rax, (%r12)
movq $0x0, 0x8(%r12)
movb $0x0, 0x10(%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xec0a
cmpl $0x4, %ebp
jne 0xcef3
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq 0x190f8(%rip), %rdi     # 0x25fd8
callq 0x5300
leaq 0xcd8c(%rip), %rsi      # 0x19c78
movl $0x9, %edx
jmp 0xcf2a
movq 0x190de(%rip), %r14     # 0x25fd8
leaq 0xcd6f(%rip), %rsi      # 0x19c70
movl $0x11, %edx
movq %r14, %rdi
callq 0x5300
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq %r14, %rdi
callq 0x5300
leaq 0xcccc(%rip), %rsi      # 0x19bf1
movl $0x1, %edx
movq %rax, %rdi
callq 0x5300
movl $0x30, %edi
callq 0x5290
xorl %ebp, %ebp
movq %rbp, (%rax)
movq %rbp, 0xc(%rax)
movq %rbp, 0x18(%rax)
movq %rbp, 0x28(%rax)
movl $0x4, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x10fda
movq %rax, 0x40(%rsp)
movq %rax, %rdi
callq 0x117b2
callq 0x1125e
movq 0x30(%rbx), %rax
cmpl $0xf, (%rax)
jne 0xd000
movq %rbx, %rdi
callq 0xbde8
movq 0x30(%rbx), %rax
movslq (%rax), %rax
leaq 0xc9ce(%rip), %rcx      # 0x19960
xorl %ebp, %ebp
cmpb $0x1, 0xd0(%rax,%rcx)
jne 0xcff3
callq 0x8ccc
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0xc4aa
movq 0x30(%rbx), %rax
movl $0x1, %ebp
cmpl $0x19, (%rax)
jne 0xcff3
movl $0x1, %ebp
leaq 0x20(%rsp), %r14
movq %rbx, %rdi
callq 0xbde8
callq 0x8ccc
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc4aa
incl %ebp
movq 0x30(%rbx), %rax
cmpl $0x19, (%rax)
je 0xcfcb
movq %rbx, %rdi
movl $0x10, %esi
callq 0xbe68
movq 0x30(%rbx), %rax
movslq (%rax), %rax
leaq 0xc952(%rip), %rcx      # 0x19960
cmpb $0x1, 0x104(%rax,%rcx)
jne 0xd025
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0xd978
movq %rbx, %rdi
movl $0x18, %esi
callq 0xbe68
movq %rbx, %rdi
movl $0x4, %esi
callq 0xbe68
movl $0x20, %edi
callq 0x5290
movq %rax, %r14
addq $0x10, %rax
movq %rax, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xec0a
movq %r14, %rdi
callq 0x110a0
movq 0x18(%rax), %r15
movq 0x8(%rsp), %r13
movq 0x8(%r13), %rsi
movq %rbx, %rdi
callq 0xec82
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm0, (%rax)
movups %xmm1, 0x10(%rax)
movups %xmm2, 0x20(%rax)
movq 0x18f30(%rip), %r15     # 0x25fd8
leaq 0xcbd3(%rip), %rsi      # 0x19c82
movl $0x1, %edx
movq %r15, %rdi
callq 0x5300
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x5300
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %esi
movq %r14, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51a0
movq 0x8(%r13), %rsi
movq %rbx, %rdi
callq 0xede6
movq 0x8(%r13), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xeaf0
movq 0x8(%r13), %rax
movq 0x40(%rsp), %r14
movq %rax, 0x18(%r14)
movl %ebp, 0x38(%r14)
movl 0x14(%rsp), %r13d
cmpl $0x1c, %r13d
jne 0xd133
movb $0x1, 0x28(%r14)
movq %r12, %rdi
callq 0x8d33
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x8d7b
movq 0x18e83(%rip), %r15     # 0x25fd8
leaq 0xcb28(%rip), %rsi      # 0x19c84
movl $0x7, %edx
movq %r15, %rdi
callq 0x5300
movq %r15, %rdi
movl %ebp, %esi
callq 0x5460
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %esi
movq %r12, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51a0
movl %ebp, 0x38(%r14)
movl $0x7, %edx
movq %r15, %rdi
leaq 0xcad4(%rip), %rsi      # 0x19c84
callq 0x5300
movl 0x38(%r14), %esi
movq %r15, %rdi
callq 0x5460
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5260
movsbl %al, %esi
movq %r14, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51a0
cmpl $0x1c, %r13d
jne 0xd204
movq 0x30(%rbx), %rax
cmpl $0xb, (%rax)
jne 0xd213
movq %rbx, %rdi
callq 0xbde8
jmp 0xd220
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0xd29c
jmp 0xd220
movq %rbx, %rdi
movl $0x39, %esi
callq 0xba44
leaq 0x19b61(%rip), %rbx     # 0x26d88
movq (%rbx), %rax
movq 0x8(%rax), %r14
callq 0x1179e
movq %r14, 0x40(%rax)
movq (%rbx), %rax
movl 0x10(%rax), %ebx
addl $-0x8, %ebx
callq 0x1179e
movq 0x18(%rax), %rax
movl %ebx, 0xc(%rax)
callq 0x117ce
callq 0x112a6
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xd293
movq 0x30(%rsp), %rsi
incq %rsi
jmp 0xd28e
movq %rax, %rbx
movl $0x20, %esi
movq 0x8(%rsp), %rdi
callq 0x52a0
movq %rbx, %rdi
callq 0x5470
nop