// File: /workspace/github_c_makefile_star2_O2/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 $0x2a8, %rsp            # imm = 0x2A8
movq %rdx, 0xe0(%rsp)
movq %rdi, 0xa0(%rsp)
cmpl $0x0, 0x14(%rdi)
je 0xbeaf
movq %rsi, %r14
leaq 0x1e0(%rsp), %rdi
movl $0xc8, %edx
xorl %esi, %esi
callq 0x20d0
movq (%r14), %rax
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
leaq 0x190(%rsp), %rax
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movl 0x1c8(%r14), %eax
movl %eax, 0x94(%rsp)
movl 0x1d0(%r14), %eax
movl %eax, 0x98(%rsp)
movl 0x1d8(%r14), %eax
movl %eax, 0x9c(%rsp)
movl 0x1cc(%r14), %eax
movl %eax, 0x88(%rsp)
movl 0x1d4(%r14), %eax
movl %eax, 0x8c(%rsp)
movl 0x1dc(%r14), %eax
movl %eax, 0x90(%rsp)
movsd 0x3f0(%r14), %xmm1
movsd %xmm1, 0xd8(%rsp)
movsd %xmm1, 0x150(%rsp)
movsd 0x400(%r14), %xmm1
movsd %xmm1, 0xd0(%rsp)
movsd %xmm1, 0x158(%rsp)
movsd 0x410(%r14), %xmm1
movsd %xmm1, 0xc8(%rsp)
movsd %xmm1, 0x160(%rsp)
movsd 0x58(%r14), %xmm1
movsd %xmm1, 0xc0(%rsp)
movsd 0x60(%r14), %xmm1
movsd %xmm1, 0xb8(%rsp)
movsd 0x68(%r14), %xmm1
movsd %xmm1, 0xb0(%rsp)
movups 0x70(%r14), %xmm1
movaps %xmm1, 0x170(%rsp)
movsd 0x80(%r14), %xmm1
movsd %xmm1, 0x180(%rsp)
movl 0x40(%r14), %eax
movl %eax, 0x4c(%rsp)
movl %eax, 0x7c(%rsp)
movl 0x44(%r14), %eax
movl %eax, 0x48(%rsp)
movl %eax, 0x80(%rsp)
movl 0x48(%r14), %eax
leaq 0x130(%rsp), %rcx
andq $0x0, 0x10(%rcx)
movl %eax, 0x44(%rsp)
movl %eax, 0x84(%rsp)
movaps %xmm0, (%rcx)
leaq 0x110(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x1c0(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0xf0(%rsp), %rax
andq $0x0, 0x10(%rax)
movaps %xmm0, (%rax)
andq $0x0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movl $0x1d8, %r13d           # imm = 0x1D8
movq $0x0, 0x30(%rsp)
movslq 0x8(%r14), %rax
movq 0x30(%rsp), %r8
cmpq %rax, %r8
jge 0xbeaf
movq 0x18(%r14), %r12
imulq $0x238, %r8, %rax       # imm = 0x238
addq %r12, %rax
movq %rax, 0xe8(%rsp)
incq %r8
movq 0xa0(%rsp), %rbx
movl 0x8(%rbx), %r9d
movl $0xc8, %esi
leaq 0x1e0(%rsp), %r15
movq %r15, %rdi
leaq 0xfbe4(%rip), %rdx      # 0x1b7ad
leaq 0xfc24(%rip), %rcx      # 0x1b7f4
movq %r8, 0x30(%rsp)
xorl %eax, %eax
callq 0x20b0
movq %r15, %rdi
leaq 0xf032(%rip), %rsi      # 0x1ac18
callq 0x8820
movsd 0x48(%rbx), %xmm0
movq %rax, 0x68(%rsp)
movq %rax, %rdi
leaq 0xfc02(%rip), %rsi      # 0x1b801
movb $0x1, %al
callq 0x2160
movq %r13, 0xa8(%rsp)
addq %r13, %r12
xorl %r13d, %r13d
cmpq $0xc, %r13
je 0xbca7
movsd -0x8(%r12,%r13,4), %xmm0
movsd 0x150(%rsp,%r13,2), %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x170(%rsp,%r13,2), %xmm2
movsd %xmm2, 0x20(%rsp)
movl 0x7c(%rsp,%r13), %ebx
movl %ebx, %edi
callq 0x761c
movl 0x94(%rsp,%r13), %ebp
movl 0x88(%rsp,%r13), %r15d
movl %eax, %edi
movl %ebp, %esi
movl %r15d, %edx
callq 0x7633
movl %eax, 0x50(%rsp,%r13,2)
movsd (%r12,%r13,4), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movl %ebx, %edi
callq 0x761c
movl %eax, %edi
movl %ebp, %esi
movl %r15d, %edx
callq 0x7633
incl %eax
movl %eax, 0x54(%rsp,%r13,2)
addq $0x4, %r13
jmp 0xbc14
movl 0x60(%rsp), %r15d
movl 0x64(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x58(%rsp), %eax
movl %eax, 0x3c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, 0x28(%rsp)
movl 0x50(%rsp), %eax
movl %eax, 0x20(%rsp)
movl 0x54(%rsp), %r13d
movl 0x3c(%rsp), %ebp
cmpl 0x40(%rsp), %r15d
jge 0xbe91
movl 0x20(%rsp), %r12d
cmpl 0x28(%rsp), %ebp
jge 0xbe89
cmpl %r13d, %r12d
jge 0xbe82
movl 0x34(%r14), %r8d
movl 0x38(%r14), %ecx
movl %r15d, %edi
movl %ebp, %esi
movl %r12d, %edx
callq 0x75ec
cltq
imulq $0x88, %rax, %rbx
movq 0x70(%rsp), %rax
cmpl $0x1, 0xc(%rax,%rbx)
jne 0xbe7a
addq 0x70(%rsp), %rbx
movl (%rbx), %eax
cmpq %rax, 0x30(%rsp)
jne 0xbe7a
movl %r12d, %edi
movsd 0xd8(%rsp), %xmm0
movsd 0xc0(%rsp), %xmm1
movl 0x4c(%rsp), %esi
callq 0x7651
movsd %xmm0, 0x130(%rsp)
movl %ebp, %edi
movsd 0xd0(%rsp), %xmm0
movsd 0xb8(%rsp), %xmm1
movl 0x48(%rsp), %esi
callq 0x7651
movsd %xmm0, 0x138(%rsp)
movl %r15d, %edi
movsd 0xc8(%rsp), %xmm0
movsd 0xb0(%rsp), %xmm1
movl 0x44(%rsp), %esi
callq 0x7651
movsd %xmm0, 0x140(%rsp)
movl 0x4(%rbx), %esi
leaq 0x130(%rsp), %rdi
movq 0xe8(%rsp), %rdx
leaq 0x110(%rsp), %rcx
leaq 0x1c0(%rsp), %r8
leaq 0xf0(%rsp), %r9
callq 0xad8e
movq 0xe0(%rsp), %rax
movsd 0x40(%rax), %xmm0
movsd 0x48(%rax), %xmm1
addq $0x10, %rbx
movq %rbx, %rdi
leaq 0x190(%rsp), %rsi
callq 0x74af
movsd 0x110(%rsp), %xmm0
movsd 0x118(%rsp), %xmm1
movsd 0x120(%rsp), %xmm2
movsd 0xf0(%rsp), %xmm3
movsd 0xf8(%rsp), %xmm4
movsd 0x100(%rsp), %xmm5
movsd 0x190(%rsp), %xmm6
movsd 0x198(%rsp), %xmm7
movaps 0x1a0(%rsp), %xmm8
movaps 0x1b0(%rsp), %xmm9
movups %xmm9, 0x10(%rsp)
movups %xmm8, (%rsp)
movq 0x68(%rsp), %rdi
leaq 0xfa92(%rip), %rsi      # 0x1b905
movb $0x8, %al
callq 0x2160
incl %r12d
jmp 0xbcef
incl %ebp
jmp 0xbce0
incl %r15d
jmp 0xbcd1
movq 0x68(%rsp), %rdi
callq 0x2080
movq 0xa8(%rsp), %r13
addq $0x238, %r13            # imm = 0x238
jmp 0xbb7b
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq