// File: /workspace/github_cpp_makefile_star2_O3/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, %r13
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 0x2380
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 -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb %bl, (%rax)
leaq 0x36ee(%rip), %rsi      # 0xb2d0
leaq -0x48(%rbp), %rdi
callq 0x23b0
movq 0x80(%r13), %r12
movq 0x98(%r13), %rbx
movq %r13, -0x50(%rbp)
movq 0xa0(%r13), %rax
addq $-0x60, %rax
movq %r12, -0x60(%rbp)
cmpq %rax, %rbx
je 0x7ceb
leaq -0x48(%rbp), %r15
leaq 0x36d6(%rip), %r13      # 0xb2f6
movq %r15, %rdi
leaq 0x36c5(%rip), %rsi      # 0xb2ef
callq 0x23b0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r15, %rdi
callq 0x2090
cmpl $0x0, 0x40(%rbx)
jle 0x7c88
movq %r15, %rdi
leaq 0x3499(%rip), %rsi      # 0xb0e8
callq 0x23b0
cmpl $0x0, 0x40(%rbx)
jle 0x7c88
movq 0x48(%rbx), %r14
xorl %r12d, %r12d
movq %r15, %rdi
movq %r13, %rsi
callq 0x23b0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x2090
addq $0x20, %r14
incl %r12d
cmpl 0x40(%rbx), %r12d
jl 0x7c61
movq %r15, %rdi
leaq 0x366c(%rip), %rsi      # 0xb2fe
callq 0x23b0
movq %r15, %rdi
leaq 0x3660(%rip), %rsi      # 0xb301
callq 0x23b0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r15, %rdi
callq 0x2090
movq %r15, %rdi
leaq 0x364e(%rip), %rsi      # 0xb30d
callq 0x23b0
addq $0x60, %rbx
movq -0x50(%rbp), %rax
movq 0xa0(%rax), %rax
addq $-0x60, %rax
cmpq %rax, %rbx
jne 0x7c20
movq -0x50(%rbp), %rax
movq 0x80(%rax), %r12
leaq -0x48(%rbp), %r14
leaq 0x3538(%rip), %r15      # 0xb22e
leaq 0x3376(%rip), %r13      # 0xb073
leaq 0x78(%r12), %rbx
movq -0x50(%rbp), %rax
cmpq 0x88(%rax), %rbx
je 0x7e16
movq 0xb8(%r12), %rsi
movq 0xc0(%r12), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
movq %r15, %rsi
callq 0x23b0
movq 0x98(%r12), %rsi
movq 0xa0(%r12), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x3371(%rip), %rsi      # 0xb0c9
callq 0x23b0
movq %rbx, -0x58(%rbp)
movq 0xd8(%r12), %rbx
cmpq 0xe0(%r12), %rbx
je 0x7dae
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
movq %r15, %rsi
callq 0x23b0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
movq %r13, %rsi
callq 0x23b0
addq $0x40, %rbx
jmp 0x7d69
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpb $0x2c, -0x1(%rax,%rcx)
jne 0x7dc8
movb $0x29, -0x1(%rax,%rcx)
movq -0x58(%rbp), %rbx
jmp 0x7ddb
movq %r14, %rdi
leaq 0x3247(%rip), %rsi      # 0xb019
callq 0x23b0
movq -0x58(%rbp), %rbx
movq %r14, %rdi
leaq 0x352d(%rip), %rsi      # 0xb312
callq 0x23b0
movq 0x78(%r12), %rsi
movq 0x80(%r12), %rdx
movq %r14, %rdi
callq 0x2090
movq %r14, %rdi
leaq 0x350d(%rip), %rsi      # 0xb316
callq 0x23b0
movq %rbx, %r12
jmp 0x7cfd
movq -0x60(%rbp), %r13
movq 0x40(%r13), %rsi
movq 0x48(%r13), %rdx
leaq -0x48(%rbp), %rdi
callq 0x2090
leaq 0x33fc(%rip), %rsi      # 0xb22e
leaq -0x48(%rbp), %rdi
callq 0x23b0
movq 0x20(%r13), %rsi
movq 0x28(%r13), %rdx
leaq -0x48(%rbp), %rdi
callq 0x2090
leaq 0x3276(%rip), %rsi      # 0xb0c9
leaq -0x48(%rbp), %rdi
callq 0x23b0
movq 0x60(%r13), %r12
cmpq 0x68(%r13), %r12
je 0x7ebb
leaq -0x48(%rbp), %rbx
leaq 0x33bd(%rip), %r14      # 0xb22e
leaq 0x31fb(%rip), %r15      # 0xb073
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq %rbx, %rdi
callq 0x2090
movq %rbx, %rdi
movq %r14, %rsi
callq 0x23b0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
callq 0x2090
movq %rbx, %rdi
movq %r15, %rsi
callq 0x23b0
addq $0x40, %r12
cmpq 0x68(%r13), %r12
jne 0x7e78
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpb $0x2c, -0x1(%rax,%rcx)
jne 0x7ed1
movb $0x29, -0x1(%rax,%rcx)
jmp 0x7ee1
leaq 0x3141(%rip), %rsi      # 0xb019
leaq -0x48(%rbp), %rdi
callq 0x23b0
leaq 0x342a(%rip), %rsi      # 0xb312
leaq -0x48(%rbp), %rdi
callq 0x23b0
movq (%r13), %rsi
movq 0x8(%r13), %rdx
leaq -0x48(%rbp), %rdi
callq 0x2090
leaq 0x340d(%rip), %rsi      # 0xb316
leaq -0x48(%rbp), %rdi
callq 0x23b0
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0x260(%rbp), %rdi
callq 0x2250
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x7f38
callq 0x21c0
movq 0x7089(%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 0x7f8c
jmp 0x7f8c
jmp 0x7f8c
jmp 0x7f8c
jmp 0x7f8c
jmp 0x7f8c
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x7fa1
callq 0x21c0
leaq -0x260(%rbp), %rdi
callq 0x22e0
movq %rbx, %rdi
callq 0x2370
nopl (%rax)