// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
pushq $0x20
popq %rdi
callq 0x5260
movq %rax, %r15
movq %rax, %rdi
callq 0xd10a
pushq $0x20
popq %rdi
callq 0x5260
movq %rax, %r12
leaq 0xb4c8(%rip), %rsi      # 0x16cc9
leaq 0x18(%rsp), %rdx
movq %rax, %rdi
callq 0x70ae
movl 0x40(%rbx), %esi
incl %esi
movl %esi, 0x40(%rbx)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x70e9
movq (%r14), %rsi
movq %r12, %rdi
callq 0x5460
leaq 0x18(%rsp), %rdi
callq 0x5488
pushq $0x20
popq %rdi
callq 0x5260
movq %rax, %r13
leaq 0xc559(%rip), %rsi      # 0x17da3
leaq 0x18(%rsp), %rdx
movq %rax, %rdi
callq 0x70ae
movq 0x30(%rbx), %rax
movl (%rax), %eax
movl %eax, 0xc(%rsp)
cmpl $0x1c, %eax
jne 0xb86e
movq %rbx, %rdi
callq 0xaa2e
pushq $0x1d
popq %rsi
movq %rbx, %rdi
callq 0xaa9a
movq 0x19750(%rip), %rdi     # 0x24fd0
leaq 0xb44b(%rip), %rsi      # 0x16cd2
callq 0x5240
movq 0x30(%rbx), %rax
cmpl $0x4, (%rax)
jne 0xb8df
movq %rbx, %rdi
callq 0xaa2e
pushq $0x20
popq %rdi
callq 0x5260
movq %rax, %r12
leaq 0xc4f4(%rip), %rsi      # 0x17da3
leaq 0x18(%rsp), %rdx
movq %rax, %rdi
callq 0x70ae
movq %rbx, %rdi
movq %r12, %rsi
callq 0xd178
movq 0x19702(%rip), %rdi     # 0x24fd0
movq %r12, %rsi
callq 0x5200
leaq 0xb404(%rip), %rsi      # 0x16ce1
jmp 0xb904
movq 0x196ea(%rip), %rdi     # 0x24fd0
leaq 0xb3ec(%rip), %rsi      # 0x16cd9
callq 0x5240
movq %rax, %rdi
movq %r13, %rsi
callq 0x5200
leaq 0xb34d(%rip), %rsi      # 0x16c51
movq %rax, %rdi
callq 0x5240
pushq $0x30
popq %rdi
callq 0x5260
andq $0x0, (%rax)
andq $0x0, 0xc(%rax)
andq $0x0, 0x18(%rax)
andq $0x0, 0x28(%rax)
pushq $0x4
popq %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xf292
movq %rax, %r13
movq %rax, %rdi
callq 0xf854
callq 0xf440
movq 0x30(%rbx), %rax
movl (%rax), %eax
xorl %ebp, %ebp
cmpl $0xf, %eax
jne 0xb9ad
movq %rbx, %rdi
callq 0xaa2e
movq 0x30(%rbx), %rax
movslq (%rax), %rax
leaq 0xb058(%rip), %rcx      # 0x169c0
xorl %ebp, %ebp
cmpb $0x1, 0xd0(%rax,%rcx)
jne 0xb99c
pushq $0x1
popq %rbp
movq %rbx, %rdi
callq 0xc156
movq 0x30(%rbx), %rax
cmpl $0x19, (%rax)
jne 0xb99c
movq %rbx, %rdi
callq 0xaa2e
movq %rbx, %rdi
callq 0xc156
incl %ebp
jmp 0xb97f
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0xaa9a
movq 0x30(%rbx), %rax
movl (%rax), %eax
cltq
leaq 0xb00a(%rip), %rcx      # 0x169c0
cmpb $0x1, 0x104(%rax,%rcx)
jne 0xb9cb
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc17a
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0xaa9a
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0xaa9a
pushq $0x20
popq %rdi
callq 0x5260
movq %rax, %r14
leaq 0xc3b0(%rip), %rsi      # 0x17da3
leaq 0x18(%rsp), %rdx
movq %rax, %rdi
callq 0x70ae
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd178
movq %r14, %rdi
callq 0xf34e
movq 0x18(%rax), %rax
movq 0x8(%r15), %rdx
movq %rdx, %rcx
movq 0x18(%rdx), %rdx
testq %rdx, %rdx
jne 0xba1b
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movq 0x1958c(%rip), %rdi     # 0x24fd0
leaq 0xb2a0(%rip), %rsi      # 0x16ceb
callq 0x5240
movq %rax, %rdi
movq %r14, %rsi
callq 0x5200
movq %rax, %rdi
callq 0x5120
movq 0x8(%r15), %rsi
movq %rbx, %rdi
callq 0xd2ee
movq 0x8(%r15), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xd092
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movl %ebp, 0x38(%r13)
cmpl $0x1c, 0xc(%rsp)
jne 0xba96
movb $0x1, 0x28(%r13)
movq %r12, %rdi
callq 0x809b
movq 0x10(%rsp), %r12
movq %rax, (%r12)
movq %rax, %rdi
movq %r13, %rsi
callq 0x80df
movq 0x19517(%rip), %r14     # 0x24fd0
leaq 0xb22d(%rip), %r15      # 0x16ced
movq %r14, %rdi
movq %r15, %rsi
callq 0x5240
movq %rax, %rdi
movl %ebp, %esi
callq 0x5410
movq %rax, %rdi
callq 0x5120
movl %ebp, 0x38(%r13)
movq %r14, %rdi
movq %r15, %rsi
callq 0x5240
movl 0x38(%r13), %esi
movq %rax, %rdi
callq 0x5410
movq %rax, %rdi
callq 0x5120
cmpl $0x1c, 0xc(%rsp)
jne 0xbb1a
movq 0x30(%rbx), %rax
cmpl $0xb, (%rax)
jne 0xbb27
movq %rbx, %rdi
callq 0xaa2e
jmp 0xbb32
movq %rbx, %rdi
movq %r12, %rsi
callq 0xbbc0
jmp 0xbb32
pushq $0x39
popq %rsi
movq %rbx, %rdi
callq 0xa6a4
leaq 0x1a22f(%rip), %rbx     # 0x25d68
movq (%rbx), %rax
movq 0x8(%rax), %r14
callq 0xf840
movq %r14, 0x40(%rax)
movq (%rbx), %rax
movl 0x10(%rax), %ebx
addl $-0x8, %ebx
callq 0xf840
movq 0x18(%rax), %rax
movl %ebx, 0xc(%rax)
callq 0xf870
callq 0xf47e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbb9e
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r14, %rdi
jmp 0xbbb2
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r13, %rdi
jmp 0xbbb2
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5488
jmp 0xbbb7
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r12, %rdi
jmp 0xbbb2
movq %rax, %rbx
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x5270
movq %rbx, %rdi
callq 0x5420
nop