user: 请将以下的汇编代码转换成C语言代码:

```asm
<VolumeAveragedNavierStokesFullDevStress_3D_Evaluate>:
  endbr64
  push   %r15
  mov    %rdx,%rax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rsi,0x8(%rsp)
  mov    0xc8(%rsp),%r10
  mov    0x128(%rsp),%rdx
  mov    0x140(%rsp),%rcx
  mov    0x148(%rsp),%rsi
  mov    0x150(%rsp),%rdi
  mov    0x158(%rsp),%r11
  test   %ebp,%ebp
  jle    L26
  mov    %rax,(%rsp)
  movslq %ebp,%r15
  movapd %xmm0,%xmm2
  xor    %ebp,%ebp
  mov    0x90(%rsp),%rbx
  xor    %r12d,%r12d
  mov    0x80(%rsp),%r14
  mov    %r15,0x10(%rsp)
  mov    0x88(%rsp),%r13
  xor    %r15d,%r15d
  pxor   %xmm7,%xmm7
  movsd  D52(%rip),%xmm8
  movq   D29(%rip),%xmm12
  movsd  D54(%rip),%xmm11
  movq   D18(%rip),%xmm10
  movsd  D46(%rip),%xmm13
  movsd  D107(%rip),%xmm14
  xchg   %ax,%ax
L57:
  movsd  (%rbx),%xmm0
  mov    0x98(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  (%rbx),%xmm0
  mov    0xa0(%rsp),%rax
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  (%rbx),%xmm0
  mov    0xa8(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  (%rbx),%xmm0
  mov    0xb0(%rsp),%rax
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  (%rbx),%xmm0
  mov    0xb8(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  (%rbx),%xmm0
  mov    0xc0(%rsp),%rax
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  (%rbx),%xmm0
  mulsd  (%r9),%xmm0
  mov    0xd0(%rsp),%rax
  movsd  %xmm0,(%r10,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,0x8(%r10,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x10(%r10,%rbp,1)
  movsd  (%rbx),%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  mov    0xd8(%rsp),%rax
  movsd  %xmm0,0x8(%rax,%rbp,1)
  mov    0xe0(%rsp),%rax
  movsd  (%rbx),%xmm0
  movsd  %xmm0,0x10(%rax,%rbp,1)
  mulsd  %xmm2,%xmm0
  movsd  (%r9),%xmm3
  mov    0xe8(%rsp),%rax
  mulsd  %xmm3,%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,0x8(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x10(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0xf0(%rsp),%rax
  addsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,0x8(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x10(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0xf8(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  movsd  %xmm0,0x8(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  mov    0x100(%rsp),%rax
  movsd  %xmm0,0x10(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0x108(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  mulsd  (%r9),%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  movsd  (%r14),%xmm3
  mulsd  %xmm2,%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,0x8(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x10(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0x110(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0x120(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,0x10(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0x118(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  addsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,0x8(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x10(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0x130(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  mulsd  (%r9),%xmm0
  movsd  %xmm0,(%rdx,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,0x8(%rdx,%rbp,1)
  movsd  (%rbx),%xmm0
  movsd  0x0(%r13),%xmm3
  mulsd  %xmm2,%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,0x10(%rdx,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mov    0x138(%rsp),%rax
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x8(%rax,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r9),%xmm0
  movsd  %xmm0,(%rcx,%rbp,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  (%r14),%xmm0
  movsd  %xmm0,0x8(%rcx,%rbp,1)
  movsd  (%rbx),%xmm0
  addsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x10(%rcx,%rbp,1)
  movsd  (%rbx),%xmm0
  addsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rsi,%r15,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x20(%rsi,%r15,1)
  movsd  (%rbx),%xmm0
  mov    0x160(%rsp),%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x40(%rsi,%r15,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x18(%rax,%r15,1)
  movsd  (%rbx),%xmm0
  mov    0x168(%rsp),%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x30(%rax,%r15,1)
  movsd  (%rbx),%xmm0
  mov    0x170(%rsp),%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdi,%r15,1)
  movsd  (%rbx),%xmm0
  addsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x20(%rdi,%r15,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x40(%rdi,%r15,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rax,%r15,1)
  movsd  (%rbx),%xmm0
  mov    0x178(%rsp),%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x38(%rax,%r15,1)
  movsd  (%rbx),%xmm0
  mov    0x180(%rsp),%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%r11,%r15,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x20(%r11,%r15,1)
  movsd  (%rbx),%xmm0
  addsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x40(%r11,%r15,1)
  movsd  (%rbx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x10(%rax,%r15,1)
  movsd  (%rbx),%xmm0
  mov    0x188(%rsp),%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x28(%rax,%r15,1)
  movsd  (%r9),%xmm15
  movsd  (%r14),%xmm4
  movsd  0x0(%r13),%xmm3
  mulsd  %xmm4,%xmm4
  movapd %xmm15,%xmm0
  mulsd  %xmm15,%xmm0
  mulsd  %xmm3,%xmm3
  addsd  %xmm4,%xmm0
  addsd  %xmm3,%xmm0
  ucomisd %xmm0,%xmm7
  ja     L6
  sqrtsd %xmm0,%xmm0
L36:
  movsd  (%rbx),%xmm5
  movapd %xmm8,%xmm9
  movapd %xmm7,%xmm4
  subsd  %xmm5,%xmm9
  movapd %xmm9,%xmm3
  andpd  %xmm12,%xmm3
  comisd %xmm3,%xmm11
  ja     L38
  mov    0x8(%rsp),%rax
  movsd  (%rax,%r12,8),%xmm4
  mulsd  %xmm5,%xmm4
  mulsd  %xmm14,%xmm4
  divsd  %xmm9,%xmm4
  divsd  %xmm1,%xmm4
L38:
  movapd %xmm5,%xmm6
  movapd %xmm7,%xmm3
  andpd  %xmm12,%xmm6
  comisd %xmm6,%xmm11
  ja     L52
  mov    0x8(%rsp),%rax
  movsd  D76(%rip),%xmm3
  movsd  (%rax,%r12,8),%xmm6
  mulsd  %xmm9,%xmm3
  mulsd  %xmm6,%xmm6
  mulsd  %xmm9,%xmm3
  mulsd  %xmm5,%xmm6
  mulsd  %xmm5,%xmm6
  mulsd  %xmm5,%xmm6
  divsd  %xmm6,%xmm3
L52:
  movapd %xmm5,%xmm6
  mov    (%rsp),%rax
  add    $0x8,%rbx
  add    $0x8,%r9
  mulsd  %xmm5,%xmm6
  add    $0x8,%r14
  add    $0x8,%r13
  add    $0x48,%r15
  movapd %xmm4,%xmm9
  xorpd  %xmm10,%xmm5
  mulsd  %xmm0,%xmm9
  mulsd  %xmm2,%xmm5
  mulsd  (%rax),%xmm5
  mov    0x190(%rsp),%rax
  mulsd  %xmm1,%xmm6
  addsd  %xmm8,%xmm9
  mulsd  %xmm3,%xmm6
  mulsd  %xmm9,%xmm6
  mulsd  %xmm15,%xmm6
  addsd  %xmm5,%xmm6
  movsd  %xmm6,(%rax,%r12,8)
  movsd  -0x8(%rbx),%xmm6
  mov    (%rsp),%rax
  movapd %xmm6,%xmm5
  mulsd  %xmm6,%xmm5
  xorpd  %xmm10,%xmm6
  mulsd  %xmm2,%xmm6
  mulsd  0x8(%rax),%xmm6
  mov    0x198(%rsp),%rax
  mulsd  %xmm1,%xmm5
  mulsd  %xmm3,%xmm5
  mulsd  %xmm9,%xmm5
  mulsd  -0x8(%r14),%xmm5
  addsd  %xmm6,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%rbx),%xmm6
  mov    (%rsp),%rax
  movapd %xmm6,%xmm5
  mulsd  %xmm6,%xmm5
  xorpd  %xmm10,%xmm6
  mulsd  %xmm2,%xmm6
  mulsd  0x10(%rax),%xmm6
  mov    0x1a0(%rsp),%rax
  mulsd  %xmm1,%xmm5
  mulsd  %xmm3,%xmm5
  mulsd  %xmm9,%xmm5
  mulsd  -0x8(%r13),%xmm5
  addsd  %xmm6,%xmm5
  movapd %xmm0,%xmm6
  addsd  %xmm13,%xmm6
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r9),%xmm5
  movsd  -0x8(%rbx),%xmm9
  mov    0x1a8(%rsp),%rax
  mulsd  %xmm5,%xmm5
  mulsd  %xmm9,%xmm9
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm9
  mulsd  %xmm3,%xmm9
  addsd  %xmm0,%xmm5
  mulsd  %xmm4,%xmm5
  addsd  %xmm8,%xmm5
  mulsd  %xmm9,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r14),%xmm5
  mulsd  -0x8(%r9),%xmm5
  movsd  -0x8(%rbx),%xmm9
  mov    0x1b0(%rsp),%rax
  mulsd  %xmm9,%xmm9
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm9
  mulsd  %xmm3,%xmm9
  mulsd  %xmm4,%xmm5
  addsd  %xmm7,%xmm5
  mulsd  %xmm9,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r13),%xmm5
  mulsd  -0x8(%r9),%xmm5
  movsd  -0x8(%rbx),%xmm9
  mov    0x1b8(%rsp),%rax
  mulsd  %xmm9,%xmm9
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm9
  mulsd  %xmm3,%xmm9
  mulsd  %xmm4,%xmm5
  addsd  %xmm7,%xmm5
  mulsd  %xmm9,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r14),%xmm5
  movsd  -0x8(%rbx),%xmm9
  mov    0x1c8(%rsp),%rax
  mulsd  %xmm5,%xmm5
  mulsd  %xmm9,%xmm9
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm9
  mulsd  %xmm3,%xmm9
  addsd  %xmm0,%xmm5
  mulsd  %xmm4,%xmm5
  addsd  %xmm8,%xmm5
  mulsd  %xmm9,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r9),%xmm5
  mulsd  -0x8(%r14),%xmm5
  movsd  -0x8(%rbx),%xmm9
  mov    0x1c0(%rsp),%rax
  mulsd  %xmm9,%xmm9
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm9
  mulsd  %xmm3,%xmm9
  mulsd  %xmm4,%xmm5
  addsd  %xmm7,%xmm5
  mulsd  %xmm9,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r13),%xmm5
  mulsd  -0x8(%r14),%xmm5
  movsd  -0x8(%rbx),%xmm9
  mov    0x1d0(%rsp),%rax
  mulsd  %xmm9,%xmm9
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm9
  mulsd  %xmm3,%xmm9
  mulsd  %xmm4,%xmm5
  addsd  %xmm7,%xmm5
  mulsd  %xmm9,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r13),%xmm5
  movsd  -0x8(%rbx),%xmm9
  mov    0x1e8(%rsp),%rax
  mulsd  %xmm5,%xmm5
  mulsd  %xmm9,%xmm9
  divsd  %xmm6,%xmm5
  mulsd  %xmm1,%xmm9
  mulsd  %xmm3,%xmm9
  addsd  %xmm0,%xmm5
  mulsd  %xmm4,%xmm5
  addsd  %xmm8,%xmm5
  mulsd  %xmm9,%xmm5
  movsd  %xmm5,(%rax,%r12,8)
  movsd  -0x8(%r9),%xmm0
  mulsd  -0x8(%r13),%xmm0
  movsd  -0x8(%rbx),%xmm5
  mov    0x1d8(%rsp),%rax
  mulsd  %xmm5,%xmm5
  divsd  %xmm6,%xmm0
  mulsd  %xmm1,%xmm5
  mulsd  %xmm3,%xmm5
  mulsd  %xmm4,%xmm0
  addsd  %xmm7,%xmm0
  mulsd  %xmm5,%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  -0x8(%r14),%xmm0
  mulsd  -0x8(%r13),%xmm0
  movsd  -0x8(%rbx),%xmm5
  mov    0x1e0(%rsp),%rax
  mulsd  %xmm5,%xmm5
  divsd  %xmm6,%xmm0
  mulsd  %xmm1,%xmm5
  mulsd  %xmm3,%xmm5
  mulsd  %xmm4,%xmm0
  addsd  %xmm7,%xmm0
  mulsd  %xmm5,%xmm0
  movsd  %xmm0,(%rax,%r12,8)
  movsd  -0x8(%rbx),%xmm0
  mulsd  (%r8,%rbp,1),%xmm0
  mov    0x1f0(%rsp),%rax
  movsd  %xmm0,(%rax,%r12,8)
  mov    0x1f8(%rsp),%rax
  movsd  -0x8(%rbx),%xmm0
  movsd  %xmm0,(%rax,%rbp,1)
  mulsd  0x8(%r8,%rbp,1),%xmm0
  mov    0x200(%rsp),%rax
  movsd  %xmm0,(%rax,%r12,8)
  mov    0x208(%rsp),%rax
  movsd  -0x8(%rbx),%xmm0
  movsd  %xmm0,0x8(%rax,%rbp,1)
  mulsd  0x10(%r8,%rbp,1),%xmm0
  mov    0x210(%rsp),%rax
  movsd  %xmm0,(%rax,%r12,8)
  movsd  -0x8(%rbx),%xmm0
  add    $0x1,%r12
  mov    0x218(%rsp),%rax
  movsd  %xmm0,0x10(%rax,%rbp,1)
  add    $0x18,%rbp
  cmp    0x10(%rsp),%r12
  jne    L57
L26:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L6:
  mov    %r11,0x158(%rsp)
  mov    %rdi,0x150(%rsp)
  mov    %rsi,0x148(%rsp)
  mov    %rcx,0x140(%rsp)
  mov    %rdx,0x128(%rsp)
  mov    %r10,0xc8(%rsp)
  mov    %r8,0x38(%rsp)
  mov    %r9,0x20(%rsp)
  movsd  %xmm1,0x30(%rsp)
  movsd  %xmm2,0x28(%rsp)
  movsd  %xmm15,0x18(%rsp)
  call   <sqrt@plt>
  mov    D107(%rip),%rax
  mov    0x158(%rsp),%r11
  pxor   %xmm7,%xmm7
  mov    0x150(%rsp),%rdi
  mov    0x148(%rsp),%rsi
  movq   %rax,%xmm14
  mov    D46(%rip),%rax
  mov    0x140(%rsp),%rcx
  mov    0x128(%rsp),%rdx
  mov    0xc8(%rsp),%r10
  movq   %rax,%xmm13
  mov    0x38(%rsp),%r8
  mov    D54(%rip),%rax
  movsd  0x30(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm2
  movq   %rax,%xmm11
  mov    D52(%rip),%rax
  mov    0x20(%rsp),%r9
  movq   D18(%rip),%xmm10
  movsd  0x18(%rsp),%xmm15
  movq   D29(%rip),%xmm12
  movq   %rax,%xmm8
  jmp    L36
```

