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

```asm
<txt2html>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D56(%rip),%rax
  mov    %rax,-0x30(%rbp)
  lea    D60(%rip),%rax
  mov    %rax,-0x28(%rbp)
  lea    D20(%rip),%rax
  mov    %rax,-0x20(%rbp)
  lea    D38(%rip),%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x40(%rbp)
  movl   $0x0,-0x44(%rbp)
  cmpq   $0x0,-0x70(%rbp)
  jle    L31
  mov    -0x68(%rbp),%rax
  lea    D3(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L9
L82:
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x9f,%al
  jbe    L72
  movl   $0x6,-0x3c(%rbp)
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  lea    -0xf(%rbp),%rax
  lea    D51(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    -0xf(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L222
L72:
  mov    -0x58(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    $0x3e,%eax
  je     L175
  cmp    $0x3e,%eax
  jg     L44
  cmp    $0x3c,%eax
  je     L137
  cmp    $0x3c,%eax
  jg     L44
  cmp    $0xa,%eax
  je     L112
  cmp    $0x26,%eax
  je     L104
  jmp    L44
L137:
  movl   $0x4,-0x3c(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L222
L175:
  movl   $0x4,-0x3c(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L222
L104:
  movl   $0x5,-0x3c(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L222
L112:
  movl   $0x5,-0x3c(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  jmp    L222
L44:
  movl   $0x1,-0x3c(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x38(%rbp)
L222:
  mov    -0x3c(%rbp),%edx
  mov    -0x40(%rbp),%eax
  add    %edx,%eax
  cltq
  cmp    %rax,-0x70(%rbp)
  jle    L162
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x68(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x3c(%rbp),%eax
  cltq
  add    %rax,-0x68(%rbp)
  mov    -0x3c(%rbp),%eax
  add    %eax,-0x40(%rbp)
  addl   $0x1,-0x44(%rbp)
  addq   $0x1,-0x58(%rbp)
L9:
  mov    -0x44(%rbp),%eax
  cltq
  cmp    %rax,-0x60(%rbp)
  jle    L89
  mov    -0x40(%rbp),%eax
  cltq
  cmp    %rax,-0x70(%rbp)
  jg     L82
  jmp    L89
L162:
  nop
L89:
  mov    -0x68(%rbp),%rax
  lea    D3(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L18
L31:
  nop
L18:
  mov    -0x44(%rbp),%eax
  cltq
  cmp    %rax,-0x60(%rbp)
  jle    L172
  mov    -0x44(%rbp),%eax
  neg    %eax
  jmp    L110
L172:
  mov    -0x40(%rbp),%eax
L110:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L141
  call   <__stack_chk_fail@plt>
L141:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D56
data_type: string
name: disassemble_data
arguments: data_label: D60
data_type: string
name: disassemble_data
arguments: data_label: D20
data_type: string
name: disassemble_data
arguments: data_label: D38
data_type: string
name: disassemble_data
arguments: data_label: D3
data_type: string
name: disassemble_data
arguments: data_label: D51
data_type: string

tool: D56: &lt;

tool: D60: &gt;

tool: D20: &amp;

tool: D38: <BR>


tool: 

tool: D51: &#%d;

assistant: ```c
int txt2html(unsigned char *src, long srclen, unsigned char *dst, long dstlen) {
  int si, di, substrlen;
  unsigned char *substr;
  unsigned char tmpstr[7];
  unsigned char *lt = "&lt;";
  unsigned char *gt = "&gt;";
  unsigned char *amp = "&amp;";
  unsigned char *nl = "<BR>\n";
  di = 0;
  si = 0;
  if (dstlen < 0 + 0 + 1)
    goto term;
  strcpy(dst, "");
  dst += 0;
  di += 0;
  for (; si < srclen && di < dstlen; si++, src++) {
    if (*src >= 160) {
      substrlen = 6;
      sprintf(tmpstr, "&#%d;", *src);
      substr = tmpstr;
    } else
      switch (*src) {
      case '<':
        substrlen = 4;
        substr = lt;
        break;
      case '>':
        substrlen = 4;
        substr = gt;
        break;
      case '&':
        substrlen = 5;
        substr = amp;
        break;
      case '\n':
        substrlen = 5;
        substr = nl;
        break;
      default:
        substrlen = 1;
        substr = src;
      }
    if (substrlen + di <= dstlen - 0 - 1) {
      strncpy(dst, substr, substrlen);
      dst += substrlen;
      di += substrlen;
    } else {
      break;
    }
  }
  strcpy(dst, "");
  dst += 0;
  di += 0;
term:
  if (si < srclen) {
    return -si;
  } else {
    return di;
  }
}
```