// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/cram_io.c
// Function: cram_compress_by_method
static char *cram_compress_by_method(char *in, size_t in_size,
				     size_t *out_size,
				     enum cram_block_method method,
				     int level, int strat) {
    switch (method) {
    case GZIP:
	return zlib_mem_deflate(in, in_size, out_size, level, strat);

    case BZIP2: {
#ifdef HAVE_LIBBZ2
	unsigned int comp_size = in_size*1.01 + 600;
	char *comp = malloc(comp_size);
	if (!comp)
	    return NULL;

	if (BZ_OK != BZ2_bzBuffToBuffCompress(comp, &comp_size,
					      in, in_size,
					      level, 0, 30)) {
	    free(comp);
	    return NULL;
	}
	*out_size = comp_size;
	return comp;
#else
	return NULL;
#endif
    }

    case LZMA:
#ifdef HAVE_LIBLZMA
	return lzma_mem_deflate(in, in_size, out_size, level);
#else
	return NULL;
#endif

    case RANS0: {
	unsigned int out_size_i;
	unsigned char *cp;
	cp = rans_compress((unsigned char *)in, in_size, &out_size_i, 0);
	*out_size = out_size_i;
	return (char *)cp;
    }

    case RANS1: {
	unsigned int out_size_i;
	unsigned char *cp;
	
	cp = rans_compress((unsigned char *)in, in_size, &out_size_i, 1);
	*out_size = out_size_i;
	return (char *)cp;
    }

    case RAW:
	break;

    default:
	return NULL;
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r13
cmpl $0xa, %ecx
je 0x4ed0c
cmpl $0x4, %ecx
je 0x4ecfa
cmpl $0x1, %ecx
jne 0x4ed8c
movl %r9d, %ebp
movl %r8d, %r15d
movq %r14, (%rsp)
movq %r12, %xmm0
punpckldq 0x2c454(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2c45c(%rip), %xmm0    # 0x7b020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x330c8(%rip), %xmm1    # 0x81ca0
addsd 0x2e5e0(%rip), %xmm1    # 0x7d1c0
cvttsd2si %xmm1, %r14d
movslq %r14d, %rdi
callq 0x69d0
testq %rax, %rax
je 0x4ed8c
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
andq $0x0, 0x50(%rdi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x40(%rdi)
movq %r13, (%rdi)
movl %r12d, 0x8(%rdi)
andq $0x0, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movl %r14d, 0x20(%rdi)
andq $0x0, 0x28(%rdi)
andl $0x0, 0x58(%rdi)
leaq 0x38b5a(%rip), %rax     # 0x8778a
pushq $0x8
popq %rdx
pushq $0x1f
popq %rcx
pushq $0x9
popq %r8
movl %r15d, %esi
movl %ebp, %r9d
pushq $0x70
pushq %rax
callq 0x6090
addq $0x10, %rsp
testl %eax, %eax
jne 0x4ed2d
xorl %ecx, %ecx
leaq 0x8(%rsp), %r15
cmpl $0x0, 0x10(%rsp)
je 0x4ecaf
movslq %ecx, %rax
leaq (%rbx,%rax), %rcx
movq %rcx, 0x20(%rsp)
movl %r14d, %ecx
subl %eax, %ecx
movl %ecx, 0x28(%rsp)
jle 0x4ed70
movq %r15, %rdi
xorl %esi, %esi
callq 0x6310
movl %r14d, %ecx
subl 0x28(%rsp), %ecx
testl %eax, %eax
je 0x4ec5b
movq 0x6433f(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
movq 0x38(%rsp), %rdx
leaq 0x393d9(%rip), %rsi     # 0x88081
xorl %eax, %eax
callq 0x6a90
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rsi
callq 0x6310
cmpl $0x1, %eax
jne 0x4ed4e
leaq 0x8(%rsp), %rdi
movq 0x28(%rdi), %rax
movq (%rsp), %rcx
movq %rax, (%rcx)
callq 0x6420
testl %eax, %eax
je 0x4ed8e
movq 0x642ef(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
movq 0x38(%rsp), %rdx
leaq 0x39389(%rip), %rsi     # 0x88081
jmp 0x4ed45
leaq 0x8(%rsp), %r15
movq %r13, %rdi
movl %r12d, %esi
movq %r15, %rdx
xorl %ecx, %ecx
jmp 0x4ed1d
leaq 0x8(%rsp), %r15
pushq $0x1
popq %rcx
movq %r13, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x57b82
movq %rax, %rbx
movl (%r15), %eax
movq %rax, (%r14)
jmp 0x4ed8e
movq 0x642a4(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
movq 0x38(%rsp), %rdx
leaq 0x392ec(%rip), %rsi     # 0x8802f
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x6a90
jmp 0x4ed8e
movq 0x64283(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
movq 0x38(%rsp), %rdx
leaq 0x3931d(%rip), %rsi     # 0x88081
xorl %eax, %eax
callq 0x6a90
jmp 0x4ecc5
movq 0x64261(%rip), %rax     # 0xb2fd8
movq (%rax), %rcx
leaq 0x392cb(%rip), %rdi     # 0x8804c
pushq $0x34
popq %rsi
pushq $0x1
popq %rdx
callq 0x6e70
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq