// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: recover_utg_by_coverage(ma_ug_t**, asg_t*, ma_sub_t*, ma_hit_t_alloc*, R_to_U*, trans_chain*)
void recover_utg_by_coverage(ma_ug_t **ptg, asg_t* read_g, ma_sub_t* coverage_cut, 
ma_hit_t_alloc* sources, R_to_U* ruIndex, trans_chain* t_ch)
{
    if(asm_opt.recover_atg_cov_min == -1) return;
    if(asm_opt.recover_atg_cov_max == -1) return;
    if(asm_opt.recover_atg_cov_min > asm_opt.recover_atg_cov_max) return;
    ma_ug_t *atg = NULL;
    atg = ma_ug_gen_primary(read_g, ALTER_LABLE);
    asg_t* nsg = atg->g;
    uint32_t v, n_vtx = nsg->n_seq, k, j, rId, available_reads = 0, keep_atg = 0, tn, is_Unitig;
    ma_utg_t* u = NULL;
    ma_hit_t *h;

    
    ///print_untig_by_read(atg, "SRR11606870.634978", -1, NULL, NULL, "debug");
    long long R_bases = 0, C_bases = 0, C_bases_primary = 0, C_bases_alter = 0;
    long long total_C_bases = 0, total_C_bases_alter = 0;
    for (v = 0; v < n_vtx; ++v) 
    {
        if(nsg->seq[v].del) continue;
        u = &(atg->u.a[v]);
        if(u->m == 0) continue;
        total_C_bases = total_C_bases_alter = available_reads = 0;
        
        for (k = 0; k < u->n; k++)
        {
            rId = u->a[k]>>33;
            C_bases = C_bases_primary = C_bases_alter = 0;
            R_bases = coverage_cut[rId].e - coverage_cut[rId].s;
            for (j = 0; j < (uint64_t)(sources[rId].length); j++)
            {
                h = &(sources[rId].buffer[j]);
                if(h->el != 1) continue;
                tn = Get_tn((*h));
                if(read_g->seq[tn].del == 1)
                {
                    ///get the id of read that contains it 
                    get_R_to_U(ruIndex, tn, &tn, &is_Unitig);
                    if(tn == (uint32_t)-1 || is_Unitig == 1 || read_g->seq[tn].del == 1) continue;
                }
                if(read_g->seq[tn].del == 1) continue;
                if(read_g->seq[tn].c == ALTER_LABLE)
                {
                    C_bases_alter += Get_qe((*h)) - Get_qs((*h));
                }
                else
                {
                    C_bases_primary += Get_qe((*h)) - Get_qs((*h));
                }
            }

            C_bases = C_bases_primary + C_bases_alter;
            total_C_bases += C_bases; 

            C_bases = C_bases/R_bases;
            if(C_bases >= asm_opt.recover_atg_cov_min && C_bases <= asm_opt.recover_atg_cov_max)
            {
                if(C_bases_alter >= (C_bases_primary + C_bases_alter) * ALTER_COV_THRES) available_reads++;
                total_C_bases_alter += C_bases_alter;
            }
        }


        if(((available_reads < (u->n * 0.8)) && (total_C_bases_alter < (total_C_bases * 0.8))) 
           || available_reads == 0)
        {
            asg_seq_del(nsg, v);

            if(u->m!=0)
            {
                u->m = u->n = 0;
                free(u->a);
                u->a = NULL;
            }
        }
        else
        {
            ///print_utg_coverage(atg, coverage_cut, v, sources);
            ///fprintf(stderr, "rId: %u\n", rId);
            ///fprintf(stderr, "%.*s\t%lld\n", (int)Get_NAME_LENGTH(R_INF, rId), Get_NAME(R_INF, rId), C_bases);
            keep_atg++;
        }
    }

    if(keep_atg > 0)
    {
        asg_cleanup(nsg);
        asg_symm(nsg);
        append_utg(*ptg, atg, t_ch);

        n_vtx = read_g->n_seq;
        for (v = 0; v < n_vtx; v++)
        {
            read_g->seq[v].c = ALTER_LABLE;
        }
        
        nsg = (*ptg)->g;
        n_vtx = nsg->n_seq;
        for (v = 0; v < n_vtx; ++v) 
        {
            if(nsg->seq[v].del) continue;
            u = &((*ptg)->u.a[v]);
            if(u->m == 0) continue;
            for (k = 0; k < u->n; k++)
            {
                rId = u->a[k]>>33;
                read_g->seq[rId].c = nsg->seq[v].c;
            }
        }


        n_vtx = read_g->n_seq;
        for (v = 0; v < n_vtx; v++)
        {
            if(read_g->seq[v].c == ALTER_LABLE)
            {
                asg_seq_drop(read_g, v);
            }
        }
    }

    ma_ug_destroy(atg);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, 0x80(%rsp)
leaq 0x1a292f(%rip), %rax    # 0x295758
movl 0x13c(%rax), %eax
cmpl $-0x1, %eax
je 0xf38fb
movq %rcx, %r15
leaq 0x1a2916(%rip), %rcx    # 0x295758
movl 0x140(%rcx), %ecx
cmpl $-0x1, %ecx
je 0xf38fb
cmpl %ecx, %eax
jg 0xf38fb
movq %r8, %r13
movq %rsi, %rbx
movq %rdi, %r14
movq %r9, 0x60(%rsp)
movq %rsi, %rdi
movl $0x1, %esi
callq 0xb2a6d
movq %rax, 0x28(%rsp)
movq 0x18(%rax), %r12
movl 0x14(%r12), %edx
andq $0x7fffffff, %rdx       # imm = 0x7FFFFFFF
je 0xf38e0
movq %r14, 0x58(%rsp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movsd 0x13e70e(%rip), %xmm2   # 0x2315b0
movsd 0x13e74e(%rip), %xmm3   # 0x2315f8
xorl %esi, %esi
movl $0x0, 0xc(%rsp)
movq %r15, 0x78(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x20(%r12), %rdi
movl (%rdi,%rsi,8), %r8d
testl %r8d, %r8d
js 0xf31ba
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
leaq (%rsi,%rsi,4), %rcx
cmpl $0x0, 0xc(%rax,%rcx,8)
je 0xf31ba
leaq (%rax,%rcx,8), %rax
movl 0x10(%rax), %ecx
movq %rcx, 0x40(%rsp)
testq %rcx, %rcx
movq %rsi, 0x18(%rsp)
movq %rax, 0x68(%rsp)
je 0xf30a9
movl %r8d, 0x10(%rsp)
movq %rdi, 0x30(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x90(%rsp)
leaq 0x1a2834(%rip), %rax    # 0x295758
movslq 0x13c(%rax), %rcx
movq %rcx, 0x88(%rsp)
movslq 0x140(%rax), %rax
movq %rax, 0x70(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x38(%rsp)
xorl %r11d, %r11d
movl $0x0, 0x14(%rsp)
movq 0x90(%rsp), %rax
movq (%rax,%rbp,8), %rax
shrq $0x21, %rax
leaq (%rax,%rax,2), %rax
movl 0xc(%r15,%rax,8), %ecx
testq %rcx, %rcx
je 0xf2fdf
leaq (%r15,%rax,8), %rdx
movq (%rdx), %rdx
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %r10
xorl %r8d, %r8d
xorl %r15d, %r15d
xorl %ecx, %ecx
cmpb $0x1, 0x20(%rdx,%r8)
jne 0xf2fd4
movl 0xc(%rdx,%r8), %esi
movq 0x20(%rbx), %rdi
cmpl $0x0, (%rdi,%rsi,8)
js 0xf2fb6
movl 0x8(%rdx,%r8), %r9d
subl (%rdx,%r8), %r9d
cmpb $0x1, 0x4(%rdi,%rsi,8)
jne 0xf2fd1
addq %r9, %r15
jmp 0xf2fd4
cmpq %rsi, (%r13)
jbe 0xf2fd4
movq 0x8(%r13), %r9
movslq (%r9,%rsi,4), %rsi
testq %rsi, %rsi
js 0xf2fd4
cmpl $0x0, (%rdi,%rsi,8)
jns 0xf2fa1
jmp 0xf2fd4
addq %r9, %rcx
addq $0x28, %r8
cmpq %r8, %r10
jne 0xf2f8a
jmp 0xf2fe4
xorl %ecx, %ecx
xorl %r15d, %r15d
movq 0x80(%rsp), %rdx
movl 0x4(%rdx,%rax,4), %esi
movl (%rdx,%rax,4), %eax
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %eax
subl %eax, %esi
addq %r15, %rcx
movq %rcx, %rax
cqto
idivq %rsi
cmpq 0x88(%rsp), %rax
jl 0xf303a
cmpq 0x70(%rsp), %rax
jg 0xf303a
xorps %xmm0, %xmm0
cvtsi2sd %r15, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %rcx, %xmm1
mulsd %xmm3, %xmm1
ucomisd %xmm1, %xmm0
sbbl $-0x1, 0x14(%rsp)
addq %r15, 0x38(%rsp)
addq %rcx, %r11
incq %rbp
cmpq 0x40(%rsp), %rbp
movq 0x78(%rsp), %r15
jne 0xf2f55
movl 0x14(%rsp), %ecx
movl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x40(%rsp), %xmm1
mulsd %xmm2, %xmm1
ucomisd %xmm0, %xmm1
jbe 0xf319a
xorps %xmm0, %xmm0
cvtsi2sd %r11, %xmm0
mulsd %xmm2, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x38(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdi
movl 0x10(%rsp), %r8d
ja 0xf30a9
testl %ecx, %ecx
jne 0xf31b1
orl $0x80000000, %r8d       # imm = 0x80000000
movl %r8d, (%rdi,%rsi,8)
leaq (%rsi,%rsi), %rax
movb $0x1, %cl
xorl %edx, %edx
orq %rax, %rdx
movq 0x28(%r12), %rsi
movq (%rsi,%rdx,8), %rdi
movq %rdi, %rsi
andq %r14, %rsi
je 0xf314b
shrq $0x20, %rdi
leaq (%rdi,%rdi,2), %rdi
shlq $0x3, %rdi
addq 0x8(%r12), %rdi
xorl %r8d, %r8d
leaq (%r8,%r8,2), %r9
orb $-0x80, 0xf(%rdi,%r9,8)
movl 0x8(%rdi,%r9,8), %r9d
xorq $0x1, %r9
movq 0x28(%r12), %r10
movq (%r10,%r9,8), %r10
movq %r10, %r9
andq %r14, %r9
je 0xf3143
movq 0x8(%r12), %r11
shrq $0x20, %r10
shlq $0x3, %r9
leaq (%r9,%r9,2), %r9
leaq (%r10,%r10,2), %r10
leaq (%r11,%r10,8), %r10
addq $0xc, %r10
xorl %r11d, %r11d
movl -0x4(%r10,%r11), %ebp
xorl %edx, %ebp
cmpl $0x1, %ebp
jne 0xf313a
orb $-0x80, 0x3(%r10,%r11)
addq $0x18, %r11
cmpq %r11, %r9
jne 0xf3128
incq %r8
cmpq %rsi, %r8
jne 0xf30e4
movl $0x1, %edx
testb $0x1, %cl
movl $0x0, %ecx
jne 0xf30bc
movq 0x68(%rsp), %rbp
cmpl $0x0, 0xc(%rbp)
je 0xf318e
xorl %ecx, %ecx
movq %rcx, 0xc(%rbp)
movq 0x18(%rbp), %rdi
callq 0x2220
movsd 0x13e478(%rip), %xmm3   # 0x2315f8
movsd 0x13e428(%rip), %xmm2   # 0x2315b0
xorl %eax, %eax
movq %rax, 0x18(%rbp)
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rsi
jmp 0xf31ba
testl %ecx, %ecx
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdi
movl 0x10(%rsp), %r8d
je 0xf30a9
incl 0xc(%rsp)
movq 0x20(%rsp), %rdx
incq %rsi
cmpq %rdx, %rsi
jne 0xf2ebe
cmpl $0x0, 0xc(%rsp)
movq 0x58(%rsp), %r14
je 0xf38e0
movq %r12, %rdi
callq 0xa0a7d
movq %r12, %rdi
callq 0xa0ab6
movq %r12, %rdi
callq 0xa0b79
orb $-0x80, 0x17(%r12)
movq (%r14), %rdi
movq 0x28(%rsp), %rsi
movq 0x60(%rsp), %rdx
callq 0xf2bf5
movl 0x14(%rbx), %edx
andq $0x7fffffff, %rdx       # imm = 0x7FFFFFFF
je 0xf3771
movq 0x20(%rbx), %rax
leal 0xf(%rdx), %ecx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa %xmm0, 0x40(%rsp)
andl $-0x10, %ecx
shlq $0x3, %rcx
movdqa 0x142aa1(%rip), %xmm1   # 0x235ce0
movdqa 0x142aa9(%rip), %xmm2   # 0x235cf0
movdqa 0x142ab1(%rip), %xmm3   # 0x235d00
movdqa 0x142ab9(%rip), %xmm4   # 0x235d10
movdqa 0x13e041(%rip), %xmm5   # 0x2312a0
movdqa 0x13e049(%rip), %xmm6   # 0x2312b0
movdqa 0x13e051(%rip), %xmm7   # 0x2312c0
movdqa 0x13e058(%rip), %xmm8   # 0x2312d0
xorl %edx, %edx
movdqa 0x13e05d(%rip), %xmm9   # 0x2312e0
pcmpeqd %xmm10, %xmm10
movdqa 0x40(%rsp), %xmm12
pxor %xmm9, %xmm12
movdqa %xmm8, %xmm13
pxor %xmm9, %xmm13
movdqa %xmm13, %xmm15
pcmpgtd %xmm12, %xmm15
pshufd $0xa0, %xmm15, %xmm14   # xmm14 = xmm15[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm0    # xmm0 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm13
pshufd $0xf5, %xmm13, %xmm13   # xmm13 = xmm13[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm11   # xmm11 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm0, %xmm11
pshufd $0xf5, %xmm15, %xmm15   # xmm15 = xmm15[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm0    # xmm0 = xmm15[0,2,2,3,4,5,6,7]
por %xmm11, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
movd %xmm0, %esi
testb $0x1, %sil
je 0xf32f3
movb $0x1, 0x4(%rax,%rdx)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm13
packsswb %xmm13, %xmm13
movd %xmm13, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0xf3324
movb $0x1, 0xc(%rax,%rdx)
movdqa %xmm7, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm0, %xmm11
pcmpgtd %xmm12, %xmm11
pshufd $0xa0, %xmm11, %xmm13   # xmm13 = xmm11[0,0,2,2]
pcmpeqd %xmm12, %xmm0
pshufd $0xf5, %xmm0, %xmm14    # xmm14 = xmm0[1,1,3,3]
movdqa %xmm14, %xmm0
pand %xmm13, %xmm0
pshufd $0xf5, %xmm11, %xmm15   # xmm15 = xmm11[1,1,3,3]
por %xmm15, %xmm0
packssdw %xmm0, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
movd %xmm0, %esi
shrl $0x10, %esi
testb $0x1, %sil
je 0xf3380
movb $0x1, 0x14(%rax,%rdx)
pshufhw $0x84, %xmm13, %xmm0    # xmm0 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm11   # xmm11 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm0, %xmm11
pshufhw $0x84, %xmm15, %xmm0    # xmm0 = xmm15[0,1,2,3,4,5,4,6]
por %xmm11, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
movd %xmm0, %esi
shrl $0x18, %esi
testb $0x1, %sil
je 0xf33bb
movb $0x1, 0x1c(%rax,%rdx)
movdqa %xmm6, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm0, %xmm11
pcmpgtd %xmm12, %xmm11
pshufd $0xa0, %xmm11, %xmm14   # xmm14 = xmm11[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm0
pshufd $0xf5, %xmm0, %xmm13    # xmm13 = xmm0[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm0    # xmm0 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm0
pshufd $0xf5, %xmm11, %xmm15   # xmm15 = xmm11[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm11   # xmm11 = xmm15[0,2,2,3,4,5,6,7]
por %xmm0, %xmm11
pxor %xmm10, %xmm11
packssdw %xmm11, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x2, %xmm0, %esi
testb $0x1, %sil
je 0xf341f
movb $0x1, 0x24(%rax,%rdx)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x2, %xmm0, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0xf344f
movb $0x1, 0x2c(%rax,%rdx)
movdqa %xmm5, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm0, %xmm11
pcmpgtd %xmm12, %xmm11
pshufd $0xa0, %xmm11, %xmm13   # xmm13 = xmm11[0,0,2,2]
pcmpeqd %xmm12, %xmm0
pshufd $0xf5, %xmm0, %xmm14    # xmm14 = xmm0[1,1,3,3]
movdqa %xmm14, %xmm0
pand %xmm13, %xmm0
pshufd $0xf5, %xmm11, %xmm15   # xmm15 = xmm11[1,1,3,3]
por %xmm15, %xmm0
packssdw %xmm0, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x3, %xmm0, %esi
testb $0x1, %sil
je 0xf34a9
movb $0x1, 0x34(%rax,%rdx)
pshufhw $0x84, %xmm13, %xmm0    # xmm0 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm11   # xmm11 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm0, %xmm11
pshufhw $0x84, %xmm15, %xmm0    # xmm0 = xmm15[0,1,2,3,4,5,4,6]
por %xmm11, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x3, %xmm0, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0xf34e5
movb $0x1, 0x3c(%rax,%rdx)
movdqa %xmm4, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm0, %xmm11
pcmpgtd %xmm12, %xmm11
pshufd $0xa0, %xmm11, %xmm14   # xmm14 = xmm11[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm0
pshufd $0xf5, %xmm0, %xmm13    # xmm13 = xmm0[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm0    # xmm0 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm0
pshufd $0xf5, %xmm11, %xmm15   # xmm15 = xmm11[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm11   # xmm11 = xmm15[0,2,2,3,4,5,6,7]
por %xmm0, %xmm11
pxor %xmm10, %xmm11
packssdw %xmm11, %xmm11
packsswb %xmm11, %xmm0
pextrw $0x4, %xmm0, %esi
testb $0x1, %sil
je 0xf354a
movb $0x1, 0x44(%rax,%rdx)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm13
packsswb %xmm13, %xmm0
pextrw $0x4, %xmm0, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0xf357b
movb $0x1, 0x4c(%rax,%rdx)
movdqa %xmm3, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm0, %xmm11
pcmpgtd %xmm12, %xmm11
pshufd $0xa0, %xmm11, %xmm13   # xmm13 = xmm11[0,0,2,2]
pcmpeqd %xmm12, %xmm0
pshufd $0xf5, %xmm0, %xmm14    # xmm14 = xmm0[1,1,3,3]
movdqa %xmm14, %xmm0
pand %xmm13, %xmm0
pshufd $0xf5, %xmm11, %xmm15   # xmm15 = xmm11[1,1,3,3]
por %xmm15, %xmm0
packssdw %xmm0, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x5, %xmm0, %esi
testb $0x1, %sil
je 0xf35d5
movb $0x1, 0x54(%rax,%rdx)
pshufhw $0x84, %xmm13, %xmm0    # xmm0 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm11   # xmm11 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm0, %xmm11
pshufhw $0x84, %xmm15, %xmm0    # xmm0 = xmm15[0,1,2,3,4,5,4,6]
por %xmm11, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x5, %xmm0, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0xf3611
movb $0x1, 0x5c(%rax,%rdx)
movdqa %xmm2, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm0, %xmm11
pcmpgtd %xmm12, %xmm11
pshufd $0xa0, %xmm11, %xmm14   # xmm14 = xmm11[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm0
pshufd $0xf5, %xmm0, %xmm13    # xmm13 = xmm0[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm0    # xmm0 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm0
pshufd $0xf5, %xmm11, %xmm15   # xmm15 = xmm11[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm11   # xmm11 = xmm15[0,2,2,3,4,5,6,7]
por %xmm0, %xmm11
pxor %xmm10, %xmm11
packssdw %xmm11, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x6, %xmm0, %esi
testb $0x1, %sil
je 0xf3675
movb $0x1, 0x64(%rax,%rdx)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x6, %xmm0, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0xf36a5
movb $0x1, 0x6c(%rax,%rdx)
movdqa %xmm1, %xmm0
pxor %xmm9, %xmm0
movdqa %xmm0, %xmm11
pcmpgtd %xmm12, %xmm11
pshufd $0xa0, %xmm11, %xmm13   # xmm13 = xmm11[0,0,2,2]
pcmpeqd %xmm12, %xmm0
pshufd $0xf5, %xmm0, %xmm12    # xmm12 = xmm0[1,1,3,3]
movdqa %xmm12, %xmm0
pand %xmm13, %xmm0
pshufd $0xf5, %xmm11, %xmm14   # xmm14 = xmm11[1,1,3,3]
por %xmm14, %xmm0
packssdw %xmm0, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x7, %xmm0, %esi
testb $0x1, %sil
je 0xf36ff
movb $0x1, 0x74(%rax,%rdx)
pshufhw $0x84, %xmm13, %xmm0    # xmm0 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm12, %xmm11   # xmm11 = xmm12[0,1,2,3,4,5,4,6]
pand %xmm0, %xmm11
pshufhw $0x84, %xmm14, %xmm0    # xmm0 = xmm14[0,1,2,3,4,5,4,6]
por %xmm11, %xmm0
pxor %xmm10, %xmm0
packssdw %xmm0, %xmm0
packsswb %xmm0, %xmm0
pextrw $0x7, %xmm0, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0xf373b
movb $0x1, 0x7c(%rax,%rdx)
movdqa 0x1425dd(%rip), %xmm0   # 0x235d20
paddq %xmm0, %xmm8
paddq %xmm0, %xmm7
paddq %xmm0, %xmm6
paddq %xmm0, %xmm5
paddq %xmm0, %xmm4
paddq %xmm0, %xmm3
paddq %xmm0, %xmm2
paddq %xmm0, %xmm1
subq $-0x80, %rdx
cmpq %rdx, %rcx
jne 0xf3288
movq (%r14), %rax
movq 0x18(%rax), %rdx
movl 0x14(%rdx), %ecx
andq $0x7fffffff, %rcx       # imm = 0x7FFFFFFF
je 0xf37da
movq 0x20(%rdx), %rdx
xorl %esi, %esi
cmpl $0x0, (%rdx,%rsi,8)
js 0xf37d2
movq 0x10(%rax), %rdi
leaq (%rsi,%rsi,4), %r8
cmpl $0x0, 0xc(%rdi,%r8,8)
je 0xf37d2
leaq (%rdi,%r8,8), %r8
movl 0x10(%r8), %edi
testq %rdi, %rdi
je 0xf37d2
movq 0x18(%r8), %r8
movq 0x20(%rbx), %r9
movb 0x4(%rdx,%rsi,8), %r10b
xorl %r11d, %r11d
movq (%r8,%r11,8), %r14
shrq $0x21, %r14
movb %r10b, 0x4(%r9,%r14,8)
incq %r11
cmpq %r11, %rdi
jne 0xf37bd
incq %rsi
cmpq %rcx, %rsi
jne 0xf378a
movl 0x14(%rbx), %eax
andq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
je 0xf38e0
xorl %ecx, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x20(%rbx), %rsi
cmpb $0x1, 0x4(%rsi,%rcx,8)
jne 0xf38d4
leaq (%rcx,%rcx), %rsi
movb $0x1, %dil
xorl %r8d, %r8d
orq %rsi, %r8
movq 0x28(%rbx), %r9
movq (%r9,%r8,8), %r10
movq %r10, %r9
andq %rdx, %r9
je 0xf38bf
shrq $0x20, %r10
leaq (%r10,%r10,2), %r10
shlq $0x3, %r10
addq 0x8(%rbx), %r10
xorl %r11d, %r11d
leaq (%r11,%r11,2), %r14
movl 0xc(%r10,%r14,8), %ebp
testl %ebp, %ebp
js 0xf38b3
leaq (%r10,%r14,8), %r15
movq 0x20(%rbx), %r12
movl 0x8(%r15), %r14d
movl %r14d, %r13d
shrl %r13d
cmpb $0x1, 0x4(%r12,%r13,8)
je 0xf38b3
orl $0x80000000, %ebp       # imm = 0x80000000
movl %ebp, 0xc(%r15)
xorq $0x1, %r14
movq 0x28(%rbx), %r15
movq (%r15,%r14,8), %r15
movq %r15, %r14
andq %rdx, %r14
je 0xf38b3
movq 0x8(%rbx), %r12
shrq $0x20, %r15
shlq $0x3, %r14
leaq (%r14,%r14,2), %r14
leaq (%r15,%r15,2), %r15
leaq (%r12,%r15,8), %r15
addq $0xc, %r15
xorl %r12d, %r12d
movl -0x4(%r15,%r12), %ebp
xorl %r8d, %ebp
cmpl $0x1, %ebp
jne 0xf38aa
orb $-0x80, 0x3(%r15,%r12)
addq $0x18, %r12
cmpq %r12, %r14
jne 0xf3897
incq %r11
cmpq %r9, %r11
jne 0xf3833
movl $0x1, %r8d
testb $0x1, %dil
movl $0x0, %edi
jne 0xf3809
incq %rcx
cmpq %rax, %rcx
jne 0xf37f0
movq 0x28(%rsp), %rdi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa0761
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq