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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int,
                           unsigned char, unsigned char);
unsigned char *get_asn_int(unsigned char *, int *);
unsigned char *get_asn_text(unsigned char *, char *, size_t);
int /*<<< orphan*/ stderr;
unsigned char *get_asn_dbtag(unsigned char *abp, char *name, size_t name_len,
                             char *str, size_t str_len, int *id_p) {
  if (*abp == 0x30) {
    abp += 2;
  }
  if (*abp == 0xa0) {
    abp = get_asn_text(abp + 2, name, name_len);
  } else {
    fprintf(stderr, "*** ERROR [%s:%d] -  missing dbtag:db %d %d\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/uwbmrb/BMRB-API/refs/heads/master/"
            "server/wsgi/bmrbapi/submodules/fasta36/src/ncbl2_mlib.c",
            2080, abp[0], abp[1]);
    abp += 2;
  }
  if (*abp == 0xa1) {
    abp += 2;
    abp += 2;
    if (*abp == 2)
      abp = get_asn_int(abp, id_p);
    else
      abp = get_asn_text(abp, str, str_len);
  } else {
    fprintf(stderr, "*** ERROR [%s:%d] - missing dbtag:tag %2x %2x\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/uwbmrb/BMRB-API/refs/heads/master/"
            "server/wsgi/bmrbapi/submodules/fasta36/src/ncbl2_mlib.c",
            2091, abp[0], abp[1]);
    abp += 2;
  }
  return abp + 2;
}


