// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: gen_fg(ma_ug_t*, asg_t*, ma_hit_t_alloc*, ma_sub_t*, int, int, int)
ma_ug_t* gen_fg(ma_ug_t *ug, asg_t *rg, ma_hit_t_alloc* src, ma_sub_t *cov, int32_t max_hang, int32_t min_ovlp, int32_t gap_fuzz)
{
    uint32_t *idx; MALLOC(idx, rg->n_seq); 
    memset(idx, -1, sizeof((*idx))*rg->n_seq);
    ma_ug_t *fg = copy_untig_graph(ug); asg_cleanup(fg->g);///some edges might be deleted
    kvec_t(uint64_t) srt; kv_init(srt);    
    uint64_t i, k, l, m, rv, rw, uv, uw, zn, z, nist = 0; ma_utg_t *u;
    for (k = 0; k < fg->u.n; k++) {
        u = &(ug->u.a[k]); fg->g->seq[k].c = PRIMARY_LABLE;
        if((u->circ) || (u->n == 0)) continue;
        m = k<<1; m |= (((uint64_t)Uc_beg((*u)))<<32); kv_push(uint64_t, srt, m);///((uint32_t)(((*u)).a[0]>>32));
        m = (k<<1)+1; m |= (((uint64_t)Uc_end((*u)))<<32); kv_push(uint64_t, srt, m);
    }
    

    radix_sort_arch64(srt.a, srt.a+srt.n);
    for (k = 1, l = 0; k <= srt.n; k++) {
        if(k == srt.n || (srt.a[k]>>33) != (srt.a[l]>>33)) {
            idx[srt.a[l]>>33] = l;
            l = k;
        }
    }

    ma_hit_t_alloc* x; asg_arc_t *za; 
    ma_hit_t *h; ma_sub_t *sq, *st;
    int32_t r; asg_arc_t t0, t1, *p;
    for (k = 0; k < fg->u.n; k++) {
        u = &(ug->u.a[k]);
        if((u->circ) || (u->n == 0)) continue;

        uv = k<<1; rv = Uc_end((*u))^1;
        x = &(src[rv>>1]); 
        za = asg_arc_a(ug->g, uv); 
        zn = asg_arc_n(ug->g, uv); 
        for (i = 0; i < x->length; i++) {
            h = &(x->buffer[i]);
            // if(!(h->el)) continue;
            sq = &(cov[Get_qn(*h)]); st = &(cov[Get_tn(*h)]);
            if(st->del || rg->seq[Get_tn(*h)].del) continue;
            r = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, 
                                asm_opt.max_hang_rate, min_ovlp, &t0);
        
            ///if it is a contained read, skip
            if(r < 0) continue;
            if((t0.ul>>32) != rv) continue;
            rw = t0.v;
            if(idx[rw>>1] == ((uint32_t)-1)) continue;
            if(!(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, t0.ul>>32, t0.v, &t0))) continue;

            m = idx[rw>>1]; assert((srt.a[m]>>33) == (rw>>1));
            for (; m < srt.n && (srt.a[m]>>33) == (rw>>1); m++) {
                if(rw == (srt.a[m]>>32)) {
                    uw = (uint32_t)srt.a[m];
                    if(uv == uw) continue;
                    for (z = 0; z < zn; z++) {
                        if((!za[z].del) && (za[z].v==uw)) break;
                    }
                    if(z < zn) continue;
                    if(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, (t0.v^1), ((t0.ul>>32)^1), &t1)) {
                        p = asg_arc_pushp(fg->g); *p = t0; 
                        p->ul<<=32; p->ul>>=32; p->ul |= (uv<<32); p->v = uw;

                        p = asg_arc_pushp(fg->g); *p = t1;
                        p->ul<<=32; p->ul>>=32; p->ul |= ((uw^1)<<32); p->v = uv^1;
                        nist++;
                    }
                }
            }
        }


        uv = (k<<1)+1; rv = Uc_beg((*u))^1;
        x = &(src[rv>>1]); 
        za = asg_arc_a(ug->g, uv); 
        zn = asg_arc_n(ug->g, uv); 
        for (i = 0; i < x->length; i++) {
            h = &(x->buffer[i]);
            // if(!(h->el)) continue;
            sq = &(cov[Get_qn(*h)]); st = &(cov[Get_tn(*h)]);
            if(st->del || rg->seq[Get_tn(*h)].del) continue;
            r = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, 
                                asm_opt.max_hang_rate, min_ovlp, &t0);
        
            ///if it is a contained read, skip
            if(r < 0) continue;
            if((t0.ul>>32) != rv) continue;
            rw = t0.v;
            if(idx[rw>>1] == ((uint32_t)-1)) continue;
            if(!(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, t0.ul>>32, t0.v, &t0))) continue;

            m = idx[rw>>1]; assert((srt.a[m]>>33) == (rw>>1));
            for (; m < srt.n && (srt.a[m]>>33) == (rw>>1); m++) {
                if(rw == (srt.a[m]>>32)) {
                    uw = (uint32_t)srt.a[m];
                    if(uv == uw) continue;
                    for (z = 0; z < zn; z++) {
                        if((!za[z].del) && (za[z].v==uw)) break;
                    }
                    if(z < zn) continue;
                    if(get_edge_from_source(src, cov, NULL, max_hang, min_ovlp, (t0.v^1), ((t0.ul>>32)^1), &t1)) {
                        p = asg_arc_pushp(fg->g); *p = t0; 
                        p->ul<<=32; p->ul>>=32; p->ul |= (uv<<32); p->v = uw;

                        p = asg_arc_pushp(fg->g); *p = t1;
                        p->ul<<=32; p->ul>>=32; p->ul |= ((uw^1)<<32); p->v = uv^1;
                        nist++;
                    }
                }
            }
        }
    }

    if(nist) {
        free(fg->g->idx);
        fg->g->idx = 0;
        fg->g->is_srt = 0;
        asg_cleanup(fg->g);
        asg_symm(fg->g);
        asg_arc_del_trans(fg->g, gap_fuzz);
        ///some of old edges might be lost due the transitive reduction
        recall_arcs(fg->g, ug->g);
    }

    kv_destroy(srt); free(idx);
    return fg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x2270
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x2100
movq -0x8(%rbp), %rdi
callq 0x10ba70
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xcdd10
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0xa8(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x11af0e
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x60(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rax
movq -0x60(%rbp), %rcx
movb $0x0, 0x4(%rax,%rcx,8)
movq -0xb0(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x11adb5
movq -0xb0(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x11adba
jmp 0x11aefd
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x70(%rbp)
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, %eax
shlq $0x20, %rax
orq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x11ae34
cmpq $0x0, -0x48(%rbp)
je 0x11ae06
movq -0x48(%rbp), %rax
shlq %rax
movq %rax, -0x120(%rbp)
jmp 0x11ae14
movl $0x2, %eax
movq %rax, -0x120(%rbp)
jmp 0x11ae14
movq -0x120(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0x40(%rbp)
movq -0x70(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x50(%rbp)
movq %rdx, (%rax,%rcx,8)
movq -0x60(%rbp), %rax
shlq %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq -0xb0(%rbp), %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
xorl $0x1, %eax
movl %eax, %eax
shlq $0x20, %rax
orq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x11aee0
cmpq $0x0, -0x48(%rbp)
je 0x11aeb2
movq -0x48(%rbp), %rax
shlq %rax
movq %rax, -0x128(%rbp)
jmp 0x11aec0
movl $0x2, %eax
movq %rax, -0x128(%rbp)
jmp 0x11aec0
movq -0x128(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0x40(%rbp)
movq -0x70(%rbp), %rdx
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x50(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0x11aefd
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x11ad5a
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x50(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0xc90e0
movq $0x1, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x50(%rbp), %rax
ja 0x11afa4
movq -0x60(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x11af6f
movq -0x40(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq -0x40(%rbp), %rcx
movq -0x68(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x21, %rcx
cmpq %rcx, %rax
je 0x11af94
movq -0x68(%rbp), %rax
movl %eax, %edx
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x68(%rbp), %rsi
movq (%rcx,%rsi,8), %rcx
shrq $0x21, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x11af96
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x11af36
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x11ba7b
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x60(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x11aff2
movq -0xb0(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x11aff7
jmp 0x11ba6a
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x88(%rbp)
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq -0xb0(%rbp), %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
xorl $0x1, %eax
xorl $0x1, %eax
movl %eax, %eax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
shrq %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rcx
movq -0x88(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x98(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0xb8(%rbp), %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jae 0x11b537
movq -0xb8(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0x20(%rbp), %rax
movq -0xc8(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
movl %ecx, %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq -0x20(%rbp), %rax
movq -0xc8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x11b145
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0xc8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11b14a
jmp 0x11b526
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rax
movl 0x4(%rax), %esi
movq -0xd0(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
subl %eax, %esi
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %edx
movq -0xd8(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
subl %eax, %edx
movl -0x24(%rbp), %ecx
leaq 0x2a9669(%rip), %rax    # 0x3c47f8
movss 0x158(%rax), %xmm0
movl -0x28(%rbp), %r8d
leaq -0xf8(%rbp), %r9
callq 0xd0300
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
jge 0x11b1bb
jmp 0x11b526
movq -0xf8(%rbp), %rax
shrq $0x20, %rax
cmpq -0x78(%rbp), %rax
je 0x11b1d1
jmp 0x11b526
movl -0xf0(%rbp), %eax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
movq -0x80(%rbp), %rcx
shrq %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x11b1f1
jmp 0x11b526
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
movq -0xf8(%rbp), %rax
shrq $0x20, %rax
movl %eax, %r9d
movl -0xf0(%rbp), %r10d
xorl %eax, %eax
movl %eax, %edx
leaq -0xf8(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
cmpl $0x0, %eax
jne 0x11b238
jmp 0x11b526
movq -0x30(%rbp), %rax
movq -0x80(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq -0x80(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jne 0x11b268
jmp 0x11b287
leaq 0x26cf26(%rip), %rdi    # 0x388195
leaq 0x26b647(%rip), %rsi    # 0x3868bd
movl $0x4ce2, %edx           # imm = 0x4CE2
leaq 0x26cf2d(%rip), %rcx    # 0x3881af
callq 0x2130
jmp 0x11b289
movq -0x70(%rbp), %rcx
xorl %eax, %eax
cmpq -0x50(%rbp), %rcx
movb %al, -0x129(%rbp)
jae 0x11b2be
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq -0x80(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
sete %al
movb %al, -0x129(%rbp)
movb -0x129(%rbp), %al
testb $0x1, %al
jne 0x11b2cd
jmp 0x11b524
movq -0x80(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jne 0x11b511
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jne 0x11b314
jmp 0x11b513
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jae 0x11b382
movq -0xc0(%rbp), %rax
imulq $0x18, -0xa0(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x11b36c
movq -0xc0(%rbp), %rax
imulq $0x18, -0xa0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0x90(%rbp), %rax
jne 0x11b36c
jmp 0x11b382
jmp 0x11b36e
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x11b31f
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jae 0x11b397
jmp 0x11b513
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
movl -0xf0(%rbp), %r9d
xorl $0x1, %r9d
movq -0xf8(%rbp), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %r10d
xorl %eax, %eax
movl %eax, %edx
leaq -0x110(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
cmpl $0x0, %eax
je 0x11b50f
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xd4050
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, (%rax)
movq -0xf0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xe8(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shrq $0x20, %rcx
movq %rcx, (%rax)
movq -0x88(%rbp), %rcx
shlq $0x20, %rcx
movq -0x118(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rax
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xd4050
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq -0x110(%rbp), %rcx
movq %rcx, (%rax)
movq -0x108(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x100(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shrq $0x20, %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
xorq $0x1, %rcx
shlq $0x20, %rcx
movq -0x118(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x88(%rbp), %rax
xorq $0x1, %rax
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x11b511
jmp 0x11b513
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x11b289
jmp 0x11b526
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x11b0a9
movq -0x60(%rbp), %rax
shlq %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0xb0(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
shrq $0x20, %rax
xorl $0x1, %eax
movl %eax, %eax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
shrq %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rcx
movq -0x88(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movq -0x88(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x98(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0xb8(%rbp), %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jae 0x11ba68
movq -0xb8(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x58(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0x20(%rbp), %rax
movq -0xc8(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
movl %ecx, %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq -0x20(%rbp), %rax
movq -0xc8(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x11b676
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0xc8(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x11b67b
jmp 0x11ba57
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rax
movl 0x4(%rax), %esi
movq -0xd0(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
subl %eax, %esi
movq -0xd8(%rbp), %rax
movl 0x4(%rax), %edx
movq -0xd8(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
subl %eax, %edx
movl -0x24(%rbp), %ecx
leaq 0x2a9138(%rip), %rax    # 0x3c47f8
movss 0x158(%rax), %xmm0
movl -0x28(%rbp), %r8d
leaq -0xf8(%rbp), %r9
callq 0xd0300
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
jge 0x11b6ec
jmp 0x11ba57
movq -0xf8(%rbp), %rax
shrq $0x20, %rax
cmpq -0x78(%rbp), %rax
je 0x11b702
jmp 0x11ba57
movl -0xf0(%rbp), %eax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
movq -0x80(%rbp), %rcx
shrq %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x11b722
jmp 0x11ba57
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
movq -0xf8(%rbp), %rax
shrq $0x20, %rax
movl %eax, %r9d
movl -0xf0(%rbp), %r10d
xorl %eax, %eax
movl %eax, %edx
leaq -0xf8(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
cmpl $0x0, %eax
jne 0x11b769
jmp 0x11ba57
movq -0x30(%rbp), %rax
movq -0x80(%rbp), %rcx
shrq %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq -0x80(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jne 0x11b799
jmp 0x11b7b8
leaq 0x26c9f5(%rip), %rdi    # 0x388195
leaq 0x26b116(%rip), %rsi    # 0x3868bd
movl $0x4d0b, %edx           # imm = 0x4D0B
leaq 0x26c9fc(%rip), %rcx    # 0x3881af
callq 0x2130
jmp 0x11b7ba
movq -0x70(%rbp), %rcx
xorl %eax, %eax
cmpq -0x50(%rbp), %rcx
movb %al, -0x12a(%rbp)
jae 0x11b7ef
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movq -0x80(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
sete %al
movb %al, -0x12a(%rbp)
movb -0x12a(%rbp), %al
testb $0x1, %al
jne 0x11b7fe
jmp 0x11ba55
movq -0x80(%rbp), %rax
movq -0x40(%rbp), %rcx
movq -0x70(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jne 0x11ba42
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x90(%rbp), %rax
jne 0x11b845
jmp 0x11ba44
movq $0x0, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jae 0x11b8b3
movq -0xc0(%rbp), %rax
imulq $0x18, -0xa0(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x11b89d
movq -0xc0(%rbp), %rax
imulq $0x18, -0xa0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpq -0x90(%rbp), %rax
jne 0x11b89d
jmp 0x11b8b3
jmp 0x11b89f
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
jmp 0x11b850
movq -0xa0(%rbp), %rax
cmpq -0x98(%rbp), %rax
jae 0x11b8c8
jmp 0x11ba44
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
movl -0xf0(%rbp), %r9d
xorl $0x1, %r9d
movq -0xf8(%rbp), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %r10d
xorl %eax, %eax
movl %eax, %edx
leaq -0x110(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
cmpl $0x0, %eax
je 0x11ba40
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xd4050
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq -0xf8(%rbp), %rcx
movq %rcx, (%rax)
movq -0xf0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xe8(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shrq $0x20, %rcx
movq %rcx, (%rax)
movq -0x88(%rbp), %rcx
shlq $0x20, %rcx
movq -0x118(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rax
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xd4050
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rax
movq -0x110(%rbp), %rcx
movq %rcx, (%rax)
movq -0x108(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x100(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movq -0x118(%rbp), %rax
movq (%rax), %rcx
shrq $0x20, %rcx
movq %rcx, (%rax)
movq -0x90(%rbp), %rcx
xorq $0x1, %rcx
shlq $0x20, %rcx
movq -0x118(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movq -0x88(%rbp), %rax
xorq $0x1, %rax
movl %eax, %ecx
movq -0x118(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
jmp 0x11ba42
jmp 0x11ba44
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x11b7ba
jmp 0x11ba57
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x11b5da
jmp 0x11ba6a
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x11afac
cmpq $0x0, -0xa8(%rbp)
je 0x11bafc
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rdi
callq 0x2210
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq $0x0, 0x28(%rax)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xcdd10
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xce020
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movl 0x10(%rbp), %esi
callq 0xda630
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x11a990
movq -0x40(%rbp), %rdi
callq 0x2210
movq -0x30(%rbp), %rdi
callq 0x2210
movq -0x38(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax,%rax)