// File: /workspace/github_cpp_makefile_star2_O1/gioannides[P]Language_Processors/src/../include/ast/ast_node.hpp
// Function: InitDeclarator::render_asm(std::basic_ofstream<char, std::char_traits<char>>&, Context&)
void render_asm(std::ofstream& file,Context& contxt) {
			if(contxt.reading) { //this is predicting total stack frame for all paramters/local declarations in function body
					//contxt.variable.offset = contxt.totalStackArea;
					contxt.totalStackArea += 4;// contxt.variable.word_size;
					//file << "\nonly golbals get here " << contxt.totalStackArea << "\n";

				}

				if(!contxt.reading){ //this is execution

					contxt.StackOffset += 4;//contxt.variable.word_size;
					contxt.variable.offset = contxt.StackOffset-4;//contxt.variable.word_size;
					contxt.variable.offset = contxt.totalStackArea - contxt.variable.offset - 8; 
				}
			
			if( InitiaLizer != NULL && DecLarator != NULL) 
			{
				contxt.initialized = true;
				contxt.variable.initialized = true;
				/*for(int i=0; i<contxt.Variables.size(); i++) {	//Predict the signedness of LHS, made DirectDeclarator members public...
					std::cout << contxt.Variables[i].id << contxt.Variables[i].DataType << std::endl;				
					if(*(DecLarator->DirectDecLarator->IDENTIFIER) == contxt.Variables[i].id) {
						if(contxt.Variables[i].DataType == "unsigned") {
							contxt.is_unsigned = true;
						}
					}
				}*/
				if(contxt.function||contxt.function_dec){			
				
				InitiaLizer->render_asm(file,contxt);
				
				contxt.lhs_of_assignment = true;
				DecLarator->render_asm(file,contxt);	// The boolean variable was 'initialized' set to false by default
				contxt.lhs_of_assignment = false;
				}
				else 
				{
					//file << std::endl << "# global initialized" << std::endl;
					contxt.no_of_initial_values=0;							
					//contxt.lhs_of_assignment = true;
					DecLarator->render_asm(file,contxt); 
					//contxt.lhs_of_assignment = false;

					contxt.no_array_elements = contxt.eval[contxt.Regs+1];
					if(!contxt.no_array_elements)
						contxt.no_array_elements=1;
					file << std::endl << "\n\t.data";
					file << std::endl << "\t.globl\t" << contxt.variable.id;
					if( log2(contxt.variable.word_size) )
					{
						file << std::endl << "\t.align\t" << log2(contxt.variable.word_size);
					}
					file << std::endl << "\t.type\t" << contxt.variable.id << ", @object";
					file << std::endl << "\t.size\t" << contxt.variable.id << ", " << contxt.variable.word_size*contxt.no_array_elements;
					file << std::endl << contxt.variable.id << ":";
				
					//contxt.rhs_of_expression = true;
					InitiaLizer->render_asm(file,contxt); // print .word in here
					//contxt.rhs_of_expression = false;
					if(contxt.no_array_elements-contxt.no_of_initial_values>0){
						file << std::endl << "\t.space\t" << (contxt.no_array_elements-contxt.no_of_initial_values)*contxt.variable.word_size;
					}
				}
				contxt.initialized = false;
				
			}
			else if(DecLarator != NULL &&  InitiaLizer == NULL){
				//file << std::endl << "# global not initialized" << std::endl;
				contxt.initialized = false;
				contxt.variable.initialized = false;
				contxt.lhs_of_assignment=true;
				DecLarator->render_asm(file,contxt);
				contxt.lhs_of_assignment=false;
				if(!contxt.function&&!contxt.function_dec){
					contxt.no_of_initial_values=1;	
					contxt.no_array_elements = contxt.eval[contxt.Regs+1];
					if(!contxt.no_array_elements)
						contxt.no_array_elements=1;
					file << std::endl << "\n\t.data";
					file << std::endl << "\t.globl\t" << contxt.variable.id;
					if( log2(contxt.variable.word_size) )
					{
						file << std::endl << "\t.align\t" << log2(contxt.variable.word_size);
					}
					file << std::endl << "\t.type\t" << contxt.variable.id << ", @object";
					file << std::endl << "\t.size\t" << contxt.variable.id << ", " << contxt.variable.word_size*contxt.no_array_elements;
					file << std::endl << contxt.variable.id << ":";
				if( contxt.variable.word_size > 4 ){					
					file << std::endl << "\t.double\t" << 0 ; 	//TODO: Convert to IEEE-754 for FLOAT and DOUBLE
				}
				else if( (contxt.variable.word_size==4) && contxt.variable.DataType!="float"){
					file << std::endl << "\t.word\t" << 0; //contxt.variable.value;
				}
				else if( (contxt.variable.word_size==4) && contxt.variable.DataType=="float"){
					file << std::endl << "\t.float\t" << 0; //contxt.variable.value;
					contxt.float_ = false;
				}
				else if(contxt.variable.word_size==2){
					file << std::endl << "\t.half\t" << 0;
				}
				else if(contxt.variable.word_size==1){
					file << std::endl << "\t.byte\t" << 0;
				}
				        // reset the value of the global
				for(int i=contxt.Regs; i<=20; i++)
				{
					//file << "\n#" << contxt.eval[i];
					contxt.eval[i] = 0; 
				}
					//file << std::endl << contxt.variable.id << ":";
					if(contxt.no_array_elements-contxt.no_of_initial_values>0){
						file << std::endl << "\t.space\t" << (contxt.no_array_elements-contxt.no_of_initial_values)*contxt.variable.word_size;
					}
				}
			}
			contxt.is_unsigned = false;
			contxt.float_ = false;
		}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpb $0x1, 0x21b(%rdx)
