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

```asm
<txt2html>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rsi,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %rcx,%rcx
  jle    L159
  mov    %rsi,%rbx
  mov    %rdi,%rbp
  lea    D67(%rip),%rsi
  mov    %rdx,%rdi
  mov    %rdx,%r13
  mov    %rcx,%r14
  call   <strcpy@plt>
  test   %rbx,%rbx
  jle    L9
  lea    0x0(%rbp,%rbx,1),%rax
  mov    $0x1,%r12d
  xor    %r11d,%r11d
  mov    %rax,0x8(%rsp)
  jmp    L84
  nopl   0x0(%rax)
L114:
  cmp    $0x3c,%dl
  je     L81
  ja     L25
  cmp    $0xa,%dl
  je     L123
  xor    %ebx,%ebx
  cmp    $0x26,%dl
  lea    D59(%rip),%rsi
  sete   %dl
  sete   %bl
  cmovne %rbp,%rsi
  movzbl %dl,%edx
  lea    0x1(,%rbx,4),%rbx
  lea    0x1(,%rdx,4),%edx
L72:
  lea    (%rdx,%r11,1),%r15d
  movslq %r15d,%rax
  cmp    %r14,%rax
  jge    L61
L21:
  mov    %r13,%rdi
  add    $0x1,%rbp
  add    %rbx,%r13
  mov    %r12,%rbx
  call   <strncpy@plt>
  mov    %r12d,%ecx
  add    $0x1,%r12
  cmp    0x8(%rsp),%rbp
  je     L127
  mov    %r15d,%r11d
L84:
  movzbl 0x0(%rbp),%edx
  lea    -0x1(%r12),%ecx
  cmp    $0x9f,%dl
  jbe    L114
  lea    0x21(%rsp),%r15
  lea    D37(%rip),%rsi
  mov    %ecx,0x14(%rsp)
  mov    $0x6,%ebx
  mov    %r15,%rdi
  mov    %r11d,0x10(%rsp)
  call   <sprintf@plt>
  mov    0x10(%rsp),%r11d
  mov    %r15,%rsi
  mov    0x14(%rsp),%ecx
  mov    $0x6,%edx
  lea    (%rdx,%r11,1),%r15d
  movslq %r15d,%rax
  cmp    %r14,%rax
  jl     L21
L61:
  movslq %ecx,%rbx
  mov    %r11d,%r14d
  mov    %rbx,%r15
L112:
  lea    D67(%rip),%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
  jmp    L152
  xchg   %ax,%ax
L25:
  xor    %ebx,%ebx
  cmp    $0x3e,%dl
  lea    D52(%rip),%rsi
  sete   %dl
  sete   %bl
  cmovne %rbp,%rsi
  movzbl %dl,%edx
  lea    0x1(%rbx,%rbx,2),%rbx
  lea    0x1(%rdx,%rdx,2),%edx
  jmp    L72
  nopw   0x0(%rax,%rax,1)
L123:
  mov    $0x5,%ebx
  lea    D4(%rip),%rsi
  mov    $0x5,%edx
  jmp    L72
  cs nopw 0x0(%rax,%rax,1)
L81:
  mov    $0x4,%ebx
  lea    D55(%rip),%rsi
  mov    $0x4,%edx
  jmp    L72
  cs nopw 0x0(%rax,%rax,1)
L159:
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  xor    %r15d,%r15d
L152:
  mov    %r15d,%r10d
  neg    %r10d
  cmp    %rbx,0x18(%rsp)
  cmovg  %r10d,%r14d
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L116
  add    $0x38,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L127:
  mov    %r15d,%r14d
  mov    %ecx,%r15d
  jmp    L112
L9:
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  xor    %r15d,%r15d
  jmp    L112
L116:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D67
data_type: string
name: parse_data
arguments: data_tag: D59
data_type: string
name: parse_data
arguments: data_tag: D37
data_type: string
name: parse_data
arguments: data_tag: D52
data_type: string
name: parse_data
arguments: data_tag: D4
data_type: string
name: parse_data
arguments: data_tag: D55
data_type: string

tool: 

tool: D59: &amp;

tool: D37: &#%d;

tool: D52: &gt;

tool: D4: <BR>


tool: D55: &lt;

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