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

/* Variables and functions */
int /*<<< orphan*/ *X509_NAME_ENTRY_create_by_OBJ(int /*<<< orphan*/ *,
                                                  int /*<<< orphan*/ const *,
                                                  int, unsigned char const *,
                                                  int);
int /*<<< orphan*/ X509_NAME_ENTRY_free(int /*<<< orphan*/ *);
int X509_NAME_add_entry(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int, int);
int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj,
                               int type, const unsigned char *bytes, int len,
                               int loc, int set) {
  X509_NAME_ENTRY *ne;
  int ret;
  ne = X509_NAME_ENTRY_create_by_OBJ(NULL, obj, type, bytes, len);
  if (!ne)
    return 0;
  ret = X509_NAME_add_entry(name, ne, loc, set);
  X509_NAME_ENTRY_free(ne);
  return ret;
}


x86 assembly (clang, -O0):
<X509_NAME_add_entry_by_OBJ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
call   1050 <X509_NAME_ENTRY_create_by_OBJ@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1185 <X509_NAME_add_entry_by_OBJ+0x55>
movl   $0x0,-0x4(%rbp)
jmp    11aa <X509_NAME_add_entry_by_OBJ+0x7a>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%edx
mov    0x10(%rbp),%ecx
call   1030 <X509_NAME_add_entry@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rdi
call   1040 <X509_NAME_ENTRY_free@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<X509_NAME_add_entry_by_OBJ>:
push   %rbp
push   %r14
push   %rbx
mov    %r9d,%r14d
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <X509_NAME_ENTRY_create_by_OBJ@plt>
test   %rax,%rax
je     1169 <X509_NAME_add_entry_by_OBJ+0x39>
mov    %rax,%rbp
mov    0x20(%rsp),%ecx
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r14d,%edx
call   1030 <X509_NAME_add_entry@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1040 <X509_NAME_ENTRY_free@plt>
mov    %ebx,%eax
jmp    116b <X509_NAME_add_entry_by_OBJ+0x3b>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @X509_NAME_add_entry_by_OBJ(i32* %0, i32* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32
store i32* %0, i32** %9
store i32* %1, i32** %10
store i32 %2, i32* %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
%18 = load i32*, i32** %10
%19 = load i32, i32* %11
%20 = load i8*, i8** %12
%21 = load i32, i32* %13
%22 = call i32* @X509_NAME_ENTRY_create_by_OBJ(i32* null, i32* %18, i32 %19, i8* %20, i32 %21)
store i32* %22, i32** %16
%23 = load i32*, i32** %16
%24 = icmp ne i32* %23, null
br i1 %24, label %26, label %25
25: ; preds = %7
store i32 0, i32* %8
br label %35
26: ; preds = %7
%27 = load i32*, i32** %9
%28 = load i32*, i32** %16
%29 = load i32, i32* %14
%30 = load i32, i32* %15
%31 = call i32 @X509_NAME_add_entry(i32* %27, i32* %28, i32 %29, i32 %30)
store i32 %31, i32* %17
%32 = load i32*, i32** %16
%33 = call i32 @X509_NAME_ENTRY_free(i32* %32)
%34 = load i32, i32* %17
store i32 %34, i32* %8
br label %35
35: ; preds = %26, %25
%36 = load i32, i32* %8
ret i32 %36
}

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