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

/* Variables and functions */
int /*<<< orphan*/ ERR_asprintf_error_data(char *, char const *, char const *);
int /*<<< orphan*/ OBJ_sn2nid(char const *);
int /*<<< orphan*/ X509V3_R_ERROR_IN_EXTENSION;
int /*<<< orphan*/ X509V3error(int /*<<< orphan*/);
int /*<<< orphan*/ *do_ext_nconf(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/, int, char const *);
int v3_check_critical(char const **);
int v3_check_generic(char const **);
int /*<<< orphan*/ *v3_generic_extension(char const *, char const *, int, int,
                                         int /*<<< orphan*/ *);
X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name,
                                 const char *value) {
  int crit;
  int ext_type;
  X509_EXTENSION *ret;
  crit = v3_check_critical(&value);
  if ((ext_type = v3_check_generic(&value)))
    return v3_generic_extension(name, value, crit, ext_type, ctx);
  ret = do_ext_nconf(conf, ctx, OBJ_sn2nid(name), crit, value);
  if (!ret) {
    X509V3error(X509V3_R_ERROR_IN_EXTENSION);
    ERR_asprintf_error_data("name=%s, value=%s", name, value);
  }
  return ret;
}


x86 assembly (clang, -O0):
<X509V3_EXT_nconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
call   1090 <v3_check_critical@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x28(%rbp),%rdi
call   1080 <v3_check_generic@plt>
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
je     11c9 <X509V3_EXT_nconf+0x59>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x18(%rbp),%r8
call   1070 <v3_generic_extension@plt>
mov    %rax,-0x8(%rbp)
jmp    1231 <X509V3_EXT_nconf+0xc1>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <OBJ_sn2nid@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%r8
call   1060 <do_ext_nconf@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1229 <X509V3_EXT_nconf+0xb9>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   1050 <X509V3error@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xddc(%rip),%rdi
call   1030 <ERR_asprintf_error_data@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509V3_EXT_nconf>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
mov    %rcx,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <v3_check_critical@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1080 <v3_check_generic@plt>
test   %eax,%eax
je     11bb <X509V3_EXT_nconf+0x4b>
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    %ebp,%edx
mov    %eax,%ecx
mov    %r12,%r8
call   1070 <v3_generic_extension@plt>
jmp    1200 <X509V3_EXT_nconf+0x90>
mov    %r14,%rdi
call   1040 <OBJ_sn2nid@plt>
mov    0x8(%rsp),%r8
mov    %r15,%rdi
mov    %r12,%rsi
mov    %eax,%edx
mov    %ebp,%ecx
call   1060 <do_ext_nconf@plt>
test   %rax,%rax
jne    1200 <X509V3_EXT_nconf+0x90>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
call   1050 <X509V3error@plt>
mov    0x8(%rsp),%rdx
lea    0xe0a(%rip),%rdi
mov    %r14,%rsi
call   1030 <ERR_asprintf_error_data@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@X509V3_R_ERROR_IN_EXTENSION = global i32 0
@.str = [18 x i8] c"name=%s, value=%s\00"
define i32* @X509V3_EXT_nconf(i32* %0, i32* %1, i8* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%13 = call i32 @v3_check_critical(i8** %9)
store i32 %13, i32* %10
%14 = call i32 @v3_check_generic(i8** %9)
store i32 %14, i32* %11
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %4
%17 = load i8*, i8** %8
%18 = load i8*, i8** %9
%19 = load i32, i32* %10
%20 = load i32, i32* %11
%21 = load i32*, i32** %7
%22 = call i32* @v3_generic_extension(i8* %17, i8* %18, i32 %19, i32 %20, i32* %21)
store i32* %22, i32** %5
br label %41
23: ; preds = %4
%24 = load i32*, i32** %6
%25 = load i32*, i32** %7
%26 = load i8*, i8** %8
%27 = call i32 @OBJ_sn2nid(i8* %26)
%28 = load i32, i32* %10
%29 = load i8*, i8** %9
%30 = call i32* @do_ext_nconf(i32* %24, i32* %25, i32 %27, i32 %28, i8* %29)
store i32* %30, i32** %12
%31 = load i32*, i32** %12
%32 = icmp ne i32* %31, null
br i1 %32, label %39, label %33
33: ; preds = %23
%34 = load i32, i32* @X509V3_R_ERROR_IN_EXTENSION
%35 = call i32 @X509V3error(i32 %34)
%36 = load i8*, i8** %8
%37 = load i8*, i8** %9
%38 = call i32 @ERR_asprintf_error_data(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %36, i8* %37)
br label %39
39: ; preds = %33, %23
%40 = load i32*, i32** %12
store i32* %40, i32** %5
br label %41
41: ; preds = %39, %16
%42 = load i32*, i32** %5
ret i32* %42
}

LLVM IR (-O2):
@X509V3_R_ERROR_IN_EXTENSION = global i32 0
@.str = [18 x i8] c"name=%s, value=%s\00"
define i32* @X509V3_EXT_nconf(i32* %0, i32* %1, i8* %2, i8* %3) {
%5 = alloca i8*
store i8* %3, i8** %5
%6 = call i32 @v3_check_critical(i8** %5)
%7 = call i32 @v3_check_generic(i8** %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = call i32* @v3_generic_extension(i8* %2, i8* %10, i32 %6, i32 %7, i32* %1)
br label %22
12: ; preds = %4
%13 = call i32 @OBJ_sn2nid(i8* %2)
%14 = load i8*, i8** %5
%15 = call i32* @do_ext_nconf(i32* %0, i32* %1, i32 %13, i32 %6, i8* %14)
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* @X509V3_R_ERROR_IN_EXTENSION
%19 = call i32 @X509V3error(i32 %18)
%20 = load i8*, i8** %5
%21 = call i32 @ERR_asprintf_error_data(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %20)
br label %22
22: ; preds = %12, %17, %9
%23 = phi i32* [ %11, %9 ], [ null, %17 ], [ %15, %12 ]
ret i32* %23
}