// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: bcf_subset_format
int bcf_subset_format(const bcf_hdr_t *hdr, bcf1_t *rec)
{
    if ( !hdr->keep_samples ) return 0;
    if ( !bcf_hdr_nsamples(hdr) )
    {
        rec->indiv.l = rec->n_sample = 0;
        return 0;
    }

    int i, j;
    uint8_t *ptr = (uint8_t*)rec->indiv.s, *dst = NULL, *src;
    bcf_dec_t *dec = &rec->d;
    hts_expand(bcf_fmt_t, rec->n_fmt, dec->m_fmt, dec->fmt);
    for (i=0; i<dec->m_fmt; ++i) dec->fmt[i].p_free = 0;

    for (i=0; i<rec->n_fmt; i++)
    {
        ptr = bcf_unpack_fmt_core1(ptr, rec->n_sample, &dec->fmt[i]);
        src = dec->fmt[i].p - dec->fmt[i].size;
        if ( dst )
        {
            memmove(dec->fmt[i-1].p + dec->fmt[i-1].p_len, dec->fmt[i].p - dec->fmt[i].p_off, dec->fmt[i].p_off);
            dec->fmt[i].p = dec->fmt[i-1].p + dec->fmt[i-1].p_len + dec->fmt[i].p_off;
        }
        dst = dec->fmt[i].p;
        for (j=0; j<hdr->nsamples_ori; j++)
        {
            src += dec->fmt[i].size;
            if ( !bit_array_test(hdr->keep_samples,j) ) continue;
            memmove(dst, src, dec->fmt[i].size);
            dst += dec->fmt[i].size;
        }
        rec->indiv.l -= dec->fmt[i].p_len - (dst - dec->fmt[i].p);
        dec->fmt[i].p_len = dst - dec->fmt[i].p;
    }
    rec->unpacked |= BCF_UN_FMT;

    rec->n_sample = bcf_hdr_nsamples(hdr);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jne 0x40ff7
movl $0x0, -0x4(%rbp)
jmp 0x41491
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x41033
movq -0x18(%rbp), %rax
movabsq $0xffffffffff, %rcx     # imm = 0xFFFFFFFFFF
andq 0x18(%rax), %rcx
orq $0x0, %rcx
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x38(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x41491
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x18(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jle 0x410df
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
cmpl $0x1, %eax
jl 0x4109b
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movl %eax, -0x44(%rbp)
jmp 0x410a5
movl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x410a5
movl -0x44(%rbp), %eax
movslq %eax, %rdi
movq -0x40(%rbp), %rax
movslq (%rax), %rsi
movq -0x40(%rbp), %r9
addq $0x48, %r9
movl $0x4, %edx
movl $0x20, %ecx
xorl %r8d, %r8d
leaq 0xc6a74(%rip), %rax     # 0x107b42
movq %rax, (%rsp)
callq 0x15780
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, (%rax)
jmp 0x410e1
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x41120
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x1c(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x410e8
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x41445
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x28, %rax
movl %eax, %esi
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rdx
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdx
callq 0x414a0
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x48(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movslq 0x8(%rcx), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x412c4
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
addq %rax, %rdi
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movslq %eax, %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
callq 0x4830
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x1c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl 0x18(%rax), %eax
addq %rax, %rcx
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl 0x1c(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cltq
addq %rax, %rcx
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x70(%rcx), %eax
jge 0x413b9
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x50(%rbp)
movl -0x20(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x48(%rbp)
movl -0x20(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl -0x48(%rbp), %eax
movl %edx, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
jne 0x41363
jmp 0x413ab
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rdx
callq 0x4830
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x30(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x412e6
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movl %eax, %edx
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
movq 0x48(%rcx), %rcx
movslq -0x1c(%rbp), %rsi
shlq $0x5, %rsi
addq %rsi, %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
subq %rax, %rdx
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x38(%rax)
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
movq 0x48(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movq 0x10(%rcx), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x1c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x41127
movq -0x18(%rbp), %rax
movl 0xbc(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xbc(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0xffffff, %rdx         # imm = 0xFFFFFF
shlq $0x28, %rdx
movabsq $0xffffffffff, %rsi     # imm = 0xFFFFFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)