user: 请从给定的汇编指令推导出C源代码:

```asm
<d_to_h>:
  endbr64
  push   %rbp
  mov    %esi,%ecx
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rsi
  mov    %rsi,0x28(%rsp)
  xor    %esi,%esi
  movl   $0x23,(%rsp)
  test   %edi,%edi
  je     L71
  mov    %edi,%eax
  sar    $0x1f,%edi
  shr    $0x1c,%edi
  lea    (%rax,%rdi,1),%esi
  and    $0xf,%esi
  sub    %edi,%esi
  lea    0x57(%rsi),%r8d
  lea    0x30(%rsi),%edi
  cmp    $0xa,%esi
  mov    %r8d,%esi
  cmovl  %edi,%esi
  test   %eax,%eax
  mov    %esi,0x8(%rsp)
  lea    0xf(%rax),%esi
  cmovs  %esi,%eax
  mov    %eax,%edi
  sar    $0x4,%edi
  je     L71
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rdi,%rax,1),%esi
  and    $0xf,%esi
  sub    %eax,%esi
  cmp    $0xa,%esi
  lea    0x57(%rsi),%r8d
  lea    0x30(%rsi),%eax
  cmovge %r8d,%eax
  test   %edi,%edi
  mov    %eax,0x4(%rsp)
  lea    0xf(%rdi),%eax
  cmovns %edi,%eax
  mov    %eax,%esi
  sar    $0x4,%esi
  je     L71
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  add    %eax,%esi
  and    $0xf,%esi
  sub    %eax,%esi
  lea    0x30(%rsi),%edi
  lea    0x57(%rsi),%eax
  cmp    $0x9,%esi
  cmovle %edi,%eax
  mov    %eax,(%rsp)
L71:
  test   %ecx,%ecx
  je     L131
  mov    %ecx,%esi
  sar    $0x1f,%esi
  shr    $0x1c,%esi
  lea    (%rcx,%rsi,1),%eax
  and    $0xf,%eax
  sub    %esi,%eax
  lea    0x57(%rax),%edi
  lea    0x30(%rax),%esi
  cmp    $0xa,%eax
  mov    %edi,%eax
  cmovl  %esi,%eax
  test   %ecx,%ecx
  mov    %eax,0x10(%rsp)
  lea    0xf(%rcx),%eax
  cmovns %ecx,%eax
  mov    %eax,%esi
  sar    $0x4,%esi
  je     L131
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rsi,%rax,1),%ecx
  and    $0xf,%ecx
  sub    %eax,%ecx
  cmp    $0xa,%ecx
  lea    0x57(%rcx),%edi
  lea    0x30(%rcx),%eax
  cmovge %edi,%eax
  test   %esi,%esi
  mov    %eax,0xc(%rsp)
  lea    0xf(%rsi),%eax
  cmovns %esi,%eax
  mov    %eax,%esi
  sar    $0x4,%esi
  je     L131
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rsi,%rax,1),%ecx
  and    $0xf,%ecx
  sub    %eax,%ecx
  cmp    $0xa,%ecx
  lea    0x57(%rcx),%edi
  lea    0x30(%rcx),%eax
  cmovge %edi,%eax
  test   %esi,%esi
  mov    %eax,0x8(%rsp)
  lea    0xf(%rsi),%eax
  cmovns %esi,%eax
  mov    %eax,%esi
  sar    $0x4,%esi
  je     L131
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rsi,%rax,1),%ecx
  and    $0xf,%ecx
  sub    %eax,%ecx
  cmp    $0xa,%ecx
  lea    0x57(%rcx),%edi
  lea    0x30(%rcx),%eax
  cmovge %edi,%eax
  test   %esi,%esi
  mov    %eax,0x4(%rsp)
  lea    0xf(%rsi),%eax
  cmovns %esi,%eax
  mov    %eax,%ecx
  sar    $0x4,%ecx
  je     L131
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  add    %eax,%ecx
  and    $0xf,%ecx
  sub    %eax,%ecx
  lea    0x30(%rcx),%esi
  lea    0x57(%rcx),%eax
  cmp    $0x9,%ecx
  cmovle %esi,%eax
  mov    %eax,(%rsp)
L131:
  test   %edx,%edx
  je     L158
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  shr    $0x1c,%ecx
  lea    (%rdx,%rcx,1),%eax
  and    $0xf,%eax
  sub    %ecx,%eax
  lea    0x57(%rax),%esi
  lea    0x30(%rax),%ecx
  cmp    $0xa,%eax
  mov    %esi,%eax
  cmovl  %ecx,%eax
  test   %edx,%edx
  mov    %eax,0x18(%rsp)
  lea    0xf(%rdx),%eax
  cmovns %edx,%eax
  mov    %eax,%ecx
  sar    $0x4,%ecx
  je     L158
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rcx,%rax,1),%edx
  and    $0xf,%edx
  sub    %eax,%edx
  cmp    $0xa,%edx
  lea    0x57(%rdx),%esi
  lea    0x30(%rdx),%eax
  cmovge %esi,%eax
  test   %ecx,%ecx
  mov    %eax,0x14(%rsp)
  lea    0xf(%rcx),%eax
  cmovns %ecx,%eax
  mov    %eax,%ecx
  sar    $0x4,%ecx
  je     L158
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rcx,%rax,1),%edx
  and    $0xf,%edx
  sub    %eax,%edx
  cmp    $0xa,%edx
  lea    0x57(%rdx),%esi
  lea    0x30(%rdx),%eax
  cmovge %esi,%eax
  test   %ecx,%ecx
  mov    %eax,0x10(%rsp)
  lea    0xf(%rcx),%eax
  cmovns %ecx,%eax
  mov    %eax,%ecx
  sar    $0x4,%ecx
  je     L158
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rcx,%rax,1),%edx
  and    $0xf,%edx
  sub    %eax,%edx
  cmp    $0xa,%edx
  lea    0x57(%rdx),%esi
  lea    0x30(%rdx),%eax
  cmovge %esi,%eax
  test   %ecx,%ecx
  mov    %eax,0xc(%rsp)
  lea    0xf(%rcx),%eax
  cmovns %ecx,%eax
  mov    %eax,%ecx
  sar    $0x4,%ecx
  je     L158
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rcx,%rax,1),%edx
  and    $0xf,%edx
  sub    %eax,%edx
  cmp    $0xa,%edx
  lea    0x57(%rdx),%esi
  lea    0x30(%rdx),%eax
  cmovge %esi,%eax
  test   %ecx,%ecx
  mov    %eax,0x8(%rsp)
  lea    0xf(%rcx),%eax
  cmovns %ecx,%eax
  mov    %eax,%ecx
  sar    $0x4,%ecx
  je     L158
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%rcx,%rax,1),%edx
  and    $0xf,%edx
  sub    %eax,%edx
  cmp    $0xa,%edx
  lea    0x57(%rdx),%esi
  lea    0x30(%rdx),%eax
  cmovge %esi,%eax
  test   %ecx,%ecx
  mov    %eax,0x4(%rsp)
  lea    0xf(%rcx),%eax
  cmovns %ecx,%eax
  mov    %eax,%edx
  sar    $0x4,%edx
  je     L158
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  add    %eax,%edx
  and    $0xf,%edx
  sub    %eax,%edx
  lea    0x30(%rdx),%ecx
  lea    0x57(%rdx),%eax
  cmp    $0x9,%edx
  cmovle %ecx,%eax
  mov    %eax,(%rsp)
L158:
  mov    %rsp,%rbx
  lea    0x1c(%rsp),%rbp
  nop
L89:
  mov    (%rbx),%edi
  add    $0x4,%rbx
  call   <putchar@plt>
  cmp    %rbp,%rbx
  jne    L89
  lea    D2(%rip),%rdi
  call   <puts@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L69
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L69:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D2
type: string

tool: D2: 


assistant: ```c
int d_to_h(int r, int g, int b) {
  int final[7];
  int i, temp, temp1;
  final[0] = '#';
  temp = r;
  i = 2;
  while (temp != 0) {
    temp1 = temp % 16;
    if (temp1 < 10)
      temp1 += 48;
    else
      temp1 += 87;
    final[i--] = temp1;
    temp = temp / 16;
  }
  temp = g;
  i = 4;
  while (temp != 0) {
    temp1 = temp % 16;
    if (temp1 < 10)
      temp1 += 48;
    else
      temp1 += 87;
    final[i--] = temp1;
    temp = temp / 16;
  }
  temp = b;
  i = 6;
  while (temp != 0) {
    temp1 = temp % 16;
    if (temp1 < 10)
      temp1 += 48;
    else
      temp1 += 87;
    final[i--] = temp1;
    temp = temp / 16;
  }
  for (i = 0; i < 7; i++) {
    printf("%c", final[i]);
  }
  printf("\n\n");
  return 0;
}
```