// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_byte_array_len_decode_init
cram_codec *cram_byte_array_len_decode_init(cram_block_compression_hdr *hdr,
                                            char *data, int size,
                                            enum cram_encoding codec,
                                            enum cram_external_type option,
                                            int version, varint_vec *vv) {
    cram_codec *c;
    char *cp   = data;
    char *endp = data + size;

    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;
    c->describe = cram_byte_array_len_describe;
    c->u.byte_array_len.len_codec = NULL;
    c->u.byte_array_len.val_codec = NULL;

    int encoding = vv->varint_get32(&cp, endp, NULL);
    int sub_size = vv->varint_get32(&cp, endp, NULL);
    if (sub_size < 0 || endp - cp < sub_size)
        goto malformed;
    c->u.byte_array_len.len_codec = cram_decoder_init(hdr, encoding, cp, sub_size,
                                                      E_INT, version, vv);
    if (c->u.byte_array_len.len_codec == NULL)
        goto no_codec;
    cp += sub_size;

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

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

    return c;

 malformed:
    hts_log_error("Malformed byte_array_len header stream");
 no_codec:
    cram_byte_array_len_decode_free(c);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x880, %edi            # imm = 0x880
callq 0x4650
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xeb11a
movq $0x0, -0x8(%rbp)
jmp 0xeb2f0
movq -0x30(%rbp), %rax
movl $0x4, (%rax)
movq -0x30(%rbp), %rax
leaq -0x2df(%rip), %rcx      # 0xeae50
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
leaq -0x22e(%rip), %rcx      # 0xeaf10
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
leaq -0x1cd(%rip), %rcx      # 0xeaf80
movq %rcx, 0x58(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x68(%rax)
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movl %eax, -0x44(%rbp)
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jl 0xeb1b5
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movslq -0x48(%rbp), %rcx
cmpq %rcx, %rax
jge 0xeb1ba
jmp 0xeb2c5
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movq -0x38(%rbp), %rdx
movl -0x48(%rbp), %ecx
movl -0x28(%rbp), %r9d
movq 0x10(%rbp), %rax
movl $0x1, %r8d
movq %rax, (%rsp)
callq 0xe5250
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0xeb1fa
jmp 0xeb2df
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movl %eax, -0x44(%rbp)
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
leaq -0x38(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq *%rax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jl 0xeb257
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movslq -0x48(%rbp), %rcx
cmpq %rcx, %rax
jge 0xeb259
jmp 0xeb2c5
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movq -0x38(%rbp), %rdx
movl -0x48(%rbp), %ecx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movq 0x10(%rbp), %rax
movq %rax, (%rsp)
callq 0xe5250
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0xeb294
jmp 0xeb2df
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
je 0xeb2bb
jmp 0xeb2c5
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xeb2f0
movl $0x1, %edi
leaq 0xe02e(%rip), %rsi      # 0xf92ff
leaq 0xe047(%rip), %rdx      # 0xf931f
movb $0x0, %al
callq 0x1b030
movq -0x30(%rbp), %rdi
callq 0xeaf10
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)