// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/vcf.c
// Function: vcf_parse_filter
static int vcf_parse_filter(kstring_t *str, const bcf_hdr_t *h, bcf1_t *v, char *p, char *q) {
    int i, n_flt = 1, max_n_flt = 0;
    char *r, *t;
    int32_t *a_flt = NULL;
    ks_tokaux_t aux1;
    khint_t k;
    vdict_t *d = (vdict_t*)h->dict[BCF_DT_ID];
    // count the number of filters
    if (*(q-1) == ';') *(q-1) = 0;
    for (r = p; *r; ++r)
        if (*r == ';') ++n_flt;
    if (n_flt > max_n_flt) {
        a_flt = malloc(n_flt * sizeof(*a_flt));
        if (!a_flt) {
            hts_log_error("Could not allocate memory at %s:%"PRIhts_pos, bcf_seqname_safe(h,v), v->pos+1);
            v->errcode |= BCF_ERR_LIMITS; // No appropriate code?
            return -1;
        }
        max_n_flt = n_flt;
    }
    // add filters
    for (t = kstrtok(p, ";", &aux1), i = 0; t; t = kstrtok(0, 0, &aux1)) {
        *(char*)aux1.p = 0;
        k = kh_get(vdict, d, t);
        if (k == kh_end(d))
        {
            // Simple error recovery for FILTERs not defined in the header. It will not help when VCF header has
            // been already printed, but will enable tools like vcfcheck to proceed.
            hts_log_warning("FILTER '%s' is not defined in the header", t);
            kstring_t tmp = {0,0,0};
            int l;
            ksprintf(&tmp, "##FILTER=<ID=%s,Description=\"Dummy\">", t);
            bcf_hrec_t *hrec = bcf_hdr_parse_line(h,tmp.s,&l);
            free(tmp.s);
            int res = hrec ? bcf_hdr_add_hrec((bcf_hdr_t*)h, hrec) : -1;
            if (res < 0) bcf_hrec_destroy(hrec);
            if (res > 0) res = bcf_hdr_sync((bcf_hdr_t*)h);
            k = kh_get(vdict, d, t);
            v->errcode |= BCF_ERR_TAG_UNDEF;
            if (res || k == kh_end(d)) {
                hts_log_error("Could not add dummy header for FILTER '%s' at %s:%"PRIhts_pos, t, bcf_seqname_safe(h,v), v->pos+1);
                v->errcode |= BCF_ERR_TAG_INVALID;
                free(a_flt);
                return -1;
            }
        }
        a_flt[i++] = kh_val(d, k).id;
    }

    bcf_enc_vint(str, n_flt, a_flt, -1);
    free(a_flt);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, %r13
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, 0x48(%rsp)
movq 0x28(%rsi), %rax
movq %rax, (%rsp)
cmpb $0x3b, -0x1(%r8)
jne 0x33dcf
movb $0x0, -0x1(%r8)
movl $0x1, %ebp
movq %r13, %rax
movzbl (%rax), %ecx
cmpl $0x3b, %ecx
je 0x33de5
testl %ecx, %ecx
jne 0x33de7
jmp 0x33dec
incl %ebp
incq %rax
jmp 0x33dd7
testl %ebp, %ebp
jle 0x33e41
movl %ebp, %edi
shlq $0x2, %rdi
callq 0x46a0
movq %rax, 0x18(%rsp)
testq %rax, %rax
jne 0x33e4a
testq %rbx, %rbx
je 0x341da
movslq 0x10(%rbx), %rax
testq %rax, %rax
sets %cl
testq %r14, %r14
sete %dl
orb %cl, %dl
jne 0x341da
cmpl %eax, 0x4(%r14)
jle 0x341da
movq 0x18(%r14), %rcx
shlq $0x4, %rax
movq (%rcx,%rax), %rax
jmp 0x341dc
movq $0x0, 0x18(%rsp)
movl %ebp, 0x3c(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x40(%rsp)
leaq 0x78b18(%rip), %rsi     # 0xac977
leaq 0x78(%rsp), %rdx
movq %r13, %rdi
callq 0x895db
testq %rax, %rax
je 0x341b3
movq %rax, %r8
xorl %ebx, %ebx
movq %rbx, 0x50(%rsp)
movq 0xa0(%rsp), %rax
movb $0x0, (%rax)
movq (%rsp), %rax
movl (%rax), %edx
movl $0x0, %r15d
testl %edx, %edx
movq %r8, 0x30(%rsp)
je 0x33f58
movb (%r8), %cl
testb %cl, %cl
je 0x33ec9
leaq 0x1(%r8), %rax
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebx, %ecx
imull $0x1000193, %ecx, %ebx  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x33eb3
jmp 0x33ece
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
movq %rdx, 0x10(%rsp)
leal -0x1(%rdx), %r13d
andl %r13d, %ebx
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %ebp
movl %ebx, %r15d
movq %rsi, 0x28(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r14d
leal (%r15,%r15), %r12d
andl $0x1e, %r12d
movl %r14d, %eax
movl %r12d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x33f45
testb $0x1, %al
jne 0x33f36
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
callq 0x46e0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %r8
testl %eax, %eax
je 0x33f45
addl %ebp, %r15d
andl %r13d, %r15d
incl %ebp
cmpl %ebx, %r15d
jne 0x33eef
jmp 0x33f61
movl %r12d, %ecx
shrl %cl, %r14d
testb $0x3, %r14b
movq 0x10(%rsp), %rdx
cmovnel %edx, %r15d
cmpl %edx, %r15d
jne 0x340e6
movl $0x3, %edi
leaq 0x789d5(%rip), %rsi     # 0xac942
leaq 0x78a05(%rip), %rdx     # 0xac979
movq %r8, %rcx
xorl %eax, %eax
movq %r8, %rbx
callq 0x942d
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x78a04(%rip), %rsi     # 0xac9a2
movq %rbx, %rdx
xorl %eax, %eax
callq 0x89557
movq 0x70(%rsp), %rsi
leaq 0x5c(%rsp), %rdx
callq 0x2b376
movq %rax, %r12
movq 0x70(%rsp), %rdi
callq 0x45c0
testq %r12, %r12
je 0x33ff1
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x2bd95
testl %eax, %eax
js 0x33ff1
je 0x34128
movq 0x20(%rsp), %rdi
callq 0x2ab97
testl %eax, %eax
setne %al
jmp 0x33ffb
movq %r12, %rdi
callq 0x2ac82
movb $0x1, %al
movl %eax, 0xc(%rsp)
movq (%rsp), %rax
movl (%rax), %eax
movq %rax, 0x10(%rsp)
testl %eax, %eax
movq 0x30(%rsp), %r10
je 0x34135
movb (%r10), %cl
testb %cl, %cl
je 0x3403d
leaq 0x1(%r10), %rax
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebx, %ecx
imull $0x1000193, %ecx, %ebx  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x34027
jmp 0x34042
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
movq 0x10(%rsp), %rax
leal -0x1(%rax), %r13d
andl %r13d, %ebx
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %ebp
movl %ebx, %r15d
movq %rsi, 0x28(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r14d
leal (%r15,%r15), %r12d
andl $0x1e, %r12d
movl %r14d, %eax
movl %r12d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x340b9
testb $0x1, %al
jne 0x340aa
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r10, %rsi
callq 0x46e0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %r10
testl %eax, %eax
je 0x340b9
addl %ebp, %r15d
andl %r13d, %r15d
incl %ebp
cmpl %ebx, %r15d
jne 0x34063
jmp 0x34135
movl %r12d, %ecx
shrl %cl, %r14d
testb $0x3, %r14b
movq 0x10(%rsp), %rax
cmovnel %eax, %r15d
movq 0x40(%rsp), %rbx
orb $0x2, 0xcc(%rbx)
cmpl %eax, %r15d
sete %al
movl 0xc(%rsp), %ecx
orb %al, %cl
jne 0x34141
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r15d, %ecx
imulq $0x38, %rcx, %rcx
movl 0x30(%rax,%rcx), %eax
movq 0x18(%rsp), %rcx
movq 0x50(%rsp), %rbx
movl %eax, (%rcx,%rbx,4)
incq %rbx
xorl %edi, %edi
xorl %esi, %esi
leaq 0x78(%rsp), %rdx
callq 0x895db
movq %rax, %r8
testq %rax, %rax
jne 0x33e7a
jmp 0x341b3
movl $0x0, 0xc(%rsp)
jmp 0x33fff
movq 0x40(%rsp), %rbx
orb $0x2, 0xcc(%rbx)
movslq 0x10(%rbx), %rax
testq %rax, %rax
sets %cl
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
sete %dl
orb %cl, %dl
jne 0x3416d
cmpl %eax, 0x4(%rsi)
jle 0x3416d
movq 0x18(%rsi), %rcx
shlq $0x4, %rax
movq (%rcx,%rax), %rax
jmp 0x3416f
xorl %eax, %eax
testq %rax, %rax
leaq 0x78796(%rip), %r8      # 0xac90f
cmovneq %rax, %r8
movq (%rbx), %r9
incq %r9
leaq 0x787b8(%rip), %rsi     # 0xac942
leaq 0x78836(%rip), %rdx     # 0xac9c7
movl $0x1, %edi
movq %r10, %rcx
xorl %eax, %eax
callq 0x942d
orb $0x40, 0xcc(%rbx)
movq 0x18(%rsp), %rdi
callq 0x45c0
jmp 0x34211
movq 0x48(%rsp), %rdi
movl 0x3c(%rsp), %esi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x32025
movq %rbx, %rdi
callq 0x45c0
xorl %eax, %eax
jmp 0x34216
xorl %eax, %eax
testq %rax, %rax
leaq 0x78729(%rip), %rcx     # 0xac90f
cmovneq %rax, %rcx
movq (%rbx), %r8
incq %r8
leaq 0x7874b(%rip), %rsi     # 0xac942
leaq 0x78755(%rip), %rdx     # 0xac953
movl $0x1, %edi
xorl %eax, %eax
callq 0x942d
orb $0x8, 0xcc(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq