#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 getopt(int, char **, char *);
int /*<<< orphan*/ usage(int);
int /*<<< orphan*/ version();
int main(int argc, char **argv) {
  int ch;
  while ((ch = getopt(argc, argv, "vh")) != -1)
    switch (ch) {
    case 'v':
      version();
    case 'h':
      usage(0);
    default:
      usage(1);
    }
}


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   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11a7 <main+0x77>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x68,%eax
je     1191 <main+0x61>
jmp    1179 <main+0x49>
mov    -0x18(%rbp),%eax
sub    $0x76,%eax
jne    1198 <main+0x68>
jmp    118a <main+0x5a>
mov    $0x0,%al
call   1030 <version@plt>
xor    %edi,%edi
call   1040 <usage@plt>
mov    $0x1,%edi
call   1040 <usage@plt>
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%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    1168 <main+0x38>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <version@plt>
xor    %edi,%edi
call   1040 <usage@plt>
mov    $0x1,%edi
call   1040 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getopt@plt>
cmp    $0x68,%eax
je     1157 <main+0x27>
cmp    $0x76,%eax
je     1150 <main+0x20>
cmp    $0xffffffff,%eax
jne    115e <main+0x2e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"vh\00"
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 = %20, %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 %21
12: ; preds = %7
%13 = load i32, i32* %6
switch i32 %13, label %18 [
i32 118, label %14
i32 104, label %16
]
14: ; preds = %12
%15 = call i32 (...) @version()
br label %16
16: ; preds = %12, %14
%17 = call i32 @usage(i32 0)
br label %18
18: ; preds = %12, %16
%19 = call i32 @usage(i32 1)
br label %20
20: ; preds = %18
br label %7
21: ; preds = %7
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [3 x i8] c"vh\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %9, %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 %9 [
i32 -1, label %11
i32 118, label %5
i32 104, label %7
]
5: ; preds = %3
%6 = tail call i32 (...) @version()
br label %7
7: ; preds = %3, %5
%8 = tail call i32 @usage(i32 0)
br label %9
9: ; preds = %3, %7
%10 = tail call i32 @usage(i32 1)
br label %3
11: ; preds = %3
ret i32 0
}