// File: /workspace/github_c_makefile_star2_O2/mohuangrui[P]ArtraCFD/diffusive_flux.c
// Function: ComputeFvhatZ
static void ComputeFvhatZ(const int tn, const int k, const int j, const int i,
        const int partn[restrict], const Real dd[restrict], const Node *const node,
        const Model *model, Real Fvhat[restrict])
{
    const int idx = IndexNode(k, j, i, partn[Y], partn[X]);
    const int idxW = IndexNode(k, j, i - 1, partn[Y], partn[X]);
    const int idxE = IndexNode(k, j, i + 1, partn[Y], partn[X]);
    const int idxS = IndexNode(k, j - 1, i, partn[Y], partn[X]);
    const int idxN = IndexNode(k, j + 1, i, partn[Y], partn[X]);

    const int idxB = IndexNode(k + 1, j, i, partn[Y], partn[X]);
    const int idxWB = IndexNode(k + 1, j, i - 1, partn[Y], partn[X]);
    const int idxEB = IndexNode(k + 1, j, i + 1, partn[Y], partn[X]);
    const int idxSB = IndexNode(k + 1, j - 1, i, partn[Y], partn[X]);
    const int idxNB = IndexNode(k + 1, j + 1, i, partn[Y], partn[X]);

    const Real *restrict U = node[idx].U[tn];
    const Real u = U[1] / U[0];
    const Real v = U[2] / U[0];
    const Real w = U[3] / U[0];
    const Real T = ComputeTemperature(model->cv, U);

    U = node[idxW].U[tn];
    const Real uW = U[1] / U[0];
    const Real wW = U[3] / U[0];

    U = node[idxE].U[tn];
    const Real uE = U[1] / U[0];
    const Real wE = U[3] / U[0];

    U = node[idxS].U[tn];
    const Real vS = U[2] / U[0];
    const Real wS = U[3] / U[0];

    U = node[idxN].U[tn];
    const Real vN = U[2] / U[0];
    const Real wN = U[3] / U[0];

    U = node[idxB].U[tn];
    const Real uB = U[1] / U[0];
    const Real vB = U[2] / U[0];
    const Real wB = U[3] / U[0];
    const Real TB = ComputeTemperature(model->cv, U);

    U = node[idxWB].U[tn];
    const Real uWB = U[1] / U[0];
    const Real wWB = U[3] / U[0];

    U = node[idxEB].U[tn];
    const Real uEB = U[1] / U[0];
    const Real wEB = U[3] / U[0];

    U = node[idxSB].U[tn];
    const Real vSB = U[2] / U[0];
    const Real wSB = U[3] / U[0];

    U = node[idxNB].U[tn];
    const Real vNB = U[2] / U[0];
    const Real wNB = U[3] / U[0];

    const Real dw_dx = 0.25 * (wE + wEB - wW - wWB) * dd[X];
    const Real du_dz = (uB - u) * dd[Z];
    const Real dw_dy = 0.25 * (wN + wNB - wS - wSB) * dd[Y];
    const Real dv_dz = (vB - v) * dd[Z];
    const Real du_dx = 0.25 * (uE + uEB - uW - uWB) * dd[X];
    const Real dv_dy = 0.25 * (vN + vNB - vS - vSB) * dd[Y];
    const Real dw_dz = (wB - w) * dd[Z];
    const Real dT_dz = (TB - T) * dd[Z];

    /* calculate interfacial values */
    const Real uhat = 0.5 * (u + uB);
    const Real vhat = 0.5 * (v + vB);
    const Real what = 0.5 * (w + wB);
    const Real That = 0.5 * (T + TB);
    const Real mu = model->refMu * Viscosity(That * model->refT);
    const Real heatK = model->gamma * model->cv * mu / PrandtlNumber();
    const Real divV = du_dx + dv_dy + dw_dz;

    Fvhat[0] = 0.0;
    Fvhat[1] = mu * (dw_dx + du_dz);
    Fvhat[2] = mu * (dw_dy + dv_dz);
    Fvhat[3] = mu * (dw_dz + dw_dz - (2.0/3.0) * divV);
    Fvhat[4] = heatK * dT_dz + Fvhat[1] * uhat + Fvhat[2] * vhat + Fvhat[3] * what;
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r9, 0x48(%rsp)
movl %ecx, %r14d
movl %edx, %ebp
movl %esi, %r15d
movl %edi, 0x8(%rsp)
movl (%r8), %r12d
movl 0x4(%r8), %r13d
movl %esi, %edi
movl %edx, %esi
movl %ecx, %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, 0x20(%rsp)
leal -0x1(%r14), %edx
movl %edx, 0x10(%rsp)
movl %r15d, %edi
movl %ebp, %esi
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, 0x80(%rsp)
leal 0x1(%r14), %edx
movl %edx, 0x40(%rsp)
movl %r15d, %edi
movl %ebp, %esi
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, (%rsp)
leal -0x1(%rbp), %esi
movl %esi, 0x90(%rsp)
movl %r15d, %edi
movl %r14d, %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, 0x70(%rsp)
leal 0x1(%rbp), %ebx
movl %r15d, %edi
movl %ebx, %esi
movl %r14d, %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, 0x60(%rsp)
incl %r15d
movl %r15d, %edi
movl %ebp, %esi
movl %r14d, %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, 0x50(%rsp)
movl %r15d, %edi
movl %ebp, %esi
movl 0x10(%rsp), %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, 0x10(%rsp)
movl %r15d, %edi
movl %ebp, %esi
movl 0x40(%rsp), %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, 0x38(%rsp)
movl %r15d, %edi
movl 0x90(%rsp), %esi
movl %r14d, %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movl %eax, %ebp
movl %r15d, %edi
movl %ebx, %esi
movl %r14d, %edx
movl %r13d, %ecx
movl %r12d, %r8d
callq 0x75ec
movslq 0x20(%rsp), %rcx
movslq 0x8(%rsp), %rdx
imulq $0x88, %rcx, %rcx
movq 0x100(%rsp), %rsi
addq %rsi, %rcx
imulq $0x28, %rdx, %r14
leaq (%r14,%rcx), %rdi
addq $0x10, %rdi
movsd (%rdi), %xmm1
movsd 0x18(%rdi), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x108(%rsp), %rcx
movsd 0x50(%rcx), %xmm0
movslq 0x80(%rsp), %rcx
imulq $0x88, %rcx, %r13
addq %rsi, %r13
movslq (%rsp), %rcx
imulq $0x88, %rcx, %r15
addq %rsi, %r15
movslq 0x70(%rsp), %rcx
imulq $0x88, %rcx, %rbx
addq %rsi, %rbx
movslq 0x60(%rsp), %rcx
imulq $0x88, %rcx, %r12
addq %rsi, %r12
movslq 0x50(%rsp), %rcx
imulq $0x88, %rcx, %rcx
addq %rsi, %rcx
addq %r14, %rcx
addq $0x10, %rcx
movq %rcx, 0xc0(%rsp)
movslq 0x10(%rsp), %rcx
imulq $0x88, %rcx, %rcx
addq %rsi, %rcx
movq %rcx, 0x40(%rsp)
movslq 0x38(%rsp), %rcx
imulq $0x88, %rcx, %rcx
addq %rsi, %rcx
movq %rcx, 0x10(%rsp)
movslq %ebp, %rcx
imulq $0x88, %rcx, %rbp
addq %rsi, %rbp
cltq
imulq $0x88, %rax, %rax
addq %rsi, %rax
movq %rax, 0x60(%rsp)
movupd 0x8(%rdi), %xmm2
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm1, %xmm2
movapd %xmm2, 0x70(%rsp)
callq 0x752b
movsd %xmm0, (%rsp)
movsd 0x10(%r14,%r13), %xmm0
movsd 0x18(%r14,%r13), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0xb8(%rsp)
movsd 0x10(%r14,%r15), %xmm1
movsd 0x18(%r14,%r15), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0xa8(%rsp)
movsd 0x10(%r14,%rbx), %xmm2
movsd 0x20(%r14,%rbx), %xmm3
divsd %xmm2, %xmm3
movsd %xmm3, 0x38(%rsp)
movsd 0x28(%r14,%r13), %xmm3
movhpd 0x28(%r14,%rbx), %xmm3  # xmm3 = xmm3[0],mem[0]
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
divpd %xmm0, %xmm3
movapd %xmm3, 0x50(%rsp)
movsd 0x10(%r14,%r12), %xmm0
movsd 0x20(%r14,%r12), %xmm2
divsd %xmm0, %xmm2
movsd %xmm2, 0xb0(%rsp)
movsd 0x28(%r14,%r15), %xmm2
movhpd 0x28(%r14,%r12), %xmm2  # xmm2 = xmm2[0],mem[0]
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
divpd %xmm1, %xmm2
movapd %xmm2, 0x90(%rsp)
movq 0xc0(%rsp), %rdi
movsd (%rdi), %xmm0
movupd 0x8(%rdi), %xmm2
movsd 0x18(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
divpd %xmm0, %xmm2
movapd %xmm2, 0x80(%rsp)
movq 0x108(%rsp), %rbx
movsd 0x50(%rbx), %xmm0
callq 0x752b
movq 0x40(%rsp), %rax
movsd 0x10(%r14,%rax), %xmm2
movsd 0x18(%r14,%rax), %xmm3
movq %rax, %rcx
divsd %xmm2, %xmm3
movq 0x10(%rsp), %rax
movsd 0x10(%r14,%rax), %xmm4
movsd 0x18(%r14,%rax), %xmm1
divsd %xmm4, %xmm1
addsd 0xa8(%rsp), %xmm1
subsd 0xb8(%rsp), %xmm1
subsd %xmm3, %xmm1
movsd 0x10(%r14,%rbp), %xmm3
movsd 0x20(%r14,%rbp), %xmm5
divsd %xmm3, %xmm5
movsd 0x28(%r14,%rcx), %xmm6
movhpd 0x28(%r14,%rbp), %xmm6  # xmm6 = xmm6[0],mem[0]
unpcklpd %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0]
divpd %xmm2, %xmm6
movq 0x60(%rsp), %rcx
movsd 0x10(%r14,%rcx), %xmm7
movsd 0x20(%r14,%rcx), %xmm2
divsd %xmm7, %xmm2
addsd 0xb0(%rsp), %xmm2
subsd 0x38(%rsp), %xmm2
subsd %xmm5, %xmm2
movsd 0x28(%r14,%rax), %xmm3
movhpd 0x28(%r14,%rcx), %xmm3  # xmm3 = xmm3[0],mem[0]
unpcklpd %xmm7, %xmm4            # xmm4 = xmm4[0],xmm7[0]
divpd %xmm4, %xmm3
addpd 0x90(%rsp), %xmm3
subpd 0x50(%rsp), %xmm3
subpd %xmm6, %xmm3
movq 0x48(%rsp), %rax
movsd 0x10(%rax), %xmm4
mulpd 0xe41b(%rip), %xmm3     # 0x1ba40
movupd (%rax), %xmm9
mulpd %xmm9, %xmm3
movapd 0x80(%rsp), %xmm11
movapd %xmm11, %xmm5
movapd 0x70(%rsp), %xmm8
subpd %xmm8, %xmm5
movsd 0x8(%rsp), %xmm10
movapd %xmm10, %xmm7
movsd 0x20(%rsp), %xmm6
subsd %xmm6, %xmm7
mulsd %xmm4, %xmm7
movsd %xmm7, 0x48(%rsp)
movapd %xmm0, %xmm12
movsd (%rsp), %xmm7
subsd %xmm7, %xmm12
mulsd %xmm4, %xmm12
movsd %xmm12, 0x50(%rsp)
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
mulpd %xmm5, %xmm4
addpd %xmm3, %xmm4
movapd %xmm4, 0x60(%rsp)
movsd 0xe391(%rip), %xmm3     # 0x1ba30
mulsd %xmm3, %xmm1
mulsd %xmm9, %xmm1
mulsd %xmm3, %xmm2
unpckhpd %xmm9, %xmm9            # xmm9 = xmm9[1,1]
mulsd %xmm2, %xmm9
addsd %xmm1, %xmm9
movapd %xmm9, 0x10(%rsp)
movapd %xmm11, %xmm2
addpd %xmm8, %xmm2
movsd 0xdddc(%rip), %xmm1     # 0x1b4b0
movapd %xmm2, %xmm3
mulsd %xmm1, %xmm3
movapd %xmm3, 0x70(%rsp)
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
mulsd %xmm1, %xmm2
movapd %xmm2, 0x80(%rsp)
movapd %xmm10, %xmm2
addsd %xmm6, %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rsp)
addsd %xmm7, %xmm0
mulsd %xmm1, %xmm0
movsd 0x38(%rbx), %xmm1
movsd %xmm1, 0x20(%rsp)
mulsd 0x70(%rbx), %xmm0
callq 0x7478
mulsd 0x20(%rsp), %xmm0
movapd %xmm0, 0x20(%rsp)
movsd 0x40(%rbx), %xmm1
mulsd 0x50(%rbx), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
callq 0x74a6
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movq 0x110(%rsp), %rax
andq $0x0, (%rax)
mulsd 0x50(%rsp), %xmm1
movapd %xmm1, %xmm3
movapd 0x10(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
addsd %xmm2, %xmm1
movapd 0x20(%rsp), %xmm4
movapd %xmm4, %xmm0
unpcklpd %xmm4, %xmm0            # xmm0 = xmm0[0],xmm4[0]
mulpd 0x60(%rsp), %xmm0
movupd %xmm0, 0x8(%rax)
mulsd 0xe2a1(%rip), %xmm1     # 0x1ba38
addsd %xmm2, %xmm2
addsd %xmm2, %xmm1
mulsd %xmm4, %xmm1
movsd %xmm1, 0x18(%rax)
movapd 0x70(%rsp), %xmm2
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
mulsd 0x80(%rsp), %xmm0
addsd %xmm2, %xmm0
mulsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rax)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq