#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ mgetline(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *strstr(char *, char *);
int main(int argc, char *argv[]) {
  char line[1000];
  long lineno = 0;
  int c, except = 0, number = 0, found = 0;
  while (--argc > 0 && (*++argv)[0] == '-')
    while ((c = *++argv[0]))
      switch (c) {
      case 'x':
        except = 1;
        break;
      case 'n':
        number = 1;
        break;
      default:
        printf("find: illegal option %c\n", c);
        argc = 0;
        break;
      }
  if (argc < 1) {
    printf("Usage: find [-x] [-n] pattern [file...]\n");
    return -1;
  }
  if (argc == 1)
    while (mgetline(line, 1000) > 0) {
      lineno++;
      if ((strstr(line, *argv) != NULL) != except) {
        if (number)
          printf("%ld:", lineno);
        printf("%s", line);
        found++;
      }
    }
  else {
    char *pattern = *argv;
    FILE *fp;
    while (--argc > 0) {
      if ((fp = fopen(*++argv, "r")) == NULL) {
        fprintf(stderr, "find: can't open file %s\n.", *argv);
        return -1;
      }
      lineno = 0;
      while (fgets(line, 1000, fp) != NULL) {
        lineno++;
        if ((strstr(line, pattern) != NULL) != except) {
          printf("(%s) ", *argv);
          if (number)
            printf("%ld: ", lineno);
          printf("%s", line);
          found++;
        }
      }
    }
  }
  printf("\nTotal: %i occurrences.\n", found);
  return found;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x408(%rbp)
movl   $0x0,-0x410(%rbp)
movl   $0x0,-0x414(%rbp)
movl   $0x0,-0x418(%rbp)
mov    -0x8(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x429(%rbp)
jle    11de <main+0x7e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x429(%rbp)
mov    -0x429(%rbp),%al
test   $0x1,%al
jne    11f1 <main+0x91>
jmp    128b <main+0x12b>
jmp    11f6 <main+0x96>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movsbl 0x1(%rax),%eax
mov    %eax,-0x40c(%rbp)
cmp    $0x0,%eax
je     1286 <main+0x126>
mov    -0x40c(%rbp),%eax
mov    %eax,-0x430(%rbp)
sub    $0x6e,%eax
je     1257 <main+0xf7>
jmp    1234 <main+0xd4>
mov    -0x430(%rbp),%eax
sub    $0x78,%eax
jne    1266 <main+0x106>
jmp    1248 <main+0xe8>
movl   $0x1,-0x410(%rbp)
jmp    1281 <main+0x121>
movl   $0x1,-0x414(%rbp)
jmp    1281 <main+0x121>
mov    -0x40c(%rbp),%esi
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
jmp    11f6 <main+0x96>
jmp    11a2 <main+0x42>
cmpl   $0x1,-0x8(%rbp)
jge    12af <main+0x14f>
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14cf <main+0x36f>
cmpl   $0x1,-0x8(%rbp)
jne    1366 <main+0x206>
jmp    12be <main+0x15e>
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1060 <mgetline@plt>
cmp    $0x0,%rax
jle    1361 <main+0x201>
mov    -0x408(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x408(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
cmp    -0x410(%rbp),%eax
je     135c <main+0x1fc>
cmpl   $0x0,-0x414(%rbp)
je     1338 <main+0x1d8>
mov    -0x408(%rbp),%rsi
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x400(%rbp),%rsi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
jmp    12be <main+0x15e>
jmp    14b2 <main+0x352>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x420(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    14ad <main+0x34d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xcaa(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x428(%rbp)
cmp    $0x0,%rax
jne    13de <main+0x27e>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc7f(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14cf <main+0x36f>
movq   $0x0,-0x408(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     14a8 <main+0x348>
mov    -0x408(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x408(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x420(%rbp),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
cmp    -0x410(%rbp),%eax
je     14a3 <main+0x343>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xc11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x414(%rbp)
je     147f <main+0x31f>
mov    -0x408(%rbp),%rsi
lea    0xbf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x400(%rbp),%rsi
lea    0xbba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
jmp    13e9 <main+0x289>
jmp    1374 <main+0x214>
jmp    14b2 <main+0x352>
mov    -0x418(%rbp),%esi
lea    0xbb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x418(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3f8,%rsp
cmp    $0x2,%edi
jl     1218 <main+0xa8>
mov    %rsi,%rbx
xor    %r12d,%r12d
lea    0xe69(%rip),%r14
xor    %r13d,%r13d
jmp    11a7 <main+0x37>
nopl   0x0(%rax)
mov    %ebp,%edi
cmp    $0x2,%ebp
jl     1218 <main+0xa8>
lea    -0x1(%rdi),%ebp
mov    0x8(%rbx),%r15
add    $0x8,%rbx
cmpb   $0x2d,(%r15)
jne    123d <main+0xcd>
lea    0x1(%r15),%rax
mov    %rax,(%rbx)
mov    0x1(%r15),%cl
jmp    11ed <main+0x7d>
nopl   0x0(%rax)
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rax
lea    0x1(%rax),%rdx
mov    %rdx,(%rbx)
movzbl 0x1(%rax),%ecx
mov    %rdx,%rax
test   %cl,%cl
je     11a0 <main+0x30>
movsbl %cl,%esi
cmp    $0x78,%esi
je     1210 <main+0xa0>
cmp    $0x6e,%esi
jne    11d0 <main+0x60>
mov    $0x1,%r12d
jmp    11df <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%r13d
jmp    11df <main+0x6f>
lea    0xe44(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x1,%ebp
jne    12db <main+0x16b>
lea    0x10(%rsp),%rdi
mov    $0x3e8,%esi
call   1070 <mgetline@plt>
test   %rax,%rax
jle    13f1 <main+0x281>
mov    %r12d,%r15d
mov    $0x1,%ebp
lea    0x10(%rsp),%r14
lea    0xdac(%rip),%r12
movl   $0x0,(%rsp)
jmp    12ab <main+0x13b>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
addl   $0x1,(%rsp)
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1070 <mgetline@plt>
add    $0x1,%rbp
test   %rax,%rax
jle    13f8 <main+0x288>
mov    (%rbx),%rsi
mov    %r14,%rdi
call   1090 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
cmp    %ecx,%r13d
je     1291 <main+0x121>
test   %r15d,%r15d
je     1280 <main+0x110>
lea    0xd4a(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1280 <main+0x110>
mov    %r13d,%ebp
mov    %r12d,0x4(%rsp)
add    $0xfffffffe,%edi
lea    0x10(%rsp),%r13
movl   $0x0,(%rsp)
jmp    1313 <main+0x1a3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rsp),%rcx
lea    -0x1(%rcx),%eax
cmp    $0x2,%ecx
mov    %eax,%edi
jl     13f8 <main+0x288>
mov    %rdi,0x8(%rsp)
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
lea    0xcfa(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13d4 <main+0x264>
mov    %rax,%r12
mov    %r13,%rdi
mov    $0x3e8,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1300 <main+0x190>
mov    $0x1,%r14d
jmp    1392 <main+0x222>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xcb7(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
addl   $0x1,(%rsp)
mov    %r13,%rdi
mov    $0x3e8,%esi
mov    %r12,%rdx
call   1050 <fgets@plt>
add    $0x1,%r14
test   %rax,%rax
je     1300 <main+0x190>
mov    %r13,%rdi
mov    %r15,%rsi
call   1090 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
cmp    %ecx,%ebp
je     1375 <main+0x205>
mov    (%rbx),%rsi
lea    0xc8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
je     1360 <main+0x1f0>
lea    0xc7c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1360 <main+0x1f0>
mov    0x2c05(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc3c(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1224 <main+0xb4>
movl   $0x0,(%rsp)
lea    0xc4b(%rip),%rdi
mov    (%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1229 <main+0xb9>

LLVM IR (-O0):
@.str = [25 x i8] c"find: illegal option %c\0A\00"
@.str.1 = [41 x i8] c"Usage: find [-x] [-n] pattern [file...]\0A\00"
@.str.2 = [5 x i8] c"%ld:\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.5 = [27 x i8] c"find: can't open file %s\0A.\00"
@.str.6 = [6 x i8] c"(%s) \00"
@.str.7 = [6 x i8] c"%ld: \00"
@.str.8 = [25 x i8] c"\0ATotal: %i occurrences.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i8]
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %7
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
br label %14
14: ; preds = %45, %2
%15 = load i32, i32* %4
%16 = add nsw i32 %15, -1
store i32 %16, i32* %4
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i32 1
store i8** %20, i8*** %5
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 45
br label %26
26: ; preds = %18, %14
%27 = phi i1 [ false, %14 ], [ %25, %18 ]
br i1 %27, label %28, label %46
28: ; preds = %26
br label %29
29: ; preds = %44, %28
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %31
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
store i32 %35, i32* %8
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %45
37: ; preds = %29
%38 = load i32, i32* %8
switch i32 %38, label %41 [
i32 120, label %39
i32 110, label %40
]
39: ; preds = %37
store i32 1, i32* %9
br label %44
40: ; preds = %37
store i32 1, i32* %10
br label %44
41: ; preds = %37
%42 = load i32, i32* %8
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %42)
store i32 0, i32* %4
br label %44
44: ; preds = %41, %40, %39
br label %29
45: ; preds = %29
br label %14
46: ; preds = %26
%47 = load i32, i32* %4
%48 = icmp slt i32 %47, 1
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %138
51: ; preds = %46
%52 = load i32, i32* %4
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %83
54: ; preds = %51
br label %55
55: ; preds = %81, %54
%56 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%57 = call i64 @mgetline(i8* %56, i32 1000)
%58 = icmp sgt i64 %57, 0
br i1 %58, label %59, label %82
59: ; preds = %55
%60 = load i64, i64* %7
%61 = add nsw i64 %60, 1
store i64 %61, i64* %7
%62 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%63 = load i8**, i8*** %5
%64 = load i8*, i8** %63
%65 = call i32* @strstr(i8* %62, i8* %64)
%66 = icmp ne i32* %65, null
%67 = zext i1 %66 to i32
%68 = load i32, i32* %9
%69 = icmp ne i32 %67, %68
br i1 %69, label %70, label %81
70: ; preds = %59
%71 = load i32, i32* %10
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load i64, i64* %7
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %74)
br label %76
76: ; preds = %73, %70
%77 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %77)
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %81
81: ; preds = %76, %59
br label %55
82: ; preds = %55
br label %134
83: ; preds = %51
%84 = load i8**, i8*** %5
%85 = load i8*, i8** %84
store i8* %85, i8** %12
br label %86
86: ; preds = %132, %83
%87 = load i32, i32* %4
%88 = add nsw i32 %87, -1
store i32 %88, i32* %4
%89 = icmp sgt i32 %88, 0
br i1 %89, label %90, label %133
90: ; preds = %86
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i32 1
store i8** %92, i8*** %5
%93 = load i8*, i8** %92
%94 = call i32* @fopen(i8* %93, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %94, i32** %13
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %101
96: ; preds = %90
%97 = load i32, i32* @stderr
%98 = load i8**, i8*** %5
%99 = load i8*, i8** %98
%100 = call i32 @fprintf(i32 %97, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %99)
store i32 -1, i32* %3
br label %138
101: ; preds = %90
store i64 0, i64* %7
br label %102
102: ; preds = %131, %101
%103 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%104 = load i32*, i32** %13
%105 = call i32* @fgets(i8* %103, i32 1000, i32* %104)
%106 = icmp ne i32* %105, null
br i1 %106, label %107, label %132
107: ; preds = %102
%108 = load i64, i64* %7
%109 = add nsw i64 %108, 1
store i64 %109, i64* %7
%110 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%111 = load i8*, i8** %12
%112 = call i32* @strstr(i8* %110, i8* %111)
%113 = icmp ne i32* %112, null
%114 = zext i1 %113 to i32
%115 = load i32, i32* %9
%116 = icmp ne i32 %114, %115
br i1 %116, label %117, label %131
117: ; preds = %107
%118 = load i8**, i8*** %5
%119 = load i8*, i8** %118
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %119)
%121 = load i32, i32* %10
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %126
123: ; preds = %117
%124 = load i64, i64* %7
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 %124)
br label %126
126: ; preds = %123, %117
%127 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %127)
%129 = load i32, i32* %11
%130 = add nsw i32 %129, 1
store i32 %130, i32* %11
br label %131
131: ; preds = %126, %107
br label %102
132: ; preds = %102
br label %86
133: ; preds = %86
br label %134
134: ; preds = %133, %82
%135 = load i32, i32* %11
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %135)
%137 = load i32, i32* %11
store i32 %137, i32* %3
br label %138
138: ; preds = %134, %96, %49
%139 = load i32, i32* %3
ret i32 %139
}

LLVM IR (-O2):
@.str = [25 x i8] c"find: illegal option %c\0A\00"
@.str.2 = [5 x i8] c"%ld:\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.5 = [27 x i8] c"find: can't open file %s\0A.\00"
@.str.6 = [6 x i8] c"(%s) \00"
@.str.7 = [6 x i8] c"%ld: \00"
@.str.8 = [25 x i8] c"\0ATotal: %i occurrences.\0A\00"
@str = [40 x i8] c"Usage: find [-x] [-n] pattern [file...]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %11, label %44
6: ; preds = %36, %21
%7 = phi i32 [ %14, %21 ], [ %38, %36 ]
%8 = phi i32 [ %13, %21 ], [ %39, %36 ]
%9 = phi i32 [ %16, %21 ], [ %40, %36 ]
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %44
11: ; preds = %2, %6
%12 = phi i32 [ %9, %6 ], [ %0, %2 ]
%13 = phi i32 [ %8, %6 ], [ 0, %2 ]
%14 = phi i32 [ %7, %6 ], [ 0, %2 ]
%15 = phi i8** [ %17, %6 ], [ %1, %2 ]
%16 = add nsw i32 %12, -1
%17 = getelementptr inbounds i8*, i8** %15, i64 1
%18 = load i8*, i8** %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 45
br i1 %20, label %21, label %46
21: ; preds = %11
%22 = getelementptr inbounds i8, i8* %18, i64 1
store i8* %22, i8** %17
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %6, label %25
25: ; preds = %21, %36
%26 = phi i8* [ %41, %36 ], [ %22, %21 ]
%27 = phi i8 [ %42, %36 ], [ %23, %21 ]
%28 = phi i32 [ %40, %36 ], [ %16, %21 ]
%29 = phi i32 [ %39, %36 ], [ %13, %21 ]
%30 = phi i32 [ %38, %36 ], [ %14, %21 ]
%31 = sext i8 %27 to i32
switch i32 %31, label %33 [
i32 120, label %36
i32 110, label %32
]
32: ; preds = %25
br label %36
33: ; preds = %25
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %31)
%35 = load i8*, i8** %17
br label %36
36: ; preds = %25, %33, %32
%37 = phi i8* [ %35, %33 ], [ %26, %32 ], [ %26, %25 ]
%38 = phi i32 [ %30, %33 ], [ %30, %32 ], [ 1, %25 ]
%39 = phi i32 [ %29, %33 ], [ 1, %32 ], [ %29, %25 ]
%40 = phi i32 [ 0, %33 ], [ %28, %32 ], [ %28, %25 ]
%41 = getelementptr inbounds i8, i8* %37, i64 1
store i8* %41, i8** %17
%42 = load i8, i8* %41
%43 = icmp eq i8 %42, 0
br i1 %43, label %6, label %25
44: ; preds = %6, %2
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
br label %117
46: ; preds = %11
%47 = icmp eq i32 %16, 1
br i1 %47, label %48, label %72
48: ; preds = %46
%49 = call i64 @mgetline(i8* %4, i32 1000)
%50 = icmp sgt i64 %49, 0
br i1 %50, label %51, label %114
51: ; preds = %48
%52 = icmp eq i32 %13, 0
br label %53
53: ; preds = %51, %68
%54 = phi i32 [ 0, %51 ], [ %69, %68 ]
%55 = phi i64 [ 0, %51 ], [ %56, %68 ]
%56 = add nuw nsw i64 %55, 1
%57 = load i8*, i8** %17
%58 = call i32* @strstr(i8* %4, i8* dereferenceable(1) %57)
%59 = icmp ne i32* %58, null
%60 = zext i1 %59 to i32
%61 = icmp eq i32 %14, %60
br i1 %61, label %68, label %62
62: ; preds = %53
br i1 %52, label %65, label %63
63: ; preds = %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %56)
br label %65
65: ; preds = %63, %62
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%67 = add nsw i32 %54, 1
br label %68
68: ; preds = %65, %53
%69 = phi i32 [ %67, %65 ], [ %54, %53 ]
%70 = call i64 @mgetline(i8* %4, i32 1000)
%71 = icmp sgt i64 %70, 0
br i1 %71, label %53, label %114
72: ; preds = %46
%73 = add nsw i32 %12, -2
%74 = icmp eq i32 %13, 0
br label %79
75: ; preds = %110, %87
%76 = phi i32 [ %81, %87 ], [ %111, %110 ]
%77 = add nsw i32 %80, -1
%78 = icmp sgt i32 %80, 1
br i1 %78, label %79, label %114
79: ; preds = %72, %75
%80 = phi i32 [ %73, %72 ], [ %77, %75 ]
%81 = phi i32 [ 0, %72 ], [ %76, %75 ]
%82 = phi i8** [ %17, %72 ], [ %83, %75 ]
%83 = getelementptr inbounds i8*, i8** %82, i64 1
%84 = load i8*, i8** %83
%85 = call i32* @fopen(i8* %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%86 = icmp eq i32* %85, null
br i1 %86, label %90, label %87
87: ; preds = %79
%88 = call i32* @fgets(i8* %4, i32 1000, i32* %85)
%89 = icmp eq i32* %88, null
br i1 %89, label %75, label %94
90: ; preds = %79
%91 = load i32, i32* @stderr
%92 = load i8*, i8** %83
%93 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %92)
br label %117
94: ; preds = %87, %110
%95 = phi i32 [ %111, %110 ], [ %81, %87 ]
%96 = phi i64 [ %97, %110 ], [ 0, %87 ]
%97 = add nuw nsw i64 %96, 1
%98 = call i32* @strstr(i8* %4, i8* dereferenceable(1) %18)
%99 = icmp ne i32* %98, null
%100 = zext i1 %99 to i32
%101 = icmp eq i32 %14, %100
br i1 %101, label %110, label %102
102: ; preds = %94
%103 = load i8*, i8** %83
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %103)
br i1 %74, label %107, label %105
105: ; preds = %102
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 %97)
br label %107
107: ; preds = %105, %102
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%109 = add nsw i32 %95, 1
br label %110
110: ; preds = %107, %94
%111 = phi i32 [ %109, %107 ], [ %95, %94 ]
%112 = call i32* @fgets(i8* %4, i32 1000, i32* %85)
%113 = icmp eq i32* %112, null
br i1 %113, label %75, label %94
114: ; preds = %75, %68, %48
%115 = phi i32 [ 0, %48 ], [ %69, %68 ], [ %76, %75 ]
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %115)
br label %117
117: ; preds = %90, %114, %44
%118 = phi i32 [ -1, %44 ], [ %115, %114 ], [ -1, %90 ]
ret i32 %118
}