#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) {
  char *end;
  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,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xead(%rip),%rdx
lea    0x2ee1(%rip),%rcx
lea    -0x28(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    1179 <parse_options+0x49>
jmp    11c0 <parse_options+0x90>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x3f,%eax
je     11b1 <parse_options+0x81>
jmp    118d <parse_options+0x5d>
mov    -0x2c(%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 i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.options* %2, %struct.options** %6
br label %10
10: ; preds = %3
store i32 0, i32* %9
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt_long(i32 %11, i8** %12, 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* %9)
store i32 %13, i32* %8
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %16
15: ; preds = %10
br label %27
16: ; preds = %10
%17 = load i32, i32* %8
switch i32 %17, label %25 [
i32 104, label %18
i32 63, label %24
]
18: ; preds = %16
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @print_help(i8* %21)
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %16
br label %25
25: ; preds = %16, %24
%26 = call i32 @exit(i32 2)
unreachable
27: ; preds = %15
%28 = load i32, i32* @optind
ret i32 %28
}

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
}