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

```asm
<bm_get_hsl>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %edi,%ebp
  mov    %rsi,%rdi
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <assert@plt>
  mov    %r13,%rdi
  call   <assert@plt>
  mov    %r12,%rdi
  call   <assert@plt>
  mov    %ebp,%edi
  lea    0x7(%rsp),%rcx
  lea    0x6(%rsp),%rdx
  lea    0x5(%rsp),%rsi
  call   <bm_get_rgb@plt>
  movzbl 0x7(%rsp),%edx
  movzbl 0x6(%rsp),%ecx
  movzbl 0x5(%rsp),%eax
  cmp    %cl,%dl
  movzbl %cl,%edi
  movzbl %cl,%ebx
  cmovae %edx,%edi
  movzbl %al,%ebp
  cmp    %al,%dil
  cmovae %edi,%ebp
  cmp    %cl,%dl
  cmovbe %edx,%ebx
  mov    %ebp,%esi
  cmp    %al,%bl
  cmova  %eax,%ebx
  sub    %bl,%sil
  jne    L21
  movq   $0x0,(%r14)
  pxor   %xmm1,%xmm1
  mov    $0x168,%edi
  movapd %xmm1,%xmm0
  call   <fmod@plt>
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  movsd  %xmm0,(%r14)
  ja     L70
L88:
  add    %ebx,%ebp
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebp,%xmm0
  mulsd  D124(%rip),%xmm0
  divsd  D99(%rip),%xmm0
  movsd  %xmm0,(%r12)
L89:
  movsd  %xmm1,0x0(%r13)
  movsd  D30(%rip),%xmm0
  movsd  (%r12),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  %xmm1,(%r12)
  mulsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x0(%r13)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L83
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L70:
  addsd  D54(%rip),%xmm0
  movsd  %xmm0,(%r14)
  jmp    L88
  nopw   0x0(%rax,%rax,1)
L21:
  cmp    %al,%dil
  jbe    L17
  cmp    %bpl,%cl
  je     L18
  cmp    %bpl,%dl
  je     L0
  movsd  (%r14),%xmm0
  movzbl %sil,%r15d
L118:
  mulsd  D115(%rip),%xmm0
  mov    $0x168,%edi
  call   <fmod@plt>
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  movsd  %xmm0,(%r14)
  ja     L52
  add    %ebx,%ebp
  pxor   %xmm0,%xmm0
  movsd  D99(%rip),%xmm3
  cvtsi2sd %ebp,%xmm0
  mulsd  D124(%rip),%xmm0
  divsd  %xmm3,%xmm0
  movsd  %xmm0,(%r12)
L103:
  addsd  %xmm0,%xmm0
  movsd  D136(%rip),%xmm2
  pxor   %xmm1,%xmm1
  cvtsi2sd %r15d,%xmm1
  subsd  %xmm2,%xmm0
  andpd  D51(%rip),%xmm0
  subsd  %xmm0,%xmm2
  divsd  %xmm2,%xmm1
  divsd  %xmm3,%xmm1
  jmp    L89
  nopw   0x0(%rax,%rax,1)
L0:
  sub    %ecx,%eax
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  movzbl %sil,%r15d
  cvtsi2sd %eax,%xmm0
  cvtsi2sd %r15d,%xmm1
  divsd  %xmm1,%xmm0
  addsd  D29(%rip),%xmm0
  movsd  %xmm0,(%r14)
  jmp    L118
  nopl   (%rax)
L52:
  addsd  D54(%rip),%xmm0
  add    %ebp,%ebx
  movsd  D99(%rip),%xmm3
  movsd  %xmm0,(%r14)
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebx,%xmm0
  mulsd  D124(%rip),%xmm0
  divsd  %xmm3,%xmm0
  movsd  %xmm0,(%r12)
  jmp    L103
  cs nopw 0x0(%rax,%rax,1)
L18:
  sub    %eax,%edx
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  movzbl %sil,%r15d
  cvtsi2sd %edx,%xmm0
  cvtsi2sd %r15d,%xmm1
  divsd  %xmm1,%xmm0
  addsd  D117(%rip),%xmm0
  movsd  %xmm0,(%r14)
  jmp    L118
  nopl   (%rax)
L17:
  sub    %edx,%ecx
  movzbl %sil,%r15d
  pxor   %xmm0,%xmm0
  mov    $0x6,%edi
  pxor   %xmm1,%xmm1
  cvtsi2sd %ecx,%xmm0
  cvtsi2sd %r15d,%xmm1
  divsd  %xmm1,%xmm0
  call   <fmod@plt>
  movsd  %xmm0,(%r14)
  jmp    L118
L83:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D124
type_infered: f64
name: disassemble_data
arguments: data_tag: D99
type_infered: f64
name: disassemble_data
arguments: data_tag: D30
type_infered: byte[8]
name: disassemble_data
arguments: data_tag: D54
type_infered: f64
name: disassemble_data
arguments: data_tag: D115
type_infered: f64
name: disassemble_data
arguments: data_tag: D136
type_infered: f64
name: disassemble_data
arguments: data_tag: D51
type_infered: qword[2]
name: disassemble_data
arguments: data_tag: D29
type_infered: f64
name: disassemble_data
arguments: data_tag: D117
type_infered: f64

tool: D124: 0.5

tool: D99: 255

tool: {"D30": [0x00,0x00,0x00,0x00,0x00,0x00,0x59,0x40]}

tool: D54: 360

tool: D115: 60

tool: D136: 1

tool: {"D51": [0x7fffffffffffffff,0x0000000000000000]}

tool: D29: 4

tool: D117: 2

assistant: ```c
void bm_get_hsl(unsigned int col, double *H, double *S, double *L) {
  unsigned char R, G, B, M, m, C;
  assert(H);
  assert(S);
  assert(L);
  bm_get_rgb(col, &R, &G, &B);
  M = (((R) > ((((G) > (B)) ? (G) : (B)))) ? (R) : ((((G) > (B)) ? (G) : (B))));
  m = (((R) < ((((G) < (B)) ? (G) : (B)))) ? (R) : ((((G) < (B)) ? (G) : (B))));
  C = M - m;
  if (C == 0) {
    *H = 0;
  } else if (M == R) {
    *H = fmod((double)(G - B) / C, 6);
  } else if (M == G) {
    *H = (double)(B - R) / C + 2.0;
  } else if (M == B) {
    *H = (double)(R - G) / C + 4.0;
  }
  *H = fmod(*H * 60.0, 360);
  if (*H < 0)
    *H = 360.0 + *H;
  *L = 0.5 * (M + m) / 255.0;
  if (C == 0) {
    *S = 0;
  } else {
    *S = (double)C / (1.0 - fabs(2.0 * *L - 1.0)) / 255.0;
  }
  *L *= 100;
  *S *= 100;
}
```