// File: /workspace/github_cpp_makefile_star2_O1/nikhilYadala[P]Python_to_cpp/Source/src/render_code.cpp
// Function: source_code::render_code()
void source_code::render_code()
{
	int s=strlen(file_name);
	char *file_to_write=(char *)malloc(s+5);
	*file_to_write='\0';
	strcat(file_to_write,file_name);
	strcat(file_to_write,".cpp\0");
	

	std::ofstream cpp_file(file_to_write);

	
	std::string decl;
	decl.append("#include \"supporting_libs.h\"\n\n");

	std::vector< std::pair< std::string,function_declaration > >::iterator itr = generated_cpp_code.begin();



//code for rendering the cpp classes

  for(std::vector<std::pair <std::string,class_declaration > >
   			::iterator class_itr=generated_cpp_classes.begin();
   			 class_itr!=generated_cpp_classes.end()-1;
   			 class_itr++)
   {
   		decl.append("class ");
   		decl.append((class_itr->second).name);
   		//attach the inherited functions here
   		if((class_itr->second).num_base_func >0)
   		{
   			decl.append(": ");
   			std::vector< std::string >::iterator base_functions_itr = (class_itr->second).base_functions.begin();
   			for(int k=0;k<(class_itr->second).num_base_func;k++)
   			{
   				decl.append("public ");
   				decl.append(*(base_functions_itr));
   				base_functions_itr++;


   			}
   		}
   		decl.append("\n{");
   		decl.append("\n public: \n");
   		decl.append(class_itr->first);
   		decl.append("\n};\n");
   }


// For remaining functions iterate over the generated_cpp_code vec	tor
	for(std::vector< std::pair< std::string,function_declaration > >::iterator itr=generated_cpp_code.begin()+1;itr!=generated_cpp_code.end();++itr)
		{
			 decl.append(itr->second.return_type);
			 decl.append(" ");
			 decl.append(itr->second.name);
			 decl.append("(");
			 for(std::vector< string_pair >::iterator i=itr->second.args.begin();i!=itr->second.args.end();++i)
			 {
			 	decl.append(i->second);
			 	decl.append(" ");
			 	decl.append(i->first);
			 	decl.append(",");
			 }
			 if(*(decl.end()-1) == ',')
			 	*(decl.end()-1)=')';
			 else  decl.append(")");
			 
			decl.append("\n{\n");
			decl.append(itr->first);
			decl.append("\n}\n\n");

		}

			// For main function 
		    	decl.append(itr->second.return_type);
			 decl.append(" ");
			 decl.append(itr->second.name);
			 decl.append("(");
			 for(std::vector< string_pair >::iterator i=itr->second.args.begin();i!=itr->second.args.end();++i)
			 {
			 	decl.append(i->second);
			 	decl.append(" ");
			 	decl.append(i->first);
			 	decl.append(",");
			 }
			 if(*(decl.end()-1) == ',')
			 	*(decl.end()-1)=')';
			 else  decl.append(")");
			 
			decl.append("\n{\n");
			decl.append(itr->first);
			decl.append("\n}\n\n");


		cpp_file<<decl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %r12
movq 0x30(%rdi), %r14
movq %r14, %rdi
callq 0x20d0
addl $0x5, %eax
movslq %eax, %rdi
callq 0x22a0
movq %rax, %r15
xorl %ebx, %ebx
movb %bl, (%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2390
movq %r15, %rdi
callq 0x20d0
movb %bl, 0x4(%r15,%rax)
movl $0x7070632e, (%r15,%rax) # imm = 0x7070632E
leaq -0x260(%rbp), %rdi
movq %r15, %rsi
movl $0x10, %edx
callq 0x2230
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb %bl, (%rax)
leaq 0x363a(%rip), %rsi      # 0xb2d0
leaq -0x50(%rbp), %rdi
callq 0x23c0
movq 0x80(%r12), %rax
movq %rax, -0x30(%rbp)
movq 0x98(%r12), %rbx
movq %r12, -0x58(%rbp)
movq 0xa0(%r12), %rax
addq $-0x60, %rax
cmpq %rax, %rbx
je 0x7d97
leaq -0x50(%rbp), %r15
leaq 0x361f(%rip), %r13      # 0xb2f6
movq %r15, %rdi
leaq 0x360e(%rip), %rsi      # 0xb2ef
callq 0x23c0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r15, %rdi
callq 0x2090
cmpl $0x0, 0x40(%rbx)
jle 0x7d3f
movq %r15, %rdi
leaq 0x33e2(%rip), %rsi      # 0xb0e8
callq 0x23c0
cmpl $0x0, 0x40(%rbx)
jle 0x7d3f
movq 0x48(%rbx), %r14
xorl %r12d, %r12d
movq %r15, %rdi
movq %r13, %rsi
callq 0x23c0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x2090
addq $0x20, %r14
incl %r12d
cmpl 0x40(%rbx), %r12d
jl 0x7d18
movq %r15, %rdi
leaq 0x35b5(%rip), %rsi      # 0xb2fe
callq 0x23c0
movq %r15, %rdi
leaq 0x35a9(%rip), %rsi      # 0xb301
callq 0x23c0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %rdi
callq 0x2090
movq %r15, %rdi
leaq 0x3597(%rip), %rsi      # 0xb30d
callq 0x23c0
addq $0x60, %rbx
movq -0x58(%rbp), %rax
movq 0xa0(%rax), %rax
addq $-0x60, %rax
cmpq %rax, %rbx
jne 0x7cd7
movq -0x58(%rbp), %rax
movq 0x80(%rax), %r12
leaq -0x50(%rbp), %r14
leaq 0x3481(%rip), %r15      # 0xb22e
leaq 0x32bf(%rip), %r13      # 0xb073
leaq 0x78(%r12), %rbx
movq -0x58(%rbp), %rax
cmpq 0x88(%rax), %rbx
je 0x7ecd
movq 0xb8(%r12), %rsi
movq 0xc0(%r12), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
movq %r15, %rsi
callq 0x23c0
movq 0x98(%r12), %rsi
movq 0xa0(%r12), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x32ba(%rip), %rsi      # 0xb0c9
callq 0x23c0
movq %rbx, -0x60(%rbp)
movq 0xd8(%r12), %rbx
cmpq 0xe0(%r12), %rbx
je 0x7e65
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
movq %r15, %rsi
callq 0x23c0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
movq %r13, %rsi
callq 0x23c0
addq $0x40, %rbx
jmp 0x7e20
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpb $0x2c, -0x1(%rax,%rcx)
jne 0x7e7f
movb $0x29, -0x1(%rax,%rcx)
movq -0x60(%rbp), %rbx
jmp 0x7e92
movq %r14, %rdi
leaq 0x3190(%rip), %rsi      # 0xb019
callq 0x23c0
movq -0x60(%rbp), %rbx
movq %r14, %rdi
leaq 0x3476(%rip), %rsi      # 0xb312
callq 0x23c0
movq 0x78(%r12), %rsi
movq 0x80(%r12), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x3456(%rip), %rsi      # 0xb316
callq 0x23c0
movq %rbx, %r12
jmp 0x7db4
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq 0x3345(%rip), %rsi      # 0xb22e
leaq -0x50(%rbp), %rdi
callq 0x23c0
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq 0x31bb(%rip), %rsi      # 0xb0c9
leaq -0x50(%rbp), %rdi
callq 0x23c0
movq -0x30(%rbp), %rax
movq 0x60(%rax), %r12
cmpq 0x68(%rax), %r12
je 0x7f7e
leaq -0x50(%rbp), %rbx
leaq 0x32fe(%rip), %r14      # 0xb22e
leaq 0x313c(%rip), %r15      # 0xb073
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq %rbx, %rdi
callq 0x2090
movq %rbx, %rdi
movq %r14, %rsi
callq 0x23c0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
callq 0x2090
movq %rbx, %rdi
movq %r15, %rsi
callq 0x23c0
addq $0x40, %r12
movq -0x30(%rbp), %rax
cmpq 0x68(%rax), %r12
jne 0x7f37
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpb $0x2c, -0x1(%rax,%rcx)
jne 0x7f94
movb $0x29, -0x1(%rax,%rcx)
jmp 0x7fa4
leaq 0x307e(%rip), %rsi      # 0xb019
leaq -0x50(%rbp), %rdi
callq 0x23c0
leaq 0x3367(%rip), %rsi      # 0xb312
leaq -0x50(%rbp), %rdi
callq 0x23c0
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq 0x3347(%rip), %rsi      # 0xb316
leaq -0x50(%rbp), %rdi
callq 0x23c0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x260(%rbp), %rdi
callq 0x2250
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x7ffe
callq 0x21c0
movq 0x6fc3(%rip), %rax      # 0xefc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x258(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x260(%rbp,%rcx)
callq 0x2190
leaq -0x168(%rbp), %rdi
callq 0x20a0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8052
jmp 0x8052
jmp 0x8052
jmp 0x8052
jmp 0x8052
jmp 0x8052
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x8067
callq 0x21c0
leaq -0x260(%rbp), %rdi
callq 0x22e0
movq %rbx, %rdi
callq 0x2380
nop