#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 flags;
  int /*<<< orphan*/ length;
  int /*<<< orphan*/ *data;
};
typedef TYPE_1__ ASN1_STRING;

/* Variables and functions */
int ASN1_STRING_FLAG_NDEF;
int /*<<< orphan*/ free(TYPE_1__ *);
int /*<<< orphan*/ freezero(int /*<<< orphan*/ *, int /*<<< orphan*/);
void ASN1_STRING_free(ASN1_STRING *a) {
  if (a == NULL)
    return;
  if (a->data != NULL && !(a->flags & ASN1_STRING_FLAG_NDEF))
    freezero(a->data, a->length);
  free(a);
}


x86 assembly (clang, -O0):
<ASN1_STRING_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <ASN1_STRING_free+0x1c>
jmp    1180 <ASN1_STRING_free+0x60>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1177 <ASN1_STRING_free+0x57>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2e88(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1177 <ASN1_STRING_free+0x57>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
call   1030 <freezero@plt>
mov    -0x8(%rbp),%rdi
call   1040 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_STRING_free>:
test   %rdi,%rdi
je     1150 <ASN1_STRING_free+0x30>
push   %rbx
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
test   %rdi,%rdi
je     1147 <ASN1_STRING_free+0x27>
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
test   %eax,(%rbx)
jne    1147 <ASN1_STRING_free+0x27>
mov    0x4(%rbx),%esi
call   1030 <freezero@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <free@plt>
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, i32, i32* }
@ASN1_STRING_FLAG_NDEF = global i32 0
define void @ASN1_STRING_free(%struct.TYPE_4__* %0) {
%2 = alloca %struct.TYPE_4__*
store %struct.TYPE_4__* %0, %struct.TYPE_4__** %2
%3 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%4 = icmp eq %struct.TYPE_4__* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %29
6: ; preds = %1
%7 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 2
%9 = load i32*, i32** %8
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %26
11: ; preds = %6
%12 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = load i32, i32* @ASN1_STRING_FLAG_NDEF
%16 = and i32 %14, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %11
%19 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%20 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %19, i32 0, i32 2
%21 = load i32*, i32** %20
%22 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%23 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = call i32 @freezero(i32* %21, i32 %24)
br label %26
26: ; preds = %18, %11, %6
%27 = load %struct.TYPE_4__*, %struct.TYPE_4__** %2
%28 = call i32 @free(%struct.TYPE_4__* %27)
br label %29
29: ; preds = %26, %5
ret void
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, i32, i32* }
@ASN1_STRING_FLAG_NDEF = global i32 0
define void @ASN1_STRING_free(%struct.TYPE_4__* %0) {
%2 = icmp eq %struct.TYPE_4__* %0, null
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 2
%5 = load i32*, i32** %4
%6 = icmp eq i32* %5, null
br i1 %6, label %17, label %7
7: ; preds = %3
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 0
%9 = load i32, i32* %8
%10 = load i32, i32* @ASN1_STRING_FLAG_NDEF
%11 = and i32 %10, %9
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %7
%14 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %0, i64 0, i32 1
%15 = load i32, i32* %14
%16 = tail call i32 @freezero(i32* %5, i32 %15)
br label %17
17: ; preds = %13, %7, %3
%18 = tail call i32 @free(%struct.TYPE_4__* %0)
br label %19
19: ; preds = %1, %17
ret void
}