#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 */

/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_TLC;
typedef int /*<<< orphan*/ ASN1_ITEM;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_ex_free(int /*<<< orphan*/ **,
                                     int /*<<< orphan*/ const *);
int asn1_item_embed_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                        int /*<<< orphan*/ const *, int, int, char,
                        int /*<<< orphan*/ *, int /*<<< orphan*/);
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
                     const ASN1_ITEM *it, int tag, int aclass, char opt,
                     ASN1_TLC *ctx) {
  int rv;
  rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0);
  if (rv <= 0)
    ASN1_item_ex_free(pval, it);
  return rv;
}


x86 assembly (clang, -O0):
<ASN1_item_ex_d2i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    0x10(%rbp),%r10b
mov    0x18(%rbp),%rax
xor    %r11d,%r11d
movsbl %r10b,%r10d
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1040 <asn1_item_embed_d2i@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jg     119e <ASN1_item_ex_d2i+0x7e>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <ASN1_item_ex_free@plt>
mov    -0x2c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_item_ex_d2i>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdi,%rbx
movsbl 0x20(%rsp),%eax
sub    $0x8,%rsp
push   $0x0
push   0x38(%rsp)
push   %rax
call   1040 <asn1_item_embed_d2i@plt>
add    $0x20,%rsp
mov    %eax,%ebp
test   %eax,%eax
jg     1154 <ASN1_item_ex_d2i+0x34>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ASN1_item_ex_free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ASN1_item_ex_d2i(i32** %0, i8** %1, i64 %2, i32* %3, i32 %4, i32 %5, i8 signext %6, i32* %7) {
%9 = alloca i32**
%10 = alloca i8**
%11 = alloca i64
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
%16 = alloca i32*
%17 = alloca i32
store i32** %0, i32*** %9
store i8** %1, i8*** %10
store i64 %2, i64* %11
store i32* %3, i32** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i8 %6, i8* %15
store i32* %7, i32** %16
%18 = load i32**, i32*** %9
%19 = load i8**, i8*** %10
%20 = load i64, i64* %11
%21 = load i32*, i32** %12
%22 = load i32, i32* %13
%23 = load i32, i32* %14
%24 = load i8, i8* %15
%25 = load i32*, i32** %16
%26 = call i32 @asn1_item_embed_d2i(i32** %18, i8** %19, i64 %20, i32* %21, i32 %22, i32 %23, i8 signext %24, i32* %25, i32 0)
store i32 %26, i32* %17
%27 = load i32, i32* %17
%28 = icmp sle i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %8
%30 = load i32**, i32*** %9
%31 = load i32*, i32** %12
%32 = call i32 @ASN1_item_ex_free(i32** %30, i32* %31)
br label %33
33: ; preds = %29, %8
%34 = load i32, i32* %17
ret i32 %34
}

LLVM IR (-O2):
define i32 @ASN1_item_ex_d2i(i32** %0, i8** %1, i64 %2, i32* %3, i32 %4, i32 %5, i8 signext %6, i32* %7) {
%9 = tail call i32 @asn1_item_embed_d2i(i32** %0, i8** %1, i64 %2, i32* %3, i32 %4, i32 %5, i8 signext %6, i32* %7, i32 0)
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @ASN1_item_ex_free(i32** %0, i32* %3)
br label %13
13: ; preds = %11, %8
ret i32 %9
}