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

```asm
<main>:
  endbr64
  push   %r13
  lea    D40(%rip),%rdi
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  lea    0xf(%rsp),%rsi
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  call   <scanf@plt>
  movzbl 0xf(%rsp),%eax
  cmp    $0x68,%al
  je     L186
L87:
  cmp    $0x64,%al
  je     L4
L61:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L152
  add    $0x68,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L186:
  lea    0x51(%rsp),%rbx
  lea    D1(%rip),%rdi
  mov    %rbx,%rsi
  call   <scanf@plt>
  mov    %rbx,%rdx
  lea    0x20(%rsp),%rsi
  lea    0x58(%rsp),%rdi
  jmp    L170
  cs nopw 0x0(%rax,%rax,1)
L20:
  movsbl %cl,%ecx
  mov    %ecx,(%rsi)
L182:
  add    $0x1,%rdx
  add    $0x4,%rsi
  cmp    %rdx,%rdi
  je     L27
L170:
  movzbl (%rdx),%eax
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  jbe    L20
  lea    -0x61(%rax),%ecx
  cmp    $0x5,%cl
  ja     L182
  sub    $0x57,%eax
  add    $0x1,%rdx
  add    $0x4,%rsi
  movsbl %al,%eax
  mov    %eax,-0x4(%rsi)
  cmp    %rdx,%rdi
  jne    L170
L27:
  mov    0x24(%rsp),%esi
  mov    0x2c(%rsp),%edx
  lea    D99(%rip),%rdi
  xor    %eax,%eax
  mov    0x34(%rsp),%ecx
  shl    $0x4,%esi
  shl    $0x4,%edx
  add    0x28(%rsp),%esi
  add    0x30(%rsp),%edx
  shl    $0x4,%ecx
  add    0x38(%rsp),%ecx
  mov    %esi,0x14(%rsp)
  movsbl %sil,%esi
  mov    %edx,0x18(%rsp)
  movsbl %dl,%edx
  mov    %ecx,0x1c(%rsp)
  movsbl %cl,%ecx
  call   <printf@plt>
  movzbl 0xf(%rsp),%eax
  jmp    L87
L4:
  lea    0x47(%rsp),%rbp
  lea    D1(%rip),%r13
  xor    %ebx,%ebx
  lea    0x4c(%rsp),%r12
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <scanf@plt>
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <scanf@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <scanf@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    $0x1,%r12d
  call   <strcat@plt>
  jmp    L161
  nopl   0x0(%rax)
L167:
  movslq %r12d,%rdx
  mov    0x10(%rsp,%rdx,4),%ecx
  lea    (%rcx,%rcx,4),%ecx
  lea    -0x30(%rax,%rcx,2),%eax
  mov    %eax,0x10(%rsp,%rdx,4)
L65:
  add    $0x1,%rbx
L161:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jle    L108
  movsbl 0x0(%rbp,%rbx,1),%eax
  cmp    $0x2c,%al
  jne    L167
  add    $0x1,%r12d
  jmp    L65
L108:
  movss  D33(%rip),%xmm4
  lea    0x10(%rsp),%rax
  lea    0x51(%rsp),%rdx
  movss  D96(%rip),%xmm3
  movss  D47(%rip),%xmm2
  lea    0x1c(%rsp),%rdi
L162:
  mov    0x4(%rax),%ecx
  cmp    $0x10,%ecx
  jle    L199
  pxor   %xmm0,%xmm0
  mov    %ecx,%esi
  pxor   %xmm1,%xmm1
  cvtsi2ss %ecx,%xmm0
  sar    $0x4,%esi
  cvtsi2ss %esi,%xmm1
  lea    0x57(%rsi),%ecx
  mulss  %xmm4,%xmm0
  subss  %xmm1,%xmm0
  mulss  %xmm3,%xmm0
  cmp    $0x9,%esi
  jg     L157
  lea    0x30(%rsi),%ecx
L157:
  comiss %xmm0,%xmm2
  mov    %esi,0x4(%rax)
  mov    %cl,0x1(%rdx)
  jbe    L127
  addss  D27(%rip),%xmm0
  cvttss2si %xmm0,%esi
L22:
  add    $0x4,%rax
  mov    %sil,0x2(%rdx)
  add    $0x2,%rdx
  cmp    %rdi,%rax
  jne    L162
  movsbl 0x54(%rsp),%ecx
  movsbl 0x53(%rsp),%edx
  lea    D37(%rip),%rdi
  movsbl 0x52(%rsp),%esi
  push   %rax
  movsbl 0x5f(%rsp),%eax
  push   %rax
  movsbl 0x66(%rsp),%r9d
  xor    %eax,%eax
  movsbl 0x65(%rsp),%r8d
  call   <printf@plt>
  pop    %rdx
  pop    %rcx
  jmp    L61
L199:
  cmpl   $0x9,(%rax)
  movb   $0x30,0x1(%rdx)
  lea    0x57(%rcx),%esi
  jg     L22
  lea    0x30(%rcx),%esi
  jmp    L22
L127:
  addss  D48(%rip),%xmm0
  cvttss2si %xmm0,%esi
  jmp    L22
L152:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D40
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D1
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D99
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D33
type_infered: byte[4]
name: extract_symbolic_data
arguments: data_tag: D96
type_infered: byte[4]
name: extract_symbolic_data
arguments: data_tag: D47
type_infered: byte[4]
name: extract_symbolic_data
arguments: data_tag: D27
type_infered: byte[4]
name: extract_symbolic_data
arguments: data_tag: D37
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D48
type_infered: byte[4]

tool: D40: %c

tool: D1: %s

tool: D99: rgb(%d, %d, %d)


tool: {"D33": [0x00,0x00,0x80,0x3d]}

tool: {"D96": [0x00,0x00,0x80,0x41]}

tool: {"D47": [0x00,0x00,0x20,0x41]}

tool: {"D27": [0x00,0x00,0x40,0x42]}

tool: D37: #%c%c%c%c%c%c


tool: {"D48": [0x00,0x00,0xae,0x42]}

assistant: ```c
int main() {
  char tip, hexa[7], decain[5], decain2[5];
  int i = 0, deca[4] = {0, 0, 0, 0}, hexanum[7], p = 1;
  float helper, tupezik;
  scanf("%c", &tip);
  if (tip == 'h') {
    scanf("%s", hexa);
    for (i = 0; i < 7; i++) {
      if (hexa[i] >= '0' && hexa[i] <= '9')
        hexanum[i] = hexa[i] - 48;
      if (hexa[i] >= 'a' && hexa[i] <= 'f')
        hexanum[i] = hexa[i] - 87;
    }
    for (i = 1; i < 4; i++) {
      deca[i] = hexanum[i * 2] + hexanum[i * 2 - 1] * 16;
    }
    printf("rgb(%d, %d, %d)\n", deca[1], deca[2], deca[3]);
  }
  if (tip == 'd') {
    scanf("%s", decain);
    scanf("%s", decain2);
    strcat(decain, decain2);
    scanf("%s", decain2);
    strcat(decain, decain2);
    for (i = 0; i < strlen(decain); i++) {
      if (decain[i] != ',')
        deca[p] = deca[p] * 10 + decain[i] - 48;
      else
        p++;
    }
    p = 0;
    for (i = 1; i <= 3; i++) {
      if (deca[i] > 16) {
        tupezik = deca[i];
        helper = tupezik / 16;
        deca[i] = deca[i] / 16;
        helper = (helper - deca[i]) * 16;
        if (deca[i] < 10) {
          hexa[i * 2 - 1] = deca[i] + 48;
        } else
          hexa[i * 2 - 1] = deca[i] + 87;
        if (helper < 10) {
          hexa[i * 2] = helper + 48;
        } else
          hexa[i * 2] = helper + 87;
      } else {
        hexa[i * 2 - 1] = '0';
        if (deca[i - 1] < 10) {
          hexa[i * 2] = deca[i] + 48;
        } else
          hexa[i * 2] = deca[i] + 87;
      }
    }
    printf("#%c%c%c%c%c%c\n", hexa[1], hexa[2], hexa[3], hexa[4], hexa[5], hexa[6]);
  }
  return 0;
}
```