#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_seqid_other(unsigned char *abp, int *gi_p, char *acc,
                                   size_t acc_len, char *name,
                                   size_t name_len) {
  int db_type, itmp, seq_cnt = 0;
  *gi_p = 0;
  name[0] = acc[0] = '\0';
  if (*abp != 0x30) {
    fprintf(stderr,
            "*** ERROR [%s:%d] - get_asn_seqid - missing SEQ 1: %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",
            2336, abp[0], abp[1]);
    return abp;
  } else {
    abp += 2;
    seq_cnt++;
  }
  while (*abp) {
    if (*abp == 0xa1) {
      abp = get_asn_text(abp + 2, acc, acc_len);
    }
    if (*abp == 0xa3) {
      abp = get_asn_text(abp + 2, acc, acc_len);
    } else if (*abp == 0xa0) {
      abp = get_asn_text(abp + 2, name, name_len);
    } else if (*abp == 2) {
      abp = get_asn_int(abp, &itmp);
    } else {
      fprintf(stderr,
              "*** ERROR [%s:%d] -- get_asn_seqid not SEQID_ACC: %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",
              2356, abp[0], abp[1]);
      return abp;
    }
  }
  if (*abp == 171) {
    abp = get_asn_int(abp + 2, gi_p);
  }
  while (seq_cnt-- > 0) {
    abp += 4;
  }
  return abp;
}


