// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/cram/cram_encode.c
// Function: cram_compress_slice
static int cram_compress_slice(cram_fd *fd, cram_slice *s) {
    int level = fd->level, i;
    int method = 1<<GZIP | 1<<GZIP_RLE, methodF = method;

    /* Compress the CORE Block too, with minimal zlib level */
    if (level > 5 && s->block[0]->uncomp_size > 500)
	cram_compress_block(fd, s->block[0], NULL, GZIP, 1);
 
    if (fd->use_bz2)
	method |= 1<<BZIP2;

    if (fd->use_rans)
	method |= (1<<RANS0) | (1<<RANS1);

    if (fd->use_lzma)
	method |= (1<<LZMA);

    /* Faster method for data series we only need entropy encoding on */
    methodF = method & ~(1<<GZIP | 1<<BZIP2 | 1<<LZMA);
    if (level >= 6)
	methodF = method;
    

    /* Specific compression methods for certain block types */
    if (cram_compress_block(fd, s->block[DS_IN], fd->m[DS_IN], //IN (seq)
			    method, level))
	return -1;

    if (fd->level == 0) {
	/* Do nothing */
    } else if (fd->level == 1) {
	if (cram_compress_block(fd, s->block[DS_QS], fd->m[DS_QS],
				methodF, 1))
	    return -1;
	for (i = DS_aux; i <= DS_aux_oz; i++) {
	    if (s->block[i])
		if (cram_compress_block(fd, s->block[i], fd->m[i],
					method, 1))
		    return -1;
	}
    } else if (fd->level < 3) {
	if (cram_compress_block(fd, s->block[DS_QS], fd->m[DS_QS],
				method, 1))
	    return -1;
	if (cram_compress_block(fd, s->block[DS_BA], fd->m[DS_BA],
				method, 1))
	    return -1;
	if (s->block[DS_BB])
	    if (cram_compress_block(fd, s->block[DS_BB], fd->m[DS_BB],
				    method, 1))
	    return -1;
	for (i = DS_aux; i <= DS_aux_oz; i++) {
	    if (s->block[i])
		if (cram_compress_block(fd, s->block[i], fd->m[i],
					method, level))
		    return -1;
	}
    } else {
	if (cram_compress_block(fd, s->block[DS_QS], fd->m[DS_QS],
				method, level))
	    return -1;
	if (cram_compress_block(fd, s->block[DS_BA], fd->m[DS_BA],
				method, level))
	    return -1;
	if (s->block[DS_BB])
	    if (cram_compress_block(fd, s->block[DS_BB], fd->m[DS_BB],
				    method, level))
	    return -1;
	for (i = DS_aux; i <= DS_aux_oz; i++) {
	    if (s->block[i])
		if (cram_compress_block(fd, s->block[i], fd->m[i],
					method, level))
		    return -1;
	}
    }

    // NAME: best is generally xz, bzip2, zlib then rans1
    // It benefits well from a little bit extra compression level.
    if (cram_compress_block(fd, s->block[DS_RN], fd->m[DS_RN],
			    method & ~(1<<RANS0 | 1<<GZIP_RLE),
			    MIN(9,level)))
	return -1;

    // NS shows strong local correlation as rearrangements are localised
    if (s->block[DS_NS] != s->block[0])
	if (cram_compress_block(fd, s->block[DS_NS], fd->m[DS_NS],
				method, level))
	    return -1;


    /*
     * Minimal compression of any block still uncompressed, bar CORE
     */
    {
	int i;
	for (i = 1; i < DS_END; i++) {
	    if (!s->block[i] || s->block[i] == s->block[0])
		continue;

	    // fast methods only
	    if (s->block[i]->method == RAW) {
		cram_compress_block(fd, s->block[i], fd->m[i],
				    methodF, level);
	    }
	}
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x1c(%rbp)
movl $0x802, -0x24(%rbp)     # imm = 0x802
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x5, -0x1c(%rbp)
jle 0xc5372
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
cmpl $0x1f4, 0x14(%rax)      # imm = 0x1F4
jle 0xc5372
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x1, %r8d
movl %r8d, %ecx
callq 0x7f960
movq -0x10(%rbp), %rax
cmpl $0x0, 0x214(%rax)
je 0xc5388
movl -0x24(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x218(%rax)
je 0xc53a0
movl -0x24(%rbp), %eax
orl $0x410, %eax            # imm = 0x410
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x21c(%rax)
je 0xc53b6
movl -0x24(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
andl $-0xf, %eax
movl %eax, -0x28(%rbp)
cmpl $0x6, -0x1c(%rbp)
jl 0xc53cb
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x68(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rdx
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc5403
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
movq -0x10(%rbp), %rax
cmpl $0x0, 0x78(%rax)
jne 0xc5412
jmp 0xc5754
movq -0x10(%rbp), %rax
cmpl $0x1, 0x78(%rax)
jne 0xc54d1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rdx
movl -0x28(%rbp), %ecx
movl $0x1, %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc545a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
movl $0x1, -0x20(%rbp)
cmpl $0x9, -0x20(%rbp)
jg 0xc54cc
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xc54bf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq 0x80(%rax,%rcx,8), %rdx
movl -0x24(%rbp), %ecx
movl $0x1, %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc54bd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
jmp 0xc54bf
jmp 0xc54c1
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc5461
jmp 0xc5752
movq -0x10(%rbp), %rax
cmpl $0x3, 0x78(%rax)
jge 0xc561c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rdx
movl -0x24(%rbp), %ecx
movl $0x1, %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc5519
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0xf0(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x170(%rax), %rdx
movl -0x24(%rbp), %ecx
movl $0x1, %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc5556
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x128(%rax)
je 0xc55a7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x128(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x1a8(%rax), %rdx
movl -0x24(%rbp), %ecx
movl $0x1, %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc55a5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
jmp 0xc55a7
movl $0x1, -0x20(%rbp)
cmpl $0x9, -0x20(%rbp)
jg 0xc5617
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xc560a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq 0x80(%rax,%rcx,8), %rdx
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc5608
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
jmp 0xc560a
jmp 0xc560c
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc55ae
jmp 0xc5750
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x60(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rdx
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc5654
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0xf0(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x170(%rax), %rdx
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc568f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x128(%rax)
je 0xc56de
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x128(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x1a8(%rax), %rdx
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc56dc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
jmp 0xc56de
movl $0x1, -0x20(%rbp)
cmpl $0x9, -0x20(%rbp)
jg 0xc574e
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xc5741
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq 0x80(%rax,%rcx,8), %rdx
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc573f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
jmp 0xc5741
jmp 0xc5743
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xc56e5
jmp 0xc5750
jmp 0xc5752
jmp 0xc5754
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
andl $0xfffff7ef, %eax       # imm = 0xFFFFF7EF
movl %eax, -0x30(%rbp)
movl $0x9, %eax
cmpl -0x1c(%rbp), %eax
jge 0xc579a
movl $0x9, %eax
movl %eax, -0x4c(%rbp)
jmp 0xc57a0
movl -0x1c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x30(%rbp), %ecx
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdi
movl -0x4c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc57c9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq (%rcx), %rax
je 0xc5822
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0xa0(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x120(%rax), %rdx
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
cmpl $0x0, %eax
je 0xc5820
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xc58c1
jmp 0xc5822
movl $0x1, -0x2c(%rbp)
cmpl $0x2f, -0x2c(%rbp)
jge 0xc58ba
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0xc5863
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq (%rcx), %rax
jne 0xc5865
jmp 0xc58ac
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x0, (%rax)
jne 0xc58aa
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x80(%rax,%rcx,8), %rdx
movl -0x28(%rbp), %ecx
movl -0x1c(%rbp), %r8d
callq 0x7f960
jmp 0xc58ac
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xc5829
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)