#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 */

/* Type definitions */
typedef int /*<<< orphan*/ string;

/* Variables and functions */
unsigned char *get_asn_int(unsigned char *, int *);
unsigned char *get_asn_text(unsigned char *, char *, int);
unsigned char *get_asn_junk(unsigned char *abp) {
  int seq_cnt = 0;
  int tmp;
  char string[256];
  while (*abp) {
    if (*abp == 0x30) {
      abp += 2;
      seq_cnt++;
    } else if (*abp == 1) {
      abp = get_asn_int(abp, &tmp);
    } else if (*abp == 2) {
      abp = get_asn_int(abp, &tmp);
    } else if (*abp == 26) {
      abp = get_asn_text(abp, string, sizeof(string) - 1);
    } else {
      abp += 2;
    }
  }
  while (seq_cnt-- > 0)
    abp += 2;
  return abp;
}


x86 assembly (clang, -O0):
<get_asn_junk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1207 <get_asn_junk+0xe7>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x30,%eax
jne    116d <get_asn_junk+0x4d>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1202 <get_asn_junk+0xe2>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x1,%eax
jne    1193 <get_asn_junk+0x73>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <get_asn_int@plt>
mov    %rax,-0x8(%rbp)
jmp    11fd <get_asn_junk+0xdd>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2,%eax
jne    11b9 <get_asn_junk+0x99>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <get_asn_int@plt>
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_asn_junk+0xd8>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x1a,%eax
jne    11e7 <get_asn_junk+0xc7>
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xff,%edx
call   1040 <get_asn_text@plt>
mov    %rax,-0x8(%rbp)
jmp    11f3 <get_asn_junk+0xd3>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    11f8 <get_asn_junk+0xd8>
jmp    11fd <get_asn_junk+0xdd>
jmp    1202 <get_asn_junk+0xe2>
jmp    1136 <get_asn_junk+0x16>
jmp    120c <get_asn_junk+0xec>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1231 <get_asn_junk+0x111>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    120c <get_asn_junk+0xec>
mov    -0x8(%rbp),%rax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_asn_junk>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rdi,%rax
xor    %r15d,%r15d
lea    0xec5(%rip),%rbx
lea    0xc(%rsp),%r12
lea    0x10(%rsp),%r14
jmp    1160 <get_asn_junk+0x40>
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0xff,%edx
call   1040 <get_asn_text@plt>
movzbl (%rax),%ecx
cmp    $0x30,%rcx
ja     1180 <get_asn_junk+0x60>
movslq (%rbx,%rcx,4),%rcx
add    %rbx,%rcx
jmp    *%rcx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <get_asn_int@plt>
jmp    1160 <get_asn_junk+0x40>
nop
add    $0x2,%rax
jmp    1160 <get_asn_junk+0x40>
add    $0x2,%rax
add    $0x1,%r15d
jmp    1160 <get_asn_junk+0x40>
xor    %ecx,%ecx
sub    $0x1,%r15d
lea    0x2(%r15,%r15,1),%rdx
cmovae %rdx,%rcx
add    %rcx,%rax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @get_asn_junk(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [256 x i8]
store i8* %0, i8** %2
store i32 0, i32* %3
br label %6
6: ; preds = %51, %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %52
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 48
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 2
store i8* %17, i8** %2
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %51
20: ; preds = %10
%21 = load i8*, i8** %2
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %2
%27 = call i8* @get_asn_int(i8* %26, i32* %4)
store i8* %27, i8** %2
br label %50
28: ; preds = %20
%29 = load i8*, i8** %2
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i8*, i8** %2
%35 = call i8* @get_asn_int(i8* %34, i32* %4)
store i8* %35, i8** %2
br label %49
36: ; preds = %28
%37 = load i8*, i8** %2
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = icmp eq i32 %39, 26
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = load i8*, i8** %2
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%44 = call i8* @get_asn_text(i8* %42, i8* %43, i32 255)
store i8* %44, i8** %2
br label %48
45: ; preds = %36
%46 = load i8*, i8** %2
%47 = getelementptr inbounds i8, i8* %46, i64 2
store i8* %47, i8** %2
br label %48
48: ; preds = %45, %41
br label %49
49: ; preds = %48, %33
br label %50
50: ; preds = %49, %25
br label %51
51: ; preds = %50, %15
br label %6
52: ; preds = %6
br label %53
53: ; preds = %57, %52
%54 = load i32, i32* %3
%55 = add nsw i32 %54, -1
store i32 %55, i32* %3
%56 = icmp sgt i32 %54, 0
br i1 %56, label %57, label %60
57: ; preds = %53
%58 = load i8*, i8** %2
%59 = getelementptr inbounds i8, i8* %58, i64 2
store i8* %59, i8** %2
br label %53
60: ; preds = %53
%61 = load i8*, i8** %2
ret i8* %61
}

LLVM IR (-O2):
define i8* @get_asn_junk(i8* %0) {
%2 = alloca i32
%3 = alloca [256 x i8]
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
br label %6
6: ; preds = %20, %1
%7 = phi i8* [ %21, %20 ], [ %0, %1 ]
%8 = phi i32 [ %22, %20 ], [ 0, %1 ]
br label %9
9: ; preds = %25, %6
%10 = phi i8* [ %7, %6 ], [ %26, %25 ]
%11 = load i8, i8* %10
switch i8 %11, label %31 [
i8 0, label %12
i8 48, label %20
i8 1, label %23
i8 2, label %27
i8 26, label %29
]
12: ; preds = %9
%13 = icmp eq i32 %8, 0
%14 = add nsw i32 %8, -1
%15 = zext i32 %14 to i64
%16 = shl nuw nsw i64 %15, 1
%17 = add nuw nsw i64 %16, 2
%18 = select i1 %13, i64 0, i64 %17
%19 = getelementptr i8, i8* %10, i64 %18
ret i8* %19
20: ; preds = %9
%21 = getelementptr inbounds i8, i8* %10, i64 2
%22 = add nuw nsw i32 %8, 1
br label %6
23: ; preds = %9
%24 = call i8* @get_asn_int(i8* %10, i32* %2)
br label %25
25: ; preds = %23, %29, %31, %27
%26 = phi i8* [ %24, %23 ], [ %28, %27 ], [ %30, %29 ], [ %32, %31 ]
br label %9
27: ; preds = %9
%28 = call i8* @get_asn_int(i8* %10, i32* %2)
br label %25
29: ; preds = %9
%30 = call i8* @get_asn_text(i8* %10, i8* %5, i32 255)
br label %25
31: ; preds = %9
%32 = getelementptr inbounds i8, i8* %10, i64 2
br label %25
}