// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: bcf_get_version
static int bcf_get_version(const bcf_hdr_t *hdr, const char *verstr)
{
    const char *version = NULL, vcf[] = "VCFv";
    char *major = NULL, *minor = NULL;
    int ver = -1;
    long tmp = 0;
    bcf_hdr_aux_t *aux = NULL;

    if (!hdr && !verstr) {  //invalid input
        goto fail;
    }

    if (hdr) {
        if ((aux = get_hdr_aux(hdr)) && aux->version != 0) {    //use cached version
            return aux->version;
        }
        //get from header
        version = bcf_hdr_get_version(hdr);
    } else {
        //get from version string
        version = verstr;
    }
    if (!(major = strstr(version, vcf))) {  //bad format
        goto fail;
    }
    major += sizeof(vcf) - 1;
    if (!(minor = strchr(major, '.'))) {    //bad format
        goto fail;
    }
    tmp = strtol(major, NULL, 10);
    if ((!tmp && errno == EINVAL) ||
        ((tmp == LONG_MIN || tmp == LONG_MAX) && errno == ERANGE)) {    //failed
        goto fail;
    }
    ver = tmp * 100 * 10000;
    tmp = strtol(++minor, NULL, 10);
    if ((!tmp && errno == EINVAL) ||
        ((tmp == LONG_MIN || tmp == LONG_MAX) && errno == ERANGE)) {    //failed
        goto fail;
    }
    ver += tmp * 1000;
    return ver;

fail:
    hts_log_warning("Couldn't get VCF version, considering as %d.%d",
        VCF_MAJOR_VER(VCF_DEF), VCF_MINOR_VER(VCF_DEF));
    return VCF_DEF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movl 0xcb93e(%rip), %eax     # 0x10857c
movl %eax, -0x25(%rbp)
movb 0xcb939(%rip), %al      # 0x108580
movb %al, -0x21(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x3cc84
cmpq $0x0, -0x18(%rbp)
jne 0x3cc84
jmp 0x3cded
cmpq $0x0, -0x10(%rbp)
je 0x3ccc6
movq -0x10(%rbp), %rdi
callq 0x3b020
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x3ccb7
movq -0x50(%rbp), %rax
cmpl $0x0, 0x38(%rax)
je 0x3ccb7
movq -0x50(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x3ce19
movq -0x10(%rbp), %rdi
callq 0x3f3a0
movq %rax, -0x20(%rbp)
jmp 0x3ccce
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x25(%rbp), %rsi
callq 0x40b0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x3ccea
jmp 0x3cded
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movl $0x2e, %esi
callq 0x4160
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x3cd13
jmp 0x3cded
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x46c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x3cd3a
callq 0x4050
cmpl $0x16, (%rax)
je 0x3cd64
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x48(%rbp)
je 0x3cd5a
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, -0x48(%rbp)
jne 0x3cd69
callq 0x4050
cmpl $0x22, (%rax)
jne 0x3cd69
jmp 0x3cded
imulq $0x64, -0x48(%rbp), %rax
imulq $0x2710, %rax, %rax     # imm = 0x2710
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
addq $0x1, %rdi
movq %rdi, -0x38(%rbp)
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x46c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x3cda7
callq 0x4050
cmpl $0x16, (%rax)
je 0x3cdd1
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x48(%rbp)
je 0x3cdc7
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, -0x48(%rbp)
jne 0x3cdd3
callq 0x4050
cmpl $0x22, (%rax)
jne 0x3cdd3
jmp 0x3cded
imulq $0x3e8, -0x48(%rbp), %rcx # imm = 0x3E8
movslq -0x3c(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3ce19
movl $0x3, %edi
leaq 0xcb788(%rip), %rsi     # 0x108581
leaq 0xcb791(%rip), %rdx     # 0x108591
movl $0x4, %ecx
movl $0x2, %r8d
movb $0x0, %al
callq 0x9d90
movl $0x3d10d0, -0x4(%rbp)   # imm = 0x3D10D0
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)