// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/horder.cpp
// Function: update_scg(horder_t*, trans_col_t*)
void update_scg(horder_t *h, trans_col_t *t_idx)
{
    uint64_t i, k, l, p0s, p0e, p1s, p1e, span_s, span_e, suid, euid, v, w, slen, elen, sd, ed;
    uint64_t t_hits = 0, a_hits = 0;
    double max_div, we;
    h_w_t e; kv_init(e);
    dens_idx_t *idx = NULL;
    hw_aux_t *ep = NULL;
    ma_ug_t *ug = h->ug;
    kvec_pe_hit *hits = &(h->u_hits);
    osg_arc_t *p = NULL;
    osg_destroy(h->sg.g); 
    h->sg.g = osg_init();
    for (i = 0; i < ug->u.n; i++) {
        osg_seq_set(h->sg.g, i, 0);
        h->sg.g->seq[i].mw[0] = h->sg.g->seq[i].mw[1] = 0;
        h->sg.g->seq[i].ez[0] = ug->u.a[i].len>>1;
        h->sg.g->seq[i].ez[1] = ug->u.a[i].len - (ug->u.a[i].len>>1);
    }
    idx = build_interval_idx(hits, ug);///idx is used to get density
    
    for (i = 0, e.n = 0; i < hits->a.n; i++) {
        if(!hits->a.a[i].id) continue;//hom hits
        suid = get_hit_suid(*hits, i);
        euid = get_hit_euid(*hits, i);
        if(suid == euid) continue;//same unitig
        slen = ug->u.a[suid].len;
        elen = ug->u.a[euid].len;

        p0s = get_hit_spos(*hits, i);
        p0e = get_hit_spos_e(*hits, i);
        span_s = MIN(p0s, p0e);
        span_s = MIN(span_s, slen-1);
        span_e = MAX(p0s, p0e);
        span_e =  MIN(span_e, slen-1);
        span_s = ((span_s+span_e)>>1);
        sd = span_s;
        v = suid << 1;
        if(span_s > (slen>>1)) v++;


        p1s = get_hit_epos(*hits, i);
        p1e = get_hit_epos_e(*hits, i);
        span_s = MIN(p1s, p1e);
        span_s = MIN(span_s, elen-1);
        span_e = MAX(p1s, p1e);
        span_e =  MIN(span_e, elen-1);
        span_s = ((span_s+span_e)>>1);
        ed = span_s;
        w = euid << 1;
        if(span_s > (elen>>1)) w++;
        t_hits++;
        
        kv_pushp(hw_aux_t, e, &ep);
        ep->w = 0;
        ep->e = (v<<32)|w; 
        ep->d = (sd<<32)|ed;

        if(v > w) {
            ep->e = (w<<32)|v;
            ep->d = (ed<<32)|sd;
        } 
        
        // div = h->sg.g->seq[v>>1].ez[v&1] + h->sg.g->seq[w>>1].ez[w&1];
        // max_div = MAX(max_div, div);
        a_hits++;
    }

    // fprintf(stderr, "sa-0-sa: occ-%lu\n", get_vw_hits_num(&e, 12, 690));
    // print_specfic_hic_hits(hits, 12, 690, ug);

    
    
    update_h_w(&e, idx, &max_div);

    // fprintf(stderr, "sa-1-sa: occ-%lu\n", get_vw_hits_num(&e, 676, 738));

    radix_sort_hw_e(e.a, e.a+e.n);
    for (k = 1, l = 0; k <= e.n; ++k) 
    {   
        if (k == e.n || e.a[k].e != e.a[l].e) 
        {
            for (i = 0; i < h->avoid.n; i++)
            {
                v = e.a[l].e;
                w = e.a[l].e<<32; w |= (e.a[l].e>>32);
                if(h->avoid.a[i] == v || h->avoid.a[i] == w)
                {
                    break;
                }
            }

            if(i >= h->avoid.n)
            {
                for (i = l, we = 0; i < k; i++)
                {
                    if(e.a[i].w == 0) fprintf(stderr, "ERROR-3\n");
                    we += (max_div/e.a[i].w);
                }
                
                p = osg_arc_pushp(h->sg.g);
                p->u = p->v = p->occ = p->del = p->w = p->nw = 0;
                p->u = e.a[l].e>>32; p->v = (uint32_t)e.a[l].e;
                p->occ = k - l; p->w = we;
                // if(div != 0) p->w = (double)(k - l)*(max_div/div);
                p = osg_arc_pushp(h->sg.g);
                p->u = p->v = p->occ = p->del = p->w = p->nw = 0;
                p->u = (uint32_t)e.a[l].e; p->v = e.a[l].e>>32;
                p->occ = k - l; p->w = we;
                

                h->sg.g->seq[e.a[l].e>>33].mw[(e.a[l].e>>32)&1] 
                                = MAX(h->sg.g->seq[e.a[l].e>>33].mw[(e.a[l].e>>32)&1], p->w);
                h->sg.g->seq[((uint32_t)e.a[l].e)>>1].mw[e.a[l].e&1]
                                = MAX(h->sg.g->seq[((uint32_t)e.a[l].e)>>1].mw[e.a[l].e&1], p->w);
            }

            l = k;
        }
    }

    // fprintf(stderr, "sa-2-sa: occ-%lu\n", get_vw_hits_num(&e, 676, 738));
    osg_cleanup(h->sg.g);
    double bestAlt;
    uint64_t eg_edges = 0;
    for (i = 0; i < h->sg.g->n_arc; i++)///all p->w should be >= 2
    {
        p = &(h->sg.g->arc[i]);
        bestAlt = MAX(h->sg.g->seq[p->u>>1].mw[p->u&1], h->sg.g->seq[p->v>>1].mw[p->v&1]);
        if(p->w >= bestAlt*0.95)///acutally should be p->w == bestAlt
        {
            bestAlt = get_max_weight(p->u, p->v, h->sg.g);
        }

        if(bestAlt == 0) bestAlt = 1;
        ///if there is just one edges between p->u and p->v, then bestAlt -> p->nw <= 1; this is wrong
        p->nw = p->w/bestAlt;
        if(p->nw > 1) eg_edges++;
    }

    fprintf(stderr, "[M::%s::] # Nodes: %u, # Edges: %u, # Best Edges: %lu, t_hits: %lu, a_hits: %lu\n", 
    __func__, h->sg.g->n_seq, h->sg.g->n_arc, eg_edges, t_hits, a_hits);

    /*******************************for debug************************************/
    /**
    for (i = 0; i < h->sg.g->n_arc; i++)
    {
        p = &(h->sg.g->arc[i]);
        fprintf(stderr, "u-stg%.6ul(%c)(div:%f)\tv-stg%.6ul(%c)(div:%f)\tocc:%u\tw:%f\tnw:%f\n", 
        (p->u>>1)+1, "+-"[p->u&1], h->sg.g->seq[p->u>>1].ez[p->u&1],
        (p->v>>1)+1, "+-"[p->v&1], h->sg.g->seq[p->v>>1].ez[p->v&1], p->occ, p->w, p->nw);
    }
    fprintf(stderr, "sbsbsbsb\n\n\n\n\n\n");
    **/
    
    // uint32_t u, nv, f;
    // osg_arc_t *av = NULL;
    // for (k = 0; k < h->sg.g->n_arc; k++)
    // {
    //     p = &(h->sg.g->arc[k]);
    //     u = p->u; v = p->v;
    //     f = 0;

    //     nv = asg_arc_n(h->sg.g, u);
    //     av = asg_arc_a(h->sg.g, u);
    //     for (i = 0; i < nv; i++)
    //     {
    //         if(av[i].v == v) continue;
    //         if(av[i].w > p->w) f = 1;
    //     }

    //     nv = asg_arc_n(h->sg.g, v);
    //     av = asg_arc_a(h->sg.g, v);
    //     for (i = 0; i < nv; i++)
    //     {
    //         if(av[i].v == u) continue;
    //         if(av[i].w > p->w) f = 1;
    //     }

    //     if(p->nw > 1 && f == 1) fprintf(stderr, "ERROR1\n");
    //     if(p->nw <= 1 && f == 0)
    //     {
    //         fprintf(stderr, "\nERROR2, nw-%f, w-%f, u-%u, v-%u\n", p->nw, p->w, p->u, p->v);
    //          nv = asg_arc_n(h->sg.g, u);
    //         av = asg_arc_a(h->sg.g, u);
    //         for (i = 0; i < nv; i++)
    //         {
    //             if(av[i].v == v) continue;
    //             fprintf(stderr, "+u-%u, v-%u, w-%f\n", av[i].u, av[i].v, av[i].w);
    //         }

    //         nv = asg_arc_n(h->sg.g, v);
    //         av = asg_arc_a(h->sg.g, v);
    //         for (i = 0; i < nv; i++)
    //         {
    //             if(av[i].v == u) continue;
    //             fprintf(stderr, "-u-%u, v-%u, w-%f\n", av[i].u, av[i].v, av[i].w);
    //         }
    //     } 
        
    // }
    /*******************************for debug************************************/
    kv_destroy(e); 
    free(idx->pos.a);
    free(idx->a);
    free(idx);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r15
xorpd %xmm0, %xmm0
andq $0x0, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movq 0xc8(%rdi), %r13
movq 0xd8(%rdi), %rdi
leaq 0x70(%r15), %rax
movq %rax, 0x40(%rsp)
callq 0x174c02
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x2120
movq %rax, 0xd8(%r15)
cmpq $0x0, (%r13)
je 0x20b0b
xorl %r14d, %r14d
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %ebx, %ebx
movq 0xd8(%r15), %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x174c30
movq 0xd8(%r15), %rax
movq 0x18(%rax), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax,%r14)
movq 0x10(%r13), %rcx
movl (%rcx,%r14), %edx
shrl %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x10(%rax,%r14)
movl (%rcx,%r14), %ecx
andl %ebp, %ecx
movl %ecx, %edx
shrl %edx
subl %edx, %ecx
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x18(%rax,%r14)
incq %rbx
addq $0x28, %r14
cmpq (%r13), %rbx
jb 0x20aa7
movq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x174eff
movq %rax, 0x58(%rsp)
andq $0x0, 0x68(%rsp)
movq 0x60(%rsp), %r12
movq 0x70(%rsp), %r11
cmpq $0x0, (%rbx)
movq %r15, 0x10(%rsp)
jne 0x20b49
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %r9d, %r9d
jmp 0x20d71
movq %rbx, %r10
movq %r13, 0x78(%rsp)
pushq $0x18
popq %rbx
xorl %ebp, %ebp
xorl %r9d, %r9d
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x80(%r15), %rdx
cmpq $0x0, -0x8(%rdx,%rbx)
je 0x20d61
movq -0x18(%rdx,%rbx), %rax
leaq (%rax,%rax), %rdi
movb 0xb8(%r15), %sil
xorl %ecx, %ecx
subb %sil, %cl
shrq %cl, %rdi
movq -0x10(%rdx,%rbx), %rsi
leaq (%rsi,%rsi), %r8
shrq %cl, %r8
cmpq %r8, %rdi
je 0x20d61
movq %r8, 0x50(%rsp)
movq %rdi, 0x18(%rsp)
movq %r9, 0x38(%rsp)
movq %r12, %rdi
movq 0xc0(%r15), %rcx
movq %rcx, %r8
andq %rax, %r8
testq %rax, %rax
js 0x20bd0
movl 0x4(%rdx,%rbx), %eax
leaq (%r8,%rax), %r12
decq %r12
jmp 0x20be6
leaq 0x1(%r8), %rax
movl 0x4(%rdx,%rbx), %r9d
subq %r9, %rax
movl $0x0, %r12d
cmovaeq %rax, %r12
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
imulq $0x28, 0x18(%rsp), %r9
movl (%rax,%r9), %r9d
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
andq %r10, %r9
cmpq %r12, %r8
movq %r12, %r10
cmovbq %r8, %r10
cmovaq %r8, %r12
leaq -0x1(%r9), %r8
cmpq %r8, %r10
cmovaeq %r8, %r10
cmpq %r8, %r12
cmovaeq %r8, %r12
addq %r10, %r12
shrq %r12
shrl %r9d
cmpq %r9, %r12
seta 0xe(%rsp)
andq %rsi, %rcx
testq %rsi, %rsi
movq %r14, 0x20(%rsp)
js 0x20c4c
movl (%rdx,%rbx), %edx
leaq (%rcx,%rdx), %r15
decq %r15
jmp 0x20c60
leaq 0x1(%rcx), %rsi
movl (%rdx,%rbx), %edx
subq %rdx, %rsi
movl $0x0, %r15d
cmovaeq %rsi, %r15
movq 0x50(%rsp), %r8
imulq $0x28, %r8, %rdx
movl (%rax,%rdx), %edx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %rdx
cmpq %r15, %rcx
movq %r15, %rsi
cmovbq %rcx, %rsi
cmovaq %rcx, %r15
leaq -0x1(%rdx), %rcx
cmpq %rcx, %rsi
cmovaeq %rcx, %rsi
cmpq %rcx, %r15
cmovaeq %rcx, %r15
addq %rsi, %r15
shrq %r15
shrl %edx
xorl %r14d, %r14d
cmpq %rdx, %r15
seta 0xf(%rsp)
cmpq %r11, 0x20(%rsp)
jne 0x20cd9
movq %r13, 0x48(%rsp)
leaq (%r11,%r11), %r13
testq %r11, %r11
pushq $0x2
popq %rax
cmoveq %rax, %r13
imulq $0x18, %r13, %rsi
callq 0x2370
movq 0x50(%rsp), %r8
movq %r13, %r11
movq 0x48(%rsp), %r13
jmp 0x20cdc
movq %rdi, %rax
movq 0x38(%rsp), %r9
movq 0x40(%rsp), %r10
movq 0x18(%rsp), %rcx
xorl %edx, %edx
movb 0xe(%rsp), %sil
movb %sil, %dl
leaq (%rdx,%rcx,2), %rdx
movb 0xf(%rsp), %cl
movb %cl, %r14b
leaq (%r14,%r8,2), %rsi
movq 0x20(%rsp), %r14
imulq $0x18, %r14, %rcx
andq $0x0, 0x10(%rax,%rcx)
movq %rdx, %rdi
shlq $0x20, %rdi
orq %rsi, %rdi
movq %rdi, (%rax,%rcx)
movq %r12, %rdi
shlq $0x20, %rdi
orq %r15, %rdi
movq %rax, %r8
movq %rdi, 0x8(%rax,%rcx)
cmpq %rsi, %rdx
jbe 0x20d50
addq %r8, %rcx
shlq $0x20, %rsi
orq %rdx, %rsi
movq %rsi, (%rcx)
shlq $0x20, %r15
orq %r12, %r15
movq %r15, 0x8(%rcx)
incq %r13
incq %r14
incq %r9
movq %r8, %r12
movq 0x10(%rsp), %r15
incq %rbp
addq $0x20, %rbx
cmpq (%r10), %rbp
jb 0x20b5f
movq %r9, 0x38(%rsp)
movq %r13, 0x48(%rsp)
leaq 0x60(%rsp), %rdi
movq %r14, 0x8(%rdi)
movq %r11, 0x10(%rdi)
movq %r12, (%rdi)
leaq 0x80(%rsp), %rdx
movq 0x58(%rsp), %rsi
callq 0x1751fe
imulq $0x18, %r14, %rsi
addq %r12, %rsi
movq %r12, %rdi
callq 0x16c9ac
testq %r14, %r14
je 0x2109d
leaq 0x10(%r12), %rax
movq %rax, 0x18(%rsp)
xorl %ebx, %ebx
xorpd %xmm1, %xmm1
pushq $0x1
popq %r13
cmpq %r14, %r13
je 0x20de8
imulq $0x18, %r13, %rax
movq (%r12,%rax), %rax
imulq $0x18, %rbx, %rcx
cmpq (%r12,%rcx), %rax
jne 0x20de8
movq %rbx, %rax
jmp 0x2108e
movq (%r15), %rax
testq %rax, %rax
setne %dil
je 0x20e4e
imulq $0x18, %rbx, %rcx
movq (%r12,%rcx), %rcx
movq 0x10(%r15), %rdx
movq %rcx, %rsi
rolq $0x20, %rsi
movq (%rdx), %r8
cmpq %rcx, %r8
sete %r9b
cmpq %rsi, %r8
sete %r8b
orb %r9b, %r8b
jne 0x20e42
leaq -0x1(%rax), %rdi
xorl %r8d, %r8d
cmpq %r8, %rdi
je 0x20e4e
movq 0x8(%rdx,%r8,8), %r9
incq %r8
cmpq %rcx, %r9
je 0x20e3b
cmpq %rsi, %r9
jne 0x20e24
cmpq %rax, %r8
setb %dil
movq %r13, %rax
testb %dil, %dil
jne 0x2108e
movq %r14, %rbp
xorpd %xmm2, %xmm2
cmpq %rbx, %r13
jbe 0x20ec1
imulq $0x18, %rbx, %r14
addq 0x18(%rsp), %r14
movq %rbx, %r15
movsd (%r14), %xmm0
ucomisd %xmm1, %xmm0
jne 0x20e73
jnp 0x20e93
movsd 0x80(%rsp), %xmm0
divsd (%r14), %xmm0
addsd %xmm0, %xmm2
incq %r15
addq $0x18, %r14
cmpq %r15, %r13
jne 0x20e66
jmp 0x20ec1
movq 0x269146(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x209fdf(%rip), %rdi    # 0x22ae83
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movapd %xmm2, 0x20(%rsp)
callq 0x2410
movapd 0x20(%rsp), %xmm2
xorpd %xmm1, %xmm1
jmp 0x20e73
movq 0x10(%rsp), %rax
movq 0xd8(%rax), %r14
movl 0x4(%r14), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %ecx
movl (%r14), %eax
cmpl %eax, %ecx
movapd %xmm2, 0x20(%rsp)
jne 0x20f0a
leal (%rax,%rax), %esi
testl %eax, %eax
pushq $0x10
popq %rax
cmovel %eax, %esi
movl %esi, (%r14)
movq 0x8(%r14), %rdi
shlq $0x5, %rsi
callq 0x2370
movapd 0x20(%rsp), %xmm2
movq %rax, 0x8(%r14)
movq 0x8(%r14), %rax
movl 0x4(%r14), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leal 0x1(%rdx), %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl %edi, %esi
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%r14)
shlq $0x5, %rcx
andl $0x0, 0x8(%rax,%rcx)
andq $0x0, (%rax,%rcx)
imulq $0x18, %rbx, %r14
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax,%rcx)
movq (%r12,%r14), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
movl %esi, 0x4(%rax,%rcx)
movl %edx, (%rax,%rcx)
movl %r13d, %r15d
subl %ebx, %r15d
andl %edi, %r15d
movl %r15d, 0x8(%rax,%rcx)
movsd %xmm2, 0x10(%rax,%rcx)
movq 0x10(%rsp), %rax
movq 0xd8(%rax), %rbx
movl 0x4(%rbx), %ecx
andl %edi, %ecx
movl (%rbx), %eax
cmpl %eax, %ecx
jne 0x20fad
leal (%rax,%rax), %esi
testl %eax, %eax
pushq $0x10
popq %rax
cmovel %eax, %esi
movl %esi, (%rbx)
movq 0x8(%rbx), %rdi
shlq $0x5, %rsi
callq 0x2370
movapd 0x20(%rsp), %xmm2
movq %rax, 0x8(%rbx)
movq 0x8(%rbx), %rax
movl 0x4(%rbx), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leal 0x1(%rdx), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %esi, %edx
movl %edx, 0x4(%rbx)
shlq $0x5, %rcx
andl $0x0, 0x8(%rax,%rcx)
andq $0x0, (%rax,%rcx)
addq %r12, %r14
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax,%rcx)
movq (%r14), %rdx
movl %edx, 0x4(%rax,%rcx)
shrq $0x20, %rdx
movl %edx, (%rax,%rcx)
movl %r15d, 0x8(%rax,%rcx)
movsd %xmm2, 0x10(%rax,%rcx)
movq 0x10(%rsp), %r15
movq 0xd8(%r15), %rdx
movq 0x18(%rdx), %rsi
movq (%r14), %rdx
movq %rdx, %rdi
shrq $0x21, %rdi
imulq $0x28, %rdi, %rdi
addq %rsi, %rdi
movq %rdx, %r8
shrq $0x20, %r8
andl $0x1, %r8d
movsd (%rdi,%r8,8), %xmm0
movapd %xmm2, %xmm1
cmplesd %xmm0, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm2, %xmm1
orpd %xmm0, %xmm1
movlpd %xmm1, (%rdi,%r8,8)
movl %edx, %edi
shrl %edi
imulq $0x28, %rdi, %rdi
addq %rsi, %rdi
andl $0x1, %edx
movsd (%rdi,%rdx,8), %xmm0
movsd 0x10(%rax,%rcx), %xmm1
movapd %xmm1, %xmm2
cmplesd %xmm0, %xmm2
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
movlpd %xmm2, (%rdi,%rdx,8)
movq %r13, %rax
movq %rbp, %r14
xorpd %xmm1, %xmm1
incq %r13
movq %rax, %rbx
cmpq %r14, %r13
jbe 0x20dc9
movq %r12, 0x10(%rsp)
movq 0xd8(%r15), %rdi
callq 0x174e07
movq 0xd8(%r15), %r12
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl 0x4(%r12), %r8d
andl %ebp, %r8d
jne 0x210cc
xorl %r15d, %r15d
jmp 0x211b9
movq 0x8(%r12), %rbx
movq 0x18(%r12), %r14
xorl %r15d, %r15d
movsd 0x2043b7(%rip), %xmm3   # 0x225498
xorpd %xmm4, %xmm4
movsd 0x204183(%rip), %xmm5   # 0x225270
xorl %r13d, %r13d
movl (%rbx), %esi
movl 0x4(%rbx), %edi
movl %edi, %eax
shrl %eax
imulq $0x28, %rax, %rax
addq %r14, %rax
movl %edi, %ecx
andl $0x1, %ecx
movsd (%rax,%rcx,8), %xmm1
movl %esi, %eax
shrl %eax
imulq $0x28, %rax, %rax
addq %r14, %rax
movl %esi, %ecx
andl $0x1, %ecx
movsd (%rax,%rcx,8), %xmm2
movapd %xmm2, %xmm0
cmplesd %xmm1, %xmm0
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
movsd 0x10(%rbx), %xmm6
movapd %xmm0, %xmm1
mulsd %xmm3, %xmm1
ucomisd %xmm1, %xmm6
jb 0x2116f
movq %r12, %rdx
movsd %xmm6, 0x20(%rsp)
callq 0x174e3f
movsd 0x20(%rsp), %xmm6
movsd 0x20410d(%rip), %xmm5   # 0x225270
xorpd %xmm4, %xmm4
movsd 0x204329(%rip), %xmm3   # 0x225498
movapd %xmm0, %xmm1
cmpeqsd %xmm4, %xmm1
movapd %xmm1, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm0, %xmm1
orpd %xmm2, %xmm1
divsd %xmm1, %xmm6
movsd %xmm6, 0x18(%rbx)
xorl %eax, %eax
ucomisd %xmm5, %xmm6
seta %al
addq %rax, %r15
incq %r13
movl 0x4(%r12), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
addq $0x20, %rbx
cmpq %r8, %r13
jb 0x210f0
movq 0x268e20(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
andl 0x14(%r12), %ebp
leaq 0x2105be(%rip), %rsi    # 0x23178d
leaq 0x210608(%rip), %rdx    # 0x2317de
movl %ebp, %ecx
movq %r15, %r9
xorl %eax, %eax
pushq 0x38(%rsp)
pushq 0x50(%rsp)
callq 0x22b0
popq %rcx
popq %rdx
movq 0x10(%rsp), %rdi
callq 0x2220
movq 0x58(%rsp), %rbx
movq 0x10(%rbx), %rdi
callq 0x2220
movq 0x18(%rbx), %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2220
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq