// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_decode.c
// Function: cram_decode_slice_header
cram_block_slice_hdr *cram_decode_slice_header(cram_fd *fd, cram_block *b) {
    cram_block_slice_hdr *hdr;
    char *cp;
    char *cp_end;
    int i;

    if (b->method != RAW) {
        /* Spec. says slice header should be RAW, but we can future-proof
	   by trying to decode it if it isn't. */
        if (cram_uncompress_block(b) < 0)
            return NULL;
    }
    cp =  (char *)b->data;
    cp_end = cp + b->uncomp_size;

    if (b->content_type != MAPPED_SLICE &&
	b->content_type != UNMAPPED_SLICE)
	return NULL;

    if (!(hdr  = calloc(1, sizeof(*hdr))))
	return NULL;

    hdr->content_type = b->content_type;

    if (b->content_type == MAPPED_SLICE) {
        cp += safe_itf8_get(cp,  cp_end, &hdr->ref_seq_id);
        cp += safe_itf8_get(cp,  cp_end, &hdr->ref_seq_start);
        cp += safe_itf8_get(cp,  cp_end, &hdr->ref_seq_span);
    }
    cp += safe_itf8_get(cp,  cp_end, &hdr->num_records);
    hdr->record_counter = 0;
    if (CRAM_MAJOR_VERS(fd->version) == 2) {
	int32_t i32 = 0;
	cp += safe_itf8_get(cp, cp_end, &i32);
	hdr->record_counter = i32;
    } else if (CRAM_MAJOR_VERS(fd->version) >= 3) {
	cp += ltf8_get(cp, &hdr->record_counter);
    }

    cp += safe_itf8_get(cp, cp_end, &hdr->num_blocks);

    cp += safe_itf8_get(cp, cp_end, &hdr->num_content_ids);
    if (hdr->num_content_ids < 1 ||
	hdr->num_content_ids >= SIZE_MAX / sizeof(int32_t)) {
        /* Slice must have at least one data block,
	   and malloc'd size shouldn't wrap. */
        free(hdr);
        return NULL;
    }
    hdr->block_content_ids = malloc(hdr->num_content_ids * sizeof(int32_t));
    if (!hdr->block_content_ids) {
	free(hdr);
	return NULL;
    }

    for (i = 0; i < hdr->num_content_ids; i++) {
	int l = safe_itf8_get(cp, cp_end,
			      &hdr->block_content_ids[i]);
	if (l <= 0) {
	    free(hdr->block_content_ids);
	    free(hdr);
	    return NULL;
	}
	cp += l;
    }

    if (b->content_type == MAPPED_SLICE) {
        cp += safe_itf8_get(cp,  cp_end, &hdr->ref_base_id);
    }

    if (CRAM_MAJOR_VERS(fd->version) != 1) {
        if (cp_end - cp < 16) {
            free(hdr->block_content_ids);
            free(hdr);
            return NULL;
        }
	memcpy(hdr->md5, cp, 16);
    } else {
	memset(hdr->md5, 0, 16);
    }

    return hdr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %rbx
cmpl $0x0, (%rsi)
je 0x775e8
movq %r12, %rdi
callq 0x567e1
testl %eax, %eax
js 0x77e87
movl 0x8(%r12), %r14d
movl %r14d, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x77e87
movq %rbx, (%rsp)
movq 0x20(%r12), %r15
movslq 0x14(%r12), %rbp
movl $0x1, %edi
movl $0x48, %esi
callq 0x6470
testq %rax, %rax
je 0x77e87
leaq (%r15,%rbp), %r13
movq %rax, %rbx
movl %r14d, (%rax)
cmpl $0x2, %r14d
jne 0x77657
cmpl $0x4, %ebp
jg 0x77660
testl %ebp, %ebp
jle 0x7764e
movzbl (%r15), %ecx
shrl $0x4, %ecx
leaq 0x21467(%rip), %rdx     # 0x98ab0
cmpl (%rdx,%rcx,4), %ebp
jge 0x77660
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x776fb
movq (%rsp), %r8
jmp 0x7788e
movzbl (%r15), %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x776fb
movzbl 0x1(%r15), %edx
cmpb $-0x41, %cl
ja 0x7768a
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x776fb
cmpb $-0x21, %cl
ja 0x776a8
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x776fb
cmpb $-0x11, %cl
ja 0x776d0
shll $0x10, %edx
movzbl 0x2(%r15), %esi
shll $0x8, %esi
movzbl 0x3(%r15), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x776fb
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r15), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r15), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r15), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
movl %ecx, 0x4(%rbx)
addq %rdx, %r15
movq %rbp, %rcx
subq %rdx, %rcx
cmpq $0x4, %rcx
jg 0x7772f
cmpq %rdx, %rbp
jle 0x77729
movzbl (%r15), %edx
shrl $0x4, %edx
leaq 0x21390(%rip), %rsi     # 0x98ab0
movslq (%rsi,%rdx,4), %rdx
cmpq %rdx, %rcx
jge 0x7772f
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x7773c
movzbl (%r15), %ecx
movl $0x1, %edx
testb %cl, %cl
js 0x777a4
movq (%rsp), %r8
movl %ecx, 0x8(%rbx)
addq %rdx, %r15
movq %r13, %rcx
subq %r15, %rcx
cmpq $0x4, %rcx
jg 0x77777
cmpq %r13, %r15
jae 0x7776e
movzbl (%r15), %edx
shrl $0x4, %edx
leaq 0x2134b(%rip), %rsi     # 0x98ab0
movslq (%rsi,%rdx,4), %rdx
cmpq %rdx, %rcx
jge 0x77777
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x77888
movzbl (%r15), %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x77888
movzbl 0x1(%r15), %edx
cmpb $-0x41, %cl
ja 0x777c4
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x77888
movzbl 0x1(%r15), %edx
cmpb $-0x41, %cl
movq (%rsp), %r8
ja 0x777e5
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x77740
cmpb $-0x21, %cl
ja 0x77806
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x77888
cmpb $-0x21, %cl
ja 0x7782e
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x77740
cmpb $-0x11, %cl
ja 0x7785d
shll $0x10, %edx
movzbl 0x2(%r15), %esi
shll $0x8, %esi
movzbl 0x3(%r15), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x77888
cmpb $-0x11, %cl
ja 0x77a3a
shll $0x10, %edx
movzbl 0x2(%r15), %esi
shll $0x8, %esi
movzbl 0x3(%r15), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x77740
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r15), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r15), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r15), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
movl %ecx, 0xc(%rbx)
addq %rdx, %r15
movq %r13, %rcx
subq %r15, %rcx
cmpq $0x4, %rcx
jg 0x778bf
cmpq %r13, %r15
jae 0x778b6
movzbl (%r15), %edx
shrl $0x4, %edx
leaq 0x21203(%rip), %rsi     # 0x98ab0
movslq (%rsi,%rdx,4), %rdx
cmpq %rdx, %rcx
jge 0x778bf
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x7795a
movzbl (%r15), %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x7795a
movzbl 0x1(%r15), %edx
cmpb $-0x41, %cl
ja 0x778e9
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x7795a
cmpb $-0x21, %cl
ja 0x77907
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x7795a
cmpb $-0x11, %cl
ja 0x7792f
shll $0x10, %edx
movzbl 0x2(%r15), %esi
shll $0x8, %esi
movzbl 0x3(%r15), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x7795a
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r15), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r15), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r15), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
movl %ecx, 0x10(%rbx)
addq %rdx, %r15
addq $0x18, %rax
movq $0x0, 0x18(%rbx)
movl 0xc(%r8), %ecx
sarl $0x8, %ecx
cmpl $0x2, %ecx
jne 0x779a9
movq %r13, %rcx
subq %r15, %rcx
cmpq $0x4, %rcx
jg 0x779c4
cmpq %r13, %r15
jae 0x779a0
movzbl (%r15), %edx
shrl $0x4, %edx
leaq 0x21119(%rip), %rsi     # 0x98ab0
movslq (%rsi,%rdx,4), %rdx
cmpq %rdx, %rcx
jge 0x779c4
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x77a95
jle 0x77a9e
movq %r15, %rdi
movq %rax, %rsi
callq 0x54843
cltq
addq %rax, %r15
jmp 0x77a9e
movzbl (%r15), %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x77a95
movzbl 0x1(%r15), %edx
cmpb $-0x41, %cl
ja 0x779f1
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x77a95
cmpb $-0x21, %cl
ja 0x77a12
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x77a95
cmpb $-0x11, %cl
ja 0x77a6a
shll $0x10, %edx
movzbl 0x2(%r15), %esi
shll $0x8, %esi
movzbl 0x3(%r15), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
movl $0x4, %edx
jmp 0x77a95
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r15), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r15), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r15), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
jmp 0x77740
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x2(%r15), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x3(%r15), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x4(%r15), %ecx
andl $0xf, %ecx
orl %edx, %ecx
movl $0x5, %edx
addq %rdx, %r15
movslq %ecx, %rcx
movq %rcx, (%rax)
movq %r13, %rax
subq %r15, %rax
cmpq $0x4, %rax
jg 0x77acf
cmpq %r13, %r15
jae 0x77ac6
movzbl (%r15), %ecx
shrl $0x4, %ecx
leaq 0x20ff3(%rip), %rdx     # 0x98ab0
movslq (%rdx,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x77acf
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x77b67
movzbl (%r15), %eax
movl $0x1, %ecx
testb %al, %al
jns 0x77b67
movzbl 0x1(%r15), %ecx
cmpb $-0x41, %al
ja 0x77af8
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %ecx
jmp 0x77b67
cmpb $-0x21, %al
ja 0x77b15
shll $0x8, %ecx
movzbl 0x2(%r15), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %ecx
jmp 0x77b67
cmpb $-0x11, %al
ja 0x77b3c
shll $0x10, %ecx
movzbl 0x2(%r15), %edx
shll $0x8, %edx
movzbl 0x3(%r15), %esi
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %edx, %eax
orl %esi, %eax
movl $0x4, %ecx
jmp 0x77b67
shll $0x1c, %eax
shll $0x14, %ecx
orl %eax, %ecx
movzbl 0x2(%r15), %eax
shll $0xc, %eax
orl %ecx, %eax
movzbl 0x3(%r15), %ecx
shll $0x4, %ecx
orl %eax, %ecx
movzbl 0x4(%r15), %eax
andl $0xf, %eax
orl %ecx, %eax
movl $0x5, %ecx
movl %eax, 0x20(%rbx)
addq %rcx, %r15
movq %r13, %rax
subq %r15, %rax
cmpq $0x4, %rax
jg 0x77b9f
cmpq %r13, %r15
jae 0x77b95
movzbl (%r15), %ecx
shrl $0x4, %ecx
leaq 0x20f24(%rip), %rdx     # 0x98ab0
movslq (%rdx,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x77b9f
xorl %eax, %eax
xorl %r14d, %r14d
jmp 0x77c3c
movzbl (%r15), %eax
movl $0x1, %r14d
testb %al, %al
jns 0x77c3c
movzbl 0x1(%r15), %ecx
cmpb $-0x41, %al
ja 0x77bca
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %r14d
jmp 0x77c3c
cmpb $-0x21, %al
ja 0x77be8
shll $0x8, %ecx
movzbl 0x2(%r15), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %r14d
jmp 0x77c3c
cmpb $-0x11, %al
ja 0x77c10
shll $0x10, %ecx
movzbl 0x2(%r15), %edx
shll $0x8, %edx
movzbl 0x3(%r15), %esi
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %edx, %eax
orl %esi, %eax
movl $0x4, %r14d
jmp 0x77c3c
shll $0x1c, %eax
shll $0x14, %ecx
orl %eax, %ecx
movzbl 0x2(%r15), %eax
shll $0xc, %eax
orl %ecx, %eax
movzbl 0x3(%r15), %ecx
shll $0x4, %ecx
orl %eax, %ecx
movzbl 0x4(%r15), %eax
andl $0xf, %eax
orl %ecx, %eax
movl $0x5, %r14d
movl %eax, 0x24(%rbx)
testl %eax, %eax
jle 0x77e7f
movl %eax, %edi
shlq $0x2, %rdi
callq 0x69d0
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x77e7f
addq %r14, %r15
cmpl $0x0, 0x24(%rbx)
jle 0x77d75
xorl %ebp, %ebp
movq %r13, %rax
subq %r15, %rax
cmpq $0x4, %rax
jg 0x77ca2
movb $0x1, %r14b
cmpq %r13, %r15
jae 0x77c99
movzbl (%r15), %ecx
shrl $0x4, %ecx
leaq 0x20e20(%rip), %rdx     # 0x98ab0
movslq (%rdx,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x77ca2
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x77d3e
movzbl (%r15), %eax
testb %al, %al
js 0x77cb4
movl $0x1, %ecx
jmp 0x77d3b
movzbl 0x1(%r15), %ecx
cmpb $-0x41, %al
ja 0x77ccc
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %ecx
jmp 0x77d3b
cmpb $-0x21, %al
ja 0x77ce9
shll $0x8, %ecx
movzbl 0x2(%r15), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %ecx
jmp 0x77d3b
cmpb $-0x11, %al
ja 0x77d10
shll $0x10, %ecx
movzbl 0x2(%r15), %edx
shll $0x8, %edx
movzbl 0x3(%r15), %esi
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %edx, %eax
orl %esi, %eax
movl $0x4, %ecx
jmp 0x77d3b
shll $0x1c, %eax
shll $0x14, %ecx
orl %eax, %ecx
movzbl 0x2(%r15), %eax
shll $0xc, %eax
orl %ecx, %eax
movzbl 0x3(%r15), %ecx
shll $0x4, %ecx
orl %eax, %ecx
movzbl 0x4(%r15), %eax
andl $0xf, %eax
orl %ecx, %eax
movl $0x5, %ecx
xorl %r14d, %r14d
movq 0x28(%rbx), %rdi
movl %eax, (%rdi,%rbp,4)
testb %r14b, %r14b
je 0x77d59
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
jmp 0x77d5c
addq %rcx, %r15
testb %r14b, %r14b
jne 0x77e87
incq %rbp
movslq 0x24(%rbx), %rax
cmpq %rax, %rbp
jl 0x77c6e
cmpl $0x2, 0x8(%r12)
jne 0x77db2
movq %r13, %rax
subq %r15, %rax
cmpq $0x4, %rax
movq (%rsp), %rdi
jg 0x77dbb
cmpq %r13, %r15
jae 0x77da9
movzbl (%r15), %ecx
shrl $0x4, %ecx
leaq 0x20d10(%rip), %rdx     # 0x98ab0
movslq (%rdx,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x77dbb
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x77e53
movq (%rsp), %rdi
jmp 0x77e59
movzbl (%r15), %eax
movl $0x1, %ecx
testb %al, %al
jns 0x77e53
movzbl 0x1(%r15), %ecx
cmpb $-0x41, %al
ja 0x77de4
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %ecx
jmp 0x77e53
cmpb $-0x21, %al
ja 0x77e01
shll $0x8, %ecx
movzbl 0x2(%r15), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %ecx
jmp 0x77e53
cmpb $-0x11, %al
ja 0x77e28
shll $0x10, %ecx
movzbl 0x2(%r15), %edx
shll $0x8, %edx
movzbl 0x3(%r15), %esi
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %edx, %eax
orl %esi, %eax
movl $0x4, %ecx
jmp 0x77e53
shll $0x1c, %eax
shll $0x14, %ecx
orl %eax, %ecx
movzbl 0x2(%r15), %eax
shll $0xc, %eax
orl %ecx, %eax
movzbl 0x3(%r15), %ecx
shll $0x4, %ecx
orl %eax, %ecx
movzbl 0x4(%r15), %eax
andl $0xf, %eax
orl %ecx, %eax
movl $0x5, %ecx
movl %eax, 0x30(%rbx)
addq %rcx, %r15
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
andl 0xc(%rdi), %eax
cmpl $0x100, %eax            # imm = 0x100
jne 0x77e6d
xorps %xmm0, %xmm0
jmp 0x77e9f
subq %r15, %r13
cmpq $0xf, %r13
jg 0x77e9b
movq 0x28(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movups (%r15), %xmm0
movups %xmm0, 0x34(%rbx)
jmp 0x77e89