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

```asm
<set_rgb16_lum_from_rgb16>:
  endbr64
  mov    %edi,%ecx
  mov    %edi,%eax
  pxor   %xmm0,%xmm0
  push   %r15
  sar    $0x10,%ecx
  push   %r14
  pxor   %xmm2,%xmm2
  pxor   %xmm4,%xmm4
  movzbl %cl,%ecx
  push   %r13
  mov    %esi,%edx
  push   %r12
  cvtsi2sd %ecx,%xmm0
  movzbl %ah,%ecx
  movzbl %dil,%eax
  push   %rbp
  cvtsi2sd %ecx,%xmm2
  movzbl %sil,%ebp
  lea    D32(%rip),%rdi
  push   %rbx
  cvtsi2sd %eax,%xmm4
  mov    %esi,%ebx
  movzbl %dh,%eax
  sar    $0x10,%ebx
  mov    %eax,%r12d
  movzbl %bl,%ebx
  sub    $0x8,%rsp
  movsd  D43(%rip),%xmm1
  movsd  D26(%rip),%xmm3
  mulsd  %xmm1,%xmm0
  mulsd  %xmm3,%xmm2
  addsd  %xmm2,%xmm0
  movsd  D51(%rip),%xmm2
  mulsd  %xmm2,%xmm4
  addsd  %xmm4,%xmm0
  pxor   %xmm4,%xmm4
  cvtsi2sd %eax,%xmm4
  cvttsd2si %xmm0,%r8d
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebx,%xmm0
  mulsd  %xmm3,%xmm4
  mov    %r8d,%edx
  mulsd  %xmm1,%xmm0
  addsd  %xmm4,%xmm0
  pxor   %xmm4,%xmm4
  cvtsi2sd %ebp,%xmm4
  mulsd  %xmm2,%xmm4
  addsd  %xmm4,%xmm0
  cvttsd2si %xmm0,%r9d
  pxor   %xmm0,%xmm0
  sub    %r9d,%edx
  add    %edx,%ebx
  add    %edx,%r12d
  add    %edx,%ebp
  mov    %ebx,%eax
  mov    %r12d,%ecx
  mov    %r12d,%r15d
  mov    %r12d,%r13d
  shl    $0x8,%ecx
  shl    $0x10,%eax
  mov    %ebx,%esi
  add    %ecx,%eax
  add    %ebp,%eax
  mov    %eax,%ecx
  sar    $0x10,%ecx
  cmp    %r12d,%ebx
  movzbl %cl,%ecx
  cmovle %ebx,%r15d
  cvtsi2sd %ecx,%xmm0
  movzbl %ah,%ecx
  movzbl %al,%eax
  cmp    %ebp,%r15d
  cmovg  %ebp,%r15d
  cmp    %r12d,%ebx
  cmovge %ebx,%r13d
  push   %r15
  mulsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cmp    %ebp,%r13d
  cvtsi2sd %ecx,%xmm1
  cmovl  %ebp,%r13d
  mov    %ebp,%ecx
  push   %r13
  mulsd  %xmm3,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  xor    %eax,%eax
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%r14d
  push   %r14
  push   %rdx
  mov    %r12d,%edx
  call   <printf@plt>
  add    $0x20,%rsp
  test   %r15d,%r15d
  js     L10
L37:
  cmp    $0xff,%r13d
  jg     L6
L9:
  shl    $0x10,%ebx
  shl    $0x8,%r12d
  add    $0x8,%rsp
  lea    (%rbx,%r12,1),%eax
  pop    %rbx
  add    %ebp,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L6:
  mov    %ebx,%eax
  mov    $0xff,%ecx
  sub    %r14d,%r13d
  sub    %r14d,%ecx
  sub    %r14d,%eax
  lea    D6(%rip),%rdi
  imul   %ecx,%eax
  cltd
  idiv   %r13d
  lea    (%rax,%r14,1),%ebx
  mov    %r12d,%eax
  sub    %r14d,%eax
  imul   %ecx,%eax
  cltd
  idiv   %r13d
  lea    (%rax,%r14,1),%r12d
  mov    %ebp,%eax
  sub    %r14d,%eax
  imul   %ecx,%eax
  cltd
  idiv   %r13d
  lea    (%rax,%r14,1),%ebp
  call   <puts@plt>
  jmp    L9
  nopw   0x0(%rax,%rax,1)
L10:
  mov    %ebx,%eax
  mov    %r14d,%ecx
  lea    D36(%rip),%rdi
  sub    %r14d,%eax
  sub    %r15d,%ecx
  imul   %r14d,%eax
  cltd
  idiv   %ecx
  lea    (%rax,%r14,1),%ebx
  mov    %r12d,%eax
  sub    %r14d,%eax
  imul   %r14d,%eax
  cltd
  idiv   %ecx
  lea    (%rax,%r14,1),%r12d
  mov    %ebp,%eax
  sub    %r14d,%eax
  imul   %r14d,%eax
  cltd
  idiv   %ecx
  lea    (%rax,%r14,1),%ebp
  call   <puts@plt>
  jmp    L37
```

