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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int getopt_long(int const, char **, char *, struct option *, int *);
int optind;
int /*<<< orphan*/ print_help(char *);
int parse_options(const int argc, char **argv,
                  struct options *opts __attribute__((unused))) {
  int c;
  while (1) {
    int option_index = 0;
    static struct option long_options[] = {{"help", 0, NULL, 'h'},
                                           {0, 0, 0, 0}};
    if ((c = getopt_long(argc, argv, "s:h", long_options, &option_index)) ==
        -1) {
      break;
    }
    switch (c) {
    case 'h':
      print_help(argv[0]);
      exit(0);
    case '?':
    default:
      exit(2);
    }
  }
  return optind;
}


x86 assembly (clang, -O0):
<parse_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xead(%rip),%rdx
lea    0x2ee1(%rip),%rcx
lea    -0x20(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
jne    1179 <parse_options+0x49>
jmp    11c0 <parse_options+0x90>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x3f,%eax
je     11b1 <parse_options+0x81>
jmp    118d <parse_options+0x5d>
mov    -0x24(%rbp),%eax
sub    $0x68,%eax
jne    11b6 <parse_options+0x86>
jmp    119e <parse_options+0x6e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <print_help@plt>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    11b6 <parse_options+0x86>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_options>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movl   $0x0,0xc(%rsp)
lea    0xebe(%rip),%rdx
lea    0x2ef2(%rip),%rcx
lea    0xc(%rsp),%r8
call   1030 <getopt_long@plt>
cmp    $0xffffffff,%eax
jne    116c <parse_options+0x3c>
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret
cmp    $0x68,%eax
jne    1180 <parse_options+0x50>
mov    (%rbx),%rdi
call   1040 <print_help@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
%struct.options = type { i32 }
@parse_options.long_options = internal global [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 0, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [4 x i8] c"s:h\00"
@optind = global i32 0
define i32 @parse_options(i32 %0, i8** %1, %struct.options* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.options*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.options* %2, %struct.options** %6
br label %9
9: ; preds = %3
store i32 0, i32* %8
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt_long(i32 %10, i8** %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @parse_options.long_options, i64 0, i64 0), i32* %8)
store i32 %12, i32* %7
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %9
br label %26
15: ; preds = %9
%16 = load i32, i32* %7
switch i32 %16, label %24 [
i32 104, label %17
i32 63, label %23
]
17: ; preds = %15
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @print_help(i8* %20)
%22 = call i32 @exit(i32 0)
unreachable
23: ; preds = %15
br label %24
24: ; preds = %15, %23
%25 = call i32 @exit(i32 2)
unreachable
26: ; preds = %14
%27 = load i32, i32* @optind
ret i32 %27
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
%struct.options = type { i32 }
@parse_options.long_options = internal global [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 0, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [4 x i8] c"s:h\00"
@optind = global i32 0
define i32 @parse_options(i32 %0, i8** %1, %struct.options* nocapture readnone %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @parse_options.long_options, i64 0, i64 0), i32* %4)
switch i32 %6, label %13 [
i32 -1, label %7
i32 104, label %9
]
7: ; preds = %3
%8 = load i32, i32* @optind
ret i32 %8
9: ; preds = %3
%10 = load i8*, i8** %1
%11 = call i32 @print_help(i8* %10)
%12 = call i32 @exit(i32 0)
unreachable
13: ; preds = %3
%14 = call i32 @exit(i32 2)
unreachable
}