// File: /workspace/github_c_makefile_star2_O1/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 0x3a19e
movq %r8, %r12
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %r15
leaq 0xc(%rsp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x95214
movl (%rbx), %ebx
testl %ebx, %ebx
cmovsl %eax, %ebx
testl %eax, %eax
cmovnsl %eax, %ebx
movq %r15, %rdi
movl %ebx, %esi
callq 0x3a1ad
testl %eax, %eax
je 0x3a0c2
movq 0x18(%r14), %rax
testq %rax, %rax
sete %cl
cmpl $0x100, %ebx            # imm = 0x100
setae %dl
orb %cl, %dl
jne 0x3a034
movl %ebx, %ecx
movq (%rax,%rcx,8), %rax
jmp 0x3a0a7
testq %rax, %rax
je 0x3a067
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), %rax
testq %rax, %rax
je 0x3a067
cmpl %ebx, 0xc(%rax)
je 0x3a0a7
movq (%r14), %rax
movslq 0x28(%rax), %rcx
testq %rcx, %rcx
jle 0x3a0a5
movq 0x10(%r14), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
testq %rdi, %rdi
je 0x3a095
cmpl $0x4, 0x8(%rdi)
jne 0x3a095
cmpl %ebx, 0xc(%rdi)
jne 0x3a095
xorl %r8d, %r8d
movq %rdi, %rax
jmp 0x3a098
movb $0x1, %r8b
testb %r8b, %r8b
je 0x3a0a7
incq %rsi
cmpq %rsi, %rcx
jne 0x3a079
xorl %eax, %eax
testq %rax, %rax
je 0x3a0b2
movl 0x14(%rax), %eax
movl %eax, (%rbp)
testq %r12, %r12
je 0x3a0c2
cmpl $0x1, (%r13)
jne 0x3a0c2
movl %ebx, (%r12)
movq 0x2d8(%r15), %rdi
testq %rdi, %rdi
je 0x3a19e
leaq 0xc(%rsp), %rbx
movq %rbx, %rsi
callq 0x95214
movl (%rbx), %ebx
testl %ebx, %ebx
cmovsl %eax, %ebx
testl %eax, %eax
cmovnsl %eax, %ebx
movq %r15, %rdi
movl %ebx, %esi
callq 0x3a1ad
testl %eax, %eax
je 0x3a19e
movq 0x18(%r14), %rax
testq %rax, %rax
sete %cl
cmpl $0x100, %ebx            # imm = 0x100
setae %dl
orb %cl, %dl
jne 0x3a11c
movl %ebx, %ecx
movq (%rax,%rcx,8), %rax
jmp 0x3a18f
testq %rax, %rax
je 0x3a14f
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), %rax
testq %rax, %rax
je 0x3a14f
cmpl %ebx, 0xc(%rax)
je 0x3a18f
movq (%r14), %rax
movslq 0x28(%rax), %rcx
testq %rcx, %rcx
jle 0x3a18d
movq 0x10(%r14), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rdi
testq %rdi, %rdi
je 0x3a17d
cmpl $0x4, 0x8(%rdi)
jne 0x3a17d
cmpl %ebx, 0xc(%rdi)
jne 0x3a17d
xorl %r8d, %r8d
movq %rdi, %rax
jmp 0x3a180
movb $0x1, %r8b
testb %r8b, %r8b
je 0x3a18f
incq %rsi
cmpq %rsi, %rcx
jne 0x3a161
xorl %eax, %eax
testq %rax, %rax
je 0x3a19e
movl 0x14(%rax), %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq