// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movq %r9, 0x68(%rsp)
movl %ecx, %r13d
movl %edx, %r12d
movl %esi, %ebp
movl %edi, 0x8(%rsp)
movl (%r8), %r14d
movl 0x4(%r8), %ebx
movl %esi, %edi
movl %edx, %esi
movl %ecx, %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x20(%rsp)
leal -0x1(%r13), %edx
movl %edx, 0x60(%rsp)
movl %ebp, %edi
movl %r12d, %esi
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x10(%rsp)
leal 0x1(%r13), %edx
movl %edx, 0x58(%rsp)
movl %ebp, %edi
movl %r12d, %esi
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x18(%rsp)
leal -0x1(%r12), %esi
movl %esi, 0x40(%rsp)
movl %ebp, %edi
movl %r13d, %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x28(%rsp)
leal 0x1(%r12), %r15d
movl %ebp, %edi
movl %r15d, %esi
movl %r13d, %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x30(%rsp)
incl %ebp
movl %ebp, %edi
movl %r12d, %esi
movl %r13d, %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x38(%rsp)
movl %ebp, %edi
movl %r12d, %esi
movl 0x60(%rsp), %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x48(%rsp)
movl %ebp, %edi
movl %r12d, %esi
movl 0x58(%rsp), %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, 0x50(%rsp)
movl %ebp, %edi
movl 0x40(%rsp), %esi
movl %r13d, %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, %r12d
movl %ebp, %edi
movl %r15d, %esi
movl %r13d, %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0x7ea3
movl %eax, %ebp
movslq 0x20(%rsp), %rax
movslq 0x8(%rsp), %rcx
movq %rax, %rdx
shlq $0x7, %rdx
leaq (%rdx,%rax,8), %rax
movq 0xd0(%rsp), %r15
addq %r15, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rbx
leaq (%rax,%rbx), %rdi
addq $0x10, %rdi
movsd (%rdi), %xmm0
movsd 0x8(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rsp)
movsd 0x10(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x60(%rsp)
movsd 0x18(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movq 0xd8(%rsp), %r14
movsd 0x50(%r14), %xmm0
callq 0x7de5
movsd %xmm0, 0x20(%rsp)
movslq 0x10(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm0
movsd 0x18(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x88(%rsp)
movsd 0x28(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movslq 0x18(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm0
movsd 0x18(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x70(%rsp)
movsd 0x28(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x78(%rsp)
movslq 0x28(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm0
movsd 0x20(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
movsd 0x28(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movslq 0x30(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm0
movsd 0x20(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x80(%rsp)
movsd 0x28(%rax,%rbx), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x90(%rsp)
movslq 0x38(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
leaq (%rax,%rbx), %rdi
addq $0x10, %rdi
movsd (%rdi), %xmm0
movsd 0x8(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
movsd 0x10(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
movsd 0x18(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsp)
movsd 0x50(%r14), %xmm0
callq 0x7de5
movslq 0x48(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm1
movsd 0x18(%rax,%rbx), %xmm2
divsd %xmm1, %xmm2
movsd 0x28(%rax,%rbx), %xmm3
divsd %xmm1, %xmm3
movslq 0x50(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm4
movsd 0x18(%rax,%rbx), %xmm1
divsd %xmm4, %xmm1
addsd 0x70(%rsp), %xmm1
subsd 0x88(%rsp), %xmm1
subsd %xmm2, %xmm1
movsd 0x28(%rax,%rbx), %xmm2
divsd %xmm4, %xmm2
addsd 0x78(%rsp), %xmm2
subsd 0x40(%rsp), %xmm2
subsd %xmm3, %xmm2
movslq %r12d, %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm3
movsd 0x20(%rax,%rbx), %xmm4
divsd %xmm3, %xmm4
movsd 0x28(%rax,%rbx), %xmm5
divsd %xmm3, %xmm5
movslq %ebp, %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm3
movsd 0x20(%rax,%rbx), %xmm6
divsd %xmm3, %xmm6
addsd 0x80(%rsp), %xmm6
subsd 0x10(%rsp), %xmm6
subsd %xmm4, %xmm6
movapd %xmm6, %xmm12
movsd 0x28(%rax,%rbx), %xmm4
divsd %xmm3, %xmm4
addsd 0x90(%rsp), %xmm4
subsd 0x18(%rsp), %xmm4
subsd %xmm5, %xmm4
movsd 0xf7bd(%rip), %xmm3     # 0x1dac8
mulsd %xmm3, %xmm2
movq 0x68(%rsp), %rax
movsd (%rax), %xmm5
movsd 0x8(%rax), %xmm6
mulsd %xmm5, %xmm2
movsd 0x28(%rsp), %xmm10
movapd %xmm10, %xmm9
movsd 0x58(%rsp), %xmm8
subsd %xmm8, %xmm9
movsd 0x10(%rax), %xmm7
mulsd %xmm7, %xmm9
addsd %xmm2, %xmm9
movsd %xmm9, 0x68(%rsp)
mulsd %xmm3, %xmm4
mulsd %xmm6, %xmm4
movsd 0x30(%rsp), %xmm9
movapd %xmm9, %xmm11
movsd 0x60(%rsp), %xmm2
subsd %xmm2, %xmm11
mulsd %xmm7, %xmm11
addsd %xmm4, %xmm11
movsd %xmm11, 0x50(%rsp)
mulsd %xmm3, %xmm1
mulsd %xmm5, %xmm1
mulsd %xmm3, %xmm12
mulsd %xmm6, %xmm12
addsd %xmm1, %xmm12
movsd %xmm12, 0x48(%rsp)
movsd 0x38(%rsp), %xmm6
movapd %xmm6, %xmm3
movsd 0x8(%rsp), %xmm1
subsd %xmm1, %xmm3
mulsd %xmm7, %xmm3
movsd %xmm3, 0x18(%rsp)
movapd %xmm0, %xmm4
movsd 0x20(%rsp), %xmm3
subsd %xmm3, %xmm4
mulsd %xmm7, %xmm4
movsd %xmm4, 0x10(%rsp)
movapd %xmm10, %xmm5
addsd %xmm8, %xmm5
movapd %xmm9, %xmm4
addsd %xmm2, %xmm4
movapd %xmm6, %xmm2
addsd %xmm1, %xmm2
addsd %xmm3, %xmm0
movsd 0xf1c6(%rip), %xmm1     # 0x1d5c0
mulsd %xmm1, %xmm5
movsd %xmm5, 0x28(%rsp)
mulsd %xmm1, %xmm4
movsd %xmm4, 0x30(%rsp)
mulsd %xmm1, %xmm2
movsd %xmm2, 0x38(%rsp)
mulsd %xmm1, %xmm0
movsd 0x38(%r14), %xmm1
movsd %xmm1, 0x8(%rsp)
mulsd 0x70(%r14), %xmm0
callq 0x7d2c
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x40(%r14), %xmm1
mulsd 0x50(%r14), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
callq 0x7d5a
movsd 0x20(%rsp), %xmm1
divsd %xmm0, %xmm1
mulsd 0x10(%rsp), %xmm1
movapd %xmm1, %xmm4
movsd 0x48(%rsp), %xmm0
movsd 0x18(%rsp), %xmm3
addsd %xmm3, %xmm0
movq 0xe0(%rsp), %rax
movq $0x0, (%rax)
movsd 0x68(%rsp), %xmm1
movsd 0x8(%rsp), %xmm5
mulsd %xmm5, %xmm1
movsd %xmm1, 0x8(%rax)
movsd 0x50(%rsp), %xmm2
mulsd %xmm5, %xmm2
movsd %xmm2, 0x10(%rax)
addsd %xmm3, %xmm3
mulsd 0xf613(%rip), %xmm0     # 0x1dad0
addsd %xmm3, %xmm0
mulsd %xmm5, %xmm0
movsd %xmm0, 0x18(%rax)
mulsd 0x28(%rsp), %xmm1
addsd %xmm4, %xmm1
mulsd 0x30(%rsp), %xmm2
addsd %xmm1, %xmm2
mulsd 0x38(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x20(%rax)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop