// File: /workspace/github_c_makefile_star2_O3/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, 0x5c(%rsp)
movq %rsi, %r14
movl 0x8(%rdi), %r15d
movq %rdi, 0x48(%rsp)
movq 0x20(%rdi), %r13
movl $0x1, %esi
movl $0x20, %edx
xorl %edi, %edi
callq 0x18ab0
movq %rax, %r12
movq $0x0, 0x18(%rax)
testq %r15, %r15
je 0x6f30
xorl %ebp, %ebp
movq %r14, 0x98(%rsp)
movq %r15, 0x90(%rsp)
movq %r13, 0x88(%rsp)
movq %r12, 0x80(%rsp)
movq 0x10(%r13), %rax
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
movq %rcx, 0xa0(%rsp)
testb $0x40, 0x23(%rax,%rcx,8)
jne 0x6f24
movslq (%r14,%rbp,4), %rcx
movq %rcx, 0x10(%rsp)
cmpq $0x2, %rcx
jl 0x6f0b
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x70(%rsp)
movq %rbp, 0x40(%rsp)
leal (,%rbp,2), %eax
movq %rax, 0x20(%rsp)
movq $-0x1, %r8
movb $0x1, %dil
xorl %ecx, %ecx
xorl %ebx, %ebx
xorl %eax, %eax
movq $0x0, 0x38(%rsp)
orq 0x20(%rsp), %rcx
movq 0x70(%rsp), %rsi
movq 0x38(%rsi), %rdx
movq (%rdx,%rcx,8), %r13
testq %r13, %r13
je 0x681f
movq 0x30(%rsi), %rdx
movq (%rdx,%rcx,8), %r15
leaq (%r15,%r15,2), %rbp
shlq $0x4, %rbp
addq 0x28(%rsi), %rbp
testb $0x40, 0x23(%rbp)
jne 0x680f
movq (%rbp), %rcx
movq 0x8(%rbp), %rdx
movq %rdx, %rsi
xorq %rcx, %rsi
cmpq $0x2, %rsi
jae 0x67bd
cmpq %rdx, %rcx
movq %r8, %rcx
cmoveq %r15, %rcx
testb $0x1, %dil
cmovneq %rcx, %r8
jmp 0x680f
cmpq %rax, 0x38(%rsp)
jne 0x67fe
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rsi
movl %edi, %r12d
movq %rbx, %rdi
movq %r8, %rbx
callq 0x3330
movl %r12d, %edi
movq 0x80(%rsp), %r12
movq %rbx, %r8
movq %rax, %rbx
movq %r14, %rax
movq 0x38(%rsp), %rcx
movq %r15, (%rbx,%rcx,8)
incq %rcx
movq %rcx, 0x38(%rsp)
incq %r15
addq $0x30, %rbp
decq %r13
jne 0x678f
movl $0x1, %ecx
testb $0x1, %dil
movl $0x0, %edi
jne 0x6760
movq %r8, 0x68(%rsp)
movq 0x40(%rsp), %rax
leaq (%rax,%rax,2), %rax
movq %rax, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
xorl %r13d, %r13d
movq 0x48(%rsp), %rbp
movq 0x10(%rbp), %r15
movq 0x50(%rsp), %r14
movq (%r15,%r14,8), %rdi
callq 0x3130
movq %rax, %xmm0
punpckldq 0x13d1a(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x13d22(%rip), %xmm0    # 0x1a5a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
leaq 0x1(%r13), %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 0x13c46(%rip), %xmm0    # 0x1a508
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x13be2(%rip), %xmm0    # 0x1a4b8
cvttsd2si %xmm0, %rdi
andq %rcx, %rdi
orq %rax, %rdi
callq 0x32f0
movq %r13, %rcx
movq %rax, %r13
movq (%r15,%r14,8), %rdx
xorl %r15d, %r15d
movq %rax, %rdi
leaq 0x14943(%rip), %rsi     # 0x1b240
movq %rcx, 0xa8(%rsp)
xorl %eax, %eax
callq 0x3420
movq %rbp, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0xacf1
movl %eax, %ebp
movq %r13, %rdi
callq 0x3060
cmpq $0x0, 0x10(%r12)
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
je 0x693e
movb (%r12), %cl
movl $0x1, %r15d
shll %cl, %r15d
movl 0x4(%r12), %eax
movl %r15d, %ecx
shrl %ecx
movl %r15d, %edx
shrl $0x2, %edx
addl %ecx, %edx
movl %ebp, %r14d
cmpl %edx, %eax
movq %rbp, 0x78(%rsp)
movq %r14, 0x20(%rsp)
jae 0x696a
movl (%r12), %ecx
movl %r15d, %r11d
jmp 0x69bb
leal 0x1(%r15), %ecx
bsrl %ecx, %edx
cmpl $0x2, %ecx
movl $0x0, %esi
cmovbl %esi, %edx
andl %r15d, %ecx
cmpl $0x1, %ecx
sbbl $-0x1, %edx
cmpl $0x3, %edx
movl $0x2, %ecx
cmovael %edx, %ecx
movl $0x1, %r8d
shll %cl, %r8d
movl %r8d, %edi
shrl %edi
movl %r8d, %esi
shrl $0x2, %esi
addl %edi, %esi
cmpl %esi, %eax
jbe 0x6a6b
movl (%r12), %ecx
movl $0x1, %r11d
shll %cl, %r11d
movq 0x10(%rsp), %r13
movl %ebp, %eax
shll $0xf, %eax
notl %eax
addl %ebp, %eax
movl %eax, %edx
shrl $0xa, %edx
xorl %eax, %edx
leal (%rdx,%rdx,8), %eax
movl %eax, %edx
shrl $0x6, %edx
xorl %eax, %edx
movl %edx, %eax
shll $0xb, %eax
notl %eax
addl %edx, %eax
movl %eax, %edx
shrl $0x10, %edx
xorl %eax, %edx
imull $0x9e3779b9, %edx, %r15d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r15d
decl %r11d
movq 0x8(%r12), %rsi
movl %r15d, %ecx
movl %ecx, %eax
shrl $0x5, %eax
movl (%rsi,%rax,4), %edi
movl $0x1, %edx
shll %cl, %edx
btl %ecx, %edi
jae 0x6a42
movq 0x10(%r12), %r8
movl %ecx, %r9d
cmpl (%r8,%r9,8), %ebp
je 0x6a42
incl %ecx
andl %r11d, %ecx
cmpl %r15d, %ecx
jne 0x6a01
movl %r15d, %eax
shrl $0x5, %eax
movl $0x1, %edx
movl %r15d, %ecx
shll %cl, %edx
movl (%rsi,%rax,4), %edi
jmp 0x6a45
movl %ecx, %r15d
testl %edi, %edx
jne 0x6c7d
movq 0x10(%r12), %rcx
movl %r15d, %esi
movq %r14, (%rcx,%rsi,8)
movq 0x8(%r12), %rcx
orl %edx, (%rcx,%rax,4)
incl 0x4(%r12)
jmp 0x6c7d
movl %ecx, 0x1c(%rsp)
movq 0x18(%r12), %rdi
movq %r8, 0x8(%rsp)
movl %r8d, %r14d
shrl $0x3, %r14d
andl $-0x4, %r14d
cmpl $0x5, %edx
movl $0x4, %eax
cmovbl %eax, %r14d
movq %r14, %rsi
callq 0x18c11
movq %rax, %r13
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x31b0
testq %r13, %r13
je 0x6ad0
movq 0x10(%r12), %rsi
testq %rsi, %rsi
je 0x6ae5
movb (%r12), %cl
movl $0x1, %r14d
shll %cl, %r14d
movq 0x8(%rsp), %rax
cmpl %eax, %r14d
jb 0x6aed
jmp 0x6b19
movq 0x10(%rsp), %r13
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
movq 0x20(%rsp), %r14
jmp 0x6c7d
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
movq 0x18(%r12), %rdi
movl %eax, %edx
shlq $0x3, %rdx
callq 0x18d19
testq %rax, %rax
je 0x6c60
movq %rax, 0x10(%r12)
testl %r14d, %r14d
movq 0x8(%rsp), %rax
je 0x6c2a
leal -0x1(%rax), %edi
movl $0x20, %eax
subl 0x1c(%rsp), %eax
movl %r14d, %r8d
xorl %edx, %edx
movq 0x8(%r12), %r9
movl %edx, %esi
shrl $0x5, %esi
movl (%r9,%rsi,4), %r11d
movl $0x1, %r14d
movl %edx, %ecx
shll %cl, %r14d
btl %edx, %r11d
jae 0x6bfa
movq 0x10(%r12), %rcx
movq (%rcx,%rdx,8), %r10
notl %r14d
andl %r14d, %r11d
movl %r11d, (%r9,%rsi,4)
movl %r10d, %ecx
shll $0xf, %ecx
notl %ecx
addl %r10d, %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, %r11d
shrl $0x5, %r11d
movl (%r13,%r11,4), %r15d
movl $0x1, %r14d
movl %esi, %ecx
shll %cl, %r14d
btl %esi, %r15d
jae 0x6bb9
incl %esi
andl %edi, %esi
jmp 0x6b96
orl %r14d, %r15d
movl %r15d, (%r13,%r11,4)
cmpl %r8d, %esi
jae 0x6bef
movq 0x10(%r12), %rcx
testl %r14d, (%r9,%r11,4)
je 0x6bf4
movl %esi, %esi
movq (%rcx,%rsi,8), %r15
movq %r10, (%rcx,%rsi,8)
notl %r14d
movq 0x8(%r12), %r9
andl %r14d, (%r9,%r11,4)
movq %r15, %r10
jmp 0x6b60
movq 0x10(%r12), %rcx
movl %esi, %esi
movq %r10, (%rcx,%rsi,8)
incq %rdx
cmpq %r8, %rdx
jne 0x6b2a
movq 0x8(%rsp), %rax
cmpl %eax, %r8d
jbe 0x6c2a
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdi
movl %eax, %edx
shlq $0x3, %rdx
callq 0x18d19
movq %rax, 0x10(%r12)
movq 0x8(%r12), %rsi
movq 0x18(%r12), %rdi
callq 0x18b4b
movq 0x8(%rsp), %r11
movq %r13, 0x8(%r12)
movl 0x1c(%rsp), %ecx
movl %ecx, (%r12)
movq 0x10(%rsp), %r13
movq 0x20(%rsp), %r14
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
jmp 0x69c0
movq 0x18(%r12), %rdi
movq %r13, %rsi
callq 0x18b4b
movq 0x10(%rsp), %r13
movq 0x20(%rsp), %r14
movl $0x3fffffff, %r10d      # imm = 0x3FFFFFFF
movq 0x10(%r12), %rax
movl %r15d, %ecx
movq 0x40(%rsp), %rdx
movl %edx, 0x4(%rax,%rcx,8)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %r15
leaq (%r14,%r14,2), %rax
movq 0x50(%rsp), %rcx
movq 0x10(%r15,%rcx,8), %rcx
movq %rcx, 0x10(%r15,%rax,8)
movq 0x70(%rsp), %rbp
movq (%rbp), %rax
cmpq 0x8(%rbp), %rax
jne 0x6d24
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, %rcx
movq %rax, 0x10(%rbp)
movq (%rbp), %rax
jmp 0x6d28
movq 0x10(%rbp), %rcx
movq 0x50(%rsp), %rdx
leaq (%r15,%rdx,8), %rdx
addq $0x10, %rdx
leaq 0x1(%rax), %rsi
movq %rsi, (%rbp)
leaq (%rax,%rax,4), %rsi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rcx,%rsi,8)
movupd %xmm0, (%rcx,%rsi,8)
movq $0x0, 0x20(%rcx,%rsi,8)
movl (%rdx), %eax
movq %rax, 0x18(%rcx,%rsi,8)
movq 0x10(%rbp), %rax
movq 0xa0(%rsp), %rdx
movl 0x20(%rax,%rdx,8), %eax
andl %r10d, %eax
xorl %edx, %edx
divl %r13d
movl %eax, 0x20(%rcx,%rsi,8)
movq 0x38(%rsp), %r12
testq %r12, %r12
je 0x6de7
movq 0x78(%rsp), %rax
leal (%rax,%rax), %r14d
xorl %r15d, %r15d
movq 0x28(%rbp), %rax
movq (%rbx,%r15,8), %rcx
leaq (%rcx,%rcx,2), %rdx
shlq $0x4, %rdx
movq (%rax,%rdx), %rsi
movq 0x8(%rax,%rdx), %r9
andl $0x1, %esi
orq %r14, %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 %r13d
shrl $0x1f, %edi
movl %edi, (%rsp)
movq %rbp, %rdi
movq %r9, %rdx
movl %eax, %r9d
callq 0x1114b
incq %r15
cmpq %r15, %r12
jne 0x6d92
movq %rbx, 0x8(%rsp)
cmpq $-0x1, 0x68(%rsp)
sete %al
cmpq $0x0, 0xa8(%rsp)
sete %cl
orb %al, %cl
movl $0x0, %esi
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq %rbp, %rbx
movq %r13, %rbp
movq 0x78(%rsp), %r12
jne 0x6ead
movq 0x68(%rsp), %rax
leaq (%rax,%rax,2), %r13
shlq $0x4, %r13
addq 0x28(%rbx), %r13
addl %r12d, %r12d
movq 0x20(%rsp), %rax
addq %rax, %rax
movq %rax, 0x20(%rsp)
movq 0x60(%rsp), %r14
movq 0x20(%rsp), %rax
leaq (%rax,%r14), %r15
movq 0x10(%r13), %rcx
movq 0x18(%r13), %r8
movl 0x20(%r13), %eax
andl %edx, %eax
xorl %edx, %edx
divl %ebp
movl %esi, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %eax, %r9d
callq 0x1114b
movq 0x10(%r13), %rcx
movq 0x18(%r13), %r8
movl 0x20(%r13), %eax
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl %edx, %eax
xorl %edx, %edx
divl %ebp
xorl %edx, %edx
movl %edx, (%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movl %eax, %r9d
callq 0x1114b
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
xorl %esi, %esi
addq $0x2, %r14
jne 0x6e44
addq $-0x2, 0x60(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, %r13
cmpq %rbp, %rax
movq 0x80(%rsp), %r12
movq %rbx, %rbp
movq 0x8(%rsp), %rbx
jne 0x6852
movq %rbx, %rdi
callq 0x3060
movq %rbp, %rdi
xorl %esi, %esi
callq 0x121d6
movq 0x98(%rsp), %r14
movq 0x90(%rsp), %r15
movq 0x88(%rsp), %r13
movq %rbp, %rdi
movq 0x40(%rsp), %rbp
jmp 0x6f1c
cmpl $0x0, 0x5c(%rsp)
je 0x6f24
movq %r13, %rdi
cmpl $0x0, 0x10(%rsp)
jne 0x6f24
movq %rbp, %rsi
callq 0x6f45
incq %rbp
cmpq %r15, %rbp
jne 0x66f3
movq %r12, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq