#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 EXIT_SUCCESS;
int getopt(int, char **, char *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  int c;
  while ((c = getopt(argc, argv, "hv")) != -1) {
    switch (c) {
    case 'h':
      help();
      break;
    case 'v':
      version();
      break;
    default:
      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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11ac <main+0x7c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x68,%eax
je     118a <main+0x5a>
jmp    1179 <main+0x49>
mov    -0x18(%rbp),%eax
sub    $0x76,%eax
je     1196 <main+0x66>
jmp    11a2 <main+0x72>
mov    $0x0,%al
call   1050 <help@plt>
jmp    11a7 <main+0x77>
mov    $0x0,%al
call   1030 <version@plt>
jmp    11a7 <main+0x77>
jmp    11a7 <main+0x77>
jmp    1146 <main+0x16>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec0(%rip),%r14
jmp    1157 <main+0x27>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <version@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <getopt@plt>
cmp    $0x68,%eax
je     1180 <main+0x50>
cmp    $0x76,%eax
je     1150 <main+0x20>
cmp    $0xffffffff,%eax
jne    1157 <main+0x27>
jmp    1189 <main+0x59>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <help@plt>
jmp    1157 <main+0x27>
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"hv\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i32, i32* %6
switch i32 %13, label %18 [
i32 104, label %14
i32 118, label %16
]
14: ; preds = %12
%15 = call i32 (...) @help()
br label %19
16: ; preds = %12
%17 = call i32 (...) @version()
br label %19
18: ; preds = %12
br label %19
19: ; preds = %18, %16, %14
br label %7
20: ; preds = %7
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}

LLVM IR (-O2):
@.str = [3 x i8] c"hv\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %5 [
i32 -1, label %10
i32 104, label %6
i32 118, label %8
]
5: ; preds = %3, %8, %6
br label %3
6: ; preds = %3
%7 = tail call i32 (...) @help()
br label %5
8: ; preds = %3
%9 = tail call i32 (...) @version()
br label %5
10: ; preds = %3
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}