#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 */
TYPE_1__ *asn1_get_enc_ptr(int /*<<< orphan*/ **, int /*<<< orphan*/ const *);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  ASN1_ENCODING *enc;
  enc = asn1_get_enc_ptr(pval, it);
  if (enc) {
    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   1040 <asn1_get_enc_ptr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117b <asn1_enc_free+0x5b>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <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   1040 <asn1_get_enc_ptr@plt>
test   %rax,%rax
je     1144 <asn1_enc_free+0x24>
mov    %rax,%rbx
mov    0x10(%rax),%rdi
call   1030 <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 %22
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 = call i32 @free(i32* %14)
%16 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%17 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %16, i32 0, i32 2
store i32* null, i32** %17
%18 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%19 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %18, i32 0, i32 1
store i64 0, i64* %19
%20 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%21 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %20, i32 0, i32 0
store i32 1, i32* %21
br label %22
22: ; preds = %11, %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 %12, 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 = tail call i32 @free(i32* %7)
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 1
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i64 0, i32 0
%11 = bitcast i64* %9 to i8*
store i32 1, i32* %10
br label %12
12: ; preds = %5, %2
ret void
}