#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 */

/* Variables and functions */
int /*<<< orphan*/ check_options(int, char *const *, int);
int /*<<< orphan*/ clean_config();
int /*<<< orphan*/ free_command_line(int, char **);
int load_command_line(int, char *const *, char **);
int parse_options(int, char **);
int /*<<< orphan*/ preload_options(int, char **);
int load_options(int argc, char *const argv[]) {
  char *argv_new[2048];
  int argc_new;
  check_options(argc, argv, 1);
  argc_new = load_command_line(argc, argv, argv_new);
  preload_options(argc_new, argv_new);
  check_options(argc_new, argv_new, 0);
  if (parse_options(argc_new, argv_new) == -1) {
    free_command_line(argc_new, argv_new);
    return -1;
  }
  free_command_line(argc_new, argv_new);
  clean_config();
  return 0;
}


x86 assembly (clang, -O0):
<load_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4020,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1050 <check_options@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x4010(%rbp),%rdx
call   1030 <load_command_line@plt>
mov    %eax,-0x4014(%rbp)
mov    -0x4014(%rbp),%edi
lea    -0x4010(%rbp),%rsi
call   1060 <preload_options@plt>
mov    -0x4014(%rbp),%edi
lea    -0x4010(%rbp),%rsi
xor    %edx,%edx
call   1050 <check_options@plt>
mov    -0x4014(%rbp),%edi
lea    -0x4010(%rbp),%rsi
call   1040 <parse_options@plt>
cmp    $0xffffffff,%eax
jne    11fb <load_options+0x9b>
mov    -0x4014(%rbp),%edi
lea    -0x4010(%rbp),%rsi
call   1080 <free_command_line@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121b <load_options+0xbb>
mov    -0x4014(%rbp),%edi
lea    -0x4010(%rbp),%rsi
call   1080 <free_command_line@plt>
mov    $0x0,%al
call   1070 <clean_config@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_options>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x4008,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x1,%edx
call   1050 <check_options@plt>
mov    %rsp,%r14
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <load_command_line@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r14,%rsi
call   1060 <preload_options@plt>
xor    %r15d,%r15d
mov    %ebp,%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1050 <check_options@plt>
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <parse_options@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %r14,%rsi
call   1080 <free_command_line@plt>
cmp    $0xffffffff,%ebx
je     11cb <load_options+0x6b>
xor    %eax,%eax
call   1070 <clean_config@plt>
jmp    11d1 <load_options+0x71>
mov    $0xffffffff,%r15d
mov    %r15d,%eax
add    $0x4008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @load_options(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048 x i8*]
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @check_options(i32 %8, i8** %9, i32 1)
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds [2048 x i8*], [2048 x i8*]* %6, i64 0, i64 0
%14 = call i32 @load_command_line(i32 %11, i8** %12, i8** %13)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = getelementptr inbounds [2048 x i8*], [2048 x i8*]* %6, i64 0, i64 0
%17 = call i32 @preload_options(i32 %15, i8** %16)
%18 = load i32, i32* %7
%19 = getelementptr inbounds [2048 x i8*], [2048 x i8*]* %6, i64 0, i64 0
%20 = call i32 @check_options(i32 %18, i8** %19, i32 0)
%21 = load i32, i32* %7
%22 = getelementptr inbounds [2048 x i8*], [2048 x i8*]* %6, i64 0, i64 0
%23 = call i32 @parse_options(i32 %21, i8** %22)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %29
25: ; preds = %2
%26 = load i32, i32* %7
%27 = getelementptr inbounds [2048 x i8*], [2048 x i8*]* %6, i64 0, i64 0
%28 = call i32 @free_command_line(i32 %26, i8** %27)
store i32 -1, i32* %3
br label %34
29: ; preds = %2
%30 = load i32, i32* %7
%31 = getelementptr inbounds [2048 x i8*], [2048 x i8*]* %6, i64 0, i64 0
%32 = call i32 @free_command_line(i32 %30, i8** %31)
%33 = call i32 (...) @clean_config()
store i32 0, i32* %3
br label %34
34: ; preds = %29, %25
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @load_options(i32 %0, i8** %1) {
%3 = alloca [2048 x i8*]
%4 = bitcast [2048 x i8*]* %3 to i8*
%5 = tail call i32 @check_options(i32 %0, i8** %1, i32 1)
%6 = getelementptr inbounds [2048 x i8*], [2048 x i8*]* %3, i64 0, i64 0
%7 = call i32 @load_command_line(i32 %0, i8** %1, i8** %6)
%8 = call i32 @preload_options(i32 %7, i8** %6)
%9 = call i32 @check_options(i32 %7, i8** %6, i32 0)
%10 = call i32 @parse_options(i32 %7, i8** %6)
%11 = icmp eq i32 %10, -1
%12 = call i32 @free_command_line(i32 %7, i8** %6)
br i1 %11, label %15, label %13
13: ; preds = %2
%14 = call i32 (...) @clean_config()
br label %15
15: ; preds = %2, %13
%16 = phi i32 [ 0, %13 ], [ -1, %2 ]
ret i32 %16
}