// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x240, %edi            # imm = 0x240
callq 0x47a0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x73b3e
movq $0x0, -0x8(%rbp)
jmp 0x73de2
movq -0x28(%rbp), %rax
movl $0x5, (%rax)
movl -0x18(%rbp), %eax
movl %eax, -0x34(%rbp)
subl $0x4, %eax
je 0x73b70
jmp 0x73b55
movl -0x34(%rbp), %eax
subl $0x5, %eax
jne 0x73b81
jmp 0x73b5f
movq -0x28(%rbp), %rax
leaq -0x47a(%rip), %rcx      # 0x736f0
movq %rcx, 0x18(%rax)
jmp 0x73baf
movq -0x28(%rbp), %rax
leaq 0x275(%rip), %rcx       # 0x73df0
movq %rcx, 0x18(%rax)
jmp 0x73baf
movq 0x16448(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
leaq 0xb11e(%rip), %rsi      # 0x7ecb0
movb $0x0, %al
callq 0x4830
movq -0x28(%rbp), %rdi
callq 0x46a0
movq $0x0, -0x8(%rbp)
jmp 0x73de2
movq -0x28(%rbp), %rax
leaq -0xea(%rip), %rcx       # 0x73ad0
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x30(%rax)
movl -0x1c(%rbp), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x73c27
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
addl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x10, %eax
addl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
shll $0x18, %eax
addl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0x73d9b
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x73c50
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x73d8a
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xc0, %eax
jge 0x73c8c
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
shll $0x8, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
orl %eax, %ecx
andl $0x3fff, %ecx           # imm = 0x3FFF
movq -0x28(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0x2, %eax
movl %eax, -0x3c(%rbp)
jmp 0x73d84
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xe0, %eax
jge 0x73cd5
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
shll $0x10, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
orl %eax, %ecx
andl $0x1fffff, %ecx         # imm = 0x1FFFFF
movq -0x28(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0x3, %eax
movl %eax, -0x40(%rbp)
jmp 0x73d7e
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xf0, %eax
jge 0x73d28
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
shll $0x18, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x10, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x8, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
orl %eax, %ecx
andl $0xfffffff, %ecx        # imm = 0xFFFFFFF
movq -0x28(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0x4, %eax
movl %eax, -0x44(%rbp)
jmp 0x73d78
movq -0x30(%rbp), %rax
movzbl (%rax), %ecx
andl $0xf, %ecx
shll $0x1c, %ecx
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x14, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0xc, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
shll $0x4, %eax
orl %eax, %ecx
movq -0x30(%rbp), %rax
movzbl 0x4(%rax), %eax
andl $0xf, %eax
orl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x34(%rax)
movl $0x5, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movslq -0x14(%rbp), %rcx
cmpq %rcx, %rax
je 0x73dda
movq 0x1621a(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
leaq 0xaf22(%rip), %rsi      # 0x7ece2
movb $0x0, %al
callq 0x4830
movq -0x28(%rbp), %rdi
callq 0x46a0
movq $0x0, -0x8(%rbp)
jmp 0x73de2
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)