// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
leaq 0x62086(%rip), %rdx     # 0xd6aac
movq %rdi, 0x8(%rsp)
callq 0x14a60
testq %rax, %rax
je 0x74b55
movq %rax, %r12
movzwl 0x1a(%r14), %edi
movl $0x4, %esi
callq 0x15ea0
movq %rax, %rbx
movl 0xc(%r12), %ecx
cmpl $0x1, %ecx
je 0x74c4b
cmpl $0x2, %ecx
je 0x74b5d
cmpl $0x3, %ecx
jne 0x74ce6
movq 0x18(%r14), %rax
shrq $0x28, %rax
je 0x74c59
xorl %r15d, %r15d
xorl %esi, %esi
cmpl $0x0, 0x4(%r12)
jle 0x74b32
movl 0x8(%r12), %eax
imull %r15d, %eax
movslq %eax, %r13
addq 0x10(%r12), %r13
xorl %ebp, %ebp
movl (%r13,%rbp,4), %ecx
movl $0x13, %eax
cmpl $0x80000001, %ecx       # imm = 0x80000001
je 0x74b11
movl $0x15, %eax
cmpl $0x2, %ecx
jb 0x74b11
sarl %ecx
movzwl 0x1a(%r14), %eax
cmpl %eax, %ecx
jle 0x74b08
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x10(%r14), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rcx
movq (%r14), %r8
incq %r8
movl $0x1, %edi
leaq 0x605bd(%rip), %rsi     # 0xd50ab
leaq 0x605c7(%rip), %rdx     # 0xd50bc
xorl %eax, %eax
callq 0x157b0
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x9, %eax
jmp 0x74b11
movslq %ecx, %rax
incl -0x4(%rbx,%rax,4)
xorl %eax, %eax
testl %eax, %eax
je 0x74b1a
cmpl $0x15, %eax
jne 0x74b2d
incq %rbp
movslq 0x4(%r12), %rax
cmpq %rax, %rbp
jl 0x74aa0
jmp 0x74b32
cmpl $0x13, %eax
jne 0x74b34
xorl %eax, %eax
testl %eax, %eax
jne 0x74e84
incl %r15d
movq 0x18(%r14), %rax
shrq $0x28, %rax
cmpl %eax, %r15d
jb 0x74a81
jmp 0x74c5b
xorl %r13d, %r13d
jmp 0x74eb2
movq 0x18(%r14), %rax
shrq $0x28, %rax
je 0x74c59
xorl %r15d, %r15d
xorl %esi, %esi
cmpl $0x0, 0x4(%r12)
jle 0x74c2b
movl 0x8(%r12), %eax
imull %r15d, %eax
movslq %eax, %r13
addq 0x10(%r12), %r13
xorl %ebp, %ebp
movzwl (%r13,%rbp,2), %ecx
movl $0xd, %eax
cmpl $0x8001, %ecx           # imm = 0x8001
je 0x74c0a
movl $0xf, %eax
cmpw $0x2, %cx
jb 0x74c0a
movswl %cx, %eax
sarl %eax
decl %eax
movswl %ax, %ecx
movzwl 0x1a(%r14), %edx
cmpl %ecx, %edx
jle 0x74bcb
movswq %ax, %rax
incl (%rbx,%rax,4)
xorl %eax, %eax
jmp 0x74c0a
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x10(%r14), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rcx
movq (%r14), %r8
incq %r8
movl $0x1, %edi
leaq 0x604b9(%rip), %rsi     # 0xd50ab
leaq 0x604c3(%rip), %rdx     # 0xd50bc
xorl %eax, %eax
callq 0x157b0
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x9, %eax
testl %eax, %eax
je 0x74c13
cmpl $0xf, %eax
jne 0x74c26
incq %rbp
movslq 0x4(%r12), %rax
cmpq %rax, %rbp
jl 0x74b8f
jmp 0x74c2b
cmpl $0xd, %eax
jne 0x74c2d
xorl %eax, %eax
testl %eax, %eax
jne 0x74e84
incl %r15d
movq 0x18(%r14), %rax
shrq $0x28, %rax
cmpl %eax, %r15d
jb 0x74b70
jmp 0x74c5b
movq 0x18(%r14), %rax
shrq $0x28, %rax
jne 0x74dad
xorl %esi, %esi
movl %esi, 0x4(%rsp)
movq %rbx, 0x10(%rsp)
movq 0x18(%r14), %r15
movq %r15, %rbp
shrq $0x10, %rbp
movzwl %bp, %ebx
addl $0x3f, %ebx
shrl $0x6, %ebx
leal (,%rbx,8), %eax
movq %rax, 0x20(%rsp)
leaq 0x18(%rax), %rdi
callq 0x14810
xorl %r13d, %r13d
testq %rax, %rax
je 0x74d2e
movq %rax, %r12
movq %rbx, 0x8(%rax)
movq %rbx, (%rax)
movq %rax, %rdi
addq $0x10, %rdi
movq %r15, 0x18(%rsp)
xorl %r15d, %r15d
xorl %esi, %esi
movq 0x20(%rsp), %rdx
callq 0x14240
andl $0x3f, %ebp
movq $-0x1, %rax
movl %ebp, %ecx
shlq %cl, %rax
notq %rax
cmpq $0x1, %rbp
sbbq %r15, %r15
orq %rax, %r15
movq %r15, 0x10(%r12,%rbx,8)
movq 0x18(%rsp), %r15
jmp 0x74d31
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x10(%r14), %rdx
shlq $0x4, %rdx
movq (%rax,%rdx), %r8
movq (%r14), %r9
incq %r9
leaq 0x603a3(%rip), %rsi     # 0xd50ab
leaq 0x603d5(%rip), %rdx     # 0xd50e4
xorl %r12d, %r12d
movl $0x1, %edi
xorl %eax, %eax
callq 0x157b0
xorl %r13d, %r13d
movl $0x0, 0x4(%rsp)
jmp 0x74e93
xorl %r12d, %r12d
movq 0x10(%rsp), %rbx
cmpl $0x20000, %r15d         # imm = 0x20000
jb 0x74d7d
shrl $0x10, %r15d
cmpl $0x3, %r15d
movl $0x2, %eax
cmovael %r15d, %eax
xorl %r13d, %r13d
movl $0x1, %ecx
cmpl $0x0, (%rbx,%rcx,4)
jne 0x74d75
movl $0x1, %edx
shlq %cl, %rdx
movq %rcx, %rsi
shrq $0x6, %rsi
orq %rdx, 0x10(%r12,%rsi,8)
incl %r13d
incq %rcx
cmpq %rcx, %rax
jne 0x74d58
testl %r13d, %r13d
je 0x74e90
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x16090
testl %eax, %eax
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movl 0x4(%rsp), %ecx
cmovnel %eax, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x74e93
xorl %r15d, %r15d
xorl %esi, %esi
cmpl $0x0, 0x4(%r12)
jle 0x74e65
movl 0x8(%r12), %eax
imull %r15d, %eax
movslq %eax, %r13
addq 0x10(%r12), %r13
xorl %ebp, %ebp
movb (%r13,%rbp), %cl
movl $0x6, %eax
cmpb $-0x7f, %cl
je 0x74e44
movl $0x8, %eax
cmpb $0x2, %cl
jb 0x74e44
sarb %cl
decb %cl
movsbl %cl, %eax
movzwl 0x1a(%r14), %edx
cmpl %eax, %edx
jle 0x74e05
movsbq %cl, %rax
incl (%rbx,%rax,4)
xorl %eax, %eax
jmp 0x74e44
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x10(%r14), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rcx
movq (%r14), %r8
incq %r8
movl $0x1, %edi
leaq 0x6027f(%rip), %rsi     # 0xd50ab
leaq 0x60289(%rip), %rdx     # 0xd50bc
xorl %eax, %eax
callq 0x157b0
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x9, %eax
testl %eax, %eax
je 0x74e4d
cmpl $0x8, %eax
jne 0x74e60
incq %rbp
movslq 0x4(%r12), %rax
cmpq %rax, %rbp
jl 0x74dd1
jmp 0x74e65
cmpl $0x6, %eax
jne 0x74e67
xorl %eax, %eax
testl %eax, %eax
jne 0x74e84
incl %r15d
movq 0x18(%r14), %rax
shrq $0x28, %rax
cmpl %eax, %r15d
jb 0x74db2
jmp 0x74c5b
cmpl $0x9, %eax
jne 0x74ec4
movl %esi, 0x4(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %rbx, %rdi
callq 0x14dd0
testq %r12, %r12
je 0x74ea8
movq %r12, %rdi
callq 0x14dd0
movl 0x4(%rsp), %eax
testl %eax, %eax
cmovnel %eax, %r13d
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x74eb2