// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %esi, %esi
callq 0x3e820
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0x508cd
movl -0x38(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x508cd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x508cd
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
andq $0xf, %rax
cmpl $0xf, %eax
jne 0x508d9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x50b1e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
shrq $0x4, %rax
andq $0xf, %rax
cmpl $0x3, %eax
je 0x5090d
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x50b1e
movq -0x18(%rbp), %rax
movl 0xbc(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
jne 0x5092d
movq -0x18(%rbp), %rdi
movl $0x8, %esi
callq 0x48110
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x5097a
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x38(%rbp), %eax
jne 0x5096d
jmp 0x5097a
jmp 0x5096f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x50934
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jne 0x509a0
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x50b1e
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x509d1
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0x50b1e
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x50a20
movslq -0x44(%rbp), %rdi
shlq $0x3, %rdi
callq 0x4670
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x50a12
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x50b1e
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
imull -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
cmpl -0x48(%rbp), %eax
jge 0x50a7e
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
movslq -0x48(%rbp), %rsi
callq 0x4840
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, (%rax)
jne 0x50a75
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x50b1e
movl -0x48(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x50b18
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %rdx
imull 0x4(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl -0x34(%rbp), %ecx
movq -0x40(%rbp), %rdx
movl 0x4(%rdx), %edx
addl $0x1, %edx
imull %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rax
movslq 0x4(%rax), %rdx
callq 0x43b0
movq -0x58(%rbp), %rax
movq -0x40(%rbp), %rcx
movslq 0x4(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq -0x58(%rbp), %rdx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x34(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x50a85
movl -0x48(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)