// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/vcf.c
// Function: hrec_add_idx
int hrec_add_idx(bcf_hrec_t *hrec, int idx)
{
    int n = hrec->nkeys + 1;
    char **tmp = (char**) realloc(hrec->keys, sizeof(char*)*n);
    if (!tmp) return -1;
    hrec->keys = tmp;

    tmp = (char**) realloc(hrec->vals, sizeof(char*)*n);
    if (!tmp) return -1;
    hrec->vals = tmp;

    hrec->keys[hrec->nkeys] = strdup("IDX");
    if (!hrec->keys[hrec->nkeys]) return -1;

    kstring_t str = {0,0,0};
    if (kputw(idx, &str) < 0) {
        free(hrec->keys[hrec->nkeys]);
        return -1;
    }
    hrec->vals[hrec->nkeys] = str.s;
    hrec->nkeys = n;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r15d
movq %rdi, %r14
movslq 0x18(%rdi), %r13
movq 0x20(%rdi), %rdi
leaq 0x8(,%r13,8), %r12
movq %r12, %rsi
callq 0x4860
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2c3e7
movq %rax, 0x20(%r14)
movq 0x28(%r14), %rdi
movq %r12, %rsi
callq 0x4860
testq %rax, %rax
je 0x2c3e7
movq %rax, 0x28(%r14)
leaq 0x7e7ba(%rip), %rdi     # 0xaaa23
callq 0x4930
movq 0x20(%r14), %rcx
movslq 0x18(%r14), %rdx
movq %rax, (%rcx,%rdx,8)
movq 0x20(%r14), %rax
cmpq $0x0, (%rax,%rdx,8)
je 0x2c3e7
xorl %ebp, %ebp
testl %r15d, %r15d
js 0x2c296
xorl %esi, %esi
xorl %eax, %eax
jmp 0x2c2b9
movl $0x4, %edi
callq 0x46a0
testq %rax, %rax
je 0x2c3f8
negl %r15d
movb $0x2d, (%rax)
movl $0x1, %ebp
movl $0x4, %esi
cmpl $0x9, %r15d
ja 0x2c2f1
leal 0x2(%rbp), %ecx
cmpl %ecx, %esi
jae 0x2c2de
leaq 0x3(%rbp), %rsi
movq %rax, %r12
movq %rax, %rdi
callq 0x4860
testq %rax, %rax
je 0x2c3ff
orb $0x30, %r15b
addq %rax, %rbp
incq %rbp
movb %r15b, -0x1(%rbp)
jmp 0x2c3b6
bsrl %r15d, %edx
xorl $0x1f, %edx
shll $0x2, %edx
leaq 0x81cee(%rip), %rcx     # 0xadff0
movl (%rdx,%rcx), %edi
leaq 0x81d64(%rip), %rcx     # 0xae070
xorl %r12d, %r12d
cmpl %r15d, (%rdx,%rcx)
seta %r12b
movl %edi, %r10d
subl %r12d, %r10d
leaq (%r10,%rbp), %rcx
addq $0x2, %rcx
cmpq %rcx, %rsi
jae 0x2c35c
movq %rcx, %rsi
shrq %rsi
addq %rcx, %rsi
movq %rdi, 0x8(%rsp)
movq %rax, (%rsp)
movq %rax, %rdi
movq %r10, 0x10(%rsp)
callq 0x4860
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r10
testq %rax, %rax
je 0x2c403
negl %r12d
leaq (%rax,%rbp), %rcx
leal (%rdi,%r12), %edx
addl $-0x2, %edx
leaq 0x7f57f(%rip), %rsi     # 0xab8f0
movl %r15d, %edi
movl %r15d, %r8d
imulq $0x51eb851f, %r8, %r15  # imm = 0x51EB851F
shrq $0x25, %r15
imull $0x64, %r15d, %r8d
movl %edi, %r9d
subl %r8d, %r9d
movl %edx, %r8d
movzwl (%rsi,%r9,2), %r9d
movw %r9w, (%rcx,%r8)
addl $-0x2, %edx
cmpl $0x3e7, %edi            # imm = 0x3E7
ja 0x2c371
cmpl $-0x1, %edx
jne 0x2c3b0
orb $0x30, %r15b
movb %r15b, (%rcx)
addq %r10, %rbp
addq %rax, %rbp
movb $0x0, (%rbp)
xorl %ecx, %ecx
movq %rax, %r12
movslq 0x18(%r14), %rax
testb %cl, %cl
je 0x2c3d6
movq 0x20(%r14), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x45c0
jmp 0x2c3e7
incq %r13
movq 0x28(%r14), %rcx
movq %r12, (%rcx,%rax,8)
movl %r13d, 0x18(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %cl
xorl %r12d, %r12d
jmp 0x2c3bf
movb $0x1, %cl
jmp 0x2c3bf
movb $0x1, %cl
movq (%rsp), %r12
jmp 0x2c3bf