// File: /workspace/github_cpp_makefile_star2_O3/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, 0x90(%rsp)
movq %rsi, %r14
movq %rdi, %r12
movq (%rsi), %r15
movq 0x8(%rsi), %rbx
leaq 0xb029(%rip), %rsi      # 0x179cc
movl $0x1, %ecx
xorl %edx, %edx
callq 0x33d0
cmpq $-0x1, %rax
je 0xd063
movq %rax, %r13
subq %r15, %rbx
movq %rbx, %rax
shrq $0x5, %rax
movq %rax, 0x158(%rsp)
movabsq $0xfffffffe0, %rax      # imm = 0xFFFFFFFE0
andq %rbx, %rax
movq %rax, 0x160(%rsp)
leaq 0xafe2(%rip), %r15      # 0x179cc
movq %r12, 0x140(%rsp)
movl $0x1, %ecx
movq %r12, %rdi
leaq 0xa991(%rip), %rsi      # 0x17392
movq %r13, %rdx
callq 0x32d0
movq %rax, 0x98(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0xa909(%rip), %rbx      # 0x17339
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x892e
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x892e
leaq 0x2(%r13), %rdx
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
movq $-0x1, %rcx
callq 0x3240
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x3350
movl %eax, %ecx
leaq 0x40(%rsp), %rax
cmpq %rax, %rbx
movl %ecx, 0xc(%rsp)
je 0xca9e
movq 0x40(%rsp), %rsi
incq %rsi
movq %rbx, %rdi
callq 0x3220
movl 0xc(%rsp), %ecx
xorl %ebp, %ebp
testl %ecx, %ecx
setle %bpl
je 0xcad2
movl %ecx, %eax
leaq 0x30(%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 0xcaaf
jmp 0xcad7
leaq 0x30(%rsp), %rbx
movq 0x98(%rsp), %rax
leaq 0x1(%rax), %rdx
movq %r13, %rcx
subq %rax, %rcx
movq %rcx, 0x150(%rsp)
decq %rcx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3240
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x32a0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xcb28
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3220
movl 0xc(%rsp), %eax
testl %eax, %eax
jns 0xcfa4
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %rbx, %rdi
leaq 0xa7f1(%rip), %rdx      # 0x17339
movq %rdx, %rsi
callq 0x892e
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0x89c4
leaq 0xf0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x11957(%rip), %rsi     # 0x1e4e8
movq 0x11958(%rip), %rdx     # 0x1e4f0
addq %rsi, %rdx
leaq 0xe0(%rsp), %rdi
callq 0x89c4
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rcx
leaq 0x100(%rsp), %r15
movq %r15, %rdi
xorl %edx, %edx
callq 0x3320
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3240
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0xcc04
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3220
movq %r13, 0x148(%rsp)
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0xcc31
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3220
incq %rbx
je 0xcf3c
cmpl $0x0, 0x158(%rsp)
jle 0xcd5c
xorl %r13d, %r13d
movq (%r14), %r12
movq 0x8(%r12,%r13), %rdx
addq %r13, %r12
cmpq 0x78(%rsp), %rdx
jne 0xcc78
testq %rdx, %rdx
je 0xccf7
movq 0x70(%rsp), %rsi
movq (%r12), %rdi
callq 0x3230
testl %eax, %eax
je 0xccf7
leaq 0x10(%rsp), %rdi
leaq 0x11884(%rip), %rsi     # 0x1e508
movq %r12, %rdx
callq 0xd584
movq 0x18(%rsp), %rdx
cmpq 0x78(%rsp), %rdx
jne 0xccb7
movq 0x10(%rsp), %r12
testq %rdx, %rdx
je 0xccc1
movq 0x70(%rsp), %rsi
movq %r12, %rdi
callq 0x3230
testl %eax, %eax
sete %r15b
jmp 0xccc4
movq 0x10(%rsp), %r12
xorl %r15d, %r15d
jmp 0xccc4
movb $0x1, %r15b
leaq 0x20(%rsp), %rax
cmpq %rax, %r12
je 0xccde
movq 0x20(%rsp), %rsi
incq %rsi
movq %r12, %rdi
callq 0x3220
testb %r15b, %r15b
jne 0xcd11
addq $0x20, %r13
cmpq %r13, 0x160(%rsp)
jne 0xcc4b
jmp 0xcd5c
movq 0x90(%rsp), %rax
addq (%rax), %r13
leaq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x3150
jmp 0xcd5c
movq 0x90(%rsp), %rax
addq (%rax), %r13
leaq 0x10(%rsp), %r12
movq %r12, %rdi
leaq 0x117dd(%rip), %rsi     # 0x1e508
movq %r13, %rdx
callq 0xd584
leaq 0x20(%rsp), %r15
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq 0x32a0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xcd5c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0x168(%rsp), %r15
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
leaq 0x11775(%rip), %rdx     # 0x1e4e8
callq 0xd584
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %r15, %rdi
callq 0x30d0
leaq 0x20(%rsp), %r15
movq %r15, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0x10(%rsp), %r12
je 0xcdb7
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0xcdbe
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x32a0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0xcdfa
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0xce1f
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x3220
movq %rbx, %r15
leaq 0x130(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rdi
callq 0x89c4
movq %r12, %rbx
movq %r14, %r12
leaq 0xd0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x1167f(%rip), %rsi     # 0x1e4e8
movq 0x11680(%rip), %rdx     # 0x1e4f0
addq %rsi, %rdx
leaq 0xc0(%rsp), %rdi
callq 0x89c4
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rcx
leaq 0x120(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
callq 0x3320
movq %rax, %r13
movq %rax, %rcx
subq %r15, %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3240
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
callq 0x32a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
movq %r12, %r14
je 0xcee6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0xcf0b
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0xcf30
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3220
incq %r13
movq %r13, %rbx
jne 0xcc3a
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0xcf5e
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3150
movq 0x140(%rsp), %r12
movq 0x148(%rsp), %r13
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xcf99
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3220
leaq 0xaa2c(%rip), %r15      # 0x179cc
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0xcfcc
movl %eax, %ebx
negl %ebx
cmpl %ebx, %eax
cmovgl %eax, %ebx
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
callq 0x30d0
decl %ebx
jne 0xcfb1
movslq %ebp, %rax
movq 0x150(%rsp), %rcx
leaq (%rcx,%rax), %rdx
addq $0x2, %rdx
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %r8
movq %r12, %rdi
movq 0x98(%rsp), %rsi
callq 0x3270
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xd01b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0xd040
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3220
incq %r13
movl $0x1, %ecx
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x33d0
movq %rax, %r13
cmpq $-0x1, %rax
jne 0xc9f2
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd084
leaq 0x110(%rsp), %r15
movq %rax, %rbx
jmp 0xd0c1
movq %rax, %rbx
jmp 0xd1a1
jmp 0xd177
leaq 0x110(%rsp), %r15
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0xd0c1
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x100(%rsp), %rdi
cmpq %r15, %rdi
je 0xd1a1
movq 0x110(%rsp), %rsi
jmp 0xd199
jmp 0xd177
movq %rax, %rbx
jmp 0xd1d9
jmp 0xd177
jmp 0xd177
jmp 0xd17c
jmp 0xd17c
movq %rax, %rbx
movq 0x168(%rsp), %rdi
leaq 0x178(%rsp), %rax
cmpq %rax, %rdi
je 0xd17f
movq 0x178(%rsp), %rsi
jmp 0xd16b
jmp 0xd17c
movq %rax, %rbx
jmp 0xd14e
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0xd14e
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0xd17f
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3220
jmp 0xd17f
jmp 0xd17c
movq %rax, %rbx
jmp 0xd1bd
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0xd1a1
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xd1bd
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xd1d9
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3220
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0xd1fe
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3220
movq %rbx, %rdi
callq 0x33e0