#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;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ *member_1;
  int /*<<< orphan*/ member_0;
};
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*/ ASN1_R_TYPE_NOT_PRIMITIVE;
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 /*<<< orphan*/ OPENSSL_free(scalar_t__ *);
int V_ASN1_ANY;
int V_ASN1_BOOLEAN;
int V_ASN1_ENUMERATED;
int V_ASN1_INTEGER;
int V_ASN1_NULL;
int V_ASN1_OBJECT;
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 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 = {0, NULL, 0};
  const unsigned char *cont = NULL;
  long len;
  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;
    }
  } else if (cst) {
    if (utype == V_ASN1_NULL || utype == V_ASN1_BOOLEAN ||
        utype == V_ASN1_OBJECT || utype == V_ASN1_INTEGER ||
        utype == V_ASN1_ENUMERATED) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_PRIMITIVE);
      return 0;
    }
    free_cont = 1;
    if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL, 0)) {
      goto err;
    }
    len = buf.length;
    if (!BUF_MEM_grow_clean(&buf, len + 1)) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
      goto err;
    }
    buf.data[len] = 0;
    cont = (const unsigned char *)buf.data;
  } 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)
    OPENSSL_free(buf.data);
  return ret;
}


x86 assembly (clang, -O0):
<asn1_d2i_ex_primitive>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xc0,%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)
lea    -0x88(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movq   $0x0,-0x90(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1204 <asn1_d2i_ex_primitive+0x84>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
mov    0x2d57(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    0x2d7e(%rip),%rcx
cmp    (%rcx),%rax
jne    122d <asn1_d2i_ex_primitive+0xad>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
jmp    1237 <asn1_d2i_ex_primitive+0xb7>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2d1f(%rip),%rcx
cmp    (%rcx),%eax
jne    1352 <asn1_d2i_ex_primitive+0x1d2>
cmpl   $0x0,-0x3c(%rbp)
jl     1276 <asn1_d2i_ex_primitive+0xf6>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
mov    0x2d55(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
cmpb   $0x0,0x10(%rbp)
je     12a3 <asn1_d2i_ex_primitive+0x123>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
mov    0x2cd8(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
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    -0x99(%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   1030 <asn1_check_tlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    1328 <asn1_d2i_ex_primitive+0x1a8>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
mov    0x2c93(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
movzbl -0x99(%rbp),%eax
mov    0x2c52(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     134d <asn1_d2i_ex_primitive+0x1cd>
mov    0x2c90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
jmp    1352 <asn1_d2i_ex_primitive+0x1d2>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    136f <asn1_d2i_ex_primitive+0x1ef>
mov    -0x48(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2c1f(%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   1030 <asn1_check_tlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    13f4 <asn1_d2i_ex_primitive+0x274>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
mov    0x2bc7(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
cmpl   $0xffffffff,-0x44(%rbp)
jne    140a <asn1_d2i_ex_primitive+0x28a>
movl   $0xffffffff,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
jmp    140f <asn1_d2i_ex_primitive+0x28f>
movl   $0x0,-0x44(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2b30(%rip),%rcx
cmp    (%rcx),%eax
je     144c <asn1_d2i_ex_primitive+0x2cc>
mov    -0x48(%rbp),%eax
mov    0x2b3e(%rip),%rcx
cmp    (%rcx),%eax
je     144c <asn1_d2i_ex_primitive+0x2cc>
mov    -0x48(%rbp),%eax
mov    0x2b94(%rip),%rcx
cmp    (%rcx),%eax
jne    1526 <asn1_d2i_ex_primitive+0x3a6>
mov    -0x48(%rbp),%eax
mov    0x2b82(%rip),%rcx
cmp    (%rcx),%eax
jne    1479 <asn1_d2i_ex_primitive+0x2f9>
cmpq   $0x0,0x18(%rbp)
je     1474 <asn1_d2i_ex_primitive+0x2f4>
mov    0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    14ab <asn1_d2i_ex_primitive+0x32b>
cmpb   $0x0,-0x51(%rbp)
jne    14a6 <asn1_d2i_ex_primitive+0x326>
mov    0x2b5e(%rip),%rax
mov    (%rax),%edi
mov    0x2b4d(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
jmp    14ab <asn1_d2i_ex_primitive+0x32b>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
cmpb   $0x0,-0x52(%rbp)
je     14fc <asn1_d2i_ex_primitive+0x37c>
mov    -0x50(%rbp),%rsi
lea    -0x60(%rbp),%rdi
movsbl -0x52(%rbp),%edx
call   10a0 <asn1_find_end@plt>
cmp    $0x0,%eax
jne    14e2 <asn1_d2i_ex_primitive+0x362>
jmp    16c9 <asn1_d2i_ex_primitive+0x549>
mov    -0x60(%rbp),%rax
mov    -0x90(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x98(%rbp)
jmp    1521 <asn1_d2i_ex_primitive+0x3a1>
mov    -0x60(%rbp),%rax
mov    -0x90(%rbp),%rcx
sub    %rcx,%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x50(%rbp),%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    1687 <asn1_d2i_ex_primitive+0x507>
cmpb   $0x0,-0x51(%rbp)
je     1660 <asn1_d2i_ex_primitive+0x4e0>
mov    -0x48(%rbp),%eax
mov    0x2a3e(%rip),%rcx
cmp    (%rcx),%eax
je     158a <asn1_d2i_ex_primitive+0x40a>
mov    -0x48(%rbp),%eax
mov    0x2a34(%rip),%rcx
cmp    (%rcx),%eax
je     158a <asn1_d2i_ex_primitive+0x40a>
mov    -0x48(%rbp),%eax
mov    0x2a6a(%rip),%rcx
cmp    (%rcx),%eax
je     158a <asn1_d2i_ex_primitive+0x40a>
mov    -0x48(%rbp),%eax
mov    0x2a40(%rip),%rcx
cmp    (%rcx),%eax
je     158a <asn1_d2i_ex_primitive+0x40a>
mov    -0x48(%rbp),%eax
mov    0x2a16(%rip),%rcx
cmp    (%rcx),%eax
jne    15ad <asn1_d2i_ex_primitive+0x42d>
mov    0x2a57(%rip),%rax
mov    (%rax),%edi
mov    0x2a36(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    16f0 <asn1_d2i_ex_primitive+0x570>
movb   $0x1,-0x53(%rbp)
mov    -0x50(%rbp),%rdx
mov    -0x52(%rbp),%cl
lea    -0x88(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0xffffffff,%r8d
xor    %eax,%eax
mov    0x29b6(%rip),%rax
movsbl %cl,%ecx
movzbl (%rax),%r9d
movl   $0x0,(%rsp)
call   1060 <asn1_collect@plt>
cmp    $0x0,%eax
jne    15f3 <asn1_d2i_ex_primitive+0x473>
jmp    16c9 <asn1_d2i_ex_primitive+0x549>
mov    -0x88(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rsi
add    $0x1,%rsi
lea    -0x88(%rbp),%rdi
call   1080 <BUF_MEM_grow_clean@plt>
cmp    $0x0,%eax
jne    163d <asn1_d2i_ex_primitive+0x4bd>
mov    0x29c0(%rip),%rax
mov    (%rax),%edi
mov    0x298f(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
jmp    16c9 <asn1_d2i_ex_primitive+0x549>
mov    -0x80(%rbp),%rax
mov    -0x98(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x80(%rbp),%rax
mov    %rax,-0x90(%rbp)
jmp    1682 <asn1_d2i_ex_primitive+0x502>
mov    -0x60(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x50(%rbp),%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    1687 <asn1_d2i_ex_primitive+0x507>
mov    -0x20(%rbp),%rdi
mov    -0x90(%rbp),%rsi
mov    -0x98(%rbp),%rdx
mov    -0x48(%rbp),%ecx
mov    -0x38(%rbp),%r9
lea    -0x53(%rbp),%r8
call   1070 <asn1_ex_c2i@plt>
cmp    $0x0,%eax
jne    16b7 <asn1_d2i_ex_primitive+0x537>
jmp    16c9 <asn1_d2i_ex_primitive+0x549>
mov    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x44(%rbp)
movsbl -0x53(%rbp),%eax
cmp    $0x0,%eax
je     16ea <asn1_d2i_ex_primitive+0x56a>
cmpq   $0x0,-0x80(%rbp)
je     16ea <asn1_d2i_ex_primitive+0x56a>
mov    -0x80(%rbp),%rdi
call   1090 <OPENSSL_free@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xc0,%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    $0x58,%rsp
movb   $0x0,0x9(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x50(%rsp)
test   %rdi,%rdi
je     11ee <asn1_d2i_ex_primitive+0x7e>
mov    %r9d,%r15d
mov    %r8d,%r14d
mov    %rdx,%r13
mov    %rdi,%r12
mov    0x98(%rsp),%r10
mov    0x90(%rsp),%bl
mov    (%rcx),%rax
mov    0x2dcd(%rip),%rdx
cmp    (%rdx),%rax
jne    1203 <asn1_d2i_ex_primitive+0x93>
mov    %r14d,0xc(%rsp)
mov    0x2d8c(%rip),%rdx
mov    %r14d,%eax
cmp    %r14d,(%rdx)
mov    $0xffffffff,%r14d
jne    12e8 <asn1_d2i_ex_primitive+0x178>
mov    $0xffffffff,%r14d
jmp    1233 <asn1_d2i_ex_primitive+0xc3>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
mov    0x2d4a(%rip),%rax
jmp    135e <asn1_d2i_ex_primitive+0x1ee>
mov    0x8(%rcx),%eax
mov    %eax,0xc(%rsp)
mov    0x2d4f(%rip),%rdx
cmp    (%rdx),%eax
jne    12e8 <asn1_d2i_ex_primitive+0x178>
test   %r14d,%r14d
js     1233 <asn1_d2i_ex_primitive+0xc3>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
mov    0x2d8a(%rip),%rax
jmp    135e <asn1_d2i_ex_primitive+0x1ee>
test   %bl,%bl
je     124c <asn1_d2i_ex_primitive+0xdc>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
mov    0x2d21(%rip),%rax
jmp    135e <asn1_d2i_ex_primitive+0x1ee>
mov    %rcx,0x28(%rsp)
mov    %rsi,0x20(%rsp)
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
sub    $0x8,%rsp
xor    %ebp,%ebp
lea    0x14(%rsp),%rsi
lea    0x20(%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   1030 <asn1_check_tlen@plt>
add    $0x30,%rsp
test   %eax,%eax
je     12a6 <asn1_d2i_ex_primitive+0x136>
mov    0x18(%rsp),%al
mov    0x2cec(%rip),%rcx
cmp    (%rcx),%al
jne    12c2 <asn1_d2i_ex_primitive+0x152>
mov    0xc(%rsp),%eax
jmp    12cf <asn1_d2i_ex_primitive+0x15f>
mov    0x2d3b(%rip),%rax
mov    (%rax),%edi
mov    0x2cf2(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
jmp    1367 <asn1_d2i_ex_primitive+0x1f7>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x20(%rsp),%rsi
mov    0x98(%rsp),%r10
mov    0x28(%rsp),%rcx
mov    0x90(%rsp),%bl
mov    %rcx,0x28(%rsp)
cmp    $0xffffffff,%r14d
mov    0x2c90(%rip),%rcx
movzbl (%rcx),%ecx
cmove  %ecx,%r15d
cmovne %r14d,%eax
mov    %rsi,0x20(%rsp)
mov    (%rsi),%rcx
mov    %rcx,0x10(%rsp)
sub    $0x8,%rsp
movsbl %bl,%ebp
lea    0x20(%rsp),%rdi
lea    0x12(%rsp),%rcx
lea    0x13(%rsp),%r8
lea    0x18(%rsp),%r9
xor    %esi,%esi
xor    %edx,%edx
mov    %r10,%r14
push   %r10
push   %rbp
push   %r15
push   %rax
push   %r13
call   1030 <asn1_check_tlen@plt>
add    $0x30,%rsp
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     1367 <asn1_d2i_ex_primitive+0x1f7>
test   %ebp,%ebp
jne    1378 <asn1_d2i_ex_primitive+0x208>
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc(%rsp),%eax
mov    0x2bcd(%rip),%rdx
mov    0x2c4e(%rip),%rcx
mov    (%rcx),%ecx
cmp    (%rdx),%eax
je     1472 <asn1_d2i_ex_primitive+0x302>
mov    0x2bd5(%rip),%rdx
cmp    (%rdx),%eax
je     1472 <asn1_d2i_ex_primitive+0x302>
cmp    %ecx,%eax
je     1472 <asn1_d2i_ex_primitive+0x302>
cmpb   $0x0,0xb(%rsp)
je     14c3 <asn1_d2i_ex_primitive+0x353>
mov    0x2bbb(%rip),%rcx
cmp    (%rcx),%eax
je     14d3 <asn1_d2i_ex_primitive+0x363>
mov    0x2bb4(%rip),%rcx
cmp    (%rcx),%eax
je     14d3 <asn1_d2i_ex_primitive+0x363>
mov    0x2bed(%rip),%rcx
cmp    (%rcx),%eax
je     14d3 <asn1_d2i_ex_primitive+0x363>
mov    0x2bc6(%rip),%rcx
cmp    (%rcx),%eax
je     14d3 <asn1_d2i_ex_primitive+0x363>
mov    0x2b9f(%rip),%rcx
cmp    (%rcx),%eax
je     14d3 <asn1_d2i_ex_primitive+0x363>
movb   $0x1,0x9(%rsp)
mov    0x18(%rsp),%rdx
movsbl 0xa(%rsp),%ecx
mov    0x2b71(%rip),%rax
movzbl (%rax),%r9d
sub    $0x8,%rsp
lea    0x38(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    $0xffffffff,%r8d
push   $0x0
call   1050 <asn1_collect@plt>
add    $0x10,%rsp
xor    %ebp,%ebp
test   %eax,%eax
je     1543 <asn1_d2i_ex_primitive+0x3d3>
mov    0x30(%rsp),%rbx
lea    0x1(%rbx),%rsi
lea    0x30(%rsp),%rdi
call   1070 <BUF_MEM_grow_clean@plt>
test   %eax,%eax
je     157b <asn1_d2i_ex_primitive+0x40b>
mov    0x38(%rsp),%rbp
movq   $0x0,0x0(%rbp,%rbx,8)
jmp    1503 <asn1_d2i_ex_primitive+0x393>
cmp    %ecx,%eax
jne    1484 <asn1_d2i_ex_primitive+0x314>
test   %r14,%r14
je     148f <asn1_d2i_ex_primitive+0x31f>
movq   $0x0,(%r14)
jmp    148f <asn1_d2i_ex_primitive+0x31f>
cmpb   $0x0,0xb(%rsp)
je     1566 <asn1_d2i_ex_primitive+0x3f6>
mov    0x20(%rsp),%rax
mov    (%rax),%rbp
mov    0xa(%rsp),%al
test   %al,%al
je     14e8 <asn1_d2i_ex_primitive+0x378>
mov    0x18(%rsp),%rsi
movsbl %al,%edx
lea    0x10(%rsp),%rdi
call   1090 <asn1_find_end@plt>
test   %eax,%eax
je     1541 <asn1_d2i_ex_primitive+0x3d1>
mov    0x10(%rsp),%rbx
sub    %rbp,%rbx
jmp    1503 <asn1_d2i_ex_primitive+0x393>
mov    0x10(%rsp),%rbp
mov    0x18(%rsp),%rbx
lea    (%rbx,%rbp,1),%rax
jmp    14fe <asn1_d2i_ex_primitive+0x38e>
mov    0x2b0e(%rip),%rax
mov    (%rax),%edi
mov    0x2aed(%rip),%rax
jmp    135e <asn1_d2i_ex_primitive+0x1ee>
mov    0x10(%rsp),%rax
mov    %rax,%rbx
sub    %rbp,%rbx
mov    0x18(%rsp),%rcx
add    %rcx,%rbx
add    %rcx,%rax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%ecx
lea    0x9(%rsp),%r8
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    0x28(%rsp),%r9
call   1060 <asn1_ex_c2i@plt>
test   %eax,%eax
je     1541 <asn1_d2i_ex_primitive+0x3d1>
mov    0x10(%rsp),%rax
mov    0x20(%rsp),%rcx
mov    %rax,(%rcx)
mov    $0x1,%ebp
cmpb   $0x0,0x9(%rsp)
jne    154e <asn1_d2i_ex_primitive+0x3de>
jmp    1367 <asn1_d2i_ex_primitive+0x1f7>
xor    %ebp,%ebp
cmpb   $0x0,0x9(%rsp)
je     1367 <asn1_d2i_ex_primitive+0x1f7>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     1367 <asn1_d2i_ex_primitive+0x1f7>
call   1080 <OPENSSL_free@plt>
jmp    1367 <asn1_d2i_ex_primitive+0x1f7>
mov    0x2a7b(%rip),%rax
mov    (%rax),%edi
mov    0x2a6a(%rip),%rax
jmp    135e <asn1_d2i_ex_primitive+0x1ee>
mov    0x2a66(%rip),%rax
mov    (%rax),%edi
mov    0x2a35(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
cmpb   $0x0,0x9(%rsp)
jne    154e <asn1_d2i_ex_primitive+0x3de>
jmp    1367 <asn1_d2i_ex_primitive+0x1f7>

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

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