#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*/ ERR_asprintf_error_data(char *, char const *);
int /*<<< orphan*/ *OBJ_txt2obj(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ X509_F_X509_NAME_ENTRY_CREATE_BY_TXT;
int /*<<< orphan*/ *X509_NAME_ENTRY_create_by_OBJ(int /*<<< orphan*/ **,
                                                  int /*<<< orphan*/ *, int,
                                                  unsigned char const *, int);
int /*<<< orphan*/ X509_R_INVALID_FIELD_NAME;
int /*<<< orphan*/ X509err(int /*<<< orphan*/, int /*<<< orphan*/);
X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
                                               const char *field, int type,
                                               const unsigned char *bytes,
                                               int len) {
  ASN1_OBJECT *obj;
  X509_NAME_ENTRY *nentry;
  obj = OBJ_txt2obj(field, 0);
  if (obj == NULL) {
    X509err(X509_F_X509_NAME_ENTRY_CREATE_BY_TXT, X509_R_INVALID_FIELD_NAME);
    ERR_asprintf_error_data("name=%s", field);
    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_txt>:
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)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <OBJ_txt2obj@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11b9 <X509_NAME_ENTRY_create_by_txt+0x69>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
call   1050 <X509err@plt>
mov    -0x18(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1030 <ERR_asprintf_error_data@plt>
movq   $0x0,-0x8(%rbp)
jmp    11e6 <X509_NAME_ENTRY_create_by_txt+0x96>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
call   1070 <X509_NAME_ENTRY_create_by_OBJ@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <ASN1_OBJECT_free@plt>
mov    -0x40(%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_txt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %edx,%r12d
mov    %rsi,%rbx
mov    %rdi,%r13
mov    %rsi,%rdi
xor    %esi,%esi
call   1040 <OBJ_txt2obj@plt>
test   %rax,%rax
je     11a0 <X509_NAME_ENTRY_create_by_txt+0x50>
mov    %rax,%rbp
mov    %r13,%rdi
mov    %rax,%rsi
mov    %r12d,%edx
mov    %r15,%rcx
mov    %r14d,%r8d
call   1070 <X509_NAME_ENTRY_create_by_OBJ@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1060 <ASN1_OBJECT_free@plt>
mov    %rbx,%rax
jmp    11c8 <X509_NAME_ENTRY_create_by_txt+0x78>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
mov    0x2e30(%rip),%rax
mov    (%rax),%esi
call   1050 <X509err@plt>
lea    0xe42(%rip),%rdi
mov    %rbx,%rsi
call   1030 <ERR_asprintf_error_data@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@X509_F_X509_NAME_ENTRY_CREATE_BY_TXT = global i32 0
@X509_R_INVALID_FIELD_NAME = global i32 0
@.str = [8 x i8] c"name=%s\00"
define i32* @X509_NAME_ENTRY_create_by_txt(i32** %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32**
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32** %0, i32*** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i32 %4, i32* %11
%14 = load i8*, i8** %8
%15 = call i32* @OBJ_txt2obj(i8* %14, i32 0)
store i32* %15, i32** %12
%16 = load i32*, i32** %12
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %24
18: ; preds = %5
%19 = load i32, i32* @X509_F_X509_NAME_ENTRY_CREATE_BY_TXT
%20 = load i32, i32* @X509_R_INVALID_FIELD_NAME
%21 = call i32 @X509err(i32 %19, i32 %20)
%22 = load i8*, i8** %8
%23 = call i32 @ERR_asprintf_error_data(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %22)
store i32* null, i32** %6
br label %34
24: ; preds = %5
%25 = load i32**, i32*** %7
%26 = load i32*, i32** %12
%27 = load i32, i32* %9
%28 = load i8*, i8** %10
%29 = load i32, i32* %11
%30 = call i32* @X509_NAME_ENTRY_create_by_OBJ(i32** %25, i32* %26, i32 %27, i8* %28, i32 %29)
store i32* %30, i32** %13
%31 = load i32*, i32** %12
%32 = call i32 @ASN1_OBJECT_free(i32* %31)
%33 = load i32*, i32** %13
store i32* %33, i32** %6
br label %34
34: ; preds = %24, %18
%35 = load i32*, i32** %6
ret i32* %35
}

LLVM IR (-O2):
@X509_F_X509_NAME_ENTRY_CREATE_BY_TXT = global i32 0
@X509_R_INVALID_FIELD_NAME = global i32 0
@.str = [8 x i8] c"name=%s\00"
define i32* @X509_NAME_ENTRY_create_by_txt(i32** %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i32* @OBJ_txt2obj(i8* %1, i32 0)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i32, i32* @X509_F_X509_NAME_ENTRY_CREATE_BY_TXT
%10 = load i32, i32* @X509_R_INVALID_FIELD_NAME
%11 = tail call i32 @X509err(i32 %9, i32 %10)
%12 = tail call i32 @ERR_asprintf_error_data(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %16
13: ; preds = %5
%14 = tail call i32* @X509_NAME_ENTRY_create_by_OBJ(i32** %0, i32* %6, i32 %2, i8* %3, i32 %4)
%15 = tail call i32 @ASN1_OBJECT_free(i32* %6)
br label %16
16: ; preds = %13, %8
%17 = phi i32* [ null, %8 ], [ %14, %13 ]
ret i32* %17
}