#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
scalar_t__ isspace(char);
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *strstr(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  FILE *in, *out;
  char line[1024];
  char *tmp, *tmp2, *tmp3;
  int i = 1, optind = 0;
  int key_found = 0;
  int output_line = 1;
  char voice_name[200];
  char voicenames[5][200];
  int voices = 0;
  int found;
  if ((NULL == (tmp = malloc(200))) || (NULL == (tmp2 = malloc(200))) ||
      (NULL == (tmp3 = malloc(200)))) {
    fprintf(stderr, "%s: couldn't allocate memory\n", "abc2prt");
    exit(1);
  }
  if (argc > 1)
    while ('-' == argv[i][0]) {
      switch (argv[i][1]) {
      case 'h':
        usage();
        exit(0);
        break;
      case 'v':
        if (voices < 5) {
          strcpy(voicenames[voices++], &argv[i][2]);
        } else {
          usage();
          exit(1);
          break;
        }
        break;
      }
      optind++;
      i++;
      if (i == argc)
        break;
    }
  in = stdin;
  out = stdout;
  switch (argc - optind - 1) {
  case 0:;
    break;
  case 1:
    strcpy(tmp2, argv[++optind]);
    if (NULL == (in = fopen(tmp2, "r"))) {
      sprintf(tmp, "%s: can't open %s\n", "abc2prt", tmp2);
      exit(1);
    }
    break;
  case 2:
    strcpy(tmp2, argv[++optind]);
    if (NULL == (in = fopen(tmp2, "r"))) {
      sprintf(tmp, "%s: can't open %s\n", "abc2prt", tmp2);
      exit(1);
    }
    strcpy(tmp3, argv[++optind]);
    if (!strcmp(tmp2, tmp3)) {
      sprintf(tmp, "%s and %s cannot be the same file.", tmp2, tmp3);
      exit(1);
    }
    if (NULL == (out = fopen(tmp3, "w"))) {
      sprintf(tmp, "%s: can't open %s\n", "abc2prt", tmp3);
      exit(1);
    }
    break;
  default:
    usage();
    exit(1);
  }
  do {
    key_found = 0;
    do {
      if (NULL == fgets(line, 1024, in))
        break;
      output_line = 1;
      if (NULL != strstr(line, "%%staves"))
        output_line = 0;
      tmp2 = strstr(line, "V:");
      if (NULL != tmp2) {
        tmp2 += 2;
        while (isspace(*tmp2))
          tmp2++;
        for (found = 0, i = 0; i < voices && !found; i++) {
          found = !strncmp(tmp2, voicenames[i], strlen(voicenames[i]));
        }
        if (!found)
          output_line = 0;
        else
          output_line = 1;
      }
      if (1 == output_line)
        fputs(line, out);
      if (NULL != strstr(line, "K:"))
        key_found = 1;
    } while (0 == key_found);
    do {
      if (NULL == fgets(line, 1024, in))
        break;
      if (1 == strlen(line))
        output_line = 1;
      tmp2 = strstr(line, "V:");
      if (NULL != tmp2) {
        tmp2 += 2;
        while (isspace(*tmp2))
          tmp2++;
        for (found = 0, i = 0; i < voices && !found; i++) {
          found = !strncmp(tmp2, voicenames[i], strlen(voicenames[i]));
        }
        if (!found)
          output_line = 0;
        else
          output_line = 1;
      }
      if (output_line)
        fputs(line, out);
    } while (strlen(line) > 1);
  } while (!feof(in));
  fclose(in);
  fclose(out);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x940,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x43c(%rbp)
movl   $0x0,-0x440(%rbp)
movl   $0x0,-0x444(%rbp)
movl   $0x1,-0x448(%rbp)
movl   $0x0,-0x904(%rbp)
mov    $0xc8,%edi
call   10d0 <malloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x428(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
je     12a8 <main+0xa8>
mov    $0xc8,%edi
call   10d0 <malloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x430(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
je     12a8 <main+0xa8>
mov    $0xc8,%edi
call   10d0 <malloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x438(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    12ce <main+0xce>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
lea    0xd48(%rip),%rsi
lea    0xd5f(%rip),%rdx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
cmpl   $0x1,-0x8(%rbp)
jle    13e5 <main+0x1e5>
jmp    12dd <main+0xdd>
mov    -0x10(%rbp),%rax
movslq -0x43c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
jne    13e0 <main+0x1e0>
mov    -0x10(%rbp),%rax
movslq -0x43c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x90c(%rbp)
sub    $0x68,%eax
je     1337 <main+0x137>
jmp    1323 <main+0x123>
mov    -0x90c(%rbp),%eax
sub    $0x76,%eax
je     1345 <main+0x145>
jmp    13a9 <main+0x1a9>
mov    $0x0,%al
call   10e0 <usage@plt>
xor    %edi,%edi
call   1110 <exit@plt>
cmpl   $0x5,-0x904(%rbp)
jge    1393 <main+0x193>
mov    -0x904(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x904(%rbp)
cltq
lea    -0x900(%rbp),%rdi
imul   $0xc8,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rax
movslq -0x43c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
add    $0x2,%rsi
call   1040 <strcpy@plt>
jmp    13a4 <main+0x1a4>
mov    $0x0,%al
call   10e0 <usage@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    13a9 <main+0x1a9>
mov    -0x440(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x440(%rbp)
mov    -0x43c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x43c(%rbp)
mov    -0x43c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    13db <main+0x1db>
jmp    13e0 <main+0x1e0>
jmp    12dd <main+0xdd>
jmp    13e5 <main+0x1e5>
mov    0x2bfc(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2bd6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x440(%rbp),%eax
not    %eax
add    %ecx,%eax
mov    %eax,-0x910(%rbp)
je     1447 <main+0x247>
jmp    141f <main+0x21f>
mov    -0x910(%rbp),%eax
sub    $0x1,%eax
je     144c <main+0x24c>
jmp    1433 <main+0x233>
mov    -0x910(%rbp),%eax
sub    $0x2,%eax
je     14c7 <main+0x2c7>
jmp    15ff <main+0x3ff>
jmp    1610 <main+0x410>
mov    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x440(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x440(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
mov    -0x430(%rbp),%rdi
lea    0xba6(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    14c2 <main+0x2c2>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rcx
lea    0xb7c(%rip),%rsi
lea    0xb6b(%rip),%rdx
call   1100 <sprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    1610 <main+0x410>
mov    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x440(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x440(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
mov    -0x430(%rbp),%rdi
lea    0xb2b(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    153d <main+0x33d>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rcx
lea    0xb01(%rip),%rsi
lea    0xaf0(%rip),%rdx
call   1100 <sprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x438(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x440(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x440(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
mov    -0x430(%rbp),%rdi
mov    -0x438(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    15aa <main+0x3aa>
mov    -0x428(%rbp),%rdi
mov    -0x430(%rbp),%rdx
mov    -0x438(%rbp),%rcx
lea    0xaa0(%rip),%rsi
call   1100 <sprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x438(%rbp),%rdi
lea    0xaa6(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rcx
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    15fa <main+0x3fa>
mov    -0x428(%rbp),%rdi
mov    -0x438(%rbp),%rcx
lea    0xa44(%rip),%rsi
lea    0xa33(%rip),%rdx
call   1100 <sprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    1610 <main+0x410>
mov    $0x0,%al
call   10e0 <usage@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    1615 <main+0x415>
movl   $0x0,-0x444(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1090 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1647 <main+0x447>
jmp    184a <main+0x64a>
movl   $0x1,-0x448(%rbp)
lea    -0x420(%rbp),%rdi
lea    0xa01(%rip),%rsi
call   1120 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     167c <main+0x47c>
movl   $0x0,-0x448(%rbp)
lea    -0x420(%rbp),%rdi
lea    0x9df(%rip),%rsi
call   1120 <strstr@plt>
mov    %rax,-0x430(%rbp)
xor    %eax,%eax
cmp    -0x430(%rbp),%rax
je     17eb <main+0x5eb>
mov    -0x430(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x430(%rbp)
mov    -0x430(%rbp),%rax
movsbl (%rax),%edi
call   1080 <isspace@plt>
cmp    $0x0,%rax
je     16e7 <main+0x4e7>
mov    -0x430(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x430(%rbp)
jmp    16b7 <main+0x4b7>
movl   $0x0,-0x908(%rbp)
movl   $0x0,-0x43c(%rbp)
mov    -0x43c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x904(%rbp),%ecx
mov    %al,-0x911(%rbp)
jge    1727 <main+0x527>
cmpl   $0x0,-0x908(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x911(%rbp)
mov    -0x911(%rbp),%al
test   $0x1,%al
jne    173a <main+0x53a>
jmp    17c0 <main+0x5c0>
mov    -0x430(%rbp),%rax
mov    %rax,-0x928(%rbp)
movslq -0x43c(%rbp),%rcx
lea    -0x900(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x920(%rbp)
movslq -0x43c(%rbp),%rax
lea    -0x900(%rbp),%rdi
imul   $0xc8,%rax,%rax
add    %rax,%rdi
call   1060 <strlen@plt>
mov    -0x928(%rbp),%rdi
mov    -0x920(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x908(%rbp)
mov    -0x43c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x43c(%rbp)
jmp    16fb <main+0x4fb>
cmpl   $0x0,-0x908(%rbp)
jne    17dc <main+0x5dc>
movl   $0x0,-0x448(%rbp)
jmp    17e6 <main+0x5e6>
movl   $0x1,-0x448(%rbp)
jmp    17eb <main+0x5eb>
mov    $0x1,%eax
cmp    -0x448(%rbp),%eax
jne    180c <main+0x60c>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <fputs@plt>
lea    -0x420(%rbp),%rdi
lea    0x852(%rip),%rsi
call   1120 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1837 <main+0x637>
movl   $0x1,-0x444(%rbp)
jmp    183c <main+0x63c>
xor    %eax,%eax
cmp    -0x444(%rbp),%eax
je     161f <main+0x41f>
jmp    184f <main+0x64f>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1090 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1877 <main+0x677>
jmp    1a42 <main+0x842>
lea    -0x420(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    189c <main+0x69c>
movl   $0x1,-0x448(%rbp)
lea    -0x420(%rbp),%rdi
lea    0x7bf(%rip),%rsi
call   1120 <strstr@plt>
mov    %rax,-0x430(%rbp)
xor    %eax,%eax
cmp    -0x430(%rbp),%rax
je     1a0b <main+0x80b>
mov    -0x430(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x430(%rbp)
mov    -0x430(%rbp),%rax
movsbl (%rax),%edi
call   1080 <isspace@plt>
cmp    $0x0,%rax
je     1907 <main+0x707>
mov    -0x430(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x430(%rbp)
jmp    18d7 <main+0x6d7>
movl   $0x0,-0x908(%rbp)
movl   $0x0,-0x43c(%rbp)
mov    -0x43c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x904(%rbp),%ecx
mov    %al,-0x929(%rbp)
jge    1947 <main+0x747>
cmpl   $0x0,-0x908(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x929(%rbp)
mov    -0x929(%rbp),%al
test   $0x1,%al
jne    195a <main+0x75a>
jmp    19e0 <main+0x7e0>
mov    -0x430(%rbp),%rax
mov    %rax,-0x940(%rbp)
movslq -0x43c(%rbp),%rcx
lea    -0x900(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x938(%rbp)
movslq -0x43c(%rbp),%rax
lea    -0x900(%rbp),%rdi
imul   $0xc8,%rax,%rax
add    %rax,%rdi
call   1060 <strlen@plt>
mov    -0x940(%rbp),%rdi
mov    -0x938(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x908(%rbp)
mov    -0x43c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x43c(%rbp)
jmp    191b <main+0x71b>
cmpl   $0x0,-0x908(%rbp)
jne    19fc <main+0x7fc>
movl   $0x0,-0x448(%rbp)
jmp    1a06 <main+0x806>
movl   $0x1,-0x448(%rbp)
jmp    1a0b <main+0x80b>
cmpl   $0x0,-0x448(%rbp)
je     1a28 <main+0x828>
lea    -0x420(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <fputs@plt>
jmp    1a2d <main+0x82d>
lea    -0x420(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x1,%eax
jg     184f <main+0x64f>
jmp    1a47 <main+0x847>
mov    -0x18(%rbp),%rdi
call   10c0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1615 <main+0x415>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   1110 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
mov    %rsi,%rbp
mov    %edi,%r15d
mov    $0xc8,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
je     124a <main+0x4a>
mov    %rax,%r12
mov    $0xc8,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
je     124a <main+0x4a>
mov    %rax,%r14
mov    $0xc8,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
jne    1270 <main+0x70>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xda6(%rip),%rsi
lea    0xdbd(%rip),%rdx
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    %rax,0x18(%rsp)
xor    %ecx,%ecx
mov    $0x0,%r13d
cmp    $0x2,%r15d
jl     1317 <main+0x117>
mov    %r14,0x10(%rsp)
mov    %r15d,%r13d
lea    -0x1(%r15),%eax
mov    %eax,0x8(%rsp)
add    $0xffffffffffffffff,%r13
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    12c2 <main+0xc2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x68,%eax
je     1654 <main+0x454>
add    $0x1,%r14
cmp    %r14,%r13
je     12fe <main+0xfe>
mov    0x8(%rbp,%r14,8),%rsi
cmpb   $0x2d,(%rsi)
jne    130c <main+0x10c>
movsbl 0x1(%rsi),%eax
cmp    $0x76,%eax
jne    12b0 <main+0xb0>
cmp    $0x4,%ebx
jg     1382 <main+0x182>
movslq %ebx,%rax
add    $0x1,%ebx
imul   $0xc8,%rax,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x20,%rdi
add    $0x2,%rsi
call   1040 <strcpy@plt>
jmp    12b9 <main+0xb9>
mov    %ebx,%r13d
mov    0x10(%rsp),%r14
mov    0x8(%rsp),%ecx
jmp    1317 <main+0x117>
mov    %r14d,%ecx
mov    %ebx,%r13d
mov    0x10(%rsp),%r14
mov    0x2cb2(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
mov    %ecx,%eax
not    %eax
add    %r15d,%eax
mov    %r13d,0x10(%rsp)
je     1393 <main+0x193>
cmp    $0x2,%eax
je     15e4 <main+0x3e4>
cmp    $0x1,%eax
jne    1382 <main+0x182>
movslq %ecx,%rax
mov    0x8(%rbp,%rax,8),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0xccd(%rip),%rsi
mov    %r14,%rdi
call   10f0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    139d <main+0x19d>
lea    0xcb8(%rip),%rsi
lea    0xca7(%rip),%rdx
mov    %r12,%rdi
mov    %r14,%rcx
jmp    168f <main+0x48f>
xor    %eax,%eax
call   10e0 <usage@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x2c4e(%rip),%rax
mov    (%rax),%rbx
movslq %r13d,%r12
mov    $0x1,%r15d
lea    0x410(%rsp),%r14
mov    %rbx,0x18(%rsp)
jmp    13e0 <main+0x1e0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x18(%rsp),%rbx
mov    %ebp,%r13d
mov    %r14,%rdi
lea    0xc9a(%rip),%rsi
call   1120 <strstr@plt>
test   %rax,%rax
jne    14b7 <main+0x2b7>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     14b7 <main+0x2b7>
mov    %r13d,%ebp
mov    %r14,%rdi
lea    0xc63(%rip),%rsi
call   1120 <strstr@plt>
test   %rax,%rax
je     1580 <main+0x380>
mov    %rax,%r13
add    $0x1,%r13
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%r13),%edi
add    $0x1,%r13
call   1080 <isspace@plt>
test   %rax,%rax
jne    1420 <main+0x220>
xor    %r15d,%r15d
test   %ebp,%ebp
jle    13c0 <main+0x1c0>
mov    $0x1,%ebx
lea    0x20(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    %r12,%rbx
jge    1479 <main+0x279>
add    $0xc8,%rbp
add    $0x1,%rbx
test   %eax,%eax
jne    1450 <main+0x250>
test   %eax,%eax
mov    0x10(%rsp),%r13d
mov    0x18(%rsp),%rbx
jne    13c8 <main+0x1c8>
jmp    15a3 <main+0x3a3>
test   %r15d,%r15d
je     1576 <main+0x376>
mov    %r14,%rdi
mov    0x8(%rsp),%rsi
call   1070 <fputs@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
cmp    $0x1,%eax
jle    15bb <main+0x3bb>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     15bb <main+0x3bb>
mov    %r14,%rdi
call   1060 <strlen@plt>
cmp    $0x1,%eax
cmove  %eax,%r15d
mov    %r14,%rdi
lea    0xb80(%rip),%rsi
call   1120 <strstr@plt>
test   %rax,%rax
je     1490 <main+0x290>
mov    %rax,%rbp
add    $0x1,%rbp
nopw   0x0(%rax,%rax,1)
movsbl 0x1(%rbp),%edi
add    $0x1,%rbp
call   1080 <isspace@plt>
test   %rax,%rax
jne    1500 <main+0x300>
xor    %r15d,%r15d
test   %r13d,%r13d
jle    14a6 <main+0x2a6>
mov    $0x1,%r13d
lea    0x20(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    %r12,%r13
jge    1559 <main+0x359>
add    $0xc8,%rbx
add    $0x1,%r13
test   %eax,%eax
jne    1530 <main+0x330>
test   %eax,%eax
mov    0x10(%rsp),%r13d
mov    0x18(%rsp),%rbx
jne    14a6 <main+0x2a6>
mov    $0x1,%r15d
jmp    1499 <main+0x299>
xor    %r15d,%r15d
jmp    14a6 <main+0x2a6>
xchg   %ax,%ax
mov    %r14,%rdi
lea    0xad6(%rip),%rsi
call   1120 <strstr@plt>
xor    %r15d,%r15d
test   %rax,%rax
mov    0x18(%rsp),%rbx
mov    %ebp,%r13d
jne    13c8 <main+0x1c8>
mov    %r14,%rdi
mov    0x8(%rsp),%rsi
call   1070 <fputs@plt>
mov    $0x1,%r15d
jmp    13c8 <main+0x1c8>
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
je     13e0 <main+0x1e0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   1110 <exit@plt>
mov    %r14,%r15
movslq %ecx,%r14
mov    0x8(%rbp,%r14,8),%rsi
mov    %r15,%rdi
call   1040 <strcpy@plt>
lea    0xa28(%rip),%rsi
mov    %r15,%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
jne    1621 <main+0x421>
lea    0xa16(%rip),%rsi
lea    0xa05(%rip),%rdx
mov    %r12,%rdi
mov    %r15,%rcx
jmp    168f <main+0x48f>
mov    %rax,%rbx
mov    0x10(%rbp,%r14,8),%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
jne    1662 <main+0x462>
lea    0x9ef(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
jmp    168c <main+0x48c>
xor    %eax,%eax
call   10e0 <usage@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0x9f5(%rip),%rsi
mov    %rbp,%rdi
call   10f0 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
jne    169e <main+0x49e>
lea    0x9a6(%rip),%rsi
lea    0x995(%rip),%rdx
mov    %r12,%rdi
mov    %rbp,%rcx
call   1100 <sprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    0x10(%rsp),%r13d
jmp    139d <main+0x19d>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"%s: couldn't allocate memory\0A\00"
@.str.1 = [8 x i8] c"abc2prt\00"
@stdin = global i32* null
@stdout = global i32* null
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [19 x i8] c"%s: can't open %s\0A\00"
@.str.4 = [35 x i8] c"%s and %s cannot be the same file.\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [9 x i8] c"%%staves\00"
@.str.7 = [3 x i8] c"V:\00"
@.str.8 = [3 x i8] c"K:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [5 x [200 x i8]]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [5 x [200 x i8]], [5 x [200 x i8]]* %4, i64 0, i64 0, i64 0
%7 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%8 = icmp eq i8* %7, null
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%11 = icmp eq i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12, %9, %2
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %12
%20 = icmp sgt i32 %0, 1
br i1 %20, label %21, label %55
21: ; preds = %19
%22 = zext i32 %0 to i64
%23 = add nsw i32 %0, -1
br label %24
24: ; preds = %21, %50
%25 = phi i64 [ 1, %21 ], [ %53, %50 ]
%26 = phi i32 [ 0, %21 ], [ %52, %50 ]
%27 = phi i32 [ 0, %21 ], [ %51, %50 ]
%28 = getelementptr inbounds i8*, i8** %1, i64 %25
%29 = load i8*, i8** %28
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 45
br i1 %31, label %32, label %55
32: ; preds = %24
%33 = getelementptr inbounds i8, i8* %29, i64 1
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
switch i32 %35, label %50 [
i32 104, label %36
i32 118, label %39
]
36: ; preds = %32
%37 = call i32 (...) @usage()
%38 = call i32 @exit(i32 0)
unreachable
39: ; preds = %32
%40 = icmp slt i32 %27, 5
br i1 %40, label %41, label %47
41: ; preds = %39
%42 = add nsw i32 %27, 1
%43 = sext i32 %27 to i64
%44 = getelementptr inbounds [5 x [200 x i8]], [5 x [200 x i8]]* %4, i64 0, i64 %43, i64 0
%45 = getelementptr inbounds i8, i8* %29, i64 2
%46 = call i32 @strcpy(i8* %44, i8* %45)
br label %50
47: ; preds = %39
%48 = call i32 (...) @usage()
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %32, %41
%51 = phi i32 [ %27, %32 ], [ %42, %41 ]
%52 = add nuw nsw i32 %26, 1
%53 = add nuw nsw i64 %25, 1
%54 = icmp eq i64 %53, %22
br i1 %54, label %55, label %24
55: ; preds = %24, %50, %19
%56 = phi i32 [ 0, %19 ], [ %26, %24 ], [ %23, %50 ]
%57 = phi i32 [ 0, %19 ], [ %27, %24 ], [ %51, %50 ]
%58 = load i32*, i32** @stdin
%59 = load i32*, i32** @stdout
%60 = xor i32 %56, -1
%61 = add i32 %60, %0
switch i32 %61, label %101 [
i32 0, label %104
i32 1, label %62
i32 2, label %73
]
62: ; preds = %55
%63 = add nsw i32 %56, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %1, i64 %64
%66 = load i8*, i8** %65
%67 = call i32 @strcpy(i8* %10, i8* %66)
%68 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %104
70: ; preds = %62
%71 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %55
%74 = add nsw i32 %56, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %1, i64 %75
%77 = load i8*, i8** %76
%78 = call i32 @strcpy(i8* %10, i8* %77)
%79 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %84
81: ; preds = %73
%82 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %73
%85 = add nsw i32 %56, 2
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %1, i64 %86
%88 = load i8*, i8** %87
%89 = call i32 @strcpy(i8* %13, i8* %88)
%90 = call i32 @strcmp(i8* %10, i8* %13)
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %95
92: ; preds = %84
%93 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %10, i8* %13)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %84
%96 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%97 = icmp eq i32* %96, null
br i1 %97, label %98, label %104
98: ; preds = %95
%99 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %55
%102 = call i32 (...) @usage()
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %95, %62, %55
%105 = phi i32* [ %96, %95 ], [ %59, %62 ], [ %59, %55 ]
%106 = phi i32* [ %79, %95 ], [ %68, %62 ], [ %58, %55 ]
%107 = icmp sgt i32 %57, 0
%108 = sext i32 %57 to i64
br label %109
109: ; preds = %187, %104
%110 = phi i32 [ 1, %104 ], [ %188, %187 ]
%111 = call i32* @fgets(i8* %5, i32 1024, i32* %106)
%112 = icmp eq i32* %111, null
br i1 %112, label %147, label %116
113: ; preds = %143
%114 = call i32* @fgets(i8* %5, i32 1024, i32* %106)
%115 = icmp eq i32* %114, null
br i1 %115, label %147, label %116
116: ; preds = %109, %113
%117 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%118 = icmp eq i8* %117, null
br i1 %118, label %138, label %119
119: ; preds = %116
%120 = getelementptr inbounds i8, i8* %117, i64 2
br label %121
121: ; preds = %121, %119
%122 = phi i8* [ %120, %119 ], [ %126, %121 ]
%123 = load i8, i8* %122
%124 = call i64 @isspace(i8 signext %123)
%125 = icmp eq i64 %124, 0
%126 = getelementptr inbounds i8, i8* %122, i64 1
br i1 %125, label %127, label %121
127: ; preds = %121
br i1 %107, label %128, label %143
128: ; preds = %127, %128
%129 = phi i64 [ %134, %128 ], [ 0, %127 ]
%130 = getelementptr inbounds [5 x [200 x i8]], [5 x [200 x i8]]* %4, i64 0, i64 %129, i64 0
%131 = call i32 @strlen(i8* %130)
%132 = call i32 @strncmp(i8* %122, i8* %130, i32 %131)
%133 = icmp ne i32 %132, 0
%134 = add nuw nsw i64 %129, 1
%135 = icmp slt i64 %134, %108
%136 = select i1 %135, i1 %133, i1 false
br i1 %136, label %128, label %137
137: ; preds = %128
br i1 %133, label %143, label %141
138: ; preds = %116
%139 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%140 = icmp eq i8* %139, null
br i1 %140, label %141, label %143
141: ; preds = %137, %138
%142 = call i32 @fputs(i8* %5, i32* %105)
br label %143
143: ; preds = %127, %137, %141, %138
%144 = phi i32 [ 1, %141 ], [ 0, %138 ], [ 0, %137 ], [ 0, %127 ]
%145 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%146 = icmp eq i8* %145, null
br i1 %146, label %113, label %147
147: ; preds = %143, %113, %109
%148 = phi i32 [ %110, %109 ], [ %144, %113 ], [ %144, %143 ]
br label %149
149: ; preds = %147, %183
%150 = phi i32 [ %184, %183 ], [ %148, %147 ]
%151 = call i32* @fgets(i8* %5, i32 1024, i32* %106)
%152 = icmp eq i32* %151, null
br i1 %152, label %187, label %153
153: ; preds = %149
%154 = call i32 @strlen(i8* %5)
%155 = icmp eq i32 %154, 1
%156 = select i1 %155, i32 1, i32 %150
%157 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%158 = icmp eq i8* %157, null
br i1 %158, label %178, label %159
159: ; preds = %153
%160 = getelementptr inbounds i8, i8* %157, i64 2
br label %161
161: ; preds = %161, %159
%162 = phi i8* [ %160, %159 ], [ %166, %161 ]
%163 = load i8, i8* %162
%164 = call i64 @isspace(i8 signext %163)
%165 = icmp eq i64 %164, 0
%166 = getelementptr inbounds i8, i8* %162, i64 1
br i1 %165, label %167, label %161
167: ; preds = %161
br i1 %107, label %168, label %183
168: ; preds = %167, %168
%169 = phi i64 [ %174, %168 ], [ 0, %167 ]
%170 = getelementptr inbounds [5 x [200 x i8]], [5 x [200 x i8]]* %4, i64 0, i64 %169, i64 0
%171 = call i32 @strlen(i8* %170)
%172 = call i32 @strncmp(i8* %162, i8* %170, i32 %171)
%173 = icmp ne i32 %172, 0
%174 = add nuw nsw i64 %169, 1
%175 = icmp slt i64 %174, %108
%176 = select i1 %175, i1 %173, i1 false
br i1 %176, label %168, label %177
177: ; preds = %168
br i1 %173, label %183, label %180
178: ; preds = %153
%179 = icmp eq i32 %156, 0
br i1 %179, label %183, label %180
180: ; preds = %177, %178
%181 = phi i32 [ %156, %178 ], [ 1, %177 ]
%182 = call i32 @fputs(i8* %5, i32* %105)
br label %183
183: ; preds = %167, %177, %178, %180
%184 = phi i32 [ 0, %178 ], [ %181, %180 ], [ 0, %177 ], [ 0, %167 ]
%185 = call i32 @strlen(i8* %5)
%186 = icmp sgt i32 %185, 1
br i1 %186, label %149, label %187
187: ; preds = %183, %149
%188 = phi i32 [ %150, %149 ], [ %184, %183 ]
%189 = call i32 @feof(i32* %106)
%190 = icmp eq i32 %189, 0
br i1 %190, label %109, label %191
191: ; preds = %187
%192 = call i32 @fclose(i32* %106)
%193 = call i32 @fclose(i32* %105)
%194 = call i32 @exit(i32 0)
unreachable
}