// File: /workspace/github_c_makefile_star2_O3/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 0x77242
movq %r12, %rdi
callq 0x56a71
testl %eax, %eax
js 0x77af9
movl 0x8(%r12), %r14d
movl %r14d, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x77af9
movq %rbx, (%rsp)
movq 0x20(%r12), %r15
movslq 0x14(%r12), %rbp
movl $0x1, %edi
movl $0x48, %esi
callq 0x6470
testq %rax, %rax
je 0x77af9
leaq (%r15,%rbp), %r13
movq %rax, %rbx
movl %r14d, (%rax)
cmpl $0x2, %r14d
jne 0x772b3
cmpl $0x5, %ebp
jge 0x772bc
testl %ebp, %ebp
jle 0x772aa
movzbl (%r15), %esi
movl %esi, %ecx
shrl $0x4, %ecx
leaq 0x218fb(%rip), %rdx     # 0x98ba0
cmpl (%rdx,%rcx,4), %ebp
jge 0x772bf
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x7735d
movq (%rsp), %r8
jmp 0x77535
movb (%r15), %sil
movzbl %sil, %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x7735d
movzbl 0x1(%r15), %edx
cmpb $-0x41, %sil
ja 0x772ea
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x7735d
cmpb $-0x21, %sil
ja 0x77309
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x7735d
cmpb $-0x11, %sil
ja 0x77332
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 0x7735d
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 $0x5, %rcx
jge 0x77397
cmpq %rdx, %rbp
jle 0x773c9
movzbl (%r15), %esi
movl %esi, %edx
shrl $0x4, %edx
leaq 0x2181c(%rip), %rdi     # 0x98ba0
movslq (%rdi,%rdx,4), %rdx
cmpq %rdx, %rcx
movq (%rsp), %r8
jge 0x7739e
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x773d1
movb (%r15), %sil
movq (%rsp), %r8
movzbl %sil, %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x773d1
movzbl 0x1(%r15), %edx
cmpb $-0x41, %sil
ja 0x7743b
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x773d1
xorl %ecx, %ecx
xorl %edx, %edx
movq (%rsp), %r8
movl %ecx, 0x8(%rbx)
addq %rdx, %r15
movq %r13, %rcx
subq %r15, %rcx
cmpq $0x5, %rcx
jge 0x7740a
cmpq %r13, %r15
jae 0x77401
movzbl (%r15), %esi
movl %esi, %edx
shrl $0x4, %edx
leaq 0x217a8(%rip), %rdi     # 0x98ba0
movslq (%rdi,%rdx,4), %rdx
cmpq %rdx, %rcx
jge 0x7740d
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x7752f
movb (%r15), %sil
movzbl %sil, %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x7752f
movzbl 0x1(%r15), %edx
cmpb $-0x41, %sil
ja 0x7745d
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x7752f
cmpb $-0x21, %sil
ja 0x7747f
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x773d1
cmpb $-0x21, %sil
ja 0x774ab
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x7752f
cmpb $-0x11, %sil
ja 0x774d4
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 0x773d1
cmpb $-0x11, %sil
ja 0x77504
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 0x7752f
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 0x773d1
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 $0x5, %rcx
jge 0x77568
cmpq %r13, %r15
jae 0x7755f
movzbl (%r15), %esi
movl %esi, %edx
shrl $0x4, %edx
leaq 0x2164a(%rip), %rdi     # 0x98ba0
movslq (%rdi,%rdx,4), %rdx
cmpq %rdx, %rcx
jge 0x7756b
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x77609
movb (%r15), %sil
movzbl %sil, %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x77609
movzbl 0x1(%r15), %edx
cmpb $-0x41, %sil
ja 0x77596
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x77609
cmpb $-0x21, %sil
ja 0x775b5
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x77609
cmpb $-0x11, %sil
ja 0x775de
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 0x77609
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 0x7765a
movq %r13, %rcx
subq %r15, %rcx
cmpq $0x5, %rcx
jge 0x77675
cmpq %r13, %r15
jae 0x77651
movzbl (%r15), %esi
movl %esi, %edx
shrl $0x4, %edx
leaq 0x21558(%rip), %rdi     # 0x98ba0
movslq (%rdi,%rdx,4), %rdx
cmpq %rdx, %rcx
jge 0x77678
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x77716
jle 0x7771f
movq %r15, %rdi
movq %rax, %rsi
callq 0x54ba7
cltq
addq %rax, %r15
jmp 0x7771f
movb (%r15), %sil
movzbl %sil, %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x77716
movzbl 0x1(%r15), %edx
cmpb $-0x41, %sil
ja 0x776a3
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x77716
cmpb $-0x21, %sil
ja 0x776c2
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x77716
cmpb $-0x11, %sil
ja 0x776eb
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 0x77716
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 $0x5, %rax
jge 0x77752
cmpq %r13, %r15
jae 0x77749
movzbl (%r15), %edx
movl %edx, %ecx
shrl $0x4, %ecx
leaq 0x21460(%rip), %rsi     # 0x98ba0
movslq (%rsi,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x77755
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x777ef
movb (%r15), %dl
movzbl %dl, %eax
movl $0x1, %ecx
testb %al, %al
jns 0x777ef
movzbl 0x1(%r15), %ecx
cmpb $-0x41, %dl
ja 0x7777e
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %ecx
jmp 0x777ef
cmpb $-0x21, %dl
ja 0x7779c
shll $0x8, %ecx
movzbl 0x2(%r15), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %ecx
jmp 0x777ef
cmpb $-0x11, %dl
ja 0x777c4
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 0x777ef
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 $0x5, %rax
jge 0x77828
cmpq %r13, %r15
jae 0x77af1
movzbl (%r15), %edx
movl %edx, %ecx
shrl $0x4, %ecx
leaq 0x21386(%rip), %rsi     # 0x98ba0
movslq (%rsi,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x7782b
jmp 0x77af1
movb (%r15), %dl
movzbl %dl, %eax
movl $0x1, %r14d
testb %al, %al
jns 0x778ca
movzbl 0x1(%r15), %ecx
cmpb $-0x41, %dl
ja 0x77856
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %r14d
jmp 0x778ca
cmpb $-0x21, %dl
ja 0x77875
shll $0x8, %ecx
movzbl 0x2(%r15), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %r14d
jmp 0x778ca
cmpb $-0x11, %dl
ja 0x7789e
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 0x778ca
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 0x77af1
movl %eax, %ebp
leaq (,%rbp,4), %rdi
callq 0x69d0
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x77af1
addq %r14, %r15
xorl %edx, %edx
leaq 0x212a3(%rip), %rcx     # 0x98ba0
movq %r13, %rsi
subq %r15, %rsi
cmpq $0x5, %rsi
jge 0x7792a
cmpq %r13, %r15
jae 0x77ae9
movzbl (%r15), %r8d
movl %r8d, %edi
shrl $0x4, %edi
movslq (%rcx,%rdi,4), %rdi
cmpq %rdi, %rsi
jge 0x7792d
jmp 0x77ae9
movb (%r15), %r8b
movzbl %r8b, %esi
movl $0x1, %edi
testb %sil, %sil
jns 0x779d0
movzbl 0x1(%r15), %edi
cmpb $-0x41, %r8b
ja 0x77959
andl $0x3f, %esi
shll $0x8, %esi
orl %edi, %esi
movl $0x2, %edi
jmp 0x779d0
cmpb $-0x21, %r8b
ja 0x77979
shll $0x8, %edi
movzbl 0x2(%r15), %r8d
andl $0x1f, %esi
shll $0x10, %esi
orl %edi, %esi
orl %r8d, %esi
movl $0x3, %edi
jmp 0x779d0
cmpb $-0x11, %r8b
ja 0x779a5
shll $0x10, %edi
movzbl 0x2(%r15), %r8d
shll $0x8, %r8d
movzbl 0x3(%r15), %r9d
andl $0xf, %esi
shll $0x18, %esi
orl %edi, %esi
orl %r8d, %esi
orl %r9d, %esi
movl $0x4, %edi
jmp 0x779d0
shll $0x1c, %esi
shll $0x14, %edi
orl %esi, %edi
movzbl 0x2(%r15), %esi
shll $0xc, %esi
orl %edi, %esi
movzbl 0x3(%r15), %edi
shll $0x4, %edi
orl %esi, %edi
movzbl 0x4(%r15), %esi
andl $0xf, %esi
orl %edi, %esi
movl $0x5, %edi
movl %esi, (%rax,%rdx,4)
addq %rdi, %r15
incq %rdx
cmpq %rbp, %rdx
jb 0x778fd
cmpl $0x2, 0x8(%r12)
jne 0x77a1a
movq %r13, %rdx
subq %r15, %rdx
cmpq $0x5, %rdx
movq (%rsp), %r8
jge 0x77a23
cmpq %r13, %r15
jae 0x77a11
movzbl (%r15), %esi
movl %esi, %edi
shrl $0x4, %edi
movslq (%rcx,%rdi,4), %rcx
cmpq %rcx, %rdx
jge 0x77a26
xorl %ecx, %ecx
xorl %edx, %edx
jmp 0x77ac4
movq (%rsp), %r8
jmp 0x77aca
movb (%r15), %sil
movzbl %sil, %ecx
movl $0x1, %edx
testb %cl, %cl
jns 0x77ac4
movzbl 0x1(%r15), %edx
cmpb $-0x41, %sil
ja 0x77a51
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
movl $0x2, %edx
jmp 0x77ac4
cmpb $-0x21, %sil
ja 0x77a70
shll $0x8, %edx
movzbl 0x2(%r15), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
movl $0x3, %edx
jmp 0x77ac4
cmpb $-0x11, %sil
ja 0x77a99
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 0x77ac4
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, 0x30(%rbx)
addq %rdx, %r15
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
andl 0xc(%r8), %ecx
cmpl $0x100, %ecx            # imm = 0x100
jne 0x77ae0
xorps %xmm0, %xmm0
jmp 0x77b11
subq %r15, %r13
cmpq $0xf, %r13
jg 0x77b0d
movq %rax, %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 0x77afb