// File: /workspace/github_cpp_makefile_star2_O1/MarkCBell[P]twister/./twister/kernel/parsing.cpp
// Function: expand_brackets(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void expand_brackets(std::string &command, std::vector<std::string> &names, std::vector<std::string> &inverse_names)
{
	int num_names = int(names.size());
	
	for(size_t next = command.find(")"); next != std::string::npos; next = command.find(")", next))
	{
		size_t previous = command.rfind("(", next);
		std::string replacement = "", subreplacement = "";
		int power = atoi((char *) command.substr(next+2, std::string::npos).c_str());
		int power_length = digit_length(power);
		
		subreplacement = command.substr(previous+1, next-previous-1);
		if (power < 0)
		{
			size_t marker = 0;
			std::string new_subreplacement = "";
			for (std::string s = find_next_substring(subreplacement, separator, marker); marker != 0; s = find_next_substring(subreplacement, separator, marker))
			{
				for (int i = 0; i < num_names; i++)
				{
					if (names[i] == s)
					{
						s = inverse_names[i];
						break;
					}
					if (drill + names[i] == s)
					{
						s = drill + inverse_names[i];
						break;
					}
				}
				new_subreplacement = s + separator + new_subreplacement; // Restack the results.
			}
			subreplacement = new_subreplacement;
		}
		
		power = abs(power);
		
		for (int i = 0; i < power; i++)
			replacement += subreplacement;
		
		command.replace(previous, next-previous+1+1+power_length, replacement);
		
		next++;
	}
	
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdx, 0x88(%rsp)
movq %rsi, %r14
movq %rdi, %r13
movq 0x8(%rsi), %r15
subq (%rsi), %r15
leaq 0xb1ca(%rip), %rsi      # 0x1798c
movl $0x1, %ecx
xorl %edx, %edx
callq 0x33d0
cmpq $-0x1, %rax
je 0xce7b
movq %rax, %rbx
shrq $0x5, %r15
movq %r15, 0x138(%rsp)
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
shlq $0x5, %r15
leaq 0xb193(%rip), %r12      # 0x1798c
movq %r15, 0x130(%rsp)
movq %r13, 0x120(%rsp)
movl $0x1, %ecx
movq %r13, %rdi
leaq 0xab3a(%rip), %rsi      # 0x17352
movq %rbx, %rdx
callq 0x32d0
movq %rax, 0x98(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0xaab2(%rip), %rbp      # 0x172f9
movq %rbp, %rsi
movq %rbp, %rdx
callq 0x86fe
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
movq %rbp, %rsi
movq %rbp, %rdx
callq 0x86fe
leaq 0x2(%rbx), %rdx
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x3240
movq %rbx, 0x90(%rsp)
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x3350
movl %eax, %ecx
leaq 0x38(%rsp), %rax
cmpq %rax, %rbx
movl %ecx, 0x4(%rsp)
je 0xc8bd
movq 0x38(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x3220
movl 0x4(%rsp), %ecx
xorl %ebp, %ebp
testl %ecx, %ecx
setle %bpl
je 0xc8f1
movl %ecx, %eax
leaq 0x28(%rsp), %rbx
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rax # imm = 0x66666667
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rax
addl %edx, %eax
incl %ebp
addl $0x9, %ecx
cmpl $0x12, %ecx
ja 0xc8ce
jmp 0xc8f6
leaq 0x28(%rsp), %rbx
movq 0x98(%rsp), %rax
leaq 0x1(%rax), %rdx
movq 0x90(%rsp), %rcx
subq %rax, %rcx
movq %rcx, 0x128(%rsp)
decq %rcx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3240
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x32a0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xc94c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3220
movl 0x4(%rsp), %eax
testl %eax, %eax
jns 0xcdb4
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %rbx, %rdi
leaq 0xa98d(%rip), %rdx      # 0x172f9
movq %rdx, %rsi
callq 0x86fe
leaq 0x158(%rsp), %rbx
movq %rbx, 0x148(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
leaq 0x148(%rsp), %rdi
callq 0x878e
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x11b33(%rip), %rsi     # 0x1e4e8
movq 0x11b34(%rip), %rdx     # 0x1e4f0
addq %rsi, %rdx
leaq 0xe0(%rsp), %rdi
callq 0x878e
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rcx
leaq 0x148(%rsp), %r12
movq %r12, %rdi
xorl %edx, %edx
callq 0x3320
leaq 0x68(%rsp), %rdi
movq %r12, %rsi
movq %rax, %r12
xorl %edx, %edx
movq %rax, %rcx
callq 0x3240
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0xca28
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x148(%rsp), %rdi
cmpq %rbx, %rdi
je 0xca45
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3220
incq %r12
je 0xcd5a
movq %r12, 0x140(%rsp)
cmpl $0x0, 0x138(%rsp)
jle 0xcb6d
xorl %r13d, %r13d
movq (%r14), %r12
movq 0x8(%r12,%r13), %rdx
addq %r13, %r12
cmpq 0x70(%rsp), %rdx
jne 0xca94
testq %rdx, %rdx
je 0xcb08
movq 0x68(%rsp), %rsi
movq (%r12), %rdi
callq 0x3230
testl %eax, %eax
je 0xcb08
leaq 0x8(%rsp), %rdi
leaq 0x11a68(%rip), %rsi     # 0x1e508
movq %r12, %rdx
callq 0xd38e
movq 0x10(%rsp), %rdx
cmpq 0x70(%rsp), %rdx
jne 0xcad0
testq %rdx, %rdx
je 0xcad5
movq 0x68(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x3230
testl %eax, %eax
sete %r12b
jmp 0xcad8
xorl %r12d, %r12d
jmp 0xcad8
movb $0x1, %r12b
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xcaf4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3220
testb %r12b, %r12b
jne 0xcb22
addq $0x20, %r13
cmpq %r13, %r15
jne 0xca67
jmp 0xcb6d
movq 0x88(%rsp), %rax
addq (%rax), %r13
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x3150
jmp 0xcb6d
movq 0x88(%rsp), %rax
addq (%rax), %r13
leaq 0x8(%rsp), %r15
movq %r15, %rdi
leaq 0x119cc(%rip), %rsi     # 0x1e508
movq %r13, %rdx
callq 0xd38e
leaq 0x18(%rsp), %r12
leaq 0x68(%rsp), %rdi
movq %r15, %rsi
callq 0x32a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xcb6d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0x168(%rsp), %r15
movq %r15, %rdi
leaq 0x68(%rsp), %rsi
leaq 0x11964(%rip), %rdx     # 0x1e4e8
callq 0xd38e
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r15, %rdi
callq 0x30d0
leaq 0x18(%rsp), %r12
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0x8(%rsp), %rsi
je 0xcbc8
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0xcbd0
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x28(%rsp), %rdi
callq 0x32a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xcc09
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0xcc2e
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0x878e
movq %r14, %rbx
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x11876(%rip), %rsi     # 0x1e4e8
movq 0x11877(%rip), %rdx     # 0x1e4f0
addq %rsi, %rdx
leaq 0xc0(%rsp), %rdi
callq 0x878e
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rcx
leaq 0x100(%rsp), %r14
movq %r14, %rdi
movq 0x140(%rsp), %r12
movq %r12, %rdx
callq 0x3320
movq %rax, %r13
movq %rax, %rcx
subq %r12, %rcx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3240
leaq 0x68(%rsp), %rdi
movq %r15, %rsi
callq 0x32a0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
movq %rbx, %r14
je 0xccfc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
movq 0x130(%rsp), %r15
je 0xcd29
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0xcd4e
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3220
incq %r13
movq %r13, %r12
jne 0xca4e
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xcd76
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3150
movq 0x120(%rsp), %r13
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xcda9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0xabdc(%rip), %r12      # 0x1798c
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0xcddc
movl %eax, %ebx
negl %ebx
cmpl %ebx, %eax
cmovgl %eax, %ebx
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x30d0
decl %ebx
jne 0xcdc1
movslq %ebp, %rax
movq 0x128(%rsp), %rcx
leaq (%rcx,%rax), %rdx
addq $0x2, %rdx
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %r8
movq %r13, %rdi
movq 0x98(%rsp), %rsi
callq 0x3270
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
movq 0x90(%rsp), %rbx
je 0xce33
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0xce58
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3220
incq %rbx
movl $0x1, %ecx
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x33d0
movq %rax, %rbx
cmpq $-0x1, %rax
jne 0xc809
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xce97
movq %rbx, %r12
movq %rax, %rbx
jmp 0xcecf
movq %rax, %rbx
jmp 0xcfa9
jmp 0xcf85
movq %rbx, %r12
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0xcecf
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x148(%rsp), %rdi
cmpq %r12, %rdi
je 0xcfa9
movq 0x158(%rsp), %rsi
jmp 0xcfa1
jmp 0xcf85
movq %rax, %rbx
jmp 0xcfe1
jmp 0xcf85
jmp 0xcf85
jmp 0xcf8a
jmp 0xcf8a
movq %rax, %rbx
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0xcf8d
movq 0x178(%rsp), %rsi
jmp 0xcf79
jmp 0xcf8a
movq %rax, %rbx
jmp 0xcf5c
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0xcf5c
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0xcf8d
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3220
jmp 0xcf8d
jmp 0xcf8a
movq %rax, %rbx
jmp 0xcfc5
movq %rax, %rbx
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0xcfa9
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xcfc5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xcfe1
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0xd006
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3220
movq %rbx, %rdi
callq 0x33e0