// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: integer_candidate(ul_resolve_t*, integer_t*, unsigned int, unsigned int)
void integer_candidate(ul_resolve_t *uidx, integer_t *buf, uint32_t qid, uint32_t is_hom)
{
    uint64_t k, z, m_het, m_het_occ, ref_occ, b_n, m; uint32_t vk, vz, is_circle = 0; integer_aln_t *p; ul_chain_t sc;
    ul_str_idx_t *str_idx = &(uidx->pstr); ma_ug_t *ug = uidx->l1_ug; 
    uint64_t *hid_a, hid_n; uc_block_t *xi;
    ul_str_t *str = &(str_idx->str.a[qid]);
    if(str->cn < 2) return; ///directly filter out too short UL
    kv_resize(uint64_t, buf->u, str->cn); buf->u.n = str->cn;
    for (k = m_het = m_het_occ = ref_occ = 0; k < str->cn; k++) {
        xi = &(uidx->idx->a[qid].bb.a[str->a[k]>>32]);
        assert(((xi->hid<<1)+xi->rev)==((uint32_t)str->a[k]));
        buf->u.a[k] = ug_occ_w(xi->ts, xi->te, &(ug->u.a[xi->hid]));
        assert(buf->u.a[k] > 0);
        if((!is_hom) && (!IF_HOM((((uint32_t)str->a[k])>>1), (*uidx->bub)))) {
            m_het++; m_het_occ += buf->u.a[k];///m_het_occ: how many het HiFi reads
        }
        ref_occ += buf->u.a[k];
        // fprintf(stderr, "[M::%s::k->%lu] buf->u.a[k]->%lu, ts->%u, te->%u, pchain->%u\n", __func__, k, buf->u.a[k], xi->ts, xi->te, xi->pchain);
    }
    // if((!is_hom) && (m_het < 2) && (m_het > 0)) return;///if all matched unitigs are hom, is ok
    if(m_het == 0 || m_het_occ == 0) is_hom = 1;
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-0");
    for (k = 0, buf->b.n = 0; k < str->cn; k++) {
        vk = (uint32_t)str->a[k];
        hid_a = str_idx->occ.a + str_idx->idx.a[vk>>1];
        hid_n = str_idx->idx.a[(vk>>1)+1] - str_idx->idx.a[vk>>1];
        for (z = 0; z < hid_n; z++) {
            if((hid_a[z]>>32) == qid) continue;
            if(str_idx->str.a[hid_a[z]>>32].cn < 2) continue;
            vz = (uint32_t)(str_idx->str.a[hid_a[z]>>32].a[(uint32_t)hid_a[z]]);
            assert((vk>>1) == (vz>>1));
            kv_pushp(integer_aln_t, buf->b, &p);
            p->vq = vk; p->tk = (uint32_t)hid_a[z]; 
            if((vk^vz)&1) p->tk = str_idx->str.a[hid_a[z]>>32].cn - p->tk - 1;///rev
            p->tn_rev_qk = (hid_a[z]>>32); p->tn_rev_qk <<= 1; p->tn_rev_qk |= ((vk^vz)&1);
            p->tn_rev_qk <<= 32; p->tn_rev_qk += k; 
            ///set score of this pair
            p->sc = buf->u.a[k];
            xi = &(uidx->idx->a[hid_a[z]>>32].bb.a[(str_idx->str.a[hid_a[z]>>32].a[(uint32_t)hid_a[z]])>>32]);
            assert(((xi->hid<<1)+xi->rev)==vz); m = ug_occ_w(xi->ts, xi->te, &(ug->u.a[xi->hid]));
            if(p->sc > m) p->sc = m;
        }
    }
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-1");
    radix_sort_integer_aln_t_srt(buf->b.a, buf->b.a + buf->b.n); 
    b_n = buf->b.n; buf->sc.n = 0;
    for (k = 1, z = 0; k <= b_n; k++) {
        if(k == b_n || (buf->b.a[z].tn_rev_qk>>32) != (buf->b.a[k].tn_rev_qk>>32)) {
            ///get the chain for <qn, tn>
            if(integer_chain(qid, buf->b.a + z, k - z, z, buf, ug, str_idx, uidx->idx, &sc) && sc.v != (uint32_t)-1) {
                if((buf->sc.n > 0) && ((buf->sc.a[buf->sc.n-1].v>>1) == (sc.v>>1))) {
                    if(buf->sc.a[buf->sc.n-1].sc < sc.sc) {
                        buf->sc.a[buf->sc.n-1] = sc;
                    }
                } else {
                    kv_push(ul_chain_t, buf->sc, sc);
                }
            }
            z = k;
        }
    }
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-2");
    uint64_t *o, o_n, cns_het, cns_het_occ, ref_cns_occ, corrected = 0;
    o_n = integer_chain_dp(uidx->bub, buf, str_idx->str.a, buf->b.a, buf->sc.a, buf->sc.n, qid, is_hom, 2, &corrected);
    assert(o_n <= str->cn); 
    // if(qid == 2062 || qid == 2093) fprintf(stderr,"[M::%s::] o_n::%lu, str->cn::%u, corrected::%lu\n", __func__, o_n, str->cn, corrected);
    if(o_n <= 0) return; 
    if(corrected) return;
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-3");
    
    for (k = cns_het = cns_het_occ = ref_cns_occ = 0, o = buf->o.a; k < o_n; k++) {
        if((!is_hom) && (!IF_HOM((((uint32_t)str->a[o[k]])>>1), (*uidx->bub)))) {
            cns_het++; cns_het_occ += buf->u.a[o[k]];
        }
        ref_cns_occ += buf->u.a[o[k]];     
    }
    buf->o.n = o_n;
    ///1. if the ref read only has hom unitigs, is fine
    ///2. otherwise need to have consenus het untigs
    if(!is_hom) {
        if((cns_het <= 0) || (cns_het_occ <= 0) || (cns_het_occ <= (m_het_occ*0.25))) return;
    } else {
        if(ref_cns_occ <= (ref_occ*0.25)) return;
    }
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-4");
    // fprintf(stderr, "\n");
    // print_integer_seq(ug, str_idx->str.a, qid, 1);
    // print_aln_seq(ug, uidx->idx, qid, 1);
    // if(qid == 2062 || qid == 2093) print_cns_seq(ug, str, o, o_n);
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-5");

    for (k = m = 0; k < buf->sc.n; k++) {
        // fprintf(stderr, "[M::%s::k->%lu] m::%lu\n", __func__, k, m);
        // if(k == 72) {
        //     print_integer_ovlps(ug, str_idx->str.a, buf->b.a, buf->b.n, buf->sc.a+k, 1, qid, o_n);
        // }
        if(refine_integer_ovlps(uidx->idx, uidx->bub, ug, str_idx->str.a, buf->b.a, 
                                                            &(buf->sc.a[k]), qid, buf, o, o_n)) {                                                
            buf->sc.a[m++] = buf->sc.a[k];
        } 
        // else {
        //     print_integer_ovlps(ug, str_idx->str.a, buf->b.a, buf->b.n, buf->sc.a+k, 1, qid, o_n);
        //     fprintf(stderr, "[M::%s::] idx->q_sidx::%u, idx->q_eidx::%u, idx->t_sidx::%u, idx->t_eidx::%u\n******************************************************\n", 
        //         __func__, buf->sc.a[k].q_sidx, buf->sc.a[k].q_eidx, buf->sc.a[k].t_sidx, buf->sc.a[k].t_eidx);
        // }
    }
    buf->sc.n = m;
    if(m <= 0) return;
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-6");
    // if(m != str->cn) print_integer_ovlps(uidx->l1_ug, str_idx->str.a, buf->b.a, buf->b.n, buf->sc.a, buf->sc.n, qid, m);
    poa_cns_chain(&(buf->pg), uidx->idx, ug, str_idx->str.a, buf->sc.a, buf->sc.n, qid, buf, &is_circle);
    if(is_circle) {
        buf->n_circle++;
        return;
    }
    // print_ul_alignment(ug, &UL_INF, 27512, "inner-7");
    // print_res_seq(&(buf->pg), ug, buf->pg.srt_b.res.a, buf->pg.srt_b.res.n);
    // radix_sort_ul_chain_t_srt(buf->sc.a, buf->sc.a + buf->sc.n);
    
    // integer_phase(str_idx->str.a, buf, buf->sc.a, buf->sc.n, buf->b.a, qid);

    // radix_sort_ul_chain_t_srt(buf->sc.a, buf->sc.a + buf->sc.n);
    o = NULL; o_n = 0;
    update_raw_integer_seq(&(buf->pg), ug, buf->pg.srt_b.res.a, buf->pg.srt_b.res.n, uidx->idx, str_idx->str.a, qid, buf, buf->sc.a, buf->sc.n);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, %r13d
movl $0x0, 0x44(%rsp)
movq 0x1d0(%rdi), %rbx
movq %rdx, 0x48(%rsp)
movl %edx, %r12d
movq %r12, %rcx
shlq $0x5, %rcx
movl 0x18(%rbx,%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl $0x2, %eax
jae 0x205b86
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rdi), %rbp
addq %rcx, %rbx
cmpq %rax, 0x98(%rsi)
movq %rsi, (%rsp)
movq %rdi, 0x8(%rsp)
jae 0x205c0a
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x98(%rsi)
movq 0xa0(%rsi), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
movq %rax, 0xa0(%rsi)
movl 0x18(%rbx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 0x90(%rsi)
testl $0x7fffffff, 0x18(%rbx) # imm = 0x7FFFFFFF
movq %r12, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
je 0x205d4b
movq 0x30(%rdi), %rax
movq 0x48(%rax), %rax
imulq $0x58, %r12, %rcx
movq %rbx, %rdx
movq 0x30(%rax,%rcx), %rbx
movq 0x10(%rdx), %r14
xorl %r15d, %r15d
movq $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
xorl %r12d, %r12d
movq (%r14,%r15,8), %rdx
movq %rdx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,8), %rcx
movl (%rbx,%rcx,4), %eax
movl 0x20(%rbx,%rcx,4), %esi
shrl $0x5, %esi
andl $0x1, %esi
leal (%rsi,%rax,2), %esi
cmpl %edx, %esi
jne 0x20647a
leaq (%rbx,%rcx,4), %rcx
movl 0xc(%rcx), %edi
movl 0x10(%rcx), %esi
leaq (%rax,%rax,4), %rdx
shlq $0x3, %rdx
addq 0x10(%rbp), %rdx
callq 0x1fe266
movq (%rsp), %rsi
movq 0xa0(%rsi), %rcx
movq %rax, (%rcx,%r15,8)
testq %rax, %rax
je 0x20645b
testl %r13d, %r13d
movq 0x8(%rsp), %rdi
jne 0x205ce6
movq 0x28(%rdi), %rcx
movl (%r14,%r15,8), %edx
shrl %edx
movq (%rcx), %r8
movq 0x80(%rcx), %rcx
movl (%r8,%rdx,4), %edx
incq %rcx
cmpq %rdx, %rcx
jb 0x205ce6
incq 0x20(%rsp)
addq %rax, 0x28(%rsp)
addq %rax, %r12
incq %r15
movq 0x18(%rsp), %rax
movl 0x18(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r15
jb 0x205c58
cmpq $0x0, 0x20(%rsp)
movq %r12, %xmm0
punpckldq 0x2b56b(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
sete %al
subpd 0x2b570(%rip), %xmm0    # 0x231290
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x2b89c(%rip), %xmm1    # 0x2315d0
movapd %xmm1, 0x60(%rsp)
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %rbx
movq 0x28(%rsp), %rcx
jmp 0x205d59
movb $0x1, %al
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
xorl %ecx, %ecx
movq %rbp, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
movl $0x1, %ecx
cmovel %ecx, %r13d
testb %al, %al
cmovnel %ecx, %r13d
movq %r13, 0x38(%rsp)
movq $0x0, 0x30(%rsi)
movl 0x18(%rbx), %eax
xorl %ebp, %ebp
testl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
je 0x205f8a
xorl %edx, %edx
movq 0x10(%rbx), %rcx
movq %rdx, 0x20(%rsp)
movl (%rcx,%rdx,8), %edx
movq 0x1a0(%rdi), %rcx
movl %edx, 0x40(%rsp)
shrl %edx
movq (%rcx,%rdx,8), %r15
movq %rdx, 0x50(%rsp)
movq 0x8(%rcx,%rdx,8), %r14
cmpq %r15, %r14
je 0x205f71
movq 0x1b8(%rdi), %rbx
movq (%rbx,%r15,8), %rax
movq %rax, %rdx
shrq $0x20, %rdx
cmpq %r12, %rdx
je 0x205f5d
movq 0x1d0(%rdi), %rcx
shlq $0x5, %rdx
testl $0x7ffffffe, 0x18(%rcx,%rdx) # imm = 0x7FFFFFFE
je 0x205f5d
addq %rcx, %rdx
movq 0x10(%rdx), %rdx
movl %eax, %eax
movl (%rdx,%rax,8), %r12d
movl %r12d, %eax
shrl %eax
cmpl %eax, 0x50(%rsp)
jne 0x20641d
movq 0x40(%rsi), %rax
cmpq 0x38(%rsi), %rbp
jne 0x205e5e
leaq (,%rbp,2), %rcx
testq %rbp, %rbp
movl $0x2, %edx
cmoveq %rdx, %rcx
movq %rcx, 0x38(%rsi)
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq 0x8(%rsp), %rdi
movq (%rsp), %rsi
movq %rax, 0x40(%rsi)
movq 0x30(%rsi), %rbp
movq 0x1d0(%rdi), %rcx
leaq (,%rbp,2), %rdx
addq %rbp, %rdx
incq %rbp
movq %rbp, 0x30(%rsi)
leaq (%rax,%rdx,8), %r13
movl 0x40(%rsp), %r8d
movl %r8d, 0x4(%r13)
movq (%rbx,%r15,8), %rax
movl %eax, (%r13)
movl %r12d, %edx
xorl %r8d, %edx
andl $0x1, %edx
je 0x205eb6
movq %rax, %r8
shrq $0x1b, %r8
andq $-0x20, %r8
movl 0x18(%rcx,%r8), %r8d
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
andl %r9d, %r8d
movl %eax, %r9d
notl %r9d
addl %r8d, %r9d
movl %r9d, (%r13)
shrq $0x1f, %rax
andl $-0x2, %eax
orl %edx, %eax
shlq $0x20, %rax
movq 0x20(%rsp), %rdx
addq %rdx, %rax
movq %rax, 0x10(%r13)
movq 0xa0(%rsi), %rax
movq (%rax,%rdx,8), %rax
movl %eax, 0x8(%r13)
movq 0x30(%rdi), %rdx
movq 0x48(%rdx), %rdx
movq (%rbx,%r15,8), %rsi
movl %esi, %edi
shrq $0x20, %rsi
imulq $0x58, %rsi, %r8
movq 0x30(%rdx,%r8), %rdx
shlq $0x5, %rsi
movq 0x10(%rcx,%rsi), %rcx
movl 0x4(%rcx,%rdi,8), %ecx
leaq (%rcx,%rcx,8), %rsi
movl (%rdx,%rsi,4), %ecx
movl 0x20(%rdx,%rsi,4), %edi
shrl $0x5, %edi
andl $0x1, %edi
leal (%rdi,%rcx,2), %edi
cmpl %r12d, %edi
jne 0x20643c
movl %eax, %r12d
leaq (%rdx,%rsi,4), %rax
movl 0xc(%rax), %edi
movl 0x10(%rax), %esi
leaq (%rcx,%rcx,4), %rdx
shlq $0x3, %rdx
movq 0x30(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1fe266
cmpq %r12, %rax
jae 0x205f4f
movl %eax, 0x8(%r13)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r12
incq %r15
cmpq %r15, %r14
jne 0x205dcb
movq 0x18(%rsp), %rbx
movl 0x18(%rbx), %eax
movq 0x20(%rsp), %rdx
incq %rdx
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %rdx
jb 0x205d94
movq 0x40(%rsi), %rdi
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq (%rdi,%rax,8), %rsi
callq 0x1eef97
movq (%rsp), %r10
movq 0x30(%r10), %rbx
movq $0x0, 0xc0(%r10)
testq %rbx, %rbx
je 0x206126
movq 0x8(%rsp), %rax
leaq 0x190(%rax), %r14
movl $0x1, %r15d
movl $0x28, %r12d
xorl %ecx, %ecx
leaq 0x70(%rsp), %r13
movl $0x2, %ebp
movq 0x40(%r10), %rax
cmpq %r15, %rbx
je 0x206002
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%r12), %rsi
xorq 0x10(%rax,%rdx,8), %rsi
shrq $0x20, %rsi
je 0x206108
leaq (%rcx,%rcx,2), %rdx
leaq (%rax,%rdx,8), %rsi
movq %r15, %rdx
subq %rcx, %rdx
subq $0x8, %rsp
movq 0x50(%rsp), %rdi
movq %r10, %r8
movq 0x38(%rsp), %r9
pushq %r13
movq 0x18(%rsp), %rax
pushq 0x30(%rax)
pushq %r14
callq 0x1ff87d
movq 0x20(%rsp), %r10
addq $0x20, %rsp
movl 0x78(%rsp), %edx
cmpl $-0x1, %edx
setne %sil
andb %al, %sil
movq %r15, %rcx
cmpb $0x1, %sil
jne 0x206108
movq 0xc0(%r10), %rcx
movq 0xd0(%r10), %rax
testq %rcx, %rcx
je 0x206091
leaq (%rcx,%rcx,4), %rsi
xorl -0x20(%rax,%rsi,8), %edx
cmpl $0x1, %edx
ja 0x206091
leaq (%rax,%rsi,8), %rax
movq -0x18(%rax), %rdx
movq %r15, %rcx
cmpq 0x80(%rsp), %rdx
jae 0x206108
addq $-0x28, %rax
jmp 0x2060e1
cmpq 0xc8(%r10), %rcx
jne 0x2060ce
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
cmoveq %rbp, %rdx
movq %rdx, 0xc8(%r10)
shlq $0x3, %rdx
leaq (%rdx,%rdx,4), %rsi
movq %rax, %rdi
callq 0x2370
movq (%rsp), %r10
movq %rax, 0xd0(%r10)
movq 0xc0(%r10), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0xc0(%r10)
leaq (%rcx,%rcx,4), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x90(%rsp), %rcx
movq %rcx, 0x20(%rax)
movupd 0x70(%rsp), %xmm0
movupd 0x80(%rsp), %xmm1
movupd %xmm1, 0x10(%rax)
movupd %xmm0, (%rax)
movq %r15, %rcx
incq %r15
addq $0x18, %r12
cmpq %rbx, %r15
jbe 0x205fe2
movq 0xc0(%r10), %r9
movq 0x10(%rsp), %r12
jmp 0x206129
xorl %r9d, %r9d
leaq 0x58(%rsp), %rax
movq $0x0, (%rax)
movq 0x8(%rsp), %rcx
movq 0x28(%rcx), %rdi
movq 0x1d0(%rcx), %rdx
movq 0x40(%r10), %rcx
movq 0xd0(%r10), %r8
movq %r10, %rsi
pushq %rax
pushq $0x2
pushq 0x48(%rsp)
pushq %r12
callq 0x1ffeb5
addq $0x20, %rsp
movq 0x18(%rsp), %r11
movl 0x18(%r11), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %rax
movq 0x28(%rsp), %r14
ja 0x206499
testq %rax, %rax
movq (%rsp), %r10
je 0x205b74
cmpq $0x0, 0x58(%rsp)
jne 0x205b74
movq 0x88(%r10), %r12
movq 0xa0(%r10), %rsi
movq %rax, %rdi
negq %rdi
xorl %r15d, %r15d
xorl %ecx, %ecx
xorl %edx, %edx
xorl %r8d, %r8d
incq %r8
cmpl $0x0, 0x38(%rsp)
je 0x2061e1
movq -0x8(%r12,%r8,8), %r9
addq (%rsi,%r9,8), %r15
leaq (%rdi,%r8), %r9
incq %r9
incq %r8
cmpq $0x1, %r9
jne 0x2061bc
jmp 0x20629f
movq 0x8(%rsp), %r9
movq 0x28(%r9), %r10
movq 0x10(%r11), %r11
movq -0x8(%r12,%r8,8), %r9
movl (%r11,%r9,8), %r11d
shrl %r11d
movq (%r10), %rbx
movq 0x80(%r10), %r10
movl (%rbx,%r11,4), %r11d
incq %r10
cmpq %r11, %r10
jb 0x206217
incq %rdx
addq (%rsi,%r9,8), %rcx
movq (%rsp), %r10
addq (%rsi,%r9,8), %r15
movq %rdi, %r9
addq %r8, %r9
movq 0x18(%rsp), %r11
jne 0x2061b9
movq %rax, 0x78(%r10)
cmpl $0x0, 0x38(%rsp)
jne 0x2062a3
testq %rdx, %rdx
je 0x205b74
testq %rcx, %rcx
je 0x205b74
movq %rcx, %xmm0
movq 0x2b02a(%rip), %xmm1    # 0x231280
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x2b02e(%rip), %xmm2    # 0x231290
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq %r14, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x2b33d(%rip), %xmm1    # 0x2315d0
ucomisd %xmm3, %xmm1
jae 0x205b74
jmp 0x2062d4
movq %rax, 0x78(%r10)
movq %r15, %xmm0
punpckldq 0x2afd0(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2afd8(%rip), %xmm0    # 0x231290
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd 0x60(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jae 0x205b74
cmpq $0x0, 0xc0(%r10)
je 0x205b74
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x8(%rsp), %rcx
movq 0x28(%rcx), %rsi
movq 0x30(%rcx), %rdi
movq 0x1d0(%rcx), %rcx
movq 0x40(%r10), %r8
movq 0xd0(%r10), %r9
addq %rbx, %r9
movq 0x30(%rsp), %rdx
movq %rax, %rbp
pushq %rax
pushq %r12
pushq %r10
pushq 0x28(%rsp)
movq %r10, %r15
callq 0x200db3
addq $0x20, %rsp
testq %rax, %rax
je 0x206363
movq 0xd0(%r15), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
incq %r13
movq 0x20(%rax,%rbx), %rdx
movq %rdx, 0x20(%rax,%rcx,8)
movupd (%rax,%rbx), %xmm0
movupd 0x10(%rax,%rbx), %xmm1
movupd %xmm1, 0x10(%rax,%rcx,8)
movupd %xmm0, (%rax,%rcx,8)
movq %r15, %r10
incq %r14
addq $0x28, %rbx
cmpq 0xc0(%r15), %r14
movq %rbp, %rax
jb 0x2062ea
movq %r13, 0xc0(%r10)
testq %r13, %r13
je 0x205b74
movq 0x30(%rsp), %r12
leaq 0xf0(%r10), %rbp
movq 0x8(%rsp), %r15
movq 0x30(%r15), %rsi
movq 0x1d0(%r15), %rcx
movq 0xd0(%r10), %r8
subq $0x8, %rsp
leaq 0x4c(%rsp), %rbx
movq %rbp, %rdi
movq %r12, %rdx
movq %r13, %r9
pushq %rbx
pushq %r10
pushq 0x28(%rsp)
movq %r10, %r14
callq 0x20495f
addq $0x20, %rsp
cmpl $0x0, (%rbx)
je 0x2063e6
incq 0x320(%r14)
jmp 0x205b74
movq 0x180(%r14), %rdx
movl 0x170(%r14), %ecx
movq 0x30(%r15), %r8
movq 0x1d0(%r15), %r9
subq $0x10, %rsp
movq %rbp, %rdi
movq %r12, %rsi
pushq %r14
pushq 0x60(%rsp)
callq 0x20576c
addq $0x20, %rsp
jmp 0x205b74
leaq 0x4113a(%rip), %rdi     # 0x24755e
leaq 0x3f1de(%rip), %rsi     # 0x245609
leaq 0x410d4(%rip), %rcx     # 0x247506
movl $0x1953, %edx           # imm = 0x1953
callq 0x2110
leaq 0x4112e(%rip), %rdi     # 0x247571
leaq 0x3f1bf(%rip), %rsi     # 0x245609
leaq 0x410b5(%rip), %rcx     # 0x247506
movl $0x195c, %edx           # imm = 0x195C
callq 0x2110
leaq 0x410ec(%rip), %rdi     # 0x24754e
leaq 0x3f1a0(%rip), %rsi     # 0x245609
leaq 0x41096(%rip), %rcx     # 0x247506
movl $0x1941, %edx           # imm = 0x1941
callq 0x2110
leaq 0x41057(%rip), %rdi     # 0x2474d8
leaq 0x3f181(%rip), %rsi     # 0x245609
leaq 0x41077(%rip), %rcx     # 0x247506
movl $0x193f, %edx           # imm = 0x193F
callq 0x2110
leaq 0x410ec(%rip), %rdi     # 0x24758c
leaq 0x3f162(%rip), %rsi     # 0x245609
leaq 0x41058(%rip), %rcx     # 0x247506
movl $0x1975, %edx           # imm = 0x1975
callq 0x2110