jne 0x25049
addl $0x4, 0x308(%rbx)
jmp 0x25069
movl 0x308(%rbx), %eax
movl 0x30c(%rbx), %ecx
leal 0x4(%rcx), %edx
movl %edx, 0x30c(%rbx)
subl %ecx, %eax
addl $-0x8, %eax
movl %eax, 0x2a8(%rbx)
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x25123
movq 0x8(%r15), %r12
testq %r12, %r12
je 0x25123
movb $0x1, %al
movb %al, 0x217(%rbx)
movb %al, 0x300(%rbx)
cmpb $0x0, 0x218(%rbx)
jne 0x250a7
cmpb $0x1, 0x13e7c(%rbx)
jne 0x254d7
movq %r14, %rsi
movq %rbx, %rdx
callq 0x259a4
movb $0x1, 0x1d2(%rbx)
movq 0x8(%r15), %r15
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x25490
cmpq $0x0, 0x10(%r15)
je 0x25490
movb $0x1, 0x2f4(%rbx)
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e12
movl 0x20(%rbx), %eax
movl %eax, 0x2f8(%rbx)
movl %eax, 0x2fc(%rbx)
movq 0x10(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e4a
movl $0x0, 0x20(%rbx)
movb $0x0, 0x2f4(%rbx)
movq $0x0, 0x2f8(%rbx)
jmp 0x254af
testq %rdi, %rdi
setne %al
movq 0x8(%r15), %r15
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0x254bd
xorl %eax, %eax
movb %al, 0x217(%rbx)
movb %al, 0x300(%rbx)
movb $0x1, 0x1d2(%rbx)
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x251ab
cmpq $0x0, 0x10(%r15)
je 0x251ab
movb $0x1, 0x2f4(%rbx)
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e12
movl 0x20(%rbx), %eax
movl %eax, 0x2f8(%rbx)
movl %eax, 0x2fc(%rbx)
movq 0x10(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e4a
movl $0x0, 0x20(%rbx)
movb $0x0, 0x2f4(%rbx)
movq $0x0, 0x2f8(%rbx)
jmp 0x251ca
testq %rdi, %rdi
setne %al
movq 0x10(%r15), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x251ca
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e4a
movb $0x0, 0x1d2(%rbx)
cmpb $0x0, 0x218(%rbx)
jne 0x254bd
cmpb $0x0, 0x13e7c(%rbx)
jne 0x254bd
movl $0x1, 0x13e80(%rbx)
movslq 0x310(%rbx), %rax
movl 0x5fc(%rbx,%rax,4), %eax
cmpl $0x1, %eax
adcl $0x0, %eax
movl %eax, 0x13e8c(%rbx)
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
leaq 0x12adc(%rip), %rsi     # 0x37d19
movl $0x7, %edx
movq %rax, %rdi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x12275(%rip), %rsi     # 0x374f0
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %r15, %rdi
callq 0x73a0
cvtsi2sdl 0x258(%rbx), %xmm0
callq 0x7600
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x252b7
jnp 0x2530d
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x12a39(%rip), %rsi     # 0x37d21
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
xorps %xmm0, %xmm0
cvtsi2sdl 0x258(%rbx), %xmm0
callq 0x7600
movq %r15, %rdi
callq 0x7540
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x121de(%rip), %rsi     # 0x3751c
movl $0x7, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %r15, %rdi
callq 0x73a0
leaq 0x129c2(%rip), %rsi     # 0x37d2a
movl $0x9, %edx
movq %rax, %rdi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x1298e(%rip), %rsi     # 0x37d34
movl $0x7, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %r15, %rdi
callq 0x73a0
movq %rax, %r15
leaq 0x1282a(%rip), %rsi     # 0x37bfd
movl $0x2, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x13e8c(%rbx), %esi
imull 0x258(%rbx), %esi
movq %r15, %rdi
callq 0x75c0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %rax, %rdi
callq 0x73a0
leaq 0x11fdd(%rip), %rsi     # 0x37416
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x258(%rbx), %eax
cmpl $0x5, %eax
jl 0x2582f
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r15
leaq 0x128bf(%rip), %rsi     # 0x37d45
movl $0x9, %edx
jmp 0x258be
testq %rdi, %rdi
setne %al
movq 0x10(%r15), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x254af
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e4a
movb $0x0, 0x1d2(%rbx)
movb $0x0, 0x217(%rbx)
xorl %eax, %eax
movb %al, 0x219(%rbx)
movb %al, 0x340(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x0, 0x13e80(%rbx)
movq 0x8(%r12), %rdi
testq %rdi, %rdi
je 0x2553f
cmpq $0x0, 0x10(%r12)
je 0x2553f
movb $0x1, 0x2f4(%rbx)
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e12
movl 0x20(%rbx), %eax
movl %eax, 0x2f8(%rbx)
movl %eax, 0x2fc(%rbx)
movq 0x10(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e4a
movl $0x0, 0x20(%rbx)
movb $0x0, 0x2f4(%rbx)
movq $0x0, 0x2f8(%rbx)
jmp 0x2555f
testq %rdi, %rdi
setne %al
movq 0x10(%r12), %rdi
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x2555f
movq %r14, %rsi
movq %rbx, %rdx
callq 0x20e4a
movslq 0x310(%rbx), %rax
movl 0x5fc(%rbx,%rax,4), %eax
cmpl $0x1, %eax
adcl $0x0, %eax
movl %eax, 0x13e8c(%rbx)
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
leaq 0x12772(%rip), %rsi     # 0x37d19
movl $0x7, %edx
movq %rax, %rdi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r12
leaq 0x11f0b(%rip), %rsi     # 0x374f0
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %r12, %rdi
callq 0x73a0
cvtsi2sdl 0x258(%rbx), %xmm0
callq 0x7600
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x25621
jnp 0x25677
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r12
leaq 0x126cf(%rip), %rsi     # 0x37d21
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
xorps %xmm0, %xmm0
cvtsi2sdl 0x258(%rbx), %xmm0
callq 0x7600
movq %r12, %rdi
callq 0x7540
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r12
leaq 0x11e74(%rip), %rsi     # 0x3751c
movl $0x7, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %r12, %rdi
callq 0x73a0
leaq 0x12658(%rip), %rsi     # 0x37d2a
movl $0x9, %edx
movq %rax, %rdi
callq 0x73a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r12
leaq 0x12624(%rip), %rsi     # 0x37d34
movl $0x7, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %r12, %rdi
callq 0x73a0
movq %rax, %r12
leaq 0x124c0(%rip), %rsi     # 0x37bfd
movl $0x2, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x13e8c(%rbx), %esi
imull 0x258(%rbx), %esi
movq %r12, %rdi
callq 0x75c0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq 0x260(%rbx), %rsi
movq 0x268(%rbx), %rdx
movq %rax, %rdi
callq 0x73a0
leaq 0x11c73(%rip), %rsi     # 0x37416
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x10(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x259a4
movl 0x13e8c(%rbx), %eax
cmpl 0x13e80(%rbx), %eax
jle 0x254b6
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r14
leaq 0x1253a(%rip), %rsi     # 0x37d3c
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x13e8c(%rbx), %esi
subl 0x13e80(%rbx), %esi
imull 0x258(%rbx), %esi
movq %r14, %rdi
callq 0x75c0
jmp 0x254b6
cmpl $0x4, %eax
jne 0x2585f
leaq 0x2b0(%rbx), %rdi
leaq 0x11d43(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x2585f
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x124f2(%rip), %rsi     # 0x37d4f
jmp 0x258b9
cmpl $0x4, 0x258(%rbx)
jne 0x25883
leaq 0x2b0(%rbx), %rdi
leaq 0x11d0f(%rip), %rsi     # 0x37585
callq 0x70c0
testl %eax, %eax
je 0x2596e
movl 0x258(%rbx), %eax
cmpl $0x1, %eax
je 0x258a7
cmpl $0x2, %eax
jne 0x258d0
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x124bb(%rip), %rsi     # 0x37d60
jmp 0x258b9
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x124af(%rip), %rsi     # 0x37d68
movl $0x7, %edx
movq %rax, %rdi
callq 0x73a0
movq %r15, %rdi
xorl %esi, %esi
callq 0x75c0
movslq 0x310(%rbx), %rax
cmpq $0x14, %rax
jg 0x258fe
leaq (%rbx,%rax,4), %rdi
addq $0x5f8, %rdi            # imm = 0x5F8
movl $0x14, %ecx
subl %eax, %ecx
leaq 0x4(,%rcx,4), %rdx
xorl %esi, %esi
callq 0x71d0
movl 0x13e8c(%rbx), %eax
cmpl 0x13e80(%rbx), %eax
jle 0x254bd
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x7300
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x7220
movq %rax, %r14
leaq 0x123fb(%rip), %rsi     # 0x37d3c
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x13e8c(%rbx), %esi
subl 0x13e80(%rbx), %esi
imull 0x258(%rbx), %esi
movq %r14, %rdi
callq 0x75c0
jmp 0x254bd
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x123d7(%rip), %rsi     # 0x37d57
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
movq %r15, %rdi
xorl %esi, %esi
callq 0x75c0
movb $0x0, 0x340(%rbx)
jmp 0x258d0
nop