#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_WRONG_TAG;
int ASN1_get_object(unsigned char const **, long *, int *, int *, long);
int /*<<< orphan*/ ASN1error(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 (ctx && 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) {
      ctx->ret = i;
      ctx->plen = plen;
      ctx->pclass = pclass;
      ctx->ptag = ptag;
      ctx->hdrlen = p - q;
      ctx->valid = 1;
      if (!(i & 0x81) && ((plen + ctx->hdrlen) > len)) {
        ASN1error(ASN1_R_TOO_LONG);
        if (ctx)
          (ctx)->valid = 0;
        return 0;
      }
    }
  }
  if (i & 0x80) {
    ASN1error(ASN1_R_BAD_OBJECT_HEADER);
    if (ctx)
      (ctx)->valid = 0;
    return 0;
  }
  if (exptag >= 0) {
    if ((exptag != ptag) || (expclass != pclass)) {
      if (opt)
        return -1;
      if (ctx)
        (ctx)->valid = 0;
      ASN1error(ASN1_R_WRONG_TAG);
      return 0;
    }
    if (ctx)
      (ctx)->valid = 0;
  }
  if (i & 1)
    plen = len - (p - q);
  if (inf)
    *inf = i & 1;
  if (cst)
    *cst = i & V_ASN1_CONSTRUCTED;
  if (olen)
    *olen = plen;
  if (oclass)
    *oclass = pclass;
  if (otag)
    *otag = ptag;
  *in = p;
  return 1;
}


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,0x30(%rbp)
je     11c0 <asn1_check_tlen+0xa0>
mov    0x30(%rbp),%rax
cmpl   $0x0,(%rax)
je     11c0 <asn1_check_tlen+0xa0>
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    1292 <asn1_check_tlen+0x172>
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     128d <asn1_check_tlen+0x16d>
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    1288 <asn1_check_tlen+0x168>
mov    -0x50(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq 0x18(%rcx),%rcx
add    %rcx,%rax
cmp    0x10(%rbp),%rax
jle    1288 <asn1_check_tlen+0x168>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
cmpq   $0x0,0x30(%rbp)
je     127c <asn1_check_tlen+0x15c>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1402 <asn1_check_tlen+0x2e2>
jmp    128d <asn1_check_tlen+0x16d>
jmp    1292 <asn1_check_tlen+0x172>
mov    -0x3c(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     12d2 <asn1_check_tlen+0x1b2>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
cmpq   $0x0,0x30(%rbp)
je     12c6 <asn1_check_tlen+0x1a6>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1402 <asn1_check_tlen+0x2e2>
cmpl   $0x0,0x18(%rbp)
jl     1353 <asn1_check_tlen+0x233>
mov    0x18(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    12f4 <asn1_check_tlen+0x1d4>
mov    0x20(%rbp),%eax
cmp    -0x44(%rbp),%eax
je     1339 <asn1_check_tlen+0x219>
cmpb   $0x0,0x28(%rbp)
je     130a <asn1_check_tlen+0x1ea>
movl   $0xffffffff,-0x4(%rbp)
jmp    1402 <asn1_check_tlen+0x2e2>
cmpq   $0x0,0x30(%rbp)
je     131f <asn1_check_tlen+0x1ff>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
movl   $0x0,-0x4(%rbp)
jmp    1402 <asn1_check_tlen+0x2e2>
cmpq   $0x0,0x30(%rbp)
je     134e <asn1_check_tlen+0x22e>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
jmp    1353 <asn1_check_tlen+0x233>
mov    -0x3c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1378 <asn1_check_tlen+0x258>
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     1391 <asn1_check_tlen+0x271>
mov    -0x3c(%rbp),%eax
and    $0x1,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     13b0 <asn1_check_tlen+0x290>
mov    -0x3c(%rbp),%eax
mov    0x2c2a(%rip),%rcx
and    (%rcx),%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     13c6 <asn1_check_tlen+0x2a6>
mov    -0x50(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     13dc <asn1_check_tlen+0x2bc>
mov    -0x44(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     13f0 <asn1_check_tlen+0x2d0>
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)
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    $0x38,%rsp
mov    %r9,%r13
mov    %r8,%r12
mov    %rcx,%rbp
mov    %rdx,0x30(%rsp)
mov    %rdi,%rbx
mov    0x90(%rsp),%r14
mov    0x70(%rsp),%r8
mov    (%r9),%r15
mov    %r15,0x10(%rsp)
test   %r14,%r14
je     118d <asn1_check_tlen+0x6d>
cmpl   $0x0,(%r14)
je     11cf <asn1_check_tlen+0xaf>
mov    0x4(%r14),%eax
mov    0x8(%r14),%rcx
mov    %rcx,0x18(%rsp)
mov    0x10(%r14),%ecx
mov    %ecx,0x8(%rsp)
mov    0x14(%r14),%ecx
mov    %ecx,0xc(%rsp)
movslq 0x18(%r14),%rcx
add    %r15,%rcx
mov    %rcx,0x10(%rsp)
jmp    126a <asn1_check_tlen+0x14a>
lea    0x10(%rsp),%rdi
mov    %rbx,0x20(%rsp)
mov    %rsi,%rbx
lea    0x18(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbp,%r14
mov    %r8,%rbp
call   1030 <ASN1_get_object@plt>
mov    %rbp,%r8
mov    %r14,%rbp
mov    %rbx,%rsi
mov    0x90(%rsp),%r14
mov    0x20(%rsp),%rbx
jmp    126a <asn1_check_tlen+0x14a>
mov    %rbp,0x28(%rsp)
mov    %rsi,0x20(%rsp)
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r8,%rbp
call   1030 <ASN1_get_object@plt>
mov    %eax,0x4(%r14)
mov    0x18(%rsp),%rcx
mov    %rcx,0x8(%r14)
mov    0x8(%rsp),%edx
mov    %edx,0x10(%r14)
mov    0xc(%rsp),%edx
mov    %edx,0x14(%r14)
mov    0x10(%rsp),%rdx
sub    %r15,%rdx
mov    %edx,0x18(%r14)
movl   $0x1,(%r14)
test   $0x81,%al
je     1238 <asn1_check_tlen+0x118>
mov    0x20(%rsp),%rsi
mov    %rbp,%r8
mov    0x28(%rsp),%rbp
jmp    126a <asn1_check_tlen+0x14a>
movslq %edx,%rdx
add    %rcx,%rdx
cmp    %rbp,%rdx
mov    0x20(%rsp),%rsi
mov    %rbp,%r8
mov    0x28(%rsp),%rbp
jle    126a <asn1_check_tlen+0x14a>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
movl   $0x0,(%r14)
jmp    1351 <asn1_check_tlen+0x231>
test   $0x80,%al
jne    130a <asn1_check_tlen+0x1ea>
mov    0x78(%rsp),%ecx
test   %ecx,%ecx
js     12a1 <asn1_check_tlen+0x181>
cmp    %ecx,0xc(%rsp)
jne    1328 <asn1_check_tlen+0x208>
mov    0x80(%rsp),%ecx
cmp    %ecx,0x8(%rsp)
jne    1328 <asn1_check_tlen+0x208>
test   %r14,%r14
je     12a1 <asn1_check_tlen+0x181>
movl   $0x0,(%r14)
mov    %eax,%ecx
and    $0x1,%ecx
je     12b5 <asn1_check_tlen+0x195>
add    %r8,%r15
sub    0x10(%rsp),%r15
mov    %r15,0x18(%rsp)
test   %rbp,%rbp
je     12bd <asn1_check_tlen+0x19d>
mov    %cl,0x0(%rbp)
test   %r12,%r12
je     12cf <asn1_check_tlen+0x1af>
mov    0x2d07(%rip),%rcx
and    (%rcx),%eax
mov    %al,(%r12)
test   %rbx,%rbx
je     12dc <asn1_check_tlen+0x1bc>
mov    0x18(%rsp),%rax
mov    %rax,(%rbx)
cmpq   $0x0,0x30(%rsp)
je     12ef <asn1_check_tlen+0x1cf>
mov    0x8(%rsp),%al
mov    0x30(%rsp),%rcx
mov    %al,(%rcx)
test   %rsi,%rsi
je     12fa <asn1_check_tlen+0x1da>
mov    0xc(%rsp),%eax
mov    %eax,(%rsi)
mov    0x10(%rsp),%rax
mov    %rax,0x0(%r13)
mov    $0x1,%eax
jmp    1353 <asn1_check_tlen+0x233>
mov    0x2cc7(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
xor    %eax,%eax
test   %r14,%r14
je     1353 <asn1_check_tlen+0x233>
movl   $0x0,(%r14)
jmp    1353 <asn1_check_tlen+0x233>
mov    $0xffffffff,%eax
cmpb   $0x0,0x88(%rsp)
jne    1353 <asn1_check_tlen+0x233>
test   %r14,%r14
je     1343 <asn1_check_tlen+0x223>
movl   $0x0,(%r14)
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
call   1040 <ASN1error@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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