#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_date_std(unsigned char *, char *);
unsigned char *get_asn_text(unsigned char *, char *, size_t);
int /*<<< orphan*/ stderr;
unsigned char *get_asn_date(unsigned char *abp, char *date, size_t date_len) {
  if (*abp == 0xa0) {
    abp = get_asn_text(abp, date, date_len);
  } else if (*abp == 0xa1) {
    abp = get_asn_date_std(abp + 2, date);
  } else {
    fprintf(stderr, "*** ERROR [%s:%d] - incorrect date code: %0x1 %0x1\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",
            2146, abp[0], abp[1]);
  }
  return abp + 2;
}


x86 assembly (clang, -O0):
<get_asn_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa0,%eax
jne    1170 <get_asn_date+0x40>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <get_asn_text@plt>
mov    %rax,-0x8(%rbp)
jmp    11d6 <get_asn_date+0xa6>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa1,%eax
jne    119c <get_asn_date+0x6c>
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <get_asn_date_std@plt>
mov    %rax,-0x8(%rbp)
jmp    11d1 <get_asn_date+0xa1>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%r8b
mov    -0x8(%rbp),%rax
lea    0xe49(%rip),%rsi
lea    0xe76(%rip),%rdx
mov    $0x862,%ecx
movzbl %r8b,%r8d
movzbl 0x1(%rax),%r9d
call   1030 <fprintf@plt>
jmp    11d6 <get_asn_date+0xa6>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_asn_date>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0xa1,%al
je     114b <get_asn_date+0x1b>
cmp    $0xa0,%al
jne    115c <get_asn_date+0x2c>
mov    %rbx,%rdi
call   1050 <get_asn_text@plt>
mov    %rax,%rbx
jmp    1186 <get_asn_date+0x56>
add    $0x2,%rbx
mov    %rbx,%rdi
call   1040 <get_asn_date_std@plt>
mov    %rax,%rbx
jmp    1186 <get_asn_date+0x56>
mov    0x2e7d(%rip),%rcx
mov    (%rcx),%edi
movzbl 0x1(%rbx),%r9d
movzbl %al,%r8d
lea    0xe8b(%rip),%rsi
lea    0xeb8(%rip),%rdx
mov    $0x862,%ecx
call   1030 <fprintf@plt>
add    $0x2,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [52 x i8] c"*** ERROR [%s:%d] - incorrect date code: %0x1 %0x1\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"
define i8* @get_asn_date(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = icmp eq i32 %9, 160
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = call i8* @get_asn_text(i8* %12, i8* %13, i64 %14)
store i8* %15, i8** %4
br label %36
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = icmp eq i32 %19, 161
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8*, i8** %5
%25 = call i8* @get_asn_date_std(i8* %23, i8* %24)
store i8* %25, i8** %4
br label %35
26: ; preds = %16
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
%34 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2146, i8 zeroext %30, i8 zeroext %33)
br label %35
35: ; preds = %26, %21
br label %36
36: ; preds = %35, %11
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i64 2
ret i8* %38
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [52 x i8] c"*** ERROR [%s:%d] - incorrect date code: %0x1 %0x1\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"
define i8* @get_asn_date(i8* %0, i8* %1, i64 %2) {
%4 = load i8, i8* %0
switch i8 %4, label %10 [
i8 -96, label %5
i8 -95, label %7
]
5: ; preds = %3
%6 = tail call i8* @get_asn_text(i8* %0, i8* %1, i64 %2)
br label %15
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = tail call i8* @get_asn_date_std(i8* %8, i8* %1)
br label %15
10: ; preds = %3
%11 = load i32, i32* @stderr
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = load i8, i8* %12
%14 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str.1, i64 0, i64 0), i32 2146, i8 zeroext %4, i8 zeroext %13)
br label %15
15: ; preds = %7, %10, %5
%16 = phi i8* [ %6, %5 ], [ %9, %7 ], [ %0, %10 ]
%17 = getelementptr inbounds i8, i8* %16, i64 2
ret i8* %17
}