// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/vcf.c
// Function: vcf_parse_format_max3
static int vcf_parse_format_max3(kstring_t *s, const bcf_hdr_t *h, bcf1_t *v,
                                 char *p, char *q, fmt_aux_t *fmt) {
    int n_sample_ori = -1;
    char *r = q + 1;  // r: position in the format string
    int l = 0, m = 1, g = 1, j;
    v->n_sample = 0;  // m: max vector size, l: max field len, g: max number of alleles
    const char *end = s->s + s->l;

    while ( r<end )
    {
        // can we skip some samples?
        if ( h->keep_samples )
        {
            n_sample_ori++;
            if ( !bit_array_test(h->keep_samples,n_sample_ori) )
            {
                while ( *r!='\t' && r<end ) r++;
                if ( *r=='\t' ) { *r = 0; r++; }
                continue;
            }
        }

        // collect fmt stats: max vector size, length, number of alleles
        j = 0;  // j-th format field
        fmt_aux_t *f = fmt;
        static char meta[256] = {
            // \0 \t , / : |
            1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
            0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
        };

        char *r_start = r;
        for (;;) {
            // Quickly skip ahead to an appropriate meta-character
            while (!meta[(unsigned char)*r]) r++;

            switch (*r) {
            case ',':
                m++;
                break;

            case '|':
            case '/':
                if (f->is_gt) g++;
                break;

            case '\t':
                *r = 0; // fall through

            default: // valid due to while loop above.
            case '\0':
            case ':':
                l = r - r_start; r_start = r;
                if (f->max_m < m) f->max_m = m;
                if (f->max_l < l) f->max_l = l;
                if (f->is_gt && f->max_g < g) f->max_g = g;
                l = 0, m = g = 1;
                if ( *r==':' ) {
                    j++; f++;
                    if ( j>=v->n_fmt ) {
                        hts_log_error("Incorrect number of FORMAT fields at %s:%"PRIhts_pos"",
                                      h->id[BCF_DT_CTG][v->rid].key, v->pos+1);
                        v->errcode |= BCF_ERR_NCOLS;
                        return -1;
                    }
                } else goto end_for;
                break;
            }
            if ( r>=end ) break;
            r++;
        }
    end_for:
        v->n_sample++;
        if ( v->n_sample == bcf_hdr_nsamples(h) ) break;
        r++;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %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)
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x1, -0x50(%rbp)
movl $0x1, -0x54(%rbp)
movq -0x20(%rbp), %rax
movabsq $0xffffffffff, %rcx     # imm = 0xFFFFFFFFFF
andq 0x18(%rax), %rcx
orq $0x0, %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
addq (%rcx), %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x60(%rbp), %rax
jae 0x53568
movq -0x18(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x532ec
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x80(%rbp)
movl -0x3c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x80(%rbp), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x74(%rbp)
movl -0x3c(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl -0x74(%rbp), %eax
movl %edx, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
jne 0x532ea
jmp 0x53287
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x81(%rbp)
je 0x532ac
movq -0x48(%rbp), %rax
cmpq -0x60(%rbp), %rax
setb %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x532b8
jmp 0x532c6
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x53287
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0x532e5
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x53218
jmp 0x532ec
movl $0x0, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x53305
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0xd244b(%rip), %rax     # 0x125760
cmpb $0x0, (%rax,%rcx)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x53324
jmp 0x53332
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x53305
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x88(%rbp)
testl %eax, %eax
je 0x533ba
jmp 0x53345
movl -0x88(%rbp), %eax
subl $0x9, %eax
je 0x533b1
jmp 0x53352
movl -0x88(%rbp), %eax
subl $0x2c, %eax
je 0x53386
jmp 0x5335f
movl -0x88(%rbp), %eax
subl $0x2f, %eax
je 0x53394
jmp 0x5336c
movl -0x88(%rbp), %eax
subl $0x3a, %eax
je 0x533ba
jmp 0x53379
movl -0x88(%rbp), %eax
subl $0x7c, %eax
je 0x53394
jmp 0x533b8
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x534eb
movq -0x68(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x533ac
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x534eb
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
jmp 0x533ba
movq -0x48(%rbp), %rax
movq -0x70(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x50(%rbp), %eax
jge 0x533e6
movl -0x50(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x68(%rbp), %rax
movl 0x14(%rax), %eax
cmpl -0x4c(%rbp), %eax
jae 0x533fc
movl -0x4c(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x68(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x53433
movq -0x68(%rbp), %rax
movl 0x10(%rax), %eax
shrl %eax
cmpl -0x54(%rbp), %eax
jge 0x53433
movl -0x54(%rbp), %edx
movq -0x68(%rbp), %rax
movl 0x10(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
shll %edx
andl $0x1, %ecx
orl %edx, %ecx
movl %ecx, 0x10(%rax)
movl $0x0, -0x4c(%rbp)
movl $0x1, -0x54(%rbp)
movl $0x1, -0x50(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x534e7
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
movq -0x68(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x68(%rbp)
movl -0x58(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jl 0x534e5
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
movslq 0x10(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq (%rax), %r8
addq $0x1, %r8
movl $0x1, %edi
leaq 0xb58b5(%rip), %rsi     # 0x108d6d
leaq 0xb58c4(%rip), %rdx     # 0x108d83
movb $0x0, %al
callq 0x9d90
movq -0x20(%rbp), %rax
movl 0xcc(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0xcc(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5356f
jmp 0x534e9
jmp 0x5350a
jmp 0x534eb
movq -0x48(%rbp), %rax
cmpq -0x60(%rbp), %rax
jb 0x534f7
jmp 0x53508
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x53303
jmp 0x5350a
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
shrq $0x28, %rcx
addl $0x1, %ecx
movl %ecx, %ecx
movl %ecx, %edx
movq 0x18(%rax), %rcx
andq $0xffffff, %rdx         # imm = 0xFFFFFF
shlq $0x28, %rdx
movabsq $0xffffffffff, %rsi     # imm = 0xFFFFFFFFFF
andq %rsi, %rcx
orq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x28, %rax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x53557
jmp 0x53568
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x53218
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)