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

```asm
<mem_parse>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    %r9,-0x50(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0xffffffff,-0x14(%rbp)
  cmpq   $0x0,-0x48(%rbp)
  jle    L105
  mov    -0x40(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x28(%rbp),%rsi
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <search_linear@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L105
  cmpq   $0x0,-0x50(%rbp)
  jle    L25
  mov    -0x48(%rbp),%rax
  add    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  mov    -0x40(%rbp),%rax
  add    %rcx,%rax
  mov    %rax,%rcx
  mov    -0x50(%rbp),%rdx
  mov    -0x10(%rbp),%rsi
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <search_linear@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L105
  mov    -0x8(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  sub    %rdx,%rax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  cmp    %rax,0x18(%rbp)
  jg     L98
  mov    0x18(%rbp),%rax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
L98:
  movl   $0x0,-0x18(%rbp)
  jmp    L108
L95:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rcx
  mov    0x10(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x18(%rbp)
L108:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L95
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    0x10(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  jmp    L105
L25:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  sub    %rdx,%rax
  mov    %eax,%edx
  mov    -0x40(%rbp),%rax
  add    %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  cmp    %rax,0x18(%rbp)
  jg     L86
  mov    0x18(%rbp),%rax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
L86:
  movl   $0x0,-0x18(%rbp)
  jmp    L69
L106:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rcx
  mov    0x10(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x18(%rbp)
L69:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L106
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    0x10(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L105:
  mov    -0x14(%rbp),%eax
  leave
  ret
```

assistant: ```c
int mem_parse(char *buf, char *mp1, char *mp2, uint32_t buf_len, uint32_t mp1_len, uint32_t mp2_len, char *dbuf, uint32_t dlen) {
  char *src = NULL, *dst = NULL;
  int i = 0;
  int len = -1;
  if (mp1_len > 0) {
    src = search_linear(mp1, buf, mp1_len, buf_len);
    if (src != NULL) {
      if (mp2_len > 0) {
        src += mp1_len;
        if ((dst = search_linear(mp2, src, mp2_len, buf_len - ((unsigned long)src - (unsigned long)buf))) != NULL) {
          if ((len = (unsigned long)dst - (unsigned long)src) > (dlen - 1)) {
            len = dlen - 1;
          }
          for (i = 0; i < len; i++) {
            *(dbuf + i) = *(src + i);
          }
          *(dbuf + i) = '\0';
        }
      } else {
        src += mp1_len;
        len = buf_len - ((unsigned long)src - (unsigned long)buf);
        if (len > (dlen - 1)) {
          len = dlen - 1;
        }
        for (i = 0; i < len; i++) {
          *(dbuf + i) = *(src + i);
        }
        *(dbuf + i) = '\0';
      }
    }
  }
  return len;
}
```