// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/vcf.c
// Function: bcf_unpack
int bcf_unpack(bcf1_t *b, int which)
{
    if ( !b->shared.l ) return 0; // Building a new BCF record from scratch
    uint8_t *ptr = (uint8_t*)b->shared.s, *ptr_ori;
    int i;
    bcf_dec_t *d = &b->d;
    if (which & BCF_UN_FLT) which |= BCF_UN_STR;
    if (which & BCF_UN_INFO) which |= BCF_UN_SHR;
    if ((which&BCF_UN_STR) && !(b->unpacked&BCF_UN_STR))
    {
        kstring_t tmp;

        // ID
        tmp.l = 0; tmp.s = d->id; tmp.m = d->m_id;
        ptr_ori = ptr;
        ptr = bcf_fmt_sized_array(&tmp, ptr);
        b->unpack_size[0] = ptr - ptr_ori;
        kputc_('\0', &tmp);
        d->id = tmp.s; d->m_id = tmp.m;

        // REF and ALT are in a single block (d->als) and d->alleles are pointers into this block
        hts_expand(char*, b->n_allele, d->m_allele, d->allele); // NM: hts_expand() is a macro
        tmp.l = 0; tmp.s = d->als; tmp.m = d->m_als;
        ptr_ori = ptr;
        for (i = 0; i < b->n_allele; ++i) {
            // Use offset within tmp.s as realloc may change pointer
            d->allele[i] = (char *)(intptr_t)tmp.l;
            ptr = bcf_fmt_sized_array(&tmp, ptr);
            kputc_('\0', &tmp);
        }
        b->unpack_size[1] = ptr - ptr_ori;
        d->als = tmp.s; d->m_als = tmp.m;

        // Convert our offsets within tmp.s back to pointers again
        for (i = 0; i < b->n_allele; ++i)
            d->allele[i] = d->als + (ptrdiff_t)d->allele[i];
        b->unpacked |= BCF_UN_STR;
    }
    if ((which&BCF_UN_FLT) && !(b->unpacked&BCF_UN_FLT)) { // FILTER
        ptr = (uint8_t*)b->shared.s + b->unpack_size[0] + b->unpack_size[1];
        ptr_ori = ptr;
        if (*ptr>>4) {
            int type;
            d->n_flt = bcf_dec_size(ptr, &ptr, &type);
            hts_expand(int, d->n_flt, d->m_flt, d->flt);
            for (i = 0; i < d->n_flt; ++i)
                d->flt[i] = bcf_dec_int1(ptr, type, &ptr);
        } else ++ptr, d->n_flt = 0;
        b->unpack_size[2] = ptr - ptr_ori;
        b->unpacked |= BCF_UN_FLT;
    }
    if ((which&BCF_UN_INFO) && !(b->unpacked&BCF_UN_INFO)) { // INFO
        ptr = (uint8_t*)b->shared.s + b->unpack_size[0] + b->unpack_size[1] + b->unpack_size[2];
        hts_expand(bcf_info_t, b->n_info, d->m_info, d->info);
        for (i = 0; i < d->m_info; ++i) d->info[i].vptr_free = 0;
        for (i = 0; i < b->n_info; ++i)
            ptr = bcf_unpack_info_core1(ptr, &d->info[i]);
        b->unpacked |= BCF_UN_INFO;
    }
    if ((which&BCF_UN_FMT) && b->n_sample && !(b->unpacked&BCF_UN_FMT)) { // FORMAT
        ptr = (uint8_t*)b->indiv.s;
        hts_expand(bcf_fmt_t, b->n_fmt, d->m_fmt, d->fmt);
        for (i = 0; i < d->m_fmt; ++i) d->fmt[i].p_free = 0;
        for (i = 0; i < b->n_fmt; ++i)
            ptr = bcf_unpack_fmt_core1(ptr, b->n_sample, &d->fmt[i]);
        b->unpacked |= BCF_UN_FMT;
    }
    return 0;
}

