// File: chhylp123[P]hifiasm/Correct.cpp
// Function: rcall_lidel_variant(kv_ul_ov_t*, overlap_region_alloc*, haplotype_evdience_alloc*, asg64_v*, asg64_v*, unsigned long)
uint64_t rcall_lidel_variant(kv_ul_ov_t *cz, overlap_region_alloc *ol, haplotype_evdience_alloc *hp, asg64_v *idx, asg64_v *idz, uint64_t rid)
{
    // fprintf(stderr, "-0-[M::%s] %.*s\tis_match::%u\n", __func__, (int)Get_NAME_LENGTH(R_INF, ol->list[48].y_id), Get_NAME(R_INF, ol->list[48].y_id), ol->list[48].is_match); 

    uint64_t i, k, zi, zk, nec[2], p, pmm, pmn, bn0 = 0, *ia, in, sv_n = cz->n, svi_n = 0, ovn = 0, m, rm_n; /**overlap_region *z;**/ ul_ov_t ez, *cp;
    hp->length = hp->snp_stat.n = idx->n = idz->n = 0; 
    ///for debug indel
    // fprintf(stderr, "+[M::%s] sv_n::%lu\n", __func__, sv_n);
    for (k = 1, i = 0; k <= sv_n; k++) {
        // fprintf(stderr, "+[M::%s] i::%ld, k::%ld\n", __func__, i, k);
        if (k == sv_n || (cz->a[k].ts) != (cz->a[i].ts)) {
            ///calculate pos
            for (zi = i, nec[0] = nec[1] = 0, idx->n = bn0, pmm = ((uint64_t)-1), pmn = 0; zi < k; zi++) {
                // z = &(ol->list[cz->a[zi].tn]); 
                nec[cz->a[zi].el]++;
                p = cz->a[zi].qs; p <<= 32; p |= ((uint64_t)cz->a[zi].qe);
                kv_push(uint64_t, *idx, p);
                if(pmm == ((uint64_t)-1)) pmm = p;
                if(pmm == p) pmn++;
                // fprintf(stderr, "[M::%s] cid::%u\trid::%u\t%.*s\tq::[%u,%u)\terr::%u\n", __func__, cz->a[zi].ts, z->y_id, (int)Get_NAME_LENGTH(R_INF, z->y_id), Get_NAME(R_INF, z->y_id), cz->a[zi].qs, cz->a[zi].qe, cz->a[zi].qn);
            }
            if(nec[0] < nec[1]) {
                ///calculate pos
                if((pmn <= 0) || (pmn < (idx->n - bn0 - pmn))) {
                    ia = idx->a + bn0; in = idx->n - bn0;
                    if(k - i > 1) radix_sort_bc64(ia, ia + in);
                    for (zk = 1, zi = 0, pmm = ((uint64_t)-1), pmn = 0; zk <= in; zk++) {
                        if((zk == in) || (ia[zi] != ia[zk])) {
                            if((zk - zi) > pmn) {
                                pmn = zk - zi; pmm = ia[zi];
                            }
                            zi = zk;
                        }
                    }
                }

                ez.qs = pmm>>32; ez.qe = (uint32_t)pmm; ez.ts = i; ez.te = k; ez.qn = 0; ez.tn = cz->a[i].ts;
                ///calculate error
                for (zi = i, idx->n = bn0, pmm = ((uint64_t)-1), pmn = 0; zi < k; zi++) {
                    if((cz->a[zi].qs != ez.qs) || (cz->a[zi].qe != ez.qe)) continue;
                    kv_push(uint64_t, *idx, cz->a[zi].qn);
                    if(pmm == ((uint64_t)-1)) pmm = cz->a[zi].qn;
                    if(pmm == cz->a[zi].qn) pmn++;
                }
                if((pmn <= 0) || (pmn < (idx->n - bn0 - pmn))) {
                    ia = idx->a + bn0; in = idx->n - bn0;
                    if(k - i > 1) radix_sort_bc64(ia, ia + in);
                    for (zk = 1, zi = 0, pmm = ((uint64_t)-1), pmn = 0; zk <= in; zk++) {
                        if((zk == in) || (ia[zi] != ia[zk])) {
                            if((zk - zi) > pmn) {
                                pmn = zk - zi; pmm = ia[zi];
                            }
                            zi = zk;
                        }
                    }
                }
                ez.qn = pmm; kv_push(ul_ov_t, *cz, ez);
                
                // fprintf(stderr, "-[M::%s] nec[0]::%ld, nec[1]::%ld, pa::[%u, %u), err::%u\n\n", __func__, nec[0], nec[1], ez.qs, ez.qe, ez.qn);
            }
            
            i = k;
        }
    }
    // fprintf(stderr, "-1-[M::%s] %.*s\tis_match::%u\n", __func__, (int)Get_NAME_LENGTH(R_INF, ol->list[48].y_id), Get_NAME(R_INF, ol->list[48].y_id), ol->list[48].is_match); 

    svi_n = cz->n - sv_n; idx->n = 0;
    gen_ov_lidel_variant(cz, ol, idx, 0); 
    ovn = cz->n - sv_n - svi_n;
    // fprintf(stderr, "-2-[M::%s] %.*s\tis_match::%u\n", __func__, (int)Get_NAME_LENGTH(R_INF, ol->list[48].y_id), Get_NAME(R_INF, ol->list[48].y_id), ol->list[48].is_match); 
    // fprintf(stderr, "+[M::%s] sv_n::%lu, svi_n::%lu, ovn::%lu\n", __func__, sv_n, svi_n, ovn);

    ul_ov_t *sv = cz->a, *svi = cz->a + sv_n, *ov = cz->a + sv_n + svi_n; int64_t s, e, os, oe, q[2];
    radix_sort_ul_ov_srt_qs1(svi, svi + svi_n); 
    for (k = i = 0; k < svi_n; k++) {
        // fprintf(stderr, "\n-3-[M::%s] %.*s\tis_match::%u\n", __func__, (int)Get_NAME_LENGTH(R_INF, ol->list[48].y_id), Get_NAME(R_INF, ol->list[48].y_id), ol->list[48].is_match); 
        ///label matched overlaps
        s = svi[k].qs; e = svi[k].qe;
        for (p = svi[k].ts; p < svi[k].te; p++) {
            // z = &(ol->list[sv[p].tn]);
            // fprintf(stderr, "+++[M::%s] cid::%lu\tccid::%lu\trid::%u\t%.*s\tq::[%ld,%ld)\terr::%u\n", __func__, k, p - svi[k].ts, z->y_id, (int)Get_NAME_LENGTH(R_INF, z->y_id), Get_NAME(R_INF, z->y_id), s, e, sv[p].qn);
            assert(sv[p].ts == svi[k].tn);
            // if(!(ol->list[sv[p].tn].is_match == 1)) {
            //     fprintf(stderr, "+[M::%s] rid::%lu\toid::%u\tis_match::%u\n", __func__, rid, sv[p].tn, ol->list[sv[p].tn].is_match); 
            //     fprintf(stderr, "[M::%s] cid::%lu\tccid::%lu\trid::%u\t%.*s\tq::[%ld,%ld)\terr::%u\n", __func__, k, p - svi[k].ts, z->y_id, (int)Get_NAME_LENGTH(R_INF, z->y_id), Get_NAME(R_INF, z->y_id), s, e, sv[p].qn);
            // }
            assert(ol->list[sv[p].tn].is_match == 1);
            ol->list[sv[p].tn].is_match = 2;
        }

        ///filter out passed overlaps
        for (m = rm_n = ovn; m < idx->n; m++) {
            cp = &(ov[idx->a[m]]);
            q[0] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start+ovlp_bd(*cp);
            q[1] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1-ovlp_bd(*cp);
            if(q[1] <= s) continue;
            idx->a[rm_n++] = idx->a[m];
        }
        idx->n = rm_n;

        ///push new overlaps
        for (; i < ovn; ++i) {
            cp = &(ov[(uint32_t)idx->a[i]]);
            q[0] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start+ovlp_bd(*cp);
            q[1] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1-ovlp_bd(*cp);
            if(q[0] >= e) break;
            os = MAX(q[0], s); oe = MIN(q[1], e);
            if(oe > os) {
                kv_push(uint64_t, *idx, ((uint32_t)idx->a[i]));
            }
        }

        push_idel_info(hp, s, e, svi[k].qn, ov, ovn, sv + svi[k].ts, svi[k].te - svi[k].ts, ol->list, idx->a + ovn, idx->n - ovn, rid, asm_opt.het_cov, asm_opt.hom_cov, asm_opt.polyploidy, 0.333333, 5);

        ///relabel matched overlaps
        for (p = svi[k].ts; p < svi[k].te; p++) {
            assert(ol->list[sv[p].tn].is_match == 2);
            ol->list[sv[p].tn].is_match = 1;
        }
        // fprintf(stderr, "-4-[M::%s] %.*s\tis_match::%u\n", __func__, (int)Get_NAME_LENGTH(R_INF, ol->list[48].y_id), Get_NAME(R_INF, ol->list[48].y_id), ol->list[48].is_match); 
    }

    return hp->length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movq $0x0, -0xb0(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movq -0x50(%rbp), %rax
movq $0x0, (%rax)
movq -0x48(%rbp), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x220(%rax)
movq -0x40(%rbp), %rax
movl $0x0, 0x10(%rax)
movq $0x1, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rax
cmpq -0xc8(%rbp), %rax
ja 0x78aa8
movq -0x68(%rbp), %rax
cmpq -0xc8(%rbp), %rax
je 0x783b4
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x60(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
je 0x78a95
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq -0xb0(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq $-0x1, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x7855f
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
movl %eax, %eax
movq -0x90(%rbp,%rax,8), %rcx
addq $0x1, %rcx
movq %rcx, -0x90(%rbp,%rax,8)
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
orq -0x98(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x784ee
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x784ad
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x168(%rbp)
jmp 0x784bb
movl $0x2, %eax
movq %rax, -0x168(%rbp)
jmp 0x784bb
movq -0x168(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x98(%rbp), %rdx
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
cmpq $-0x1, -0xa0(%rbp)
jne 0x7852a
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jne 0x7854c
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x7854e
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x783f6
movq -0x90(%rbp), %rax
cmpq -0x88(%rbp), %rax
jae 0x78a8d
cmpq $0x0, -0xa8(%rbp)
jbe 0x785a2
movq -0xa8(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
subq -0xb0(%rbp), %rcx
subq -0xa8(%rbp), %rcx
cmpq %rcx, %rax
jae 0x786b6
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xb0(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
subq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x68(%rbp), %rax
subq -0x60(%rbp), %rax
cmpq $0x1, %rax
jbe 0x78603
movq -0xb8(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq -0xc0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x2da20
movq $0x1, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movq $-0x1, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x78(%rbp), %rax
cmpq -0xc0(%rbp), %rax
ja 0x786b4
movq -0x78(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x78663
movq -0xb8(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0xb8(%rbp), %rcx
movq -0x78(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x786a1
movq -0x78(%rbp), %rax
subq -0x70(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jbe 0x78699
movq -0x78(%rbp), %rax
subq -0x70(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa0(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x786a3
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x78629
jmp 0x786b6
movq -0xa0(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x100(%rbp)
movq -0xa0(%rbp), %rax
movl %eax, -0xfc(%rbp)
movq -0x60(%rbp), %rax
movl %eax, -0xf4(%rbp)
movq -0x68(%rbp), %rax
movl %eax, -0xf0(%rbp)
movl $0x0, -0x104(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x60(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0xf8(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0xb0(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq $-0x1, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x78884
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x100(%rbp), %eax
jne 0x78778
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0xfc(%rbp), %eax
je 0x7877d
jmp 0x78873
jmp 0x7877f
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x787f0
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x787af
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x170(%rbp)
jmp 0x787bd
movl $0x2, %eax
movq %rax, -0x170(%rbp)
jmp 0x787bd
movq -0x170(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, %edx
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
cmpq $-0x1, -0xa0(%rbp)
jne 0x78842
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x70(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x70(%rbp), %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
jne 0x78871
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x78873
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x78736
cmpq $0x0, -0xa8(%rbp)
jbe 0x788b3
movq -0xa8(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
subq -0xb0(%rbp), %rcx
subq -0xa8(%rbp), %rcx
cmpq %rcx, %rax
jae 0x789c7
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xb0(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x48(%rbp), %rax
movq (%rax), %rax
subq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x68(%rbp), %rax
subq -0x60(%rbp), %rax
cmpq $0x1, %rax
jbe 0x78914
movq -0xb8(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq -0xc0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x2da20
movq $0x1, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
movq $-0x1, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x78(%rbp), %rax
cmpq -0xc0(%rbp), %rax
ja 0x789c5
movq -0x78(%rbp), %rax
cmpq -0xc0(%rbp), %rax
je 0x78974
movq -0xb8(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0xb8(%rbp), %rcx
movq -0x78(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x789b2
movq -0x78(%rbp), %rax
subq -0x70(%rbp), %rax
cmpq -0xa8(%rbp), %rax
jbe 0x789aa
movq -0x78(%rbp), %rax
subq -0x70(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa0(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x789b4
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x7893a
jmp 0x789c7
movq -0xa0(%rbp), %rax
movl %eax, -0x104(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x78a41
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x78a05
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x178(%rbp)
jmp 0x78a13
movl $0x2, %eax
movq %rax, -0x178(%rbp)
jmp 0x78a13
movq -0x178(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x30(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x104(%rbp), %rcx
movq %rcx, (%rax)
movq -0xfc(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xf4(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0xec(%rbp), %ecx
movl %ecx, 0x18(%rax)
jmp 0x78a8d
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x78a97
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x7836c
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
subq -0xc8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x48(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x77de0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
subq -0xc8(%rbp), %rax
subq -0xd0(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0xc8(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0xc8(%rbp), %rcx
addq %rcx, %rax
imulq $0x1c, -0xd0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x128(%rbp)
movq -0x120(%rbp), %rdi
movq -0x120(%rbp), %rsi
imulq $0x1c, -0xd0(%rbp), %rax
addq %rax, %rsi
callq 0x30750
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0xd0(%rbp), %rax
jae 0x79264
movq -0x120(%rbp), %rax
imulq $0x1c, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq %rax, -0x130(%rbp)
movq -0x120(%rbp), %rax
imulq $0x1c, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq %rax, -0x138(%rbp)
movq -0x120(%rbp), %rax
imulq $0x1c, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq -0x120(%rbp), %rcx
imulq $0x1c, -0x68(%rbp), %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
cmpq %rcx, %rax
jae 0x78ccd
movq -0x118(%rbp), %rax
imulq $0x1c, -0x98(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x120(%rbp), %rcx
imulq $0x1c, -0x68(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jne 0x78c1d
jmp 0x78c3c
leaq 0x30c39e(%rip), %rdi    # 0x384fc2
leaq 0x3096f0(%rip), %rsi    # 0x38231b
movl $0x4e8f, %edx           # imm = 0x4E8F
leaq 0x30c3a1(%rip), %rcx    # 0x384fd8
callq 0x2130
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x118(%rbp), %rcx
imulq $0x1c, -0x98(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x1, %eax
jne 0x78c6d
jmp 0x78c8c
leaq 0x30c3e3(%rip), %rdi    # 0x385057
leaq 0x3096a0(%rip), %rsi    # 0x38231b
movl $0x4e94, %edx           # imm = 0x4E94
leaq 0x30c351(%rip), %rcx    # 0x384fd8
callq 0x2130
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x118(%rbp), %rcx
imulq $0x1c, -0x98(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movb $0x2, 0x2c(%rax)
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x78bd0
movq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x48(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x78e14
movq -0x128(%rbp), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0xe0(%rbp), %rdx
imulq $0x1c, (%rcx,%rdx,8), %rcx
addq %rcx, %rax
movq %rax, -0x110(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0x110(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x110(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl %ecx, %eax
cltq
movq %rax, -0x160(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0x110(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x110(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
subl %ecx, %eax
cltq
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rax
cmpq -0x130(%rbp), %rax
jg 0x78dc9
jmp 0x78dfd
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xe8(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0xe8(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x78ce2
movq -0xe8(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
cmpq -0xd8(%rbp), %rax
jae 0x79050
movq -0x128(%rbp), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x110(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0x110(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x110(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl %ecx, %eax
cltq
movq %rax, -0x160(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0x110(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x110(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
subl %ecx, %eax
cltq
movq %rax, -0x158(%rbp)
movq -0x160(%rbp), %rax
cmpq -0x138(%rbp), %rax
jl 0x78f0b
jmp 0x79050
movq -0x160(%rbp), %rax
cmpq -0x130(%rbp), %rax
jl 0x78f2b
movq -0x160(%rbp), %rax
movq %rax, -0x180(%rbp)
jmp 0x78f39
movq -0x130(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x158(%rbp), %rax
cmpq -0x138(%rbp), %rax
jg 0x78f67
movq -0x158(%rbp), %rax
movq %rax, -0x188(%rbp)
jmp 0x78f75
movq -0x138(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
cmpq -0x140(%rbp), %rax
jle 0x7903d
jmp 0x78f99
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x7900a
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x78fc9
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x190(%rbp)
jmp 0x78fd7
movl $0x2, %eax
movq %rax, -0x190(%rbp)
jmp 0x78fd7
movq -0x190(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movl %eax, %edx
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x7903d
jmp 0x7903f
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x78e22
movq -0x40(%rbp), %rdi
movq -0x130(%rbp), %rsi
movq -0x138(%rbp), %rdx
movq -0x120(%rbp), %rax
imulq $0x1c, -0x68(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, %ecx
movq -0x128(%rbp), %r8
movq -0xd8(%rbp), %r9
movq -0x118(%rbp), %rax
movq -0x120(%rbp), %r10
imulq $0x1c, -0x68(%rbp), %r11
addq %r11, %r10
movl 0x10(%r10), %r10d
imulq $0x1c, %r10, %r10
addq %r10, %rax
movq %rax, -0x1a0(%rbp)
movq -0x120(%rbp), %rax
imulq $0x1c, -0x68(%rbp), %r10
addq %r10, %rax
movl 0x14(%rax), %eax
movq -0x120(%rbp), %r10
imulq $0x1c, -0x68(%rbp), %r11
addq %r11, %r10
subl 0x10(%r10), %eax
movl %eax, %eax
movl %eax, %r13d
movq -0x38(%rbp), %rax
movq (%rax), %r12
movq -0x48(%rbp), %rax
movq 0x10(%rax), %r15
movq -0xd8(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r15
movq -0x48(%rbp), %rax
movq (%rax), %r14
subq -0xd8(%rbp), %r14
movq -0x58(%rbp), %rbx
leaq 0x34b6ed(%rip), %rax    # 0x3c47f8
movslq 0xd4(%rax), %r11
leaq 0x34b6df(%rip), %rax    # 0x3c47f8
movslq 0xd0(%rax), %r10
leaq 0x34b6d1(%rip), %rax    # 0x3c47f8
movslq 0x1bc(%rax), %rax
movq %rax, -0x198(%rbp)
movq -0x1a0(%rbp), %rax
movsd 0x309184(%rip), %xmm0   # 0x3822c8
movq %rax, (%rsp)
movq -0x198(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq $0x5, 0x48(%rsp)
callq 0x778c0
movq -0x120(%rbp), %rax
imulq $0x1c, -0x68(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq -0x120(%rbp), %rcx
imulq $0x1c, -0x68(%rbp), %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
cmpq %rcx, %rax
jae 0x79251
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x118(%rbp), %rcx
imulq $0x1c, -0x98(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movzbl 0x2c(%rax), %eax
cmpl $0x2, %eax
jne 0x791f1
jmp 0x79210
leaq 0x30be80(%rip), %rdi    # 0x385078
leaq 0x30911c(%rip), %rsi    # 0x38231b
movl $0x4eb2, %edx           # imm = 0x4EB2
leaq 0x30bdcd(%rip), %rcx    # 0x384fd8
callq 0x2130
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x118(%rbp), %rcx
imulq $0x1c, -0x98(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movb $0x1, 0x2c(%rax)
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x7919e
jmp 0x79253
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x78b74
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)