// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: cmp_untig_graph(ma_ug_t*, ma_ug_t*)
uint32_t cmp_untig_graph(ma_ug_t *src, ma_ug_t *dest)
{
    uint32_t nv, nw;
	asg_arc_t *av = NULL, *aw = NULL;
    uint32_t v, i, k, n_vtx = dest->g->n_seq*2;
    if(src->g->n_seq!=dest->g->n_seq)
    {
        fprintf(stderr, "src->g->n_seq: %u, dest->g->n_seq: %u\n", src->g->n_seq, dest->g->n_seq);
        ///return 1;
    } 
    if(src->g->r_seq!=dest->g->r_seq)
    {
        fprintf(stderr, "src->g->r_seq: %u, dest->g->r_seq: %u\n", src->g->r_seq, dest->g->r_seq);
        ///return 1;
    } 
    if(src->g->is_srt!=dest->g->is_srt)
    {
        fprintf(stderr, "src->g->is_srt: %u, dest->g->is_srt: %u\n", src->g->is_srt, dest->g->is_srt);
        ///return 1;
    } 
    if(src->g->is_symm!=dest->g->is_symm)
    {
        fprintf(stderr, "src->g->is_symm: %u, dest->g->is_symm: %u\n", src->g->is_symm, dest->g->is_symm);
        ///return 1;
    } 
    ///if(memcmp(src->g->seq, dest->g->seq, sizeof(asg_seq_t)*src->g->n_seq)!=0) return 1;

    n_vtx = dest->g->n_seq;
    for (v = 0; v < n_vtx; v++)
    {
        if(src->g->seq[v].c != dest->g->seq[v].c)
        {
            fprintf(stderr, "src->g->seq[%u].c: %u, dest->g->seq[%u].c: %u\n", 
            v, src->g->seq[v].c, v, dest->g->seq[v].c);
        }

        if(src->g->seq[v].del != dest->g->seq[v].del)
        {
            fprintf(stderr, "src->g->seq[%u].del: %u, dest->g->seq[%u].del: %u\n", 
            v, src->g->seq[v].del, v, dest->g->seq[v].del);
        }

        if(src->g->seq[v].len != dest->g->seq[v].len)
        {
            fprintf(stderr, "src->g->seq[%u].len: %u, dest->g->seq[%u].len: %u\n", 
            v, src->g->seq[v].len, v, dest->g->seq[v].len);
        }
        
        if(src->u.a[v].n != dest->u.a[v].n)
        {
            fprintf(stderr, "src->u.a[%u].n: %u, dest->u.a[%u].n: %u\n", 
            v, src->u.a[v].n, v, dest->u.a[v].n);
        }

        if(src->u.a[v].a[0] != dest->u.a[v].a[0] || 
                    src->u.a[v].a[src->u.a[v].n-1] != dest->u.a[v].a[dest->u.a[v].n - 1]) 
        {
            fprintf(stderr, "unequal beg/end node\n");
        }
    }
    

    n_vtx = dest->g->n_seq*2;
    for (v = 0; v < n_vtx; v++)
    {
        nv = asg_arc_n(src->g, v);
	    av = asg_arc_a(src->g, v);
        nw = asg_arc_n(dest->g, v);
        aw = asg_arc_a(dest->g, v);
        if(get_real_length(src->g, v, NULL) != get_real_length(dest->g, v, NULL))
        {
            fprintf(stderr, "v>>1: %u, v&1: %u, get_real_length(src->g, v, NULL): %u, get_real_length(dest->g, v, NULL): %u\n", 
            v>>1, v&1, get_real_length(src->g, v, NULL), get_real_length(dest->g, v, NULL));
            ///return 1;
        } 

        for (i = 0; i < nv; i++)
        {
            if(av[i].del) continue;
            for (k = 0; k < nw; k++)
            {
                if(aw[k].del) continue;
                if(av[i].v == aw[k].v) break;
            }

            if(k == nw) return 1;
        }
    }

    n_vtx = dest->g->n_seq;
    ma_utg_t *src_u = NULL, *dest_u = NULL;
    for (v = 0; v < n_vtx; v++)
    {
        src_u = &(src->u.a[v]);
        dest_u = &(dest->u.a[v]);
        if(src_u->circ!=dest_u->circ) return 1;
        if(src_u->end!=dest_u->end) return 1;
        if(src_u->len!=dest_u->len) return 1;
        if(src_u->n!=dest_u->n) return 1;
        if(src_u->start!=dest_u->start) return 1;
        if(memcmp(src_u->a, dest_u->a, 8*src_u->n)!=0) return 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rsi), %rax
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl 0x14(%rax), %ecx
andl %edx, %ecx
movq 0x18(%rdi), %rsi
andl 0x14(%rsi), %edx
cmpl %ecx, %edx
jne 0x95bd6
movl 0x18(%rsi), %edx
movl 0x18(%rax), %ecx
cmpl %ecx, %edx
jne 0x95bfb
movl 0x4(%rsi), %edx
shrl $0x1f, %edx
movl 0x4(%rax), %ecx
shrl $0x1f, %ecx
cmpl %ecx, %edx
jne 0x95c20
movl 0x14(%rsi), %edx
shrl $0x1f, %edx
movl 0x14(%rax), %r12d
movl %r12d, %ecx
shrl $0x1f, %ecx
cmpl %ecx, %edx
jne 0x95c45
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
xorl %ebp, %ebp
cmpq %rbp, %r12
je 0x95a90
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
movzbl 0x4(%rax,%rbp,8), %ecx
movq 0x18(%rbx), %rdx
movq 0x20(%rdx), %rdx
movzbl 0x4(%rdx,%rbp,8), %r9d
cmpb %r9b, %cl
jne 0x959d4
movl (%rax,%rbp,8), %ecx
movl %ecx, %eax
shrl $0x1f, %eax
movl (%rdx,%rbp,8), %r9d
movl %r9d, %r10d
shrl $0x1f, %r10d
cmpl %r10d, %eax
jne 0x95a06
andl %r13d, %ecx
andl %r13d, %r9d
cmpl %r9d, %ecx
jne 0x95a44
movq 0x10(%r14), %rdx
movl 0x10(%rdx,%r15), %ecx
movq 0x10(%rbx), %rax
movl 0x10(%rax,%r15), %r9d
cmpl %r9d, %ecx
jne 0x95a66
movq 0x18(%rdx,%r15), %rsi
movq (%rsi), %rdi
movq 0x18(%rax,%r15), %rcx
cmpq (%rcx), %rdi
jne 0x959b6
movl 0x10(%rdx,%r15), %edx
decl %edx
movq (%rsi,%rdx,8), %rdx
movl 0x10(%rax,%r15), %eax
decl %eax
cmpq (%rcx,%rax,8), %rdx
jne 0x959b6
incq %rbp
addq $0x28, %r15
jmp 0x9590d
movq 0x1bd623(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x153a1a(%rip), %rdi    # 0x1e93e1
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
jmp 0x959aa
movq 0x1bd605(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x15393e(%rip), %rsi    # 0x1e9323
movl %ebp, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
movq 0x18(%rbx), %rcx
movq 0x20(%rcx), %rdx
jmp 0x9593a
movq 0x1bd5d3(%rip), %rcx    # 0x252fe0
movq (%rcx), %rdi
leaq 0x15393b(%rip), %rsi    # 0x1e9352
movl %ebp, %edx
movl %eax, %ecx
movl %ebp, %r8d
movl %r10d, %r9d
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
movl (%rax,%rbp,8), %ecx
movq 0x18(%rbx), %rax
movq 0x20(%rax), %rax
movl (%rax,%rbp,8), %r9d
jmp 0x95956
movq 0x1bd595(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x153930(%rip), %rsi    # 0x1e9385
movl %ebp, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x22b0
jmp 0x95965
movq 0x1bd573(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x153941(%rip), %rsi    # 0x1e93b8
movl %ebp, %edx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x22b0
movq 0x10(%r14), %rdx
movq 0x10(%rbx), %rax
jmp 0x95980
movq 0x18(%rbx), %rax
movl 0x14(%rax), %eax
addl %eax, %eax
xorl %r12d, %r12d
movq %rax, 0x10(%rsp)
cmpq %rax, %r12
je 0x95c6a
movq 0x18(%r14), %rdi
movq 0x28(%rdi), %rax
movq (%rax,%r12,8), %rax
movq %rax, 0x20(%rsp)
shrq $0x20, %rax
imulq $0x18, %rax, %rbp
addq 0x8(%rdi), %rbp
movq 0x18(%rbx), %rax
movq 0x8(%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x28(%rax), %rax
movq (%rax,%r12,8), %r15
movl %r12d, %esi
xorl %edx, %edx
callq 0xc2e7a
movl %eax, %r13d
movq 0x18(%rbx), %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0xc2e7a
cmpl %eax, %r13d
jne 0x95b72
movq %r15, %rdx
shrq $0x20, %rdx
movl 0x20(%rsp), %eax
movl %r15d, %ecx
imulq $0x18, %rdx, %rdx
movq 0x18(%rsp), %rsi
addq %rsi, %rdx
addq $0xc, %rdx
xorl %esi, %esi
cmpq %rax, %rsi
je 0x95b65
imulq $0x18, %rsi, %rdi
cmpl $0x0, 0xc(%rbp,%rdi)
js 0x95b60
addq %rbp, %rdi
movq %rdx, %r9
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x95cda
cmpl $0x0, (%r9)
js 0x95b4e
movl 0x8(%rdi), %r10d
cmpl -0x4(%r9), %r10d
je 0x95b57
incq %r8
addq $0x18, %r9
jmp 0x95b35
cmpl %r8d, %r15d
je 0x95cda
incq %rsi
jmp 0x95b1c
incq %r12
movq 0x10(%rsp), %rax
jmp 0x95aa1
movq 0x1bd467(%rip), %rax    # 0x252fe0
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movl %r12d, %eax
shrl %eax
movl %eax, 0x4(%rsp)
movl %r12d, %r13d
andl $0x1, %r13d
movq 0x18(%r14), %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0xc2e7a
movl %eax, (%rsp)
movq 0x18(%rbx), %rdi
movl %r12d, %esi
xorl %edx, %edx
callq 0xc2e7a
movq 0x8(%rsp), %rdi
leaq 0x15383b(%rip), %rsi    # 0x1e93f7
movl 0x4(%rsp), %edx
movl %r13d, %ecx
movl (%rsp), %r8d
movl %eax, %r9d
xorl %eax, %eax
callq 0x22b0
jmp 0x95afc
movq 0x1bd403(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x15369a(%rip), %rsi    # 0x1e9281
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rsi
movq 0x18(%rbx), %rax
jmp 0x958c1
movq 0x1bd3de(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x15369c(%rip), %rsi    # 0x1e92a8
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rsi
movq 0x18(%rbx), %rax
jmp 0x958cf
movq 0x1bd3b9(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x15369e(%rip), %rsi    # 0x1e92cf
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rsi
movq 0x18(%rbx), %rax
jmp 0x958e3
movq 0x1bd394(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x1536a2(%rip), %rsi    # 0x1e92f8
xorl %eax, %eax
callq 0x22b0
movq 0x18(%rbx), %rax
movl 0x14(%rax), %r12d
jmp 0x958fb
movq 0x18(%rbx), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
imulq $0x28, %rax, %r15
addq $0x28, %r15
xorl %ecx, %ecx
leaq 0x28(%rcx), %r12
cmpq %r12, %r15
je 0x95cec
movq 0x10(%r14), %rax
movq 0x10(%rbx), %rsi
movl (%rax,%rcx), %edx
movl (%rsi,%rcx), %edi
movl %edi, %r8d
xorl %edx, %r8d
js 0x95cda
cmpl %edi, %edx
jne 0x95cda
movl 0x8(%rsi,%rcx), %edx
cmpl %edx, 0x8(%rax,%rcx)
jne 0x95cda
movl 0x10(%rax,%rcx), %edx
cmpl 0x10(%rsi,%rcx), %edx
jne 0x95cda
movl 0x4(%rax,%rcx), %edi
cmpl 0x4(%rsi,%rcx), %edi
jne 0x95cda
movq 0x18(%rax,%rcx), %rdi
movq 0x18(%rsi,%rcx), %rsi
shll $0x3, %edx
callq 0x21a0
movq %r12, %rcx
testl %eax, %eax
je 0x95c80
pushq $0x1
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x95cdd