// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x7c3de
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xc0, %eax
jge 0x7c41e
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
shlq $0x8, %rcx
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
orq %rax, %rcx
andq $0x3fff, %rcx           # imm = 0x3FFF
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x2, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xe0, %eax
jge 0x7c46d
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
shlq $0x10, %rcx
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
orq %rax, %rcx
andq $0x1fffff, %rcx         # imm = 0x1FFFFF
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x3, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xf0, %eax
jge 0x7c4cb
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
shlq $0x18, %rcx
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
shlq $0x10, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
orq %rax, %rcx
andq $0xfffffff, %rcx        # imm = 0xFFFFFFF
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x4, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xf8, %eax
jge 0x7c53e
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
shlq $0x20, %rcx
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
shlq $0x18, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x10, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
orq %rax, %rcx
movabsq $0x7ffffffff, %rax      # imm = 0x7FFFFFFFF
andq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x5, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xfc, %eax
jge 0x7c5c0
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
shlq $0x28, %rcx
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x18, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
shlq $0x10, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x5(%rax), %eax
orq %rax, %rcx
movabsq $0x3ffffffffff, %rax    # imm = 0x3FFFFFFFFFF
andq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x6, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xfe, %eax
jge 0x7c655
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
shlq $0x30, %rcx
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
shlq $0x28, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
shlq $0x18, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
shlq $0x10, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x5(%rax), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x6(%rax), %eax
orq %rax, %rcx
movabsq $0x1ffffffffffff, %rax  # imm = 0x1FFFFFFFFFFFF
andq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x7, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
jge 0x7c6eb
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, %ecx
shlq $0x30, %rcx
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x28, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
shlq $0x18, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x5(%rax), %eax
shlq $0x10, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x6(%rax), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x7(%rax), %eax
orq %rax, %rcx
movabsq $0xffffffffffffff, %rax # imm = 0xFFFFFFFFFFFFFF
andq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x8, -0x4(%rbp)
jmp 0x7c76c
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, %ecx
shlq $0x38, %rcx
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x30, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
shlq $0x28, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x4(%rax), %eax
shlq $0x20, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x5(%rax), %eax
shlq $0x18, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x6(%rax), %eax
shlq $0x10, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x7(%rax), %eax
shlq $0x8, %rax
orq %rax, %rcx
movq -0x20(%rbp), %rax
movzbl 0x8(%rax), %eax
orq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x9, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)