#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 /*<<< orphan*/ OPENSSL_free(scalar_t__ *);
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 **, long, int, int, char, TYPE_2__ *);
int /*<<< orphan*/ asn1_collect(TYPE_1__ *, unsigned char **, long, char, int,
                                unsigned char);
int /*<<< orphan*/ asn1_ex_c2i(int /*<<< orphan*/ **, unsigned char *, long,
                               int, char *, TYPE_3__ const *);
int asn1_d2i_ex_primitive(ASN1_VALUE **pval, 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;
  unsigned char *p;
  BUF_MEM buf;
  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;
  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_collect(NULL, &p, plen, inf, -1, -1))
        goto err;
      len = p - cont;
    } else {
      len = p - cont + plen;
      p += plen;
      buf.data = NULL;
    }
  } else if (cst) {
    buf.length = 0;
    buf.max = 0;
    buf.data = NULL;
    if (!asn1_collect(&buf, &p, plen, inf, -1, V_ASN1_UNIVERSAL))
      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 = (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)
    OPENSSL_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)
cmpq   $0x0,-0x20(%rbp)
jne    11ce <asn1_d2i_ex_primitive+0x6e>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
mov    0x2dbd(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    0x2dd4(%rip),%rcx
cmp    (%rcx),%rax
jne    11f7 <asn1_d2i_ex_primitive+0x97>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
jmp    1201 <asn1_d2i_ex_primitive+0xa1>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2d85(%rip),%rcx
cmp    (%rcx),%eax
jne    131c <asn1_d2i_ex_primitive+0x1bc>
cmpl   $0x0,-0x3c(%rbp)
jl     1240 <asn1_d2i_ex_primitive+0xe0>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
mov    0x2d9b(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
cmpb   $0x0,0x10(%rbp)
je     126d <asn1_d2i_ex_primitive+0x10d>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
mov    0x2d3e(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
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   1030 <asn1_check_tlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    12f2 <asn1_d2i_ex_primitive+0x192>
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
mov    0x2ce1(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
movzbl -0x89(%rbp),%eax
mov    0x2ca8(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     1317 <asn1_d2i_ex_primitive+0x1b7>
mov    0x2cc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
jmp    131c <asn1_d2i_ex_primitive+0x1bc>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1339 <asn1_d2i_ex_primitive+0x1d9>
mov    -0x48(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2c75(%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    13be <asn1_d2i_ex_primitive+0x25e>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
mov    0x2c15(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
cmpl   $0xffffffff,-0x44(%rbp)
jne    13d4 <asn1_d2i_ex_primitive+0x274>
movl   $0xffffffff,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
jmp    13d9 <asn1_d2i_ex_primitive+0x279>
mov    -0x48(%rbp),%eax
mov    0x2b9d(%rip),%rcx
cmp    (%rcx),%eax
je     140f <asn1_d2i_ex_primitive+0x2af>
mov    -0x48(%rbp),%eax
mov    0x2bab(%rip),%rcx
cmp    (%rcx),%eax
je     140f <asn1_d2i_ex_primitive+0x2af>
mov    -0x48(%rbp),%eax
mov    0x2bd1(%rip),%rcx
cmp    (%rcx),%eax
jne    14f8 <asn1_d2i_ex_primitive+0x398>
mov    -0x48(%rbp),%eax
mov    0x2bbf(%rip),%rcx
cmp    (%rcx),%eax
jne    143c <asn1_d2i_ex_primitive+0x2dc>
cmpq   $0x0,0x18(%rbp)
je     1437 <asn1_d2i_ex_primitive+0x2d7>
mov    0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    146e <asn1_d2i_ex_primitive+0x30e>
cmpb   $0x0,-0x51(%rbp)
jne    1469 <asn1_d2i_ex_primitive+0x309>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
mov    0x2b8a(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
jmp    146e <asn1_d2i_ex_primitive+0x30e>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
cmpb   $0x0,-0x52(%rbp)
je     14c9 <asn1_d2i_ex_primitive+0x369>
mov    -0x50(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%edi
lea    -0x60(%rbp),%rsi
mov    $0xffffffff,%r8d
mov    $0xff,%r9d
movsbl -0x52(%rbp),%ecx
call   1050 <asn1_collect@plt>
cmp    $0x0,%eax
jne    14b2 <asn1_d2i_ex_primitive+0x352>
jmp    1622 <asn1_d2i_ex_primitive+0x4c2>
mov    -0x60(%rbp),%rax
mov    -0x80(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x88(%rbp)
jmp    14f3 <asn1_d2i_ex_primitive+0x393>
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    15e3 <asn1_d2i_ex_primitive+0x483>
cmpb   $0x0,-0x51(%rbp)
je     15bf <asn1_d2i_ex_primitive+0x45f>
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
mov    -0x50(%rbp),%rdx
mov    -0x52(%rbp),%cl
lea    -0x78(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0xffffffff,%r8d
mov    0x2a72(%rip),%rax
movsbl %cl,%ecx
movzbl (%rax),%r9d
call   1050 <asn1_collect@plt>
cmp    $0x0,%eax
jne    1550 <asn1_d2i_ex_primitive+0x3f0>
jmp    1622 <asn1_d2i_ex_primitive+0x4c2>
mov    -0x78(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rsi
add    $0x1,%rsi
lea    -0x78(%rbp),%rdi
call   1070 <BUF_MEM_grow_clean@plt>
cmp    $0x0,%eax
jne    159b <asn1_d2i_ex_primitive+0x43b>
mov    0x2a69(%rip),%rax
mov    (%rax),%edi
mov    0x2a48(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1649 <asn1_d2i_ex_primitive+0x4e9>
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    15de <asn1_d2i_ex_primitive+0x47e>
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    15e3 <asn1_d2i_ex_primitive+0x483>
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   1060 <asn1_ex_c2i@plt>
cmp    $0x0,%eax
jne    1610 <asn1_d2i_ex_primitive+0x4b0>
jmp    1622 <asn1_d2i_ex_primitive+0x4c2>
mov    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x44(%rbp)
movsbl -0x53(%rbp),%eax
cmp    $0x0,%eax
je     1643 <asn1_d2i_ex_primitive+0x4e3>
cmpq   $0x0,-0x70(%rbp)
je     1643 <asn1_d2i_ex_primitive+0x4e3>
mov    -0x70(%rbp),%rdi
call   1080 <OPENSSL_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)
test   %rdi,%rdi
je     11c8 <asn1_d2i_ex_primitive+0x68>
mov    %r9d,%r15d
mov    %r8d,%r14d
mov    %rdx,%r13
mov    %rdi,%r12
mov    0x88(%rsp),%rbp
mov    0x80(%rsp),%bl
mov    (%rcx),%rax
mov    0x2e13(%rip),%rdx
cmp    (%rdx),%rax
jne    11dd <asn1_d2i_ex_primitive+0x7d>
mov    %r14d,0xc(%rsp)
mov    0x2de2(%rip),%rdx
mov    %r14d,%eax
cmp    %r14d,(%rdx)
mov    $0xffffffff,%r14d
jne    12c1 <asn1_d2i_ex_primitive+0x161>
mov    $0xffffffff,%r14d
jmp    120d <asn1_d2i_ex_primitive+0xad>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
mov    0x2da0(%rip),%rax
jmp    1336 <asn1_d2i_ex_primitive+0x1d6>
mov    0x8(%rcx),%eax
mov    %eax,0xc(%rsp)
mov    0x2da5(%rip),%rdx
cmp    (%rdx),%eax
jne    12c1 <asn1_d2i_ex_primitive+0x161>
test   %r14d,%r14d
js     120d <asn1_d2i_ex_primitive+0xad>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
mov    0x2dc0(%rip),%rax
jmp    1336 <asn1_d2i_ex_primitive+0x1d6>
test   %bl,%bl
je     1226 <asn1_d2i_ex_primitive+0xc6>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
mov    0x2d77(%rip),%rax
jmp    1336 <asn1_d2i_ex_primitive+0x1d6>
mov    %rcx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
sub    $0x8,%rsp
xor    %ebx,%ebx
lea    0x14(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x18(%rsp),%r9
xor    %edi,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
push   %rbp
push   $0x0
push   $0x0
push   $0xffffffffffffffff
push   %r13
call   1030 <asn1_check_tlen@plt>
add    $0x30,%rsp
test   %eax,%eax
je     127f <asn1_d2i_ex_primitive+0x11f>
mov    0x30(%rsp),%al
mov    0x2d33(%rip),%rcx
cmp    (%rcx),%al
jne    129b <asn1_d2i_ex_primitive+0x13b>
mov    0xc(%rsp),%eax
jmp    12a8 <asn1_d2i_ex_primitive+0x148>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
mov    0x2d31(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
jmp    133f <asn1_d2i_ex_primitive+0x1df>
mov    0x2d36(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x18(%rsp),%rsi
mov    0x88(%rsp),%rbp
mov    0x20(%rsp),%rcx
mov    0x80(%rsp),%bl
mov    %rcx,0x20(%rsp)
cmp    $0xffffffff,%r14d
mov    0x2cd7(%rip),%rcx
movzbl (%rcx),%ecx
cmove  %ecx,%r15d
cmovne %r14d,%eax
mov    %rsi,0x18(%rsp)
mov    (%rsi),%rcx
mov    %rcx,0x10(%rsp)
sub    $0x8,%rsp
movsbl %bl,%ebx
lea    0x30(%rsp),%rdi
lea    0x12(%rsp),%rcx
lea    0x13(%rsp),%r8
lea    0x18(%rsp),%r9
xor    %esi,%esi
xor    %edx,%edx
mov    %rbp,%r14
push   %rbp
push   %rbx
push   %r15
push   %rax
push   %r13
call   1030 <asn1_check_tlen@plt>
add    $0x30,%rsp
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     133f <asn1_d2i_ex_primitive+0x1df>
test   %ebx,%ebx
jne    1350 <asn1_d2i_ex_primitive+0x1f0>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
mov    0x2c8a(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc(%rsp),%eax
mov    0x2c25(%rip),%rdx
mov    0x2c76(%rip),%rcx
mov    (%rcx),%ecx
cmp    (%rdx),%eax
je     1403 <asn1_d2i_ex_primitive+0x2a3>
mov    0x2c2d(%rip),%rdx
cmp    (%rdx),%eax
je     1403 <asn1_d2i_ex_primitive+0x2a3>
cmp    %ecx,%eax
je     1403 <asn1_d2i_ex_primitive+0x2a3>
cmpb   $0x0,0xb(%rsp)
je     145e <asn1_d2i_ex_primitive+0x2fe>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x40(%rsp)
mov    0x28(%rsp),%rdx
movsbl 0xa(%rsp),%ecx
mov    0x2bf8(%rip),%rax
movzbl (%rax),%r9d
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0xffffffff,%r8d
call   1050 <asn1_collect@plt>
test   %eax,%eax
je     14c9 <asn1_d2i_ex_primitive+0x369>
mov    0x30(%rsp),%rbp
lea    0x1(%rbp),%rsi
lea    0x30(%rsp),%rdi
call   1070 <BUF_MEM_grow_clean@plt>
test   %eax,%eax
je     1501 <asn1_d2i_ex_primitive+0x3a1>
mov    0x38(%rsp),%r14
movq   $0x0,(%r14,%rbp,8)
movb   $0x1,0x9(%rsp)
jmp    1497 <asn1_d2i_ex_primitive+0x337>
cmp    %ecx,%eax
jne    1415 <asn1_d2i_ex_primitive+0x2b5>
test   %r14,%r14
je     1420 <asn1_d2i_ex_primitive+0x2c0>
movq   $0x0,(%r14)
jmp    1420 <asn1_d2i_ex_primitive+0x2c0>
cmpb   $0x0,0xb(%rsp)
je     14ec <asn1_d2i_ex_primitive+0x38c>
mov    0x18(%rsp),%rax
mov    (%rax),%r14
mov    0xa(%rsp),%al
test   %al,%al
je     1473 <asn1_d2i_ex_primitive+0x313>
mov    0x28(%rsp),%rdx
movsbl %al,%ecx
lea    0x10(%rsp),%rsi
xor    %edi,%edi
mov    $0xffffffff,%r8d
mov    $0xff,%r9d
call   1050 <asn1_collect@plt>
test   %eax,%eax
je     14c9 <asn1_d2i_ex_primitive+0x369>
mov    0x10(%rsp),%rbp
sub    %r14,%rbp
jmp    1497 <asn1_d2i_ex_primitive+0x337>
mov    0x10(%rsp),%r14
mov    0x28(%rsp),%rbp
lea    (%r14,%rbp,1),%rax
mov    %rax,0x10(%rsp)
jmp    1497 <asn1_d2i_ex_primitive+0x337>
mov    0x10(%rsp),%rax
mov    %rax,%rbp
sub    %r14,%rbp
mov    0x28(%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    %r14,%rsi
mov    %rbp,%rdx
mov    0x20(%rsp),%r9
call   1060 <asn1_ex_c2i@plt>
test   %eax,%eax
je     14c9 <asn1_d2i_ex_primitive+0x369>
mov    0x10(%rsp),%rax
mov    0x18(%rsp),%rcx
mov    %rax,(%rcx)
mov    $0x1,%ebx
cmpb   $0x0,0x9(%rsp)
je     133f <asn1_d2i_ex_primitive+0x1df>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     133f <asn1_d2i_ex_primitive+0x1df>
call   1080 <OPENSSL_free@plt>
jmp    133f <asn1_d2i_ex_primitive+0x1df>
mov    0x2af5(%rip),%rax
mov    (%rax),%edi
mov    0x2ae4(%rip),%rax
jmp    1336 <asn1_d2i_ex_primitive+0x1d6>
mov    0x2ae0(%rip),%rax
mov    (%rax),%edi
mov    0x2abf(%rip),%rax
jmp    1336 <asn1_d2i_ex_primitive+0x1d6>

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