user: Translate the below assembly code into C programming language:

```asm
<get_derivative_nac>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x128,%rsp
  mov    %rdi,0x80(%rsp)
  mov    %rsi,0x60(%rsp)
  mov    %edx,0xac(%rsp)
  mov    %rcx,%rax
  mov    %r8,0xa0(%rsp)
  mov    %r9,%rcx
  mov    0x160(%rsp),%r14
  mov    0x168(%rsp),%rdi
  mov    %rdi,0x48(%rsp)
  mov    0x170(%rsp),%rdx
  movsd  %xmm0,0x28(%rsp)
  mov    %fs:0x28,%rsi
  mov    %rsi,0x118(%rsp)
  xor    %esi,%esi
  movsd  (%rax),%xmm1
  movsd  0x20(%rax),%xmm10
  movsd  0x40(%rax),%xmm4
  movsd  0x28(%rax),%xmm6
  movsd  0x38(%rax),%xmm7
  movapd %xmm10,%xmm12
  mulsd  %xmm4,%xmm12
  movapd %xmm6,%xmm0
  mulsd  %xmm7,%xmm0
  subsd  %xmm0,%xmm12
  movsd  0x8(%rax),%xmm5
  movsd  0x30(%rax),%xmm3
  movsd  0x18(%rax),%xmm9
  movapd %xmm6,%xmm11
  mulsd  %xmm3,%xmm11
  movapd %xmm4,%xmm0
  mulsd  %xmm9,%xmm0
  subsd  %xmm0,%xmm11
  movsd  0x10(%rax),%xmm2
  movapd %xmm7,%xmm8
  mulsd  %xmm9,%xmm8
  movapd %xmm10,%xmm0
  mulsd  %xmm3,%xmm0
  subsd  %xmm0,%xmm8
  movapd %xmm1,%xmm0
  mulsd  %xmm12,%xmm0
  movapd %xmm5,%xmm13
  mulsd  %xmm11,%xmm13
  addsd  %xmm13,%xmm0
  movapd %xmm2,%xmm13
  mulsd  %xmm8,%xmm13
  addsd  %xmm13,%xmm0
  divsd  %xmm0,%xmm12
  movsd  %xmm12,0xd0(%rsp)
  divsd  %xmm0,%xmm11
  movsd  %xmm11,0xd8(%rsp)
  divsd  %xmm0,%xmm8
  movsd  %xmm8,0xe0(%rsp)
  movapd %xmm7,%xmm8
  mulsd  %xmm2,%xmm8
  movapd %xmm4,%xmm11
  mulsd  %xmm5,%xmm11
  subsd  %xmm11,%xmm8
  divsd  %xmm0,%xmm8
  movsd  %xmm8,0xe8(%rsp)
  mulsd  %xmm1,%xmm4
  movapd %xmm3,%xmm8
  mulsd  %xmm2,%xmm8
  subsd  %xmm8,%xmm4
  divsd  %xmm0,%xmm4
  movsd  %xmm4,0xf0(%rsp)
  mulsd  %xmm5,%xmm3
  mulsd  %xmm1,%xmm7
  subsd  %xmm7,%xmm3
  divsd  %xmm0,%xmm3
  movsd  %xmm3,0xf8(%rsp)
  movapd %xmm6,%xmm3
  mulsd  %xmm5,%xmm3
  movapd %xmm10,%xmm4
  mulsd  %xmm2,%xmm4
  subsd  %xmm4,%xmm3
  divsd  %xmm0,%xmm3
  movsd  %xmm3,0x100(%rsp)
  mulsd  %xmm9,%xmm2
  mulsd  %xmm1,%xmm6
  subsd  %xmm6,%xmm2
  divsd  %xmm0,%xmm2
  movsd  %xmm2,0x108(%rsp)
  mulsd  %xmm10,%xmm1
  mulsd  %xmm9,%xmm5
  subsd  %xmm5,%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x110(%rsp)
  lea    0xb0(%rsp),%r8
  mov    $0x0,%edi
  jmp    L216
L155:
  lea    (%rdi,%rax,1),%esi
  movslq %esi,%rsi
  movsd  0xd0(%rsp,%rsi,8),%xmm1
  mulsd  (%rdx,%rax,8),%xmm1
  addsd  %xmm1,%xmm0
L5:
  add    $0x1,%rax
  cmp    $0x3,%rax
  je     L107
L29:
  test   %rdx,%rdx
  jne    L155
  lea    (%rdi,%rax,1),%esi
  movslq %esi,%rsi
  movsd  0xd0(%rsp,%rsi,8),%xmm1
  mulsd  (%rcx,%rax,8),%xmm1
  addsd  %xmm1,%xmm0
  jmp    L5
L107:
  movsd  %xmm0,(%r9)
  add    $0x8,%r8
  add    $0x3,%edi
  cmp    $0x9,%edi
  je     L172
L216:
  mov    %r8,%r9
  mov    $0x0,%eax
  pxor   %xmm0,%xmm0
  jmp    L29
L172:
  lea    0xb0(%rsp),%rdi
  mov    0x48(%rsp),%rsi
  call   <get_C@plt>
  movsd  %xmm0,0x50(%rsp)
  mov    0xac(%rsp),%eax
  test   %eax,%eax
  jle    L49
  mov    %eax,%edi
  mov    %rdi,0x98(%rsp)
  imul   %eax,%eax
  lea    (%rax,%rax,8),%eax
  mov    %eax,0x88(%rsp)
  neg    %eax
  mov    %eax,0x7c(%rsp)
  movl   $0x0,0xa8(%rsp)
  movq   $0x0,0x90(%rsp)
  jmp    L59
L10:
  call   <sqrt@plt>
  movsd  %xmm0,0x40(%rsp)
  jmp    L101
L99:
  add    $0x1,%r15
  cmp    $0x3,%r15
  je     L202
L98:
  mov    %rbx,%rcx
  mov    0x8(%rsp),%rdx
  mov    %r15d,%esi
  mov    0x14(%rsp),%edi
  call   <get_A@plt>
  movsd  %xmm0,0x18(%rsp)
  mov    %rbx,%rcx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    0x14(%rsp),%edi
  call   <get_dA@plt>
  movsd  %xmm0,0x20(%rsp)
  mov    0x48(%rsp),%r8
  mov    0x8(%rsp),%rcx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    %r13d,%edi
  call   <get_dC@plt>
  movapd %xmm0,%xmm1
  movsd  0x30(%rsp),%xmm6
  movapd %xmm6,%xmm3
  movsd  0x18(%rsp),%xmm7
  mulsd  %xmm7,%xmm3
  movsd  0x50(%rsp),%xmm5
  movapd %xmm5,%xmm4
  mulsd  0x40(%rsp),%xmm4
  mulsd  0x38(%rsp),%xmm7
  movapd %xmm7,%xmm0
  movsd  0x20(%rsp),%xmm2
  mulsd  %xmm6,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm3,%xmm1
  divsd  %xmm5,%xmm1
  subsd  %xmm1,%xmm0
  divsd  %xmm4,%xmm0
  mulsd  0x28(%rsp),%xmm0
  movsd  %xmm0,0x0(%rbp,%r15,8)
  test   %r14d,%r14d
  jne    L99
  mov    0x5c(%rsp),%eax
  add    %r15d,%eax
  cltq
  divsd  %xmm4,%xmm3
  mulsd  0x28(%rsp),%xmm3
  mov    0x60(%rsp),%rcx
  movsd  %xmm3,(%rcx,%rax,8)
  jmp    L99
L202:
  add    $0x1,%r13d
  addl   $0x3,0x58(%rsp)
  add    $0x18,%rbp
  cmp    $0x3,%r13d
  je     L100
L141:
  mov    %rbx,%rcx
  mov    0x8(%rsp),%rdx
  mov    %r13d,%esi
  mov    0x6c(%rsp),%r15d
  mov    %r15d,%edi
  call   <get_A@plt>
  movsd  %xmm0,0x30(%rsp)
  mov    %rbx,%rcx
  mov    %r14d,%edx
  mov    %r13d,%esi
  mov    %r15d,%edi
  call   <get_dA@plt>
  movsd  %xmm0,0x38(%rsp)
  mov    0x58(%rsp),%eax
  add    0x68(%rsp),%eax
  mov    %eax,0x5c(%rsp)
  mov    $0x0,%r15d
  jmp    L98
L100:
  add    $0x1,%r14d
  mov    0x88(%rsp),%edi
  add    %edi,0x78(%rsp)
  mov    0x7c(%rsp),%esi
  add    %esi,0x68(%rsp)
  cmp    $0x3,%r14d
  je     L28
L214:
  mov    0x78(%rsp),%edx
  movslq %edx,%rax
  mov    0x80(%rsp),%rdi
  lea    (%rdi,%rax,8),%r15
  mov    %edx,0x58(%rsp)
  mov    $0x0,%r13d
  mov    %r15,%rbp
  jmp    L141
L28:
  mov    %rbx,%r15
  addq   $0x1,0x70(%rsp)
  mov    0x70(%rsp),%rax
  addl   $0x9,0x8c(%rsp)
  cmp    0x98(%rsp),%rax
  je     L173
L70:
  mov    0x70(%rsp),%rsi
  mov    %esi,0x14(%rsp)
  mov    0xa0(%rsp),%rax
  mov    0x90(%rsp),%rdi
  movsd  (%rax,%rdi,8),%xmm0
  mulsd  (%rax,%rsi,8),%xmm0
  pxor   %xmm4,%xmm4
  ucomisd %xmm0,%xmm4
  ja     L10
  sqrtsd %xmm0,%xmm0
  movsd  %xmm0,0x40(%rsp)
L101:
  mov    0x8c(%rsp),%eax
  mov    %eax,0x78(%rsp)
  movl   $0x0,0x68(%rsp)
  mov    $0x0,%r14d
  lea    0xb0(%rsp),%rax
  mov    %rax,0x8(%rsp)
  mov    %r15,%rbx
  jmp    L214
L173:
  mov    %rbx,%r14
  addq   $0x1,0x90(%rsp)
  mov    0x90(%rsp),%rax
  mov    0xac(%rsp),%esi
  add    %esi,0xa8(%rsp)
  cmp    0x98(%rsp),%rax
  je     L49
L59:
  mov    0x90(%rsp),%eax
  mov    %eax,0x6c(%rsp)
  mov    0xa8(%rsp),%eax
  lea    (%rax,%rax,8),%eax
  mov    %eax,0x8c(%rsp)
  movq   $0x0,0x70(%rsp)
  mov    %r14,%r15
  jmp    L70
L49:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L123
  add    $0x128,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L123:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void get_derivative_nac(double *ddnac, double *dnac, const int num_patom, const double *lattice, const double *mass, const double *q, const double *born, const double *dielectric, const double *q_direction, const double factor) {
  int i, j, k, l, m;
  double a, b, c, da, db, dc, volume, mass_sqrt;
  double q_cart[3], rec_lat[9];
  volume = lattice[0] * (lattice[4] * lattice[8] - lattice[5] * lattice[7]) + lattice[1] * (lattice[5] * lattice[6] - lattice[3] * lattice[8]) + lattice[2] * (lattice[3] * lattice[7] - lattice[4] * lattice[6]);
  rec_lat[0] = (lattice[4] * lattice[8] - lattice[5] * lattice[7]) / volume;
  rec_lat[1] = (lattice[5] * lattice[6] - lattice[3] * lattice[8]) / volume;
  rec_lat[2] = (lattice[3] * lattice[7] - lattice[4] * lattice[6]) / volume;
  rec_lat[3] = (lattice[7] * lattice[2] - lattice[8] * lattice[1]) / volume;
  rec_lat[4] = (lattice[8] * lattice[0] - lattice[6] * lattice[2]) / volume;
  rec_lat[5] = (lattice[6] * lattice[1] - lattice[7] * lattice[0]) / volume;
  rec_lat[6] = (lattice[1] * lattice[5] - lattice[2] * lattice[4]) / volume;
  rec_lat[7] = (lattice[2] * lattice[3] - lattice[0] * lattice[5]) / volume;
  rec_lat[8] = (lattice[0] * lattice[4] - lattice[1] * lattice[3]) / volume;
  for (i = 0; i < 3; i++) {
    q_cart[i] = 0;
    for (j = 0; j < 3; j++) {
      if (q_direction) {
        q_cart[i] += rec_lat[i * 3 + j] * q_direction[j];
      } else {
        q_cart[i] += rec_lat[i * 3 + j] * q[j];
      }
    }
  }
  c = get_C(q_cart, dielectric);
  for (i = 0; i < num_patom; i++) {
    for (j = 0; j < num_patom; j++) {
      mass_sqrt = sqrt(mass[i] * mass[j]);
      for (k = 0; k < 3; k++) {
        for (l = 0; l < 3; l++) {
          a = get_A(i, l, q_cart, born);
          da = get_dA(i, l, k, born);
          for (m = 0; m < 3; m++) {
            b = get_A(j, m, q_cart, born);
            db = get_dA(j, m, k, born);
            dc = get_dC(l, m, k, q_cart, dielectric);
            ddnac[k * num_patom * num_patom * 9 + i * 9 * num_patom + j * 9 + l * 3 + m] = (da * b + db * a - a * b * dc / c) / (c * mass_sqrt) * factor;
            if (k == 0) {
              dnac[i * 9 * num_patom + j * 9 + l * 3 + m] = a * b / (c * mass_sqrt) * factor;
            }
          }
        }
      }
    }
  }
}
```