// File: /workspace/github_cpp_makefile_star2_O3/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 0x1997(%rip), %rsi      # 0x4321
leaq 0x1997(%rip), %rdx      # 0x4328
leaq -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x30c8
movq (%rbx), %rax
movsbl (%rax), %esi
movq %r14, %rdi
callq 0x2100
leaq 0x1977(%rip), %rsi      # 0x4329
leaq -0x68(%rbp), %rdi
callq 0x2250
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x196a(%rip), %rsi      # 0x4334
leaq 0x197a(%rip), %rdx      # 0x434b
leaq -0x48(%rbp), %rdi
callq 0x30c8
cmpq $0x4, 0x8(%rbx)
jb 0x2bcb
movl $0x1, %r13d
movl $0x3, %r14d
leaq -0x48(%rbp), %r15
movl $0x1, %r12d
movq (%rbx), %rax
movzbl (%rax,%r14), %eax
cmpl $0x5e, %eax
je 0x2b8b
cmpl $0x7c, %eax
jne 0x2a50
movq %r15, %rdi
leaq 0x1931(%rip), %rsi      # 0x434c
callq 0x2250
cmpl $0x2, %r13d
jl 0x2a36
movq %r15, %rdi
movl $0x7d, %esi
callq 0x2100
decl %r13d
movl $0x1, %r12d
movq %r15, %rdi
leaq 0x1962(%rip), %rsi      # 0x43a8
callq 0x2250
jmp 0x2b8b
movsbl %al, %edi
callq 0x3370
testl %eax, %eax
je 0x2acc
testl %r12d, %r12d
je 0x2b5a
movq %r15, %rdi
leaq 0x1988(%rip), %rsi      # 0x43f7
callq 0x2250
movq %r15, %rdi
leaq 0x198e(%rip), %rsi      # 0x440c
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
movq %r15, %rdi
leaq 0x1966(%rip), %rsi      # 0x4403
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
movq %r15, %rdi
leaq 0x1952(%rip), %rsi      # 0x440e
callq 0x2250
incl %r13d
xorl %r12d, %r12d
jmp 0x2b8b
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
movq %r15, %rdi
leaq 0x192c(%rip), %rsi      # 0x4412
callq 0x2250
movq (%rbx), %rsi
addq %r14, %rsi
leaq 0x36e0(%rip), %rdi      # 0x61d8
callq 0x2f90
cmpl $0x0, (%rax)
jne 0x2b8b
leaq 0x36ab(%rip), %rdi      # 0x61b8
leaq 0x180f(%rip), %rsi      # 0x4323
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
leaq 0x3690(%rip), %rdi      # 0x61b8
callq 0x2100
leaq 0x3684(%rip), %rdi      # 0x61b8
leaq 0x18db(%rip), %rsi      # 0x4416
callq 0x2250
movq (%rbx), %rsi
addq %r14, %rsi
leaq 0x368b(%rip), %rdi      # 0x61d8
callq 0x2f90
movl $0x1, (%rax)
jmp 0x2b8b
movq %r15, %rdi
leaq 0x18a2(%rip), %rsi      # 0x4406
callq 0x2250
movq (%rbx), %rax
movsbl (%rax,%r14), %esi
movq %r15, %rdi
callq 0x2100
xorl %r12d, %r12d
movq %r15, %rdi
leaq 0x1888(%rip), %rsi      # 0x440e
callq 0x2250
incq %r14
cmpq %r14, 0x8(%rbx)
ja 0x29fb
cmpl $0x1, %r13d
jle 0x2bcb
leaq 0x17a7(%rip), %rsi      # 0x434c
leaq -0x48(%rbp), %rdi
callq 0x2250
leaq 0x1769(%rip), %rbx      # 0x431e
leaq -0x48(%rbp), %r14
decl %r13d
je 0x2bcb
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2250
jmp 0x2bb9
leaq -0x98(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x183e(%rip), %rsi      # 0x441b
leaq 0x1846(%rip), %rdx      # 0x442a
leaq -0xa8(%rbp), %rdi
callq 0x30c8
leaq -0xc8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x2ff8
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 0x2c45
movq %rdx, -0x88(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x78(%rbp)
jmp 0x2c4c
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 0x3527(%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 0x2cab
movq %rdx, -0xe8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xd8(%rbp)
jmp 0x2cb3
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 0x34c0(%rip), %rdi      # 0x6198
movq %rbx, %rsi
callq 0x2190
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x2cf7
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x2d0f
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2150
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d2e
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2d49
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d62
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2d7b
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 0x2dfb
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x2daf
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2daf
movq %rax, %rbx
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2dd3
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2dd3
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2dfe
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x2dfe
jmp 0x2dfb
jmp 0x2df4
movq %rax, %rbx
jmp 0x2e17
jmp 0x2dfb
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2e17
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2150
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2e30
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2150
movq %rbx, %rdi
callq 0x2230