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

/* Type definitions */
struct TYPE_5__ {
  int flags;
  int /*<<< orphan*/ tag;
};
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_TLC;
typedef TYPE_1__ ASN1_TEMPLATE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_F_ASN1_TEMPLATE_EX_D2I;
int /*<<< orphan*/ ASN1_R_EXPLICIT_LENGTH_MISMATCH;
int /*<<< orphan*/ ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED;
int /*<<< orphan*/ ASN1_R_MISSING_EOC;
int ASN1_TFLG_EXPTAG;
int ASN1_TFLG_TAG_CLASS;
int /*<<< orphan*/ ASN1_template_free(int /*<<< orphan*/ **, TYPE_1__ const *);
int /*<<< orphan*/ ASN1err(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ ERR_R_NESTED_ASN1_ERROR;
int /*<<< orphan*/ asn1_check_eoc(unsigned char const **, long);
int asn1_check_tlen(long *, int /*<<< orphan*/ *, int /*<<< orphan*/ *, char *,
                    char *, unsigned char const **, long, int /*<<< orphan*/,
                    int, char, int /*<<< orphan*/ *);
int asn1_template_noexp_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                            TYPE_1__ const *, char, int /*<<< orphan*/ *, int);
int asn1_template_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long inlen,
                         const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx,
                         int depth) {
  int flags, aclass;
  int ret;
  long len;
  const unsigned char *p, *q;
  char exp_eoc;
  if (!val)
    return 0;
  flags = tt->flags;
  aclass = flags & ASN1_TFLG_TAG_CLASS;
  p = *in;
  if (flags & ASN1_TFLG_EXPTAG) {
    char cst;
    ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst, &p, inlen, tt->tag,
                          aclass, opt, ctx);
    q = p;
    if (!ret) {
      ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
      return 0;
    } else if (ret == -1)
      return -1;
    if (!cst) {
      ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED);
      return 0;
    }
    ret = asn1_template_noexp_d2i(val, &p, len, tt, 0, ctx, depth);
    if (!ret) {
      ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ERR_R_NESTED_ASN1_ERROR);
      return 0;
    }
    len -= p - q;
    if (exp_eoc) {
      if (!asn1_check_eoc(&p, len)) {
        ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_MISSING_EOC);
        goto err;
      }
    } else {
      if (len) {
        ASN1err(ASN1_F_ASN1_TEMPLATE_EX_D2I, ASN1_R_EXPLICIT_LENGTH_MISMATCH);
        goto err;
      }
    }
  } else
    return asn1_template_noexp_d2i(val, in, inlen, tt, opt, ctx, depth);
  *in = p;
  return 1;
err:
  ASN1_template_free(val, tt);
  return 0;
}


