// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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 0x69d0
testq %rax, %rax
je 0x88a71
movl $0x6, (%rax)
leal -0x1(%r15), %ecx
cmpl $0x2, %ecx
jae 0x888ef
leaq -0x40c(%rip), %rcx      # 0x884e1
jmp 0x88904
addl $-0x3, %r15d
cmpl $0x2, %r15d
jae 0x88a79
leaq -0x105(%rip), %rcx      # 0x887ff
movq %rcx, 0x18(%rax)
leaq -0x62(%rip), %rcx       # 0x888ad
movq %rcx, 0x10(%rax)
movzbl (%r14), %edx
movl $0x1, %ecx
testb %dl, %dl
js 0x8892a
movl $0x1, %esi
jmp 0x889b5
movzbl 0x1(%r14), %esi
cmpb $-0x41, %dl
ja 0x88943
andl $0x3f, %edx
shll $0x8, %edx
orl %esi, %edx
movl $0x2, %esi
jmp 0x889b5
cmpb $-0x21, %dl
ja 0x88961
shll $0x8, %esi
movzbl 0x2(%r14), %edi
andl $0x1f, %edx
shll $0x10, %edx
orl %esi, %edx
orl %edi, %edx
movl $0x3, %esi
jmp 0x889b5
cmpb $-0x11, %dl
ja 0x8898a
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 0x889b5
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 0x88a52
movzbl 0x1(%rdx), %ecx
cmpb $-0x41, %sil
ja 0x889e3
andl $0x3f, %esi
shll $0x8, %esi
orl %ecx, %esi
movl $0x2, %ecx
jmp 0x88a52
cmpb $-0x21, %sil
ja 0x88a01
shll $0x8, %ecx
movzbl 0x2(%rdx), %edi
andl $0x1f, %esi
shll $0x10, %esi
orl %ecx, %esi
orl %edi, %esi
movl $0x3, %ecx
jmp 0x88a52
cmpb $-0x11, %sil
ja 0x88a2a
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 0x88a52
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 0x88a69
cmpl $0x21, 0x34(%rax)
jb 0x88a73
movq %rax, %rdi
callq 0x85a9
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
callq 0x63c0