// File: chhylp123[P]hifiasm/Correct.cpp
// Function: rphase_lidel_cc(overlap_region_alloc*, ul_ov_t*, long, double, unsigned long, double, unsigned long, unsigned long, asg64_v*, asg64_v*)
int64_t rphase_lidel_cc(overlap_region_alloc* oa, ul_ov_t *a, int64_t an, double len_st, uint64_t len_w, double err_dif, uint64_t c_sz, uint64_t rid, asg64_v *buf, asg64_v *idx)
{
    int64_t k, z, mk, gni; uint64_t ol, ck, v, *ia, *ca, iak, ii, ian; double sw, msw = -1; 
    kv_resize(uint64_t, *idx, (oa->length<<1)); 
    ia = idx->a; ian = oa->length; iak = 0;
    ca = idx->a + oa->length; memset(ca, 0, sizeof((*ca))*oa->length);

    for (k = 0; k < an; k++) {
        ol = (a[k].qe - a[k].qs) * len_st; if(ol < len_w) ol = len_w;
        if((a[k].qe - a[k].qs) < ol) continue;
        for (z = k + 1; (z < an) && (a[z].qs < a[k].qe); z++) {
            if(cal_lindel_dd(&(a[k]), &(a[z]), len_st, len_w, err_dif, c_sz) >= 0) {
                a[k].sec++; a[z].sec++; 
                // fprintf(stderr, "(0)[M::%s] k(%ld)sec::%u\trid::%u\t%.*s\tq::[%u,%u)\terr::%u\n", __func__, k, a[k].sec, oa->list[a[k].tn].y_id, (int)Get_NAME_LENGTH(R_INF, oa->list[a[k].tn].y_id), Get_NAME(R_INF, oa->list[a[k].tn].y_id), a[k].qs, a[k].qe, a[k].qn);
                // fprintf(stderr, "(1)[M::%s] z(%ld)sec::%u\trid::%u\t%.*s\tq::[%u,%u)\terr::%u\n", __func__, z, a[z].sec, oa->list[a[z].tn].y_id, (int)Get_NAME_LENGTH(R_INF, oa->list[a[z].tn].y_id), Get_NAME(R_INF, oa->list[a[z].tn].y_id), a[z].qs, a[z].qe, a[z].qn);
            }
        }
    }
    
    for (k = z = 0; k < an; k++) {
        if(a[k].sec == 0) {
            // fprintf(stderr, "#[M::%s] z::%ld, sec::%u\trid::%u\t%.*s\tq::[%u,%u)\terr::%u\tel::%u\n", __func__, z, a[k].sec, oa->list[a[k].tn].y_id, (int)Get_NAME_LENGTH(R_INF, oa->list[a[k].tn].y_id), Get_NAME(R_INF, oa->list[a[k].tn].y_id), a[k].qs, a[k].qe, a[k].qn, a[k].el);
            continue;
        }
        a[k].ts = a[k].te = ((uint32_t)-1);///cluster
        // fprintf(stderr, "[M::%s] z::%ld, tn::%u, sec::%u\trid::%u\t%.*s\tq::[%u,%u)\terr::%u\n", __func__, z, a[k].tn, a[k].sec, oa->list[a[k].tn].y_id, (int)Get_NAME_LENGTH(R_INF, oa->list[a[k].tn].y_id), Get_NAME(R_INF, oa->list[a[k].tn].y_id), a[k].qs, a[k].qe, a[k].qn);
        a[z++] = a[k];
    }
    an = z;
    if(an == 0) return 0;

    // fprintf(stderr, "*0*[M::%s] rid::%lu, an::%ld\n", __func__, rid, an);
    for (k = ck = buf->n = gni = 0; k < an; k++) {
        if((a[k].sec < c_sz) || (a[k].ts != ((uint32_t)-1))) continue;
        // fprintf(stderr, "\n[M::%s] k::%ld\tsec::%u\tcc::%u\tck::%lu\ttn::%u\n", __func__, k, a[k].sec, a[k].ts, ck, a[k].tn);

        buf->n = 0; kv_push(uint64_t, *buf, k); iak = 0;
        while (buf->n) {
            v = buf->a[--buf->n];
            ol = (a[v].qe - a[v].qs) * len_st; if(ol < len_w) ol = len_w;
            if((a[v].qe - a[v].qs) < ol) continue;
            
            // fprintf(stderr, "*0*[M::%s] v::%lu\n", __func__, v);
            if((set_cgid(&(a[v]), ia, &iak, ian, ca, ck, oa->list, &gni)) || (a[v].ts == ck)) {
                // fprintf(stderr, "*1*[M::%s] v::%lu\n", __func__, v);
                for (z = 0; (z < an) && (a[z].qs < a[v].qe); z++) {
                    // fprintf(stderr, "*0*[M::%s] a[z].tn::%u, a[z].sec::%u, c_sz::%lu, a[z].ts:%u, v::%lu, z::%ld\n", __func__, a[z].tn, a[z].sec, c_sz, a[z].ts, v, z);
                    if((a[z].sec < c_sz) || (a[z].ts != ((uint32_t)-1)) || (((int64_t)v) == z)) continue;
                    // fprintf(stderr, "*1*[M::%s] a[z].tn::%u\n", __func__, a[z].tn);
                    if((cal_lindel_dd(&(a[v]), &(a[z]), len_st, len_w, err_dif, c_sz) >= 0) && (set_cgid(&(a[z]), ia, &iak, ian, ca, ck, oa->list, &gni))) {
                        kv_push(uint64_t, *buf, z);
                        // fprintf(stderr, "*2*[M::%s] z::%ld, a[z].tn::%u\n", __func__, z, a[z].tn);
                    }
                }
            }
        }

        for (ii = 0; ii < iak; ii++) ia[ii] = 0;
        ck++;
    }

    // for (k = 0; k < an; k++) {
    //     fprintf(stderr, "*0*[M::%s] z::%ld, tn::%u, sec::%u\trid::%u\t%.*s\tq::[%u,%u)\terr::%u\tgid::%u\n", __func__, k, a[k].tn, a[k].sec, oa->list[a[k].tn].y_id, (int)Get_NAME_LENGTH(R_INF, oa->list[a[k].tn].y_id), Get_NAME(R_INF, oa->list[a[k].tn].y_id), a[k].qs, a[k].qe, a[k].qn, a[k].ts);
    // }
    // fprintf(stderr, "*1*[M::%s] rid::%lu, an::%ld, ck::%lu\n", __func__, rid, an, ck);
    if(ck <= 0 || gni <= 0) return 0;

    if(gni < an) {
        ///build index for cluster
        buf->n = an + ck; kv_resize(uint64_t, *buf, buf->n); 
        memset(buf->a, -1, sizeof((*(buf->a)))*buf->n);
        ca = buf->a; ia = buf->a + ck;
        for (k = 0; k < an; k++) {
            if(a[k].ts == ((uint32_t)-1)) continue;
            if(ca[a[k].ts] != ((uint64_t)-1)) {
                ///set the previous one 
                assert(ia[((uint32_t)ca[a[k].ts])] == ((uint64_t)-1));
                ia[((uint32_t)ca[a[k].ts])] = k;
                ca[a[k].ts] >>= 32; ca[a[k].ts] <<= 32; ca[a[k].ts] |= k;
            } else {
                ca[a[k].ts] = k; ca[a[k].ts] <<= 32; ca[a[k].ts] |= ((uint64_t)k);
            }
        }
        

        for (k = ck = 0; k < an; k++) {
            if(a[k].ts != ((uint32_t)-1)) {
                ck++; continue;
            }
            ol = (a[k].qe - a[k].qs) * len_st; if(ol < len_w) ol = len_w;
            if((a[k].qe - a[k].qs) < ol) continue;
            mk = -1; msw = -1;
            for (z = 0/**k + 1**/; (z < an) && (a[z].qs < a[k].qe); z++) {
                if(a[z].sec < c_sz) continue;
                if(a[z].ts == ((uint32_t)-1)) continue;
                if(z == k) continue;
                sw = cal_lindel_dd(&(a[k]), &(a[z]), len_st, len_w, err_dif, c_sz);
                if(sw < 0) continue;
                if((sw > msw) && (is_get_group(a, /**an, rid,**/ ca, ia, a[z].ts, a[k].tn))) {
                    mk = a[z].ts; msw = sw;
                }
            }
            if(mk != -1) {
                ck++; a[k].ts = mk;
                ///set the previous one 
                assert(ia[((uint32_t)ca[a[k].ts])] == ((uint64_t)-1));
                ia[((uint32_t)ca[a[k].ts])] = k;
                ca[a[k].ts] >>= 32; ca[a[k].ts] <<= 32; ca[a[k].ts] |= k;
            }
        }
    } else {
        ck = gni;
    }
    radix_sort_ul_ov_srt_ts1(a, a + an);
    // for (k = 0; k < an; k++) {
    //     fprintf(stderr, "*1*[M::%s] z::%ld, tn::%u, sec::%u\trid::%u\t%.*s\tq::[%u,%u)\terr::%u\tgid::%u\n", __func__, k, a[k].tn, a[k].sec, oa->list[a[k].tn].y_id, (int)Get_NAME_LENGTH(R_INF, oa->list[a[k].tn].y_id), Get_NAME(R_INF, oa->list[a[k].tn].y_id), a[k].qs, a[k].qe, a[k].qn, a[k].ts);
    // }
    return ck;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movsd %xmm0, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movsd %xmm1, -0x38(%rbp)
movq %r8, -0x40(%rbp)
movq %r9, -0x48(%rbp)
movsd 0x30b88b(%rip), %xmm0   # 0x382278
movsd %xmm0, -0xb8(%rbp)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
shlq %rcx
cmpq %rcx, %rax
jae 0x76adf
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
shlq %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x18(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x76ae1
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
movq $0x0, -0x98(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x2100
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x76cf4
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movl 0x4(%rax,%rdx), %ecx
movl 0x8(%rax,%rdx), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x30b45e(%rip), %xmm1   # 0x381ff8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x76bbf
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
cmpq -0x70(%rbp), %rax
jae 0x76bea
jmp 0x76ce3
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0xb9(%rbp)
jge 0x76c2f
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
setb %al
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0x76c3e
jmp 0x76ce1
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x50(%rbp), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rsi
movsd -0x28(%rbp), %xmm0
movq -0x30(%rbp), %rdx
movsd -0x38(%rbp), %xmm1
movq -0x40(%rbp), %rcx
callq 0x76660
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x76cce
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
addl $0x1, %edx
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
addl $0x1, %edx
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
jmp 0x76cd0
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x76bf6
jmp 0x76ce3
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x76b4a
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x76da6
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
cmpl $0x0, %eax
jne 0x76d2d
jmp 0x76d95
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x14(%rax) # imm = 0xFFFFFFFF
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x10(%rax) # imm = 0xFFFFFFFF
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq -0x58(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x58(%rbp)
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x76d04
movq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x76dc2
movq $0x0, -0x8(%rbp)
jmp 0x778ab
movq $0x0, -0x68(%rbp)
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movq $0x0, -0x78(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x77219
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
cmpq -0x40(%rbp), %rax
jb 0x76e21
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
je 0x76e26
jmp 0x77208
movq 0x10(%rbp), %rax
movq $0x0, (%rax)
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x76ea2
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x76e61
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xc8(%rbp)
jmp 0x76e6f
movl $0x2, %eax
movq %rax, -0xc8(%rbp)
jmp 0x76e6f
movq -0xc8(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rdx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq $0x0, -0x98(%rbp)
movq 0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x771b7
movq 0x10(%rbp), %rdx
movq (%rdx), %rcx
movq 0x10(%rdx), %rax
movq %rcx, %rsi
decq %rsi
movq %rsi, (%rdx)
movq -0x8(%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rax
movq -0x80(%rbp), %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movl 0x4(%rax,%rdx), %ecx
movl 0x8(%rax,%rdx), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x30b0bd(%rip), %xmm1   # 0x381ff8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x76f60
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
cmpq -0x70(%rbp), %rax
jae 0x76f8b
jmp 0x76ece
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x80(%rbp), %rax
addq %rax, %rdi
movq -0x88(%rbp), %rsi
movq -0xa8(%rbp), %rcx
movq -0x90(%rbp), %r8
movq -0x78(%rbp), %r9
movq -0x10(%rbp), %rax
movq (%rax), %r10
leaq -0x98(%rbp), %rdx
leaq -0x68(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xc1510
cmpq $0x0, %rax
jne 0x76fef
movq -0x18(%rbp), %rax
imulq $0x1c, -0x80(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
cmpq -0x78(%rbp), %rax
jne 0x771b2
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0xc9(%rbp)
jge 0x77030
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x80(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
setb %al
movb %al, -0xc9(%rbp)
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0x7703f
jmp 0x771b0
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
cmpq -0x40(%rbp), %rax
jb 0x77077
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
jne 0x77077
movq -0x80(%rbp), %rax
cmpq -0x58(%rbp), %rax
jne 0x7707c
jmp 0x7719f
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x80(%rbp), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rsi
movsd -0x28(%rbp), %xmm0
movq -0x30(%rbp), %rdx
movsd -0x38(%rbp), %xmm1
movq -0x40(%rbp), %rcx
callq 0x76660
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x7719d
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rdi
movq -0x88(%rbp), %rsi
movq -0xa8(%rbp), %rcx
movq -0x90(%rbp), %r8
movq -0x78(%rbp), %r9
movq -0x10(%rbp), %rax
movq (%rax), %r10
leaq -0x98(%rbp), %rdx
leaq -0x68(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xc1510
cmpq $0x0, %rax
je 0x7719d
jmp 0x77109
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x7717a
movq 0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x77139
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xd8(%rbp)
jmp 0x77147
movl $0x2, %eax
movq %rax, -0xd8(%rbp)
jmp 0x77147
movq -0xd8(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rdx
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x7719d
jmp 0x7719f
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x76ff7
jmp 0x771b2
jmp 0x76ece
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jae 0x771fc
movq -0x88(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x771c2
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x76de5
cmpq $0x0, -0x78(%rbp)
jbe 0x77227
cmpq $0x0, -0x68(%rbp)
jg 0x77234
movq $0x0, -0x8(%rbp)
jmp 0x778ab
movq -0x68(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x77886
movq -0x20(%rbp), %rcx
addq -0x78(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x77330
movq 0x10(%rbp), %rax
movq (%rax), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x2, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x4, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x8, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
shrq $0x10, %rcx
movq 0x10(%rbp), %rax
orq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x77332
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rbp), %rax
movq (%rax), %rdx
shlq $0x3, %rdx
movl $0xff, %esi
callq 0x2100
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x77519
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
jne 0x773a5
jmp 0x77508
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
cmpq $-0x1, (%rax,%rcx,8)
je 0x774a4
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq -0x18(%rbp), %rdx
imulq $0x1c, -0x50(%rbp), %rsi
addq %rsi, %rdx
movl 0x10(%rdx), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x773f2
jmp 0x77411
leaq 0x30db13(%rip), %rdi    # 0x384f0c
leaq 0x30af1b(%rip), %rsi    # 0x38231b
movl $0x4da0, %edx           # imm = 0x4DA0
leaq 0x30db2e(%rip), %rcx    # 0x384f3a
callq 0x2130
movq -0x50(%rbp), %rdx
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x50(%rbp), %rdi
addq %rdi, %rsi
movl 0x10(%rsi), %esi
movq (%rcx,%rsi,8), %rcx
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rdx
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rsi
addq %rsi, %rcx
movl 0x10(%rcx), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x77506
movq -0x50(%rbp), %rdx
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rsi
addq %rsi, %rcx
movl 0x10(%rcx), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rdx
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rsi
addq %rsi, %rcx
movl 0x10(%rcx), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x77508
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x77380
movq $0x0, -0x78(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x77884
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
je 0x7755a
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x77873
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movl 0x4(%rax,%rdx), %ecx
movl 0x8(%rax,%rdx), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd -0x28(%rbp), %xmm1
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x30aa5c(%rip), %xmm1   # 0x381ff8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x775c1
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
cmpq -0x70(%rbp), %rax
jae 0x775ec
jmp 0x77873
movq $-0x1, -0x60(%rbp)
movsd 0x30ac7c(%rip), %xmm0   # 0x382278
movsd %xmm0, -0xb8(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rcx
xorl %eax, %eax
cmpq -0x20(%rbp), %rcx
movb %al, -0xd9(%rbp)
jge 0x77645
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
setb %al
movb %al, -0xd9(%rbp)
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x77654
jmp 0x77769
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
cmpq -0x40(%rbp), %rax
jae 0x77675
jmp 0x77758
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
cmpl $-0x1, 0x10(%rax)
jne 0x7768c
jmp 0x77758
movq -0x58(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x7769b
jmp 0x77758
movq -0x18(%rbp), %rdi
imulq $0x1c, -0x50(%rbp), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x58(%rbp), %rax
addq %rax, %rsi
movsd -0x28(%rbp), %xmm0
movq -0x30(%rbp), %rdx
movsd -0x38(%rbp), %xmm1
movq -0x40(%rbp), %rcx
callq 0x76660
movsd %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
ucomisd -0xb0(%rbp), %xmm0
jbe 0x776e1
jmp 0x77758
movsd -0xb0(%rbp), %xmm0
ucomisd -0xb8(%rbp), %xmm0
jbe 0x77756
movq -0x18(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %r8
addq %r8, %rax
movl 0xc(%rax), %eax
movl %eax, %r8d
callq 0x768f0
cmpq $0x0, %rax
je 0x77756
movq -0x18(%rbp), %rax
imulq $0x1c, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq %rax, -0x60(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
jmp 0x77758
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x7760c
cmpq $-0x1, -0x60(%rbp)
je 0x77871
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x60(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq -0x18(%rbp), %rdx
imulq $0x1c, -0x50(%rbp), %rsi
addq %rsi, %rdx
movl 0x10(%rdx), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x777c1
jmp 0x777e0
leaq 0x30d744(%rip), %rdi    # 0x384f0c
leaq 0x30ab4c(%rip), %rsi    # 0x38231b
movl $0x4dbd, %edx           # imm = 0x4DBD
leaq 0x30d75f(%rip), %rcx    # 0x384f3a
callq 0x2130
movq -0x50(%rbp), %rdx
movq -0x88(%rbp), %rax
movq -0x90(%rbp), %rcx
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x50(%rbp), %rdi
addq %rdi, %rsi
movl 0x10(%rsi), %esi
movq (%rcx,%rsi,8), %rcx
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
movq (%rax,%rcx,8), %rdx
shrq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rdx
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
imulq $0x1c, -0x50(%rbp), %rsi
addq %rsi, %rcx
movl 0x10(%rcx), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x77873
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x77529
jmp 0x7788e
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
imulq $0x1c, -0x20(%rbp), %rax
addq %rax, %rsi
callq 0x31c50
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)