// File: 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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
testb $0x1, 0x9c(%rax)
je 0x27e09
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c6ae(%rip), %rsi     # 0x64344
callq 0x1f7a0
testb $0x1, %al
jne 0x27ca4
jmp 0x27e09
movq -0x8(%rbp), %rax
testb $0x1, 0x49(%rax)
je 0x27e04
movq -0x10(%rbp), %rdi
movq 0x602b3(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c9e6(%rip), %rsi     # 0x646b2
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c9c9(%rip), %rsi     # 0x646b9
callq 0x8400
movq %rax, %rdi
leaq 0x3c531(%rip), %rsi     # 0x64230
callq 0x8400
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq -0x28(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x83c0
movq %rax, %rdi
leaq 0x3d6c2(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x10(%rbp), %rdi
movq 0x6022a(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3cba6(%rip), %rsi     # 0x648fb
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3cbcf(%rip), %rsi     # 0x64948
callq 0x8400
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq -0x20(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x83c0
movq %rax, %rdi
leaq 0x3d648(%rip), %rsi     # 0x653f8
callq 0x8400
movq %rax, %rdi
leaq 0x3cb39(%rip), %rsi     # 0x648f8
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3d615(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
jmp 0x28610
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
testb $0x1, 0x9c(%rax)
je 0x27fd4
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c4f8(%rip), %rsi     # 0x64344
callq 0x9e30
testb $0x1, %al
jne 0x27e5a
jmp 0x27fd4
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
testb $0x1, 0xa8(%rax)
je 0x27fd2
movq -0x10(%rbp), %rdi
movq 0x600ea(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c81d(%rip), %rsi     # 0x646b2
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c800(%rip), %rsi     # 0x646b9
callq 0x8400
movq %rax, %rdi
leaq 0x3c368(%rip), %rsi     # 0x64230
callq 0x8400
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x83c0
movq %rax, %rdi
leaq 0x3d4f9(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x10(%rbp), %rdi
movq 0x60061(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c9dd(%rip), %rsi     # 0x648fb
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3ca06(%rip), %rsi     # 0x64948
callq 0x8400
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq -0x30(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x83c0
movq %rax, %rdi
leaq 0x3d47f(%rip), %rsi     # 0x653f8
callq 0x8400
movq %rax, %rdi
leaq 0x3c970(%rip), %rsi     # 0x648f8
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3d44c(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x66, 0x341(%rax,%rcx)
jmp 0x28610
jmp 0x27fd4
jmp 0x27fd6
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
testb $0x1, 0x9c(%rax)
jne 0x2810f
movq -0x10(%rbp), %rdi
movq 0x5ff6e(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c93d(%rip), %rsi     # 0x6494e
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c8b5(%rip), %rsi     # 0x648ea
callq 0x8400
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x83c0
movq %rax, %rdi
leaq 0x3d38c(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x10(%rbp), %rdi
movq 0x5fef4(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c866(%rip), %rsi     # 0x648f1
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c60f(%rip), %rsi     # 0x646be
callq 0x8400
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x83c0
movq %rax, %rdi
leaq 0x3c811(%rip), %rsi     # 0x648f7
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3d2ee(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c2de(%rip), %rsi     # 0x6440f
callq 0x9e30
testb $0x1, %al
jne 0x2813c
jmp 0x2815a
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x75, 0x341(%rax,%rcx)
jmp 0x28176
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x13e90(%rax)
je 0x281ea
movq -0x10(%rbp), %rdi
movq 0x5fde2(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c71e(%rip), %rsi     # 0x648bb
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c38f(%rip), %rsi     # 0x64550
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c5a9(%rip), %rsi     # 0x6478e
callq 0x8400
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c157(%rip), %rsi     # 0x64363
callq 0x9e30
testb $0x1, %al
jne 0x2821a
jmp 0x282a2
movq -0x10(%rbp), %rdi
movq 0x5fd4b(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c491(%rip), %rsi     # 0x646c5
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c473(%rip), %rsi     # 0x646cb
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3d17c(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x63, 0x341(%rax,%rcx)
jmp 0x285a0
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c0aa(%rip), %rsi     # 0x6436e
callq 0x9e30
testb $0x1, %al
jne 0x282d2
jmp 0x2838a
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c050(%rip), %rsi     # 0x64344
callq 0x1f7a0
testb $0x1, %al
jne 0x28302
jmp 0x2838a
movq -0x10(%rbp), %rdi
movq 0x5fc63(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c3d0(%rip), %rsi     # 0x646ec
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c38b(%rip), %rsi     # 0x646cb
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3d094(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
jmp 0x2859e
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3cb9f(%rip), %rsi     # 0x64f4b
callq 0x9e30
testb $0x1, %al
jne 0x28410
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c038(%rip), %rsi     # 0x6440f
callq 0x9e30
testb $0x1, %al
jne 0x28410
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3c00f(%rip), %rsi     # 0x64411
callq 0x9e30
testb $0x1, %al
jne 0x28410
jmp 0x284c8
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3bf12(%rip), %rsi     # 0x64344
callq 0x1f7a0
testb $0x1, %al
jne 0x28440
jmp 0x284c8
movq -0x10(%rbp), %rdi
movq 0x5fb25(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c31b(%rip), %rsi     # 0x64775
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c24d(%rip), %rsi     # 0x646cb
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3cf56(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
jmp 0x2859c
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3be5a(%rip), %rsi     # 0x64344
callq 0x9e30
testb $0x1, %al
jne 0x284f8
jmp 0x2859a
movq -0x10(%rbp), %rdi
movq 0x5fa6d(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3c26a(%rip), %rsi     # 0x6477c
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3c195(%rip), %rsi     # 0x646cb
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3ce9e(%rip), %rsi     # 0x653f8
callq 0x8400
movq -0x10(%rbp), %rdi
movq 0x5fa06(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3bf12(%rip), %rsi     # 0x6448b
callq 0x8400
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x66, 0x341(%rax,%rcx)
jmp 0x2859c
jmp 0x2859e
jmp 0x285a0
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3be4d(%rip), %rsi     # 0x6440f
callq 0x9e30
testb $0x1, %al
jne 0x285cd
jmp 0x285d8
movq -0x8(%rbp), %rax
movb $0x1, 0x219(%rax)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3bd4a(%rip), %rsi     # 0x64344
callq 0x9e30
testb $0x1, %al
jne 0x28605
jmp 0x28610
movq -0x8(%rbp), %rax
movb $0x1, 0x340(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)