// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/stl.c
// Function: WriteStlFile
void WriteStlFile(const char *fname, const Polyhedron *poly)
{
    StlStr header = "binary stl";
    StlLint facetN = 0;
    StlInt attribute = 0;
    StlReal facetData = 0.0;
    FILE *fp = Fopen(fname, "wb");
    fwrite(header, sizeof(StlStr), 1, fp);
    facetN = poly->faceN;
    fwrite(&facetN, sizeof(StlLint), 1, fp);
    for (StlLint n = 0; n < facetN; ++n) {
        facetData = poly->facet[n].N[X];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].N[Y];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].N[Z];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v0[X];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v0[Y];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v0[Z];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v1[X];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v1[Y];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v1[Z];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v2[X];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v2[Y];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        facetData = poly->facet[n].v2[Z];
        fwrite(&facetData, sizeof(StlReal), 1, fp);
        fwrite(&attribute, sizeof(StlInt), 1, fp);
    }
    fclose(fp);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
leaq 0x7dd2(%rip), %rsi      # 0x2ae10
movl $0x50, %edx
callq 0x2150
movl $0x0, -0x64(%rbp)
movw $0x0, -0x66(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5e01(%rip), %rsi      # 0x28e69
callq 0xbf90
movq %rax, -0x78(%rbp)
leaq -0x60(%rbp), %rdi
movq -0x78(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x64(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jae 0x23397
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x10(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x30(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x38(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x40(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x48(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x50(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x10(%rbp), %rax
movq 0x230(%rax), %rax
movl -0x7c(%rbp), %ecx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movsd 0x58(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movq -0x78(%rbp), %rcx
leaq -0x6c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x78(%rbp), %rcx
leaq -0x66(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x21f0
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x230af
movq -0x78(%rbp), %rdi
callq 0x2080
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)