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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rbp
movaps %xmm0, 0x40(%rbp)
movaps %xmm0, 0x30(%rbp)
movaps %xmm0, 0x20(%rbp)
movaps %xmm0, 0x10(%rbp)
movaps %xmm0, (%rbp)
leaq 0x14(%rsp), %r14
andl $0x0, (%r14)
leaq 0x12(%rsp), %rax
andw $0x0, (%rax)
leaq 0xc(%rsp), %r15
andl $0x0, (%r15)
leaq 0x51f3(%rip), %rsi      # 0x1c372
callq 0x8820
movq %rax, %r12
pushq $0x50
popq %rsi
pushq $0x1
popq %r13
movq %rbp, %rdi
movq %r13, %rdx
movq %rax, %rcx
callq 0x8850
pushq $0x4
popq %rbp
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
movslq (%r14), %rax
movl %eax, (%rbx)
imulq $0x60, %rax, %rdi
callq 0x870a
movq %rax, 0x230(%rbx)
xorl %r14d, %r14d
xorl %ecx, %ecx
movl 0x14(%rsp), %eax
cmpq %rax, %rcx
jae 0x173bb
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %rcx, 0x18(%rsp)
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, (%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x8(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x10(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x18(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x20(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x28(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x30(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x38(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x40(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x48(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x50(%rax,%r14)
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
cvtss2sd 0xc(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x58(%rax,%r14)
leaq 0x12(%rsp), %rdi
pushq $0x2
popq %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x8850
movq 0x18(%rsp), %rcx
incq %rcx
addq $0x60, %r14
jmp 0x171ca
movq %r12, %rdi
callq 0x2080
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq