// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_encode.c
// Function: cram_encode_slice_header
cram_block *cram_encode_slice_header(cram_fd *fd, cram_slice *s) {
    char *buf;
    char *cp;
    cram_block *b = cram_new_block(MAPPED_SLICE, 0);
    int j;

    if (!b)
	return NULL;

    if (NULL == (cp = buf = malloc(16+5*(8+s->hdr->num_blocks)))) {
	cram_free_block(b);
	return NULL;
    }

    cp += itf8_put(cp, s->hdr->ref_seq_id);
    cp += itf8_put(cp, s->hdr->ref_seq_start);
    cp += itf8_put(cp, s->hdr->ref_seq_span);
    cp += itf8_put(cp, s->hdr->num_records);
    if (CRAM_MAJOR_VERS(fd->version) == 2)
	cp += itf8_put(cp, s->hdr->record_counter);
    else if (CRAM_MAJOR_VERS(fd->version) >= 3)
	cp += ltf8_put(cp, s->hdr->record_counter);
    cp += itf8_put(cp, s->hdr->num_blocks);
    cp += itf8_put(cp, s->hdr->num_content_ids);
    for (j = 0; j < s->hdr->num_content_ids; j++) {
	cp += itf8_put(cp, s->hdr->block_content_ids[j]);
    }
    if (s->hdr->content_type == MAPPED_SLICE)
	cp += itf8_put(cp, s->hdr->ref_base_id);

    if (CRAM_MAJOR_VERS(fd->version) != 1) {
	memcpy(cp, s->hdr->md5, 16); cp += 16;
    }
    
    assert(cp-buf <= 16+5*(8+s->hdr->num_blocks));

    b->data = (unsigned char *)buf;
    b->comp_size = b->uncomp_size = cp-buf;

    return b;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r12
movl $0x2, %edi
xorl %esi, %esi
callq 0x55f07
testq %rax, %rax
je 0x7f619
movq %rax, %rbx
movq (%r14), %rbp
movl 0x20(%rbp), %eax
leal (%rax,%rax,4), %eax
addl $0x38, %eax
movslq %eax, %rdi
callq 0x69d0
testq %rax, %rax
je 0x7f611
movq %rax, %r15
movl 0x4(%rbp), %eax
cmpl $0x7f, %eax
ja 0x7f620
movb %al, (%r15)
movl $0x1, %r13d
jmp 0x7f6c7
movq %rbx, %rdi
callq 0x567c0
xorl %ebx, %ebx
jmp 0x7fdeb
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x7f641
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r15)
movb 0x4(%rbp), %al
movb %al, 0x1(%r15)
movl $0x2, %r13d
jmp 0x7f6c7
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x7f666
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r15)
movb 0x5(%rbp), %al
movb %al, 0x1(%r15)
movb 0x4(%rbp), %al
movb %al, 0x2(%r15)
movl $0x3, %r13d
jmp 0x7f6c7
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x7f692
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r15)
movb 0x6(%rbp), %al
movb %al, 0x1(%r15)
movb 0x5(%rbp), %al
movb %al, 0x2(%r15)
movb 0x4(%rbp), %al
movb %al, 0x3(%r15)
movl $0x4, %r13d
jmp 0x7f6c7
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r15)
movl 0x4(%rbp), %eax
shrl $0x14, %eax
movb %al, 0x1(%r15)
movl 0x4(%rbp), %eax
shrl $0xc, %eax
movb %al, 0x2(%r15)
movl 0x4(%rbp), %eax
shrl $0x4, %eax
movb %al, 0x3(%r15)
movb 0x4(%rbp), %al
andb $0xf, %al
movb %al, 0x4(%r15)
movl $0x5, %r13d
addq %r15, %r13
movl 0x8(%rbp), %eax
cmpl $0x7f, %eax
ja 0x7f6e0
movb %al, (%r13)
movl $0x1, %eax
jmp 0x7f787
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x7f701
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x8(%rbp), %al
movb %al, 0x1(%r13)
movl $0x2, %eax
jmp 0x7f787
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x7f726
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x9(%rbp), %al
movb %al, 0x1(%r13)
movb 0x8(%rbp), %al
movb %al, 0x2(%r13)
movl $0x3, %eax
jmp 0x7f787
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x7f752
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0xa(%rbp), %al
movb %al, 0x1(%r13)
movb 0x9(%rbp), %al
movb %al, 0x2(%r13)
movb 0x8(%rbp), %al
movb %al, 0x3(%r13)
movl $0x4, %eax
jmp 0x7f787
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x8(%rbp), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x8(%rbp), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x8(%rbp), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x8(%rbp), %al
andb $0xf, %al
movb %al, 0x4(%r13)
movl $0x5, %eax
addq %rax, %r13
movl 0xc(%rbp), %eax
cmpl $0x7f, %eax
ja 0x7f7a0
movb %al, (%r13)
movl $0x1, %eax
jmp 0x7f847
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x7f7c1
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0xc(%rbp), %al
movb %al, 0x1(%r13)
movl $0x2, %eax
jmp 0x7f847
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x7f7e6
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0xd(%rbp), %al
movb %al, 0x1(%r13)
movb 0xc(%rbp), %al
movb %al, 0x2(%r13)
movl $0x3, %eax
jmp 0x7f847
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x7f812
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0xe(%rbp), %al
movb %al, 0x1(%r13)
movb 0xd(%rbp), %al
movb %al, 0x2(%r13)
movb 0xc(%rbp), %al
movb %al, 0x3(%r13)
movl $0x4, %eax
jmp 0x7f847
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0xc(%rbp), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0xc(%rbp), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0xc(%rbp), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0xc(%rbp), %al
andb $0xf, %al
movb %al, 0x4(%r13)
movl $0x5, %eax
addq %rax, %r13
movl 0x10(%rbp), %eax
cmpl $0x7f, %eax
ja 0x7f860
movb %al, (%r13)
movl $0x1, %eax
jmp 0x7f907
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x7f881
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x10(%rbp), %al
movb %al, 0x1(%r13)
movl $0x2, %eax
jmp 0x7f907
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x7f8a6
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x11(%rbp), %al
movb %al, 0x1(%r13)
movb 0x10(%rbp), %al
movb %al, 0x2(%r13)
movl $0x3, %eax
jmp 0x7f907
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x7f8d2
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x12(%rbp), %al
movb %al, 0x1(%r13)
movb 0x11(%rbp), %al
movb %al, 0x2(%r13)
movb 0x10(%rbp), %al
movb %al, 0x3(%r13)
movl $0x4, %eax
jmp 0x7f907
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x10(%rbp), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x10(%rbp), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x10(%rbp), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x10(%rbp), %al
andb $0xf, %al
movb %al, 0x4(%r13)
movl $0x5, %eax
addq %rax, %r13
movl 0xc(%r12), %eax
sarl $0x8, %eax
cmpl $0x2, %eax
jne 0x7f92f
movq 0x18(%rbp), %rax
cmpq $0x7f, %rax
ja 0x7f948
movb %al, (%r13)
movl $0x1, %eax
jmp 0x7f9f2
jle 0x7f9f5
movq 0x18(%rbp), %rsi
movq %r13, %rdi
callq 0x54679
cltq
jmp 0x7f9f2
cmpq $0x3fff, %rax           # imm = 0x3FFF
ja 0x7f96a
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x18(%rbp), %al
movb %al, 0x1(%r13)
movl $0x2, %eax
jmp 0x7f9f2
cmpq $0x1fffff, %rax         # imm = 0x1FFFFF
ja 0x7f990
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x19(%rbp), %al
movb %al, 0x1(%r13)
movb 0x18(%rbp), %al
movb %al, 0x2(%r13)
movl $0x3, %eax
jmp 0x7f9f2
cmpq $0xfffffff, %rax        # imm = 0xFFFFFFF
ja 0x7f9bd
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x1a(%rbp), %al
movb %al, 0x1(%r13)
movb 0x19(%rbp), %al
movb %al, 0x2(%r13)
movb 0x18(%rbp), %al
movb %al, 0x3(%r13)
movl $0x4, %eax
jmp 0x7f9f2
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x18(%rbp), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x18(%rbp), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x18(%rbp), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x18(%rbp), %al
andb $0xf, %al
movb %al, 0x4(%r13)
movl $0x5, %eax
addq %rax, %r13
movq (%r14), %rax
movl 0x20(%rax), %ecx
cmpl $0x7f, %ecx
ja 0x7fa0e
movb %cl, (%r13)
movl $0x1, %ecx
jmp 0x7fabd
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x7fa31
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, (%r13)
movb 0x20(%rax), %cl
movb %cl, 0x1(%r13)
movl $0x2, %ecx
jmp 0x7fabd
cmpl $0x1fffff, %ecx         # imm = 0x1FFFFF
ja 0x7fa58
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, (%r13)
movb 0x21(%rax), %cl
movb %cl, 0x1(%r13)
movb 0x20(%rax), %cl
movb %cl, 0x2(%r13)
movl $0x3, %ecx
jmp 0x7fabd
cmpl $0xfffffff, %ecx        # imm = 0xFFFFFFF
ja 0x7fa86
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, (%r13)
movb 0x22(%rax), %cl
movb %cl, 0x1(%r13)
movb 0x21(%rax), %cl
movb %cl, 0x2(%r13)
movb 0x20(%rax), %cl
movb %cl, 0x3(%r13)
movl $0x4, %ecx
jmp 0x7fabd
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, (%r13)
movl 0x20(%rax), %ecx
shrl $0x14, %ecx
movb %cl, 0x1(%r13)
movl 0x20(%rax), %ecx
shrl $0xc, %ecx
movb %cl, 0x2(%r13)
movl 0x20(%rax), %ecx
shrl $0x4, %ecx
movb %cl, 0x3(%r13)
movb 0x20(%rax), %cl
andb $0xf, %cl
movb %cl, 0x4(%r13)
movl $0x5, %ecx
addq %rcx, %r13
movl 0x24(%rax), %ecx
cmpl $0x7f, %ecx
ja 0x7fad6
movb %cl, (%r13)
movl $0x1, %eax
jmp 0x7fb84
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x7faf9
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, (%r13)
movb 0x24(%rax), %al
movb %al, 0x1(%r13)
movl $0x2, %eax
jmp 0x7fb84
cmpl $0x1fffff, %ecx         # imm = 0x1FFFFF
ja 0x7fb20
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, (%r13)
movb 0x25(%rax), %cl
movb %cl, 0x1(%r13)
movb 0x24(%rax), %al
movb %al, 0x2(%r13)
movl $0x3, %eax
jmp 0x7fb84
cmpl $0xfffffff, %ecx        # imm = 0xFFFFFFF
ja 0x7fb4e
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, (%r13)
movb 0x26(%rax), %cl
movb %cl, 0x1(%r13)
movb 0x25(%rax), %cl
movb %cl, 0x2(%r13)
movb 0x24(%rax), %al
movb %al, 0x3(%r13)
movl $0x4, %eax
jmp 0x7fb84
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, (%r13)
movl 0x24(%rax), %ecx
shrl $0x14, %ecx
movb %cl, 0x1(%r13)
movl 0x24(%rax), %ecx
shrl $0xc, %ecx
movb %cl, 0x2(%r13)
movl 0x24(%rax), %ecx
shrl $0x4, %ecx
movb %cl, 0x3(%r13)
movb 0x24(%rax), %al
andb $0xf, %al
movb %al, 0x4(%r13)
movl $0x5, %eax
addq %rax, %r13
movq (%r14), %rcx
cmpl $0x0, 0x24(%rcx)
jle 0x7fcc1
xorl %eax, %eax
movq 0x28(%rcx), %rcx
movl (%rcx,%rax,4), %ecx
cmpl $0x7f, %ecx
ja 0x7fbb0
movb %cl, (%r13)
movl $0x1, %ecx
jmp 0x7fcab
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x7fbda
shrl $0x8, %ecx
orb $-0x80, %cl
movb %cl, (%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movb (%rcx,%rax,4), %cl
movb %cl, 0x1(%r13)
movl $0x2, %ecx
jmp 0x7fcab
cmpl $0x1fffff, %ecx         # imm = 0x1FFFFF
ja 0x7fc13
shrl $0x10, %ecx
orb $-0x40, %cl
movb %cl, (%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movb 0x1(%rcx,%rax,4), %cl
movb %cl, 0x1(%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movb (%rcx,%rax,4), %cl
movb %cl, 0x2(%r13)
movl $0x3, %ecx
jmp 0x7fcab
cmpl $0xfffffff, %ecx        # imm = 0xFFFFFFF
ja 0x7fc58
shrl $0x18, %ecx
orb $-0x20, %cl
movb %cl, (%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movb 0x2(%rcx,%rax,4), %cl
movb %cl, 0x1(%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movb 0x1(%rcx,%rax,4), %cl
movb %cl, 0x2(%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movb (%rcx,%rax,4), %cl
movb %cl, 0x3(%r13)
movl $0x4, %ecx
jmp 0x7fcab
shrl $0x1c, %ecx
orb $-0x10, %cl
movb %cl, (%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movl (%rcx,%rax,4), %ecx
shrl $0x14, %ecx
movb %cl, 0x1(%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movl (%rcx,%rax,4), %ecx
shrl $0xc, %ecx
movb %cl, 0x2(%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movl (%rcx,%rax,4), %ecx
shrl $0x4, %ecx
movb %cl, 0x3(%r13)
movq (%r14), %rcx
movq 0x28(%rcx), %rcx
movb (%rcx,%rax,4), %cl
andb $0xf, %cl
movb %cl, 0x4(%r13)
movl $0x5, %ecx
addq %rcx, %r13
incq %rax
movq (%r14), %rcx
movslq 0x24(%rcx), %rdx
cmpq %rdx, %rax
jl 0x7fb96
cmpl $0x2, (%rcx)
jne 0x7fda8
movl 0x30(%rcx), %eax
cmpl $0x7f, %eax
ja 0x7fce0
movb %al, (%r13)
movl $0x1, %eax
jmp 0x7fda5
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x7fd04
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movq (%r14), %rax
movb 0x30(%rax), %al
movb %al, 0x1(%r13)
movl $0x2, %eax
jmp 0x7fda5
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x7fd2f
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movq (%r14), %rax
movb 0x31(%rax), %al
movb %al, 0x1(%r13)
movq (%r14), %rax
movb 0x30(%rax), %al
movb %al, 0x2(%r13)
movl $0x3, %eax
jmp 0x7fda5
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x7fd64
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movq (%r14), %rax
movb 0x32(%rax), %al
movb %al, 0x1(%r13)
movq (%r14), %rax
movb 0x31(%rax), %al
movb %al, 0x2(%r13)
movq (%r14), %rax
movb 0x30(%rax), %al
movb %al, 0x3(%r13)
movl $0x4, %eax
jmp 0x7fda5
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movq (%r14), %rax
movl 0x30(%rax), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movq (%r14), %rax
movl 0x30(%rax), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movq (%r14), %rax
movl 0x30(%rax), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movq (%r14), %rax
movb 0x30(%rax), %al
andb $0xf, %al
movb %al, 0x4(%r13)
movl $0x5, %eax
addq %rax, %r13
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
andl 0xc(%r12), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x7fdc9
movq (%r14), %rax
movups 0x34(%rax), %xmm0
movups %xmm0, (%r13)
addq $0x10, %r13
subq %r15, %r13
movq (%r14), %rax
movl 0x20(%rax), %eax
leal (%rax,%rax,4), %eax
addl $0x38, %eax
cltq
cmpq %rax, %r13
jg 0x7fdfd
movq %r15, 0x20(%rbx)
movl %r13d, 0x14(%rbx)
movl %r13d, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b3f2(%rip), %rdi     # 0x9b1f6
leaq 0x1b411(%rip), %rsi     # 0x9b21c
leaq 0x1b41d(%rip), %rcx     # 0x9b22f
movl $0x2c2, %edx            # imm = 0x2C2
callq 0x6460