// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: vcf_parse_format_alloc4
static int vcf_parse_format_alloc4(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v,
                                   const char *p, const char *q,
                                   fmt_aux_t *fmt) {
    kstring_t *mem = (kstring_t*)&h->mem;

    int j;
    for (j = 0; j < v->n_fmt; ++j) {
        fmt_aux_t *f = &fmt[j];
        if ( !f->max_m ) f->max_m = 1;  // omitted trailing format field

        if ((f->y>>4&0xf) == BCF_HT_STR) {
            f->size = f->is_gt? f->max_g << 2 : f->max_l;
        } else if ((f->y>>4&0xf) == BCF_HT_REAL || (f->y>>4&0xf) == BCF_HT_INT) {
            f->size = f->max_m << 2;
        } else {
            hts_log_error("The format type %d at %s:%"PRIhts_pos" is currently not supported", f->y>>4&0xf, bcf_seqname_safe(h,v), v->pos+1);
            v->errcode |= BCF_ERR_TAG_INVALID;
            return -1;
        }

        if (align_mem(mem) < 0) {
            hts_log_error("Memory allocation failure at %s:%"PRIhts_pos, bcf_seqname_safe(h,v), v->pos+1);
            v->errcode |= BCF_ERR_LIMITS;
            return -1;
        }

        // Limit the total memory to ~2Gb per VCF row.  This should mean
        // malformed VCF data is less likely to take excessive memory and/or
        // time.
        if ((uint64_t) mem->l + v->n_sample * (uint64_t)f->size > INT_MAX) {
            static int warned = 0;
            if ( !warned ) hts_log_warning("Excessive memory required by FORMAT fields at %s:%"PRIhts_pos, bcf_seqname_safe(h,v), v->pos+1);
            warned = 1;
            v->errcode |= BCF_ERR_LIMITS;
            f->size = -1;
            f->offset = 0;
            continue;
        }

        f->offset = mem->l;
        if (ks_resize(mem, mem->l + v->n_sample * (size_t)f->size) < 0) {
            hts_log_error("Memory allocation failure at %s:%"PRIhts_pos, bcf_seqname_safe(h,v), v->pos+1);
            v->errcode |= BCF_ERR_LIMITS;
            return -1;
        }
        mem->l += v->n_sample * f->size;
    }

    {
        int j;
        for (j = 0; j < v->n_fmt; ++j)
            fmt[j].buf = (uint8_t*)mem->s + fmt[j].offset;
    }

    // check for duplicate tags
    int i;
    for (i=1; i<v->n_fmt; i++)
    {
        fmt_aux_t *ifmt = &fmt[i];
        if ( ifmt->size==-1 ) continue; // already marked for removal
        for (j=0; j<i; j++)
        {
            fmt_aux_t *jfmt = &fmt[j];
            if ( jfmt->size==-1 ) continue; // already marked for removal
            if ( ifmt->key!=jfmt->key ) continue;
            static int warned = 0;
            if ( !warned ) hts_log_warning("Duplicate FORMAT tag %s at %s:%"PRIhts_pos, bcf_hdr_int2id(h,BCF_DT_ID,ifmt->key), bcf_seqname_safe(h,v), v->pos+1);
            warned = 1;
            v->errcode |= BCF_ERR_TAG_INVALID;
            ifmt->size = -1;
            ifmt->offset = 0;
            break;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x18(%rbp), %rax
addq $0x80, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x538b2
movq -0x38(%rbp), %rax
movslq -0x44(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x535fe
movq -0x50(%rbp), %rax
movl $0x1, 0x4(%rax)
movq -0x50(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x3, %eax
jne 0x53649
movq -0x50(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x53630
movq -0x50(%rbp), %rax
movl 0x10(%rax), %eax
shrl %eax
shll $0x2, %eax
movl %eax, -0x6c(%rbp)
jmp 0x5363a
movq -0x50(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x536e9
movq -0x50(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x2, %eax
je 0x5366d
movq -0x50(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
cmpl $0x1, %eax
jne 0x53680
movq -0x50(%rbp), %rax
movl 0x4(%rax), %ecx
shll $0x2, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x536e7
movq -0x50(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x4, %eax
andl $0xf, %eax
movl %eax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43520
movl -0x70(%rbp), %ecx
movq %rax, %r8
movq -0x20(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x1, %edi
leaq 0xb56f5(%rip), %rsi     # 0x108daf
leaq 0xb5706(%rip), %rdx     # 0x108dc7
movb $0x0, %al
callq 0x9d90
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0xcc(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x53a57
jmp 0x536e9
movq -0x40(%rbp), %rdi
callq 0x54df0
cmpl $0x0, %eax
jge 0x5374b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43520
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xb5691(%rip), %rsi     # 0x108daf
leaq 0xb56da(%rip), %rdx     # 0x108dff
movb $0x0, %al
callq 0x9d90
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xcc(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x53a57
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x28, %rcx
movl %ecx, %ecx
movq -0x50(%rbp), %rdx
movslq 0x8(%rdx), %rdx
imulq %rdx, %rcx
addq %rcx, %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jbe 0x537ed
cmpl $0x0, 0xd703a(%rip)     # 0x12a7b8
jne 0x537b5
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43520
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x3, %edi
leaq 0xb5608(%rip), %rsi     # 0x108daf
leaq 0xb5675(%rip), %rdx     # 0x108e23
movb $0x0, %al
callq 0x9d90
movl $0x1, 0xd6ff9(%rip)     # 0x12a7b8
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xcc(%rax)
movq -0x50(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movl $0x0, 0xc(%rax)
jmp 0x538a4
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x28, %rax
movl %eax, %eax
movq -0x50(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq %rcx, %rax
addq %rax, %rsi
callq 0x44ba0
cmpl $0x0, %eax
jge 0x53883
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43520
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xb5559(%rip), %rsi     # 0x108daf
leaq 0xb55a2(%rip), %rdx     # 0x108dff
movb $0x0, %al
callq 0x9d90
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x8, %ecx
movl %ecx, 0xcc(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x53a57
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x28, %rax
movq -0x50(%rbp), %rcx
imull 0x8(%rcx), %eax
movslq %eax, %rcx
movq -0x40(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x535b8
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x5390f
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x38(%rbp), %rax
movslq -0x54(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movslq 0xc(%rax), %rax
addq %rax, %rcx
movq -0x38(%rbp), %rax
movslq -0x54(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x20(%rax)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x538b9
movl $0x1, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x53a50
movq -0x38(%rbp), %rax
movslq -0x58(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
jne 0x53956
jmp 0x53a42
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x53a40
movq -0x38(%rbp), %rax
movslq -0x44(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
jne 0x5398b
jmp 0x53a32
movq -0x60(%rbp), %rax
movl (%rax), %eax
movq -0x68(%rbp), %rcx
cmpl (%rcx), %eax
je 0x5399e
jmp 0x53a32
cmpl $0x0, 0xd6e17(%rip)     # 0x12a7bc
jne 0x539fd
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43520
movq -0x78(%rbp), %rcx
movq %rax, %r8
movq -0x20(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x3, %edi
leaq 0xb53c0(%rip), %rsi     # 0x108daf
leaq 0xb5462(%rip), %rdx     # 0x108e58
movb $0x0, %al
callq 0x9d90
movl $0x1, 0xd6db5(%rip)     # 0x12a7bc
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x40, %ecx
movl %ecx, 0xcc(%rax)
movq -0x60(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x60(%rbp), %rax
movl $0x0, 0xc(%rax)
jmp 0x53a40
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x5395d
jmp 0x53a42
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x53916
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)