#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_5__ TYPE_1__;

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

/* Variables and functions */
int ASN1_STRING_FLAG_NDEF;
int /*<<< orphan*/ explicit_bzero(TYPE_1__ *, int /*<<< orphan*/);
int /*<<< orphan*/ free(TYPE_1__ *);
void ASN1_STRING_free(ASN1_STRING *a) {
  if (a == NULL)
    return;
  if (a->data != NULL && !(a->flags & ASN1_STRING_FLAG_NDEF)) {
    explicit_bzero(a->data, a->length);
    free(a->data);
  }
  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    118d <ASN1_STRING_free+0x6d>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1184 <ASN1_STRING_free+0x64>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2e88(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1184 <ASN1_STRING_free+0x64>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%esi
call   1040 <explicit_bzero@plt>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, %struct.TYPE_5__*, i32 }
@ASN1_STRING_FLAG_NDEF = global i32 0
define void @ASN1_STRING_free(%struct.TYPE_5__* %0) {
%2 = alloca %struct.TYPE_5__*
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %2
%3 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%4 = icmp eq %struct.TYPE_5__* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %33
6: ; preds = %1
%7 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %7, i32 0, i32 1
%9 = load %struct.TYPE_5__*, %struct.TYPE_5__** %8
%10 = icmp ne %struct.TYPE_5__* %9, null
br i1 %10, label %11, label %30
11: ; preds = %6
%12 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %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 %30, label %18
18: ; preds = %11
%19 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%20 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %19, i32 0, i32 1
%21 = load %struct.TYPE_5__*, %struct.TYPE_5__** %20
%22 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%23 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %22, i32 0, i32 2
%24 = load i32, i32* %23
%25 = call i32 @explicit_bzero(%struct.TYPE_5__* %21, i32 %24)
%26 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%27 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %26, i32 0, i32 1
%28 = load %struct.TYPE_5__*, %struct.TYPE_5__** %27
%29 = call i32 @free(%struct.TYPE_5__* %28)
br label %30
30: ; preds = %18, %11, %6
%31 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%32 = call i32 @free(%struct.TYPE_5__* %31)
br label %33
33: ; preds = %30, %5
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, %struct.TYPE_5__*, i32 }
@ASN1_STRING_FLAG_NDEF = global i32 0
define void @ASN1_STRING_free(%struct.TYPE_5__* %0) {
%2 = icmp eq %struct.TYPE_5__* %0, null
br i1 %2, label %21, label %3
3: ; preds = %1
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 1
%5 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%6 = icmp eq %struct.TYPE_5__* %5, null
br i1 %6, label %19, label %7
7: ; preds = %3
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %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 %19
13: ; preds = %7
%14 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 2
%15 = load i32, i32* %14
%16 = tail call i32 @explicit_bzero(%struct.TYPE_5__* %5, i32 %15)
%17 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%18 = tail call i32 @free(%struct.TYPE_5__* %17)
br label %19
19: ; preds = %13, %7, %3
%20 = tail call i32 @free(%struct.TYPE_5__* %0)
br label %21
21: ; preds = %1, %19
ret void
}