#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_3;
  char const *name;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ *member_0;
};

/* Variables and functions */
int getopt_long(int, char **, char *, struct option *, int *);
char *optarg;
scalar_t__ opterr;
int optind;
int /*<<< orphan*/ required_argument;
char *input_get_argument(int argc, char **argv, const char *argument) {
  opterr = 0;
  optind = 1;
  while (1) {
    struct option long_options[] = {{NULL, required_argument, 0, 'a'},
                                    {0, 0, 0, 0}};
    long_options[0].name = argument;
    int option_index = 0;
    int c = getopt_long(argc, argv, "", long_options, &option_index);
    if (c == -1)
      break;
    switch (c) {
    case 'a':
      return optarg;
      break;
    default:
      break;
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<input_get_argument>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2e8e(%rip),%rax
movq   $0x0,(%rax)
mov    0x2e98(%rip),%rax
movl   $0x1,(%rax)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    0x2e73(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x58(%rbp)
movl   $0x61,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
lea    -0x60(%rbp),%rcx
lea    0xe6c(%rip),%rdx
lea    -0x64(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x68(%rbp)
cmpl   $0xffffffff,-0x68(%rbp)
jne    11af <input_get_argument+0x8f>
jmp    11dd <input_get_argument+0xbd>
mov    -0x68(%rbp),%eax
sub    $0x61,%eax
jne    11d3 <input_get_argument+0xb3>
jmp    11c0 <input_get_argument+0xa0>
mov    0x2e31(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <input_get_argument+0xc5>
jmp    11d8 <input_get_argument+0xb8>
jmp    114e <input_get_argument+0x2e>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_get_argument>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2ea3(%rip),%rax
movq   $0x0,(%rax)
mov    0x2ea5(%rip),%rax
movl   $0x1,(%rax)
lea    0xeb8(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movl   $0x61,0x24(%rsp)
mov    %r14,0x18(%rsp)
movl   $0x0,0xc(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1030 <getopt_long@plt>
cmp    $0xffffffff,%eax
je     11b5 <input_get_argument+0xa5>
cmp    $0x61,%eax
jne    1160 <input_get_argument+0x50>
mov    0x2e48(%rip),%rax
mov    (%rax),%rax
jmp    11b7 <input_get_argument+0xa7>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8, i8*, i32, i32, i32* }
@opterr = global i64 0
@optind = global i32 0
@required_argument = global i32 0
@.str = [1 x i8] zeroinitializer
@optarg = global i8* null
define i8* @input_get_argument(i32 %0, i8** %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca [2 x %struct.option]
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i64 0, i64* @opterr
store i32 1, i32* @optind
br label %11
11: ; preds = %3, %35
%12 = bitcast [2 x %struct.option]* %8 to i8*
%13 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %8, i64 0, i64 0
%14 = getelementptr inbounds %struct.option, %struct.option* %13, i32 0, i32 1
%15 = load i32, i32* @required_argument
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %14
%18 = getelementptr inbounds %struct.option, %struct.option* %13, i32 0, i32 3
store i32 97, i32* %18
%19 = getelementptr inbounds %struct.option, %struct.option* %13, i64 1
%20 = load i8*, i8** %7
%21 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %8, i64 0, i64 0
%22 = getelementptr inbounds %struct.option, %struct.option* %21, i32 0, i32 1
store i8* %20, i8** %22
store i32 0, i32* %9
%23 = load i32, i32* %5
%24 = load i8**, i8*** %6
%25 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %8, i64 0, i64 0
%26 = call i32 @getopt_long(i32 %23, i8** %24, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %struct.option* %25, i32* %9)
store i32 %26, i32* %10
%27 = load i32, i32* %10
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %30
29: ; preds = %11
br label %36
30: ; preds = %11
%31 = load i32, i32* %10
switch i32 %31, label %34 [
i32 97, label %32
]
32: ; preds = %30
%33 = load i8*, i8** @optarg
store i8* %33, i8** %4
br label %37
34: ; preds = %30
br label %35
35: ; preds = %34
br label %11
36: ; preds = %29
store i8* null, i8** %4
br label %37
37: ; preds = %36, %32
%38 = load i8*, i8** %4
ret i8* %38
}

LLVM IR (-O2):
%struct.option = type { i8, i8*, i32, i32, i32* }
@opterr = global i64 0
@optind = global i32 0
@required_argument = global i32 0
@.str = [1 x i8] zeroinitializer
@optarg = global i8* null
define i8* @input_get_argument(i32 %0, i8** %1, i8* %2) {
%4 = alloca [2 x %struct.option]
%5 = alloca i32
store i64 0, i64* @opterr
store i32 1, i32* @optind
%6 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %4, i64 0, i64 0, i32 0
%7 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %4, i64 0, i64 0
%8 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %4, i64 0, i64 0, i32 1
%9 = getelementptr inbounds [2 x %struct.option], [2 x %struct.option]* %4, i64 0, i64 0, i32 3
%10 = bitcast i32* %5 to i8*
br label %11
11: ; preds = %15, %3
store i32 97, i32* %9
store i8* %2, i8** %8
store i32 0, i32* %5
%12 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %struct.option* %7, i32* %5)
switch i32 %12, label %15 [
i32 -1, label %16
i32 97, label %13
]
13: ; preds = %11
%14 = load i8*, i8** @optarg
br label %17
15: ; preds = %11
br label %11
16: ; preds = %11
br label %17
17: ; preds = %13, %16
%18 = phi i8* [ null, %16 ], [ %14, %13 ]
ret i8* %18
}