// File: /workspace/github_c_makefile_star2_O3/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 0x8a955
movq %rax, %rbx
movslq %r12d, %r15
movl $0x4, (%rax)
leaq -0xe4(%rip), %rax       # 0x8a479
movq %rax, 0x18(%rbx)
leaq -0x72(%rip), %rax       # 0x8a4f6
movq %rax, 0x10(%rbx)
cmpl $0x5, %r15d
jge 0x8a596
testl %r12d, %r12d
jle 0x8a58d
movzbl (%r14), %ecx
movl %ecx, %eax
shrl $0x4, %eax
leaq 0xe619(%rip), %rdx      # 0x98ba0
cmpl %r12d, (%rdx,%rax,4)
jle 0x8a599
xorl %edi, %edi
xorl %eax, %eax
jmp 0x8a634
movb (%r14), %cl
movzbl %cl, %edi
movl $0x1, %eax
testb %dil, %dil
jns 0x8a634
movzbl 0x1(%r14), %eax
cmpb $-0x41, %cl
ja 0x8a5c3
andl $0x3f, %edi
shll $0x8, %edi
orl %eax, %edi
movl $0x2, %eax
jmp 0x8a634
cmpb $-0x21, %cl
ja 0x8a5e1
shll $0x8, %eax
movzbl 0x2(%r14), %ecx
andl $0x1f, %edi
shll $0x10, %edi
orl %eax, %edi
orl %ecx, %edi
movl $0x3, %eax
jmp 0x8a634
cmpb $-0x11, %cl
ja 0x8a609
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 0x8a634
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 %r15, %rcx
subq %rax, %rcx
cmpq $0x5, %rcx
movl %ebp, 0x4(%rsp)
jge 0x8a66d
cmpq %rax, %r15
jle 0x8a667
movzbl (%r12), %edx
movl %edx, %eax
shrl $0x4, %eax
leaq 0xe542(%rip), %rsi      # 0x98ba0
movslq (%rsi,%rax,4), %rax
cmpq %rax, %rcx
jge 0x8a671
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x8a6e2
movb (%r12), %dl
movzbl %dl, %eax
movl $0x1, %ecx
testb %al, %al
jns 0x8a6e2
movzbl 0x1(%r12), %ecx
cmpb $-0x41, %dl
ja 0x8a697
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %ecx
jmp 0x8a6e2
cmpb $-0x21, %dl
ja 0x8a6b6
shll $0x8, %ecx
movzbl 0x2(%r12), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %ecx
jmp 0x8a6e2
movzbl 0x2(%r12), %esi
cmpb $-0x11, %dl
ja 0x8a7d1
shll $0x10, %ecx
shll $0x8, %esi
movzbl 0x3(%r12), %edx
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %esi, %eax
orl %edx, %eax
movl $0x4, %ecx
addq %rcx, %r12
leaq (%r14,%r15), %rbp
movq %rbp, %rcx
subq %r12, %rcx
movl %eax, %r13d
cmpq %r13, %rcx
jl 0x8a948
movq %r12, %rsi
movl %r13d, %edx
movl $0x1, %ecx
movl (%rsp), %r8d
callq 0x8a969
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x8a94d
addq %r13, %r12
movq %rbp, %rax
subq %r12, %rax
cmpq $0x5, %rax
jge 0x8a753
cmpq %rbp, %r12
jae 0x8a74a
movzbl (%r12), %ecx
movl %ecx, %edx
shrl $0x4, %edx
leaq 0xe45f(%rip), %rsi      # 0x98ba0
movslq (%rsi,%rdx,4), %rdx
cmpq %rdx, %rax
jge 0x8a757
xorl %edi, %edi
xorl %eax, %eax
jmp 0x8a833
movb (%r12), %cl
movzbl %cl, %edi
movl $0x1, %eax
testb %dil, %dil
jns 0x8a833
movzbl 0x1(%r12), %eax
cmpb $-0x41, %cl
ja 0x8a785
andl $0x3f, %edi
shll $0x8, %edi
orl %eax, %edi
movl $0x2, %eax
jmp 0x8a833
cmpb $-0x21, %cl
ja 0x8a7a7
shll $0x8, %eax
movzbl 0x2(%r12), %ecx
andl $0x1f, %edi
shll $0x10, %edi
orl %eax, %edi
orl %ecx, %edi
movl $0x3, %eax
jmp 0x8a833
cmpb $-0x11, %cl
ja 0x8a805
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 0x8a833
shll $0x1c, %eax
js 0x8a948
shll $0x14, %ecx
shll $0xc, %esi
orl %ecx, %esi
movzbl 0x3(%r12), %ecx
shll $0x4, %ecx
orl %esi, %ecx
movzbl 0x4(%r12), %edx
andl $0xf, %edx
orl %ecx, %edx
orl %eax, %edx
addq $0x5, %r12
movl %edx, %eax
jmp 0x8a6e5
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 %rbp, %rax
subq %r12, %rax
cmpq $0x5, %rax
jge 0x8a86a
cmpq %rbp, %r12
jae 0x8a861
movzbl (%r12), %edx
movl %edx, %ecx
shrl $0x4, %ecx
leaq 0xe348(%rip), %rsi      # 0x98ba0
movslq (%rsi,%rcx,4), %rcx
cmpq %rcx, %rax
jge 0x8a86e
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x8a90f
movb (%r12), %dl
movzbl %dl, %eax
movl $0x1, %ecx
testb %al, %al
jns 0x8a90f
movzbl 0x1(%r12), %ecx
cmpb $-0x41, %dl
ja 0x8a898
andl $0x3f, %eax
shll $0x8, %eax
orl %ecx, %eax
movl $0x2, %ecx
jmp 0x8a90f
cmpb $-0x21, %dl
ja 0x8a8b7
shll $0x8, %ecx
movzbl 0x2(%r12), %edx
andl $0x1f, %eax
shll $0x10, %eax
orl %ecx, %eax
orl %edx, %eax
movl $0x3, %ecx
jmp 0x8a90f
cmpb $-0x11, %dl
ja 0x8a8e1
shll $0x10, %ecx
movzbl 0x2(%r12), %edx
shll $0x8, %edx
movzbl 0x3(%r12), %esi
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %edx, %eax
orl %esi, %eax
movl $0x4, %ecx
jmp 0x8a90f
shll $0x1c, %eax
shll $0x14, %ecx
orl %eax, %ecx
movzbl 0x2(%r12), %eax
shll $0xc, %eax
orl %ecx, %eax
movzbl 0x3(%r12), %ecx
shll $0x4, %ecx
orl %eax, %ecx
movzbl 0x4(%r12), %eax
andl $0xf, %eax
orl %ecx, %eax
movl $0x5, %ecx
testl %eax, %eax
js 0x8a948
addq %rcx, %r12
subq %r12, %rbp
movl %eax, %r13d
cmpq %r13, %rbp
jl 0x8a948
movq %r12, %rsi
movl %r13d, %edx
movl 0x4(%rsp), %ecx
movl (%rsp), %r8d
callq 0x8a969
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x8a94d
addq %r13, %r12
subq %r14, %r12
cmpq %r15, %r12
je 0x8a957
callq 0x85c6
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