user: Please show me the C implementation that matches the assembly code listed below:

```asm
<calculate_force>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  movsd  %xmm0,(%rsp)
  mulsd  D9(%rip),%xmm0
  movsd  %xmm0,0x8(%rsp)
  test   %ecx,%ecx
  jle    L29
  mov    %rdi,%rax
  mov    %rdi,%rbx
  lea    -0x1(%rcx),%edi
  lea    (%rdi,%rdi,2),%rcx
  lea    0x18(%rax,%rcx,8),%rcx
L99:
  movq   $0x0,(%rax)
  movq   $0x0,0x8(%rax)
  movq   $0x0,0x10(%rax)
  add    $0x18,%rax
  cmp    %rcx,%rax
  jne    L99
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x20(%rsp)
  lea    0x8(%rsi,%rdi,8),%rax
  mov    %rax,0x28(%rsp)
  movsd  0x8(%rsp),%xmm7
  xorpd  D29(%rip),%xmm7
  movsd  %xmm7,0x10(%rsp)
  jmp    L13
L82:
  movsd  0x10(%rsp),%xmm5
  comisd %xmm0,%xmm5
  jbe    L46
  addsd  (%rsp),%xmm0
L46:
  mulsd  %xmm1,%xmm0
  addsd  (%rbx,%rax,1),%xmm0
  movsd  %xmm0,(%rbx,%rax,1)
  add    $0x8,%rax
  cmp    $0x18,%rax
  je     L63
L26:
  mov    0x0(%rbp),%rdx
  mov    (%rdx,%r14,1),%rdx
  mov    (%rdx,%rax,1),%rdx
  movsd  0x0(%r13,%rax,1),%xmm0
  subsd  (%rdx),%xmm0
  comisd 0x8(%rsp),%xmm0
  jbe    L82
  subsd  (%rsp),%xmm0
  jmp    L46
L63:
  add    $0x1,%r12
  lea    0x1(%r12),%eax
  cmp    %r15d,%eax
  jg     L18
L37:
  lea    0x1(%r12),%rax
  lea    0x0(,%rax,8),%r14
  mov    0x0(%rbp),%rdx
  mov    (%rdx,%rax,8),%rax
  movsd  (%rsp),%xmm0
  mov    (%rax),%rsi
  mov    %r13,%rdi
  call   <distance_periodic@plt>
  movsd  D41(%rip),%xmm2
  divsd  %xmm0,%xmm2
  movapd %xmm2,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  %xmm2,%xmm0
  movapd %xmm0,%xmm1
  mulsd  D39(%rip),%xmm1
  subsd  D9(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  mulsd  %xmm2,%xmm1
  mov    $0x0,%eax
  jmp    L26
L18:
  addq   $0x8,0x18(%rsp)
  mov    0x18(%rsp),%rax
  add    $0x18,%rbx
  addq   $0x18,0x20(%rsp)
  cmp    0x28(%rsp),%rax
  je     L29
L13:
  mov    0x18(%rsp),%rax
  mov    %rax,%rbp
  mov    (%rax),%rax
  mov    (%rax),%rax
  mov    (%rax),%rax
  cvttsd2si (%rax),%r15d
  test   %r15d,%r15d
  jle    L18
  mov    0x20(%rsp),%r13
  mov    $0x0,%r12d
  jmp    L37
L29:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D9
datatype: f64
name: extract_symbolic_data
arguments: data_tag: D29
datatype: byte[16]
name: extract_symbolic_data
arguments: data_tag: D41
datatype: f64
name: extract_symbolic_data
arguments: data_tag: D39
datatype: f64

tool: D9: 0.5

tool: {"D29": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: D41: 1

tool: D39: 48

assistant: ```c
void calculate_force(double forces[][3], double ****neighbor, double particles[][3], double region, int amount) {
  int i, j, k;
  double r = region / 2.;
  for (i = 0; i < amount; i++) {
    for (j = 0; j < 3; j++) {
      forces[i][j] = 0;
    }
  }
#pragma omp parallel for private(j, k)
  for (i = 0; i < amount; i++) {
    int neighbors = *neighbor[i][0][0];
    for (j = 1; j <= neighbors; j++) {
      double d = distance_periodic(particles[i], *neighbor[i][j], region);
      double di = 1. / d;
      double d3 = di * di * di;
      for (k = 0; k < 3; k++) {
        double dl = particles[i][k] - *neighbor[i][j][k];
        if (dl > r) {
          dl -= region;
        } else if (dl < -r) {
          dl += region;
        }
        forces[i][k] += 48. * d3 * (d3 - 0.5) * di * dl;
      }
    }
  }
#pragma omp barrier
}
```