// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcfutils.c
// Function: bcf_trim_alleles
int bcf_trim_alleles(const bcf_hdr_t *header, bcf1_t *line)
{
    int i, ret = 0, nrm = 0;
    kbitset_t *rm_set = NULL;
    bcf_fmt_t *gt = bcf_get_fmt(header, line, "GT");
    if ( !gt ) return 0;

    int *ac = (int*) calloc(line->n_allele,sizeof(int));

    // check if all alleles are populated
    #define BRANCH(type_t, convert, vector_end) { \
        for (i=0; i<line->n_sample; i++) \
        { \
            uint8_t *p = gt->p + i*gt->size; \
            int ial; \
            for (ial=0; ial<gt->n; ial++) \
            { \
                int32_t val = convert(&p[ial * sizeof(type_t)]); \
                if ( val==vector_end ) break; /* smaller ploidy */ \
                if ( bcf_gt_is_missing(val) ) continue; /* missing allele */ \
                if ( (val>>1)-1 >= line->n_allele ) { \
                    hts_log_error("Allele index is out of bounds at %s:%"PRIhts_pos, header->id[BCF_DT_CTG][line->rid].key, line->pos+1); \
                    ret = -1; \
                    goto clean; \
                } \
                ac[(val>>1)-1]++; \
            }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0xa2821(%rip), %rdx     # 0x13b109
callq 0x14b40
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x98904
movl $0x0, -0x4(%rbp)
jmp 0x98e0f
movq -0x18(%rbp), %rax
movzwl 0x1a(%rax), %eax
movl %eax, %edi
movl $0x4, %esi
callq 0x16060
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x74(%rbp)
subl $0x1, %eax
je 0x9894c
jmp 0x9892d
movl -0x74(%rbp), %eax
subl $0x2, %eax
je 0x98a87
jmp 0x9893b
movl -0x74(%rbp), %eax
subl $0x3, %eax
je 0x98bc2
jmp 0x98cfa
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x28, %rcx
cmpl %ecx, %eax
jge 0x98a82
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %rdx
imull 0x8(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x98a72
movq -0x48(%rbp), %rdi
movslq -0x4c(%rbp), %rax
shlq $0x0, %rax
addq %rax, %rdi
callq 0x98390
movsbl %al, %eax
movl %eax, -0x50(%rbp)
cmpl $-0x7f, -0x50(%rbp)
jne 0x989c3
jmp 0x98a72
movl -0x50(%rbp), %eax
sarl %eax
cmpl $0x0, %eax
je 0x989d5
xorl %eax, %eax
testb $0x1, %al
jne 0x989dd
jmp 0x989e2
movb $0x1, %al
testb $0x1, %al
jne 0x989dd
jmp 0x989e2
jmp 0x98a64
movl -0x50(%rbp), %eax
sarl %eax
subl $0x1, %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x10, %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jl 0x98a4c
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x10(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xa0839(%rip), %rsi     # 0x13926b
leaq 0xa0843(%rip), %rdx     # 0x13927c
movb $0x0, %al
callq 0x15920
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x98ddc
movq -0x40(%rbp), %rax
movl -0x50(%rbp), %ecx
sarl %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x9898e
jmp 0x98a74
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x98953
jmp 0x98d45
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x28, %rcx
cmpl %ecx, %eax
jge 0x98bbd
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %rdx
imull 0x8(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x98bad
movq -0x58(%rbp), %rdi
movslq -0x5c(%rbp), %rax
shlq %rax
addq %rax, %rdi
callq 0x983e0
cwtl
movl %eax, -0x60(%rbp)
cmpl $0xffff8001, -0x60(%rbp) # imm = 0xFFFF8001
jne 0x98afe
jmp 0x98bad
movl -0x60(%rbp), %eax
sarl %eax
cmpl $0x0, %eax
je 0x98b10
xorl %eax, %eax
testb $0x1, %al
jne 0x98b18
jmp 0x98b1d
movb $0x1, %al
testb $0x1, %al
jne 0x98b18
jmp 0x98b1d
jmp 0x98b9f
movl -0x60(%rbp), %eax
sarl %eax
subl $0x1, %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x10, %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jl 0x98b87
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x10(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xa06fe(%rip), %rsi     # 0x13926b
leaq 0xa0708(%rip), %rdx     # 0x13927c
movb $0x0, %al
callq 0x15920
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x98ddc
movq -0x40(%rbp), %rax
movl -0x60(%rbp), %ecx
sarl %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x98ac9
jmp 0x98baf
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x98a8e
jmp 0x98d45
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x28, %rcx
cmpl %ecx, %eax
jge 0x98cf8
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %rdx
imull 0x8(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x98ce8
movq -0x68(%rbp), %rdi
movslq -0x6c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x98430
movl %eax, -0x70(%rbp)
cmpl $0x80000001, -0x70(%rbp) # imm = 0x80000001
jne 0x98c39
jmp 0x98ce8
movl -0x70(%rbp), %eax
sarl %eax
cmpl $0x0, %eax
je 0x98c4b
xorl %eax, %eax
testb $0x1, %al
jne 0x98c53
jmp 0x98c58
movb $0x1, %al
testb $0x1, %al
jne 0x98c53
jmp 0x98c58
jmp 0x98cda
movl -0x70(%rbp), %eax
sarl %eax
subl $0x1, %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x10, %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jl 0x98cc2
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0x10(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xa05c3(%rip), %rsi     # 0x13926b
leaq 0xa05cd(%rip), %rdx     # 0x13927c
movb $0x0, %al
callq 0x15920
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
jmp 0x98ddc
movq -0x40(%rbp), %rax
movl -0x70(%rbp), %ecx
sarl %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x98c04
jmp 0x98cea
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x98bc9
jmp 0x98d45
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rdx
movslq 0x10(%rdx), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rax), %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x1, %edi
leaq 0xa0539(%rip), %rsi     # 0x13926b
leaq 0xa056b(%rip), %rdx     # 0x1392a4
movb $0x0, %al
callq 0x15920
jmp 0x98ddc
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, %eax
movl %eax, %edi
callq 0x98e20
movq %rax, -0x30(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x10, %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jge 0x98db5
movq -0x40(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x98da8
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x98e40
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x98daa
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x98d6b
cmpl $0x0, -0x24(%rbp)
je 0x98dda
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x16270
cmpl $0x0, %eax
je 0x98dd8
movl $0xfffffffe, -0x20(%rbp) # imm = 0xFFFFFFFE
jmp 0x98dda
jmp 0x98ddc
movq -0x40(%rbp), %rdi
callq 0x14ef0
cmpq $0x0, -0x30(%rbp)
je 0x98df5
movq -0x30(%rbp), %rdi
callq 0x9bd90
cmpl $0x0, -0x20(%rbp)
je 0x98e03
movl -0x20(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x98e09
movl -0x24(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)