user: Converte this assembly snippet into its equivalent C code:

```asm
<ThreephaseNavierStokes_ST_LS_SO_3D_Evaluate>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xc8,%rsp
  movsd  %xmm0,0x78(%rsp)
  movsd  %xmm1,0x80(%rsp)
  movsd  %xmm2,(%rsp)
  movsd  %xmm3,0x8(%rsp)
  movsd  %xmm4,0x88(%rsp)
  movsd  %xmm5,0x90(%rsp)
  movsd  %xmm6,0x98(%rsp)
  movsd  %xmm7,0xa0(%rsp)
  mov    %rsi,0xa8(%rsp)
  mov    %rdx,0x10(%rsp)
  mov    %rcx,0x28(%rsp)
  mov    %r8,0xb0(%rsp)
  mov    %r9,0x18(%rsp)
  test   %edi,%edi
  jle    L8
  mov    0x130(%rsp),%r13
  mov    0x138(%rsp),%r12
  mov    0x140(%rsp),%rbp
  mov    %edi,%eax
  mov    %rax,0xb8(%rsp)
  mov    $0x0,%r15d
  mov    $0x0,%ebx
  mov    $0x0,%r14d
  mov    %r12,%rax
  mov    %r13,%r12
  mov    %rax,%r13
L11:
  mov    0x10(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  (%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedHeaviside@plt>
  pxor   %xmm7,%xmm7
  cvtsi2sd %eax,%xmm7
  movsd  %xmm7,0x20(%rsp)
  mov    0x10(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  (%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedDirac@plt>
  mov    0x10(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  0x8(%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedHeaviside@plt>
  pxor   %xmm4,%xmm4
  cvtsi2sd %eax,%xmm4
  movsd  %xmm4,0x30(%rsp)
  mov    0x10(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  0x8(%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedDirac@plt>
  pxor   %xmm5,%xmm5
  cvtsi2sd %eax,%xmm5
  movsd  %xmm5,0x48(%rsp)
  movsd  D33(%rip),%xmm1
  movsd  0x20(%rsp),%xmm7
  subsd  %xmm7,%xmm1
  mulsd  0x90(%rsp),%xmm1
  mulsd  0xa0(%rsp),%xmm7
  addsd  %xmm7,%xmm1
  movsd  %xmm1,0x38(%rsp)
  movsd  D33(%rip),%xmm2
  movsd  0x30(%rsp),%xmm4
  subsd  %xmm4,%xmm2
  movapd %xmm2,%xmm1
  mulsd  0x98(%rsp),%xmm1
  mulsd  0x100(%rsp),%xmm4
  addsd  %xmm4,%xmm1
  movsd  %xmm1,0x40(%rsp)
  mov    0x18(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  (%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedHeaviside@plt>
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movsd  %xmm2,0x30(%rsp)
  mov    0x18(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  (%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedDirac@plt>
  mov    0x18(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  0x8(%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedHeaviside@plt>
  pxor   %xmm7,%xmm7
  cvtsi2sd %eax,%xmm7
  movsd  %xmm7,0x20(%rsp)
  mov    0x18(%rsp),%rax
  movsd  (%rax,%r14,8),%xmm1
  movsd  0x8(%rsp),%xmm0
  mov    $0x2,%eax
  call   <smoothedDirac@plt>
  pxor   %xmm4,%xmm4
  cvtsi2sd %eax,%xmm4
  movsd  %xmm4,0x50(%rsp)
  movsd  0x38(%rsp),%xmm0
  movsd  0x30(%rsp),%xmm2
  mulsd  %xmm2,%xmm0
  movsd  D33(%rip),%xmm5
  subsd  %xmm2,%xmm5
  movapd %xmm5,%xmm1
  mulsd  0x108(%rsp),%xmm1
  movapd %xmm1,%xmm4
  addsd  %xmm0,%xmm4
  movsd  %xmm4,0x58(%rsp)
  movsd  D33(%rip),%xmm2
  movsd  0x20(%rsp),%xmm7
  subsd  %xmm7,%xmm2
  movsd  %xmm2,0x30(%rsp)
  movsd  0x40(%rsp),%xmm1
  mulsd  %xmm7,%xmm1
  movapd %xmm2,%xmm0
  mulsd  0x110(%rsp),%xmm0
  addsd  %xmm1,%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  %xmm7,%xmm0
  movsd  0x108(%rsp),%xmm1
  mulsd  0x110(%rsp),%xmm1
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm0
  movapd %xmm7,%xmm5
  mulsd  %xmm4,%xmm5
  movapd %xmm5,%xmm6
  movsd  %xmm5,0x38(%rsp)
  mov    %r12,0x60(%rsp)
  movapd %xmm5,%xmm1
  mulsd  (%r12),%xmm1
  mov    0x148(%rsp),%rax
  movsd  %xmm1,(%rax,%r14,8)
  mov    0x150(%rsp),%rax
  movsd  %xmm5,(%rax,%r14,8)
  mov    %r13,0x68(%rsp)
  movapd %xmm5,%xmm1
  mulsd  0x0(%r13),%xmm1
  mov    0x158(%rsp),%rax
  movsd  %xmm1,(%rax,%r14,8)
  mov    0x160(%rsp),%rax
  movsd  %xmm5,(%rax,%r14,8)
  mov    %rbp,0x70(%rsp)
  movapd %xmm5,%xmm1
  mulsd  0x0(%rbp),%xmm1
  mov    0x168(%rsp),%rax
  movsd  %xmm1,(%rax,%r14,8)
  mov    0x170(%rsp),%rax
  movsd  %xmm5,(%rax,%r14,8)
  movsd  (%r12),%xmm1
  mov    0x178(%rsp),%rax
  movsd  %xmm1,(%rax,%rbx,1)
  movsd  0x0(%r13),%xmm1
  movsd  %xmm1,0x8(%rax,%rbx,1)
  movsd  0x0(%rbp),%xmm1
  movsd  %xmm1,0x10(%rax,%rbx,1)
  mov    0x180(%rsp),%rax
  mov    D33(%rip),%rsi
  mov    %rsi,(%rax,%rbx,1)
  mov    0x188(%rsp),%rax
  mov    %rsi,0x8(%rax,%rbx,1)
  mov    0x190(%rsp),%rax
  mov    %rsi,0x10(%rax,%rbx,1)
  movsd  (%r12),%xmm2
  movapd %xmm5,%xmm1
  mulsd  %xmm2,%xmm1
  mulsd  %xmm2,%xmm1
  mov    0x198(%rsp),%rax
  movsd  %xmm1,(%rax,%rbx,1)
  movapd %xmm5,%xmm1
  mulsd  (%r12),%xmm1
  mulsd  0x0(%r13),%xmm1
  movsd  %xmm1,0x8(%rax,%rbx,1)
  movapd %xmm5,%xmm1
  mulsd  (%r12),%xmm1
  mulsd  0x0(%rbp),%xmm1
  movsd  %xmm1,0x10(%rax,%rbx,1)
  movapd %xmm7,%xmm1
  addsd  %xmm7,%xmm1
  mulsd  %xmm1,%xmm4
  movapd %xmm4,%xmm2
  movapd %xmm4,%xmm3
  mulsd  (%r12),%xmm3
  mov    0x1a0(%rsp),%rax
  movsd  %xmm3,(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%r13),%xmm3
  movsd  %xmm3,0x8(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%rbp),%xmm3
  movsd  %xmm3,0x10(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  (%r12),%xmm3
  mov    0x1a8(%rsp),%rax
  movsd  %xmm3,0x8(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  (%r12),%xmm3
  mov    0x1b0(%rsp),%rax
  movsd  %xmm3,0x10(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%r13),%xmm3
  mulsd  (%r12),%xmm3
  mov    0x1b8(%rsp),%rax
  movsd  %xmm3,(%rax,%rbx,1)
  movsd  0x0(%r13),%xmm4
  movapd %xmm5,%xmm3
  mulsd  %xmm4,%xmm3
  mulsd  %xmm4,%xmm3
  movsd  %xmm3,0x8(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%r13),%xmm3
  mulsd  0x0(%rbp),%xmm3
  movsd  %xmm3,0x10(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%r13),%xmm3
  mov    0x1c0(%rsp),%rax
  movsd  %xmm3,(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%r13),%xmm3
  mov    0x1d0(%rsp),%rax
  movsd  %xmm3,0x10(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  (%r12),%xmm3
  mov    0x1c8(%rsp),%rax
  movsd  %xmm3,(%rax,%rbx,1)
  movapd %xmm2,%xmm3
  mulsd  0x0(%r13),%xmm3
  movsd  %xmm3,0x8(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%rbp),%xmm3
  movsd  %xmm3,0x10(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%rbp),%xmm3
  mulsd  (%r12),%xmm3
  mov    0x1d8(%rsp),%rax
  movsd  %xmm3,(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%rbp),%xmm3
  mulsd  0x0(%r13),%xmm3
  movsd  %xmm3,0x8(%rax,%rbx,1)
  movsd  0x0(%rbp),%xmm4
  movapd %xmm5,%xmm3
  mulsd  %xmm4,%xmm3
  mulsd  %xmm4,%xmm3
  movsd  %xmm3,0x10(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%rbp),%xmm3
  mov    0x1e0(%rsp),%rax
  movsd  %xmm3,(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  0x0(%rbp),%xmm3
  mov    0x1e8(%rsp),%rax
  movsd  %xmm3,0x8(%rax,%rbx,1)
  movapd %xmm5,%xmm3
  mulsd  (%r12),%xmm3
  mov    0x1f0(%rsp),%rax
  movsd  %xmm3,(%rax,%rbx,1)
  mulsd  0x0(%r13),%xmm6
  movsd  %xmm6,0x8(%rax,%rbx,1)
  mulsd  0x0(%rbp),%xmm2
  movsd  %xmm2,0x10(%rax,%rbx,1)
  mulsd  %xmm0,%xmm1
  mov    0x1f8(%rsp),%rax
  movsd  %xmm1,(%rax,%r15,1)
  mulsd  %xmm7,%xmm0
  movsd  %xmm0,0x20(%rax,%r15,1)
  movsd  %xmm0,0x40(%rax,%r15,1)
  mov    0x210(%rsp),%rax
  movsd  %xmm0,0x18(%rax,%r15,1)
  mov    0x218(%rsp),%rax
  movsd  %xmm0,0x30(%rax,%r15,1)
  mov    0x200(%rsp),%rax
  movsd  %xmm0,(%rax,%r15,1)
  movsd  %xmm1,0x20(%rax,%r15,1)
  movsd  %xmm0,0x40(%rax,%r15,1)
  mov    0x220(%rsp),%rax
  movsd  %xmm0,0x8(%rax,%r15,1)
  mov    0x228(%rsp),%rax
  movsd  %xmm0,0x38(%rax,%r15,1)
  mov    0x208(%rsp),%rax
  movsd  %xmm0,(%rax,%r15,1)
  movsd  %xmm0,0x20(%rax,%r15,1)
  movsd  %xmm1,0x40(%rax,%r15,1)
  mov    0x230(%rsp),%rax
  movsd  %xmm0,0x10(%rax,%r15,1)
  mov    0x238(%rsp),%rax
  movsd  %xmm0,0x28(%rax,%r15,1)
  mov    0x28(%rsp),%rax
  movsd  (%rax,%rbx,1),%xmm4
  movsd  %xmm4,0x40(%rsp)
  movsd  0x8(%rax,%rbx,1),%xmm1
  movsd  0x10(%rax,%rbx,1),%xmm0
  movapd %xmm4,%xmm5
  mulsd  %xmm4,%xmm5
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm5
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm5
  pxor   %xmm7,%xmm7
  ucomisd %xmm5,%xmm7
  ja     L34
  sqrtsd %xmm5,%xmm5
L23:
  movsd  0x38(%rsp),%xmm0
  xorpd  D15(%rip),%xmm0
  movsd  0x48(%rsp),%xmm1
  mulsd  0x20(%rsp),%xmm1
  mulsd  0x88(%rsp),%xmm1
  movsd  0x58(%rsp),%xmm2
  movapd %xmm2,%xmm4
  mulsd  0x78(%rsp),%xmm4
  mulsd  0x50(%rsp),%xmm4
  mov    0x60(%rsp),%rax
  movsd  (%rax),%xmm7
  mulsd  0x80(%rsp),%xmm2
  movsd  0x30(%rsp),%xmm3
  mulsd  %xmm2,%xmm3
  mov    0xa8(%rsp),%rax
  movapd %xmm0,%xmm2
  mulsd  (%rax),%xmm2
  mov    0xb0(%rsp),%rdx
  movapd %xmm1,%xmm6
  mulsd  (%rdx,%r14,8),%xmm6
  mulsd  0x40(%rsp),%xmm6
  divsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm2
  movapd %xmm4,%xmm6
  mulsd  %xmm7,%xmm6
  addsd  %xmm6,%xmm2
  mulsd  %xmm3,%xmm7
  addsd  %xmm7,%xmm2
  mov    0x240(%rsp),%rdi
  movsd  %xmm2,(%rdi,%r14,8)
  movapd %xmm4,%xmm8
  addsd  %xmm3,%xmm8
  mov    0x248(%rsp),%rsi
  movsd  %xmm8,(%rsi,%r14,8)
  mov    0x250(%rsp),%rdi
  movq   $0x0,(%rdi,%r14,8)
  mov    0x258(%rsp),%rsi
  movq   $0x0,(%rsi,%r14,8)
  mov    0x68(%rsp),%rdi
  movsd  (%rdi),%xmm7
  movapd %xmm0,%xmm2
  mulsd  0x8(%rax),%xmm2
  movapd %xmm1,%xmm6
  mulsd  (%rdx,%r14,8),%xmm6
  mov    0x28(%rsp),%rcx
  mulsd  0x8(%rcx,%rbx,1),%xmm6
  divsd  %xmm5,%xmm6
  subsd  %xmm6,%xmm2
  movapd %xmm4,%xmm6
  mulsd  %xmm7,%xmm6
  addsd  %xmm6,%xmm2
  mulsd  %xmm3,%xmm7
  addsd  %xmm7,%xmm2
  mov    0x260(%rsp),%rsi
  movsd  %xmm2,(%rsi,%r14,8)
  mov    0x268(%rsp),%rdi
  movq   $0x0,(%rdi,%r14,8)
  mov    0x270(%rsp),%rsi
  movsd  %xmm8,(%rsi,%r14,8)
  mov    0x278(%rsp),%rdi
  movq   $0x0,(%rdi,%r14,8)
  mov    0x70(%rsp),%rsi
  movsd  (%rsi),%xmm2
  mulsd  0x10(%rax),%xmm0
  mulsd  (%rdx,%r14,8),%xmm1
  mulsd  0x10(%rcx,%rbx,1),%xmm1
  divsd  %xmm5,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm4
  addsd  %xmm4,%xmm0
  mulsd  %xmm3,%xmm2
  addsd  %xmm2,%xmm0
  mov    0x280(%rsp),%rax
  movsd  %xmm0,(%rax,%r14,8)
  mov    0x288(%rsp),%rax
  movq   $0x0,(%rax,%r14,8)
  mov    0x290(%rsp),%rax
  movq   $0x0,(%rax,%r14,8)
  mov    0x298(%rsp),%rax
  movsd  %xmm8,(%rax,%r14,8)
  mov    0x128(%rsp),%rax
  movsd  (%rax,%rbx,1),%xmm0
  mov    0x2a0(%rsp),%rax
  movsd  %xmm0,(%rax,%r14,8)
  mov    0x2a8(%rsp),%rax
  mov    D33(%rip),%rcx
  mov    %rcx,(%rax,%rbx,1)
  mov    0x128(%rsp),%rax
  movsd  0x8(%rax,%rbx,1),%xmm0
  mov    0x2b0(%rsp),%rax
  movsd  %xmm0,(%rax,%r14,8)
  mov    0x2b8(%rsp),%rax
  mov    %rcx,0x8(%rax,%rbx,1)
  mov    0x128(%rsp),%rax
  movsd  0x10(%rax,%rbx,1),%xmm0
  mov    0x2c0(%rsp),%rax
  movsd  %xmm0,(%rax,%r14,8)
  mov    0x2c8(%rsp),%rax
  mov    %rcx,0x10(%rax,%rbx,1)
  add    $0x1,%r14
  add    $0x8,%r12
  add    $0x8,%r13
  add    $0x8,%rbp
  add    $0x18,%rbx
  add    $0x48,%r15
  cmp    0xb8(%rsp),%r14
  jne    L11
L8:
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L34:
  movapd %xmm5,%xmm0
  call   <sqrt@plt>
  movapd %xmm0,%xmm5
  jmp    L23
```

