user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x60,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x10(%rsp)
  movl   $0x0,0x14(%rsp)
  movl   $0x0,0x18(%rsp)
  movl   $0x0,0x1c(%rsp)
  lea    0xf(%rsp),%rsi
  lea    D14(%rip),%rdi
  call   <scanf@plt>
  cmpb   $0x68,0xf(%rsp)
  je     L38
L82:
  cmpb   $0x64,0xf(%rsp)
  je     L208
L199:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  mov    $0x0,%eax
  add    $0x60,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L38:
  lea    0x51(%rsp),%rbx
  mov    %rbx,%rsi
  lea    D85(%rip),%rdi
  call   <scanf@plt>
  mov    %rbx,%rdx
  lea    0x20(%rsp),%rcx
  lea    0x58(%rsp),%rdi
  jmp    L191
L94:
  lea    -0x61(%rax),%esi
  cmp    $0x5,%sil
  ja     L52
  movsbl %al,%eax
  sub    $0x57,%eax
  mov    %eax,(%rcx)
L52:
  add    $0x1,%rdx
  add    $0x4,%rcx
  cmp    %rdi,%rdx
  je     L51
L191:
  movzbl (%rdx),%eax
  lea    -0x30(%rax),%esi
  cmp    $0x9,%sil
  ja     L94
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,(%rcx)
  jmp    L52
L51:
  mov    0x24(%rsp),%esi
  shl    $0x4,%esi
  add    0x28(%rsp),%esi
  mov    %esi,0x14(%rsp)
  mov    0x2c(%rsp),%edx
  shl    $0x4,%edx
  add    0x30(%rsp),%edx
  mov    %edx,0x18(%rsp)
  mov    0x34(%rsp),%ecx
  shl    $0x4,%ecx
  add    0x38(%rsp),%ecx
  mov    %ecx,0x1c(%rsp)
  movsbl %cl,%ecx
  movsbl %dl,%edx
  movsbl %sil,%esi
  lea    D34(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L82
L208:
  lea    0x47(%rsp),%rbp
  mov    %rbp,%rsi
  lea    D85(%rip),%r12
  mov    %r12,%rdi
  call   <scanf@plt>
  lea    0x4c(%rsp),%rbx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    $0x0,%ebx
  mov    $0x1,%r12d
  jmp    L135
L85:
  add    $0x1,%r12d
L207:
  add    $0x1,%rbx
L135:
  mov    %rbp,%rdi
  call   <strlen@plt>
  cmp    %ebx,%eax
  jle    L125
  movzbl (%rbx,%rbp,1),%eax
  cmp    $0x2c,%al
  je     L85
  movslq %r12d,%rdx
  mov    0x10(%rsp,%rdx,4),%ecx
  lea    (%rcx,%rcx,4),%ecx
  movsbl %al,%eax
  lea    -0x30(%rax,%rcx,2),%eax
  mov    %eax,0x10(%rsp,%rdx,4)
  jmp    L207
L125:
  lea    0x10(%rsp),%rdi
  lea    0x51(%rsp),%rsi
  lea    0x57(%rsp),%r8
  mov    $0x10,%r9d
  movss  D64(%rip),%xmm4
  movss  D39(%rip),%xmm3
  movss  D9(%rip),%xmm2
  jmp    L54
L143:
  add    $0x57,%eax
  mov    %al,0x1(%rsi)
  jmp    L73
L157:
  addss  D91(%rip),%xmm0
  cvttss2si %xmm0,%eax
  mov    %al,0x2(%rsi)
  jmp    L151
L107:
  movb   $0x30,0x1(%rsi)
  lea    0x57(%rcx),%eax
  add    $0x30,%ecx
  cmpl   $0xa,(%rdi)
  cmovge %eax,%ecx
  mov    %cl,0x2(%rsi)
L151:
  add    $0x4,%rdi
  add    $0x2,%rsi
  cmp    %r8,%rsi
  je     L22
L54:
  mov    0x4(%rdi),%ecx
  cmp    $0x10,%ecx
  jle    L107
  mov    %ecx,%eax
  cltd
  idiv   %r9d
  mov    %eax,0x4(%rdi)
  pxor   %xmm0,%xmm0
  cvtsi2ss %ecx,%xmm0
  mulss  %xmm4,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ss %eax,%xmm1
  subss  %xmm1,%xmm0
  mulss  %xmm3,%xmm0
  cmp    $0x9f,%ecx
  jg     L143
  add    $0x30,%eax
  mov    %al,0x1(%rsi)
L73:
  comiss %xmm0,%xmm2
  jbe    L157
  addss  D44(%rip),%xmm0
  cvttss2si %xmm0,%eax
  mov    %al,0x2(%rsi)
  jmp    L151
L22:
  movsbl 0x54(%rsp),%ecx
  movsbl 0x53(%rsp),%edx
  movsbl 0x52(%rsp),%esi
  sub    $0x8,%rsp
  movsbl 0x5f(%rsp),%eax
  push   %rax
  movsbl 0x66(%rsp),%r9d
  movsbl 0x65(%rsp),%r8d
  lea    D47(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
  jmp    L199
L61:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D14
type_guessed: string
name: disassemble_data
arguments: data_tag: D85
type_guessed: string
name: disassemble_data
arguments: data_tag: D34
type_guessed: string
name: disassemble_data
arguments: data_tag: D64
type_guessed: byte[4]
name: disassemble_data
arguments: data_tag: D39
type_guessed: byte[4]
name: disassemble_data
arguments: data_tag: D9
type_guessed: byte[4]
name: disassemble_data
arguments: data_tag: D91
type_guessed: byte[4]
name: disassemble_data
arguments: data_tag: D44
type_guessed: byte[4]
name: disassemble_data
arguments: data_tag: D47
type_guessed: string

tool: D14: %c

tool: D85: %s

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


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

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

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

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

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

tool: D47: #%c%c%c%c%c%c


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;
}
```