#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_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free_board();
int getopt(int, char **, char *);
int /*<<< orphan*/ print_help_message();
int /*<<< orphan*/ print_version();
int /*<<< orphan*/ set_quit_program();
void read_opts(int argc, char **argv) {
  int opt;
  while ((opt = getopt(argc, argv, "hv")) != -1) {
    switch (opt) {
    case 'h':
      print_help_message();
      set_quit_program();
      break;
    case 'v':
      print_version();
      set_quit_program();
      break;
    default:
      free_board();
      exit(EXIT_FAILURE);
    }
  }
  return;
}


x86 assembly (clang, -O0):
<read_opts>:
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    0xe83(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11f3 <read_opts+0x93>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x68,%eax
je     11b3 <read_opts+0x53>
jmp    11a2 <read_opts+0x42>
mov    -0x18(%rbp),%eax
sub    $0x76,%eax
je     11c6 <read_opts+0x66>
jmp    11d9 <read_opts+0x79>
mov    $0x0,%al
call   1030 <print_help_message@plt>
mov    $0x0,%al
call   1080 <set_quit_program@plt>
jmp    11ee <read_opts+0x8e>
mov    $0x0,%al
call   1040 <print_version@plt>
mov    $0x0,%al
call   1080 <set_quit_program@plt>
jmp    11ee <read_opts+0x8e>
mov    $0x0,%al
call   1050 <free_board@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
jmp    116f <read_opts+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_opts>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe90(%rip),%r14
jmp    118e <read_opts+0x2e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <print_help_message@plt>
xor    %eax,%eax
call   1080 <set_quit_program@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    $0x68,%eax
je     1180 <read_opts+0x20>
cmp    $0x76,%eax
jne    11ae <read_opts+0x4e>
xor    %eax,%eax
call   1040 <print_version@plt>
jmp    1187 <read_opts+0x27>
cmp    $0xffffffff,%eax
jne    11b8 <read_opts+0x58>
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %eax,%eax
call   1050 <free_board@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"hv\00"
@EXIT_FAILURE = global i32 0
define void @read_opts(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 = %23, %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 %24
11: ; preds = %6
%12 = load i32, i32* %5
switch i32 %12, label %19 [
i32 104, label %13
i32 118, label %16
]
13: ; preds = %11
%14 = call i32 (...) @print_help_message()
%15 = call i32 (...) @set_quit_program()
br label %23
16: ; preds = %11
%17 = call i32 (...) @print_version()
%18 = call i32 (...) @set_quit_program()
br label %23
19: ; preds = %11
%20 = call i32 (...) @free_board()
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %16, %13
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"hv\00"
@EXIT_FAILURE = global i32 0
define void @read_opts(i32 %0, i8** %1) {
br label %3
3: ; preds = %13, %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 %15
i32 104, label %5
i32 118, label %7
]
5: ; preds = %3
%6 = tail call i32 (...) @print_help_message()
br label %13
7: ; preds = %3
%8 = tail call i32 (...) @print_version()
br label %13
9: ; preds = %3
%10 = tail call i32 (...) @free_board()
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %7, %5
%14 = tail call i32 (...) @set_quit_program()
br label %3
15: ; preds = %3
ret void
}