#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 discovery_options(int, char **, int *, int *, char *);
int /*<<< orphan*/ help(char **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ version();
int main(int argc, char **argv) {
  int ret = 0;
  int show_help = 0;
  int show_version = 0;
  char input[128] = "";
  if ((ret = discovery_options(argc, argv, &show_help, &show_version, input))) {
    printf("discovery options failed. ret=%d", ret);
    return ret;
  }
  if (show_help) {
    help(argv);
  }
  if (show_version) {
    version();
  }
  printf("[%s] running...\n", input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0xa0(%rbp),%r8
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1050 <discovery_options@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     11d4 <main+0x84>
mov    -0x14(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1214 <main+0xc4>
cmpl   $0x0,-0x18(%rbp)
je     11e7 <main+0x97>
mov    -0x10(%rbp),%rdi
call   1070 <help@plt>
cmpl   $0x0,-0x1c(%rbp)
je     11f8 <main+0xa8>
mov    $0x0,%al
call   1060 <version@plt>
lea    -0xa0(%rbp),%rsi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%r14
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x10(%rsp),%r8
call   1040 <discovery_options@plt>
mov    %eax,%ebx
test   %eax,%eax
je     11b7 <main+0x77>
lea    0xe54(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e7 <main+0xa7>
cmpl   $0x0,0xc(%rsp)
je     11c6 <main+0x86>
mov    %r14,%rdi
call   1060 <help@plt>
cmpl   $0x0,0x8(%rsp)
je     11d4 <main+0x94>
xor    %eax,%eax
call   1050 <version@plt>
lea    0xe46(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"discovery options failed. ret=%d\00"
@.str.1 = [17 x i8] c"[%s] running...\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
%9 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%10 = bitcast [128 x i8]* %9 to i8*
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%14 = call i32 @discovery_options(i32 %11, i8** %12, i32* %7, i32* %8, i8* %13)
store i32 %14, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32, i32* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %34
20: ; preds = %2
%21 = load i32, i32* %7
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i8**, i8*** %5
%25 = call i32 @help(i8** %24)
br label %26
26: ; preds = %23, %20
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @version()
br label %31
31: ; preds = %29, %26
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %32)
store i32 0, i32* %3
br label %34
34: ; preds = %31, %16
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@.str = [33 x i8] c"discovery options failed. ret=%d\00"
@.str.1 = [17 x i8] c"[%s] running...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [128 x i8]
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%9 = call i32 @discovery_options(i32 %0, i8** %1, i32* %3, i32* %4, i8* %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %25
13: ; preds = %2
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = call i32 @help(i8** %1)
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 (...) @version()
br label %23
23: ; preds = %21, %18
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %25
25: ; preds = %23, %11
ret i32 %9
}