#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 */
typedef int /*<<< orphan*/ CONF;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
scalar_t__ BIO_R_NO_SUCH_FILE;
int /*<<< orphan*/ BIO_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BIO_new_file(char const *, char *);
int /*<<< orphan*/ CONF_R_NO_SUCH_FILE;
int /*<<< orphan*/ CONFerror(int /*<<< orphan*/);
scalar_t__ ERR_GET_REASON(int /*<<< orphan*/);
int /*<<< orphan*/ ERR_R_SYS_LIB;
int /*<<< orphan*/ ERR_peek_last_error();
int def_load_bio(int /*<<< orphan*/ *, int /*<<< orphan*/ *, long *);
int def_load(CONF *conf, const char *name, long *line) {
  int ret;
  BIO *in = NULL;
  in = BIO_new_file(name, "rb");
  if (in == NULL) {
    if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
      CONFerror(CONF_R_NO_SUCH_FILE);
    else
      CONFerror(ERR_R_SYS_LIB);
    return 0;
  }
  ret = def_load_bio(conf, in, line);
  BIO_free(in);
  return ret;
}


x86 assembly (clang, -O0):
<def_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1080 <BIO_new_file@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11e6 <def_load+0x86>
mov    $0x0,%al
call   1030 <ERR_peek_last_error@plt>
mov    %eax,%edi
call   1070 <ERR_GET_REASON@plt>
mov    0x2e38(%rip),%rcx
cmp    (%rcx),%rax
jne    11cc <def_load+0x6c>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
call   1060 <CONFerror@plt>
jmp    11da <def_load+0x7a>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
call   1060 <CONFerror@plt>
movl   $0x0,-0x4(%rbp)
jmp    1209 <def_load+0xa9>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <def_load_bio@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <BIO_free@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<def_load>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rax
mov    %rdi,%r15
lea    0xe89(%rip),%rsi
mov    %rax,%rdi
call   1080 <BIO_new_file@plt>
test   %rax,%rax
je     11a3 <def_load+0x43>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <def_load_bio@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <BIO_free@plt>
mov    %ebp,%eax
jmp    11d6 <def_load+0x76>
xor    %eax,%eax
call   1030 <ERR_peek_last_error@plt>
mov    %eax,%edi
call   1070 <ERR_GET_REASON@plt>
mov    0x2e30(%rip),%rcx
cmp    (%rcx),%rax
jne    11c6 <def_load+0x66>
mov    0x2e14(%rip),%rax
jmp    11cd <def_load+0x6d>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
call   1060 <CONFerror@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@BIO_R_NO_SUCH_FILE = global i64 0
@CONF_R_NO_SUCH_FILE = global i32 0
@ERR_R_SYS_LIB = global i32 0
define i32 @def_load(i32* %0, i8* %1, i64* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i64*
%8 = alloca i32
%9 = alloca i32*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i64* %2, i64** %7
store i32* null, i32** %9
%10 = load i8*, i8** %6
%11 = call i32* @BIO_new_file(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %9
%12 = load i32*, i32** %9
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %26
14: ; preds = %3
%15 = call i32 (...) @ERR_peek_last_error()
%16 = call i64 @ERR_GET_REASON(i32 %15)
%17 = load i64, i64* @BIO_R_NO_SUCH_FILE
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* @CONF_R_NO_SUCH_FILE
%21 = call i32 @CONFerror(i32 %20)
br label %25
22: ; preds = %14
%23 = load i32, i32* @ERR_R_SYS_LIB
%24 = call i32 @CONFerror(i32 %23)
br label %25
25: ; preds = %22, %19
store i32 0, i32* %4
br label %34
26: ; preds = %3
%27 = load i32*, i32** %5
%28 = load i32*, i32** %9
%29 = load i64*, i64** %7
%30 = call i32 @def_load_bio(i32* %27, i32* %28, i64* %29)
store i32 %30, i32* %8
%31 = load i32*, i32** %9
%32 = call i32 @BIO_free(i32* %31)
%33 = load i32, i32* %8
store i32 %33, i32* %4
br label %34
34: ; preds = %26, %25
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@BIO_R_NO_SUCH_FILE = global i64 0
@CONF_R_NO_SUCH_FILE = global i32 0
@ERR_R_SYS_LIB = global i32 0
define i32 @def_load(i32* %0, i8* %1, i64* %2) {
%4 = tail call i32* @BIO_new_file(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = tail call i32 (...) @ERR_peek_last_error()
%8 = tail call i64 @ERR_GET_REASON(i32 %7)
%9 = load i64, i64* @BIO_R_NO_SUCH_FILE
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i32, i32* @CONF_R_NO_SUCH_FILE
%13 = tail call i32 @CONFerror(i32 %12)
br label %20
14: ; preds = %6
%15 = load i32, i32* @ERR_R_SYS_LIB
%16 = tail call i32 @CONFerror(i32 %15)
br label %20
17: ; preds = %3
%18 = tail call i32 @def_load_bio(i32* %0, i32* %4, i64* %2)
%19 = tail call i32 @BIO_free(i32* %4)
br label %20
20: ; preds = %11, %14, %17
%21 = phi i32 [ %18, %17 ], [ 0, %14 ], [ 0, %11 ]
ret i32 %21
}