#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *combine(char *, char *);
char *compact(char *);
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ expand(char *, char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int find_in(char **, int, char *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ qsort_arr(char **, char **, int /*<<< orphan*/, int);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, const char *argv[]) {
  FILE *in, *out;
  char *pattab_key[(256 * 1024)];
  char *pattab_val[(256 * 1024)];
  int patterns = 0;
  char *newpattab_key[(256 * 1024)];
  char *newpattab_val[(256 * 1024)];
  int newpatterns = 0;
  char format[132];
  int p;
  if (argc != 3)
    die("Usage: <orig-file> <new-file>\n");
  if ((in = fopen(argv[1], "r")) == NULL)
    die("Could not read input");
  if ((out = fopen(argv[2], "w")) == NULL)
    die("Could not create output");
  while (fgets(format, 132, in) != NULL) {
    int l = strlen(format);
    if (format[l - 1] == '\n') {
      l--;
      format[l] = 0;
    }
    if (format[0] == '%' || format[0] == 0) {
    } else {
      if (format[l - 1] == '%') {
        l--;
        format[l] = 0;
      }
      int i, j;
      char *pat = (char *)malloc(l + 1);
      char *org = (char *)malloc(l * 2 + 1);
      if (pat == NULL || org == NULL)
        die("not enough memory");
      expand(org, format, l);
      for (i = 0, j = 0; i < l; i++) {
        char c = format[i];
        if (c < '0' || c > '9')
          pat[j++] = c;
      }
      pat[j] = 0;
      p = patterns;
      pattab_key[patterns] = pat;
      pattab_val[patterns++] = org;
      if (patterns > (256 * 1024))
        die("to many base patterns");
    }
  }
  fclose(in);
  qsort_arr(pattab_key, pattab_val, 0, patterns - 1);
  for (p = 0; p < patterns; p++) {
    char *pat = pattab_key[p];
    int patsize = strlen(pat);
    int j, l;
    for (l = 1; l <= patsize; l++) {
      for (j = 1; j <= l; j++) {
        int i = l - j;
        int subpat_ndx;
        char subpat[132];
        strncpy(subpat, pat + i, j);
        subpat[j] = 0;
        if ((subpat_ndx = find_in(pattab_key, patterns, subpat)) >= 0) {
          int newpat_ndx;
          char *newpat = malloc(l + 1);
          if (newpat == NULL)
            die("not enough memory");
          strncpy(newpat, pat + 0, l);
          newpat[l] = 0;
          if ((newpat_ndx = find_in(newpattab_key, newpatterns, newpat)) < 0) {
            char *neworg = malloc(132);
            if (neworg == NULL)
              die("not enough memory");
            expand(neworg, newpat, l);
            newpattab_key[newpatterns] = newpat;
            newpattab_val[newpatterns++] =
                combine(neworg, pattab_val[subpat_ndx]);
            if (newpatterns > (256 * 1024))
              die("to many new patterns");
          } else {
            free(newpat);
            newpattab_val[newpat_ndx] =
                combine(newpattab_val[newpat_ndx], pattab_val[subpat_ndx]);
          }
        }
      }
    }
  }
  for (p = 0; p < newpatterns; p++) {
    fprintf(out, "%s\n", compact(newpattab_val[p]));
    free(newpattab_key[p]);
    free(newpattab_val[p]);
  }
  fclose(out);
  for (p = 0; p < patterns; p++) {
    free(pattab_key[p]);
    free(pattab_val[p]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8001b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x400024(%rbp)
movl   $0x0,-0x800034(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1223 <main+0x43>
lea    0xde2(%rip),%rdi
call   10e0 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xded(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1251 <main+0x71>
lea    0xdd5(%rip),%rdi
call   10e0 <die@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdd6(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    127f <main+0x9f>
lea    0xdbe(%rip),%rdi
call   10e0 <die@plt>
jmp    1284 <main+0xa4>
lea    -0x8000c0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x84,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     14cf <main+0x2ef>
lea    -0x8000c0(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x8000c8(%rbp)
mov    -0x8000c8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x8000c0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    12ef <main+0x10f>
mov    -0x8000c8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8000c8(%rbp)
movslq -0x8000c8(%rbp),%rax
movb   $0x0,-0x8000c0(%rbp,%rax,1)
movsbl -0x8000c0(%rbp),%eax
cmp    $0x25,%eax
je     130f <main+0x12f>
movsbl -0x8000c0(%rbp),%eax
cmp    $0x0,%eax
jne    1314 <main+0x134>
jmp    14ca <main+0x2ea>
mov    -0x8000c8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x8000c0(%rbp,%rax,1),%eax
ff
cmp    $0x25,%eax
jne    134e <main+0x16e>
mov    -0x8000c8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8000c8(%rbp)
movslq -0x8000c8(%rbp),%rax
movb   $0x0,-0x8000c0(%rbp,%rax,1)
mov    -0x8000c8(%rbp),%edi
add    $0x1,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x8000d8(%rbp)
mov    -0x8000c8(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x8000e0(%rbp)
cmpq   $0x0,-0x8000d8(%rbp)
je     1397 <main+0x1b7>
cmpq   $0x0,-0x8000e0(%rbp)
jne    13a3 <main+0x1c3>
lea    0xcb2(%rip),%rdi
call   10e0 <die@plt>
mov    -0x8000e0(%rbp),%rdi
lea    -0x8000c0(%rbp),%rsi
mov    -0x8000c8(%rbp),%edx
call   10f0 <expand@plt>
movl   $0x0,-0x8000cc(%rbp)
movl   $0x0,-0x8000d0(%rbp)
mov    -0x8000cc(%rbp),%eax
cmp    -0x8000c8(%rbp),%eax
jge    1453 <main+0x273>
movslq -0x8000cc(%rbp),%rax
mov    -0x8000c0(%rbp,%rax,1),%al
mov    %al,-0x8000e1(%rbp)
movsbl -0x8000e1(%rbp),%eax
cmp    $0x30,%eax
jl     1416 <main+0x236>
movsbl -0x8000e1(%rbp),%eax
cmp    $0x39,%eax
jle    143a <main+0x25a>
mov    -0x8000e1(%rbp),%dl
mov    -0x8000d8(%rbp),%rax
mov    -0x8000d0(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x8000d0(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    143f <main+0x25f>
mov    -0x8000cc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8000cc(%rbp)
jmp    13d0 <main+0x1f0>
mov    -0x8000d8(%rbp),%rax
movslq -0x8000d0(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x400024(%rbp),%eax
mov    %eax,-0x8000c4(%rbp)
mov    -0x8000d8(%rbp),%rcx
movslq -0x400024(%rbp),%rax
mov    %rcx,-0x200020(%rbp,%rax,8)
ff
mov    -0x8000e0(%rbp),%rcx
mov    -0x400024(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x400024(%rbp)
cltq
mov    %rcx,-0x400020(%rbp,%rax,8)
ff
cmpl   $0x40000,-0x400024(%rbp)
jle    14c5 <main+0x2e5>
lea    0xba2(%rip),%rdi
call   10e0 <die@plt>
jmp    14ca <main+0x2ea>
jmp    1284 <main+0xa4>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x200020(%rbp),%rdi
lea    -0x400020(%rbp),%rsi
mov    -0x400024(%rbp),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
call   10c0 <qsort_arr@plt>
movl   $0x0,-0x8000c4(%rbp)
mov    -0x8000c4(%rbp),%eax
cmp    -0x400024(%rbp),%eax
jge    17a5 <main+0x5c5>
movslq -0x8000c4(%rbp),%rax
mov    -0x200020(%rbp,%rax,8),%rax
ff
mov    %rax,-0x8000f0(%rbp)
mov    -0x8000f0(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x8000f4(%rbp)
movl   $0x1,-0x8000fc(%rbp)
mov    -0x8000fc(%rbp),%eax
cmp    -0x8000f4(%rbp),%eax
jg     178c <main+0x5ac>
movl   $0x1,-0x8000f8(%rbp)
mov    -0x8000f8(%rbp),%eax
cmp    -0x8000fc(%rbp),%eax
jg     1773 <main+0x593>
mov    -0x8000fc(%rbp),%eax
sub    -0x8000f8(%rbp),%eax
mov    %eax,-0x800100(%rbp)
lea    -0x800190(%rbp),%rdi
mov    -0x8000f0(%rbp),%rsi
movslq -0x800100(%rbp),%rax
add    %rax,%rsi
mov    -0x8000f8(%rbp),%edx
call   1040 <strncpy@plt>
movslq -0x8000f8(%rbp),%rax
movb   $0x0,-0x800190(%rbp,%rax,1)
lea    -0x200020(%rbp),%rdi
mov    -0x400024(%rbp),%esi
lea    -0x800190(%rbp),%rdx
call   1100 <find_in@plt>
mov    %eax,-0x800104(%rbp)
cmp    $0x0,%eax
jl     175a <main+0x57a>
mov    -0x8000fc(%rbp),%edi
add    $0x1,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x8001a0(%rbp)
cmpq   $0x0,-0x8001a0(%rbp)
jne    160d <main+0x42d>
lea    0xa48(%rip),%rdi
call   10e0 <die@plt>
mov    -0x8001a0(%rbp),%rdi
mov    -0x8000f0(%rbp),%rsi
mov    -0x8000fc(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x8001a0(%rbp),%rax
movslq -0x8000fc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
lea    -0x600030(%rbp),%rdi
mov    -0x800034(%rbp),%esi
mov    -0x8001a0(%rbp),%rdx
call   1100 <find_in@plt>
mov    %eax,-0x800194(%rbp)
cmp    $0x0,%eax
jge    1714 <main+0x534>
mov    $0x84,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x8001a8(%rbp)
cmpq   $0x0,-0x8001a8(%rbp)
jne    168b <main+0x4ab>
lea    0x9ca(%rip),%rdi
call   10e0 <die@plt>
mov    -0x8001a8(%rbp),%rdi
mov    -0x8001a0(%rbp),%rsi
mov    -0x8000fc(%rbp),%edx
call   10f0 <expand@plt>
mov    -0x8001a0(%rbp),%rcx
movslq -0x800034(%rbp),%rax
mov    %rcx,-0x600030(%rbp,%rax,8)
ff
mov    -0x8001a8(%rbp),%rdi
movslq -0x800104(%rbp),%rax
mov    -0x400020(%rbp,%rax,8),%rsi
ff
call   1070 <combine@plt>
mov    %rax,%rcx
mov    -0x800034(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x800034(%rbp)
cltq
mov    %rcx,-0x800030(%rbp,%rax,8)
ff
cmpl   $0x40000,-0x800034(%rbp)
jle    170f <main+0x52f>
lea    0x96e(%rip),%rdi
call   10e0 <die@plt>
jmp    1755 <main+0x575>
mov    -0x8001a0(%rbp),%rdi
call   1030 <free@plt>
movslq -0x800194(%rbp),%rax
mov    -0x800030(%rbp,%rax,8),%rdi
ff
movslq -0x800104(%rbp),%rax
mov    -0x400020(%rbp,%rax,8),%rsi
ff
call   1070 <combine@plt>
mov    %rax,%rcx
movslq -0x800194(%rbp),%rax
mov    %rcx,-0x800030(%rbp,%rax,8)
ff
jmp    175a <main+0x57a>
jmp    175f <main+0x57f>
mov    -0x8000f8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8000f8(%rbp)
jmp    1560 <main+0x380>
jmp    1778 <main+0x598>
mov    -0x8000fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8000fc(%rbp)
jmp    1544 <main+0x364>
jmp    1791 <main+0x5b1>
mov    -0x8000c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8000c4(%rbp)
jmp    1500 <main+0x320>
movl   $0x0,-0x8000c4(%rbp)
mov    -0x8000c4(%rbp),%eax
cmp    -0x800034(%rbp),%eax
jge    1832 <main+0x652>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8001b0(%rbp)
movslq -0x8000c4(%rbp),%rax
mov    -0x800030(%rbp,%rax,8),%rdi
ff
call   10a0 <compact@plt>
mov    -0x8001b0(%rbp),%rdi
mov    %rax,%rdx
lea    0x89c(%rip),%rsi
call   1090 <fprintf@plt>
movslq -0x8000c4(%rbp),%rax
mov    -0x600030(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
movslq -0x8000c4(%rbp),%rax
mov    -0x800030(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x8000c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8000c4(%rbp)
jmp    17af <main+0x5cf>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x8000c4(%rbp)
mov    -0x8000c4(%rbp),%eax
cmp    -0x400024(%rbp),%eax
jge    1893 <main+0x6b3>
movslq -0x8000c4(%rbp),%rax
mov    -0x200020(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
movslq -0x8000c4(%rbp),%rax
mov    -0x400020(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x8000c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8000c4(%rbp)
jmp    1845 <main+0x665>
xor    %eax,%eax
add    $0x8001b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800188,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1205 <main+0x25>
lea    0xe00(%rip),%rdi
call   10e0 <die@plt>
mov    0x8(%rbx),%rdi
lea    0xe0f(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1229 <main+0x49>
lea    0xdfd(%rip),%rdi
call   10e0 <die@plt>
mov    0x10(%rbx),%rdi
lea    0xe02(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    124d <main+0x6d>
lea    0xdf0(%rip),%rdi
call   10e0 <die@plt>
mov    %rbx,0x18(%rsp)
lea    0x60(%rsp),%rdi
mov    $0x84,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     13d9 <main+0x1f9>
lea    0x60(%rsp),%r12
jmp    129c <main+0xbc>
nopw   0x0(%rax,%rax,1)
mov    %r13,%r14
mov    %r12,%rdi
mov    $0x84,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     13d9 <main+0x1f9>
mov    %r14,%r13
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %eax,%r14d
cltq
cmpb   $0xa,0x5f(%rsp,%rax,1)
jne    12bf <main+0xdf>
add    $0xffffffffffffffff,%rax
movb   $0x0,0x60(%rsp,%rax,1)
mov    %eax,%r14d
mov    0x60(%rsp),%al
test   %al,%al
je     1280 <main+0xa0>
cmp    $0x25,%al
je     1280 <main+0xa0>
movslq %r14d,%rax
cmpb   $0x25,0x5f(%rsp,%rax,1)
jne    12e1 <main+0x101>
add    $0xffffffffffffffff,%rax
movb   $0x0,0x60(%rsp,%rax,1)
mov    %eax,%r14d
lea    0x1(%r14),%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
lea    (%r14,%r14,1),%edi
add    $0x1,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
test   %rbx,%rbx
je     1306 <main+0x126>
test   %rbp,%rbp
jne    1312 <main+0x132>
lea    0xd43(%rip),%rdi
call   10e0 <die@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   10f0 <expand@plt>
test   %r14d,%r14d
jle    134f <main+0x16f>
mov    %r14d,%r8d
cmp    $0x1,%r14d
jne    138a <main+0x1aa>
xor    %edx,%edx
xor    %eax,%eax
test   $0x1,%r8b
je     1351 <main+0x171>
mov    0x60(%rsp,%rdx,1),%cl
lea    -0x3a(%rcx),%edx
cmp    $0xf5,%dl
ja     1351 <main+0x171>
movslq %eax,%rdx
add    $0x1,%eax
mov    %cl,(%rbx,%rdx,1)
jmp    1351 <main+0x171>
xor    %eax,%eax
cltq
movb   $0x0,(%rbx,%rax,1)
movslq %r13d,%rax
mov    %rbx,0x200180(%rsp,%rax,8)
lea    0x1(%rax),%r14d
mov    %rbp,0x180(%rsp,%rax,8)
cmp    $0x40000,%eax
jl     1283 <main+0xa3>
lea    0xce2(%rip),%rdi
call   10e0 <die@plt>
jmp    1283 <main+0xa3>
mov    %r8d,%esi
and    $0xfffffffe,%esi
xor    %edx,%edx
xor    %eax,%eax
jmp    13a9 <main+0x1c9>
cs nopw 0x0(%rax,%rax,1)
add    $0x2,%rdx
cmp    %rdx,%rsi
je     1332 <main+0x152>
movzbl 0x60(%rsp,%rdx,1),%edi
lea    -0x3a(%rdi),%ecx
cmp    $0xf5,%cl
ja     13c0 <main+0x1e0>
movslq %eax,%rcx
add    $0x1,%eax
mov    %dil,(%rbx,%rcx,1)
movzbl 0x61(%rsp,%rdx,1),%edi
lea    -0x3a(%rdi),%ecx
cmp    $0xf5,%cl
ja     13a0 <main+0x1c0>
movslq %eax,%rcx
add    $0x1,%eax
mov    %dil,(%rbx,%rcx,1)
jmp    13a0 <main+0x1c0>
mov    %r15,%rdi
call   1050 <fclose@plt>
lea    -0x1(%r14),%ecx
lea    0x200180(%rsp),%rdi
lea    0x180(%rsp),%rsi
xor    %edx,%edx
call   10c0 <qsort_arr@plt>
test   %r14d,%r14d
jle    16a5 <main+0x4c5>
xor    %ebp,%ebp
mov    %r14d,%eax
mov    %rax,0x10(%rsp)
xor    %ebx,%ebx
mov    %r14,0x8(%rsp)
jmp    1439 <main+0x259>
nopl   0x0(%rax,%rax,1)
mov    0x38(%rsp),%rbx
add    $0x1,%rbx
cmp    0x10(%rsp),%rbx
mov    0x18(%rsp),%r13
je     160d <main+0x42d>
mov    0x200180(%rsp,%rbx,8),%r15
mov    %r15,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
mov    %rbx,0x38(%rsp)
jle    1420 <main+0x240>
add    $0x1,%eax
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %rcx,0x30(%rsp)
mov    %r15,0x58(%rsp)
mov    %rax,0x40(%rsp)
jmp    1491 <main+0x2b1>
nopl   (%rax)
mov    0x48(%rsp),%r15
add    $0x1,%r15
addq   $0xffffffffffffffff,0x30(%rsp)
mov    0x20(%rsp),%rcx
mov    %rcx,%rdx
mov    0x40(%rsp),%rax
cmp    %rax,%rcx
je     1420 <main+0x240>
mov    %rdx,0x28(%rsp)
lea    0x1(%rdx),%rax
mov    %rax,0x20(%rsp)
mov    %r15,0x48(%rsp)
mov    $0x1,%r12d
jmp    1502 <main+0x322>
nopl   0x0(%rax)
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%ebx
mov    0x400180(%rsp,%rbx,8),%rdi
mov    %r13d,%eax
mov    0x180(%rsp,%rax,8),%rsi
call   1070 <combine@plt>
mov    %rax,0x400180(%rsp,%rbx,8)
mov    %r14,%rbp
mov    0x8(%rsp),%r14
add    $0xffffffffffffffff,%r15
mov    0x30(%rsp),%rax
add    %r12,%rax
add    $0x1,%rax
add    $0x1,%r12
cmp    $0x2,%rax
je     1470 <main+0x290>
lea    0xf0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12d,%edx
call   1040 <strncpy@plt>
movb   $0x0,0xf0(%rsp,%r12,1)
lea    0x200180(%rsp),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1100 <find_in@plt>
test   %eax,%eax
js     14e4 <main+0x304>
mov    %eax,%r13d
mov    %rbp,%r14
mov    0x20(%rsp),%rdi
call   10b0 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    155c <main+0x37c>
lea    0xaf9(%rip),%rdi
call   10e0 <die@plt>
mov    %rbx,%rdi
mov    0x58(%rsp),%rsi
mov    0x28(%rsp),%rbp
mov    %ebp,%edx
call   1040 <strncpy@plt>
movb   $0x0,(%rbx,%rbp,1)
lea    0x600180(%rsp),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1100 <find_in@plt>
test   %eax,%eax
jns    14b0 <main+0x2d0>
mov    $0x84,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    15ad <main+0x3cd>
lea    0xaa8(%rip),%rdi
call   10e0 <die@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    0x28(%rsp),%rdx
call   10f0 <expand@plt>
movslq %r14d,%rax
mov    %rax,0x50(%rsp)
mov    %rbx,0x600180(%rsp,%rax,8)
mov    %r13d,%eax
mov    0x180(%rsp,%rax,8),%rsi
mov    %rbp,%rdi
call   1070 <combine@plt>
lea    0x1(%r14),%ebx
mov    0x50(%rsp),%rcx
mov    %rax,0x400180(%rsp,%rcx,8)
cmp    $0x40000,%r14d
jl     1606 <main+0x426>
lea    0xa77(%rip),%rdi
call   10e0 <die@plt>
mov    %ebx,%ebp
jmp    14df <main+0x2ff>
mov    %rbp,%rbx
test   %ebx,%ebx
jle    165c <main+0x47c>
mov    %ebx,%r15d
xor    %ebx,%ebx
lea    0xa6d(%rip),%r14
mov    0x400180(%rsp,%rbx,8),%r12
mov    %r12,%rdi
call   10a0 <compact@plt>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1090 <fprintf@plt>
mov    0x600180(%rsp,%rbx,8),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1620 <main+0x440>
mov    %r13,%rdi
call   1050 <fclose@plt>
cmpl   $0x0,0x8(%rsp)
mov    0x10(%rsp),%rbp
jle    16af <main+0x4cf>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x200180(%rsp,%rbx,8),%rdi
call   1030 <free@plt>
mov    0x180(%rsp,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1680 <main+0x4a0>
jmp    16af <main+0x4cf>
mov    0x18(%rsp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x800188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [31 x i8] c"Usage: <orig-file> <new-file>\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Could not read input\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [24 x i8] c"Could not create output\00"
@.str.5 = [18 x i8] c"not enough memory\00"
@.str.6 = [22 x i8] c"to many base patterns\00"
@.str.7 = [21 x i8] c"to many new patterns\00"
@.str.8 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [262144 x i8*]
%4 = alloca [262144 x i8*]
%5 = alloca [262144 x i8*]
%6 = alloca [262144 x i8*]
%7 = alloca [132 x i8]
%8 = alloca [132 x i8]
%9 = bitcast [262144 x i8*]* %3 to i8*
%10 = bitcast [262144 x i8*]* %4 to i8*
%11 = bitcast [262144 x i8*]* %5 to i8*
%12 = bitcast [262144 x i8*]* %6 to i8*
%13 = getelementptr inbounds [132 x i8], [132 x i8]* %7, i64 0, i64 0
%14 = icmp eq i32 %0, 3
br i1 %14, label %17, label %15
15: ; preds = %2
%16 = tail call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = tail call i32 @die(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %17
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = tail call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %24
%32 = call i32* @fgets(i8* %13, i32 132, i32* %20)
%33 = icmp eq i32* %32, null
br i1 %33, label %131, label %34
34: ; preds = %31, %127
%35 = phi i32 [ %128, %127 ], [ 0, %31 ]
%36 = call i32 @strlen(i8* %13)
%37 = add nsw i32 %36, -1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [132 x i8], [132 x i8]* %7, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 10
br i1 %41, label %42, label %43
42: ; preds = %34
store i8 0, i8* %39
br label %43
43: ; preds = %42, %34
%44 = phi i32 [ %37, %42 ], [ %36, %34 ]
%45 = load i8, i8* %13
switch i8 %45, label %46 [
i8 37, label %127
i8 0, label %127
]
46: ; preds = %43
%47 = add nsw i32 %44, -1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [132 x i8], [132 x i8]* %7, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = icmp eq i8 %50, 37
br i1 %51, label %52, label %53
52: ; preds = %46
store i8 0, i8* %49
br label %53
53: ; preds = %52, %46
%54 = phi i32 [ %47, %52 ], [ %44, %46 ]
%55 = add nsw i32 %54, 1
%56 = call i8* @malloc(i32 %55)
%57 = shl nsw i32 %54, 1
%58 = or i32 %57, 1
%59 = call i8* @malloc(i32 %58)
%60 = icmp eq i8* %56, null
%61 = icmp eq i8* %59, null
%62 = or i1 %60, %61
br i1 %62, label %63, label %65
63: ; preds = %53
%64 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %65
65: ; preds = %53, %63
%66 = call i32 @expand(i8* %59, i8* %13, i32 %54)
%67 = icmp sgt i32 %54, 0
br i1 %67, label %68, label %116
68: ; preds = %65
%69 = zext i32 %54 to i64
%70 = and i64 %69, 1
%71 = icmp eq i32 %54, 1
br i1 %71, label %102, label %72
72: ; preds = %68
%73 = and i64 %69, 4294967294
br label %74
74: ; preds = %97, %72
%75 = phi i64 [ 0, %72 ], [ %99, %97 ]
%76 = phi i32 [ 0, %72 ], [ %98, %97 ]
%77 = phi i64 [ 0, %72 ], [ %100, %97 ]
%78 = getelementptr inbounds [132 x i8], [132 x i8]* %7, i64 0, i64 %75
%79 = load i8, i8* %78
%80 = add i8 %79, -58
%81 = icmp ult i8 %80, -10
br i1 %81, label %82, label %86
82: ; preds = %74
%83 = add nsw i32 %76, 1
%84 = sext i32 %76 to i64
%85 = getelementptr inbounds i8, i8* %56, i64 %84
store i8 %79, i8* %85
br label %86
86: ; preds = %74, %82
%87 = phi i32 [ %83, %82 ], [ %76, %74 ]
%88 = or i64 %75, 1
%89 = getelementptr inbounds [132 x i8], [132 x i8]* %7, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = add i8 %90, -58
%92 = icmp ult i8 %91, -10
br i1 %92, label %93, label %97
93: ; preds = %86
%94 = add nsw i32 %87, 1
%95 = sext i32 %87 to i64
%96 = getelementptr inbounds i8, i8* %56, i64 %95
store i8 %90, i8* %96
br label %97
97: ; preds = %93, %86
%98 = phi i32 [ %94, %93 ], [ %87, %86 ]
%99 = add nuw nsw i64 %75, 2
%100 = add i64 %77, 2
%101 = icmp eq i64 %100, %73
br i1 %101, label %102, label %74
102: ; preds = %97, %68
%103 = phi i32 [ undef, %68 ], [ %98, %97 ]
%104 = phi i64 [ 0, %68 ], [ %99, %97 ]
%105 = phi i32 [ 0, %68 ], [ %98, %97 ]
%106 = icmp eq i64 %70, 0
br i1 %106, label %116, label %107
107: ; preds = %102
%108 = getelementptr inbounds [132 x i8], [132 x i8]* %7, i64 0, i64 %104
%109 = load i8, i8* %108
%110 = add i8 %109, -58
%111 = icmp ult i8 %110, -10
br i1 %111, label %112, label %116
112: ; preds = %107
%113 = add nsw i32 %105, 1
%114 = sext i32 %105 to i64
%115 = getelementptr inbounds i8, i8* %56, i64 %114
store i8 %109, i8* %115
br label %116
116: ; preds = %102, %112, %107, %65
%117 = phi i32 [ 0, %65 ], [ %103, %102 ], [ %113, %112 ], [ %105, %107 ]
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %56, i64 %118
store i8 0, i8* %119
%120 = sext i32 %35 to i64
%121 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %3, i64 0, i64 %120
store i8* %56, i8** %121
%122 = add nsw i32 %35, 1
%123 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %4, i64 0, i64 %120
store i8* %59, i8** %123
%124 = icmp sgt i32 %35, 262143
br i1 %124, label %125, label %127
125: ; preds = %116
%126 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %127
127: ; preds = %116, %125, %43, %43
%128 = phi i32 [ %35, %43 ], [ %35, %43 ], [ %122, %125 ], [ %122, %116 ]
%129 = call i32* @fgets(i8* %13, i32 132, i32* %20)
%130 = icmp eq i32* %129, null
br i1 %130, label %131, label %34
131: ; preds = %127, %31
%132 = phi i32 [ 0, %31 ], [ %128, %127 ]
%133 = call i32 @fclose(i32* %20)
%134 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %3, i64 0, i64 0
%135 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %4, i64 0, i64 0
%136 = add nsw i32 %132, -1
%137 = call i32 @qsort_arr(i8** %134, i8** %135, i32 0, i32 %136)
%138 = icmp sgt i32 %132, 0
br i1 %138, label %141, label %139
139: ; preds = %131
%140 = call i32 @fclose(i32* %27)
br label %250
141: ; preds = %131
%142 = getelementptr inbounds [132 x i8], [132 x i8]* %8, i64 0, i64 0
%143 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %5, i64 0, i64 0
%144 = zext i32 %132 to i64
br label %149
145: ; preds = %220
%146 = icmp sgt i32 %221, 0
br i1 %146, label %147, label %236
147: ; preds = %145
%148 = zext i32 %221 to i64
br label %224
149: ; preds = %141, %220
%150 = phi i64 [ 0, %141 ], [ %222, %220 ]
%151 = phi i32 [ 0, %141 ], [ %221, %220 ]
%152 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %3, i64 0, i64 %150
%153 = load i8*, i8** %152
%154 = call i32 @strlen(i8* %153)
%155 = icmp slt i32 %154, 1
br i1 %155, label %220, label %156
156: ; preds = %149
%157 = add nuw i32 %154, 1
%158 = zext i32 %157 to i64
br label %159
159: ; preds = %156, %217
%160 = phi i64 [ 1, %156 ], [ %163, %217 ]
%161 = phi i64 [ 2, %156 ], [ %218, %217 ]
%162 = phi i32 [ %151, %156 ], [ %214, %217 ]
%163 = add nuw nsw i64 %160, 1
%164 = trunc i64 %163 to i32
%165 = trunc i64 %160 to i32
br label %166
166: ; preds = %159, %213
%167 = phi i64 [ 1, %159 ], [ %215, %213 ]
%168 = phi i32 [ %162, %159 ], [ %214, %213 ]
%169 = sub nsw i64 %160, %167
%170 = getelementptr inbounds i8, i8* %153, i64 %169
%171 = trunc i64 %167 to i32
%172 = call i32 @strncpy(i8* %142, i8* %170, i32 %171)
%173 = getelementptr inbounds [132 x i8], [132 x i8]* %8, i64 0, i64 %167
store i8 0, i8* %173
%174 = call i32 @find_in(i8** %134, i32 %132, i8* %142)
%175 = icmp sgt i32 %174, -1
br i1 %175, label %176, label %213
176: ; preds = %166
%177 = call i8* @malloc(i32 %164)
%178 = icmp eq i8* %177, null
br i1 %178, label %179, label %181
179: ; preds = %176
%180 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %181
181: ; preds = %179, %176
%182 = call i32 @strncpy(i8* %177, i8* %153, i32 %165)
%183 = getelementptr inbounds i8, i8* %177, i64 %160
store i8 0, i8* %183
%184 = call i32 @find_in(i8** %143, i32 %168, i8* %177)
%185 = icmp slt i32 %184, 0
br i1 %185, label %186, label %204
186: ; preds = %181
%187 = call dereferenceable_or_null(132) i8* @malloc(i32 132)
%188 = icmp eq i8* %187, null
br i1 %188, label %189, label %191
189: ; preds = %186
%190 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %191
191: ; preds = %189, %186
%192 = call i32 @expand(i8* %187, i8* %177, i32 %165)
%193 = sext i32 %168 to i64
%194 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %5, i64 0, i64 %193
store i8* %177, i8** %194
%195 = zext i32 %174 to i64
%196 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %4, i64 0, i64 %195
%197 = load i8*, i8** %196
%198 = call i8* @combine(i8* %187, i8* %197)
%199 = add nsw i32 %168, 1
%200 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %6, i64 0, i64 %193
store i8* %198, i8** %200
%201 = icmp sgt i32 %168, 262143
br i1 %201, label %202, label %213
202: ; preds = %191
%203 = call i32 @die(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %213
204: ; preds = %181
%205 = call i32 @free(i8* %177)
%206 = zext i32 %184 to i64
%207 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %6, i64 0, i64 %206
%208 = load i8*, i8** %207
%209 = zext i32 %174 to i64
%210 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %4, i64 0, i64 %209
%211 = load i8*, i8** %210
%212 = call i8* @combine(i8* %208, i8* %211)
store i8* %212, i8** %207
br label %213
213: ; preds = %204, %202, %191, %166
%214 = phi i32 [ %168, %166 ], [ %168, %204 ], [ %199, %202 ], [ %199, %191 ]
%215 = add nuw nsw i64 %167, 1
%216 = icmp eq i64 %215, %161
br i1 %216, label %217, label %166
217: ; preds = %213
%218 = add nuw nsw i64 %161, 1
%219 = icmp eq i64 %163, %158
br i1 %219, label %220, label %159
220: ; preds = %217, %149
%221 = phi i32 [ %151, %149 ], [ %214, %217 ]
%222 = add nuw nsw i64 %150, 1
%223 = icmp eq i64 %222, %144
br i1 %223, label %145, label %149
224: ; preds = %147, %224
%225 = phi i64 [ 0, %147 ], [ %234, %224 ]
%226 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %6, i64 0, i64 %225
%227 = load i8*, i8** %226
%228 = call i8* @compact(i8* %227)
%229 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %228)
%230 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %5, i64 0, i64 %225
%231 = load i8*, i8** %230
%232 = call i32 @free(i8* %231)
%233 = call i32 @free(i8* %227)
%234 = add nuw nsw i64 %225, 1
%235 = icmp eq i64 %234, %148
br i1 %235, label %236, label %224
236: ; preds = %224, %145
%237 = call i32 @fclose(i32* %27)
br i1 %138, label %238, label %250
238: ; preds = %236
%239 = zext i32 %132 to i64
br label %240
240: ; preds = %238, %240
%241 = phi i64 [ 0, %238 ], [ %248, %240 ]
%242 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %3, i64 0, i64 %241
%243 = load i8*, i8** %242
%244 = call i32 @free(i8* %243)
%245 = getelementptr inbounds [262144 x i8*], [262144 x i8*]* %4, i64 0, i64 %241
%246 = load i8*, i8** %245
%247 = call i32 @free(i8* %246)
%248 = add nuw nsw i64 %241, 1
%249 = icmp eq i64 %248, %239
br i1 %249, label %250, label %240
250: ; preds = %240, %139, %236
ret i32 0
}