// File: /workspace/github_cpp_makefile_star2_O2/gioannides[P]Language_Processors/src/../include/ast/class_forward_declarations.hpp
// Function: CastToType(std::basic_ofstream<char, std::char_traits<char>>&, Context&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
inline void CastToType(std::ofstream& file, Context& contxt, std::string IDENTIFIER) {
	int i,j;
	for(i=contxt.Variables.size()-1; i>=0; i--) {
				for (j=contxt.Scopes.size()-1; j>=0; j--)
				{
					if(contxt.Variables[i].scope == contxt.Scopes[j] && IDENTIFIER == contxt.Variables[i].id) 
					{
						
					if(contxt.Variables[i].DataType == contxt.CastType){
						//do nothing
					}
					else if(contxt.Variables[i].DataType == "float" && contxt.CastType == "short" ){
						
						file << std::endl << "\t.set macro\t";
						file << std::endl << "\ttrunc.w.s\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1 << ",$" << contxt.Regs+1;
						file << std::endl << "\t.set nomacro\t";
						file << std::endl << "\tmfc1\t$" << contxt.Regs+1 << "," << "$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						file << std::endl << "\tsll\t$" << contxt.Regs+1 << "," << "$" << contxt.Regs+1 << ",16";
						file << std::endl << "\tsra\t$" << contxt.Regs+1 << "," << "$" << contxt.Regs+1 << ",16";
						file << std::endl << "\tmtc1\t$" << contxt.Regs+1 << "," << "$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						file << std::endl << "\tcvt.s.w\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						contxt.regType[contxt.Regs+1]='f';
						
					}
					else if(contxt.Variables[i].DataType == "float" && contxt.CastType == "char" ){
						
						file << std::endl << "\t.set macro\t";
						file << std::endl << "\ttrunc.w.s\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1 << ",$" << contxt.Regs+1;
						file << std::endl << "\t.set nomacro\t";
						file << std::endl << "\tmfc1\t$" << contxt.Regs+1 << "," << "$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						file << std::endl << "\tsll\t$" << contxt.Regs+1 << "," << "$" << contxt.Regs+1 << ",24";
						file << std::endl << "\tsra\t$" << contxt.Regs+1 << "," << "$" << contxt.Regs+1 << ",24";
						file << std::endl << "\tmtc1\t$" << contxt.Regs+1 << "," << "$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						file << std::endl << "\tcvt.s.w\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						contxt.regType[contxt.Regs+1]='f';
						
					}
					else if(contxt.Variables[i].DataType == "float" && (contxt.CastType == "int" || contxt.CastType == "unsigned" || contxt.CastType == "signed") ){
						
						file << std::endl << "\tcvt.w.s\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						contxt.regType[contxt.Regs+1]='f';
						
					}
					else if( (contxt.Variables[i].DataType == "short" || contxt.Variables[i].DataType == "int" || contxt.Variables[i].DataType == "unsigned" ||contxt.Variables[i].DataType == "char" || contxt.Variables[i].DataType == "signed") && contxt.CastType == "float" ){
						
						file << std::endl << "\tmtc1\t$" << contxt.Regs+1 << "," << "$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						file << std::endl << "\tcvt.s.w\t$f" << contxt.Regs+1 << ",$f" << contxt.Regs+1;
						file << std::endl << "\tnop" << std::endl;
						contxt.regType[contxt.Regs+1]='f';
						
					}

					else if(contxt.Variables[i].DataType == "int" && contxt.CastType == "short" ){
						
						file << std::endl << "\tsll\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",16";
						file << std::endl << "\tsra\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",16";
						contxt.regType[contxt.Regs+1]='i';
						
					}
					else if(contxt.Variables[i].DataType == "int" && contxt.CastType == "char" ){
						
						file << std::endl << "\tsll\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",24";
						file << std::endl << "\tsra\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",24";
						contxt.regType[contxt.Regs+1]='c';
						
					}
					else if(contxt.Variables[i].DataType == "short" && contxt.CastType == "char" ){
						
						file << std::endl << "\tsll\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",24";
						file << std::endl << "\tsra\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",24";
						file << std::endl << "\tsll\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",16";
						file << std::endl << "\tsra\t$" << contxt.Regs+1 << ",$" << contxt.Regs+1 << ",16";
						contxt.regType[contxt.Regs+1]='c';
						
					}
						i = -1;
						j = -1;
			}									
		}
	  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x248(%rsi), %rax
subq 0x240(%rsi), %rax
movl $0xb0, %ecx
cqto
idivq %rcx
movq %rax, %rbp
leaq 0x98(%rsi), %rax
movq %rax, (%rsp)
decl %ebp
js 0x18e23
movq 0x468(%r14), %r12
subq 0x460(%r14), %r12
shrq $0x5, %r12
movslq %ebp, %rax
decl %r12d
imulq $0xb0, %rax, %r13
testl %r12d, %r12d
js 0x183fa
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x30, %rdi
movl %r12d, %esi
shlq $0x5, %rsi
addq 0x460(%r14), %rsi
callq 0xcbbb
testb %al, %al
je 0x18467
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0xcbbb
testb %al, %al
jne 0x1846c
decl %r12d
jmp 0x18421
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
movq (%rsp), %rsi
callq 0xcbbb
pushq $-0x1
popq %rcx
movl %ecx, %ebp
movl %ecx, %r12d
testb %al, %al
jne 0x18414
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x150e9(%rip), %r12     # 0x2d58f
movq %r12, %rsi
callq 0x820e
testb %al, %al
je 0x18642
movq (%rsp), %rdi
leaq 0x150f8(%rip), %rsi     # 0x2d5b9
callq 0x820e
testb %al, %al
je 0x18642
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x15681(%rip), %rsi     # 0x2db61
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x15616(%rip), %rsi     # 0x2db0d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x15268(%rip), %rsi     # 0x2d77f
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x15204(%rip), %rsi     # 0x2d73b
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x1560f(%rip), %rsi     # 0x2db6e
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x155a5(%rip), %rsi     # 0x2db1b
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x150f2(%rip), %r13     # 0x2d688
movq %r13, %rsi
callq 0x7310
movq %rax, %rdi
leaq 0x155b6(%rip), %rsi     # 0x2db5e
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x1502c(%rip), %rsi     # 0x2d5fc
callq 0x7310
movq %rax, %rdi
callq 0x7190
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x1558e(%rip), %rsi     # 0x2db7d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
callq 0x7310
movq %rax, %rdi
leaq 0x15507(%rip), %rbp     # 0x2db21
movq %rbp, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x15547(%rip), %r12     # 0x2db84
jmp 0x187e8
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
movq %r12, %rsi
callq 0x820e
testb %al, %al
je 0x1887d
movq (%rsp), %rdi
leaq 0x14f42(%rip), %rsi     # 0x2d5ae
callq 0x820e
testb %al, %al
je 0x1887d
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x154d6(%rip), %rsi     # 0x2db61
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x1546b(%rip), %rsi     # 0x2db0d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x150bd(%rip), %rsi     # 0x2d77f
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x15059(%rip), %rsi     # 0x2d73b
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x15464(%rip), %rsi     # 0x2db6e
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x153fa(%rip), %rsi     # 0x2db1b
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14f47(%rip), %r13     # 0x2d688
movq %r13, %rsi
callq 0x7310
movq %rax, %rdi
leaq 0x1540b(%rip), %rsi     # 0x2db5e
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14e81(%rip), %rsi     # 0x2d5fc
callq 0x7310
movq %rax, %rdi
callq 0x7190
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x153e3(%rip), %rsi     # 0x2db7d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
callq 0x7310
movq %rax, %rdi
leaq 0x1535c(%rip), %rbp     # 0x2db21
movq %rbp, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x153a7(%rip), %r12     # 0x2db8f
movq %r12, %rsi
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x15386(%rip), %rsi     # 0x2db88
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
callq 0x7310
movq %rax, %rdi
movq %rbp, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x15270(%rip), %rsi     # 0x2dacc
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
jmp 0x18a20
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
movq %r12, %rsi
callq 0x820e
testb %al, %al
je 0x18937
movq (%rsp), %rdi
leaq 0x158ef(%rip), %rsi     # 0x2e196
callq 0x820e
testb %al, %al
jne 0x188d8
movq (%rsp), %rdi
leaq 0x14d9f(%rip), %rsi     # 0x2d65a
callq 0x820e
testb %al, %al
jne 0x188d8
movq (%rsp), %rdi
leaq 0x14d8d(%rip), %rsi     # 0x2d65c
callq 0x820e
testb %al, %al
je 0x18937
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14e0b(%rip), %rsi     # 0x2d6f5
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14e75(%rip), %rsi     # 0x2d77f
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14cca(%rip), %rsi     # 0x2d5fc
jmp 0x18abd
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x14c6c(%rip), %rsi     # 0x2d5b9
callq 0x820e
testb %al, %al
jne 0x189da
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15826(%rip), %rsi     # 0x2e196
callq 0x820e
testb %al, %al
jne 0x189da
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x14ccb(%rip), %rsi     # 0x2d65a
callq 0x820e
testb %al, %al
jne 0x189da
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x14c00(%rip), %rsi     # 0x2d5ae
callq 0x820e
testb %al, %al
jne 0x189da
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x14c8f(%rip), %rsi     # 0x2d65c
callq 0x820e
testb %al, %al
je 0x18ae8
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x820e
testb %al, %al
je 0x18ae8
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x150cc(%rip), %rsi     # 0x2dacc
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14c68(%rip), %rsi     # 0x2d688
callq 0x7310
movq %rax, %rdi
leaq 0x1512f(%rip), %rsi     # 0x2db5e
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14ba5(%rip), %r12     # 0x2d5fc
movq %r12, %rsi
callq 0x7310
movq %rax, %rdi
callq 0x7190
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x150b0(%rip), %rsi     # 0x2db29
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14ce6(%rip), %rsi     # 0x2d77f
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movq %rax, %rdi
callq 0x7190
movb $0x66, %al
movslq 0x310(%r14), %rcx
movb %al, 0x342(%r14,%rcx)
pushq $-0x1
popq %rax
movl %eax, %ebp
movl %eax, %r12d
jmp 0x18414
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x15698(%rip), %rsi     # 0x2e196
callq 0x820e
testb %al, %al
je 0x18bd6
movq (%rsp), %rdi
leaq 0x14aa3(%rip), %rsi     # 0x2d5b9
callq 0x820e
testb %al, %al
je 0x18bd6
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x15048(%rip), %rsi     # 0x2db7d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14be6(%rip), %r12     # 0x2d73b
movq %r12, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x1500c(%rip), %r13     # 0x2db84
movq %r13, %rsi
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14ff6(%rip), %rsi     # 0x2db88
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
callq 0x7310
movb $0x69, %al
jmp 0x18acc
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x155aa(%rip), %rsi     # 0x2e196
callq 0x820e
testb %al, %al
je 0x18c81
movq (%rsp), %rdi
leaq 0x149aa(%rip), %rsi     # 0x2d5ae
callq 0x820e
testb %al, %al
je 0x18c81
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14f5e(%rip), %rsi     # 0x2db7d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14afc(%rip), %r12     # 0x2d73b
movq %r12, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14f2d(%rip), %r13     # 0x2db8f
movq %r13, %rsi
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14f0c(%rip), %rsi     # 0x2db88
jmp 0x18ddf
movq 0x240(%r14), %rax
leaq (%rax,%r13), %rdi
addq $0x58, %rdi
leaq 0x14922(%rip), %rsi     # 0x2d5b9
callq 0x820e
pushq $-0x1
popq %rcx
movl %ecx, %ebp
movl %ecx, %r12d
testb %al, %al
je 0x18414
movq (%rsp), %rdi
leaq 0x148f7(%rip), %rsi     # 0x2d5ae
callq 0x820e
pushq $-0x1
popq %rcx
movl %ecx, %ebp
movl %ecx, %r12d
testb %al, %al
je 0x18414
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14e9f(%rip), %rsi     # 0x2db7d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14a3d(%rip), %r12     # 0x2d73b
movq %r12, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14e6e(%rip), %r13     # 0x2db8f
movq %r13, %rsi
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14e4d(%rip), %rbp     # 0x2db88
movq %rbp, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
leaq 0x14df0(%rip), %rsi     # 0x2db7d
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
leaq 0x14dbb(%rip), %r13     # 0x2db84
movq %r13, %rsi
callq 0x7310
movq %r15, %rdi
callq 0x7190
movq %rax, %rdi
movq %rbp, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movl 0x310(%r14), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
callq 0x7310
movb $0x63, %al
jmp 0x18acc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq