#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ cfbf_open_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ cfbf_print_help();
int /*<<< orphan*/ cfbf_print_license();
int /*<<< orphan*/ cfbf_print_version();
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ *optarg;
int /*<<< orphan*/ puts(char *);
#define required_argument 128
int main(int argc, char **argv) {
  static struct option long_options[] = {
      {"version", 0, 0, 'v'}, {"license", 0, 0, 'l'},
      {"help", 0, 0, 'h'},    {"file", required_argument, 0, 'f'},
      {NULL, 0, NULL, 0},
  };
  int option;
  int option_index = 0;
  while ((option = getopt_long(argc, argv, "vlhf:", long_options,
                               &option_index)) != -1) {
    switch (option) {
    case 'v':
      cfbf_print_version();
      return EXIT_SUCCESS;
    case 'l':
      cfbf_print_license();
      return EXIT_SUCCESS;
    case 'h':
      cfbf_print_help();
      return EXIT_SUCCESS;
    case 'f':
      if (optarg != NULL && cfbf_open_file(optarg)) {
        return EXIT_SUCCESS;
      } else {
        return EXIT_FAILURE;
      }
    case '?':
      puts("For usage, run ./cfbf -h");
      break;
    }
  }
  return EXIT_SUCCESS;
}


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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8f(%rip),%rdx
lea    0x2ece(%rip),%rcx
lea    -0x18(%rbp),%r8
call   1070 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     12a3 <main+0x143>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x3f,%eax
je     1292 <main+0x132>
jmp    11bb <main+0x5b>
mov    -0x1c(%rbp),%eax
sub    $0x66,%eax
je     1247 <main+0xe7>
jmp    11cc <main+0x6c>
mov    -0x1c(%rbp),%eax
sub    $0x68,%eax
je     122f <main+0xcf>
jmp    11dd <main+0x7d>
mov    -0x1c(%rbp),%eax
sub    $0x6c,%eax
je     1217 <main+0xb7>
jmp    11ee <main+0x8e>
mov    -0x1c(%rbp),%eax
sub    $0x76,%eax
jne    129e <main+0x13e>
jmp    11ff <main+0x9f>
mov    $0x0,%al
call   1080 <cfbf_print_version@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <main+0x14f>
mov    $0x0,%al
call   1060 <cfbf_print_license@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <main+0x14f>
mov    $0x0,%al
call   1050 <cfbf_print_help@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <main+0x14f>
mov    0x2daa(%rip),%rax
cmpq   $0x0,(%rax)
je     1281 <main+0x121>
mov    0x2d99(%rip),%rax
mov    (%rax),%rdi
call   1030 <cfbf_open_file@plt>
cmp    $0x0,%eax
je     1281 <main+0x121>
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <main+0x14f>
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <main+0x14f>
lea    0xd87(%rip),%rdi
call   1040 <puts@plt>
jmp    117d <main+0x1d>
mov    0x2d26(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%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
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,0x4(%rsp)
lea    0xedf(%rip),%r14
lea    0x2eda(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe6e(%rip),%r13
jmp    11ac <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1070 <getopt_long@plt>
cmp    $0x3f,%eax
je     11a0 <main+0x40>
lea    -0x66(%rax),%ecx
cmp    $0x10,%ecx
ja     11e0 <main+0x80>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
jmp    *%rax
cs nopw 0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
jne    11ac <main+0x4c>
jmp    1221 <main+0xc1>
mov    0x2e0a(%rip),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     11ff <main+0x9f>
call   1030 <cfbf_open_file@plt>
test   %eax,%eax
jne    1221 <main+0xc1>
mov    0x2dd2(%rip),%rax
jmp    1228 <main+0xc8>
xor    %eax,%eax
call   1050 <cfbf_print_help@plt>
jmp    1221 <main+0xc1>
xor    %eax,%eax
call   1060 <cfbf_print_license@plt>
jmp    1221 <main+0xc1>
xor    %eax,%eax
call   1080 <cfbf_print_version@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@main.long_options = internal global [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 0, i32* null, i32 118 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8 0, i32* null, i32 108 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 0, i32* null, i32 104 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32* null, i32 102 }, %struct.option zeroinitializer]
@.str = [8 x i8] c"version\00"
@.str.1 = [8 x i8] c"license\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [6 x i8] c"vlhf:\00"
@EXIT_SUCCESS = global i32 0
@optarg = global i32* null
@EXIT_FAILURE = global i32 0
@.str.5 = [25 x i8] c"For usage, run ./cfbf -h\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %37, %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt_long(i32 %9, i8** %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %struct.option* getelementptr inbounds ([5 x %struct.option], [5 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %7)
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %38
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %37 [
i32 118, label %15
i32 108, label %18
i32 104, label %21
i32 102, label %24
i32 63, label %35
]
15: ; preds = %13
%16 = call i32 (...) @cfbf_print_version()
%17 = load i32, i32* @EXIT_SUCCESS
store i32 %17, i32* %3
br label %40
18: ; preds = %13
%19 = call i32 (...) @cfbf_print_license()
%20 = load i32, i32* @EXIT_SUCCESS
store i32 %20, i32* %3
br label %40
21: ; preds = %13
%22 = call i32 (...) @cfbf_print_help()
%23 = load i32, i32* @EXIT_SUCCESS
store i32 %23, i32* %3
br label %40
24: ; preds = %13
%25 = load i32*, i32** @optarg
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i32*, i32** @optarg
%29 = call i32 @cfbf_open_file(i32* %28)
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = load i32, i32* @EXIT_SUCCESS
store i32 %32, i32* %3
br label %40
33: ; preds = %27, %24
%34 = load i32, i32* @EXIT_FAILURE
store i32 %34, i32* %3
br label %40
35: ; preds = %13
%36 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %37
37: ; preds = %13, %35
br label %8
38: ; preds = %8
%39 = load i32, i32* @EXIT_SUCCESS
store i32 %39, i32* %3
br label %40
40: ; preds = %38, %33, %31, %21, %18, %15
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@main.long_options = internal global [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 0, i32* null, i32 118 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8 0, i32* null, i32 108 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 0, i32* null, i32 104 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32* null, i32 102 }, %struct.option zeroinitializer]
@.str = [8 x i8] c"version\00"
@.str.1 = [8 x i8] c"license\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [5 x i8] c"file\00"
@.str.4 = [6 x i8] c"vlhf:\00"
@EXIT_SUCCESS = global i32 0
@optarg = global i32* null
@EXIT_FAILURE = global i32 0
@.str.5 = [25 x i8] c"For usage, run ./cfbf -h\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %7, %2
%6 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %struct.option* getelementptr inbounds ([5 x %struct.option], [5 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %3)
switch i32 %6, label %7 [
i32 -1, label %23
i32 118, label %8
i32 108, label %10
i32 104, label %12
i32 102, label %14
i32 63, label %21
]
7: ; preds = %5, %21
br label %5
8: ; preds = %5
%9 = call i32 (...) @cfbf_print_version()
br label %23
10: ; preds = %5
%11 = call i32 (...) @cfbf_print_license()
br label %23
12: ; preds = %5
%13 = call i32 (...) @cfbf_print_help()
br label %23
14: ; preds = %5
%15 = load i32*, i32** @optarg
%16 = icmp eq i32* %15, null
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = call i32 @cfbf_open_file(i32* %15)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17, %14
br label %23
21: ; preds = %5
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %7
23: ; preds = %5, %17, %20, %12, %10, %8
%24 = phi i32* [ @EXIT_FAILURE, %20 ], [ @EXIT_SUCCESS, %12 ], [ @EXIT_SUCCESS, %10 ], [ @EXIT_SUCCESS, %8 ], [ @EXIT_SUCCESS, %17 ], [ @EXIT_SUCCESS, %5 ]
%25 = load i32, i32* %24
ret i32 %25
}