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

/* Variables and functions */
int CTLOG_new_from_base64(int /*<<< orphan*/ **, char *, char const *);
int /*<<< orphan*/ CT_F_CTLOG_NEW_FROM_CONF;
int /*<<< orphan*/ CT_R_LOG_CONF_MISSING_DESCRIPTION;
int /*<<< orphan*/ CT_R_LOG_CONF_MISSING_KEY;
int /*<<< orphan*/ CTerr(int /*<<< orphan*/, int /*<<< orphan*/);
void *NCONF_get_string(int /*<<< orphan*/ const *, char const *, char *);
int ctlog_new_from_conf(CTLOG **ct_log, const CONF *conf, const char *section) {
  const char *description = NCONF_get_string(conf, section, "description");
  char *pkey_base64;
  if (description == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_CONF, CT_R_LOG_CONF_MISSING_DESCRIPTION);
    return 0;
  }
  pkey_base64 = NCONF_get_string(conf, section, "key");
  if (pkey_base64 == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_CONF, CT_R_LOG_CONF_MISSING_KEY);
    return 0;
  }
  return CTLOG_new_from_base64(ct_log, pkey_base64, description);
}


x86 assembly (clang, -O0):
<ctlog_new_from_conf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    0xead(%rip),%rdx
call   1040 <NCONF_get_string@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    118a <ctlog_new_from_conf+0x5a>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
call   1050 <CTerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e4 <ctlog_new_from_conf+0xb4>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    0xe73(%rip),%rdx
call   1040 <NCONF_get_string@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11d0 <ctlog_new_from_conf+0xa0>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
call   1050 <CTerr@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e4 <ctlog_new_from_conf+0xb4>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <CTLOG_new_from_base64@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctlog_new_from_conf>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeb8(%rip),%rdx
mov    %rsi,%rdi
mov    %r12,%rsi
call   1040 <NCONF_get_string@plt>
test   %rax,%rax
je     118b <ctlog_new_from_conf+0x5b>
mov    %rax,%r15
lea    0xeaa(%rip),%rdx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <NCONF_get_string@plt>
test   %rax,%rax
je     119d <ctlog_new_from_conf+0x6d>
mov    %r14,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <CTLOG_new_from_base64@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
mov    0x2e3d(%rip),%rax
jmp    11ad <ctlog_new_from_conf+0x7d>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    0x2e23(%rip),%rax
mov    (%rax),%esi
call   1050 <CTerr@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"description\00"
@CT_F_CTLOG_NEW_FROM_CONF = global i32 0
@CT_R_LOG_CONF_MISSING_DESCRIPTION = global i32 0
@.str.1 = [4 x i8] c"key\00"
@CT_R_LOG_CONF_MISSING_KEY = global i32 0
define i32 @ctlog_new_from_conf(i32** %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32** %0, i32*** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
%10 = load i32*, i32** %6
%11 = load i8*, i8** %7
%12 = call i8* @NCONF_get_string(i32* %10, i8* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %3
%16 = load i32, i32* @CT_F_CTLOG_NEW_FROM_CONF
%17 = load i32, i32* @CT_R_LOG_CONF_MISSING_DESCRIPTION
%18 = call i32 @CTerr(i32 %16, i32 %17)
store i32 0, i32* %4
br label %34
19: ; preds = %3
%20 = load i32*, i32** %6
%21 = load i8*, i8** %7
%22 = call i8* @NCONF_get_string(i32* %20, i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %22, i8** %9
%23 = load i8*, i8** %9
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %29
25: ; preds = %19
%26 = load i32, i32* @CT_F_CTLOG_NEW_FROM_CONF
%27 = load i32, i32* @CT_R_LOG_CONF_MISSING_KEY
%28 = call i32 @CTerr(i32 %26, i32 %27)
store i32 0, i32* %4
br label %34
29: ; preds = %19
%30 = load i32**, i32*** %5
%31 = load i8*, i8** %9
%32 = load i8*, i8** %8
%33 = call i32 @CTLOG_new_from_base64(i32** %30, i8* %31, i8* %32)
store i32 %33, i32* %4
br label %34
34: ; preds = %29, %25, %15
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
@.str = [12 x i8] c"description\00"
@CT_F_CTLOG_NEW_FROM_CONF = global i32 0
@CT_R_LOG_CONF_MISSING_DESCRIPTION = global i32 0
@.str.1 = [4 x i8] c"key\00"
@CT_R_LOG_CONF_MISSING_KEY = global i32 0
define i32 @ctlog_new_from_conf(i32** %0, i32* %1, i8* %2) {
%4 = tail call i8* @NCONF_get_string(i32* %1, i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @CT_F_CTLOG_NEW_FROM_CONF
%8 = load i32, i32* @CT_R_LOG_CONF_MISSING_DESCRIPTION
%9 = tail call i32 @CTerr(i32 %7, i32 %8)
br label %19
10: ; preds = %3
%11 = tail call i8* @NCONF_get_string(i32* %1, i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* @CT_F_CTLOG_NEW_FROM_CONF
%15 = load i32, i32* @CT_R_LOG_CONF_MISSING_KEY
%16 = tail call i32 @CTerr(i32 %14, i32 %15)
br label %19
17: ; preds = %10
%18 = tail call i32 @CTLOG_new_from_base64(i32** %0, i8* %11, i8* %4)
br label %19
19: ; preds = %17, %13, %6
%20 = phi i32 [ 0, %6 ], [ 0, %13 ], [ %18, %17 ]
ret i32 %20
}