// File: /workspace/github_cpp_makefile_star2_O2/gioannides[P]Language_Processors/src/../include/ast/class_forward_declarations.hpp
// Function: store_globals(Context&, std::basic_ofstream<char, std::char_traits<char>>&, int)
inline void store_globals(Context& contxt, std::ofstream& file, int good_index)
{
	file << std::endl << "\tlui\t$" << contxt.Regs+2 << ", %hi(" << contxt.Variables[good_index].id << ")";
		file << std::endl << "\tla $" << contxt.Regs+2 << ", %lo(" << contxt.Variables[good_index].id << ")($" << contxt.Regs+2 << ")";
	if(contxt.nested_arrays){	
		file << std::endl << "\tadd $" << contxt.Regs+2 << ", $" << contxt.Regs+2 << ", $25";
	}
	if(contxt.Variables[good_index].DataType=="char") {
		if(contxt.regType[contxt.Regs+1] == 'f'){
			file << std::endl << ".set macro" << std::endl;
			file << std::endl << "\ttrunc.w.s\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1 << ",$" << contxt.Regs+1;
			file << std::endl << ".set nomacro" << std::endl;
			file << std::endl << "\tmfc1\t$" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
			file << std::endl << "\tnop" << std::endl;
			if(contxt.regType[contxt.Regs+1] == 'u'){
				file << std::endl << "\tandi\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",0xFF";
			}
		}
		file << std::endl << "\tsb $" << contxt.Regs+1 << ", 0($" << contxt.Regs+2 << ")";			
		//file << std::endl << "\tsb\t$" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($" << contxt.Regs+2 << ")";
		contxt.regType[contxt.Regs+1]='c';
	}
	else if((contxt.Variables[good_index].DataType == "int" || contxt.Variables[good_index].DataType =="signed" || contxt.Variables[good_index].DataType =="unsigned") && contxt.Variables[good_index].DataType != "float"){

		if(contxt.regType[contxt.Regs+1] == 'f'){
			file << std::endl << ".set macro" << std::endl;
			file << std::endl << "\ttrunc.w.s\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1 << ",$" << contxt.Regs+1;
			file << std::endl << ".set nomacro" << std::endl;
			file << std::endl << "\tmfc1\t$" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
			file << std::endl << "\tnop" << std::endl;
			if(contxt.regType[contxt.Regs+1] == 'u'){
				file << std::endl << "\tandi\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",0xFF";
			}
		}	
		file << std::endl << "\tsw $" << contxt.Regs+1 << ", 0($" << contxt.Regs+2 << ")";
		//file << std::endl << "\tsw\t$" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($" << contxt.Regs+2 << ")";
		contxt.regType[contxt.Regs+1]='i';
	}
	else if(contxt.Variables[good_index].DataType == "short" && contxt.Variables[good_index].DataType != "float"){

		if(contxt.regType[contxt.Regs+1] == 'f'){
			file << std::endl << ".set macro" << std::endl;
			file << std::endl << "\ttrunc.w.s\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1 << ",$" << contxt.Regs+1;
			file << std::endl << ".set nomacro" << std::endl;
			file << std::endl << "\tmfc1\t$" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
			file << std::endl << "\tnop" << std::endl;
			if(contxt.regType[contxt.Regs+1] == 'u'){
				file << std::endl << "\tandi\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",0xFF";
			}
		}	
		file << std::endl << "\tsh $" << contxt.Regs+1 << ", 0($" << contxt.Regs+2 << ")";
		//file << std::endl << "\tsw\t$" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($" << contxt.Regs+2 << ")";
		contxt.regType[contxt.Regs+1]='i';
	}
	else if(contxt.Variables[good_index].DataType == "float"){ //TODO: CHECK OK
		
		if(contxt.regType[contxt.Regs+1] != 'f'){
			file << std::endl << "\tmtc1\t$" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
			file << std::endl << "\tcvt.s.w\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
		}
		file << std::endl << "\tswc1 $f" << contxt.Regs+1 << ", 0($" << contxt.Regs+2 << ")";
		//file << std::endl << "\tswc1\t$f" << contxt.Regs+1 << ", %lo(" << contxt.Variables[good_index].id << ")($" << contxt.Regs+2 << ")";
		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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x7190
leaq 0x15f6a(%rip), %rsi     # 0x2d8fd
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
addl $0x2, %esi
movq %rax, %rdi
callq 0x7590
leaq 0x16182(%rip), %rsi     # 0x2db35
movq %rax, %rdi
callq 0x7310
movslq %ebp, %rcx
movq 0x240(%rbx), %rdx
imulq $0xb0, %rcx, %r13
leaq (%rdx,%r13), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
leaq 0x16c36(%rip), %r15     # 0x2e619
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movq %r14, %rdi
callq 0x7190
leaq 0x1613f(%rip), %rsi     # 0x2db3c
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
addl $0x2, %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15eec(%rip), %rsi     # 0x2d909
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rcx
leaq (%rcx,%r13), %rsi
addq $0x8, %rsi
movq %rax, %rdi
callq 0x72d0
leaq 0x160ff(%rip), %rsi     # 0x2db42
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
addl $0x2, %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
cmpl $0x0, 0x13e90(%rbx)
je 0x17ac7
movq %r14, %rdi
callq 0x7190
leaq 0x16087(%rip), %rsi     # 0x2db06
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
addl $0x2, %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15cfc(%rip), %rsi     # 0x2d79b
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
addl $0x2, %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15f1a(%rip), %rsi     # 0x2d9d9
movq %rax, %rdi
callq 0x7310
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15ad1(%rip), %rsi     # 0x2d5ae
callq 0x820e
testb %al, %al
je 0x17afc
movslq 0x310(%rbx), %rax
movb $0x63, %bpl
leaq 0x15abc(%rip), %r15     # 0x2d5b3
jmp 0x17be2
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x16684(%rip), %rsi     # 0x2e196
callq 0x820e
testb %al, %al
jne 0x17b59
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15b2b(%rip), %rsi     # 0x2d65c
callq 0x820e
testb %al, %al
jne 0x17b59
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15b0a(%rip), %rsi     # 0x2d65a
callq 0x820e
testb %al, %al
je 0x17b8b
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15a20(%rip), %rsi     # 0x2d58f
callq 0x14630
testb %al, %al
je 0x17b8b
movslq 0x310(%rbx), %rax
movb $0x69, %bpl
leaq 0x15dc2(%rip), %r15     # 0x2d94b
jmp 0x17be2
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15a18(%rip), %rsi     # 0x2d5b9
callq 0x820e
testb %al, %al
je 0x17d66
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x159cb(%rip), %rsi     # 0x2d58f
callq 0x14630
testb %al, %al
je 0x17d66
movslq 0x310(%rbx), %rax
movb $0x69, %bpl
leaq 0x159dd(%rip), %r15     # 0x2d5bf
cmpb $0x66, 0x342(%rax,%rbx)
jne 0x17e33
movq %r14, %rdi
callq 0x7190
leaq 0x15a03(%rip), %rsi     # 0x2d602
movq %rax, %rdi
callq 0x7310
movq %rax, %rdi
callq 0x7190
movq %r14, %rdi
callq 0x7190
leaq 0x15eef(%rip), %rsi     # 0x2db0d
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15b42(%rip), %r12     # 0x2d77f
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15adc(%rip), %rsi     # 0x2d73b
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r14, %rdi
callq 0x7190
leaq 0x158c4(%rip), %rsi     # 0x2d54a
movq %rax, %rdi
callq 0x7310
movq %rax, %rdi
callq 0x7190
movq %r14, %rdi
callq 0x7190
leaq 0x15e76(%rip), %rsi     # 0x2db1b
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r14, %rdi
callq 0x7190
leaq 0x15915(%rip), %rsi     # 0x2d5fc
movq %rax, %rdi
callq 0x7310
movq %rax, %rdi
callq 0x7190
movslq 0x310(%rbx), %rax
cmpb $0x75, 0x342(%rbx,%rax)
jne 0x17e33
movq %r14, %rdi
callq 0x7190
leaq 0x15bb0(%rip), %rsi     # 0x2d8cb
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15a01(%rip), %rsi     # 0x2d73b
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15dca(%rip), %rsi     # 0x2db23
movq %rax, %rdi
callq 0x7310
jmp 0x17e33
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15813(%rip), %rsi     # 0x2d58f
callq 0x820e
testb %al, %al
je 0x17e94
movslq 0x310(%rbx), %rax
movb $0x66, %bpl
leaq 0x15bb8(%rip), %r15     # 0x2d952
cmpb $0x66, 0x342(%rax,%rbx)
je 0x17e33
movq %r14, %rdi
callq 0x7190
leaq 0x15d15(%rip), %rsi     # 0x2dacc
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x159a9(%rip), %r12     # 0x2d77f
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r14, %rdi
callq 0x7190
leaq 0x15d29(%rip), %rsi     # 0x2db29
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r14, %rdi
callq 0x7190
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
leaq 0x15ab9(%rip), %rsi     # 0x2d916
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
addl $0x2, %esi
movq %rax, %rdi
callq 0x7590
leaq 0x1679c(%rip), %rsi     # 0x2e619
movq %rax, %rdi
callq 0x7310
movslq 0x310(%rbx), %rax
movb %bpl, 0x342(%rax,%rbx)
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x157b0(%rip), %rsi     # 0x2d65a
callq 0x820e
testb %al, %al
je 0x17eba
movb $0x1, 0x219(%rbx)
movq 0x240(%rbx), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x156bf(%rip), %rsi     # 0x2d58f
callq 0x820e
testb %al, %al
je 0x17ee0
movb $0x1, 0x340(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq