#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_params {
  int dummy;
};
struct gengetopt_args_info {
  int dummy;
};

/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ options_free(struct gengetopt_args_info *);
int options_internal(int, char **, struct gengetopt_args_info *,
                     struct options_params *, int /*<<< orphan*/);
int options_ext(int argc, char **argv, struct gengetopt_args_info *args_info,
                struct options_params *params) {
  int result;
  result = options_internal(argc, argv, args_info, params, 0);
  if (result == EXIT_FAILURE) {
    options_free(args_info);
    exit(EXIT_FAILURE);
  }
  return result;
}


x86 assembly (clang, -O0):
<options_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <options_internal@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    0x2e75(%rip),%rcx
cmp    (%rcx),%eax
jne    118a <options_ext+0x5a>
mov    -0x18(%rbp),%rdi
call   1030 <options_free@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<options_ext>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
xor    %r8d,%r8d
call   1040 <options_internal@plt>
mov    0x2e9a(%rip),%r14
cmp    (%r14),%eax
je     1153 <options_ext+0x23>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
call   1030 <options_free@plt>
mov    (%r14),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.gengetopt_args_info = type { i32 }
%struct.options_params = type { i32 }
@EXIT_FAILURE = global i32 0
define i32 @options_ext(i32 %0, i8** %1, %struct.gengetopt_args_info* %2, %struct.options_params* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca %struct.gengetopt_args_info*
%8 = alloca %struct.options_params*
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store %struct.gengetopt_args_info* %2, %struct.gengetopt_args_info** %7
store %struct.options_params* %3, %struct.options_params** %8
%10 = load i32, i32* %5
%11 = load i8**, i8*** %6
%12 = load %struct.gengetopt_args_info*, %struct.gengetopt_args_info** %7
%13 = load %struct.options_params*, %struct.options_params** %8
%14 = call i32 @options_internal(i32 %10, i8** %11, %struct.gengetopt_args_info* %12, %struct.options_params* %13, i32 0)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i32, i32* @EXIT_FAILURE
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %4
%19 = load %struct.gengetopt_args_info*, %struct.gengetopt_args_info** %7
%20 = call i32 @options_free(%struct.gengetopt_args_info* %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %4
%24 = load i32, i32* %9
ret i32 %24
}

LLVM IR (-O2):
%struct.gengetopt_args_info = type { i32 }
%struct.options_params = type { i32 }
@EXIT_FAILURE = global i32 0
define i32 @options_ext(i32 %0, i8** %1, %struct.gengetopt_args_info* %2, %struct.options_params* %3) {
%5 = tail call i32 @options_internal(i32 %0, i8** %1, %struct.gengetopt_args_info* %2, %struct.options_params* %3, i32 0)
%6 = load i32, i32* @EXIT_FAILURE
%7 = icmp eq i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = tail call i32 @options_free(%struct.gengetopt_args_info* %2)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %4
ret i32 %5
}