// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcfutils.c
// Function: bcf_gt_type
int bcf_gt_type(bcf_fmt_t *fmt_ptr, int isample, int *_ial, int *_jal)
{
    int i, nals = 0, has_ref = 0, has_alt = 0, ial = 0, jal = 0;
    #define BRANCH_INT(type_t, convert, vector_end) { \
        uint8_t *p = fmt_ptr->p + isample*fmt_ptr->size; \
        for (i=0; i<fmt_ptr->n; i++) \
        { \
            int32_t val = convert(&p[i * sizeof(type_t)]); \
            if ( val == vector_end ) break; /* smaller ploidy */ \
            if ( bcf_gt_is_missing(val) ) return GT_UNKN; /* missing allele */ \
            int tmp = val>>1; \
            if ( tmp>1 ) \
            { \
                if ( !ial ) { ial = tmp; has_alt = 1; } \
                else if ( tmp!=ial ) \
                { \
                    if ( tmp<ial ) \
                    { \
                        jal = ial; \
                        ial = tmp; \
                    } \
                    else \
                    { \
                        jal = tmp; \
                    } \
                    has_alt = 2; \
                } \
            } \
            else has_ref = 1; \
            nals++; \
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0xc(%rdi), %r8d
pushq $0x6
popq %rax
cmpl $0x3, %r8d
je 0x5d483
cmpl $0x2, %r8d
je 0x5d3fd
cmpl $0x1, %r8d
jne 0x5d563
imull 0x8(%rdi), %esi
movslq %esi, %rbx
addq 0x10(%rdi), %rbx
movl 0x4(%rdi), %esi
xorl %r11d, %r11d
testl %esi, %esi
cmovlel %r11d, %esi
pushq $0x1
popq %rbp
pushq $0x2
popq %r14
xorl %edi, %edi
xorl %r10d, %r10d
xorl %r9d, %r9d
xorl %r8d, %r8d
cmpq %r11, %rsi
je 0x5d4fe
movb (%rbx,%r11), %r15b
cmpb $-0x7f, %r15b
je 0x5d4fb
cmpb $0x2, %r15b
jb 0x5d558
sarb %r15b
cmpb $0x2, %r15b
jl 0x5d3ed
movsbl %r15b, %r15d
testl %r10d, %r10d
je 0x5d3f2
cmpl %r15d, %r10d
je 0x5d3f8
movl %r15d, %edi
cmovgl %r10d, %edi
cmovgel %r15d, %r10d
movl %r14d, %r9d
jmp 0x5d3f8
movl %ebp, %r8d
jmp 0x5d3f8
movl %r15d, %r10d
movl %ebp, %r9d
incq %r11
jmp 0x5d3a5
imull 0x8(%rdi), %esi
movslq %esi, %rbx
addq 0x10(%rdi), %rbx
movl 0x4(%rdi), %esi
xorl %r11d, %r11d
testl %esi, %esi
cmovlel %r11d, %esi
pushq $0x1
popq %rbp
pushq $0x2
popq %r14
xorl %edi, %edi
xorl %r10d, %r10d
xorl %r9d, %r9d
xorl %r8d, %r8d
cmpq %r11, %rsi
je 0x5d4fe
movzwl (%rbx,%r11,2), %r15d
cmpw $0x8001, %r15w          # imm = 0x8001
je 0x5d4fb
cmpw $0x2, %r15w
jb 0x5d558
movswl %r15w, %r15d
sarl %r15d
cmpw $0x2, %r15w
jl 0x5d473
testl %r10d, %r10d
je 0x5d478
cmpl %r15d, %r10d
je 0x5d47e
movl %r15d, %edi
cmovgl %r10d, %edi
cmovgel %r15d, %r10d
movl %r14d, %r9d
jmp 0x5d47e
movl %ebp, %r8d
jmp 0x5d47e
movl %r15d, %r10d
movl %ebp, %r9d
incq %r11
jmp 0x5d426
imull 0x8(%rdi), %esi
movslq %esi, %rbx
addq 0x10(%rdi), %rbx
movl 0x4(%rdi), %esi
xorl %r11d, %r11d
testl %esi, %esi
cmovlel %r11d, %esi
pushq $0x1
popq %rbp
pushq $0x2
popq %r14
xorl %edi, %edi
xorl %r10d, %r10d
xorl %r9d, %r9d
xorl %r8d, %r8d
cmpq %r11, %rsi
je 0x5d4fe
movl (%rbx,%r11,4), %r15d
cmpl $0x80000001, %r15d      # imm = 0x80000001
je 0x5d4fb
cmpl $0x2, %r15d
jb 0x5d558
sarl %r15d
cmpl $0x2, %r15d
jl 0x5d4eb
testl %r10d, %r10d
je 0x5d4f0
cmpl %r10d, %r15d
je 0x5d4f6
movl %r10d, %edi
cmovgl %r15d, %edi
cmovll %r15d, %r10d
movl %r14d, %r9d
jmp 0x5d4f6
movl %ebp, %r8d
jmp 0x5d4f6
movl %r15d, %r10d
movl %ebp, %r9d
incq %r11
jmp 0x5d4ac
movl %r11d, %esi
testq %rdx, %rdx
je 0x5d513
xorl %r11d, %r11d
testl %r10d, %r10d
setg %r11b
subl %r11d, %r10d
movl %r10d, (%rdx)
testq %rcx, %rcx
je 0x5d523
xorl %edx, %edx
testl %edi, %edi
setg %dl
subl %edx, %edi
movl %edi, (%rcx)
testl %esi, %esi
je 0x5d558
cmpl $0x1, %esi
jne 0x5d537
xorl %eax, %eax
cmpl $0x1, %r8d
adcl $0x4, %eax
jmp 0x5d558
testl %r8d, %r8d
je 0x5d548
xorl %eax, %eax
testl %r9d, %r9d
setne %al
addl %eax, %eax
jmp 0x5d558
xorl %eax, %eax
cmpl $0x1, %r9d
setne %al
leal 0x1(,%rax,2), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4c895(%rip), %rsi     # 0xa9dff
leaq 0x4b341(%rip), %rdx     # 0xa88b2
pushq $0x1
popq %rbx
movl %ebx, %edi
movl %r8d, %ecx
xorl %eax, %eax
callq 0x15830
movl %ebx, %edi
callq 0x14650