user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<c_monochrome>:
  endbr64
  test   %esi,%esi
  je     L204
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %esi,%r14d
  mov    %edx,%r13d
  mov    %ecx,%ebx
  mov    $0x0,%ebp
  lea    D34(%rip),%r15
  jmp    L135
  mov    %ebp,%eax
  movzbl (%r12,%rax,1),%edx
  movzbl 0x1(%r12,%rax,1),%esi
  movzbl 0x2(%r12,%rax,1),%eax
  jmp    L41
  mov    %ebp,%edx
  movzbl (%r12,%rdx,1),%esi
  movzbl 0x1(%r12,%rdx,1),%eax
  movzbl 0x2(%r12,%rdx,1),%edx
  jmp    L41
  mov    %ebp,%eax
  movzbl (%r12,%rax,1),%esi
  movzbl 0x1(%r12,%rax,1),%edx
  movzbl 0x2(%r12,%rax,1),%eax
  jmp    L41
  mov    %ebp,%edx
  movzbl (%r12,%rdx,1),%eax
  movzbl 0x1(%r12,%rdx,1),%esi
  movzbl 0x2(%r12,%rdx,1),%edx
  jmp    L41
  mov    %ebp,%ecx
  movzbl (%r12,%rcx,1),%eax
  movzbl 0x1(%r12,%rcx,1),%edx
  movzbl 0x2(%r12,%rcx,1),%esi
  jmp    L41
L113:
  mov    %ebp,%ecx
  movzbl (%r12,%rcx,1),%edx
  movzbl 0x1(%r12,%rcx,1),%eax
  movzbl 0x2(%r12,%rcx,1),%esi
  jmp    L41
L25:
  mov    %ebp,%eax
  movzwl (%r12,%rax,1),%ecx
  mov    %ecx,%eax
  shr    $0x6,%ax
  and    $0x1f,%eax
  test   %r13b,%r13b
  jne    L49
  mov    %ecx,%edx
  and    $0x1f,%edx
  shr    $0xb,%cx
  mov    %ecx,%esi
L41:
  movzbl %dl,%edx
  pxor   %xmm0,%xmm0
  cvtsi2sd %edx,%xmm0
  mulsd  D19(%rip),%xmm0
  movzbl %al,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  mulsd  D11(%rip),%xmm1
  addsd  %xmm1,%xmm0
  movzbl %sil,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  mulsd  D33(%rip),%xmm1
  addsd  %xmm1,%xmm0
  call   <round@plt>
  cmp    $0x3,%bl
  je     L118
  cmp    $0x4,%bl
  je     L19
  cmp    $0x2,%bl
  je     L153
L203:
  movzbl %bl,%eax
  add    %eax,%ebp
  cmp    %ebp,%r14d
  jbe    L79
L135:
  cmp    $0x2,%bl
  jbe    L25
  cmp    $0x5,%r13b
  ja     L113
  movzbl %r13b,%eax
  movslq (%r15,%rax,4),%rax
  add    %r15,%rax
  notrack jmp *%rax
L49:
  mov    %ecx,%esi
  and    $0x1f,%esi
  shr    $0xb,%cx
  mov    %ecx,%edx
  jmp    L41
L19:
  test   %al,%al
  jne    L167
  mov    %ebp,%eax
  movl   $0x0,(%r12,%rax,1)
  jmp    L203
L167:
  movzbl %al,%eax
  mov    %ebp,%ecx
  mov    %eax,%edx
  shl    $0x8,%edx
  mov    %eax,%esi
  shl    $0x10,%esi
  or     %esi,%edx
  or     %edx,%eax
  or     $0xff000000,%eax
  mov    %eax,(%r12,%rcx,1)
  jmp    L203
L118:
  mov    %ebp,%edx
  mov    %al,(%r12,%rdx,1)
  mov    %al,0x1(%r12,%rdx,1)
  mov    %al,0x2(%r12,%rdx,1)
  jmp    L203
L153:
  movzbl %al,%ecx
  mov    %ebp,%esi
  mov    %ecx,%edx
  shl    $0xb,%edx
  shl    $0x6,%ecx
  or     %ecx,%edx
  movzbl %al,%eax
  or     %edx,%eax
  mov    %ax,(%r12,%rsi,1)
  jmp    L203
L79:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L204:
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D19
type: f64
name: unpack_data
arguments: data_label: D11
type: f64
name: unpack_data
arguments: data_label: D33
type: f64

tool: D19: 0.2126

tool: D11: 0.7152

tool: D33: 0.0722

assistant: ```c
void c_monochrome(char *pixels, unsigned int size, unsigned char color_order, unsigned char bytes_per_pixel) {
  unsigned int idx;
  unsigned char r;
  unsigned char g;
  unsigned char b;
  unsigned char m;
  unsigned short rgb565;
  for (idx = 0; idx < size; idx += bytes_per_pixel) {
    if (bytes_per_pixel >= 3) {
      switch (color_order) {
      case 1:
        r = *(pixels + idx);
        b = *(pixels + idx + 1);
        g = *(pixels + idx + 2);
        break;
      case 2:
        b = *(pixels + idx);
        g = *(pixels + idx + 1);
        r = *(pixels + idx + 2);
        break;
      case 3:
        b = *(pixels + idx);
        r = *(pixels + idx + 1);
        g = *(pixels + idx + 2);
        break;
      case 4:
        g = *(pixels + idx);
        b = *(pixels + idx + 1);
        r = *(pixels + idx + 2);
        break;
      case 5:
        g = *(pixels + idx);
        r = *(pixels + idx + 1);
        b = *(pixels + idx + 2);
        break;
      default:
        r = *(pixels + idx);
        g = *(pixels + idx + 1);
        b = *(pixels + idx + 2);
      }
    } else {
      rgb565 = *((unsigned short *)(pixels + idx));
      g = (rgb565 >> 6) & 31;
      if (color_order == 0) {
        r = rgb565 & 31;
        b = (rgb565 >> 11) & 31;
      } else {
        b = rgb565 & 31;
        r = (rgb565 >> 11) & 31;
      }
    }
    m = (unsigned char)round(0.2126 * r + 0.7152 * g + 0.0722 * b);
    switch (bytes_per_pixel) {
    case 4:
      if (m == 0) {
        *((unsigned int *)(pixels + idx)) = m | (m << 8) | (m << 16);
      } else {
        *((unsigned int *)(pixels + idx)) = m | (m << 8) | (m << 16) | 0xFF000000;
      }
      break;
    case 3:
      *(pixels + idx) = m;
      *(pixels + idx + 1) = m;
      *(pixels + idx + 2) = m;
      break;
    case 2:
      rgb565 = 0;
      rgb565 = (m << 11) | (m << 6) | m;
      *((unsigned short *)(pixels + idx)) = rgb565;
      break;
    }
  }
}
```