// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/cram/cram_io.c
// Function: ltf8_get
int ltf8_get(char *cp, int64_t *val_p) {
    unsigned char *up = (unsigned char *)cp;
    
    if (up[0] < 0x80) {
	*val_p =   up[0];
	return 1;
    } else if (up[0] < 0xc0) {
	*val_p = (((uint64_t)up[0]<< 8) |
		   (uint64_t)up[1]) & (((1LL<<(6+8)))-1);
	return 2;
    } else if (up[0] < 0xe0) {
	*val_p = (((uint64_t)up[0]<<16) |
		  ((uint64_t)up[1]<< 8) |
		   (uint64_t)up[2]) & ((1LL<<(5+2*8))-1);
	return 3;
    } else if (up[0] < 0xf0) {
	*val_p = (((uint64_t)up[0]<<24) |
		  ((uint64_t)up[1]<<16) |
		  ((uint64_t)up[2]<< 8) |
		   (uint64_t)up[3]) & ((1LL<<(4+3*8))-1);
	return 4;
    } else if (up[0] < 0xf8) {
	*val_p = (((uint64_t)up[0]<<32) |
		  ((uint64_t)up[1]<<24) |
		  ((uint64_t)up[2]<<16) |
		  ((uint64_t)up[3]<< 8) |
		   (uint64_t)up[4]) & ((1LL<<(3+4*8))-1);
	return 5;
    } else if (up[0] < 0xfc) {
	*val_p = (((uint64_t)up[0]<<40) |
		  ((uint64_t)up[1]<<32) |
		  ((uint64_t)up[2]<<24) |
		  ((uint64_t)up[3]<<16) |
		  ((uint64_t)up[4]<< 8) |
		   (uint64_t)up[5]) & ((1LL<<(2+5*8))-1);
	return 6;
    } else if (up[0] < 0xfe) {
	*val_p = (((uint64_t)up[0]<<48) |
		  ((uint64_t)up[1]<<40) |
		  ((uint64_t)up[2]<<32) |
		  ((uint64_t)up[3]<<24) |
		  ((uint64_t)up[4]<<16) |
		  ((uint64_t)up[5]<< 8) |
		   (uint64_t)up[6]) & ((1LL<<(1+6*8))-1);
	return 7;
    } else if (up[0] < 0xff) {
	*val_p = (((uint64_t)up[1]<<48) |
		  ((uint64_t)up[2]<<40) |
		  ((uint64_t)up[3]<<32) |
		  ((uint64_t)up[4]<<24) |
		  ((uint64_t)up[5]<<16) |
		  ((uint64_t)up[6]<< 8) |
		   (uint64_t)up[7]) & ((1LL<<(7*8))-1);
	return 8;
    } else {
	*val_p = (((uint64_t)up[1]<<56) |
		  ((uint64_t)up[2]<<48) |
		  ((uint64_t)up[3]<<40) |
		  ((uint64_t)up[4]<<32) |
		  ((uint64_t)up[5]<<24) |
		  ((uint64_t)up[6]<<16) |
		  ((uint64_t)up[7]<< 8) |
		   (uint64_t)up[8]);
	return 9;
    }
}

// Assembly:
movzbl (%rdi), %ecx
testb %cl, %cl
js 0x54bb8
movl $0x1, %eax
jmp 0x54d97
cmpb $-0x41, %cl
ja 0x54bd4
movzbl 0x1(%rdi), %eax
andl $0x3f, %ecx
shll $0x8, %ecx
orq %rax, %rcx
movl $0x2, %eax
jmp 0x54d97
cmpb $-0x21, %cl
ja 0x54bf9
movzbl 0x1(%rdi), %eax
shll $0x8, %eax
movzbl 0x2(%rdi), %edx
andl $0x1f, %ecx
shll $0x10, %ecx
orl %eax, %ecx
orq %rdx, %rcx
movl $0x3, %eax
jmp 0x54d97
cmpb $-0x11, %cl
ja 0x54c27
movzbl 0x1(%rdi), %eax
shll $0x10, %eax
movzbl 0x2(%rdi), %edx
shll $0x8, %edx
movzbl 0x3(%rdi), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %eax, %ecx
orl %edx, %ecx
orq %rdi, %rcx
movl $0x4, %eax
jmp 0x54d97
cmpb $-0x9, %cl
ja 0x54c64
movzbl 0x1(%rdi), %eax
shll $0x18, %eax
movzbl 0x2(%rdi), %edx
shll $0x10, %edx
movzbl 0x3(%rdi), %r8d
shll $0x8, %r8d
movzbl 0x4(%rdi), %edi
andl $0x7, %ecx
shlq $0x20, %rcx
orq %rax, %rcx
orq %rdx, %rcx
orq %r8, %rcx
orq %rdi, %rcx
movl $0x5, %eax
jmp 0x54d97
cmpb $-0x5, %cl
ja 0x54cae
movzbl 0x1(%rdi), %eax
shlq $0x20, %rax
movzbl 0x2(%rdi), %edx
shll $0x18, %edx
movzbl 0x3(%rdi), %r8d
shll $0x10, %r8d
movzbl 0x4(%rdi), %r9d
shll $0x8, %r9d
movzbl 0x5(%rdi), %edi
andl $0x3, %ecx
shlq $0x28, %rcx
orq %rax, %rcx
orq %rdx, %rcx
orq %r8, %rcx
orq %r9, %rcx
orq %rdi, %rcx
movl $0x6, %eax
jmp 0x54d97
cmpb $-0x3, %cl
ja 0x54d05
movzbl 0x1(%rdi), %eax
shlq $0x28, %rax
movzbl 0x2(%rdi), %edx
shlq $0x20, %rdx
movzbl 0x3(%rdi), %r8d
shll $0x18, %r8d
movzbl 0x4(%rdi), %r9d
shll $0x10, %r9d
movzbl 0x5(%rdi), %r10d
shll $0x8, %r10d
movzbl 0x6(%rdi), %edi
andl $0x1, %ecx
shlq $0x30, %rcx
orq %rax, %rcx
orq %rdx, %rcx
orq %r8, %rcx
orq %r9, %rcx
orq %r10, %rcx
orq %rdi, %rcx
movl $0x7, %eax
jmp 0x54d97
movzbl 0x1(%rdi), %r11d
movzbl 0x2(%rdi), %r10d
movzbl 0x3(%rdi), %r9d
movzbl 0x4(%rdi), %r8d
movzbl 0x5(%rdi), %edx
movzbl 0x6(%rdi), %eax
cmpl $0xff, %ecx
je 0x54d5c
shlq $0x30, %r11
shlq $0x28, %r10
orq %r11, %r10
shlq $0x20, %r9
orq %r10, %r9
shll $0x18, %r8d
orq %r9, %r8
shll $0x10, %edx
orq %r8, %rdx
shll $0x8, %eax
orq %rdx, %rax
movzbl 0x7(%rdi), %ecx
orq %rax, %rcx
movl $0x8, %eax
jmp 0x54d97
shlq $0x38, %r11
shlq $0x30, %r10
orq %r11, %r10
shlq $0x28, %r9
orq %r10, %r9
shlq $0x20, %r8
orq %r9, %r8
shll $0x18, %edx
orq %r8, %rdx
shll $0x10, %eax
orq %rdx, %rax
movzbl 0x7(%rdi), %edx
shll $0x8, %edx
orq %rax, %rdx
movzbl 0x8(%rdi), %ecx
orq %rdx, %rcx
movl $0x9, %eax
movq %rcx, (%rsi)
retq