tool_calls: name: read_data
arguments: label: D33
type: f64
name: read_data
arguments: label: D15
type: f32[4]

tool: D33: 1

tool: {"D15": [0.0,-0.0,0.0,0.0]}

assistant: ```c
void ThreephaseNavierStokes_ST_LS_SO_3D_Evaluate(const int nPoints, const double boundaryPenaltyCoef, const double volumePenaltyCoef, const double eps_rho, const double eps_mu, const double sigma, const double rho_0, const double nu_0, const double rho_1, const double nu_1, const double rho_s, const double nu_s, const double *g, const double *phi, const double *n, const double *kappa, const double *phi_s, const double *n_s, const double *p, const double *grad_p, const double *u, const double *v, const double *w, double *mom_u_acc, double *dmom_u_acc_u, double *mom_v_acc, double *dmom_v_acc_v, double *mom_w_acc, double *dmom_w_acc_w, double *mass_adv, double *dmass_adv_u, double *dmass_adv_v, double *dmass_adv_w, double *mom_u_adv, double *dmom_u_adv_u, double *dmom_u_adv_v, double *dmom_u_adv_w, double *mom_v_adv, double *dmom_v_adv_u, double *dmom_v_adv_v, double *dmom_v_adv_w, double *mom_w_adv, double *dmom_w_adv_u, double *dmom_w_adv_v, double *dmom_w_adv_w, double *mom_u_diff_ten, double *mom_v_diff_ten, double *mom_w_diff_ten, double *mom_uv_diff_ten, double *mom_uw_diff_ten, double *mom_vu_diff_ten, double *mom_vw_diff_ten, double *mom_wu_diff_ten, double *mom_wv_diff_ten, double *mom_u_source, double *dmom_u_source_u, double *dmom_u_source_v, double *dmom_u_source_w, double *mom_v_source, double *dmom_v_source_u, double *dmom_v_source_v, double *dmom_v_source_w, double *mom_w_source, double *dmom_w_source_u, double *dmom_w_source_v, double *dmom_w_source_w, double *mom_u_ham, double *dmom_u_ham_grad_p, double *mom_v_ham, double *dmom_v_ham_grad_p, double *mom_w_ham, double *dmom_w_ham_grad_p) {
  int k;
  double rho, nu, mu, H_rho, d_rho, H_mu, d_mu, H_rho_s, d_rho_s, H_mu_s, d_mu_s, norm_n, norm_n_s;
  for (k = 0; k < nPoints; k++) {
    H_rho = smoothedHeaviside(eps_rho, phi[k]);
    d_rho = smoothedDirac(eps_rho, phi[k]);
    H_mu = smoothedHeaviside(eps_mu, phi[k]);
    d_mu = smoothedDirac(eps_mu, phi[k]);
    rho = rho_0 * (1.0 - H_rho) + rho_1 * H_rho;
    nu = nu_0 * (1.0 - H_mu) + nu_1 * H_mu;
    mu = rho_0 * nu_0 * (1.0 - H_mu) + rho_1 * nu_1 * H_mu;
    H_rho_s = smoothedHeaviside(eps_rho, phi_s[k]);
    d_rho_s = smoothedDirac(eps_rho, phi_s[k]);
    H_mu_s = smoothedHeaviside(eps_mu, phi_s[k]);
    d_mu_s = smoothedDirac(eps_mu, phi_s[k]);
    rho = rho_s * (1.0 - H_rho_s) + rho * H_rho_s;
    nu = nu_s * (1.0 - H_mu_s) + nu * H_mu_s;
    mu = rho_s * nu_s * (1.0 - H_mu_s) + rho * nu * H_mu_s;
    mom_u_acc[k] = H_mu_s * rho * u[k];
    dmom_u_acc_u[k] = H_mu_s * rho;
    mom_v_acc[k] = H_mu_s * rho * v[k];
    dmom_v_acc_v[k] = H_mu_s * rho;
    mom_w_acc[k] = H_mu_s * rho * w[k];
    dmom_w_acc_w[k] = H_mu_s * rho;
    mass_adv[k * 3 + 0] = u[k];
    mass_adv[k * 3 + 1] = v[k];
    mass_adv[k * 3 + 2] = w[k];
    dmass_adv_u[k * 3 + 0] = 1.0;
    dmass_adv_v[k * 3 + 1] = 1.0;
    dmass_adv_w[k * 3 + 2] = 1.0;
    mom_u_adv[k * 3 + 0] = H_mu_s * rho * u[k] * u[k];
    mom_u_adv[k * 3 + 1] = H_mu_s * rho * u[k] * v[k];
    mom_u_adv[k * 3 + 2] = H_mu_s * rho * u[k] * w[k];
    dmom_u_adv_u[k * 3 + 0] = 2.0 * H_mu_s * rho * u[k];
    dmom_u_adv_u[k * 3 + 1] = H_mu_s * rho * v[k];
    dmom_u_adv_u[k * 3 + 2] = H_mu_s * rho * w[k];
    dmom_u_adv_v[k * 3 + 1] = H_mu_s * rho * u[k];
    dmom_u_adv_w[k * 3 + 2] = H_mu_s * rho * u[k];
    mom_v_adv[k * 3 + 0] = H_mu_s * rho * v[k] * u[k];
    mom_v_adv[k * 3 + 1] = H_mu_s * rho * v[k] * v[k];
    mom_v_adv[k * 3 + 2] = H_mu_s * rho * v[k] * w[k];
    dmom_v_adv_u[k * 3 + 0] = H_mu_s * rho * v[k];
    dmom_v_adv_w[k * 3 + 2] = H_mu_s * rho * v[k];
    dmom_v_adv_v[k * 3 + 0] = H_mu_s * rho * u[k];
    dmom_v_adv_v[k * 3 + 1] = 2.0 * H_mu_s * rho * v[k];
    dmom_v_adv_v[k * 3 + 2] = H_mu_s * rho * w[k];
    mom_w_adv[k * 3 + 0] = H_mu_s * rho * w[k] * u[k];
    mom_w_adv[k * 3 + 1] = H_mu_s * rho * w[k] * v[k];
    mom_w_adv[k * 3 + 2] = H_mu_s * rho * w[k] * w[k];
    dmom_w_adv_u[k * 3 + 0] = H_mu_s * rho * w[k];
    dmom_w_adv_v[k * 3 + 1] = H_mu_s * rho * w[k];
    dmom_w_adv_w[k * 3 + 0] = H_mu_s * rho * u[k];
    dmom_w_adv_w[k * 3 + 1] = H_mu_s * rho * v[k];
    dmom_w_adv_w[k * 3 + 2] = 2.0 * H_mu_s * rho * w[k];
    mom_u_diff_ten[k * 9 + 0] = 2.0 * H_mu_s * mu;
    mom_u_diff_ten[k * 9 + 4] = H_mu_s * mu;
    mom_u_diff_ten[k * 9 + 8] = H_mu_s * mu;
    mom_uv_diff_ten[k * 9 + 3] = H_mu_s * mu;
    mom_uw_diff_ten[k * 9 + 6] = H_mu_s * mu;
    mom_v_diff_ten[k * 9 + 0] = H_mu_s * mu;
    mom_v_diff_ten[k * 9 + 4] = 2.0 * H_mu_s * mu;
    mom_v_diff_ten[k * 9 + 8] = H_mu_s * mu;
    mom_vu_diff_ten[k * 9 + 1] = H_mu_s * mu;
    mom_vw_diff_ten[k * 9 + 7] = H_mu_s * mu;
    mom_w_diff_ten[k * 9 + 0] = H_mu_s * mu;
    mom_w_diff_ten[k * 9 + 4] = H_mu_s * mu;
    mom_w_diff_ten[k * 9 + 8] = 2.0 * H_mu_s * mu;
    mom_wu_diff_ten[k * 9 + 2] = H_mu_s * mu;
    mom_wv_diff_ten[k * 9 + 5] = H_mu_s * mu;
    norm_n = sqrt(n[k * 3 + 0] * n[k * 3 + 0] + n[k * 3 + 1] * n[k * 3 + 1] + n[k * 3 + 2] * n[k * 3 + 2]);
    mom_u_source[k] = -H_mu_s * rho * g[0] - H_mu_s * d_mu * sigma * kappa[k] * n[k * 3 + 0] / (norm_n) + boundaryPenaltyCoef * rho * d_mu_s * (u[k] - 0.0) + volumePenaltyCoef * rho * (1.0 - H_mu_s) * (u[k] - 0.0);
    dmom_u_source_u[k] = boundaryPenaltyCoef * rho * d_mu_s + volumePenaltyCoef * rho * (1.0 - H_mu_s);
    dmom_u_source_v[k] = 0.0;
    dmom_u_source_w[k] = 0.0;
    mom_v_source[k] = -H_mu_s * rho * g[1] - H_mu_s * d_mu * sigma * kappa[k] * n[k * 3 + 1] / (norm_n) + boundaryPenaltyCoef * rho * d_mu_s * (v[k] - 0.0) + volumePenaltyCoef * rho * (1.0 - H_mu_s) * (v[k] - 0.0);
    dmom_v_source_u[k] = 0.0;
    dmom_v_source_v[k] = boundaryPenaltyCoef * rho * d_mu_s + volumePenaltyCoef * rho * (1.0 - H_mu_s);
    dmom_v_source_w[k] = 0.0;
    mom_w_source[k] = -H_mu_s * rho * g[2] - H_mu_s * d_mu * sigma * kappa[k] * n[k * 3 + 2] / (norm_n) + boundaryPenaltyCoef * rho * d_mu_s * (w[k] - 0.0) + volumePenaltyCoef * rho * (1.0 - H_mu_s) * (w[k] - 0.0);
    dmom_w_source_u[k] = 0.0;
    dmom_w_source_v[k] = 0.0;
    dmom_w_source_w[k] = boundaryPenaltyCoef * rho * d_mu_s + volumePenaltyCoef * rho * (1.0 - H_mu_s);
    mom_u_ham[k] = grad_p[k * 3 + 0];
    dmom_u_ham_grad_p[k * 3 + 0] = 1.0;
    mom_v_ham[k] = grad_p[k * 3 + 1];
    dmom_v_ham_grad_p[k * 3 + 1] = 1.0;
    mom_w_ham[k] = grad_p[k * 3 + 2];
    dmom_w_ham_grad_p[k * 3 + 2] = 1.0;
  }
}
```