// File: ncbi[P]amr/common.cpp
// Function: Common_sp::replaceStr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void replaceStr (string &s,
                 const string &from,
                 const string &to)
{
  ASSERT (! from. empty ());
  
  if (from == to)
    return;
  
  const bool inside = contains (to, from);

  size_t start = 0;    
  for (;;)
  {
    const size_t pos = s. find (from, start);
    if (pos == string::npos)
      break;
    s. replace (pos, from. size (), to);
    start = pos + (inside ? to. size () : 0);
  }
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x170(%rsp)
movq %rsi, 0x168(%rsp)
movq %rdx, 0x160(%rsp)
callq 0xc090
movl $0x0, (%rax)
movq 0x168(%rsp), %rdi
callq 0xcc10
testb $0x1, %al
jne 0x40a10
jmp 0x40c7f
callq 0xc8c0
cmpl $0x0, %eax
jne 0x40c75
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xcd00
movq 0x28(%rsp), %rdx
leaq 0x8cfdd(%rip), %rsi     # 0xcda19
leaq 0xc0(%rsp), %rdi
callq 0x29fd0
jmp 0x40a4b
leaq 0x88(%rsp), %rdi
movl $0x3c3, %esi            # imm = 0x3C3
callq 0x2ded0
jmp 0x40a5f
leaq 0xe0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x2dde0
jmp 0x40a7e
leaq 0x8b11c(%rip), %rdx     # 0xcbba1
leaq 0x100(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x2a2f0
jmp 0x40a9c
leaq 0x47(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0xcd00
movq 0x20(%rsp), %rdx
leaq 0x8d183(%rip), %rsi     # 0xcdc3a
leaq 0x48(%rsp), %rdi
callq 0x29fd0
jmp 0x40ac3
leaq 0x8cf4c(%rip), %rdx     # 0xcda16
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x2a2f0
jmp 0x40adb
leaq 0x120(%rsp), %rdi
leaq 0x100(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x2dde0
jmp 0x40af7
leaq 0x8d181(%rip), %rdx     # 0xcdc7f
leaq 0x140(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x2a2f0
jmp 0x40b15
leaq 0x140(%rsp), %rdi
callq 0x3e9b0
jmp 0x40b24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x40c04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xce98
leaq 0x120(%rsp), %rdi
callq 0xce98
leaq 0x68(%rsp), %rdi
callq 0xce98
leaq 0x48(%rsp), %rdi
callq 0xce98
leaq 0x47(%rsp), %rdi
callq 0xc7a0
leaq 0x100(%rsp), %rdi
callq 0xce98
leaq 0xe0(%rsp), %rdi
callq 0xce98
leaq 0x88(%rsp), %rdi
callq 0xce98
leaq 0xc0(%rsp), %rdi
callq 0xce98
leaq 0xbf(%rsp), %rdi
callq 0xc7a0
jmp 0x40d77
movl $0x1, %edi
callq 0xc8d0
movq 0x168(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0x30100
testb $0x1, %al
jne 0x40c9a
jmp 0x40c9f
jmp 0x40d6f
movq 0x160(%rsp), %rdi
movq 0x168(%rsp), %rsi
callq 0x2f5d0
andb $0x1, %al
movb %al, 0x46(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x170(%rsp), %rdi
movq 0x168(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0xce60
movq %rax, 0x30(%rsp)
cmpq $-0x1, 0x30(%rsp)
jne 0x40cef
jmp 0x40d6f
movq 0x170(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x168(%rsp), %rdi
callq 0xc530
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
movq 0x160(%rsp), %rcx
callq 0xc280
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
testb $0x1, 0x46(%rsp)
je 0x40d51
movq 0x160(%rsp), %rdi
callq 0xc530
movq %rax, (%rsp)
jmp 0x40d59
xorl %eax, %eax
movq %rax, (%rsp)
jmp 0x40d59
movq 0x18(%rsp), %rax
movq (%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
jmp 0x40cc3
addq $0x178, %rsp            # imm = 0x178
retq
movq 0xb0(%rsp), %rdi
callq 0xccf0
nopw %cs:(%rax,%rax)