#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*/ ProcessFile(char *);
int /*<<< orphan*/ Usage(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int i;
  for (i = 1; i < argc; ++i) {
    if (*argv[i] == '-') {
      char *pt = argv[i] + 1;
      if (*pt == '-')
        ++pt;
      if (strcmp(pt, "usage") == 0 || strcmp(pt, "help") == 0)
        Usage(argv[0]);
      else if (strcmp(pt, "version") == 0) {
        printf("frombin v1.0\n");
        exit(0);
      } else {
        fprintf(stderr, "Unrecognized argument %s\n", argv[i]);
        Usage(argv[0]);
      }
    } else {
      ProcessFile(argv[i]);
    }
  }
  return (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   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129e <main+0x13e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    127a <main+0x11a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11d1 <main+0x71>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe24(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1205 <main+0xa5>
mov    -0x20(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1216 <main+0xb6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <Usage@plt>
jmp    1275 <main+0x115>
mov    -0x20(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1243 <main+0xe3>
lea    0xddc(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdc2(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <Usage@plt>
jmp    1275 <main+0x115>
jmp    128b <main+0x12b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <ProcessFile@plt>
jmp    1290 <main+0x130>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     120e <main+0xae>
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0x1,%r13d
lea    0xe79(%rip),%r14
lea    0xe78(%rip),%r15
jmp    119e <main+0x3e>
call   1040 <ProcessFile@plt>
add    $0x1,%r13
cmp    %r13,%r12
je     120e <main+0xae>
mov    (%rbx,%r13,8),%rdi
cmpb   $0x2d,(%rdi)
jne    1190 <main+0x30>
lea    0x1(%rdi),%rbp
lea    0x2(%rdi),%rax
cmpb   $0x2d,0x1(%rdi)
cmove  %rax,%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1204 <main+0xa4>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1204 <main+0xa4>
mov    %rbp,%rdi
lea    0xe2a(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     121f <main+0xbf>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    (%rbx,%r13,8),%rdx
lea    0xe14(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%rbx),%rdi
call   1050 <Usage@plt>
jmp    1195 <main+0x35>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe07(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"usage\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [8 x i8] c"version\00"
@.str.3 = [14 x i8] c"frombin v1.0\0A\00"
@stderr = global i32 0
@.str.4 = [26 x i8] c"Unrecognized argument %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %8
8: ; preds = %77, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %80
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 45
br i1 %20, label %21, label %69
21: ; preds = %12
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8, i8* %26, i64 1
store i8* %27, i8** %7
%28 = load i8*, i8** %7
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 45
br i1 %31, label %32, label %35
32: ; preds = %21
%33 = load i8*, i8** %7
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %7
br label %35
35: ; preds = %32, %21
%36 = load i8*, i8** %7
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %43, label %39
39: ; preds = %35
%40 = load i8*, i8** %7
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %39, %35
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 @Usage(i8* %46)
br label %68
48: ; preds = %39
%49 = load i8*, i8** %7
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%54 = call i32 @exit(i32 0)
unreachable
55: ; preds = %48
%56 = load i32, i32* @stderr
%57 = load i8**, i8*** %5
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %61)
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 0
%65 = load i8*, i8** %64
%66 = call i32 @Usage(i8* %65)
br label %67
67: ; preds = %55
br label %68
68: ; preds = %67, %43
br label %76
69: ; preds = %12
%70 = load i8**, i8*** %5
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %70, i64 %72
%74 = load i8*, i8** %73
%75 = call i32 @ProcessFile(i8* %74)
br label %76
76: ; preds = %69, %68
br label %77
77: ; preds = %76
%78 = load i32, i32* %6
%79 = add nsw i32 %78, 1
store i32 %79, i32* %6
br label %8
80: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"usage\00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [8 x i8] c"version\00"
@stderr = global i32 0
@.str.4 = [26 x i8] c"Unrecognized argument %s\0A\00"
@str = [13 x i8] c"frombin v1.0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %43
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %40
%7 = phi i64 [ 1, %4 ], [ %41, %40 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 45
br i1 %11, label %12, label %38
12: ; preds = %6
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 45
%16 = getelementptr inbounds i8, i8* %9, i64 2
%17 = select i1 %15, i8* %16, i8* %13
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %12
%21 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20, %12
%24 = load i8*, i8** %1
%25 = tail call i32 @Usage(i8* %24)
br label %40
26: ; preds = %20
%27 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%31 = tail call i32 @exit(i32 0)
unreachable
32: ; preds = %26
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %8
%35 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %1
%37 = tail call i32 @Usage(i8* %36)
br label %40
38: ; preds = %6
%39 = tail call i32 @ProcessFile(i8* %9)
br label %40
40: ; preds = %23, %32, %38
%41 = add nuw nsw i64 %7, 1
%42 = icmp eq i64 %41, %5
br i1 %42, label %43, label %6
43: ; preds = %40, %2
ret i32 0
}