// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x69d0
testq %rax, %rax
je 0x774e1
movq %rax, %rbx
movl $0x6, (%rax)
leal -0x1(%r15), %eax
cmpl $0x2, %eax
jae 0x7735c
leaq -0x401(%rip), %rax      # 0x76f59
jmp 0x77371
addl $-0x3, %r15d
cmpl $0x2, %r15d
jae 0x774f1
leaq -0xe8(%rip), %rax       # 0x77289
movq %rax, 0x18(%rbx)
leaq -0x62(%rip), %rax       # 0x7731a
movq %rax, 0x10(%rbx)
movzbl (%r14), %ecx
pushq $0x1
popq %rax
testb %cl, %cl
js 0x77390
movq %rax, %rdx
jmp 0x773ec
movzbl 0x1(%r14), %esi
cmpb $-0x41, %cl
ja 0x773a7
pushq $0x2
popq %rdx
andl $0x3f, %ecx
shll $0x8, %ecx
orl %esi, %ecx
jmp 0x773ec
cmpb $-0x21, %cl
ja 0x773c3
pushq $0x3
popq %rdx
shll $0x8, %esi
movzbl 0x2(%r14), %edi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %esi, %ecx
orl %edi, %ecx
jmp 0x773ec
cmpb $-0x11, %cl
ja 0x77455
pushq $0x4
popq %rdx
shll $0x10, %esi
movzbl 0x2(%r14), %edi
shll $0x8, %edi
movzbl 0x3(%r14), %r8d
andl $0xf, %ecx
shll $0x18, %ecx
orl %esi, %ecx
orl %edi, %ecx
orl %r8d, %ecx
movl %ecx, 0x30(%rbx)
leaq (%r14,%rdx), %rcx
movzbl (%r14,%rdx), %edx
testb %dl, %dl
jns 0x774a7
movzbl 0x1(%rcx), %eax
cmpb $-0x41, %dl
ja 0x77418
andl $0x3f, %edx
shll $0x8, %edx
orl %eax, %edx
pushq $0x2
jmp 0x774a6
cmpb $-0x21, %dl
ja 0x77432
shll $0x8, %eax
movzbl 0x2(%rcx), %esi
andl $0x1f, %edx
shll $0x10, %edx
orl %eax, %edx
orl %esi, %edx
pushq $0x3
jmp 0x774a6
cmpb $-0x11, %dl
ja 0x77481
shll $0x10, %eax
movzbl 0x2(%rcx), %esi
shll $0x8, %esi
movzbl 0x3(%rcx), %edi
andl $0xf, %edx
shll $0x18, %edx
orl %eax, %edx
orl %esi, %edx
orl %edi, %edx
pushq $0x4
jmp 0x774a6
pushq $0x5
popq %rdx
shll $0x1c, %ecx
shll $0x14, %esi
orl %ecx, %esi
movzbl 0x2(%r14), %ecx
shll $0xc, %ecx
orl %esi, %ecx
movzbl 0x3(%r14), %esi
shll $0x4, %esi
orl %ecx, %esi
movzbl 0x4(%r14), %ecx
andl $0xf, %ecx
jmp 0x773a3
shll $0x1c, %edx
shll $0x14, %eax
orl %edx, %eax
movzbl 0x2(%rcx), %edx
shll $0xc, %edx
orl %eax, %edx
movzbl 0x3(%rcx), %eax
shll $0x4, %eax
orl %edx, %eax
movzbl 0x4(%rcx), %edx
andl $0xf, %edx
orl %eax, %edx
pushq $0x5
popq %rax
movl %edx, 0x34(%rbx)
addq %rax, %rcx
subq %r14, %rcx
movslq %ebp, %rax
cmpq %rax, %rcx
jne 0x774bd
cmpl $0x21, %edx
jb 0x774e3
movq 0x3bb14(%rip), %rax     # 0xb2fd8
movq (%rax), %rcx
leaq 0x13330(%rip), %rdi     # 0x8a7fe
pushq $0x1d
popq %rsi
pushq $0x1
popq %rdx
callq 0x6e70
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x63c0