tool_calls: name: disassemble_data
arguments: label: D52
data_type: f64
name: disassemble_data
arguments: label: D29
data_type: qword
name: disassemble_data
arguments: label: D54
data_type: byte[8]
name: disassemble_data
arguments: label: D18
data_type: f32[2]
name: disassemble_data
arguments: label: D46
data_type: byte[8]
name: disassemble_data
arguments: label: D107
data_type: byte[8]
name: disassemble_data
arguments: label: D76
data_type: f64

tool: D52: 1

tool: D29: 9223372036854775807

tool: {"D54": [0x48,0xaf,0xbc,0x9a,0xf2,0xd7,0x7a,0x3e]}

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

tool: {"D46": [0x11,0xea,0x2d,0x81,0x99,0x97,0x71,0x3d]}

tool: {"D107": [0x7b,0x14,0xae,0x47,0xe1,0x7a,0x84,0x3f]}

tool: D76: 180

assistant: ```c
void VolumeAveragedNavierStokesFullDevStress_3D_Evaluate(const int nPoints, const double rho, const double mu, const double *meanGrainSize, const double *g, const double *p, const double *grad_p, const double *u, const double *v, const double *w, const double *porosity, 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 *mom_v_source, double *mom_w_source, double *dmom_u_source_u, double *dmom_u_source_v, double *dmom_u_source_w, double *dmom_v_source_u, double *dmom_v_source_v, double *dmom_v_source_w, 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 Ftilde, Kinv, uc;
  for (k = 0; k < nPoints; k++) {
    mom_u_acc[k] = porosity[k] * rho * u[k];
    dmom_u_acc_u[k] = porosity[k] * rho;
    mom_v_acc[k] = porosity[k] * rho * v[k];
    dmom_v_acc_v[k] = porosity[k] * rho;
    mom_w_acc[k] = porosity[k] * rho * w[k];
    dmom_w_acc_w[k] = porosity[k] * rho;
    mass_adv[k * 3 + 0] = porosity[k] * u[k];
    mass_adv[k * 3 + 1] = porosity[k] * v[k];
    mass_adv[k * 3 + 2] = porosity[k] * w[k];
    dmass_adv_u[k * 3 + 0] = porosity[k];
    dmass_adv_v[k * 3 + 1] = porosity[k];
    dmass_adv_w[k * 3 + 2] = porosity[k];
    mom_u_adv[k * 3 + 0] = porosity[k] * rho * u[k] * u[k];
    mom_u_adv[k * 3 + 1] = porosity[k] * rho * u[k] * v[k];
    mom_u_adv[k * 3 + 2] = porosity[k] * rho * u[k] * w[k];
    dmom_u_adv_u[k * 3 + 0] = 2.0 * porosity[k] * rho * u[k];
    dmom_u_adv_u[k * 3 + 1] = porosity[k] * rho * v[k];
    dmom_u_adv_u[k * 3 + 2] = porosity[k] * rho * w[k];
    dmom_u_adv_v[k * 3 + 1] = porosity[k] * rho * u[k];
    dmom_u_adv_w[k * 3 + 2] = porosity[k] * rho * u[k];
    mom_v_adv[k * 3 + 0] = porosity[k] * rho * v[k] * u[k];
    mom_v_adv[k * 3 + 1] = porosity[k] * rho * v[k] * v[k];
    mom_v_adv[k * 3 + 2] = porosity[k] * rho * v[k] * w[k];
    dmom_v_adv_u[k * 3 + 0] = porosity[k] * rho * v[k];
    dmom_v_adv_w[k * 3 + 2] = porosity[k] * rho * v[k];
    dmom_v_adv_v[k * 3 + 0] = porosity[k] * rho * u[k];
    dmom_v_adv_v[k * 3 + 1] = 2.0 * porosity[k] * rho * v[k];
    dmom_v_adv_v[k * 3 + 2] = porosity[k] * rho * w[k];
    mom_w_adv[k * 3 + 0] = porosity[k] * rho * w[k] * u[k];
    mom_w_adv[k * 3 + 1] = porosity[k] * rho * w[k] * v[k];
    mom_w_adv[k * 3 + 2] = porosity[k] * rho * w[k] * w[k];
    dmom_w_adv_u[k * 3 + 0] = porosity[k] * rho * w[k];
    dmom_w_adv_v[k * 3 + 1] = porosity[k] * rho * w[k];
    dmom_w_adv_w[k * 3 + 0] = porosity[k] * rho * u[k];
    dmom_w_adv_w[k * 3 + 1] = porosity[k] * rho * v[k];
    dmom_w_adv_w[k * 3 + 2] = 2.0 * porosity[k] * rho * w[k];
    mom_u_diff_ten[k * 9 + 0] = 2.0 * porosity[k] * mu;
    mom_u_diff_ten[k * 9 + 4] = porosity[k] * mu;
    mom_u_diff_ten[k * 9 + 8] = porosity[k] * mu;
    mom_uv_diff_ten[k * 9 + 3] = porosity[k] * mu;
    mom_uw_diff_ten[k * 9 + 6] = porosity[k] * mu;
    mom_v_diff_ten[k * 9 + 0] = porosity[k] * mu;
    mom_v_diff_ten[k * 9 + 4] = 2.0 * porosity[k] * mu;
    mom_v_diff_ten[k * 9 + 8] = porosity[k] * mu;
    mom_vu_diff_ten[k * 9 + 1] = porosity[k] * mu;
    mom_vw_diff_ten[k * 9 + 7] = porosity[k] * mu;
    mom_w_diff_ten[k * 9 + 0] = porosity[k] * mu;
    mom_w_diff_ten[k * 9 + 4] = porosity[k] * mu;
    mom_w_diff_ten[k * 9 + 8] = 2.0 * porosity[k] * mu;
    mom_wu_diff_ten[k * 9 + 2] = porosity[k] * mu;
    mom_wv_diff_ten[k * 9 + 5] = porosity[k] * mu;
    uc = sqrt(u[k] * u[k] + v[k] * v[k] + w[k] * w[k]);
    if (fabs(1.0 - porosity[k]) < 1.0e-7)
      Ftilde = 0.0;
    else
      Ftilde = porosity[k] * meanGrainSize[k] * 1.0e-2 / (1.0 - porosity[k]) / mu;
    if (fabs(porosity[k]) < 1.0e-7)
      Kinv = 0.0;
    else
      Kinv = 180.0 * (1.0 - porosity[k]) * (1.0 - porosity[k]) / (meanGrainSize[k] * meanGrainSize[k] * porosity[k] * porosity[k] * porosity[k]);
    mom_u_source[k] = -porosity[k] * rho * g[0] + porosity[k] * porosity[k] * mu * Kinv * (1.0 + Ftilde * uc) * u[k];
    mom_v_source[k] = -porosity[k] * rho * g[1] + porosity[k] * porosity[k] * mu * Kinv * (1.0 + Ftilde * uc) * v[k];
    mom_w_source[k] = -porosity[k] * rho * g[2] + porosity[k] * porosity[k] * mu * Kinv * (1.0 + Ftilde * uc) * w[k];
    dmom_u_source_u[k] = porosity[k] * porosity[k] * mu * Kinv * (1.0 + Ftilde * (uc + u[k] * u[k] / (uc + 1.0e-12)));
    dmom_u_source_v[k] = porosity[k] * porosity[k] * mu * Kinv * (0.0 + Ftilde * (v[k] * u[k] / (uc + 1.0e-12)));
    dmom_u_source_w[k] = porosity[k] * porosity[k] * mu * Kinv * (0.0 + Ftilde * (w[k] * u[k] / (uc + 1.0e-12)));
    dmom_v_source_v[k] = porosity[k] * porosity[k] * mu * Kinv * (1.0 + Ftilde * (uc + v[k] * v[k] / (uc + 1.0e-12)));
    dmom_v_source_u[k] = porosity[k] * porosity[k] * mu * Kinv * (0.0 + Ftilde * (u[k] * v[k] / (uc + 1.0e-12)));
    dmom_v_source_w[k] = porosity[k] * porosity[k] * mu * Kinv * (0.0 + Ftilde * (w[k] * v[k] / (uc + 1.0e-12)));
    dmom_w_source_w[k] = porosity[k] * porosity[k] * mu * Kinv * (1.0 + Ftilde * (uc + w[k] * w[k] / (uc + 1.0e-12)));
    dmom_w_source_u[k] = porosity[k] * porosity[k] * mu * Kinv * (0.0 + Ftilde * (u[k] * w[k] / (uc + 1.0e-12)));
    dmom_w_source_v[k] = porosity[k] * porosity[k] * mu * Kinv * (0.0 + Ftilde * (v[k] * w[k] / (uc + 1.0e-12)));
    mom_u_ham[k] = porosity[k] * grad_p[k * 3 + 0];
    dmom_u_ham_grad_p[k * 3 + 0] = porosity[k];
    mom_v_ham[k] = porosity[k] * grad_p[k * 3 + 1];
    dmom_v_ham_grad_p[k * 3 + 1] = porosity[k];
    mom_w_ham[k] = porosity[k] * grad_p[k * 3 + 2];
    dmom_w_ham_grad_p[k * 3 + 2] = porosity[k];
  }
}
```