#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 flags;
  int /*<<< orphan*/ item;
};
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef TYPE_1__ ASN1_TEMPLATE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_ITEM_ptr(int /*<<< orphan*/);
int ASN1_TFLG_ADB_MASK;
int ASN1_TFLG_SK_MASK;
int /*<<< orphan*/ asn1_item_clear(int /*<<< orphan*/ **, int /*<<< orphan*/);
void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) {
  if (tt->flags & (ASN1_TFLG_ADB_MASK | ASN1_TFLG_SK_MASK))
    *pval = NULL;
  else
    asn1_item_clear(pval, ASN1_ITEM_ptr(tt->item));
}


x86 assembly (clang, -O0):
<asn1_template_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2e93(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2e9a(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1163 <asn1_template_clear+0x43>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
jmp    1182 <asn1_template_clear+0x62>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <ASN1_ITEM_ptr@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <asn1_item_clear@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_template_clear>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ea5(%rip),%rax
mov    0x2eae(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
test   %ecx,(%rsi)
je     1143 <asn1_template_clear+0x23>
movq   $0x0,(%rbx)
pop    %rbx
ret
mov    0x4(%rsi),%edi
call   1030 <ASN1_ITEM_ptr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <asn1_item_clear@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@ASN1_TFLG_ADB_MASK = global i32 0
@ASN1_TFLG_SK_MASK = global i32 0
define void @asn1_template_clear(i32** %0, %struct.TYPE_3__* %1) {
%3 = alloca i32**
%4 = alloca %struct.TYPE_3__*
store i32** %0, i32*** %3
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %4
%5 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = load i32, i32* @ASN1_TFLG_ADB_MASK
%9 = load i32, i32* @ASN1_TFLG_SK_MASK
%10 = or i32 %8, %9
%11 = and i32 %7, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32**, i32*** %3
store i32* null, i32** %14
br label %22
15: ; preds = %2
%16 = load i32**, i32*** %3
%17 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %17, i32 0, i32 1
%19 = load i32, i32* %18
%20 = call i32 @ASN1_ITEM_ptr(i32 %19)
%21 = call i32 @asn1_item_clear(i32** %16, i32 %20)
br label %22
22: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@ASN1_TFLG_ADB_MASK = global i32 0
@ASN1_TFLG_SK_MASK = global i32 0
define void @asn1_template_clear(i32** %0, %struct.TYPE_3__* nocapture %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = load i32, i32* @ASN1_TFLG_ADB_MASK
%6 = load i32, i32* @ASN1_TFLG_SK_MASK
%7 = or i32 %6, %5
%8 = and i32 %7, %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %2
store i32* null, i32** %0
br label %16
11: ; preds = %2
%12 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 1
%13 = load i32, i32* %12
%14 = tail call i32 @ASN1_ITEM_ptr(i32 %13)
%15 = tail call i32 @asn1_item_clear(i32** %0, i32 %14)
br label %16
16: ; preds = %11, %10
ret void
}