user: 请将以下的汇编代码转换成C语言代码：

```asm
<d_to_h>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L58
L11:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L12
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L12
  mov    -0x2c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%ebx
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <transform@plt>
  add    %ebx,%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L91
L12:
  mov    -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L91
  mov    -0x2c(%rbp),%eax
  cltd
  shr    $0x1c,%edx
  add    %edx,%eax
  and    $0xf,%eax
  sub    %edx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x2c(%rbp),%eax
  lea    0xf(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x4,%eax
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  jne    L108
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <transform_h@plt>
  mov    %al,-0x1e(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <transform_h@plt>
  mov    %al,-0x1d(%rbp)
  addl   $0x1,-0x28(%rbp)
  jmp    L0
L108:
  cmpl   $0x1,-0x28(%rbp)
  jne    L4
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <transform_h@plt>
  mov    %al,-0x1c(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <transform_h@plt>
  mov    %al,-0x1b(%rbp)
  addl   $0x1,-0x28(%rbp)
  jmp    L0
L4:
  cmpl   $0x2,-0x28(%rbp)
  jne    L0
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <transform_h@plt>
  mov    %al,-0x1a(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <transform_h@plt>
  mov    %al,-0x19(%rbp)
  addl   $0x1,-0x28(%rbp)
L0:
  movl   $0x0,-0x2c(%rbp)
L91:
  addl   $0x1,-0x30(%rbp)
L58:
  mov    -0x30(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L11
  movzbl -0x19(%rbp),%eax
  movsbl %al,%esi
  movzbl -0x1a(%rbp),%eax
  movsbl %al,%r8d
  movzbl -0x1b(%rbp),%eax
  movsbl %al,%edi
  movzbl -0x1c(%rbp),%eax
  movsbl %al,%ecx
  movzbl -0x1d(%rbp),%eax
  movsbl %al,%edx
  movzbl -0x1e(%rbp),%eax
  movsbl %al,%eax
  sub    $0x8,%rsp
  push   %rsi
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %eax,%esi
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  add    $0x10,%rsp
  nop
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L3
  call   <__stack_chk_fail@plt>
L3:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D0
data_type: string

tool: D0: #%c%c%c%c%c%c

assistant: ```c
void d_to_h(char *number, int lenght) {
  int count, total, current, written;
  char r[2], g[2], b[2];
  for (count = 0, total = 0, written = 0; count < lenght; count++) {
    if (number[count] >= '0' && number[count] <= '9') {
      total = total * 10 + transform(number[count]);
    } else {
      if (number[count] != ' ') {
        current = total % 16;
        total = total / 16;
        if (written == 0) {
          r[0] = transform_h(total);
          r[1] = transform_h(current);
          written++;
        } else if (written == 1) {
          g[0] = transform_h(total);
          g[1] = transform_h(current);
          written++;
        } else if (written == 2) {
          b[0] = transform_h(total);
          b[1] = transform_h(current);
          written++;
        }
        total = 0;
      }
    }
  }
  printf("#%c%c%c%c%c%c", r[0], r[1], g[0], g[1], b[0], b[1]);
}
```