#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_7__ TYPE_2__;
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
struct TYPE_7__ {
  int /*<<< orphan*/ (*asn1_ex_clear)(int /*<<< orphan*/ **, TYPE_1__ const *);
};
struct TYPE_6__ {
  int itype;
  int /*<<< orphan*/ templates;
  TYPE_2__ *funcs;
};
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef TYPE_1__ ASN1_ITEM;
typedef TYPE_2__ ASN1_EXTERN_FUNCS;

/* Variables and functions */
#define ASN1_ITYPE_CHOICE 133
#define ASN1_ITYPE_EXTERN 132
#define ASN1_ITYPE_MSTRING 131
#define ASN1_ITYPE_NDEF_SEQUENCE 130
#define ASN1_ITYPE_PRIMITIVE 129
#define ASN1_ITYPE_SEQUENCE 128
int /*<<< orphan*/ asn1_primitive_clear(int /*<<< orphan*/ **,
                                        TYPE_1__ const *);
int /*<<< orphan*/ asn1_template_clear(int /*<<< orphan*/ **,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ stub1(int /*<<< orphan*/ **, TYPE_1__ const *);
void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) {
  const ASN1_EXTERN_FUNCS *ef;
  switch (it->itype) {
  case ASN1_ITYPE_EXTERN:
    ef = it->funcs;
    if (ef && ef->asn1_ex_clear)
      ef->asn1_ex_clear(pval, it);
    else
      *pval = NULL;
    break;
  case ASN1_ITYPE_PRIMITIVE:
    if (it->templates)
      asn1_template_clear(pval, it->templates);
    else
      asn1_primitive_clear(pval, it);
    break;
  case ASN1_ITYPE_MSTRING:
    asn1_primitive_clear(pval, it);
    break;
  case ASN1_ITYPE_CHOICE:
  case ASN1_ITYPE_SEQUENCE:
  case ASN1_ITYPE_NDEF_SEQUENCE:
    *pval = NULL;
    break;
  }
}


