// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: copy_untig_graph(ma_ug_t*)
ma_ug_t* copy_untig_graph(ma_ug_t *src)
{
    ma_ug_t *ug = NULL;
    ug = (ma_ug_t*)calloc(1, sizeof(ma_ug_t));
    ug->g = asg_init();
    uint32_t v;

    ug->g->n_F_seq = src->g->n_F_seq;
    ug->g->r_seq = src->g->r_seq;
    ug->g->m_seq = ug->g->n_seq = src->g->n_seq;
    ug->g->seq = (asg_seq_t*)malloc(ug->g->n_seq * sizeof(asg_seq_t));
    memcpy(ug->g->seq, src->g->seq, sizeof(asg_seq_t)*ug->g->n_seq);

    ug->g->m_arc = ug->g->n_arc = src->g->n_arc;
    ug->g->arc = (asg_arc_t*)malloc(ug->g->n_arc*sizeof(asg_arc_t));
    memcpy(ug->g->arc, src->g->arc, sizeof(asg_arc_t)*ug->g->n_arc);

    ug->g->is_srt = src->g->is_srt;
    ug->g->is_symm = src->g->is_symm;
    ug->g->idx = (uint64_t*)malloc(ug->g->n_seq*2*8);
    memcpy(ug->g->idx, src->g->idx, ug->g->n_seq*2*8); 
    asg_cleanup(ug->g);



    ug->u.m = ug->u.n = src->u.n;
    ug->u.a = (ma_utg_t*)malloc(sizeof(ma_utg_t)*ug->u.n);

    ma_utg_t *src_u = NULL, *ug_u = NULL;
    for (v = 0; v < ug->u.n; v++)
    {
        src_u = &(src->u.a[v]);
        ug_u = &(ug->u.a[v]);
        (*ug_u) = (*src_u);
        ug_u->s = NULL;
        ug_u->a = NULL;
        ug_u->m = ug_u->n = src_u->n;

        ug_u->a = (uint64_t*)malloc(8 * ug_u->n);
        memcpy(ug_u->a, src_u->a, 8*ug_u->n);
    }

    /**
    if(cmp_untig_graph(src, ug)) fprintf(stderr, "ERROR\n");
    ma_ug_destroy(ug);
    return NULL;
    **/
    return ug;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq %rdi, 0x10(%rsp)
movl $0x1, %edi
movl $0x38, %esi
callq 0x2120
movq %rax, %rbx
movq %rax, 0x8(%rsp)
movl $0x1, %edi
movl $0x48, %esi
callq 0x2120
movq %rax, %r15
movq %rax, 0x18(%rbx)
movq 0x18(%r14), %r14
movl 0x38(%r14), %eax
movl %eax, 0x38(%r15)
movl 0x18(%r14), %eax
movl %eax, 0x18(%r15)
movl 0x14(%r14), %r12d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %r12, %r13
andq %rax, %r13
movl %r13d, 0x14(%r15)
movl %r13d, 0x10(%r15)
movq %r13, %rbp
shlq $0x3, %rbp
movq %rbp, %rdi
callq 0x2280
movq %rax, 0x20(%r15)
movq 0x20(%r14), %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0x2160
movl 0x4(%r14), %ebx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %rbx
movl %ebx, 0x4(%r15)
movl %ebx, (%r15)
movq %rbx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbp
movq %rbp, %rdi
callq 0x2280
movq %rax, 0x8(%r15)
movq 0x8(%r14), %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0x2160
movl $0x80000000, %eax       # imm = 0x80000000
movl 0x4(%r14), %ecx
andl %eax, %ecx
orl %ebx, %ecx
movq 0x10(%rsp), %rbx
movl %ecx, 0x4(%r15)
andl 0x14(%r14), %eax
orl %r13d, %eax
movl %eax, 0x14(%r15)
shll $0x4, %r13d
movq %r13, %rdi
callq 0x2280
movq %rax, 0x28(%r15)
movq 0x28(%r14), %rsi
shll $0x4, %r12d
movq %rax, %rdi
movq %r12, %rdx
callq 0x2160
movq %r15, %rdi
callq 0xa0a7d
movq (%rbx), %r12
movq 0x8(%rsp), %r14
movq %r12, (%r14)
movq %r12, 0x8(%r14)
leaq (,%r12,8), %rax
leaq (%rax,%rax,4), %rdi
callq 0x2280
movq %rax, 0x10(%r14)
testq %r12, %r12
je 0xc9056
movq %rax, %r15
movq 0x10(%rbx), %r13
movl $0x1, %ebp
xorl %eax, %eax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rbx
movq 0x10(%r13,%rbx), %rax
movq %rax, 0x10(%r15,%rbx)
movups (%r13,%rbx), %xmm0
movups %xmm0, (%r15,%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r15,%rbx)
movl 0x10(%r13,%rbx), %r14d
movl %r14d, 0x10(%r15,%rbx)
movl %r14d, 0xc(%r15,%rbx)
shll $0x3, %r14d
movq %r14, %rdi
callq 0x2280
movq %rax, 0x18(%r15,%rbx)
movq 0x18(%r13,%rbx), %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x2160
movl %ebp, %eax
incl %ebp
cmpq %rax, %r12
ja 0xc8ff7
movq 0x8(%rsp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq