// File: /workspace/github_cpp_makefile_star2_O2/gioannides[P]Language_Processors/src/../include/ast/ast_Expressions.cpp
// Function: PostFixExpression::render_asm(std::basic_ofstream<char, std::char_traits<char>>&, Context&)
inline void PostFixExpression::render_asm(std::ofstream& file,Context& contxt) {

			if(PostFixExpressionPtr != NULL) 
			{
				if(OPERATOR != NULL && IDENTIFIER == NULL) 
				{
					contxt.AssignmentOperator = *OPERATOR;

					if(!contxt.reading)
					{
						contxt.is_postfix= true;
					}					
					PostFixExpressionPtr->render_asm(file,contxt);
				}
				
				if(OPERATOR == NULL && AssignmentExpressionPtr == NULL && PrimaryExpressionPtr == NULL && IDENTIFIER == NULL)
				{ 	int offset = 0;
					int i = 0, j = 0;
					if(!contxt.reading)
					{
						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]) 
								{
									offset = contxt.Variables[i].offset;				
									i = -1;
									j = -1;
								}
							}
						}
						
						//file << "\n\tsw $31," << offset-(i*4) << "($sp)"; 
					}

					contxt.nested_function_calls++;
					contxt.is_function_call=true;
					
					
					PostFixExpressionPtr->render_asm(file,contxt);
					
					int search=0;
					for ( search=0; search<contxt.functions_declared.size(); search++)
					{
						if(contxt.functions_declared[search].name == contxt.Scopes[contxt.Scopes.size()-1])
						{
							break;
						}
					}
					int off;
					if(contxt.functions_declared[search].paramters_size > 16)
					{	
						off = contxt.functions_declared[search].paramters_size;
					}
						else 
					{
						off = 16;
					}
					//file << "\n offset =" << off << "\n";
					if(!contxt.reading){	
						if (offset<=0 || offset > contxt.totalStackArea-4){
							offset=116+120+off-4;
						}
						for(i=1; i<25; i++)
						{
							file << "\n\tsw $" << i << ", " << offset-(i*4) << "($sp)";
						}
						for(int j=1; j<31; j++)
						{
							file << "\n\tswc1 $f" << j << ", " << offset-100-(j-1)*4 << "($sp)";
						}
					}
					if(contxt.nested_function_calls>1 && !contxt.reading)
					{
						file << std::endl << "\taddiu $sp, $sp, -" << off;
						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])
								{									
									contxt.Variables[i].offset += off;
								}
							}
						}
					}
					
					if(ArgumentExpressionListPtr != NULL){
					    contxt.argument_no.push_back(0);
						ArgumentExpressionListPtr->render_asm(file, contxt);
						contxt.argument_no.pop_back();
						//file << "the problem comes now!";
					}
					

					if(!contxt.reading && contxt.Scopes.size()){
						file << "\n\t.option pic";
						// 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 << ")";                            	
						file <<  std::endl << "\tla $25," << contxt.Scopes[contxt.Scopes.size()-1];
						file << std::endl << "\tjalr $25";
						//file << std::endl << "\tjal " << contxt.Scopes[contxt.Scopes.size()-1];
						file << std::endl << "\tnop";
						contxt.Scopes.pop_back();
					}
					if(contxt.nested_function_calls>1 && !contxt.reading)
					{
						file << std::endl << "\taddiu $sp, $sp, " << off;
						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])
								{									
									contxt.Variables[i].offset -= off;
								}
							}
						}
					}
					if(!contxt.reading){
						if(contxt.regType[2] != 'f'){
							file << "\n\tmove\t$25, $2"; 
						}
						else{
							file << std::endl << "\tmov.s\t$f0,$f2";
						}
						for(i=1; i<25; i++)
						{
							file << "\n\tlw $" << i << "," << offset-(i*4) << "($sp)";
						}
						for(int j=1; j<31; j++)
						{
							file << "\n\tlwc1 $f" << j << ", " << offset-100-(j-1)*4 << "($sp)";
						}
						//file << "\n\tlw $31," << offset-(i*4) << "($sp)"; 
						if(contxt.regType[contxt.Regs+1] != 'f'){
							file << "\n\tmove $" << contxt.Regs+1 << ", $25"; 
						}
						else{
							file << std::endl << "\tmov.s\t$f" << contxt.Regs+1 << ",$f0";
						}
					}
					contxt.nested_function_calls--;
				}
				if(AssignmentExpressionPtr != NULL){
					contxt.is_array=true;
					bool temp_lhs=contxt.lhs_of_assignment;
					contxt.lhs_of_assignment=0;
					if(!contxt.reading){
						//file << std::endl << "\tsw $25, " << contxt.totalStackArea << "($sp)";
						file << std::endl << "\tmove $25, $0"; 
					}
					contxt.Regs++;
					AssignmentExpressionPtr->render_asm(file,contxt);
					contxt.lhs_of_assignment=temp_lhs;
					if(!contxt.reading){
					file << std:: endl <<"\tmove $25, $" << contxt.Regs+1; // move the value of the 
					}//multiply $25 by word size here;--------------------------------------------
					contxt.Regs--;
					//contxt.global_offset=contxt.eval[contxt.Regs+1];
					//for(int i=0; i<7; i++){
					//	file << std::endl << "# " << contxt.eval[i];
					//}
					contxt.nested_arrays++;
					
					PostFixExpressionPtr->render_asm(file,contxt);
					
					if(!contxt.reading){
					//file << std::endl << "\tlw $25, " << contxt.totalStackArea << "($sp)";
					}
					contxt.nested_arrays--;
					contxt.is_array=false;

				}
			}
			if( PrimaryExpressionPtr != NULL ) {

				PrimaryExpressionPtr->render_asm(file,contxt);
				
			}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
cmpq $0x0, 0x20(%rdi)
je 0x1460d
movq 0x28(%r15), %rax
movq 0x30(%r15), %rsi
testq %rsi, %rsi
setne %cl
testq %rax, %rax
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x13ef8
leaq 0x318(%rbx), %rdi
callq 0x71e0
cmpb $0x0, 0x21b(%rbx)
jne 0x13ee1
movb $0x1, 0x5b0(%rbx)
movq 0x20(%r15), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x13e88
movq 0x28(%r15), %rax
movq 0x30(%r15), %rsi
movq 0x10(%r15), %rdi
movq %rax, %xmm0
movq 0x8(%r15), %xmm1
punpcklqdq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0]
movq %rsi, %xmm0
movq %rdi, %xmm2
punpcklqdq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0]
por %xmm1, %xmm0
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
xorl $0xf, %eax
jne 0x1455b
movq $0x0, (%rsp)
cmpb $0x0, 0x21b(%rbx)
movq %r15, 0x10(%rsp)
jne 0x13fe0
movq 0x248(%rbx), %rax
subq 0x240(%rbx), %rax
movl $0xb0, %ecx
cqto
idivq %rcx
movq %rax, %r13
movq $0x0, (%rsp)
pushq $-0x1
popq %rbp
decl %r13d
js 0x13fdb
movq 0x468(%rbx), %r14
subq 0x460(%rbx), %r14
shrq $0x5, %r14
movslq %r13d, %rax
decl %r14d
imulq $0xb0, %rax, %r15
testl %r14d, %r14d
js 0x13f71
movq 0x240(%rbx), %rax
leaq (%rax,%r15), %rdi
addq $0x30, %rdi
movl %r14d, %esi
shlq $0x5, %rsi
addq 0x460(%rbx), %rsi
callq 0xcbbb
decl %r14d
testb %al, %al
je 0x13f95
movq 0x240(%rbx), %rax
movl 0x50(%rax,%r15), %eax
movq %rax, (%rsp)
movl %ebp, %r13d
movl %ebp, %r14d
jmp 0x13f88
movq 0x10(%rsp), %r15
incl 0x13e98(%rbx)
movb $0x1, 0x4b0(%rbx)
movq 0x20(%r15), %rdi
movq %r12, 0x8(%rsp)
movq %r12, %rsi
movq %rbx, %rdx
callq 0x13e88
leaq 0x460(%rbx), %rbp
pushq $0x8
popq %r13
pushq $-0x1
popq %r15
pushq $0x48
popq %r12
movq %r13, %r14
movq 0x400(%rbx), %rdi
movq 0x408(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
incq %r15
cmpq %r15, %rax
jbe 0x14057
leaq 0x48(%r14), %r13
addq %r14, %rdi
movq 0x468(%rbx), %rsi
addq $-0x20, %rsi
callq 0xcbbb
testb %al, %al
je 0x14014
movq 0x400(%rbx), %rdi
movl -0x8(%rdi,%r14), %eax
cmpl $0x11, %eax
pushq $0x10
popq %r13
cmovgel %eax, %r13d
cmpb $0x0, 0x21b(%rbx)
movq 0x8(%rsp), %r12
jne 0x14169
movq %rbp, 0x18(%rsp)
movq (%rsp), %rcx
testl %ecx, %ecx
jle 0x14093
movl 0x308(%rbx), %eax
addl $-0x4, %eax
cmpl %eax, %ecx
jle 0x1409a
leal 0xe8(%r13), %ecx
pushq $0x1
popq %rbp
movq %rcx, (%rsp)
leal -0x4(%rcx), %r15d
leaq 0x19b5b(%rip), %r12     # 0x2dc07
leaq 0x194be(%rip), %r14     # 0x2d571
cmpl $0x19, %ebp
je 0x140fc
movq 0x8(%rsp), %rdi
leaq 0x19886(%rip), %rsi     # 0x2d94a
callq 0x7310
movq %rax, %rdi
movl %ebp, %esi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movq %rax, %rdi
movl %r15d, %esi
callq 0x7590
movq %rax, %rdi
movq %r14, %rsi
callq 0x7310
incl %ebp
addl $-0x4, %r15d
jmp 0x140b3
movq (%rsp), %rax
leal -0x64(%rax), %ebp
pushq $0x1
popq %r15
leaq 0x19af9(%rip), %r12     # 0x2dc07
leaq 0x1945c(%rip), %r14     # 0x2d571
cmpl $0x1f, %r15d
je 0x1415f
movq 0x8(%rsp), %rdi
leaq 0x1982a(%rip), %rsi     # 0x2d951
callq 0x7310
movq %rax, %rdi
movl %r15d, %esi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movq %rax, %rdi
movl %ebp, %esi
callq 0x7590
movq %rax, %rdi
movq %r14, %rsi
callq 0x7310
incl %r15d
addl $-0x4, %ebp
jmp 0x14115
movq 0x8(%rsp), %r12
movq 0x18(%rsp), %rbp
cmpl $0x2, 0x13e98(%rbx)
jl 0x1417f
cmpb $0x0, 0x21b(%rbx)
je 0x14318
movq 0x10(%rsp), %r14
cmpq $0x0, 0x18(%r14)
je 0x141b6
leaq 0x490(%rbx), %rdi
leaq 0x24(%rsp), %rsi
andl $0x0, (%rsi)
callq 0x1563e
movq 0x18(%r14), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x1463a
addq $-0x4, 0x498(%rbx)
movb 0x21b(%rbx), %al
testb %al, %al
jne 0x14249
movq 0x468(%rbx), %rcx
cmpq 0x460(%rbx), %rcx
je 0x14249
leaq 0x19793(%rip), %rsi     # 0x2d96e
movq %r12, %rdi
callq 0x7310
movq %r12, %rdi
callq 0x7190
leaq 0x1978a(%rip), %rsi     # 0x2d97c
movq %rax, %rdi
callq 0x7310
movq 0x468(%rbx), %rsi
addq $-0x20, %rsi
movq %rax, %rdi
callq 0x72d0
movq %r12, %rdi
callq 0x7190
leaq 0x19769(%rip), %rsi     # 0x2d985
movq %rax, %rdi
callq 0x7310
movq %r12, %rdi
callq 0x7190
leaq 0x193c9(%rip), %rsi     # 0x2d5fc
movq %rax, %rdi
callq 0x7310
movq %rbp, %rdi
callq 0xcbde
movb 0x21b(%rbx), %al
cmpl $0x2, 0x13e98(%rbx)
jl 0x143d8
testb $0x1, %al
jne 0x143d8
movq %r12, %rdi
callq 0x7190
leaq 0x19722(%rip), %rsi     # 0x2d98f
movq %rax, %rdi
callq 0x7310
movq %rax, %rdi
movl %r13d, %esi
callq 0x7590
movq 0x248(%rbx), %rax
subq 0x240(%rbx), %rax
movl $0xb0, %ecx
cqto
idivq %rcx
movl %eax, %r14d
decq %r14
testl %r14d, %r14d
js 0x143d2
movq 0x468(%rbx), %rax
subq 0x460(%rbx), %rax
shrq $0x5, %rax
movl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %eax, %r15d
decq %r15
imulq $0xb0, %rcx, %r12
testl %r15d, %r15d
js 0x14311
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x30, %rdi
movl %r15d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
shlq $0x5, %rsi
addq 0x460(%rbx), %rsi
callq 0xcbbb
testb %al, %al
je 0x1430c
movq 0x240(%rbx), %rax
subl %r13d, 0x50(%rax,%r12)
decq %r15
jmp 0x142cf
movq 0x8(%rsp), %r12
jmp 0x1429b
movq %r12, %rdi
callq 0x7190
leaq 0x19634(%rip), %rsi     # 0x2d95b
movq %rax, %rdi
callq 0x7310
movq %rax, %rdi
movl %r13d, %esi
callq 0x7590
movq 0x248(%rbx), %rax
subq 0x240(%rbx), %rax
movl $0xb0, %ecx
cqto
idivq %rcx
movl %eax, %r14d
decq %r14
testl %r14d, %r14d
js 0x1417f
movq 0x468(%rbx), %rax
subq 0x460(%rbx), %rax
shrq $0x5, %rax
movl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %eax, %r15d
decq %r15
imulq $0xb0, %rcx, %r12
testl %r15d, %r15d
js 0x143cb
movq 0x240(%rbx), %rax
leaq (%rax,%r12), %rdi
addq $0x30, %rdi
movl %r15d, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
shlq $0x5, %rsi
addq 0x460(%rbx), %rsi
callq 0xcbbb
testb %al, %al
je 0x143c6
movq 0x240(%rbx), %rax
addl %r13d, 0x50(%rax,%r12)
decq %r15
jmp 0x14389
movq 0x8(%rsp), %r12
jmp 0x14355
movb 0x21b(%rbx), %al
testb $0x1, %al
movq 0x10(%rsp), %r15
jne 0x14551
cmpb $0x66, 0x343(%rbx)
jne 0x14402
movq %r12, %rdi
callq 0x7190
leaq 0x195b3(%rip), %rsi     # 0x2d9b0
movq %rax, %rdi
jmp 0x1440c
leaq 0x19598(%rip), %rsi     # 0x2d9a1
movq %r12, %rdi
callq 0x7310
movq (%rsp), %rax
leal -0x4(%rax), %ebp
pushq $0x1
popq %r15
leaq 0x1959c(%rip), %r14     # 0x2d9bf
leaq 0x1925e(%rip), %r12     # 0x2d688
leaq 0x19140(%rip), %r13     # 0x2d571
cmpl $0x19, %r15d
je 0x14477
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x7310
movq %rax, %rdi
movl %r15d, %esi
callq 0x7590
movq %rax, %rdi
movq %r12, %rsi
callq 0x7310
movq %rax, %rdi
movl %ebp, %esi
callq 0x7590
movq %rax, %rdi
movq %r13, %rsi
callq 0x7310
incl %r15d
addl $-0x4, %ebp
jmp 0x14431
movq (%rsp), %rax
addl $-0x64, %eax
movq %rax, (%rsp)
pushq $0x1
popq %rbp
leaq 0x1977b(%rip), %r14     # 0x2dc07
leaq 0x190de(%rip), %r15     # 0x2d571
movq 0x8(%rsp), %r13
cmpl $0x1f, %ebp
je 0x144e7
movq %r13, %rdi
leaq 0x1951f(%rip), %rsi     # 0x2d9c6
callq 0x7310
movq %rax, %rdi
movl %ebp, %esi
callq 0x7590
movq %rax, %rdi
movq %r14, %rsi
callq 0x7310
movq %rax, %rdi
movq (%rsp), %r12
movl %r12d, %esi
callq 0x7590
movq %rax, %rdi
movq %r15, %rsi
callq 0x7310
incl %ebp
addl $-0x4, %r12d
movq %r12, (%rsp)
jmp 0x14498
movslq 0x310(%rbx), %rax
cmpb $0x66, 0x342(%rbx,%rax)
movq %r13, %r12
jne 0x1451b
movq %r12, %rdi
callq 0x7190
leaq 0x194d5(%rip), %rsi     # 0x2d9df
movq %rax, %rdi
callq 0x7310
leaq 0x194d0(%rip), %r14     # 0x2d9e9
jmp 0x14531
leaq 0x194ae(%rip), %rsi     # 0x2d9d0
movq %r12, %rdi
callq 0x7310
leaq 0x194a8(%rip), %r14     # 0x2d9d9
movq 0x10(%rsp), %r15
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
movq %rax, %rdi
movq %r14, %rsi
callq 0x7310
decl 0x13e98(%rbx)
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x1460d
movb $0x1, 0x13e94(%rbx)
movb 0x1d2(%rbx), %bpl
movb $0x0, 0x1d2(%rbx)
cmpb $0x0, 0x21b(%rbx)
jne 0x1459d
movq %r12, %rdi
callq 0x7190
leaq 0x1945d(%rip), %rsi     # 0x2d9ee
movq %rax, %rdi
callq 0x7310
movq 0x10(%r15), %rdi
incl 0x310(%rbx)
movq %r12, %rsi
movq %rbx, %rdx
callq 0xe864
movb %bpl, 0x1d2(%rbx)
cmpb $0x0, 0x21b(%rbx)
jne 0x145e5
movq %r12, %rdi
callq 0x7190
leaq 0x1942f(%rip), %rsi     # 0x2d9fc
movq %rax, %rdi
callq 0x7310
movl 0x310(%rbx), %esi
incl %esi
movq %rax, %rdi
callq 0x7590
decl 0x310(%rbx)
incl 0x13e90(%rbx)
movq 0x20(%r15), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x13e88
decl 0x13e90(%rbx)
movb $0x0, 0x13e94(%rbx)
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x14621
movq %r12, %rsi
movq %rbx, %rdx
callq 0x1467a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq