#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
int /*<<< orphan*/ memmove(char *, char const *, size_t);
char *realloc(char *, size_t);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
char *strstr(char const *, char const *);
char *replace(const char *src, const char *from, const char *to, int type) {
  size_t size = strlen(src) + 1;
  size_t fromlen = strlen(from);
  size_t tolen = strlen(to);
  int badmatch = 0;
  char *dst;
  char *value = malloc(size);
  if (value == NULL) {
    fprintf(stderr, "Cannot allocate memory\n");
    return NULL;
  }
  dst = value;
  if (value != NULL) {
    for (;;) {
      const char *match = strstr(src, from);
      if (match != NULL) {
        badmatch = 0;
        if (type == 0) {
          if (src < match) {
            char c = *(match - 1);
            if (c >= '0' && (int)c <= '9')
              badmatch = 1;
          }
          if (((src + strlen(src)) > (match + strlen(from))) &&
              (badmatch == 0)) {
            char c = *(match + strlen(from));
            if (c >= '0' && c <= '9')
              badmatch = 1;
          }
        } else if (type == 3) {
          if (src < match) {
            char c = *(match - 1);
            if (c != ':')
              badmatch = 1;
          }
          if (((src + strlen(src)) > (match + strlen(from))) &&
              (badmatch == 0)) {
            char c = *(match + strlen(from));
            if (c >= '0' && c <= '9')
              badmatch = 1;
          }
        } else if (type == 1) {
          if (src < match) {
            char c = *(match - 1);
            if (c != '"' && c != '<' && c != ' ')
              badmatch = 1;
          }
          if (((src + strlen(src)) > (match + strlen(from))) &&
              (badmatch == 0)) {
            char c = *(match + strlen(from));
            if (c != '"' && c != '>' && c != ' ')
              badmatch = 1;
          }
        } else if (type == 2) {
          if (src < match) {
            char c = *(match - 1);
            if (c != '"' && c != '<' && c != ':')
              badmatch = 1;
          }
          if (((src + strlen(src)) > (match + strlen(from))) &&
              (badmatch == 0)) {
            char c = *(match + strlen(from));
            if (c != '"' && c != '@')
              badmatch = 1;
          }
        }
        if (badmatch == 1) {
          size_t count = match - src;
          memmove(dst, src, count);
          src += count;
          dst += count;
          memmove(dst, from, fromlen);
          src += fromlen;
          dst += fromlen;
          continue;
        }
        size_t count = match - src;
        char *temp;
        size += tolen - fromlen;
        temp = realloc(value, size);
        if (temp == NULL) {
          fprintf(stderr, "Cannot re-allocate memory\n");
          free(value);
          return NULL;
        }
        dst = temp + (dst - value);
        value = temp;
        memmove(dst, src, count);
        src += count;
        dst += count;
        memmove(dst, to, tolen);
        src += fromlen;
        dst += tolen;
      } else {
        strcpy(dst, src);
        break;
      }
    }
  }
  return value;
}


