// File: /workspace/github_cpp_makefile_star2_O3/karel-brinda[P]ococo/ext/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 $0x88, %rsp
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %r13
cmpl $0xa, %ecx
je 0x32d43
cmpl $0x4, %ecx
je 0x32d31
cmpl $0x1, %ecx
jne 0x32d84
movl %r8d, %r15d
movl %r9d, 0xc(%rsp)
movq %r12, %xmm0
punpckldq 0x1dd72(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1dd7a(%rip), %xmm0    # 0x50990
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1ff4e(%rip), %xmm1    # 0x52b78
addsd 0x1b44e(%rip), %xmm1    # 0x4e080
cvttsd2si %xmm1, %ebx
movslq %ebx, %rdi
callq 0x4700
testq %rax, %rax
je 0x32d84
movq %rax, %r14
movq %rbp, 0x10(%rsp)
xorpd %xmm0, %xmm0
leaq 0x18(%rsp), %rdi
movupd %xmm0, 0x40(%rdi)
xorl %ebp, %ebp
movq %rbp, 0x50(%rdi)
movq %r13, (%rdi)
movl %r12d, 0x8(%rdi)
movq %rbp, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movl %ebx, 0x20(%rdi)
movq %rbp, 0x28(%rdi)
movl $0x0, 0x58(%rdi)
leaq 0x1e39e(%rip), %rax     # 0x51025
movl %r15d, %esi
movl $0x8, %edx
movl $0x1f, %ecx
movl $0x9, %r8d
movl 0xc(%rsp), %r9d
pushq $0x70
pushq %rax
callq 0x4090
addq $0x10, %rsp
testl %eax, %eax
jne 0x32d67
leaq 0x18(%rsp), %r15
cmpl $0x0, 0x20(%rsp)
je 0x32cf7
movslq %ebp, %rax
leaq (%r14,%rax), %rcx
movq %rcx, 0x30(%rsp)
movl %ebx, %ecx
subl %eax, %ecx
movl %ecx, 0x38(%rsp)
jle 0x32d7f
movq %r15, %rdi
xorl %esi, %esi
callq 0x4260
movl %ebx, %ebp
subl 0x38(%rsp), %ebp
testl %eax, %eax
je 0x32cb8
leaq 0x18(%rsp), %rdi
callq 0x55d7
leaq 0x18(%rsp), %rdi
movl $0x4, %esi
callq 0x4260
cmpl $0x1, %eax
jne 0x32d73
leaq 0x18(%rsp), %rdi
movq 0x28(%rdi), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
callq 0x4310
testl %eax, %eax
je 0x32d87
leaq 0x18(%rsp), %rdi
callq 0x5643
jmp 0x32d87
leaq 0x18(%rsp), %r15
movq %r13, %rdi
movl %r12d, %esi
movq %r15, %rdx
xorl %ecx, %ecx
jmp 0x32d56
leaq 0x18(%rsp), %r15
movq %r13, %rdi
movl %r12d, %esi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x3d0b1
movq %rax, %r14
movl (%r15), %eax
movq %rax, (%rbp)
jmp 0x32d87
leaq 0x18(%rsp), %rdi
callq 0x55b2
jmp 0x32d84
leaq 0x18(%rsp), %rdi
callq 0x561e
jmp 0x32d0b
callq 0x55fc
xorl %r14d, %r14d
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq