#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ showHelp();
int /*<<< orphan*/ showVersion();
void getOptions(int argc, char *argv[]) {
  int opt;
  while ((opt = getopt(argc, argv, "vh")) != -1) {
    switch (opt) {
    case 'v':
      showVersion();
    case 'h':
    case '?':
    default:
      showHelp();
      exit(0);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<getOptions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xea3(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11be <getOptions+0x7e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x3f,%eax
je     11ab <getOptions+0x6b>
jmp    1182 <getOptions+0x42>
mov    -0x18(%rbp),%eax
sub    $0x68,%eax
je     11ab <getOptions+0x6b>
jmp    1193 <getOptions+0x53>
mov    -0x18(%rbp),%eax
sub    $0x76,%eax
jne    11b0 <getOptions+0x70>
jmp    11a4 <getOptions+0x64>
mov    $0x0,%al
call   1040 <showVersion@plt>
jmp    11b0 <getOptions+0x70>
mov    $0x0,%al
call   1030 <showHelp@plt>
xor    %edi,%edi
call   1060 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOptions>:
push   %rax
lea    0xeb8(%rip),%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1154 <getOptions+0x14>
pop    %rax
ret
cmp    $0x76,%eax
jne    1160 <getOptions+0x20>
xor    %eax,%eax
call   1040 <showVersion@plt>
xor    %eax,%eax
call   1030 <showHelp@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"vh\00"
define void @getOptions(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
br label %6
6: ; preds = %2
%7 = load i32, i32* %3
%8 = load i8**, i8*** %4
%9 = call i32 @getopt(i32 %7, i8** %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %9, i32* %5
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %19
11: ; preds = %6
%12 = load i32, i32* %5
switch i32 %12, label %16 [
i32 118, label %13
i32 104, label %15
i32 63, label %15
]
13: ; preds = %11
%14 = call i32 (...) @showVersion()
br label %15
15: ; preds = %11, %11, %13
br label %16
16: ; preds = %11, %15
%17 = call i32 (...) @showHelp()
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"vh\00"
define void @getOptions(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %3, label %6 [
i32 -1, label %9
i32 118, label %4
]
4: ; preds = %2
%5 = tail call i32 (...) @showVersion()
br label %6
6: ; preds = %2, %4
%7 = tail call i32 (...) @showHelp()
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
ret void
}