// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/htslib/cram/cram_codecs.c
// Function: cram_beta_decode_init
cram_codec *cram_beta_decode_init(char *data, int size,
				  enum cram_external_type option,
				  int version) {
    cram_codec *c;
    char *cp = data;

    if (!(c = malloc(sizeof(*c))))
	return NULL;

    c->codec  = E_BETA;
    if (option == E_INT || option == E_LONG)
	c->decode = cram_beta_decode_int;
    else if (option == E_BYTE_ARRAY || option == E_BYTE)
	c->decode = cram_beta_decode_char;
    else
	abort();
    c->free   = cram_beta_decode_free;
    
    cp += itf8_get(cp, &c->beta.offset);
    cp += itf8_get(cp, &c->beta.nbits);

    if (cp - data != size
        || c->beta.nbits < 0 || c->beta.nbits > 8 * sizeof(int)) {
	fprintf(stderr, "Malformed beta header stream\n");
	free(c);
	return NULL;
    }

    return c;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x4700
testq %rax, %rax
je 0x4abe4
movl $0x6, (%rax)
leal -0x1(%r15), %ecx
cmpl $0x2, %ecx
jae 0x4aa62
leaq -0x428(%rip), %rcx      # 0x4a638
jmp 0x4aa77
addl $-0x3, %r15d
cmpl $0x2, %r15d
jae 0x4abec
leaq -0x121(%rip), %rcx      # 0x4a956
movq %rcx, 0x18(%rax)
leaq -0x62(%rip), %rcx       # 0x4aa20
movq %rcx, 0x10(%rax)
movzbl (%r14), %edx
movl $0x1, %ecx
testb %dl, %dl
js 0x4aa9d
movl $0x1, %esi
jmp 0x4ab28
movzbl 0x1(%r14), %esi
cmpb $-0x41, %dl
ja 0x4aab6
andl $0x3f, %edx
shll $0x8, %edx
orl %esi, %edx
movl $0x2, %esi
jmp 0x4ab28
cmpb $-0x21, %dl
ja 0x4aad4
shll $0x8, %esi
movzbl 0x2(%r14), %edi
andl $0x1f, %edx
shll $0x10, %edx
orl %esi, %edx
orl %edi, %edx
movl $0x3, %esi
jmp 0x4ab28
cmpb $-0x11, %dl
ja 0x4aafd
shll $0x10, %esi
movzbl 0x2(%r14), %edi
shll $0x8, %edi
movzbl 0x3(%r14), %r8d
andl $0xf, %edx
shll $0x18, %edx
orl %esi, %edx
orl %edi, %edx
orl %r8d, %edx
movl $0x4, %esi
jmp 0x4ab28
shll $0x1c, %edx
shll $0x14, %esi
orl %edx, %esi
movzbl 0x2(%r14), %edx
shll $0xc, %edx
orl %esi, %edx
movzbl 0x3(%r14), %esi
shll $0x4, %esi
orl %edx, %esi
movzbl 0x4(%r14), %edx
andl $0xf, %edx
orl %esi, %edx
movl $0x5, %esi
movl %edx, 0x30(%rax)
leaq (%r14,%rsi), %rdx
movzbl (%r14,%rsi), %esi
testb %sil, %sil
jns 0x4abc5
movzbl 0x1(%rdx), %ecx
cmpb $-0x41, %sil
ja 0x4ab56
andl $0x3f, %esi
shll $0x8, %esi
orl %ecx, %esi
movl $0x2, %ecx
jmp 0x4abc5
cmpb $-0x21, %sil
ja 0x4ab74
shll $0x8, %ecx
movzbl 0x2(%rdx), %edi
andl $0x1f, %esi
shll $0x10, %esi
orl %ecx, %esi
orl %edi, %esi
movl $0x3, %ecx
jmp 0x4abc5
cmpb $-0x11, %sil
ja 0x4ab9d
shll $0x10, %ecx
movzbl 0x2(%rdx), %edi
shll $0x8, %edi
movzbl 0x3(%rdx), %r8d
andl $0xf, %esi
shll $0x18, %esi
orl %ecx, %esi
orl %edi, %esi
orl %r8d, %esi
movl $0x4, %ecx
jmp 0x4abc5
shll $0x1c, %esi
shll $0x14, %ecx
orl %esi, %ecx
movzbl 0x2(%rdx), %esi
shll $0xc, %esi
orl %ecx, %esi
movzbl 0x3(%rdx), %ecx
shll $0x4, %ecx
orl %esi, %ecx
movzbl 0x4(%rdx), %esi
andl $0xf, %esi
orl %ecx, %esi
movl $0x5, %ecx
movl %esi, 0x34(%rax)
addq %rcx, %rdx
subq %r14, %rdx
movslq %ebx, %rcx
cmpq %rcx, %rdx
jne 0x4abdc
cmpl $0x21, 0x34(%rax)
jb 0x4abe6
movq %rax, %rdi
callq 0x6178
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
callq 0x42e0