// File: /workspace/github_c_makefile_star2_O0/mohuangrui[P]ArtraCFD/paraview_writer.c
// Function: WriteStructuredData
static void WriteStructuredData(const Space *space, const Model *model, PvSet *pvSet)
{
    snprintf(pvSet->fname, sizeof(PvStr), "%s%s", pvSet->bname, pvSet->fext);
    FILE *fp = Fopen(pvSet->fname, "w");
    PvReal data = 0.0; /* paraview scalar data */
    PvReal Vec[3] = {0.0}; /* paraview vector data */
    const Partition *const part = &(space->part);
    const Node *const node = space->node;
    const Real *restrict U = NULL;
    int idx = 0; /* linear array index math variable */
    IntVec ne = {0}; /* i, j, k node number in each part */
    ne[X] = part->ns[PIO][X][MAX] - part->ns[PIO][X][MIN] - 1;
    ne[Y] = part->ns[PIO][Y][MAX] - part->ns[PIO][Y][MIN] - 1;
    ne[Z] = part->ns[PIO][Z][MAX] - part->ns[PIO][Z][MIN] - 1;
    fprintf(fp, "<?xml version=\"1.0\"?>\n");
    fprintf(fp, "<VTKFile type=\"StructuredGrid\" version=\"1.0\" byte_order=\"%s\">\n", pvSet->byteOrder);
    fprintf(fp, "  <StructuredGrid WholeExtent=\"%d %d %d %d %d %d\">\n", 0, ne[X], 0, ne[Y], 0, ne[Z]);
    fprintf(fp, "    <Piece Extent=\"%d %d %d %d %d %d\">\n", 0, ne[X], 0, ne[Y], 0, ne[Z]);
    fprintf(fp, "      <PointData>\n");
    for (int s = 0; s < pvSet->scaN; ++s) {
        fprintf(fp, "        <DataArray type=\"%s\" Name=\"%s\" format=\"ascii\">\n", pvSet->floatType, pvSet->sca[s]);
        fprintf(fp, "          ");
        for (int k = part->ns[PIO][Z][MIN]; k < part->ns[PIO][Z][MAX]; ++k) {
            for (int j = part->ns[PIO][Y][MIN]; j < part->ns[PIO][Y][MAX]; ++j) {
                for (int i = part->ns[PIO][X][MIN]; i < part->ns[PIO][X][MAX]; ++i) {
                    idx = IndexNode(k, j, i, part->n[Y], part->n[X]);
                    U = node[idx].U[TO];
                    switch (s) {
                        case 0: /* rho */
                            data = U[0];
                            break;
                        case 1: /* u */
                            data = U[1] / U[0];
                            break;
                        case 2: /* v */
                            data = U[2] / U[0];
                            break;
                        case 3: /* w */
                            data = U[3] / U[0];
                            break;
                        case 4: /* p */
                            data = ComputePressure(model->gamma, U);
                            break;
                        case 5: /* T */
                            data = ComputeTemperature(model->cv, U);
                            break;
                        case 6: /* node flag */
                            data = node[idx].did;
                            break;
                        case 7: /* face flag */
                            data = node[idx].fid;
                            break;
                        case 8: /* layer flag */
                            data = node[idx].lid;
                            break;
                        case 9: /* ghost flag */
                            data = node[idx].gst;
                            break;
                        default:
                            break;
                    }
                    fprintf(fp, "%.6g ", data);
                }
            }
        }
        fprintf(fp, "\n        </DataArray>\n");
    }
    for (int s = 0; s < pvSet->vecN; ++s) {
        fprintf(fp, "        <DataArray type=\"%s\" Name=\"%s\" NumberOfComponents=\"3\" format=\"ascii\">\n", pvSet->floatType, pvSet->vec[s]);
        fprintf(fp, "          ");
        for (int k = part->ns[PIO][Z][MIN]; k < part->ns[PIO][Z][MAX]; ++k) {
            for (int j = part->ns[PIO][Y][MIN]; j < part->ns[PIO][Y][MAX]; ++j) {
                for (int i = part->ns[PIO][X][MIN]; i < part->ns[PIO][X][MAX]; ++i) {
                    idx = IndexNode(k, j, i, part->n[Y], part->n[X]);
                    U = node[idx].U[TO];
                    Vec[X] = U[1] / U[0];
                    Vec[Y] = U[2] / U[0];
                    Vec[Z] = U[3] / U[0];
                    fprintf(fp, "%.6g %.6g %.6g ", Vec[X], Vec[Y], Vec[Z]);
                }
            }
        }
        fprintf(fp, "\n        </DataArray>\n");
    }
    fprintf(fp, "      </PointData>\n");
    fprintf(fp, "      <CellData>\n");
    fprintf(fp, "      </CellData>\n");
    fprintf(fp, "      <Points>\n");
    fprintf(fp, "        <DataArray type=\"%s\" Name=\"points\" NumberOfComponents=\"3\" format=\"ascii\">\n", pvSet->floatType);
    fprintf(fp, "          ");
    for (int k = part->ns[PIO][Z][MIN]; k < part->ns[PIO][Z][MAX]; ++k) {
        for (int j = part->ns[PIO][Y][MIN]; j < part->ns[PIO][Y][MAX]; ++j) {
            for (int i = part->ns[PIO][X][MIN]; i < part->ns[PIO][X][MAX]; ++i) {
                Vec[X] = MapPoint(i, part->domain[X][MIN], part->d[X], part->ng[X]);
                Vec[Y] = MapPoint(j, part->domain[Y][MIN], part->d[Y], part->ng[Y]);
                Vec[Z] = MapPoint(k, part->domain[Z][MIN], part->d[Z], part->ng[Z]);
                fprintf(fp, "%.6g %.6g %.6g ", Vec[X], Vec[Y], Vec[Z]);
            }
        }
    }
    fprintf(fp, "\n        </DataArray>\n");
    fprintf(fp, "      </Points>\n");
    fprintf(fp, "    </Piece>\n");
    fprintf(fp, "  </StructuredGrid>\n");
    fprintf(fp, "</VTKFile>\n");
    fclose(fp);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
movq -0x18(%rbp), %rcx
addq $0x50, %rcx
movq -0x18(%rbp), %r8
addq $0xf0, %r8
movl $0x50, %esi
leaq 0xbb53(%rip), %rdx      # 0x29ad4
movb $0x0, %al
callq 0x20b0
movq -0x18(%rbp), %rdi
addq $0xa0, %rdi
leaq 0x8ee2(%rip), %rsi      # 0x26e7c
callq 0xbf90
movq %rax, -0x20(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20d0
movq -0x8(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x20d0
movq -0x48(%rbp), %rax
movl 0x6c(%rax), %eax
movq -0x48(%rbp), %rcx
subl 0x68(%rcx), %eax
subl $0x1, %eax
movl %eax, -0x68(%rbp)
movq -0x48(%rbp), %rax
movl 0x74(%rax), %eax
movq -0x48(%rbp), %rcx
subl 0x70(%rcx), %eax
subl $0x1, %eax
movl %eax, -0x64(%rbp)
movq -0x48(%rbp), %rax
movl 0x7c(%rax), %eax
movq -0x48(%rbp), %rcx
subl 0x78(%rcx), %eax
subl $0x1, %eax
movl %eax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
leaq 0xc3e0(%rip), %rsi      # 0x2a418
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x230, %rdx            # imm = 0x230
leaq 0xc4b4(%rip), %rsi      # 0x2a509
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
movl -0x68(%rbp), %ecx
movl -0x64(%rbp), %r9d
movl -0x60(%rbp), %eax
leaq 0xc4d7(%rip), %rsi      # 0x2a548
xorl %r8d, %r8d
movl %r8d, %edx
movl $0x0, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
movl -0x68(%rbp), %ecx
movl -0x64(%rbp), %r9d
movl -0x60(%rbp), %eax
leaq 0xc4de(%rip), %rsi      # 0x2a57c
xorl %r8d, %r8d
movl %r8d, %edx
movl $0x0, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc4e3(%rip), %rsi      # 0x2a5a4
movb $0x0, %al
callq 0x2140
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x280(%rcx), %eax
jge 0x1e34e
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x1e0, %rdx            # imm = 0x1E0
movq -0x18(%rbp), %rcx
addq $0x284, %rcx            # imm = 0x284
movslq -0x6c(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %rcx
leaq 0xc4a9(%rip), %rsi      # 0x2a5b7
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc4cf(%rip), %rsi      # 0x2a5ef
movb $0x0, %al
callq 0x2140
movq -0x48(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x7c(%rcx), %eax
jge 0x1e32e
movq -0x48(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x74(%rcx), %eax
jge 0x1e31e
movq -0x48(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x1e30e
movl -0x70(%rbp), %edi
movl -0x74(%rbp), %esi
movl -0x78(%rbp), %edx
movq -0x48(%rbp), %rax
movl 0xc(%rax), %r8d
movl 0x10(%rax), %ecx
callq 0x9500
movl %eax, -0x5c(%rbp)
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rdx
movq %rdx, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rdx,8), %rcx
leaq 0x10(%rax,%rcx), %rax
movq %rax, -0x58(%rbp)
movl -0x6c(%rbp), %eax
movq %rax, -0xa0(%rbp)
subq $0x9, %rax
ja 0x1e2e7
movq -0xa0(%rbp), %rax
leaq 0xb939(%rip), %rcx      # 0x29b08
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x58(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x58(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x58(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x58(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x58(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x58(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x10(%rbp), %rax
movsd 0x40(%rax), %xmm0
movq -0x58(%rbp), %rdi
callq 0x9160
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x10(%rbp), %rax
movsd 0x50(%rax), %xmm0
movq -0x58(%rbp), %rdi
callq 0x9370
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cvtsi2sdl 0x4(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cvtsi2sdl 0x8(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
cvtsi2sdl 0xc(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x1e2e9
jmp 0x1e2e9
movq -0x20(%rbp), %rdi
movsd -0x28(%rbp), %xmm0
leaq 0xc371(%rip), %rsi      # 0x2a66a
movb $0x1, %al
callq 0x2140
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x1e165
jmp 0x1e310
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x1e14b
jmp 0x1e320
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x1e131
movq -0x20(%rbp), %rdi
leaq 0xc2c1(%rip), %rsi      # 0x2a5fa
movb $0x0, %al
callq 0x2140
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x1e0cf
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x2e8(%rcx), %eax
jge 0x1e504
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x1e0, %rdx            # imm = 0x1E0
movq -0x18(%rbp), %rcx
addq $0x2ec, %rcx            # imm = 0x2EC
movslq -0x7c(%rbp), %rax
imulq $0xa, %rax, %rax
addq %rax, %rcx
leaq 0xc27d(%rip), %rsi      # 0x2a611
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc249(%rip), %rsi      # 0x2a5ef
movb $0x0, %al
callq 0x2140
movq -0x48(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x7c(%rcx), %eax
jge 0x1e4e4
movq -0x48(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x74(%rcx), %eax
jge 0x1e4d4
movq -0x48(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x1e4be
movl -0x80(%rbp), %edi
movl -0x84(%rbp), %esi
movl -0x88(%rbp), %edx
movq -0x48(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x48(%rbp), %rax
movl 0xc(%rax), %r8d
callq 0x9500
movl %eax, -0x5c(%rbp)
movq -0x50(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0x58(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
movq -0x58(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x58(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x58(%rbp), %rax
divsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm2
leaq 0xc1bd(%rip), %rsi      # 0x2a660
movb $0x3, %al
callq 0x2140
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x1e3f4
jmp 0x1e4c0
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x1e3d4
jmp 0x1e4d6
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x1e3b7
movq -0x20(%rbp), %rdi
leaq 0xc10b(%rip), %rsi      # 0x2a5fa
movb $0x0, %al
callq 0x2140
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x1e355
movq -0x20(%rbp), %rdi
leaq 0xc161(%rip), %rsi      # 0x2a670
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc163(%rip), %rsi      # 0x2a684
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc163(%rip), %rsi      # 0x2a696
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc164(%rip), %rsi      # 0x2a6a9
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x1e0, %rdx            # imm = 0x1E0
leaq 0xc157(%rip), %rsi      # 0x2a6b9
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc07b(%rip), %rsi      # 0x2a5ef
movb $0x0, %al
callq 0x2140
movq -0x48(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x7c(%rcx), %eax
jge 0x1e6c0
movq -0x48(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, -0x90(%rbp)
movl -0x90(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x74(%rcx), %eax
jge 0x1e6aa
movq -0x48(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x1e694
movl -0x94(%rbp), %edi
movq -0x48(%rbp), %rax
movsd 0x3c8(%rax), %xmm0
movq -0x48(%rbp), %rax
movsd 0x30(%rax), %xmm1
movq -0x48(%rbp), %rax
movl 0x18(%rax), %esi
callq 0x9690
movsd %xmm0, -0x40(%rbp)
movl -0x90(%rbp), %edi
movq -0x48(%rbp), %rax
movsd 0x3d8(%rax), %xmm0
movq -0x48(%rbp), %rax
movsd 0x38(%rax), %xmm1
movq -0x48(%rbp), %rax
movl 0x1c(%rax), %esi
callq 0x9690
movsd %xmm0, -0x38(%rbp)
movl -0x8c(%rbp), %edi
movq -0x48(%rbp), %rax
movsd 0x3e8(%rax), %xmm0
movq -0x48(%rbp), %rax
movsd 0x40(%rax), %xmm1
movq -0x48(%rbp), %rax
movl 0x20(%rax), %esi
callq 0x9690
movsd %xmm0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movsd -0x40(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm2
leaq 0xbfe7(%rip), %rsi      # 0x2a660
movb $0x3, %al
callq 0x2140
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x1e5c8
jmp 0x1e696
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x1e5a8
jmp 0x1e6ac
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x1e588
movq -0x20(%rbp), %rdi
leaq 0xbf2f(%rip), %rsi      # 0x2a5fa
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc02f(%rip), %rsi      # 0x2a70c
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc02e(%rip), %rsi      # 0x2a71d
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xc02a(%rip), %rsi      # 0x2a72b
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
leaq 0xbd78(%rip), %rsi      # 0x2a48b
movb $0x0, %al
callq 0x2140
movq -0x20(%rbp), %rdi
callq 0x2080
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)