#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 *, struct option const *,
                int /*<<< orphan*/ *);
#define no_argument 128
int /*<<< orphan*/ print_usage(char *);
void parse_opts(int argc, char *argv[]) {
  while (1) {
    static const struct option lopts[] = {
        {"help", no_argument, NULL, 'h'},
        {NULL, 0, 0, 0},
    };
    int c;
    c = getopt_long(argc, argv, "h", lopts, NULL);
    if (c == -1)
      break;
    switch (c) {
      break;
    case 'h':
      print_usage(argv[0]);
      break;
    default:
      print_usage(argv[0]);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<parse_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    0xec8(%rip),%rdx
lea    0x2c9c(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1160 <parse_opts+0x40>
jmp    1193 <parse_opts+0x73>
mov    -0x14(%rbp),%eax
sub    $0x68,%eax
jne    1182 <parse_opts+0x62>
jmp    1171 <parse_opts+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <print_usage@plt>
jmp    118e <parse_opts+0x6e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <print_usage@plt>
jmp    112f <parse_opts+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_opts>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xed2(%rip),%rdx
lea    0x2ca6(%rip),%rcx
xor    %r8d,%r8d
call   1030 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     1180 <parse_opts+0x60>
lea    0xeb7(%rip),%r14
lea    0x2c8b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%rdi
call   1040 <print_usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1030 <getopt_long@plt>
cmp    $0xffffffff,%eax
jne    1160 <parse_opts+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@parse_opts.lopts = internal constant [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
define void @parse_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 = %2, %25
%7 = load i32, i32* %3
%8 = load i8**, i8*** %4
%9 = call i32 @getopt_long(i32 %7, i8** %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @parse_opts.lopts, i64 0, i64 0), i32* null)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %6
br label %26
13: ; preds = %6
%14 = load i32, i32* %5
switch i32 %14, label %20 [
i32 104, label %15
]
15: ; preds = %13
%16 = load i8**, i8*** %4
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @print_usage(i8* %18)
br label %25
20: ; preds = %13
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @print_usage(i8* %23)
br label %25
25: ; preds = %20, %15
br label %6
26: ; preds = %12
ret void
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@parse_opts.lopts = internal constant [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
define void @parse_opts(i32 %0, i8** %1) {
%3 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @parse_opts.lopts, i64 0, i64 0), i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = load i8*, i8** %1
%7 = tail call i32 @print_usage(i8* %6)
%8 = tail call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @parse_opts.lopts, i64 0, i64 0), i32* null)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %5
10: ; preds = %5, %2
ret void
}