user: Please show me the C implementation that matches the assembly code listed below:

```asm
<compress_javascript_chunk>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movb   $0x0,0x17(%rsp)
  test   %esi,%esi
  je     L520
  mov    %rdi,%r15
  mov    %esi,%ebx
  mov    %rdx,%r14
  xor    %ecx,%ecx
  xor    %r12d,%r12d
  lea    D12(%rip),%rbp
  jmp    L862
  nopl   (%rax)
L738:
  xor    %eax,%eax
  xor    %ecx,%ecx
L277:
  mov    %al,0x17(%rsp)
  test   %ebx,%ebx
  je     L134
L862:
  movzbl (%r15),%eax
  cmp    $0xa,%al
  je     L649
  cmp    $0x2f,%al
  je     L549
  jbe    L591
  cmp    $0x5c,%al
  je     L655
  jbe    L428
  lea    -0x7b(%rax),%edx
  and    $0xfd,%edx
  je     L1030
L172:
  cmp    $0x20,%cl
  je     L359
L759:
  mov    %r14,%rdx
  add    $0x1,%r12d
  add    $0x1,%r14
L1031:
  mov    %al,(%rdx)
  add    $0x1,%r15
  sub    $0x1,%ebx
  nopl   0x0(%rax)
L399:
  test   %r12d,%r12d
  je     L738
L735:
  movzbl -0x1(%r14),%ecx
  cmp    $0x1,%r12d
  jle    L761
  movzbl -0x2(%r14),%eax
  mov    %al,0x17(%rsp)
  test   %ebx,%ebx
  jne    L862
L134:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1023
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L428:
  cmp    $0x5b,%al
  jne    L172
L441:
  cmp    $0x20,%cl
  je     L901
  nopl   0x0(%rax)
L912:
  lea    0x1(%r14),%rcx
  lea    0x1(%r12),%esi
  cmp    $0x27,%al
  je     L370
L733:
  cmp    $0x5b,%al
  je     L451
  cmp    $0x22,%al
  mov    $0x22,%edx
  cmove  %edx,%r13d
L631:
  mov    %al,(%r14)
  lea    0x1(%r15),%rdx
  sub    $0x1,%ebx
  jne    L580
  jmp    L516
  nopl   (%rax)
L480:
  sub    $0x1,%ebx
  cmp    %r13b,%al
  je     L883
  mov    %al,(%rcx)
  mov    %r12d,%esi
  mov    %r14,%rcx
  mov    %r15,%rdx
L373:
  test   %ebx,%ebx
  je     L201
L580:
  movzbl (%rdx),%eax
  lea    0x1(%rdx),%r15
  lea    0x1(%rcx),%r14
  lea    0x1(%rsi),%r12d
  cmp    $0x5c,%al
  jne    L480
  movb   $0x5c,(%rcx)
  cmp    $0x1,%ebx
  je     L617
  movzbl 0x1(%rdx),%eax
  add    $0x2,%esi
  sub    $0x2,%ebx
  add    $0x2,%rcx
  add    $0x2,%rdx
  mov    %al,-0x1(%rcx)
  jmp    L373
  nopl   (%rax)
L591:
  cmp    $0x20,%al
  ja     L725
  cmp    $0x20,%cl
  je     L698
  cmp    $0xa,%cl
  je     L698
  movb   $0x20,(%r14)
  add    $0x1,%r12d
  add    $0x1,%r14
L698:
  add    $0x1,%r15
  sub    $0x1,%ebx
  jmp    L399
  cs nopw 0x0(%rax,%rax,1)
L725:
  cmp    $0x22,%al
  je     L441
  cmp    $0x27,%al
  jne    L172
  cmp    $0x20,%cl
  jne    L912
L901:
  mov    %r14,%rcx
  mov    %r12d,%esi
  sub    $0x1,%r14
  cmp    $0x27,%al
  jne    L733
L370:
  mov    $0x27,%r13d
  jmp    L631
  cs nopw 0x0(%rax,%rax,1)
L649:
  cmpb   $0x2d,0x1(%r15)
  jne    L669
  cmp    $0x3,%ebx
  jg     L905
L669:
  cmp    $0x20,%cl
  jne    L790
  movzbl 0x17(%rsp),%ecx
  sub    $0x1,%r14
  sub    $0x1,%r12d
L790:
  cmp    $0x3b,%cl
  jbe    L823
  sub    $0x7b,%ecx
  and    $0xfd,%ecx
  je     L698
L783:
  movb   $0xa,(%r14)
  add    $0x1,%r12d
  add    $0x1,%r14
  add    $0x1,%r15
  sub    $0x1,%ebx
  jmp    L399
  xchg   %ax,%ax
L883:
  mov    %r13b,(%rcx)
  jmp    L399
  nopl   0x0(%rax,%rax,1)
L617:
  xor    %ebx,%ebx
  jmp    L399
  nopw   0x0(%rax,%rax,1)
L823:
  movabs $0xf3fffffffffffbfe,%rax
  bt     %rcx,%rax
  jb     L783
  add    $0x1,%r15
  sub    $0x1,%ebx
  jmp    L399
  nopl   0x0(%rax)
L549:
  cmp    $0x1,%ebx
  jle    L1049
  movzbl 0x1(%r15),%eax
  cmp    $0x28,%al
  je     L366
  cmp    $0x2a,%al
  je     L1027
  cmp    $0x2f,%al
  je     L319
  movb   $0x2f,(%r14)
  add    $0x1,%r15
  add    $0x1,%r12d
  sub    $0x1,%ebx
  add    $0x1,%r14
L176:
  test   %r12d,%r12d
  jne    L735
  movb   $0x0,0x17(%rsp)
  xor    %ecx,%ecx
  jmp    L862
  xchg   %ax,%ax
L1030:
  cmp    $0x20,%cl
  je     L931
  cmp    $0xa,%cl
  jne    L759
L931:
  lea    -0x1(%r14),%rdx
  jmp    L1031
  nopw   0x0(%rax,%rax,1)
L655:
  movb   $0x5c,(%r14)
  lea    0x1(%r15),%rdx
  cmp    $0x1,%ebx
  jne    L302
  add    $0x1,%r14
  add    $0x1,%r12d
  mov    %rdx,%r15
L965:
  test   %r12d,%r12d
  je     L134
  xor    %ebx,%ebx
  jmp    L735
  nopl   0x0(%rax,%rax,1)
L302:
  movzbl 0x1(%r15),%eax
  lea    0x2(%r14),%rcx
  add    $0x2,%r15
  cmp    $0x20,%al
  jne    L713
  mov    %rdx,%r15
  mov    $0x9,%eax
L713:
  mov    %al,0x1(%r14)
  sub    $0x2,%ebx
  add    $0x2,%r12d
  mov    %rcx,%r14
  jmp    L399
  nopl   0x0(%rax)
L1049:
  movb   $0x2f,(%r14)
  add    $0x1,%r15
  add    $0x1,%r12d
  sub    $0x1,%ebx
  add    $0x1,%r14
  jmp    L399
  nopl   0x0(%rax,%rax,1)
L451:
  mov    $0x5d,%r13d
  jmp    L631
  nopl   0x0(%rax,%rax,1)
L905:
  xor    %eax,%eax
  mov    $0x4,%edx
  mov    %r15,%rdi
  mov    %cl,0xf(%rsp)
  lea    D69(%rip),%rsi
  call   <custom_strncmp@plt>
  movzbl 0xf(%rsp),%ecx
  test   %eax,%eax
  je     L522
  cmp    $0x20,%cl
  je     L683
L1050:
  cmp    $0x3b,%cl
  jbe    L963
  sub    $0x7b,%ecx
  and    $0xfd,%ecx
  jne    L381
L247:
  add    $0x1,%r15
  sub    $0x1,%ebx
  jmp    L176
  nopl   0x0(%rax)
L963:
  movabs $0xf3fffffffffffbfe,%rax
  bt     %rcx,%rax
  jae    L247
L381:
  movb   $0xa,(%r14)
  add    $0x1,%r12d
  add    $0x1,%r14
  jmp    L247
L366:
  movb   $0x2f,(%r14)
  movzbl 0x1(%r15),%edx
  lea    0x2(%r15),%rax
  lea    0x2(%r14),%rcx
  lea    0x2(%r12),%edi
  mov    %dl,0x1(%r14)
  sub    $0x2,%ebx
  jne    L536
  jmp    L908
  nopw   0x0(%rax,%rax,1)
L483:
  mov    %dl,-0x1(%rcx)
  test   %ebx,%ebx
  je     L279
L536:
  movzbl (%rax),%edx
  mov    %rax,%r15
  mov    %rcx,%rsi
  mov    %edi,%r9d
  lea    0x1(%rax),%rax
  lea    0x1(%rcx),%rcx
  sub    $0x1,%ebx
  lea    0x1(%rdi),%edi
  cmp    $0x29,%dl
  jne    L483
L42:
  mov    %dl,(%rsi)
  add    $0x1,%r15
  lea    0x1(%rsi),%r14
  lea    0x1(%r9),%r12d
  jmp    L399
L683:
  movzbl 0x17(%rsp),%ecx
  sub    $0x1,%r14
  sub    $0x1,%r12d
  jmp    L1050
  nopw   0x0(%rax,%rax,1)
L359:
  xor    %eax,%eax
  lea    0x17(%rsp),%rdi
  call   <javascript_concatenable@plt>
  test   %eax,%eax
  je     L1059
L531:
  movzbl (%r15),%eax
  lea    -0x1(%r14),%rdx
  jmp    L1031
  nopl   0x0(%rax)
L520:
  xor    %r12d,%r12d
  jmp    L134
L522:
  mov    %r14,%rsi
  mov    %r15,%rdi
  mov    $0x4,%edx
  add    $0x4,%r15
  call   <strncpy_overlapping@plt>
  add    $0x4,%r14
  sub    $0x4,%ebx
  add    $0x4,%r12d
  jmp    L399
  nopl   0x0(%rax)
L516:
  mov    %esi,%r12d
  mov    %rcx,%r14
  mov    %rdx,%r15
  jmp    L965
L1027:
  sub    $0x2,%ebx
  add    $0x2,%r15
  cmp    $0x1,%ebx
  jg     L251
  jmp    L254
  nopw   0x0(%rax,%rax,1)
L416:
  sub    $0x1,%ebx
  add    $0x1,%r15
  cmp    $0x1,%ebx
  je     L137
L251:
  cmpb   $0x2a,(%r15)
  jne    L416
  cmpb   $0x2f,0x1(%r15)
  jne    L416
  add    $0x2,%r15
  sub    $0x2,%ebx
  jmp    L399
L319:
  cmp    $0x20,%cl
  je     L35
L190:
  cmp    $0xa,%ebx
  jg     L831
  cmp    $0x4,%ebx
  jg     L492
  nopl   0x0(%rax)
L578:
  cmpb   $0xa,(%r15)
  je     L176
  add    $0x1,%r15
  sub    $0x1,%ebx
  jne    L578
  jmp    L965
L1059:
  mov    %r15,%rdi
  call   <javascript_concatenable@plt>
  test   %eax,%eax
  jne    L531
  movzbl (%r15),%eax
  jmp    L759
L831:
  xor    %eax,%eax
  mov    $0x9,%ecx
  lea    D7(%rip),%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <is_str_present_in_ss_comment@plt>
  test   %eax,%eax
  jne    L410
L492:
  xor    %eax,%eax
  mov    $0x3,%ecx
  mov    %rbp,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <is_str_present_in_ss_comment@plt>
  test   %eax,%eax
  je     L637
  mov    %r14,%rsi
  mov    $0x5,%edx
  xor    %eax,%eax
  add    $0x5,%r14
  lea    D58(%rip),%rdi
  add    $0x5,%r12d
  call   <strncpy_overlapping@plt>
  jmp    L578
L35:
  movb   $0x0,0x17(%rsp)
  sub    $0x1,%r14
  sub    $0x1,%r12d
  jmp    L190
L279:
  movzbl 0x1(%r15),%edx
  mov    %edi,%r9d
  mov    %rcx,%rsi
  mov    %rax,%r15
  mov    $0xffffffff,%ebx
  jmp    L42
L254:
  test   %ebx,%ebx
  je     L965
L137:
  add    $0x1,%r15
  jmp    L965
L637:
  xor    %eax,%eax
  mov    $0x3,%ecx
  lea    D47(%rip),%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <is_str_present_in_ss_comment@plt>
  test   %eax,%eax
  je     L578
  mov    %r14,%rsi
  mov    $0x6,%edx
  xor    %eax,%eax
  add    $0x6,%r14
  lea    D52(%rip),%rdi
  add    $0x6,%r12d
  call   <strncpy_overlapping@plt>
  jmp    L578
L410:
  mov    %r14,%rsi
  mov    $0xc,%edx
  xor    %eax,%eax
  add    $0xc,%r14
  lea    D4(%rip),%rdi
  add    $0xc,%r12d
  call   <strncpy_overlapping@plt>
  jmp    L578
L908:
  movzbl 0x2(%r15),%edx
  mov    %edi,%r9d
  mov    %rcx,%rsi
  mov    %rax,%r15
  mov    $0xffffffff,%ebx
  jmp    L42
L1023:
  call   <__stack_chk_fail@plt>
L201:
  test   %esi,%esi
  je     L520
  mov    %esi,%r12d
  mov    %rcx,%r14
  mov    %rdx,%r15
  jmp    L735
L761:
  xor    %eax,%eax
  jmp    L277
```