tool_calls: name: disassemble_data
arguments: label: D32
type: string
name: disassemble_data
arguments: label: D43
type: f64
name: disassemble_data
arguments: label: D26
type: f64
name: disassemble_data
arguments: label: D51
type: f64
name: disassemble_data
arguments: label: D6
type: string
name: disassemble_data
arguments: label: D36
type: string

tool: D32: r=%3i, g=%3i, b=%3i, blum=%3i, tlum=%3i, diff=%3i, lum=%3i, max=%3i, min=%3i


tool: D43: 0.3

tool: D26: 0.59

tool: D51: 0.11

tool: D6: +

tool: D36: -

assistant: ```c
int set_rgb16_lum_from_rgb16(int base, int top) {
  const int botlum = (((base >> 16) & 0xff) * 0.3 + ((base >> 8) & 0xff) * 0.59 + (base & 0xff) * 0.11);
  const int toplum = (((top >> 16) & 0xff) * 0.3 + ((top >> 8) & 0xff) * 0.59 + (top & 0xff) * 0.11);
  const int diff = botlum - toplum;
  const int topr = ((top >> 16) & 0xff), topg = ((top >> 8) & 0xff), topb = (top & 0xff);
  int r = topr + diff;
  int g = topg + diff;
  int b = topb + diff;
  int lum = (((((r << 16) + (g << 8) + b) >> 16) & 0xff) * 0.3 + ((((r << 16) + (g << 8) + b) >> 8) & 0xff) * 0.59 + (((r << 16) + (g << 8) + b) & 0xff) * 0.11);
  int cmin = (((r) < ((((g) < (b)) ? (g) : (b)))) ? (r) : ((((g) < (b)) ? (g) : (b))));
  int cmax = (((r) > ((((g) > (b)) ? (g) : (b)))) ? (r) : ((((g) > (b)) ? (g) : (b))));
  printf("r=%3i, g=%3i, b=%3i, blum=%3i, tlum=%3i, diff=%3i, lum=%3i, max=%3i, min=%3i\n", r, g, b, botlum, toplum, diff, lum, cmax, cmin);
  if (cmin < 0) {
    r = lum + (((r - lum) * lum) / (lum - cmin));
    g = lum + (((g - lum) * lum) / (lum - cmin));
    b = lum + (((b - lum) * lum) / (lum - cmin));
    printf("-\n");
  }
  if (cmax > 255) {
    r = lum + (((r - lum) * (255 - lum)) / (cmax - lum));
    g = lum + (((g - lum) * (255 - lum)) / (cmax - lum));
    b = lum + (((b - lum) * (255 - lum)) / (cmax - lum));
    printf("+\n");
  }
  return ((r << 16) + (g << 8) + b);
}
```