#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_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int valid;
  int ret;
  long plen;
  int pclass;
  int ptag;
  int hdrlen;
};
typedef TYPE_1__ ASN1_TLC;

/* Variables and functions */
int /*<<< orphan*/ ASN1_R_BAD_OBJECT_HEADER;
int /*<<< orphan*/ ASN1_R_TOO_LONG;
int /*<<< orphan*/ ASN1_R_TOO_SMALL;
int /*<<< orphan*/ ASN1_R_WRONG_TAG;
int ASN1_get_object(unsigned char const **, long *, int *, int *, long);
int /*<<< orphan*/ ERR_LIB_ASN1;
int /*<<< orphan*/ ERR_raise(int /*<<< orphan*/, int /*<<< orphan*/);
int V_ASN1_CONSTRUCTED;
int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf,
                    char *cst, const unsigned char **in, long len, int exptag,
                    int expclass, char opt, ASN1_TLC *ctx) {
  int i;
  int ptag, pclass;
  long plen;
  const unsigned char *p, *q;
  p = *in;
  q = p;
  if (len <= 0) {
    ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_SMALL);
    goto err;
  }
  if (ctx != NULL && ctx->valid) {
    i = ctx->ret;
    plen = ctx->plen;
    pclass = ctx->pclass;
    ptag = ctx->ptag;
    p += ctx->hdrlen;
  } else {
    i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
    if (ctx != NULL) {
      ctx->ret = i;
      ctx->plen = plen;
      ctx->pclass = pclass;
      ctx->ptag = ptag;
      ctx->hdrlen = p - q;
      ctx->valid = 1;
      if ((i & 0x81) == 0 && (plen + ctx->hdrlen) > len) {
        ERR_raise(ERR_LIB_ASN1, ASN1_R_TOO_LONG);
        goto err;
      }
    }
  }
  if ((i & 0x80) != 0) {
    ERR_raise(ERR_LIB_ASN1, ASN1_R_BAD_OBJECT_HEADER);
    goto err;
  }
  if (exptag >= 0) {
    if (exptag != ptag || expclass != pclass) {
      if (opt != 0)
        return -1;
      ERR_raise(ERR_LIB_ASN1, ASN1_R_WRONG_TAG);
      goto err;
    }
    do {
      if ((ctx) != NULL)
        (ctx)->valid = 0;
    } while (0);
  }
  if ((i & 1) != 0)
    plen = len - (p - q);
  if (inf != NULL)
    *inf = i & 1;
  if (cst != NULL)
    *cst = i & V_ASN1_CONSTRUCTED;
  if (olen != NULL)
    *olen = plen;
  if (oclass != NULL)
    *oclass = pclass;
  if (otag != NULL)
    *otag = ptag;
  *in = p;
  return 1;
