// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/computational_geometry.c
// Function: ConvertPolyhedron
void ConvertPolyhedron(Polyhedron *poly)
{
    /* allocate memory, assume over-estimated vertex and edge */
    AllocatePolyhedronMemory(POLYN * poly->faceN, POLYN * poly->faceN, poly->faceN, poly);
    /* convert representation */
    for (int n = 0; n < poly->faceN; ++n) {
        poly->f[n][0] = AddVertex(poly->facet[n].v0, poly);
        poly->f[n][1] = AddVertex(poly->facet[n].v1, poly);
        poly->f[n][2] = AddVertex(poly->facet[n].v2, poly);
        AddEdge(poly->f[n][0], poly->f[n][1], n, poly);
        AddEdge(poly->f[n][1], poly->f[n][2], n, poly);
        AddEdge(poly->f[n][2], poly->f[n][0], n, poly);
    }
    QuickSortEdge(poly->edgeN, poly->e);
    /* adjust the memory allocation */
    RetrieveStorage(poly->facet);
    poly->facet = NULL;
    poly->e = realloc(poly->e, poly->edgeN * sizeof(*poly->e));
    poly->Ne = realloc(poly->Ne, poly->edgeN * sizeof(*poly->Ne));
    poly->v = realloc(poly->v, poly->vertN * sizeof(*poly->v));
    poly->Nv = realloc(poly->Nv, poly->vertN * sizeof(*poly->Nv));
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
imull $0x3, (%rax), %edi
movq -0x8(%rbp), %rax
imull $0x3, (%rax), %esi
movq -0x8(%rbp), %rax
movl (%rax), %edx
movq -0x8(%rbp), %rcx
callq 0xc5d0
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xc4de
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x18, %rdi
movq -0x8(%rbp), %rsi
callq 0xc690
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x30, %rdi
movq -0x8(%rbp), %rsi
callq 0xc690
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rdi
movslq -0xc(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
addq $0x48, %rdi
movq -0x8(%rbp), %rsi
callq 0xc690
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rdx
imulq $0xc, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edi
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %esi
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0xc7e0
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edi
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0xc7e0
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
movq -0x8(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rcx
callq 0xc7e0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xc350
movq -0x8(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x8(%rbp), %rax
movq 0x210(%rax), %rsi
callq 0xc910
movq -0x8(%rbp), %rax
movq 0x230(%rax), %rdi
callq 0xbe20
movq -0x8(%rbp), %rax
movq $0x0, 0x230(%rax)
movq -0x8(%rbp), %rax
movq 0x210(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x4(%rax), %rsi
shlq $0x4, %rsi
callq 0x2190
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x210(%rax)
movq -0x8(%rbp), %rax
movq 0x218(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x4(%rax), %rax
imulq $0x18, %rax, %rsi
callq 0x2190
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x218(%rax)
movq -0x8(%rbp), %rax
movq 0x220(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x8(%rax), %rax
imulq $0x18, %rax, %rsi
callq 0x2190
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x220(%rax)
movq -0x8(%rbp), %rax
movq 0x228(%rax), %rdi
movq -0x8(%rbp), %rax
movslq 0x8(%rax), %rax
imulq $0x18, %rax, %rsi
callq 0x2190
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x228(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)