#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_3;
  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 */
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*/ BUF_MEM_grow_clean(TYPE_1__ *, long);
int /*<<< orphan*/ ERR_LIB_ASN1;
int /*<<< orphan*/ ERR_R_MALLOC_FAILURE;
int /*<<< orphan*/ ERR_R_NESTED_ASN1_ERROR;
int /*<<< orphan*/ ERR_raise(int /*<<< orphan*/, int /*<<< orphan*/);
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, 0};
  const unsigned char *cont = NULL;
  long len;
  if (pval == NULL) {
    ERR_raise(ERR_LIB_ASN1, 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) {
      ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_TAGGED_ANY);
      return 0;
    }
    if (opt) {
      ERR_raise(ERR_LIB_ASN1, 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) {
      ERR_raise(ERR_LIB_ASN1, 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) {
    ERR_raise(ERR_LIB_ASN1, 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) {
      do {
        if ((ctx) != NULL)
          (ctx)->valid = 0;
      } while (0);
    } else if (!cst) {
      ERR_raise(ERR_LIB_ASN1, 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) {
      ERR_raise(ERR_LIB_ASN1, 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)) {
      ERR_raise(ERR_LIB_ASN1, 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)
    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   1040 <memset@plt>
movq   $0x0,-0x90(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1204 <asn1_d2i_ex_primitive+0x84>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    0x2d57(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
movl   $0x0,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
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    0x2d66(%rip),%rax
mov    (%rax),%edi
mov    0x2d55(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
movl   $0x0,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
cmpb   $0x0,0x10(%rbp)
je     12a3 <asn1_d2i_ex_primitive+0x123>
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
mov    0x2cd8(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
movl   $0x0,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
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    0x2cb4(%rip),%rax
mov    (%rax),%edi
mov    0x2c93(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
movl   $0x0,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
movzbl -0x99(%rbp),%eax
mov    0x2c52(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     134d <asn1_d2i_ex_primitive+0x1cd>
mov    0x2c98(%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    0x2be8(%rip),%rax
mov    (%rax),%edi
mov    0x2bc7(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
movl   $0x0,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
cmpl   $0xffffffff,-0x44(%rbp)
jne    140a <asn1_d2i_ex_primitive+0x28a>
movl   $0xffffffff,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
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    0x2b9c(%rip),%rcx
cmp    (%rcx),%eax
jne    1530 <asn1_d2i_ex_primitive+0x3b0>
mov    -0x48(%rbp),%eax
mov    0x2b8a(%rip),%rcx
cmp    (%rcx),%eax
jne    1483 <asn1_d2i_ex_primitive+0x303>
jmp    1463 <asn1_d2i_ex_primitive+0x2e3>
cmpq   $0x0,0x18(%rbp)
je     1479 <asn1_d2i_ex_primitive+0x2f9>
mov    0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    147e <asn1_d2i_ex_primitive+0x2fe>
jmp    14b5 <asn1_d2i_ex_primitive+0x335>
cmpb   $0x0,-0x51(%rbp)
jne    14b0 <asn1_d2i_ex_primitive+0x330>
mov    0x2b2c(%rip),%rax
mov    (%rax),%edi
mov    0x2b4b(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
movl   $0x0,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
jmp    14b5 <asn1_d2i_ex_primitive+0x335>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
cmpb   $0x0,-0x52(%rbp)
je     1506 <asn1_d2i_ex_primitive+0x386>
mov    -0x50(%rbp),%rsi
lea    -0x60(%rbp),%rdi
movsbl -0x52(%rbp),%edx
call   10a0 <asn1_find_end@plt>
cmp    $0x0,%eax
jne    14ec <asn1_d2i_ex_primitive+0x36c>
jmp    16d3 <asn1_d2i_ex_primitive+0x553>
mov    -0x60(%rbp),%rax
mov    -0x90(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x98(%rbp)
jmp    152b <asn1_d2i_ex_primitive+0x3ab>
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    1691 <asn1_d2i_ex_primitive+0x511>
cmpb   $0x0,-0x51(%rbp)
je     166a <asn1_d2i_ex_primitive+0x4ea>
mov    -0x48(%rbp),%eax
mov    0x2a34(%rip),%rcx
cmp    (%rcx),%eax
je     1594 <asn1_d2i_ex_primitive+0x414>
mov    -0x48(%rbp),%eax
mov    0x2a2a(%rip),%rcx
cmp    (%rcx),%eax
je     1594 <asn1_d2i_ex_primitive+0x414>
mov    -0x48(%rbp),%eax
mov    0x2a68(%rip),%rcx
cmp    (%rcx),%eax
je     1594 <asn1_d2i_ex_primitive+0x414>
mov    -0x48(%rbp),%eax
mov    0x2a36(%rip),%rcx
cmp    (%rcx),%eax
je     1594 <asn1_d2i_ex_primitive+0x414>
mov    -0x48(%rbp),%eax
mov    0x2a0c(%rip),%rcx
cmp    (%rcx),%eax
jne    15b7 <asn1_d2i_ex_primitive+0x437>
mov    0x2a25(%rip),%rax
mov    (%rax),%edi
mov    0x2a34(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
movl   $0x0,-0x14(%rbp)
jmp    16ec <asn1_d2i_ex_primitive+0x56c>
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    0x29ac(%rip),%rax
movsbl %cl,%ecx
movzbl (%rax),%r9d
movl   $0x0,(%rsp)
call   1050 <asn1_collect@plt>
cmp    $0x0,%eax
jne    15fd <asn1_d2i_ex_primitive+0x47d>
jmp    16d3 <asn1_d2i_ex_primitive+0x553>
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    1647 <asn1_d2i_ex_primitive+0x4c7>
mov    0x298e(%rip),%rax
mov    (%rax),%edi
mov    0x298d(%rip),%rax
mov    (%rax),%esi
call   1060 <ERR_raise@plt>
jmp    16d3 <asn1_d2i_ex_primitive+0x553>
mov    -0x80(%rbp),%rax
mov    -0x98(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x80(%rbp),%rax
mov    %rax,-0x90(%rbp)
jmp    168c <asn1_d2i_ex_primitive+0x50c>
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    1691 <asn1_d2i_ex_primitive+0x511>
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    16c1 <asn1_d2i_ex_primitive+0x541>
jmp    16d3 <asn1_d2i_ex_primitive+0x553>
mov    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x44(%rbp)
cmpb   $0x0,-0x53(%rbp)
je     16e6 <asn1_d2i_ex_primitive+0x566>
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    0x2dcb(%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    0x2d9b(%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    0x2d82(%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    0x2d13(%rip),%rax
mov    (%rax),%edi
mov    0x2cf2(%rip),%rax
mov    (%rax),%esi
call   1050 <ERR_raise@plt>
jmp    1367 <asn1_d2i_ex_primitive+0x1f7>
mov    0x2d17(%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    0x2c6b(%rip),%rax
mov    (%rax),%edi
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
call   1050 <ERR_raise@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    0x2c56(%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    0x2bf5(%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   1040 <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     1572 <asn1_d2i_ex_primitive+0x402>
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     155d <asn1_d2i_ex_primitive+0x3ed>
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    0x2ae6(%rip),%rax
mov    (%rax),%edi
mov    0x2af5(%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
call   1080 <OPENSSL_free@plt>
jmp    1367 <asn1_d2i_ex_primitive+0x1f7>
mov    0x2a5c(%rip),%rax
mov    (%rax),%edi
mov    0x2a7b(%rip),%rax
jmp    135e <asn1_d2i_ex_primitive+0x1ee>
mov    0x2a47(%rip),%rax
mov    (%rax),%edi
mov    0x2a46(%rip),%rax
mov    (%rax),%esi
call   1050 <ERR_raise@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*, i32 }
@ERR_LIB_ASN1 = 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 eq i32** %30, null
br i1 %31, label %32, label %36
32: ; preds = %8
%33 = load i32, i32* @ERR_LIB_ASN1
%34 = load i32, i32* @ASN1_R_ILLEGAL_NULL
%35 = call i32 @ERR_raise(i32 %33, i32 %34)
store i32 0, i32* %9
br label %257
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* @ERR_LIB_ASN1
%57 = load i32, i32* @ASN1_R_ILLEGAL_TAGGED_ANY
%58 = call i32 @ERR_raise(i32 %56, i32 %57)
store i32 0, i32* %9
br label %257
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* @ERR_LIB_ASN1
%64 = load i32, i32* @ASN1_R_ILLEGAL_OPTIONAL_ANY
%65 = call i32 @ERR_raise(i32 %63, i32 %64)
store i32 0, i32* %9
br label %257
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* @ERR_LIB_ASN1
%76 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%77 = call i32 @ERR_raise(i32 %75, i32 %76)
store i32 0, i32* %9
br label %257
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* @ERR_LIB_ASN1
%107 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%108 = call i32 @ERR_raise(i32 %106, i32 %107)
store i32 0, i32* %9
br label %257
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 %257
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 %176
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 %139
130: ; preds = %126
br label %131
131: ; preds = %130
%132 = load %struct.TYPE_11__*, %struct.TYPE_11__** %17
%133 = icmp ne %struct.TYPE_11__* %132, null
br i1 %133, label %134, label %137
134: ; preds = %131
%135 = load %struct.TYPE_11__*, %struct.TYPE_11__** %17
%136 = getelementptr inbounds %struct.TYPE_11__, %struct.TYPE_11__* %135, i32 0, i32 0
store i64 0, i64* %136
br label %137
137: ; preds = %134, %131
br label %138
138: ; preds = %137
br label %147
139: ; preds = %126
%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* @ERR_LIB_ASN1
%144 = load i32, i32* @ASN1_R_TYPE_NOT_CONSTRUCTED
%145 = call i32 @ERR_raise(i32 %143, i32 %144)
store i32 0, i32* %9
br label %257
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 %248
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 %175
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
br label %175
175: ; preds = %164, %158
br label %236
176: ; preds = %122
%177 = load i8, i8* %21
%178 = icmp ne i8 %177, 0
br i1 %178, label %179, label %229
179: ; preds = %176
%180 = load i32, i32* %19
%181 = load i32, i32* @V_ASN1_NULL
%182 = icmp eq i32 %180, %181
br i1 %182, label %199, label %183
183: ; preds = %179
%184 = load i32, i32* %19
%185 = load i32, i32* @V_ASN1_BOOLEAN
%186 = icmp eq i32 %184, %185
br i1 %186, label %199, label %187
187: ; preds = %183
%188 = load i32, i32* %19
%189 = load i32, i32* @V_ASN1_OBJECT
%190 = icmp eq i32 %188, %189
br i1 %190, label %199, label %191
191: ; preds = %187
%192 = load i32, i32* %19
%193 = load i32, i32* @V_ASN1_INTEGER
%194 = icmp eq i32 %192, %193
br i1 %194, label %199, label %195
195: ; preds = %191
%196 = load i32, i32* %19
%197 = load i32, i32* @V_ASN1_ENUMERATED
%198 = icmp eq i32 %196, %197
br i1 %198, label %199, label %203
199: ; preds = %195, %191, %187, %183, %179
%200 = load i32, i32* @ERR_LIB_ASN1
%201 = load i32, i32* @ASN1_R_TYPE_NOT_PRIMITIVE
%202 = call i32 @ERR_raise(i32 %200, i32 %201)
store i32 0, i32* %9
br label %257
203: ; preds = %195
store i8 1, i8* %23
%204 = load i64, i64* %20
%205 = load i8, i8* %22
%206 = load i8, i8* @V_ASN1_UNIVERSAL
%207 = call i32 @asn1_collect(%struct.TYPE_10__* %25, i8** %24, i64 %204, i8 signext %205, i32 -1, i8 zeroext %206, i32 0)
%208 = icmp ne i32 %207, 0
br i1 %208, label %210, label %209
209: ; preds = %203
br label %248
210: ; preds = %203
%211 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 0
%212 = load i64, i64* %211
store i64 %212, i64* %27
%213 = load i64, i64* %27
%214 = add nsw i64 %213, 1
%215 = call i32 @BUF_MEM_grow_clean(%struct.TYPE_10__* %25, i64 %214)
%216 = icmp ne i32 %215, 0
br i1 %216, label %221, label %217
217: ; preds = %210
%218 = load i32, i32* @ERR_LIB_ASN1
%219 = load i32, i32* @ERR_R_MALLOC_FAILURE
%220 = call i32 @ERR_raise(i32 %218, i32 %219)
br label %248
221: ; preds = %210
%222 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
%223 = load i64*, i64** %222
%224 = load i64, i64* %27
%225 = getelementptr inbounds i64, i64* %223, i64 %224
store i64 0, i64* %225
%226 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
%227 = load i64*, i64** %226
%228 = bitcast i64* %227 to i8*
store i8* %228, i8** %26
br label %235
229: ; preds = %176
%230 = load i8*, i8** %24
store i8* %230, i8** %26
%231 = load i64, i64* %20
store i64 %231, i64* %27
%232 = load i64, i64* %20
%233 = load i8*, i8** %24
%234 = getelementptr inbounds i8, i8* %233, i64 %232
store i8* %234, i8** %24
br label %235
235: ; preds = %229, %221
br label %236
236: ; preds = %235, %175
%237 = load i32**, i32*** %10
%238 = load i8*, i8** %26
%239 = load i64, i64* %27
%240 = load i32, i32* %19
%241 = load %struct.TYPE_12__*, %struct.TYPE_12__** %13
%242 = call i32 @asn1_ex_c2i(i32** %237, i8* %238, i64 %239, i32 %240, i8* %23, %struct.TYPE_12__* %241)
%243 = icmp ne i32 %242, 0
br i1 %243, label %245, label %244
244: ; preds = %236
br label %248
245: ; preds = %236
%246 = load i8*, i8** %24
%247 = load i8**, i8*** %11
store i8* %246, i8** %247
store i32 1, i32* %18
br label %248
248: ; preds = %245, %244, %217, %209, %157
%249 = load i8, i8* %23
%250 = icmp ne i8 %249, 0
br i1 %250, label %251, label %255
251: ; preds = %248
%252 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %25, i32 0, i32 1
%253 = load i64*, i64** %252
%254 = call i32 @OPENSSL_free(i64* %253)
br label %255
255: ; preds = %251, %248
%256 = load i32, i32* %18
store i32 %256, i32* %9
br label %257
257: ; preds = %255, %199, %142, %112, %105, %74, %62, %55, %32
%258 = load i32, i32* %9
ret i32 %258
}

LLVM IR (-O2):
%struct.TYPE_12__ = type { i64, i32 }
%struct.TYPE_11__ = type { i64 }
%struct.TYPE_10__ = type { i64, i64*, i32, i32, i32*, i32 }
@ERR_LIB_ASN1 = 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* @ERR_LIB_ASN1
%24 = load i32, i32* @ASN1_R_ILLEGAL_NULL
%25 = tail call i32 @ERR_raise(i32 %23, i32 %24)
br label %191
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* @ERR_LIB_ASN1
%44 = load i32, i32* @ASN1_R_ILLEGAL_TAGGED_ANY
%45 = tail call i32 @ERR_raise(i32 %43, i32 %44)
br label %191
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* @ERR_LIB_ASN1
%51 = load i32, i32* @ASN1_R_ILLEGAL_OPTIONAL_ANY
%52 = tail call i32 @ERR_raise(i32 %50, i32 %51)
br label %191
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* @ERR_LIB_ASN1
%59 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%60 = call i32 @ERR_raise(i32 %58, i32 %59)
br label %191
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 %191
]
81: ; preds = %71
%82 = load i32, i32* @ERR_LIB_ASN1
%83 = load i32, i32* @ERR_R_NESTED_ASN1_ERROR
%84 = call i32 @ERR_raise(i32 %82, i32 %83)
br label %191
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* @ERR_LIB_ASN1
%105 = load i32, i32* @ASN1_R_TYPE_NOT_CONSTRUCTED
%106 = call i32 @ERR_raise(i32 %104, i32 %105)
br label %191
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* @ERR_LIB_ASN1
%148 = load i32, i32* @ASN1_R_TYPE_NOT_PRIMITIVE
%149 = call i32 @ERR_raise(i32 %147, i32 %148)
br label %191
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* @ERR_LIB_ASN1
%164 = load i32, i32* @ERR_R_MALLOC_FAILURE
%165 = call i32 @ERR_raise(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 eq i8 %185, 0
br i1 %186, label %191, label %187
187: ; preds = %183
%188 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %15, i64 0, i32 1
%189 = load i64*, i64** %188
%190 = call i32 @OPENSSL_free(i64* %189)
br label %191
191: ; preds = %183, %187, %71, %42, %49, %57, %146, %103, %81, %22
%192 = phi i32 [ 0, %22 ], [ 0, %103 ], [ 0, %146 ], [ 0, %81 ], [ 0, %57 ], [ 0, %49 ], [ 0, %42 ], [ %80, %71 ], [ %184, %187 ], [ %184, %183 ]
ret i32 %192
}