// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]oatk/graph.c
// Function: asmg_finalize
void asmg_finalize(asmg_t *g, int do_cleanup) 
{
    // TODO fix multi-arc
    uint32_t symm_fix;
    if (do_cleanup) asmg_cleanup(g);
    asmg_arc_sort(g);
    asmg_arc_index(g);
    symm_fix = asmg_arc_fix_symm(g);
    if (symm_fix > 0) {
        asmg_arc_sort(g);
        asmg_arc_index(g);
    }
    asmg_shrink_link_id(g);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
testl %esi, %esi
je 0x15dd6
movq (%rbx), %r12
leaq (,%r12,8), %r15
movq %r15, %rdi
callq 0x2310
movq %rax, %r14
movq %rax, %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x21e0
testq %r12, %r12
je 0x15de3
xorl %r15d, %r15d
movq %r12, %r13
movq 0x10(%rbx), %rdi
testb $0x40, 0x23(%rdi,%r15)
je 0x15d68
addq %r15, %rdi
callq 0x15a91
addq $0x28, %r15
decq %r13
jne 0x15d54
movl $0x4, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x10(%rbx), %rsi
testb $0x40, 0x3(%rsi,%rax,8)
jne 0x15dba
cmpq %rcx, %rdx
jae 0x15db1
leaq (%rsi,%rax,8), %rdi
addq $-0x20, %rdi
leaq (%rdx,%rdx,4), %r8
movq 0x20(%rdi), %r9
movq %r9, 0x20(%rsi,%r8,8)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups %xmm1, 0x10(%rsi,%r8,8)
movups %xmm0, (%rsi,%r8,8)
movq %rdx, (%r14,%rcx,8)
incq %rdx
jmp 0x15dbd
decq (%rbx)
incq %rcx
addq $0x5, %rax
cmpq %rcx, %r12
jne 0x15d7a
movq (%rbx), %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
jmp 0x15de5
movq 0x18(%rbx), %r15
movq 0x28(%rbx), %r12
jmp 0x15ef2
xorl %esi, %esi
movq 0x10(%rbx), %rdi
callq 0x2350
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq 0x18(%rbx), %rax
movq %rcx, 0x8(%rbx)
testq %rax, %rax
je 0x15e88
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movq 0x28(%rbx), %rdi
testb $0x40, 0x23(%rdi,%rcx)
jne 0x15e6a
leaq (%rdi,%rcx), %r8
movq (%r8), %r9
andq $-0x2, %r9
cmpq $-0x1, (%r14,%r9,4)
je 0x15e6a
movq 0x8(%rdi,%rcx), %r9
andq $-0x2, %r9
cmpq $-0x1, (%r14,%r9,4)
je 0x15e6a
cmpq %rdx, %rsi
jae 0x15e65
leaq (%rsi,%rsi,2), %r9
shlq $0x4, %r9
movups (%r8), %xmm0
movups 0x10(%r8), %xmm1
movups 0x20(%r8), %xmm2
movups %xmm2, 0x20(%rdi,%r9)
movups %xmm1, 0x10(%rdi,%r9)
movups %xmm0, (%rdi,%r9)
incq %rsi
jmp 0x15e6e
decq 0x18(%rbx)
incq %rdx
addq $0x30, %rcx
cmpq %rdx, %rax
jne 0x15e0c
movq 0x18(%rbx), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rsi
jmp 0x15e8a
xorl %esi, %esi
movq 0x28(%rbx), %rdi
callq 0x2350
movq %rax, %r12
movq %rax, 0x28(%rbx)
movq 0x18(%rbx), %r15
movq %r15, 0x20(%rbx)
testq %r15, %r15
je 0x15eea
leaq 0x8(%r12), %rax
movq %r15, %rcx
movq -0x8(%rax), %rdx
movq (%rax), %rsi
movq %rdx, %rdi
andq $-0x2, %rdi
movq (%r14,%rdi,4), %rdi
andl $0x1, %edx
leaq (%rdx,%rdi,2), %rdx
movq %rdx, -0x8(%rax)
movq %rsi, %rdx
andq $-0x2, %rdx
movq (%r14,%rdx,4), %rdx
andl $0x1, %esi
leaq (%rsi,%rdx,2), %rdx
movq %rdx, (%rax)
addq $0x30, %rax
decq %rcx
jne 0x15eaf
movq %r14, %rdi
callq 0x2060
leaq -0x3e8(%rip), %rcx      # 0x15b11
movl $0x30, %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x20d0
movq %rbx, %rdi
callq 0x15b30
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x160ce
xorl %r9d, %r9d
xorl %r12d, %r12d
movq %rbx, (%rsp)
movq 0x28(%rbx), %rax
leaq (%r12,%r12,2), %rcx
shlq $0x4, %rcx
movl 0x20(%rax,%rcx), %r13d
btl $0x1e, %r13d
jb 0x16051
addq %rax, %rcx
movq (%rcx), %rbp
movq 0x8(%rcx), %r15
xorq $0x1, %r15
xorq $0x1, %rbp
movq 0x38(%rbx), %rdx
movq (%rdx,%r15,8), %rsi
testq %rsi, %rsi
je 0x15f95
movq 0x30(%rbx), %rdx
movq (%rdx,%r15,8), %rdx
leaq (%rdx,%rdx,2), %rdx
shlq $0x4, %rdx
addq %rax, %rdx
addq $0x20, %rdx
cmpq %rbp, -0x18(%rdx)
jne 0x15f8c
movl (%rdx), %edi
btl $0x1e, %edi
jae 0x1605f
addq $0x30, %rdx
decq %rsi
jne 0x15f7a
movups 0x10(%rcx), %xmm0
movq 0x28(%rcx), %rsi
movq 0x18(%rbx), %rcx
cmpq 0x20(%rbx), %rcx
jne 0x1601f
movq %rcx, %rdx
shrq %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x2, %rcx
orq %rdx, %rcx
movq %rcx, %rdx
shrq $0x4, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x8, %rcx
orq %rdx, %rcx
movq %rcx, %rdx
shrq $0x10, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x20, %rcx
orq %rdx, %rcx
incq %rcx
movq %rcx, 0x20(%rbx)
shlq $0x4, %rcx
movq %rsi, 0x8(%rsp)
leaq (%rcx,%rcx,2), %rsi
movq %rax, %rdi
movq %r9, %rbx
movaps %xmm0, 0x10(%rsp)
callq 0x2350
movq 0x8(%rsp), %rsi
movaps 0x10(%rsp), %xmm0
movq %rbx, %r9
movq (%rsp), %rbx
movq %rax, 0x28(%rbx)
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbx)
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq %r15, (%rax,%rcx)
movq %rbp, 0x8(%rax,%rcx)
movups %xmm0, 0x10(%rax,%rcx)
movq %rsi, 0x28(%rax,%rcx)
addl $0x80000000, %r13d      # imm = 0x80000000
movl %r13d, 0x20(%rax,%rcx)
incl %r9d
incq %r12
cmpq %r14, %r12
jne 0x15f28
jmp 0x160a8
movl $0x80000000, %eax       # imm = 0x80000000
andl %eax, %r13d
andl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
orl %r13d, %edi
xorl %eax, %edi
movl %edi, (%rdx)
movq 0x10(%rcx), %rsi
movq -0x10(%rdx), %rax
cmpq %rax, %rsi
je 0x1608d
cmovbq %rsi, %rax
movq %rax, -0x10(%rdx)
movq %rax, 0x10(%rcx)
movq 0x18(%rcx), %rsi
movq -0x8(%rdx), %rax
cmpq %rax, %rsi
je 0x16051
cmovbq %rsi, %rax
movq %rax, -0x8(%rdx)
movq %rax, 0x18(%rcx)
jmp 0x16051
testl %r9d, %r9d
je 0x160ce
movq 0x18(%rbx), %rsi
movq 0x28(%rbx), %rdi
leaq -0x5ab(%rip), %rcx      # 0x15b11
movl $0x30, %edx
callq 0x20d0
movq %rbx, %rdi
callq 0x15b30
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15c00