err:
  do {
    if ((ctx) != NULL)
      (ctx)->valid = 0;
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<asn1_check_tlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%al
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,0x10(%rbp)
jg     118b <asn1_check_tlen+0x6b>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
call   1040 <ERR_raise@plt>
jmp    1402 <asn1_check_tlen+0x2e2>
cmpq   $0x0,0x30(%rbp)
je     11e7 <asn1_check_tlen+0xc7>
mov    0x30(%rbp),%rax
cmpl   $0x0,(%rax)
je     11e7 <asn1_check_tlen+0xc7>
mov    0x30(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x30(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    0x30(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x30(%rbp),%rax
mov    0x14(%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x30(%rbp),%rax
mov    0x18(%rax),%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
jmp    12a6 <asn1_check_tlen+0x186>
mov    0x10(%rbp),%r8
lea    -0x58(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x44(%rbp),%rcx
call   1030 <ASN1_get_object@plt>
mov    %eax,-0x3c(%rbp)
cmpq   $0x0,0x30(%rbp)
je     12a1 <asn1_check_tlen+0x181>
mov    -0x3c(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x50(%rbp),%rcx
mov    0x30(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x44(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x40(%rbp),%ecx
mov    0x30(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x58(%rbp),%rax
mov    -0x60(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%ecx
mov    0x30(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    0x30(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x3c(%rbp),%eax
and    $0x81,%eax
cmp    $0x0,%eax
jne    129c <asn1_check_tlen+0x17c>
mov    -0x50(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq 0x18(%rcx),%rcx
add    %rcx,%rax
cmp    0x10(%rbp),%rax
jle    129c <asn1_check_tlen+0x17c>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
call   1040 <ERR_raise@plt>
jmp    1402 <asn1_check_tlen+0x2e2>
jmp    12a1 <asn1_check_tlen+0x181>
jmp    12a6 <asn1_check_tlen+0x186>
mov    -0x3c(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     12d3 <asn1_check_tlen+0x1b3>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
mov    0x2d09(%rip),%rax
mov    (%rax),%esi
call   1040 <ERR_raise@plt>
jmp    1402 <asn1_check_tlen+0x2e2>
cmpl   $0x0,0x18(%rbp)
jl     134e <asn1_check_tlen+0x22e>
mov    0x18(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    12f5 <asn1_check_tlen+0x1d5>
mov    0x20(%rbp),%eax
cmp    -0x44(%rbp),%eax
je     132a <asn1_check_tlen+0x20a>
movsbl 0x28(%rbp),%eax
cmp    $0x0,%eax
je     130e <asn1_check_tlen+0x1ee>
movl   $0xffffffff,-0x4(%rbp)
jmp    1428 <asn1_check_tlen+0x308>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
mov    0x2c9a(%rip),%rax
mov    (%rax),%esi
call   1040 <ERR_raise@plt>
jmp    1402 <asn1_check_tlen+0x2e2>
jmp    132f <asn1_check_tlen+0x20f>
cmpq   $0x0,0x30(%rbp)
je     1344 <asn1_check_tlen+0x224>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
jmp    1349 <asn1_check_tlen+0x229>
jmp    134e <asn1_check_tlen+0x22e>
mov    -0x3c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1373 <asn1_check_tlen+0x253>
mov    0x10(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    -0x60(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     138c <asn1_check_tlen+0x26c>
mov    -0x3c(%rbp),%eax
and    $0x1,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     13ab <asn1_check_tlen+0x28b>
mov    -0x3c(%rbp),%eax
mov    0x2c1f(%rip),%rcx
and    (%rcx),%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     13c1 <asn1_check_tlen+0x2a1>
mov    -0x50(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     13d7 <asn1_check_tlen+0x2b7>
mov    -0x44(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     13eb <asn1_check_tlen+0x2cb>
mov    -0x40(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x58(%rbp),%rcx
mov    -0x38(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1428 <asn1_check_tlen+0x308>
jmp    1407 <asn1_check_tlen+0x2e7>
cmpq   $0x0,0x30(%rbp)
je     141c <asn1_check_tlen+0x2fc>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
jmp    1421 <asn1_check_tlen+0x301>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asn1_check_tlen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r14
mov    0x80(%rsp),%r15
mov    0x60(%rsp),%r8
mov    (%r9),%r12
mov    %r12,0x8(%rsp)
test   %r8,%r8
jle    1191 <asn1_check_tlen+0x71>
mov    %r9,%rbx
mov    %rdx,%rbp
mov    %rdi,%r13
test   %r15,%r15
mov    %rcx,0x20(%rsp)
je     11a6 <asn1_check_tlen+0x86>
cmpl   $0x0,(%r15)
je     11de <asn1_check_tlen+0xbe>
mov    0x4(%r15),%eax
mov    0x8(%r15),%rcx
mov    %rcx,0x10(%rsp)
mov    0x10(%r15),%ecx
mov    %ecx,(%rsp)
mov    0x14(%r15),%ecx
mov    %ecx,0x4(%rsp)
movslq 0x18(%r15),%rcx
add    %r12,%rcx
mov    %rcx,0x8(%rsp)
jmp    1262 <asn1_check_tlen+0x142>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    0x2e27(%rip),%rax
jmp    130b <asn1_check_tlen+0x1eb>
lea    0x8(%rsp),%rdi
mov    %rbx,0x18(%rsp)
mov    %r14,%rbx
mov    %r13,%r14
mov    %rsi,%r13
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
call   1030 <ASN1_get_object@plt>
mov    %r13,%rsi
mov    %r14,%r13
mov    %rbx,%r14
mov    0x18(%rsp),%rbx
jmp    1262 <asn1_check_tlen+0x142>
mov    %rsi,0x18(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
call   1030 <ASN1_get_object@plt>
mov    %eax,0x4(%r15)
mov    0x10(%rsp),%rcx
mov    %rcx,0x8(%r15)
mov    (%rsp),%edx
mov    %edx,0x10(%r15)
mov    0x4(%rsp),%edx
mov    %edx,0x14(%r15)
mov    0x8(%rsp),%rdx
sub    %r12,%rdx
mov    %edx,0x18(%r15)
movl   $0x1,(%r15)
test   $0x81,%al
je     1234 <asn1_check_tlen+0x114>
mov    0x18(%rsp),%rsi
jmp    1262 <asn1_check_tlen+0x142>
movslq %edx,%rdx
add    %rcx,%rdx
cmp    0x60(%rsp),%rdx
mov    0x18(%rsp),%rsi
jle    1262 <asn1_check_tlen+0x142>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
mov    0x2d82(%rip),%rax
mov    (%rax),%esi
call   1040 <ERR_raise@plt>
jmp    1317 <asn1_check_tlen+0x1f7>
test   $0x80,%al
jne    12fb <asn1_check_tlen+0x1db>
mov    0x68(%rsp),%ecx
test   %ecx,%ecx
mov    0x20(%rsp),%rdx
js     129a <asn1_check_tlen+0x17a>
cmp    %ecx,0x4(%rsp)
jne    132f <asn1_check_tlen+0x20f>
mov    0x70(%rsp),%ecx
cmp    %ecx,(%rsp)
jne    132f <asn1_check_tlen+0x20f>
test   %r15,%r15
je     129a <asn1_check_tlen+0x17a>
movl   $0x0,(%r15)
mov    %eax,%ecx
and    $0x1,%ecx
je     12b0 <asn1_check_tlen+0x190>
add    0x60(%rsp),%r12
sub    0x8(%rsp),%r12
mov    %r12,0x10(%rsp)
test   %rdx,%rdx
je     12b7 <asn1_check_tlen+0x197>
mov    %cl,(%rdx)
test   %r14,%r14
je     12c8 <asn1_check_tlen+0x1a8>
mov    0x2cfd(%rip),%rcx
and    (%rcx),%eax
mov    %al,(%r14)
test   %r13,%r13
je     12d6 <asn1_check_tlen+0x1b6>
mov    0x10(%rsp),%rax
mov    %rax,0x0(%r13)
test   %rbp,%rbp
je     12e1 <asn1_check_tlen+0x1c1>
mov    (%rsp),%al
mov    %al,0x0(%rbp)
test   %rsi,%rsi
je     12ec <asn1_check_tlen+0x1cc>
mov    0x4(%rsp),%eax
mov    %eax,(%rsi)
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
mov    $0x1,%eax
jmp    1320 <asn1_check_tlen+0x200>
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
mov    0x2cc5(%rip),%rax
mov    (%rax),%esi
call   1040 <ERR_raise@plt>
test   %r15,%r15
je     131e <asn1_check_tlen+0x1fe>
movl   $0x0,(%r15)
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%eax
cmpb   $0x0,0x78(%rsp)
jne    1320 <asn1_check_tlen+0x200>
mov    0x2ca6(%rip),%rax
mov    (%rax),%edi
mov    0x2c6d(%rip),%rax
jmp    130b <asn1_check_tlen+0x1eb>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32, i64, i32, i32, i32 }
@ERR_LIB_ASN1 = global i32 0
@ASN1_R_TOO_SMALL = global i32 0
@ASN1_R_TOO_LONG = global i32 0
@ASN1_R_BAD_OBJECT_HEADER = global i32 0
@ASN1_R_WRONG_TAG = global i32 0
@V_ASN1_CONSTRUCTED = global i32 0
define i32 @asn1_check_tlen(i64* %0, i32* %1, i8* %2, i8* %3, i8* %4, i8** %5, i64 %6, i32 %7, i32 %8, i8 signext %9, %struct.TYPE_3__* %10) {
%12 = alloca i32
%13 = alloca i64*
%14 = alloca i32*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8**
%19 = alloca i64
%20 = alloca i32
%21 = alloca i32
%22 = alloca i8
%23 = alloca %struct.TYPE_3__*
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i64
%28 = alloca i8*
%29 = alloca i8*
store i64* %0, i64** %13
store i32* %1, i32** %14
store i8* %2, i8** %15
store i8* %3, i8** %16
store i8* %4, i8** %17
store i8** %5, i8*** %18
store i64 %6, i64* %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i8 %9, i8* %22
store %struct.TYPE_3__* %10, %struct.TYPE_3__** %23
%30 = load i8**, i8*** %18
%31 = load i8*, i8** %30
store i8* %31, i8** %28
%32 = load i8*, i8** %28
store i8* %32, i8** %29
%33 = load i64, i64* %19
%34 = icmp sle i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %11
%36 = load i32, i32* @ERR_LIB_ASN1
%37 = load i32, i32* @ASN1_R_TOO_SMALL
%38 = call i32 @ERR_raise(i32 %36, i32 %37)
br label %200
39: ; preds = %11
%40 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%41 = icmp ne %struct.TYPE_3__* %40, null
br i1 %41, label %42, label %66
42: ; preds = %39
%43 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %43, i32 0, i32 0
%45 = load i32, i32* %44
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %66
47: ; preds = %42
%48 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%49 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %48, i32 0, i32 1
%50 = load i32, i32* %49
store i32 %50, i32* %24
%51 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%52 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %51, i32 0, i32 2
%53 = load i64, i64* %52
store i64 %53, i64* %27
%54 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%55 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %54, i32 0, i32 3
%56 = load i32, i32* %55
store i32 %56, i32* %26
%57 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%58 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %57, i32 0, i32 4
%59 = load i32, i32* %58
store i32 %59, i32* %25
%60 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%61 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %60, i32 0, i32 5
%62 = load i32, i32* %61
%63 = load i8*, i8** %28
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds i8, i8* %63, i64 %64
store i8* %65, i8** %28
br label %112
66: ; preds = %42, %39
%67 = load i64, i64* %19
%68 = call i32 @ASN1_get_object(i8** %28, i64* %27, i32* %25, i32* %26, i64 %67)
store i32 %68, i32* %24
%69 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%70 = icmp ne %struct.TYPE_3__* %69, null
br i1 %70, label %71, label %111
71: ; preds = %66
%72 = load i32, i32* %24
%73 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%74 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %73, i32 0, i32 1
store i32 %72, i32* %74
%75 = load i64, i64* %27
%76 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%77 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %76, i32 0, i32 2
store i64 %75, i64* %77
%78 = load i32, i32* %26
%79 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%80 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %79, i32 0, i32 3
store i32 %78, i32* %80
%81 = load i32, i32* %25
%82 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%83 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %82, i32 0, i32 4
store i32 %81, i32* %83
%84 = load i8*, i8** %28
%85 = load i8*, i8** %29
%86 = ptrtoint i8* %84 to i64
%87 = ptrtoint i8* %85 to i64
%88 = sub i64 %86, %87
%89 = trunc i64 %88 to i32
%90 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%91 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %90, i32 0, i32 5
store i32 %89, i32* %91
%92 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%93 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %92, i32 0, i32 0
store i32 1, i32* %93
%94 = load i32, i32* %24
%95 = and i32 %94, 129
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %110
97: ; preds = %71
%98 = load i64, i64* %27
%99 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%100 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %99, i32 0, i32 5
%101 = load i32, i32* %100
%102 = sext i32 %101 to i64
%103 = add nsw i64 %98, %102
%104 = load i64, i64* %19
%105 = icmp sgt i64 %103, %104
br i1 %105, label %106, label %110
106: ; preds = %97
%107 = load i32, i32* @ERR_LIB_ASN1
%108 = load i32, i32* @ASN1_R_TOO_LONG
%109 = call i32 @ERR_raise(i32 %107, i32 %108)
br label %200
110: ; preds = %97, %71
br label %111
111: ; preds = %110, %66
br label %112
112: ; preds = %111, %47
%113 = load i32, i32* %24
%114 = and i32 %113, 128
%115 = icmp ne i32 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %112
%117 = load i32, i32* @ERR_LIB_ASN1
%118 = load i32, i32* @ASN1_R_BAD_OBJECT_HEADER
%119 = call i32 @ERR_raise(i32 %117, i32 %118)
br label %200
120: ; preds = %112
%121 = load i32, i32* %20
%122 = icmp sge i32 %121, 0
br i1 %122, label %123, label %149
123: ; preds = %120
%124 = load i32, i32* %20
%125 = load i32, i32* %25
%126 = icmp ne i32 %124, %125
br i1 %126, label %131, label %127
127: ; preds = %123
%128 = load i32, i32* %21
%129 = load i32, i32* %26
%130 = icmp ne i32 %128, %129
br i1 %130, label %131, label %140
131: ; preds = %127, %123
%132 = load i8, i8* %22
%133 = sext i8 %132 to i32
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %136
135: ; preds = %131
store i32 -1, i32* %12
br label %209
136: ; preds = %131
%137 = load i32, i32* @ERR_LIB_ASN1
%138 = load i32, i32* @ASN1_R_WRONG_TAG
%139 = call i32 @ERR_raise(i32 %137, i32 %138)
br label %200
140: ; preds = %127
br label %141
141: ; preds = %140
%142 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%143 = icmp ne %struct.TYPE_3__* %142, null
br i1 %143, label %144, label %147
144: ; preds = %141
%145 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%146 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %145, i32 0, i32 0
store i32 0, i32* %146
br label %147
147: ; preds = %144, %141
br label %148
148: ; preds = %147
br label %149
149: ; preds = %148, %120
%150 = load i32, i32* %24
%151 = and i32 %150, 1
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %161
153: ; preds = %149
%154 = load i64, i64* %19
%155 = load i8*, i8** %28
%156 = load i8*, i8** %29
%157 = ptrtoint i8* %155 to i64
%158 = ptrtoint i8* %156 to i64
%159 = sub i64 %157, %158
%160 = sub nsw i64 %154, %159
store i64 %160, i64* %27
br label %161
161: ; preds = %153, %149
%162 = load i8*, i8** %16
%163 = icmp ne i8* %162, null
br i1 %163, label %164, label %169
164: ; preds = %161
%165 = load i32, i32* %24
%166 = and i32 %165, 1
%167 = trunc i32 %166 to i8
%168 = load i8*, i8** %16
store i8 %167, i8* %168
br label %169
169: ; preds = %164, %161
%170 = load i8*, i8** %17
%171 = icmp ne i8* %170, null
br i1 %171, label %172, label %178
172: ; preds = %169
%173 = load i32, i32* %24
%174 = load i32, i32* @V_ASN1_CONSTRUCTED
%175 = and i32 %173, %174
%176 = trunc i32 %175 to i8
%177 = load i8*, i8** %17
store i8 %176, i8* %177
br label %178
178: ; preds = %172, %169
%179 = load i64*, i64** %13
%180 = icmp ne i64* %179, null
br i1 %180, label %181, label %184
181: ; preds = %178
%182 = load i64, i64* %27
%183 = load i64*, i64** %13
store i64 %182, i64* %183
br label %184
184: ; preds = %181, %178
%185 = load i8*, i8** %15
%186 = icmp ne i8* %185, null
br i1 %186, label %187, label %191
187: ; preds = %184
%188 = load i32, i32* %26
%189 = trunc i32 %188 to i8
%190 = load i8*, i8** %15
store i8 %189, i8* %190
br label %191
191: ; preds = %187, %184
%192 = load i32*, i32** %14
%193 = icmp ne i32* %192, null
br i1 %193, label %194, label %197
194: ; preds = %191
%195 = load i32, i32* %25
%196 = load i32*, i32** %14
store i32 %195, i32* %196
br label %197
197: ; preds = %194, %191
%198 = load i8*, i8** %28
%199 = load i8**, i8*** %18
store i8* %198, i8** %199
store i32 1, i32* %12
br label %209
200: ; preds = %136, %116, %106, %35
br label %201
201: ; preds = %200
%202 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%203 = icmp ne %struct.TYPE_3__* %202, null
br i1 %203, label %204, label %207
204: ; preds = %201
%205 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%206 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %205, i32 0, i32 0
store i32 0, i32* %206
br label %207
207: ; preds = %204, %201
br label %208
208: ; preds = %207
store i32 0, i32* %12
br label %209
209: ; preds = %208, %197, %135
%210 = load i32, i32* %12
ret i32 %210
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i64, i32, i32, i32 }
@ERR_LIB_ASN1 = global i32 0
@ASN1_R_TOO_SMALL = global i32 0
@ASN1_R_TOO_LONG = global i32 0
@ASN1_R_BAD_OBJECT_HEADER = global i32 0
@ASN1_R_WRONG_TAG = global i32 0
@V_ASN1_CONSTRUCTED = global i32 0
define i32 @asn1_check_tlen(i64* writeonly %0, i32* writeonly %1, i8* writeonly %2, i8* writeonly %3, i8* writeonly %4, i8** nocapture %5, i64 %6, i32 %7, i32 %8, i8 signext %9, %struct.TYPE_3__* %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i64
%15 = alloca i8*
%16 = bitcast i32* %12 to i8*
%17 = bitcast i32* %13 to i8*
%18 = bitcast i64* %14 to i8*
%19 = bitcast i8** %15 to i8*
%20 = load i8*, i8** %5
store i8* %20, i8** %15
%21 = icmp slt i64 %6, 1
br i1 %21, label %22, label %26
22: ; preds = %11
%23 = load i32, i32* @ERR_LIB_ASN1
%24 = load i32, i32* @ASN1_R_TOO_SMALL
%25 = tail call i32 @ERR_raise(i32 %23, i32 %24)
br label %132
26: ; preds = %11
%27 = icmp eq %struct.TYPE_3__* %10, null
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = call i32 @ASN1_get_object(i8** %15, i64* %14, i32* %12, i32* %13, i64 %6)
br label %73
30: ; preds = %26
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 0
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %47, label %34
34: ; preds = %30
%35 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 1
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 2
%38 = load i64, i64* %37
store i64 %38, i64* %14
%39 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 3
%40 = load i32, i32* %39
store i32 %40, i32* %13
%41 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 4
%42 = load i32, i32* %41
store i32 %42, i32* %12
%43 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 5
%44 = load i32, i32* %43
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %20, i64 %45
store i8* %46, i8** %15
br label %73
47: ; preds = %30
%48 = call i32 @ASN1_get_object(i8** %15, i64* %14, i32* %12, i32* %13, i64 %6)
%49 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 1
store i32 %48, i32* %49
%50 = load i64, i64* %14
%51 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 2
store i64 %50, i64* %51
%52 = load i32, i32* %13
%53 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 3
store i32 %52, i32* %53
%54 = load i32, i32* %12
%55 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 4
store i32 %54, i32* %55
%56 = load i8*, i8** %15
%57 = ptrtoint i8* %56 to i64
%58 = ptrtoint i8* %20 to i64
%59 = sub i64 %57, %58
%60 = trunc i64 %59 to i32
%61 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 5
store i32 %60, i32* %61
store i32 1, i32* %31
%62 = and i32 %48, 129
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %73
64: ; preds = %47
%65 = shl i64 %59, 32
%66 = ashr exact i64 %65, 32
%67 = add nsw i64 %66, %50
%68 = icmp sgt i64 %67, %6
br i1 %68, label %69, label %73
69: ; preds = %64
%70 = load i32, i32* @ERR_LIB_ASN1
%71 = load i32, i32* @ASN1_R_TOO_LONG
%72 = call i32 @ERR_raise(i32 %70, i32 %71)
br label %134
73: ; preds = %28, %64, %47, %34
%74 = phi i32 [ %36, %34 ], [ %48, %64 ], [ %48, %47 ], [ %29, %28 ]
%75 = and i32 %74, 128
%76 = icmp eq i32 %75, 0
br i1 %76, label %81, label %77
77: ; preds = %73
%78 = load i32, i32* @ERR_LIB_ASN1
%79 = load i32, i32* @ASN1_R_BAD_OBJECT_HEADER
%80 = call i32 @ERR_raise(i32 %78, i32 %79)
br label %132
81: ; preds = %73
%82 = icmp sgt i32 %7, -1
br i1 %82, label %83, label %98
83: ; preds = %81
%84 = load i32, i32* %12
%85 = icmp eq i32 %84, %7
%86 = load i32, i32* %13
%87 = icmp eq i32 %86, %8
%88 = select i1 %85, i1 %87, i1 false
br i1 %88, label %95, label %89
89: ; preds = %83
%90 = icmp eq i8 %9, 0
br i1 %90, label %91, label %136
91: ; preds = %89
%92 = load i32, i32* @ERR_LIB_ASN1
%93 = load i32, i32* @ASN1_R_WRONG_TAG
%94 = call i32 @ERR_raise(i32 %92, i32 %93)
br label %132
95: ; preds = %83
br i1 %27, label %98, label %96
96: ; preds = %95
%97 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 0
store i32 0, i32* %97
br label %98
98: ; preds = %95, %96, %81
%99 = and i32 %74, 1
%100 = icmp eq i32 %99, 0
br i1 %100, label %107, label %101
101: ; preds = %98
%102 = load i8*, i8** %15
%103 = ptrtoint i8* %102 to i64
%104 = ptrtoint i8* %20 to i64
%105 = add i64 %104, %6
%106 = sub i64 %105, %103
store i64 %106, i64* %14
br label %107
107: ; preds = %101, %98
%108 = icmp eq i8* %3, null
br i1 %108, label %111, label %109
109: ; preds = %107
%110 = trunc i32 %99 to i8
store i8 %110, i8* %3
br label %111
111: ; preds = %109, %107
%112 = icmp eq i8* %4, null
br i1 %112, label %117, label %113
113: ; preds = %111
%114 = load i32, i32* @V_ASN1_CONSTRUCTED
%115 = and i32 %114, %74
%116 = trunc i32 %115 to i8
store i8 %116, i8* %4
br label %117
117: ; preds = %113, %111
%118 = icmp eq i64* %0, null
br i1 %118, label %121, label %119
119: ; preds = %117
%120 = load i64, i64* %14
store i64 %120, i64* %0
br label %121
121: ; preds = %119, %117
%122 = icmp eq i8* %2, null
br i1 %122, label %126, label %123
123: ; preds = %121
%124 = load i32, i32* %13
%125 = trunc i32 %124 to i8
store i8 %125, i8* %2
br label %126
126: ; preds = %123, %121
%127 = icmp eq i32* %1, null
br i1 %127, label %130, label %128
128: ; preds = %126
%129 = load i32, i32* %12
store i32 %129, i32* %1
br label %130
130: ; preds = %128, %126
%131 = load i8*, i8** %15
store i8* %131, i8** %5
br label %136
132: ; preds = %22, %77, %91
%133 = icmp eq %struct.TYPE_3__* %10, null
br i1 %133, label %136, label %134
134: ; preds = %69, %132
%135 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 0
store i32 0, i32* %135
br label %136
136: ; preds = %132, %134, %89, %130
%137 = phi i32 [ 1, %130 ], [ -1, %89 ], [ 0, %134 ], [ 0, %132 ]
ret i32 %137
}