// Assembly:
cmpq $0x0, 0x20(%rdi)
je 0x38814
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, %eax
shrl %eax
andl $0x1, %eax
testb $0x4, %bpl
movl $0x7, %r14d
cmovel %eax, %r14d
orl %esi, %r14d
testb $0x1, %r14b
je 0x38403
testb $0x1, 0xbc(%rbx)
jne 0x38403
movl %r14d, 0x28(%rsp)
movq 0x30(%rbx), %r15
movabsq $0x3fffffffffffffff, %r14 # imm = 0x3FFFFFFFFFFFFFFF
leaq 0x10(%rsp), %r12
movq $0x0, (%r12)
movq 0x78(%rbx), %rax
movq %rax, 0x10(%r12)
movslq 0x58(%rbx), %rax
movq %rax, 0x8(%r12)
movq %r12, %rdi
movq %r15, %rsi
callq 0x3353c
movq %rax, %r13
subl %r15d, %eax
movl %eax, 0xc0(%rbx)
movq (%r12), %rdx
leaq 0x1(%rdx), %rcx
cmpq %rcx, 0x8(%r12)
jae 0x38262
movq %rcx, %rax
shrq %rax
xorl %r15d, %r15d
cmpq %r14, %rcx
cmovbeq %rax, %r15
addq %rcx, %r15
movq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x4860
testq %rax, %rax
je 0x38270
movq %rax, 0x20(%rsp)
movq %r15, 0x18(%rsp)
movq 0x10(%rsp), %rdx
leaq 0x1(%rdx), %rcx
jmp 0x38267
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rsp)
movb $0x0, (%rax,%rdx)
movl %ebp, 0x2c(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x78(%rbx)
movl 0x18(%rsp), %eax
movl %eax, 0x58(%rbx)
movq 0x18(%rbx), %rax
movl %eax, %edi
shrl $0x10, %edi
movslq 0x60(%rbx), %rsi
cmpl %esi, %edi
jle 0x382cd
cmpl $0x10000, %eax          # imm = 0x10000
movl $0x1, %eax
cmovbl %eax, %edi
leaq 0x88(%rbx), %r9
leaq 0x73a9e(%rip), %rax     # 0xabd4e
movq %rax, (%rsp)
movl $0x4, %edx
movl $0x8, %ecx
xorl %r8d, %r8d
callq 0x114b1
movl %eax, 0x60(%rbx)
movq 0x18(%rbx), %rax
movq $0x0, 0x10(%rsp)
movq 0x80(%rbx), %rcx
movq %rcx, 0x20(%rsp)
movslq 0x5c(%rbx), %rdx
movq %rdx, 0x18(%rsp)
shrq $0x10, %rax
testw %ax, %ax
je 0x383df
xorl %ebp, %ebp
leaq 0x10(%rsp), %r12
movq %r13, 0x30(%rsp)
movq %r13, %r15
movq 0x10(%rsp), %rax
movq 0x88(%rbx), %rcx
movq %rax, (%rcx,%rbp,8)
movq %r12, %rdi
movq %r15, %rsi
callq 0x3353c
movq %rax, %r15
movq 0x10(%rsp), %rdx
leaq 0x1(%rdx), %rcx
cmpq %rcx, 0x18(%rsp)
jae 0x38372
movq %rcx, %rax
shrq %rax
cmpq %r14, %rcx
movl $0x0, %r13d
cmovbeq %rax, %r13
addq %rcx, %r13
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x4860
testq %rax, %rax
je 0x38380
movq %rax, 0x20(%rsp)
movq %r13, 0x18(%rsp)
movq 0x10(%rsp), %rdx
leaq 0x1(%rdx), %rcx
jmp 0x38377
movq 0x20(%rsp), %rax
movq %rcx, 0x10(%rsp)
movb $0x0, (%rax,%rdx)
incq %rbp
movq 0x18(%rbx), %rax
movl %eax, %ecx
shrl $0x10, %ecx
cmpq %rcx, %rbp
jb 0x38307
movq 0x20(%rsp), %rcx
movl 0x18(%rsp), %edx
shrq $0x10, %rax
subl 0x30(%rsp), %r15d
movl %r15d, 0xc4(%rbx)
movq %rcx, 0x80(%rbx)
movl %edx, 0x5c(%rbx)
testw %ax, %ax
je 0x383f3
xorl %eax, %eax
movq 0x80(%rbx), %rcx
movq 0x88(%rbx), %rdx
addq %rcx, (%rdx,%rax,8)
incq %rax
movzwl 0x1a(%rbx), %ecx
cmpq %rcx, %rax
jb 0x383bf
jmp 0x383f3
movl $0x0, 0xc4(%rbx)
movq %rcx, 0x80(%rbx)
movl %edx, 0x5c(%rbx)
orb $0x1, 0xbc(%rbx)
movl 0x2c(%rsp), %ebp
movl 0x28(%rsp), %r14d
testb $0x2, %r14b
je 0x3853a
testb $0x2, 0xbc(%rbx)
jne 0x3853a
movslq 0xc0(%rbx), %rax
addq 0x30(%rbx), %rax
movslq 0xc4(%rbx), %rcx
leaq (%rax,%rcx), %r15
movzbl (%rcx,%rax), %r13d
cmpl $0x10, %r13d
jae 0x3844b
leaq 0x1(%r15), %r12
movl $0x0, 0x68(%rbx)
jmp 0x38529
cmpb $-0x11, %r13b
jbe 0x3847f
movzbl 0x1(%r15), %eax
andl $0xf, %eax
decl %eax
cmpl $0x3, %eax
ja 0x3883f
leaq 0x72979(%rip), %rcx     # 0xaade4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3(%r15), %r12
movsbq 0x2(%r15), %rax
jmp 0x38489
leaq 0x1(%r15), %r12
movl %r13d, %eax
shrl $0x4, %eax
movl %eax, 0x68(%rbx)
movslq 0x64(%rbx), %rsi
cmpl %esi, %eax
jle 0x384c6
cmpl $0x2, %eax
movl $0x1, %edi
cmovgel %eax, %edi
leaq 0x70(%rbx), %r9
leaq 0x738a4(%rip), %rax     # 0xabd4e
movq %rax, (%rsp)
movl $0x4, %edx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0x114b1
movl %eax, 0x64(%rbx)
movl 0x68(%rbx), %eax
testl %eax, %eax
jle 0x38529
andb $0xf, %r13b
movq 0x70(%rbx), %rax
xorl %ecx, %ecx
movzbl %r13b, %edx
decl %edx
leaq 0x72913(%rip), %rsi     # 0xaadf4
cmpl $0x3, %edx
ja 0x38518
movslq (%rsi,%rdx,4), %rdi
addq %rsi, %rdi
jmpq *%rdi
movsbq (%r12), %rdi
incq %r12
jmp 0x3851a
movl (%r12), %edi
addq $0x4, %r12
jmp 0x3851a
movq (%r12), %rdi
addq $0x8, %r12
jmp 0x3851a
movswq (%r12), %rdi
addq $0x2, %r12
jmp 0x3851a
xorl %edi, %edi
movl %edi, (%rax,%rcx,4)
incq %rcx
movslq 0x68(%rbx), %rdi
cmpq %rdi, %rcx
jl 0x384e1
subl %r15d, %r12d
movl %r12d, 0xc8(%rbx)
orb $0x2, 0xbc(%rbx)
testb $0x4, %r14b
je 0x38618
testb $0x4, 0xbc(%rbx)
jne 0x38618
movslq 0xc0(%rbx), %r14
addq 0x30(%rbx), %r14
movslq 0xc4(%rbx), %r15
movslq 0xc8(%rbx), %r12
movq 0x18(%rbx), %rcx
movzwl %cx, %edx
movl 0x54(%rbx), %eax
cmpl %eax, %edx
jle 0x385b0
movslq %eax, %rsi
testl %edx, %edx
movzwl %cx, %eax
movl $0x1, %edi
cmovneq %rax, %rdi
leaq 0x90(%rbx), %r9
leaq 0x737b7(%rip), %rax     # 0xabd4e
movq %rax, (%rsp)
movl $0x4, %edx
movl $0x28, %ecx
xorl %r8d, %r8d
callq 0x114b1
movl %eax, 0x54(%rbx)
testl %eax, %eax
jle 0x385d9
movl $0x1c, %eax
xorl %ecx, %ecx
movq 0x90(%rbx), %rdx
andl $0x7fffffff, (%rdx,%rax) # imm = 0x7FFFFFFF
incq %rcx
movslq 0x54(%rbx), %rdx
addq $0x28, %rax
cmpq %rdx, %rcx
jl 0x385bb
cmpw $0x0, 0x18(%rbx)
je 0x38611
addq %r12, %r15
addq %r15, %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x90(%rbx), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0x38849
movq %rax, %r14
incq %r12
movzwl 0x18(%rbx), %eax
addq $0x28, %r15
cmpq %rax, %r12
jb 0x385ec
orb $0x4, 0xbc(%rbx)
testb $0x8, %bpl
je 0x38806
movq 0x18(%rbx), %rcx
movq %rcx, %rax
shrq $0x28, %rax
je 0x38806
testb $0x8, 0xbc(%rbx)
jne 0x38806
movq 0x48(%rbx), %r14
shrq $0x20, %rcx
movzbl %cl, %edx
movl 0x50(%rbx), %eax
cmpl %eax, %edx
jle 0x3868a
movslq %eax, %rsi
testl %edx, %edx
movzbl %cl, %eax
movl $0x1, %edi
cmovneq %rax, %rdi
leaq 0x98(%rbx), %r9
leaq 0x736dd(%rip), %rax     # 0xabd4e
movq %rax, (%rsp)
movl $0x4, %edx
movl $0x20, %ecx
xorl %r8d, %r8d
callq 0x114b1
movl %eax, 0x50(%rbx)
testl %eax, %eax
jle 0x386b3
movl $0x1c, %eax
xorl %ecx, %ecx
movq 0x98(%rbx), %rdx
andl $0x7fffffff, (%rdx,%rax) # imm = 0x7FFFFFFF
incq %rcx
movslq 0x50(%rbx), %rdx
addq $0x20, %rax
cmpq %rdx, %rcx
jl 0x38695
movq 0x18(%rbx), %rdx
movq %rdx, %rax
shrq $0x20, %rax
testb %al, %al
je 0x387ff
movl $0x1c, %eax
xorl %esi, %esi
leaq 0x72740(%rip), %rdi     # 0xaae14
leaq 0x94e45(%rip), %r8      # 0xcd520
leaq 0x72722(%rip), %r9      # 0xaae04
movzbl (%r14), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x38723
movslq (%r9,%rcx,4), %rcx
addq %r9, %rcx
jmpq *%rcx
leaq 0x2(%r14), %r10
movsbq 0x1(%r14), %rcx
jmp 0x38728
leaq 0x5(%r14), %r10
movl 0x1(%r14), %ecx
jmp 0x38728
leaq 0x9(%r14), %r10
movq 0x1(%r14), %rcx
jmp 0x38728
leaq 0x3(%r14), %r10
movswq 0x1(%r14), %rcx
jmp 0x38728
movq %r14, %r10
xorl %ecx, %ecx
movq 0x98(%rbx), %r11
movl %ecx, -0x1c(%r11,%rax)
movzbl (%r10), %ecx
andl $0xf, %ecx
movl %ecx, -0x10(%r11,%rax)
movzbl (%r10), %r15d
cmpl $0xef, %r15d
jbe 0x38778
movzbl 0x1(%r10), %r15d
andl $0xf, %r15d
decl %r15d
cmpl $0x3, %r15d
ja 0x387fa
movslq (%rdi,%r15,4), %r15
addq %rdi, %r15
jmpq *%r15
movsbq 0x2(%r10), %r15
addq $0x3, %r10
jmp 0x3877f
incq %r10
shrl $0x4, %r15d
movl %r15d, -0x18(%r11,%rax)
movb (%rcx,%r8), %cl
shll %cl, %r15d
shrq $0x28, %rdx
movl %r15d, -0x14(%r11,%rax)
movq %r10, -0xc(%r11,%rax)
movl %r10d, %ecx
subl %r14d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, (%r11,%rax)
imull %edx, %r15d
movslq %r15d, %rcx
addq %rcx, %r10
movl %ecx, -0x4(%r11,%rax)
incq %rsi
movq 0x18(%rbx), %rdx
movq %rdx, %rcx
shrq $0x20, %rcx
movzbl %cl, %ecx
addq $0x20, %rax
movq %r10, %r14
cmpq %rcx, %rsi
jb 0x386e2
jmp 0x387ff
movl 0x2(%r10), %r15d
addq $0x6, %r10
jmp 0x3877f
movq 0x2(%r10), %r15
addq $0xa, %r10
jmp 0x3877f
movswq 0x2(%r10), %r15
addq $0x4, %r10
jmp 0x3877f
xorl %r15d, %r15d
jmp 0x3877f
orb $0x8, 0xbc(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
xorl %eax, %eax
retq
leaq 0x6(%r15), %r12
movl 0x2(%r15), %eax
jmp 0x38489
leaq 0xa(%r15), %r12
movq 0x2(%r15), %rax
jmp 0x38489
leaq 0x4(%r15), %r12
movswq 0x2(%r15), %rax
jmp 0x38489
xorl %eax, %eax
movq %r15, %r12
jmp 0x38489