x86 assembly (clang, -O0):
<asn1_template_ex_d2i>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %r8b,%al
mov    0x10(%rbp),%r8d
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %al,-0x39(%rbp)
mov    %r9,-0x48(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1193 <asn1_template_ex_d2i+0x43>
movl   $0x0,-0x14(%rbp)
jmp    13cd <asn1_template_ex_d2i+0x27d>
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x2e32(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x2df0(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1373 <asn1_template_ex_d2i+0x223>
mov    -0x30(%rbp),%r14
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%ebx
mov    -0x50(%rbp),%r11d
mov    -0x39(%rbp),%r10b
mov    -0x48(%rbp),%rax
lea    -0x60(%rbp),%rdi
xor    %ecx,%ecx
mov    %ecx,%edx
lea    -0x71(%rbp),%rcx
lea    -0x72(%rbp),%r8
lea    -0x68(%rbp),%r9
mov    %rdx,%rsi
mov    %r14,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
movsbl %r10b,%r10d
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1030 <asn1_check_tlen@plt>
mov    %eax,-0x54(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    1251 <asn1_template_ex_d2i+0x101>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    13cd <asn1_template_ex_d2i+0x27d>
cmpl   $0xffffffff,-0x54(%rbp)
jne    1267 <asn1_template_ex_d2i+0x117>
movl   $0xffffffff,-0x14(%rbp)
jmp    13cd <asn1_template_ex_d2i+0x27d>
jmp    126c <asn1_template_ex_d2i+0x11c>
cmpb   $0x0,-0x72(%rbp)
jne    1299 <asn1_template_ex_d2i+0x149>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    13cd <asn1_template_ex_d2i+0x27d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x48(%rbp),%r9
mov    0x10(%rbp),%eax
lea    -0x68(%rbp),%rsi
xor    %r8d,%r8d
mov    %eax,(%rsp)
call   1070 <asn1_template_noexp_d2i@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    12eb <asn1_template_ex_d2i+0x19b>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
mov    0x2cf8(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    13cd <asn1_template_ex_d2i+0x27d>
mov    -0x68(%rbp),%rcx
mov    -0x70(%rbp),%rax
sub    %rax,%rcx
mov    -0x60(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x60(%rbp)
cmpb   $0x0,-0x71(%rbp)
je     1342 <asn1_template_ex_d2i+0x1f2>
mov    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdi
call   1060 <asn1_check_eoc@plt>
cmp    $0x0,%eax
jne    133d <asn1_template_ex_d2i+0x1ed>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
mov    0x2caf(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
jmp    13b9 <asn1_template_ex_d2i+0x269>
jmp    136e <asn1_template_ex_d2i+0x21e>
cmpq   $0x0,-0x60(%rbp)
je     1369 <asn1_template_ex_d2i+0x219>
mov    0x2c74(%rip),%rax
mov    (%rax),%edi
mov    0x2c8b(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
jmp    13b9 <asn1_template_ex_d2i+0x269>
jmp    136e <asn1_template_ex_d2i+0x21e>
jmp    13a2 <asn1_template_ex_d2i+0x252>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x39(%rbp),%r8b
mov    -0x48(%rbp),%r9
mov    0x10(%rbp),%eax
movsbl %r8b,%r8d
mov    %eax,(%rsp)
call   1070 <asn1_template_noexp_d2i@plt>
mov    %eax,-0x14(%rbp)
jmp    13cd <asn1_template_ex_d2i+0x27d>
mov    -0x68(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x14(%rbp)
jmp    13cd <asn1_template_ex_d2i+0x27d>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1050 <ASN1_template_free@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_template_ex_d2i>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %rdi,%rdi
je     1298 <asn1_template_ex_d2i+0x148>
mov    %r9,%r13
mov    %rcx,%r14
mov    %rdx,%rax
mov    %rsi,%r15
mov    %rdi,%r12
mov    0x60(%rsp),%esi
mov    (%rcx),%ecx
mov    0x2e55(%rip),%rdx
mov    (%rdx),%ebp
mov    (%r15),%rdx
mov    %rdx,0x10(%rsp)
mov    0x2e1c(%rip),%rdx
test   %ecx,(%rdx)
je     125b <asn1_template_ex_d2i+0x10b>
mov    %rsi,0x20(%rsp)
and    %ecx,%ebp
mov    0x4(%r14),%r10d
sub    $0x8,%rsp
movsbl %r8b,%ebx
lea    0x20(%rsp),%rdi
lea    0x17(%rsp),%rcx
lea    0x16(%rsp),%r8
lea    0x18(%rsp),%r9
xor    %esi,%esi
xor    %edx,%edx
push   %r13
push   %rbx
push   %rbp
push   %r10
push   %rax
call   1030 <asn1_check_tlen@plt>
add    $0x30,%rsp
cmp    $0xffffffff,%eax
je     129a <asn1_template_ex_d2i+0x14a>
mov    0x2de9(%rip),%rbx
test   %eax,%eax
je     1288 <asn1_template_ex_d2i+0x138>
cmpb   $0x0,0xe(%rsp)
je     1281 <asn1_template_ex_d2i+0x131>
mov    0x10(%rsp),%rbp
mov    0x18(%rsp),%rdx
sub    $0x8,%rsp
lea    0x18(%rsp),%rsi
mov    %r12,%rdi
mov    %r14,%rcx
xor    %r8d,%r8d
mov    %r13,%r9
push   0x28(%rsp)
call   1070 <asn1_template_noexp_d2i@plt>
add    $0x10,%rsp
test   %eax,%eax
je     1288 <asn1_template_ex_d2i+0x138>
mov    0x10(%rsp),%rax
sub    %rax,%rbp
add    0x18(%rsp),%rbp
mov    %rbp,0x18(%rsp)
cmpb   $0x0,0xf(%rsp)
je     12a9 <asn1_template_ex_d2i+0x159>
lea    0x10(%rsp),%rdi
mov    %rbp,%rsi
call   1060 <asn1_check_eoc@plt>
test   %eax,%eax
je     12c1 <asn1_template_ex_d2i+0x171>
mov    0x10(%rsp),%rax
jmp    12b7 <asn1_template_ex_d2i+0x167>
movsbl %r8b,%r8d
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
mov    %r14,%rcx
mov    %r13,%r9
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <asn1_template_noexp_d2i@plt>
mov    0x2d30(%rip),%rbx
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
call   1040 <ASN1err@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %rbp,%rbp
je     12b7 <asn1_template_ex_d2i+0x167>
mov    0x2d33(%rip),%rax
jmp    12c8 <asn1_template_ex_d2i+0x178>
mov    %rax,(%r15)
mov    $0x1,%eax
jmp    129a <asn1_template_ex_d2i+0x14a>
mov    0x2d18(%rip),%rax
mov    0x2cf9(%rip),%rcx
mov    (%rcx),%edi
mov    (%rax),%esi
call   1040 <ASN1err@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <ASN1_template_free@plt>
jmp    1298 <asn1_template_ex_d2i+0x148>

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32 }
@ASN1_TFLG_TAG_CLASS = global i32 0
@ASN1_TFLG_EXPTAG = global i32 0
@ASN1_F_ASN1_TEMPLATE_EX_D2I = global i32 0
@ERR_R_NESTED_ASN1_ERROR = global i32 0
@ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED = global i32 0
@ASN1_R_MISSING_EOC = global i32 0
@ASN1_R_EXPLICIT_LENGTH_MISMATCH = global i32 0
define i32 @asn1_template_ex_d2i(i32** %0, i8** %1, i64 %2, %struct.TYPE_5__* %3, i8 signext %4, i32* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32**
%10 = alloca i8**
%11 = alloca i64
%12 = alloca %struct.TYPE_5__*
%13 = alloca i8
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i64
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i8
%23 = alloca i8
store i32** %0, i32*** %9
store i8** %1, i8*** %10
store i64 %2, i64* %11
store %struct.TYPE_5__* %3, %struct.TYPE_5__** %12
store i8 %4, i8* %13
store i32* %5, i32** %14
store i32 %6, i32* %15
%24 = load i32**, i32*** %9
%25 = icmp ne i32** %24, null
br i1 %25, label %27, label %26
26: ; preds = %7
store i32 0, i32* %8
br label %125
27: ; preds = %7
%28 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%29 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %28, i32 0, i32 0
%30 = load i32, i32* %29
store i32 %30, i32* %16
%31 = load i32, i32* %16
%32 = load i32, i32* @ASN1_TFLG_TAG_CLASS
%33 = and i32 %31, %32
store i32 %33, i32* %17
%34 = load i8**, i8*** %10
%35 = load i8*, i8** %34
store i8* %35, i8** %20
%36 = load i32, i32* %16
%37 = load i32, i32* @ASN1_TFLG_EXPTAG
%38 = and i32 %36, %37
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %109
40: ; preds = %27
%41 = load i64, i64* %11
%42 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%43 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %42, i32 0, i32 1
%44 = load i32, i32* %43
%45 = load i32, i32* %17
%46 = load i8, i8* %13
%47 = load i32*, i32** %14
%48 = call i32 @asn1_check_tlen(i64* %19, i32* null, i32* null, i8* %22, i8* %23, i8** %20, i64 %41, i32 %44, i32 %45, i8 signext %46, i32* %47)
store i32 %48, i32* %18
%49 = load i8*, i8** %20
store i8* %49, i8** %21
%50 = load i32, i32* %18
%51 = icmp ne i32 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %40
%53 = load i32, i32* @ASN1_F_ASN1_TEMPLATE_EX_D2I
%54 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%55 = call i32 @ASN1err(i32 %53, i32 %54)
store i32 0, i32* %8
br label %125
56: ; preds = %40
%57 = load i32, i32* %18
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %60
59: ; preds = %56
store i32 -1, i32* %8
br label %125
60: ; preds = %56
br label %61
61: ; preds = %60
%62 = load i8, i8* %23
%63 = icmp ne i8 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %61
%65 = load i32, i32* @ASN1_F_ASN1_TEMPLATE_EX_D2I
%66 = load i32, i32* @ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED
%67 = call i32 @ASN1err(i32 %65, i32 %66)
store i32 0, i32* %8
br label %125
68: ; preds = %61
%69 = load i32**, i32*** %9
%70 = load i64, i64* %19
%71 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%72 = load i32*, i32** %14
%73 = load i32, i32* %15
%74 = call i32 @asn1_template_noexp_d2i(i32** %69, i8** %20, i64 %70, %struct.TYPE_5__* %71, i8 signext 0, i32* %72, i32 %73)
store i32 %74, i32* %18
%75 = load i32, i32* %18
%76 = icmp ne i32 %75, 0
br i1 %76, label %81, label %77
77: ; preds = %68
%78 = load i32, i32* @ASN1_F_ASN1_TEMPLATE_EX_D2I
%79 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%80 = call i32 @ASN1err(i32 %78, i32 %79)
store i32 0, i32* %8
br label %125
81: ; preds = %68
%82 = load i8*, i8** %20
%83 = load i8*, i8** %21
%84 = ptrtoint i8* %82 to i64
%85 = ptrtoint i8* %83 to i64
%86 = sub i64 %84, %85
%87 = load i64, i64* %19
%88 = sub nsw i64 %87, %86
store i64 %88, i64* %19
%89 = load i8, i8* %22
%90 = icmp ne i8 %89, 0
br i1 %90, label %91, label %100
91: ; preds = %81
%92 = load i64, i64* %19
%93 = call i32 @asn1_check_eoc(i8** %20, i64 %92)
%94 = icmp ne i32 %93, 0
br i1 %94, label %99, label %95
95: ; preds = %91
%96 = load i32, i32* @ASN1_F_ASN1_TEMPLATE_EX_D2I
%97 = load i32, i32* @ASN1_R_MISSING_EOC
%98 = call i32 @ASN1err(i32 %96, i32 %97)
br label %121
99: ; preds = %91
br label %108
100: ; preds = %81
%101 = load i64, i64* %19
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %107
103: ; preds = %100
%104 = load i32, i32* @ASN1_F_ASN1_TEMPLATE_EX_D2I
%105 = load i32, i32* @ASN1_R_EXPLICIT_LENGTH_MISMATCH
%106 = call i32 @ASN1err(i32 %104, i32 %105)
br label %121
107: ; preds = %100
br label %108
108: ; preds = %107, %99
br label %118
109: ; preds = %27
%110 = load i32**, i32*** %9
%111 = load i8**, i8*** %10
%112 = load i64, i64* %11
%113 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%114 = load i8, i8* %13
%115 = load i32*, i32** %14
%116 = load i32, i32* %15
%117 = call i32 @asn1_template_noexp_d2i(i32** %110, i8** %111, i64 %112, %struct.TYPE_5__* %113, i8 signext %114, i32* %115, i32 %116)
store i32 %117, i32* %8
br label %125
118: ; preds = %108
%119 = load i8*, i8** %20
%120 = load i8**, i8*** %10
store i8* %119, i8** %120
store i32 1, i32* %8
br label %125
121: ; preds = %103, %95
%122 = load i32**, i32*** %9
%123 = load %struct.TYPE_5__*, %struct.TYPE_5__** %12
%124 = call i32 @ASN1_template_free(i32** %122, %struct.TYPE_5__* %123)
store i32 0, i32* %8
br label %125
125: ; preds = %121, %118, %109, %77, %64, %59, %52, %26
%126 = load i32, i32* %8
ret i32 %126
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32 }
@ASN1_TFLG_TAG_CLASS = global i32 0
@ASN1_TFLG_EXPTAG = global i32 0
@ASN1_F_ASN1_TEMPLATE_EX_D2I = global i32 0
@ERR_R_NESTED_ASN1_ERROR = global i32 0
@ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED = global i32 0
@ASN1_R_MISSING_EOC = global i32 0
@ASN1_R_EXPLICIT_LENGTH_MISMATCH = global i32 0
define i32 @asn1_template_ex_d2i(i32** %0, i8** %1, i64 %2, %struct.TYPE_5__* %3, i8 signext %4, i32* %5, i32 %6) {
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8
%11 = alloca i8
%12 = bitcast i64* %8 to i8*
%13 = bitcast i8** %9 to i8*
%14 = icmp eq i32** %0, null
br i1 %14, label %69, label %15
15: ; preds = %7
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 0
%17 = load i32, i32* %16
%18 = load i32, i32* @ASN1_TFLG_TAG_CLASS
%19 = load i8*, i8** %1
store i8* %19, i8** %9
%20 = load i32, i32* @ASN1_TFLG_EXPTAG
%21 = and i32 %20, %17
%22 = icmp eq i32 %21, 0
br i1 %22, label %59, label %23
23: ; preds = %15
%24 = and i32 %18, %17
%25 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 1
%26 = load i32, i32* %25
%27 = call i32 @asn1_check_tlen(i64* %8, i32* null, i32* null, i8* %10, i8* %11, i8** %9, i64 %2, i32 %26, i32 %24, i8 signext %4, i32* %5)
%28 = load i8*, i8** %9
switch i32 %27, label %29 [
i32 0, label %52
i32 -1, label %57
]
29: ; preds = %23
%30 = load i8, i8* %11
%31 = icmp eq i8 %30, 0
br i1 %31, label %52, label %32
32: ; preds = %29
%33 = load i64, i64* %8
%34 = call i32 @asn1_template_noexp_d2i(i32** %0, i8** %9, i64 %33, %struct.TYPE_5__* %3, i8 signext 0, i32* %5, i32 %6)
%35 = icmp eq i32 %34, 0
br i1 %35, label %52, label %36
36: ; preds = %32
%37 = load i8*, i8** %9
%38 = ptrtoint i8* %37 to i64
%39 = ptrtoint i8* %28 to i64
%40 = sub i64 %39, %38
%41 = load i64, i64* %8
%42 = add i64 %40, %41
store i64 %42, i64* %8
%43 = load i8, i8* %10
%44 = icmp eq i8 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %36
%46 = call i32 @asn1_check_eoc(i8** %9, i64 %42)
%47 = icmp eq i32 %46, 0
br i1 %47, label %63, label %48
48: ; preds = %45
%49 = load i8*, i8** %9
br label %61
50: ; preds = %36
%51 = icmp eq i64 %42, 0
br i1 %51, label %61, label %63
52: ; preds = %32, %29, %23
%53 = phi i32* [ @ERR_R_NESTED_ASN1_ERROR, %23 ], [ @ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED, %29 ], [ @ERR_R_NESTED_ASN1_ERROR, %32 ]
%54 = load i32, i32* @ASN1_F_ASN1_TEMPLATE_EX_D2I
%55 = load i32, i32* %53
%56 = call i32 @ASN1err(i32 %54, i32 %55)
br label %57
57: ; preds = %52, %23
%58 = phi i32 [ %27, %23 ], [ 0, %52 ]
br label %69
59: ; preds = %15
%60 = tail call i32 @asn1_template_noexp_d2i(i32** %0, i8** %1, i64 %2, %struct.TYPE_5__* %3, i8 signext %4, i32* %5, i32 %6)
br label %69
61: ; preds = %48, %50
%62 = phi i8* [ %49, %48 ], [ %37, %50 ]
store i8* %62, i8** %1
br label %69
63: ; preds = %50, %45
%64 = phi i32* [ @ASN1_R_MISSING_EOC, %45 ], [ @ASN1_R_EXPLICIT_LENGTH_MISMATCH, %50 ]
%65 = load i32, i32* @ASN1_F_ASN1_TEMPLATE_EX_D2I
%66 = load i32, i32* %64
%67 = call i32 @ASN1err(i32 %65, i32 %66)
%68 = call i32 @ASN1_template_free(i32** %0, %struct.TYPE_5__* %3)
br label %69
69: ; preds = %57, %7, %63, %61, %59
%70 = phi i32 [ 0, %63 ], [ 1, %61 ], [ %60, %59 ], [ 0, %7 ], [ %58, %57 ]
ret i32 %70
}