// File: /workspace/github_cpp_makefile_star2_O1/kiranbhanushali[P]recursive-descent-parser-generator/template.cpp
// Function: generate_template(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void generate_template(string line){

    string function_template_begin = R"(
 void )" ;
    function_template_begin+=line[0] ;
    function_template_begin+= R"( () {
    )";
    
    string function = " int temp_pos = pos ;\n ";
    int if_stmt = 1 ,open_bracket = 1;
    for( int i =3;i<line.size();i++){
        if( line[i] =='|') {
            function += R"(
                if( cur=='$'){
                    return ;
                }
            )";
            if(open_bracket>1) {
                function+='}';
                open_bracket--;
            }
            
            function+=R"(
                pos = temp_pos;
                cur = line[pos];
            )";
            if_stmt = 1;
            continue;
        }
        
        // null symbol
        if(line[i]=='^'){
            continue;
        }
        
       if( isTerminal(line[i])){
            // matches statement 
            
            if( if_stmt) {
                function+= " if( cur== " ;
                function+=  "'" ;
                function+= line[i] ;
                function +=  "'){"
                                "match('" ;
                function+= line[i];
                function+= "');";
                if_stmt = 0 ; 
                open_bracket++;
            }
            else{
                function+= "match('" ;
                function+= line[i];
               function += "');";
            }
        }else{
            function +=  line[i];
            function += "();";
            if(!function_declaration_mp[line[i]]){
                funct_declaration+= "void ";
                funct_declaration+= line[i];
                funct_declaration+="();\n";
                function_declaration_mp[line[i]] = 1;
            }
        }

    }
    if(open_bracket>1)
    {
        open_bracket--;
        function+=R"(
                if( cur=='$'){
                    return ;
                }
            )";
        while(open_bracket--)
        function+="}\n";
    }


    string end_block = R"(
        }
    )";


    output_funct = function_template_begin + function + end_block + output_funct;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x199b(%rip), %rsi      # 0x4321
leaq 0x199b(%rip), %rdx      # 0x4328
leaq -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x30c4
movq (%rbx), %rax
movsbl (%rax), %esi
movq %r14, %rdi
callq 0x2100
leaq 0x197b(%rip), %rsi      # 0x4329
leaq -0x68(%rbp), %rdi
callq 0x2250
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x196e(%rip), %rsi      # 0x4334
leaq 0x197e(%rip), %rdx      # 0x434b
leaq -0x48(%rbp), %rdi
callq 0x30c4
movl $0x1, %r13d
cmpq $0x4, 0x8(%rbx)
jb 0x2b94
movl $0x3, %r14d
leaq -0x48(%rbp), %r15
movl $0x1, %r12d
movq (%rbx), %rax
movzbl (%rax,%r14), %eax
cmpl $0x5e, %eax
je 0x2b87
cmpl $0x7c, %eax
jne 0x2a4c
movq %r15, %rdi
leaq 0x1935(%rip), %rsi      # 0x434c
callq 0x2250
cmpl $0x2, %r13d
jl 0x2a32
movq %r15, %rdi
movl $0x7d, %esi
callq 0x2100
decl %r13d
movl $0x1, %r12d
movq %r15, %rdi
leaq 0x1966(%rip), %rsi      # 0x43a8
callq 0x2250
jmp 0x2b87
movsbl %al, %edi
callq 0x3374
testl %eax, %eax
je 0x2ac8
testl %r12d, %r12d
je 0x2b56
movq %r15, %rdi
leaq 0x198c(%rip), %rsi      # 0x43f7
callq 0x2250
movq %r15, %rdi
leaq 0x1992(%rip), %rsi      # 0x440c
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
movq %r15, %rdi
leaq 0x196a(%rip), %rsi      # 0x4403
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
movq %r15, %rdi
leaq 0x1956(%rip), %rsi      # 0x440e
callq 0x2250
incl %r13d
xorl %r12d, %r12d
jmp 0x2b87
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
movq %r15, %rdi
leaq 0x1930(%rip), %rsi      # 0x4412
callq 0x2250
movq (%rbx), %rsi
addq %r14, %rsi
leaq 0x36e4(%rip), %rdi      # 0x61d8
callq 0x2f8c
cmpl $0x0, (%rax)
jne 0x2b87
leaq 0x36af(%rip), %rdi      # 0x61b8
leaq 0x1813(%rip), %rsi      # 0x4323
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
leaq 0x3694(%rip), %rdi      # 0x61b8
callq 0x2100
leaq 0x3688(%rip), %rdi      # 0x61b8
leaq 0x18df(%rip), %rsi      # 0x4416
callq 0x2250
movq (%rbx), %rsi
addq %r14, %rsi
leaq 0x368f(%rip), %rdi      # 0x61d8
callq 0x2f8c
movl $0x1, (%rax)
jmp 0x2b87
movq %r15, %rdi
leaq 0x18a6(%rip), %rsi      # 0x4406
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
xorl %r12d, %r12d
movq %r15, %rdi
leaq 0x188c(%rip), %rsi      # 0x440e
callq 0x2250
incq %r14
cmpq %r14, 0x8(%rbx)
ja 0x29f7
cmpl $0x1, %r13d
jle 0x2bc7
leaq 0x17ab(%rip), %rsi      # 0x434c
leaq -0x48(%rbp), %rdi
callq 0x2250
leaq 0x176d(%rip), %rbx      # 0x431e
leaq -0x48(%rbp), %r14
decl %r13d
je 0x2bc7
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2250
jmp 0x2bb5
leaq -0x98(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x1842(%rip), %rsi      # 0x441b
leaq 0x184a(%rip), %rdx      # 0x442a
leaq -0xa8(%rbp), %rdi
callq 0x30c4
leaq -0xc8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x2ff3
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x2060
leaq -0x78(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2c41
movq %rdx, -0x88(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x78(%rbp)
jmp 0x2c48
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq -0x88(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x352b(%rip), %rax      # 0x6198
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x2060
leaq -0xd8(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2ca7
movq %rdx, -0xe8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xd8(%rbp)
jmp 0x2caf
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0xe8(%rbp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x34c4(%rip), %rdi      # 0x6198
movq %rbx, %rsi
callq 0x2190
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x2cf3
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x2d0b
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2150
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d2a
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2d45
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d5e
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2d77
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2150
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2df7
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x2dab
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2dab
movq %rax, %rbx
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2dcf
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2dcf
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2dfa
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2dfa
jmp 0x2df7
jmp 0x2df0
movq %rax, %rbx
jmp 0x2e13
jmp 0x2df7
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2e13
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2e2c
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2150
movq %rbx, %rdi
callq 0x2230