user: 请从给定的汇编指令推导出C源代码：

```asm
<rgb2yuv>:
  endbr64
  test   %esi,%esi
  jle    L26
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %esi,%r15d
  mov    %rdi,%r12
  mov    $0x0,%r14d
  jmp    L59
L63:
  movsd  D4(%rip),%xmm0
L69:
  movq   %rbp,%xmm7
  comisd D4(%rip),%xmm7
  ja     L118
  pxor   %xmm1,%xmm1
  comisd %xmm7,%xmm1
  jbe    L32
  movq   %xmm1,%rbp
  jmp    L32
L118:
  mov    D4(%rip),%rbp
L32:
  movq   %rbx,%xmm7
  comisd D4(%rip),%xmm7
  ja     L110
  pxor   %xmm1,%xmm1
  comisd %xmm7,%xmm1
  jbe    L95
  movq   %xmm1,%rbx
  jmp    L95
L110:
  mov    D4(%rip),%rbx
L95:
  call   <round@plt>
  mov    %al,0x0(%r13)
  movq   %rbp,%xmm0
  call   <round@plt>
  mov    %al,0x1(%r13)
  movq   %rbx,%xmm0
  call   <round@plt>
  mov    %al,0x2(%r13)
  add    $0x3,%r14d
  add    $0x3,%r12
  cmp    %r14d,%r15d
  jle    L56
L59:
  mov    %r12,%r13
  movzbl (%r12),%ecx
  shl    $0x10,%ecx
  movzbl 0x1(%r12),%edx
  shl    $0x10,%edx
  movzbl 0x2(%r12),%eax
  shl    $0x10,%eax
  sub    $0x8000,%ecx
  pxor   %xmm1,%xmm1
  cvtsi2sd %ecx,%xmm1
  sub    $0x8000,%edx
  pxor   %xmm4,%xmm4
  cvtsi2sd %edx,%xmm4
  sub    $0x8000,%eax
  pxor   %xmm3,%xmm3
  cvtsi2sd %eax,%xmm3
  movsd  D26(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D131(%rip),%xmm2
  mulsd  %xmm4,%xmm2
  addsd  %xmm2,%xmm0
  movsd  D107(%rip),%xmm2
  mulsd  %xmm3,%xmm2
  addsd  %xmm2,%xmm0
  divsd  D60(%rip),%xmm0
  addsd  D27(%rip),%xmm0
  movapd %xmm1,%xmm2
  mulsd  D116(%rip),%xmm2
  movapd %xmm4,%xmm5
  mulsd  D162(%rip),%xmm5
  subsd  %xmm5,%xmm2
  movsd  D20(%rip),%xmm6
  movapd %xmm3,%xmm5
  mulsd  %xmm6,%xmm5
  addsd  %xmm5,%xmm2
  divsd  D60(%rip),%xmm2
  movsd  D92(%rip),%xmm5
  addsd  %xmm5,%xmm2
  movq   %xmm2,%rbp
  mulsd  %xmm6,%xmm1
  mulsd  D62(%rip),%xmm4
  subsd  %xmm4,%xmm1
  mulsd  D143(%rip),%xmm3
  subsd  %xmm3,%xmm1
  divsd  D60(%rip),%xmm1
  addsd  %xmm5,%xmm1
  movq   %xmm1,%rbx
  comisd D4(%rip),%xmm0
  ja     L63
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  jbe    L69
  movapd %xmm1,%xmm0
  jmp    L69
L56:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L26:
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D4
type_guessed: byte[16]
name: retrieve_data
arguments: data_label: D26
type_guessed: f64
name: retrieve_data
arguments: data_label: D131
type_guessed: f64
name: retrieve_data
arguments: data_label: D107
type_guessed: f64
name: retrieve_data
arguments: data_label: D60
type_guessed: byte[8]
name: retrieve_data
arguments: data_label: D27
type_guessed: byte[8]
name: retrieve_data
arguments: data_label: D116
type_guessed: byte[8]
name: retrieve_data
arguments: data_label: D162
type_guessed: f64
name: retrieve_data
arguments: data_label: D20
type_guessed: f64
name: retrieve_data
arguments: data_label: D92
type_guessed: byte[8]
name: retrieve_data
arguments: data_label: D62
type_guessed: f64
name: retrieve_data
arguments: data_label: D143
type_guessed: f64

tool: {"D4": [0x00,0x00,0x00,0x00,0x00,0xe0,0x6f,0x40,0xb2,0x74,0xf4,0xae,0x30,0x33,0xcb,0x3f]}

tool: D26: 0.2124997

tool: D131: 0.7153988

tool: D107: 0.0721015

tool: {"D60": [0x00,0x00,0x00,0x00,0x50,0xa1,0xf2,0x40]}

tool: {"D27": [0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x40]}

tool: {"D116": [0x5f,0x73,0xb3,0xe4,0x96,0xfb,0xbd,0xbf]}

tool: D162: 0.3942953

tool: D20: 0.5114155

tool: {"D92": [0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x40]}

tool: D62: 0.4645915

tool: D143: 0.0468239

assistant: ```c
void rgb2yuv(unsigned char *img, int size) {
  int r, g, b, i;
  double y, u, v;
  for (i = 0; i < size; i += 3) {
    r = (int)img[i];
    g = (int)img[i + 1];
    b = (int)img[i + 2];
    r = (r << 16) - 32768;
    g = (g << 16) - 32768;
    b = (b << 16) - 32768;
    y = (0.2124997 * r + 0.7153988 * g + 0.0721015 * b) / 76309 + 16;
    u = (-0.1171202 * r - 0.3942953 * g + 0.5114155 * b) / 76309 + 128;
    v = (0.5114155 * r - 0.4645915 * g - 0.0468239 * b) / 76309 + 128;
    if (y > 255)
      y = 255;
    if (y < 0)
      y = 0;
    if (u > 255)
      u = 255;
    if (u < 0)
      u = 0;
    if (v > 255)
      v = 255;
    if (v < 0)
      v = 0;
    img[i] = (unsigned char)round(y);
    img[i + 1] = (unsigned char)round(u);
    img[i + 2] = (unsigned char)round(v);
  }
}
```