tool_calls: name: retrieve_data
arguments: label: D12
data_type: string
name: retrieve_data
arguments: label: D69
data_type: string
name: retrieve_data
arguments: label: D7
data_type: string
name: retrieve_data
arguments: label: D58
data_type: string
name: retrieve_data
arguments: label: D47
data_type: string
name: retrieve_data
arguments: label: D52
data_type: string
name: retrieve_data
arguments: label: D4
data_type: string

tool: D12: -->

tool: D69: 
-->

tool: D7: <![CDATA[

tool: D58: //-->

tool: D47: ]]>

tool: D52: //]]>


tool: D4: //<![CDATA[


assistant: ```c
int compress_javascript_chunk(const unsigned char *src, int srclen, unsigned char *dst) {
  const unsigned char *rpos = src;
  unsigned char *wpos = dst;
  int count;
  int dstlen = 0;
  unsigned char previous_char = '\0';
  unsigned char previous_char2 = '\0';
  unsigned char close_quote_char;
  int break_loop;
  count = srclen;
  while (count) {
    if (*rpos == '\n') {
      if (!((*(rpos + 1) == '-') && (count >= 4))) {
        if (previous_char == ' ') {
          wpos--;
          dstlen--;
          previous_char = previous_char2;
          previous_char2 = '\0';
        }
        if ((previous_char != '\0') && (previous_char != '\n') && (previous_char != ';') && (previous_char != ':') && (previous_char != '{') && (previous_char != '}')) {
          *(wpos++) = '\n';
          dstlen++;
        }
        rpos++;
        count--;
      } else {
        if (!custom_strncmp(rpos, "\n-->", 4)) {
          strncpy_overlapping(rpos, wpos, 4);
          rpos += 4;
          wpos += 4;
          count -= 4;
          dstlen += 4;
        } else {
          if (previous_char == ' ') {
            wpos--;
            dstlen--;
            previous_char = previous_char2;
            previous_char2 = '\0';
          }
          if ((previous_char != '\0') && (previous_char != '\n') && (previous_char != ';') && (previous_char != ':') && (previous_char != '{') && (previous_char != '}')) {
            *(wpos++) = '\n';
            dstlen++;
          }
          rpos++;
          count--;
        }
      }
    } else if ((*rpos == '{') || (*rpos == '}')) {
      if ((previous_char == ' ') || (previous_char == '\n')) {
        wpos--;
        dstlen--;
      }
      dstlen++;
      *(wpos++) = *(rpos++);
      count--;
    } else if (*rpos <= ' ') {
      if ((previous_char != ' ') && (previous_char != '\n')) {
        *(wpos++) = ' ';
        dstlen++;
      }
      rpos++;
      count--;
    } else if (*rpos == '\\') {
      *(wpos++) = *(rpos++);
      count--;
      dstlen++;
      if (count) {
        if (*rpos == ' ')
          *(wpos++) = '\t';
        else
          *(wpos++) = *(rpos++);
        count--;
        dstlen++;
      }
    } else if (*rpos == '/') {
      if (count >= 2) {
        if (*(rpos + 1) == '(') {
          *(wpos++) = *(rpos++);
          *(wpos++) = *(rpos++);
          count -= 2;
          dstlen += 2;
          while ((count) && (*rpos != ')')) {
            *(wpos++) = *(rpos++);
            count--;
            dstlen++;
          }
          *(wpos++) = *(rpos++);
          count--;
          dstlen++;
        } else if (*(rpos + 1) == '*') {
          rpos += 2;
          count -= 2;
          while ((count >= 2) && ((*rpos != '*') || (*(rpos + 1) != '/'))) {
            rpos++;
            count--;
          }
          if (count) {
            rpos++;
            count--;
          }
          if (count) {
            rpos++;
            count--;
          }
        } else if (*(rpos + 1) == '/') {
          int done_proc_comment = 0;
          if (previous_char == ' ') {
            wpos--;
            dstlen--;
            previous_char = previous_char2;
            previous_char2 = '\0';
          }
          if (count >= 11) {
            if (is_str_present_in_ss_comment(rpos, count, "<![CDATA[", 9)) {
              strncpy_overlapping("//<![CDATA[\n", wpos, 12);
              wpos += 12;
              dstlen += 12;
              done_proc_comment = 1;
            }
          }
          if ((done_proc_comment == 0) && (count >= 5)) {
            if (is_str_present_in_ss_comment(rpos, count, "-->", 3)) {
              strncpy_overlapping("//-->", wpos, 5);
              wpos += 5;
              dstlen += 5;
            } else if (is_str_present_in_ss_comment(rpos, count, "]]>", 3)) {
              strncpy_overlapping("//]]>\n", wpos, 6);
              wpos += 6;
              dstlen += 6;
            }
          }
          while (count && (*rpos != '\n')) {
            rpos++;
            count--;
          }
        } else {
          *(wpos++) = *(rpos++);
          dstlen++;
          count--;
        }
      } else {
        *(wpos++) = *(rpos++);
        dstlen++;
        count--;
      }
    } else if ((*rpos == '"') || (*rpos == '\'') || (*rpos == '[')) {
      if (previous_char == ' ') {
        wpos--;
        dstlen--;
      }
      switch (*rpos) {
      case '"':
      case '\'':
        close_quote_char = *rpos;
        break;
      case '[':
        close_quote_char = ']';
        break;
      }
      *(wpos++) = *(rpos++);
      dstlen++;
      count--;
      break_loop = 0;
      while ((count) && (!break_loop)) {
        if (*rpos == '\\') {
          *(wpos++) = *(rpos++);
          dstlen++;
          count--;
          if (count) {
            *(wpos++) = *(rpos++);
            dstlen++;
            count--;
          }
        } else if (*rpos == close_quote_char) {
          *(wpos++) = *(rpos++);
          dstlen++;
          count--;
          break_loop = 1;
        } else {
          *(wpos++) = *(rpos++);
          dstlen++;
          count--;
        }
      }
    } else {
      if (previous_char == ' ') {
        if (javascript_concatenable(&previous_char2) || javascript_concatenable(rpos)) {
          previous_char = previous_char2;
          previous_char2 = '\0';
          wpos--;
          dstlen--;
        }
      }
      *(wpos++) = *(rpos++);
      dstlen++;
      count--;
    }
    if (dstlen)
      previous_char = *(wpos - 1);
    else
      previous_char = '\0';
    if (dstlen >= 2)
      previous_char2 = *(wpos - 2);
    else
      previous_char2 = '\0';
  }
  return (dstlen);
}
```