// File: /workspace/github_c_makefile_star2_O1/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 0x4dbf6
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dbfb
callq 0xf054
cmpl $-0x1, %eax
je 0x4dc3d
movzbl %al, %r15d
movl $0x1, %eax
cmpl $0x80, %r15d
jb 0x4de8d
cmpl $0xbf, %r15d
ja 0x4dc47
shll $0x8, %r15d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dc6a
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dc6f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4de90
cmpl $0xdf, %r15d
ja 0x4dc86
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dcad
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dcb2
callq 0xf054
movzbl %al, %eax
andl $0x3f00, %r15d          # imm = 0x3F00
orq %rax, %r15
movl $0x2, %eax
jmp 0x4de8d
cmpl $0xef, %r15d
ja 0x4dcd7
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dd20
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dd25
callq 0xf054
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dd01
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dd06
cmpl $0xf7, %r15d
ja 0x4dd4d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4ddc0
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4ddc5
callq 0xf054
movzbl %al, %eax
andl $0x1f0000, %r15d        # imm = 0x1F0000
orq %r12, %r15
orq %rax, %r15
movl $0x3, %eax
jmp 0x4de8d
callq 0xf054
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dd7b
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dd80
cmpl $0xfb, %r15d
ja 0x4dded
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4de99
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4de9e
callq 0xf054
movzbl %al, %eax
orl %eax, %r12d
shll $0x8, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dda4
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dda9
callq 0xf054
movzbl %al, %eax
andl $0xfffff00, %r12d       # imm = 0xFFFFF00
orq %rax, %r12
movl $0x4, %eax
jmp 0x4de8a
callq 0xf054
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4de1b
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4de20
cmpl $0xfd, %r15d
ja 0x4dec6
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4df94
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4df99
callq 0xf054
movzbl %al, %eax
orq %rax, %r12
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4de40
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4de45
callq 0xf054
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4de6a
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4de6f
callq 0xf054
movzbl %al, %eax
movabsq $0x7ffff0000, %rcx      # imm = 0x7FFFF0000
andq %rcx, %r12
orq %r15, %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 0xf054
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4def7
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4defc
movq (%r14), %rdi
movq 0x8(%rdi), %rax
movq 0x10(%rdi), %rcx
cmpl $0xff, %r15d
jne 0x4dfc1
cmpq %rax, %rcx
jbe 0x4e0a0
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %ebp
jmp 0x4e0a7
callq 0xf054
movzbl %al, %eax
orq %rax, %r12
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4df1c
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4df21
callq 0xf054
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4df49
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4df4e
callq 0xf054
movzbl %al, %eax
orq %rax, %r15
shlq $0x8, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4df72
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4df77
callq 0xf054
movzbl %al, %eax
movabsq $0x3ffffffff00, %rcx    # imm = 0x3FFFFFFFF00
andq %rcx, %r15
orq %rax, %r15
movl $0x6, %eax
jmp 0x4de8d
callq 0xf054
shll $0x10, %r15d
shll $0x8, %eax
movzwl %ax, %r12d
orl %r15d, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dfda
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4dfdf
cmpq %rax, %rcx
jbe 0x4e0c1
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e0c6
callq 0xf054
movzbl %al, %eax
orq %rax, %r12
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4dfff
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e004
callq 0xf054
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e02c
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e031
callq 0xf054
movzbl %al, %eax
orq %rax, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e051
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e056
callq 0xf054
shlq $0x10, %r15
shll $0x8, %eax
movzwl %ax, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e07b
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e080
callq 0xf054
movzbl %al, %eax
movabsq $0x1ffffffff0000, %rcx  # imm = 0x1FFFFFFFF0000
andq %rcx, %r15
orq %r12, %r15
orq %rax, %r15
movl $0x7, %eax
jmp 0x4de8d
callq 0xf054
movl %eax, %ebp
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e0e7
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e0ec
callq 0xf054
shll $0x8, %eax
movzwl %ax, %r15d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e113
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e118
callq 0xf054
shll $0x10, %ebp
shll $0x8, %eax
movzwl %ax, %r12d
orl %ebp, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e13b
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e140
callq 0xf054
movzbl %al, %ebp
orl %r15d, %ebp
shll $0x8, %ebp
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e161
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e166
callq 0xf054
movzbl %al, %r15d
orl %r12d, %r15d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e187
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e18c
callq 0xf054
movzbl %al, %r12d
orl %ebp, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e1b4
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e1b9
callq 0xf054
shlq $0x10, %r15
shll $0x8, %eax
movzwl %ax, %r12d
orq %r15, %r12
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e1e1
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e1e6
callq 0xf054
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e206
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e20b
callq 0xf054
movzbl %al, %eax
orq %rax, %r12
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e22b
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e230
callq 0xf054
movzbl %al, %eax
orq %rax, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e258
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e25d
callq 0xf054
shlq $0x10, %r12
shll $0x8, %eax
movzwl %ax, %r15d
orq %r12, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e282
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e287
callq 0xf054
shlq $0x10, %r15
shll $0x8, %eax
movzwl %ax, %r12d
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e2ab
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e2b0
callq 0xf054
movzbl %al, %eax
orq %rax, %r15
shlq $0x8, %r15
movq (%r14), %rdi
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
jbe 0x4e2ca
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rdi)
movzbl (%rax), %eax
jmp 0x4e2cf
callq 0xf054
movzbl %al, %eax
andq $-0x10000, %r15         # imm = 0xFFFF0000
orq %r12, %r15
orq %rax, %r15
movl $0x8, %eax
jmp 0x4de8d
callq 0xf054
movzbl %al, %eax
orq %rax, %r15
movl $0x9, %eax
jmp 0x4de8d