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

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

    c->codec  = E_BYTE_ARRAY_STOP;
    switch (option) {
    case E_BYTE_ARRAY_BLOCK:
        c->decode = cram_byte_array_stop_decode_block;
	break;
    case E_BYTE_ARRAY:
        c->decode = cram_byte_array_stop_decode_char;
	break;
    default:
        fprintf(stderr, "byte_array_stop codec only supports BYTE_ARRAYs.\n");
        free(c);
        return NULL;
    }
    c->free   = cram_byte_array_stop_decode_free;
    
    c->byte_array_stop.stop = *cp++;
    if (CRAM_MAJOR_VERS(version) == 1) {
	c->byte_array_stop.content_id = cp[0] + (cp[1]<<8) + (cp[2]<<16)
	    + (cp[3]<<24);
	cp += 4;
    } else {
	cp += itf8_get(cp, &c->byte_array_stop.content_id);
    }

    if ((char *)cp - data != size) {
	fprintf(stderr, "Malformed byte_array_stop header stream\n");
	free(c);
	return NULL;
    }

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %r15d
movl %edx, %r12d
movl %esi, %ebp
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x46f0
testq %rax, %rax
je 0x3ebba
movq %rax, %rbx
movl $0x5, (%rax)
cmpl $0x5, %r12d
je 0x3eaa3
cmpl $0x4, %r12d
jne 0x3eb47
leaq 0x127(%rip), %rax       # 0x3ebc8
jmp 0x3eaaa
leaq -0x252(%rip), %rax      # 0x3e858
movq %rax, 0x18(%rbx)
leaq -0x5f(%rip), %rax       # 0x3ea56
movq %rax, 0x10(%rbx)
movb (%r14), %al
movb %al, 0x30(%rbx)
andl $0xffffff00, %r15d      # imm = 0xFFFFFF00
cmpl $0x100, %r15d           # imm = 0x100
jne 0x3eadf
movl 0x1(%r14), %eax
movl %eax, 0x34(%rbx)
leaq 0x5(%r14), %rax
jmp 0x3eb8b
leaq 0x1(%r14), %rax
movzbl (%rax), %ecx
testb %cl, %cl
js 0x3eaf1
pushq $0x1
jmp 0x3eb84
movzbl 0x2(%r14), %edx
cmpb $-0x41, %cl
ja 0x3eb07
andl $0x3f, %ecx
shll $0x8, %ecx
orl %edx, %ecx
pushq $0x2
jmp 0x3eb84
cmpb $-0x21, %cl
ja 0x3eb22
shll $0x8, %edx
movzbl 0x3(%r14), %esi
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
orl %esi, %ecx
pushq $0x3
jmp 0x3eb84
cmpb $-0x11, %cl
ja 0x3eb5c
shll $0x10, %edx
movzbl 0x3(%r14), %esi
shll $0x8, %esi
movzbl 0x4(%r14), %edi
andl $0xf, %ecx
shll $0x18, %ecx
orl %edx, %ecx
orl %esi, %ecx
orl %edi, %ecx
pushq $0x4
jmp 0x3eb84
movq 0x18482(%rip), %rax     # 0x56fd0
movq (%rax), %rcx
leaq 0x8ca8(%rip), %rdi      # 0x47800
pushq $0x31
jmp 0x3eba9
shll $0x1c, %ecx
shll $0x14, %edx
orl %ecx, %edx
movzbl 0x3(%r14), %ecx
shll $0xc, %ecx
orl %edx, %ecx
movzbl 0x4(%r14), %edx
shll $0x4, %edx
orl %ecx, %edx
movzbl 0x5(%r14), %ecx
andl $0xf, %ecx
orl %edx, %ecx
pushq $0x5
popq %rdx
movl %ecx, 0x34(%rbx)
addq %rdx, %rax
subq %r14, %rax
movslq %ebp, %rcx
cmpq %rcx, %rax
je 0x3ebbc
movq 0x18433(%rip), %rax     # 0x56fd0
movq (%rax), %rcx
leaq 0x8c8b(%rip), %rdi      # 0x47832
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x4a20
movq %rbx, %rdi
callq 0x4600
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq