// File: /workspace/github_cpp_makefile_star2_O3/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 0x2496b
addl $0x4, 0x308(%rbx)
jmp 0x2498b
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 0x8(%r15), %r12
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x24a47
testq %r12, %r12
je 0x2525e
movb $0x1, %al
movb %al, 0x217(%rbx)
movb %al, 0x300(%rbx)
cmpb $0x0, 0x218(%rbx)
jne 0x249c9
cmpb $0x1, 0x13e7c(%rbx)
jne 0x24af6
movq %r14, %rsi
movq %rbx, %rdx
callq 0x252ae
movb $0x1, 0x1d2(%rbx)
movq 0x8(%r15), %r15
movq 0x8(%r15), %rdi
movq 0x10(%r15), %rax
testq %rdi, %rdi
je 0x24ad0
testq %rax, %rax
je 0x24ae3
movb $0x1, 0x2f4(%rbx)
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2068c
movl 0x20(%rbx), %eax
movl %eax, 0x2f8(%rbx)
movl %eax, 0x2fc(%rbx)
movq 0x10(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x206f4
movl $0x0, 0x20(%rbx)
movb $0x0, 0x2f4(%rbx)
movq $0x0, 0x2f8(%rbx)
jmp 0x24ae3
testq %r12, %r12
je 0x2525e
xorl %eax, %eax
movb %al, 0x217(%rbx)
movb %al, 0x300(%rbx)
movb $0x1, 0x1d2(%rbx)
movq 0x8(%r12), %rdi
movq 0x10(%r12), %rax
testq %rdi, %rdi
je 0x24b6b
testq %rax, %rax
je 0x24b7e
movb $0x1, 0x2f4(%rbx)
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2068c
movl 0x20(%rbx), %eax
movl %eax, 0x2f8(%rbx)
movl %eax, 0x2fc(%rbx)
movq 0x10(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x206f4
movl $0x0, 0x20(%rbx)
movb $0x0, 0x2f4(%rbx)
movq $0x0, 0x2f8(%rbx)
jmp 0x24b7e
testq %rax, %rax
je 0x24ae3
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x206f4
movb $0x0, 0x1d2(%rbx)
movb $0x0, 0x217(%rbx)
jmp 0x2525e
movl $0x0, 0x13e80(%rbx)
movq 0x8(%r12), %rdi
movq 0x10(%r12), %rax
testq %rdi, %rdi
je 0x24e44
testq %rax, %rax
je 0x24e57
movb $0x1, 0x2f4(%rbx)
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2068c
movl 0x20(%rbx), %eax
movl %eax, 0x2f8(%rbx)
movl %eax, 0x2fc(%rbx)
movq 0x10(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x206f4
movl $0x0, 0x20(%rbx)
movb $0x0, 0x2f4(%rbx)
movq $0x0, 0x2f8(%rbx)
jmp 0x24e57
testq %rax, %rax
je 0x24b7e
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x206f4
movb $0x0, 0x1d2(%rbx)
cmpb $0x0, 0x218(%rbx)
jne 0x2525e
cmpb $0x0, 0x13e7c(%rbx)
jne 0x2525e
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 0x13128(%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 0x128c1(%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 0x24c6b
jnp 0x24cc1
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 0x13085(%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 0x1282a(%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 0x1300e(%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 0x12fda(%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 0x12e76(%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 0x12629(%rip), %rsi     # 0x37416
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movl 0x258(%rbx), %eax
cmpl $0x5, %eax
jl 0x25127
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 0x12f0b(%rip), %rsi     # 0x37d45
movl $0x9, %edx
jmp 0x251b7
testq %rax, %rax
je 0x24e57
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x206f4
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 0x12e7a(%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 0x12613(%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 0x24f19
jnp 0x24f6f
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 0x12dd7(%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 0x1257c(%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 0x12d60(%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 0x12d2c(%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 0x12bc8(%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 0x1237b(%rip), %rsi     # 0x37416
movl $0x1, %edx
movq %rax, %rdi
callq 0x73a0
movq 0x10(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x252ae
movl 0x13e8c(%rbx), %eax
cmpl 0x13e80(%rbx), %eax
jle 0x24aea
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 0x12c42(%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 0x24aea
cmpl $0x4, %eax
jne 0x25182
leaq 0x2b0(%rbx), %r15
leaq 0x1244b(%rip), %rsi     # 0x37585
movq %r15, %rdi
callq 0x70c0
testl %eax, %eax
je 0x2515a
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x12bf7(%rip), %rsi     # 0x37d4f
jmp 0x251b2
movl 0x258(%rbx), %eax
cmpl $0x4, %eax
jne 0x25182
leaq 0x12419(%rip), %rsi     # 0x37585
movq %r15, %rdi
callq 0x70c0
testl %eax, %eax
je 0x25278
movl 0x258(%rbx), %eax
cmpl $0x1, %eax
je 0x251a0
cmpl $0x2, %eax
jne 0x251c9
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x12bc2(%rip), %rsi     # 0x37d60
jmp 0x251b2
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x12bb6(%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 0x251f7
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 0x2525e
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 0x12b06(%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
xorl %eax, %eax
movb %al, 0x219(%rbx)
movb %al, 0x340(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x7180
movq %rax, %r15
leaq 0x12acd(%rip), %rsi     # 0x37d57
movl $0x8, %edx
movq %rax, %rdi
callq 0x73a0
movq %r15, %rdi
xorl %esi, %esi
callq 0x75c0
movb $0x0, 0x340(%rbx)
jmp 0x251c9
nop