#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 const **, long, int, int, char, TYPE_2__ *);
int /*<<< orphan*/ asn1_collect(TYPE_1__ *, unsigned char const **, long, char,
                                int, unsigned char);
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;
  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;
      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)) {
      free_cont = 1;
      goto err;
    }
    len = buf.length;
    if (!BUF_MEM_grow_clean(&buf, len + 1)) {
      ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ERR_R_MALLOC_FAILURE);
      return 0;
    }
    buf.data[len] = 0;
    cont = (const unsigned char *)buf.data;
    free_cont = 1;
  } else {
    cont = p;
    len = plen;
    p += plen;
  }
  if (!asn1_ex_c2i(pval, cont, len, utype, &free_cont, it))
    goto err;
  *in = p;
  ret = 1;
err:
  if (free_cont && buf.data)
    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    11de <asn1_d2i_ex_primitive+0x6e>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
mov    0x2dad(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    0x2dc4(%rip),%rcx
cmp    (%rcx),%rax
jne    1207 <asn1_d2i_ex_primitive+0x97>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
jmp    1211 <asn1_d2i_ex_primitive+0xa1>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2d75(%rip),%rcx
cmp    (%rcx),%eax
jne    132c <asn1_d2i_ex_primitive+0x1bc>
cmpl   $0x0,-0x3c(%rbp)
jl     1250 <asn1_d2i_ex_primitive+0xe0>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
mov    0x2d8b(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
cmpb   $0x0,0x10(%rbp)
je     127d <asn1_d2i_ex_primitive+0x10d>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
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    1302 <asn1_d2i_ex_primitive+0x192>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
mov    0x2cd1(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
movzbl -0x89(%rbp),%eax
mov    0x2c98(%rip),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
je     1327 <asn1_d2i_ex_primitive+0x1b7>
mov    0x2cb6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
jmp    132c <asn1_d2i_ex_primitive+0x1bc>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1349 <asn1_d2i_ex_primitive+0x1d9>
mov    -0x48(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2c65(%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    13ce <asn1_d2i_ex_primitive+0x25e>
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
mov    0x2c05(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
cmpl   $0xffffffff,-0x44(%rbp)
jne    13e4 <asn1_d2i_ex_primitive+0x274>
movl   $0xffffffff,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
jmp    13e9 <asn1_d2i_ex_primitive+0x279>
movl   $0x0,-0x44(%rbp)
mov    -0x48(%rbp),%eax
mov    0x2b86(%rip),%rcx
cmp    (%rcx),%eax
je     1426 <asn1_d2i_ex_primitive+0x2b6>
mov    -0x48(%rbp),%eax
mov    0x2b94(%rip),%rcx
cmp    (%rcx),%eax
je     1426 <asn1_d2i_ex_primitive+0x2b6>
mov    -0x48(%rbp),%eax
mov    0x2bba(%rip),%rcx
cmp    (%rcx),%eax
jne    14ff <asn1_d2i_ex_primitive+0x38f>
mov    -0x48(%rbp),%eax
mov    0x2ba8(%rip),%rcx
cmp    (%rcx),%eax
jne    1453 <asn1_d2i_ex_primitive+0x2e3>
cmpq   $0x0,0x18(%rbp)
je     144e <asn1_d2i_ex_primitive+0x2de>
mov    0x18(%rbp),%rax
movq   $0x0,(%rax)
jmp    1485 <asn1_d2i_ex_primitive+0x315>
cmpb   $0x0,-0x51(%rbp)
jne    1480 <asn1_d2i_ex_primitive+0x310>
mov    0x2b84(%rip),%rax
mov    (%rax),%edi
mov    0x2b73(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
jmp    1485 <asn1_d2i_ex_primitive+0x315>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
cmpb   $0x0,-0x52(%rbp)
je     14d0 <asn1_d2i_ex_primitive+0x360>
mov    -0x50(%rbp),%rsi
lea    -0x60(%rbp),%rdi
movsbl -0x52(%rbp),%edx
call   1090 <asn1_find_end@plt>
cmp    $0x0,%eax
jne    14b9 <asn1_d2i_ex_primitive+0x349>
jmp    162d <asn1_d2i_ex_primitive+0x4bd>
mov    -0x60(%rbp),%rax
mov    -0x80(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x88(%rbp)
jmp    14fa <asn1_d2i_ex_primitive+0x38a>
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    15ee <asn1_d2i_ex_primitive+0x47e>
cmpb   $0x0,-0x51(%rbp)
je     15ca <asn1_d2i_ex_primitive+0x45a>
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    0x2a6b(%rip),%rax
movsbl %cl,%ecx
movzbl (%rax),%r9d
call   1050 <asn1_collect@plt>
cmp    $0x0,%eax
jne    155b <asn1_d2i_ex_primitive+0x3eb>
movb   $0x1,-0x53(%rbp)
jmp    162d <asn1_d2i_ex_primitive+0x4bd>
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    15a6 <asn1_d2i_ex_primitive+0x436>
mov    0x2a5e(%rip),%rax
mov    (%rax),%edi
mov    0x2a3d(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
movl   $0x0,-0x14(%rbp)
jmp    1654 <asn1_d2i_ex_primitive+0x4e4>
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    15e9 <asn1_d2i_ex_primitive+0x479>
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    15ee <asn1_d2i_ex_primitive+0x47e>
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    161b <asn1_d2i_ex_primitive+0x4ab>
jmp    162d <asn1_d2i_ex_primitive+0x4bd>
mov    -0x60(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x44(%rbp)
movsbl -0x53(%rbp),%eax
cmp    $0x0,%eax
je     164e <asn1_d2i_ex_primitive+0x4de>
cmpq   $0x0,-0x70(%rbp)
je     164e <asn1_d2i_ex_primitive+0x4de>
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     11d3 <asn1_d2i_ex_primitive+0x63>
mov    %r9d,%r15d
mov    %r8d,%ebp
mov    %rdx,%r13
mov    %rdi,%r12
mov    0x88(%rsp),%r10
mov    0x80(%rsp),%bl
mov    (%rcx),%rax
mov    0x2e03(%rip),%rdx
cmp    (%rdx),%rax
jne    11e8 <asn1_d2i_ex_primitive+0x78>
mov    %ebp,0xc(%rsp)
mov    0x2dd3(%rip),%rdx
mov    %ebp,%eax
cmp    %ebp,(%rdx)
mov    $0xffffffff,%ebp
jne    12cd <asn1_d2i_ex_primitive+0x15d>
mov    $0xffffffff,%ebp
jmp    1217 <asn1_d2i_ex_primitive+0xa7>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
mov    0x2d95(%rip),%rax
jmp    1340 <asn1_d2i_ex_primitive+0x1d0>
mov    0x8(%rcx),%eax
mov    %eax,0xc(%rsp)
mov    0x2d9a(%rip),%rdx
cmp    (%rdx),%eax
jne    12cd <asn1_d2i_ex_primitive+0x15d>
test   %ebp,%ebp
js     1217 <asn1_d2i_ex_primitive+0xa7>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    0x2db6(%rip),%rax
jmp    1340 <asn1_d2i_ex_primitive+0x1d0>
test   %bl,%bl
je     1230 <asn1_d2i_ex_primitive+0xc0>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    0x2d6d(%rip),%rax
jmp    1340 <asn1_d2i_ex_primitive+0x1d0>
mov    %rcx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
sub    $0x8,%rsp
xor    %r14d,%r14d
lea    0x14(%rsp),%rsi
lea    0x38(%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     128b <asn1_d2i_ex_primitive+0x11b>
mov    0x30(%rsp),%al
mov    0x2d27(%rip),%rcx
cmp    (%rcx),%al
jne    12a7 <asn1_d2i_ex_primitive+0x137>
mov    0xc(%rsp),%eax
jmp    12b4 <asn1_d2i_ex_primitive+0x144>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
mov    0x2d25(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
jmp    134a <asn1_d2i_ex_primitive+0x1da>
mov    0x2d2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x18(%rsp),%rsi
mov    0x88(%rsp),%r10
mov    0x20(%rsp),%rcx
mov    0x80(%rsp),%bl
mov    %rcx,0x20(%rsp)
cmp    $0xffffffff,%ebp
mov    0x2ccc(%rip),%rcx
movzbl (%rcx),%ecx
cmove  %ecx,%r15d
cmovne %ebp,%eax
mov    %rsi,0x18(%rsp)
mov    (%rsi),%rcx
mov    %rcx,0x10(%rsp)
sub    $0x8,%rsp
movsbl %bl,%ebp
lea    0x30(%rsp),%rdi
lea    0x12(%rsp),%rcx
lea    0x13(%rsp),%r8
lea    0x18(%rsp),%r9
xor    %esi,%esi
xor    %edx,%edx
push   %r10
push   %rbp
push   %r15
push   %rax
push   %r13
call   1030 <asn1_check_tlen@plt>
add    $0x30,%rsp
mov    %eax,%r14d
cmp    $0xffffffff,%eax
je     134a <asn1_d2i_ex_primitive+0x1da>
test   %r14d,%r14d
jne    135c <asn1_d2i_ex_primitive+0x1ec>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
mov    0x2c80(%rip),%rax
mov    (%rax),%esi
call   1040 <ASN1err@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc(%rsp),%eax
mov    0x2c19(%rip),%rdx
mov    0x2c6a(%rip),%rcx
mov    (%rcx),%ecx
cmp    (%rdx),%eax
je     1414 <asn1_d2i_ex_primitive+0x2a4>
mov    0x2c21(%rip),%rdx
cmp    (%rdx),%eax
je     1414 <asn1_d2i_ex_primitive+0x2a4>
cmp    %ecx,%eax
je     1414 <asn1_d2i_ex_primitive+0x2a4>
cmpb   $0x0,0xb(%rsp)
je     146e <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    0x2bec(%rip),%rax
movzbl (%rax),%r9d
lea    0x30(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0xffffffff,%r8d
call   1050 <asn1_collect@plt>
test   %eax,%eax
mov    0x18(%rsp),%r14
je     14dc <asn1_d2i_ex_primitive+0x36c>
mov    0x30(%rsp),%rbp
lea    0x1(%rbp),%rsi
lea    0x30(%rsp),%rdi
call   1070 <BUF_MEM_grow_clean@plt>
test   %eax,%eax
je     151c <asn1_d2i_ex_primitive+0x3ac>
mov    0x38(%rsp),%rbx
movq   $0x0,(%rbx,%rbp,8)
movb   $0x1,0x9(%rsp)
jmp    14ac <asn1_d2i_ex_primitive+0x33c>
cmp    %ecx,%eax
jne    1433 <asn1_d2i_ex_primitive+0x2c3>
mov    0x88(%rsp),%rax
test   %rax,%rax
mov    0x18(%rsp),%r14
je     1443 <asn1_d2i_ex_primitive+0x2d3>
movq   $0x0,(%rax)
jmp    1443 <asn1_d2i_ex_primitive+0x2d3>
cmpb   $0x0,0xb(%rsp)
mov    0x18(%rsp),%r14
je     1507 <asn1_d2i_ex_primitive+0x397>
mov    (%r14),%rbx
mov    0xa(%rsp),%al
test   %al,%al
je     1488 <asn1_d2i_ex_primitive+0x318>
mov    0x28(%rsp),%rsi
movsbl %al,%edx
lea    0x10(%rsp),%rdi
call   1090 <asn1_find_end@plt>
test   %eax,%eax
je     14e1 <asn1_d2i_ex_primitive+0x371>
mov    0x10(%rsp),%rbp
sub    %rbx,%rbp
jmp    14ac <asn1_d2i_ex_primitive+0x33c>
mov    0x10(%rsp),%rbx
mov    0x28(%rsp),%rbp
lea    (%rbx,%rbp,1),%rax
mov    %rax,0x10(%rsp)
mov    0x18(%rsp),%r14
jmp    14ac <asn1_d2i_ex_primitive+0x33c>
mov    0x10(%rsp),%rax
mov    %rax,%rbp
sub    %rbx,%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    %rbx,%rsi
mov    %rbp,%rdx
mov    0x20(%rsp),%r9
call   1060 <asn1_ex_c2i@plt>
test   %eax,%eax
je     14e1 <asn1_d2i_ex_primitive+0x371>
mov    0x10(%rsp),%rax
mov    %rax,(%r14)
mov    $0x1,%r14d
jmp    14e4 <asn1_d2i_ex_primitive+0x374>
movb   $0x1,0x9(%rsp)
xor    %r14d,%r14d
cmpb   $0x0,0x9(%rsp)
je     134a <asn1_d2i_ex_primitive+0x1da>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     134a <asn1_d2i_ex_primitive+0x1da>
call   1080 <OPENSSL_free@plt>
jmp    134a <asn1_d2i_ex_primitive+0x1da>
mov    0x2ada(%rip),%rax
mov    (%rax),%edi
mov    0x2ac9(%rip),%rax
jmp    1340 <asn1_d2i_ex_primitive+0x1d0>
mov    0x2ac5(%rip),%rax
mov    (%rax),%edi
mov    0x2aa4(%rip),%rax
jmp    1340 <asn1_d2i_ex_primitive+0x1d0>

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
store i32 0, i32* %18
%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_find_end(i8** %24, i64 %150, i8 signext %151)
%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
store i8 1, i8* %23
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 %177
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 %177
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 %177
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 %177
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 %177
]
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 %177
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 %177
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 %167, 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 %159
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 %159
129: ; preds = %85
%130 = load i8, i8* %11
%131 = icmp eq i8 %130, 0
br i1 %131, label %155, 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 %140, label %141
140: ; preds = %132
store i8 1, i8* %13
br label %167
141: ; preds = %132
%142 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %15, i64 0, i32 0
%143 = load i64, i64* %142
%144 = add nsw i64 %143, 1
%145 = call i32 @BUF_MEM_grow_clean(%struct.TYPE_10__* %15, i64 %144)
%146 = icmp eq i32 %145, 0
br i1 %146, label %147, label %151
147: ; preds = %141
%148 = load i32, i32* @ASN1_F_ASN1_D2I_EX_PRIMITIVE
%149 = load i32, i32* @ERR_R_MALLOC_FAILURE
%150 = call i32 @ASN1err(i32 %148, i32 %149)
br label %177
151: ; preds = %141
%152 = load i64*, i64** %133
%153 = getelementptr inbounds i64, i64* %152, i64 %143
store i64 0, i64* %153
%154 = bitcast i64* %152 to i8*
store i8 1, i8* %13
br label %159
155: ; preds = %129
%156 = load i8*, i8** %14
%157 = load i64, i64* %10
%158 = getelementptr inbounds i8, i8* %156, i64 %157
store i8* %158, i8** %14
br label %159
159: ; preds = %151, %155, %115, %120
%160 = phi i8* [ %108, %115 ], [ %108, %120 ], [ %154, %151 ], [ %156, %155 ]
%161 = phi i64 [ %119, %115 ], [ %126, %120 ], [ %143, %151 ], [ %157, %155 ]
%162 = load i32, i32* %9
%163 = call i32 @asn1_ex_c2i(i32** %0, i8* %160, i64 %161, i32 %162, i8* %13, %struct.TYPE_12__* %3)
%164 = icmp eq i32 %163, 0
br i1 %164, label %167, label %165
165: ; preds = %159
%166 = load i8*, i8** %14
store i8* %166, i8** %1
br label %167
167: ; preds = %159, %111, %165, %140
%168 = phi i32 [ 1, %165 ], [ 0, %159 ], [ 0, %111 ], [ 0, %140 ]
%169 = load i8, i8* %13
%170 = icmp ne i8 %169, 0
%171 = getelementptr inbounds %struct.TYPE_10__, %struct.TYPE_10__* %15, i64 0, i32 1
%172 = load i64*, i64** %171
%173 = icmp ne i64* %172, null
%174 = select i1 %170, i1 %173, i1 false
br i1 %174, label %175, label %177
175: ; preds = %167
%176 = call i32 @OPENSSL_free(i64* %172)
br label %177
177: ; preds = %167, %175, %71, %42, %49, %57, %147, %103, %81, %22
%178 = phi i32 [ 0, %103 ], [ 0, %147 ], [ 0, %81 ], [ 0, %22 ], [ 0, %57 ], [ 0, %49 ], [ 0, %42 ], [ %80, %71 ], [ %168, %175 ], [ %168, %167 ]
ret i32 %178
}