// File: gioannides[P]Language_Processors/src/../include/ast/class_forward_declarations.hpp
// Function: load_locals(Context&, std::basic_ofstream<char, std::char_traits<char>>&, int)
inline void load_locals(Context& contxt, std::ofstream& file, int good_index)
{
	file << std::endl << "\taddiu $" << contxt.Regs+1 << ", $sp, " << contxt.Variables[good_index].offset; 
	if(contxt.nested_arrays){
		file << std::endl << "\tadd $" << contxt.Regs+1 << ", $" << contxt.Regs+1 << ", $25";				
	}
	if(contxt.Variables[good_index].Pointer && contxt.Variables[good_index].DataType != "float"){
		//file << std::endl << "\tlw\t$" << contxt.Regs+1 << ", " << contxt.Variables[good_index].offset << "($sp) #" << contxt.Variables[good_index].id;
		file << std::endl << "\tlw\t$" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ") #" << contxt.Variables[good_index].id;	
		
		
			contxt.regType[contxt.Regs+1]='i';
		
	}
	else if(contxt.Variables[good_index].Pointer && contxt.Variables[good_index].DataType == "float"){
		
		//file << std::endl << "\tlw\t$" << contxt.Regs+1 << ", " << contxt.Variables[good_index].offset << "($sp) #" << contxt.Variables[good_index].id;
		file << std::endl << "\tlw\t$" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ") #" << contxt.Variables[good_index].id;	

		contxt.regType[contxt.Regs+1]='i';
	}
	
			
	else if(contxt.Variables[good_index].DataType == "char" )  
	{
		//file << std::endl << "\tlb\t$" << contxt.Regs+1 << ", " << contxt.Variables[good_index].offset << "($sp) #" << contxt.Variables[good_index].id;
		file << std::endl << "\tlb\t$" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ") #" << contxt.Variables[good_index].id;	
		
		contxt.regType[contxt.Regs+1]='c';
	}
	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\t$" << contxt.Regs+1 << ", " << contxt.Variables[good_index].offset << "($sp) #" << contxt.Variables[good_index].id;	
		file << std::endl << "\tlw\t$" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ") #" << contxt.Variables[good_index].id;	
		
		if(contxt.Variables[good_index].DataType=="unsigned"){
			contxt.regType[contxt.Regs+1]='u';
		}	
		else{
			contxt.regType[contxt.Regs+1]='i';
		}		
			
	}
	else if(contxt.Variables[good_index].DataType== "short" && contxt.Variables[good_index].DataType != "float")
	{
		//file << std::endl << "\tlh\t$" << contxt.Regs+1 << ", " << contxt.Variables[good_index].offset << "($sp) #" << contxt.Variables[good_index].id;			
		file << std::endl << "\tlh\t$" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ") #" << contxt.Variables[good_index].id;	
		
		contxt.regType[contxt.Regs+1]='i';					
	}
	else if(contxt.Variables[good_index].DataType == "float") //TODO: CHECK OK
	{
		//file << std::endl << "\tlwc1\t$f" << contxt.Regs+1 << ", " << contxt.Variables[good_index].offset << "($sp) #" << contxt.Variables[good_index].id;
		file << std::endl << "\tlwc1\t$f" << contxt.Regs+1 << ", 0($" << contxt.Regs+1 << ") #" << contxt.Variables[good_index].id;	
		
		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 -0x10(%rbp), %rdi
movq 0x61bf2(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3e30a(%rip), %rsi     # 0x64697
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3e39d(%rip), %rsi     # 0x6474e
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
movl 0x50(%rax), %esi
callq 0x8730
movq -0x8(%rbp), %rax
cmpl $0x0, 0x13e90(%rax)
je 0x2644e
movq -0x10(%rbp), %rdi
movq 0x61b7e(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3e4ba(%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 0x3e12b(%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 0x3e345(%rip), %rsi     # 0x6478e
callq 0x8400
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
testb $0x1, 0x9c(%rax)
je 0x2654f
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3deb3(%rip), %rsi     # 0x64344
callq 0x1f7a0
testb $0x1, %al
jne 0x2649f
jmp 0x2654f
movq -0x10(%rbp), %rdi
movq 0x61ac6(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3e442(%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 0x3e1ee(%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 0x3e2c7(%rip), %rsi     # 0x647c8
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 -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
jmp 0x26af5
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
testb $0x1, 0x9c(%rax)
je 0x26650
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3ddb2(%rip), %rsi     # 0x64344
callq 0x9e30
testb $0x1, %al
jne 0x265a0
jmp 0x26650
movq -0x10(%rbp), %rdi
movq 0x619c5(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3e341(%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 0x3e0ed(%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 0x3e1c6(%rip), %rsi     # 0x647c8
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 -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
jmp 0x26af3
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3dcf1(%rip), %rsi     # 0x64363
callq 0x9e30
testb $0x1, %al
jne 0x26680
jmp 0x26730
movq -0x10(%rbp), %rdi
movq 0x618e5(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3e267(%rip), %rsi     # 0x64901
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3e00d(%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 0x3e0e6(%rip), %rsi     # 0x647c8
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 -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x63, 0x341(%rax,%rcx)
jmp 0x26af1
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3e7f9(%rip), %rsi     # 0x64f4b
callq 0x9e30
testb $0x1, %al
jne 0x267b6
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3dc92(%rip), %rsi     # 0x6440f
callq 0x9e30
testb $0x1, %al
jne 0x267b6
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3dc69(%rip), %rsi     # 0x64411
callq 0x9e30
testb $0x1, %al
jne 0x267b6
jmp 0x268e1
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3db6c(%rip), %rsi     # 0x64344
callq 0x1f7a0
testb $0x1, %al
jne 0x267e6
jmp 0x268e1
movq -0x10(%rbp), %rdi
movq 0x6177f(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3e0fb(%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 0x3dea7(%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 0x3df80(%rip), %rsi     # 0x647c8
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 -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3db78(%rip), %rsi     # 0x6440f
callq 0x9e30
testb $0x1, %al
jne 0x268a2
jmp 0x268c0
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x75, 0x341(%rax,%rcx)
jmp 0x268dc
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
jmp 0x26aef
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3da6b(%rip), %rsi     # 0x6436e
callq 0x9e30
testb $0x1, %al
jne 0x26911
jmp 0x269f1
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3da11(%rip), %rsi     # 0x64344
callq 0x1f7a0
testb $0x1, %al
jne 0x26941
jmp 0x269f1
movq -0x10(%rbp), %rdi
movq 0x61624(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3dfac(%rip), %rsi     # 0x64907
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3dd4c(%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 0x3de25(%rip), %rsi     # 0x647c8
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 -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x310(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x69, 0x341(%rax,%rcx)
jmp 0x26aed
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3d931(%rip), %rsi     # 0x64344
callq 0x9e30
testb $0x1, %al
jne 0x26a21
jmp 0x26aeb
movq -0x10(%rbp), %rdi
movq 0x61544(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3ded2(%rip), %rsi     # 0x6490d
callq 0x8400
movq %rax, %rdi
movq -0x8(%rbp), %rax
movl 0x310(%rax), %esi
addl $0x1, %esi
callq 0x8730
movq %rax, %rdi
leaq 0x3dc6c(%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 0x3dd45(%rip), %rsi     # 0x647c8
callq 0x8400
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rsi
callq 0x83c0
movq -0x10(%rbp), %rdi
movq 0x614b5(%rip), %rsi     # 0x87f70
callq 0x8450
movq %rax, %rdi
leaq 0x3d9c1(%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 0x26aed
jmp 0x26aef
jmp 0x26af1
jmp 0x26af3
jmp 0x26af5
movq -0x8(%rbp), %rdi
addq $0x240, %rdi            # imm = 0x240
movslq -0x14(%rbp), %rsi
callq 0xfde0
movq %rax, %rdi
addq $0x58, %rdi
leaq 0x3d8f8(%rip), %rsi     # 0x6440f
callq 0x9e30
testb $0x1, %al
jne 0x26b22
jmp 0x26b2d
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 0x3d7f5(%rip), %rsi     # 0x64344
callq 0x9e30
testb $0x1, %al
jne 0x26b5a
jmp 0x26b65
movq -0x8(%rbp), %rax
movb $0x1, 0x340(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)