user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<tagfile_simplify_query>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L87
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L84
L87:
  mov    $0x0,%eax
  jmp    L2
L19:
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L122
L83:
  mov    -0x10(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  lea    D15(%rip),%rax
  movzbl (%rdx,%rax,1),%edx
  mov    -0x14(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L52
  mov    -0x10(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  lea    D53(%rip),%rax
  movzbl (%rdx,%rax,1),%edx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  jne    L52
  movl   $0x1,-0xc(%rbp)
  jmp    L72
L52:
  addl   $0x1,-0x10(%rbp)
L122:
  mov    -0x10(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L83
L72:
  cmpl   $0x0,-0xc(%rbp)
  jne    L15
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    (%rdx,%rdx,1),%rcx
  lea    D15(%rip),%rdx
  mov    %al,(%rcx,%rdx,1)
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    (%rdx,%rdx,1),%rcx
  lea    D53(%rip),%rdx
  mov    %al,(%rcx,%rdx,1)
  addl   $0x1,-0x18(%rbp)
L15:
  addl   $0x1,-0x14(%rbp)
L84:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L131
  cmpl   $0x31,-0x18(%rbp)
  jle    L19
L131:
  mov    -0x18(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L132
  movl   $0x0,-0x10(%rbp)
  jmp    L37
L47:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rcx
  lea    D15(%rip),%rax
  movzbl (%rcx,%rax,1),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x10(%rbp)
L37:
  mov    -0x10(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L47
  mov    -0x10(%rbp),%eax
  lea    -0x1(%rax),%ecx
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  movslq %ecx,%rax
  lea    (%rax,%rax,1),%rcx
  lea    D53(%rip),%rax
  movzbl (%rcx,%rax,1),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L132:
  mov    -0x8(%rbp),%rax
L2:
  leave
  ret
```

assistant: ```c
char *tagfile_simplify_query(const char *query) {
  static char pairs[50][2];
  int num_pairs = 0;
  int pos = 0;
  int i;
  bool found;
  char *result;
  if (query == NULL || query[0] == 0)
    return NULL;
  while (query[pos + 1] != 0 && num_pairs < 50) {
    found = false;
    for (i = 0; i < num_pairs; ++i) {
      if (pairs[i][0] == query[pos] && pairs[i][1] == query[pos + 1]) {
        found = true;
        break;
      }
    }
    if (!found) {
      pairs[num_pairs][0] = query[pos];
      pairs[num_pairs][1] = query[pos + 1];
      num_pairs++;
    }
    pos++;
  }
  result = malloc(num_pairs + 2);
  if (result) {
    for (i = 0; i < num_pairs; ++i) {
      result[i] = pairs[i][0];
    }
    result[i] = pairs[i - 1][1];
    i++;
    result[i] = 0;
  }
  return result;
}
```