// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: bcf_set_variant_type
static void bcf_set_variant_type(const char *ref, const char *alt, bcf_variant_t *var)
{
    if ( *alt == '*' && !alt[1] ) { var->n = 0; var->type = VCF_OVERLAP; return; }  // overlapping variant

    // The most frequent case
    if ( !ref[1] && !alt[1] )
    {
        if ( *alt == '.' || *ref==*alt ) { var->n = 0; var->type = VCF_REF; return; }
        if ( *alt == 'X' ) { var->n = 0; var->type = VCF_REF; return; }  // mpileup's X allele shouldn't be treated as variant
        var->n = 1; var->type = VCF_SNP; return;
    }
    if ( alt[0]=='<' )
    {
        if ( alt[1]=='X' && alt[2]=='>' ) { var->n = 0; var->type = VCF_REF; return; }  // mpileup's X allele shouldn't be treated as variant
        if ( alt[1]=='*' && alt[2]=='>' ) { var->n = 0; var->type = VCF_REF; return; }
        if ( !strcmp("NON_REF>",alt+1) ) { var->n = 0; var->type = VCF_REF; return; }
        var->type = VCF_OTHER;
        return;
    }

    // Catch "joined before" breakend case
    if ( alt[0]==']' || alt[0] == '[' )
    {
        var->type = VCF_BND; return;
    }

    // Iterate through alt characters that match the reference
    const char *r = ref, *a = alt;
    while (*r && *a && toupper_c(*r)==toupper_c(*a) ) { r++; a++; }     // unfortunately, matching REF,ALT case is not guaranteed

    if ( *a && !*r )
    {
        while ( *a ) a++;
        if ( *(a-1)==']' || *(a-1)=='[' ) { var->type = VCF_BND; return; } // "joined after" breakend
        var->n = (a-alt)-(r-ref); var->type = VCF_INDEL | VCF_INS; return;
    }
    else if ( *r && !*a )
    {
        while ( *r ) r++;
        var->n = (a-alt)-(r-ref); var->type = VCF_INDEL | VCF_DEL; return;
    }
    else if ( !*r && !*a )
    {
        var->n = 0; var->type = VCF_REF; return;
    }

    const char *re = r, *ae = a;
    while ( re[1] ) re++;
    while ( ae[1] ) ae++;
    if ( ae[0]==']' || ae[0]=='[' ) { var->type = VCF_BND; return; }    // "joined after" breakend
    while ( re>r && ae>a && toupper_c(*re)==toupper_c(*ae) ) { re--; ae--; }
    if ( ae==a )
    {
        if ( re==r ) { var->n = 1; var->type = VCF_SNP; return; }
        var->n = -(re-r);
        if ( toupper_c(*re)==toupper_c(*ae) ) { var->type = VCF_INDEL | VCF_DEL; return; }
        var->type = VCF_OTHER; return;
    }
    else if ( re==r )
    {
        var->n = ae-a;
        if ( toupper_c(*re)==toupper_c(*ae) ) { var->type = VCF_INDEL | VCF_INS; return; }
        var->type = VCF_OTHER; return;
    }

    var->type = ( re-r == ae-a ) ? VCF_MNP : VCF_OTHER;
    var->n = ( re-r > ae-a ) ? -(re-r+1) : ae-a+1;

    // should do also complex events, SVs, etc...
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
jne 0x55a24
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1(%rax)
jne 0x55a24
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x20, (%rax)
jmp 0x55f85
movq -0x8(%rbp), %rax
cmpb $0x0, 0x1(%rax)
jne 0x55ab4
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1(%rax)
jne 0x55ab4
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x55a5a
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x55a74
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x55f85
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x58, %eax
jne 0x55a9a
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x55f85
movq -0x18(%rbp), %rax
movl $0x1, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x55f85
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3c, %eax
jne 0x55b6e
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x55af8
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x3e, %eax
jne 0x55af8
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x55f85
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2a, %eax
jne 0x55b2c
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x3e, %eax
jne 0x55b2c
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x55f85
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
leaq 0xb3640(%rip), %rdi     # 0x10917b
callq 0x46b0
cmpl $0x0, %eax
jne 0x55b5f
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x55f85
movq -0x18(%rbp), %rax
movl $0x8, (%rax)
jmp 0x55f85
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5d, %eax
je 0x55b86
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
jne 0x55b95
movq -0x18(%rbp), %rax
movl $0x10, (%rax)
jmp 0x55f85
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x55bf5
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x55bf5
movq -0x20(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movsbl %al, %eax
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movb %al, %cl
movl -0x40(%rbp), %eax
movsbl %cl, %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x55bfe
jmp 0x55c18
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x55ba5
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x55ca0
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x55ca0
jmp 0x55c2f
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x55c46
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x55c2f
movq -0x28(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x5d, %eax
je 0x55c60
movq -0x28(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x5b, %eax
jne 0x55c6f
movq -0x18(%rbp), %rax
movl $0x10, (%rax)
jmp 0x55f85
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rdx
subq %rdx, %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x44, (%rax)
jmp 0x55f85
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x55cff
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x55cff
jmp 0x55cb7
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x55cce
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x55cb7
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rdx
subq %rdx, %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x84, (%rax)
jmp 0x55f85
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x55d2b
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x55d2b
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x55f85
jmp 0x55d2d
jmp 0x55d2f
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpb $0x0, 0x1(%rax)
je 0x55d57
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x55d3f
jmp 0x55d59
movq -0x38(%rbp), %rax
cmpb $0x0, 0x1(%rax)
je 0x55d71
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x55d59
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5d, %eax
je 0x55d89
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5b, %eax
jne 0x55d98
movq -0x18(%rbp), %rax
movl $0x10, (%rax)
jmp 0x55f85
jmp 0x55d9a
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0x41(%rbp)
jbe 0x55de6
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x41(%rbp)
jbe 0x55de6
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movsbl %al, %eax
movl %eax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movb %al, %cl
movl -0x48(%rbp), %eax
movsbl %cl, %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x55def
jmp 0x55e09
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x55d9a
movq -0x38(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x55e9c
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x55e3b
movq -0x18(%rbp), %rax
movl $0x1, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x55f85
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rax, %rcx
xorl %eax, %eax
subq %rcx, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movsbl %al, %eax
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movb %al, %cl
movl -0x4c(%rbp), %eax
movsbl %cl, %ecx
cmpl %ecx, %eax
jne 0x55e8d
movq -0x18(%rbp), %rax
movl $0x84, (%rax)
jmp 0x55f85
movq -0x18(%rbp), %rax
movl $0x8, (%rax)
jmp 0x55f85
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x55f02
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movsbl %al, %eax
movl %eax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %edi
callq 0x55f90
movb %al, %cl
movl -0x50(%rbp), %eax
movsbl %cl, %ecx
cmpl %ecx, %eax
jne 0x55ef3
movq -0x18(%rbp), %rax
movl $0x44, (%rax)
jmp 0x55f85
movq -0x18(%rbp), %rax
movl $0x8, (%rax)
jmp 0x55f85
jmp 0x55f04
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rax
subq %rax, %rdx
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rax
subq %rax, %rsi
movl $0x8, %ecx
movl $0x2, %eax
cmpq %rsi, %rdx
cmovel %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
subq %rcx, %rax
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jle 0x55f65
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rax, %rcx
addq $0x1, %rcx
xorl %eax, %eax
subq %rcx, %rax
movq %rax, -0x58(%rbp)
jmp 0x55f78
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)