// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]oatk/path.c
// Function: sequence_duplication_by_copy_number
kh_u32_t *sequence_duplication_by_copy_number(asg_t *asg, int *copy_number, int allow_del)
{
    uint32_t i, n_seg;
    int copy;
    kh_u32_t *seg_dups;
    asmg_t *g;

    n_seg = asg->n_seg;
    g = asg->asmg;
    seg_dups = kh_u32_init();
    for (i = 0; i < n_seg; ++i) {
        if (g->vtx[i].del) continue;
        copy = copy_number[i];
        if (copy > 1) {
            // do copy
            make_seg_dups(asg, seg_dups, i, copy);
#ifdef DEBUG_SEG_COPY
            fprintf(stderr, "[DEBUG_SEG_COPY::%s] make %d extra cop%s of %s [%lu %u]\n", __func__, 
                    copy, copy > 1? "ies" : "y", asg->seg[i].name, g->vtx[i].len, g->vtx[i].cov);
#endif
        } else if (copy == 0 && allow_del) {
            /*** TODO is this safe? **/
            asmg_vtx_del(g, i, 1);
#ifdef DEBUG_SEG_COPY
            fprintf(stderr, "[DEBUG_SEG_COPY::%s] delete seg %s [%lu %u]\n", __func__,
                    asg->seg[i].name, g->vtx[i].len, g->vtx[i].cov);
#endif
        }
    }

#ifdef DEBUG_SEG_COPY
    fprintf(stderr, "[DEBUG_SEG_COPY::%s] graph after expansion\n", __func__);
    asg_print(asg, stderr, 1);
    fprintf(stderr, "[DEBUG_SEG_COPY::%s] expanded graph stats\n", __func__);
    asg_stat(asg, stderr);
#endif
    return seg_dups;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, 0x84(%rsp)
movq %rsi, %rbx
movl 0x8(%rdi), %r15d
movq %rdi, 0x58(%rsp)
movq 0x20(%rdi), %r12
pushq $0x1
popq %rsi
pushq $0x20
popq %rdx
xorl %edi, %edi
callq 0x145b8
movq %rax, 0x10(%rsp)
andq $0x0, 0x18(%rax)
xorl %r13d, %r13d
pushq $0x1
popq %r14
movq %rbx, 0xa8(%rsp)
movq %r15, 0xa0(%rsp)
movq %r12, 0x98(%rsp)
cmpq %r15, %r13
je 0x5fb0
movq 0x10(%r12), %rax
imulq $0x28, %r13, %rcx
movq %rcx, 0xb0(%rsp)
testb $0x40, 0x23(%rax,%rcx)
jne 0x5fa8
movslq (%rbx,%r13,4), %rcx
movq %rcx, 0x38(%rsp)
cmpq $0x2, %rcx
jl 0x58f3
movq 0x58(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x18(%rsp)
leal (,%r13,2), %eax
movq %rax, 0x78(%rsp)
xorl %ecx, %ecx
xorl %r15d, %r15d
xorl %ebp, %ebp
pushq $-0x1
popq %rax
movq %rax, 0x60(%rsp)
xorl %edi, %edi
movq %r13, 0x68(%rsp)
movq %rcx, 0x20(%rsp)
cmpq $0x2, %rdi
movq %rbp, 0x28(%rsp)
je 0x591c
movq %rdi, %rax
orq 0x78(%rsp), %rax
movq 0x18(%rsp), %rsi
movq 0x30(%rsi), %rcx
movq 0x38(%rsi), %rdx
movq (%rcx,%rax,8), %r13
movq (%rdx,%rax,8), %rbp
imulq $0x30, %r13, %rbx
addq 0x28(%rsi), %rbx
movq %rdi, 0x40(%rsp)
subq $0x1, %rbp
jb 0x58dc
testb $0x40, 0x23(%rbx)
jne 0x58d3
movq (%rbx), %rax
xorq 0x8(%rbx), %rax
cmpq $0x2, %rax
jae 0x588c
orq %rdi, %rax
movq 0x60(%rsp), %rax
cmoveq %r13, %rax
movq %rax, 0x60(%rsp)
jmp 0x58d3
movq 0x20(%rsp), %r12
cmpq %r15, %r12
jne 0x58bd
leaq (%r12,%r12), %r15
testq %r12, %r12
pushq $0x2
popq %rax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq 0x28(%rsp), %rdi
callq 0x3330
movq 0x40(%rsp), %rdi
jmp 0x58c2
movq 0x28(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %r13, (%rax,%r12,8)
incq %r12
movq %r12, 0x20(%rsp)
incq %r13
addq $0x30, %rbx
jmp 0x5860
incq %rdi
movq 0x68(%rsp), %r13
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rbp
jmp 0x5822
cmpl $0x0, 0x84(%rsp)
je 0x5fa8
cmpl $0x0, 0x38(%rsp)
jne 0x5fa8
movq %r12, %rdi
movq %r13, %rsi
callq 0x5fc7
jmp 0x5fa8
imulq $0x18, %r13, %rax
movq %rax, 0x70(%rsp)
movq $0x0, 0x90(%rsp)
xorl %ebx, %ebx
cmpq 0x38(%rsp), %rbx
je 0x5f69
movq 0x58(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x70(%rsp), %r13
movq (%r15,%r13), %rdi
callq 0x3130
movq %rax, %xmm0
punpckldq 0x10c2e(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x10c36(%rip), %xmm0    # 0x165a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x40(%rsp)
leaq 0x1(%rbx), %rcx
movl %ecx, %eax
negl %eax
movq %rcx, 0xb8(%rsp)
cmovsl %ecx, %eax
cvtsi2sd %eax, %xmm0
callq 0x3270
callq 0x33e0
addsd 0x40(%rsp), %xmm0
addsd 0x10b65(%rip), %xmm0    # 0x16510
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x10b01(%rip), %xmm0    # 0x164c0
cvttsd2si %xmm0, %rdi
andq %rcx, %rdi
orq %rax, %rdi
callq 0x32f0
movq %rax, %r12
movq (%r15,%r13), %rdx
xorl %r15d, %r15d
movq %rax, %rdi
leaq 0x1186d(%rip), %rsi     # 0x17250
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3420
movq 0x58(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x9283
movq %rax, 0x40(%rsp)
movq %r12, %rdi
callq 0x3060
movq 0x10(%rsp), %r8
cmpq $0x0, 0x10(%r8)
je 0x5a1e
movb (%r8), %cl
movl %r14d, %r15d
shll %cl, %r15d
movl 0x4(%r8), %eax
movl %r15d, %ecx
shrl %ecx
movl %r15d, %edx
shrl $0x2, %edx
addl %ecx, %edx
movl 0x40(%rsp), %ecx
movq %rcx, 0x30(%rsp)
cmpl %edx, %eax
jae 0x5a48
movl (%r8), %eax
movl %eax, 0xc(%rsp)
movl %r15d, %ebx
jmp 0x5a95
leal 0x1(%r15), %ecx
xorl %edx, %edx
movl %ecx, %esi
cmpl $0x2, %esi
jb 0x5a5b
shrl %esi
incl %edx
jmp 0x5a50
leal -0x1(%rcx), %esi
andl %ecx, %esi
cmpl $0x1, %esi
sbbl $-0x1, %edx
cmpl $0x3, %edx
pushq $0x2
popq %rbx
cmovael %edx, %ebx
movl %r14d, %edi
movl %ebx, %ecx
shll %cl, %edi
movl %edi, %ecx
shrl %ecx
movl %edi, %esi
shrl $0x2, %esi
addl %ecx, %esi
cmpl %esi, %eax
jbe 0x5b32
movl (%r8), %ecx
movl %r14d, %ebx
movl %ecx, 0xc(%rsp)
shll %cl, %ebx
movq 0x18(%rsp), %r12
movq 0x20(%rsp), %r13
decl %ebx
movq 0x30(%rsp), %rdi
callq 0xeec2
imull $0x9e3779b9, %eax, %r15d # imm = 0x9E3779B9
movl 0xc(%rsp), %ecx
negb %cl
shrl %cl, %r15d
movq 0x10(%rsp), %r11
movq 0x8(%r11), %rsi
movl %r15d, %ecx
movl %ecx, %eax
shrl $0x5, %eax
movl (%rsi,%rax,4), %edi
movl %r14d, %edx
shll %cl, %edx
btl %ecx, %edi
jae 0x5b07
movq 0x10(%r11), %r8
movl %ecx, %r9d
movq 0x40(%rsp), %r10
cmpl (%r8,%r9,8), %r10d
je 0x5b07
incl %ecx
andl %ebx, %ecx
cmpl %r15d, %ecx
jne 0x5ac7
movl %r15d, %eax
shrl $0x5, %eax
movl %r14d, %edx
movl %r15d, %ecx
shll %cl, %edx
movl (%rsi,%rax,4), %edi
jmp 0x5b0a
movl %ecx, %r15d
testl %edi, %edx
jne 0x5d41
movq 0x10(%r11), %rcx
movl %r15d, %esi
movq 0x30(%rsp), %rdi
movq %rdi, (%rcx,%rsi,8)
movq 0x8(%r11), %rcx
orl %edx, (%rcx,%rax,4)
incl 0x4(%r11)
jmp 0x5d41
movq %rdi, %r12
movq 0x18(%r8), %rdi
movq %r12, 0x50(%rsp)
shrl $0x3, %r12d
andl $-0x4, %r12d
cmpl $0x5, %edx
pushq $0x4
popq %rax
cmovbl %eax, %r12d
movq %r12, %rsi
callq 0x14734
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x31b0
testq %r13, %r13
je 0x5ba3
movl %ebx, 0xc(%rsp)
movq 0x10(%rsp), %rdx
movq 0x10(%rdx), %rsi
movq 0x50(%rsp), %rcx
movl %ecx, %eax
movq %rax, 0x88(%rsp)
testq %rsi, %rsi
movq 0x18(%rsp), %r12
je 0x5bb7
movq %rcx, %rax
movb (%rdx), %cl
movl %r14d, %ebp
shll %cl, %ebp
cmpl %eax, %ebp
jb 0x5bb9
jmp 0x5be9
movq 0x18(%rsp), %r12
movq 0x20(%rsp), %r13
movq 0x10(%rsp), %r11
jmp 0x5d41
xorl %ebp, %ebp
movq 0x10(%rsp), %rbx
movq 0x18(%rbx), %rdi
movq 0x88(%rsp), %rax
leaq (,%rax,8), %rdx
callq 0x1483c
testq %rax, %rax
je 0x5d28
movq %rax, 0x10(%rbx)
movq 0x50(%rsp), %rax
leal -0x1(%rax), %ebx
pushq $0x20
popq %rax
subl 0xc(%rsp), %eax
movl %eax, 0x78(%rsp)
movl %ebp, %r12d
xorl %ecx, %ecx
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rbp
cmpq %r12, %rcx
je 0x5ccd
movq 0x8(%rdi), %r15
movl %ecx, %eax
shrl $0x5, %eax
movl (%r15,%rax,4), %edx
movl %r14d, %esi
shll %cl, %esi
btl %ecx, %edx
jae 0x5cc5
movq 0x10(%rdi), %rdi
movq %rcx, 0xc0(%rsp)
movq (%rdi,%rcx,8), %rbp
notl %esi
andl %esi, %edx
movl %edx, (%r15,%rax,4)
movq %rbp, %rdi
callq 0xeec2
imull $0x9e3779b9, %eax, %eax # imm = 0x9E3779B9
movl 0x78(%rsp), %ecx
shrl %cl, %eax
movl %eax, %edx
shrl $0x5, %edx
movl (%r13,%rdx,4), %edi
movl %r14d, %esi
movl %eax, %ecx
shll %cl, %esi
btl %eax, %edi
jae 0x5c72
incl %eax
andl %ebx, %eax
jmp 0x5c56
orl %esi, %edi
movl %edi, (%r13,%rdx,4)
movl %eax, %ecx
cmpl %r12d, %eax
jae 0x5ca6
movq 0x10(%rsp), %r8
movq 0x10(%r8), %rax
testl %esi, (%r15,%rdx,4)
je 0x5caf
movq (%rax,%rcx,8), %rdi
movq %rbp, (%rax,%rcx,8)
notl %esi
movq 0x8(%r8), %r15
andl %esi, (%r15,%rdx,4)
movq %rdi, %rbp
jmp 0x5c42
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
movq %rbp, (%rax,%rcx,8)
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rbp
movq 0xc0(%rsp), %rcx
incq %rcx
jmp 0x5c06
cmpl 0x50(%rsp), %r12d
movq %rdi, %rcx
jbe 0x5cfa
movq 0x10(%rcx), %rsi
movq 0x18(%rcx), %rdi
movq 0x88(%rsp), %rdx
shlq $0x3, %rdx
movq %rcx, %rbx
callq 0x1483c
movq %rbx, %rcx
movq %rax, 0x10(%rbx)
movq 0x8(%rcx), %rsi
movq 0x18(%rcx), %rdi
movq %rcx, %rbx
callq 0x1463f
movq %r13, 0x8(%rbx)
movl 0xc(%rsp), %eax
movl %eax, (%rbx)
movq 0x18(%rsp), %r12
movq 0x20(%rsp), %r13
movq 0x50(%rsp), %rbx
jmp 0x5a9f
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0x1463f
movq %rbx, %r11
movq 0x20(%rsp), %r13
movq 0x28(%rsp), %rbp
movq 0x10(%r11), %rax
movl %r15d, %ecx
movq 0x68(%rsp), %rdx
movl %edx, 0x4(%rax,%rcx,8)
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rbx
imulq $0x18, 0x30(%rsp), %rax
movq 0x70(%rsp), %rcx
movq 0x10(%rbx,%rcx), %rcx
movq %rcx, 0x10(%rbx,%rax)
movq (%r12), %rax
cmpq 0x8(%r12), %rax
jne 0x5dd9
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x20, %rax
orq %rcx, %rax
incq %rax
movq %rax, 0x8(%r12)
movq 0x10(%r12), %rdi
imulq $0x28, %rax, %rsi
callq 0x3330
movq %rax, %rcx
movq %rax, 0x10(%r12)
movq (%r12), %rax
jmp 0x5dde
movq 0x10(%r12), %rcx
movq 0x38(%rsp), %r15
movq 0x70(%rsp), %rdx
addq %rbx, %rdx
addq $0x10, %rdx
leaq 0x1(%rax), %rsi
movq %rsi, (%r12)
imulq $0x28, %rax, %rsi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rcx,%rsi)
movupd %xmm0, (%rcx,%rsi)
andq $0x0, 0x20(%rcx,%rsi)
movl (%rdx), %eax
movq %rax, 0x18(%rcx,%rsi)
movq 0x10(%r12), %rax
movq 0xb0(%rsp), %rdx
movl 0x20(%rax,%rdx), %eax
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl %edx, %eax
xorl %edx, %edx
divl %r15d
movl %eax, 0x20(%rcx,%rsi)
movq 0x40(%rsp), %rax
addl %eax, %eax
movq %rax, 0x40(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %r13
je 0x5e9a
movq 0x28(%r12), %rax
imulq $0x30, (%rbp,%rbx,8), %rdx
movq (%rax,%rdx), %rsi
movq 0x8(%rax,%rdx), %r9
andl $0x1, %esi
orq 0x40(%rsp), %rsi
movq 0x10(%rax,%rdx), %rcx
movq 0x18(%rax,%rdx), %r8
movl 0x20(%rax,%rdx), %edi
movl %edi, %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
xorl %edx, %edx
divl %r15d
shrl $0x1f, %edi
movl %edi, (%rsp)
movq %r12, %rdi
movq %r9, %rdx
movl %eax, %r9d
callq 0xee59
incq %rbx
jmp 0x5e46
cmpq $-0x1, 0x60(%rsp)
je 0x5f53
imulq $0x30, 0x60(%rsp), %rbx
movq 0x18(%rsp), %rax
addq 0x28(%rax), %rbx
movq 0x30(%rsp), %rax
addq %rax, %rax
movq %rax, 0x30(%rsp)
movq 0x90(%rsp), %r12
testq %r12, %r12
je 0x5f53
movq 0x30(%rsp), %rax
leaq (%rax,%r12), %r15
movq 0x10(%rbx), %rcx
movq 0x18(%rbx), %r8
movl 0x20(%rbx), %eax
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl %edx, %eax
xorl %edx, %edx
movq 0x38(%rsp), %rbp
divl %ebp
andl $0x0, (%rsp)
movq 0x18(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq 0x40(%rsp), %r14
movq %r14, %rdx
movl %eax, %r9d
callq 0xee59
movq 0x10(%rbx), %rcx
movq 0x18(%rbx), %r8
movl 0x20(%rbx), %eax
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl %edx, %eax
xorl %edx, %edx
divl %ebp
movq 0x28(%rsp), %rbp
andl $0x0, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
pushq $0x1
popq %r14
movq %r15, %rdx
movl %eax, %r9d
callq 0xee59
addq $0x2, %r12
jmp 0x5eca
addq $-0x2, 0x90(%rsp)
movq 0xb8(%rsp), %rbx
jmp 0x5933
movq %rbp, %rdi
callq 0x3060
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xfcc3
movq %rbx, %rdi
movq 0x68(%rsp), %r13
movq %r13, %rsi
callq 0x5fc7
movq 0xa8(%rsp), %rbx
movq 0xa0(%rsp), %r15
movq 0x98(%rsp), %r12
incq %r13
jmp 0x57b9
movq 0x10(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq