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

```asm
<lmattoang>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    0x28(%rdi),%r13
  movq   %r13,%xmm5
  xorpd  D56(%rip),%xmm5
  movq   %xmm5,%r12
  movapd %xmm5,%xmm0
  call   <fabs@plt>
  cmp    $0x1,%eax
  jle    L43
  pxor   %xmm0,%xmm0
  movq   %r13,%xmm6
  comisd %xmm6,%xmm0
  seta   %al
  movzbl %al,%eax
  comisd %xmm0,%xmm6
  seta   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movq   %xmm2,%r12
L43:
  movq   %r12,%xmm0
  call   <asin@plt>
  movsd  %xmm0,0x8(%rbx)
  call   <cos@plt>
  call   <fabs@plt>
  test   %eax,%eax
  jle    L22
  movsd  0x8(%rbx),%xmm0
  call   <cos@plt>
  movsd  0x18(%rbp),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rsp)
  movapd %xmm1,%xmm0
  call   <fabs@plt>
  cmp    $0x1,%eax
  jle    L113
  pxor   %xmm0,%xmm0
  movsd  0x8(%rsp),%xmm3
  comisd %xmm0,%xmm3
  seta   %al
  movzbl %al,%eax
  comisd %xmm3,%xmm0
  seta   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movsd  %xmm2,0x8(%rsp)
L113:
  movsd  0x8(%rsp),%xmm0
  call   <asin@plt>
  movq   %xmm0,%r13
  movsd  %xmm0,(%rbx)
  call   <cos@plt>
  movq   %xmm0,%r12
  movsd  0x8(%rbx),%xmm0
  call   <cos@plt>
  movapd %xmm0,%xmm1
  movq   %r12,%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  0x20(%rbp),%xmm0
  pxor   %xmm2,%xmm2
  comisd %xmm0,%xmm2
  ja     L114
L112:
  movsd  0x10(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rsp)
  call   <fabs@plt>
  cmp    $0x1,%eax
  jle    L46
  pxor   %xmm0,%xmm0
  movsd  0x8(%rsp),%xmm4
  comisd %xmm0,%xmm4
  seta   %al
  movzbl %al,%eax
  comisd %xmm4,%xmm0
  seta   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  pxor   %xmm6,%xmm6
  cvtsi2sd %eax,%xmm6
  movsd  %xmm6,0x8(%rsp)
L46:
  movsd  0x8(%rsp),%xmm0
  call   <asin@plt>
  movq   %xmm0,%r13
  movsd  %xmm0,0x10(%rbx)
  call   <cos@plt>
  movq   %xmm0,%r12
  lea    0x18(%rsp),%rdi
  lea    0x10(%rsp),%rsi
  movsd  0x8(%rbx),%xmm0
  call   <sincos@plt>
  movsd  0x18(%rsp),%xmm6
  movsd  %xmm6,0x8(%rsp)
  movq   %r12,%xmm0
  mulsd  0x10(%rsp),%xmm0
  mulsd  0x40(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  ja     L66
L111:
  lea    0x18(%rsp),%r13
  lea    0x10(%rsp),%r14
  movsd  0x10(%rbx),%xmm0
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  mov    0x10(%rsp),%r12
  mov    0x18(%rsp),%r15
  mov    %r14,%rsi
  mov    %r13,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movq   %r15,%xmm0
  mulsd  0x8(%rsp),%xmm0
  mulsd  0x18(%rsp),%xmm0
  movq   %r12,%xmm1
  mulsd  0x10(%rsp),%xmm1
  addsd  %xmm1,%xmm0
  subsd  0x0(%rbp),%xmm0
  call   <fabs@plt>
  test   %eax,%eax
  jle    L103
L128:
  movsd  D8(%rip),%xmm0
  movapd %xmm0,%xmm1
  addsd  (%rbx),%xmm1
  movsd  %xmm1,(%rbx)
  movapd %xmm0,%xmm1
  subsd  0x8(%rbx),%xmm1
  movsd  %xmm1,0x8(%rbx)
  addsd  0x10(%rbx),%xmm0
  movsd  %xmm0,0x10(%rbx)
L41:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L114:
  movsd  D8(%rip),%xmm0
  movq   %r13,%xmm7
  subsd  %xmm7,%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L112
L66:
  movsd  D8(%rip),%xmm0
  movq   %r13,%xmm3
  subsd  %xmm3,%xmm0
  movsd  %xmm0,0x10(%rbx)
  jmp    L111
L103:
  movsd  0x8(%rbx),%xmm0
  call   <sin@plt>
  movsd  %xmm0,0x8(%rsp)
  mov    %r13,%r14
  lea    0x10(%rsp),%r15
  movsd  0x10(%rbx),%xmm0
  mov    %r15,%rsi
  mov    %r13,%rdi
  call   <sincos@plt>
  mov    0x10(%rsp),%r13
  mov    0x18(%rsp),%r12
  mov    %r15,%rsi
  mov    %r14,%rdi
  movsd  (%rbx),%xmm0
  call   <sincos@plt>
  movq   %r12,%xmm0
  mulsd  0x8(%rsp),%xmm0
  mulsd  0x10(%rsp),%xmm0
  movq   %r13,%xmm1
  mulsd  0x18(%rsp),%xmm1
  subsd  %xmm1,%xmm0
  subsd  0x8(%rbp),%xmm0
  call   <fabs@plt>
  test   %eax,%eax
  jg     L128
  jmp    L41
L22:
  movq   $0x0,0x10(%rbx)
  mov    0x0(%rbp),%r12
  movq   %r12,%xmm0
  call   <fabs@plt>
  cmp    $0x1,%eax
  jle    L132
  pxor   %xmm0,%xmm0
  movq   %r12,%xmm4
  comisd %xmm0,%xmm4
  seta   %al
  movzbl %al,%eax
  comisd %xmm4,%xmm0
  seta   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  pxor   %xmm3,%xmm3
  cvtsi2sd %eax,%xmm3
  movq   %xmm3,%r12
L132:
  movq   %r12,%xmm0
  call   <acos@plt>
  movsd  %xmm0,(%rbx)
  call   <sin@plt>
  xorpd  D56(%rip),%xmm0
  subsd  0x8(%rbp),%xmm0
  call   <fabs@plt>
  test   %eax,%eax
  jle    L41
  movsd  (%rbx),%xmm0
  xorpd  D56(%rip),%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L41
```

tool_calls: name: unpack_data
arguments: data_tag: D56
type: byte[16]
name: unpack_data
arguments: data_tag: D8
type: f64

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

tool: D8: 3.141592653589793

assistant: ```c
void lmattoang(double *r, double *a) {
  double temp;
  temp = -r[5];
  if (fabs(temp) > 1)
    temp = (temp > 0) - (temp < 0);
  a[1] = asin(temp);
  if (fabs(cos(a[1])) > 1e-30) {
    temp = r[3] / cos(a[1]);
    if (fabs(temp) > 1)
      temp = (temp > 0) - (temp < 0);
    a[0] = asin(temp);
    if (cos(a[0]) * cos(a[1]) * r[4] < 0)
      a[0] = 3.14159265358979323846264338327950 - a[0];
    temp = r[2] / cos(a[1]);
    if (fabs(temp) > 1)
      temp = (temp > 0) - (temp < 0);
    a[2] = asin(temp);
    if (cos(a[2]) * cos(a[1]) * r[8] < 0)
      a[2] = 3.14159265358979323846264338327950 - a[2];
    if (fabs(sin(a[1]) * sin(a[2]) * sin(a[0]) + cos(a[2]) * cos(a[0]) - r[0]) > 1e-30 || fabs(sin(a[1]) * sin(a[2]) * cos(a[0]) - cos(a[2]) * sin(a[0]) - r[1]) > 1e-30) {
      a[0] = 3.14159265358979323846264338327950 + a[0];
      a[1] = 3.14159265358979323846264338327950 - a[1];
      a[2] = 3.14159265358979323846264338327950 + a[2];
    }
  } else {
    a[2] = 0;
    temp = r[0];
    if (fabs(temp) > 1)
      temp = (temp > 0) - (temp < 0);
    a[0] = acos(temp);
    if (fabs(-sin(a[0]) - r[1]) > 1e-30)
      a[0] *= -1;
  }
}
```