// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
callq 0x18a60
movl %eax, -0x24(%rbp)
movl $0x1, %edi
callq 0x18a40
leaq 0x1000ff(%rip), %rdi    # 0x108580
leaq 0x103312(%rip), %rsi    # 0x10b79a
callq 0xcf30
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x84b5
callq 0x4050
movl (%rax), %edi
callq 0x4120
movq %rax, %rsi
leaq 0xff808(%rip), %rdi     # 0x107cb6
movb $0x0, %al
callq 0x5ae0
callq 0x43c30
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x84e2
callq 0x4050
movl (%rax), %edi
callq 0x4120
movq %rax, %rsi
leaq 0xff7f8(%rip), %rdi     # 0x107cd3
movb $0x0, %al
callq 0x5ae0
movq -0x8(%rbp), %rdi
callq 0x43030
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x8513
callq 0x4050
movl (%rax), %edi
callq 0x4120
movq %rax, %rsi
leaq 0xff7ea(%rip), %rdi     # 0x107cf6
movb $0x0, %al
callq 0x5ae0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x44620
cmpl $0x0, %eax
jne 0x852b
jmp 0x8540
leaq 0xfdb27(%rip), %rdi     # 0x106059
leaq 0xff7dc(%rip), %rsi     # 0x107d15
movb $0x0, %al
callq 0x5ae0
movq -0x18(%rbp), %rax
cmpq $0x5, 0x8(%rax)
je 0x8561
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xff7d2(%rip), %rdi     # 0x107d2c
movb $0x0, %al
callq 0x5ae0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x44620
cmpl $0x0, %eax
jne 0x8579
jmp 0x858e
leaq 0xfdad9(%rip), %rdi     # 0x106059
leaq 0xff78e(%rip), %rsi     # 0x107d15
movb $0x0, %al
callq 0x5ae0
movq -0x18(%rbp), %rax
cmpq $0xa, 0x8(%rax)
je 0x85af
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xff7a9(%rip), %rdi     # 0x107d51
movb $0x0, %al
callq 0x5ae0
movl $0x51c0fb9, -0x20(%rbp) # imm = 0x51C0FB9
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0xff7b2(%rip), %rdx     # 0x107d77
leaq -0x20(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x50f90
cmpl $0x0, %eax
jne 0x85de
jmp 0x85f3
leaq 0xfda74(%rip), %rdi     # 0x106059
leaq 0xff78f(%rip), %rsi     # 0x107d7b
movb $0x0, %al
callq 0x5ae0
movq -0x18(%rbp), %rax
cmpq $0x1, 0x8(%rax)
je 0x8614
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xff7a1(%rip), %rdi     # 0x107dae
movb $0x0, %al
callq 0x5ae0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x44620
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
je 0x863f
movl -0x1c(%rbp), %esi
leaq 0xff79b(%rip), %rdi     # 0x107dd3
movb $0x0, %al
callq 0x5ae0
movq -0x18(%rbp), %rdi
callq 0x44020
movq -0x10(%rbp), %rdi
callq 0x42dd0
movq -0x8(%rbp), %rdi
callq 0xf050
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x8674
movl -0x1c(%rbp), %esi
leaq 0xff795(%rip), %rdi     # 0x107e02
movb $0x0, %al
callq 0x5ae0
movl -0x24(%rbp), %edi
callq 0x18a40
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)