// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/vcf.c
// Function: vcf_format
int vcf_format(const bcf_hdr_t *h, const bcf1_t *v, kstring_t *s)
{
    int i;
    int32_t max_dt_id = h->n[BCF_DT_ID];
    const char *chrom = bcf_seqname(h, v);
    if (!chrom) {
        hts_log_error("Invalid BCF, CONTIG id=%d not present in the header",
                      v->rid);
        errno = EINVAL;
        return -1;
    }

    bcf_unpack((bcf1_t*)v, BCF_UN_ALL & ~(BCF_UN_INFO|BCF_UN_FMT));

    // Cache of key lengths so we don't keep repeatedly using them.
    // This assumes we're not modifying the header between successive calls
    // to vcf_format, but that would lead to many other forms of breakage
    // so it feels like a valid assumption to make.
    //
    // We cannot just do this in bcf_hdr_sync as some code (eg bcftools
    // annotate) manipulates the headers directly without calling sync to
    // refresh the data structures.  So we must do just-in-time length
    // calculation during writes instead.
    bcf_hdr_aux_t *aux = get_hdr_aux(h);
    if (!aux->key_len) {
        if (!(aux->key_len = calloc(h->n[BCF_DT_ID]+1, sizeof(*aux->key_len))))
            return -1;
    }
    size_t *key_len = aux->key_len;

    kputs(chrom, s); // CHROM
    kputc_('\t', s); kputll(v->pos + 1, s); // POS
    kputc_('\t', s); kputs(v->d.id ? v->d.id : ".", s); // ID
    kputc_('\t', s); // REF
    if (v->n_allele > 0) kputs(v->d.allele[0], s);
    else kputc_('.', s);
    kputc_('\t', s); // ALT
    if (v->n_allele > 1) {
        for (i = 1; i < v->n_allele; ++i) {
            if (i > 1) kputc_(',', s);
            kputs(v->d.allele[i], s);
        }
    } else kputc_('.', s);
    kputc_('\t', s); // QUAL
    if ( bcf_float_is_missing(v->qual) ) kputc_('.', s); // QUAL
    else kputd(v->qual, s);
    kputc_('\t', s); // FILTER
    if (v->d.n_flt) {
        for (i = 0; i < v->d.n_flt; ++i) {
            int32_t idx = v->d.flt[i];
            if (idx < 0 || idx >= max_dt_id
                || h->id[BCF_DT_ID][idx].key == NULL) {
                hts_log_error("Invalid BCF, the FILTER tag id=%d at %s:%"PRIhts_pos" not present in the header",
                              idx, bcf_seqname_safe(h, v), v->pos + 1);
                errno = EINVAL;
                return -1;
            }
            if (i) kputc_(';', s);
            if (!key_len[idx])
                key_len[idx] = strlen(h->id[BCF_DT_ID][idx].key);
            kputsn(h->id[BCF_DT_ID][idx].key, key_len[idx], s);
        }
    } else kputc_('.', s);

    kputc_('\t', s); // INFO
    if (v->n_info) {
        uint8_t *ptr = v->shared.s
            ? (uint8_t *)v->shared.s + v->unpack_size[0] +
               v->unpack_size[1] + v->unpack_size[2]
            : NULL;
        int first = 1;
        bcf_info_t *info = v->d.info;

        // Note if we duplicate this code into custom packed and unpacked
        // implementations then we gain a bit more speed, particularly with
        // clang 13 (up to 5%).  Not sure why this is, but code duplication
        // isn't pleasant and it's still faster adding packed support than
        // not so it's a win, just not as good as it should be.
        const int info_packed = !(v->unpacked & BCF_UN_INFO) && v->shared.l;
        for (i = 0; i < v->n_info; ++i) {
            bcf_info_t in, *z;
            if (info_packed) {
                // Use a local bcf_info_t when data is packed
                z = &in;
                z->key  = bcf_dec_typed_int1(ptr, &ptr);
                z->len  = bcf_dec_size(ptr, &ptr, &z->type);
                z->vptr = ptr;
                ptr += z->len << bcf_type_shift[z->type];
            } else {
                // Else previously unpacked INFO struct
                z = &info[i];

                // Also potentially since deleted
                if ( !z->vptr ) continue;
            }

            bcf_idpair_t *id = z->key >= 0 && z->key < max_dt_id
                ? &h->id[BCF_DT_ID][z->key]
                : NULL;

            if (!id || !id->key) {
                hts_log_error("Invalid BCF, the INFO tag id=%d is %s at %s:%"PRIhts_pos,
                              z->key,
                              z->key < 0 ? "negative"
                              : (z->key >= max_dt_id ? "too large" : "not present in the header"),
                              bcf_seqname_safe(h, v), v->pos+1);
                errno = EINVAL;
                return -1;
            }

            // KEY
            if (!key_len[z->key])
                key_len[z->key] = strlen(id->key);
            size_t id_len = key_len[z->key];
            if (ks_resize(s, s->l + 3 + id_len) < 0)
                return -1;
            char *sptr = s->s + s->l;
            if ( !first ) {
                *sptr++ = ';';
                s->l++;
            }
            first = 0;
            memcpy(sptr, id->key, id_len);
            s->l += id_len;

            // VALUE
            if (z->len <= 0) continue;
            sptr[id_len] = '=';
            s->l++;

            if (z->len != 1 || info_packed) {
                bcf_fmt_array(s, z->len, z->type, z->vptr);
            } else {
                // Single length vectors are unpacked into their
                // own info.v1 union and handled separately.
                if (z->type == BCF_BT_FLOAT) {
                    if ( bcf_float_is_missing(z->v1.f) )
                        kputc_('.', s);
                    else
                        kputd(z->v1.f, s);
                } else if (z->type == BCF_BT_CHAR) {
                    kputc_(z->v1.i, s);
                } else if (z->type < BCF_BT_INT64) {
                    int64_t missing[] = {
                        0, // BCF_BT_NULL
                        bcf_int8_missing,
                        bcf_int16_missing,
                        bcf_int32_missing,
                    };
                    if (z->v1.i == missing[z->type])
                        kputc_('.', s);
                    else
                        kputw(z->v1.i, s);
                } else if (z->type == BCF_BT_INT64) {
                    if (z->v1.i == bcf_int64_missing)
                        kputc_('.', s);
                    else
                        kputll(z->v1.i, s);
                } else {
                    hts_log_error("Unexpected type %d at %s:%"PRIhts_pos, z->type, bcf_seqname_safe(h, v), v->pos+1);
                    errno = EINVAL;
                    return -1;
                }
            }
        }
        if ( first ) kputc_('.', s);
    } else kputc_('.', s);

    // FORMAT and individual information
    if (v->n_sample) {
        int i,j;
        if ( v->n_fmt) {
            uint8_t *ptr = (uint8_t *)v->indiv.s;
            int gt_i = -1;
            bcf_fmt_t *fmt = v->d.fmt;
            int first = 1, ret = 0;
            int fmt_packed = !(v->unpacked & BCF_UN_FMT);

            if (fmt_packed) {
                // Local fmt as we have an array of num FORMAT keys,
                // each of which points to N.Sample values.

                // No real gain to be had in handling unpacked data here,
                // but it doesn't cost us much in complexity either and
                // it gives us flexibility.
                fmt = malloc(v->n_fmt * sizeof(*fmt));
                if (!fmt)
                    return -1;
            }

            // KEYS
            for (i = 0; i < (int)v->n_fmt; ++i) {
                bcf_fmt_t *z;
                z = &fmt[i];
                if (fmt_packed) {
                    z->id   = bcf_dec_typed_int1(ptr, &ptr);
                    z->n    = bcf_dec_size(ptr, &ptr, &z->type);
                    z->p    = ptr;
                    z->size = z->n << bcf_type_shift[z->type];
                    ptr += v->n_sample * z->size;
                }
                if ( !z->p ) continue;
                kputc_(!first ? ':' : '\t', s); first = 0;

                bcf_idpair_t *id = z->id >= 0 && z->id < max_dt_id
                    ? &h->id[BCF_DT_ID][z->id]
                    : NULL;

                if (!id || !id->key) {
                    hts_log_error("Invalid BCF, the FORMAT tag id=%d at %s:%"PRIhts_pos" not present in the header", z->id, bcf_seqname_safe(h, v), v->pos+1);
                    errno = EINVAL;
                    if (fmt_packed)
                        free(fmt);
                    return -1;
                }

                if (!key_len[z->id])
                    key_len[z->id] = strlen(id->key);
                size_t id_len = key_len[z->id];
                kputsn(id->key, id_len, s);
                if (id_len == 2 && id->key[0] == 'G' && id->key[1] == 'T')
                    gt_i = i;
            }
            if ( first ) kputsn("\t.", 2, s);

            // VALUES per sample
            for (j = 0; j < v->n_sample; ++j) {
                kputc_('\t', s);
                first = 1;
                bcf_fmt_t *f = fmt;
                for (i = 0; i < (int)v->n_fmt; i++, f++) {
                    if ( !f->p ) continue;
                    if (!first) kputc_(':', s);
                    first = 0;
                    if (gt_i == i) {
                        if ((ret = bcf_format_gt_v2(h, f,j,s)) < 0) {
                            hts_log_error("Failed to format GT value for sample %d, returned %d", i, ret);
                            errno = EINVAL;
                            if (fmt_packed)
                                free(fmt);
                            return -1;
                        }
                        break;
                    }
                    else if (f->n == 1)
                        bcf_fmt_array1(s, f->type, f->p + j * (size_t)f->size);
                    else
                        bcf_fmt_array(s, f->n, f->type, f->p + j * (size_t)f->size);
                }

                // Simpler loop post GT and at least 1 iteration
                for (i++, f++; i < (int)v->n_fmt; i++, f++) {
                    if ( !f->p ) continue;
                    kputc_(':', s);
                    if (f->n == 1)
                        bcf_fmt_array1(s, f->type, f->p + j * (size_t)f->size);
                    else
                        bcf_fmt_array(s, f->n, f->type, f->p + j * (size_t)f->size);
                }
                if ( first ) kputc_('.', s);
            }
            if (fmt_packed)
                free(fmt);
        }
        else
            for (j=0; j<=v->n_sample; j++)
                kputsn("\t.", 2, s);
    }
    kputc('\n', s);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
movl (%rdi), %eax
movl %eax, 0x34(%rsp)
callq 0x2c099
testq %rax, %rax
je 0x2b7c2
movq %rax, %rbx
pushq $0x3
popq %rsi
movq %r14, %rdi
callq 0x2b198
movq %r12, %r13
movq 0x28(%r12), %r12
movq 0x30(%r12), %rax
movq %rax, 0x18(%rsp)
testq %rax, %rax
jne 0x2b74d
movslq (%r13), %rdi
incq %rdi
pushq $0x8
popq %rsi
callq 0x42f0
movq %rax, 0x30(%r12)
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x2bcdf
movq %r13, 0x20(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2783f
pushq $0x9
popq %rbx
movl %ebx, %edi
movq %r15, %rsi
callq 0x284c4
movq (%r14), %rdi
incq %rdi
movq %r15, %rsi
callq 0x2c0c7
movl %ebx, %edi
movq %r15, %rsi
callq 0x284c4
movq 0x78(%r14), %rax
testq %rax, %rax
leaq 0x5b43b(%rip), %rdi     # 0x86bcb
cmovneq %rax, %rdi
movq %r15, %rsi
callq 0x2783f
movl %ebx, %edi
movq %r15, %rsi
callq 0x284c4
cmpw $0x0, 0x1a(%r14)
je 0x2b7e3
movq 0x88(%r14), %rax
movq (%rax), %rdi
movq %r15, %rsi
callq 0x2783f
jmp 0x2b7ee
movl 0x10(%r14), %ecx
leaq 0x5b2e5(%rip), %rsi     # 0x86ab2
leaq 0x5b2e9(%rip), %rdx     # 0x86abd
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x8132
jmp 0x2bcd4
pushq $0x2e
popq %rdi
movq %r15, %rsi
callq 0x284c4
pushq $0x9
popq %rdi
movq %r15, %rsi
callq 0x284c4
movq 0x18(%r14), %rax
testl $0xfffe0000, %eax       # imm = 0xFFFE0000
je 0x2b83f
pushq $0x1
popq %r12
pushq $0x2c
popq %rbx
shrl $0x10, %eax
cmpq %rax, %r12
jae 0x2b84a
cmpq $0x2, %r12
jb 0x2b823
movl %ebx, %edi
movq %r15, %rsi
callq 0x284c4
movq 0x88(%r14), %rax
movq (%rax,%r12,8), %rdi
movq %r15, %rsi
callq 0x2783f
incq %r12
movq 0x18(%r14), %rax
jmp 0x2b80b
pushq $0x2e
popq %rdi
movq %r15, %rsi
callq 0x284c4
pushq $0x9
popq %rdi
movq %r15, %rsi
callq 0x284c4
movd 0x14(%r14), %xmm0
movd %xmm0, %eax
cmpl %eax, 0x83cab(%rip)     # 0xaf510
jne 0x2b874
pushq $0x2e
popq %rdi
movq %r15, %rsi
callq 0x284c4
jmp 0x2b880
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x68b28
pushq $0x9
popq %rdi
movq %r15, %rsi
callq 0x284c4
movl 0x68(%r14), %eax
testl %eax, %eax
je 0x2b956
xorl %ebp, %ebp
pushq $0x3b
popq %rbx
cltq
cmpq %rax, %rbp
jge 0x2b961
movq 0x70(%r14), %rax
movslq (%rax,%rbp,4), %r12
testq %r12, %r12
js 0x2b927
cmpl 0x34(%rsp), %r12d
jge 0x2b927
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq %r12, %r13
shlq $0x4, %r13
cmpq $0x0, (%rax,%r13)
je 0x2b927
testq %rbp, %rbp
je 0x2b8ea
movl %ebx, %edi
movq %r15, %rsi
callq 0x284c4
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rcx
movq (%rcx,%r12,8), %rsi
movq (%rax,%r13), %r13
testq %rsi, %rsi
jne 0x2b910
movq %r13, %rdi
callq 0x41c0
movq %rax, %rsi
movq 0x18(%rsp), %rax
movq %rsi, (%rax,%r12,8)
movq %r13, %rdi
movq %r15, %rdx
callq 0x2787b
incq %rbp
movl 0x68(%r14), %eax
jmp 0x2b89c
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x27650
movq (%r14), %r9
incq %r9
leaq 0x5b171(%rip), %rsi     # 0x86ab2
leaq 0x5b1a9(%rip), %rdx     # 0x86af1
pushq $0x1
popq %rdi
movl %r12d, %ecx
movq %rax, %r8
jmp 0x2bccd
pushq $0x2e
popq %rdi
movq %r15, %rsi
callq 0x284c4
pushq $0x9
popq %rdi
movq %r15, %rsi
callq 0x284c4
movzwl 0x18(%r14), %eax
testq %rax, %rax
je 0x2bc08
movq 0x30(%r14), %rcx
testq %rcx, %rcx
je 0x2b9a3
movslq 0xc0(%r14), %rdx
addq %rdx, %rcx
movslq 0xc4(%r14), %rdx
movslq 0xc8(%r14), %rsi
addq %rdx, %rsi
addq %rcx, %rsi
jmp 0x2b9a5
xorl %esi, %esi
movq %rsi, 0x40(%rsp)
movq %rsi, 0x58(%rsp)
testb $0x4, 0xbc(%r14)
jne 0x2b9c3
cmpq $0x0, 0x20(%r14)
setne %bl
jmp 0x2b9c5
xorl %ebx, %ebx
pushq $0x1
popq %rcx
movl %ecx, 0x14(%rsp)
movq 0x90(%r14), %rbp
xorl %r13d, %r13d
movl %ebx, 0x38(%rsp)
movzwl %ax, %eax
cmpq %rax, %r13
jae 0x2bc01
testb %bl, %bl
je 0x2ba4a
movq 0x40(%rsp), %rdi
leaq 0x58(%rsp), %r12
movq %r12, %rsi
callq 0x2c18d
movl %eax, 0x60(%rsp)
movq 0x58(%rsp), %rdi
movq %r12, %rsi
leaq 0x64(%rsp), %rdx
callq 0x2855d
movl %eax, 0x80(%rsp)
movq 0x58(%rsp), %rdx
movq %rdx, 0x70(%rsp)
movslq 0x64(%rsp), %rcx
leaq 0x83af1(%rip), %rsi     # 0xaf520
movb (%rcx,%rsi), %cl
shll %cl, %eax
cltq
addq %rdx, %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %rdx
jmp 0x2ba58
cmpq $0x0, 0x10(%rbp)
movq %rbp, %rdx
je 0x2bbda
movl (%rdx), %ecx
movl %ecx, %r12d
cmpl 0x34(%rsp), %ecx
setl %al
testl %ecx, %ecx
js 0x2bc7a
testb %al, %al
je 0x2bc7a
movq %r13, 0x28(%rsp)
movq %rbp, %r13
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rbp
testq %rbp, %rbp
je 0x2bbf5
movq %r12, %rax
shlq $0x4, %rax
addq %rax, %rbp
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x2bbf5
movq %rdx, 0x48(%rsp)
movq 0x18(%rsp), %rax
movq (%rax,%r12,8), %rbx
testq %rbx, %rbx
jne 0x2bac9
callq 0x41c0
movq %rax, %rbx
movq 0x18(%rsp), %rax
movq %rbx, (%rax,%r12,8)
movq (%r15), %rax
leaq (%rbx,%rax), %rsi
addq $0x3, %rsi
movq %r15, %rdi
callq 0x2811b
testl %eax, %eax
js 0x2bcdf
movq 0x10(%r15), %r12
addq (%r15), %r12
cmpl $0x0, 0x14(%rsp)
jne 0x2bafd
movb $0x3b, (%r12)
incq %r12
incq (%r15)
movq (%rbp), %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, (%r15)
movl $0x0, 0x14(%rsp)
movq 0x48(%rsp), %rcx
cmpl $0x0, 0x20(%rcx)
jle 0x2bb55
movb $0x3d, (%r12,%rbx)
incq (%r15)
movl 0x20(%rcx), %esi
cmpl $0x1, %esi
setne %al
movl 0x38(%rsp), %ebx
orb %bl, %al
movslq 0x4(%rcx), %r12
testb $0x1, %al
movq %r13, %rbp
je 0x2bb63
movq 0x10(%rcx), %rcx
movq %r15, %rdi
movl %r12d, %edx
callq 0x2824c
jmp 0x2bb5c
movl 0x38(%rsp), %ebx
movq %r13, %rbp
movq 0x28(%rsp), %r13
jmp 0x2bbda
cmpl $0x7, %r12d
movq 0x28(%rsp), %r13
je 0x2bb93
cmpl $0x5, %r12d
jne 0x2bb98
movd 0x8(%rcx), %xmm0
movd %xmm0, %eax
cmpl %eax, 0x8398d(%rip)     # 0xaf510
je 0x2bbcf
cvtss2sd %xmm0, %xmm0
movq %r15, %rdi
callq 0x68b28
jmp 0x2bbda
movl 0x8(%rcx), %edi
jmp 0x2bbd2
cmpl $0x3, %r12d
jg 0x2bbb9
movq 0x8(%rcx), %rdi
leaq 0x5c267(%rip), %rax     # 0x87e10
cmpq (%rax,%r12,8), %rdi
je 0x2bbcf
movq %r15, %rsi
callq 0x22eac
jmp 0x2bbda
cmpl $0x4, %r12d
jne 0x2c073
movq 0x8(%rcx), %rdi
movq %rdi, %rax
negq %rax
jno 0x2bbeb
pushq $0x2e
popq %rdi
movq %r15, %rsi
callq 0x284c4
incq %r13
movzwl 0x18(%r14), %eax
addq $0x28, %rbp
jmp 0x2b9da
movq %r15, %rsi
callq 0x2c0c7
jmp 0x2bbda
leaq 0x5aedb(%rip), %rbx     # 0x86ad7
jmp 0x2bc9c
cmpl $0x0, 0x14(%rsp)
je 0x2bc13
pushq $0x2e
popq %rdi
movq %r15, %rsi
callq 0x284c4
movq 0x18(%r14), %r13
movq %r13, %rax
shrq $0x28, %rax
jne 0x2bc32
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x25f76
xorl %eax, %eax
jmp 0x2bce2
movq %r13, %rax
shrq $0x20, %rax
testb %al, %al
je 0x2bcf4
movq 0x48(%r14), %rbx
movq %rbx, 0x60(%rsp)
movl 0xbc(%r14), %eax
movl %eax, 0x28(%rsp)
testb $0x8, %al
jne 0x2bd24
movq %r13, %rdi
shrq $0x1b, %rdi
andl $0x1fe0, %edi           # imm = 0x1FE0
callq 0x46a0
testq %rax, %rax
jne 0x2bd2b
jmp 0x2bcdf
leaq 0x5ae56(%rip), %rcx     # 0x86ad7
leaq 0x577ec(%rip), %rdx     # 0x83474
testb %al, %al
cmovneq %rcx, %rdx
testl %r12d, %r12d
leaq 0x66447(%rip), %rbx     # 0x920df
cmovnsq %rdx, %rbx
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x27650
movq (%r14), %rcx
incq %rcx
movq %rcx, (%rsp)
leaq 0x5adf8(%rip), %rsi     # 0x86ab2
leaq 0x5ae76(%rip), %rdx     # 0x86b37
pushq $0x1
popq %rdi
movl %r12d, %ecx
movq %rbx, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x8132
callq 0x4050
movl $0x16, (%rax)
pushq $-0x1
popq %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
leaq 0x5aecd(%rip), %rbx     # 0x86bca
pushq $0x2
popq %r12
shrq $0x28, %r13
cmpl %r13d, %ebp
ja 0x2bc20
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x2787b
incl %ebp
movq 0x18(%r14), %r13
jmp 0x2bd01
movq 0x98(%r14), %rax
movq %rbx, 0x38(%rsp)
movq %rax, 0x50(%rsp)
leaq 0xc(%rax), %rbp
pushq $0x1
popq %r12
pushq $-0x1
popq %rax
movl %eax, 0x14(%rsp)
xorl %ebx, %ebx
shrq $0x20, %r13
movzbl %r13b, %eax
cmpq %rax, %rbx
jae 0x2bef2
testb $0x8, 0x28(%rsp)
jne 0x2bdbf
movq 0x38(%rsp), %rdi
leaq 0x60(%rsp), %r13
movq %r13, %rsi
callq 0x2c18d
movl %eax, -0xc(%rbp)
movq 0x60(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2855d
movl %eax, -0x8(%rbp)
movq 0x60(%rsp), %rdx
movq %rdx, 0x4(%rbp)
movslq (%rbp), %rcx
leaq 0x83786(%rip), %rsi     # 0xaf520
movb (%rcx,%rsi), %cl
shll %cl, %eax
movl %eax, -0x4(%rbp)
movq 0x18(%r14), %rcx
shrq $0x28, %rcx
imull %eax, %ecx
movslq %ecx, %rax
addq %rdx, %rax
movq %rax, 0x38(%rsp)
movq %rax, 0x60(%rsp)
jmp 0x2bdc3
movq 0x4(%rbp), %rdx
testq %rdx, %rdx
je 0x2be8c
movq %rbx, 0x48(%rsp)
testl %r12d, %r12d
pushq $0x9
popq %rdi
pushq $0x3a
popq %rax
cmovel %eax, %edi
movq %r15, %rsi
callq 0x284c4
movslq -0xc(%rbp), %r12
testq %r12, %r12
js 0x2be9c
cmpl 0x34(%rsp), %r12d
jge 0x2be9c
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x2be9c
movq %r12, %rax
shlq $0x4, %rax
addq %rax, %rbx
movq (%rbx), %r13
testq %r13, %r13
je 0x2be9c
movq %rbp, 0x40(%rsp)
movq 0x18(%rsp), %rax
movq (%rax,%r12,8), %rbp
testq %rbp, %rbp
jne 0x2be48
movq %r13, %rdi
callq 0x41c0
movq %rax, %rbp
movq 0x18(%rsp), %rax
movq %rbp, (%rax,%r12,8)
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x2787b
xorl %r12d, %r12d
cmpq $0x2, %rbp
jne 0x2be82
movq (%rbx), %rax
cmpb $0x47, (%rax)
movq 0x40(%rsp), %rbp
jne 0x2be87
cmpb $0x54, 0x1(%rax)
movl 0x14(%rsp), %eax
movq 0x48(%rsp), %rbx
cmovel %ebx, %eax
movl %eax, 0x14(%rsp)
jmp 0x2be8c
movq 0x40(%rsp), %rbp
movq 0x48(%rsp), %rbx
incq %rbx
movq 0x18(%r14), %r13
addq $0x20, %rbp
jmp 0x2bd46
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x27650
movq (%r14), %r9
incq %r9
leaq 0x5abfc(%rip), %rsi     # 0x86ab2
leaq 0x5acc7(%rip), %rdx     # 0x86b84
pushq $0x1
popq %rdi
movl %r12d, %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0x8132
callq 0x4050
movl $0x16, (%rax)
testb $0x8, 0x28(%rsp)
movq 0x50(%rsp), %rdi
jne 0x2bcdf
callq 0x45c0
jmp 0x2bcdf
testl %r12d, %r12d
je 0x2bf09
leaq 0x5accc(%rip), %rdi     # 0x86bca
pushq $0x2
popq %rsi
movq %r15, %rdx
callq 0x2787b
xorl %ebx, %ebx
pushq $0x3a
popq %r13
movq 0x18(%r14), %rax
shrq $0x28, %rax
cmpq %rax, %rbx
jae 0x2c035
pushq $0x9
popq %rdi
movq %r15, %rsi
callq 0x284c4
xorl %ebp, %ebp
pushq $0x1
popq %rax
movq 0x50(%rsp), %r12
movzbl 0x1c(%r14), %ecx
cmpl %ecx, %ebp
jae 0x2bf96
cmpq $0x0, 0x10(%r12)
je 0x2bf8e
testl %eax, %eax
jne 0x2bf55
movl %r13d, %edi
movq %r15, %rsi
callq 0x284c4
cmpl %ebp, 0x14(%rsp)
je 0x2bf9f
movl 0x4(%r12), %esi
movl 0xc(%r12), %edx
movslq 0x8(%r12), %rcx
imulq %rbx, %rcx
addq 0x10(%r12), %rcx
movq %r15, %rdi
cmpl $0x1, %esi
jne 0x2bf87
movl %edx, %esi
movq %rcx, %rdx
callq 0x2c4f0
jmp 0x2bf8c
callq 0x2824c
xorl %eax, %eax
incl %ebp
addq $0x20, %r12
jmp 0x2bf35
testl %eax, %eax
sete 0x18(%rsp)
jmp 0x2bfc2
movq 0x20(%rsp), %rdi
movq %r12, %rsi
movl %ebx, %edx
movq %r15, %rcx
callq 0x2c19e
movb $0x1, 0x18(%rsp)
movl 0x14(%rsp), %ebp
testl %eax, %eax
js 0x2c04f
incl %ebp
addq $0x30, %r12
movzbl 0x1c(%r14), %eax
cmpl %eax, %ebp
jae 0x2c01b
cmpq $0x0, (%r12)
je 0x2c013
movl %r13d, %edi
movq %r15, %rsi
callq 0x284c4
movl -0xc(%r12), %esi
movl -0x4(%r12), %edx
movslq -0x8(%r12), %rcx
imulq %rbx, %rcx
addq (%r12), %rcx
movq %r15, %rdi
cmpl $0x1, %esi
jne 0x2c00e
movl %edx, %esi
movq %rcx, %rdx
callq 0x2c4f0
jmp 0x2c013
callq 0x2824c
incl %ebp
addq $0x20, %r12
jmp 0x2bfc8
cmpb $0x0, 0x18(%rsp)
jne 0x2c02d
pushq $0x2e
popq %rdi
movq %r15, %rsi
callq 0x284c4
incq %rbx
jmp 0x2bf0f
testb $0x8, 0x28(%rsp)
jne 0x2bc20
movq 0x50(%rsp), %rdi
callq 0x45c0
jmp 0x2bc20
leaq 0x5aa5c(%rip), %rsi     # 0x86ab2
leaq 0x5ab70(%rip), %rdx     # 0x86bcd
pushq $0x1
popq %rdi
movl 0x14(%rsp), %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x8132
jmp 0x2becd
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x27650
movq (%r14), %r9
incq %r9
leaq 0x5aa25(%rip), %rsi     # 0x86ab2
leaq 0x5aad3(%rip), %rdx     # 0x86b67
jmp 0x2b948