#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int getopt_long(int, char **, char const *, struct option const *,
                int /*<<< orphan*/ *);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ version();
void process_options(int argc, char **argv) {
  const struct option long_options[] = {
      {"help", 0, 0, 'h'},
      {"version", 0, 0, 'v'},
      {NULL, 0, NULL, 0},
  };
  const char *short_options = "hv";
  int c = 0;
  while ((c = getopt_long(argc, argv, short_options, long_options, NULL)) !=
         -1) {
    switch (c) {
    case 'h':
      usage();
      return;
    case 'v':
      version();
      return;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<process_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x60,%edx
call   1040 <memset@plt>
lea    0xe97(%rip),%rax
mov    %rax,-0x70(%rbp)
movl   $0x68,-0x58(%rbp)
lea    0xe8a(%rip),%rax
mov    %rax,-0x50(%rbp)
movl   $0x76,-0x38(%rbp)
lea    0xe80(%rip),%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x78(%rbp),%rdx
lea    -0x70(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <getopt_long@plt>
mov    %eax,-0x7c(%rbp)
cmp    $0xffffffff,%eax
je     1204 <process_options+0xc4>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
sub    $0x68,%eax
je     11e2 <process_options+0xa2>
jmp    11d1 <process_options+0x91>
mov    -0x80(%rbp),%eax
sub    $0x76,%eax
je     11ee <process_options+0xae>
jmp    11fa <process_options+0xba>
mov    $0x0,%al
call   1060 <usage@plt>
jmp    1204 <process_options+0xc4>
mov    $0x0,%al
call   1050 <version@plt>
jmp    1204 <process_options+0xc4>
jmp    11ff <process_options+0xbf>
jmp    1198 <process_options+0x58>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_options>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
lea    0xe9a(%rip),%rax
mov    %rax,(%rsp)
movl   $0x68,0x18(%rsp)
lea    0xe8c(%rip),%rax
mov    %rax,0x20(%rsp)
movl   $0x76,0x38(%rsp)
lea    0xe80(%rip),%r14
mov    %rsp,%r15
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1030 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     11c2 <process_options+0x92>
cmp    $0x76,%eax
je     11bb <process_options+0x8b>
cmp    $0x68,%eax
jne    1190 <process_options+0x60>
xor    %eax,%eax
call   1050 <usage@plt>
jmp    11c2 <process_options+0x92>
xor    %eax,%eax
call   1040 <version@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [3 x i8] c"hv\00"
define void @process_options(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [3 x %struct.option]
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = bitcast [3 x %struct.option]* %5 to i8*
%9 = bitcast i8* %8 to [3 x %struct.option]*
%10 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %9, i32 0, i32 0
%11 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 3
store i32 104, i32* %12
%13 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %9, i32 0, i32 1
%14 = getelementptr inbounds %struct.option, %struct.option* %13, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds %struct.option, %struct.option* %13, i32 0, i32 3
store i32 118, i32* %15
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %6
store i32 0, i32* %7
br label %16
16: ; preds = %30, %2
%17 = load i32, i32* %3
%18 = load i8**, i8*** %4
%19 = load i8*, i8** %6
%20 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %5, i64 0, i64 0
%21 = call i32 @getopt_long(i32 %17, i8** %18, i8* %19, %struct.option* %20, i32* null)
store i32 %21, i32* %7
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %31
23: ; preds = %16
%24 = load i32, i32* %7
switch i32 %24, label %29 [
i32 104, label %25
i32 118, label %27
]
25: ; preds = %23
%26 = call i32 (...) @usage()
br label %31
27: ; preds = %23
%28 = call i32 (...) @version()
br label %31
29: ; preds = %23
br label %30
30: ; preds = %29
br label %16
31: ; preds = %25, %27, %16
ret void
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [3 x i8] c"hv\00"
define void @process_options(i32 %0, i8** %1) {
%3 = alloca [3 x %struct.option]
%4 = bitcast [3 x %struct.option]* %3 to i8*
%5 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0, i32 3
store i32 104, i32* %6
%7 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 1, i32 3
store i32 118, i32* %8
%9 = getelementptr inbounds [3 x %struct.option], [3 x %struct.option]* %3, i64 0, i64 0
br label %10
10: ; preds = %10, %2
%11 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.option* %9, i32* null)
switch i32 %11, label %10 [
i32 -1, label %16
i32 104, label %12
i32 118, label %14
]
12: ; preds = %10
%13 = call i32 (...) @usage()
br label %16
14: ; preds = %10
%15 = call i32 (...) @version()
br label %16
16: ; preds = %10, %14, %12
ret void
}