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

    if (val < 0x80) {
        *val_p =   val;
        return 1;

    } else if (val < 0xc0) {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val & (((1LL<<(6+8)))-1);
        return 2;

    } else if (val < 0xe0) {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val & ((1LL<<(5+2*8))-1);
        return 3;

    } else if (val < 0xf0) {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val & ((1LL<<(4+3*8))-1);
        return 4;

    } else if (val < 0xf8) {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val & ((1LL<<(3+4*8))-1);
        return 5;

    } else if (val < 0xfc) {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val & ((1LL<<(2+5*8))-1);
        return 6;

    } else if (val < 0xfe) {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val & ((1LL<<(1+6*8))-1);
        return 7;

    } else if (val < 0xff) {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val & ((1LL<<(7*8))-1);
        return 8;

    } else {
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        val = (val<<8) | (unsigned char)hgetc(fd->fp);
        *val_p = val;
    }

    return 9;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4b3d1
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %r15d
jmp 0x4b3df
callq 0xee9b
cmpl $-0x1, %eax
je 0x4b43e
movzbl %al, %r15d
movl $0x1, %eax
cmpl $0x80, %r15d
jb 0x4b68c
cmpl $0xbf, %r15d
ja 0x4b418
shll $0x8, %r15d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4b448
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4b44d
cmpl $0xdf, %r15d
ja 0x4b464
movq (%r14), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rdx
cmpq %rax, %rdx
jbe 0x4b491
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4b4a1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4b68f
callq 0xee9b
movzbl %al, %eax
andl $0x3f00, %r15d          # imm = 0x3F00
orq %rax, %r15
movl $0x2, %eax
jmp 0x4b68c
cmpl $0xef, %r15d
ja 0x4b4be
movq (%r14), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x4b50a
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4b51a
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %rdx
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r14d
cmpq %rcx, %rdx
jbe 0x4b4eb
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rcx), %eax
jmp 0x4b4f0
cmpl $0xf7, %r15d
ja 0x4b53a
movq (%r14), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x4b5b3
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4b5c3
callq 0xee9b
movzbl %al, %eax
andl $0x1f0000, %r15d        # imm = 0x1F0000
orq %r14, %r15
orq %rax, %r15
movl $0x3, %eax
jmp 0x4b68c
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
cmpq %rdx, %rcx
jbe 0x4b56b
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b57b
cmpl $0xfb, %r15d
ja 0x4b5e3
movq (%r14), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x4b698
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4b6a8
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orl %eax, %r12d
shll $0x8, %r12d
cmpq %rsi, %rcx
jbe 0x4b597
leaq 0x1(%rsi), %rax
movq %rax, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b59c
callq 0xee9b
movzbl %al, %eax
andl $0xfffff00, %r12d       # imm = 0xFFFFF00
orq %rax, %r12
movl $0x4, %eax
jmp 0x4b689
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
cmpq %rdx, %rcx
jbe 0x4b614
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b624
cmpl $0xfd, %r15d
ja 0x4b6c8
movq (%r14), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x4b79f
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4b7af
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r12
cmpq %rsi, %rcx
jbe 0x4b63c
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b64c
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r14d
cmpq %rdx, %rcx
jbe 0x4b669
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b66e
callq 0xee9b
movzbl %al, %eax
movabsq $0x7ffff0000, %rcx      # imm = 0x7FFFF0000
andq %rcx, %r12
orq %r14, %r12
orq %rax, %r12
movl $0x5, %eax
movq %r12, %r15
movq %r15, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
cmpq %rdx, %rcx
jbe 0x4b6f9
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b709
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
cmpl $0xff, %r15d
jne 0x4b7cf
cmpq %rdx, %rcx
jbe 0x4b8ba
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %ebp
jmp 0x4b8cc
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r12
cmpq %rsi, %rcx
jbe 0x4b721
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b731
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
cmpq %rdx, %rcx
jbe 0x4b751
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b761
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r15
shlq $0x8, %r15
cmpq %rsi, %rcx
jbe 0x4b77d
leaq 0x1(%rsi), %rax
movq %rax, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b782
callq 0xee9b
movzbl %al, %eax
movabsq $0x3ffffffff00, %rcx    # imm = 0x3FFFFFFFF00
andq %rcx, %r15
orq %rax, %r15
movl $0x6, %eax
jmp 0x4b68c
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
cmpq %rdx, %rcx
jbe 0x4b7e8
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b7f8
cmpq %rdx, %rcx
jbe 0x4b8de
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b8ee
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r12
cmpq %rsi, %rcx
jbe 0x4b810
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b820
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
cmpq %rdx, %rcx
jbe 0x4b840
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b850
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r15
cmpq %rsi, %rcx
jbe 0x4b868
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b878
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r15
shll $0x8, %eax
movzwl %ax, %r14d
cmpq %rdx, %rcx
jbe 0x4b895
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b89a
callq 0xee9b
movzbl %al, %eax
movabsq $0x1ffffffff0000, %rcx  # imm = 0x1FFFFFFFF0000
andq %rcx, %r15
orq %r14, %r15
orq %rax, %r15
movl $0x7, %eax
jmp 0x4b68c
callq 0xee9b
movl %eax, %ebp
movq (%r14), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpq %rax, %rcx
jbe 0x4b907
leaq 0x1(%rax), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4b917
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
shll $0x8, %eax
movzwl %ax, %r15d
cmpq %rsi, %rcx
jbe 0x4b936
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b946
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shll $0x10, %ebp
shll $0x8, %eax
movzwl %ax, %r12d
orl %ebp, %r12d
cmpq %rdx, %rcx
jbe 0x4b961
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b971
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
movzbl %al, %ebp
orl %r15d, %ebp
shll $0x8, %ebp
cmpq %rdx, %rcx
jbe 0x4b98a
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4b99a
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %r15d
orl %r12d, %r15d
cmpq %rsi, %rcx
jbe 0x4b9b3
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b9c3
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %r12d
orl %ebp, %r12d
cmpq %rsi, %rcx
jbe 0x4b9e3
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4b9f3
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r15
shll $0x8, %eax
movzwl %ax, %r12d
orq %r15, %r12
cmpq %rdx, %rcx
jbe 0x4ba13
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4ba23
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
cmpq %rdx, %rcx
jbe 0x4ba3b
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4ba4b
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r12
cmpq %rsi, %rcx
jbe 0x4ba63
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4ba73
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r15
cmpq %rsi, %rcx
jbe 0x4ba93
leaq 0x1(%rsi), %rdx
movq %rdx, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4baa3
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
cmpq %rdx, %rcx
jbe 0x4bac0
leaq 0x1(%rdx), %rsi
movq %rsi, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4bad0
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
shlq $0x10, %r15
shll $0x8, %eax
movzwl %ax, %r14d
cmpq %rdx, %rcx
jbe 0x4baec
leaq 0x1(%rdx), %rax
movq %rax, 0x8(%rdi)
movzbl (%rdx), %eax
jmp 0x4baf1
callq 0xee9b
movq (%r14), %rdi
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rcx
movzbl %al, %eax
orq %rax, %r15
shlq $0x8, %r15
cmpq %rsi, %rcx
jbe 0x4bb0b
leaq 0x1(%rsi), %rax
movq %rax, 0x8(%rdi)
movzbl (%rsi), %eax
jmp 0x4bb10
callq 0xee9b
movzbl %al, %eax
andq $-0x10000, %r15         # imm = 0xFFFF0000
orq %r14, %r15
orq %rax, %r15
movl $0x8, %eax
jmp 0x4b68c
callq 0xee9b
movzbl %al, %eax
orq %rax, %r15
movl $0x9, %eax
jmp 0x4b68c