// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: copy_read_graph(asg_t*)
asg_t* copy_read_graph(asg_t *src)
{
    asg_t *dest = NULL;
    dest = asg_init();

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

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

    dest->is_srt = src->is_srt;
    dest->is_symm = src->is_symm;
    dest->idx = NULL;
    // dest->idx = (uint64_t*)malloc(dest->n_seq*2*8);
    // memcpy(dest->idx, src->idx, dest->n_seq*2*8); 
    asg_cleanup(dest);

    if(src->seq_vis)
    {
        dest->seq_vis = (uint8_t*)malloc(dest->n_seq*2*sizeof(uint8_t));
        memcpy(dest->seq_vis, src->seq_vis, dest->n_seq*2*sizeof(uint8_t));
    }

    if(src->n_F_seq > 0 && src->F_seq)
    {
        dest->n_F_seq = src->n_F_seq;
        dest->F_seq = (ma_utg_t*)malloc(dest->n_F_seq*sizeof(ma_utg_t));
        memcpy(dest->F_seq, src->F_seq, dest->n_F_seq*sizeof(ma_utg_t));
    }
    return dest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
callq 0xcd150
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x10(%rbp), %rax
movl 0x14(%rax), %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %ecx, %edx
movl %edx, 0x14(%rax)
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x2180
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %ecx, %edx
movl %edx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
imulq $0x18, %rax, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
imulq $0x18, %rax, %rdx
callq 0x2180
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edx
shrl $0x1f, %edx
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %edx
shrl $0x1f, %edx
movq -0x10(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rdi
callq 0xcdd10
movq -0x8(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x10b9fb
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movslq %eax, %rdi
shlq $0x0, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movslq %eax, %rdx
shlq $0x0, %rdx
callq 0x2180
movq -0x8(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jbe 0x10ba59
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x10ba59
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x38(%rax)
movq -0x10(%rbp), %rax
movl 0x38(%rax), %eax
imulq $0x28, %rax, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x38(%rax), %eax
imulq $0x28, %rax, %rdx
callq 0x2180
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)