// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/ensight_writer.c
// Function: WritePolyVariable
static void WritePolyVariable(const int pm, const int pn, const Geometry *const geo, EnSet *enSet)
{
    FILE *fp = NULL;
    EnReal data = 0.0; /* the Ensight data format */
    for (int s = 0; s < enSet->scaN; ++s) {
        snprintf(enSet->fname, sizeof(EnStr), "%s.%s", enSet->bname, enSet->sca[s]);
        fp = Fopen(enSet->fname, "wb");
        /* first line description per file */
        strncpy(enSet->str, "scalar variable", sizeof(EnStr));
        fwrite(enSet->str, sizeof(EnStr), 1, fp);
        for (int p = enSet->part[MIN], pnum = 1; p < enSet->part[MAX]; ++p, ++pnum) {
            /* binary file format */
            strncpy(enSet->str, "part", sizeof(EnStr));
            fwrite(enSet->str, sizeof(EnStr), 1, fp);
            fwrite(&pnum, sizeof(int), 1, fp);
            strncpy(enSet->str, enSet->dtype, sizeof(EnStr));
            fwrite(enSet->str, sizeof(EnStr), 1, fp);
            /* now output the scalar value at each node in current part */
            for (int n = pm; n < pn; ++n) {
                switch (s) {
                    case 0:
                        data = geo->poly[n].r;
                        break;
                    case 1:
                        data = n + 1;
                        break;
                    default:
                        break;
                }
                fwrite(&data, sizeof(EnReal), 1, fp);
            }
        }
        fclose(fp);
    }
    for (int s = 0; s < enSet->vecN; ++s) {
        snprintf(enSet->fname, sizeof(EnStr), "%s.%s", enSet->bname, enSet->vec[s]);
        fp = Fopen(enSet->fname, "wb");
        /* binary file format */
        strncpy(enSet->str, "vector variable", sizeof(EnStr));
        fwrite(enSet->str, sizeof(EnStr), 1, fp);
        for (int p = enSet->part[MIN], pnum = 1; p < enSet->part[MAX]; ++p, ++pnum) {
            strncpy(enSet->str, "part", sizeof(EnStr));
            fwrite(enSet->str, sizeof(EnStr), 1, fp);
            fwrite(&pnum, sizeof(int), 1, fp);
            strncpy(enSet->str, enSet->dtype, sizeof(EnStr));
            fwrite(enSet->str, sizeof(EnStr), 1, fp);
            for (int n = 0; n < DIMS; ++n) {
                for (int m = pm; m < pn; ++m) {
                    data = geo->poly[m].V[TO][n];
                    fwrite(&data, sizeof(EnReal), 1, fp);
                }
            }
        }
        fclose(fp);
    }
    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 $0x0, -0x20(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x288(%rcx), %eax
jge 0x175c6
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
movq -0x18(%rbp), %rcx
addq $0x50, %rcx
movq -0x18(%rbp), %r8
addq $0x28c, %r8             # imm = 0x28C
movslq -0x28(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %r8
movl $0x50, %esi
leaq 0x1111f(%rip), %rdx     # 0x28524
movb $0x0, %al
callq 0x20b0
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
leaq 0x11a4b(%rip), %rsi     # 0x28e69
callq 0xbf90
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
leaq 0x11a8e(%rip), %rsi     # 0x28ec7
movl $0x50, %edx
callq 0x2040
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x18(%rbp), %rax
movl 0x280(%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x1, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x284(%rcx), %eax
jge 0x175af
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
leaq 0x11a20(%rip), %rsi     # 0x28eba
movl $0x50, %edx
callq 0x2040
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x20(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x18(%rbp), %rsi
addq $0x230, %rsi            # imm = 0x230
movl $0x50, %edx
callq 0x2040
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0x21f0
movl -0x4(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x17596
movl -0x28(%rbp), %eax
movl %eax, -0x4c(%rbp)
testl %eax, %eax
je 0x1753b
jmp 0x17531
movl -0x4c(%rbp), %eax
subl $0x1, %eax
je 0x17561
jmp 0x17572
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x34(%rbp), %rcx
imulq $0x238, %rcx, %rcx      # imm = 0x238
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
jmp 0x17574
movl -0x34(%rbp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x24(%rbp)
jmp 0x17574
jmp 0x17574
movq -0x20(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1751d
jmp 0x17598
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x17475
movq -0x20(%rbp), %rdi
callq 0x2080
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x173bd
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x2f0(%rcx), %eax
jge 0x177cd
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
movq -0x18(%rbp), %rcx
addq $0x50, %rcx
movq -0x18(%rbp), %r8
addq $0x2f4, %r8             # imm = 0x2F4
movslq -0x38(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %r8
movl $0x50, %esi
leaq 0x10f0f(%rip), %rdx     # 0x28524
movb $0x0, %al
callq 0x20b0
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
leaq 0x1183b(%rip), %rsi     # 0x28e69
callq 0xbf90
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
leaq 0x1188e(%rip), %rsi     # 0x28ed7
movl $0x50, %edx
callq 0x2040
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x18(%rbp), %rax
movl 0x280(%rax), %eax
movl %eax, -0x3c(%rbp)
movl $0x1, -0x40(%rbp)
movl -0x3c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x284(%rcx), %eax
jge 0x177b6
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
leaq 0x11810(%rip), %rsi     # 0x28eba
movl $0x50, %edx
callq 0x2040
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x20(%rbp), %rcx
leaq -0x40(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x18(%rbp), %rsi
addq $0x230, %rsi            # imm = 0x230
movl $0x50, %edx
callq 0x2040
movq -0x18(%rbp), %rdi
addq $0xf0, %rdi
movq -0x20(%rbp), %rcx
movl $0x50, %esi
movl $0x1, %edx
callq 0x21f0
movl $0x0, -0x44(%rbp)
cmpl $0x3, -0x44(%rbp)
jge 0x1779d
movl -0x4(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x17790
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x48(%rbp), %rcx
imulq $0x238, %rcx, %rcx      # imm = 0x238
addq %rcx, %rax
movslq -0x44(%rbp), %rcx
movsd 0x80(%rax,%rcx,8), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x24(%rbp)
movq -0x20(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x21f0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1773a
jmp 0x17792
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x1772e
jmp 0x1779f
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x17685
movq -0x20(%rbp), %rdi
callq 0x2080
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x175cd
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)