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

```asm
<DerivePrincipalStresses>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    $0x3,%ecx
  mov    $0x1,%edx
  mov    $0x3,%esi
  mov    $0x1,%edi
  call   <dmatrix@plt>
  mov    %rax,-0x18(%rbp)
  mov    $0x3,%ecx
  mov    $0x1,%edx
  mov    $0x3,%esi
  mov    $0x1,%edi
  call   <dmatrix@plt>
  mov    %rax,-0x10(%rbp)
  mov    $0x3,%esi
  mov    $0x1,%edi
  call   <dvector@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    0x8(%rax),%rdx
  mov    -0x28(%rbp),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x28(%rbp),%rax
  lea    0x18(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  add    $0x10,%rax
  movsd  0x8(%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x28(%rbp),%rax
  lea    0x30(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  add    $0x18,%rax
  movsd  0x10(%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    0x10(%rax),%rdx
  mov    -0x28(%rbp),%rax
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    0x18(%rax),%rdx
  mov    -0x28(%rbp),%rax
  movsd  0x10(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x28(%rbp),%rax
  lea    0x18(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  add    $0x18,%rax
  movsd  0x10(%rdx),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    -0x18(%rbp),%rdx
  add    $0x10,%rdx
  mov    (%rdx),%rdx
  add    $0x8,%rdx
  movsd  0x10(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x18(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    -0x18(%rbp),%rdx
  add    $0x18,%rdx
  mov    (%rdx),%rdx
  add    $0x8,%rdx
  movsd  0x18(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x18(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    -0x18(%rbp),%rdx
  add    $0x18,%rdx
  mov    (%rdx),%rdx
  add    $0x10,%rdx
  movsd  0x18(%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <jacobi@plt>
  mov    -0x8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mov    -0x8(%rbp),%rax
  add    $0x8,%rax
  movq   D10(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mov    -0x8(%rbp),%rax
  add    $0x10,%rax
  movq   D10(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm0
  mov    -0x8(%rbp),%rax
  add    $0x18,%rax
  movq   D10(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <eigsrt@plt>
  mov    -0x8(%rbp),%rax
  add    $0x8,%rax
  movsd  (%rax),%xmm0
  mov    -0x8(%rbp),%rax
  add    $0x8,%rax
  movq   D10(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x10,%rax
  movsd  (%rax),%xmm0
  mov    -0x8(%rbp),%rax
  add    $0x10,%rax
  movq   D10(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x18,%rax
  movsd  (%rax),%xmm0
  mov    -0x8(%rbp),%rax
  add    $0x18,%rax
  movq   D10(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  movl   $0x0,-0x20(%rbp)
  jmp    L13
L34:
  mov    -0x20(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  movl   $0x0,-0x1c(%rbp)
  jmp    L29
L33:
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  add    $0x1,%rax
  shl    $0x3,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  movsd  (%rcx),%xmm0
  mov    -0x1c(%rbp),%eax
  cltq
  movsd  %xmm0,(%rdx,%rax,8)
  addl   $0x1,-0x1c(%rbp)
L29:
  cmpl   $0x2,-0x1c(%rbp)
  jle    L33
  addl   $0x1,-0x20(%rbp)
L13:
  cmpl   $0x2,-0x20(%rbp)
  jle    L34
  mov    -0x18(%rbp),%rax
  mov    $0x3,%r8d
  mov    $0x1,%ecx
  mov    $0x3,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <free_dmatrix@plt>
  mov    -0x10(%rbp),%rax
  mov    $0x3,%r8d
  mov    $0x1,%ecx
  mov    $0x3,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <free_dmatrix@plt>
  mov    -0x8(%rbp),%rax
  mov    $0x3,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <free_dvector@plt>
  mov    $0x1,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D10
data_type: byte[8]

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

assistant: ```c
int DerivePrincipalStresses(double stressTensor[3][3], double sp[3], double cn[3][3]) {
  double **a, **v, *d;
  int i, j;
  a = dmatrix(1, 3, 1, 3);
  v = dmatrix(1, 3, 1, 3);
  d = dvector(1, 3);
  a[1][1] = stressTensor[0][0];
  a[2][2] = stressTensor[1][1];
  a[3][3] = stressTensor[2][2];
  a[1][2] = stressTensor[0][1];
  a[1][3] = stressTensor[0][2];
  a[2][3] = stressTensor[1][2];
  a[2][1] = a[1][2];
  a[3][1] = a[1][3];
  a[3][2] = a[2][3];
  jacobi(a, d, v);
  d[1] *= -1.0f;
  d[2] *= -1.0f;
  d[3] *= -1.0f;
  eigsrt(d, v);
  d[1] *= -1.0f;
  d[2] *= -1.0f;
  d[3] *= -1.0f;
  for (i = 0; i < 3; i++) {
    sp[i] = d[i + 1];
    for (j = 0; j < 3; j++) {
      cn[i][j] = v[j + 1][i + 1];
    }
  }
  free_dmatrix(a, 1, 3, 1, 3);
  free_dmatrix(v, 1, 3, 1, 3);
  free_dvector(d, 1, 3);
  return (1);
}
```