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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ remove(char const *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char const *);
char *strchr(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  short int G = 0, P = 0, L = 0;
  if (argc < 2) {
  USAGE:
    printf("Usage: %s [OPTION]\n", argv[0]);
    printf("Try '%s -h' for more information.\n", argv[0]);
    return 0;
  }
  if (!strcmp(argv[1], "-h")) {
    printf("\n\t-p\tDo patches without logging\n\n");
    printf("\t-l\tReport results in a log file: %s after patching\n\n",
           "rt_patch_log.txt");
    printf("\t-g\tGenerate shell script file: %s\n\n", "patch_series.sh");
    printf("example usage:\t%s -gl\n", argv[0]);
    return 0;
  } else {
    if (argv[1][0] == '-') {
      char *g = strchr(argv[1], 'g');
      if (g != NULL)
        G = 1;
      char *p = strchr(argv[1], 'p');
      if (p != NULL)
        P = 1;
      char *l = strchr(argv[1], 'l');
      if (l != NULL)
        L = 1;
      if ((!G && !P && !L) || (P && L))
        goto USAGE;
    } else
      goto USAGE;
  }
  static const char prefix[] = "cat patches/";
  static const char suffix[] = " | patch -p1";
  static const char tempout[] = "temp.out";
  char line[128], resultline[128];
  FILE *infile = fopen("patches/series", "r");
  FILE *outfile;
  FILE *logfile;
  if (infile == NULL) {
    perror("patches/series");
    exit(1);
  }
  if (G) {
    outfile = fopen("patch_series.sh", "w");
    if (outfile == NULL) {
      perror("patch_series.sh");
      exit(1);
    }
  }
  if (L) {
    logfile = fopen("rt_patch_log.txt", "w");
    if (logfile == NULL) {
      perror("rt_patch_log.txt");
      exit(1);
    }
  }
  while (fgets(line, sizeof(line), infile) != NULL) {
    if (line[0] == '#' || line[0] == '\n') {
      continue;
    }
    size_t ln = strlen(line) - 1;
    if (line[ln] == '\n')
      line[ln] = '\0';
    strcpy(resultline, "");
    strcat(resultline, prefix);
    strcat(resultline, line);
    strcat(resultline, suffix);
    if (G)
      fprintf(outfile, "%s\n", resultline);
    if (P)
      system(resultline);
    if (L) {
      strcat(resultline, " > temp.out");
      system(resultline);
      FILE *handle = fopen(tempout, "r");
      char templine[256];
      if (handle == NULL) {
        perror(tempout);
        exit(1);
      }
      fprintf(logfile, "PATCH: %s\n", line);
      while (fgets(templine, sizeof(templine), handle) != NULL) {
        if (templine[0] == 'p') {
          char patching[10], file[5], path[256];
          sscanf(templine, "%s %s %s", patching, file, path);
          fprintf(logfile, "\tFILE: %s\n", path);
        } else {
          fprintf(logfile, "\t\t%s", templine);
        }
      }
      fclose(handle);
    }
  }
  fclose(infile);
  if (G)
    fclose(outfile);
  if (L) {
    fclose(logfile);
    if (remove(tempout))
      perror(tempout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x370,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x0,-0x12(%rbp)
movw   $0x0,-0x14(%rbp)
movw   $0x0,-0x16(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1260 <main+0x70>
jmp    122a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    172e <main+0x53e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc8(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    12d6 <main+0xe6>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xdca(%rip),%rdi
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xdfc(%rip),%rdi
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    172e <main+0x53e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    13a4 <main+0x1b4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x67,%esi
call   1080 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1311 <main+0x121>
movw   $0x1,-0x12(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x70,%esi
call   1080 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1338 <main+0x148>
movw   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x6c,%esi
call   1080 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     135f <main+0x16f>
movw   $0x1,-0x16(%rbp)
cmpw   $0x0,-0x12(%rbp)
jne    1380 <main+0x190>
cmpw   $0x0,-0x14(%rbp)
jne    1380 <main+0x190>
cmpw   $0x0,-0x16(%rbp)
je     139a <main+0x1aa>
movswl -0x14(%rbp),%eax
cmp    $0x0,%eax
je     139f <main+0x1af>
movswl -0x16(%rbp),%eax
cmp    $0x0,%eax
je     139f <main+0x1af>
jmp    122a <main+0x3a>
jmp    13a9 <main+0x1b9>
jmp    122a <main+0x3a>
jmp    13ae <main+0x1be>
lea    0xd3a(%rip),%rdi
lea    0xd42(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x138(%rbp)
cmpq   $0x0,-0x138(%rbp)
jne    13ec <main+0x1fc>
lea    0xd12(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
cmpw   $0x0,-0x12(%rbp)
je     143a <main+0x24a>
lea    0xcca(%rip),%rdi
lea    0xcfb(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x140(%rbp)
cmpq   $0x0,-0x140(%rbp)
jne    1435 <main+0x245>
lea    0xca2(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    143a <main+0x24a>
cmpw   $0x0,-0x16(%rbp)
je     1488 <main+0x298>
lea    0xc46(%rip),%rdi
lea    0xcad(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x148(%rbp)
cmpq   $0x0,-0x148(%rbp)
jne    1483 <main+0x293>
lea    0xc1e(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    1488 <main+0x298>
jmp    148d <main+0x29d>
lea    -0xb0(%rbp),%rdi
mov    -0x138(%rbp),%rdx
mov    $0x80,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     16c6 <main+0x4d6>
movsbl -0xb0(%rbp),%eax
cmp    $0x23,%eax
je     14cf <main+0x2df>
movsbl -0xb0(%rbp),%eax
cmp    $0xa,%eax
jne    14d4 <main+0x2e4>
jmp    148d <main+0x29d>
lea    -0xb0(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
cltq
mov    %rax,-0x150(%rbp)
mov    -0x150(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    1513 <main+0x323>
mov    -0x150(%rbp),%rax
movb   $0x0,-0xb0(%rbp,%rax,1)
lea    -0x130(%rbp),%rdi
lea    0xb3a(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x130(%rbp),%rdi
lea    0xbfe(%rip),%rsi
call   1100 <strcat@plt>
lea    -0x130(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1100 <strcat@plt>
lea    -0x130(%rbp),%rdi
lea    0xbe5(%rip),%rsi
call   1100 <strcat@plt>
cmpw   $0x0,-0x12(%rbp)
je     1584 <main+0x394>
mov    -0x140(%rbp),%rdi
lea    -0x130(%rbp),%rdx
lea    0xbaa(%rip),%rsi
call   10c0 <fprintf@plt>
cmpw   $0x0,-0x14(%rbp)
je     159b <main+0x3ab>
lea    -0x130(%rbp),%rdi
call   1070 <system@plt>
cmpw   $0x0,-0x16(%rbp)
je     16c1 <main+0x4d1>
lea    -0x130(%rbp),%rdi
lea    0xb4e(%rip),%rsi
call   1100 <strcat@plt>
lea    -0x130(%rbp),%rdi
call   1070 <system@plt>
lea    0xb80(%rip),%rdi
lea    0xb2b(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x158(%rbp)
cmpq   $0x0,-0x158(%rbp)
jne    1603 <main+0x413>
lea    0xb58(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x148(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xaf6(%rip),%rsi
call   10c0 <fprintf@plt>
lea    -0x260(%rbp),%rdi
mov    -0x158(%rbp),%rdx
mov    $0x100,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
je     16b5 <main+0x4c5>
movsbl -0x260(%rbp),%eax
cmp    $0x70,%eax
jne    1696 <main+0x4a6>
lea    -0x260(%rbp),%rdi
lea    -0x26a(%rbp),%rdx
lea    -0x26f(%rbp),%rcx
lea    -0x370(%rbp),%r8
lea    0xaa7(%rip),%rsi
call   10d0 <sscanf@plt>
mov    -0x148(%rbp),%rdi
lea    -0x370(%rbp),%rdx
lea    0xa96(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    16b0 <main+0x4c0>
mov    -0x148(%rbp),%rdi
lea    -0x260(%rbp),%rdx
lea    0xa82(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    161d <main+0x42d>
mov    -0x158(%rbp),%rdi
call   1050 <fclose@plt>
jmp    148d <main+0x29d>
mov    -0x138(%rbp),%rdi
call   1050 <fclose@plt>
cmpw   $0x0,-0x12(%rbp)
je     16e9 <main+0x4f9>
mov    -0x140(%rbp),%rdi
call   1050 <fclose@plt>
cmpw   $0x0,-0x16(%rbp)
je     1727 <main+0x537>
mov    -0x148(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xa45(%rip),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
je     1722 <main+0x532>
lea    0xa2f(%rip),%rdi
call   10f0 <perror@plt>
jmp    1727 <main+0x537>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x370,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x338,%rsp
mov    %rsi,%rbx
cmp    $0x1,%edi
jle    1313 <main+0x113>
mov    0x8(%rbx),%rbp
lea    0xe0f(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <strcmp@plt>
test   %eax,%eax
je     1330 <main+0x130>
cmpb   $0x2d,0x0(%rbp)
jne    1313 <main+0x113>
mov    %rbp,%rdi
mov    $0x67,%esi
call   1090 <strchr@plt>
mov    %rax,%r13
mov    %rbp,%rdi
mov    $0x70,%esi
call   1090 <strchr@plt>
mov    %r13,%r15
or     %rax,%r15
mov    %rax,0x18(%rsp)
test   %rax,%rax
sete   %r14b
mov    %rbp,%rdi
mov    $0x6c,%esi
call   1090 <strchr@plt>
mov    %rax,%r12
test   %rax,%rax
sete   %al
or     %r12,%r15
je     1313 <main+0x113>
or     %al,%r14b
je     1313 <main+0x113>
lea    0xe31(%rip),%rdi
lea    0xe39(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,(%rsp)
test   %rax,%rax
je     15e1 <main+0x3e1>
test   %r13,%r13
je     138b <main+0x18b>
lea    0xde1(%rip),%rdi
lea    0xe12(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     15ea <main+0x3ea>
test   %r12,%r12
je     1394 <main+0x194>
lea    0xd81(%rip),%rdi
lea    0xde8(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1394 <main+0x194>
lea    0xd62(%rip),%rdi
jmp    15d2 <main+0x3d2>
mov    (%rbx),%rsi
lea    0xce3(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    (%rbx),%rsi
lea    0xce6(%rip),%rdi
jmp    1370 <main+0x170>
lea    0xdd9(%rip),%rdi
call   1050 <puts@plt>
lea    0xcf7(%rip),%rdi
lea    0xd26(%rip),%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
lea    0xd29(%rip),%rdi
lea    0xd47(%rip),%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    (%rbx),%rsi
lea    0xd46(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %r12,%r12
jne    12e8 <main+0xe8>
lea    0x30(%rsp),%rdi
mov    $0x80,%esi
mov    (%rsp),%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     157c <main+0x37c>
lea    0xb0(%rsp),%r15
lea    0x230(%rsp),%r14
mov    %r12,0x10(%rsp)
jmp    13fc <main+0x1fc>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    %r12,%r13
mov    0x10(%rsp),%r12
lea    0x30(%rsp),%rdi
mov    $0x80,%esi
mov    (%rsp),%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     157c <main+0x37c>
mov    0x30(%rsp),%al
cmp    $0xa,%al
je     13e0 <main+0x1e0>
cmp    $0x23,%al
je     13e0 <main+0x1e0>
mov    %r13,%r12
lea    0x30(%rsp),%r13
mov    %r13,%rdi
call   1070 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r13,1)
jne    1427 <main+0x227>
movb   $0x0,0x2f(%rsp,%rax,1)
lea    0x1b0(%rsp),%rbx
mov    %rbx,%rdi
lea    0xc36(%rip),%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
lea    0xce9(%rip),%rsi
call   1110 <strcat@plt>
mov    %rbx,%rdi
lea    0x30(%rsp),%rsi
call   1110 <strcat@plt>
mov    %rbx,%rdi
lea    0xcda(%rip),%rsi
call   1110 <strcat@plt>
mov    %r12,%r13
test   %r12,%r12
je     1485 <main+0x285>
mov    0x8(%rsp),%rdi
lea    0xc8a(%rip),%rsi
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
cmpq   $0x0,0x18(%rsp)
mov    0x10(%rsp),%r12
je     149a <main+0x29a>
mov    %rbx,%rdi
call   1080 <system@plt>
test   %r12,%r12
je     13e0 <main+0x1e0>
mov    %r13,%r12
mov    %rbx,%rdi
lea    0xc30(%rip),%rsi
call   1110 <strcat@plt>
mov    %rbx,%rdi
call   1080 <system@plt>
lea    0xc87(%rip),%rdi
lea    0xc11(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     15cb <main+0x3cb>
mov    %rax,%r13
mov    %rbp,%rdi
lea    0xc06(%rip),%rsi
lea    0x30(%rsp),%rdx
call   10d0 <fprintf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
lea    0xbed(%rip),%rbx
jne    154b <main+0x34b>
jmp    13d0 <main+0x1d0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
lea    0xbe1(%rip),%rsi
mov    %r15,%rdx
call   10d0 <fprintf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     13d0 <main+0x1d0>
cmpb   $0x70,0xb0(%rsp)
70
jne    1520 <main+0x320>
mov    %r15,%rdi
mov    %rbx,%rsi
lea    0x26(%rsp),%rdx
lea    0x21(%rsp),%rcx
mov    %r14,%r8
call   10e0 <sscanf@plt>
mov    %rbp,%rdi
lea    0xb89(%rip),%rsi
mov    %r14,%rdx
jmp    152d <main+0x32d>
mov    (%rsp),%rdi
call   1060 <fclose@plt>
test   %r13,%r13
je     1594 <main+0x394>
mov    0x8(%rsp),%rdi
call   1060 <fclose@plt>
test   %r12,%r12
je     1377 <main+0x177>
mov    %rbp,%rdi
call   1060 <fclose@plt>
lea    0xb9f(%rip),%rdi
call   1030 <remove@plt>
test   %rax,%rax
je     1377 <main+0x177>
lea    0xb8a(%rip),%rdi
call   1100 <perror@plt>
jmp    1377 <main+0x177>
lea    0xb79(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    0xae5(%rip),%rdi
jmp    15d2 <main+0x3d2>
lea    0xab5(%rip),%rdi
jmp    15d2 <main+0x3d2>

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: %s [OPTION]\0A\00"
@.str.1 = [35 x i8] c"Try '%s -h' for more information.\0A\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [34 x i8] c"\0A\09-p\09Do patches without logging\0A\0A\00"
@.str.4 = [54 x i8] c"\09-l\09Report results in a log file: %s after patching\0A\0A\00"
@.str.5 = [17 x i8] c"rt_patch_log.txt\00"
@.str.6 = [37 x i8] c"\09-g\09Generate shell script file: %s\0A\0A\00"
@.str.7 = [16 x i8] c"patch_series.sh\00"
@.str.8 = [23 x i8] c"example usage:\09%s -gl\0A\00"
@main.prefix = internal constant [13 x i8] c"cat patches/\00"
@main.suffix = internal constant [13 x i8] c" | patch -p1\00"
@main.tempout = internal constant [9 x i8] c"temp.out\00"
@.str.9 = [15 x i8] c"patches/series\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [2 x i8] c"w\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [4 x i8] c"%s\0A\00"
@.str.14 = [12 x i8] c" > temp.out\00"
@.str.15 = [11 x i8] c"PATCH: %s\0A\00"
@.str.16 = [9 x i8] c"%s %s %s\00"
@.str.17 = [11 x i8] c"\09FILE: %s\0A\00"
@.str.18 = [5 x i8] c"\09\09%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [128 x i8]
%13 = alloca [128 x i8]
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i64
%18 = alloca i32*
%19 = alloca [256 x i8]
%20 = alloca [10 x i8]
%21 = alloca [5 x i8]
%22 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i16 0, i16* %6
store i16 0, i16* %7
store i16 0, i16* %8
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 2
br i1 %24, label %25, label %35
25: ; preds = %2
br label %26
26: ; preds = %100, %98, %25
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %29)
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %33)
store i32 0, i32* %3
br label %249
35: ; preds = %2
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @strcmp(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* %47)
store i32 0, i32* %3
br label %249
49: ; preds = %35
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = getelementptr inbounds i8, i8* %52, i64 0
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 45
br i1 %56, label %57, label %100
57: ; preds = %49
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 1
%60 = load i8*, i8** %59
%61 = call i8* @strchr(i8* %60, i8 signext 103)
store i8* %61, i8** %9
%62 = load i8*, i8** %9
%63 = icmp ne i8* %62, null
br i1 %63, label %64, label %65
64: ; preds = %57
store i16 1, i16* %6
br label %65
65: ; preds = %64, %57
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 1
%68 = load i8*, i8** %67
%69 = call i8* @strchr(i8* %68, i8 signext 112)
store i8* %69, i8** %10
%70 = load i8*, i8** %10
%71 = icmp ne i8* %70, null
br i1 %71, label %72, label %73
72: ; preds = %65
store i16 1, i16* %7
br label %73
73: ; preds = %72, %65
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 1
%76 = load i8*, i8** %75
%77 = call i8* @strchr(i8* %76, i8 signext 108)
store i8* %77, i8** %11
%78 = load i8*, i8** %11
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %81
80: ; preds = %73
store i16 1, i16* %8
br label %81
81: ; preds = %80, %73
%82 = load i16, i16* %6
%83 = icmp ne i16 %82, 0
br i1 %83, label %90, label %84
84: ; preds = %81
%85 = load i16, i16* %7
%86 = icmp ne i16 %85, 0
br i1 %86, label %90, label %87
87: ; preds = %84
%88 = load i16, i16* %8
%89 = icmp ne i16 %88, 0
br i1 %89, label %90, label %98
90: ; preds = %87, %84, %81
%91 = load i16, i16* %7
%92 = sext i16 %91 to i32
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %99
94: ; preds = %90
%95 = load i16, i16* %8
%96 = sext i16 %95 to i32
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %94, %87
br label %26
99: ; preds = %94, %90
br label %101
100: ; preds = %49
br label %26
101: ; preds = %99
br label %102
102: ; preds = %101
%103 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %103, i32** %14
%104 = load i32*, i32** %14
%105 = icmp eq i32* %104, null
br i1 %105, label %106, label %109
106: ; preds = %102
%107 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%108 = call i32 @exit(i32 1)
unreachable
109: ; preds = %102
%110 = load i16, i16* %6
%111 = icmp ne i16 %110, 0
br i1 %111, label %112, label %120
112: ; preds = %109
%113 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %113, i32** %15
%114 = load i32*, i32** %15
%115 = icmp eq i32* %114, null
br i1 %115, label %116, label %119
116: ; preds = %112
%117 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %112
br label %120
120: ; preds = %119, %109
%121 = load i16, i16* %8
%122 = icmp ne i16 %121, 0
br i1 %122, label %123, label %131
123: ; preds = %120
%124 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %124, i32** %16
%125 = load i32*, i32** %16
%126 = icmp eq i32* %125, null
br i1 %126, label %127, label %130
127: ; preds = %123
%128 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%129 = call i32 @exit(i32 1)
unreachable
130: ; preds = %123
br label %131
131: ; preds = %130, %120
br label %132
132: ; preds = %228, %147, %131
%133 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%134 = load i32*, i32** %14
%135 = call i32* @fgets(i8* %133, i32 128, i32* %134)
%136 = icmp ne i32* %135, null
br i1 %136, label %137, label %229
137: ; preds = %132
%138 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = icmp eq i32 %140, 35
br i1 %141, label %147, label %142
142: ; preds = %137
%143 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%144 = load i8, i8* %143
%145 = sext i8 %144 to i32
%146 = icmp eq i32 %145, 10
br i1 %146, label %147, label %148
147: ; preds = %142, %137
br label %132
148: ; preds = %142
%149 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%150 = call i32 @strlen(i8* %149)
%151 = sub nsw i32 %150, 1
%152 = sext i32 %151 to i64
store i64 %152, i64* %17
%153 = load i64, i64* %17
%154 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 %153
%155 = load i8, i8* %154
%156 = sext i8 %155 to i32
%157 = icmp eq i32 %156, 10
br i1 %157, label %158, label %161
158: ; preds = %148
%159 = load i64, i64* %17
%160 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 %159
store i8 0, i8* %160
br label %161
161: ; preds = %158, %148
%162 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%163 = call i32 @strcpy(i8* %162, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0))
%164 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%165 = call i32 @strcat(i8* %164, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @main.prefix, i64 0, i64 0))
%166 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%167 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%168 = call i32 @strcat(i8* %166, i8* %167)
%169 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%170 = call i32 @strcat(i8* %169, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @main.suffix, i64 0, i64 0))
%171 = load i16, i16* %6
%172 = icmp ne i16 %171, 0
br i1 %172, label %173, label %177
173: ; preds = %161
%174 = load i32*, i32** %15
%175 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%176 = call i32 @fprintf(i32* %174, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %175)
br label %177
177: ; preds = %173, %161
%178 = load i16, i16* %7
%179 = icmp ne i16 %178, 0
br i1 %179, label %180, label %183
180: ; preds = %177
%181 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%182 = call i32 @system(i8* %181)
br label %183
183: ; preds = %180, %177
%184 = load i16, i16* %8
%185 = icmp ne i16 %184, 0
br i1 %185, label %186, label %228
186: ; preds = %183
%187 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%188 = call i32 @strcat(i8* %187, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%189 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%190 = call i32 @system(i8* %189)
%191 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %191, i32** %18
%192 = load i32*, i32** %18
%193 = icmp eq i32* %192, null
br i1 %193, label %194, label %197
194: ; preds = %186
%195 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0))
%196 = call i32 @exit(i32 1)
unreachable
197: ; preds = %186
%198 = load i32*, i32** %16
%199 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%200 = call i32 @fprintf(i32* %198, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %199)
br label %201
201: ; preds = %224, %197
%202 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%203 = load i32*, i32** %18
%204 = call i32* @fgets(i8* %202, i32 256, i32* %203)
%205 = icmp ne i32* %204, null
br i1 %205, label %206, label %225
206: ; preds = %201
%207 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%208 = load i8, i8* %207
%209 = sext i8 %208 to i32
%210 = icmp eq i32 %209, 112
br i1 %210, label %211, label %220
211: ; preds = %206
%212 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%213 = getelementptr inbounds [10 x i8], [10 x i8]* %20, i64 0, i64 0
%214 = getelementptr inbounds [5 x i8], [5 x i8]* %21, i64 0, i64 0
%215 = getelementptr inbounds [256 x i8], [256 x i8]* %22, i64 0, i64 0
%216 = call i32 @sscanf(i8* %212, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %213, i8* %214, i8* %215)
%217 = load i32*, i32** %16
%218 = getelementptr inbounds [256 x i8], [256 x i8]* %22, i64 0, i64 0
%219 = call i32 @fprintf(i32* %217, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i8* %218)
br label %224
220: ; preds = %206
%221 = load i32*, i32** %16
%222 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%223 = call i32 @fprintf(i32* %221, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %222)
br label %224
224: ; preds = %220, %211
br label %201
225: ; preds = %201
%226 = load i32*, i32** %18
%227 = call i32 @fclose(i32* %226)
br label %228
228: ; preds = %225, %183
br label %132
229: ; preds = %132
%230 = load i32*, i32** %14
%231 = call i32 @fclose(i32* %230)
%232 = load i16, i16* %6
%233 = icmp ne i16 %232, 0
br i1 %233, label %234, label %237
234: ; preds = %229
%235 = load i32*, i32** %15
%236 = call i32 @fclose(i32* %235)
br label %237
237: ; preds = %234, %229
%238 = load i16, i16* %8
%239 = icmp ne i16 %238, 0
br i1 %239, label %240, label %248
240: ; preds = %237
%241 = load i32*, i32** %16
%242 = call i32 @fclose(i32* %241)
%243 = call i64 @remove(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0))
%244 = icmp ne i64 %243, 0
br i1 %244, label %245, label %247
245: ; preds = %240
%246 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0))
br label %247
247: ; preds = %245, %240
br label %248
248: ; preds = %247, %237
store i32 0, i32* %3
br label %249
249: ; preds = %248, %41, %26
%250 = load i32, i32* %3
ret i32 %250
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage: %s [OPTION]\0A\00"
@.str.1 = [35 x i8] c"Try '%s -h' for more information.\0A\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.4 = [54 x i8] c"\09-l\09Report results in a log file: %s after patching\0A\0A\00"
@.str.5 = [17 x i8] c"rt_patch_log.txt\00"
@.str.6 = [37 x i8] c"\09-g\09Generate shell script file: %s\0A\0A\00"
@.str.7 = [16 x i8] c"patch_series.sh\00"
@.str.8 = [23 x i8] c"example usage:\09%s -gl\0A\00"
@main.prefix = internal constant [13 x i8] c"cat patches/\00"
@main.suffix = internal constant [13 x i8] c" | patch -p1\00"
@main.tempout = internal constant [9 x i8] c"temp.out\00"
@.str.9 = [15 x i8] c"patches/series\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [2 x i8] c"w\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [4 x i8] c"%s\0A\00"
@.str.14 = [12 x i8] c" > temp.out\00"
@.str.15 = [11 x i8] c"PATCH: %s\0A\00"
@.str.16 = [9 x i8] c"%s %s %s\00"
@.str.17 = [11 x i8] c"\09FILE: %s\0A\00"
@.str.18 = [5 x i8] c"\09\09%s\00"
@str = [33 x i8] c"\0A\09-p\09Do patches without logging\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca [256 x i8]
%6 = alloca [10 x i8]
%7 = alloca [5 x i8]
%8 = alloca [256 x i8]
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %15
10: ; preds = %29, %26, %2
%11 = load i8*, i8** %1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %133
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %17, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %15
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%24 = load i8*, i8** %1
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* %24)
br label %133
26: ; preds = %15
%27 = load i8, i8* %17
%28 = icmp eq i8 %27, 45
br i1 %28, label %29, label %10
29: ; preds = %26
%30 = tail call i8* @strchr(i8* %17, i8 signext 103)
%31 = icmp eq i8* %30, null
%32 = tail call i8* @strchr(i8* dereferenceable(1) %17, i8 signext 112)
%33 = icmp eq i8* %32, null
%34 = tail call i8* @strchr(i8* dereferenceable(1) %17, i8 signext 108)
%35 = icmp eq i8* %34, null
%36 = select i1 %31, i1 %33, i1 false
%37 = select i1 %36, i1 %35, i1 false
%38 = select i1 %33, i1 true, i1 %35
%39 = xor i1 %37, true
%40 = select i1 %39, i1 %38, i1 false
br i1 %40, label %41, label %10
41: ; preds = %29
%42 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%46 = tail call i32 @exit(i32 1)
unreachable
47: ; preds = %41
br i1 %31, label %54, label %48
48: ; preds = %47
%49 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%53 = tail call i32 @exit(i32 1)
unreachable
54: ; preds = %48, %47
%55 = phi i32* [ %49, %48 ], [ undef, %47 ]
br i1 %35, label %62, label %56
56: ; preds = %54
%57 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%61 = tail call i32 @exit(i32 1)
unreachable
62: ; preds = %56, %54
%63 = phi i32* [ %57, %56 ], [ undef, %54 ]
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%65 = call i32* @fgets(i8* %64, i32 128, i32* %42)
%66 = icmp eq i32* %65, null
br i1 %66, label %122, label %67
67: ; preds = %62
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%69 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%70 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%71 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
br label %73
73: ; preds = %67, %119
%74 = load i8, i8* %64
switch i8 %74, label %75 [
i8 35, label %119
i8 10, label %119
]
75: ; preds = %73
%76 = call i32 @strlen(i8* %64)
%77 = add nsw i32 %76, -1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = icmp eq i8 %80, 10
br i1 %81, label %82, label %83
82: ; preds = %75
store i8 0, i8* %79
br label %83
83: ; preds = %82, %75
%84 = call i32 @strcpy(i8* %68, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0))
%85 = call i32 @strcat(i8* %68, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @main.prefix, i64 0, i64 0))
%86 = call i32 @strcat(i8* %68, i8* %64)
%87 = call i32 @strcat(i8* %68, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @main.suffix, i64 0, i64 0))
br i1 %31, label %90, label %88
88: ; preds = %83
%89 = call i32 @fprintf(i32* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %68)
br label %90
90: ; preds = %88, %83
br i1 %33, label %93, label %91
91: ; preds = %90
%92 = call i32 @system(i8* %68)
br label %93
93: ; preds = %91, %90
br i1 %35, label %119, label %94
94: ; preds = %93
%95 = call i32 @strcat(i8* %68, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.14, i64 0, i64 0))
%96 = call i32 @system(i8* %68)
%97 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%98 = icmp eq i32* %97, null
br i1 %98, label %99, label %102
99: ; preds = %94
%100 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %94
%103 = call i32 @fprintf(i32* %63, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %64)
%104 = call i32* @fgets(i8* %69, i32 256, i32* %97)
%105 = icmp eq i32* %104, null
br i1 %105, label %117, label %106
106: ; preds = %102, %114
%107 = load i8, i8* %69
%108 = icmp eq i8 %107, 112
br i1 %108, label %109, label %112
109: ; preds = %106
%110 = call i32 @sscanf(i8* %69, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %70, i8* %71, i8* %72)
%111 = call i32 @fprintf(i32* %63, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i8* %72)
br label %114
112: ; preds = %106
%113 = call i32 @fprintf(i32* %63, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* %69)
br label %114
114: ; preds = %112, %109
%115 = call i32* @fgets(i8* %69, i32 256, i32* %97)
%116 = icmp eq i32* %115, null
br i1 %116, label %117, label %106
117: ; preds = %114, %102
%118 = call i32 @fclose(i32* %97)
br label %119
119: ; preds = %93, %117, %73, %73
%120 = call i32* @fgets(i8* %64, i32 128, i32* %42)
%121 = icmp eq i32* %120, null
br i1 %121, label %122, label %73
122: ; preds = %119, %62
%123 = call i32 @fclose(i32* %42)
br i1 %31, label %126, label %124
124: ; preds = %122
%125 = call i32 @fclose(i32* %55)
br label %126
126: ; preds = %124, %122
br i1 %35, label %133, label %127
127: ; preds = %126
%128 = call i32 @fclose(i32* %63)
%129 = call i64 @remove(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0))
%130 = icmp eq i64 %129, 0
br i1 %130, label %133, label %131
131: ; preds = %127
%132 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @main.tempout, i64 0, i64 0))
br label %133
133: ; preds = %126, %131, %127, %20, %10
ret i32 0
}