// File: /workspace/github_c_makefile_star2_O1/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 0x153ff
movq (%rbx), %r12
leaq (,%r12,8), %r15
movq %r15, %rdi
callq 0x2320
movq %rax, %r14
movq %rax, %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x21e0
testq %r12, %r12
je 0x152f6
xorl %r15d, %r15d
movq %r12, %r13
movq 0x10(%rbx), %rdi
testb $0x40, 0x23(%rdi,%r15)
je 0x15295
addq %r15, %rdi
callq 0x14fbd
addq $0x28, %r15
decq %r13
jne 0x15281
movl $0x4, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x10(%rbx), %rsi
testb $0x40, 0x3(%rsi,%rax,8)
jne 0x152e7
cmpq %rcx, %rdx
jae 0x152de
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 0x152ea
decq (%rbx)
incq %rcx
addq $0x5, %rax
cmpq %rcx, %r12
jne 0x152a7
movq (%rbx), %rax
movq 0x10(%rbx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
callq 0x2360
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq 0x18(%rbx), %rax
movq %rcx, 0x8(%rbx)
testq %rax, %rax
je 0x15392
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movq 0x28(%rbx), %rdi
testb $0x40, 0x23(%rdi,%rcx)
jne 0x15382
leaq (%rdi,%rcx), %r8
movq (%r8), %r9
andq $-0x2, %r9
cmpq $-0x1, (%r14,%r9,4)
je 0x15382
movq 0x8(%rdi,%rcx), %r9
andq $-0x2, %r9
cmpq $-0x1, (%r14,%r9,4)
je 0x15382
cmpq %rdx, %rsi
jae 0x1537d
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 0x15386
decq 0x18(%rbx)
incq %rdx
addq $0x30, %rcx
cmpq %rdx, %rax
jne 0x15324
movq 0x18(%rbx), %rax
movq 0x28(%rbx), %rdi
shlq $0x4, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2360
movq %rax, 0x28(%rbx)
movq 0x18(%rbx), %rcx
movq %rcx, 0x20(%rbx)
testq %rcx, %rcx
je 0x153f7
addq $0x8, %rax
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 0x153bc
movq %r14, %rdi
callq 0x2060
movq 0x18(%rbx), %rsi
movq 0x28(%rbx), %rdi
leaq -0x3d1(%rip), %rcx      # 0x1503d
movl $0x30, %edx
callq 0x20d0
movq %rbx, %rdi
callq 0x1505c
movq 0x18(%rbx), %r9
testq %r9, %r9
je 0x15615
xorl %r8d, %r8d
movl $0x80000000, %r10d      # imm = 0x80000000
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
movq 0x28(%rbx), %rdi
leaq (,%r13,2), %rax
addq %r13, %rax
shlq $0x4, %rax
movl 0x20(%rdi,%rax), %r12d
btl $0x1e, %r12d
jb 0x155e3
addq %rdi, %rax
movq (%rax), %rbp
movq 0x8(%rax), %r15
xorq $0x1, %r15
xorq $0x1, %rbp
movq 0x38(%rbx), %rcx
movq (%rcx,%r15,8), %rdx
testq %rdx, %rdx
je 0x154a9
movq 0x30(%rbx), %rcx
movq (%rcx,%r15,8), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addq %rdi, %rcx
cmpq %rbp, 0x8(%rcx)
jne 0x154a0
testb $0x40, 0x23(%rcx)
je 0x154ab
addq $0x30, %rcx
decq %rdx
jne 0x15494
xorl %ecx, %ecx
testq %rcx, %rcx
je 0x154fd
andl %r10d, %r12d
movl 0x20(%rcx), %edx
andl %r11d, %edx
orl %r12d, %edx
xorl %r10d, %edx
movl %edx, 0x20(%rcx)
movq 0x10(%rax), %rsi
movq 0x10(%rcx), %rdx
cmpq %rdx, %rsi
je 0x154db
cmovbq %rsi, %rdx
movq %rdx, 0x10(%rcx)
movq %rdx, 0x10(%rax)
movq 0x18(%rax), %rsi
movq 0x18(%rcx), %rdx
cmpq %rdx, %rsi
je 0x155e3
cmovbq %rsi, %rdx
movq %rdx, 0x18(%rcx)
movq %rdx, 0x18(%rax)
jmp 0x155e3
movq 0x10(%rax), %rsi
movq 0x18(%rax), %r14
movq 0x28(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rbx), %rax
cmpq %rax, 0x18(%rbx)
jne 0x1559f
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, 0x20(%rbx)
shlq $0x4, %rax
movq %rsi, 0x10(%rsp)
leaq (%rax,%rax,2), %rsi
movq %r8, 0x18(%rsp)
movq %r14, 0x8(%rsp)
movq %r9, %r14
callq 0x2360
movq 0x10(%rsp), %rsi
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
movl $0x80000000, %r10d      # imm = 0x80000000
movq %r14, %r9
movq 0x8(%rsp), %r14
movq 0x18(%rsp), %r8
movq %rax, 0x28(%rbx)
movq 0x18(%rbx), %rax
movq 0x28(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%rbx)
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
movq %r15, (%rcx,%rax)
movq %rbp, 0x8(%rcx,%rax)
movq %rsi, 0x10(%rcx,%rax)
movq %r14, 0x18(%rcx,%rax)
movq 0x20(%rsp), %rdx
movq %rdx, 0x28(%rcx,%rax)
addl $0x80000000, %r12d      # imm = 0x80000000
movl %r12d, 0x20(%rcx,%rax)
incl %r8d
incq %r13
cmpq %r9, %r13
jne 0x1543f
testl %r8d, %r8d
je 0x15615
movq 0x18(%rbx), %rsi
movq 0x28(%rbx), %rdi
leaq -0x5c6(%rip), %rcx      # 0x1503d
movl $0x30, %edx
callq 0x20d0
movq %rbx, %rdi
callq 0x1505c
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15131