// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x3e519
cmpl $-0x1, %eax
je 0x3e869
movzbl %al, %r15d
cmpl $0x80, %r15d
jae 0x3e871
pushq $0x1
jmp 0x3ec45
pushq $-0x1
popq %rax
jmp 0x3ec49
cmpl $0xbf, %r15d
ja 0x3e897
movq (%r14), %rdi
callq 0x3e519
movzbl %al, %eax
andl $0x3f, %r15d
shll $0x8, %r15d
orl %eax, %r15d
pushq $0x2
jmp 0x3ec45
cmpl $0xdf, %r15d
ja 0x3e8ce
movq (%r14), %rdi
callq 0x3e519
shll $0x8, %eax
movzwl %ax, %ebp
movq (%r14), %rdi
callq 0x3e519
movzbl %al, %eax
andl $0x1f, %r15d
shll $0x10, %r15d
orl %ebp, %r15d
orl %eax, %r15d
pushq $0x3
jmp 0x3ec45
cmpl $0xef, %r15d
ja 0x3e923
movq (%r14), %rdi
callq 0x3e519
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %ebp
orl %r15d, %ebp
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
movl $0xff, %r12d
andl %r12d, %r15d
orl %ebp, %r15d
shll $0x8, %r15d
movq (%r14), %rdi
callq 0x3e519
andl %r12d, %eax
andl $0xfffff00, %r15d       # imm = 0xFFFFF00
orl %eax, %r15d
pushq $0x4
jmp 0x3ec45
cmpl $0xf7, %r15d
ja 0x3e998
movq (%r14), %rdi
callq 0x3e519
movl %eax, %ebp
shll $0x10, %r15d
shll $0x8, %ebp
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %ebp
orl %r15d, %ebp
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
movl $0xff, %r13d
andl %r13d, %r15d
orl %ebp, %r15d
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
shll $0x8, %r12d
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %r12d
movq (%r14), %rdi
callq 0x3e519
andl %r13d, %eax
andl $0x7ffff, %r15d         # imm = 0x7FFFF
shlq $0x10, %r15
orq %r12, %r15
orq %rax, %r15
pushq $0x5
jmp 0x3ec45
cmpl $0xfb, %r15d
ja 0x3ea2c
movq (%r14), %rdi
callq 0x3e519
movl %eax, %ebp
shll $0x10, %r15d
shll $0x8, %ebp
movl $0xffff, %r13d          # imm = 0xFFFF
andl %r13d, %ebp
orl %r15d, %ebp
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
movl $0xff, %eax
andl %eax, %r15d
orl %ebp, %r15d
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
shlq $0x10, %r15
shll $0x8, %r12d
andl %r13d, %r12d
orq %r15, %r12
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r13d
movl $0xff, %ebp
andl %ebp, %r13d
orq %r12, %r13
shlq $0x8, %r13
movq (%r14), %rdi
callq 0x3e519
andl %ebp, %eax
movabsq $0x3ffffffff00, %r15    # imm = 0x3FFFFFFFF00
andq %r13, %r15
orq %rax, %r15
pushq $0x6
jmp 0x3ec45
cmpl $0xfd, %r15d
ja 0x3eae0
movq (%r14), %rdi
callq 0x3e519
movl %eax, %ebp
shll $0x10, %r15d
shll $0x8, %ebp
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %ebp
movl $0xffff, %r13d          # imm = 0xFFFF
orl %r15d, %ebp
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
movl $0xff, %eax
andl %eax, %r15d
orl %ebp, %r15d
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
shlq $0x10, %r15
shll $0x8, %r12d
andl %r13d, %r12d
movl $0xffff, %ebp           # imm = 0xFFFF
orq %r15, %r12
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r13d
movl $0xff, %r15d
andl %r15d, %r13d
orq %r12, %r13
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
shlq $0x10, %r13
shll $0x8, %r12d
andl %ebp, %r12d
movq (%r14), %rdi
callq 0x3e519
andl %r15d, %eax
movabsq $0x1ffffffff0000, %r15  # imm = 0x1FFFFFFFF0000
andq %r13, %r15
orq %r12, %r15
orq %rax, %r15
pushq $0x7
jmp 0x3ec45
movq (%r14), %rdi
callq 0x3e519
movl %eax, %ebp
cmpl $0xff, %r15d
jne 0x3eb9b
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
shll $0x10, %ebp
shll $0x8, %r15d
movl $0xffff, %r13d          # imm = 0xFFFF
andl %r13d, %r15d
orl %ebp, %r15d
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
movl $0xff, %ebp
andl %ebp, %r12d
orl %r15d, %r12d
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
shlq $0x10, %r12
shll $0x8, %r15d
andl %r13d, %r15d
orq %r12, %r15
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
andl %ebp, %r12d
orq %r15, %r12
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
shlq $0x10, %r12
shll $0x8, %r15d
andl %r13d, %r15d
orq %r12, %r15
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
andl %ebp, %r12d
orq %r15, %r12
shlq $0x8, %r12
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
andl %ebp, %r15d
orq %r12, %r15
pushq $0x9
jmp 0x3ec45
shll $0x8, %ebp
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %ebp
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
movl $0xff, %eax
andl %eax, %r15d
movl $0xff, %r13d
orl %ebp, %r15d
shll $0x8, %r15d
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
andl %r13d, %r12d
movl $0xff, %r13d
orl %r15d, %r12d
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r15d
shlq $0x10, %r12
shll $0x8, %r15d
movl $0xffff, %ebp           # imm = 0xFFFF
andl %ebp, %r15d
orq %r12, %r15
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r12d
andl %r13d, %r12d
orq %r15, %r12
movq (%r14), %rdi
callq 0x3e519
movl %eax, %r13d
shlq $0x10, %r12
shll $0x8, %r13d
andl %ebp, %r13d
movq (%r14), %rdi
callq 0x3e519
movl $0xff, %ecx
andl %ecx, %eax
movabsq $0xffffffffff0000, %r15 # imm = 0xFFFFFFFFFF0000
andq %r12, %r15
orq %r13, %r15
orq %rax, %r15
pushq $0x8
popq %rax
movq %r15, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq