// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/test/test-vcf-api.c
// Function: test_invalid_end_tag
void test_invalid_end_tag(void)
{
    static const char vcf_data[] = "data:,"
        "##fileformat=VCFv4.1\n"
        "##contig=<ID=X,length=155270560>\n"
        "##INFO=<ID=END,Number=1,Type=Integer,Description=\"End coordinate of this variant\">\n"
        "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n"
        "X\t86470037\trs59780433a\tTTTCA\tTGGTT,T\t.\t.\tEND=85725113\n"
        "X\t86470038\trs59780433b\tT\tTGGTT,T\t.\t.\tEND=86470047\n";

    htsFile *fp;
    bcf_hdr_t *hdr;
    bcf1_t *rec;
    int ret;
    int32_t tmpi;
    enum htsLogLevel logging = hts_get_log_level();

    // Silence warning messages
    hts_set_log_level(HTS_LOG_ERROR);

    fp = hts_open(vcf_data, "r");
    if (!fp) error("Failed to open vcf data : %s", strerror(errno));
    rec = bcf_init1();
    if (!rec) error("Failed to allocate BCF record : %s", strerror(errno));

    hdr = bcf_hdr_read(fp);
    if (!hdr) error("Failed to read BCF header : %s", strerror(errno));

    check0(bcf_read(fp, hdr, rec));
    // rec->rlen should ignore the bogus END tag value on the first read
    if (rec->rlen != 5) {
        error("Incorrect rlen - expected 5 got %"PRIhts_pos"\n", rec->rlen);
    }

    check0(bcf_read(fp, hdr, rec));
    // While on the second it should use it
    if (rec->rlen != 10) {
        error("Incorrect rlen - expected 10 got %"PRIhts_pos"\n", rec->rlen);
    }

    // Try to break it - will change rlen
    tmpi = 85725113;
    check0(bcf_update_info_int32(hdr, rec, "END", &tmpi, 1));

    if (rec->rlen != 1) {
        error("Incorrect rlen - expected 1 got %"PRIhts_pos"\n", rec->rlen);
    }

    ret = bcf_read(fp, hdr, rec);
    if (ret != -1) {
        error("Unexpected return code %d from bcf_read at EOF", ret);
    }

    bcf_destroy1(rec);
    bcf_hdr_destroy(hdr);
    ret = hts_close(fp);
    if (ret != 0) {
        error("Unexpected return code %d from hts_close", ret);
    }

    hts_set_log_level(logging);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
callq 0x13ff3
movl %eax, %ebx
movl $0x1, %edi
callq 0x13fec
leaq 0xa642d(%rip), %rdi     # 0xae5b0
leaq 0xa940f(%rip), %rsi     # 0xb1599
callq 0xbee7
testq %rax, %rax
je 0x82a1
movq %rax, %r14
callq 0x32e93
testq %rax, %rax
je 0x82b6
movq %rax, %r15
movq %r14, %rdi
callq 0x31e8f
testq %rax, %rax
je 0x82cb
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x3346e
testl %eax, %eax
jne 0x8291
movq 0x8(%r15), %rsi
cmpq $0x5, %rsi
jne 0x82e3
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3346e
testl %eax, %eax
jne 0x8291
movq 0x8(%r15), %rsi
cmpq $0xa, %rsi
jne 0x82ec
leaq 0x4(%rsp), %rcx
movl $0x51c0fb9, (%rcx)      # imm = 0x51C0FB9
leaq 0xa5b8d(%rip), %rdx     # 0xadda7
movq %r12, %rdi
movq %r15, %rsi
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x41ced
testl %eax, %eax
jne 0x82f5
movq 0x8(%r15), %rsi
cmpq $0x1, %rsi
jne 0x8305
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3346e
cmpl $-0x1, %eax
jne 0x8313
movq %r15, %rdi
callq 0x33036
movq %r12, %rdi
callq 0x31cf6
movq %r14, %rdi
callq 0xd151
testl %eax, %eax
jne 0x831c
movl %ebx, %edi
callq 0x13fec
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xa3df1(%rip), %rdi     # 0xac089
leaq 0xa5aa6(%rip), %rsi     # 0xadd45
jmp 0x830c
callq 0x4050
movl (%rax), %edi
callq 0x4140
leaq 0xa5a32(%rip), %rdi     # 0xadce6
jmp 0x82de
callq 0x4050
movl (%rax), %edi
callq 0x4140
leaq 0xa5a3a(%rip), %rdi     # 0xadd03
jmp 0x82de
callq 0x4050
movl (%rax), %edi
callq 0x4140
leaq 0xa5a48(%rip), %rdi     # 0xadd26
movq %rax, %rsi
jmp 0x830c
leaq 0xa5a72(%rip), %rdi     # 0xadd5c
jmp 0x830c
leaq 0xa5a8e(%rip), %rdi     # 0xadd81
jmp 0x830c
leaq 0xa3d8d(%rip), %rdi     # 0xac089
leaq 0xa5aa8(%rip), %rsi     # 0xaddab
jmp 0x830c
leaq 0xa5ad2(%rip), %rdi     # 0xaddde
xorl %eax, %eax
callq 0x600c
leaq 0xa5ae9(%rip), %rdi     # 0xade03
jmp 0x8323
leaq 0xa5b0f(%rip), %rdi     # 0xade32
movl %eax, %esi
xorl %eax, %eax
callq 0x600c