// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x2
popq %rdi
xorl %esi, %esi
callq 0x4db76
testq %rax, %rax
je 0x6ecd8
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 0x6ecd0
movq %rax, %r15
movl 0x4(%rbp), %eax
cmpl $0x7f, %eax
ja 0x6ecdf
movb %al, (%r15)
pushq $0x1
popq %r13
jmp 0x6ed7e
movq %rbx, %rdi
callq 0x4e18f
xorl %ebx, %ebx
jmp 0x6f43c
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x6ecfe
pushq $0x2
popq %r13
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r15)
movb 0x4(%rbp), %al
movb %al, 0x1(%r15)
jmp 0x6ed7e
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x6ed21
pushq $0x3
popq %r13
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)
jmp 0x6ed7e
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x6ed4b
pushq $0x4
popq %r13
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)
jmp 0x6ed7e
pushq $0x5
popq %r13
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)
addq %r15, %r13
movl 0x8(%rbp), %eax
cmpl $0x7f, %eax
ja 0x6ed94
movb %al, (%r13)
pushq $0x1
jmp 0x6ee2c
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x6edaf
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x8(%rbp), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x6ee2c
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x6edd1
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)
pushq $0x3
jmp 0x6ee2c
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x6edfa
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)
pushq $0x4
jmp 0x6ee2c
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)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0xc(%rbp), %eax
cmpl $0x7f, %eax
ja 0x6ee43
movb %al, (%r13)
pushq $0x1
jmp 0x6eedb
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x6ee5e
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0xc(%rbp), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x6eedb
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x6ee80
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)
pushq $0x3
jmp 0x6eedb
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x6eea9
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)
pushq $0x4
jmp 0x6eedb
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)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0x10(%rbp), %eax
cmpl $0x7f, %eax
ja 0x6eef2
movb %al, (%r13)
pushq $0x1
jmp 0x6ef8a
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x6ef0d
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x10(%rbp), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x6ef8a
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x6ef2f
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)
pushq $0x3
jmp 0x6ef8a
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x6ef58
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)
pushq $0x4
jmp 0x6ef8a
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)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0xc(%r12), %eax
sarl $0x8, %eax
cmpl $0x2, %eax
jne 0x6efb0
movq 0x18(%rbp), %rax
cmpq $0x7f, %rax
ja 0x6efcf
movb %al, (%r13)
pushq $0x1
jmp 0x6f06a
jle 0x6f06e
movq 0x18(%rbp), %rsi
movq %r13, %rdi
callq 0x4c9e6
cltq
addq %rax, %r13
movq (%r14), %rbp
jmp 0x6f06e
cmpq $0x3fff, %rax           # imm = 0x3FFF
ja 0x6efeb
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x18(%rbp), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x6f06a
cmpq $0x1fffff, %rax         # imm = 0x1FFFFF
ja 0x6f00e
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)
pushq $0x3
jmp 0x6f06a
cmpq $0xfffffff, %rax        # imm = 0xFFFFFFF
ja 0x6f038
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)
pushq $0x4
jmp 0x6f06a
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)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0x20(%rbp), %eax
cmpl $0x7f, %eax
ja 0x6f081
movb %al, (%r13)
pushq $0x1
jmp 0x6f119
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x6f09c
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x20(%rbp), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x6f119
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x6f0be
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x21(%rbp), %al
movb %al, 0x1(%r13)
movb 0x20(%rbp), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x6f119
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x6f0e7
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x22(%rbp), %al
movb %al, 0x1(%r13)
movb 0x21(%rbp), %al
movb %al, 0x2(%r13)
movb 0x20(%rbp), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x6f119
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x20(%rbp), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x20(%rbp), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x20(%rbp), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x20(%rbp), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rax
addq %rax, %r13
movl 0x24(%rbp), %eax
cmpl $0x7f, %eax
ja 0x6f130
movb %al, (%r13)
pushq $0x1
jmp 0x6f1c8
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x6f14b
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movb 0x24(%rbp), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x6f1c8
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x6f16d
shrl $0x10, %eax
orb $-0x40, %al
movb %al, (%r13)
movb 0x25(%rbp), %al
movb %al, 0x1(%r13)
movb 0x24(%rbp), %al
movb %al, 0x2(%r13)
pushq $0x3
jmp 0x6f1c8
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x6f196
shrl $0x18, %eax
orb $-0x20, %al
movb %al, (%r13)
movb 0x26(%rbp), %al
movb %al, 0x1(%r13)
movb 0x25(%rbp), %al
movb %al, 0x2(%r13)
movb 0x24(%rbp), %al
movb %al, 0x3(%r13)
pushq $0x4
jmp 0x6f1c8
shrl $0x1c, %eax
orb $-0x10, %al
movb %al, (%r13)
movl 0x24(%rbp), %eax
shrl $0x14, %eax
movb %al, 0x1(%r13)
movl 0x24(%rbp), %eax
shrl $0xc, %eax
movb %al, 0x2(%r13)
movl 0x24(%rbp), %eax
shrl $0x4, %eax
movb %al, 0x3(%r13)
movb 0x24(%rbp), %al
andb $0xf, %al
movb %al, 0x4(%r13)
pushq $0x5
popq %rcx
pushq $0x1
popq %rax
addq %rcx, %r13
xorl %ecx, %ecx
pushq $0x2
popq %rdx
pushq $0x3
popq %rsi
pushq $0x4
popq %rdi
pushq $0x5
popq %r8
movslq 0x24(%rbp), %r9
cmpq %r9, %rcx
jge 0x6f31f
movq 0x28(%rbp), %r9
movl (%r9,%rcx,4), %r9d
cmpl $0x7f, %r9d
ja 0x6f205
movb %r9b, (%r13)
movq %rax, %r9
jmp 0x6f311
cmpl $0x3fff, %r9d           # imm = 0x3FFF
ja 0x6f231
shrl $0x8, %r9d
orb $-0x80, %r9b
movb %r9b, (%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movb (%r9,%rcx,4), %r9b
movb %r9b, 0x1(%r13)
movq %rdx, %r9
jmp 0x6f311
cmpl $0x1fffff, %r9d         # imm = 0x1FFFFF
ja 0x6f26d
shrl $0x10, %r9d
orb $-0x40, %r9b
movb %r9b, (%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movb 0x1(%r9,%rcx,4), %r9b
movb %r9b, 0x1(%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movb (%r9,%rcx,4), %r9b
movb %r9b, 0x2(%r13)
movq %rsi, %r9
jmp 0x6f311
cmpl $0xfffffff, %r9d        # imm = 0xFFFFFFF
ja 0x6f2b6
shrl $0x18, %r9d
orb $-0x20, %r9b
movb %r9b, (%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movb 0x2(%r9,%rcx,4), %r9b
movb %r9b, 0x1(%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movb 0x1(%r9,%rcx,4), %r9b
movb %r9b, 0x2(%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movb (%r9,%rcx,4), %r9b
movb %r9b, 0x3(%r13)
movq %rdi, %r9
jmp 0x6f311
shrl $0x1c, %r9d
orb $-0x10, %r9b
movb %r9b, (%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movl (%r9,%rcx,4), %r9d
shrl $0x14, %r9d
movb %r9b, 0x1(%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movl (%r9,%rcx,4), %r9d
shrl $0xc, %r9d
movb %r9b, 0x2(%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movl (%r9,%rcx,4), %r9d
shrl $0x4, %r9d
movb %r9b, 0x3(%r13)
movq (%r14), %r9
movq 0x28(%r9), %r9
movb (%r9,%rcx,4), %r9b
andb $0xf, %r9b
movb %r9b, 0x4(%r13)
movq %r8, %r9
addq %r9, %r13
incq %rcx
movq (%r14), %rbp
jmp 0x6f1de
cmpl $0x2, (%rbp)
jne 0x6f3fc
movl 0x30(%rbp), %eax
cmpl $0x7f, %eax
ja 0x6f33c
movb %al, (%r13)
pushq $0x1
jmp 0x6f3f5
cmpl $0x3fff, %eax           # imm = 0x3FFF
ja 0x6f35d
shrl $0x8, %eax
orb $-0x80, %al
movb %al, (%r13)
movq (%r14), %rax
movb 0x30(%rax), %al
movb %al, 0x1(%r13)
pushq $0x2
jmp 0x6f3f5
cmpl $0x1fffff, %eax         # imm = 0x1FFFFF
ja 0x6f385
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)
pushq $0x3
jmp 0x6f3f5
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
ja 0x6f3b7
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)
pushq $0x4
jmp 0x6f3f5
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)
pushq $0x5
popq %rax
addq %rax, %r13
movq (%r14), %rbp
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
andl 0xc(%r12), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x6f41d
movups 0x34(%rbp), %xmm0
movups %xmm0, (%r13)
addq $0x10, %r13
movq (%r14), %rbp
subq %r15, %r13
movl 0x20(%rbp), %eax
leal (%rax,%rax,4), %eax
addl $0x38, %eax
cltq
cmpq %rax, %r13
jg 0x6f44e
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 0x1ad51(%rip), %rdi     # 0x8a1a6
leaq 0x1ad70(%rip), %rsi     # 0x8a1cc
leaq 0x1ad7c(%rip), %rcx     # 0x8a1df
movl $0x2c2, %edx            # imm = 0x2C2
callq 0x6460