// File: /workspace/github_cpp_makefile_star2_O1/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
cmpb $0x1, 0x9c(%rdi,%r13)
jne 0x20034
addq %r13, %rdi
addq $0x58, %rdi
leaq 0x176ea(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x20034
cmpb $0x1, 0x49(%rbx)
jne 0x207b1
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 0x17a10(%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 0x179f0(%rip), %rsi     # 0x378fa
movl $0x4, %edx
movq %rax, %rdi
callq 0x73a0
leaq 0x17553(%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 0x186c4(%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 0x17bb0(%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 0x17bd6(%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 0x17b46(%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 0x207b1
movq 0x240(%rbx), %rdi
cmpb $0x1, 0x9c(%rdi,%r13)
jne 0x201fd
addq %r13, %rdi
addq $0x58, %rdi
leaq 0x1752d(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
jne 0x201fd
movq 0x240(%rbx), %rax
cmpb $0x1, 0xa8(%rax,%r13)
jne 0x201fd
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 0x17847(%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 0x17827(%rip), %rsi     # 0x378fa
movl $0x4, %edx
movq %rax, %rdi
callq 0x73a0
leaq 0x1738a(%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 0x184fb(%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 0x179e7(%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 0x17a0d(%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 0x1797d(%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 0x207b1
movq 0x240(%rbx), %rax
cmpb $0x0, 0x9c(%rax,%r13)
jne 0x2035d
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 0x1794b(%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 0x178c0(%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 0x18377(%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 0x17859(%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 0x175ff(%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 0x17808(%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), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x172dd(%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 0x2042b
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 0x17729(%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 0x17397(%rip), %rsi     # 0x37791
movl $0x3, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
leaq 0x175b1(%rip), %rsi     # 0x379cf
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x17163(%rip), %rsi     # 0x375a4
callq 0x70c0
testl %eax, %eax
je 0x2052b
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x1714b(%rip), %rsi     # 0x375af
callq 0x70c0
testl %eax, %eax
je 0x206a9
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x17d05(%rip), %rsi     # 0x3818c
callq 0x70c0
testl %eax, %eax
je 0x204d2
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x171aa(%rip), %rsi     # 0x37650
callq 0x70c0
testl %eax, %eax
je 0x204d2
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x1718d(%rip), %rsi     # 0x37652
callq 0x70c0
testl %eax, %eax
jne 0x205bb
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x1709d(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x205bb
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 0x17490(%rip), %rsi     # 0x379b6
jmp 0x206fd
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 0x173aa(%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 0x17389(%rip), %rsi     # 0x3790c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
leaq 0x18068(%rip), %rsi     # 0x3860f
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movb $0x63, %al
jmp 0x20757
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x16fb4(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
jne 0x20765
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 0x173ae(%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 0x172d6(%rip), %rsi     # 0x3790c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r15, %rdi
callq 0x75c0
leaq 0x17fb5(%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 0x17037(%rip), %rsi     # 0x376cc
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movb $0x66, %al
jmp 0x20757
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x16ec6(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x20471
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 0x17230(%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 0x171e8(%rip), %rsi     # 0x3790c
movl $0x5, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x310(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x75c0
leaq 0x17ec7(%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 0x16ed5(%rip), %rsi     # 0x37650
callq 0x70c0
testl %eax, %eax
jne 0x2078b
movb $0x1, 0x219(%rbx)
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x16de4(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
jne 0x207b1
movb $0x1, 0x340(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq