#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_NAME_ENTRY;
typedef int /*<<< orphan*/ ASN1_OBJECT;

/* Variables and functions */
int /*<<< orphan*/ X509_NAME_ENTRY_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *X509_NAME_ENTRY_new();
int /*<<< orphan*/ X509_NAME_ENTRY_set_data(int /*<<< orphan*/ *, int,
                                            unsigned char const *, int);
int /*<<< orphan*/ X509_NAME_ENTRY_set_object(int /*<<< orphan*/ *,
                                              int /*<<< orphan*/ const *);
X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
                                               const ASN1_OBJECT *obj, int type,
                                               const unsigned char *bytes,
                                               int len) {
  X509_NAME_ENTRY *ret;
  if ((ne == NULL) || (*ne == NULL)) {
    if ((ret = X509_NAME_ENTRY_new()) == NULL)
      return (NULL);
  } else
    ret = *ne;
  if (!X509_NAME_ENTRY_set_object(ret, obj))
    goto err;
  if (!X509_NAME_ENTRY_set_data(ret, type, bytes, len))
    goto err;
  if ((ne != NULL) && (*ne == NULL))
    *ne = ret;
  return (ret);
err:
  if ((ne == NULL) || (ret != *ne))
    X509_NAME_ENTRY_free(ret);
  return (NULL);
}


