// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/vcf.c
// Function: bcf_get_format_string
int bcf_get_format_string(const bcf_hdr_t *hdr, bcf1_t *line, const char *tag, char ***dst, int *ndst)
{
    int i,tag_id = bcf_hdr_id2int(hdr, BCF_DT_ID, tag);
    if ( !bcf_hdr_idinfo_exists(hdr,BCF_HL_FMT,tag_id) ) return -1;    // no such FORMAT field in the header
    if ( bcf_hdr_id2type(hdr,BCF_HL_FMT,tag_id)!=BCF_HT_STR ) return -2;     // expected different type

    if ( !(line->unpacked & BCF_UN_FMT) ) bcf_unpack(line, BCF_UN_FMT);

    for (i=0; i<line->n_fmt; i++)
        if ( line->d.fmt[i].id==tag_id ) break;
    if ( i==line->n_fmt ) return -3;                               // the tag is not present in this record
    bcf_fmt_t *fmt = &line->d.fmt[i];
    if ( !fmt->p ) return -3;                                      // the tag was marked for removal

    int nsmpl = bcf_hdr_nsamples(hdr);
    if ( !*dst )
    {
        *dst = (char**) malloc(sizeof(char*)*nsmpl);
        if ( !*dst ) return -4;     // could not alloc
        (*dst)[0] = NULL;
    }
    int n = (fmt->n+1)*nsmpl;
    if ( *ndst < n )
    {
        (*dst)[0] = realloc((*dst)[0], n);
        if ( !(*dst)[0] ) return -4;    // could not alloc
        *ndst = n;
    }
    for (i=0; i<nsmpl; i++)
    {
        uint8_t *src = fmt->p + i*fmt->n;
        uint8_t *tmp = (uint8_t*)(*dst)[0] + i*(fmt->n+1);
        memcpy(tmp,src,fmt->n);
        tmp[fmt->n] = 0;
        (*dst)[i] = (char*) tmp;
    }
    return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movq %rcx, %rbx
movq %rsi, %r13
movq %rdi, %r12
xorl %esi, %esi
callq 0x2d3d9
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x40b50
movl %eax, %ebp
cmpl (%r12), %eax
jge 0x40b50
movq 0x10(%r12), %rax
movl %ebp, %ecx
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %rax
testq %rax, %rax
je 0x40b50
movq 0x10(%rax), %rax
movl %eax, %ecx
notl %ecx
testb $0xf, %cl
je 0x40b50
andl $0xf0, %eax
movl $0xfffffffe, %r15d      # imm = 0xFFFFFFFE
cmpl $0x30, %eax
jne 0x40b50
testb $0x8, 0xbc(%r13)
jne 0x40a48
movq %r13, %rdi
movl $0x8, %esi
callq 0x38183
movq 0x18(%r13), %rcx
shrq $0x20, %rcx
movl %ecx, %eax
andl $0xff, %eax
je 0x40a80
movq 0x98(%r13), %rdx
movzbl %cl, %esi
xorl %ecx, %ecx
cmpl %ebp, (%rdx)
je 0x40a82
incq %rcx
addq $0x20, %rdx
movl $0xfffffffd, %r15d      # imm = 0xFFFFFFFD
cmpq %rcx, %rsi
jne 0x40a65
jmp 0x40b50
xorl %ecx, %ecx
movl $0xfffffffd, %r15d      # imm = 0xFFFFFFFD
cmpl %eax, %ecx
je 0x40b50
movq 0x98(%r13), %r13
movl %ecx, %ebp
shlq $0x5, %rbp
cmpq $0x0, 0x10(%r13,%rbp)
je 0x40b50
movslq 0x8(%r12), %r12
movq (%rbx), %rax
testq %rax, %rax
jne 0x40ad2
leaq (,%r12,8), %rdi
callq 0x46a0
movq %rax, (%rbx)
testq %rax, %rax
je 0x40b4a
movq $0x0, (%rax)
addq %rbp, %r13
movslq 0x4(%r13), %r15
incq %r15
imulq %r12, %r15
cmpl %r15d, (%r14)
jge 0x40b02
movq (%rax), %rdi
movq %r15, %rsi
callq 0x4860
movq (%rbx), %rcx
movq %rax, (%rcx)
movq (%rbx), %rax
cmpq $0x0, (%rax)
je 0x40b4a
movl %r15d, (%r14)
testl %r12d, %r12d
jle 0x40b50
xorl %ebp, %ebp
movslq 0x4(%r13), %rdx
movl %edx, %eax
imull %ebp, %eax
movslq %eax, %rsi
addq 0x10(%r13), %rsi
movq (%rbx), %rax
leal 0x1(%rdx), %ecx
imull %ebp, %ecx
movslq %ecx, %r14
addq (%rax), %r14
movq %r14, %rdi
callq 0x43c0
movslq 0x4(%r13), %rax
movb $0x0, (%rax,%r14)
movq (%rbx), %rax
movq %r14, (%rax,%rbp,8)
incq %rbp
cmpq %rbp, %r12
jne 0x40b09
jmp 0x40b50
movl $0xfffffffc, %r15d      # imm = 0xFFFFFFFC
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq