// File: /workspace/github_cpp_makefile_star2_O2/MarkCBell[P]twister/./twister/kernel/parsing.cpp
// Function: tokenise_command(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<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>>>> const&)
void tokenise_command(std::string &command, const std::set<std::string> &valid_names)
{
	std::string new_command = "";
	std::string new_subcommand = "";
	size_t marker = 0;
	
	do
	{
		if (command.substr(marker,1) == drill)
		{
			new_command += separator + drill;
			marker++;
		}
		if (command.substr(marker,1) == "(")
		{
			new_command += separator + "(";
			marker++;
		}
		if (command.substr(marker,1) == ")")
		{
			int power = atoi((char *) command.substr(marker).c_str());
			int power_length = digit_length(power);
			
			new_command += separator + command.substr(marker, 2+power_length);
			marker += 2+power_length;
		}
		
		size_t old_marker = marker;
		new_subcommand = find_next_substring(command, separator, marker);
		
		for (int j = new_subcommand.size(); j >= 0; j--)
		{
			if (j > 0)
			{
				if (valid_names.find(new_subcommand.substr(0,j)) != valid_names.end())
				{
					new_command += new_subcommand.substr(0,j) + separator;
					marker = old_marker + j;
					break;
				}
			}
			else
				new_command += new_subcommand + separator;
		}
	} while (marker != 0);
	
	command = new_command;
	
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x8459(%rip), %rbx      # 0x1130f
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
callq 0x3e82
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %rsi
callq 0x3e82
movq %rsp, %rax
andq $0x0, (%rax)
leaq 0x8(%r15), %rax
movq %rax, 0x70(%rsp)
xorl %ebx, %ebx
leaq 0x8(%rsp), %r12
leaq 0x10620(%rip), %rbp     # 0x19518
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
pushq $0x1
popq %rcx
callq 0x3260
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6722
movq %rbp, %r13
movl %eax, %ebp
movq %r12, %rdi
callq 0x3458
testb %bpl, %bpl
je 0x8f5d
movq %r12, %rdi
leaq 0x105c8(%rip), %rsi     # 0x194f8
movq %r13, %rdx
callq 0x9c51
leaq 0x8429(%rip), %r13      # 0x11368
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x3420
movq %r12, %rdi
callq 0x3458
incq %rbx
movq %rbx, (%rsp)
jmp 0x8f64
leaq 0x8404(%rip), %r13      # 0x11368
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
pushq $0x1
popq %rcx
callq 0x3260
movq %r12, %rdi
movq %r13, %rsi
callq 0x631c
movl %eax, %ebp
movq %r12, %rdi
callq 0x3458
testb %bpl, %bpl
je 0x8fbd
movq %r12, %rdi
leaq 0x1055f(%rip), %rsi     # 0x194f8
movq %r13, %rdx
callq 0x658d
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x3420
movq %r12, %rdi
callq 0x3458
incq %rbx
movq %rbx, (%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
pushq $0x1
popq %rcx
callq 0x3260
movq %r12, %rdi
leaq 0x894c(%rip), %rsi      # 0x11924
callq 0x631c
movl %eax, %ebp
movq %r12, %rdi
callq 0x3458
testb %bpl, %bpl
je 0x9070
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
pushq $-0x1
popq %rcx
callq 0x3260
movq 0x8(%rsp), %rdi
callq 0x3340
movl %eax, %ebp
movq %r12, %rdi
callq 0x3458
movl %ebp, %edi
callq 0x84d3
addl $0x2, %eax
movslq %eax, %rbp
leaq 0x78(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0x3260
movq %r12, %rdi
leaq 0x104b6(%rip), %rsi     # 0x194f8
movq %r13, %rdx
callq 0x9c2d
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x3420
movq %r12, %rdi
callq 0x3458
leaq 0x78(%rsp), %rdi
callq 0x3458
addq %rbp, %rbx
movq %rbx, (%rsp)
leaq 0x104a1(%rip), %rbp     # 0x19518
leaq 0xb8(%rsp), %rdi
movq %r14, %rsi
callq 0x32e0
leaq 0x98(%rsp), %rdi
leaq 0x10462(%rip), %rsi     # 0x194f8
callq 0x32e0
leaq 0x8(%rsp), %r12
movq %r12, %rdi
leaq 0xb8(%rsp), %r13
movq %r13, %rsi
leaq 0x98(%rsp), %rdx
movq %rsp, %rcx
callq 0x8133
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x32a0
movq %r12, %rdi
callq 0x3458
leaq 0x98(%rsp), %rdi
callq 0x3458
movq %r13, %rdi
callq 0x3458
movl 0x38(%rsp), %eax
testl %eax, %eax
js 0x91e8
movq %rbx, %r13
movq %r14, %r12
movl %eax, %r14d
subl $0x1, %r14d
jae 0x913c
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
leaq 0x103e1(%rip), %rdx     # 0x194f8
callq 0x9c51
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x3420
movq %rbx, %rdi
callq 0x3458
movl %r14d, %eax
movq %r12, %r14
movq %r13, %rbx
jmp 0x90ec
movl %eax, %ecx
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
xorl %edx, %edx
movq %rcx, 0x28(%rsp)
callq 0x3260
movq %r15, %rbx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x9d18
movq %rax, %r15
movq %rbp, %rdi
callq 0x3458
movl %r14d, %eax
cmpq 0x70(%rsp), %r15
movq %r12, %r14
movq %rbx, %r15
movq %r13, %rbx
leaq 0x10390(%rip), %rbp     # 0x19518
je 0x90ec
leaq 0x78(%rsp), %r13
movq %r13, %rdi
leaq 0x30(%rsp), %rsi
xorl %edx, %edx
movq 0x28(%rsp), %rcx
callq 0x3260
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
leaq 0x1033f(%rip), %rdx     # 0x194f8
callq 0x6703
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0x3420
movq %r12, %rdi
callq 0x3458
leaq 0x78(%rsp), %rdi
callq 0x3458
addq 0x28(%rsp), %rbx
movq %rbx, (%rsp)
jmp 0x91f1
movq (%rsp), %rbx
leaq 0x8(%rsp), %r12
testq %rbx, %rbx
jne 0x8ef8
leaq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0x3160
leaq 0x30(%rsp), %rdi
callq 0x3458
leaq 0x50(%rsp), %rdi
callq 0x3458
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9299
movq %rax, %rbx
jmp 0x92a6
jmp 0x9240
jmp 0x9255
jmp 0x9299
jmp 0x9288
jmp 0x9288
jmp 0x9299
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3458
jmp 0x9258
jmp 0x9299
jmp 0x9299
jmp 0x9299
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x9290
jmp 0x9299
jmp 0x9299
jmp 0x9299
jmp 0x9299
movq %rax, %rbx
jmp 0x927c
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x3458
leaq 0xb8(%rsp), %rdi
jmp 0x9290
jmp 0x9288
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3458
jmp 0x929c
jmp 0x9299
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3458
leaq 0x50(%rsp), %rdi
callq 0x3458
movq %rbx, %rdi
callq 0x33d0