#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*/ disp(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ help();
int optind;
int /*<<< orphan*/ show_ver();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ type_mode();
int main(int argc, char *argv[]) {
  int c;
  while ((c = getopt(argc, argv, "hv")) != -1) {
    switch (c) {
    case 'h':
      help();
      break;
    case 'v':
      show_ver();
      break;
    default:
      fprintf(stderr, "usage: %s -hv\n", argv[0]);
      help();
    }
  }
  while (optind < argc) {
    disp(argv[optind++]);
  }
  if (argc == 1) {
    type_mode();
  }
  return 0;
}


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    0xe7c(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11fa <main+0x9a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x68,%eax
je     11ba <main+0x5a>
jmp    11a9 <main+0x49>
mov    -0x18(%rbp),%eax
sub    $0x76,%eax
je     11c6 <main+0x66>
jmp    11d2 <main+0x72>
mov    $0x0,%al
call   1080 <help@plt>
jmp    11f5 <main+0x95>
mov    $0x0,%al
call   1060 <show_ver@plt>
jmp    11f5 <main+0x95>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe1a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1080 <help@plt>
jmp    1176 <main+0x16>
jmp    11ff <main+0x9f>
mov    0x2de2(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    123d <main+0xdd>
mov    -0x10(%rbp),%rax
mov    0x2dcc(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2dbe(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <disp@plt>
jmp    11ff <main+0x9f>
cmpl   $0x1,-0x8(%rbp)
jne    124e <main+0xee>
mov    $0x0,%al
call   1030 <type_mode@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe8c(%rip),%r14
mov    0x2e5d(%rip),%r12
lea    0xe81(%rip),%r15
jmp    1197 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <help@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <getopt@plt>
cmp    $0x68,%eax
je     1190 <main+0x30>
cmp    $0x76,%eax
je     11d0 <main+0x70>
cmp    $0xffffffff,%eax
je     11d9 <main+0x79>
mov    (%r12),%edi
mov    (%rbx),%rdx
mov    %r15,%rsi
call   1040 <fprintf@plt>
jmp    1190 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <show_ver@plt>
jmp    1197 <main+0x37>
mov    0x2e08(%rip),%r14
mov    (%r14),%eax
cmp    %ebp,%eax
jge    11fa <main+0x9a>
lea    0x1(%rax),%ecx
mov    %ecx,(%r14)
cltq
mov    (%rbx,%rax,8),%rdi
call   1050 <disp@plt>
jmp    11e0 <main+0x80>
cmp    $0x1,%ebp
jne    1206 <main+0xa6>
xor    %eax,%eax
call   1030 <type_mode@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"hv\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"usage: %s -hv\0A\00"
@optind = 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 = %25, %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 %26
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 %25
16: ; preds = %12
%17 = call i32 (...) @show_ver()
br label %25
18: ; preds = %12
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = call i32 (...) @help()
br label %25
25: ; preds = %18, %16, %14
br label %7
26: ; preds = %7
br label %27
27: ; preds = %31, %26
%28 = load i32, i32* @optind
%29 = load i32, i32* %4
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = load i8**, i8*** %5
%33 = load i32, i32* @optind
%34 = add nsw i32 %33, 1
store i32 %34, i32* @optind
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds i8*, i8** %32, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @disp(i8* %37)
br label %27
39: ; preds = %27
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 (...) @type_mode()
br label %44
44: ; preds = %42, %39
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"hv\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"usage: %s -hv\0A\00"
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %17, %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 %12 [
i32 -1, label %5
i32 104, label %8
i32 118, label %10
]
5: ; preds = %3
%6 = load i32, i32* @optind
%7 = icmp slt i32 %6, %0
br i1 %7, label %18, label %27
8: ; preds = %3
%9 = tail call i32 (...) @help()
br label %17
10: ; preds = %3
%11 = tail call i32 (...) @show_ver()
br label %17
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = tail call i32 (...) @help()
br label %17
17: ; preds = %12, %10, %8
br label %3
18: ; preds = %5, %18
%19 = phi i32 [ %25, %18 ], [ %6, %5 ]
%20 = add nsw i32 %19, 1
store i32 %20, i32* @optind
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8*, i8** %1, i64 %21
%23 = load i8*, i8** %22
%24 = tail call i32 @disp(i8* %23)
%25 = load i32, i32* @optind
%26 = icmp slt i32 %25, %0
br i1 %26, label %18, label %27
27: ; preds = %18, %5
%28 = icmp eq i32 %0, 1
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = tail call i32 (...) @type_mode()
br label %31
31: ; preds = %29, %27
ret i32 0
}