// File: /workspace/github_c_makefile_star2_O3/mohuangrui[P]ArtraCFD/data_probe.c
// Function: WriteCurveProbeData
void WriteCurveProbeData(const Time *time, const Space *space, const Model *model)
{
    if (0 == time->dataN[PROCV]) {
        return;
    }
    FILE *fp = NULL;
    String fname = {'\0'};
    const Partition *const part = &(space->part);
    const Node *const node = space->node;
    const Geometry *const geo = &(space->geo);
    const Polyhedron *poly = NULL;
    int idx = 0; /* linear array index math variable */
    Real Uo[DIMUo] = {0.0};
    const IntVec nMin = {part->ns[PHY][X][MIN], part->ns[PHY][Y][MIN], part->ns[PHY][Z][MIN]};
    const IntVec nMax = {part->ns[PHY][X][MAX], part->ns[PHY][Y][MAX], part->ns[PHY][Z][MAX]};
    const RealVec sMin = {part->domain[X][MIN], part->domain[Y][MIN], part->domain[Z][MIN]};
    const RealVec d = {part->d[X], part->d[Y], part->d[Z]};
    const RealVec dd = {part->dd[X], part->dd[Y], part->dd[Z]};
    const IntVec ng = {part->ng[X], part->ng[Y], part->ng[Z]};
    RealVec pG = {0.0}; /* ghost point */
    RealVec pO = {0.0}; /* boundary point */
    RealVec pI = {0.0}; /* image point */
    RealVec N = {0.0}; /* normal */
    int box[DIMS][LIMIT] = {{0}}; /* bounding box in node space */
    for (int n = 0; n < geo->totN; ++n) {
        poly = geo->poly + n;
        snprintf(fname, sizeof(fname), "%s%03d_%05d.csv", "curve_probe_", n + 1, time->stepC);
        fp = Fopen(fname, "w");
        fprintf(fp, "# x, y, z, Nx, Ny, Nz, rho, u, v, w, p, T <time=%.6g>\n", time->now);
        /* determine search range according to bounding box of polyhedron and valid node space */
        for (int s = 0; s < DIMS; ++s) {
            box[s][MIN] = ConfineSpace(MapNode(poly->box[s][MIN], sMin[s], dd[s], ng[s]), nMin[s], nMax[s]);
            box[s][MAX] = ConfineSpace(MapNode(poly->box[s][MAX], sMin[s], dd[s], ng[s]), nMin[s], nMax[s]) + 1;
        }
        for (int k = box[Z][MIN]; k < box[Z][MAX]; ++k) {
            for (int j = box[Y][MIN]; j < box[Y][MAX]; ++j) {
                for (int i = box[X][MIN]; i < box[X][MAX]; ++i) {
                    idx = IndexNode(k, j, i, part->n[Y], part->n[X]);
                    if ((1 != node[idx].gst) || (n + 1 != node[idx].did)) {
                        continue;
                    }
                    pG[X] = MapPoint(i, sMin[X], d[X], ng[X]);
                    pG[Y] = MapPoint(j, sMin[Y], d[Y], ng[Y]);
                    pG[Z] = MapPoint(k, sMin[Z], d[Z], ng[Z]);
                    ComputeGeometricData(pG, node[idx].fid, poly, pO, pI, N);
                    MapPrimitive(model->gamma, model->gasR, node[idx].U[TO], Uo);
                    fprintf(fp, "%.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g\n",
                            pO[X], pO[Y], pO[Z], N[X], N[Y], N[Z], Uo[0], Uo[1], Uo[2], Uo[3], Uo[4], Uo[5]);
                }
            }
        }
        fclose(fp);
    }
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdx, 0x150(%rsp)
movq %rdi, 0x110(%rsp)
cmpl $0x0, 0x14(%rdi)
je 0xc754
movq %rsi, %r14
leaq 0x1f0(%rsp), %rdi
xorl %ebx, %ebx
movl $0xc8, %edx
xorl %esi, %esi
callq 0x20d0
movq (%r14), %rax
movq %rax, 0x80(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x1a0(%rsp)
movaps %xmm0, 0x190(%rsp)
movaps %xmm0, 0x180(%rsp)
movl 0x1c8(%r14), %eax
movl %eax, 0xa4(%rsp)
movl 0x1d0(%r14), %eax
movl %eax, 0xa8(%rsp)
movl 0x1d8(%r14), %eax
movl %eax, 0xac(%rsp)
movl 0x1cc(%r14), %eax
movl %eax, 0x98(%rsp)
movl 0x1d4(%r14), %eax
movl %eax, 0x9c(%rsp)
movl 0x1dc(%r14), %eax
movl %eax, 0xa0(%rsp)
movsd 0x3f0(%r14), %xmm1
movsd %xmm1, 0x148(%rsp)
movsd %xmm1, 0x160(%rsp)
movsd 0x400(%r14), %xmm1
movsd %xmm1, 0x140(%rsp)
movsd %xmm1, 0x168(%rsp)
movsd 0x410(%r14), %xmm1
movsd %xmm1, 0x138(%rsp)
movsd %xmm1, 0x170(%rsp)
movsd 0x58(%r14), %xmm1
movsd %xmm1, 0x130(%rsp)
movsd 0x60(%r14), %xmm1
movsd %xmm1, 0x128(%rsp)
movsd 0x68(%r14), %xmm1
movsd %xmm1, 0x120(%rsp)
movups 0x70(%r14), %xmm1
movaps %xmm1, 0x1d0(%rsp)
movsd 0x80(%r14), %xmm1
movsd %xmm1, 0x1e0(%rsp)
movl 0x40(%r14), %eax
movl %eax, 0x4c(%rsp)
movl %eax, 0x8c(%rsp)
movl 0x44(%r14), %eax
movl %eax, 0x48(%rsp)
movl %eax, 0x90(%rsp)
movl 0x48(%r14), %eax
movl %eax, 0x44(%rsp)
movl %eax, 0x94(%rsp)
movq %rbx, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movq %rbx, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movq %rbx, 0x1c0(%rsp)
movaps %xmm0, 0x1b0(%rsp)
movq %rbx, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movq %rbx, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
cmpl $0x0, 0x8(%r14)
jle 0xc754
movl $0x1d8, %r12d           # imm = 0x1D8
xorl %r8d, %r8d
movq 0x18(%r14), %r15
imulq $0x238, %r8, %rax       # imm = 0x238
addq %r15, %rax
movq %rax, 0x158(%rsp)
incq %r8
movq 0x110(%rsp), %rbx
movl 0x8(%rbx), %r9d
movl $0xc8, %esi
leaq 0x1f0(%rsp), %r13
movq %r13, %rdi
leaq 0x1047d(%rip), %rdx     # 0x1c8c5
leaq 0x104bd(%rip), %rcx     # 0x1c90c
movq %r8, 0x78(%rsp)
xorl %eax, %eax
callq 0x20b0
movq %r13, %rdi
leaq 0xf8c3(%rip), %rsi      # 0x1bd28
callq 0x9026
movsd 0x48(%rbx), %xmm0
movq %rax, 0x70(%rsp)
movq %rax, %rdi
leaq 0x1049b(%rip), %rsi     # 0x1c919
movb $0x1, %al
callq 0x2160
movq %r12, 0x118(%rsp)
addq %r12, %r15
xorl %r13d, %r13d
movsd -0x8(%r15,%r13,4), %xmm0
movsd 0x160(%rsp,%r13,2), %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x1d0(%rsp,%r13,2), %xmm2
movsd %xmm2, 0x30(%rsp)
movl 0x8c(%rsp,%r13), %ebx
movl %ebx, %edi
callq 0x7d83
movl 0xa4(%rsp,%r13), %ebp
movl 0x98(%rsp,%r13), %r12d
movl %eax, %edi
movl %ebp, %esi
movl %r12d, %edx
callq 0x7d9a
movl %eax, 0x50(%rsp,%r13,2)
movsd (%r15,%r13,4), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movl %ebx, %edi
callq 0x7d83
movl %eax, %edi
movl %ebp, %esi
movl %r12d, %edx
callq 0x7d9a
incl %eax
movl %eax, 0x54(%rsp,%r13,2)
addq $0x4, %r13
cmpq $0xc, %r13
jne 0xc493
movl 0x60(%rsp), %r13d
movl 0x64(%rsp), %eax
movl %eax, 0x40(%rsp)
cmpl %eax, %r13d
jge 0xc729
movl 0x58(%rsp), %eax
movl %eax, 0x3c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x50(%rsp), %eax
movl %eax, 0x30(%rsp)
movl 0x54(%rsp), %r15d
movl 0x3c(%rsp), %eax
movl %eax, %ebp
cmpl 0x28(%rsp), %eax
jge 0xc71b
movl 0x30(%rsp), %eax
movl %eax, %r12d
cmpl %r15d, %eax
jge 0xc70f
movl 0x34(%r14), %r8d
movl 0x38(%r14), %ecx
movl %r13d, %edi
movl %ebp, %esi
movl %r12d, %edx
callq 0x7d53
cltq
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rbx
movq 0x80(%rsp), %rax
cmpl $0x1, 0xc(%rax,%rbx)
jne 0xc703
addq 0x80(%rsp), %rbx
movl (%rbx), %eax
cmpq %rax, 0x78(%rsp)
jne 0xc703
movl %r12d, %edi
movsd 0x148(%rsp), %xmm0
movsd 0x130(%rsp), %xmm1
movl 0x4c(%rsp), %esi
callq 0x7db8
movsd %xmm0, 0xf0(%rsp)
movl %ebp, %edi
movsd 0x140(%rsp), %xmm0
movsd 0x128(%rsp), %xmm1
movl 0x48(%rsp), %esi
callq 0x7db8
movsd %xmm0, 0xf8(%rsp)
movl %r13d, %edi
movsd 0x138(%rsp), %xmm0
movsd 0x120(%rsp), %xmm1
movl 0x44(%rsp), %esi
callq 0x7db8
movsd %xmm0, 0x100(%rsp)
movl 0x4(%rbx), %esi
leaq 0xf0(%rsp), %rdi
movq 0x158(%rsp), %rdx
leaq 0xd0(%rsp), %rcx
leaq 0x1b0(%rsp), %r8
leaq 0xb0(%rsp), %r9
callq 0xb5ce
movq 0x150(%rsp), %rax
movsd 0x40(%rax), %xmm0
movsd 0x48(%rax), %xmm1
addq $0x10, %rbx
movq %rbx, %rdi
leaq 0x180(%rsp), %rsi
callq 0x7c16
movsd 0xd0(%rsp), %xmm0
movsd 0xd8(%rsp), %xmm1
movsd 0xe0(%rsp), %xmm2
movsd 0xb0(%rsp), %xmm3
movsd 0xb8(%rsp), %xmm4
movsd 0xc0(%rsp), %xmm5
movsd 0x180(%rsp), %xmm6
movsd 0x188(%rsp), %xmm7
movaps 0x190(%rsp), %xmm8
movaps 0x1a0(%rsp), %xmm9
movups %xmm9, 0x10(%rsp)
movups %xmm8, (%rsp)
movq 0x70(%rsp), %rdi
leaq 0x10321(%rip), %rsi     # 0x1ca1d
movb $0x8, %al
callq 0x2160
incl %r12d
cmpl %r12d, %r15d
jne 0xc577
incl %ebp
cmpl 0x28(%rsp), %ebp
jne 0xc567
incl %r13d
cmpl 0x40(%rsp), %r13d
jne 0xc557
movq 0x70(%rsp), %rdi
callq 0x2080
movslq 0x8(%r14), %rax
movq 0x118(%rsp), %r12
addq $0x238, %r12            # imm = 0x238
movq 0x78(%rsp), %r8
cmpq %rax, %r8
jl 0xc40c
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq