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

```asm
<RGBtoHSP>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x38(%rbp),%rax
  movsd  0x8(%rax),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  movsd  0x10(%rax),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x8,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  add    $0x10,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x30(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  D34(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm2
  mulsd  %xmm0,%xmm2
  movsd  D59(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  movsd  -0x20(%rbp),%xmm0
  movapd %xmm0,%xmm2
  mulsd  %xmm0,%xmm2
  movsd  D8(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    -0x8(%rbp),%rdx
  mov    %rax,(%rdx)
  movsd  -0x30(%rbp),%xmm0
  ucomisd -0x28(%rbp),%xmm0
  jp     L92
  movsd  -0x30(%rbp),%xmm0
  ucomisd -0x28(%rbp),%xmm0
  jne    L92
  movsd  -0x30(%rbp),%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jp     L92
  movsd  -0x30(%rbp),%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jne    L92
  mov    -0x18(%rbp),%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x10(%rbp),%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L48
L92:
  movsd  -0x30(%rbp),%xmm0
  comisd -0x28(%rbp),%xmm0
  jb     L159
  movsd  -0x30(%rbp),%xmm0
  comisd -0x20(%rbp),%xmm0
  jb     L159
  movsd  -0x20(%rbp),%xmm0
  comisd -0x28(%rbp),%xmm0
  jb     L7
  movsd  -0x20(%rbp),%xmm0
  subsd  -0x28(%rbp),%xmm0
  movsd  -0x30(%rbp),%xmm1
  movapd %xmm1,%xmm2
  subsd  -0x28(%rbp),%xmm2
  movsd  D31(%rip),%xmm1
  mulsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D85(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x18(%rbp),%rax
  movsd  %xmm0,(%rax)
  movsd  -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x30(%rbp),%xmm1
  movsd  D85(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%rax
  movsd  %xmm0,(%rax)
  jmp    L48
L7:
  movsd  -0x28(%rbp),%xmm0
  subsd  -0x20(%rbp),%xmm0
  movsd  -0x30(%rbp),%xmm1
  movapd %xmm1,%xmm2
  subsd  -0x20(%rbp),%xmm2
  movsd  D31(%rip),%xmm1
  mulsd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  mov    -0x18(%rbp),%rax
  movsd  %xmm0,(%rax)
  movsd  -0x20(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x30(%rbp),%xmm1
  movsd  D85(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%rax
  movsd  %xmm0,(%rax)
  jmp    L48
L159:
  movsd  -0x28(%rbp),%xmm0
  comisd -0x30(%rbp),%xmm0
  jb     L86
  movsd  -0x28(%rbp),%xmm0
  comisd -0x20(%rbp),%xmm0
  jb     L86
  movsd  -0x30(%rbp),%xmm0
  comisd -0x20(%rbp),%xmm0
  jb     L42
  movsd  -0x30(%rbp),%xmm0
  subsd  -0x20(%rbp),%xmm0
  movsd  -0x28(%rbp),%xmm1
  movapd %xmm1,%xmm2
  subsd  -0x20(%rbp),%xmm2
  movsd  D31(%rip),%xmm1
  mulsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D107(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x18(%rbp),%rax
  movsd  %xmm0,(%rax)
  movsd  -0x20(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x28(%rbp),%xmm1
  movsd  D85(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%rax
  movsd  %xmm0,(%rax)
  jmp    L48
L42:
  movsd  -0x20(%rbp),%xmm0
  subsd  -0x30(%rbp),%xmm0
  movsd  -0x28(%rbp),%xmm1
  movapd %xmm1,%xmm2
  subsd  -0x30(%rbp),%xmm2
  movsd  D31(%rip),%xmm1
  mulsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D107(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x18(%rbp),%rax
  movsd  %xmm0,(%rax)
  movsd  -0x30(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x28(%rbp),%xmm1
  movsd  D85(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%rax
  movsd  %xmm0,(%rax)
  jmp    L48
L86:
  movsd  -0x28(%rbp),%xmm0
  comisd -0x30(%rbp),%xmm0
  jb     L23
  movsd  -0x28(%rbp),%xmm0
  subsd  -0x30(%rbp),%xmm0
  movsd  -0x20(%rbp),%xmm1
  movapd %xmm1,%xmm2
  subsd  -0x30(%rbp),%xmm2
  movsd  D31(%rip),%xmm1
  mulsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D13(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x18(%rbp),%rax
  movsd  %xmm0,(%rax)
  movsd  -0x30(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x20(%rbp),%xmm1
  movsd  D85(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%rax
  movsd  %xmm0,(%rax)
  jmp    L48
L23:
  movsd  -0x30(%rbp),%xmm0
  subsd  -0x28(%rbp),%xmm0
  movsd  -0x20(%rbp),%xmm1
  movapd %xmm1,%xmm2
  subsd  -0x28(%rbp),%xmm2
  movsd  D31(%rip),%xmm1
  mulsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D13(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mov    -0x18(%rbp),%rax
  movsd  %xmm0,(%rax)
  movsd  -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x20(%rbp),%xmm1
  movsd  D85(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x10(%rbp),%rax
  movsd  %xmm0,(%rax)
L48:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D34
datatype: byte[8]
name: unpack_data
arguments: label: D59
datatype: byte[8]
name: unpack_data
arguments: label: D8
datatype: byte[8]
name: unpack_data
arguments: label: D31
datatype: f64
name: unpack_data
arguments: label: D85
datatype: f64
name: unpack_data
arguments: label: D107
datatype: byte[8]
name: unpack_data
arguments: label: D13
datatype: byte[8]

tool: {"D34": [0x89,0x41,0x60,0xe5,0xd0,0x22,0xd3,0x3f]}

tool: {"D59": [0x62,0x10,0x58,0x39,0xb4,0xc8,0xe2,0x3f]}

tool: {"D8": [0xc9,0x76,0xbe,0x9f,0x1a,0x2f,0xbd,0x3f]}

tool: D31: 6

tool: D85: 1

tool: {"D107": [0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0x3f]}

tool: {"D13": [0x55,0x55,0x55,0x55,0x55,0x55,0xe5,0x3f]}

assistant: ```c
void RGBtoHSP(double RGB[], double HSP[]) {
  double R = RGB[0];
  double G = RGB[1];
  double B = RGB[2];
  double *H = HSP;
  double *S = HSP + 1;
  double *P = HSP + 2;
  *P = sqrt(R * R * .299 + G * G * .587 + B * B * .114);
  if (R == G && R == B) {
    *H = 0;
    *S = 0;
    return;
  }
  if (R >= G && R >= B) {
    if (B >= G) {
      *H = 1 - (B - G) / (6 * (R - G));
      *S = 1 - G / R;
    } else {
      *H = (G - B) / (6 * (R - B));
      *S = 1 - B / R;
    }
  } else if (G >= R && G >= B) {
    if (R >= B) {
      *H = 2. / 6. - (R - B) / (6 * (G - B));
      *S = 1 - B / G;
    } else {
      *H = 2. / 6. + (B - R) / (6 * (G - R));
      *S = 1 - R / G;
    }
  } else {
    if (G >= R) {
      *H = 4. / 6. - (G - R) / (6 * (B - R));
      *S = 1 - R / B;
    } else {
      *H = 4. / 6. + (R - G) / (6 * (B - G));
      *S = 1. - G / B;
    }
  }
}
```