// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: vcf_write
int vcf_write(htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)
{
    ssize_t ret;
    fp->line.l = 0;
    if (vcf_format1(h, v, &fp->line) != 0)
        return -1;
    if ( fp->format.compression!=no_compression ) {
        if (bgzf_flush_try(fp->fp.bgzf, fp->line.l) < 0)
            return -1;
        if (fp->idx && !fp->fp.bgzf->mt)
            hts_idx_amend_last(fp->idx, bgzf_tell(fp->fp.bgzf));
        ret = bgzf_write(fp->fp.bgzf, fp->line.s, fp->line.l);
    } else {
        ret = hwrite(fp->fp.hfile, fp->line.s, fp->line.l);
    }

    if (fp->idx && fp->format.compression == bgzf) {
        int tid;
        if ((tid = hts_idx_tbi_name(fp->idx, v->rid, bcf_seqname_safe(h, v))) < 0)
            return -1;

        if (bgzf_idx_push(fp->fp.bgzf, fp->idx,
                          tid, v->pos, v->pos + v->rlen,
                          bgzf_tell(fp->fp.bgzf), 1) < 0)
            return -1;
    }

    return ret==fp->line.l ? 0 : -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x10, %rdx
callq 0x48ad0
cmpl $0x0, %eax
je 0x435b6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x43763
movq -0x10(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x43659
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xdb1a0
cmpl $0x0, %eax
jge 0x435ea
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x43763
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x43636
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq $0x0, 0x48(%rax)
jne 0x43636
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rax), %rsi
shlq $0x10, %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl 0x10(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cltq
orq %rax, %rsi
callq 0xf020
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0xdb250
movq %rax, -0x28(%rbp)
jmp 0x4367a
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x441b0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x43747
movq -0x10(%rbp), %rax
cmpl $0x2, 0x54(%rax)
jne 0x43747
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43520
movq -0x38(%rbp), %rdi
movl -0x30(%rbp), %esi
movq %rax, %rdx
callq 0xeef0
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
jge 0x436dd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x43763
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rsi
movl -0x2c(%rbp), %edx
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq (%rax), %r8
movq -0x20(%rbp), %rax
addq 0x8(%rax), %r8
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rax), %r9
shlq $0x10, %r9
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl 0x10(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cltq
orq %rax, %r9
movl $0x1, (%rsp)
callq 0xd7160
cmpl $0x0, %eax
jge 0x43745
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x43763
jmp 0x43747
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpq %rsi, %rdx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)