// File: /workspace/github_c_makefile_star2_O1/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 $0x68, %rsp
movq %rsi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r12
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
xorl %ebp, %ebp
leaq 0xc(%rsp), %r15
movl %ebp, (%r15)
movw $0x0, 0xa(%rsp)
movl %ebp, 0x4(%rsp)
leaq 0x5a54(%rip), %rsi      # 0x1e402
callq 0x9269
movq %rax, %r14
movl $0x50, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rax, %rcx
callq 0x9299
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
movslq (%r15), %rax
movl %eax, (%rbx)
shlq $0x5, %rax
leaq (%rax,%rax,2), %rdi
callq 0x911c
movq %rax, 0x230(%rbx)
cmpl %ebp, (%r15)
je 0x18c49
xorl %r13d, %r13d
leaq 0x4(%rsp), %r15
leaq 0xa(%rsp), %r12
xorl %ebp, %ebp
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, (%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x8(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x10(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x18(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x20(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x28(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x30(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x38(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x40(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x48(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x50(%rax,%r13)
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x9299
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq 0x230(%rbx), %rax
movsd %xmm0, 0x58(%rax,%r13)
movl $0x2, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x9299
incq %rbp
movl 0xc(%rsp), %eax
addq $0x60, %r13
cmpq %rax, %rbp
jb 0x18a11
movq %r14, %rdi
callq 0x2080
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq