// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: bcf_hdr_add_sample_len
static int bcf_hdr_add_sample_len(bcf_hdr_t *h, const char *s, size_t len)
{
    const char *ss = s;
    while ( *ss && isspace_c(*ss) && ss - s < len) ss++;
    if ( !*ss || ss - s == len)
    {
        hts_log_error("Empty sample name: trailing spaces/tabs in the header line?");
        return -1;
    }

    vdict_t *d = (vdict_t*)h->dict[BCF_DT_SAMPLE];
    int ret;
    char *sdup = malloc(len + 1);
    if (!sdup) return -1;
    memcpy(sdup, s, len);
    sdup[len] = 0;

    // Ensure space is available in h->samples
    size_t n = kh_size(d);
    char **new_samples = realloc(h->samples, sizeof(char*) * (n + 1));
    if (!new_samples) {
        free(sdup);
        return -1;
    }
    h->samples = new_samples;

    int k = kh_put(vdict, d, sdup, &ret);
    if (ret < 0) {
        free(sdup);
        return -1;
    }
    if (ret) { // absent
        kh_val(d, k) = bcf_idinfo_def;
        kh_val(d, k).id = n;
    } else {
        hts_log_error("Duplicated sample name '%s'", sdup);
        free(sdup);
        return -1;
    }
    h->samples[n] = sdup;
    h->dirty = 1;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x55(%rbp)
je 0x3aaaa
movq -0x28(%rbp), %rax
movsbl (%rax), %edi
callq 0x3c5e0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x55(%rbp)
je 0x3aaaa
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
cmpq -0x20(%rbp), %rax
setb %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x3aab3
jmp 0x3aac1
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x3aa6c
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3aadb
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
cmpq -0x20(%rbp), %rax
jne 0x3ab01
movl $0x1, %edi
leaq 0xcda26(%rip), %rsi     # 0x10850d
leaq 0xcda36(%rip), %rdx     # 0x108524
movb $0x0, %al
callq 0x9d90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3ac6b
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
callq 0x4670
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x3ab31
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3ac6b
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x43b0
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x48(%rbp), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
callq 0x4840
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x3ab92
movq -0x40(%rbp), %rdi
callq 0x45a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3ac6b
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0x34(%rbp), %rdx
callq 0x4d210
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x3abcd
movq -0x40(%rbp), %rdi
callq 0x45a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3ac6b
cmpl $0x0, -0x34(%rbp)
je 0x3ac15
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x54(%rbp), %rax
imulq $0x38, %rax, %rax
addq %rax, %rdi
leaq 0xeaa83(%rip), %rsi     # 0x125670
movl $0x38, %edx
callq 0x43b0
movq -0x48(%rbp), %rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x54(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x30(%rax)
jmp 0x3ac45
movq -0x40(%rbp), %rcx
movl $0x1, %edi
leaq 0xcd8e8(%rip), %rsi     # 0x10850d
leaq 0xcd934(%rip), %rdx     # 0x108560
movb $0x0, %al
callq 0x9d90
movq -0x40(%rbp), %rdi
callq 0x45a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3ac6b
movq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x48(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movl $0x1, 0x54(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)