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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int sfilter(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int ret;
  register int loops = 0;
  if ((argc == 5) && (argv[1][0] == '-') && (argv[1][1] == 'l')) {
    loops = atoi(argv[2]);
    argv += 2;
  } else if ((argc != 3) ||
             ((argc == 3) && ((argv[1][0] == '-') || (argv[2][0] == '-')))) {
    (void)fprintf(stderr, "Usage: %s [-l <loops>] <filter> <file-name>\n",
                  argv[0]);
    exit(1);
  }
  if (loops > 0) {
    register int i;
    for (i = 0; i < loops; i++) {
      (void)sfilter(argv[1], argv[2]);
    }
  }
  if ((ret = sfilter(argv[1], argv[2])) == 0) {
    (void)fprintf(stdout, "GOTHAAA!!!!\n");
  } else {
    (void)fprintf(stdout, "MISS (%d)\n", ret);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    11b1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11b1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6c,%eax
jne    11b1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
jmp    121a <main+0xda>
cmpl   $0x3,-0x8(%rbp)
jne    11ed <main+0xad>
cmpl   $0x3,-0x8(%rbp)
jne    1215 <main+0xd5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     11ed <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1215 <main+0xd5>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    121a <main+0xda>
cmpl   $0x0,-0x18(%rbp)
jle    125f <main+0x11f>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    125a <main+0x11a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <sfilter@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    122b <main+0xeb>
jmp    125f <main+0x11f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <sfilter@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    129c <main+0x15c>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
lea    0xd9d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12b6 <main+0x176>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xd8b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1197 <main+0x57>
cmp    $0x5,%edi
jne    11a9 <main+0x69>
mov    0x8(%rbx),%rax
cmpb   $0x2d,(%rax)
jne    11a9 <main+0x69>
cmpb   $0x6c,0x1(%rax)
jne    11a9 <main+0x69>
lea    0x10(%rbx),%r14
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
test   %eax,%eax
jle    1192 <main+0x52>
mov    %eax,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x18(%rbx),%rdi
mov    0x20(%rbx),%rsi
call   1030 <sfilter@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x40>
mov    %r14,%rbx
jmp    11cd <main+0x8d>
mov    0x8(%rbx),%rax
cmpb   $0x2d,(%rax)
je     11a9 <main+0x69>
mov    0x10(%rbx),%rax
cmpb   $0x2d,(%rax)
jne    11cd <main+0x8d>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe44(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1030 <sfilter@plt>
mov    0x2df7(%rip),%rcx
mov    (%rcx),%edi
test   %eax,%eax
jne    11fc <main+0xbc>
lea    0xe3f(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe37(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"Usage: %s [-l <loops>] <filter> <file-name>\0A\00"
@stdout = global i32 0
@.str.1 = [13 x i8] c"GOTHAAA!!!!\0A\00"
@.str.2 = [11 x i8] c"MISS (%d)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 5
br i1 %10, label %11, label %34
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 45
br i1 %18, label %19, label %34
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 108
br i1 %26, label %27, label %34
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %7
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
store i8** %33, i8*** %5
br label %64
34: ; preds = %19, %11, %2
%35 = load i32, i32* %4
%36 = icmp ne i32 %35, 3
br i1 %36, label %56, label %37
37: ; preds = %34
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 3
br i1 %39, label %40, label %63
40: ; preds = %37
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = getelementptr inbounds i8, i8* %43, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 45
br i1 %47, label %56, label %48
48: ; preds = %40
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = getelementptr inbounds i8, i8* %51, i64 0
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 45
br i1 %55, label %56, label %63
56: ; preds = %48, %40, %34
%57 = load i32, i32* @stderr
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 0
%60 = load i8*, i8** %59
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %60)
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %48, %37
br label %64
64: ; preds = %63, %27
%65 = load i32, i32* %7
%66 = icmp sgt i32 %65, 0
br i1 %66, label %67, label %84
67: ; preds = %64
store i32 0, i32* %8
br label %68
68: ; preds = %80, %67
%69 = load i32, i32* %8
%70 = load i32, i32* %7
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %83
72: ; preds = %68
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load i8*, i8** %74
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 2
%78 = load i8*, i8** %77
%79 = call i32 @sfilter(i8* %75, i8* %78)
br label %80
80: ; preds = %72
%81 = load i32, i32* %8
%82 = add nsw i32 %81, 1
store i32 %82, i32* %8
br label %68
83: ; preds = %68
br label %84
84: ; preds = %83, %64
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 1
%87 = load i8*, i8** %86
%88 = load i8**, i8*** %5
%89 = getelementptr inbounds i8*, i8** %88, i64 2
%90 = load i8*, i8** %89
%91 = call i32 @sfilter(i8* %87, i8* %90)
store i32 %91, i32* %6
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %84
%94 = load i32, i32* @stdout
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %100
96: ; preds = %84
%97 = load i32, i32* @stdout
%98 = load i32, i32* %6
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %98)
br label %100
100: ; preds = %96, %93
%101 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"Usage: %s [-l <loops>] <filter> <file-name>\0A\00"
@stdout = global i32 0
@.str.1 = [13 x i8] c"GOTHAAA!!!!\0A\00"
@.str.2 = [11 x i8] c"MISS (%d)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %22 [
i32 5, label %3
i32 3, label %12
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 45
br i1 %7, label %8, label %22
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 108
br i1 %11, label %27, label %22
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 45
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 45
br i1 %21, label %22, label %42
22: ; preds = %3, %8, %2, %17, %12
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %1
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %8
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = tail call i32 @atoi(i8* %29)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %42
32: ; preds = %27
%33 = getelementptr inbounds i8*, i8** %1, i64 3
%34 = getelementptr inbounds i8*, i8** %1, i64 4
br label %35
35: ; preds = %32, %35
%36 = phi i32 [ 0, %32 ], [ %40, %35 ]
%37 = load i8*, i8** %33
%38 = load i8*, i8** %34
%39 = tail call i32 @sfilter(i8* %37, i8* %38)
%40 = add nuw nsw i32 %36, 1
%41 = icmp eq i32 %40, %30
br i1 %41, label %42, label %35
42: ; preds = %35, %17, %27
%43 = phi i8** [ %28, %27 ], [ %1, %17 ], [ %28, %35 ]
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8*, i8** %43, i64 2
%47 = load i8*, i8** %46
%48 = tail call i32 @sfilter(i8* %45, i8* %47)
%49 = icmp eq i32 %48, 0
%50 = load i32, i32* @stdout
br i1 %49, label %51, label %53
51: ; preds = %42
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %55
53: ; preds = %42
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %48)
br label %55
55: ; preds = %53, %51
%56 = tail call i32 @exit(i32 0)
unreachable
}