// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/cram/cram_io.c
// Function: ltf8_decode_crc
int ltf8_decode_crc(cram_fd *fd, int64_t *val_p, uint32_t *crc) {
    unsigned char c[9];
    int64_t val = (unsigned char)hgetc(fd->fp);
    if (val == -1)
	return -1;

    c[0] = val;

    if (val < 0x80) {
	*val_p =   val;
	*crc = crc32(*crc, c, 1);
	return 1;

    } else if (val < 0xc0) {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	*val_p = val & (((1LL<<(6+8)))-1);
	*crc = crc32(*crc, c, 2);
	return 2;

    } else if (val < 0xe0) {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	val = (val<<8) | (c[2]=hgetc(fd->fp));;
	*val_p = val & ((1LL<<(5+2*8))-1);
	*crc = crc32(*crc, c, 3);
	return 3;

    } else if (val < 0xf0) {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	val = (val<<8) | (c[2]=hgetc(fd->fp));;
	val = (val<<8) | (c[3]=hgetc(fd->fp));;
	*val_p = val & ((1LL<<(4+3*8))-1);
	*crc = crc32(*crc, c, 4);
	return 4;

    } else if (val < 0xf8) {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	val = (val<<8) | (c[2]=hgetc(fd->fp));;
	val = (val<<8) | (c[3]=hgetc(fd->fp));;
	val = (val<<8) | (c[4]=hgetc(fd->fp));;
	*val_p = val & ((1LL<<(3+4*8))-1);
	*crc = crc32(*crc, c, 5);
	return 5;

    } else if (val < 0xfc) {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	val = (val<<8) | (c[2]=hgetc(fd->fp));;
	val = (val<<8) | (c[3]=hgetc(fd->fp));;
	val = (val<<8) | (c[4]=hgetc(fd->fp));;
	val = (val<<8) | (c[5]=hgetc(fd->fp));;
	*val_p = val & ((1LL<<(2+5*8))-1);
	*crc = crc32(*crc, c, 6);
	return 6;

    } else if (val < 0xfe) {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	val = (val<<8) | (c[2]=hgetc(fd->fp));;
	val = (val<<8) | (c[3]=hgetc(fd->fp));;
	val = (val<<8) | (c[4]=hgetc(fd->fp));;
	val = (val<<8) | (c[5]=hgetc(fd->fp));;
	val = (val<<8) | (c[6]=hgetc(fd->fp));;
	*val_p = val & ((1LL<<(1+6*8))-1);
	*crc = crc32(*crc, c, 7);
	return 7;

    } else if (val < 0xff) {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	val = (val<<8) | (c[2]=hgetc(fd->fp));;
	val = (val<<8) | (c[3]=hgetc(fd->fp));;
	val = (val<<8) | (c[4]=hgetc(fd->fp));;
	val = (val<<8) | (c[5]=hgetc(fd->fp));;
	val = (val<<8) | (c[6]=hgetc(fd->fp));;
	val = (val<<8) | (c[7]=hgetc(fd->fp));;
	*val_p = val & ((1LL<<(7*8))-1);
	*crc = crc32(*crc, c, 8);
	return 8;

    } else {
	val = (val<<8) | (c[1]=hgetc(fd->fp));;
	val = (val<<8) | (c[2]=hgetc(fd->fp));;
	val = (val<<8) | (c[3]=hgetc(fd->fp));;
	val = (val<<8) | (c[4]=hgetc(fd->fp));;
	val = (val<<8) | (c[5]=hgetc(fd->fp));;
	val = (val<<8) | (c[6]=hgetc(fd->fp));;
	val = (val<<8) | (c[7]=hgetc(fd->fp));;
	val = (val<<8) | (c[8]=hgetc(fd->fp));;
	*crc = crc32(*crc, c, 9);
	*val_p = val;
    }

    return 9;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x55544
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x55549
callq 0x6af76
movzbl %al, %r12d
movb %r12b, 0xf(%rsp)
cmpl $0x7f, %r12d
ja 0x55571
movq %r12, (%r14)
movl (%rbx), %edi
leaq 0xf(%rsp), %rsi
movl $0x1, %ebp
movl $0x1, %edx
jmp 0x55d65
cmpl $0xbf, %r12d
ja 0x55598
shll $0x8, %r12d
movq (%r15), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x555be
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x555c3
cmpl $0xdf, %r12d
ja 0x555ec
movq (%r15), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rdx
cmpq %rax, %rdx
jbe 0x55619
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x55629
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x1(%rsi)
movzbl %al, %eax
andl $0x3f00, %r12d          # imm = 0x3F00
orq %rax, %r12
movq %r12, (%r14)
movl (%rbx), %edi
movl $0x2, %ebp
movl $0x2, %edx
jmp 0x55d65
cmpl $0xef, %r12d
ja 0x5564a
movq (%r15), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x556ac
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x556bc
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %rdx
movb %al, 0x10(%rsp)
shll $0x10, %r12d
shll $0x8, %eax
movzwl %ax, %r15d
cmpq %rcx, %rdx
jbe 0x5567b
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rcx), %eax
jmp 0x55680
cmpl $0xf7, %r12d
ja 0x556e0
movq (%r15), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x5576f
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x5577f
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x2(%rsi)
movzbl %al, %eax
andl $0x1f0000, %r12d        # imm = 0x1F0000
orq %r15, %r12
orq %rax, %r12
movq %r12, (%r14)
movl (%rbx), %edi
movl $0x3, %ebp
movl $0x3, %edx
jmp 0x55d65
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x10(%rsp)
shll $0x10, %r12d
shll $0x8, %eax
movzwl %ax, %r13d
orl %r12d, %r13d
cmpq %rdx, %rcx
jbe 0x55711
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55721
cmpl $0xfb, %r12d
ja 0x557a3
movq (%r15), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x55868
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x55878
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x11(%rsp)
movzbl %al, %eax
orl %eax, %r13d
shll $0x8, %r13d
cmpq %rsi, %rcx
jbe 0x55741
leaq 0x1(%rsi), %rax
movq %rax, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55746
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x3(%rsi)
movzbl %al, %eax
andl $0xfffff00, %r13d       # imm = 0xFFFFF00
orq %rax, %r13
movq %r13, (%r14)
movl (%rbx), %edi
movl $0x4, %ebp
movl $0x4, %edx
jmp 0x55d65
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x10(%rsp)
shll $0x10, %r12d
shll $0x8, %eax
movzwl %ax, %r13d
orl %r12d, %r13d
cmpq %rdx, %rcx
jbe 0x557d4
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x557e4
cmpl $0xfd, %r12d
ja 0x5589c
movq (%r15), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x55991
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x559a1
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x11(%rsp)
movzbl %al, %eax
orq %rax, %r13
cmpq %rsi, %rcx
jbe 0x55800
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55810
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x12(%rsp)
shlq $0x10, %r13
shll $0x8, %eax
movzwl %ax, %r15d
cmpq %rdx, %rcx
jbe 0x55831
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55836
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x4(%rsi)
movzbl %al, %eax
movabsq $0x7ffff0000, %rcx      # imm = 0x7FFFF0000
andq %rcx, %r13
orq %r15, %r13
orq %rax, %r13
movq %r13, (%r14)
movl (%rbx), %edi
movl $0x5, %ebp
movl $0x5, %edx
jmp 0x55d65
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x10(%rsp)
shll $0x10, %r12d
shll $0x8, %eax
movzwl %ax, %r13d
orl %r12d, %r13d
cmpq %rdx, %rcx
jbe 0x558cd
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x558dd
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
cmpl $0xff, %r12d
jne 0x559c5
cmpq %rdx, %rcx
jbe 0x55ad2
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %ebp
jmp 0x55ae4
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x11(%rsp)
movzbl %al, %eax
orq %rax, %r13
cmpq %rsi, %rcx
jbe 0x558f9
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55909
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x12(%rsp)
shlq $0x10, %r13
shll $0x8, %eax
movzwl %ax, %r12d
orq %r13, %r12
cmpq %rdx, %rcx
jbe 0x5592d
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x5593d
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x13(%rsp)
movzbl %al, %eax
orq %rax, %r12
shlq $0x8, %r12
cmpq %rsi, %rcx
jbe 0x5595d
leaq 0x1(%rsi), %rax
movq %rax, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55962
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x5(%rsi)
movzbl %al, %eax
movabsq $0x3ffffffff00, %rcx    # imm = 0x3FFFFFFFF00
andq %rcx, %r12
orq %rax, %r12
movq %r12, (%r14)
movl (%rbx), %edi
movl $0x6, %ebp
movl $0x6, %edx
jmp 0x55d65
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x10(%rsp)
shll $0x10, %r12d
shll $0x8, %eax
movzwl %ax, %r13d
orl %r12d, %r13d
cmpq %rdx, %rcx
jbe 0x559de
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x559ee
cmpq %rdx, %rcx
jbe 0x55afb
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55b0b
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x11(%rsp)
movzbl %al, %eax
orq %rax, %r13
cmpq %rsi, %rcx
jbe 0x55a0a
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55a1a
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x12(%rsp)
shlq $0x10, %r13
shll $0x8, %eax
movzwl %ax, %r12d
orq %r13, %r12
cmpq %rdx, %rcx
jbe 0x55a3e
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55a4e
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x13(%rsp)
movzbl %al, %eax
orq %rax, %r12
cmpq %rsi, %rcx
jbe 0x55a6a
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55a7a
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x14(%rsp)
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
cmpq %rdx, %rcx
jbe 0x55a9b
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55aa0
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x6(%rsi)
movzbl %al, %eax
movabsq $0x1ffffffff0000, %rcx  # imm = 0x1FFFFFFFF0000
andq %rcx, %r12
orq %r15, %r12
orq %rax, %r12
movq %r12, (%r14)
movl (%rbx), %edi
movl $0x7, %ebp
movl $0x7, %edx
jmp 0x55d65
callq 0x6af76
movl %eax, %ebp
movq (%r15), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
movb %bpl, 0x10(%rsp)
cmpq %rax, %rcx
jbe 0x55b28
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x55b38
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x10(%rsp)
shll $0x8, %eax
movzwl %ax, %r12d
cmpq %rsi, %rcx
jbe 0x55b5b
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55b6b
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x11(%rsp)
shll $0x10, %ebp
shll $0x8, %eax
movzwl %ax, %r12d
orl %ebp, %r12d
cmpq %rdx, %rcx
jbe 0x55b8a
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55b9a
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x11(%rsp)
movzbl %al, %ebp
orl %r12d, %ebp
shll $0x8, %ebp
cmpq %rdx, %rcx
jbe 0x55bb7
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55bc7
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x12(%rsp)
movzbl %al, %r13d
orl %r12d, %r13d
cmpq %rsi, %rcx
jbe 0x55be4
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55bf4
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x12(%rsp)
movzbl %al, %r13d
orl %ebp, %r13d
cmpq %rsi, %rcx
jbe 0x55c18
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55c28
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x13(%rsp)
shlq $0x10, %r13
shll $0x8, %eax
movzwl %ax, %r12d
orq %r13, %r12
cmpq %rdx, %rcx
jbe 0x55c4c
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55c5c
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x13(%rsp)
shlq $0x10, %r13
shll $0x8, %eax
movzwl %ax, %r12d
orq %r13, %r12
cmpq %rdx, %rcx
jbe 0x55c78
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55c88
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x14(%rsp)
movzbl %al, %eax
orq %rax, %r12
cmpq %rsi, %rcx
jbe 0x55ca4
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55cb4
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x14(%rsp)
movzbl %al, %eax
orq %rax, %r12
cmpq %rsi, %rcx
jbe 0x55cd8
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55ce8
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x15(%rsp)
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r13d
orq %r12, %r13
cmpq %rdx, %rcx
jbe 0x55d09
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55d19
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movb %al, 0x15(%rsp)
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
cmpq %rdx, %rcx
jbe 0x55d39
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x55d3e
callq 0x6af76
movq (%r15), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movb %al, 0x16(%rsp)
movzbl %al, %eax
orq %rax, %r13
shlq $0x8, %r13
cmpq %rsi, %rcx
jbe 0x55d7d
leaq 0x1(%rsi), %rax
movq %rax, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x55d82
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x7(%rsi)
movzbl %al, %eax
andq $-0x10000, %r12         # imm = 0xFFFF0000
orq %r15, %r12
orq %rax, %r12
movq %r12, (%r14)
movl (%rbx), %edi
movl $0x8, %ebp
movl $0x8, %edx
callq 0x64b0
movl %eax, (%rbx)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6af76
leaq 0xf(%rsp), %rsi
movb %al, 0x8(%rsi)
movzbl %al, %eax
orq %rax, %r13
movl (%rbx), %edi
movl $0x9, %ebp
movl $0x9, %edx
callq 0x64b0
movl %eax, (%rbx)
movq %r13, (%r14)
jmp 0x55d6c