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

```asm
<filt_w_message>:
  endbr64
  push   %r14
  mov    $0x3e,%esi
  push   %r13
  lea    D1(%rip),%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x410,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  call   <strchr@plt>
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <strstr@plt>
  test   %rbx,%rbx
  je     L68
  mov    %rax,%r12
  test   %rax,%rax
  je     L68
  mov    %r13,%rdi
  mov    %rsp,%r14
  call   <strlen@plt>
  lea    D54(%rip),%rdx
  mov    $0x200,%esi
  mov    %r14,%rdi
  cltq
  add    %rax,%r12
  xor    %eax,%eax
  call   <snprintf@plt>
  lea    0x1(%rbx),%rsi
  mov    $0x10,%edx
  movslq %eax,%rdi
  lea    (%r14,%rdi,1),%r13
  mov    %r13,%rdi
  call   <memcpy@plt>
  lea    0x10(%r13),%rdi
  mov    %r12,%rcx
  xor    %eax,%eax
  lea    0x200(%rsp),%r13
  lea    D31(%rip),%rdx
  mov    %r13d,%esi
  sub    %edi,%esi
  call   <snprintf@plt>
  mov    %r14,%rsi
  mov    %rbp,%rdi
  mov    $0x200,%edx
  call   <strncpy@plt>
  lea    D57(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L27
L67:
  xor    %r9d,%r9d
  xor    %esi,%esi
  mov    $0x200,%r8d
  mov    %r13,%rcx
  lea    D95(%rip),%rdx
  lea    D56(%rip),%rdi
  call   <ezplib_get_attr_val@plt>
  cmpw   $0x30,0x200(%rsp)
  je     L53
  cmpw   $0x31,0x200(%rsp)
  je     L53
L26:
  mov    %rbp,%rsi
  lea    D38(%rip),%rdi
  call   <printf@plt>
L68:
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  add    $0x410,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L53:
  xor    %esi,%esi
  lea    D44(%rip),%rcx
  lea    D35(%rip),%rdx
  lea    D100(%rip),%rdi
  call   <ezplib_replace_attr@plt>
  mov    %rbp,%rsi
  lea    D38(%rip),%rdi
  call   <printf@plt>
  jmp    L68
  nopl   (%rax)
L27:
  lea    D69(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L67
  jmp    L26
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D1
datatype: string
name: read_data
arguments: data_tag: D54
datatype: string
name: read_data
arguments: data_tag: D31
datatype: string
name: read_data
arguments: data_tag: D57
datatype: string
name: read_data
arguments: data_tag: D95
datatype: string
name: read_data
arguments: data_tag: D56
datatype: string
name: read_data
arguments: data_tag: D38
datatype: string
name: read_data
arguments: data_tag: D44
datatype: string
name: read_data
arguments: data_tag: D35
datatype: string
name: read_data
arguments: data_tag: D100
datatype: string
name: read_data
arguments: data_tag: D69
datatype: string

tool: D1: WIFIConnect

tool: D54: <SYS>	

tool: D31: WIFI Connect: %s

tool: D57: wrong

tool: D95: state

tool: D56: wan_status_rule

tool: D38: msg:%s


tool: D44: 1

tool: D35: wisp

tool: D100: plug_rule

tool: D69: encryption

assistant: ```c
void filt_w_message(char *msg, char *keycat) {
  char dst[512], wan_status[512];
  char *cur = &dst[0];
  char *p1, *p3;
  int n;
  p1 = strchr(msg, '>');
  p3 = strstr(msg, "WIFIConnect");
  if (!p1 || !p3)
    return;
  p1 += 1;
  p3 += strlen("WIFIConnect");
  n = snprintf(cur, 512, "<SYS>\t");
  cur = cur + n;
  memcpy(cur, p1, sizeof("Dec  8 11:12:58 ") - 1);
  cur = cur + (sizeof("Dec  8 11:12:58 ") - 1);
  snprintf(cur, (&dst[0]) + 512 - cur, "WIFI Connect: %s", p3);
  strncpy(msg, dst, 512);
  if (strstr(p3, "wrong") || strstr(p3, "encryption")) {
    ezplib_get_attr_val("wan_status_rule", 0, "state", wan_status, sizeof(wan_status), 0);
    if (!strcmp(wan_status, "0") || !strcmp(wan_status, "1"))
      ezplib_replace_attr("plug_rule", 0, "wisp", "1");
  }
  printf("msg:%s\n", msg);
}
```