x86 assembly (clang, -O0):
<asn1_item_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     11f9 <asn1_item_clear+0xd9>
mov    -0x20(%rbp),%rax
lea    0xead(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1197 <asn1_item_clear+0x77>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1197 <asn1_item_clear+0x77>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   *%rax
jmp    11a2 <asn1_item_clear+0x82>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
jmp    11f9 <asn1_item_clear+0xd9>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     11ca <asn1_item_clear+0xaa>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
call   1030 <asn1_template_clear@plt>
jmp    11d7 <asn1_item_clear+0xb7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <asn1_primitive_clear@plt>
jmp    11f9 <asn1_item_clear+0xd9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <asn1_primitive_clear@plt>
jmp    11f9 <asn1_item_clear+0xd9>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_item_clear>:
mov    (%rsi),%eax
add    $0xffffff80,%eax
cmp    $0x5,%eax
ja     1141 <asn1_item_clear+0x21>
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x0,(%rdi)
ret
mov    0x4(%rsi),%eax
test   %eax,%eax
je     1150 <asn1_item_clear+0x30>
mov    %eax,%esi
jmp    1030 <asn1_template_clear@plt>
jmp    1040 <asn1_primitive_clear@plt>
mov    0x8(%rsi),%rax
test   %rax,%rax
je     113a <asn1_item_clear+0x1a>
mov    (%rax),%rax
test   %rax,%rax
je     113a <asn1_item_clear+0x1a>
jmp    *%rax

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, i32, %struct.TYPE_7__* }
%struct.TYPE_7__ = type { i32 (i32**, %struct.TYPE_6__*)* }
define void @asn1_item_clear(i32** %0, %struct.TYPE_6__* %1) {
%3 = alloca i32**
%4 = alloca %struct.TYPE_6__*
%5 = alloca %struct.TYPE_7__*
store i32** %0, i32*** %3
store %struct.TYPE_6__* %1, %struct.TYPE_6__** %4
%6 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%7 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %6, i32 0, i32 0
%8 = load i32, i32* %7
switch i32 %8, label %52 [
i32 132, label %9
i32 129, label %30
i32 131, label %46
i32 133, label %50
i32 128, label %50
i32 130, label %50
]
9: ; preds = %2
%10 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%11 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %10, i32 0, i32 2
%12 = load %struct.TYPE_7__*, %struct.TYPE_7__** %11
store %struct.TYPE_7__* %12, %struct.TYPE_7__** %5
%13 = load %struct.TYPE_7__*, %struct.TYPE_7__** %5
%14 = icmp ne %struct.TYPE_7__* %13, null
br i1 %14, label %15, label %27
15: ; preds = %9
%16 = load %struct.TYPE_7__*, %struct.TYPE_7__** %5
%17 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %16, i32 0, i32 0
%18 = load i32 (i32**, %struct.TYPE_6__*)*, i32 (i32**, %struct.TYPE_6__*)** %17
%19 = icmp ne i32 (i32**, %struct.TYPE_6__*)* %18, null
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load %struct.TYPE_7__*, %struct.TYPE_7__** %5
%22 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %21, i32 0, i32 0
%23 = load i32 (i32**, %struct.TYPE_6__*)*, i32 (i32**, %struct.TYPE_6__*)** %22
%24 = load i32**, i32*** %3
%25 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%26 = call i32 %23(i32** %24, %struct.TYPE_6__* %25)
br label %29
27: ; preds = %15, %9
%28 = load i32**, i32*** %3
store i32* null, i32** %28
br label %29
29: ; preds = %27, %20
br label %52
30: ; preds = %2
%31 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%32 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %31, i32 0, i32 1
%33 = load i32, i32* %32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %30
%36 = load i32**, i32*** %3
%37 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%38 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %37, i32 0, i32 1
%39 = load i32, i32* %38
%40 = call i32 @asn1_template_clear(i32** %36, i32 %39)
br label %45
41: ; preds = %30
%42 = load i32**, i32*** %3
%43 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%44 = call i32 @asn1_primitive_clear(i32** %42, %struct.TYPE_6__* %43)
br label %45
45: ; preds = %41, %35
br label %52
46: ; preds = %2
%47 = load i32**, i32*** %3
%48 = load %struct.TYPE_6__*, %struct.TYPE_6__** %4
%49 = call i32 @asn1_primitive_clear(i32** %47, %struct.TYPE_6__* %48)
br label %52
50: ; preds = %2, %2, %2
%51 = load i32**, i32*** %3
store i32* null, i32** %51
br label %52
52: ; preds = %2, %50, %46, %45, %29
ret void
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32, i32, %struct.TYPE_7__* }
%struct.TYPE_7__ = type { i32 (i32**, %struct.TYPE_6__*)* }
define void @asn1_item_clear(i32** %0, %struct.TYPE_6__* %1) {
%3 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 0
%4 = load i32, i32* %3
switch i32 %4, label %27 [
i32 132, label %5
i32 129, label %16
i32 131, label %24
i32 133, label %26
i32 128, label %26
i32 130, label %26
]
5: ; preds = %2
%6 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 2
%7 = load %struct.TYPE_7__*, %struct.TYPE_7__** %6
%8 = icmp eq %struct.TYPE_7__* %7, null
br i1 %8, label %15, label %9
9: ; preds = %5
%10 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %7, i64 0, i32 0
%11 = load i32 (i32**, %struct.TYPE_6__*)*, i32 (i32**, %struct.TYPE_6__*)** %10
%12 = icmp eq i32 (i32**, %struct.TYPE_6__*)* %11, null
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 %11(i32** %0, %struct.TYPE_6__* %1)
br label %27
15: ; preds = %9, %5
store i32* null, i32** %0
br label %27
16: ; preds = %2
%17 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 1
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = tail call i32 @asn1_template_clear(i32** %0, i32 %18)
br label %27
22: ; preds = %16
%23 = tail call i32 @asn1_primitive_clear(i32** %0, %struct.TYPE_6__* %1)
br label %27
24: ; preds = %2
%25 = tail call i32 @asn1_primitive_clear(i32** %0, %struct.TYPE_6__* %1)
br label %27
26: ; preds = %2, %2, %2
store i32* null, i32** %0
br label %27
27: ; preds = %20, %22, %13, %15, %2, %26, %24
ret void
}