#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 */
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int /*<<< orphan*/ db;
  TYPE_1__ *db_meth;
};
typedef TYPE_2__ X509V3_CTX;
struct TYPE_4__ {
  char *(*get_string)(int /*<<< orphan*/, char const *, char const *);
};

/* Variables and functions */
int /*<<< orphan*/ X509V3_R_OPERATION_NOT_DEFINED;
int /*<<< orphan*/ X509V3error(int /*<<< orphan*/);
char *stub1(int /*<<< orphan*/, char const *, char const *);
char *X509V3_get_string(X509V3_CTX *ctx, const char *name,
                        const char *section) {
  if (!ctx->db || !ctx->db_meth || !ctx->db_meth->get_string) {
    X509V3error(X509V3_R_OPERATION_NOT_DEFINED);
    return NULL;
  }
  return ctx->db_meth->get_string(ctx->db, name, section);
}


x86 assembly (clang, -O0):
<X509V3_get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     1152 <X509V3_get_string+0x42>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1152 <X509V3_get_string+0x42>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
cmpq   $0x0,(%rax)
jne    116d <X509V3_get_string+0x5d>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1030 <X509V3error@plt>
movq   $0x0,-0x8(%rbp)
jmp    118c <X509V3_get_string+0x7c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   *%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509V3_get_string>:
push   %rax
mov    %rdi,%rax
mov    (%rdi),%edi
test   %edi,%edi
je     112e <X509V3_get_string+0x1e>
mov    0x8(%rax),%rax
test   %rax,%rax
je     112e <X509V3_get_string+0x1e>
mov    (%rax),%rax
test   %rax,%rax
je     112e <X509V3_get_string+0x1e>
pop    %rcx
jmp    *%rax
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1030 <X509V3error@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__* }
%struct.TYPE_4__ = type { i8* (i32, i8*, i8*)* }
@X509V3_R_OPERATION_NOT_DEFINED = global i32 0
define i8* @X509V3_get_string(%struct.TYPE_5__* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca %struct.TYPE_5__*
%6 = alloca i8*
%7 = alloca i8*
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %3
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %13, i32 0, i32 1
%15 = load %struct.TYPE_4__*, %struct.TYPE_4__** %14
%16 = icmp ne %struct.TYPE_4__* %15, null
br i1 %16, label %17, label %24
17: ; preds = %12
%18 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%19 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %18, i32 0, i32 1
%20 = load %struct.TYPE_4__*, %struct.TYPE_4__** %19
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %20, i32 0, i32 0
%22 = load i8* (i32, i8*, i8*)*, i8* (i32, i8*, i8*)** %21
%23 = icmp ne i8* (i32, i8*, i8*)* %22, null
br i1 %23, label %27, label %24
24: ; preds = %17, %12, %3
%25 = load i32, i32* @X509V3_R_OPERATION_NOT_DEFINED
%26 = call i32 @X509V3error(i32 %25)
store i8* null, i8** %4
br label %39
27: ; preds = %17
%28 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%29 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %28, i32 0, i32 1
%30 = load %struct.TYPE_4__*, %struct.TYPE_4__** %29
%31 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %30, i32 0, i32 0
%32 = load i8* (i32, i8*, i8*)*, i8* (i32, i8*, i8*)** %31
%33 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%34 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i32 0, i32 0
%35 = load i32, i32* %34
%36 = load i8*, i8** %6
%37 = load i8*, i8** %7
%38 = call i8* %32(i32 %35, i8* %36, i8* %37)
store i8* %38, i8** %4
br label %39
39: ; preds = %27, %24
%40 = load i8*, i8** %4
ret i8* %40
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__* }
%struct.TYPE_4__ = type { i8* (i32, i8*, i8*)* }
@X509V3_R_OPERATION_NOT_DEFINED = global i32 0
define i8* @X509V3_get_string(%struct.TYPE_5__* nocapture %0, i8* %1, i8* %2) {
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 1
%9 = load %struct.TYPE_4__*, %struct.TYPE_4__** %8
%10 = icmp eq %struct.TYPE_4__* %9, null
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i64 0, i32 0
%13 = load i8* (i32, i8*, i8*)*, i8* (i32, i8*, i8*)** %12
%14 = icmp eq i8* (i32, i8*, i8*)* %13, null
br i1 %14, label %15, label %18
15: ; preds = %11, %7, %3
%16 = load i32, i32* @X509V3_R_OPERATION_NOT_DEFINED
%17 = tail call i32 @X509V3error(i32 %16)
br label %20
18: ; preds = %11
%19 = tail call i8* %13(i32 %5, i8* %1, i8* %2)
br label %20
20: ; preds = %18, %15
%21 = phi i8* [ %19, %18 ], [ null, %15 ]
ret i8* %21
}