// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: gen_fg(ma_ug_t*, asg_t*, ma_hit_t_alloc*, ma_sub_t*, int, int, int)
ma_ug_t* gen_fg(ma_ug_t *ug, asg_t *rg, ma_hit_t_alloc* src, ma_sub_t *cov, int32_t max_hang, int32_t min_ovlp, int32_t gap_fuzz)
{
    uint32_t *idx; MALLOC(idx, rg->n_seq); 
    memset(idx, -1, sizeof((*idx))*rg->n_seq);
    ma_ug_t *fg = copy_untig_graph(ug); asg_cleanup(fg->g);///some edges might be deleted
    kvec_t(uint64_t) srt; kv_init(srt);    
    uint64_t i, k, l, m, rv, rw, uv, uw, zn, z, nist = 0; ma_utg_t *u;
    for (k = 0; k < fg->u.n; k++) {
        u = &(ug->u.a[k]); fg->g->seq[k].c = PRIMARY_LABLE;
        if((u->circ) || (u->n == 0)) continue;
        m = k<<1; m |= (((uint64_t)Uc_beg((*u)))<<32); kv_push(uint64_t, srt, m);///((uint32_t)(((*u)).a[0]>>32));
        m = (k<<1)+1; m |= (((uint64_t)Uc_end((*u)))<<32); kv_push(uint64_t, srt, m);
    }
    

    radix_sort_arch64(srt.a, srt.a+srt.n);
    for (k = 1, l = 0; k <= srt.n; k++) {
        if(k == srt.n || (srt.a[k]>>33) != (srt.a[l]>>33)) {
            idx[srt.a[l]>>33] = l;
            l = k;
        }
    }

    ma_hit_t_alloc* x; asg_arc_t *za; 
    ma_hit_t *h; ma_sub_t *sq, *st;
    int32_t r; asg_arc_t t0, t1, *p;
    for (k = 0; k < fg->u.n; k++) {
        u = &(ug->u.a[k]);
        if((u->circ) || (u->n == 0)) continue;

        uv = k<<1; rv = Uc_end((*u))^1;
        x = &(src[rv>>1]); 
        za = asg_arc_a(ug->g, uv); 
        zn = asg_arc_n(ug->g, uv); 
        for (i = 0; i < x->length; i++) {
            h = &(x->buffer[i]);
            // if(!(h->el)) continue;
            sq = &(cov[Get_qn(*h)]); st = &(cov[Get_tn(*h)]);
            if(st->del || rg->seq[Get_tn(*h)].del) continue;
            r = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, 
                                asm_opt.max_hang_rate, min_ovlp, &t0);
        
            ///if it is a contained read, skip
            if(r < 0) continue;
            if((t0.ul>>32) != rv) continue;
            rw = t0.v;
            if(idx[rw>>1] == ((uint32_t)-1)) continue;
            if(!(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, t0.ul>>32, t0.v, &t0))) continue;

            m = idx[rw>>1]; assert((srt.a[m]>>33) == (rw>>1));
            for (; m < srt.n && (srt.a[m]>>33) == (rw>>1); m++) {
                if(rw == (srt.a[m]>>32)) {
                    uw = (uint32_t)srt.a[m];
                    if(uv == uw) continue;
                    for (z = 0; z < zn; z++) {
                        if((!za[z].del) && (za[z].v==uw)) break;
                    }
                    if(z < zn) continue;
                    if(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, (t0.v^1), ((t0.ul>>32)^1), &t1)) {
                        p = asg_arc_pushp(fg->g); *p = t0; 
                        p->ul<<=32; p->ul>>=32; p->ul |= (uv<<32); p->v = uw;

                        p = asg_arc_pushp(fg->g); *p = t1;
                        p->ul<<=32; p->ul>>=32; p->ul |= ((uw^1)<<32); p->v = uv^1;
                        nist++;
                    }
                }
            }
        }


        uv = (k<<1)+1; rv = Uc_beg((*u))^1;
        x = &(src[rv>>1]); 
        za = asg_arc_a(ug->g, uv); 
        zn = asg_arc_n(ug->g, uv); 
        for (i = 0; i < x->length; i++) {
            h = &(x->buffer[i]);
            // if(!(h->el)) continue;
            sq = &(cov[Get_qn(*h)]); st = &(cov[Get_tn(*h)]);
            if(st->del || rg->seq[Get_tn(*h)].del) continue;
            r = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, 
                                asm_opt.max_hang_rate, min_ovlp, &t0);
        
            ///if it is a contained read, skip
            if(r < 0) continue;
            if((t0.ul>>32) != rv) continue;
            rw = t0.v;
            if(idx[rw>>1] == ((uint32_t)-1)) continue;
            if(!(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, t0.ul>>32, t0.v, &t0))) continue;

            m = idx[rw>>1]; assert((srt.a[m]>>33) == (rw>>1));
            for (; m < srt.n && (srt.a[m]>>33) == (rw>>1); m++) {
                if(rw == (srt.a[m]>>32)) {
                    uw = (uint32_t)srt.a[m];
                    if(uv == uw) continue;
                    for (z = 0; z < zn; z++) {
                        if((!za[z].del) && (za[z].v==uw)) break;
                    }
                    if(z < zn) continue;
                    if(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, (t0.v^1), ((t0.ul>>32)^1), &t1)) {
                        p = asg_arc_pushp(fg->g); *p = t0; 
                        p->ul<<=32; p->ul>>=32; p->ul |= (uv<<32); p->v = uw;

                        p = asg_arc_pushp(fg->g); *p = t1;
                        p->ul<<=32; p->ul>>=32; p->ul |= ((uw^1)<<32); p->v = uv^1;
                        nist++;
                    }
                }
            }
        }
    }

    if(nist) {
        free(fg->g->idx);
        fg->g->idx = 0;
        fg->g->is_srt = 0;
        asg_cleanup(fg->g);
        asg_symm(fg->g);
        asg_arc_del_trans(fg->g, gap_fuzz);
        ///some of old edges might be lost due the transitive reduction
        recall_arcs(fg->g, ug->g);
    }

    kv_destroy(srt); free(idx);
    return fg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %r9d, %ebp
movl %r8d, %r12d
movq %rcx, 0x8(%rsp)
movq %rdx, %r15
movq %rdi, %r14
movq %rsi, 0xe8(%rsp)
movl 0x14(%rsi), %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
shlq $0x2, %rbx
movq %rbx, %rdi
callq 0x2280
movq %rax, 0x90(%rsp)
movq %rax, %rdi
movl $0xff, %esi
movq %rbx, %rdx
callq 0x20e0
movq %r14, 0x78(%rsp)
movq %r14, %rdi
callq 0xc8eab
movq %rax, %rbx
movq 0x18(%rax), %rdi
callq 0xa0a7d
movq (%rbx), %rax
testq %rax, %rax
movq %rbx, 0x88(%rsp)
je 0xd3063
movq %r15, 0x68(%rsp)
movl %ebp, 0x24(%rsp)
addq $0x18, %rbx
movq %rbx, 0x98(%rsp)
xorl %ebx, %ebx
movl $0x2, %r15d
movq $0x0, 0x38(%rsp)
xorl %ebp, %ebp
xorl %edi, %edi
movl %r12d, 0x4(%rsp)
movq 0x78(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rbx,%rbx,4), %rdx
movq 0x98(%rsp), %rsi
movq (%rsi), %rsi
movq 0x20(%rsi), %rsi
movb $0x0, 0x4(%rsi,%rbx,8)
cmpl $0x0, (%rcx,%rdx,8)
js 0xd2412
leaq (%rcx,%rdx,8), %r14
movl 0x10(%r14), %ecx
testl %ecx, %ecx
je 0xd2412
movq 0x18(%r14), %rax
movq (%rax), %r12
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
andq %rdx, %r12
movq 0x38(%rsp), %r13
cmpq %rbp, %r13
jne 0xd2392
leaq (,%r13,2), %rbp
testq %r13, %r13
cmoveq %r15, %rbp
leaq (,%rbp,8), %rsi
callq 0x2370
movq %rax, %rdi
movq 0x18(%r14), %rax
movl 0x10(%r14), %ecx
leaq (%rbx,%rbx), %r14
orq %r14, %r12
leaq 0x1(%r13), %rdx
movq %r12, (%rdi,%r13,8)
decl %ecx
movq (%rax,%rcx,8), %r12
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
andq %rax, %r12
cmpq %rbp, %rdx
jne 0xd23db
leaq (,%rbp,2), %r13
testq %rbp, %rbp
cmoveq %r15, %r13
leaq (,%r13,8), %rsi
callq 0x2370
movq %rax, %rdi
movq %r13, %rbp
movq 0x88(%rsp), %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
xorq %rcx, %r12
orq %r12, %r14
orq $0x1, %r14
movq 0x38(%rsp), %rcx
movq %r14, 0x8(%rdi,%rcx,8)
addq $0x2, %rcx
movq %rcx, 0x38(%rsp)
movq (%rax), %rax
movl 0x4(%rsp), %r12d
incq %rbx
cmpq %rax, %rbx
jb 0xd2312
movq 0x38(%rsp), %r14
leaq (%rdi,%r14,8), %rsi
movq %rdi, 0x28(%rsp)
callq 0x9dc69
testq %r14, %r14
movq 0x8(%rsp), %rbx
je 0xd2493
leaq 0x1(%r14), %rcx
cmpq $0x3, %rcx
movl $0x2, %eax
cmovaeq %rcx, %rax
movl $0x1, %ecx
xorl %edx, %edx
cmpq %rcx, %r14
jne 0xd2463
movq 0x28(%rsp), %rsi
movq (%rsi,%rdx,8), %rsi
jmp 0xd2479
movq 0x28(%rsp), %rdi
movq (%rdi,%rdx,8), %rsi
movq (%rdi,%rcx,8), %rdi
xorq %rsi, %rdi
shrq $0x21, %rdi
je 0xd248b
shrq $0x21, %rsi
movq 0x90(%rsp), %rdi
movl %edx, (%rdi,%rsi,4)
movq %rcx, %rdx
incq %rcx
cmpq %rcx, %rax
jne 0xd2453
movq 0x88(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xf0(%rsp)
testq %rax, %rax
je 0xd305c
movq $0x0, 0xa8(%rsp)
xorl %r8d, %r8d
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
leaq (%r8,%r8,4), %rcx
cmpl $0x0, (%rax,%rcx,8)
movq 0x68(%rsp), %rdi
movq %r8, 0xf8(%rsp)
js 0xd3038
leaq (%rax,%rcx,8), %r10
movl 0x10(%r10), %eax
testl %eax, %eax
je 0xd3038
leaq (%r8,%r8), %r9
movq 0x18(%r10), %rdx
decl %eax
movq (%rdx,%rax,8), %r11
movq %r11, %rax
shrq $0x21, %rax
leaq (%rax,%rax,2), %rsi
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
cmpl $0x0, 0xc(%rdi,%rsi,8)
movq %r9, 0xd8(%rsp)
je 0xd2ac9
movq %r10, 0xd0(%rsp)
shrq $0x20, %r11
movq %r11, 0x80(%rsp)
leaq (%rdi,%rsi,8), %r14
movq %r8, %rdx
shlq $0x4, %rdx
movq (%rcx,%rdx), %rcx
movl %ecx, %edx
shrq $0x20, %rcx
shlq $0x21, %r8
movq %r8, 0xb0(%rsp)
movl %r9d, %esi
orl $0x1, %esi
movl %esi, 0x40(%rsp)
movq %rdx, 0xc0(%rsp)
leaq (,%rdx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
movq %rdx, 0xb8(%rsp)
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
addq $0xc, %rax
movq %rax, 0xc8(%rsp)
xorl %r15d, %r15d
movq %r14, 0x10(%rsp)
movq (%r14), %rsi
leaq (%r15,%r15,4), %r8
movl 0xc(%rsi,%r8,8), %edx
leaq (%rdx,%rdx,2), %rdi
movl (%rbx,%rdi,4), %ecx
testl %ecx, %ecx
js 0xd26c1
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0x0, (%rax,%rdx,8)
js 0xd26c1
leaq (%rsi,%r8,8), %rax
leaq (%rbx,%rdi,4), %rdi
movl 0x4(%rdi), %edi
subl %ecx, %edi
movq 0x18(%rax), %rcx
testl %ecx, %ecx
js 0xd25ff
movl 0x10(%rax), %r14d
movl 0x14(%rax), %r10d
subl %r10d, %edi
movl %edi, %r9d
movl %r14d, %edi
jmp 0xd260d
movl 0x10(%rax), %r14d
movl 0x14(%rax), %r10d
subl %r10d, %edi
movl %r14d, %r9d
movq (%rsi,%r8,8), %rsi
movq %rsi, %r8
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
leaq (%rbx,%r8,4), %r8
movl 0x4(%r8), %r13d
movl (%r8), %r8d
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
andl %r11d, %r8d
subl %r8d, %r13d
cmpl %esi, %edi
movl %esi, %ebx
cmovll %edi, %ebx
movl 0x8(%rax), %r11d
movl %r13d, %r8d
subl %r11d, %r8d
cmpl %r9d, %r8d
movl %r9d, %ebp
cmovll %r8d, %ebp
cmpl %r12d, %ebx
jg 0xd26b7
cmpl %r12d, %ebp
jg 0xd26b7
movq %rcx, 0x18(%rsp)
movl %r11d, %r12d
subl %esi, %r12d
xorps %xmm1, %xmm1
cvtsi2ss %r12, %xmm1
addl %ebx, %r12d
addl %ebp, %r12d
xorps %xmm2, %xmm2
cvtsi2ss %r12, %xmm2
leaq 0x1c30d8(%rip), %rcx    # 0x295758
movss 0x158(%rcx), %xmm0
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
ja 0xd26b2
subl %r14d, %r10d
xorps %xmm1, %xmm1
cvtsi2ss %r10, %xmm1
addl %ebx, %ebp
addl %r10d, %ebp
xorps %xmm2, %xmm2
cvtsi2ss %rbp, %xmm2
mulss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0xd26d6
movl 0x4(%rsp), %r12d
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
incq %r15
movl 0xc(%r14), %eax
cmpq %rax, %r15
jb 0xd25a6
jmp 0xd2a9f
cmpl %r9d, %r8d
setl %r8b
setg %bl
cmpl %edi, %esi
setg %r14b
setl %r10b
orb %bl, %r14b
cmpb $0x1, %r14b
jne 0xd26b2
orb %r8b, %r10b
movq 0x10(%rsp), %r14
je 0xd2a90
movl 0x24(%rsp), %r8d
cmpl %r8d, %r12d
jl 0xd2a90
cmpl %r8d, %ebp
movl 0x4(%rsp), %r12d
jl 0xd2a95
movq 0x18(%rsp), %rcx
testl %ecx, %ecx
setns %r8b
addl %r11d, %r9d
movl %r13d, %r10d
subl %r9d, %r10d
xorl %r11d, %r11d
movl %esi, %r9d
subl %edi, %r9d
setle %r11b
setg %dil
cmovlel %r10d, %r9d
xorb %r8b, %dil
movzbl %dil, %edi
shrq $0x1f, %rsi
andl $-0x2, %esi
orq %r11, %rsi
leal (%rdi,%rdx,2), %r10d
movq %rsi, %rdx
shlq $0x20, %rdx
addq %r9, %rdx
movq %rdx, 0x50(%rsp)
movl %r10d, 0x58(%rsp)
subl %r9d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movl %r13d, 0x5c(%rsp)
movzwl 0x60(%rsp), %edx
shrl $0x10, %ecx
andl $0x4000, %ecx           # imm = 0x4000
andl $0x3fff, %edx           # imm = 0x3FFF
orl %ecx, %edx
movb 0x20(%rax), %cl
movb %cl, 0x62(%rsp)
movzbl 0x21(%rax), %eax
shll $0xf, %eax
orl %edx, %eax
movw %ax, 0x60(%rsp)
testl %r9d, %r9d
movq 0x8(%rsp), %rbx
js 0xd26c1
cmpl 0x80(%rsp), %esi
movq 0xc8(%rsp), %r13
jne 0xd26c1
movl %r10d, %ebp
shrl %ebp
movq 0x90(%rsp), %rax
movl (%rax,%rbp,4), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rcx
je 0xd26c1
movq %rcx, 0x18(%rsp)
movq 0x68(%rsp), %rdi
movq %rbx, %rsi
movl %r12d, %ecx
movl 0x24(%rsp), %r8d
movq 0x80(%rsp), %r9
leaq 0x50(%rsp), %rax
pushq %rax
movq %r10, 0x38(%rsp)
pushq %r10
callq 0xb3df3
addq $0x10, %rsp
testl %eax, %eax
je 0xd26c1
movq 0x28(%rsp), %rax
movq 0x18(%rsp), %rdx
movq (%rax,%rdx,8), %rax
shrq $0x21, %rax
cmpl %ebp, %eax
jne 0xd30b8
cmpq %rdx, 0x38(%rsp)
movq 0x30(%rsp), %rax
jbe 0xd26c1
movl %eax, %esi
movl 0x54(%rsp), %eax
movl 0x58(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x4c(%rsp)
xorl $0x1, %eax
movq %rax, 0xa0(%rsp)
movq %rsi, 0x70(%rsp)
movq 0x28(%rsp), %rax
movq (%rax,%rdx,8), %rdi
movq %rdi, %rax
shrq $0x21, %rax
cmpl %ebp, %eax
jne 0xd26c1
movq %rdi, %rax
shrq $0x20, %rax
cmpl %esi, %eax
jne 0xd2a7d
movl %edi, %eax
cmpq %rax, 0xd8(%rsp)
je 0xd2a7d
cmpq $0x0, 0xc0(%rsp)
movq 0xb8(%rsp), %rcx
je 0xd28d8
xorl %eax, %eax
cmpl $0x0, (%r13,%rax)
js 0xd28cf
cmpl %edi, -0x4(%r13,%rax)
je 0xd2a7d
addq $0x18, %rax
cmpq %rax, %rcx
jne 0xd28bc
movq %rdi, 0x30(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x68(%rsp), %rdi
movq %rbx, %rsi
movl %r12d, %ecx
movl 0x24(%rsp), %r8d
movl 0x4c(%rsp), %r9d
leaq 0x100(%rsp), %rax
pushq %rax
pushq 0xa8(%rsp)
callq 0xb3df3
addq $0x10, %rsp
testl %eax, %eax
je 0xd2a73
movq 0x98(%rsp), %rax
movq (%rax), %r9
movl 0x4(%r9), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%r9), %ecx
movq %r9, 0xe0(%rsp)
jne 0xd2977
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%r9)
movq 0x8(%r9), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq 0xe0(%rsp), %r9
movq %rax, 0x8(%r9)
movl 0x4(%r9), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0xd297b
movq 0x8(%r9), %rax
movq 0x30(%rsp), %r8
leal 0x1(%rdx), %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl %edi, %esi
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%r9)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
movq 0x60(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movl (%rax,%rcx,8), %edx
orq 0xb0(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
movl %r8d, 0x8(%rax,%rcx,8)
movl 0x4(%r9), %edx
movl %edx, %ecx
andl %edi, %ecx
cmpl (%r9), %ecx
jne 0xd2a10
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%r9)
movq 0x8(%r9), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq 0xe0(%rsp), %r9
movq 0x30(%rsp), %r8
movq %rax, 0x8(%r9)
movl 0x4(%r9), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0xd2a14
movq 0x8(%r9), %rax
leal 0x1(%rdx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%r9)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movups 0x100(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
movq 0x110(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movl (%rax,%rcx,8), %edx
shlq $0x20, %r8
orq %rdx, %r8
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorq %rdx, %r8
movq %r8, (%rax,%rcx,8)
movl 0x40(%rsp), %edx
movl %edx, 0x8(%rax,%rcx,8)
incq 0xa8(%rsp)
movq 0x18(%rsp), %rdx
movq 0x70(%rsp), %rsi
incq %rdx
cmpq 0x38(%rsp), %rdx
jne 0xd2870
jmp 0xd26c1
movl 0x4(%rsp), %r12d
movq 0x8(%rsp), %rbx
jmp 0xd26c1
movq 0xd0(%rsp), %rax
movq 0x18(%rax), %rdx
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
movq 0x68(%rsp), %rdi
movq 0xd8(%rsp), %r9
movq (%rdx), %rsi
movq %rsi, %rdx
shrq $0x21, %rdx
leaq (%rdx,%rdx,2), %rdx
cmpl $0x0, 0xc(%rdi,%rdx,8)
je 0xd3038
movq %r9, %r8
orq $0x1, %r8
leaq (%rdi,%rdx,8), %r14
movq 0x8(%rcx,%r9,8), %rcx
movl %ecx, %edi
shrq $0x20, %rcx
movq %r8, 0x80(%rsp)
shlq $0x20, %r8
movq %r8, 0xb0(%rsp)
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
andq %rdx, %rsi
movq %rsi, 0xc8(%rsp)
movq %rdi, 0xc0(%rsp)
leaq (,%rdi,8), %rdx
leaq (%rdx,%rdx,2), %rdx
movq %rdx, 0xb8(%rsp)
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
addq $0xc, %rax
movq %rax, 0xd0(%rsp)
xorl %r15d, %r15d
movq %r14, 0x10(%rsp)
movq (%r14), %rdi
leaq (%r15,%r15,4), %r9
movl 0xc(%rdi,%r9,8), %edx
leaq (%rdx,%rdx,2), %rsi
movl (%rbx,%rsi,4), %ecx
testl %ecx, %ecx
js 0xd2c75
movq 0xe8(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0x0, (%rax,%rdx,8)
js 0xd2c75
leaq (%rdi,%r9,8), %rax
leaq (%rbx,%rsi,4), %rsi
movl 0x4(%rsi), %esi
subl %ecx, %esi
movq 0x18(%rax), %rcx
testl %ecx, %ecx
js 0xd2bb2
movl 0x10(%rax), %r14d
movl 0x14(%rax), %r10d
subl %r10d, %esi
movl %esi, %r8d
movl %r14d, %esi
jmp 0xd2bc0
movl 0x10(%rax), %r14d
movl 0x14(%rax), %r10d
subl %r10d, %esi
movl %r14d, %r8d
movq (%rdi,%r9,8), %r9
movq %r9, %rdi
shrq $0x20, %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (%rbx,%rdi,4), %r11
movl 0x4(%r11), %edi
movl (%r11), %r11d
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andl %ebx, %r11d
subl %r11d, %edi
cmpl %r9d, %esi
movl %r9d, %ebx
cmovll %esi, %ebx
movl 0x8(%rax), %r11d
movl %edi, %r13d
subl %r11d, %r13d
cmpl %r8d, %r13d
movl %r8d, %ebp
cmovll %r13d, %ebp
cmpl %r12d, %ebx
jg 0xd2c6b
cmpl %r12d, %ebp
jg 0xd2c6b
movq %rcx, 0x18(%rsp)
movl %r11d, %r12d
subl %r9d, %r12d
xorps %xmm1, %xmm1
cvtsi2ss %r12, %xmm1
addl %ebx, %r12d
addl %ebp, %r12d
xorps %xmm2, %xmm2
cvtsi2ss %r12, %xmm2
leaq 0x1c2b24(%rip), %rcx    # 0x295758
movss 0x158(%rcx), %xmm0
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
ja 0xd2c66
subl %r14d, %r10d
xorps %xmm1, %xmm1
cvtsi2ss %r10, %xmm1
addl %ebx, %ebp
addl %r10d, %ebp
xorps %xmm2, %xmm2
cvtsi2ss %rbp, %xmm2
mulss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jbe 0xd2c8a
movl 0x4(%rsp), %r12d
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
incq %r15
movl 0xc(%r14), %eax
cmpq %rax, %r15
jb 0xd2b59
jmp 0xd3038
cmpl %r8d, %r13d
setl %r10b
setg %r14b
cmpl %esi, %r9d
setg %r13b
setl %bl
orb %r14b, %r13b
cmpb $0x1, %r13b
jne 0xd2c66
orb %r10b, %bl
je 0xd2c66
movl 0x24(%rsp), %r10d
cmpl %r10d, %r12d
jl 0xd2c66
cmpl %r10d, %ebp
movl 0x4(%rsp), %r12d
jl 0xd2c6b
movq 0x18(%rsp), %rcx
testl %ecx, %ecx
setns %r10b
addl %r11d, %r8d
movl %edi, %r11d
subl %r8d, %r11d
xorl %ebx, %ebx
movl %r9d, %r8d
subl %esi, %r8d
setle %bl
setg %sil
cmovlel %r11d, %r8d
xorb %r10b, %sil
movzbl %sil, %esi
shrq $0x1f, %r9
andl $-0x2, %r9d
orq %rbx, %r9
leal (%rsi,%rdx,2), %r10d
movq %r9, %rdx
shlq $0x20, %rdx
leaq (%r8,%rdx), %rsi
movq %rsi, 0x50(%rsp)
movl %r10d, 0x58(%rsp)
subl %r8d, %edi
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movl %edi, 0x5c(%rsp)
movzwl 0x60(%rsp), %esi
shrl $0x10, %ecx
andl $0x4000, %ecx           # imm = 0x4000
andl $0x3fff, %esi           # imm = 0x3FFF
orl %ecx, %esi
movb 0x20(%rax), %cl
movb %cl, 0x62(%rsp)
movzbl 0x21(%rax), %eax
shll $0xf, %eax
orl %esi, %eax
movw %ax, 0x60(%rsp)
testl %r8d, %r8d
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
movq 0xd0(%rsp), %r13
js 0xd2c75
xorq 0xc8(%rsp), %rdx
movabsq $0x100000000, %rax      # imm = 0x100000000
cmpq %rax, %rdx
jne 0xd2c75
movl %r10d, %ebp
shrl %ebp
movq 0x90(%rsp), %rax
movl (%rax,%rbp,4), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rcx
je 0xd2c75
movq %rcx, 0x18(%rsp)
movq 0x68(%rsp), %rdi
movq %rbx, %rsi
movl %r12d, %ecx
movl 0x24(%rsp), %r8d
leaq 0x50(%rsp), %rax
pushq %rax
movq %r10, 0x48(%rsp)
pushq %r10
callq 0xb3df3
addq $0x10, %rsp
testl %eax, %eax
je 0xd2c75
movq 0x28(%rsp), %rax
movq 0x18(%rsp), %rdx
movq (%rax,%rdx,8), %rax
shrq $0x21, %rax
cmpl %ebp, %eax
jne 0xd30d7
cmpq %rdx, 0x38(%rsp)
movq 0x40(%rsp), %rax
jbe 0xd2c75
movl %eax, %esi
movl 0x54(%rsp), %eax
movl 0x58(%rsp), %ecx
xorl $0x1, %ecx
movl %ecx, 0x4c(%rsp)
xorl $0x1, %eax
movq %rax, 0xa0(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x28(%rsp), %rax
movq (%rax,%rdx,8), %rdi
movq %rdi, %rax
shrq $0x21, %rax
cmpl %ebp, %eax
jne 0xd2c75
movq %rdi, %rax
shrq $0x20, %rax
cmpl %esi, %eax
jne 0xd3025
movl %edi, %eax
cmpq %rax, 0x80(%rsp)
je 0xd3025
cmpq $0x0, 0xc0(%rsp)
movq 0xb8(%rsp), %rcx
je 0xd2e85
xorl %eax, %eax
cmpl $0x0, (%r13,%rax)
js 0xd2e7c
cmpl %edi, -0x4(%r13,%rax)
je 0xd3025
addq $0x18, %rax
cmpq %rax, %rcx
jne 0xd2e69
movq %rdi, 0x40(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x68(%rsp), %rdi
movq %rbx, %rsi
movl %r12d, %ecx
movl 0x24(%rsp), %r8d
movl 0x4c(%rsp), %r9d
leaq 0x100(%rsp), %rax
pushq %rax
pushq 0xa8(%rsp)
callq 0xb3df3
addq $0x10, %rsp
testl %eax, %eax
je 0xd301b
movq 0x98(%rsp), %rax
movq (%rax), %r9
movl 0x4(%r9), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%r9), %ecx
movq %r9, 0x70(%rsp)
jne 0xd2f1e
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%r9)
movq 0x8(%r9), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq 0x70(%rsp), %r9
movq %rax, 0x8(%r9)
movl 0x4(%r9), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0xd2f22
movq 0x8(%r9), %rax
movq 0x40(%rsp), %r8
leal 0x1(%rdx), %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl %edi, %esi
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%r9)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
movq 0x60(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movl (%rax,%rcx,8), %edx
orq 0xb0(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
movl %r8d, 0x8(%rax,%rcx,8)
movl 0x4(%r9), %edx
movl %edx, %ecx
andl %edi, %ecx
cmpl (%r9), %ecx
jne 0xd2fb4
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%r9)
movq 0x8(%r9), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq 0x70(%rsp), %r9
movq 0x40(%rsp), %r8
movq %rax, 0x8(%r9)
movl 0x4(%r9), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0xd2fb8
movq 0x8(%r9), %rax
leal 0x1(%rdx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%r9)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movups 0x100(%rsp), %xmm0
movups %xmm0, (%rax,%rcx,8)
movq 0x110(%rsp), %rdx
movq %rdx, 0x10(%rax,%rcx,8)
movl (%rax,%rcx,8), %edx
shlq $0x20, %r8
orq %rdx, %r8
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorq %rdx, %r8
movq %r8, (%rax,%rcx,8)
movq 0xd8(%rsp), %rdx
movl %edx, 0x8(%rax,%rcx,8)
incq 0xa8(%rsp)
movq 0x18(%rsp), %rdx
movq 0x30(%rsp), %rsi
incq %rdx
cmpq 0x38(%rsp), %rdx
jne 0xd2e1d
jmp 0xd2c75
movq 0xf8(%rsp), %r8
incq %r8
cmpq 0xf0(%rsp), %r8
jne 0xd24be
cmpq $0x0, 0xa8(%rsp)
jne 0xd309d
movq 0x28(%rsp), %rbx
jmp 0xd306e
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x9dc69
movq %rbx, %rdi
callq 0x2220
movq 0x90(%rsp), %rdi
callq 0x2220
movq 0x88(%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x98(%rsp), %rdi
movl 0x150(%rsp), %esi
movq 0x78(%rsp), %rdx
callq 0x10d0c
jmp 0xd305c
leaq 0x1644eb(%rip), %rdi    # 0x2375aa
leaq 0x162dcb(%rip), %rsi    # 0x235e91
leaq 0x1644f7(%rip), %rcx    # 0x2375c4
movl $0x4ce2, %edx           # imm = 0x4CE2
callq 0x2110
leaq 0x1644cc(%rip), %rdi    # 0x2375aa
leaq 0x162dac(%rip), %rsi    # 0x235e91
leaq 0x1644d8(%rip), %rcx    # 0x2375c4
movl $0x4d0b, %edx           # imm = 0x4D0B
callq 0x2110