x86 assembly (clang, -O0):
<X509_NAME_ENTRY_create_by_OBJ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1174 <X509_NAME_ENTRY_create_by_OBJ+0x34>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    119b <X509_NAME_ENTRY_create_by_OBJ+0x5b>
mov    $0x0,%al
call   1030 <X509_NAME_ENTRY_new@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1196 <X509_NAME_ENTRY_create_by_OBJ+0x56>
movq   $0x0,-0x8(%rbp)
jmp    1240 <X509_NAME_ENTRY_create_by_OBJ+0x100>
jmp    11a6 <X509_NAME_ENTRY_create_by_OBJ+0x66>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <X509_NAME_ENTRY_set_object@plt>
cmp    $0x0,%eax
jne    11c1 <X509_NAME_ENTRY_create_by_OBJ+0x81>
jmp    1213 <X509_NAME_ENTRY_create_by_OBJ+0xd3>
mov    -0x38(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1050 <X509_NAME_ENTRY_set_data@plt>
cmp    $0x0,%eax
jne    11e2 <X509_NAME_ENTRY_create_by_OBJ+0xa2>
jmp    1213 <X509_NAME_ENTRY_create_by_OBJ+0xd3>
cmpq   $0x0,-0x10(%rbp)
je     1206 <X509_NAME_ENTRY_create_by_OBJ+0xc6>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1206 <X509_NAME_ENTRY_create_by_OBJ+0xc6>
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1240 <X509_NAME_ENTRY_create_by_OBJ+0x100>
cmpq   $0x0,-0x10(%rbp)
je     122f <X509_NAME_ENTRY_create_by_OBJ+0xef>
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
je     1238 <X509_NAME_ENTRY_create_by_OBJ+0xf8>
mov    -0x38(%rbp),%rdi
call   1060 <X509_NAME_ENTRY_free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_NAME_ENTRY_create_by_OBJ>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %rcx,%r12
mov    %edx,%r13d
mov    %rsi,%rbp
mov    %rdi,%r14
test   %rdi,%rdi
je     1167 <X509_NAME_ENTRY_create_by_OBJ+0x27>
mov    (%r14),%rbx
test   %rbx,%rbx
jne    1176 <X509_NAME_ENTRY_create_by_OBJ+0x36>
xor    %eax,%eax
call   1030 <X509_NAME_ENTRY_new@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11bc <X509_NAME_ENTRY_create_by_OBJ+0x7c>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <X509_NAME_ENTRY_set_object@plt>
test   %eax,%eax
je     11aa <X509_NAME_ENTRY_create_by_OBJ+0x6a>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12,%rdx
mov    %r15d,%ecx
call   1050 <X509_NAME_ENTRY_set_data@plt>
test   %eax,%eax
je     11aa <X509_NAME_ENTRY_create_by_OBJ+0x6a>
test   %r14,%r14
je     11be <X509_NAME_ENTRY_create_by_OBJ+0x7e>
cmpq   $0x0,(%r14)
jne    11be <X509_NAME_ENTRY_create_by_OBJ+0x7e>
mov    %rbx,(%r14)
jmp    11be <X509_NAME_ENTRY_create_by_OBJ+0x7e>
test   %r14,%r14
je     11b4 <X509_NAME_ENTRY_create_by_OBJ+0x74>
cmp    (%r14),%rbx
je     11bc <X509_NAME_ENTRY_create_by_OBJ+0x7c>
mov    %rbx,%rdi
call   1060 <X509_NAME_ENTRY_free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @X509_NAME_ENTRY_create_by_OBJ(i32** %0, i32* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32**
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32*
store i32** %0, i32*** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i32 %4, i32* %11
%13 = load i32**, i32*** %7
%14 = icmp eq i32** %13, null
br i1 %14, label %19, label %15
15: ; preds = %5
%16 = load i32**, i32*** %7
%17 = load i32*, i32** %16
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %15, %5
%20 = call i32* (...) @X509_NAME_ENTRY_new()
store i32* %20, i32** %12
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %23
22: ; preds = %19
store i32* null, i32** %6
br label %65
23: ; preds = %19
br label %27
24: ; preds = %15
%25 = load i32**, i32*** %7
%26 = load i32*, i32** %25
store i32* %26, i32** %12
br label %27
27: ; preds = %24, %23
%28 = load i32*, i32** %12
%29 = load i32*, i32** %8
%30 = call i32 @X509_NAME_ENTRY_set_object(i32* %28, i32* %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %27
br label %53
33: ; preds = %27
%34 = load i32*, i32** %12
%35 = load i32, i32* %9
%36 = load i8*, i8** %10
%37 = load i32, i32* %11
%38 = call i32 @X509_NAME_ENTRY_set_data(i32* %34, i32 %35, i8* %36, i32 %37)
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %33
br label %53
41: ; preds = %33
%42 = load i32**, i32*** %7
%43 = icmp ne i32** %42, null
br i1 %43, label %44, label %51
44: ; preds = %41
%45 = load i32**, i32*** %7
%46 = load i32*, i32** %45
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = load i32*, i32** %12
%50 = load i32**, i32*** %7
store i32* %49, i32** %50
br label %51
51: ; preds = %48, %44, %41
%52 = load i32*, i32** %12
store i32* %52, i32** %6
br label %65
53: ; preds = %40, %32
%54 = load i32**, i32*** %7
%55 = icmp eq i32** %54, null
br i1 %55, label %61, label %56
56: ; preds = %53
%57 = load i32*, i32** %12
%58 = load i32**, i32*** %7
%59 = load i32*, i32** %58
%60 = icmp ne i32* %57, %59
br i1 %60, label %61, label %64
61: ; preds = %56, %53
%62 = load i32*, i32** %12
%63 = call i32 @X509_NAME_ENTRY_free(i32* %62)
br label %64
64: ; preds = %61, %56
store i32* null, i32** %6
br label %65
65: ; preds = %64, %51, %22
%66 = load i32*, i32** %6
ret i32* %66
}

LLVM IR (-O2):
define i32* @X509_NAME_ENTRY_create_by_OBJ(i32** %0, i32* %1, i32 %2, i8* %3, i32 %4) {
%6 = icmp eq i32** %0, null
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = load i32*, i32** %0
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %7, %5
%11 = tail call i32* (...) @X509_NAME_ENTRY_new()
%12 = icmp eq i32* %11, null
br i1 %12, label %31, label %13
13: ; preds = %7, %10
%14 = phi i32* [ %11, %10 ], [ %8, %7 ]
%15 = tail call i32 @X509_NAME_ENTRY_set_object(i32* %14, i32* %1)
%16 = icmp eq i32 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %13
%18 = tail call i32 @X509_NAME_ENTRY_set_data(i32* %14, i32 %2, i8* %3, i32 %4)
%19 = icmp eq i32 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %17
br i1 %6, label %31, label %21
21: ; preds = %20
%22 = load i32*, i32** %0
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %31
24: ; preds = %21
store i32* %14, i32** %0
br label %31
25: ; preds = %17, %13
br i1 %6, label %29, label %26
26: ; preds = %25
%27 = load i32*, i32** %0
%28 = icmp eq i32* %14, %27
br i1 %28, label %31, label %29
29: ; preds = %26, %25
%30 = tail call i32 @X509_NAME_ENTRY_free(i32* %14)
br label %31
31: ; preds = %26, %29, %20, %21, %24, %10
%32 = phi i32* [ null, %10 ], [ %14, %24 ], [ %14, %21 ], [ %14, %20 ], [ null, %29 ], [ null, %26 ]
ret i32* %32
}