// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: vcf_parse
int vcf_parse(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v)
{
    int ret = -2, overflow = 0;
    char *p, *q, *r, *t;
    kstring_t *str;
    khint_t k;
    ks_tokaux_t aux;

//#define NOT_DOT(p) strcmp((p), ".")
//#define NOT_DOT(p) (!(*p == '.' && !p[1]))
//#define NOT_DOT(p) ((*p) != '.' || (p)[1])
//#define NOT_DOT(p) (q-p != 1 || memcmp(p, ".\0", 2))
#define NOT_DOT(p) (memcmp(p, ".\0", 2))

    if (!s || !h || !v || !(s->s))
        return ret;

    // Assumed in lots of places, but we may as well spot this early
    assert(sizeof(float) == sizeof(int32_t));

    // Ensure string we parse has space to permit some over-flow when during
    // parsing.  Eg to do memcmp(key, "END", 4) in vcf_parse_info over
    // the more straight forward looking strcmp, giving a speed advantage.
    if (ks_resize(s, s->l+4) < 0)
        return -2;

    // Force our memory to be initialised so we avoid the technicality of
    // undefined behaviour in using a 4-byte memcmp.  (The reality is this
    // almost certainly is never detected by the compiler so has no impact,
    // but equally so this code has minimal (often beneficial) impact on
    // performance too.)
    s->s[s->l+0] = 0;
    s->s[s->l+1] = 0;
    s->s[s->l+2] = 0;
    s->s[s->l+3] = 0;

    bcf_clear1(v);
    str = &v->shared;
    memset(&aux, 0, sizeof(ks_tokaux_t));

    // CHROM
    if (!(p = kstrtok(s->s, "\t", &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    vdict_t *d = (vdict_t*)h->dict[BCF_DT_CTG];
    k = kh_get(vdict, d, p);
    if (k == kh_end(d)) {
        hts_log_warning("Contig '%s' is not defined in the header. (Quick workaround: index the file with tabix.)", p);
        v->errcode = BCF_ERR_CTG_UNDEF;
        if ((k = fix_chromosome(h, d, p)) == kh_end(d)) {
            hts_log_error("Could not add dummy header for contig '%s'", p);
            v->errcode |= BCF_ERR_CTG_INVALID;
            goto err;
        }
    }
    v->rid = kh_val(d, k).id;

    // POS
    if (!(p = kstrtok(0, 0, &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    overflow = 0;
    char *tmp = p;
    v->pos = hts_str2uint(p, &p, 62, &overflow);
    if (overflow) {
        hts_log_error("Position value '%s' is too large", tmp);
        goto err;
    } else if ( *p ) {
        hts_log_error("Could not parse the position '%s'", tmp);
        goto err;
    } else {
        v->pos -= 1;
    }
    if (v->pos >= INT32_MAX)
        v->unpacked |= BCF_IS_64BIT;

    // ID
    if (!(p = kstrtok(0, 0, &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    if (NOT_DOT(p)) bcf_enc_vchar(str, q - p, p);
    else bcf_enc_size(str, 0, BCF_BT_CHAR);

    // REF
    if (!(p = kstrtok(0, 0, &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    bcf_enc_vchar(str, q - p, p);
    v->n_allele = 1, v->rlen = q - p;

    // ALT
    if (!(p = kstrtok(0, 0, &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    if (NOT_DOT(p)) {
        for (r = t = p;; ++r) {
            if (*r == ',' || *r == 0) {
                if (v->n_allele == UINT16_MAX) {
                    hts_log_error("Too many ALT alleles at %s:%"PRIhts_pos,
                                  bcf_seqname_safe(h,v), v->pos+1);
                    v->errcode |= BCF_ERR_LIMITS;
                    goto err;
                }
                bcf_enc_vchar(str, r - t, t);
                t = r + 1;
                ++v->n_allele;
            }
            if (r == q) break;
        }
    }

    // QUAL
    if (!(p = kstrtok(0, 0, &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    if (NOT_DOT(p)) v->qual = atof(p);
    else bcf_float_set_missing(v->qual);
    if ( v->max_unpack && !(v->max_unpack>>1) ) goto end; // BCF_UN_STR

    // FILTER
    if (!(p = kstrtok(0, 0, &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    if (NOT_DOT(p)) {
        if (vcf_parse_filter(str, h, v, p, q)) {
            goto err;
        }
    } else bcf_enc_vint(str, 0, 0, -1);
    if ( v->max_unpack && !(v->max_unpack>>2) ) goto end; // BCF_UN_FLT

    // INFO
    if (!(p = kstrtok(0, 0, &aux)))
        goto err;
    *(q = (char*)aux.p) = 0;

    if (NOT_DOT(p)) {
        if (vcf_parse_info(str, h, v, p, q)) {
            goto err;
        }
    }
    if ( v->max_unpack && !(v->max_unpack>>3) ) goto end;

    // FORMAT; optional
    p = kstrtok(0, 0, &aux);
    if (p) {
        *(q = (char*)aux.p) = 0;

        if (vcf_parse_format(s, h, v, p, q)) {
            goto err;
        }
    }

 end:
    v->rlen = get_rlen(h, v);    //set rlen based on version
    ret = 0;

 err:
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0xfffffffe, -0x24(%rbp) # imm = 0xFFFFFFFE
movl $0x0, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x45585
cmpq $0x0, -0x18(%rbp)
je 0x45585
cmpq $0x0, -0x20(%rbp)
je 0x45585
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x45590
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x45c92
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
addq $0x4, %rsi
callq 0x44ba0
cmpl $0x0, %eax
jge 0x455b5
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x45c92
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movb $0x0, 0x1(%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movb $0x0, 0x2(%rax,%rcx)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movb $0x0, 0x3(%rax,%rcx)
movq -0x20(%rbp), %rdi
callq 0x40be0
movq -0x20(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x50(%rbp)
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x4240
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xc0ffd(%rip), %rsi     # 0x106638
leaq -0x88(%rbp), %rdx
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x45656
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x3e520
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x90(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x4571b
movq -0x30(%rbp), %rcx
movl $0x3, %edi
leaq 0xc267e(%rip), %rsi     # 0x107d23
leaq 0xc2681(%rip), %rdx     # 0x107d2d
movb $0x0, %al
callq 0x9d90
movq -0x20(%rbp), %rax
movl $0x1, 0xcc(%rax)
movq -0x18(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x45ca0
movl %eax, -0x54(%rbp)
movq -0x90(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x45719
movq -0x30(%rbp), %rcx
movl $0x1, %edi
leaq 0xc2630(%rip), %rsi     # 0x107d23
leaq 0xc268c(%rip), %rdx     # 0x107d86
movb $0x0, %al
callq 0x9d90
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x20, %ecx
movl %ecx, 0xcc(%rax)
jmp 0x45c8c
jmp 0x4571b
movq -0x90(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x54(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movl 0x30(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x4575c
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movl $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x3e, %edx
leaq -0x28(%rbp), %rcx
callq 0x45d80
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpl $0x0, -0x28(%rbp)
je 0x457c5
movq -0x98(%rbp), %rcx
movl $0x1, %edi
leaq 0xc2571(%rip), %rsi     # 0x107d23
leaq 0xc25f8(%rip), %rdx     # 0x107db1
movb $0x0, %al
callq 0x9d90
jmp 0x45c8c
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x457f4
movq -0x98(%rbp), %rcx
movl $0x1, %edi
leaq 0xc2542(%rip), %rsi     # 0x107d23
leaq 0xc25ea(%rip), %rdx     # 0x107dd2
movb $0x0, %al
callq 0x9d90
jmp 0x45c8c
movq -0x20(%rbp), %rax
movq (%rax), %rcx
subq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x45804
movq -0x20(%rbp), %rax
cmpq $0x7fffffff, (%rax)     # imm = 0x7FFFFFFF
jl 0x45827
movq -0x20(%rbp), %rax
movl 0xbc(%rax), %ecx
orl $0x40000000, %ecx       # imm = 0x40000000
movl %ecx, 0xbc(%rax)
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x45849
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
movw (%rax), %ax
subw $0x2e, %ax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x45886
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movq -0x30(%rbp), %rdx
callq 0x44db0
jmp 0x45896
movq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x7, %edx
callq 0x448b0
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x458b8
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movq -0x30(%rbp), %rdx
callq 0x44db0
movq -0x20(%rbp), %rax
movabsq $-0xffff0001, %rcx      # imm = 0xFFFFFFFF0000FFFF
andq 0x18(%rax), %rcx
orq $0x10000, %rcx          # imm = 0x10000
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
subq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x4592f
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
movw (%rax), %ax
subw $0x2e, %ax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x45a66
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x4597c
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x45a45
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x459e2
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43520
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xc2367(%rip), %rsi     # 0x107d23
leaq 0xc2431(%rip), %rdx     # 0x107df4
movb $0x0, %al
callq 0x9d90
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xcc(%rax)
jmp 0x45c8c
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movq -0x48(%rbp), %rdx
callq 0x44db0
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
shrq $0x10, %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
addl $0x1, %ecx
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0xffff, %rdx           # imm = 0xFFFF
shlq $0x10, %rdx
movabsq $-0xffff0001, %rsi      # imm = 0xFFFFFFFF0000FFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x45a51
jmp 0x45a64
jmp 0x45a53
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x45960
jmp 0x45a66
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x45a88
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
movw (%rax), %ax
subw $0x2e, %ax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x45ac1
movq -0x30(%rbp), %rdi
callq 0x4610
cvtsd2ss %xmm0, %xmm0
movq -0x20(%rbp), %rax
movss %xmm0, 0x14(%rax)
jmp 0x45ad4
movq -0x20(%rbp), %rdi
addq $0x14, %rdi
movl 0xdfb71(%rip), %esi     # 0x125640
callq 0x40e90
movq -0x20(%rbp), %rax
cmpl $0x0, 0xb8(%rax)
je 0x45af7
movq -0x20(%rbp), %rax
movl 0xb8(%rax), %eax
sarl %eax
cmpl $0x0, %eax
jne 0x45af7
jmp 0x45c6d
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x45b19
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
movw (%rax), %ax
subw $0x2e, %ax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x45b5f
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x45f40
cmpl $0x0, %eax
je 0x45b5d
jmp 0x45c8c
jmp 0x45b73
movq -0x50(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x442f0
movq -0x20(%rbp), %rax
cmpl $0x0, 0xb8(%rax)
je 0x45b97
movq -0x20(%rbp), %rax
movl 0xb8(%rax), %eax
sarl $0x2, %eax
cmpl $0x0, %eax
jne 0x45b97
jmp 0x45c6d
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x45bb9
jmp 0x45c8c
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
movw (%rax), %ax
subw $0x2e, %ax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x45bff
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x462c0
cmpl $0x0, %eax
je 0x45bfd
jmp 0x45c8c
jmp 0x45bff
movq -0x20(%rbp), %rax
cmpl $0x0, 0xb8(%rax)
je 0x45c20
movq -0x20(%rbp), %rax
movl 0xb8(%rax), %eax
sarl $0x3, %eax
cmpl $0x0, %eax
jne 0x45c20
jmp 0x45c6d
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdx
movq %rsi, %rdi
callq 0xd6380
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x45c6b
movq -0x60(%rbp), %rax
movq %rax, -0x38(%rbp)
movb $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x46c90
cmpl $0x0, %eax
je 0x45c69
jmp 0x45c8c
jmp 0x45c6b
jmp 0x45c6d
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x46e40
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nop