#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 /*<<< orphan*/ _Usage(int);
int /*<<< orphan*/ barry_InitGlobals();
int barry_Parse(char const *, char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
scalar_t__ fu_Exists(char const *);
char *fu_Read(char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  const char *file = NULL;
  const char *src = NULL;
  if (argc < 2) {
    _Usage(1);
    return 1;
  }
  (void)*argv++;
  ({
    int i = -1;
    while (argv[++i]) {
      char *opt = argv[i];
      {
        if ('-' == opt[0]) {
          if ((0 == strcmp(opt, "-h")) || (0 == strcmp(opt, "--help"))) {
            _Usage(0);
            exit(0);
          } else if ((0 == strcmp(opt, "-v")) ||
                     (0 == strcmp(opt, "--version"))) {
            fprintf(stdout, "barry v%s\n", "0.0.1");
            exit(0);
          } else {
            fprintf(stderr, "error: unknown option `%s`\n", opt);
            _Usage(1);
            exit(1);
          }
          continue;
        }
        file = opt;
        break;
      };
    }
  });
  if (0 != fu_Exists(file)) {
    fprintf(stderr, "Error: cannot find the file `%s`\n", file);
    return 1;
  }
  src = fu_Read(file);
  if (NULL == src) {
    fprintf(stderr, "Error: error reading `%s`\n", file);
    return 1;
  }
  barry_InitGlobals();
  return barry_Parse(file, src, NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11c6 <main+0x46>
mov    $0x1,%edi
call   1080 <_Usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    138b <main+0x20b>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
movl   $0xffffffff,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     12f6 <main+0x176>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
jne    12ee <main+0x16e>
mov    -0x30(%rbp),%rdi
lea    0xddd(%rip),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1254 <main+0xd4>
mov    -0x30(%rbp),%rdi
lea    0xdc2(%rip),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1262 <main+0xe2>
xor    %edi,%edi
call   1080 <_Usage@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    -0x30(%rbp),%rdi
lea    0xd9d(%rip),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     129e <main+0x11e>
mov    -0x30(%rbp),%rdi
lea    0xd82(%rip),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    12c1 <main+0x141>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
lea    0xd69(%rip),%rsi
lea    0xd6d(%rip),%rdx
call   1070 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xd53(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <_Usage@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fu_Exists@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1332 <main+0x1b2>
mov    0x2ccc(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xd23(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    138b <main+0x20b>
mov    -0x18(%rbp),%rdi
call   1030 <fu_Read@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1370 <main+0x1f0>
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xd07(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    138b <main+0x20b>
mov    $0x0,%al
call   10a0 <barry_InitGlobals@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <barry_Parse@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     1195 <main+0x15>
mov    $0x1,%edi
call   1080 <_Usage@plt>
jmp    11c8 <main+0x48>
mov    0x8(%rsi),%rbx
test   %rbx,%rbx
je     11a3 <main+0x23>
cmpb   $0x2d,(%rbx)
je     1212 <main+0x92>
mov    %rbx,%rdi
call   1050 <fu_Exists@plt>
test   %rax,%rax
je     11d5 <main+0x55>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
mov    %rbx,%rdx
call   1070 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
call   1030 <fu_Read@plt>
test   %rax,%rax
je     1200 <main+0x80>
mov    %rax,%r14
xor    %eax,%eax
call   10a0 <barry_InitGlobals@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <barry_Parse@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xe56(%rip),%rsi
jmp    11c0 <main+0x40>
lea    0xde7(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     123a <main+0xba>
lea    0xdd6(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1248 <main+0xc8>
xor    %edi,%edi
call   1080 <_Usage@plt>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xdbb(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1270 <main+0xf0>
lea    0xdaa(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1293 <main+0x113>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
lea    0xd97(%rip),%rsi
lea    0xd9b(%rip),%rdx
call   1070 <fprintf@plt>
xor    %edi,%edi
call   1090 <exit@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
lea    0xd85(%rip),%rsi
mov    %rbx,%rdx
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1080 <_Usage@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-v\00"
@.str.3 = [10 x i8] c"--version\00"
@stdout = global i32 0
@.str.4 = [11 x i8] c"barry v%s\0A\00"
@.str.5 = [6 x i8] c"0.0.1\00"
@stderr = global i32 0
@.str.6 = [28 x i8] c"error: unknown option `%s`\0A\00"
@.str.7 = [34 x i8] c"Error: cannot find the file `%s`\0A\00"
@.str.8 = [27 x i8] c"Error: error reading `%s`\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @_Usage(i32 1)
store i32 1, i32* %3
br label %90
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %5
%17 = load i8*, i8** %15
store i32 -1, i32* %8
br label %18
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = load i32, i32* %8
%21 = add nsw i32 %20, 1
store i32 %21, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %19, i64 %22
%24 = load i8*, i8** %23
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %68
26: ; preds = %18
%27 = load i8**, i8*** %5
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
store i8* %31, i8** %9
%32 = load i8*, i8** %9
%33 = getelementptr inbounds i8, i8* %32, i64 0
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 45, %35
br i1 %36, label %37, label %66
37: ; preds = %26
%38 = load i8*, i8** %9
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%40 = icmp eq i64 0, %39
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = load i8*, i8** %9
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp eq i64 0, %43
br i1 %44, label %45, label %48
45: ; preds = %41, %37
%46 = call i32 @_Usage(i32 0)
%47 = call i32 @exit(i32 0)
unreachable
48: ; preds = %41
%49 = load i8*, i8** %9
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i64 0, %50
br i1 %51, label %56, label %52
52: ; preds = %48
%53 = load i8*, i8** %9
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%55 = icmp eq i64 0, %54
br i1 %55, label %56, label %60
56: ; preds = %52, %48
%57 = load i32, i32* @stdout
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%59 = call i32 @exit(i32 0)
unreachable
60: ; preds = %52
%61 = load i32, i32* @stderr
%62 = load i8*, i8** %9
%63 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %62)
%64 = call i32 @_Usage(i32 1)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %26
%67 = load i8*, i8** %9
store i8* %67, i8** %6
br label %68
68: ; preds = %66, %18
%69 = load i8*, i8** %6
%70 = call i64 @fu_Exists(i8* %69)
%71 = icmp ne i64 0, %70
br i1 %71, label %72, label %76
72: ; preds = %68
%73 = load i32, i32* @stderr
%74 = load i8*, i8** %6
%75 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %74)
store i32 1, i32* %3
br label %90
76: ; preds = %68
%77 = load i8*, i8** %6
%78 = call i8* @fu_Read(i8* %77)
store i8* %78, i8** %7
%79 = load i8*, i8** %7
%80 = icmp eq i8* null, %79
br i1 %80, label %81, label %85
81: ; preds = %76
%82 = load i32, i32* @stderr
%83 = load i8*, i8** %6
%84 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* %83)
store i32 1, i32* %3
br label %90
85: ; preds = %76
%86 = call i32 (...) @barry_InitGlobals()
%87 = load i8*, i8** %6
%88 = load i8*, i8** %7
%89 = call i32 @barry_Parse(i8* %87, i8* %88, i32* null)
store i32 %89, i32* %3
br label %90
90: ; preds = %85, %81, %72, %12
%91 = load i32, i32* %3
ret i32 %91
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [3 x i8] c"-v\00"
@.str.3 = [10 x i8] c"--version\00"
@stdout = global i32 0
@.str.4 = [11 x i8] c"barry v%s\0A\00"
@.str.5 = [6 x i8] c"0.0.1\00"
@stderr = global i32 0
@.str.6 = [28 x i8] c"error: unknown option `%s`\0A\00"
@.str.7 = [34 x i8] c"Error: cannot find the file `%s`\0A\00"
@.str.8 = [27 x i8] c"Error: error reading `%s`\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @_Usage(i32 1)
br label %52
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %37, label %10
10: ; preds = %6
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 45
br i1 %12, label %13, label %37
13: ; preds = %10
%14 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16, %13
%20 = tail call i32 @_Usage(i32 0)
%21 = tail call i32 @exit(i32 0)
unreachable
22: ; preds = %16
%23 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %25, %22
%29 = load i32, i32* @stdout
%30 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%31 = tail call i32 @exit(i32 0)
unreachable
32: ; preds = %25
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %8)
%35 = tail call i32 @_Usage(i32 1)
%36 = tail call i32 @exit(i32 1)
unreachable
37: ; preds = %10, %6
%38 = tail call i64 @fu_Exists(i8* %8)
%39 = icmp eq i64 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %8)
br label %52
43: ; preds = %37
%44 = tail call i8* @fu_Read(i8* %8)
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = tail call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i8* %8)
br label %52
49: ; preds = %43
%50 = tail call i32 (...) @barry_InitGlobals()
%51 = tail call i32 @barry_Parse(i8* %8, i8* %44, i32* null)
br label %52
52: ; preds = %49, %46, %40, %4
%53 = phi i32 [ 1, %4 ], [ 1, %40 ], [ 1, %46 ], [ %51, %49 ]
ret i32 %53
}