#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*/ ASN1error(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) {
    ASN1error(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   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115f <ASN1_STRING_type_new+0x3f>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
movq   $0x0,-0x8(%rbp)
jmp    1194 <ASN1_STRING_type_new+0x74>
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   1030 <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    1158 <ASN1_STRING_type_new+0x38>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i64, i32*, i64 }
@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 %11
8: ; preds = %1
%9 = load i32, i32* @ERR_R_MALLOC_FAILURE
%10 = call i32 @ASN1error(i32 %9)
store %struct.TYPE_4__* null, %struct.TYPE_4__** %2
br label %22
11: ; preds = %1
%12 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 3
store i64 0, i64* %13
%14 = load i32, i32* %3
%15 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%16 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %15, i32 0, i32 0
store i32 %14, i32* %16
%17 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%18 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %17, i32 0, i32 2
store i32* null, i32** %18
%19 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
%20 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %19, i32 0, i32 1
store i64 0, i64* %20
%21 = load %struct.TYPE_4__*, %struct.TYPE_4__** %4
store %struct.TYPE_4__* %21, %struct.TYPE_4__** %2
br label %22
22: ; preds = %11, %8
%23 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
ret %struct.TYPE_4__* %23
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i64, i32*, i64 }
@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 %7
4: ; preds = %1
%5 = load i32, i32* @ERR_R_MALLOC_FAILURE
%6 = tail call i32 @ASN1error(i32 %5)
br label %12
7: ; preds = %1
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %2, i64 0, i32 3
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %2, i64 0, i32 0
store i32 %0, i32* %9
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %2, i64 0, i32 1
%11 = bitcast i64* %10 to i8*
br label %12
12: ; preds = %7, %4
ret %struct.TYPE_4__* %2
}