#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_12__ TYPE_3__;
typedef struct TYPE_11__ TYPE_2__;
typedef struct TYPE_10__ TYPE_1__;

/* Type definitions */
struct TYPE_12__ {
  scalar_t__ itype;
  int utype;
};
struct TYPE_11__ {
  scalar_t__ valid;
};
struct TYPE_10__ {
  long length;
  scalar_t__ *data;
  scalar_t__ max;
};
typedef TYPE_1__ BUF_MEM;
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef TYPE_2__ ASN1_TLC;
typedef TYPE_3__ ASN1_ITEM;

/* Variables and functions */
int /*<<< orphan*/ ASN1_F_ASN1_D2I_EX_PRIMITIVE;
scalar_t__ ASN1_ITYPE_MSTRING;
int /*<<< orphan*/ ASN1_R_ILLEGAL_NULL;
int /*<<< orphan*/ ASN1_R_ILLEGAL_OPTIONAL_ANY;
int /*<<< orphan*/ ASN1_R_ILLEGAL_TAGGED_ANY;
int /*<<< orphan*/ ASN1_R_TYPE_NOT_CONSTRUCTED;
int /*<<< orphan*/ ASN1err(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ BUF_MEM_grow_clean(TYPE_1__ *, long);
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE;
int /*<<< orphan*/ ERR_R_NESTED_ASN1_ERROR;
int V_ASN1_ANY;
int V_ASN1_OTHER;
int V_ASN1_SEQUENCE;
int V_ASN1_SET;
unsigned char V_ASN1_UNIVERSAL;
int asn1_check_tlen(long *, int *, unsigned char *, char *, char *,
                    unsigned char const **, long, int, int, char, TYPE_2__ *);
int /*<<< orphan*/ asn1_collect(TYPE_1__ *, unsigned char const **, long, char,
                                int, unsigned char, int /*<<< orphan*/);
int /*<<< orphan*/ asn1_ex_c2i(int /*<<< orphan*/ **, unsigned char const *,
                               long, int, char *, TYPE_3__ const *);
int /*<<< orphan*/ asn1_find_end(unsigned char const **, long, char);
int /*<<< orphan*/ free(scalar_t__ *);
int asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in,
                          long inlen, const ASN1_ITEM *it, int tag, int aclass,
                          char opt, ASN1_TLC *ctx) {
  int ret = 0, utype;
  long plen;
  char cst, inf, free_cont = 0;
  const unsigned char *p;
  BUF_MEM buf;
  const unsigned char *cont = NULL;
  long len;
  buf.length = 0;
  buf.max = 0;
  buf.data = NULL;
  if (!pval) {
    ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
    return 0;
  }
  if (it->itype == ASN1_ITYPE_MSTRING) {
    utype = tag;
    tag = -1;
  } else
    utype = it->utype;
  if (utype == V_ASN1_ANY) {
    unsigned char oclass;
    if (tag >= 0) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_TAGGED_ANY);
      return 0;
    }
    if (opt) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_OPTIONAL_ANY);
      return 0;
    }
    p = *in;
    ret = asn1_check_tlen(NULL, &utype, &oclass, NULL, NULL, &p, inlen, -1, 0,
                          0, ctx);
    if (!ret) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
      return 0;
    }
    if (oclass != V_ASN1_UNIVERSAL)
      utype = V_ASN1_OTHER;
  }
  if (tag == -1) {
    tag = utype;
    aclass = V_ASN1_UNIVERSAL;
  }
  p = *in;
  ret = asn1_check_tlen(&plen, NULL, NULL, &inf, &cst, &p, inlen, tag, aclass,
                        opt, ctx);
  if (!ret) {
    ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_NESTED_ASN1_ERROR);
    return 0;
  } else if (ret == -1)
    return -1;
  ret = 0;
  if ((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) ||
      (utype == V_ASN1_OTHER)) {
    if (utype == V_ASN1_OTHER) {
      if (ctx)
        (ctx)->valid = 0;
    } else if (!cst) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_CONSTRUCTED);
      return 0;
    }
    cont = *in;
    if (inf) {
      if (!asn1_find_end(&p, plen, inf))
        goto err;
      len = p - cont;
    } else {
      len = p - cont + plen;
      p += plen;
      buf.data = NULL;
    }
  } else if (cst) {
    if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) {
      free_cont = 1;
      goto err;
    }
    len = buf.length;
    if (!BUF_MEM_grow_clean(&buf, len + 1)) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
      return 0;
    }
    buf.data[len] = 0;
    cont = (const unsigned char *)buf.data;
    free_cont = 1;
  } else {
    cont = p;
    len = plen;
    p += plen;
  }
  if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it))
    goto err;
  *in = p;
  ret = 1;
err:
  if (free_cont && buf.data)
    free(buf.data);
  return ret;
}


x86 assembly (clang, -O0):
<asn1_d2i_ex_primitive>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xb0,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%al
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8d,-0x3c(%rbp)
mov    %r9d,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movb   $0x0,-0x53(%rbp)
movq   $0x0,-0x80(%rbp)
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f6 <asn1_d2i_ex_primitive+0x86>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    0x2dac(%rip),%rcx
cmp    (%rcx),%rax
jne    121f <asn1_d2i_ex_primitive+0xaf>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
jmp    1229 <asn1_d2i_ex_primitive+0xb9>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2d5d(%rip),%rcx
cmp    (%rcx),%eax
jne    1344 <asn1_d2i_ex_primitive+0x1d4>
cmpl   $0x0,-0x3c(%rbp)
jl     1268 <asn1_d2i_ex_primitive+0xf8>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
mov    0x2d73(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
cmpb   $0x0,0x10(%rbp)
je     1295 <asn1_d2i_ex_primitive+0x125>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
mov    0x2d16(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%r10
mov    0x18(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%r8d
lea    -0x48(%rbp),%rsi
lea    -0x89(%rbp),%rdx
lea    -0x60(%rbp),%r9
xor    %ecx,%ecx
mov    %r8,%rdi
mov    %r8,%rcx
mov    %r10,(%rsp)
movl   $0xffffffff,0x8(%rsp)
ff
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <asn1_check_tlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    131a <asn1_d2i_ex_primitive+0x1aa>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
mov    0x2cb9(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
movzbl -0x89(%rbp),%eax
mov    0x2c80(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     133f <asn1_d2i_ex_primitive+0x1cf>
mov    0x2c9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
jmp    1344 <asn1_d2i_ex_primitive+0x1d4>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1361 <asn1_d2i_ex_primitive+0x1f1>
mov    -0x48(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2c4d(%rip),%rax
movzbl (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%r14
mov    -0x3c(%rbp),%ebx
mov    -0x40(%rbp),%r11d
mov    0x10(%rbp),%r10b
mov    0x18(%rbp),%rax
lea    -0x50(%rbp),%rdi
xor    %ecx,%ecx
mov    %ecx,%edx
lea    -0x52(%rbp),%rcx
lea    -0x51(%rbp),%r8
lea    -0x60(%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   1040 <asn1_check_tlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    13e6 <asn1_d2i_ex_primitive+0x276>
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
mov    0x2bed(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
cmpl   $0xffffffff,-0x44(%rbp)
jne    13fc <asn1_d2i_ex_primitive+0x28c>
movl   $0xffffffff,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
jmp    1401 <asn1_d2i_ex_primitive+0x291>
movl   $0x0,-0x44(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2b6e(%rip),%rcx
cmp    (%rcx),%eax
je     143e <asn1_d2i_ex_primitive+0x2ce>
mov    -0x48(%rbp),%eax
mov    0x2b7c(%rip),%rcx
cmp    (%rcx),%eax
je     143e <asn1_d2i_ex_primitive+0x2ce>
mov    -0x48(%rbp),%eax
mov    0x2ba2(%rip),%rcx
cmp    (%rcx),%eax
jne    1517 <asn1_d2i_ex_primitive+0x3a7>
mov    -0x48(%rbp),%eax
mov    0x2b90(%rip),%rcx
cmp    (%rcx),%eax
jne    146b <asn1_d2i_ex_primitive+0x2fb>
cmpq   $0x0,0x18(%rbp)
je     1466 <asn1_d2i_ex_primitive+0x2f6>
mov    0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    149d <asn1_d2i_ex_primitive+0x32d>
cmpb   $0x0,-0x51(%rbp)
jne    1498 <asn1_d2i_ex_primitive+0x328>
mov    0x2b6c(%rip),%rax
mov    (%rax),%edi
mov    0x2b5b(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
jmp    149d <asn1_d2i_ex_primitive+0x32d>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
cmpb   $0x0,-0x52(%rbp)
je     14e8 <asn1_d2i_ex_primitive+0x378>
mov    -0x50(%rbp),%rsi
lea    -0x60(%rbp),%rdi
movsbl -0x52(%rbp),%edx
call   1090 <asn1_find_end@plt>
cmp    $0x0,%eax
jne    14d1 <asn1_d2i_ex_primitive+0x361>
jmp    1636 <asn1_d2i_ex_primitive+0x4c6>
mov    -0x60(%rbp),%rax
mov    -0x80(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x88(%rbp)
jmp    1512 <asn1_d2i_ex_primitive+0x3a2>
mov    -0x60(%rbp),%rax
mov    -0x80(%rbp),%rcx
sub    %rcx,%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x50(%rbp),%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
movq   $0x0,-0x70(%rbp)
jmp    15f7 <asn1_d2i_ex_primitive+0x487>
cmpb   $0x0,-0x51(%rbp)
je     15d3 <asn1_d2i_ex_primitive+0x463>
mov    -0x50(%rbp),%rdx
mov    -0x52(%rbp),%cl
lea    -0x78(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0xffffffff,%r8d
xor    %eax,%eax
mov    0x2a69(%rip),%rax
movsbl %cl,%ecx
movzbl (%rax),%r9d
movl   $0x0,(%rsp)
call   1060 <asn1_collect@plt>
cmp    $0x0,%eax
jne    1564 <asn1_d2i_ex_primitive+0x3f4>
movb   $0x1,-0x53(%rbp)
jmp    1636 <asn1_d2i_ex_primitive+0x4c6>
mov    -0x78(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rsi
add    $0x1,%rsi
lea    -0x78(%rbp),%rdi
call   1080 <BUF_MEM_grow_clean@plt>
cmp    $0x0,%eax
jne    15af <asn1_d2i_ex_primitive+0x43f>
mov    0x2a55(%rip),%rax
mov    (%rax),%edi
mov    0x2a34(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    165d <asn1_d2i_ex_primitive+0x4ed>
mov    -0x70(%rbp),%rax
mov    -0x88(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x70(%rbp),%rax
mov    %rax,-0x80(%rbp)
movb   $0x1,-0x53(%rbp)
jmp    15f2 <asn1_d2i_ex_primitive+0x482>
mov    -0x60(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x50(%rbp),%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    15f7 <asn1_d2i_ex_primitive+0x487>
mov    -0x20(%rbp),%rdi
mov    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%rdx
mov    -0x48(%rbp),%ecx
mov    -0x38(%rbp),%r9
lea    -0x53(%rbp),%r8
call   1070 <asn1_ex_c2i@plt>
cmp    $0x0,%eax
jne    1624 <asn1_d2i_ex_primitive+0x4b4>
jmp    1636 <asn1_d2i_ex_primitive+0x4c6>
mov    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x44(%rbp)
movsbl -0x53(%rbp),%eax
cmp    $0x0,%eax
je     1657 <asn1_d2i_ex_primitive+0x4e7>
cmpq   $0x0,-0x70(%rbp)
je     1657 <asn1_d2i_ex_primitive+0x4e7>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_d2i_ex_primitive>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movb   $0x0,0x9(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x40(%rsp)
test   %rdi,%rdi
je     11e4 <asn1_d2i_ex_primitive+0x74>
mov    %r9d,%r15d
mov    %r8d,%ebp
mov    %rdx,%r13
mov    %rdi,%r12
mov    0x88(%rsp),%r10
mov    0x80(%rsp),%bl
mov    (%rcx),%rax
mov    0x2df2(%rip),%rdx
cmp    (%rdx),%rax
jne    11f9 <asn1_d2i_ex_primitive+0x89>
mov    %ebp,0xc(%rsp)
mov    0x2dc2(%rip),%rdx
mov    %ebp,%eax
cmp    %ebp,(%rdx)
mov    $0xffffffff,%ebp
jne    12de <asn1_d2i_ex_primitive+0x16e>
mov    $0xffffffff,%ebp
jmp    1228 <asn1_d2i_ex_primitive+0xb8>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
mov    0x2d84(%rip),%rax
jmp    1351 <asn1_d2i_ex_primitive+0x1e1>
mov    0x8(%rcx),%eax
mov    %eax,0xc(%rsp)
mov    0x2d89(%rip),%rdx
cmp    (%rdx),%eax
jne    12de <asn1_d2i_ex_primitive+0x16e>
test   %ebp,%ebp
js     1228 <asn1_d2i_ex_primitive+0xb8>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
mov    0x2da5(%rip),%rax
jmp    1351 <asn1_d2i_ex_primitive+0x1e1>
test   %bl,%bl
je     1241 <asn1_d2i_ex_primitive+0xd1>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
mov    0x2d5c(%rip),%rax
jmp    1351 <asn1_d2i_ex_primitive+0x1e1>
mov    %rcx,0x28(%rsp)
mov    %rsi,0x18(%rsp)
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
sub    $0x8,%rsp
xor    %r14d,%r14d
lea    0x14(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x18(%rsp),%r9
xor    %edi,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
push   %r10
push   $0x0
push   $0x0
push   $0xffffffffffffffff
push   %r13
call   1040 <asn1_check_tlen@plt>
add    $0x30,%rsp
test   %eax,%eax
je     129c <asn1_d2i_ex_primitive+0x12c>
mov    0x20(%rsp),%al
mov    0x2d16(%rip),%rcx
cmp    (%rcx),%al
jne    12b8 <asn1_d2i_ex_primitive+0x148>
mov    0xc(%rsp),%eax
jmp    12c5 <asn1_d2i_ex_primitive+0x155>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
mov    0x2d14(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
jmp    135b <asn1_d2i_ex_primitive+0x1eb>
mov    0x2d19(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x18(%rsp),%rsi
mov    0x88(%rsp),%r10
mov    0x28(%rsp),%rcx
mov    0x80(%rsp),%bl
mov    %rcx,0x28(%rsp)
cmp    $0xffffffff,%ebp
mov    0x2cbb(%rip),%rcx
movzbl (%rcx),%ecx
cmove  %ecx,%r15d
cmovne %ebp,%eax
mov    %rsi,0x18(%rsp)
mov    (%rsi),%rcx
mov    %rcx,0x10(%rsp)
sub    $0x8,%rsp
movsbl %bl,%ebp
lea    0x28(%rsp),%rdi
lea    0x12(%rsp),%rcx
lea    0x13(%rsp),%r8
lea    0x18(%rsp),%r9
xor    %esi,%esi
xor    %edx,%edx
push   %r10
push   %rbp
push   %r15
push   %rax
push   %r13
call   1040 <asn1_check_tlen@plt>
add    $0x30,%rsp
mov    %eax,%r14d
cmp    $0xffffffff,%eax
je     135b <asn1_d2i_ex_primitive+0x1eb>
test   %r14d,%r14d
jne    136d <asn1_d2i_ex_primitive+0x1fd>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
mov    0x2c6f(%rip),%rax
mov    (%rax),%esi
call   1050 <ASN1err@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc(%rsp),%eax
mov    0x2c08(%rip),%rdx
mov    0x2c59(%rip),%rcx
mov    (%rcx),%ecx
cmp    (%rdx),%eax
je     141a <asn1_d2i_ex_primitive+0x2aa>
mov    0x2c10(%rip),%rdx
cmp    (%rdx),%eax
je     141a <asn1_d2i_ex_primitive+0x2aa>
cmp    %ecx,%eax
je     141a <asn1_d2i_ex_primitive+0x2aa>
cmpb   $0x0,0xb(%rsp)
je     1474 <asn1_d2i_ex_primitive+0x304>
mov    0x20(%rsp),%rdx
movsbl 0xa(%rsp),%ecx
mov    0x2bf0(%rip),%rax
movzbl (%rax),%r9d
sub    $0x8,%rsp
lea    0x38(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    $0xffffffff,%r8d
push   $0x0
call   1060 <asn1_collect@plt>
add    $0x10,%rsp
test   %eax,%eax
mov    0x18(%rsp),%r14
je     14e2 <asn1_d2i_ex_primitive+0x372>
mov    0x30(%rsp),%rbp
lea    0x1(%rbp),%rsi
lea    0x30(%rsp),%rdi
call   1080 <BUF_MEM_grow_clean@plt>
test   %eax,%eax
je     1522 <asn1_d2i_ex_primitive+0x3b2>
mov    0x38(%rsp),%rbx
movq   $0x0,(%rbx,%rbp,8)
movb   $0x1,0x9(%rsp)
jmp    14b2 <asn1_d2i_ex_primitive+0x342>
cmp    %ecx,%eax
jne    1439 <asn1_d2i_ex_primitive+0x2c9>
mov    0x88(%rsp),%rax
test   %rax,%rax
mov    0x18(%rsp),%r14
je     1449 <asn1_d2i_ex_primitive+0x2d9>
movq   $0x0,(%rax)
jmp    1449 <asn1_d2i_ex_primitive+0x2d9>
cmpb   $0x0,0xb(%rsp)
mov    0x18(%rsp),%r14
je     150d <asn1_d2i_ex_primitive+0x39d>
mov    (%r14),%rbx
mov    0xa(%rsp),%al
test   %al,%al
je     148e <asn1_d2i_ex_primitive+0x31e>
mov    0x20(%rsp),%rsi
movsbl %al,%edx
lea    0x10(%rsp),%rdi
call   1090 <asn1_find_end@plt>
test   %eax,%eax
je     14e7 <asn1_d2i_ex_primitive+0x377>
mov    0x10(%rsp),%rbp
sub    %rbx,%rbp
jmp    14b2 <asn1_d2i_ex_primitive+0x342>
mov    0x10(%rsp),%rbx
mov    0x20(%rsp),%rbp
lea    (%rbx,%rbp,1),%rax
mov    %rax,0x10(%rsp)
mov    0x18(%rsp),%r14
jmp    14b2 <asn1_d2i_ex_primitive+0x342>
mov    0x10(%rsp),%rax
mov    %rax,%rbp
sub    %rbx,%rbp
mov    0x20(%rsp),%rcx
add    %rcx,%rbp
add    %rcx,%rax
mov    %rax,0x10(%rsp)
movq   $0x0,0x38(%rsp)
mov    0xc(%rsp),%ecx
lea    0x9(%rsp),%r8
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    0x28(%rsp),%r9
call   1070 <asn1_ex_c2i@plt>
test   %eax,%eax
je     14e7 <asn1_d2i_ex_primitive+0x377>
mov    0x10(%rsp),%rax
mov    %rax,(%r14)
mov    $0x1,%r14d
jmp    14ea <asn1_d2i_ex_primitive+0x37a>
movb   $0x1,0x9(%rsp)
xor    %r14d,%r14d
cmpb   $0x0,0x9(%rsp)
je     135b <asn1_d2i_ex_primitive+0x1eb>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     135b <asn1_d2i_ex_primitive+0x1eb>
call   1030 <free@plt>
jmp    135b <asn1_d2i_ex_primitive+0x1eb>
mov    0x2ad4(%rip),%rax
mov    (%rax),%edi
mov    0x2ac3(%rip),%rax
jmp    1351 <asn1_d2i_ex_primitive+0x1e1>
mov    0x2abf(%rip),%rax
mov    (%rax),%edi
mov    0x2a9e(%rip),%rax
jmp    1351 <asn1_d2i_ex_primitive+0x1e1>

LLVM IR (-O0):
%struct.TYPE_12__ = type { i64, i32 }
%struct.TYPE_11__ = type { i64 }
%struct.TYPE_10__ = type { i64, i64*, i64 }
@ASN1_F_ASN1_D2I_EX_PRIMITIVE = global i32 0
@ASN1_R_ILLEGAL_NULL = global i32 0
@ASN1_ITYPE_MSTRING = global i64 0
@V_ASN1_ANY = global i32 0
@ASN1_R_ILLEGAL_TAGGED_ANY = global i32 0
@ASN1_R_ILLEGAL_OPTIONAL_ANY = global i32 0
@ERR_R_NESTED_ASN1_ERROR = global i32 0
@V_ASN1_UNIVERSAL = global i8 0
@V_ASN1_OTHER = global i32 0
@V_ASN1_SEQUENCE = global i32 0
@V_ASN1_SET = global i32 0
@ASN1_R_TYPE_NOT_CONSTRUCTED = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
define i32 @asn1_d2i_ex_primitive(i32** %0, i8** %1, i64 %2, %struct.TYPE_12__* %3, i32 %4, i32 %5, i8 signext %6, %struct.TYPE_11__* %7) {
%9 = alloca i32
%10 = alloca i32**
%11 = alloca i8**
%12 = alloca i64
%13 = alloca %struct.TYPE_12__*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
%17 = alloca %struct.TYPE_11__*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i64
%21 = alloca i8
%22 = alloca i8
%23 = alloca i8
%24 = alloca i8*
%25 = alloca %struct.TYPE_10__
%26 = alloca i8*
%27 = alloca i64
%28 = alloca i8
store i32** %0, i32*** %10
store i8** %1, i8*** %11
store i64 %2, i64* %12
store %struct.TYPE_12__* %3, %struct.TYPE_12__** %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i8 %6, i8* %16
store %struct.TYPE_11__* %7, %struct.TYPE_11__** %17
store i32 0, i32* %18
store i8 0, i8* %23
store i8* null, i8** %26
%29 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 0
store i64 0, i64* %29
%30 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 2
store i64 0, i64* %30
%31 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
store i64* null, i64** %31
%32 = load i32**, i32*** %10
%33 = icmp ne i32** %32, null
br i1 %33, label %38, label %34
34: ; preds = %8
%35 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%36 = load i32, i32* @ASN1_R_ILLEGAL_NULL
%37 = call i32 @ASN1err(i32 %35, i32 %36)
store i32 0, i32* %9
br label %239
38: ; preds = %8
%39 = load %struct.TYPE_12__*, %struct.TYPE_12__** %13
%40 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %39, i32 0, i32 0
%41 = load i64, i64* %40
%42 = load i64, i64* @ASN1_ITYPE_MSTRING
%43 = icmp eq i64 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %38
%45 = load i32, i32* %14
store i32 %45, i32* %19
store i32 -1, i32* %14
br label %50
46: ; preds = %38
%47 = load %struct.TYPE_12__*, %struct.TYPE_12__** %13
%48 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %47, i32 0, i32 1
%49 = load i32, i32* %48
store i32 %49, i32* %19
br label %50
50: ; preds = %46, %44
%51 = load i32, i32* %19
%52 = load i32, i32* @V_ASN1_ANY
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %89
54: ; preds = %50
%55 = load i32, i32* %14
%56 = icmp sge i32 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%59 = load i32, i32* @ASN1_R_ILLEGAL_TAGGED_ANY
%60 = call i32 @ASN1err(i32 %58, i32 %59)
store i32 0, i32* %9
br label %239
61: ; preds = %54
%62 = load i8, i8* %16
%63 = icmp ne i8 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %61
%65 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%66 = load i32, i32* @ASN1_R_ILLEGAL_OPTIONAL_ANY
%67 = call i32 @ASN1err(i32 %65, i32 %66)
store i32 0, i32* %9
br label %239
68: ; preds = %61
%69 = load i8**, i8*** %11
%70 = load i8*, i8** %69
store i8* %70, i8** %24
%71 = load i64, i64* %12
%72 = load %struct.TYPE_11__*, %struct.TYPE_11__** %17
%73 = call i32 @asn1_check_tlen(i64* null, i32* %19, i8* %28, i8* null, i8* null, i8** %24, i64 %71, i32 -1, i32 0, i8 signext 0, %struct.TYPE_11__* %72)
store i32 %73, i32* %18
%74 = load i32, i32* %18
%75 = icmp ne i32 %74, 0
br i1 %75, label %80, label %76
76: ; preds = %68
%77 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%78 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%79 = call i32 @ASN1err(i32 %77, i32 %78)
store i32 0, i32* %9
br label %239
80: ; preds = %68
%81 = load i8, i8* %28
%82 = zext i8 %81 to i32
%83 = load i8, i8* @V_ASN1_UNIVERSAL
%84 = zext i8 %83 to i32
%85 = icmp ne i32 %82, %84
br i1 %85, label %86, label %88
86: ; preds = %80
%87 = load i32, i32* @V_ASN1_OTHER
store i32 %87, i32* %19
br label %88
88: ; preds = %86, %80
br label %89
89: ; preds = %88, %50
%90 = load i32, i32* %14
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %96
92: ; preds = %89
%93 = load i32, i32* %19
store i32 %93, i32* %14
%94 = load i8, i8* @V_ASN1_UNIVERSAL
%95 = zext i8 %94 to i32
store i32 %95, i32* %15
br label %96
96: ; preds = %92, %89
%97 = load i8**, i8*** %11
%98 = load i8*, i8** %97
store i8* %98, i8** %24
%99 = load i64, i64* %12
%100 = load i32, i32* %14
%101 = load i32, i32* %15
%102 = load i8, i8* %16
%103 = load %struct.TYPE_11__*, %struct.TYPE_11__** %17
%104 = call i32 @asn1_check_tlen(i64* %20, i32* null, i8* null, i8* %22, i8* %21, i8** %24, i64 %99, i32 %100, i32 %101, i8 signext %102, %struct.TYPE_11__* %103)
store i32 %104, i32* %18
%105 = load i32, i32* %18
%106 = icmp ne i32 %105, 0
br i1 %106, label %111, label %107
107: ; preds = %96
%108 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%109 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%110 = call i32 @ASN1err(i32 %108, i32 %109)
store i32 0, i32* %9
br label %239
111: ; preds = %96
%112 = load i32, i32* %18
%113 = icmp eq i32 %112, -1
br i1 %113, label %114, label %115
114: ; preds = %111
store i32 -1, i32* %9
br label %239
115: ; preds = %111
br label %116
116: ; preds = %115
store i32 0, i32* %18
%117 = load i32, i32* %19
%118 = load i32, i32* @V_ASN1_SEQUENCE
%119 = icmp eq i32 %117, %118
br i1 %119, label %128, label %120
120: ; preds = %116
%121 = load i32, i32* %19
%122 = load i32, i32* @V_ASN1_SET
%123 = icmp eq i32 %121, %122
br i1 %123, label %128, label %124
124: ; preds = %120
%125 = load i32, i32* %19
%126 = load i32, i32* @V_ASN1_OTHER
%127 = icmp eq i32 %125, %126
br i1 %127, label %128, label %177
128: ; preds = %124, %120, %116
%129 = load i32, i32* %19
%130 = load i32, i32* @V_ASN1_OTHER
%131 = icmp eq i32 %129, %130
br i1 %131, label %132, label %139
132: ; preds = %128
%133 = load %struct.TYPE_11__*, %struct.TYPE_11__** %17
%134 = icmp ne %struct.TYPE_11__* %133, null
br i1 %134, label %135, label %138
135: ; preds = %132
%136 = load %struct.TYPE_11__*, %struct.TYPE_11__** %17
%137 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %136, i32 0, i32 0
store i64 0, i64* %137
br label %138
138: ; preds = %135, %132
br label %147
139: ; preds = %128
%140 = load i8, i8* %21
%141 = icmp ne i8 %140, 0
br i1 %141, label %146, label %142
142: ; preds = %139
%143 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%144 = load i32, i32* @ASN1_R_TYPE_NOT_CONSTRUCTED
%145 = call i32 @ASN1err(i32 %143, i32 %144)
store i32 0, i32* %9
br label %239
146: ; preds = %139
br label %147
147: ; preds = %146, %138
%148 = load i8**, i8*** %11
%149 = load i8*, i8** %148
store i8* %149, i8** %26
%150 = load i8, i8* %22
%151 = icmp ne i8 %150, 0
br i1 %151, label %152, label %164
152: ; preds = %147
%153 = load i64, i64* %20
%154 = load i8, i8* %22
%155 = call i32 @asn1_find_end(i8** %24, i64 %153, i8 signext %154)
%156 = icmp ne i32 %155, 0
br i1 %156, label %158, label %157
157: ; preds = %152
br label %225
158: ; preds = %152
%159 = load i8*, i8** %24
%160 = load i8*, i8** %26
%161 = ptrtoint i8* %159 to i64
%162 = ptrtoint i8* %160 to i64
%163 = sub i64 %161, %162
store i64 %163, i64* %27
br label %176
164: ; preds = %147
%165 = load i8*, i8** %24
%166 = load i8*, i8** %26
%167 = ptrtoint i8* %165 to i64
%168 = ptrtoint i8* %166 to i64
%169 = sub i64 %167, %168
%170 = load i64, i64* %20
%171 = add nsw i64 %169, %170
store i64 %171, i64* %27
%172 = load i64, i64* %20
%173 = load i8*, i8** %24
%174 = getelementptr inbounds i8, i8* %173, i64 %172
store i8* %174, i8** %24
%175 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
store i64* null, i64** %175
br label %176
176: ; preds = %164, %158
br label %213
177: ; preds = %124
%178 = load i8, i8* %21
%179 = icmp ne i8 %178, 0
br i1 %179, label %180, label %206
180: ; preds = %177
%181 = load i64, i64* %20
%182 = load i8, i8* %22
%183 = load i8, i8* @V_ASN1_UNIVERSAL
%184 = call i32 @asn1_collect(%struct.TYPE_10__* %25, i8** %24, i64 %181, i8 signext %182, i32 -1, i8 zeroext %183, i32 0)
%185 = icmp ne i32 %184, 0
br i1 %185, label %187, label %186
186: ; preds = %180
store i8 1, i8* %23
br label %225
187: ; preds = %180
%188 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 0
%189 = load i64, i64* %188
store i64 %189, i64* %27
%190 = load i64, i64* %27
%191 = add nsw i64 %190, 1
%192 = call i32 @BUF_MEM_grow_clean(%struct.TYPE_10__* %25, i64 %191)
%193 = icmp ne i32 %192, 0
br i1 %193, label %198, label %194
194: ; preds = %187
%195 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%196 = load i32, i32* @ERR_R_MALLOC_FAILURE
%197 = call i32 @ASN1err(i32 %195, i32 %196)
store i32 0, i32* %9
br label %239
198: ; preds = %187
%199 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
%200 = load i64*, i64** %199
%201 = load i64, i64* %27
%202 = getelementptr inbounds i64, i64* %200, i64 %201
store i64 0, i64* %202
%203 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
%204 = load i64*, i64** %203
%205 = bitcast i64* %204 to i8*
store i8* %205, i8** %26
store i8 1, i8* %23
br label %212
206: ; preds = %177
%207 = load i8*, i8** %24
store i8* %207, i8** %26
%208 = load i64, i64* %20
store i64 %208, i64* %27
%209 = load i64, i64* %20
%210 = load i8*, i8** %24
%211 = getelementptr inbounds i8, i8* %210, i64 %209
store i8* %211, i8** %24
br label %212
212: ; preds = %206, %198
br label %213
213: ; preds = %212, %176
%214 = load i32**, i32*** %10
%215 = load i8*, i8** %26
%216 = load i64, i64* %27
%217 = load i32, i32* %19
%218 = load %struct.TYPE_12__*, %struct.TYPE_12__** %13
%219 = call i32 @asn1_ex_c2i(i32** %214, i8* %215, i64 %216, i32 %217, i8* %23, %struct.TYPE_12__* %218)
%220 = icmp ne i32 %219, 0
br i1 %220, label %222, label %221
221: ; preds = %213
br label %225
222: ; preds = %213
%223 = load i8*, i8** %24
%224 = load i8**, i8*** %11
store i8* %223, i8** %224
store i32 1, i32* %18
br label %225
225: ; preds = %222, %221, %186, %157
%226 = load i8, i8* %23
%227 = sext i8 %226 to i32
%228 = icmp ne i32 %227, 0
br i1 %228, label %229, label %237
229: ; preds = %225
%230 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
%231 = load i64*, i64** %230
%232 = icmp ne i64* %231, null
br i1 %232, label %233, label %237
233: ; preds = %229
%234 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
%235 = load i64*, i64** %234
%236 = call i32 @free(i64* %235)
br label %237
237: ; preds = %233, %229, %225
%238 = load i32, i32* %18
store i32 %238, i32* %9
br label %239
239: ; preds = %237, %194, %142, %114, %107, %76, %64, %57, %34
%240 = load i32, i32* %9
ret i32 %240
}

LLVM IR (-O2):
%struct.TYPE_12__ = type { i64, i32 }
%struct.TYPE_11__ = type { i64 }
%struct.TYPE_10__ = type { i64, i64*, i64 }
@ASN1_F_ASN1_D2I_EX_PRIMITIVE = global i32 0
@ASN1_R_ILLEGAL_NULL = global i32 0
@ASN1_ITYPE_MSTRING = global i64 0
@V_ASN1_ANY = global i32 0
@ASN1_R_ILLEGAL_TAGGED_ANY = global i32 0
@ASN1_R_ILLEGAL_OPTIONAL_ANY = global i32 0
@ERR_R_NESTED_ASN1_ERROR = global i32 0
@V_ASN1_UNIVERSAL = global i8 0
@V_ASN1_OTHER = global i32 0
@V_ASN1_SEQUENCE = global i32 0
@V_ASN1_SET = global i32 0
@ASN1_R_TYPE_NOT_CONSTRUCTED = global i32 0
@ERR_R_MALLOC_FAILURE = global i32 0
define i32 @asn1_d2i_ex_primitive(i32** %0, i8** nocapture %1, i64 %2, %struct.TYPE_12__* %3, i32 %4, i32 %5, i8 signext %6, %struct.TYPE_11__* %7) {
%9 = alloca i32
%10 = alloca i64
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8*
%15 = alloca %struct.TYPE_10__
%16 = alloca i8
%17 = bitcast i32* %9 to i8*
%18 = bitcast i64* %10 to i8*
store i8 0, i8* %13
%19 = bitcast i8** %14 to i8*
%20 = bitcast %struct.TYPE_10__* %15 to i8*
%21 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %15, i64 0, i32 0
%22 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %15, i64 0, i32 1
%23 = icmp eq i32** %0, null
%24 = bitcast %struct.TYPE_10__* %15 to i8*
br i1 %23, label %25, label %29
25: ; preds = %8
%26 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%27 = load i32, i32* @ASN1_R_ILLEGAL_NULL
%28 = tail call i32 @ASN1err(i32 %26, i32 %27)
br label %175
29: ; preds = %8
%30 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %3, i64 0, i32 0
%31 = load i64, i64* %30
%32 = load i64, i64* @ASN1_ITYPE_MSTRING
%33 = icmp eq i64 %31, %32
br i1 %33, label %39, label %34
34: ; preds = %29
%35 = getelementptr inbounds %struct.TYPE_12__, %struct.TYPE_12__* %3, i64 0, i32 1
%36 = load i32, i32* %35
store i32 %36, i32* %9
%37 = load i32, i32* @V_ASN1_ANY
%38 = icmp eq i32 %36, %37
br i1 %38, label %43, label %74
39: ; preds = %29
store i32 %4, i32* %9
%40 = load i32, i32* @V_ASN1_ANY
%41 = icmp eq i32 %40, %4
br i1 %41, label %42, label %74
42: ; preds = %39
br label %49
43: ; preds = %34
%44 = icmp sgt i32 %4, -1
br i1 %44, label %45, label %49
45: ; preds = %43
%46 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%47 = load i32, i32* @ASN1_R_ILLEGAL_TAGGED_ANY
%48 = tail call i32 @ASN1err(i32 %46, i32 %47)
br label %175
49: ; preds = %42, %43
%50 = phi i32 [ -1, %42 ], [ %4, %43 ]
%51 = icmp eq i8 %6, 0
br i1 %51, label %56, label %52
52: ; preds = %49
%53 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%54 = load i32, i32* @ASN1_R_ILLEGAL_OPTIONAL_ANY
%55 = tail call i32 @ASN1err(i32 %53, i32 %54)
br label %175
56: ; preds = %49
%57 = load i8*, i8** %1
store i8* %57, i8** %14
%58 = call i32 @asn1_check_tlen(i64* null, i32* %9, i8* %16, i8* null, i8* null, i8** %14, i64 %2, i32 -1, i32 0, i8 signext 0, %struct.TYPE_11__* %7)
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%62 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%63 = call i32 @ASN1err(i32 %61, i32 %62)
br label %175
64: ; preds = %56
%65 = load i8, i8* %16
%66 = load i8, i8* @V_ASN1_UNIVERSAL
%67 = icmp eq i8 %65, %66
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = load i32, i32* %9
br label %72
70: ; preds = %64
%71 = load i32, i32* @V_ASN1_OTHER
store i32 %71, i32* %9
br label %72
72: ; preds = %68, %70
%73 = phi i32 [ %69, %68 ], [ %71, %70 ]
br label %74
74: ; preds = %39, %72, %34
%75 = phi i32 [ %4, %39 ], [ %73, %72 ], [ %36, %34 ]
%76 = phi i32 [ -1, %39 ], [ %50, %72 ], [ %4, %34 ]
%77 = icmp eq i32 %76, -1
%78 = load i8, i8* @V_ASN1_UNIVERSAL
%79 = zext i8 %78 to i32
%80 = select i1 %77, i32 %79, i32 %5
%81 = select i1 %77, i32 %75, i32 %76
%82 = load i8*, i8** %1
store i8* %82, i8** %14
%83 = call i32 @asn1_check_tlen(i64* %10, i32* null, i8* null, i8* %12, i8* %11, i8** %14, i64 %2, i32 %81, i32 %80, i8 signext %6, %struct.TYPE_11__* %7)
switch i32 %83, label %88 [
i32 0, label %84
i32 -1, label %175
]
84: ; preds = %74
%85 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%86 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%87 = call i32 @ASN1err(i32 %85, i32 %86)
br label %175
88: ; preds = %74
%89 = load i32, i32* %9
%90 = load i32, i32* @V_ASN1_SEQUENCE
%91 = icmp eq i32 %89, %90
%92 = load i32, i32* @V_ASN1_SET
%93 = icmp eq i32 %89, %92
%94 = select i1 %91, i1 true, i1 %93
%95 = load i32, i32* @V_ASN1_OTHER
%96 = icmp eq i32 %89, %95
%97 = select i1 %94, i1 true, i1 %96
br i1 %97, label %98, label %131
98: ; preds = %88
br i1 %96, label %99, label %103
99: ; preds = %98
%100 = icmp eq %struct.TYPE_11__* %7, null
br i1 %100, label %110, label %101
101: ; preds = %99
%102 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %7, i64 0, i32 0
store i64 0, i64* %102
br label %110
103: ; preds = %98
%104 = load i8, i8* %11
%105 = icmp eq i8 %104, 0
br i1 %105, label %106, label %110
106: ; preds = %103
%107 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%108 = load i32, i32* @ASN1_R_TYPE_NOT_CONSTRUCTED
%109 = call i32 @ASN1err(i32 %107, i32 %108)
br label %175
110: ; preds = %103, %99, %101
%111 = load i8*, i8** %1
%112 = load i8, i8* %12
%113 = icmp eq i8 %112, 0
br i1 %113, label %123, label %114
114: ; preds = %110
%115 = load i64, i64* %10
%116 = call i32 @asn1_find_end(i8** %14, i64 %115, i8 signext %112)
%117 = icmp eq i32 %116, 0
br i1 %117, label %166, label %118
118: ; preds = %114
%119 = load i8*, i8** %14
%120 = ptrtoint i8* %119 to i64
%121 = ptrtoint i8* %111 to i64
%122 = sub i64 %120, %121
br label %158
123: ; preds = %110
%124 = load i8*, i8** %14
%125 = ptrtoint i8* %124 to i64
%126 = ptrtoint i8* %111 to i64
%127 = sub i64 %125, %126
%128 = load i64, i64* %10
%129 = add nsw i64 %127, %128
%130 = getelementptr inbounds i8, i8* %124, i64 %128
store i8* %130, i8** %14
store i64* null, i64** %22
br label %158
131: ; preds = %88
%132 = load i8, i8* %11
%133 = icmp eq i8 %132, 0
br i1 %133, label %154, label %134
134: ; preds = %131
%135 = load i64, i64* %10
%136 = load i8, i8* %12
%137 = load i8, i8* @V_ASN1_UNIVERSAL
%138 = call i32 @asn1_collect(%struct.TYPE_10__* %15, i8** %14, i64 %135, i8 signext %136, i32 -1, i8 zeroext %137, i32 0)
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %141
140: ; preds = %134
store i8 1, i8* %13
br label %166
141: ; preds = %134
%142 = load i64, i64* %21
%143 = add nsw i64 %142, 1
%144 = call i32 @BUF_MEM_grow_clean(%struct.TYPE_10__* %15, i64 %143)
%145 = icmp eq i32 %144, 0
br i1 %145, label %146, label %150
146: ; preds = %141
%147 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%148 = load i32, i32* @ERR_R_MALLOC_FAILURE
%149 = call i32 @ASN1err(i32 %147, i32 %148)
br label %175
150: ; preds = %141
%151 = load i64*, i64** %22
%152 = getelementptr inbounds i64, i64* %151, i64 %142
store i64 0, i64* %152
%153 = bitcast i64* %151 to i8*
store i8 1, i8* %13
br label %158
154: ; preds = %131
%155 = load i8*, i8** %14
%156 = load i64, i64* %10
%157 = getelementptr inbounds i8, i8* %155, i64 %156
store i8* %157, i8** %14
br label %158
158: ; preds = %150, %154, %118, %123
%159 = phi i8* [ %111, %118 ], [ %111, %123 ], [ %153, %150 ], [ %155, %154 ]
%160 = phi i64 [ %122, %118 ], [ %129, %123 ], [ %142, %150 ], [ %156, %154 ]
%161 = load i32, i32* %9
%162 = call i32 @asn1_ex_c2i(i32** %0, i8* %159, i64 %160, i32 %161, i8* %13, %struct.TYPE_12__* %3)
%163 = icmp eq i32 %162, 0
br i1 %163, label %166, label %164
164: ; preds = %158
%165 = load i8*, i8** %14
store i8* %165, i8** %1
br label %166
166: ; preds = %158, %114, %164, %140
%167 = phi i32 [ 1, %164 ], [ 0, %158 ], [ 0, %114 ], [ 0, %140 ]
%168 = load i8, i8* %13
%169 = icmp ne i8 %168, 0
%170 = load i64*, i64** %22
%171 = icmp ne i64* %170, null
%172 = select i1 %169, i1 %171, i1 false
br i1 %172, label %173, label %175
173: ; preds = %166
%174 = call i32 @free(i64* %170)
br label %175
175: ; preds = %166, %173, %74, %45, %52, %60, %146, %106, %84, %25
%176 = phi i32 [ 0, %106 ], [ 0, %146 ], [ 0, %84 ], [ 0, %25 ], [ 0, %60 ], [ 0, %52 ], [ 0, %45 ], [ %83, %74 ], [ %167, %173 ], [ %167, %166 ]
ret i32 %176
}