user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<HSBtoRGB>:
  endbr64
  mov    %edx,%r8d
  test   %esi,%esi
  je     L38
  mov    $0xff,%edx
  sub    %esi,%edx
  imul   %r8d,%edx
  sar    $0x8,%edx
  movslq %edi,%rax
  imul   $0xffffffffb60b60b7,%rax,%rax
  shr    $0x20,%rax
  add    %edi,%eax
  sar    $0x8,%eax
  mov    %edi,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  imul   $0x168,%eax,%eax
  mov    %edi,%esi
  sub    %eax,%esi
  movslq %esi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %esi,%eax
  sar    $0x5,%eax
  sar    $0x1f,%esi
  sub    %esi,%eax
  cmp    $0x5,%eax
  ja     L73
  mov    %eax,%eax
  lea    D3(%rip),%rsi
  movslq (%rsi,%rax,4),%rax
  add    %rsi,%rax
  notrack jmp *%rax
  mov    %r8d,%eax
  sub    %edx,%eax
  imul   %edi,%eax
  movslq %eax,%rsi
  imul   $0xffffffff88888889,%rsi,%rsi
  shr    $0x20,%rsi
  add    %eax,%esi
  sar    $0x5,%esi
  sar    $0x1f,%eax
  sub    %eax,%esi
  mov    %edx,%eax
  lea    (%rsi,%rdx,1),%edx
L51:
  movslq %r8d,%r8
  mov    %r8,(%rcx)
  movslq %edx,%rdx
  mov    %rdx,0x8(%rcx)
  cltq
  mov    %rax,0x10(%rcx)
L38:
  ret
  movslq %edi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edi,%eax
  sar    $0x5,%eax
  mov    %edi,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  imul   $0x3c,%eax,%eax
  sub    %edi,%eax
  lea    0x3c(%rax),%eax
  mov    %r8d,%esi
  sub    %edx,%esi
  imul   %esi,%eax
  movslq %eax,%rsi
  imul   $0xffffffff88888889,%rsi,%rsi
  shr    $0x20,%rsi
  add    %eax,%esi
  sar    $0x5,%esi
  sar    $0x1f,%eax
  sub    %eax,%esi
  add    %edx,%esi
  mov    %edx,%eax
  mov    %r8d,%edx
  mov    %esi,%r8d
  jmp    L51
  mov    %r8d,%esi
  sub    %edx,%esi
  movslq %edi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edi,%eax
  sar    $0x5,%eax
  mov    %edi,%r9d
  sar    $0x1f,%r9d
  sub    %r9d,%eax
  imul   $0x3c,%eax,%eax
  sub    %eax,%edi
  imul   %esi,%edi
  movslq %edi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edi,%eax
  sar    $0x5,%eax
  sar    $0x1f,%edi
  sub    %edi,%eax
  add    %edx,%eax
  mov    %r8d,%esi
  mov    %edx,%r8d
  mov    %esi,%edx
  jmp    L51
  movslq %edi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edi,%eax
  sar    $0x5,%eax
  mov    %edi,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  imul   $0x3c,%eax,%eax
  sub    %edi,%eax
  lea    0x3c(%rax),%eax
  mov    %r8d,%esi
  sub    %edx,%esi
  imul   %esi,%eax
  movslq %eax,%rsi
  imul   $0xffffffff88888889,%rsi,%rsi
  shr    $0x20,%rsi
  add    %eax,%esi
  sar    $0x5,%esi
  sar    $0x1f,%eax
  sub    %eax,%esi
  mov    %r8d,%eax
  mov    %edx,%r8d
  lea    (%rsi,%rdx,1),%edx
  jmp    L51
  mov    %r8d,%esi
  sub    %edx,%esi
  movslq %edi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edi,%eax
  sar    $0x5,%eax
  mov    %edi,%r9d
  sar    $0x1f,%r9d
  sub    %r9d,%eax
  imul   $0x3c,%eax,%eax
  sub    %eax,%edi
  imul   %esi,%edi
  movslq %edi,%rsi
  imul   $0xffffffff88888889,%rsi,%rsi
  shr    $0x20,%rsi
  add    %edi,%esi
  sar    $0x5,%esi
  sar    $0x1f,%edi
  sub    %edi,%esi
  mov    %r8d,%eax
  lea    (%rsi,%rdx,1),%r8d
  jmp    L51
  movslq %edi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edi,%eax
  sar    $0x5,%eax
  mov    %edi,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  imul   $0x3c,%eax,%eax
  sub    %edi,%eax
  lea    0x3c(%rax),%esi
  mov    %r8d,%eax
  sub    %edx,%eax
  imul   %eax,%esi
  movslq %esi,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %esi,%eax
  sar    $0x5,%eax
  sar    $0x1f,%esi
  sub    %esi,%eax
  add    %edx,%eax
  jmp    L51
L73:
  mov    $0x0,%eax
  mov    $0x0,%edx
  mov    $0x0,%r8d
  jmp    L51
```

assistant: ```c
void HSBtoRGB(int32_t hue, int32_t sat, int32_t val, uint8_t out[]) {
  int r = 0, g = 0, b = 0;
  int base;
  if (sat == 0) {
    r = g = b = val;
  } else {
    base = ((255 - sat) * val) >> 8;
    switch ((hue % 360) / 60) {
    case 0:
      r = val;
      g = (((val - base) * hue) / 60) + base;
      b = base;
      break;
    case 1:
      r = (((val - base) * (60 - (hue % 60))) / 60) + base;
      g = val;
      b = base;
      break;
    case 2:
      r = base;
      g = val;
      b = (((val - base) * (hue % 60)) / 60) + base;
      break;
    case 3:
      r = base;
      g = (((val - base) * (60 - (hue % 60))) / 60) + base;
      b = val;
      break;
    case 4:
      r = (((val - base) * (hue % 60)) / 60) + base;
      g = base;
      b = val;
      break;
    case 5:
      r = val;
      g = base;
      b = (((val - base) * (60 - (hue % 60))) / 60) + base;
      break;
    }
    out[0] = (uint8_t)r;
    out[1] = (uint8_t)g;
    out[2] = (uint8_t)b;
  }
}
```