// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movslq %edx, %rax
movq 0x240(%rdi), %rdi
imulq $0xb0, %rax, %r13
movb 0x9c(%rdi,%r13), %al
cmpb $0x1, %al
jne 0x1f984
addq %r13, %rdi
addq $0x58, %rdi
leaq 0x17da9(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x1f975
cmpb $0x1, 0x49(%rbx)
jne 0x200eb
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x180cf(%rip), %rsi     # 0x378f3
movl $0x6, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
movq %rax, %r15
leaq 0x180af(%rip), %rsi     # 0x378fa
movl $0x4, %edx
movq %rax, %rdi
callq 0x73a0
leaq 0x17c12(%rip), %rsi     # 0x37471
movl $0x1, %edx
movq %r15, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
movq 0x8(%rax,%r13), %rsi
movq 0x10(%rax,%r13), %rdx
movq %r15, %rdi
callq 0x73a0
leaq 0x18d83(%rip), %r15     # 0x3860f
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r14
leaq 0x1826f(%rip), %rsi     # 0x37b3c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
movq %rax, %r14
leaq 0x18295(%rip), %rsi     # 0x37b89
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
movq 0x8(%rax,%r13), %rsi
movq 0x10(%rax,%r13), %rdx
movq %r14, %rdi
callq 0x73a0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
leaq 0x18205(%rip), %rsi     # 0x37b39
movl $0x2, %edx
movq %r14, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
movslq 0x310(%rbx), %rax
movb $0x69, 0x342(%rax,%rbx)
jmp 0x200eb
movq 0x240(%rbx), %rdi
movb 0x9c(%rdi,%r13), %al
testb $0x1, %al
je 0x1fb3f
addq %r13, %rdi
addq $0x58, %rdi
leaq 0x17beb(%rip), %rsi     # 0x37585
callq 0x70c0
movq 0x240(%rbx), %rdi
testl %eax, %eax
jne 0x1fb3f
cmpb $0x1, 0xa8(%rdi,%r13)
jne 0x1fb3f
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x17f05(%rip), %rsi     # 0x378f3
movl $0x6, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
movq %rax, %r15
leaq 0x17ee5(%rip), %rsi     # 0x378fa
movl $0x4, %edx
movq %rax, %rdi
callq 0x73a0
leaq 0x17a48(%rip), %rsi     # 0x37471
movl $0x1, %edx
movq %r15, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
movq 0x8(%rax,%r13), %rsi
movq 0x10(%rax,%r13), %rdx
movq %r15, %rdi
callq 0x73a0
leaq 0x18bb9(%rip), %r15     # 0x3860f
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r14
leaq 0x180a5(%rip), %rsi     # 0x37b3c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
movq %rax, %r14
leaq 0x180cb(%rip), %rsi     # 0x37b89
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
movq 0x8(%rax,%r13), %rsi
movq 0x10(%rax,%r13), %rdx
movq %r14, %rdi
callq 0x73a0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
leaq 0x1803b(%rip), %rsi     # 0x37b39
movl $0x2, %edx
movq %r14, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
movslq 0x310(%rbx), %rax
movb $0x66, 0x342(%rax,%rbx)
jmp 0x200eb
cmpb $0x0, 0x9c(%rdi,%r13)
jne 0x1fc9f
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x18010(%rip), %rsi     # 0x37b8f
movl $0x6, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
movq %rax, %r15
leaq 0x17f85(%rip), %rsi     # 0x37b2b
movl $0x6, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
movq 0x8(%rax,%r13), %rsi
movq 0x10(%rax,%r13), %rdx
movq %r15, %rdi
callq 0x73a0
leaq 0x18a3c(%rip), %r15     # 0x3860f
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r12
leaq 0x17f1e(%rip), %rsi     # 0x37b32
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r12, %rdi
callq 0x75c0
movq %rax, %r12
leaq 0x17cc4(%rip), %rsi     # 0x378ff
movl $0x6, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
movq 0x8(%rax,%r13), %rsi
movq 0x10(%rax,%r13), %rdx
movq %r12, %rdi
callq 0x73a0
movq %rax, %r12
leaq 0x17ecd(%rip), %rsi     # 0x37b38
movl $0x3, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r12, %rdi
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x73a0
movq 0x240(%rbx), %rdi
addq %r13, %rdi
addq $0x58, %rdi
leaq 0x179a3(%rip), %rsi     # 0x37650
callq 0x70c0
testl %eax, %eax
movl $0x75, %eax
movl $0x69, %ecx
cmovel %eax, %ecx
movslq 0x310(%rbx), %rax
movb %cl, 0x342(%rax,%rbx)
cmpl $0x0, 0x13e90(%rbx)
je 0x1fd65
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x17def(%rip), %rsi     # 0x37afc
movl $0x6, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
movq %rax, %r15
leaq 0x17a5d(%rip), %rsi     # 0x37791
movl $0x3, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
leaq 0x17c77(%rip), %rsi     # 0x379cf
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x17829(%rip), %rsi     # 0x375a4
callq 0x70c0
testl %eax, %eax
je 0x1fe65
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x17811(%rip), %rsi     # 0x375af
callq 0x70c0
testl %eax, %eax
je 0x1ffe3
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x183cb(%rip), %rsi     # 0x3818c
callq 0x70c0
testl %eax, %eax
je 0x1fe0c
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x17870(%rip), %rsi     # 0x37650
callq 0x70c0
testl %eax, %eax
je 0x1fe0c
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x17853(%rip), %rsi     # 0x37652
callq 0x70c0
testl %eax, %eax
jne 0x1fef5
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x17763(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x1fef5
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r14
leaq 0x17b56(%rip), %rsi     # 0x379b6
jmp 0x20037
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r14
leaq 0x17a70(%rip), %rsi     # 0x37906
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
movq %rax, %r14
leaq 0x17a4f(%rip), %rsi     # 0x3790c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
leaq 0x1872e(%rip), %rsi     # 0x3860f
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movb $0x63, %al
jmp 0x20091
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x1767a(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
jne 0x2009f
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x17a74(%rip), %rsi     # 0x379bd
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
movq %rax, %r15
leaq 0x1799c(%rip), %rsi     # 0x3790c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
leaq 0x1867b(%rip), %rsi     # 0x3860f
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
leaq 0x176fd(%rip), %rsi     # 0x376cc
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movb $0x66, %al
jmp 0x20091
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x1758c(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x1fdab
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r14
leaq 0x178f6(%rip), %rsi     # 0x3792d
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
movq %rax, %r14
leaq 0x178ae(%rip), %rsi     # 0x3790c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
leaq 0x1858d(%rip), %rsi     # 0x3860f
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movb $0x69, %al
movslq 0x310(%rbx), %rcx
movb %al, 0x342(%rcx,%rbx)
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x1759b(%rip), %rsi     # 0x37650
callq 0x70c0
testl %eax, %eax
jne 0x200c5
movb $0x1, 0x219(%rbx)
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x174aa(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
jne 0x200eb
movb $0x1, 0x340(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq