// File: /workspace/github_cpp_makefile_star2_O3/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 0xd2082
movl 0x18(%rsi), %edx
movl 0x18(%rax), %ecx
cmpl %ecx, %edx
jne 0xd20a7
movl 0x4(%rsi), %edx
shrl $0x1f, %edx
movl 0x4(%rax), %ecx
shrl $0x1f, %ecx
cmpl %ecx, %edx
jne 0xd20cc
movl 0x14(%rsi), %edx
shrl $0x1f, %edx
movl 0x14(%rax), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
cmpl %ecx, %edx
jne 0xd20f1
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0xd1e52
movl %ecx, %r12d
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
movzbl 0x4(%rax,%r15,8), %ecx
movq 0x18(%rbx), %rdx
movq 0x20(%rdx), %rdx
movzbl 0x4(%rdx,%r15,8), %r9d
cmpb %r9b, %cl
jne 0xd1d8a
movl (%rax,%r15,8), %ecx
movl %ecx, %eax
shrl $0x1f, %eax
movl (%rdx,%r15,8), %r9d
movl %r9d, %r10d
shrl $0x1f, %r10d
cmpl %r10d, %eax
jne 0xd1dbd
andl %r13d, %ecx
andl %r13d, %r9d
cmpl %r9d, %ecx
jne 0xd1dfd
movq 0x10(%r14), %rdx
movl 0x10(%rdx,%rbp), %ecx
movq 0x10(%rbx), %rax
movl 0x10(%rax,%rbp), %r9d
cmpl %r9d, %ecx
jne 0xd1e20
movq 0x18(%rdx,%rbp), %rsi
movq (%rsi), %rdi
movq 0x18(%rax,%rbp), %rcx
cmpq (%rcx), %rdi
jne 0xd1d83
movl 0x10(%rdx,%rbp), %edx
decl %edx
movq (%rsi,%rdx,8), %rdx
movl 0x10(%rax,%rbp), %eax
decl %eax
cmpq (%rcx,%rax,8), %rdx
jne 0xd1d83
incq %r15
addq $0x28, %rbp
cmpq %r15, %r12
jne 0xd1cdb
jmp 0xd1e4b
callq 0x10cf0
jmp 0xd1d6e
movq 0x1c324f(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x165688(%rip), %rsi    # 0x237423
movl %r15d, %edx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
movq 0x18(%rbx), %rcx
movq 0x20(%rcx), %rdx
jmp 0xd1d00
movq 0x1c321c(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
leaq 0x165684(%rip), %rsi    # 0x237452
movl %r15d, %edx
movl %eax, %ecx
movl %r15d, %r8d
movl %r10d, %r9d
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
movl (%rax,%r15,8), %ecx
movq 0x18(%rbx), %rax
movq 0x20(%rax), %rax
movl (%rax,%r15,8), %r9d
jmp 0xd1d1d
movq 0x1c31dc(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x165677(%rip), %rsi    # 0x237485
movl %r15d, %edx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x22b0
jmp 0xd1d2c
movq 0x1c31b9(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x165687(%rip), %rsi    # 0x2374b8
movl %r15d, %edx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x22b0
movq 0x10(%r14), %rdx
movq 0x10(%rbx), %rax
jmp 0xd1d46
movq 0x18(%rbx), %rax
movl 0x14(%rax), %eax
movl %eax, %ecx
addl %eax, %ecx
je 0xd211c
movl %ecx, %r11d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r10d, %r10d
movq 0x18(%r14), %rax
movq 0x8(%rax), %r15
movq 0x28(%rax), %rax
movq (%rax,%r10,8), %r13
movq %r13, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %r12
movq %r13, %rax
movl $0x0, %ecx
andq %r9, %rax
je 0xd1ebf
leaq (%r15,%r12,8), %rdx
addq $0xc, %rdx
leaq (,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rsi
xorl %edi, %edi
xorl %ecx, %ecx
movl (%rdx,%rdi), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %ecx
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0xd1ea8
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq 0x18(%rbx), %rdx
movq 0x8(%rdx), %rsi
movq 0x28(%rdx), %rdx
movq %r10, (%rsp)
movq (%rdx,%r10,8), %rbp
movq %rbp, %r12
shrq $0x20, %r12
movq %rbp, %r15
andq %r9, %r15
movq %rsi, 0x8(%rsp)
je 0xd1f27
leaq (%r12,%r12,2), %rdx
leaq (%rsi,%rdx,8), %rdx
addq $0xc, %rdx
leaq (,%r15,8), %rsi
leaq (%rsi,%rsi,2), %rdi
xorl %r8d, %r8d
xorl %esi, %esi
movl (%rdx,%r8), %r9d
notl %r9d
shrl $0x1f, %r9d
addl %r9d, %esi
addq $0x18, %r8
cmpq %r8, %rdi
jne 0xd1f0e
jmp 0xd1f29
xorl %esi, %esi
cmpl %esi, %ecx
jne 0xd1fc8
testl %r13d, %r13d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
je 0xd1fb3
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movl %r13d, %ecx
leaq (%r12,%r12,2), %rdx
movq 0x8(%rsp), %rsi
leaq (%rsi,%rdx,8), %rdx
addq $0xc, %rdx
xorl %esi, %esi
leaq (%rsi,%rsi,2), %rdi
cmpl $0x0, 0xc(%rax,%rdi,8)
js 0xd1fab
testl %ebp, %ebp
je 0xd1f99
leaq (%rax,%rdi,8), %r8
movq %rdx, %r9
xorl %edi, %edi
cmpl $0x0, (%r9)
js 0xd1f88
movl 0x8(%r8), %r10d
cmpl -0x4(%r9), %r10d
je 0xd1f9d
incq %rdi
addq $0x18, %r9
cmpq %rdi, %r15
jne 0xd1f78
jmp 0xd2078
xorl %edi, %edi
jmp 0xd1fa3
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
cmpl %ebp, %edi
je 0xd2078
incq %rsi
cmpq %rcx, %rsi
jne 0xd1f60
movq (%rsp), %r10
incq %r10
cmpq %r11, %r10
jne 0xd1e68
jmp 0xd2115
xorl %r9d, %r9d
movl $0x0, %r8d
testq %rax, %rax
je 0xd2009
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rdx
leaq (%rcx,%rdx,8), %rcx
addq $0xc, %rcx
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
xorl %edx, %edx
xorl %r8d, %r8d
movl (%rcx,%rdx), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %r8d
addq $0x18, %rdx
cmpq %rdx, %rax
jne 0xd1ff5
movq %r11, 0x20(%rsp)
testq %r15, %r15
je 0xd2049
leaq (%r12,%r12,2), %rax
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax,8), %rax
addq $0xc, %rax
leaq (,%r15,8), %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %r9d, %r9d
movl (%rax,%rdx), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %r9d
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0xd2035
movq (%rsp), %rax
movl %eax, %edx
shrl %edx
movl %eax, %ecx
andl $0x1, %ecx
movq 0x1c2f83(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x165490(%rip), %rsi    # 0x2374f7
xorl %eax, %eax
callq 0x22b0
movq 0x20(%rsp), %r11
jmp 0xd1f31
movl $0x1, %ebx
jmp 0xd2194
movq 0x1c2f57(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x1652ee(%rip), %rsi    # 0x237381
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rsi
movq 0x18(%rbx), %rax
jmp 0xd1c87
movq 0x1c2f32(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x1652f0(%rip), %rsi    # 0x2373a8
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rsi
movq 0x18(%rbx), %rax
jmp 0xd1c95
movq 0x1c2f0d(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x1652f2(%rip), %rsi    # 0x2373cf
xorl %eax, %eax
callq 0x22b0
movq 0x18(%r14), %rsi
movq 0x18(%rbx), %rax
jmp 0xd1ca9
movq 0x1c2ee8(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x1652f6(%rip), %rsi    # 0x2373f8
xorl %eax, %eax
callq 0x22b0
movq 0x18(%rbx), %rax
movl 0x14(%rax), %eax
jmp 0xd1cbf
movq 0x18(%rbx), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
je 0xd2192
movq 0x10(%r14), %r14
movq 0x10(%rbx), %r15
movl %eax, %eax
shlq $0x3, %rax
leaq (%rax,%rax,4), %r12
xorl %r13d, %r13d
movl $0x1, %ebx
movl (%r14,%r13), %eax
movl (%r15,%r13), %ecx
movl %ecx, %edx
xorl %eax, %edx
js 0xd2194
cmpl %ecx, %eax
jne 0xd2194
movl 0x8(%r15,%r13), %eax
cmpl %eax, 0x8(%r14,%r13)
jne 0xd2194
movl 0x10(%r14,%r13), %edx
cmpl 0x10(%r15,%r13), %edx
jne 0xd2194
movl 0x4(%r14,%r13), %eax
cmpl 0x4(%r15,%r13), %eax
jne 0xd2194
movq 0x18(%r14,%r13), %rdi
movq 0x18(%r15,%r13), %rsi
shll $0x3, %edx
callq 0x21a0
testl %eax, %eax
jne 0xd2194
addq $0x28, %r13
cmpq %r13, %r12
jne 0xd213d
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq