// File: /workspace/github_c_makefile_star2_O3/mohuangrui[P]ArtraCFD/diffusive_flux.c
// Function: ComputeFvhatX
static void ComputeFvhatX(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 idxS = IndexNode(k, j - 1, i, partn[Y], partn[X]);
    const int idxN = IndexNode(k, j + 1, i, partn[Y], partn[X]);
    const int idxF = IndexNode(k - 1, j, i, partn[Y], partn[X]);
    const int idxB = IndexNode(k + 1, j, i, partn[Y], partn[X]);

    const int idxE = IndexNode(k, j, i + 1, partn[Y], partn[X]);
    const int idxSE = IndexNode(k, j - 1, i + 1, partn[Y], partn[X]);
    const int idxNE = IndexNode(k, j + 1, i + 1, partn[Y], partn[X]);
    const int idxFE = IndexNode(k - 1, j, i + 1, partn[Y], partn[X]);
    const int idxBE = IndexNode(k + 1, j, i + 1, 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[idxS].U[tn];
    const Real uS = U[1] / U[0];
    const Real vS = U[2] / U[0];

    U = node[idxN].U[tn];
    const Real uN = U[1] / U[0];
    const Real vN = U[2] / U[0];

    U = node[idxF].U[tn];
    const Real uF = U[1] / U[0];
    const Real wF = U[3] / U[0];

    U = node[idxB].U[tn];
    const Real uB = U[1] / U[0];
    const Real wB = U[3] / U[0];

    U = node[idxE].U[tn];
    const Real uE = U[1] / U[0];
    const Real vE = U[2] / U[0];
    const Real wE = U[3] / U[0];
    const Real TE = ComputeTemperature(model->cv, U);

    U = node[idxSE].U[tn];
    const Real uSE = U[1] / U[0];
    const Real vSE = U[2] / U[0];

    U = node[idxNE].U[tn];
    const Real uNE = U[1] / U[0];
    const Real vNE = U[2] / U[0];

    U = node[idxFE].U[tn];
    const Real uFE = U[1] / U[0];
    const Real wFE = U[3] / U[0];

    U = node[idxBE].U[tn];
    const Real uBE = U[1] / U[0];
    const Real wBE = U[3] / U[0];

    const Real du_dx = (uE - u) * dd[X];
    const Real dv_dy = 0.25 * (vN + vNE - vS - vSE) * dd[Y];
    const Real dw_dz = 0.25 * (wB + wBE - wF - wFE) * dd[Z];
    const Real du_dy = 0.25 * (uN + uNE - uS - uSE) * dd[Y];
    const Real dv_dx = (vE - v) * dd[X];
    const Real du_dz = 0.25 * (uB + uBE - uF - uFE) * dd[Z];
    const Real dw_dx = (wE - w) * dd[X];
    const Real dT_dx = (TE - T) * dd[X];

    /* calculate interfacial values */
    const Real uhat = 0.5 * (u + uE);
    const Real vhat = 0.5 * (v + vE);
    const Real what = 0.5 * (w + wE);
    const Real That = 0.5 * (T + TE);
    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 * (du_dx + du_dx - (2.0/3.0) * divV);
    Fvhat[2] = mu * (du_dy + dv_dx);
    Fvhat[3] = mu * (du_dz + dw_dx);
    Fvhat[4] = heatK * dT_dx + Fvhat[1] * uhat + Fvhat[2] * vhat + Fvhat[3] * what;
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %r9, 0xe8(%rsp)
movl %ecx, %r15d
movl %edx, %ebx
movl %esi, %r13d
movl %edi, 0x18(%rsp)
movl (%r8), %ebp
movl 0x4(%r8), %r14d
movl %esi, %edi
movl %edx, %esi
movl %ecx, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0x90(%rsp)
leal -0x1(%rbx), %esi
movl %esi, 0x80(%rsp)
movl %r13d, %edi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0x70(%rsp)
leal 0x1(%rbx), %esi
movl %esi, 0x10(%rsp)
movl %r13d, %edi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0x60(%rsp)
leal -0x1(%r13), %edi
movl %edi, 0x40(%rsp)
movl %ebx, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0x50(%rsp)
leal 0x1(%r13), %r12d
movl %r12d, %edi
movl %ebx, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0x8(%rsp)
incl %r15d
movl %r13d, %edi
movl %ebx, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0x20(%rsp)
movl %r13d, %edi
movl 0x80(%rsp), %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0xd0(%rsp)
movl %r13d, %edi
movl 0x10(%rsp), %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, 0x10(%rsp)
movl 0x40(%rsp), %edi
movl %ebx, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, %r13d
movl %r12d, %edi
movl %ebx, %esi
movl %r15d, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0x7d53
movl %eax, %ebp
movslq 0x90(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq %rax, %rdx
shlq $0x7, %rdx
leaq (%rdx,%rax,8), %rax
movq 0x160(%rsp), %r15
addq %r15, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rbx
leaq (%rax,%rbx), %rdi
addq $0x10, %rdi
movsd (%rdi), %xmm1
movapd %xmm1, 0xb0(%rsp)
movsd 0x8(%rdi), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
movq 0x168(%rsp), %r14
movsd 0x50(%r14), %xmm0
movsd 0x10(%rdi), %xmm1
movaps %xmm1, 0xa0(%rsp)
movsd 0x18(%rdi), %xmm1
movaps %xmm1, 0xc0(%rsp)
callq 0x7c92
movsd %xmm0, 0x90(%rsp)
movslq 0x70(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movsd 0x10(%rax,%rbx), %xmm1
movapd %xmm1, 0xf0(%rsp)
movsd 0x20(%rax,%rbx), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movslq 0x60(%rsp), %rcx
movq %rcx, %rdx
shlq $0x7, %rdx
leaq (%rdx,%rcx,8), %rcx
addq %r15, %rcx
movsd 0x10(%rcx,%rbx), %xmm1
movapd %xmm1, 0x100(%rsp)
movsd 0x20(%rcx,%rbx), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rsp)
movslq 0x50(%rsp), %rdx
movq %rdx, %rsi
shlq $0x7, %rsi
leaq (%rsi,%rdx,8), %rdx
addq %r15, %rdx
movsd 0x10(%rdx,%rbx), %xmm1
movapd %xmm1, 0x110(%rsp)
movsd 0x28(%rdx,%rbx), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movslq 0x8(%rsp), %rsi
movq %rsi, %rdi
shlq $0x7, %rdi
leaq (%rdi,%rsi,8), %rsi
addq %r15, %rsi
movsd 0x10(%rsi,%rbx), %xmm1
movapd %xmm1, 0x40(%rsp)
movsd 0x28(%rsi,%rbx), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movslq 0x20(%rsp), %rdi
movq %rdi, %r8
shlq $0x7, %r8
leaq (%r8,%rdi,8), %rdi
addq %r15, %rdi
addq %rbx, %rdi
addq $0x10, %rdi
movsd (%rdi), %xmm0
movsd 0x8(%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x10(%rdi), %xmm1
unpcklpd 0xa0(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
unpcklpd 0xb0(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
divpd %xmm0, %xmm1
movapd %xmm1, 0x60(%rsp)
movsd 0x18(%rdi), %xmm1
unpcklpd 0xc0(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
divpd %xmm0, %xmm1
movapd %xmm1, 0x70(%rsp)
movsd 0x50(%r14), %xmm0
movsd 0x18(%rax,%rbx), %xmm1
movaps %xmm1, 0xa0(%rsp)
movsd 0x18(%rcx,%rbx), %xmm1
movaps %xmm1, 0xb0(%rsp)
movsd 0x18(%rdx,%rbx), %xmm1
movaps %xmm1, 0xc0(%rsp)
movsd 0x18(%rsi,%rbx), %xmm1
movaps %xmm1, 0x20(%rsp)
callq 0x7c92
movslq 0xd0(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movapd 0xa0(%rsp), %xmm9
movhpd 0x18(%rax,%rbx), %xmm9  # xmm9 = xmm9[0],mem[0]
movsd 0x10(%rax,%rbx), %xmm1
movapd 0xf0(%rsp), %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
divpd %xmm2, %xmm9
movsd 0x20(%rax,%rbx), %xmm2
divsd %xmm1, %xmm2
movslq 0x10(%rsp), %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movapd 0xb0(%rsp), %xmm7
movhpd 0x18(%rax,%rbx), %xmm7  # xmm7 = xmm7[0],mem[0]
movsd 0x10(%rax,%rbx), %xmm1
movapd 0x100(%rsp), %xmm3
unpcklpd %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0]
divpd %xmm3, %xmm7
movsd 0x20(%rax,%rbx), %xmm3
divsd %xmm1, %xmm3
addsd 0xe0(%rsp), %xmm3
subsd 0x30(%rsp), %xmm3
subsd %xmm2, %xmm3
movslq %r13d, %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movapd 0xc0(%rsp), %xmm5
movhpd 0x18(%rax,%rbx), %xmm5  # xmm5 = xmm5[0],mem[0]
movsd 0x10(%rax,%rbx), %xmm1
movapd 0x110(%rsp), %xmm2
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
divpd %xmm2, %xmm5
movsd 0x28(%rax,%rbx), %xmm2
divsd %xmm1, %xmm2
movslq %ebp, %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,8), %rax
addq %r15, %rax
movapd 0x20(%rsp), %xmm6
movhpd 0x18(%rax,%rbx), %xmm6  # xmm6 = xmm6[0],mem[0]
movsd 0x10(%rax,%rbx), %xmm1
movapd 0x40(%rsp), %xmm4
unpcklpd %xmm1, %xmm4            # xmm4 = xmm4[0],xmm1[0]
divpd %xmm4, %xmm6
movsd 0x28(%rax,%rbx), %xmm4
divsd %xmm1, %xmm4
addsd 0x8(%rsp), %xmm4
subsd 0x50(%rsp), %xmm4
subsd %xmm2, %xmm4
movapd %xmm7, %xmm8
unpckhpd %xmm7, %xmm8            # xmm8 = xmm8[1],xmm7[1]
addsd %xmm7, %xmm8
movsd 0xf815(%rip), %xmm1     # 0x1cb48
mulsd %xmm1, %xmm3
movsd %xmm3, 0x10(%rsp)
mulsd %xmm1, %xmm4
movapd %xmm4, %xmm7
movapd %xmm9, %xmm2
subsd %xmm9, %xmm8
unpckhpd %xmm9, %xmm2            # xmm2 = xmm2[1],xmm9[1]
subsd %xmm2, %xmm8
mulsd %xmm1, %xmm8
movapd %xmm6, %xmm2
unpckhpd %xmm6, %xmm2            # xmm2 = xmm2[1],xmm6[1]
addsd %xmm6, %xmm2
movapd 0x60(%rsp), %xmm3
movapd %xmm3, %xmm6
unpckhpd %xmm3, %xmm6            # xmm6 = xmm6[1],xmm3[1]
movapd %xmm5, %xmm4
subsd %xmm5, %xmm2
unpckhpd %xmm5, %xmm4            # xmm4 = xmm4[1],xmm5[1]
subsd %xmm4, %xmm2
movapd %xmm3, %xmm5
movapd %xmm3, %xmm4
subsd %xmm6, %xmm5
mulsd %xmm1, %xmm2
unpcklpd %xmm2, %xmm5            # xmm5 = xmm5[0],xmm2[0]
movapd %xmm5, 0x50(%rsp)
movapd 0x70(%rsp), %xmm2
movapd %xmm2, %xmm5
unpckhpd %xmm2, %xmm5            # xmm5 = xmm5[1],xmm2[1]
movapd %xmm2, %xmm1
movapd %xmm2, %xmm3
subsd %xmm5, %xmm1
unpcklpd %xmm1, %xmm8            # xmm8 = xmm8[0],xmm1[0]
movapd %xmm8, 0xd0(%rsp)
movsd 0x18(%rsp), %xmm1
movapd %xmm1, %xmm8
movsd 0x80(%rsp), %xmm2
subsd %xmm2, %xmm8
movsd %xmm8, 0x8(%rsp)
addsd %xmm2, %xmm1
movapd %xmm1, %xmm2
addsd %xmm4, %xmm6
movq 0xe8(%rsp), %rbx
movsd 0x10(%rbx), %xmm1
movapd %xmm1, 0x40(%rsp)
mulsd %xmm1, %xmm7
movsd %xmm7, 0x60(%rsp)
addsd %xmm3, %xmm5
movapd %xmm0, %xmm3
movsd 0x90(%rsp), %xmm1
subsd %xmm1, %xmm3
movsd %xmm3, 0x70(%rsp)
addsd %xmm1, %xmm0
movsd 0xf185(%rip), %xmm1     # 0x1c5c0
mulsd %xmm1, %xmm2
movsd %xmm2, 0x18(%rsp)
mulsd %xmm1, %xmm6
movapd %xmm6, 0x80(%rsp)
mulsd %xmm1, %xmm5
movapd %xmm5, 0x90(%rsp)
mulsd %xmm1, %xmm0
movsd 0x38(%r14), %xmm1
movsd %xmm1, 0x30(%rsp)
mulsd 0x70(%r14), %xmm0
callq 0x7bdf
mulsd 0x30(%rsp), %xmm0
movapd %xmm0, 0x30(%rsp)
movsd 0x40(%r14), %xmm1
mulsd 0x50(%r14), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
callq 0x7c0d
movsd 0x20(%rsp), %xmm5
divsd %xmm0, %xmm5
movq 0x170(%rsp), %rax
movq $0x0, (%rax)
movupd (%rbx), %xmm1
movsd 0x8(%rsp), %xmm4
mulsd %xmm1, %xmm4
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
mulsd 0x10(%rsp), %xmm0
movapd %xmm1, %xmm2
unpcklpd 0x40(%rsp), %xmm2       # xmm2 = xmm2[0],mem[0]
mulpd 0x50(%rsp), %xmm2
movsd 0x70(%rsp), %xmm3
mulsd %xmm1, %xmm3
shufpd $0x1, %xmm1, %xmm1      # xmm1 = xmm1[1,0]
mulpd 0xd0(%rsp), %xmm1
addpd %xmm2, %xmm1
mulsd %xmm5, %xmm3
movapd %xmm4, %xmm2
addsd %xmm4, %xmm0
addsd 0x60(%rsp), %xmm0
addsd %xmm4, %xmm2
mulsd 0xf630(%rip), %xmm0     # 0x1cb50
addsd %xmm2, %xmm0
movapd 0x30(%rsp), %xmm2
mulsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rax)
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd %xmm1, %xmm2
movupd %xmm2, 0x10(%rax)
mulsd 0x18(%rsp), %xmm0
addsd %xmm3, %xmm0
movapd 0x80(%rsp), %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
mulsd 0x90(%rsp), %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x20(%rax)
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq