user: What is the c source code of the assembly code below?

```asm
<filter_ansi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <color_mode@plt>
  test   %rax,%rax
  je     L66
  mov    -0x44(%rbp),%edx
  mov    -0x40(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <vfprintf@plt>
  jmp    L35
L66:
  mov    -0x44(%rbp),%edx
  mov    -0x40(%rbp),%rcx
  lea    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <vasprintf@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x1,-0x10(%rbp)
  jbe    L113
  movq   $0x0,-0x20(%rbp)
  jmp    L59
L175:
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x1b,%al
  jne    L133
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5b,%al
  jne    L133
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x20(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L47
L162:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  jne    L115
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addq   $0x1,-0x18(%rbp)
L47:
  mov    -0x18(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L162
  jmp    L75
L115:
  nop
L75:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L133:
  addq   $0x1,-0x20(%rbp)
L59:
  mov    -0x10(%rbp),%rax
  sub    $0x2,%rax
  cmp    %rax,-0x20(%rbp)
  jb     L175
L113:
  movq   $0x0,-0x20(%rbp)
  jmp    L161
L14:
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <fputs@plt>
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    -0x20(%rbp),%rdx
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L63
L68:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L30
  addq   $0x1,-0x18(%rbp)
L63:
  mov    -0x18(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L68
  jmp    L4
L30:
  nop
L4:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L161:
  mov    -0x20(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L14
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L35:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L26
  call   <__stack_chk_fail@plt>
L26:
  leave
  ret
```

assistant: ```c
void filter_ansi(FILE *file, const char *fmt, va_list args) {
  char *str = NULL;
  size_t len, i, j;
  if (color_mode(file)) {
    vfprintf(file, fmt, args);
    return;
  }
  len = vasprintf(&str, fmt, args);
  if (len >= 2) {
    for (i = 0; i < len - 2; ++i) {
      if (str[i] == '\x1b' && str[i + 1] == '[') {
        str[i] = str[i + 1] = '\0';
        for (j = i + 2; j < len; ++j) {
          if (isalpha(str[j]))
            break;
          str[j] = '\0';
        }
        str[j] = '\0';
      }
    }
  }
  for (i = 0; i < len; i = j) {
    fputs(&str[i], file);
    for (j = i + strlen(&str[i]); j < len; ++j) {
      if (str[j] != '\0')
        break;
    }
  }
  free(str);
}
```