// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_decode_init
cram_codec *cram_byte_array_len_decode_init(char *data, int size,
					    enum cram_external_type option,
					    int version) {
    cram_codec *c;
    char *cp   = data;
    char *endp = data + size;
    int32_t encoding = 0;
    int32_t sub_size = -1;

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

    c->codec  = E_BYTE_ARRAY_LEN;
    c->decode = cram_byte_array_len_decode;
    c->free   = cram_byte_array_len_decode_free;
    
    cp += safe_itf8_get(cp, endp, &encoding);
    cp += safe_itf8_get(cp, endp, &sub_size);
    if (sub_size < 0 || endp - cp < sub_size)
        goto malformed;
    c->byte_array_len.len_codec = cram_decoder_init(encoding, cp, sub_size,
						    E_INT, version);
    if (c->byte_array_len.len_codec == NULL)
        goto no_codec;
    cp += sub_size;

    sub_size = -1;
    cp += safe_itf8_get(cp, endp, &encoding);
    cp += safe_itf8_get(cp, endp, &sub_size);
    if (sub_size < 0 || endp - cp < sub_size)
        goto malformed;
    c->byte_array_len.val_codec = cram_decoder_init(encoding, cp, sub_size,
						    option, version);
    if (c->byte_array_len.val_codec == NULL)
        goto no_codec;
    cp += sub_size;

    if (cp - data != size)
        goto malformed;

    return c;

 malformed:
    fprintf(stderr, "Malformed byte_array_len header stream\n");
 no_codec:
    free(c);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, (%rsp)
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r14
movl $0x240, %edi            # imm = 0x240
callq 0x69d0
testq %rax, %rax
je 0x8ae20
movq %rax, %rbx
movslq %r12d, %r13
movl $0x4, (%rax)
leaq -0xe4(%rip), %rax       # 0x8a955
movq %rax, 0x18(%rbx)
leaq -0x72(%rip), %rax       # 0x8a9d2
movq %rax, 0x10(%rbx)
cmpl $0x4, %r13d
jg 0x8aa70
testl %r12d, %r12d
jle 0x8aa67
movzbl (%r14), %eax
shrl $0x4, %eax
leaq 0xe04f(%rip), %rcx      # 0x98ab0
cmpl %r12d, (%rcx,%rax,4)
jle 0x8aa70
xorl %edi, %edi
xorl %eax, %eax
jmp 0x8ab0f
movzbl (%r14), %edi
movl $0x1, %eax
testb %dil, %dil
jns 0x8ab0f
movzbl 0x1(%r14), %eax
cmpb $-0x41, %dil
ja 0x8aa9c
andl $0x3f, %edi
shll $0x8, %edi
orl %eax, %edi
movl $0x2, %eax
jmp 0x8ab0f
cmpb $-0x21, %dil
ja 0x8aabb
shll $0x8, %eax
movzbl 0x2(%r14), %ecx
andl $0x1f, %edi
shll $0x10, %edi
orl %eax, %edi
orl %ecx, %edi
movl $0x3, %eax
jmp 0x8ab0f
cmpb $-0x11, %dil
ja 0x8aae4
shll $0x10, %eax
movzbl 0x2(%r14), %ecx
shll $0x8, %ecx
movzbl 0x3(%r14), %edx
andl $0xf, %edi
shll $0x18, %edi
orl %eax, %edi
orl %ecx, %edi
orl %edx, %edi
movl $0x4, %eax
jmp 0x8ab0f
shll $0x1c, %edi
shll $0x14, %eax
orl %edi, %eax
movzbl 0x2(%r14), %ecx
shll $0xc, %ecx
orl %eax, %ecx
movzbl 0x3(%r14), %eax
shll $0x4, %eax
orl %ecx, %eax
movzbl 0x4(%r14), %edi
andl $0xf, %edi
orl %eax, %edi
movl $0x5, %eax
leaq (%r14,%rax), %r12
movq %r13, %rcx
subq %rax, %rcx
cmpq $0x4, %rcx
movl %ebp, 0x4(%rsp)
jg 0x8ab49
cmpq %rax, %r13
jle 0x8ab40
movzbl (%r12), %eax
shrl $0x4, %eax
leaq 0xdf79(%rip), %rdx      # 0x98ab0
movslq (%rdx,%rax,4), %rax
cmpq %rax, %rcx
jge 0x8ab49
xorl %edx, %edx
xorl %eax, %eax
jmp 0x8abec
movzbl (%r12), %edx
movl $0x1, %eax
testb %dl, %dl
jns 0x8abec
movzbl 0x1(%r12), %eax
cmpb $-0x41, %dl
ja 0x8ab75
andl $0x3f, %edx
shll $0x8, %edx
orl %eax, %edx
movl $0x2, %eax
jmp 0x8abec
cmpb $-0x21, %dl
ja 0x8ab94
shll $0x8, %eax
movzbl 0x2(%r12), %ecx
andl $0x1f, %edx
shll $0x10, %edx
orl %eax, %edx
orl %ecx, %edx
movl $0x3, %eax
jmp 0x8abec
cmpb $-0x11, %dl
ja 0x8abbe
shll $0x10, %eax
movzbl 0x2(%r12), %ecx
shll $0x8, %ecx
movzbl 0x3(%r12), %esi
andl $0xf, %edx
shll $0x18, %edx
orl %eax, %edx
orl %ecx, %edx
orl %esi, %edx
movl $0x4, %eax
jmp 0x8abec
shll $0x1c, %edx
shll $0x14, %eax
orl %edx, %eax
movzbl 0x2(%r12), %ecx
shll $0xc, %ecx
orl %eax, %ecx
movzbl 0x3(%r12), %eax
shll $0x4, %eax
orl %ecx, %eax
movzbl 0x4(%r12), %edx
andl $0xf, %edx
orl %eax, %edx
movl $0x5, %eax
testl %edx, %edx
js 0x8ae13
leaq (%r14,%r13), %r15
addq %rax, %r12
movq %r15, %rax
subq %r12, %rax
movl %edx, %ebp
cmpq %rbp, %rax
jl 0x8ae13
movq %r12, %rsi
movl $0x1, %ecx
movl (%rsp), %r8d
callq 0x8ae34
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x8ae18
addq %rbp, %r12
movq %r15, %rax
subq %r12, %rax
cmpq $0x4, %rax
jg 0x8ac5f
cmpq %r15, %r12
jae 0x8ac56
movzbl (%r12), %ecx
shrl $0x4, %ecx
leaq 0xde63(%rip), %rdx      # 0x98ab0
movslq (%rdx,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x8ac5f
xorl %edi, %edi
xorl %eax, %eax
jmp 0x8ad06
movzbl (%r12), %edi
movl $0x1, %eax
testb %dil, %dil
jns 0x8ad06
movzbl 0x1(%r12), %eax
cmpb $-0x41, %dil
ja 0x8ac8d
andl $0x3f, %edi
shll $0x8, %edi
orl %eax, %edi
movl $0x2, %eax
jmp 0x8ad06
cmpb $-0x21, %dil
ja 0x8acad
shll $0x8, %eax
movzbl 0x2(%r12), %ecx
andl $0x1f, %edi
shll $0x10, %edi
orl %eax, %edi
orl %ecx, %edi
movl $0x3, %eax
jmp 0x8ad06
cmpb $-0x11, %dil
ja 0x8acd8
shll $0x10, %eax
movzbl 0x2(%r12), %ecx
shll $0x8, %ecx
movzbl 0x3(%r12), %edx
andl $0xf, %edi
shll $0x18, %edi
orl %eax, %edi
orl %ecx, %edi
orl %edx, %edi
movl $0x4, %eax
jmp 0x8ad06
shll $0x1c, %edi
shll $0x14, %eax
orl %edi, %eax
movzbl 0x2(%r12), %ecx
shll $0xc, %ecx
orl %eax, %ecx
movzbl 0x3(%r12), %eax
shll $0x4, %eax
orl %ecx, %eax
movzbl 0x4(%r12), %edi
andl $0xf, %edi
orl %eax, %edi
movl $0x5, %eax
addq %rax, %r12
movq %r15, %rax
subq %r12, %rax
cmpq $0x4, %rax
jg 0x8ad3b
cmpq %r15, %r12
jae 0x8ad32
movzbl (%r12), %ecx
shrl $0x4, %ecx
leaq 0xdd87(%rip), %rdx      # 0x98ab0
movslq (%rdx,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x8ad3b
xorl %edx, %edx
xorl %eax, %eax
jmp 0x8adde
movzbl (%r12), %edx
movl $0x1, %eax
testb %dl, %dl
jns 0x8adde
movzbl 0x1(%r12), %eax
cmpb $-0x41, %dl
ja 0x8ad67
andl $0x3f, %edx
shll $0x8, %edx
orl %eax, %edx
movl $0x2, %eax
jmp 0x8adde
cmpb $-0x21, %dl
ja 0x8ad86
shll $0x8, %eax
movzbl 0x2(%r12), %ecx
andl $0x1f, %edx
shll $0x10, %edx
orl %eax, %edx
orl %ecx, %edx
movl $0x3, %eax
jmp 0x8adde
cmpb $-0x11, %dl
ja 0x8adb0
shll $0x10, %eax
movzbl 0x2(%r12), %ecx
shll $0x8, %ecx
movzbl 0x3(%r12), %esi
andl $0xf, %edx
shll $0x18, %edx
orl %eax, %edx
orl %ecx, %edx
orl %esi, %edx
movl $0x4, %eax
jmp 0x8adde
shll $0x1c, %edx
shll $0x14, %eax
orl %edx, %eax
movzbl 0x2(%r12), %ecx
shll $0xc, %ecx
orl %eax, %ecx
movzbl 0x3(%r12), %eax
shll $0x4, %eax
orl %ecx, %eax
movzbl 0x4(%r12), %edx
andl $0xf, %edx
orl %eax, %edx
movl $0x5, %eax
testl %edx, %edx
js 0x8ae13
addq %rax, %r12
subq %r12, %r15
movl %edx, %ebp
cmpq %rbp, %r15
jl 0x8ae13
movq %r12, %rsi
movl 0x4(%rsp), %ecx
movl (%rsp), %r8d
callq 0x8ae34
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x8ae18
addq %rbp, %r12
subq %r14, %r12
cmpq %r13, %r12
je 0x8ae22
callq 0x869f
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq