// File: /workspace/github_c_makefile_star2_O2/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
subq $0x18, %rsp
movq %r8, %r14
movq %rcx, %rbx
movq %rsi, %r12
movq %rdi, %r15
xorl %esi, %esi
callq 0x2489c
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x302fa
movl %eax, %r13d
cmpl (%r15), %eax
jge 0x302fa
movq 0x10(%r15), %rax
movl %r13d, %ecx
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %rax
testq %rax, %rax
je 0x302fa
movq %rbx, (%rsp)
movq 0x10(%rax), %rax
movl %eax, %ecx
notl %ecx
testb $0xf, %cl
je 0x302fa
andl $0xf0, %eax
cmpl $0x30, %eax
jne 0x302f7
testb $0x8, 0xbc(%r12)
jne 0x302ce
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0x2b198
movzbl 0x1c(%r12), %eax
movl %eax, %ecx
shll $0x5, %ecx
xorl %ebx, %ebx
pushq $-0x3
popq %rbp
cmpq %rbx, %rcx
je 0x302fa
movq 0x98(%r12), %rdx
cmpl %r13d, (%rdx,%rbx)
je 0x3030b
addq $0x20, %rbx
jmp 0x302de
pushq $-0x2
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
shll $0x5, %eax
cmpl %ebx, %eax
je 0x302fa
movq 0x98(%r12), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x10(%rax,%rbx)
je 0x302fa
movslq 0x8(%r15), %r13
movq (%rsp), %rax
movq (%rax), %rax
pushq $-0x4
popq %rbp
testq %rax, %rax
jne 0x30357
leaq (,%r13,8), %rdi
callq 0x46a0
movq (%rsp), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x302fa
andq $0x0, (%rax)
movq 0x8(%rsp), %rcx
movslq 0x4(%rcx,%rbx), %r15
incq %r15
imulq %r13, %r15
cmpl %r15d, (%r14)
jge 0x30392
movq (%rax), %rdi
movq %r15, %rsi
callq 0x4860
movq (%rsp), %rdx
movq (%rdx), %rcx
movq %rax, (%rcx)
movq (%rdx), %rax
cmpq $0x0, (%rax)
je 0x302fa
movl %r15d, (%r14)
xorl %ebp, %ebp
testl %r13d, %r13d
cmovlel %ebp, %r13d
movq %r13, 0x10(%rsp)
movq 0x8(%rsp), %r12
cmpq %rbp, %r13
je 0x303f8
movslq 0x4(%r12,%rbx), %rdx
movl %edx, %eax
imull %ebp, %eax
movslq %eax, %rsi
addq 0x10(%r12,%rbx), %rsi
movq %r15, %r13
movq (%rsp), %r15
movq (%r15), %rax
leal 0x1(%rdx), %ecx
imull %ebp, %ecx
movslq %ecx, %r14
addq (%rax), %r14
movq %r14, %rdi
callq 0x43c0
movslq 0x4(%r12,%rbx), %rax
movb $0x0, (%rax,%r14)
movq (%r15), %rax
movq %r13, %r15
movq 0x10(%rsp), %r13
movq %r14, (%rax,%rbp,8)
incq %rbp
jmp 0x303a5
movl %r15d, %ebp
jmp 0x302fa