// File: /workspace/github_cpp_makefile_star2_O3/nikhilYadala[P]Python_to_cpp/Source/src/functionize.cpp
// Function: self_sanitize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
void self_sanitize(std::string* code) {
	int itr = code->find("self.", 0);
    while(itr != std::string::npos) {
        code->replace(itr, 5, ""); 
        itr = code->find("self.", itr);
    }

    itr = code->find("self", 0);
    while(itr != std::string::npos) {
        code->replace(itr, 4, ""); 
        itr = code->find("self", itr);
    }

    itr = code->find("import re", 0);
    while(itr != std::string::npos) {
        code->replace(itr, 9, ""); 
        itr = code->find("self", itr);
    }

    int rem = code->find("re.search(");
    if(rem!=std::string::npos){
    itr =  code->find("re.search(")+10;
    	// std::cout<<">>>>>>>>>>>"<<itr<<"  "<<"\n";
    while(*(code->begin()+itr)==' ')
    	itr++;


    std::string s ="",r="";
    while(*(code->begin()+itr)!=','){
    	r.push_back(*(code->begin()+itr));
    	itr++;
    }
    itr++;

    while(*(code->begin()+itr)!=')'){
    	s.push_back(*(code->begin()+itr));
    	itr++;
    }
    rem=itr-rem+1;
       itr = code->find("re.search(", 0);
    while(itr != std::string::npos) {
        code->replace(itr, rem, "std::regex_match("+s+",std::regex("+r+"))"); 
        itr = code->find("re.search(", itr);
    	}
	}
	// if(std::find(tokens.begin(), tokens.end(),"re.search")!=tokens.end())
	// {
	// 	converted_code.append((size_t)lines[i].second*tab_size,' ');	
	// 	converted_code.append("bool "+v+" = std::regex_match("+*(itr+8)+", std::regex_match("+*(itr+6)+"))"+"\n");		

	// }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
leaq 0x56ad(%rip), %rsi      # 0xb1d9
movl $0x5, %ecx
xorl %edx, %edx
callq 0x2360
movq %rax, %r14
shlq $0x20, %r14
cmpq %r13, %r14
je 0x5b8b
leaq 0x56d3(%rip), %r15      # 0xb21e
leaq 0x5687(%rip), %r12      # 0xb1d9
sarq $0x20, %r14
movl $0x5, %edx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x2240
movl $0x5, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2360
movq %rax, %r14
shlq $0x20, %r14
cmpq %r13, %r14
jne 0x5b52
leaq 0x564d(%rip), %rsi      # 0xb1df
movl $0x4, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2360
movq %rax, %r14
shlq $0x20, %r14
cmpq %r13, %r14
je 0x5bf4
leaq 0x566a(%rip), %r15      # 0xb21e
leaq 0x5624(%rip), %r12      # 0xb1df
sarq $0x20, %r14
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x2240
movl $0x4, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2360
movq %rax, %r14
shlq $0x20, %r14
cmpq %r13, %r14
jne 0x5bbb
leaq 0x55e9(%rip), %rsi      # 0xb1e4
movl $0x9, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2360
movq %rax, %r14
shlq $0x20, %r14
cmpq %r13, %r14
je 0x5c5d
leaq 0x5601(%rip), %r15      # 0xb21e
leaq 0x55bb(%rip), %r12      # 0xb1df
sarq $0x20, %r14
movl $0x9, %edx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x2240
movl $0x4, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2360
movq %rax, %r14
shlq $0x20, %r14
cmpq %r13, %r14
jne 0x5c24
leaq 0x558a(%rip), %rsi      # 0xb1ee
movl $0xa, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2360
cmpl $-0x1, %eax
je 0x5fbe
movq %rax, -0xb0(%rbp)
movabsq $0x100000000, %r12      # imm = 0x100000000
leaq 0x555a(%rip), %rsi      # 0xb1ee
movl $0xa, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2360
movq (%rbx), %rcx
shlq $0x20, %rax
movq %r13, %rdx
movabsq $0xa00000000, %r13      # imm = 0xA00000000
addq %rax, %r13
movq %r13, %r15
sarq $0x20, %r15
addq %rdx, %r13
addq %r12, %r13
cmpb $0x20, (%rcx,%r15)
leaq 0x1(%r15), %r15
je 0x5cc4
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x553a(%rip), %r14      # 0xb21e
leaq -0xd0(%rbp), %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x4e32
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0xa8(%rbp), %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x4e32
movq (%rbx), %rax
movq %r13, %r14
sarq $0x20, %r14
movb (%rax,%r14), %al
cmpb $0x2c, %al
je 0x5d4f
leaq -0xa8(%rbp), %r14
movsbl %al, %esi
movq %r14, %rdi
callq 0x21a0
movq (%rbx), %rax
movb (%rax,%r15), %al
addq %r12, %r13
incq %r15
cmpb $0x2c, %al
jne 0x5d2c
sarq $0x20, %r13
movq %r13, %r14
movq %r14, %rax
shlq $0x20, %rax
movq -0xb0(%rbp), %rcx
shlq $0x20, %rcx
subq %rcx, %rax
movabsq $0x200000000, %r13      # imm = 0x200000000
addq %rax, %r13
incq %r14
leaq -0xd0(%rbp), %r15
movq (%rbx), %rax
movb (%rax,%r14), %al
cmpb $0x29, %al
je 0x5d99
addq %r12, %r13
incq %r14
movsbl %al, %esi
movq %r15, %rdi
callq 0x21a0
jmp 0x5d7b
leaq 0x544e(%rip), %rsi      # 0xb1ee
movl $0xa, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2360
movq %rax, %r15
shlq $0x20, %r15
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
cmpq %rax, %r15
je 0x5f8e
sarq $0x20, %r13
leaq -0xf0(%rbp), %r14
movq %r14, %rdi
leaq 0x541b(%rip), %rsi      # 0xb1f9
leaq -0xd0(%rbp), %rdx
callq 0x4b36
movq %r14, %r12
movq %r14, %rdi
leaq 0x5414(%rip), %rsi      # 0xb20b
callq 0x23b0
leaq -0x58(%rbp), %rsi
movq %rsi, -0x68(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5e20
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x5e26
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x60(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x2090
leaq -0x78(%rbp), %rsi
movq %rsi, -0x88(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5e7e
movq %rdx, -0x88(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x78(%rbp)
jmp 0x5e84
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x80(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x88(%rbp), %rdi
leaq 0x536f(%rip), %rsi      # 0xb218
callq 0x23b0
leaq -0x38(%rbp), %rsi
movq %rsi, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5ed2
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x5ed8
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
sarq $0x20, %r15
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %r8
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2240
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5f1b
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x5f30
callq 0x21c0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x5f42
callq 0x21c0
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x5f5a
callq 0x21c0
movl $0xa, %ecx
movq %rbx, %rdi
leaq 0x5285(%rip), %rsi      # 0xb1ee
movq %r15, %rdx
callq 0x2360
movq %rax, %r15
shlq $0x20, %r15
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
cmpq %rax, %r15
movq %r12, %r14
jne 0x5dd4
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x5fa6
callq 0x21c0
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x5fbe
callq 0x21c0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x605c
jmp 0x6041
movq %rax, %rbx
jmp 0x6025
movq %rax, %rbx
jmp 0x6013
movq %rax, %rbx
jmp 0x5ffe
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5ffe
callq 0x21c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x6013
callq 0x21c0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x6025
callq 0x21c0
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x6044
callq 0x21c0
jmp 0x6044
jmp 0x6041
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x605c
callq 0x21c0
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x6074
callq 0x21c0
movq %rbx, %rdi
callq 0x2370