#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_F_ASN1_CHECK_TLEN;
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*/ ASN1err(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 (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)) {
        ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_TOO_LONG);
        if (ctx)
          (ctx)->valid = 0;
        return 0;
      }
    }
  }
  if (i & 0x80) {
    ASN1err(ASN1_F_ASN1_CHECK_TLEN, 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;
      ASN1err(ASN1_F_ASN1_CHECK_TLEN, 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    129b <asn1_check_tlen+0x17b>
mov    0x10(%rbp),%r8
lea    -0x58(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x44(%rbp),%rcx
call   1040 <ASN1_get_object@plt>
mov    %eax,-0x3c(%rbp)
cmpq   $0x0,0x30(%rbp)
je     1296 <asn1_check_tlen+0x176>
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    1291 <asn1_check_tlen+0x171>
mov    -0x50(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq 0x18(%rcx),%rcx
add    %rcx,%rax
cmp    0x10(%rbp),%rax
jle    1291 <asn1_check_tlen+0x171>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
mov    0x2d77(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@plt>
cmpq   $0x0,0x30(%rbp)
je     1285 <asn1_check_tlen+0x165>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    141d <asn1_check_tlen+0x2fd>
jmp    1296 <asn1_check_tlen+0x176>
jmp    129b <asn1_check_tlen+0x17b>
mov    -0x3c(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     12e4 <asn1_check_tlen+0x1c4>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@plt>
cmpq   $0x0,0x30(%rbp)
je     12d8 <asn1_check_tlen+0x1b8>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    141d <asn1_check_tlen+0x2fd>
cmpl   $0x0,0x18(%rbp)
jl     136e <asn1_check_tlen+0x24e>
mov    0x18(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    1306 <asn1_check_tlen+0x1e6>
mov    0x20(%rbp),%eax
cmp    -0x44(%rbp),%eax
je     1354 <asn1_check_tlen+0x234>
cmpb   $0x0,0x28(%rbp)
je     131c <asn1_check_tlen+0x1fc>
movl   $0xffffffff,-0x4(%rbp)
jmp    141d <asn1_check_tlen+0x2fd>
cmpq   $0x0,0x30(%rbp)
je     1331 <asn1_check_tlen+0x211>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
mov    0x2c90(%rip),%rax
mov    (%rax),%edi
mov    0x2c7f(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@plt>
movl   $0x0,-0x4(%rbp)
jmp    141d <asn1_check_tlen+0x2fd>
cmpq   $0x0,0x30(%rbp)
je     1369 <asn1_check_tlen+0x249>
mov    0x30(%rbp),%rax
movl   $0x0,(%rax)
jmp    136e <asn1_check_tlen+0x24e>
mov    -0x3c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1393 <asn1_check_tlen+0x273>
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     13ac <asn1_check_tlen+0x28c>
mov    -0x3c(%rbp),%eax
and    $0x1,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     13cb <asn1_check_tlen+0x2ab>
mov    -0x3c(%rbp),%eax
mov    0x2c0f(%rip),%rcx
and    (%rcx),%eax
mov    %al,%cl
mov    -0x30(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     13e1 <asn1_check_tlen+0x2c1>
mov    -0x50(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     13f7 <asn1_check_tlen+0x2d7>
mov    -0x44(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     140b <asn1_check_tlen+0x2eb>
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    1273 <asn1_check_tlen+0x153>
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   1040 <ASN1_get_object@plt>
mov    %rbp,%r8
mov    %r14,%rbp
mov    %rbx,%rsi
mov    0x90(%rsp),%r14
mov    0x20(%rsp),%rbx
jmp    1273 <asn1_check_tlen+0x153>
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   1040 <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    1273 <asn1_check_tlen+0x153>
movslq %edx,%rdx
add    %rcx,%rdx
cmp    %rbp,%rdx
mov    0x20(%rsp),%rsi
mov    %rbp,%r8
mov    0x28(%rsp),%rbp
jle    1273 <asn1_check_tlen+0x153>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
mov    0x2d80(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@plt>
movl   $0x0,(%r14)
jmp    136c <asn1_check_tlen+0x24c>
test   $0x80,%al
jne    1313 <asn1_check_tlen+0x1f3>
mov    0x78(%rsp),%ecx
test   %ecx,%ecx
js     12aa <asn1_check_tlen+0x18a>
cmp    %ecx,0xc(%rsp)
jne    133a <asn1_check_tlen+0x21a>
mov    0x80(%rsp),%ecx
cmp    %ecx,0x8(%rsp)
jne    133a <asn1_check_tlen+0x21a>
test   %r14,%r14
je     12aa <asn1_check_tlen+0x18a>
movl   $0x0,(%r14)
mov    %eax,%ecx
and    $0x1,%ecx
je     12be <asn1_check_tlen+0x19e>
add    %r8,%r15
sub    0x10(%rsp),%r15
mov    %r15,0x18(%rsp)
test   %rbp,%rbp
je     12c6 <asn1_check_tlen+0x1a6>
mov    %cl,0x0(%rbp)
test   %r12,%r12
je     12d8 <asn1_check_tlen+0x1b8>
mov    0x2cfe(%rip),%rcx
and    (%rcx),%eax
mov    %al,(%r12)
test   %rbx,%rbx
je     12e5 <asn1_check_tlen+0x1c5>
mov    0x18(%rsp),%rax
mov    %rax,(%rbx)
cmpq   $0x0,0x30(%rsp)
je     12f8 <asn1_check_tlen+0x1d8>
mov    0x8(%rsp),%al
mov    0x30(%rsp),%rcx
mov    %al,(%rcx)
test   %rsi,%rsi
je     1303 <asn1_check_tlen+0x1e3>
mov    0xc(%rsp),%eax
mov    %eax,(%rsi)
mov    0x10(%rsp),%rax
mov    %rax,0x0(%r13)
mov    $0x1,%eax
jmp    136e <asn1_check_tlen+0x24e>
mov    0x2cae(%rip),%rax
mov    (%rax),%edi
mov    0x2cb5(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@plt>
xor    %eax,%eax
test   %r14,%r14
je     136e <asn1_check_tlen+0x24e>
movl   $0x0,(%r14)
jmp    136e <asn1_check_tlen+0x24e>
mov    $0xffffffff,%eax
cmpb   $0x0,0x88(%rsp)
jne    136e <asn1_check_tlen+0x24e>
test   %r14,%r14
je     1355 <asn1_check_tlen+0x235>
movl   $0x0,(%r14)
mov    0x2c6c(%rip),%rax
mov    (%rax),%edi
mov    0x2c5b(%rip),%rax
mov    (%rax),%esi
call   1030 <ASN1err@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_F_ASN1_CHECK_TLEN = 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 %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 %111
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 %110
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 %109, 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 %109
99: ; preds = %90
%100 = load i32, i32* @ASN1_F_ASN1_CHECK_TLEN
%101 = load i32, i32* @ASN1_R_TOO_LONG
%102 = call i32 @ASN1err(i32 %100, i32 %101)
%103 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%104 = icmp ne %struct.TYPE_3__* %103, null
br i1 %104, label %105, label %108
105: ; preds = %99
%106 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%107 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %106, i32 0, i32 0
store i32 0, i32* %107
br label %108
108: ; preds = %105, %99
store i32 0, i32* %12
br label %208
109: ; preds = %90, %64
br label %110
110: ; preds = %109, %59
br label %111
111: ; preds = %110, %40
%112 = load i32, i32* %24
%113 = and i32 %112, 128
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %125
115: ; preds = %111
%116 = load i32, i32* @ASN1_F_ASN1_CHECK_TLEN
%117 = load i32, i32* @ASN1_R_BAD_OBJECT_HEADER
%118 = call i32 @ASN1err(i32 %116, i32 %117)
%119 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%120 = icmp ne %struct.TYPE_3__* %119, null
br i1 %120, label %121, label %124
121: ; preds = %115
%122 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%123 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %122, i32 0, i32 0
store i32 0, i32* %123
br label %124
124: ; preds = %121, %115
store i32 0, i32* %12
br label %208
125: ; preds = %111
%126 = load i32, i32* %20
%127 = icmp sge i32 %126, 0
br i1 %127, label %128, label %157
128: ; preds = %125
%129 = load i32, i32* %20
%130 = load i32, i32* %25
%131 = icmp ne i32 %129, %130
br i1 %131, label %136, label %132
132: ; preds = %128
%133 = load i32, i32* %21
%134 = load i32, i32* %26
%135 = icmp ne i32 %133, %134
br i1 %135, label %136, label %150
136: ; preds = %132, %128
%137 = load i8, i8* %22
%138 = icmp ne i8 %137, 0
br i1 %138, label %139, label %140
139: ; preds = %136
store i32 -1, i32* %12
br label %208
140: ; preds = %136
%141 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%142 = icmp ne %struct.TYPE_3__* %141, null
br i1 %142, label %143, label %146
143: ; preds = %140
%144 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%145 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %144, i32 0, i32 0
store i32 0, i32* %145
br label %146
146: ; preds = %143, %140
%147 = load i32, i32* @ASN1_F_ASN1_CHECK_TLEN
%148 = load i32, i32* @ASN1_R_WRONG_TAG
%149 = call i32 @ASN1err(i32 %147, i32 %148)
store i32 0, i32* %12
br label %208
150: ; preds = %132
%151 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%152 = icmp ne %struct.TYPE_3__* %151, null
br i1 %152, label %153, label %156
153: ; preds = %150
%154 = load %struct.TYPE_3__*, %struct.TYPE_3__** %23
%155 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %154, i32 0, i32 0
store i32 0, i32* %155
br label %156
156: ; preds = %153, %150
br label %157
157: ; preds = %156, %125
%158 = load i32, i32* %24
%159 = and i32 %158, 1
%160 = icmp ne i32 %159, 0
br i1 %160, label %161, label %169
161: ; preds = %157
%162 = load i64, i64* %19
%163 = load i8*, i8** %28
%164 = load i8*, i8** %29
%165 = ptrtoint i8* %163 to i64
%166 = ptrtoint i8* %164 to i64
%167 = sub i64 %165, %166
%168 = sub nsw i64 %162, %167
store i64 %168, i64* %27
br label %169
169: ; preds = %161, %157
%170 = load i8*, i8** %16
%171 = icmp ne i8* %170, null
br i1 %171, label %172, label %177
172: ; preds = %169
%173 = load i32, i32* %24
%174 = and i32 %173, 1
%175 = trunc i32 %174 to i8
%176 = load i8*, i8** %16
store i8 %175, i8* %176
br label %177
177: ; preds = %172, %169
%178 = load i8*, i8** %17
%179 = icmp ne i8* %178, null
br i1 %179, label %180, label %186
180: ; preds = %177
%181 = load i32, i32* %24
%182 = load i32, i32* @V_ASN1_CONSTRUCTED
%183 = and i32 %181, %182
%184 = trunc i32 %183 to i8
%185 = load i8*, i8** %17
store i8 %184, i8* %185
br label %186
186: ; preds = %180, %177
%187 = load i64*, i64** %13
%188 = icmp ne i64* %187, null
br i1 %188, label %189, label %192
189: ; preds = %186
%190 = load i64, i64* %27
%191 = load i64*, i64** %13
store i64 %190, i64* %191
br label %192
192: ; preds = %189, %186
%193 = load i8*, i8** %15
%194 = icmp ne i8* %193, null
br i1 %194, label %195, label %199
195: ; preds = %192
%196 = load i32, i32* %26
%197 = trunc i32 %196 to i8
%198 = load i8*, i8** %15
store i8 %197, i8* %198
br label %199
199: ; preds = %195, %192
%200 = load i32*, i32** %14
%201 = icmp ne i32* %200, null
br i1 %201, label %202, label %205
202: ; preds = %199
%203 = load i32, i32* %25
%204 = load i32*, i32** %14
store i32 %203, i32* %204
br label %205
205: ; preds = %202, %199
%206 = load i8*, i8** %28
%207 = load i8**, i8*** %18
store i8* %206, i8** %207
store i32 1, i32* %12
br label %208
208: ; preds = %205, %146, %139, %124, %108
%209 = load i32, i32* %12
ret i32 %209
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32, i64, i32, i32, i32 }
@ASN1_F_ASN1_CHECK_TLEN = 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 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 %67
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 %67
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 %67
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 %67
63: ; preds = %58
%64 = load i32, i32* @ASN1_F_ASN1_CHECK_TLEN
%65 = load i32, i32* @ASN1_R_TOO_LONG
%66 = call i32 @ASN1err(i32 %64, i32 %65)
store i32 0, i32* %25
br label %131
67: ; preds = %22, %58, %41, %28
%68 = phi i32 [ %30, %28 ], [ %42, %41 ], [ %42, %58 ], [ %23, %22 ]
%69 = and i32 %68, 128
%70 = icmp eq i32 %69, 0
br i1 %70, label %77, label %71
71: ; preds = %67
%72 = load i32, i32* @ASN1_F_ASN1_CHECK_TLEN
%73 = load i32, i32* @ASN1_R_BAD_OBJECT_HEADER
%74 = call i32 @ASN1err(i32 %72, i32 %73)
br i1 %21, label %131, label %75
75: ; preds = %71
%76 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 0
store i32 0, i32* %76
br label %131
77: ; preds = %67
%78 = icmp sgt i32 %7, -1
br i1 %78, label %79, label %97
79: ; preds = %77
%80 = load i32, i32* %12
%81 = icmp eq i32 %80, %7
%82 = load i32, i32* %13
%83 = icmp eq i32 %82, %8
%84 = select i1 %81, i1 %83, i1 false
br i1 %84, label %94, label %85
85: ; preds = %79
%86 = icmp eq i8 %9, 0
br i1 %86, label %87, label %131
87: ; preds = %85
br i1 %21, label %90, label %88
88: ; preds = %87
%89 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 0
store i32 0, i32* %89
br label %90
90: ; preds = %88, %87
%91 = load i32, i32* @ASN1_F_ASN1_CHECK_TLEN
%92 = load i32, i32* @ASN1_R_WRONG_TAG
%93 = call i32 @ASN1err(i32 %91, i32 %92)
br label %131
94: ; preds = %79
br i1 %21, label %97, label %95
95: ; preds = %94
%96 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i64 0, i32 0
store i32 0, i32* %96
br label %97
97: ; preds = %94, %95, %77
%98 = and i32 %68, 1
%99 = icmp eq i32 %98, 0
br i1 %99, label %106, label %100
100: ; preds = %97
%101 = load i8*, i8** %15
%102 = ptrtoint i8* %101 to i64
%103 = ptrtoint i8* %20 to i64
%104 = add i64 %103, %6
%105 = sub i64 %104, %102
store i64 %105, i64* %14
br label %106
106: ; preds = %100, %97
%107 = icmp eq i8* %3, null
br i1 %107, label %110, label %108
108: ; preds = %106
%109 = trunc i32 %98 to i8
store i8 %109, i8* %3
br label %110
110: ; preds = %108, %106
%111 = icmp eq i8* %4, null
br i1 %111, label %116, label %112
112: ; preds = %110
%113 = load i32, i32* @V_ASN1_CONSTRUCTED
%114 = and i32 %113, %68
%115 = trunc i32 %114 to i8
store i8 %115, i8* %4
br label %116
116: ; preds = %112, %110
%117 = icmp eq i64* %0, null
br i1 %117, label %120, label %118
118: ; preds = %116
%119 = load i64, i64* %14
store i64 %119, i64* %0
br label %120
120: ; preds = %118, %116
%121 = icmp eq i8* %2, null
br i1 %121, label %125, label %122
122: ; preds = %120
%123 = load i32, i32* %13
%124 = trunc i32 %123 to i8
store i8 %124, i8* %2
br label %125
125: ; preds = %122, %120
%126 = icmp eq i32* %1, null
br i1 %126, label %129, label %127
127: ; preds = %125
%128 = load i32, i32* %12
store i32 %128, i32* %1
br label %129
129: ; preds = %127, %125
%130 = load i8*, i8** %15
store i8* %130, i8** %5
br label %131
131: ; preds = %85, %71, %75, %129, %90, %63
%132 = phi i32 [ 0, %90 ], [ 1, %129 ], [ 0, %63 ], [ 0, %75 ], [ 0, %71 ], [ -1, %85 ]
ret i32 %132
}