// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/ensight_reader.c
// Function: ReadPolygonPolyData
static void ReadPolygonPolyData(const int pm, const int pn, Geometry *const geo, EnSet *enSet)
{
    snprintf(enSet->fname, sizeof(EnStr), "%s.geo", enSet->bname);
    FILE *fp = Fopen(enSet->fname, "rb");
    EnReal data = 0.0; /* the Ensight data format */
    Polyhedron *poly = NULL;
    int ne = 0; /* total number of nodes in a part */
    Fread(enSet->str, sizeof(EnStr), 1, fp);
    Fread(enSet->str, sizeof(EnStr), 1, fp);
    Fread(enSet->str, sizeof(EnStr), 1, fp);
    Fread(enSet->str, sizeof(EnStr), 1, fp);
    Fread(enSet->str, sizeof(EnStr), 1, fp);
    for (int p = enSet->part[MIN], pnum = 1; p < enSet->part[MAX]; ++p, ++pnum) {
        poly = geo->poly + p;
        Fread(enSet->str, sizeof(EnStr), 1, fp);
        Fread(&pnum, sizeof(int), 1, fp);
        Fread(enSet->str, sizeof(EnStr), 1, fp);
        Sscanf(enSet->str, 3, "%d %d %d", &(poly->vertN), &(poly->edgeN), &(poly->faceN));
        Fread(enSet->str, sizeof(EnStr), 1, fp);
        Fread(&ne, sizeof(int), 1, fp);
        AllocatePolyhedronMemory(poly->vertN, poly->edgeN, poly->faceN, poly);
        poly->edgeN = 0; /* reset edge count before applying edge adding */
        for (int s = 0; s < DIMS; ++s) {
            for (int n = 0; n < poly->vertN; ++n) {
                Fread(&data, sizeof(EnReal), 1, fp);
                poly->v[n][s] = data;
            }
        }
        Fread(enSet->str, sizeof(EnStr), 1, fp);
        Fread(&ne, sizeof(int), 1, fp);
        for (int n = 0, m = 0; n < poly->faceN; ++n) {
            for (int s = 0; s < POLYN; ++s) {
                Fread(&m, sizeof(int), 1, fp);
                poly->f[n][s] = m - 1;
            }
            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);
    }
    ReadPolyState(pm, pn, geo, enSet);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
movq -0x18(%rbp), %rcx
addq $0x50, %rcx
movl $0x50, %esi
leaq 0x12e71(%rip), %rdx     # 0x28536
movb $0x0, %al
callq 0x20b0
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
leaq 0x12e4c(%rip), %rsi     # 0x2852a
callq 0xbf90
movq %rax, -0x20(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x18(%rbp), %rax
movl 0x280(%rax), %eax
movl %eax, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
movl -0x38(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x284(%rcx), %eax
jge 0x15ac6
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x38(%rbp), %rcx
imulq $0x238, %rcx, %rcx      # imm = 0x238
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x20(%rbp), %rcx
leaq -0x3c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x30(%rbp), %rcx
addq $0x8, %rcx
movq -0x30(%rbp), %r8
addq $0x4, %r8
movq -0x30(%rbp), %r9
movl $0x3, %esi
leaq 0x12cea(%rip), %rdx     # 0x2853d
movb $0x0, %al
callq 0xc110
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x20(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x30(%rbp), %rax
movl 0x4(%rax), %esi
movq -0x30(%rbp), %rax
movl (%rax), %edx
movq -0x30(%rbp), %rcx
callq 0xc5d0
movq -0x30(%rbp), %rax
movl $0x0, 0x4(%rax)
movl $0x0, -0x40(%rbp)
cmpl $0x3, -0x40(%rbp)
jge 0x1592e
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x15921
movq -0x20(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xbfe0
movss -0x24(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x30(%rbp), %rax
movq 0x220(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x158cb
jmp 0x15923
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x158be
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0xbfe0
movq -0x20(%rbp), %rcx
leaq -0x34(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xbfe0
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x15a98
movl $0x0, -0x50(%rbp)
cmpl $0x3, -0x50(%rbp)
jge 0x159d2
movq -0x20(%rbp), %rcx
leaq -0x4c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xbfe0
movl -0x4c(%rbp), %edx
subl $0x1, %edx
movq -0x30(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x50(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x15987
movq -0x30(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edi
movq -0x30(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %esi
movl -0x48(%rbp), %edx
movq -0x30(%rbp), %rcx
callq 0xc7e0
movq -0x30(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %edi
movq -0x30(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
movl -0x48(%rbp), %edx
movq -0x30(%rbp), %rcx
callq 0xc7e0
movq -0x30(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
movq -0x30(%rbp), %rax
movq 0x200(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
movl -0x48(%rbp), %edx
movq -0x30(%rbp), %rcx
callq 0xc7e0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x15971
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edi
movq -0x30(%rbp), %rax
movq 0x210(%rax), %rsi
callq 0xc910
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x157a8
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x15610
addq $0x50, %rsp
popq %rbp
retq
nop