// File: /workspace/github_cpp_makefile_star2_O2/gioannides[P]Language_Processors/src/../include/ast/class_forward_declarations.hpp
// Function: load_globals(Context&, std::basic_ofstream<char, std::char_traits<char>>&, int)
inline void load_globals(Context& contxt, std::ofstream& file, int good_index)
{

	if(contxt.Variables[good_index].Pointer && contxt.Variables[good_index].DataType != "float"){
    		if(contxt.AddressOf){		
	   		 file << std::endl << "\tlui\t$" << contxt.Regs+1 << ",%hi" << "(" << contxt.Variables[good_index].id << ")"; 
	 		 file << std::endl << "\tlw\t$" << contxt.Regs+1 <<  ",%lo(" << contxt.Variables[good_index].id << ")" << "($" << contxt.Regs+1 << ")";
			
			 contxt.regType[contxt.Regs+1]='i';
		}
		
	    return;
	}
	else if(contxt.Variables[good_index].Pointer && contxt.Variables[good_index].DataType == "float"){
		if(contxt.Variables[good_index].initialized){
			file << std::endl << "\tlui\t$" << contxt.Regs+1 << ",%hi" << "(" << contxt.Variables[good_index].id << ")"; 
                	file << std::endl << "\tlw\t$" << contxt.Regs+1 <<  ",%lo(" << contxt.Variables[good_index].id << ")" << "($" << contxt.Regs+1 << ")";
	   	 	contxt.regType[contxt.Regs+1]='f';
	    	return;
		}
	}
	
	if(!contxt.Variables[good_index].Pointer){
		file << std::endl << "\tlui $" << contxt.Regs+1 << ", %hi(" << contxt.Variables[good_index].id << ")";
		file << std::endl << "\tla $" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($" << contxt.Regs+1 << ")";
	}
	if(contxt.Variables[good_index].DataType=="unsigned"){
			contxt.regType[contxt.Regs+1]='u';
		}	
	else{
		contxt.regType[contxt.Regs+1]='i';
	}
	if(contxt.nested_arrays){
		file << std::endl << "\tadd $" << contxt.Regs+1 << ", $" << contxt.Regs+1 << ", $25";				
	}
				if(contxt.Variables[good_index].DataType=="char") 
				{
					file << std::endl << "\tlb $" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ")";
					//file << std::endl << "\tlb $" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($" << contxt.Regs+1 << ")";
					contxt.regType[contxt.Regs+1]='c';
				}
				else if(contxt.Variables[good_index].DataType == "short" && contxt.Variables[good_index].DataType != "float")
				{
					file << std::endl << "\tlh $" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ")";
					//file << std::endl << "\tlw $" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($"<< contxt.Regs+1 << ")";                            	
					contxt.regType[contxt.Regs+1]='i';
   				}
				else if((contxt.Variables[good_index].DataType== "int" ||contxt.Variables[good_index].DataType== "unsigned" || contxt.Variables[good_index].DataType=="signed") && contxt.Variables[good_index].DataType != "float")
				{
					file << std::endl << "\tlw $" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ")";
					//file << std::endl << "\tlw $" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($"<< contxt.Regs+1 << ")";                            	
					contxt.regType[contxt.Regs+1]='i';
   				}
				
				else if( contxt.Variables[good_index].DataType == "float") //TODO: CHECK OK
				{				
					file << std::endl << "\tlwc1 $f" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ")";
					//file << std::endl << "\tlwc1 $f" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($"<< contxt.Regs+1 << ")";     
		                       	file << std::endl << "\tnop\t";
					contxt.regType[contxt.Regs+1]='f';
   				}
   				if(contxt.Variables[good_index].DataType == "unsigned") 
				{
					contxt.is_unsigned = true;			
				}
				if(contxt.Variables[good_index].DataType == "float") {
					contxt.float_ = true;
				}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movslq %edx, %rax
movq 0x240(%rdi), %rdi
imulq $0xb0, %rax, %r12
movb 0x9c(%rdi,%r12), %al
cmpb $0x1, %al
jne 0x18f99
addq %r12, %rdi
addq $0x58, %rdi
leaq 0x14720(%rip), %rsi     # 0x2d58f
callq 0x14630
testb %al, %al
je 0x18f8a
cmpb $0x1, 0x49(%rbx)
jne 0x194d8
movq %r14, %rdi
callq 0x7190
leaq 0x14a68(%rip), %rsi     # 0x2d8fd
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14a50(%rip), %rsi     # 0x2d904
movq %rax, %rdi
callq 0x7310
leaq 0x145b8(%rip), %rsi     # 0x2d47b
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rcx
leaq (%rcx,%r12), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
leaq 0x15730(%rip), %r15     # 0x2e619
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movq %r14, %rdi
callq 0x7190
leaq 0x14c43(%rip), %rsi     # 0x2db46
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14c71(%rip), %rsi     # 0x2db93
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rcx
leaq (%rcx,%r12), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
leaq 0x14bf0(%rip), %rsi     # 0x2db43
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movslq 0x310(%rbx), %rax
movb $0x69, 0x342(%rax,%rbx)
jmp 0x194d8
movq 0x240(%rbx), %rdi
movb 0x9c(%rdi,%r12), %al
testb $0x1, %al
je 0x190d6
addq %r12, %rdi
addq $0x58, %rdi
leaq 0x145e0(%rip), %rsi     # 0x2d58f
callq 0x820e
movq 0x240(%rbx), %rdi
testb %al, %al
je 0x190d6
cmpb $0x1, 0xa8(%rdi,%r12)
jne 0x190d6
movq %r14, %rdi
callq 0x7190
leaq 0x1491c(%rip), %rsi     # 0x2d8fd
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14904(%rip), %rsi     # 0x2d904
movq %rax, %rdi
callq 0x7310
leaq 0x1446c(%rip), %rsi     # 0x2d47b
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rcx
leaq (%rcx,%r12), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
leaq 0x155e4(%rip), %r15     # 0x2e619
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movq %r14, %rdi
callq 0x7190
leaq 0x14af7(%rip), %rsi     # 0x2db46
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14b25(%rip), %rsi     # 0x2db93
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rcx
leaq (%rcx,%r12), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
leaq 0x14aa4(%rip), %rsi     # 0x2db43
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movslq 0x310(%rbx), %rax
movb $0x66, 0x342(%rax,%rbx)
jmp 0x194d8
cmpb $0x0, 0x9c(%rdi,%r12)
jne 0x191c2
movq %r14, %rdi
callq 0x7190
leaq 0x14aa5(%rip), %rsi     # 0x2db99
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14a22(%rip), %rsi     # 0x2db35
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rcx
leaq (%rcx,%r12), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
leaq 0x154e0(%rip), %r15     # 0x2e619
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movq %r14, %rdi
callq 0x7190
leaq 0x149e9(%rip), %rsi     # 0x2db3c
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14797(%rip), %rsi     # 0x2d909
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rcx
leaq (%rcx,%r12), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
leaq 0x149aa(%rip), %rsi     # 0x2db42
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movq 0x240(%rbx), %rdi
addq %r12, %rdi
addq $0x58, %rdi
leaq 0x1448a(%rip), %rsi     # 0x2d65a
callq 0x820e
testb %al, %al
pushq $0x75
popq %rax
pushq $0x69
popq %rcx
cmovnel %eax, %ecx
movslq 0x310(%rbx), %rax
movb %cl, 0x342(%rax,%rbx)
cmpl $0x0, 0x13e90(%rbx)
je 0x1924c
movq %r14, %rdi
callq 0x7190
leaq 0x14900(%rip), %rsi     # 0x2db06
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14576(%rip), %rsi     # 0x2d79b
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14795(%rip), %rsi     # 0x2d9d9
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x1434c(%rip), %rsi     # 0x2d5ae
callq 0x820e
testb %al, %al
je 0x192c7
movq %r14, %rdi
callq 0x7190
leaq 0x14696(%rip), %rsi     # 0x2d910
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x1467d(%rip), %rsi     # 0x2d916
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15361(%rip), %rsi     # 0x2e619
movq %rax, %rdi
callq 0x7310
movb $0x63, %al
jmp 0x1947e
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x142dc(%rip), %rsi     # 0x2d5b9
callq 0x820e
testb %al, %al
je 0x19319
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x14293(%rip), %rsi     # 0x2d58f
callq 0x14630
testb %al, %al
je 0x19319
movq %r14, %rdi
callq 0x7190
leaq 0x14623(%rip), %rsi     # 0x2d937
jmp 0x193a4
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x14e67(%rip), %rsi     # 0x2e196
callq 0x820e
testb %al, %al
jne 0x19376
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x1430c(%rip), %rsi     # 0x2d65a
callq 0x820e
testb %al, %al
jne 0x19376
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x142ef(%rip), %rsi     # 0x2d65c
callq 0x820e
testb %al, %al
je 0x193f1
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x14203(%rip), %rsi     # 0x2d58f
callq 0x14630
testb %al, %al
je 0x193f1
movq %r14, %rdi
callq 0x7190
leaq 0x1461c(%rip), %rsi     # 0x2d9c0
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x14553(%rip), %rsi     # 0x2d916
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15237(%rip), %rsi     # 0x2e619
movq %rax, %rdi
callq 0x7310
movb $0x69, %al
jmp 0x1947e
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x14188(%rip), %rsi     # 0x2d58f
callq 0x820e
testb %al, %al
je 0x1948c
movq %r14, %rdi
callq 0x7190
leaq 0x145a8(%rip), %rsi     # 0x2d9c7
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x144d8(%rip), %rsi     # 0x2d916
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x151bc(%rip), %rsi     # 0x2e619
movq %rax, %rdi
callq 0x7310
movq %r14, %rdi
callq 0x7190
leaq 0x14262(%rip), %rsi     # 0x2d6d6
movq %rax, %rdi
callq 0x7310
movb $0x66, %al
movslq 0x310(%rbx), %rcx
movb %al, 0x342(%rcx,%rbx)
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x141b8(%rip), %rsi     # 0x2d65a
callq 0x820e
testb %al, %al
je 0x194b2
movb $0x1, 0x219(%rbx)
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x58, %rdi
leaq 0x140c7(%rip), %rsi     # 0x2d58f
callq 0x820e
testb %al, %al
je 0x194d8
movb $0x1, 0x340(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq