// File: /workspace/github_cpp_makefile_star2_O2/davinash[P]regex/src/regex.cpp
// Function: RegEx::PreProcessBracket(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string RegEx::PreProcessBracket( std::string strRegEx) {
	std::string::size_type startPos, endPos, separatorPos;
	std::string ReplacedStrRegEx;

	startPos = strRegEx.find_first_of("[");
	endPos   = strRegEx.find_first_of("]");
	separatorPos = strRegEx.find_first_of("-");

	if ( startPos == std::string::npos || endPos == std::string::npos )
		return strRegEx;

	ReplacedStrRegEx += strRegEx.substr( 0, startPos );
	ReplacedStrRegEx.push_back('(');
	std::string result = strRegEx.substr( startPos + 1, endPos - startPos - 1);
	char first = result[0];
	char last  = result[result.size() - 1 ];

	if ( separatorPos != std::string::npos ) {		
		while ( first != last ) {
			ReplacedStrRegEx.push_back(first);
			ReplacedStrRegEx += "|";
			first++;
		}
		ReplacedStrRegEx.push_back(first);				
	} else {
		startPos++;
		while ( startPos != endPos - 1) {
			ReplacedStrRegEx.push_back(strRegEx[startPos]);
			ReplacedStrRegEx += "|";
			startPos++;
		}
		ReplacedStrRegEx.push_back(strRegEx[endPos - 1]);
	}
	ReplacedStrRegEx += strRegEx.substr( endPos + 1, strRegEx.size() - endPos );
	ReplacedStrRegEx += ")";

	return ReplacedStrRegEx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x44fc(%rip), %rsi      # 0x95e0
movq %rdx, %rdi
xorl %edx, %edx
callq 0x20a0
movq %rax, %r12
leaq 0x42b3(%rip), %rsi      # 0x93ab
movq %r14, %rdi
xorl %edx, %edx
callq 0x20a0
movq %rax, %r15
leaq 0x44d6(%rip), %rsi      # 0x95e2
movq %r14, %rdi
xorl %edx, %edx
callq 0x20a0
movq %rax, %r13
cmpq $-0x1, %r12
setne %al
cmpq $-0x1, %r15
setne %cl
testb %cl, %al
jne 0x513b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2200
jmp 0x52a4
movq %rbx, 0x40(%rsp)
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r12, %rcx
callq 0x21a0
movq %rsp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x22c0
leaq 0x20(%rsp), %rdi
callq 0x2090
movq %rsp, %rdi
pushq $0x28
popq %rsi
callq 0x2150
leaq 0x1(%r12), %rdx
movq %r12, %rcx
notq %rcx
addq %r15, %rcx
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x21a0
cmpq $-0x1, %r13
je 0x51cf
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movb -0x1(%rax,%rcx), %bpl
movb (%rax), %bl
movq %rsp, %r12
leaq 0x4434(%rip), %r13      # 0x95e4
cmpb %bl, %bpl
je 0x5208
movsbl %bl, %esi
movq %r12, %rdi
callq 0x2150
movq %r12, %rdi
movq %r13, %rsi
callq 0x22b0
incb %bl
jmp 0x51b0
leaq -0x2(%r15), %rbx
movq %rsp, %r13
leaq 0x4407(%rip), %rbp      # 0x95e4
movq (%r14), %rax
cmpq %r12, %rbx
je 0x5203
movsbl 0x1(%rax,%r12), %esi
movq %r13, %rdi
callq 0x2150
movq %r13, %rdi
movq %rbp, %rsi
callq 0x22b0
incq %r12
jmp 0x51dd
movb -0x1(%rax,%r15), %bpl
movsbl %bpl, %esi
movq %rsp, %rdi
callq 0x2150
movq 0x8(%r14), %rcx
subq %r15, %rcx
incq %r15
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x21a0
movq %rsp, %rdi
leaq 0x48(%rsp), %rsi
callq 0x22c0
leaq 0x48(%rsp), %rdi
callq 0x2090
leaq 0x417b(%rip), %rsi      # 0x93c7
movq %rsp, %rdi
callq 0x22b0
movq 0x40(%rsp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%rsp), %rcx
leaq 0x10(%rsp), %rdx
cmpq %rdx, %rcx
je 0x527c
movq %rcx, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
jmp 0x5282
movups (%rdx), %xmm0
movups %xmm0, (%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %rdx, (%rsp)
andq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x2090
movq %rsp, %rdi
callq 0x2090
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2090
jmp 0x52e1
jmp 0x52de
jmp 0x52d5
jmp 0x52d5
jmp 0x52de
movq %rax, %rbx
jmp 0x52eb
jmp 0x52de
jmp 0x52de
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2090
movq %rsp, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2290
nop