x86 assembly (clang, -O0):
<get_asn_seqid_other>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x30,%eax
je     11c1 <get_asn_seqid_other+0x91>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%r8b
mov    -0x10(%rbp),%rax
lea    0xe66(%rip),%rsi
lea    0xe9b(%rip),%rdx
mov    $0x920,%ecx
movzbl %r8b,%r8d
movzbl 0x1(%rax),%r9d
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1343 <get_asn_seqid_other+0x213>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11db <get_asn_seqid_other+0xab>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     12ea <get_asn_seqid_other+0x1ba>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa1,%eax
jne    1213 <get_asn_seqid_other+0xe3>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <get_asn_text@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa3,%eax
jne    1243 <get_asn_seqid_other+0x113>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <get_asn_text@plt>
mov    %rax,-0x10(%rbp)
jmp    12e5 <get_asn_seqid_other+0x1b5>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa0,%eax
jne    1273 <get_asn_seqid_other+0x143>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1050 <get_asn_text@plt>
mov    %rax,-0x10(%rbp)
jmp    12e0 <get_asn_seqid_other+0x1b0>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2,%eax
jne    1299 <get_asn_seqid_other+0x169>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <get_asn_int@plt>
mov    %rax,-0x10(%rbp)
jmp    12db <get_asn_seqid_other+0x1ab>
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%r8b
mov    -0x10(%rbp),%rax
lea    0xe3c(%rip),%rsi
lea    0xd81(%rip),%rdx
mov    $0x934,%ecx
movzbl %r8b,%r8d
movzbl 0x1(%rax),%r9d
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1343 <get_asn_seqid_other+0x213>
jmp    12e0 <get_asn_seqid_other+0x1b0>
jmp    12e5 <get_asn_seqid_other+0x1b5>
jmp    11db <get_asn_seqid_other+0xab>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xab,%eax
jne    1311 <get_asn_seqid_other+0x1e1>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x18(%rbp),%rsi
call   1030 <get_asn_int@plt>
mov    %rax,-0x10(%rbp)
jmp    1316 <get_asn_seqid_other+0x1e6>
mov    -0x44(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x44(%rbp)
cmp    $0x0,%eax
jle    133b <get_asn_seqid_other+0x20b>
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1316 <get_asn_seqid_other+0x1e6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_asn_seqid_other>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x0,(%rsi)
movb   $0x0,(%rdx)
movb   $0x0,(%r8)
mov    (%rdi),%al
cmp    $0x30,%al
jne    11f0 <get_asn_seqid_other+0xc0>
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
add    $0x2,%rbx
lea    0x4(%rsp),%rbp
jmp    1185 <get_asn_seqid_other+0x55>
nopl   0x0(%rax)
add    $0x2,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <get_asn_text@plt>
mov    %rax,%rbx
movzbl (%rbx),%eax
cmp    $0xa1,%al
je     11a0 <get_asn_seqid_other+0x70>
test   %al,%al
je     1217 <get_asn_seqid_other+0xe7>
cmp    $0xa0,%al
jne    11bc <get_asn_seqid_other+0x8c>
jmp    1170 <get_asn_seqid_other+0x40>
nopw   0x0(%rax,%rax,1)
add    $0x2,%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1050 <get_asn_text@plt>
mov    %rax,%rbx
movzbl (%rax),%eax
cmp    $0xa0,%al
je     1170 <get_asn_seqid_other+0x40>
cmp    $0x2,%al
je     11e0 <get_asn_seqid_other+0xb0>
cmp    $0xa3,%al
jne    121d <get_asn_seqid_other+0xed>
add    $0x2,%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
jmp    117d <get_asn_seqid_other+0x4d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <get_asn_int@plt>
mov    %rax,%rbx
jmp    1185 <get_asn_seqid_other+0x55>
mov    0x2de9(%rip),%rcx
mov    (%rcx),%edi
movzbl 0x1(%rbx),%r9d
movzbl %al,%r8d
lea    0xdf7(%rip),%rsi
lea    0xe2c(%rip),%rdx
mov    $0x920,%ecx
jmp    1242 <get_asn_seqid_other+0x112>
add    $0x4,%rbx
jmp    1247 <get_asn_seqid_other+0x117>
mov    0x2dbc(%rip),%rcx
mov    (%rcx),%edi
movzbl 0x1(%rbx),%r9d
movzbl %al,%r8d
lea    0xeba(%rip),%rsi
lea    0xdff(%rip),%rdx
mov    $0x934,%ecx
call   1040 <fprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"*** ERROR [%s:%d] - get_asn_seqid - missing SEQ 1: %2x %2x\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 = [59 x i8] c"*** ERROR [%s:%d] -- get_asn_seqid not SEQID_ACC: %2x %2x\0A\00"
define i8* @get_asn_seqid_other(i8* %0, i32* %1, i8* %2, i64 %3, i8* %4, i64 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %8
store i32* %1, i32** %9
store i8* %2, i8** %10
store i64 %3, i64* %11
store i8* %4, i8** %12
store i64 %5, i64* %13
store i32 0, i32* %16
%17 = load i32*, i32** %9
store i32 0, i32* %17
%18 = load i8*, i8** %10
%19 = getelementptr inbounds i8, i8* %18, i64 0
store i8 0, i8* %19
%20 = load i8*, i8** %12
%21 = getelementptr inbounds i8, i8* %20, i64 0
store i8 0, i8* %21
%22 = load i8*, i8** %8
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = icmp ne i32 %24, 48
br i1 %25, label %26, label %36
26: ; preds = %6
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %8
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
%34 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2336, i8 zeroext %30, i8 zeroext %33)
%35 = load i8*, i8** %8
store i8* %35, i8** %7
br label %120
36: ; preds = %6
%37 = load i8*, i8** %8
%38 = getelementptr inbounds i8, i8* %37, i64 2
store i8* %38, i8** %8
%39 = load i32, i32* %16
%40 = add nsw i32 %39, 1
store i32 %40, i32* %16
br label %41
41: ; preds = %36
br label %42
42: ; preds = %99, %41
%43 = load i8*, i8** %8
%44 = load i8, i8* %43
%45 = icmp ne i8 %44, 0
br i1 %45, label %46, label %100
46: ; preds = %42
%47 = load i8*, i8** %8
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = icmp eq i32 %49, 161
br i1 %50, label %51, label %57
51: ; preds = %46
%52 = load i8*, i8** %8
%53 = getelementptr inbounds i8, i8* %52, i64 2
%54 = load i8*, i8** %10
%55 = load i64, i64* %11
%56 = call i8* @get_asn_text(i8* %53, i8* %54, i64 %55)
store i8* %56, i8** %8
br label %57
57: ; preds = %51, %46
%58 = load i8*, i8** %8
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = icmp eq i32 %60, 163
br i1 %61, label %62, label %68
62: ; preds = %57
%63 = load i8*, i8** %8
%64 = getelementptr inbounds i8, i8* %63, i64 2
%65 = load i8*, i8** %10
%66 = load i64, i64* %11
%67 = call i8* @get_asn_text(i8* %64, i8* %65, i64 %66)
store i8* %67, i8** %8
br label %99
68: ; preds = %57
%69 = load i8*, i8** %8
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = icmp eq i32 %71, 160
br i1 %72, label %73, label %79
73: ; preds = %68
%74 = load i8*, i8** %8
%75 = getelementptr inbounds i8, i8* %74, i64 2
%76 = load i8*, i8** %12
%77 = load i64, i64* %13
%78 = call i8* @get_asn_text(i8* %75, i8* %76, i64 %77)
store i8* %78, i8** %8
br label %98
79: ; preds = %68
%80 = load i8*, i8** %8
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = icmp eq i32 %82, 2
br i1 %83, label %84, label %87
84: ; preds = %79
%85 = load i8*, i8** %8
%86 = call i8* @get_asn_int(i8* %85, i32* %15)
store i8* %86, i8** %8
br label %97
87: ; preds = %79
%88 = load i32, i32* @stderr
%89 = load i8*, i8** %8
%90 = getelementptr inbounds i8, i8* %89, i64 0
%91 = load i8, i8* %90
%92 = load i8*, i8** %8
%93 = getelementptr inbounds i8, i8* %92, i64 1
%94 = load i8, i8* %93
%95 = call i32 @fprintf(i32 %88, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2356, i8 zeroext %91, i8 zeroext %94)
%96 = load i8*, i8** %8
store i8* %96, i8** %7
br label %120
97: ; preds = %84
br label %98
98: ; preds = %97, %73
br label %99
99: ; preds = %98, %62
br label %42
100: ; preds = %42
%101 = load i8*, i8** %8
%102 = load i8, i8* %101
%103 = zext i8 %102 to i32
%104 = icmp eq i32 %103, 171
br i1 %104, label %105, label %110
105: ; preds = %100
%106 = load i8*, i8** %8
%107 = getelementptr inbounds i8, i8* %106, i64 2
%108 = load i32*, i32** %9
%109 = call i8* @get_asn_int(i8* %107, i32* %108)
store i8* %109, i8** %8
br label %110
110: ; preds = %105, %100
br label %111
111: ; preds = %115, %110
%112 = load i32, i32* %16
%113 = add nsw i32 %112, -1
store i32 %113, i32* %16
%114 = icmp sgt i32 %112, 0
br i1 %114, label %115, label %118
115: ; preds = %111
%116 = load i8*, i8** %8
%117 = getelementptr inbounds i8, i8* %116, i64 4
store i8* %117, i8** %8
br label %111
118: ; preds = %111
%119 = load i8*, i8** %8
store i8* %119, i8** %7
br label %120
120: ; preds = %118, %87, %26
%121 = load i8*, i8** %7
ret i8* %121
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"*** ERROR [%s:%d] - get_asn_seqid - missing SEQ 1: %2x %2x\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 = [59 x i8] c"*** ERROR [%s:%d] -- get_asn_seqid not SEQID_ACC: %2x %2x\0A\00"
define i8* @get_asn_seqid_other(i8* %0, i32* nocapture writeonly %1, i8* %2, i64 %3, i8* %4, i64 %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
store i32 0, i32* %1
store i8 0, i8* %2
store i8 0, i8* %4
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 48
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %13
%15 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2336, i8 zeroext %9, i8 zeroext %14)
br label %45
16: ; preds = %6
%17 = getelementptr inbounds i8, i8* %0, i64 2
br label %18
18: ; preds = %36, %16
%19 = phi i8* [ %17, %16 ], [ %37, %36 ]
%20 = load i8, i8* %19
switch i8 %20, label %27 [
i8 0, label %21
i8 -95, label %23
]
21: ; preds = %18
%22 = getelementptr i8, i8* %19, i64 4
br label %45
23: ; preds = %18
%24 = getelementptr inbounds i8, i8* %19, i64 2
%25 = call i8* @get_asn_text(i8* %24, i8* %2, i64 %3)
%26 = load i8, i8* %25
br label %27
27: ; preds = %18, %23
%28 = phi i8 [ %20, %18 ], [ %26, %23 ]
%29 = phi i8* [ %19, %18 ], [ %25, %23 ]
switch i8 %28, label %40 [
i8 -93, label %30
i8 -96, label %33
i8 2, label %38
]
30: ; preds = %27
%31 = getelementptr inbounds i8, i8* %29, i64 2
%32 = call i8* @get_asn_text(i8* %31, i8* %2, i64 %3)
br label %36
33: ; preds = %27
%34 = getelementptr inbounds i8, i8* %29, i64 2
%35 = call i8* @get_asn_text(i8* %34, i8* %4, i64 %5)
br label %36
36: ; preds = %33, %38, %30
%37 = phi i8* [ %32, %30 ], [ %35, %33 ], [ %39, %38 ]
br label %18
38: ; preds = %27
%39 = call i8* @get_asn_int(i8* %29, i32* %7)
br label %36
40: ; preds = %27
%41 = load i32, i32* @stderr
%42 = getelementptr inbounds i8, i8* %29, i64 1
%43 = load i8, i8* %42
%44 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2356, i8 zeroext %28, i8 zeroext %43)
br label %45
45: ; preds = %21, %40, %11
%46 = phi i8* [ %0, %11 ], [ %29, %40 ], [ %22, %21 ]
ret i8* %46
}