// File: MarkCBell[P]twister/./twister/kernel/parsing.cpp
// Function: replace_macros(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>>>> const&, 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>>>> const&)
void replace_macros(std::string &command, const std::vector<std::string> &macro_name, const std::vector<std::string> &macro)
{
	std::string old_command = "";
	int num_macros = int(macro_name.size());
	
	for (int i = 0; i < num_macros; i++)
		if (command.find(drill + macro_name[i]) != std::string::npos)
			output_error("Cannot drill a macro.");
	
	int c = 0;  // Count the number of replacements we make.
	while (command != old_command)
	{
		old_command = command;
		for (int i = 0; i < num_macros; i++)
			find_and_replace(command, separator + macro_name[i] + separator, separator + macro[i] + separator);
		
		if (c++ > num_macros)
			output_error("Circular references detected in macros in command.");
	}
	
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x3560
movq -0x158(%rbp), %rdx
leaq 0x136fd(%rip), %rsi     # 0x272f2
leaq -0x38(%rbp), %rdi
callq 0x4e10
jmp 0x13c00
leaq -0x39(%rbp), %rdi
callq 0x3360
movq -0x10(%rbp), %rdi
callq 0x8c60
movl %eax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0x13d53
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x54(%rbp), %rsi
callq 0x14d20
movq %rax, %rdx
leaq 0x2199e(%rip), %rsi     # 0x355e8
leaq -0x78(%rbp), %rdi
callq 0x14d90
jmp 0x13c55
movq -0x160(%rbp), %rdi
leaq -0x78(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x35e0
movq %rax, -0x168(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x35f8
movq -0x168(%rbp), %rax
cmpq $-0x1, %rax
je 0x13d43
leaq -0x99(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x3560
movq -0x170(%rbp), %rdx
leaq 0x1376d(%rip), %rsi     # 0x27418
leaq -0x98(%rbp), %rdi
callq 0x4e10
jmp 0x13cb9
leaq -0x98(%rbp), %rdi
callq 0x4d40
jmp 0x13cc7
leaq -0x98(%rbp), %rdi
callq 0x35f8
leaq -0x99(%rbp), %rdi
callq 0x3360
jmp 0x13d43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x3360
jmp 0x13fbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x13fb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x13d32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x35f8
leaq -0x99(%rbp), %rdi
callq 0x3360
jmp 0x13fb5
jmp 0x13d45
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x13c1c
movl $0x0, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x14ea0
testb $0x1, %al
jne 0x13d73
jmp 0x13fa3
movq -0x8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x3050
jmp 0x13d82
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x50(%rbp), %eax
jge 0x13ef9
movq -0x8(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x10(%rbp), %rdi
movslq -0xa4(%rbp), %rsi
callq 0x14d20
movq %rax, %rdx
leaq 0x21808(%rip), %rsi     # 0x355c8
leaq -0xe8(%rbp), %rdi
callq 0x14d90
jmp 0x13dce
leaq 0x217f3(%rip), %rdx     # 0x355c8
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x99d0
jmp 0x13dea
movq -0x18(%rbp), %rdi
movslq -0xa4(%rbp), %rsi
callq 0x14d20
movq %rax, %rdx
leaq 0x217c4(%rip), %rsi     # 0x355c8
leaq -0x128(%rbp), %rdi
callq 0x14d90
jmp 0x13e12
leaq 0x217af(%rip), %rdx     # 0x355c8
leaq -0x108(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x99d0
jmp 0x13e2e
movq -0x178(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0x108(%rbp), %rdx
callq 0x12190
jmp 0x13e4a
leaq -0x108(%rbp), %rdi
callq 0x35f8
leaq -0x128(%rbp), %rdi
callq 0x35f8
leaq -0xc8(%rbp), %rdi
callq 0x35f8
leaq -0xe8(%rbp), %rdi
callq 0x35f8
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x13d8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x13ee8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x13edc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x13ed0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x35f8
leaq -0x128(%rbp), %rdi
callq 0x35f8
leaq -0xc8(%rbp), %rdi
callq 0x35f8
leaq -0xe8(%rbp), %rdi
callq 0x35f8
jmp 0x13fb5
movl -0xa0(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xa0(%rbp)
cmpl -0x50(%rbp), %eax
jle 0x13f9e
leaq -0x149(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x3560
movq -0x180(%rbp), %rdx
leaq 0x134fa(%rip), %rsi     # 0x2742e
leaq -0x148(%rbp), %rdi
callq 0x4e10
jmp 0x13f42
leaq -0x148(%rbp), %rdi
callq 0x4d40
jmp 0x13f50
leaq -0x148(%rbp), %rdi
callq 0x35f8
leaq -0x149(%rbp), %rdi
callq 0x3360
jmp 0x13f9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x13f90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x35f8
leaq -0x149(%rbp), %rdi
callq 0x3360
jmp 0x13fb5
jmp 0x13d5d
leaq -0x38(%rbp), %rdi
callq 0x35f8
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x35f8
movq -0x48(%rbp), %rdi
callq 0x3550
nopw (%rax,%rax)