// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: bcf_update_info
int bcf_update_info(const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const void *values, int n, int type)
{
    static int negative_rlen_warned = 0;
    int is_end_tag, is_svlen_tag = 0;

    // Is the field already present?
    int i, inf_id = bcf_hdr_id2int(hdr,BCF_DT_ID,key);
    if ( !bcf_hdr_idinfo_exists(hdr,BCF_HL_INFO,inf_id) ) return -1;    // No such INFO field in the header
    if ( !(line->unpacked & BCF_UN_INFO) ) bcf_unpack(line, BCF_UN_INFO);

    is_end_tag = strcmp(key, "END") == 0;
    is_svlen_tag = strcmp(key, "SVLEN") == 0;

    for (i=0; i<line->n_info; i++)
        if ( inf_id==line->d.info[i].key ) break;
    bcf_info_t *inf = i==line->n_info ? NULL : &line->d.info[i];

    if ( !n || (type==BCF_HT_STR && !values) )
    {
        if ( inf )
        {
            // Mark the tag for removal, free existing memory if necessary
            if ( inf->vptr_free )
            {
                free(inf->vptr - inf->vptr_off);
                inf->vptr_free = 0;
            }
            line->d.shared_dirty |= BCF1_DIRTY_INF;
            inf->vptr = NULL;
            inf->vptr_off = inf->vptr_len = 0;
        }
        if ( n==0 && (is_end_tag || is_svlen_tag) ) {
            line->rlen = get_rlen(hdr, line);
        }
        return 0;
    }

    if (is_end_tag)
    {
        if (n != 1)
        {
            hts_log_error("END info tag should only have one value at %s:%"PRIhts_pos, bcf_seqname_safe(hdr,line), line->pos+1);
            line->errcode |= BCF_ERR_TAG_INVALID;
            return -1;
        }
        if (type != BCF_HT_INT && type != BCF_HT_LONG)
        {
            hts_log_error("Wrong type (%d) for END info tag at %s:%"PRIhts_pos, type, bcf_seqname_safe(hdr,line), line->pos+1);
            line->errcode |= BCF_ERR_TAG_INVALID;
            return -1;
        }
    }

    // Encode the values and determine the size required to accommodate the values
    kstring_t str = {0,0,0};
    bcf_enc_int1(&str, inf_id);
    if ( type==BCF_HT_INT )
        bcf_enc_vint(&str, n, (int32_t*)values, -1);
    else if ( type==BCF_HT_REAL )
        bcf_enc_vfloat(&str, n, (float*)values);
    else if ( type==BCF_HT_FLAG || type==BCF_HT_STR )
    {
        if ( values==NULL )
            bcf_enc_size(&str, 0, BCF_BT_NULL);
        else
            bcf_enc_vchar(&str, strlen((char*)values), (char*)values);
    }
#ifdef VCF_ALLOW_INT64
    else if ( type==BCF_HT_LONG )
    {
        if (n != 1) {
            hts_log_error("Only storing a single BCF_HT_LONG value is supported at %s:%"PRIhts_pos, bcf_seqname_safe(hdr,line), line->pos+1);
            abort();
        }
        bcf_enc_long1(&str, *(int64_t *) values);
    }
#endif
    else
    {
        hts_log_error("The type %d not implemented yet at %s:%"PRIhts_pos, type, bcf_seqname_safe(hdr,line), line->pos+1);
        abort();
    }

    // Is the INFO tag already present
    if ( inf )
    {
        // Is it big enough to accommodate new block?
        if ( inf->vptr && str.l <= inf->vptr_len + inf->vptr_off )
        {
            if ( str.l != inf->vptr_len + inf->vptr_off ) line->d.shared_dirty |= BCF1_DIRTY_INF;
            uint8_t *ptr = inf->vptr - inf->vptr_off;
            memcpy(ptr, str.s, str.l);
            free(str.s);
            int vptr_free = inf->vptr_free;
            bcf_unpack_info_core1(ptr, inf);
            inf->vptr_free = vptr_free;
        }
        else
        {
            if ( inf->vptr_free )
                free(inf->vptr - inf->vptr_off);
            bcf_unpack_info_core1((uint8_t*)str.s, inf);
            inf->vptr_free = 1;
            line->d.shared_dirty |= BCF1_DIRTY_INF;
        }
    }
    else
    {
        // The tag is not present, create new one
        line->n_info++;
        hts_expand0(bcf_info_t, line->n_info, line->d.m_info , line->d.info);
        inf = &line->d.info[line->n_info-1];
        bcf_unpack_info_core1((uint8_t*)str.s, inf);
        inf->vptr_free = 1;
        line->d.shared_dirty |= BCF1_DIRTY_INF;
    }
    line->unpacked |= BCF_UN_INFO;

   if ( n==1 && is_end_tag) {
        hts_pos_t end = type == BCF_HT_INT ? *(int32_t *) values : *(int64_t *) values;
        if ( (type == BCF_HT_INT && end!=bcf_int32_missing) || (type == BCF_HT_LONG && end!=bcf_int64_missing) )
        {
            if ( end <= line->pos )
            {
                if ( !negative_rlen_warned )
                {
                    hts_log_warning("INFO/END=%"PRIhts_pos" is smaller than POS at %s:%"PRIhts_pos,end,bcf_seqname_safe(hdr,line),line->pos+1);
                    negative_rlen_warned = 1;
                }
            }
        }
    }
    if (is_svlen_tag || is_end_tag) {
        line->rlen = get_rlen(hdr, line);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %esi, %esi
callq 0x3e820
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jl 0x4df9b
movl -0x40(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x4df9b
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x4df9b
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x40(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
andq $0xf, %rax
cmpl $0xf, %eax
jne 0x4dfa7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4e6b5
movq -0x18(%rbp), %rax
movl 0xbc(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x4dfc7
movq -0x18(%rbp), %rdi
movl $0x4, %esi
callq 0x48110
movq -0x20(%rbp), %rdi
leaq 0xba2a3(%rip), %rsi     # 0x108275
callq 0x46b0
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rdi
leaq 0xba289(%rip), %rsi     # 0x108279
callq 0x46b0
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jge 0x4e04c
movl -0x40(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x90(%rcx), %rcx
movslq -0x3c(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x4e03f
jmp 0x4e04c
jmp 0x4e041
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x4e00a
movl -0x3c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jne 0x4e06a
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0x4e084
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rax
movslq -0x3c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x4e0a7
cmpl $0x3, -0x30(%rbp)
jne 0x4e16b
cmpq $0x0, -0x28(%rbp)
jne 0x4e16b
cmpq $0x0, -0x48(%rbp)
je 0x4e135
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x4e0f8
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movslq %eax, %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
callq 0x45a0
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x1c(%rax)
movq -0x18(%rbp), %rax
movl 0xb0(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xb0(%rax)
movq -0x48(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x48(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %ecx
andl $0x80000000, %ecx       # imm = 0x80000000
orl $0x0, %ecx
movl %ecx, 0x1c(%rax)
cmpl $0x0, -0x2c(%rbp)
jne 0x4e15f
cmpl $0x0, -0x34(%rbp)
jne 0x4e147
cmpl $0x0, -0x38(%rbp)
je 0x4e15f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x46e40
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4e6b5
cmpl $0x0, -0x34(%rbp)
je 0x4e243
cmpl $0x1, -0x2c(%rbp)
je 0x4e1cf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xba0dd(%rip), %rsi     # 0x10827f
leaq 0xba0e6(%rip), %rdx     # 0x10828f
movb $0x0, %al
callq 0x9d90
movq -0x18(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0xcc(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4e6b5
cmpl $0x1, -0x30(%rbp)
je 0x4e241
cmpl $0x101, -0x30(%rbp)     # imm = 0x101
je 0x4e241
movl -0x30(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movl -0x84(%rbp), %ecx
movq %rax, %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x1, %edi
leaq 0xba06b(%rip), %rsi     # 0x10827f
leaq 0xba0a6(%rip), %rdx     # 0x1082c1
movb $0x0, %al
callq 0x9d90
movq -0x18(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0xcc(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4e6b5
jmp 0x4e243
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4240
movl -0x40(%rbp), %esi
leaq -0x60(%rbp), %rdi
callq 0x44a50
cmpl $0x1, -0x30(%rbp)
jne 0x4e27f
movl -0x2c(%rbp), %esi
movq -0x28(%rbp), %rdx
leaq -0x60(%rbp), %rdi
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x442f0
jmp 0x4e323
cmpl $0x2, -0x30(%rbp)
jne 0x4e29a
movl -0x2c(%rbp), %esi
movq -0x28(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x44c70
jmp 0x4e321
cmpl $0x0, -0x30(%rbp)
je 0x4e2a6
cmpl $0x3, -0x30(%rbp)
jne 0x4e2d6
cmpq $0x0, -0x28(%rbp)
jne 0x4e2bc
leaq -0x60(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x448b0
jmp 0x4e2d4
movq -0x28(%rbp), %rdi
callq 0x41a0
movl %eax, %esi
movq -0x28(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x44db0
jmp 0x4e31f
movl -0x30(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movl -0x88(%rbp), %ecx
movq %rax, %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x1, %edi
leaq 0xb9f73(%rip), %rsi     # 0x10827f
leaq 0xb9fd9(%rip), %rdx     # 0x1082ec
movb $0x0, %al
callq 0x9d90
callq 0x4250
jmp 0x4e321
jmp 0x4e323
cmpq $0x0, -0x48(%rbp)
je 0x4e479
movq -0x48(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4e40b
movq -0x60(%rbp), %rax
movq -0x48(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x48(%rbp), %rdx
movl 0x1c(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
addl %edx, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
ja 0x4e40b
movq -0x60(%rbp), %rax
movq -0x48(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x48(%rbp), %rdx
movl 0x1c(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
addl %edx, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
je 0x4e396
movq -0x18(%rbp), %rax
movl 0xb0(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xb0(%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movl 0x1c(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movslq %ecx, %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x43b0
movq -0x50(%rbp), %rdi
callq 0x45a0
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x1f, %eax
movl %eax, -0x6c(%rbp)
movq -0x68(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x48900
movl -0x6c(%rbp), %edx
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x1c(%rax)
jmp 0x4e474
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x4e43e
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movslq %eax, %rcx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
callq 0x45a0
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x48900
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x1c(%rax)
movq -0x18(%rbp), %rax
movl 0xb0(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xb0(%rax)
jmp 0x4e59e
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
addl $0x1, %ecx
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0xffff, %rdx           # imm = 0xFFFF
andq $-0x10000, %rcx         # imm = 0xFFFF0000
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movq -0x18(%rbp), %rcx
cmpl 0x54(%rcx), %eax
jle 0x4e53b
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x1, %eax
jl 0x4e4e8
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
movl %eax, -0x8c(%rbp)
jmp 0x4e4f5
movl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x4e4f5
movl -0x8c(%rbp), %eax
movslq %eax, %rdi
movq -0x18(%rbp), %rax
movslq 0x54(%rax), %rsi
movq -0x18(%rbp), %r9
addq $0x50, %r9
addq $0x40, %r9
movl $0x4, %edx
movl $0x28, %ecx
movl $0x1, %r8d
leaq 0xb9d56(%rip), %rax     # 0x10827f
movq %rax, (%rsp)
callq 0x15780
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x54(%rax)
jmp 0x4e53d
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x48900
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x1c(%rax)
movq -0x18(%rbp), %rax
movl 0xb0(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xb0(%rax)
movq -0x18(%rbp), %rax
movl 0xbc(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0xbc(%rax)
cmpl $0x1, -0x2c(%rbp)
jne 0x4e68a
cmpl $0x0, -0x34(%rbp)
je 0x4e68a
cmpl $0x1, -0x30(%rbp)
jne 0x4e5db
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x98(%rbp)
jmp 0x4e5e9
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpl $0x1, -0x30(%rbp)
jne 0x4e604
cmpq $-0x80000000, -0x78(%rbp) # imm = 0x80000000
jne 0x4e61d
cmpl $0x101, -0x30(%rbp)     # imm = 0x101
jne 0x4e688
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, -0x78(%rbp)
je 0x4e688
movq -0x78(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jg 0x4e686
cmpl $0x0, 0xdc177(%rip)     # 0x12a7a8
jne 0x4e684
movq -0x78(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movq -0xa0(%rbp), %rcx
movq %rax, %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x3, %edi
leaq 0xb9c13(%rip), %rsi     # 0x10827f
leaq 0xb9ca3(%rip), %rdx     # 0x108316
movb $0x0, %al
callq 0x9d90
movl $0x1, 0xdc124(%rip)     # 0x12a7a8
jmp 0x4e686
jmp 0x4e688
jmp 0x4e68a
cmpl $0x0, -0x38(%rbp)
jne 0x4e696
cmpl $0x0, -0x34(%rbp)
je 0x4e6ae
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x46e40
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)