// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_decode.c
// Function: cram_decode_estimate_sizes
void cram_decode_estimate_sizes(cram_block_compression_hdr *hdr, cram_slice *s,
                                int *qual_size, int *name_size,
                                int *q_id) {
    int bnum1, bnum2;
    cram_codec *cd;

    *qual_size = 0;
    *name_size = 0;

    /* Qual */
    cd = hdr->codecs[DS_QS];
    if (cd == NULL) return;
    bnum1 = cram_codec_to_id(cd, &bnum2);
    if (bnum1 < 0 && bnum2 >= 0) bnum1 = bnum2;
    if (cram_ds_unique(hdr, cd, bnum1)) {
        cram_block *b = cram_get_block_by_id(s, bnum1);
        if (b) *qual_size = b->uncomp_size;
        if (q_id && cd->codec == E_EXTERNAL)
            *q_id = bnum1;
    }

    /* Name */
    cd = hdr->codecs[DS_RN];
    if (cd == NULL) return;
    bnum1 = cram_codec_to_id(cd, &bnum2);
    if (bnum1 < 0 && bnum2 >= 0) bnum1 = bnum2;
    if (cram_ds_unique(hdr, cd, bnum1)) {
        cram_block *b = cram_get_block_by_id(s, bnum1);
        if (b) *name_size = b->uncomp_size;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %eax, %eax
movl %eax, (%rdx)
movq %rcx, 0x10(%rsp)
movl %eax, (%rcx)
movq 0x2e0(%rdi), %r13
testq %r13, %r13
je 0x38c00
movq %r8, %r12
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %r15
leaq 0xc(%rsp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x928be
movl (%rbx), %ebx
testl %ebx, %ebx
cmovsl %eax, %ebx
testl %eax, %eax
cmovnsl %eax, %ebx
movq %r15, %rdi
movl %ebx, %esi
callq 0x38c0f
testl %eax, %eax
je 0x38b34
movq 0x18(%r14), %rax
testq %rax, %rax
setne %cl
cmpl $0x100, %ebx            # imm = 0x100
setb %dl
testb %cl, %dl
je 0x38abb
movl %ebx, %ecx
movq (%rax,%rcx,8), %rcx
testq %rcx, %rcx
jne 0x38aee
jmp 0x38b24
testq %rax, %rax
je 0x38af6
movl %ebx, %ecx
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rcx, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %ecx
movl %ebx, %edx
subl %ecx, %edx
shll $0x3, %edx
movq 0x800(%rax,%rdx), %rcx
testq %rcx, %rcx
je 0x38af6
cmpl %ebx, 0xc(%rcx)
jne 0x38af6
movl 0x14(%rcx), %eax
movl %eax, (%rbp)
jmp 0x38b24
movq (%r14), %rax
movslq 0x28(%rax), %rax
testq %rax, %rax
jle 0x38b24
movq 0x10(%r14), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rcx
testq %rcx, %rcx
je 0x38b1c
cmpl $0x4, 0x8(%rcx)
jne 0x38b1c
cmpl %ebx, 0xc(%rcx)
je 0x38aee
incq %rsi
cmpq %rsi, %rax
jne 0x38b08
testq %r12, %r12
je 0x38b34
cmpl $0x1, (%r13)
jne 0x38b34
movl %ebx, (%r12)
movq 0x2d8(%r15), %rdi
testq %rdi, %rdi
je 0x38c00
leaq 0xc(%rsp), %rbx
movq %rbx, %rsi
callq 0x928be
movl (%rbx), %ebx
testl %ebx, %ebx
cmovsl %eax, %ebx
testl %eax, %eax
cmovnsl %eax, %ebx
movq %r15, %rdi
movl %ebx, %esi
callq 0x38c0f
testl %eax, %eax
je 0x38c00
movq 0x18(%r14), %rax
testq %rax, %rax
setne %cl
cmpl $0x100, %ebx            # imm = 0x100
setb %dl
testb %cl, %dl
je 0x38b93
movl %ebx, %ecx
movq (%rax,%rcx,8), %rcx
testq %rcx, %rcx
jne 0x38bc6
jmp 0x38c00
testq %rax, %rax
je 0x38bd2
movl %ebx, %ecx
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rcx, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %ecx
movl %ebx, %edx
subl %ecx, %edx
shll $0x3, %edx
movq 0x800(%rax,%rdx), %rcx
testq %rcx, %rcx
je 0x38bd2
cmpl %ebx, 0xc(%rcx)
jne 0x38bd2
movl 0x14(%rcx), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
jmp 0x38c00
movq (%r14), %rax
movslq 0x28(%rax), %rax
testq %rax, %rax
jle 0x38c00
movq 0x10(%r14), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rcx
testq %rcx, %rcx
je 0x38bf8
cmpl $0x4, 0x8(%rcx)
jne 0x38bf8
cmpl %ebx, 0xc(%rcx)
je 0x38bc6
incq %rsi
cmpq %rsi, %rax
jne 0x38be4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq