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

/* Type definitions */
struct TYPE_3__ {
  int modified;
  scalar_t__ len;
  int /*<<< orphan*/ *enc;
};
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_ITEM;
typedef TYPE_1__ ASN1_ENCODING;

/* Variables and functions */
int /*<<< orphan*/ OPENSSL_free(int /*<<< orphan*/ *);
TYPE_1__ *asn1_get_enc_ptr(int /*<<< orphan*/ **, int /*<<< orphan*/ const *);
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  ASN1_ENCODING *enc;
  enc = asn1_get_enc_ptr(pval, it);
  if (enc) {
    if (enc->enc)
      OPENSSL_free(enc->enc);
    enc->enc = NULL;
    enc->len = 0;
    enc->modified = 1;
  }
}


x86 assembly (clang, -O0):
<asn1_enc_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <asn1_get_enc_ptr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118a <asn1_enc_free+0x6a>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     1168 <asn1_enc_free+0x48>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <OPENSSL_free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_enc_free>:
push   %rbx
call   1030 <asn1_get_enc_ptr@plt>
test   %rax,%rax
je     1149 <asn1_enc_free+0x29>
mov    %rax,%rbx
mov    0x10(%rax),%rdi
test   %rdi,%rdi
je     113c <asn1_enc_free+0x1c>
call   1040 <OPENSSL_free@plt>
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rbx)
movl   $0x1,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i64, i32* }
define void @asn1_enc_free(i32** %0, i32* %1) {
%3 = tail call %struct.TYPE_3__* @asn1_get_enc_ptr(i32** %0, i32* %1)
%4 = icmp eq %struct.TYPE_3__* %3, null
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 2
%7 = load i32*, i32** %6
%8 = icmp eq i32* %7, null
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @OPENSSL_free(i32* %7)
br label %11
11: ; preds = %9, %5
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 1
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 0
%14 = bitcast i64* %12 to i8*
store i32 1, i32* %13
br label %15
15: ; preds = %11, %2
ret void
}