user: Converte this assembly snippet into its equivalent C code:

```asm
<rgb_to_hsl_int>:
  endbr64
  push   %rbx
  mov    (%rsi),%r8d
  mov    %rdi,%rcx
  mov    (%rdi),%eax
  mov    (%rdx),%edi
  cmp    %r8d,%eax
  jbe    L51
  cmp    %edi,%eax
  mov    %edi,%r9d
  mov    %edi,%r10d
  cmovae %eax,%r9d
  cmp    %edi,%r8d
  cmovbe %r8d,%r10d
L48:
  lea    (%r10,%r9,1),%ebx
  pxor   %xmm0,%xmm0
  movsd  D28(%rip),%xmm2
  cvtsi2sd %rbx,%xmm0
  mov    %rbx,%r11
  movapd %xmm0,%xmm1
  mulsd  %xmm2,%xmm1
  cmp    %r9d,%r10d
  je     L101
  mov    %r9d,%ebx
  pxor   %xmm5,%xmm5
  movsd  D34(%rip),%xmm6
  movsd  D20(%rip),%xmm4
  sub    %r10d,%ebx
  cvtsi2sd %rbx,%xmm5
  comisd %xmm1,%xmm6
  movapd %xmm5,%xmm3
  mulsd  %xmm4,%xmm3
  jbe    L41
  divsd  %xmm0,%xmm3
  cmp    %eax,%r9d
  je     L122
L72:
  cmp    %r8d,%r9d
  je     L21
  sub    %r8d,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  divsd  %xmm5,%xmm0
  addsd  D16(%rip),%xmm0
L62:
  mulsd  D25(%rip),%xmm0
  addsd  %xmm2,%xmm3
  cvttsd2si %xmm3,%rax
  pxor   %xmm3,%xmm3
  comisd %xmm0,%xmm3
  ja     L100
  comisd %xmm4,%xmm0
  ja     L88
L20:
  addsd  %xmm2,%xmm0
  cvttsd2si %xmm0,%rdi
L120:
  addsd  %xmm2,%xmm1
  mov    %edi,(%rcx)
  pop    %rbx
  mov    %eax,(%rsi)
  cvttsd2si %xmm1,%rax
  mov    %eax,(%rdx)
  ret
  cs nopw 0x0(%rax,%rax,1)
L51:
  cmp    %edi,%r8d
  mov    %edi,%r9d
  mov    %edi,%r10d
  cmovae %r8d,%r9d
  cmp    %edi,%eax
  cmovbe %eax,%r10d
  jmp    L48
  nopl   0x0(%rax,%rax,1)
L41:
  mov    $0x1ff,%r10d
  pxor   %xmm0,%xmm0
  sub    %r11d,%r10d
  cvtsi2sd %r10,%xmm0
  divsd  %xmm0,%xmm3
  cmp    %eax,%r9d
  jne    L72
L122:
  sub    %edi,%r8d
  pxor   %xmm0,%xmm0
  cvtsi2sd %r8,%xmm0
  divsd  %xmm5,%xmm0
  jmp    L62
  nopl   0x0(%rax)
L101:
  xor    %eax,%eax
  xor    %edi,%edi
  jmp    L120
  xchg   %ax,%ax
L100:
  addsd  %xmm4,%xmm0
  addsd  %xmm2,%xmm0
  cvttsd2si %xmm0,%rdi
  jmp    L120
  nopw   0x0(%rax,%rax,1)
L88:
  subsd  %xmm4,%xmm0
  jmp    L20
  nopl   0x0(%rax)
L21:
  sub    %eax,%edi
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdi,%xmm0
  divsd  %xmm5,%xmm0
  addsd  D59(%rip),%xmm0
  jmp    L62
```

tool_calls: name: retrieve_data
arguments: label: D28
datatype: f64
name: retrieve_data
arguments: label: D34
datatype: f32[2]
name: retrieve_data
arguments: label: D20
datatype: f32[2]
name: retrieve_data
arguments: label: D16
datatype: f32[2]
name: retrieve_data
arguments: label: D25
datatype: f64
name: retrieve_data
arguments: label: D59
datatype: f64

tool: D28: 0.5

tool: {"D34": [0.0,3.5]}

tool: {"D20": [0.0,3.748046875]}

tool: {"D16": [0.0,2.25]}

tool: D25: 42.5

tool: D59: 2

assistant: ```c
void rgb_to_hsl_int(unsigned int *red, unsigned int *green, unsigned int *blue) {
  unsigned int r, g, b;
  double h, s, l;
  unsigned int min, max;
  unsigned int delta;
  r = *red;
  g = *green;
  b = *blue;
  if (r > g) {
    max = ((r) > (b) ? (r) : (b));
    ;
    min = ((g) < (b) ? (g) : (b));
    ;
  } else {
    max = ((g) > (b) ? (g) : (b));
    ;
    min = ((r) < (b) ? (r) : (b));
    ;
  }
  l = (max + min) / 2.0;
  if (max == min) {
    s = 0.0;
    h = 0.0;
  } else {
    delta = (max - min);
    if (l < 128)
      s = 255 * (double)delta / (double)(max + min);
    else
      s = 255 * (double)delta / (double)(511 - max - min);
    if (r == max)
      h = (g - b) / (double)delta;
    else if (g == max)
      h = 2 + (b - r) / (double)delta;
    else
      h = 4 + (r - g) / (double)delta;
    h = h * 42.5;
    if (h < 0)
      h += 255;
    else if (h > 255)
      h -= 255;
  }
  *red = ((int32_t)((h) + 0.5));
  *green = ((int32_t)((s) + 0.5));
  *blue = ((int32_t)((l) + 0.5));
}
```