user: Translate the below assembly code into C programming language:

```asm
<libirc_colorparser_irc2code>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r15
  mov    %esi,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x18(%rsp)
  movl   $0x0,0x1c(%rsp)
  movq   $0x0,0x20(%rsp)
  movl   $0x0,0x8(%rsp)
  lea    D56(%rip),%rbp
  jmp    L301
L218:
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L296
  mov    %rax,0x20(%rsp)
  movzbl (%r15),%eax
  test   %al,%al
  jne    L312
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  call   <libirc_colorparser_closetags@plt>
  jmp    L145
  test   %r12d,%r12d
  jne    L234
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  lea    D40(%rip),%r9
  lea    D26(%rip),%r8
  mov    $0x2,%ecx
  call   <libirc_colorparser_applymask@plt>
  jmp    L234
  test   %r12d,%r12d
  jne    L234
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  lea    D21(%rip),%r9
  lea    D38(%rip),%r8
  mov    $0x4,%ecx
  call   <libirc_colorparser_applymask@plt>
  jmp    L234
  test   %r12d,%r12d
  jne    L234
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  lea    D24(%rip),%r9
  lea    D13(%rip),%r8
  mov    $0x8,%ecx
  call   <libirc_colorparser_applymask@plt>
  jmp    L234
  test   %r12d,%r12d
  jne    L234
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  call   <libirc_colorparser_closetags@plt>
  jmp    L234
  movsbl 0x1(%rbx),%edi
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L57
L234:
  lea    0x1(%rbx),%rdx
  movzbl 0x1(%rbx),%eax
  test   %al,%al
  je     L171
L330:
  mov    %rdx,%rbx
L26:
  cmp    $0x1f,%al
  ja     L159
  movzbl %al,%edx
  movslq 0x0(%rbp,%rdx,4),%rdx
  add    %rbp,%rdx
  notrack jmp *%rdx
L57:
  movsbl 0x1(%rbx),%r14d
  sub    $0x30,%r14d
  movsbl 0x2(%rbx),%edi
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L138
  add    $0x1,%rbx
L251:
  cmpb   $0x2c,0x1(%rbx)
  je     L186
L243:
  test   %r12d,%r12d
  jne    L234
  cmp    $0xf,%r14d
  jg     L234
  jmp    L237
L138:
  lea    (%r14,%r14,4),%edx
  movsbl 0x2(%rbx),%eax
  lea    -0x30(%rax,%rdx,2),%r14d
  add    $0x2,%rbx
  jmp    L251
L186:
  movsbl 0x2(%rbx),%edi
  call   <isdigit@plt>
  test   %eax,%eax
  je     L243
  movsbl 0x2(%rbx),%eax
  sub    $0x30,%eax
  mov    %eax,0xc(%rsp)
  movsbl 0x3(%rbx),%edi
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L182
  add    $0x2,%rbx
L202:
  cmp    $0xf,%r14d
  setle  %dl
  mov    0xc(%rsp),%ecx
  cmp    $0xf,%ecx
  setle  %al
  test   %al,%dl
  je     L234
  test   %r12d,%r12d
  jne    L234
  cmp    $0xffffffff,%ecx
  cmove  0x8(%rsp),%ecx
  mov    %ecx,0x8(%rsp)
L237:
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  mov    0x8(%rsp),%r8d
  mov    %r14d,%ecx
  call   <libirc_colorparser_applycolor@plt>
  jmp    L234
L182:
  mov    0xc(%rsp),%eax
  lea    (%rax,%rax,4),%edx
  movsbl 0x3(%rbx),%eax
  lea    -0x30(%rax,%rdx,2),%eax
  mov    %eax,0xc(%rsp)
  add    $0x3,%rbx
  jmp    L202
L159:
  test   %r13,%r13
  je     L6
  mov    0x20(%rsp),%rdx
  lea    0x1(%rdx),%rcx
  mov    %rcx,0x20(%rsp)
  mov    %al,(%rdx)
  lea    0x1(%rbx),%rdx
  movzbl 0x1(%rbx),%eax
  test   %al,%al
  jne    L330
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  call   <libirc_colorparser_closetags@plt>
L145:
  mov    0x20(%rsp),%rax
  movb   $0x0,(%rax)
L296:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L195
  mov    %r13,%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L6:
  addl   $0x1,0x1c(%rsp)
  jmp    L234
L171:
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  call   <libirc_colorparser_closetags@plt>
  addl   $0x1,0x1c(%rsp)
  test   %r13,%r13
  jne    L145
L301:
  mov    0x1c(%rsp),%edi
  test   %edi,%edi
  jne    L218
  movzbl (%r15),%eax
  test   %al,%al
  je     L235
  mov    $0x0,%r13d
L312:
  mov    %r15,%rbx
  jmp    L26
L235:
  lea    0x1c(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x18(%rsp),%rdi
  call   <libirc_colorparser_closetags@plt>
  addl   $0x1,0x1c(%rsp)
  jmp    L301
L195:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D40
type_guessed: string
name: retrieve_data
arguments: label: D26
type_guessed: string
name: retrieve_data
arguments: label: D21
type_guessed: string
name: retrieve_data
arguments: label: D38
type_guessed: string
name: retrieve_data
arguments: label: D24
type_guessed: string
name: retrieve_data
arguments: label: D13
type_guessed: string

tool: D40: [/B]

tool: D26: [B]

tool: D21: [/U]

tool: D38: [U]

tool: D24: [/I]

tool: D13: [I]

assistant: ```c
char *libirc_colorparser_irc2code(const char *source, int strip) {
  unsigned int mask = 0, destlen = 0;
  char *destline = 0, *d = 0;
  const char *p;
  int current_color = 1, current_bg = 0;
  while (destline == 0) {
    if (destlen > 0) {
      if ((destline = malloc(destlen)) == 0)
        return 0;
      d = destline;
    }
    for (p = source; *p; p++) {
      switch (*p) {
      case 0x02:
        if (strip)
          continue;
        libirc_colorparser_applymask(&mask, &d, &destlen, (1 << 1), "[B]", "[/B]");
        break;
      case 0x1F:
        if (strip)
          continue;
        libirc_colorparser_applymask(&mask, &d, &destlen, (1 << 2), "[U]", "[/U]");
        break;
      case 0x16:
        if (strip)
          continue;
        libirc_colorparser_applymask(&mask, &d, &destlen, (1 << 3), "[I]", "[/I]");
        break;
      case 0x0F:
        if (strip)
          continue;
        libirc_colorparser_closetags(&mask, &d, &destlen);
        break;
      case 0x03:
        if (isdigit(p[1])) {
          int bgcolor = -1, color = p[1] - 0x30;
          p++;
          if (isdigit(p[1])) {
            color = color * 10 + (p[1] - 0x30);
            p++;
          }
          if (p[1] == ',' && isdigit(p[2])) {
            bgcolor = p[2] - 0x30;
            p += 2;
            if (isdigit(p[1])) {
              bgcolor = bgcolor * 10 + (p[1] - 0x30);
              p++;
            }
          }
          if (color <= 15 && bgcolor <= 15) {
            if (strip)
              continue;
            current_color = color;
            if (bgcolor != -1)
              current_bg = bgcolor;
            libirc_colorparser_applycolor(&mask, &d, &destlen, color, current_bg);
          }
        }
        break;
      default:
        if (destline)
          *d++ = *p;
        else
          destlen++;
        break;
      }
    }
    libirc_colorparser_closetags(&mask, &d, &destlen);
    destlen++;
  }
  *d = '\0';
  return destline;
}
```