// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: ulg_arc_cut_length(ul_resolve_t*, ma_ug_t*, int, unsigned int, float, unsigned int, unsigned int, unsigned int, unsigned int*, asg64_v*, asg64_v*)
uint32_t ulg_arc_cut_length(ul_resolve_t *uidx, ma_ug_t *ug, int32_t max_ext, uint32_t max_ext_hifi, 
float len_rat, uint32_t is_trio, uint32_t topo_level, uint32_t hom_check, uint32_t *max_drop_len, asg64_v *in, asg64_v *ib)
{
    asg64_v tx = {0,0,0}, tb = {0,0,0}, *b = NULL, *ub = NULL; asg_t *g = ug->g;
    uint32_t v, w, i, k, kv, kw, nv, nw, cnt = 0, n_vtx = g->n_seq<<1, n_het, n_hom, ff, ol_max, mm_ol, to_del;
    asg_arc_t *av, *aw, *ve, *we, *vl_max, *wl_max;

    b = (in?(in):(&tx)); ub = (ib?(ib):(&tb));
    for (v = b->n = 0; v < n_vtx; ++v) {
        if (g->seq[v>>1].del) continue;
        if(g->seq_vis[v] == 0) {
            av = asg_arc_a(g, v); nv = asg_arc_n(g, v);
            if (nv < 2) continue;

            for (i = kv = 0; i < nv && kv < 2; ++i) {
                if(av[i].del) continue;
                kv++;
            }
            if(kv < 2) continue;
            if(hom_check) {
                for (i = n_het = n_hom = 0; i < nv; ++i) {
                    if(av[i].del) continue;
                    ff = is_het_ulg_edge(uidx, av[i].ul>>32, av[i].v); assert(ff != (uint32_t)-1);
                    if(ff) n_het++;
                    else n_hom++;
                    if(n_het > 0 && n_hom > 0) break;
                }
                if(n_het == 0 || n_hom == 0) continue;
            }

            for (i = 0; i < nv; ++i) {
                if(av[i].del) continue;
                kv_push(uint64_t, *b, (((uint64_t)av[i].ol)<<32) | ((uint64_t)(av-g->arc+i)));
            }
        }
    }

    radix_sort_srt64(b->a, b->a + b->n);
    for (k = 0; k < b->n; k++) {
        if(g->arc[(uint32_t)b->a[k]].del) continue;
        v = g->arc[(uint32_t)b->a[k]].ul>>32; w = g->arc[(uint32_t)b->a[k]].v^1;
        if(g->seq[v>>1].del || g->seq[w>>1].del) continue;
        nv = asg_arc_n(g, v); nw = asg_arc_n(g, w);
        av = asg_arc_a(g, v); aw = asg_arc_a(g, w);
        if(nv<=1 && nw <= 1) continue;
        if(hom_check) {
            ff = is_het_ulg_edge(uidx, g->arc[(uint32_t)b->a[k]].ul>>32, g->arc[(uint32_t)b->a[k]].v); 
            assert(ff != (uint32_t)-1);
            if(ff) continue;
        }

        ve = &(g->arc[(uint32_t)b->a[k]]);
        for (i = 0; i < nw; ++i) {
            if (aw[i].v == (v^1)) {
                we = &(aw[i]);
                break;
            }
        }
        mm_ol = MIN(ve->ol, we->ol); ///ve and we are hom edges

        for (i = kv = ol_max = 0, vl_max = NULL; i < nv; ++i) {
            if(av[i].del) continue;
            kv++;
            if(hom_check) { 
                ff = is_het_ulg_edge(uidx, av[i].ul>>32, av[i].v); assert(ff != (uint32_t)-1);
                if(!ff) continue;///vl_max must be a het edge
            }
            if(ol_max < av[i].ol) ol_max = av[i].ol, vl_max = &(av[i]);
        }
        if (kv < 1 || (!vl_max)) continue;
        if (kv >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
        }

        for (i = kw = ol_max = 0, wl_max = NULL; i < nw; ++i) {
            if(aw[i].del) continue;
            kw++;
            if(hom_check) { 
                ff = is_het_ulg_edge(uidx, aw[i].ul>>32, aw[i].v); assert(ff != (uint32_t)-1);
                if(!ff) continue;///wl_max must be a het edge
            }
            if(ol_max < aw[i].ol) ol_max = aw[i].ol, wl_max = &(aw[i]);
        }
        if (kw < 1 || (!wl_max)) continue;
        if (kw >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
        }

        if (kv <= 1 && kw <= 1) continue;

        to_del = 0;
        if(topo_level == 0) {
            to_del = 1;
        } else if(topo_level == 2) {
            if (kv > 1 && kw > 1) to_del = 1;
        } else {
            if (kv > 1 && kw > 1) {
                to_del = 1;
            } else if (kw == 1) {
                if (usg_topocut_aux(uidx, ug, w^1, max_ext, max_ext_hifi, b, ub)) to_del = 1;                    
            } else if (kv == 1) {
                if (usg_topocut_aux(uidx, ug, v^1, max_ext, max_ext_hifi, b, ub)) to_del = 1;   
            }
        }

        if (to_del) {
            ve->del = we->del = 1, ++cnt;
        }
    }


    if(!in) free(tx.a); if(!ib) free(tb.a);
    if (cnt > 0) asg_cleanup(g);

    return cnt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x94(%rbp)
movq -0x70(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x98(%rbp)
cmpq $0x0, 0x20(%rbp)
je 0x3435d3
movq 0x20(%rbp), %rax
movq %rax, -0xe8(%rbp)
jmp 0x3435e0
leaq -0x40(%rbp), %rax
movq %rax, -0xe8(%rbp)
jmp 0x3435e0
movq -0xe8(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, 0x28(%rbp)
je 0x3435ff
movq 0x28(%rbp), %rax
movq %rax, -0xf0(%rbp)
jmp 0x34360c
leaq -0x58(%rbp), %rax
movq %rax, -0xf0(%rbp)
jmp 0x34360c
movq -0xf0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x98(%rbp), %eax
jae 0x34399e
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 0x343657
jmp 0x343990
movq -0x70(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x74(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x34398e
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, -0xb8(%rbp)
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x8c(%rbp)
cmpl $0x2, -0x8c(%rbp)
jae 0x3436bb
jmp 0x343990
movl $0x0, -0x84(%rbp)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x8c(%rbp), %ecx
movb %al, -0xf1(%rbp)
jae 0x3436ef
cmpl $0x2, -0x84(%rbp)
setb %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x3436fb
jmp 0x343733
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x343719
jmp 0x343728
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3436cc
cmpl $0x2, -0x84(%rbp)
jae 0x343741
jmp 0x343990
cmpl $0x0, 0x10(%rbp)
je 0x343863
movl $0x0, -0xa0(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jae 0x34384a
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x343796
jmp 0x34383c
movq -0x8(%rbp), %rdi
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %esi
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
callq 0x342e50
movl %eax, -0xa4(%rbp)
cmpl $-0x1, -0xa4(%rbp)
je 0x3437de
jmp 0x3437fd
leaq 0x55359(%rip), %rdi     # 0x398b3e
leaq 0x529cd(%rip), %rsi     # 0x3961b9
movl $0x2285, %edx           # imm = 0x2285
leaq 0x55359(%rip), %rcx     # 0x398b51
callq 0x2130
cmpl $0x0, -0xa4(%rbp)
je 0x343817
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x343826
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
cmpl $0x0, -0x9c(%rbp)
jbe 0x34383a
cmpl $0x0, -0xa0(%rbp)
jbe 0x34383a
jmp 0x34384a
jmp 0x34383c
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x343766
cmpl $0x0, -0x9c(%rbp)
je 0x34385c
cmpl $0x0, -0xa0(%rbp)
jne 0x343861
jmp 0x343990
jmp 0x343863
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jae 0x34398c
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34389a
jmp 0x34397e
jmp 0x34389c
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq -0x60(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x34390d
movq -0x60(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3438cc
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x100(%rbp)
jmp 0x3438da
movl $0x2, %eax
movq %rax, -0x100(%rbp)
jmp 0x3438da
movq -0x100(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
shlq $0x20, %rax
movq %rax, -0x108(%rbp)
movq -0xb8(%rbp), %rax
movq -0x70(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq -0x108(%rbp), %rdx
movl -0x7c(%rbp), %ecx
addq %rcx, %rax
orq %rax, %rdx
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x34397e
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x34386a
jmp 0x34398e
jmp 0x343990
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x343629
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x60(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x344123
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x343a08
jmp 0x344115
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x74(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x78(%rbp)
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
jne 0x343a8f
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x78(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x343a94
jmp 0x344115
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x8c(%rbp)
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x78(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x90(%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, -0xb8(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x70(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x78(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
cmpl $0x1, -0x8c(%rbp)
ja 0x343b27
cmpl $0x1, -0x90(%rbp)
ja 0x343b27
jmp 0x344115
cmpl $0x0, 0x10(%rbp)
je 0x343bc6
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %esi
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
callq 0x342e50
movl %eax, -0xa4(%rbp)
cmpl $-0x1, -0xa4(%rbp)
je 0x343b97
jmp 0x343bb6
leaq 0x54fa0(%rip), %rdi     # 0x398b3e
leaq 0x52614(%rip), %rsi     # 0x3961b9
movl $0x229e, %edx           # imm = 0x229E
leaq 0x54fa0(%rip), %rcx     # 0x398b51
callq 0x2130
cmpl $0x0, -0xa4(%rbp)
je 0x343bc4
jmp 0x344115
jmp 0x343bc6
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jae 0x343c44
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x74(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x343c37
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
jmp 0x343c44
jmp 0x343c39
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x343bf4
movq -0xc8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0xd0(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jg 0x343c7e
movq -0xc8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x10c(%rbp)
jmp 0x343c93
movq -0xd0(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
movl %eax, -0xac(%rbp)
movl $0x0, -0xa8(%rbp)
movl $0x0, -0x84(%rbp)
movl $0x0, -0x7c(%rbp)
movq $0x0, -0xd8(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jae 0x343de9
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x343cf5
jmp 0x343ddb
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
cmpl $0x0, 0x10(%rbp)
je 0x343d7e
movq -0x8(%rbp), %rdi
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %esi
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
callq 0x342e50
movl %eax, -0xa4(%rbp)
cmpl $-0x1, -0xa4(%rbp)
je 0x343d52
jmp 0x343d71
leaq 0x54de5(%rip), %rdi     # 0x398b3e
leaq 0x52459(%rip), %rsi     # 0x3961b9
movl $0x22af, %edx           # imm = 0x22AF
leaq 0x54de5(%rip), %rcx     # 0x398b51
callq 0x2130
cmpl $0x0, -0xa4(%rbp)
jne 0x343d7c
jmp 0x343ddb
jmp 0x343d7e
movl -0xa8(%rbp), %eax
movq -0xb8(%rbp), %rcx
movl -0x7c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x343dd9
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xa8(%rbp)
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
jmp 0x343ddb
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x343cc5
cmpl $0x1, -0x84(%rbp)
jb 0x343dfc
cmpq $0x0, -0xd8(%rbp)
jne 0x343e01
jmp 0x344115
cmpl $0x2, -0x84(%rbp)
jb 0x343e31
movl -0xac(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0xa8(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x343e2f
jmp 0x344115
jmp 0x343e31
movl $0x0, -0xa8(%rbp)
movl $0x0, -0x88(%rbp)
movl $0x0, -0x7c(%rbp)
movq $0x0, -0xe0(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jae 0x343f7b
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x343e87
jmp 0x343f6d
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
cmpl $0x0, 0x10(%rbp)
je 0x343f10
movq -0x8(%rbp), %rdi
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %esi
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
callq 0x342e50
movl %eax, -0xa4(%rbp)
cmpl $-0x1, -0xa4(%rbp)
je 0x343ee4
jmp 0x343f03
leaq 0x54c53(%rip), %rdi     # 0x398b3e
leaq 0x522c7(%rip), %rsi     # 0x3961b9
movl $0x22bd, %edx           # imm = 0x22BD
leaq 0x54c53(%rip), %rcx     # 0x398b51
callq 0x2130
cmpl $0x0, -0xa4(%rbp)
jne 0x343f0e
jmp 0x343f6d
jmp 0x343f10
movl -0xa8(%rbp), %eax
movq -0xc0(%rbp), %rcx
movl -0x7c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x343f6b
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xa8(%rbp)
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
jmp 0x343f6d
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x343e57
cmpl $0x1, -0x88(%rbp)
jb 0x343f8e
cmpq $0x0, -0xe0(%rbp)
jne 0x343f93
jmp 0x344115
cmpl $0x2, -0x88(%rbp)
jb 0x343fc3
movl -0xac(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0xa8(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x343fc1
jmp 0x344115
jmp 0x343fc3
cmpl $0x1, -0x84(%rbp)
ja 0x343fda
cmpl $0x1, -0x88(%rbp)
ja 0x343fda
jmp 0x344115
movl $0x0, -0xb0(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x343ff9
movl $0x1, -0xb0(%rbp)
jmp 0x3440c9
cmpl $0x2, -0x24(%rbp)
jne 0x344020
cmpl $0x1, -0x84(%rbp)
jbe 0x34401b
cmpl $0x1, -0x88(%rbp)
jbe 0x34401b
movl $0x1, -0xb0(%rbp)
jmp 0x3440c7
cmpl $0x1, -0x84(%rbp)
jbe 0x344041
cmpl $0x1, -0x88(%rbp)
jbe 0x344041
movl $0x1, -0xb0(%rbp)
jmp 0x3440c5
cmpl $0x1, -0x88(%rbp)
jne 0x344081
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x78(%rbp), %edx
xorl $0x1, %edx
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
movq -0x60(%rbp), %r9
movq -0x68(%rbp), %rax
movq %rax, (%rsp)
callq 0x343240
cmpl $0x0, %eax
je 0x34407f
movl $0x1, -0xb0(%rbp)
jmp 0x3440c3
cmpl $0x1, -0x84(%rbp)
jne 0x3440c1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x74(%rbp), %edx
xorl $0x1, %edx
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
movq -0x60(%rbp), %r9
movq -0x68(%rbp), %rax
movq %rax, (%rsp)
callq 0x343240
cmpl $0x0, %eax
je 0x3440bf
movl $0x1, -0xb0(%rbp)
jmp 0x3440c1
jmp 0x3440c3
jmp 0x3440c5
jmp 0x3440c7
jmp 0x3440c9
cmpl $0x0, -0xb0(%rbp)
je 0x344113
movq -0xd0(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0xc8(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x344115
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x3439c8
cmpq $0x0, 0x20(%rbp)
jne 0x344133
movq -0x30(%rbp), %rdi
callq 0x2210
cmpq $0x0, 0x28(%rbp)
jne 0x344143
movq -0x48(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x94(%rbp)
jbe 0x344155
movq -0x70(%rbp), %rdi
callq 0xcdd10
movl -0x94(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)