#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_SUCCESS;
int /*<<< orphan*/ app_init(int, char **);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ no_argument;
int /*<<< orphan*/ usage();
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  int opt;
  char *optstr = "hV";
  struct option longopts[] = {{"help", no_argument, NULL, 'h'},
                              {"version", no_argument, NULL, 'V'},
                              {NULL, no_argument, NULL, 0}};
  while ((opt = getopt_long(argc, argv, optstr, longopts, NULL)) != -1) {
    switch (opt) {
    case 'h':
      help();
    case 'V':
      version();
    default:
      usage();
    }
  }
  app_init(argc, argv);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe80(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe74(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x78(%rbp)
movq   $0x0,-0x70(%rbp)
movl   $0x68,-0x68(%rbp)
add    $0x20,%rdi
lea    0xe4f(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x58(%rbp)
movq   $0x0,-0x50(%rbp)
movl   $0x56,-0x48(%rbp)
add    $0x20,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x80(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     125e <main+0xfe>
mov    -0x14(%rbp),%eax
mov    %eax,-0x84(%rbp)
sub    $0x56,%eax
je     124b <main+0xeb>
jmp    1230 <main+0xd0>
mov    -0x84(%rbp),%eax
sub    $0x68,%eax
jne    1252 <main+0xf2>
jmp    1244 <main+0xe4>
mov    $0x0,%al
call   1080 <help@plt>
mov    $0x0,%al
call   1060 <version@plt>
mov    $0x0,%al
call   1070 <usage@plt>
jmp    11f4 <main+0x94>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <app_init@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe9d(%rip),%rax
mov    %rax,(%rsp)
mov    0x2e6f(%rip),%rax
mov    (%rax),%al
mov    %al,0x8(%rsp)
movq   $0x0,0x10(%rsp)
movl   $0x68,0x18(%rsp)
lea    0xe79(%rip),%rcx
mov    %rcx,0x20(%rsp)
mov    %al,0x28(%rsp)
movq   $0x0,0x30(%rsp)
movl   $0x56,0x38(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
mov    %al,0x48(%rsp)
lea    0xe3f(%rip),%r14
mov    %rsp,%r15
jmp    11e5 <main+0x95>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <help@plt>
xor    %eax,%eax
call   1050 <version@plt>
xor    %eax,%eax
call   1060 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1040 <getopt_long@plt>
cmp    $0x56,%eax
je     11d7 <main+0x87>
cmp    $0x68,%eax
je     11d0 <main+0x80>
cmp    $0xffffffff,%eax
jne    11de <main+0x8e>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <app_init@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [3 x i8] c"hV\00"
@.str.1 = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.2 = [8 x i8] c"version\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [3 x %struct.option]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %7
%9 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %8, i64 0, i64 0
%10 = getelementptr inbounds %struct.option, %struct.option* %9, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds %struct.option, %struct.option* %9, i32 0, i32 1
%12 = load i32, i32* @no_argument
%13 = trunc i32 %12 to i8
store i8 %13, i8* %11
%14 = getelementptr inbounds %struct.option, %struct.option* %9, i32 0, i32 2
store i32* null, i32** %14
%15 = getelementptr inbounds %struct.option, %struct.option* %9, i32 0, i32 3
store i32 104, i32* %15
%16 = getelementptr inbounds %struct.option, %struct.option* %9, i64 1
%17 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 1
%19 = load i32, i32* @no_argument
%20 = trunc i32 %19 to i8
store i8 %20, i8* %18
%21 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 2
store i32* null, i32** %21
%22 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 3
store i32 86, i32* %22
%23 = getelementptr inbounds %struct.option, %struct.option* %16, i64 1
%24 = bitcast %struct.option* %23 to i8*
%25 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 1
%26 = load i32, i32* @no_argument
%27 = trunc i32 %26 to i8
store i8 %27, i8* %25
br label %28
28: ; preds = %43, %2
%29 = load i32, i32* %4
%30 = load i8**, i8*** %5
%31 = load i8*, i8** %7
%32 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %8, i64 0, i64 0
%33 = call i32 @getopt_long(i32 %29, i8** %30, i8* %31, %struct.option* %32, i32* null)
store i32 %33, i32* %6
%34 = icmp ne i32 %33, -1
br i1 %34, label %35, label %44
35: ; preds = %28
%36 = load i32, i32* %6
switch i32 %36, label %41 [
i32 104, label %37
i32 86, label %39
]
37: ; preds = %35
%38 = call i32 (...) @help()
br label %39
39: ; preds = %35, %37
%40 = call i32 (...) @version()
br label %41
41: ; preds = %35, %39
%42 = call i32 (...) @usage()
br label %43
43: ; preds = %41
br label %28
44: ; preds = %28
%45 = load i32, i32* %4
%46 = load i8**, i8*** %5
%47 = call i32 @app_init(i32 %45, i8** %46)
%48 = load i32, i32* @EXIT_SUCCESS
ret i32 %48
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [3 x i8] c"hV\00"
@.str.1 = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.2 = [8 x i8] c"version\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [3 x %struct.option]
%4 = bitcast [3 x %struct.option]* %3 to i8*
%5 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0
%6 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 1
%8 = load i32, i32* @no_argument
%9 = trunc i32 %8 to i8
store i8 %9, i8* %7
%10 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 2
store i32* null, i32** %10
%11 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 3
store i32 104, i32* %11
%12 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 1
store i8 %9, i8* %13
%14 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 2
store i32* null, i32** %14
%15 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 3
store i32 86, i32* %15
%16 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 2
%17 = bitcast %struct.option* %16 to i8*
%18 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 2, i32 1
store i8 %9, i8* %18
br label %19
19: ; preds = %25, %2
%20 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %struct.option* %5, i32* null)
switch i32 %20, label %25 [
i32 -1, label %27
i32 104, label %21
i32 86, label %23
]
21: ; preds = %19
%22 = call i32 (...) @help()
br label %23
23: ; preds = %19, %21
%24 = call i32 (...) @version()
br label %25
25: ; preds = %19, %23
%26 = call i32 (...) @usage()
br label %19
27: ; preds = %19
%28 = call i32 @app_init(i32 %0, i8** %1)
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}