// File: /workspace/github_c_makefile_star2_O2/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
testl %esi, %esi
movq %rdi, (%rsp)
je 0x122f9
movq (%rdi), %r12
leaq (,%r12,8), %r15
movq %r15, %rdi
callq 0x2310
movq %rax, %r14
movq %rax, %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x21e0
xorl %ebx, %ebx
movq %r12, %r15
subq $0x1, %r15
jb 0x121a7
movq (%rsp), %rax
movq 0x10(%rax), %rdi
testb $0x40, 0x23(%rdi,%rbx)
je 0x121a1
addq %rbx, %rdi
callq 0x11eb1
addq $0x28, %rbx
jmp 0x12184
pushq $0x4
popq %rax
xorl %ecx, %ecx
xorl %edx, %edx
movq (%rsp), %r10
movq 0x10(%r10), %rdi
cmpq %rdx, %r12
je 0x12203
testb $0x40, 0x3(%rdi,%rax,8)
jne 0x121f7
cmpq %rdx, %rcx
jae 0x121ee
leaq (%rdi,%rax,8), %rsi
addq $-0x20, %rsi
imulq $0x28, %rcx, %r8
movq 0x20(%rsi), %r9
movq %r9, 0x20(%rdi,%r8)
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups %xmm1, 0x10(%rdi,%r8)
movups %xmm0, (%rdi,%r8)
movq %rcx, (%r14,%rdx,8)
incq %rcx
jmp 0x121fa
decq (%r10)
incq %rdx
addq $0x5, %rax
jmp 0x121b2
imulq $0x28, (%r10), %rsi
callq 0x2350
movq (%rsp), %r10
movq %rax, 0x10(%r10)
movq (%r10), %rcx
movq 0x18(%r10), %rax
movq %rcx, 0x8(%r10)
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movq 0x28(%r10), %rdi
cmpq %rsi, %rax
je 0x12291
testb $0x40, 0x23(%rdi,%rcx)
jne 0x12284
leaq (%rdi,%rcx), %r8
movq (%r8), %r9
andq $-0x2, %r9
cmpq $-0x1, (%r14,%r9,4)
je 0x12284
movq 0x8(%rdi,%rcx), %r9
andq $-0x2, %r9
cmpq $-0x1, (%r14,%r9,4)
je 0x12284
cmpq %rsi, %rdx
jae 0x1227f
imulq $0x30, %rdx, %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 %rdx
jmp 0x12288
decq 0x18(%r10)
incq %rsi
addq $0x30, %rcx
jmp 0x12225
imulq $0x30, 0x18(%r10), %rsi
callq 0x2350
movq (%rsp), %rdx
movq %rax, 0x28(%rdx)
movq 0x18(%rdx), %rcx
movq %rcx, 0x20(%rdx)
addq $0x8, %rax
subq $0x1, %rcx
jb 0x122ed
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
jmp 0x122af
movq %r14, %rdi
callq 0x2060
movq (%rsp), %rdi
callq 0x11f14
movq (%rsp), %rdi
callq 0x11f4a
movq (%rsp), %rdi
movq 0x18(%rdi), %r13
movl $0x0, 0xc(%rsp)
pushq $0x28
popq %rbp
subq $0x1, %r13
jb 0x12471
movq 0x28(%rdi), %r14
movl -0x8(%r14,%rbp), %ebx
btl $0x1e, %ebx
jb 0x12468
movq -0x28(%r14,%rbp), %r12
movq -0x20(%r14,%rbp), %r15
xorq $0x1, %r15
xorq $0x1, %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x12a8e
testq %rax, %rax
je 0x123b4
movl $0x80000000, %edx       # imm = 0x80000000
andl %edx, %ebx
movl 0x20(%rax), %ecx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %ecx
orl %ebx, %ecx
xorl %edx, %ecx
movl %ecx, 0x20(%rax)
movq -0x18(%r14,%rbp), %rdx
movq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x1238c
cmovbq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq %rcx, -0x18(%r14,%rbp)
movq -0x10(%r14,%rbp), %rdx
movq 0x18(%rax), %rcx
cmpq %rcx, %rdx
movq (%rsp), %rdi
je 0x12468
cmovbq %rdx, %rcx
movq %rcx, 0x18(%rax)
movq %rcx, -0x10(%r14,%rbp)
jmp 0x12468
movups -0x18(%r14,%rbp), %xmm0
movq (%r14,%rbp), %rdx
movq (%rsp), %rdi
movq 0x18(%rdi), %rax
cmpq 0x20(%rdi), %rax
jne 0x12439
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(%rdi)
imulq $0x30, %rax, %rsi
movq %r14, %rdi
movaps %xmm0, 0x10(%rsp)
movq %rdx, %r14
callq 0x2350
movq %r14, %rdx
movaps 0x10(%rsp), %xmm0
movq (%rsp), %rdi
movq %rax, %r14
movq %rax, 0x28(%rdi)
movq 0x18(%rdi), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%rdi)
imulq $0x30, %rax, %rax
movq %r15, (%r14,%rax)
movq %r12, 0x8(%r14,%rax)
movups %xmm0, 0x10(%r14,%rax)
movq %rdx, 0x28(%r14,%rax)
addl $0x80000000, %ebx       # imm = 0x80000000
movl %ebx, 0x20(%r14,%rax)
incl 0xc(%rsp)
addq $0x30, %rbp
jmp 0x1231a
cmpl $0x0, 0xc(%rsp)
je 0x1248a
callq 0x11f14
movq (%rsp), %rdi
callq 0x11f4a
movq (%rsp), %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12014