// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: reduce_hamming_error_adv(ma_ug_t*, asg_t*, ma_hit_t_alloc*, ma_sub_t*, int, int, long long, R_to_U*, bubble_type*)
void reduce_hamming_error_adv(ma_ug_t *iug, asg_t *sg, ma_hit_t_alloc* sources, ma_sub_t *coverage_cut, 
int max_hang, int min_ovlp, long long gap_fuzz, R_to_U *ru, bubble_type* bub)
{
    double index_time = yak_realtime();
    ma_ug_t *ug = NULL; ug = (iug)?(iug):(ma_ug_gen_primary(sg, PRIMARY_LABLE));
    uint8_t* vis_flag = NULL; CALLOC(vis_flag, sg->n_seq*2);
    uint32_t fix_bub = 0; asg_t *g = ug->g;
    uint32_t v, n_vtx = g->n_seq * 2, n_arc, n_arc_0 = sg->n_arc, nv, i;
    uint64_t n_pop = 0, max_dist; asg_arc_t *p;
    asg_arc_t *av; asg_t *ig = asg_init(); asg64_v sv; kv_init(sv);
    buf_t b; memset(&b, 0, sizeof(buf_t));
    b.a = (binfo_t*)calloc(n_vtx, sizeof(binfo_t));
    uint8_t* bs_flag = NULL; CALLOC(bs_flag, n_vtx);
    for (i = 0; i < ug->g->n_seq; i++) ug->g->seq[i].c = 0;
    max_dist = get_bub_pop_max_dist_advance(g, &b);
    
    if(max_dist > 0) {
        if(bub) {
            for (i = 0; i < bub->f_bub; i++) {
                get_bubbles(bub, i, &v, NULL, NULL, NULL, NULL);
                fix_bub += gen_switch_phasing(sg, ug, v, sources, coverage_cut, max_hang, min_ovlp, 
                    R_INF.trio_flag, vis_flag, &b, max_dist, 1, ig, &sv);
            }
        } else {
            for (v = 0; v < n_vtx; ++v) {
                if(bs_flag[v] != 0) continue;
                nv = asg_arc_n(g, v); av = asg_arc_a(g, v);
                ///some node could be deleted
                if (nv < 2 || g->seq[v>>1].del) continue;
                ///some edges could be deleted
                for (i = n_arc = 0; i < nv; ++i) // asg_bub_pop1() may delete some edges/arcs
                    if (!av[i].del) ++n_arc;
                if (n_arc < 2) continue;
                if(asg_bub_pop1_primary_trio(ug->g, NULL, v, max_dist, &b, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL)) {
                    //beg is v, end is b.S.a[0]
                    //note b.b include end, does not include beg
                    for (i = 0; i < b.b.n; i++) {
                        if(b.b.a[i]==v || b.b.a[i]==b.S.a[0]) continue;
                        bs_flag[b.b.a[i]] = bs_flag[b.b.a[i]^1] = 1;
                    }
                    bs_flag[v] = 2; bs_flag[b.S.a[0]^1] = 3;
                }
            }

            //traverse all node with two directions 
            for (v = 0; v < n_vtx; ++v) {
                if(bs_flag[v] !=2) continue;
                nv = asg_arc_n(g, v);
                av = asg_arc_a(g, v);
                ///some node could be deleted
                if (nv < 2 || g->seq[v>>1].del) continue;
                ///some edges could be deleted
                for (i = n_arc = 0; i < nv; ++i) // asg_bub_pop1() may delete some edges/arcs
                    if (!av[i].del) ++n_arc;
                if (n_arc > 1) {
                    fix_bub += gen_switch_phasing(sg, ug, v, sources, coverage_cut, max_hang, min_ovlp, 
                    R_INF.trio_flag, vis_flag, &b, max_dist, 1, ig, &sv);
                }
            }
        }
    }
    free(bs_flag); if(!iug) ma_ug_destroy(ug);    

    if(sv.n > 0) {
        ig->n_seq = ig->m_seq = sg->n_seq; 
        MALLOC(ig->seq, ig->n_seq);
        memcpy(ig->seq, sg->seq, (sizeof((*(ig->seq)))*ig->n_seq));
        asg_cleanup(ig); asg_arc_del_trans_aux(ig, sg, vis_flag, gap_fuzz);
        REALLOC(b.a, (ig->n_seq<<1)); memset(b.a, 0, sizeof((*(b.a)))*(ig->n_seq<<1));

        for (i = 0; i < sv.n; i++) rd_hamming_symm_simple0(&b, sg, ig, sv.a[i]>>32, (uint32_t)(sv.a[i]), max_dist, NULL);
        /**
        rd_hamming_t aux_t; memset((&aux_t), 0, sizeof(aux_t));
        aux_t.n_thread = 1; // aux_t.n_thread = asm_opt.thread_num; 
        CALLOC(aux_t.a, aux_t.n_thread);
        for (i = 0; i < aux_t.n_thread; i++) aux_t.a[i].a = b.a;
        aux_t.g = ig; aux_t.ref = sg; aux_t.rr = &sv; aux_t.max_dist = max_dist;
        // print_debug_gfa(ug, sg, coverage_cut, "debug_hamming", sources, ru);
        // kt_for(aux_t.n_thread, rd_hamming_symm, &aux_t, aux_t.rr->n);
        for (i = 0; i < aux_t.rr->n; i++) {
            rd_hamming_symm_simple(&aux_t, aux_t.rr->a[i]>>32, (uint32_t)(aux_t.rr->a[i]));
        }        
        for (i = 0; i < aux_t.n_thread; i++) {
            free(aux_t.a[i].S.a); free(aux_t.a[i].T.a); 
            free(aux_t.a[i].b.a); free(aux_t.a[i].e.a);
        }
        free(aux_t.a);
        **/
    }
    free(sv.a); free(vis_flag);

    for (i = n_pop = 0; i < ig->n_arc; i++) {
        if(ig->arc[i].del) continue;
        p = asg_arc_pushp(sg); *p = (ig->arc[i]); n_pop++;
    }
    if(n_pop) {
        free(sg->idx);
        sg->idx = 0;
        sg->is_srt = 0;
        asg_cleanup(sg);
        asg_symm(sg);
        asg_arc_del_trans(sg, gap_fuzz);
    }
    free(b.a); free(b.S.a); free(b.T.a); free(b.b.a); free(b.e.a); asg_destroy(ig);
    fprintf(stderr, "[M::%s::%.3f] # inserted edges: %u, # fixed bubbles: %u\n", 
                        __func__, yak_realtime() - index_time, sg->n_arc - n_arc_0, fix_bub);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
movl %r8d, -0x44(%rbp)
movl %r9d, -0x48(%rbp)
callq 0x1b7ca0
movsd %xmm0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x10f45c
movq -0x28(%rbp), %rax
movq %rax, -0x140(%rbp)
jmp 0x10f46e
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0xe7ae0
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x30(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movslq %eax, %rdi
movl $0x1, %esi
callq 0x2140
movq %rax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x80(%rbp)
movq $0x0, -0x90(%rbp)
callq 0xcd150
movq %rax, -0xb0(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xb8(%rbp)
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2100
movl -0x78(%rbp), %eax
movl %eax, %edi
movl $0x1c, %esi
callq 0x2140
movq %rax, -0x130(%rbp)
movq $0x0, -0x138(%rbp)
movl -0x78(%rbp), %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x2140
movq %rax, -0x138(%rbp)
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq -0x58(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x10f5a2
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movl -0x88(%rbp), %ecx
movb $0x0, 0x4(%rax,%rcx,8)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x10f55f
movq -0x70(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0xfde50
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jbe 0x10fa77
cmpq $0x0, 0x20(%rbp)
je 0x10f6b2
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq 0x20(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jae 0x10f6ad
movq 0x20(%rbp), %rdi
movl -0x88(%rbp), %eax
movl %eax, %esi
leaq -0x74(%rbp), %rdx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %rcx
movq %r9, %r8
movq $0x0, (%rsp)
callq 0x1c4b20
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x74(%rbp), %eax
movl %eax, %edx
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %r8
movl -0x44(%rbp), %r9d
movl -0x48(%rbp), %r12d
leaq 0x2b5c91(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %r15
movq -0x60(%rbp), %r14
movq -0x98(%rbp), %r11
movq -0xb0(%rbp), %r10
leaq -0x130(%rbp), %rbx
leaq -0xc8(%rbp), %rax
movl %r12d, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movq $0x1, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x136f90
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x10f5dc
jmp 0x10fa75
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x78(%rbp), %eax
jae 0x10f8f4
movq -0x138(%rbp), %rax
movl -0x74(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x10f6dd
jmp 0x10f8e6
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x84(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x70(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x74(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
cmpl $0x2, -0x84(%rbp)
jb 0x10f73e
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x10f743
jmp 0x10f8e6
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x84(%rbp), %eax
jae 0x10f79d
movq -0xa8(%rbp), %rax
movl -0x88(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x10f78a
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x10f78c
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x10f754
cmpl $0x2, -0x7c(%rbp)
jae 0x10f7a8
jmp 0x10f8e6
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x74(%rbp), %edx
movq -0x98(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq -0x130(%rbp), %r8
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movl $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x0, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
callq 0xfe040
cmpq $0x0, %rax
je 0x10f8e4
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpq -0xf8(%rbp), %rax
jae 0x10f8bd
movq -0xe8(%rbp), %rax
movl -0x88(%rbp), %ecx
movl (%rax,%rcx,4), %eax
cmpl -0x74(%rbp), %eax
je 0x10f86c
movq -0xe8(%rbp), %rax
movl -0x88(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movq -0x118(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x10f86e
jmp 0x10f8a9
movq -0x138(%rbp), %rax
movq -0xe8(%rbp), %rcx
movl -0x88(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movb $0x1, (%rax,%rcx)
movq -0x138(%rbp), %rax
movq -0xe8(%rbp), %rcx
movl -0x88(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
movb $0x1, (%rax,%rcx)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x10f829
movq -0x138(%rbp), %rax
movl -0x74(%rbp), %ecx
movb $0x2, (%rax,%rcx)
movq -0x138(%rbp), %rax
movq -0x118(%rbp), %rcx
movl (%rcx), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movb $0x3, (%rax,%rcx)
jmp 0x10f8e6
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x10f6b9
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x78(%rbp), %eax
jae 0x10fa73
movq -0x138(%rbp), %rax
movl -0x74(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
je 0x10f91f
jmp 0x10fa65
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x84(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x70(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x74(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
cmpl $0x2, -0x84(%rbp)
jb 0x10f980
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x10f985
jmp 0x10fa65
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x84(%rbp), %eax
jae 0x10f9df
movq -0xa8(%rbp), %rax
movl -0x88(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x10f9cc
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x10f9ce
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x10f996
cmpl $0x1, -0x7c(%rbp)
jbe 0x10fa63
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x74(%rbp), %eax
movl %eax, %edx
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %r8
movl -0x44(%rbp), %r9d
movl -0x48(%rbp), %r12d
leaq 0x2b58c7(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %r15
movq -0x60(%rbp), %r14
movq -0x98(%rbp), %r11
movq -0xb0(%rbp), %r10
leaq -0x130(%rbp), %rbx
leaq -0xc8(%rbp), %rax
movl %r12d, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movq $0x1, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x136f90
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x10fa65
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x10f8fb
jmp 0x10fa75
jmp 0x10fa77
movq -0x138(%rbp), %rdi
callq 0x2210
cmpq $0x0, -0x28(%rbp)
jne 0x10fa93
movq -0x58(%rbp), %rdi
callq 0xcd6f0
cmpq $0x0, -0xc8(%rbp)
jbe 0x10fc20
movq -0x30(%rbp), %rax
movl 0x14(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq -0xb0(%rbp), %rax
movl %edx, 0x10(%rax)
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x14(%rax)
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2270
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0xb0(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x2180
movq -0xb0(%rbp), %rdi
callq 0xcdd10
movq -0xb0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq 0x10(%rbp), %rax
movl %eax, %ecx
callq 0x137830
movq -0x130(%rbp), %rdi
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
cltq
imulq $0x1c, %rax, %rsi
callq 0x2360
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rdi
movq -0xb0(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
cltq
imulq $0x1c, %rax, %rdx
xorl %esi, %esi
callq 0x2100
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpq -0xc8(%rbp), %rax
jae 0x10fc1e
movq -0x30(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq -0xb8(%rbp), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, %ecx
movq -0xb8(%rbp), %rax
movl -0x88(%rbp), %edi
movq (%rax,%rdi,8), %rax
movl %eax, %r8d
movq -0x98(%rbp), %r9
leaq -0x130(%rbp), %rdi
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0x1399c0
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x10fbab
jmp 0x10fc20
movq -0xb8(%rbp), %rdi
callq 0x2210
movq -0x60(%rbp), %rdi
callq 0x2210
movq $0x0, -0x90(%rbp)
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq -0xb0(%rbp), %rcx
movl 0x4(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x10fcf8
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x88(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x10fc8d
jmp 0x10fce4
movq -0x30(%rbp), %rdi
callq 0xd4050
movq %rax, -0xa0(%rbp)
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rcx
movl -0x88(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq -0xa0(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x10fc4a
cmpq $0x0, -0x90(%rbp)
je 0x10fd4f
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2210
movq -0x30(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rdi
callq 0xcdd10
movq -0x30(%rbp), %rdi
callq 0xce020
movq -0x30(%rbp), %rdi
movq 0x10(%rbp), %rax
movl %eax, %esi
callq 0xda630
movq -0x130(%rbp), %rdi
callq 0x2210
movq -0x118(%rbp), %rdi
callq 0x2210
movq -0x100(%rbp), %rdi
callq 0x2210
movq -0xe8(%rbp), %rdi
callq 0x2210
movq -0xd0(%rbp), %rdi
callq 0x2210
movq -0xb0(%rbp), %rdi
callq 0xcd170
movq 0x2b4242(%rip), %rax    # 0x3c3fe0
movq (%rax), %rax
movq %rax, -0x148(%rbp)
callq 0x1b7ca0
movq -0x148(%rbp), %rdi
subsd -0x50(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
subl -0x80(%rbp), %ecx
movl -0x64(%rbp), %r8d
leaq 0x278e10(%rip), %rsi    # 0x388be4
leaq 0x278e42(%rip), %rdx    # 0x388c1d
movb $0x1, %al
callq 0x22a0
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)