#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 */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int type;
  scalar_t__ flags;
  int /*<<< orphan*/ *data;
  scalar_t__ length;
};
typedef TYPE_1__ ASN1_STRING;

/* Variables and functions */
int /*<<< orphan*/ ASN1_F_ASN1_STRING_TYPE_NEW;
int /*<<< orphan*/ ASN1err(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE;
TYPE_1__ *malloc(int);
ASN1_STRING *ASN1_STRING_type_new(int type) {
  ASN1_STRING *ret;
  ret = malloc(sizeof(ASN1_STRING));
  if (ret == NULL) {
    ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
    return (NULL);
  }
  ret->length = 0;
  ret->type = type;
  ret->data = NULL;
  ret->flags = 0;
  return (ret);
}


x86 assembly (clang, -O0):
<ASN1_STRING_type_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    $0x20,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1168 <ASN1_STRING_type_new+0x48>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@plt>
movq   $0x0,-0x8(%rbp)
jmp    119d <ASN1_STRING_type_new+0x7d>
mov    -0x18(%rbp),%rax
movq   $0x0,0x18(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_STRING_type_new>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x20,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     114a <ASN1_STRING_type_new+0x2a>
movq   $0x0,0x18(%rbx)
mov    %ebp,(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rbx)
jmp    1161 <ASN1_STRING_type_new+0x41>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i64, i32*, i64 }
@ASN1_F_ASN1_STRING_TYPE_NEW = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
define %struct.TYPE_4__* @ASN1_STRING_type_new(i32 %0) {
%2 = alloca %struct.TYPE_4__*
%3 = alloca i32
%4 = alloca %struct.TYPE_4__*
store i32 %0, i32* %3
%5 = call %struct.TYPE_4__* @malloc(i32 32)
store %struct.TYPE_4__* %5, %struct.TYPE_4__** %4
%6 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%7 = icmp eq %struct.TYPE_4__* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @ASN1_F_ASN1_STRING_TYPE_NEW
%10 = load i32, i32* @ERR_R_MALLOC_FAILURE
%11 = call i32 @ASN1err(i32 %9, i32 %10)
store %struct.TYPE_4__* null, %struct.TYPE_4__** %2
br label %23
12: ; preds = %1
%13 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%14 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %13, i32 0, i32 3
store i64 0, i64* %14
%15 = load i32, i32* %3
%16 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%17 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %16, i32 0, i32 0
store i32 %15, i32* %17
%18 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%19 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %18, i32 0, i32 2
store i32* null, i32** %19
%20 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %20, i32 0, i32 1
store i64 0, i64* %21
%22 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
store %struct.TYPE_4__* %22, %struct.TYPE_4__** %2
br label %23
23: ; preds = %12, %8
%24 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
ret %struct.TYPE_4__* %24
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i64, i32*, i64 }
@ASN1_F_ASN1_STRING_TYPE_NEW = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
define noalias %struct.TYPE_4__* @ASN1_STRING_type_new(i32 %0) {
%2 = tail call %struct.TYPE_4__* @malloc(i32 32)
%3 = icmp eq %struct.TYPE_4__* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @ASN1_F_ASN1_STRING_TYPE_NEW
%6 = load i32, i32* @ERR_R_MALLOC_FAILURE
%7 = tail call i32 @ASN1err(i32 %5, i32 %6)
br label %13
8: ; preds = %1
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %2, i64 0, i32 3
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %2, i64 0, i32 0
store i32 %0, i32* %10
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %2, i64 0, i32 1
%12 = bitcast i64* %11 to i8*
br label %13
13: ; preds = %8, %4
ret %struct.TYPE_4__* %2
}