#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*/ ASN1_OBJECT_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *OBJ_nid2obj(int);
int /*<<< orphan*/ *X509_NAME_ENTRY_create_by_OBJ(int /*<<< orphan*/ **,
                                                  int /*<<< orphan*/ *, int,
                                                  unsigned char const *, int);
int /*<<< orphan*/ X509_R_UNKNOWN_NID;
int /*<<< orphan*/ X509error(int /*<<< orphan*/);
X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
                                               int type,
                                               const unsigned char *bytes,
                                               int len) {
  ASN1_OBJECT *obj;
  X509_NAME_ENTRY *nentry;
  obj = OBJ_nid2obj(nid);
  if (obj == NULL) {
    X509error(X509_R_UNKNOWN_NID);
    return (NULL);
  }
  nentry = X509_NAME_ENTRY_create_by_OBJ(ne, obj, type, bytes, len);
  ASN1_OBJECT_free(obj);
  return nentry;
}


x86 assembly (clang, -O0):
<X509_NAME_ENTRY_create_by_NID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <OBJ_nid2obj@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    118c <X509_NAME_ENTRY_create_by_NID+0x4c>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1040 <X509error@plt>
movq   $0x0,-0x8(%rbp)
jmp    11b9 <X509_NAME_ENTRY_create_by_NID+0x79>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1060 <X509_NAME_ENTRY_create_by_OBJ@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <ASN1_OBJECT_free@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_NAME_ENTRY_create_by_NID>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %edx,%r12d
mov    %rdi,%rbp
mov    %esi,%edi
call   1030 <OBJ_nid2obj@plt>
test   %rax,%rax
je     1187 <X509_NAME_ENTRY_create_by_NID+0x47>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    %rax,%rsi
mov    %r12d,%edx
mov    %r15,%rcx
mov    %r14d,%r8d
call   1060 <X509_NAME_ENTRY_create_by_OBJ@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <ASN1_OBJECT_free@plt>
mov    %rbp,%rax
jmp    1197 <X509_NAME_ENTRY_create_by_NID+0x57>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1040 <X509error@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@X509_R_UNKNOWN_NID = global i32 0
define i32* @X509_NAME_ENTRY_create_by_NID(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*
%13 = 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
%14 = load i32, i32* %8
%15 = call i32* @OBJ_nid2obj(i32 %14)
store i32* %15, i32** %12
%16 = load i32*, i32** %12
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %5
%19 = load i32, i32* @X509_R_UNKNOWN_NID
%20 = call i32 @X509error(i32 %19)
store i32* null, i32** %6
br label %31
21: ; preds = %5
%22 = load i32**, i32*** %7
%23 = load i32*, i32** %12
%24 = load i32, i32* %9
%25 = load i8*, i8** %10
%26 = load i32, i32* %11
%27 = call i32* @X509_NAME_ENTRY_create_by_OBJ(i32** %22, i32* %23, i32 %24, i8* %25, i32 %26)
store i32* %27, i32** %13
%28 = load i32*, i32** %12
%29 = call i32 @ASN1_OBJECT_free(i32* %28)
%30 = load i32*, i32** %13
store i32* %30, i32** %6
br label %31
31: ; preds = %21, %18
%32 = load i32*, i32** %6
ret i32* %32
}

LLVM IR (-O2):
@X509_R_UNKNOWN_NID = global i32 0
define i32* @X509_NAME_ENTRY_create_by_NID(i32** %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32* @OBJ_nid2obj(i32 %1)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* @X509_R_UNKNOWN_NID
%10 = tail call i32 @X509error(i32 %9)
br label %14
11: ; preds = %5
%12 = tail call i32* @X509_NAME_ENTRY_create_by_OBJ(i32** %0, i32* %6, i32 %2, i8* %3, i32 %4)
%13 = tail call i32 @ASN1_OBJECT_free(i32* %6)
br label %14
14: ; preds = %11, %8
%15 = phi i32* [ null, %8 ], [ %12, %11 ]
ret i32* %15
}