// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/htscodecs/htscodecs/fqzcomp_qual.c
// Function: fqz_pick_parameters
static inline
int fqz_pick_parameters(fqz_gparams *gp,
                        int vers,
                        int strat,
                        fqz_slice *s,
                        unsigned char *in,
                        size_t in_size) {
    //approx sqrt(delta), must be sequential
    int dsqr[] = {
        0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
        4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5,
        5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
        6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
    };
    uint32_t qhist[256] = {0};

    if (strat >= nstrats) strat = nstrats-1;

    // Start with 1 set of parameters.
    // FIXME: add support for multiple params later.
    memset(gp, 0, sizeof(*gp));
    gp->vers = FQZ_VERS;

    if (!(gp->p = calloc(1, sizeof(fqz_param))))
        return -1;
    gp->nparam = 1;
    gp->max_sel = 0;

    if (vers == 3) // V3.0 doesn't store qual in original orientation
        gp->gflags |= GFLAG_DO_REV;

    fqz_param *pm = gp->p;

    // Programmed strategies, which we then amend based on our
    // statistical analysis of the quality stream.
    pm->qbits  = strat_opts[strat][0];
    pm->qshift = strat_opts[strat][1];
    pm->pbits  = strat_opts[strat][2];
    pm->pshift = strat_opts[strat][3];
    pm->dbits  = strat_opts[strat][4];
    pm->dshift = strat_opts[strat][5];
    pm->qloc   = strat_opts[strat][6];
    pm->sloc   = strat_opts[strat][7];
    pm->ploc   = strat_opts[strat][8];
    pm->dloc   = strat_opts[strat][9];

    // Params for controlling behaviour here.
    pm->do_r2 = strat_opts[strat][10];
    pm->do_qa = strat_opts[strat][11];

    // Validity check input lengths and buffer size
    size_t tlen = 0, i;
    for (i = 0; i < s->num_records; i++) {
        if (tlen + s->len[i] > in_size)
            // Oversized buffer
            s->len[i] = in_size - tlen;
        tlen += s->len[i];
    }
    if (s->num_records > 0 && tlen < in_size)
        // Undersized buffer
        s->len[s->num_records-1] += in_size - tlen;

    // Quality metrics, for all recs
    fqz_qual_stats(s, in, in_size, pm, qhist, -1);

    pm->store_qmap = (pm->nsym <= 8 && pm->nsym*2 < pm->max_sym);

    // Check for fixed length.
    uint32_t first_len = s->len[0];
    for (i = 1; i < s->num_records; i++) {
        if (s->len[i] != first_len)
            break;
    }
    pm->fixed_len = (i == s->num_records);
    pm->use_qtab = 0; // unused by current encoder

    if (strat >= nstrats-1)
        goto manually_set; // used in TEST_MAIN for debugging

    if (pm->pshift < 0)
        pm->pshift = MAX(0, log((double)s->len[0]/(1<<pm->pbits))/log(2)+.5);

    if (pm->nsym <= 4) {
        // NovaSeq
        pm->qshift = 2; // qmax 64, although we can store up to 256 if needed
        if (in_size < 5000000) {
            pm->pbits =2;
            pm->pshift=5;
        }
    } else if (pm->nsym <= 8) {
        // HiSeqX
        pm->qbits =MIN(pm->qbits,9);
        pm->qshift=3;
        if (in_size < 5000000)
            pm->qbits =6;
    }

    if (in_size < 300000) {
        pm->qbits=pm->qshift;
        pm->dbits=2;
    }

 manually_set:
//    fprintf(stderr, "-x 0x%x%x%x%x%x%x%x%x%x%x%x%x\n",
//          pm->qbits, pm->qshift,
//          pm->pbits, pm->pshift,
//          pm->dbits, pm->dshift,
//          pm->qloc, pm->sloc, pm->ploc, pm->dloc,
//          pm->do_r2, pm->do_qa);

    for (i = 0; i < sizeof(dsqr)/sizeof(*dsqr); i++)
        if (dsqr[i] > (1<<pm->dbits)-1)
            dsqr[i] = (1<<pm->dbits)-1;

    if (pm->store_qmap) {
        int j;
        for (i = j = 0; i < 256; i++)
            if (qhist[i])
                pm->qmap[i] = j++;
            else
                pm->qmap[i] = INT_MAX;
        pm->max_sym = pm->nsym;
    } else {
        pm->nsym = 255;
        for (i = 0; i < 256; i++)
            pm->qmap[i] = i;
    }
    if (gp->max_sym < pm->max_sym)
        gp->max_sym = pm->max_sym;

    // Produce ptab from pshift.
    if (pm->qbits) {
        for (i = 0; i < 256; i++) {
            pm->qtab[i] = i; // 1:1

            // Alternative mappings:
            //qtab[i] = i > 30 ? MIN(max_sym,i)-15 : i/2;  // eg for 9827 BAM
        }

    }
    pm->qmask = (1<<pm->qbits)-1;

    if (pm->pbits) {
        for (i = 0; i < 1024; i++)
            pm->ptab[i] = MIN((1<<pm->pbits)-1, i>>pm->pshift);

        // Alternatively via analysis of quality distributions we
        // may select a bunch of positions that are special and
        // have a non-uniform ptab[].
        // Manual experimentation on a NovaSeq run saved 2.8% here.
    }

    if (pm->dbits) {
        for (i = 0; i < 256; i++)
            pm->dtab[i] = dsqr[MIN(sizeof(dsqr)/sizeof(*dsqr)-1, i>>pm->dshift)];
    }

    pm->use_ptab = (pm->pbits > 0);
    pm->use_dtab = (pm->dbits > 0);

    pm->pflags =
        (pm->use_qtab   ?PFLAG_HAVE_QTAB :0)|
        (pm->use_dtab   ?PFLAG_HAVE_DTAB :0)|
        (pm->use_ptab   ?PFLAG_HAVE_PTAB :0)|
        (pm->do_sel     ?PFLAG_DO_SEL    :0)|
        (pm->fixed_len  ?PFLAG_DO_LEN    :0)|
        (pm->do_dedup   ?PFLAG_DO_DEDUP  :0)|
        (pm->store_qmap ?PFLAG_HAVE_QMAP :0);

    gp->max_sel = 0;
    if (pm->do_sel) {
        // 2 selectors values, but 1 parameter block.
        // We'll use the sloc instead to encode the selector bits into
        // the context.
        gp->max_sel = 1; // indicator to check recs
        gp->gflags |= GFLAG_HAVE_STAB;
        // NB: stab is already all zero
    }

    if (gp->max_sel && s->num_records) {
        int max = 0;
        for (i = 0; i < s->num_records; i++) {
            if (max < (s->flags[i] >> 16))
                max = (s->flags[i] >> 16);
        }
        gp->max_sel = max;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x590, %rsp            # imm = 0x590
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
leaq -0x130(%rbp), %rdi
leaq 0x6cb21(%rip), %rsi     # 0xf62a0
movl $0x100, %edx            # imm = 0x100
callq 0x43b0
leaq -0x530(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x4250
movl -0x18(%rbp), %eax
cmpl 0x8432b(%rip), %eax     # 0x10dad0
jl 0x897b3
movl 0x84323(%rip), %eax     # 0x10dad0
subl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x420, %edx            # imm = 0x420
callq 0x4250
movq -0x10(%rbp), %rax
movl $0x5, (%rax)
movl $0x1, %edi
movl $0x1c64, %esi           # imm = 0x1C64
callq 0x42f0
movq -0x10(%rbp), %rcx
movq %rax, 0x418(%rcx)
cmpq $0x0, %rax
jne 0x897f9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8a315
movq -0x10(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
cmpl $0x3, -0x14(%rbp)
jne 0x89822
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movq 0x418(%rax), %rax
movq %rax, -0x538(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x842a1(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84283(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c48(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84261(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x24(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84242(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c4c(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84220(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x2c(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84201(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c50(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x841df(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x20(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x841c0(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x38(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x841a1(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x28(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84182(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x24(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x30(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84163(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c5c(%rax)
movslq -0x18(%rbp), %rcx
leaq 0x84141(%rip), %rax     # 0x10dae0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x2c(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c60(%rax)
movq $0x0, -0x540(%rbp)
movq $0x0, -0x548(%rbp)
movq -0x548(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jae 0x89a57
movq -0x540(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x548(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
addq %rcx, %rax
cmpq -0x30(%rbp), %rax
jbe 0x89a20
movq -0x30(%rbp), %rax
subq -0x540(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x548(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x548(%rbp), %rcx
movl (%rax,%rcx,4), %eax
addq -0x540(%rbp), %rax
movq %rax, -0x540(%rbp)
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x899cc
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x89a95
movq -0x540(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x89a95
movq -0x30(%rbp), %rsi
subq -0x540(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
addq %rsi, %rdx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x538(%rbp), %rcx
leaq -0x530(%rbp), %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0x86540
movq -0x538(%rbp), %rcx
xorl %eax, %eax
cmpl $0x8, 0x40(%rcx)
movb %al, -0x555(%rbp)
jg 0x89aee
movq -0x538(%rbp), %rax
movl 0x40(%rax), %eax
shll %eax
movq -0x538(%rbp), %rcx
cmpl 0x3c(%rcx), %eax
setl %al
movb %al, -0x555(%rbp)
movb -0x555(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %eax
movl %eax, -0x54c(%rbp)
movq $0x1, -0x548(%rbp)
movq -0x548(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jae 0x89b63
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x548(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x54c(%rbp), %eax
je 0x89b4d
jmp 0x89b63
jmp 0x89b4f
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x89b1e
movq -0x548(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x538(%rbp), %rax
movb $0x0, 0x18(%rax)
movl -0x18(%rbp), %eax
movl 0x83f36(%rip), %ecx     # 0x10dad0
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x89ba6
jmp 0x89d98
movq -0x538(%rbp), %rax
cmpl $0x0, 0x1c4c(%rax)
jge 0x89ca8
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %eax
cvtsi2sd %rax, %xmm0
movq -0x538(%rbp), %rax
movl 0x24(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
callq 0x4380
movsd %xmm0, -0x560(%rbp)
movsd 0x6b959(%rip), %xmm0    # 0xf5550
callq 0x4380
movsd -0x560(%rbp), %xmm1
divsd %xmm0, %xmm1
movsd 0x63408(%rip), %xmm0    # 0xed018
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x89c2a
xorps %xmm0, %xmm0
movsd %xmm0, -0x568(%rbp)
jmp 0x89c8f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %eax
cvtsi2sd %rax, %xmm0
movq -0x538(%rbp), %rax
movl 0x24(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
callq 0x4380
movsd %xmm0, -0x570(%rbp)
movsd 0x6b8e9(%rip), %xmm0    # 0xf5550
callq 0x4380
movaps %xmm0, %xmm1
movsd -0x570(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd 0x63395(%rip), %xmm1    # 0xed018
addsd %xmm1, %xmm0
movsd %xmm0, -0x568(%rbp)
movsd -0x568(%rbp), %xmm0
cvttsd2si %xmm0, %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c4c(%rax)
movq -0x538(%rbp), %rax
cmpl $0x4, 0x40(%rax)
jg 0x89cf1
movq -0x538(%rbp), %rax
movl $0x2, 0x1c48(%rax)
cmpq $0x4c4b40, -0x30(%rbp)  # imm = 0x4C4B40
jae 0x89cef
movq -0x538(%rbp), %rax
movl $0x2, 0x24(%rax)
movq -0x538(%rbp), %rax
movl $0x5, 0x1c4c(%rax)
jmp 0x89d67
movq -0x538(%rbp), %rax
cmpl $0x8, 0x40(%rax)
jg 0x89d65
movq -0x538(%rbp), %rax
cmpl $0x9, 0x1c(%rax)
jae 0x89d1d
movq -0x538(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x574(%rbp)
jmp 0x89d2a
movl $0x9, %eax
movl %eax, -0x574(%rbp)
jmp 0x89d2a
movl -0x574(%rbp), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x538(%rbp), %rax
movl $0x3, 0x1c48(%rax)
cmpq $0x4c4b40, -0x30(%rbp)  # imm = 0x4C4B40
jae 0x89d63
movq -0x538(%rbp), %rax
movl $0x6, 0x1c(%rax)
jmp 0x89d65
jmp 0x89d67
cmpq $0x493e0, -0x30(%rbp)   # imm = 0x493E0
jae 0x89d96
movq -0x538(%rbp), %rax
movl 0x1c48(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x538(%rbp), %rax
movl $0x2, 0x2c(%rax)
jmp 0x89d98
movq $0x0, -0x548(%rbp)
cmpq $0x40, -0x548(%rbp)
jae 0x89e0f
movq -0x548(%rbp), %rax
movl -0x130(%rbp,%rax,4), %eax
movq -0x538(%rbp), %rcx
movl 0x2c(%rcx), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x89df9
movq -0x538(%rbp), %rax
movl 0x2c(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
subl $0x1, %ecx
movq -0x548(%rbp), %rax
movl %ecx, -0x130(%rbp,%rax,4)
jmp 0x89dfb
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x89da3
movq -0x538(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x89eba
movl $0x0, -0x550(%rbp)
movq $0x0, -0x548(%rbp)
cmpq $0x100, -0x548(%rbp) # imm = 0x100
jae 0x89ea4
movq -0x548(%rbp), %rax
cmpl $0x0, -0x530(%rbp,%rax,4)
je 0x89e78
movl -0x550(%rbp), %edx
movl %edx, %eax
addl $0x1, %eax
movl %eax, -0x550(%rbp)
movq -0x538(%rbp), %rax
movq -0x548(%rbp), %rcx
movl %edx, 0x48(%rax,%rcx,4)
jmp 0x89e8e
movq -0x538(%rbp), %rax
movq -0x548(%rbp), %rcx
movl $0x7fffffff, 0x48(%rax,%rcx,4) # imm = 0x7FFFFFFF
jmp 0x89e90
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x89e35
movq -0x538(%rbp), %rax
movl 0x40(%rax), %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x3c(%rax)
jmp 0x89f11
movq -0x538(%rbp), %rax
movl $0xff, 0x40(%rax)
movq $0x0, -0x548(%rbp)
cmpq $0x100, -0x548(%rbp) # imm = 0x100
jae 0x89f0f
movq -0x548(%rbp), %rax
movl %eax, %edx
movq -0x538(%rbp), %rax
movq -0x548(%rbp), %rcx
movl %edx, 0x48(%rax,%rcx,4)
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x89ed3
jmp 0x89f11
movq -0x10(%rbp), %rax
movl 0x410(%rax), %eax
movq -0x538(%rbp), %rcx
cmpl 0x3c(%rcx), %eax
jge 0x89f3b
movq -0x538(%rbp), %rax
movl 0x3c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x410(%rax)
movq -0x538(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x89f94
movq $0x0, -0x548(%rbp)
cmpq $0x100, -0x548(%rbp) # imm = 0x100
jae 0x89f92
movq -0x548(%rbp), %rax
movl %eax, %edx
movq -0x538(%rbp), %rax
movq -0x548(%rbp), %rcx
movl %edx, 0x448(%rax,%rcx,4)
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x89f53
jmp 0x89f94
movq -0x538(%rbp), %rax
movl 0x1c(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
subl $0x1, %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x1c58(%rax)
movq -0x538(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0x8a08d
movq $0x0, -0x548(%rbp)
cmpq $0x400, -0x548(%rbp) # imm = 0x400
jae 0x8a08b
movq -0x538(%rbp), %rax
movl 0x24(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
cltq
movq -0x548(%rbp), %rdx
movq -0x538(%rbp), %rcx
movl 0x1c4c(%rcx), %ecx
shrq %cl, %rdx
movq %rdx, %rcx
cmpq %rcx, %rax
jae 0x8a038
movq -0x538(%rbp), %rax
movl 0x24(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
cltq
movq %rax, -0x580(%rbp)
jmp 0x8a056
movq -0x548(%rbp), %rax
movq -0x538(%rbp), %rcx
movl 0x1c4c(%rcx), %ecx
shrq %cl, %rax
movq %rax, -0x580(%rbp)
movq -0x580(%rbp), %rax
movl %eax, %edx
movq -0x538(%rbp), %rax
movq -0x548(%rbp), %rcx
movl %edx, 0x848(%rax,%rcx,4)
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x89fd3
jmp 0x8a08d
movq -0x538(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x8a146
movq $0x0, -0x548(%rbp)
cmpq $0x100, -0x548(%rbp) # imm = 0x100
jae 0x8a144
movq -0x548(%rbp), %rax
movq -0x538(%rbp), %rcx
movl 0x1c50(%rcx), %ecx
shrq %cl, %rax
movq %rax, %rcx
movl $0x3f, %eax
cmpq %rcx, %rax
jae 0x8a0ec
movl $0x3f, %eax
movq %rax, -0x588(%rbp)
jmp 0x8a10a
movq -0x548(%rbp), %rax
movq -0x538(%rbp), %rcx
movl 0x1c50(%rcx), %ecx
shrq %cl, %rax
movq %rax, -0x588(%rbp)
movq -0x588(%rbp), %rax
movl -0x130(%rbp,%rax,4), %edx
movq -0x538(%rbp), %rax
movq -0x548(%rbp), %rcx
movl %edx, 0x1848(%rax,%rcx,4)
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x8a0a9
jmp 0x8a146
movq -0x538(%rbp), %rax
cmpl $0x0, 0x24(%rax)
seta %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x538(%rbp), %rax
movb %cl, 0x1a(%rax)
movq -0x538(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
seta %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x538(%rbp), %rax
movb %cl, 0x19(%rax)
movq -0x538(%rbp), %rax
movzbl 0x18(%rax), %edx
xorl %ecx, %ecx
movl $0x80, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x538(%rbp), %rax
movzbl 0x19(%rax), %esi
xorl %eax, %eax
movl $0x40, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
orl %eax, %ecx
movq -0x538(%rbp), %rax
movzbl 0x1a(%rax), %esi
xorl %eax, %eax
movl $0x20, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
orl %eax, %ecx
movq -0x538(%rbp), %rax
movl 0x8(%rax), %esi
xorl %eax, %eax
movl $0x8, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
orl %eax, %ecx
movq -0x538(%rbp), %rax
movl 0x14(%rax), %esi
xorl %eax, %eax
movl $0x4, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
orl %eax, %ecx
movq -0x538(%rbp), %rax
movl 0xc(%rax), %esi
xorl %eax, %eax
movl $0x2, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
orl %eax, %ecx
movq -0x538(%rbp), %rax
movl 0x10(%rax), %esi
xorl %eax, %eax
movl $0x10, %edx
cmpl $0x0, %esi
cmovnel %edx, %eax
orl %eax, %ecx
movq -0x538(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x538(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x8a26e
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x8a30e
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8a30e
movl $0x0, -0x554(%rbp)
movq $0x0, -0x548(%rbp)
movq -0x548(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jae 0x8a301
movl -0x554(%rbp), %eax
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x548(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shrl $0x10, %ecx
cmpl %ecx, %eax
jae 0x8a2eb
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x548(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shrl $0x10, %eax
movl %eax, -0x554(%rbp)
jmp 0x8a2ed
movq -0x548(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x548(%rbp)
jmp 0x8a29e
movl -0x554(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x590, %rsp            # imm = 0x590
popq %rbp
retq
nopw %cs:(%rax,%rax)