// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x49c60
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x48b40
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
movl $0x1, %edi
leaq 0xbf30b(%rip), %rsi     # 0x107e26
leaq 0xbf30f(%rip), %rdx     # 0x107e31
movb $0x0, %al
callq 0x9d90
callq 0x4050
movl $0x16, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0x48110
movq -0x10(%rbp), %rdi
callq 0x3b020
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x48b98
movq -0x10(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x42e0
movq -0x38(%rbp), %rcx
movq %rax, 0x30(%rcx)
cmpq $0x0, %rax
jne 0x48b96
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
jmp 0x48b98
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43910
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
movq (%rax), %rdi
addq $0x1, %rdi
movq -0x20(%rbp), %rsi
callq 0x49cb0
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0x48bfd
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x128(%rbp)
jmp 0x48c0d
leaq 0xbf33b(%rip), %rax     # 0x107f3f
movq %rax, -0x128(%rbp)
jmp 0x48c0d
movq -0x128(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x43910
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x0, %eax
jle 0x48c5b
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x43910
jmp 0x48c69
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x10, %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x1, %eax
jle 0x48cec
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x10, %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jge 0x48cea
cmpl $0x1, -0x24(%rbp)
jle 0x48cc3
movq -0x20(%rbp), %rsi
movl $0x2c, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x20(%rbp), %rsi
callq 0x43910
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x48c95
jmp 0x48cfa
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
movss 0x14(%rax), %xmm0
callq 0x49e40
cmpl $0x0, %eax
je 0x48d2b
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
jmp 0x48d41
movq -0x18(%rbp), %rax
movss 0x14(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x20(%rbp), %rdi
callq 0xd58f0
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
cmpl $0x0, 0x68(%rax)
je 0x48e90
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jge 0x48e8e
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x48dad
movl -0x44(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x48dad
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
jne 0x48e08
movl -0x44(%rbp), %eax
movl %eax, -0x12c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movl -0x12c(%rbp), %ecx
movq %rax, %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x1, %edi
leaq 0xbf043(%rip), %rsi     # 0x107e26
leaq 0xbf07b(%rip), %rdx     # 0x107e65
movb $0x0, %al
callq 0x9d90
callq 0x4050
movl $0x16, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
cmpl $0x0, -0x24(%rbp)
je 0x48e1c
movq -0x20(%rbp), %rsi
movl $0x3b, %edi
callq 0x452d0
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x48e55
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x41a0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x20(%rbp), %rdx
callq 0x43970
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x48d64
jmp 0x48e9e
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
andq $0xffff, %rax           # imm = 0xFFFF
cmpl $0x0, %eax
je 0x494cd
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x48f09
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x18(%rbp), %rcx
movslq 0xc0(%rcx), %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movslq 0xc4(%rcx), %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movslq 0xc8(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x138(%rbp)
jmp 0x48f14
xorl %eax, %eax
movq %rax, -0x138(%rbp)
jmp 0x48f14
movq -0x138(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x1, -0x54(%rbp)
movq -0x18(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movl 0xbc(%rax), %ecx
andl $0x4, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x139(%rbp)
jne 0x48f61
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
setne %al
movb %al, -0x139(%rbp)
movb -0x139(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x64(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
andq $0xffff, %rcx           # imm = 0xFFFF
cmpl %ecx, %eax
jge 0x494b7
cmpl $0x0, -0x64(%rbp)
je 0x49027
leaq -0x90(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x49e70
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rdi
movq -0x98(%rbp), %rdx
addq $0x4, %rdx
leaq -0x50(%rbp), %rsi
callq 0x454d0
movl %eax, %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x50(%rbp), %rcx
movq -0x98(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x98(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x98(%rbp), %rcx
movslq 0x4(%rcx), %rdx
leaq 0xdc641(%rip), %rcx     # 0x125650
movzbl (%rcx,%rdx), %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x49052
movq -0x60(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x49050
jmp 0x494a9
jmp 0x49052
movq -0x98(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x4908e
movq -0x98(%rbp), %rax
movl (%rax), %eax
cmpl -0x28(%rbp), %eax
jge 0x4908e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x98(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x148(%rbp)
jmp 0x49099
xorl %eax, %eax
movq %rax, -0x148(%rbp)
jmp 0x49099
movq -0x148(%rbp), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x490c2
movq -0xa0(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x4917f
movq -0x98(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14c(%rbp)
movq -0x98(%rbp), %rax
cmpl $0x0, (%rax)
jge 0x490ed
leaq 0xc68ff(%rip), %rax     # 0x10f9e3
movq %rax, -0x158(%rbp)
jmp 0x49114
movq -0x98(%rbp), %rax
movl (%rax), %edx
movl -0x28(%rbp), %esi
leaq 0xbed4b(%rip), %rax     # 0x107e4b
leaq 0xbb399(%rip), %rcx     # 0x1044a0
cmpl %esi, %edx
cmovgeq %rcx, %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movl -0x14c(%rbp), %ecx
movq -0x160(%rbp), %r8
movq %rax, %r9
movq -0x18(%rbp), %rax
movq (%rax), %rax
addq $0x1, %rax
movl $0x1, %edi
leaq 0xbecd0(%rip), %rsi     # 0x107e26
leaq 0xbed4e(%rip), %rdx     # 0x107eab
movq %rax, (%rsp)
movb $0x0, %al
callq 0x9d90
callq 0x4050
movl $0x16, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
movq -0x40(%rbp), %rax
movq -0x98(%rbp), %rcx
movslq (%rcx), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x491b8
movq -0xa0(%rbp), %rax
movq (%rax), %rdi
callq 0x41a0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movq -0x98(%rbp), %rcx
movslq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq -0x98(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
addq $0x3, %rsi
addq -0xa8(%rbp), %rsi
callq 0x44ba0
cmpl $0x0, %eax
jge 0x491fd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
addq (%rcx), %rax
movq %rax, -0xb0(%rbp)
cmpl $0x0, -0x54(%rbp)
jne 0x4923f
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0xb0(%rbp)
movb $0x3b, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movl $0x0, -0x54(%rbp)
movq -0xb0(%rbp), %rdi
movq -0xa0(%rbp), %rax
movq (%rax), %rsi
movq -0xa8(%rbp), %rdx
callq 0x43b0
movq -0xa8(%rbp), %rcx
movq -0x20(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jg 0x49286
jmp 0x494a9
movq -0xb0(%rbp), %rax
movq -0xa8(%rbp), %rcx
movb $0x3d, (%rax,%rcx)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x492b9
cmpl $0x0, -0x64(%rbp)
je 0x492e6
movq -0x20(%rbp), %rdi
movq -0x98(%rbp), %rax
movl 0x20(%rax), %esi
movq -0x98(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0x44df0
jmp 0x494a7
movq -0x98(%rbp), %rax
cmpl $0x5, 0x4(%rax)
jne 0x49337
movq -0x98(%rbp), %rax
movss 0x8(%rax), %xmm0
callq 0x49e40
cmpl $0x0, %eax
je 0x49319
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
jmp 0x49332
movq -0x98(%rbp), %rax
movss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x20(%rbp), %rdi
callq 0xd58f0
jmp 0x494a5
movq -0x98(%rbp), %rax
cmpl $0x7, 0x4(%rax)
jne 0x4935f
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x452d0
jmp 0x494a3
movq -0x98(%rbp), %rax
cmpl $0x4, 0x4(%rax)
jge 0x493f3
movq 0xbfe19(%rip), %rax     # 0x109190
movq %rax, -0xd0(%rbp)
movq 0xbfe13(%rip), %rax     # 0x109198
movq %rax, -0xc8(%rbp)
movq 0xbfe0d(%rip), %rax     # 0x1091a0
movq %rax, -0xc0(%rbp)
movq 0xbfe07(%rip), %rax     # 0x1091a8
movq %rax, -0xb8(%rbp)
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x98(%rbp), %rcx
movslq 0x4(%rcx), %rcx
cmpq -0xd0(%rbp,%rcx,8), %rax
jne 0x493d8
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
jmp 0x493ee
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x3bac0
jmp 0x494a1
movq -0x98(%rbp), %rax
cmpl $0x4, 0x4(%rax)
jne 0x4943d
movq -0x98(%rbp), %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
cmpq %rcx, 0x8(%rax)
jne 0x49427
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
jmp 0x4943b
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x49cb0
jmp 0x4949f
movq -0x98(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x164(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movl -0x164(%rbp), %ecx
movq %rax, %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x1, %edi
leaq 0xbe9ac(%rip), %rsi     # 0x107e26
leaq 0xbea5a(%rip), %rdx     # 0x107edb
movb $0x0, %al
callq 0x9d90
callq 0x4050
movl $0x16, (%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
jmp 0x494a1
jmp 0x494a3
jmp 0x494a5
jmp 0x494a7
jmp 0x494a9
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x48f76
cmpl $0x0, -0x54(%rbp)
je 0x494cb
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
jmp 0x494db
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x28, %rax
cmpl $0x0, %eax
je 0x49c3f
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
cmpl $0x0, %eax
je 0x49bf5
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0xe0(%rbp)
movl $0xffffffff, -0xe4(%rbp) # imm = 0xFFFFFFFF
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq %rax, -0xf0(%rbp)
movl $0x1, -0xf4(%rbp)
movl $0x0, -0xf8(%rbp)
movq -0x18(%rbp), %rax
movl 0xbc(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xfc(%rbp)
cmpl $0x0, -0xfc(%rbp)
je 0x495b1
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x20, %rax
andq $0xff, %rax
movl %eax, %eax
movl %eax, %edi
shlq $0x5, %rdi
callq 0x4670
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0xf0(%rbp)
jne 0x495af
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
jmp 0x495b1
movl $0x0, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x4989c
movq -0xf0(%rbp), %rax
movslq -0xd4(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
cmpl $0x0, -0xfc(%rbp)
je 0x496ba
movq -0xe0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x49e70
movl %eax, %ecx
movq -0x108(%rbp), %rax
movl %ecx, (%rax)
movq -0xe0(%rbp), %rdi
movq -0x108(%rbp), %rdx
addq $0xc, %rdx
leaq -0xe0(%rbp), %rsi
callq 0x454d0
movl %eax, %ecx
movq -0x108(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xe0(%rbp), %rcx
movq -0x108(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x108(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x108(%rbp), %rcx
movslq 0xc(%rcx), %rdx
leaq 0xdbfd5(%rip), %rcx     # 0x125650
movzbl (%rcx,%rdx), %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x108(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x28, %rax
movl %eax, %ecx
movq -0x108(%rbp), %rax
imull 0x8(%rax), %ecx
movq -0xe0(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0x108(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x496cd
jmp 0x49888
cmpl $0x0, -0xf4(%rbp)
setne %cl
xorb $-0x1, %cl
movl $0x9, %edi
movl $0x3a, %eax
testb $0x1, %cl
cmovnel %eax, %edi
movq -0x20(%rbp), %rsi
callq 0x452d0
movl $0x0, -0xf4(%rbp)
movq -0x108(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x49739
movq -0x108(%rbp), %rax
movl (%rax), %eax
cmpl -0x28(%rbp), %eax
jge 0x49739
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x108(%rbp), %rcx
movslq (%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x170(%rbp)
jmp 0x49744
xorl %eax, %eax
movq %rax, -0x170(%rbp)
jmp 0x49744
movq -0x170(%rbp), %rax
movq %rax, -0x110(%rbp)
cmpq $0x0, -0x110(%rbp)
je 0x49769
movq -0x110(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x497df
movq -0x108(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x174(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x43520
movl -0x174(%rbp), %ecx
movq %rax, %r8
movq -0x18(%rbp), %rax
movq (%rax), %r9
addq $0x1, %r9
movl $0x1, %edi
leaq 0xbe681(%rip), %rsi     # 0x107e26
leaq 0xbe74c(%rip), %rdx     # 0x107ef8
movb $0x0, %al
callq 0x9d90
callq 0x4050
movl $0x16, (%rax)
cmpl $0x0, -0xfc(%rbp)
je 0x497d3
movq -0xf0(%rbp), %rdi
callq 0x45a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
movq -0x40(%rbp), %rax
movq -0x108(%rbp), %rcx
movslq (%rcx), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x49818
movq -0x110(%rbp), %rax
movq (%rax), %rdi
callq 0x41a0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movq -0x108(%rbp), %rcx
movslq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq -0x108(%rbp), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rax
movq (%rax), %rdi
movq -0x118(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x43970
cmpq $0x2, -0x118(%rbp)
jne 0x49886
movq -0x110(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x47, %eax
jne 0x49886
movq -0x110(%rbp), %rax
movq (%rax), %rax
movsbl 0x1(%rax), %eax
cmpl $0x54, %eax
jne 0x49886
movl -0xd4(%rbp), %eax
movl %eax, -0xe4(%rbp)
jmp 0x49888
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x495bb
cmpl $0x0, -0xf4(%rbp)
je 0x498ba
movq -0x20(%rbp), %rdx
leaq 0xbe68e(%rip), %rdi     # 0x107f3e
movl $0x2, %esi
callq 0x43970
movl $0x0, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x28, %rcx
cmpl %ecx, %eax
jge 0x49bde
movq -0x20(%rbp), %rsi
movl $0x9, %edi
callq 0x452d0
movl $0x1, -0xf4(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x120(%rbp)
movl $0x0, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x49a9f
movq -0x120(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x49942
jmp 0x49a79
cmpl $0x0, -0xf4(%rbp)
jne 0x49959
movq -0x20(%rbp), %rsi
movl $0x3a, %edi
callq 0x452d0
movl $0x0, -0xf4(%rbp)
movl -0xe4(%rbp), %eax
cmpl -0xd4(%rbp), %eax
jne 0x499ee
movq -0x10(%rbp), %rdi
movq -0x120(%rbp), %rsi
movl -0xd8(%rbp), %edx
movq -0x20(%rbp), %rcx
callq 0x49eb0
movl %eax, -0xf8(%rbp)
cmpl $0x0, %eax
jge 0x499e9
movl -0xd4(%rbp), %ecx
movl -0xf8(%rbp), %r8d
movl $0x1, %edi
leaq 0xbe477(%rip), %rsi     # 0x107e26
leaq 0xbe58b(%rip), %rdx     # 0x107f41
movb $0x0, %al
callq 0x9d90
callq 0x4050
movl $0x16, (%rax)
cmpl $0x0, -0xfc(%rbp)
je 0x499dd
movq -0xf0(%rbp), %rdi
callq 0x45a0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x49c54
jmp 0x49a9f
movq -0x120(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jne 0x49a34
movq -0x20(%rbp), %rdi
movq -0x120(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rdx
movslq -0xd8(%rbp), %rax
movq -0x120(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq %rcx, %rax
addq %rax, %rdx
callq 0x4a480
jmp 0x49a75
movq -0x20(%rbp), %rdi
movq -0x120(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x120(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0xd8(%rbp), %rax
movq -0x120(%rbp), %r8
movslq 0x8(%r8), %r8
imulq %r8, %rax
addq %rax, %rcx
callq 0x44df0
jmp 0x49a77
jmp 0x49a79
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
movq -0x120(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x120(%rbp)
jmp 0x4990e
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
movq -0x120(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x120(%rbp)
movl -0xd4(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
andq $0xff, %rcx
cmpl %ecx, %eax
jge 0x49bb1
movq -0x120(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x49af4
jmp 0x49b8b
movq -0x20(%rbp), %rsi
movl $0x3a, %edi
callq 0x452d0
movq -0x120(%rbp), %rax
cmpl $0x1, 0x4(%rax)
jne 0x49b48
movq -0x20(%rbp), %rdi
movq -0x120(%rbp), %rax
movl 0xc(%rax), %esi
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rdx
movslq -0xd8(%rbp), %rax
movq -0x120(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq %rcx, %rax
addq %rax, %rdx
callq 0x4a480
jmp 0x49b89
movq -0x20(%rbp), %rdi
movq -0x120(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x120(%rbp), %rax
movl 0xc(%rax), %edx
movq -0x120(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0xd8(%rbp), %rax
movq -0x120(%rbp), %r8
movslq 0x8(%r8), %r8
imulq %r8, %rax
addq %rax, %rcx
callq 0x44df0
jmp 0x49b8b
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
movq -0x120(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x120(%rbp)
jmp 0x49ac0
cmpl $0x0, -0xf4(%rbp)
je 0x49bc8
movq -0x20(%rbp), %rsi
movl $0x2e, %edi
callq 0x452d0
jmp 0x49bca
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x498c4
cmpl $0x0, -0xfc(%rbp)
je 0x49bf3
movq -0xf0(%rbp), %rdi
callq 0x45a0
jmp 0x49c3d
movl $0x0, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x28, %rcx
cmpl %ecx, %eax
jg 0x49c3b
movq -0x20(%rbp), %rdx
leaq 0xbe31e(%rip), %rdi     # 0x107f3e
movl $0x2, %esi
callq 0x43970
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x49bff
jmp 0x49c3d
jmp 0x49c3f
movq -0x20(%rbp), %rsi
movl $0xa, %edi
callq 0x40b10
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq