#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 *, int *);
int optind;
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ show_info(char *);
int /*<<< orphan*/ show_usage();
int main(int argc, char *argv[]) {
  if (argc == 1) {
    show_usage();
    return 0;
  }
  while (1) {
    static struct option long_options[] = {{"help", 0, 0, 'h'}};
    int option_index = 0;
    int c = getopt_long(argc, argv, "h", long_options, &option_index);
    if (c == -1) {
      break;
    }
    switch (c) {
    case 'h':
      show_usage();
      return 0;
    }
  }
  if (optind == argc) {
    show_usage();
    return 0;
  }
  while (optind < argc) {
    show_info(argv[optind++]);
    if (optind < argc) {
      putchar('\n');
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1173 <main+0x33>
mov    $0x0,%al
call   1060 <show_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1263 <main+0x123>
jmp    1178 <main+0x38>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe78(%rip),%rdx
lea    0x2ebc(%rip),%rcx
lea    -0x14(%rbp),%r8
call   1050 <getopt_long@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    11af <main+0x6f>
jmp    11d8 <main+0x98>
mov    -0x18(%rbp),%eax
sub    $0x68,%eax
jne    11d3 <main+0x93>
jmp    11c0 <main+0x80>
mov    $0x0,%al
call   1060 <show_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1263 <main+0x123>
jmp    1178 <main+0x38>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jne    11fd <main+0xbd>
mov    $0x0,%al
call   1060 <show_usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1263 <main+0x123>
jmp    1202 <main+0xc2>
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    125c <main+0x11c>
mov    -0x10(%rbp),%rax
mov    0x2dc9(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2dbb(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <show_info@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1257 <main+0x117>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1202 <main+0xc2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x1,%edi
je     11a5 <main+0x65>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea8(%rip),%r14
lea    0x2eec(%rip),%r15
lea    0xc(%rsp),%r12
nopl   0x0(%rax)
movl   $0x0,0xc(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1050 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     1197 <main+0x57>
cmp    $0x68,%eax
jne    1170 <main+0x30>
jmp    11a5 <main+0x65>
mov    0x2e4a(%rip),%r14
mov    (%r14),%eax
cmp    %ebp,%eax
jne    11bb <main+0x7b>
xor    %eax,%eax
call   1060 <show_usage@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
jl     11c4 <main+0x84>
jmp    11ac <main+0x6c>
nop
cmp    %ebp,%eax
jge    11ac <main+0x6c>
lea    0x1(%rax),%ecx
mov    %ecx,(%r14)
cltq
mov    (%rbx,%rax,8),%rdi
call   1040 <show_info@plt>
mov    (%r14),%eax
cmp    %ebp,%eax
jge    11c0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r14),%eax
jmp    11c0 <main+0x80>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@main.long_options = internal global [1 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 0, i32 0, i32 104 }]
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @show_usage()
store i32 0, i32* %3
br label %51
12: ; preds = %2
br label %13
13: ; preds = %12, %24
store i32 0, i32* %6
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @getopt_long(i32 %14, i8** %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([1 x %struct.option], [1 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %6)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %13
br label %25
20: ; preds = %13
%21 = load i32, i32* %7
switch i32 %21, label %24 [
i32 104, label %22
]
22: ; preds = %20
%23 = call i32 (...) @show_usage()
store i32 0, i32* %3
br label %51
24: ; preds = %20
br label %13
25: ; preds = %19
%26 = load i32, i32* @optind
%27 = load i32, i32* %4
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (...) @show_usage()
store i32 0, i32* %3
br label %51
31: ; preds = %25
br label %32
32: ; preds = %49, %31
%33 = load i32, i32* @optind
%34 = load i32, i32* %4
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %50
36: ; preds = %32
%37 = load i8**, i8*** %5
%38 = load i32, i32* @optind
%39 = add nsw i32 %38, 1
store i32 %39, i32* @optind
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds i8*, i8** %37, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @show_info(i8* %42)
%44 = load i32, i32* @optind
%45 = load i32, i32* %4
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %49
47: ; preds = %36
%48 = call i32 @putchar(i8 signext 10)
br label %49
49: ; preds = %47, %36
br label %32
50: ; preds = %32
store i32 0, i32* %3
br label %51
51: ; preds = %50, %29, %22, %10
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@main.long_options = internal global [1 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 0, i32 0, i32 104 }]
@.str = [5 x i8] c"help\00"
@.str.1 = [2 x i8] c"h\00"
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = bitcast i32* %3 to i8*
br label %9
7: ; preds = %2
%8 = tail call i32 (...) @show_usage()
br label %36
9: ; preds = %5, %13
store i32 0, i32* %3
%10 = 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 ([1 x %struct.option], [1 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %3)
switch i32 %10, label %13 [
i32 -1, label %14
i32 104, label %11
]
11: ; preds = %9
%12 = call i32 (...) @show_usage()
br label %36
13: ; preds = %9
br label %9
14: ; preds = %9
%15 = load i32, i32* @optind
%16 = icmp eq i32 %15, %0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = icmp slt i32 %15, %0
br i1 %18, label %21, label %36
19: ; preds = %14
%20 = call i32 (...) @show_usage()
br label %36
21: ; preds = %17, %33
%22 = phi i32 [ %34, %33 ], [ %15, %17 ]
%23 = add nsw i32 %22, 1
store i32 %23, i32* @optind
%24 = sext i32 %22 to i64
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @show_info(i8* %26)
%28 = load i32, i32* @optind
%29 = icmp slt i32 %28, %0
br i1 %29, label %30, label %33
30: ; preds = %21
%31 = call i32 @putchar(i8 signext 10)
%32 = load i32, i32* @optind
br label %33
33: ; preds = %30, %21
%34 = phi i32 [ %32, %30 ], [ %28, %21 ]
%35 = icmp slt i32 %34, %0
br i1 %35, label %21, label %36
36: ; preds = %33, %17, %11, %19, %7
ret i32 0
}