x86 assembly (clang, -O0):
<replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x30(%rbp),%rdi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    1206 <replace+0x86>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
lea    0xe0c(%rip),%rsi
call   1060 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    17c1 <replace+0x641>
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     17b9 <replace+0x639>
jmp    121e <replace+0x9e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     179d <replace+0x61d>
movl   $0x0,-0x44(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    133b <replace+0x1bb>
mov    -0x10(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    1289 <replace+0x109>
mov    -0x60(%rbp),%rax
mov    -0x1(%rax),%al
mov    %al,-0x61(%rbp)
movsbl -0x61(%rbp),%eax
cmp    $0x30,%eax
jl     1284 <replace+0x104>
movsbl -0x61(%rbp),%eax
cmp    $0x39,%eax
jg     1284 <replace+0x104>
movl   $0x1,-0x44(%rbp)
jmp    1289 <replace+0x109>
mov    -0x10(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x98(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x88(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x90(%rbp),%rcx
mov    %rax,%rdx
mov    -0x88(%rbp),%rax
add    %rdx,%rcx
cmp    %rcx,%rax
jbe    1336 <replace+0x1b6>
cmpl   $0x0,-0x44(%rbp)
jne    1336 <replace+0x1b6>
mov    -0x60(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0xa0(%rbp),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x62(%rbp)
movsbl -0x62(%rbp),%eax
cmp    $0x30,%eax
jl     1331 <replace+0x1b1>
movsbl -0x62(%rbp),%eax
cmp    $0x39,%eax
jg     1331 <replace+0x1b1>
movl   $0x1,-0x44(%rbp)
jmp    1336 <replace+0x1b6>
jmp    1652 <replace+0x4d2>
cmpl   $0x3,-0x24(%rbp)
jne    1428 <replace+0x2a8>
mov    -0x10(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    1376 <replace+0x1f6>
mov    -0x60(%rbp),%rax
mov    -0x1(%rax),%al
mov    %al,-0x63(%rbp)
movsbl -0x63(%rbp),%eax
cmp    $0x3a,%eax
je     1371 <replace+0x1f1>
movl   $0x1,-0x44(%rbp)
jmp    1376 <replace+0x1f6>
mov    -0x10(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0xb8(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xb0(%rbp),%rcx
mov    %rax,%rdx
mov    -0xa8(%rbp),%rax
add    %rdx,%rcx
cmp    %rcx,%rax
jbe    1423 <replace+0x2a3>
cmpl   $0x0,-0x44(%rbp)
jne    1423 <replace+0x2a3>
mov    -0x60(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0xc0(%rbp),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x64(%rbp)
movsbl -0x64(%rbp),%eax
cmp    $0x30,%eax
jl     141e <replace+0x29e>
movsbl -0x64(%rbp),%eax
cmp    $0x39,%eax
jg     141e <replace+0x29e>
movl   $0x1,-0x44(%rbp)
jmp    1423 <replace+0x2a3>
jmp    164d <replace+0x4cd>
cmpl   $0x1,-0x24(%rbp)
jne    153c <replace+0x3bc>
mov    -0x10(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    147d <replace+0x2fd>
mov    -0x60(%rbp),%rax
mov    -0x1(%rax),%al
mov    %al,-0x65(%rbp)
movsbl -0x65(%rbp),%eax
cmp    $0x22,%eax
je     1478 <replace+0x2f8>
movsbl -0x65(%rbp),%eax
cmp    $0x3c,%eax
je     1478 <replace+0x2f8>
movsbl -0x65(%rbp),%eax
cmp    $0x20,%eax
je     1478 <replace+0x2f8>
movl   $0x1,-0x44(%rbp)
jmp    147d <replace+0x2fd>
mov    -0x10(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0xd8(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xc8(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0xd0(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xd0(%rbp),%rcx
mov    %rax,%rdx
mov    -0xc8(%rbp),%rax
add    %rdx,%rcx
cmp    %rcx,%rax
jbe    1537 <replace+0x3b7>
cmpl   $0x0,-0x44(%rbp)
jne    1537 <replace+0x3b7>
mov    -0x60(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0xe0(%rbp),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x66(%rbp)
movsbl -0x66(%rbp),%eax
cmp    $0x22,%eax
je     1532 <replace+0x3b2>
movsbl -0x66(%rbp),%eax
cmp    $0x3e,%eax
je     1532 <replace+0x3b2>
movsbl -0x66(%rbp),%eax
cmp    $0x20,%eax
je     1532 <replace+0x3b2>
movl   $0x1,-0x44(%rbp)
jmp    1537 <replace+0x3b7>
jmp    1648 <replace+0x4c8>
cmpl   $0x2,-0x24(%rbp)
jne    1643 <replace+0x4c3>
mov    -0x10(%rbp),%rax
cmp    -0x60(%rbp),%rax
jae    1591 <replace+0x411>
mov    -0x60(%rbp),%rax
mov    -0x1(%rax),%al
mov    %al,-0x67(%rbp)
movsbl -0x67(%rbp),%eax
cmp    $0x22,%eax
je     158c <replace+0x40c>
movsbl -0x67(%rbp),%eax
cmp    $0x3c,%eax
je     158c <replace+0x40c>
movsbl -0x67(%rbp),%eax
cmp    $0x3a,%eax
je     158c <replace+0x40c>
movl   $0x1,-0x44(%rbp)
jmp    1591 <replace+0x411>
mov    -0x10(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0xf8(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xe8(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xf0(%rbp),%rcx
mov    %rax,%rdx
mov    -0xe8(%rbp),%rax
add    %rdx,%rcx
cmp    %rcx,%rax
jbe    163e <replace+0x4be>
cmpl   $0x0,-0x44(%rbp)
jne    163e <replace+0x4be>
mov    -0x60(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x100(%rbp),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x68(%rbp)
movsbl -0x68(%rbp),%eax
cmp    $0x22,%eax
je     1639 <replace+0x4b9>
movsbl -0x68(%rbp),%eax
cmp    $0x40,%eax
je     1639 <replace+0x4b9>
movl   $0x1,-0x44(%rbp)
jmp    163e <replace+0x4be>
jmp    1643 <replace+0x4c3>
jmp    1648 <replace+0x4c8>
jmp    164d <replace+0x4cd>
jmp    1652 <replace+0x4d2>
cmpl   $0x1,-0x44(%rbp)
jne    16c2 <replace+0x542>
mov    -0x60(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x70(%rbp),%rdx
call   1090 <memmove@plt>
mov    -0x70(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x70(%rbp),%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1090 <memmove@plt>
mov    -0x38(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x38(%rbp),%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    121e <replace+0x9e>
mov    -0x60(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x40(%rbp),%rax
sub    -0x38(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <realloc@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
jne    1728 <replace+0x5a8>
mov    0x28dc(%rip),%rax
mov    (%rax),%edi
lea    0x90b(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    17c1 <replace+0x641>
mov    -0x80(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    -0x58(%rbp),%rdx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x78(%rbp),%rdx
call   1090 <memmove@plt>
mov    -0x78(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x78(%rbp),%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1090 <memmove@plt>
mov    -0x38(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x40(%rbp),%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    17af <replace+0x62f>
mov    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    17b4 <replace+0x634>
jmp    121e <replace+0x9e>
jmp    17b9 <replace+0x639>
mov    -0x58(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %ecx,0x14(%rsp)
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
call   1050 <strlen@plt>
mov    %rax,%rbp
add    $0x1,%rbp
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %rax,0x18(%rsp)
mov    %r14,0x38(%rsp)
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rax,0x20(%rsp)
mov    %rbp,%rdi
call   1070 <malloc@plt>
test   %rax,%rax
je     1489 <replace+0x309>
mov    %rax,%r13
mov    %rbp,0x28(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <strstr@plt>
test   %rax,%rax
je     14a0 <replace+0x320>
mov    %rax,%r14
mov    0x20(%rsp),%rax
sub    0x18(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    0x14(%rsp),%eax
mov    %rax,0x40(%rsp)
mov    %r13,%rbp
mov    %r12,0x8(%rsp)
jmp    126d <replace+0xed>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%r15
sub    %rbx,%r14
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <memmove@plt>
add    %r14,%r13
mov    %r13,%rdi
mov    %r12,%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdx
call   1090 <memmove@plt>
add    %rbp,%r13
add    %rbp,%rbx
add    %r14,%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <strstr@plt>
mov    %rax,%r14
test   %rax,%rax
mov    %r15,%rbp
je     14a3 <replace+0x323>
cmpl   $0x3,0x14(%rsp)
ja     142e <replace+0x2ae>
mov    0x40(%rsp),%rax
lea    0xd7c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %r12d,%r12d
cmp    %r14,%rbx
jae    13d4 <replace+0x254>
movzbl -0x1(%r14),%eax
add    $0xd0,%al
xor    %r12d,%r12d
cmp    $0xa,%al
setb   %r12b
jmp    13d4 <replace+0x254>
xchg   %ax,%ax
xor    %r12d,%r12d
mov    $0x1,%dl
cmp    %r14,%rbx
jae    12e0 <replace+0x160>
movzbl -0x1(%r14),%eax
cmp    $0x3c,%rax
ja     12d5 <replace+0x155>
movabs $0x1000000500000000,%rcx
bt     %rax,%rcx
jb     12e0 <replace+0x160>
mov    $0x1,%r12d
xor    %edx,%edx
nopl   (%rax)
mov    %edx,0x10(%rsp)
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rax,%r15
mov    0x8(%rsp),%rdi
call   1050 <strlen@plt>
cmpb   $0x0,0x10(%rsp)
je     1420 <replace+0x2a0>
add    %rbx,%r15
add    %r14,%rax
cmp    %rax,%r15
jbe    1420 <replace+0x2a0>
movzbl (%rax),%eax
cmp    $0x3e,%rax
mov    0x8(%rsp),%r12
ja     1220 <replace+0xa0>
movabs $0x4000000500000000,%rcx
bt     %rax,%rcx
jb     142e <replace+0x2ae>
jmp    1220 <replace+0xa0>
xchg   %ax,%ax
xor    %esi,%esi
mov    $0x1,%r12b
cmp    %r14,%rbx
jae    1370 <replace+0x1f0>
movzbl -0x1(%r14),%eax
cmp    $0x3c,%rax
ja     1365 <replace+0x1e5>
movabs $0x1400000400000000,%rcx
bt     %rax,%rcx
jb     1370 <replace+0x1f0>
mov    $0x1,%esi
xor    %r12d,%r12d
nopl   (%rax)
mov    %esi,0x10(%rsp)
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rax,%r15
mov    0x8(%rsp),%rdi
call   1050 <strlen@plt>
test   %r12b,%r12b
je     140d <replace+0x28d>
add    %rbx,%r15
add    %r14,%rax
cmp    %rax,%r15
mov    0x10(%rsp),%r12d
jbe    1420 <replace+0x2a0>
movzbl (%rax),%eax
cmp    $0x22,%al
mov    0x8(%rsp),%r12
je     142e <replace+0x2ae>
cmp    $0x40,%al
je     142e <replace+0x2ae>
jmp    1220 <replace+0xa0>
nop
xor    %r12d,%r12d
cmp    %r14,%rbx
jae    13d4 <replace+0x254>
xor    %r12d,%r12d
cmpb   $0x3a,-0x1(%r14)
setne  %r12b
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rax,%r15
mov    0x8(%rsp),%rdi
call   1050 <strlen@plt>
test   %r12d,%r12d
jne    1420 <replace+0x2a0>
add    %rbx,%r15
add    %r14,%rax
cmp    %rax,%r15
jbe    1420 <replace+0x2a0>
movzbl (%rax),%eax
add    $0xd0,%al
cmp    $0xa,%al
mov    0x8(%rsp),%r12
jb     1220 <replace+0xa0>
jmp    142e <replace+0x2ae>
mov    0x10(%rsp),%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %r12d,%r12d
mov    0x8(%rsp),%r12
jne    1220 <replace+0xa0>
mov    0x28(%rsp),%rsi
add    0x30(%rsp),%rsi
mov    %rbp,%rdi
mov    %rsi,0x28(%rsp)
call   1080 <realloc@plt>
test   %rax,%rax
je     14b0 <replace+0x330>
mov    %rax,%r15
sub    %rbx,%r14
sub    %rbp,%r13
add    %rax,%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <memmove@plt>
add    %r14,%r13
mov    %r13,%rdi
mov    0x38(%rsp),%rsi
mov    0x20(%rsp),%rbp
mov    %rbp,%rdx
call   1090 <memmove@plt>
add    %rbp,%r13
mov    0x18(%rsp),%rbp
jmp    124d <replace+0xcd>
mov    0x2b50(%rip),%rax
mov    (%rax),%edi
lea    0xb77(%rip),%rsi
call   1060 <fprintf@plt>
jmp    14cd <replace+0x34d>
mov    %r13,%rbp
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
jmp    14cf <replace+0x34f>
mov    0x2b29(%rip),%rax
mov    (%rax),%edi
lea    0xb68(%rip),%rsi
call   1060 <fprintf@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %ebp,%ebp
mov    %rbp,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Cannot allocate memory\0A\00"
@.str.1 = [27 x i8] c"Cannot re-allocate memory\0A\00"
define i8* @replace(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8
%18 = alloca i8
%19 = alloca i8
%20 = alloca i8
%21 = alloca i8
%22 = alloca i8
%23 = alloca i8
%24 = alloca i8
%25 = alloca i64
%26 = alloca i64
%27 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%28 = load i8*, i8** %6
%29 = call i64 @strlen(i8* %28)
%30 = add i64 %29, 1
store i64 %30, i64* %10
%31 = load i8*, i8** %7
%32 = call i64 @strlen(i8* %31)
store i64 %32, i64* %11
%33 = load i8*, i8** %8
%34 = call i64 @strlen(i8* %33)
store i64 %34, i64* %12
store i32 0, i32* %13
%35 = load i64, i64* %10
%36 = call i8* @malloc(i64 %35)
store i8* %36, i8** %15
%37 = load i8*, i8** %15
%38 = icmp eq i8* %37, null
br i1 %38, label %39, label %42
39: ; preds = %4
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %5
br label %347
42: ; preds = %4
%43 = load i8*, i8** %15
store i8* %43, i8** %14
%44 = load i8*, i8** %15
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %345
46: ; preds = %42
br label %47
47: ; preds = %343, %263, %46
%48 = load i8*, i8** %6
%49 = load i8*, i8** %7
%50 = call i8* @strstr(i8* %48, i8* %49)
store i8* %50, i8** %16
%51 = load i8*, i8** %16
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %339
53: ; preds = %47
store i32 0, i32* %13
%54 = load i32, i32* %9
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %102
56: ; preds = %53
%57 = load i8*, i8** %6
%58 = load i8*, i8** %16
%59 = icmp ult i8* %57, %58
br i1 %59, label %60, label %73
60: ; preds = %56
%61 = load i8*, i8** %16
%62 = getelementptr inbounds i8, i8* %61, i64 -1
%63 = load i8, i8* %62
store i8 %63, i8* %17
%64 = load i8, i8* %17
%65 = sext i8 %64 to i32
%66 = icmp sge i32 %65, 48
br i1 %66, label %67, label %72
67: ; preds = %60
%68 = load i8, i8* %17
%69 = sext i8 %68 to i32
%70 = icmp sle i32 %69, 57
br i1 %70, label %71, label %72
71: ; preds = %67
store i32 1, i32* %13
br label %72
72: ; preds = %71, %67, %60
br label %73
73: ; preds = %72, %56
%74 = load i8*, i8** %6
%75 = load i8*, i8** %6
%76 = call i64 @strlen(i8* %75)
%77 = getelementptr inbounds i8, i8* %74, i64 %76
%78 = load i8*, i8** %16
%79 = load i8*, i8** %7
%80 = call i64 @strlen(i8* %79)
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = icmp ugt i8* %77, %81
br i1 %82, label %83, label %101
83: ; preds = %73
%84 = load i32, i32* %13
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %101
86: ; preds = %83
%87 = load i8*, i8** %16
%88 = load i8*, i8** %7
%89 = call i64 @strlen(i8* %88)
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = load i8, i8* %90
store i8 %91, i8* %18
%92 = load i8, i8* %18
%93 = sext i8 %92 to i32
%94 = icmp sge i32 %93, 48
br i1 %94, label %95, label %100
95: ; preds = %86
%96 = load i8, i8* %18
%97 = sext i8 %96 to i32
%98 = icmp sle i32 %97, 57
br i1 %98, label %99, label %100
99: ; preds = %95
store i32 1, i32* %13
br label %100
100: ; preds = %99, %95, %86
br label %101
101: ; preds = %100, %83, %73
br label %260
102: ; preds = %53
%103 = load i32, i32* %9
%104 = icmp eq i32 %103, 3
br i1 %104, label %105, label %147
105: ; preds = %102
%106 = load i8*, i8** %6
%107 = load i8*, i8** %16
%108 = icmp ult i8* %106, %107
br i1 %108, label %109, label %118
109: ; preds = %105
%110 = load i8*, i8** %16
%111 = getelementptr inbounds i8, i8* %110, i64 -1
%112 = load i8, i8* %111
store i8 %112, i8* %19
%113 = load i8, i8* %19
%114 = sext i8 %113 to i32
%115 = icmp ne i32 %114, 58
br i1 %115, label %116, label %117
116: ; preds = %109
store i32 1, i32* %13
br label %117
117: ; preds = %116, %109
br label %118
118: ; preds = %117, %105
%119 = load i8*, i8** %6
%120 = load i8*, i8** %6
%121 = call i64 @strlen(i8* %120)
%122 = getelementptr inbounds i8, i8* %119, i64 %121
%123 = load i8*, i8** %16
%124 = load i8*, i8** %7
%125 = call i64 @strlen(i8* %124)
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = icmp ugt i8* %122, %126
br i1 %127, label %128, label %146
128: ; preds = %118
%129 = load i32, i32* %13
%130 = icmp eq i32 %129, 0
br i1 %130, label %131, label %146
131: ; preds = %128
%132 = load i8*, i8** %16
%133 = load i8*, i8** %7
%134 = call i64 @strlen(i8* %133)
%135 = getelementptr inbounds i8, i8* %132, i64 %134
%136 = load i8, i8* %135
store i8 %136, i8* %20
%137 = load i8, i8* %20
%138 = sext i8 %137 to i32
%139 = icmp sge i32 %138, 48
br i1 %139, label %140, label %145
140: ; preds = %131
%141 = load i8, i8* %20
%142 = sext i8 %141 to i32
%143 = icmp sle i32 %142, 57
br i1 %143, label %144, label %145
144: ; preds = %140
store i32 1, i32* %13
br label %145
145: ; preds = %144, %140, %131
br label %146
146: ; preds = %145, %128, %118
br label %259
147: ; preds = %102
%148 = load i32, i32* %9
%149 = icmp eq i32 %148, 1
br i1 %149, label %150, label %204
150: ; preds = %147
%151 = load i8*, i8** %6
%152 = load i8*, i8** %16
%153 = icmp ult i8* %151, %152
br i1 %153, label %154, label %171
154: ; preds = %150
%155 = load i8*, i8** %16
%156 = getelementptr inbounds i8, i8* %155, i64 -1
%157 = load i8, i8* %156
store i8 %157, i8* %21
%158 = load i8, i8* %21
%159 = sext i8 %158 to i32
%160 = icmp ne i32 %159, 34
br i1 %160, label %161, label %170
161: ; preds = %154
%162 = load i8, i8* %21
%163 = sext i8 %162 to i32
%164 = icmp ne i32 %163, 60
br i1 %164, label %165, label %170
165: ; preds = %161
%166 = load i8, i8* %21
%167 = sext i8 %166 to i32
%168 = icmp ne i32 %167, 32
br i1 %168, label %169, label %170
169: ; preds = %165
store i32 1, i32* %13
br label %170
170: ; preds = %169, %165, %161, %154
br label %171
171: ; preds = %170, %150
%172 = load i8*, i8** %6
%173 = load i8*, i8** %6
%174 = call i64 @strlen(i8* %173)
%175 = getelementptr inbounds i8, i8* %172, i64 %174
%176 = load i8*, i8** %16
%177 = load i8*, i8** %7
%178 = call i64 @strlen(i8* %177)
%179 = getelementptr inbounds i8, i8* %176, i64 %178
%180 = icmp ugt i8* %175, %179
br i1 %180, label %181, label %203
181: ; preds = %171
%182 = load i32, i32* %13
%183 = icmp eq i32 %182, 0
br i1 %183, label %184, label %203
184: ; preds = %181
%185 = load i8*, i8** %16
%186 = load i8*, i8** %7
%187 = call i64 @strlen(i8* %186)
%188 = getelementptr inbounds i8, i8* %185, i64 %187
%189 = load i8, i8* %188
store i8 %189, i8* %22
%190 = load i8, i8* %22
%191 = sext i8 %190 to i32
%192 = icmp ne i32 %191, 34
br i1 %192, label %193, label %202
193: ; preds = %184
%194 = load i8, i8* %22
%195 = sext i8 %194 to i32
%196 = icmp ne i32 %195, 62
br i1 %196, label %197, label %202
197: ; preds = %193
%198 = load i8, i8* %22
%199 = sext i8 %198 to i32
%200 = icmp ne i32 %199, 32
br i1 %200, label %201, label %202
201: ; preds = %197
store i32 1, i32* %13
br label %202
202: ; preds = %201, %197, %193, %184
br label %203
203: ; preds = %202, %181, %171
br label %258
204: ; preds = %147
%205 = load i32, i32* %9
%206 = icmp eq i32 %205, 2
br i1 %206, label %207, label %257
207: ; preds = %204
%208 = load i8*, i8** %6
%209 = load i8*, i8** %16
%210 = icmp ult i8* %208, %209
br i1 %210, label %211, label %228
211: ; preds = %207
%212 = load i8*, i8** %16
%213 = getelementptr inbounds i8, i8* %212, i64 -1
%214 = load i8, i8* %213
store i8 %214, i8* %23
%215 = load i8, i8* %23
%216 = sext i8 %215 to i32
%217 = icmp ne i32 %216, 34
br i1 %217, label %218, label %227
218: ; preds = %211
%219 = load i8, i8* %23
%220 = sext i8 %219 to i32
%221 = icmp ne i32 %220, 60
br i1 %221, label %222, label %227
222: ; preds = %218
%223 = load i8, i8* %23
%224 = sext i8 %223 to i32
%225 = icmp ne i32 %224, 58
br i1 %225, label %226, label %227
226: ; preds = %222
store i32 1, i32* %13
br label %227
227: ; preds = %226, %222, %218, %211
br label %228
228: ; preds = %227, %207
%229 = load i8*, i8** %6
%230 = load i8*, i8** %6
%231 = call i64 @strlen(i8* %230)
%232 = getelementptr inbounds i8, i8* %229, i64 %231
%233 = load i8*, i8** %16
%234 = load i8*, i8** %7
%235 = call i64 @strlen(i8* %234)
%236 = getelementptr inbounds i8, i8* %233, i64 %235
%237 = icmp ugt i8* %232, %236
br i1 %237, label %238, label %256
238: ; preds = %228
%239 = load i32, i32* %13
%240 = icmp eq i32 %239, 0
br i1 %240, label %241, label %256
241: ; preds = %238
%242 = load i8*, i8** %16
%243 = load i8*, i8** %7
%244 = call i64 @strlen(i8* %243)
%245 = getelementptr inbounds i8, i8* %242, i64 %244
%246 = load i8, i8* %245
store i8 %246, i8* %24
%247 = load i8, i8* %24
%248 = sext i8 %247 to i32
%249 = icmp ne i32 %248, 34
br i1 %249, label %250, label %255
250: ; preds = %241
%251 = load i8, i8* %24
%252 = sext i8 %251 to i32
%253 = icmp ne i32 %252, 64
br i1 %253, label %254, label %255
254: ; preds = %250
store i32 1, i32* %13
br label %255
255: ; preds = %254, %250, %241
br label %256
256: ; preds = %255, %238, %228
br label %257
257: ; preds = %256, %204
br label %258
258: ; preds = %257, %203
br label %259
259: ; preds = %258, %146
br label %260
260: ; preds = %259, %101
%261 = load i32, i32* %13
%262 = icmp eq i32 %261, 1
br i1 %262, label %263, label %289
263: ; preds = %260
%264 = load i8*, i8** %16
%265 = load i8*, i8** %6
%266 = ptrtoint i8* %264 to i64
%267 = ptrtoint i8* %265 to i64
%268 = sub i64 %266, %267
store i64 %268, i64* %25
%269 = load i8*, i8** %14
%270 = load i8*, i8** %6
%271 = load i64, i64* %25
%272 = call i32 @memmove(i8* %269, i8* %270, i64 %271)
%273 = load i64, i64* %25
%274 = load i8*, i8** %6
%275 = getelementptr inbounds i8, i8* %274, i64 %273
store i8* %275, i8** %6
%276 = load i64, i64* %25
%277 = load i8*, i8** %14
%278 = getelementptr inbounds i8, i8* %277, i64 %276
store i8* %278, i8** %14
%279 = load i8*, i8** %14
%280 = load i8*, i8** %7
%281 = load i64, i64* %11
%282 = call i32 @memmove(i8* %279, i8* %280, i64 %281)
%283 = load i64, i64* %11
%284 = load i8*, i8** %6
%285 = getelementptr inbounds i8, i8* %284, i64 %283
store i8* %285, i8** %6
%286 = load i64, i64* %11
%287 = load i8*, i8** %14
%288 = getelementptr inbounds i8, i8* %287, i64 %286
store i8* %288, i8** %14
br label %47
289: ; preds = %260
%290 = load i8*, i8** %16
%291 = load i8*, i8** %6
%292 = ptrtoint i8* %290 to i64
%293 = ptrtoint i8* %291 to i64
%294 = sub i64 %292, %293
store i64 %294, i64* %26
%295 = load i64, i64* %12
%296 = load i64, i64* %11
%297 = sub i64 %295, %296
%298 = load i64, i64* %10
%299 = add i64 %298, %297
store i64 %299, i64* %10
%300 = load i8*, i8** %15
%301 = load i64, i64* %10
%302 = call i8* @realloc(i8* %300, i64 %301)
store i8* %302, i8** %27
%303 = load i8*, i8** %27
%304 = icmp eq i8* %303, null
br i1 %304, label %305, label %310
305: ; preds = %289
%306 = load i32, i32* @stderr
%307 = call i32 @fprintf(i32 %306, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%308 = load i8*, i8** %15
%309 = call i32 @free(i8* %308)
store i8* null, i8** %5
br label %347
310: ; preds = %289
%311 = load i8*, i8** %27
%312 = load i8*, i8** %14
%313 = load i8*, i8** %15
%314 = ptrtoint i8* %312 to i64
%315 = ptrtoint i8* %313 to i64
%316 = sub i64 %314, %315
%317 = getelementptr inbounds i8, i8* %311, i64 %316
store i8* %317, i8** %14
%318 = load i8*, i8** %27
store i8* %318, i8** %15
%319 = load i8*, i8** %14
%320 = load i8*, i8** %6
%321 = load i64, i64* %26
%322 = call i32 @memmove(i8* %319, i8* %320, i64 %321)
%323 = load i64, i64* %26
%324 = load i8*, i8** %6
%325 = getelementptr inbounds i8, i8* %324, i64 %323
store i8* %325, i8** %6
%326 = load i64, i64* %26
%327 = load i8*, i8** %14
%328 = getelementptr inbounds i8, i8* %327, i64 %326
store i8* %328, i8** %14
%329 = load i8*, i8** %14
%330 = load i8*, i8** %8
%331 = load i64, i64* %12
%332 = call i32 @memmove(i8* %329, i8* %330, i64 %331)
%333 = load i64, i64* %11
%334 = load i8*, i8** %6
%335 = getelementptr inbounds i8, i8* %334, i64 %333
store i8* %335, i8** %6
%336 = load i64, i64* %12
%337 = load i8*, i8** %14
%338 = getelementptr inbounds i8, i8* %337, i64 %336
store i8* %338, i8** %14
br label %343
339: ; preds = %47
%340 = load i8*, i8** %14
%341 = load i8*, i8** %6
%342 = call i32 @strcpy(i8* %340, i8* %341)
br label %344
343: ; preds = %310
br label %47
344: ; preds = %339
br label %345
345: ; preds = %344, %42
%346 = load i8*, i8** %15
store i8* %346, i8** %5
br label %347
347: ; preds = %345, %305, %39
%348 = load i8*, i8** %5
ret i8* %348
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Cannot allocate memory\0A\00"
@.str.1 = [27 x i8] c"Cannot re-allocate memory\0A\00"
define i8* @replace(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add i64 %5, 1
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%9 = tail call i8* @malloc(i64 %6)
%10 = icmp eq i8* %9, null
br i1 %10, label %16, label %11
11: ; preds = %4
%12 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%13 = icmp eq i8* %12, null
br i1 %13, label %140, label %14
14: ; preds = %11
%15 = sub i64 %8, %7
br label %19
16: ; preds = %4
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %145
19: ; preds = %14, %131
%20 = phi i8* [ %12, %14 ], [ %138, %131 ]
%21 = phi i8* [ %0, %14 ], [ %137, %131 ]
%22 = phi i64 [ %6, %14 ], [ %134, %131 ]
%23 = phi i8* [ %9, %14 ], [ %133, %131 ]
%24 = phi i8* [ %9, %14 ], [ %132, %131 ]
switch i32 %3, label %111 [
i32 0, label %25
i32 3, label %46
i32 1, label %66
i32 2, label %83
]
25: ; preds = %19
%26 = icmp ult i8* %21, %20
br i1 %26, label %27, label %33
27: ; preds = %25
%28 = getelementptr inbounds i8, i8* %20, i64 -1
%29 = load i8, i8* %28
%30 = add i8 %29, -48
%31 = icmp ult i8 %30, 10
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %27, %25
%34 = phi i32 [ %32, %27 ], [ 0, %25 ]
%35 = tail call i64 @strlen(i8* dereferenceable(1) %21)
%36 = getelementptr inbounds i8, i8* %21, i64 %35
%37 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%38 = getelementptr inbounds i8, i8* %20, i64 %37
%39 = icmp ugt i8* %36, %38
%40 = icmp eq i32 %34, 0
%41 = and i1 %40, %39
br i1 %41, label %42, label %100
42: ; preds = %33
%43 = load i8, i8* %38
%44 = add i8 %43, -48
%45 = icmp ult i8 %44, 10
br i1 %45, label %103, label %111
46: ; preds = %19
%47 = icmp ult i8* %21, %20
br i1 %47, label %48, label %53
48: ; preds = %46
%49 = getelementptr inbounds i8, i8* %20, i64 -1
%50 = load i8, i8* %49
%51 = icmp ne i8 %50, 58
%52 = zext i1 %51 to i32
br label %53
53: ; preds = %48, %46
%54 = phi i32 [ %52, %48 ], [ 0, %46 ]
%55 = tail call i64 @strlen(i8* dereferenceable(1) %21)
%56 = getelementptr inbounds i8, i8* %21, i64 %55
%57 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%58 = getelementptr inbounds i8, i8* %20, i64 %57
%59 = icmp ugt i8* %56, %58
%60 = icmp eq i32 %54, 0
%61 = and i1 %60, %59
br i1 %61, label %62, label %100
62: ; preds = %53
%63 = load i8, i8* %58
%64 = add i8 %63, -48
%65 = icmp ult i8 %64, 10
br i1 %65, label %103, label %111
66: ; preds = %19
%67 = icmp ult i8* %21, %20
br i1 %67, label %68, label %72
68: ; preds = %66
%69 = getelementptr inbounds i8, i8* %20, i64 -1
%70 = load i8, i8* %69
switch i8 %70, label %71 [
i8 60, label %72
i8 34, label %72
i8 32, label %72
]
71: ; preds = %68
br label %72
72: ; preds = %71, %68, %68, %68, %66
%73 = phi i1 [ false, %71 ], [ true, %68 ], [ true, %68 ], [ true, %68 ], [ true, %66 ]
%74 = phi i32 [ 1, %71 ], [ 0, %68 ], [ 0, %68 ], [ 0, %68 ], [ 0, %66 ]
%75 = tail call i64 @strlen(i8* dereferenceable(1) %21)
%76 = getelementptr inbounds i8, i8* %21, i64 %75
%77 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%78 = getelementptr inbounds i8, i8* %20, i64 %77
%79 = icmp ugt i8* %76, %78
%80 = and i1 %73, %79
br i1 %80, label %81, label %100
81: ; preds = %72
%82 = load i8, i8* %78
switch i8 %82, label %103 [
i8 62, label %111
i8 34, label %111
i8 32, label %111
]
83: ; preds = %19
%84 = icmp ult i8* %21, %20
br i1 %84, label %85, label %89
85: ; preds = %83
%86 = getelementptr inbounds i8, i8* %20, i64 -1
%87 = load i8, i8* %86
switch i8 %87, label %88 [
i8 60, label %89
i8 58, label %89
i8 34, label %89
]
88: ; preds = %85
br label %89
89: ; preds = %88, %85, %85, %85, %83
%90 = phi i1 [ false, %88 ], [ true, %85 ], [ true, %85 ], [ true, %85 ], [ true, %83 ]
%91 = phi i32 [ 1, %88 ], [ 0, %85 ], [ 0, %85 ], [ 0, %85 ], [ 0, %83 ]
%92 = tail call i64 @strlen(i8* dereferenceable(1) %21)
%93 = getelementptr inbounds i8, i8* %21, i64 %92
%94 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%95 = getelementptr inbounds i8, i8* %20, i64 %94
%96 = icmp ugt i8* %93, %95
%97 = and i1 %90, %96
br i1 %97, label %98, label %100
98: ; preds = %89
%99 = load i8, i8* %95
switch i8 %99, label %103 [
i8 64, label %111
i8 34, label %111
]
100: ; preds = %53, %89, %72, %33
%101 = phi i32 [ %34, %33 ], [ %54, %53 ], [ %74, %72 ], [ %91, %89 ]
%102 = icmp eq i32 %101, 1
br i1 %102, label %103, label %111
103: ; preds = %98, %62, %42, %81, %100
%104 = ptrtoint i8* %20 to i64
%105 = ptrtoint i8* %21 to i64
%106 = sub i64 %104, %105
%107 = tail call i32 @memmove(i8* %23, i8* %21, i64 %106)
%108 = getelementptr inbounds i8, i8* %23, i64 %106
%109 = tail call i32 @memmove(i8* %108, i8* %1, i64 %7)
%110 = getelementptr inbounds i8, i8* %108, i64 %7
br label %131
111: ; preds = %98, %98, %19, %81, %81, %81, %62, %42, %100
%112 = ptrtoint i8* %20 to i64
%113 = ptrtoint i8* %21 to i64
%114 = sub i64 %112, %113
%115 = add i64 %22, %15
%116 = tail call i8* @realloc(i8* %24, i64 %115)
%117 = icmp eq i8* %116, null
br i1 %117, label %118, label %122
118: ; preds = %111
%119 = load i32, i32* @stderr
%120 = tail call i32 @fprintf(i32 %119, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%121 = tail call i32 @free(i8* %24)
br label %145
122: ; preds = %111
%123 = ptrtoint i8* %23 to i64
%124 = ptrtoint i8* %24 to i64
%125 = sub i64 %123, %124
%126 = getelementptr inbounds i8, i8* %116, i64 %125
%127 = tail call i32 @memmove(i8* %126, i8* %21, i64 %114)
%128 = getelementptr inbounds i8, i8* %126, i64 %114
%129 = tail call i32 @memmove(i8* %128, i8* %2, i64 %8)
%130 = getelementptr inbounds i8, i8* %128, i64 %8
br label %131
131: ; preds = %122, %103
%132 = phi i8* [ %24, %103 ], [ %116, %122 ]
%133 = phi i8* [ %110, %103 ], [ %130, %122 ]
%134 = phi i64 [ %22, %103 ], [ %115, %122 ]
%135 = phi i64 [ %106, %103 ], [ %114, %122 ]
%136 = getelementptr inbounds i8, i8* %21, i64 %7
%137 = getelementptr inbounds i8, i8* %136, i64 %135
%138 = tail call i8* @strstr(i8* dereferenceable(1) %137, i8* dereferenceable(1) %1)
%139 = icmp eq i8* %138, null
br i1 %139, label %140, label %19
140: ; preds = %131, %11
%141 = phi i8* [ %9, %11 ], [ %132, %131 ]
%142 = phi i8* [ %9, %11 ], [ %133, %131 ]
%143 = phi i8* [ %0, %11 ], [ %137, %131 ]
%144 = tail call i32 @strcpy(i8* %142, i8* %143)
br label %145
145: ; preds = %118, %140, %16
%146 = phi i8* [ null, %16 ], [ %141, %140 ], [ null, %118 ]
ret i8* %146
}