x86 assembly (clang, -O0):
<get_asn_dbtag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x30,%eax
jne    116c <get_asn_dbtag+0x3c>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa0,%eax
jne    119c <get_asn_dbtag+0x6c>
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <get_asn_text@plt>
mov    %rax,-0x8(%rbp)
jmp    11dd <get_asn_dbtag+0xad>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%r8b
mov    -0x8(%rbp),%rax
lea    0xe49(%rip),%rsi
lea    0xe6f(%rip),%rdx
mov    $0x820,%ecx
movzbl %r8b,%r8d
movzbl 0x1(%rax),%r9d
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa1,%eax
jne    1247 <get_asn_dbtag+0x117>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2,%eax
jne    122d <get_asn_dbtag+0xfd>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <get_asn_int@plt>
mov    %rax,-0x8(%rbp)
jmp    1242 <get_asn_dbtag+0x112>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <get_asn_text@plt>
mov    %rax,-0x8(%rbp)
jmp    1288 <get_asn_dbtag+0x158>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%r8b
mov    -0x8(%rbp),%rax
lea    0xe7f(%rip),%rsi
lea    0xdc4(%rip),%rdx
mov    $0x82b,%ecx
movzbl %r8b,%r8d
movzbl 0x1(%rax),%r9d
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_asn_dbtag>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8,%r14
mov    %rcx,%r12
xor    %eax,%eax
cmpb   $0x30,(%rdi)
sete   %al
lea    (%rdi,%rax,2),%rbx
mov    (%rdi,%rax,2),%al
cmp    $0xa0,%al
jne    1165 <get_asn_dbtag+0x35>
add    $0x2,%rbx
mov    %rbx,%rdi
call   1050 <get_asn_text@plt>
mov    %rax,%rbx
jmp    1193 <get_asn_dbtag+0x63>
mov    0x2e74(%rip),%rcx
mov    (%rcx),%edi
movzbl 0x1(%rbx),%r9d
movzbl %al,%r8d
lea    0xe82(%rip),%rsi
lea    0xea8(%rip),%rdx
mov    $0x820,%ecx
call   1040 <fprintf@plt>
add    $0x2,%rbx
mov    (%rbx),%al
cmp    $0xa1,%al
jne    11ad <get_asn_dbtag+0x7d>
lea    0x4(%rbx),%rdi
cmpb   $0x2,0x4(%rbx)
jne    11dd <get_asn_dbtag+0xad>
mov    %r15,%rsi
call   1030 <get_asn_int@plt>
jmp    11e8 <get_asn_dbtag+0xb8>
mov    0x2e2c(%rip),%rcx
mov    (%rcx),%edi
movzbl 0x1(%rbx),%r9d
movzbl %al,%r8d
lea    0xf1b(%rip),%rsi
lea    0xe60(%rip),%rdx
mov    $0x82b,%ecx
call   1040 <fprintf@plt>
add    $0x2,%rbx
jmp    11eb <get_asn_dbtag+0xbb>
mov    %r12,%rsi
mov    %r14,%rdx
call   1050 <get_asn_text@plt>
mov    %rax,%rbx
add    $0x2,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"*** ERROR [%s:%d] - missing dbtag:db %d %d\0A\00"
@.str.1 = [180 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/uwbmrb/BMRB-API/refs/heads/master/server/wsgi/bmrbapi/submodules/fasta36/src/ncbl2_mlib.c\00"
@.str.2 = [47 x i8] c"*** ERROR [%s:%d] - missing dbtag:tag %2x %2x\0A\00"
define i8* @get_asn_dbtag(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4, i32* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i8* %3, i8** %10
store i64 %4, i64* %11
store i32* %5, i32** %12
%13 = load i8*, i8** %7
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = icmp eq i32 %15, 48
br i1 %16, label %17, label %20
17: ; preds = %6
%18 = load i8*, i8** %7
%19 = getelementptr inbounds i8, i8* %18, i64 2
store i8* %19, i8** %7
br label %20
20: ; preds = %17, %6
%21 = load i8*, i8** %7
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = icmp eq i32 %23, 160
br i1 %24, label %25, label %31
25: ; preds = %20
%26 = load i8*, i8** %7
%27 = getelementptr inbounds i8, i8* %26, i64 2
%28 = load i8*, i8** %8
%29 = load i64, i64* %9
%30 = call i8* @get_asn_text(i8* %27, i8* %28, i64 %29)
store i8* %30, i8** %7
br label %42
31: ; preds = %20
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %7
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = load i8*, i8** %7
%37 = getelementptr inbounds i8, i8* %36, i64 1
%38 = load i8, i8* %37
%39 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2080, i8 zeroext %35, i8 zeroext %38)
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i64 2
store i8* %41, i8** %7
br label %42
42: ; preds = %31, %25
%43 = load i8*, i8** %7
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = icmp eq i32 %45, 161
br i1 %46, label %47, label %66
47: ; preds = %42
%48 = load i8*, i8** %7
%49 = getelementptr inbounds i8, i8* %48, i64 2
store i8* %49, i8** %7
%50 = load i8*, i8** %7
%51 = getelementptr inbounds i8, i8* %50, i64 2
store i8* %51, i8** %7
%52 = load i8*, i8** %7
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = icmp eq i32 %54, 2
br i1 %55, label %56, label %60
56: ; preds = %47
%57 = load i8*, i8** %7
%58 = load i32*, i32** %12
%59 = call i8* @get_asn_int(i8* %57, i32* %58)
store i8* %59, i8** %7
br label %65
60: ; preds = %47
%61 = load i8*, i8** %7
%62 = load i8*, i8** %10
%63 = load i64, i64* %11
%64 = call i8* @get_asn_text(i8* %61, i8* %62, i64 %63)
store i8* %64, i8** %7
br label %65
65: ; preds = %60, %56
br label %77
66: ; preds = %42
%67 = load i32, i32* @stderr
%68 = load i8*, i8** %7
%69 = getelementptr inbounds i8, i8* %68, i64 0
%70 = load i8, i8* %69
%71 = load i8*, i8** %7
%72 = getelementptr inbounds i8, i8* %71, i64 1
%73 = load i8, i8* %72
%74 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2091, i8 zeroext %70, i8 zeroext %73)
%75 = load i8*, i8** %7
%76 = getelementptr inbounds i8, i8* %75, i64 2
store i8* %76, i8** %7
br label %77
77: ; preds = %66, %65
%78 = load i8*, i8** %7
%79 = getelementptr inbounds i8, i8* %78, i64 2
ret i8* %79
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"*** ERROR [%s:%d] - missing dbtag:db %d %d\0A\00"
@.str.1 = [180 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/uwbmrb/BMRB-API/refs/heads/master/server/wsgi/bmrbapi/submodules/fasta36/src/ncbl2_mlib.c\00"
@.str.2 = [47 x i8] c"*** ERROR [%s:%d] - missing dbtag:tag %2x %2x\0A\00"
define i8* @get_asn_dbtag(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4, i32* %5) {
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 48
%9 = select i1 %8, i64 2, i64 0
%10 = getelementptr i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, -96
br i1 %12, label %13, label %16
13: ; preds = %6
%14 = getelementptr inbounds i8, i8* %10, i64 2
%15 = tail call i8* @get_asn_text(i8* %14, i8* %1, i64 %2)
br label %22
16: ; preds = %6
%17 = load i32, i32* @stderr
%18 = getelementptr inbounds i8, i8* %10, i64 1
%19 = load i8, i8* %18
%20 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2080, i8 zeroext %11, i8 zeroext %19)
%21 = getelementptr inbounds i8, i8* %10, i64 2
br label %22
22: ; preds = %16, %13
%23 = phi i8* [ %15, %13 ], [ %21, %16 ]
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, -95
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %23, i64 4
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 2
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = tail call i8* @get_asn_int(i8* %27, i32* %5)
br label %40
32: ; preds = %26
%33 = tail call i8* @get_asn_text(i8* %27, i8* %3, i64 %4)
br label %40
34: ; preds = %22
%35 = load i32, i32* @stderr
%36 = getelementptr inbounds i8, i8* %23, i64 1
%37 = load i8, i8* %36
%38 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2091, i8 zeroext %24, i8 zeroext %37)
%39 = getelementptr inbounds i8, i8* %23, i64 2
br label %40
40: ; preds = %30, %32, %34
%41 = phi i8* [ %31, %30 ], [ %33, %32 ], [ %39, %34 ]
%42 = getelementptr inbounds i8, i8* %41, i64 2
ret i8* %42
}