// File: /workspace/github_c_makefile_star2_O1/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 $0xb8, %rsp
movl %edx, 0x74(%rsp)
movq %rsi, %rbx
movl 0x8(%rdi), %r14d
movq %rdi, 0x58(%rsp)
movq 0x20(%rdi), %r15
movl $0x1, %esi
movl $0x20, %edx
xorl %edi, %edi
callq 0x171c8
movq %rax, %r13
movq $0x0, 0x18(%rax)
testq %r14, %r14
je 0x6db3
xorl %r12d, %r12d
movq %rbx, 0x90(%rsp)
movq %r14, 0x88(%rsp)
movq %r15, 0x80(%rsp)
movq %r13, 0x98(%rsp)
movq 0x10(%r15), %rax
leaq (%r12,%r12,4), %rcx
movq %rcx, 0xa0(%rsp)
testb $0x40, 0x23(%rax,%rcx,8)
jne 0x6da7
movslq (%rbx,%r12,4), %rcx
movq %rcx, 0x8(%rsp)
cmpq $0x2, %rcx
jl 0x6d8e
movq 0x58(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x60(%rsp)
movq %r12, 0x50(%rsp)
leal (%r12,%r12), %eax
movq %rax, 0x20(%rsp)
movq $-0x1, %rdi
xorl %r9d, %r9d
movq $0x0, 0x10(%rsp)
xorl %r8d, %r8d
movq $0x0, 0x48(%rsp)
movq %r9, %rcx
orq 0x20(%rsp), %rcx
movq 0x60(%rsp), %rsi
movq 0x38(%rsi), %rdx
movq (%rdx,%rcx,8), %r12
testq %r12, %r12
je 0x66dc
movq 0x30(%rsi), %rdx
movq (%rdx,%rcx,8), %rbp
leaq (,%rbp,2), %rbx
addq %rbp, %rbx
shlq $0x4, %rbx
addq 0x28(%rsi), %rbx
testb $0x40, 0x23(%rbx)
jne 0x66cc
movq (%rbx), %rcx
xorq 0x8(%rbx), %rcx
cmpq $0x2, %rcx
jae 0x666d
orq %r9, %rcx
cmoveq %rbp, %rdi
jmp 0x66cc
cmpq %r8, 0x48(%rsp)
jne 0x66b1
leaq (%r8,%r8), %r15
testq %r8, %r8
movl $0x2, %eax
cmoveq %rax, %r15
leaq (,%r15,8), %rsi
movq %rdi, 0x40(%rsp)
movq 0x10(%rsp), %rdi
movq %r13, %r14
movq %r9, %r13
callq 0x3330
movq %r13, %r9
movq %r14, %r13
movq 0x40(%rsp), %rdi
movq %r15, %r8
jmp 0x66b6
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rcx
movq %rbp, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x48(%rsp)
incq %rbp
addq $0x30, %rbx
decq %r12
jne 0x6651
leaq 0x1(%r9), %rcx
testq %r9, %r9
movq %rcx, %r9
je 0x6618
movq %rdi, 0x40(%rsp)
movq 0x50(%rsp), %rax
leaq (%rax,%rax,2), %rax
movq %rax, 0x68(%rsp)
movq $0x0, 0x78(%rsp)
xorl %r15d, %r15d
movq 0x8(%rsp), %r14
movq 0x58(%rsp), %r12
movq 0x10(%r12), %rbx
movq 0x68(%rsp), %rbp
movq (%rbx,%rbp,8), %rdi
callq 0x3130
movq %rax, %xmm0
punpckldq 0x12e5b(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x12e63(%rip), %xmm0    # 0x195a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
leaq 0x1(%r15), %rcx
movl %ecx, %eax
negl %eax
movq %rcx, 0xb0(%rsp)
cmovsl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x3270
callq 0x33e0
addsd 0x20(%rsp), %xmm0
addsd 0x12d87(%rip), %xmm0    # 0x19508
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x12d23(%rip), %xmm0    # 0x194b8
cvttsd2si %xmm0, %rdi
andq %rcx, %rdi
orq %rax, %rdi
callq 0x32f0
movq %r15, %rcx
movq %rax, %r15
movq (%rbx,%rbp,8), %rdx
xorl %ebp, %ebp
movq %rax, %rdi
leaq 0x13a75(%rip), %rsi     # 0x1a230
movq %rcx, 0xa8(%rsp)
xorl %eax, %eax
callq 0x3420
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xa82f
movl %eax, %r12d
movq %r15, %rdi
callq 0x3060
cmpq $0x0, 0x10(%r13)
je 0x67f4
movb (%r13), %cl
movl $0x1, %ebp
shll %cl, %ebp
movl 0x4(%r13), %eax
movl %ebp, %ecx
shrl %ecx
movl %ebp, %edx
shrl $0x2, %edx
addl %ecx, %edx
movl %r12d, %r8d
cmpl %edx, %eax
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
movq %r12, 0x8(%rsp)
movq %r8, 0x20(%rsp)
jb 0x6a62
leal 0x1(%rbp), %ecx
bsrl %ecx, %edx
cmpl $0x2, %ecx
movl $0x0, %esi
cmovbl %esi, %edx
andl %ebp, %ecx
cmpl $0x1, %ecx
sbbl $-0x1, %edx
cmpl $0x3, %edx
movl $0x2, %ecx
cmovael %edx, %ecx
movl $0x1, %r9d
shll %cl, %r9d
movl %r9d, %edi
shrl %edi
movl %r9d, %esi
shrl $0x2, %esi
addl %edi, %esi
cmpl %esi, %eax
ja 0x6a57
movl %ecx, 0x1c(%rsp)
movq 0x18(%r13), %rdi
movq %r9, 0x38(%rsp)
movl %r9d, %ebx
shrl $0x3, %ebx
andl $-0x4, %ebx
cmpl $0x5, %edx
movl $0x4, %eax
cmovbl %eax, %ebx
movq %rbx, %rsi
callq 0x17335
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x31b0
testq %r15, %r15
je 0x68b6
movq 0x10(%r13), %rsi
testq %rsi, %rsi
je 0x68c6
movb (%r13), %cl
movl $0x1, %r12d
shll %cl, %r12d
jmp 0x68c9
movq 0x20(%rsp), %r8
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
jmp 0x6af4
xorl %r12d, %r12d
movq 0x38(%rsp), %rax
cmpl %eax, %r12d
jae 0x6910
movq 0x18(%r13), %rdi
movl %eax, %edx
shlq $0x3, %rdx
callq 0x17438
movq %rax, %rbx
testq %rax, %rax
je 0x68f0
movq %rbx, 0x10(%r13)
jmp 0x68fc
movq 0x18(%r13), %rdi
movq %r15, %rsi
callq 0x1726a
testq %rbx, %rbx
movq 0x20(%rsp), %r8
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
je 0x6af4
testl %r12d, %r12d
je 0x6a0d
movq 0x38(%rsp), %rax
leal -0x1(%rax), %edi
movl $0x20, %eax
subl 0x1c(%rsp), %eax
movl %r12d, %r8d
xorl %edx, %edx
movq 0x8(%r13), %rsi
movl %edx, %r10d
shrl $0x5, %r10d
movl (%rsi,%r10,4), %r11d
movl $0x1, %ebp
movl %edx, %ecx
shll %cl, %ebp
btl %edx, %r11d
jae 0x6a01
movq 0x10(%r13), %rcx
movq (%rcx,%rdx,8), %r9
notl %ebp
andl %ebp, %r11d
movl %r11d, (%rsi,%r10,4)
movl %r9d, %ecx
shll $0xf, %ecx
notl %ecx
addl %r9d, %ecx
movl %ecx, %esi
shrl $0xa, %esi
xorl %ecx, %esi
leal (%rsi,%rsi,8), %ecx
movl %ecx, %esi
shrl $0x6, %esi
xorl %ecx, %esi
movl %esi, %ecx
shll $0xb, %ecx
notl %ecx
addl %esi, %ecx
movl %ecx, %esi
shrl $0x10, %esi
xorl %ecx, %esi
imull $0x9e3779b9, %esi, %esi # imm = 0x9E3779B9
movl %eax, %ecx
shrl %cl, %esi
movl %esi, %r10d
shrl $0x5, %r10d
movl (%r15,%r10,4), %ebp
movl $0x1, %r11d
movl %esi, %ecx
shll %cl, %r11d
btl %esi, %ebp
jae 0x69b9
incl %esi
andl %edi, %esi
jmp 0x6998
orl %r11d, %ebp
movl %ebp, (%r15,%r10,4)
movl %esi, %ecx
cmpl %r12d, %esi
jae 0x69ef
movq 0x8(%r13), %rsi
testl %r11d, (%rsi,%r10,4)
je 0x69ef
movq 0x10(%r13), %rsi
movq (%rsi,%rcx,8), %rbp
movq %r9, (%rsi,%rcx,8)
notl %r11d
movq 0x8(%r13), %rcx
andl %r11d, (%rcx,%r10,4)
movb $0x1, %cl
movq %rbp, %r9
jmp 0x69f9
movq 0x10(%r13), %rsi
movq %r9, (%rsi,%rcx,8)
xorl %ecx, %ecx
testb %cl, %cl
jne 0x6962
incq %rdx
cmpq %r8, %rdx
jne 0x692f
movq 0x38(%rsp), %rbx
cmpl %ebx, %r12d
jbe 0x6a2e
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdi
movl %ebx, %edx
shlq $0x3, %rdx
callq 0x17438
movq %rax, 0x10(%r13)
movq 0x8(%r13), %rsi
movq 0x18(%r13), %rdi
callq 0x1726a
movq %r15, 0x8(%r13)
movl 0x1c(%rsp), %eax
movl %eax, (%r13)
movq 0x8(%rsp), %r12
movq 0x20(%rsp), %r8
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
movb (%r13), %cl
movl $0x1, %ebp
shll %cl, %ebp
movl %r12d, %eax
shll $0xf, %eax
notl %eax
addl %r12d, %eax
movl %eax, %ecx
shrl $0xa, %ecx
xorl %eax, %ecx
leal (%rcx,%rcx,8), %eax
movl %eax, %ecx
shrl $0x6, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shll $0xb, %eax
notl %eax
addl %ecx, %eax
movl %eax, %ecx
shrl $0x10, %ecx
xorl %eax, %ecx
imull $0x9e3779b9, %ecx, %edx # imm = 0x9E3779B9
movb (%r13), %al
xorl %ecx, %ecx
subb %al, %cl
shrl %cl, %edx
movl %ebp, %ecx
decl %ecx
movq 0x8(%r13), %rax
movl %edx, %ebp
movl %ebp, %esi
shrl $0x5, %esi
movl (%rax,%rsi,4), %esi
btl %ebp, %esi
jae 0x6ac9
movq 0x10(%r13), %rsi
movl %ebp, %edi
cmpl (%rsi,%rdi,8), %r12d
je 0x6ac9
incl %ebp
andl %ecx, %ebp
cmpl %edx, %ebp
jne 0x6aa8
movl %ebp, %edx
shrl $0x5, %edx
movl (%rax,%rdx,4), %esi
movl $0x1, %eax
movl %ebp, %ecx
shll %cl, %eax
btl %ebp, %esi
jb 0x6af4
movq 0x10(%r13), %rcx
movl %ebp, %esi
movq %r8, (%rcx,%rsi,8)
movq 0x8(%r13), %rcx
orl %eax, (%rcx,%rdx,4)
incl 0x4(%r13)
movq 0x10(%r13), %rax
movl %ebp, %ecx
movq 0x50(%rsp), %rdx
movl %edx, 0x4(%rax,%rcx,8)
movq 0x58(%rsp), %rax
movq 0x10(%rax), %r15
leaq (%r8,%r8,2), %rax
movq 0x68(%rsp), %rdx
movl 0x10(%r15,%rdx,8), %ecx
movl %ecx, 0x10(%r15,%rax,8)
movl 0x14(%r15,%rdx,8), %ecx
movl %ecx, 0x14(%r15,%rax,8)
movq 0x60(%rsp), %rbp
movq 0x8(%rbp), %rax
cmpq %rax, (%rbp)
jne 0x6b9a
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
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rbp)
movq 0x10(%rbp), %rdi
leaq 0x8(,%rax,8), %rax
leaq (%rax,%rax,4), %rsi
callq 0x3330
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
movq %rax, 0x10(%rbp)
movq 0x68(%rsp), %rax
leaq (%r15,%rax,8), %rax
movq (%rbp), %rcx
movq 0x10(%rbp), %rsi
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbp)
leaq (%rcx,%rcx,4), %rcx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsi,%rcx,8)
movupd %xmm0, (%rsi,%rcx,8)
movq $0x0, 0x20(%rsi,%rcx,8)
movl 0x10(%rax), %eax
movq %rax, 0x18(%rsi,%rcx,8)
movq 0x10(%rbp), %rax
movq 0xa0(%rsp), %rdx
movl 0x20(%rax,%rdx,8), %eax
andl %r10d, %eax
xorl %edx, %edx
divl %r14d
movl %eax, 0x20(%rsi,%rcx,8)
movq 0x48(%rsp), %r13
testq %r13, %r13
movq 0x10(%rsp), %rbx
je 0x6c63
movq 0x8(%rsp), %rax
leal (%rax,%rax), %r15d
xorl %r12d, %r12d
movq 0x28(%rbp), %rax
movq (%rbx,%r12,8), %rcx
leaq (%rcx,%rcx,2), %rdx
shlq $0x4, %rdx
movq (%rax,%rdx), %rsi
movq 0x8(%rax,%rdx), %r9
andl $0x1, %esi
orq %r15, %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 %r14d
shrl $0x1f, %edi
movl %edi, (%rsp)
movq %rbp, %rdi
movq %r9, %rdx
movl %eax, %r9d
callq 0x1082c
incq %r12
cmpq %r12, %r13
jne 0x6c0e
cmpq $-0x1, 0x40(%rsp)
sete %al
cmpq $0x0, 0xa8(%rsp)
sete %cl
orb %al, %cl
movl $0x0, %esi
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq 0x8(%rsp), %r13
jne 0x6d29
movq %rbp, %rbx
movq 0x40(%rsp), %rax
leaq (%rax,%rax,2), %r12
shlq $0x4, %r12
addq 0x28(%rbp), %r12
addl %r13d, %r13d
movq 0x20(%rsp), %rax
addq %rax, %rax
movq %rax, 0x20(%rsp)
movq 0x78(%rsp), %rbp
movq 0x20(%rsp), %rax
leaq (%rax,%rbp), %r15
movq 0x10(%r12), %rcx
movq 0x18(%r12), %r8
movl 0x20(%r12), %eax
andl %edx, %eax
xorl %edx, %edx
divl %r14d
movl %esi, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %eax, %r9d
callq 0x1082c
movq 0x10(%r12), %rcx
movq 0x18(%r12), %r8
movl 0x20(%r12), %eax
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl %edx, %eax
xorl %edx, %edx
divl %r14d
xorl %edx, %edx
movl %edx, (%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movl %eax, %r9d
callq 0x1082c
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
xorl %esi, %esi
addq $0x2, %rbp
jne 0x6cb8
addq $-0x2, 0x78(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, %r15
cmpq %r14, %rax
movq 0x98(%rsp), %r13
jne 0x6710
movq 0x10(%rsp), %rdi
callq 0x3060
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x11baf
movq %rbx, %rdi
movq 0x50(%rsp), %r12
movq %r12, %rsi
callq 0x6dc8
movq 0x90(%rsp), %rbx
movq 0x88(%rsp), %r14
movq 0x80(%rsp), %r15
jmp 0x6da7
cmpl $0x0, 0x74(%rsp)
je 0x6da7
cmpl $0x0, 0x8(%rsp)
jne 0x6da7
movq %r15, %rdi
movq %r12, %rsi
callq 0x6dc8
incq %r12
cmpq %r14, %r12
jne 0x65af
movq %r13, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq