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

```asm
<fz_saturation_rgb>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%r10
  mov    %rdx,%rsi
  mov    0x28(%rsp),%r12d
  mov    0x30(%rsp),%r11d
  mov    0x38(%rsp),%ebp
  cmp    %ecx,%r8d
  mov    %ecx,%ebx
  cmovle %r8d,%ebx
  cmp    %r9d,%ebx
  cmovg  %r9d,%ebx
  cmp    %ecx,%r8d
  mov    %ecx,%edx
  cmovge %r8d,%edx
  cmp    %r9d,%edx
  cmovl  %r9d,%edx
  cmp    %edx,%ebx
  je     L3
  cmp    %r12d,%r11d
  mov    %r12d,%eax
  cmovge %r11d,%eax
  cmp    %ebp,%eax
  cmovl  %ebp,%eax
  cmp    %r12d,%r11d
  cmovg  %r12d,%r11d
  cmp    %ebp,%r11d
  cmovg  %ebp,%r11d
  sub    %r11d,%eax
  shl    $0x10,%eax
  sub    %ebx,%edx
  mov    %edx,%r11d
  cltd
  idiv   %r11d
  imul   $0x4d,%ecx,%edx
  imul   $0x97,%r8d,%r11d
  add    %r11d,%edx
  imul   $0x1c,%r9d,%r11d
  lea    0x80(%rdx,%r11,1),%r11d
  sar    $0x8,%r11d
  sub    %r11d,%ecx
  imul   %eax,%ecx
  add    $0x8000,%ecx
  sar    $0x10,%ecx
  lea    (%rcx,%r11,1),%ebp
  mov    %r8d,%ebx
  sub    %r11d,%ebx
  imul   %eax,%ebx
  add    $0x8000,%ebx
  sar    $0x10,%ebx
  lea    (%rbx,%r11,1),%edx
  sub    %r11d,%r9d
  imul   %eax,%r9d
  add    $0x8000,%r9d
  sar    $0x10,%r9d
  lea    (%r9,%r11,1),%r8d
  mov    %ebp,%eax
  or     %edx,%eax
  or     %r8d,%eax
  test   $0x1,%ah
  je     L33
  cmp    %edx,%ebp
  mov    %edx,%eax
  cmovle %ebp,%eax
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  mov    %eax,%r12d
  cmp    %edx,%ebp
  cmovge %ebp,%edx
  cmp    %r8d,%edx
  cmovge %edx,%r8d
  mov    $0x10000,%ebp
  test   %eax,%eax
  js     L19
L14:
  mov    $0x10000,%eax
  cmp    $0xff,%r8d
  jle    L29
  mov    $0xff,%eax
  sub    %r11d,%eax
  shl    $0x10,%eax
  sub    %r11d,%r8d
  cltd
  idiv   %r8d
L29:
  cmp    %eax,%ebp
  cmovle %ebp,%eax
  imul   %eax,%ecx
  add    $0x8000,%ecx
  sar    $0x10,%ecx
  lea    (%rcx,%r11,1),%ebp
  imul   %eax,%ebx
  add    $0x8000,%ebx
  sar    $0x10,%ebx
  lea    (%rbx,%r11,1),%edx
  imul   %eax,%r9d
  add    $0x8000,%r9d
  sar    $0x10,%r9d
  lea    (%r9,%r11,1),%r8d
L33:
  mov    %ebp,(%rdi)
  mov    %edx,(%r10)
  mov    %r8d,(%rsi)
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L19:
  mov    %r11d,%eax
  shl    $0x10,%eax
  mov    %r11d,%r13d
  sub    %r12d,%r13d
  cltd
  idiv   %r13d
  mov    %eax,%ebp
  jmp    L14
L3:
  mov    %r8d,%ebp
  mov    %r8d,%edx
  jmp    L33
```

assistant: ```c
void fz_saturation_rgb(int *rd, int *gd, int *bd, int rb, int gb, int bb, int rs, int gs, int bs) {
  int minb, maxb;
  int mins, maxs;
  int y;
  int scale;
  int r, g, b;
  minb = ((rb) < (((gb) < (bb) ? (gb) : (bb))) ? (rb) : (((gb) < (bb) ? (gb) : (bb))));
  maxb = ((rb) > (((gb) > (bb) ? (gb) : (bb))) ? (rb) : (((gb) > (bb) ? (gb) : (bb))));
  if (minb == maxb) {
    *rd = gb;
    *gd = gb;
    *bd = gb;
    return;
  }
  mins = ((rs) < (((gs) < (bs) ? (gs) : (bs))) ? (rs) : (((gs) < (bs) ? (gs) : (bs))));
  maxs = ((rs) > (((gs) > (bs) ? (gs) : (bs))) ? (rs) : (((gs) > (bs) ? (gs) : (bs))));
  scale = ((maxs - mins) << 16) / (maxb - minb);
  y = (rb * 77 + gb * 151 + bb * 28 + 0x80) >> 8;
  r = y + ((((rb - y) * scale) + 0x8000) >> 16);
  g = y + ((((gb - y) * scale) + 0x8000) >> 16);
  b = y + ((((bb - y) * scale) + 0x8000) >> 16);
  if ((r | g | b) & 0x100) {
    int scalemin, scalemax;
    int min, max;
    min = ((r) < (((g) < (b) ? (g) : (b))) ? (r) : (((g) < (b) ? (g) : (b))));
    max = ((r) > (((g) > (b) ? (g) : (b))) ? (r) : (((g) > (b) ? (g) : (b))));
    if (min < 0)
      scalemin = (y << 16) / (y - min);
    else
      scalemin = 0x10000;
    if (max > 255)
      scalemax = ((255 - y) << 16) / (max - y);
    else
      scalemax = 0x10000;
    scale = ((scalemin) < (scalemax) ? (scalemin) : (scalemax));
    r = y + (((r - y) * scale + 0x8000) >> 16);
    g = y + (((g - y) * scale + 0x8000) >> 16);
    b = y + (((b - y) * scale + 0x8000) >> 16);
  }
  *rd = r;
  *gd = g;
  *bd = b;
}
```