// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/header.c
// Function: sam_hrecs_vupdate
int sam_hrecs_vupdate(sam_hrecs_t *hrecs, sam_hrec_type_t *type, va_list ap) {
    if (!hrecs)
        return -1;

    for (;;) {
        char *k, *v, *str;
        sam_hrec_tag_t *tag, *prev = NULL;

        if (!(k = (char *)va_arg(ap, char *)))
            break;
        if (!(v = va_arg(ap, char *)))
            v = "";

        tag = sam_hrecs_find_key(type, k, &prev);
        if (!tag) {
            if (!(tag = pool_alloc(hrecs->tag_pool)))
                return -1;
            if (prev)
                prev->next = tag;
            else
                type->tag = tag;

            tag->next = NULL;
        }

        tag->len = 3 + strlen(v);
        str = string_alloc(hrecs->str_pool, tag->len+1);
        if (!str)
            return -1;

        if (snprintf(str, tag->len+1, "%2.2s:%s", k, v) < 0)
            return -1;

        tag->str = str;
    }

    hrecs->dirty = 1; //mark text as dirty and force a rebuild

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xdac2a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdadf3
jmp 0xdac2c
movq $0x0, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x28, %eax
ja 0xdac5f
movq -0x58(%rbp), %rcx
movl -0x4c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x60(%rbp)
jmp 0xdac76
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0xdac8c
jmp 0xdadde
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movl (%rax), %eax
movl %eax, -0x64(%rbp)
cmpl $0x28, %eax
ja 0xdacb7
movq -0x70(%rbp), %rcx
movl -0x64(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x78(%rbp)
jmp 0xdacce
movq -0x70(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xdacea
leaq 0x1528f(%rip), %rax     # 0xeff75
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0xdaf50
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xdad54
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x82110
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0xdad29
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdadf3
cmpq $0x0, -0x48(%rbp)
je 0xdad3d
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
jmp 0xdad49
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rdi
callq 0x41b0
addq $0x3, %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x82420
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xdad98
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdadf3
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
leaq 0x1d974(%rip), %rdx     # 0xf872c
movb $0x0, %al
callq 0x47e0
cmpl $0x0, %eax
jge 0xdadcd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdadf3
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xdac2c
movq -0x10(%rbp), %rax
movl $0x1, 0x90(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nop