user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<search_and_replace_kw>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %esi,%r12d
  mov    %rdx,(%rsp)
  mov    %rcx,%r15
  mov    %r8d,%ebx
  mov    %r8d,0x1c(%rsp)
  lea    0x0(,%r8,4),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %ebx,%ebx
  jle    L120
  mov    %ebx,%ebp
  mov    $0x0,%ebx
L28:
  mov    (%rsp),%rax
  mov    (%rax,%rbx,8),%rdi
  call   <strlen@plt>
  mov    %eax,0x0(%r13,%rbx,4)
  add    $0x1,%rbx
  cmp    %rbp,%rbx
  jne    L28
L120:
  movslq %r12d,%rax
  mov    %rax,0x10(%rsp)
  cmp    $0x50,%r12d
  jle    L46
  mov    0x8(%rsp),%rbx
  movl   $0x1,0x18(%rsp)
  jmp    L280
L293:
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jle    L38
  mov    (%rsp),%rbp
  mov    %eax,%r14d
  mov    $0x0,%r12d
  jmp    L156
L26:
  movzbl (%rbx,%rax,1),%ecx
  cmp    $0x3d,%cl
  je     L136
  cmp    $0x20,%cl
  jne    L220
L136:
  add    $0x1,%rax
  cmp    %eax,%edx
  jl     L105
L218:
  cmp    %eax,%edx
  jle    L26
  mov    0x0(%rbp),%rcx
  movzbl (%rbx,%rax,1),%esi
  cmp    %sil,(%rcx,%rax,1)
  je     L136
  jmp    L220
L281:
  cmpb   $0x58,(%rbx)
  je     L18
L38:
  add    $0x50,%rbx
  mov    %rbx,%rax
  sub    0x8(%rsp),%rax
  add    $0x50,%rax
  cmp    0x10(%rsp),%rax
  jge    L46
L280:
  cmpl   $0x0,0x18(%rsp)
  je     L281
  cmpb   $0x45,(%rbx)
  jne    L293
  cmpb   $0x4e,0x1(%rbx)
  jne    L293
  cmpb   $0x44,0x2(%rbx)
  jne    L293
  cmpb   $0x20,0x3(%rbx)
  jne    L293
  movl   $0x0,0x18(%rsp)
  jmp    L38
L18:
  cmpb   $0x54,0x1(%rbx)
  jne    L38
  cmpb   $0x45,0x2(%rbx)
  jne    L38
  cmpb   $0x4e,0x3(%rbx)
  jne    L38
  cmpb   $0x53,0x4(%rbx)
  jne    L38
  cmpb   $0x49,0x5(%rbx)
  jne    L38
  cmpb   $0x4f,0x6(%rbx)
  jne    L38
  cmpb   $0x4e,0x7(%rbx)
  sete   %al
  movzbl %al,%eax
  mov    %eax,0x18(%rsp)
  jmp    L38
L105:
  mov    (%r15,%r12,8),%rdx
  mov    0x0(%rbp),%rsi
  mov    %rbx,%rdi
  call   <search_rep@plt>
L220:
  add    $0x1,%r12
  add    $0x8,%rbp
  cmp    %r12,%r14
  je     L38
L156:
  mov    0x0(%r13,%r12,4),%edx
  mov    $0x0,%eax
  test   %edx,%edx
  jns    L218
  jmp    L105
L46:
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0x0,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int search_and_replace_kw(char *buf, int bufsize, char **key_in, char **key_out, int nk) {
  char *w;
  int i, j;
  int in_header;
  int match_flag;
  int *keysizes;
  keysizes = malloc(nk * sizeof(int));
  for (i = 0; i < nk; i++)
    keysizes[i] = (int)strlen(key_in[i]);
  w = buf;
  in_header = 1;
  while ((w - buf + 80) < bufsize) {
    if (in_header) {
      if (w[0] == 'E' && w[1] == 'N' && w[2] == 'D' && w[3] == ' ') {
        in_header = 0;
      } else {
        for (i = 0; i < nk; i++) {
          match_flag = 1;
          for (j = 0; j <= keysizes[i]; j++) {
            if (j < keysizes[i]) {
              if (key_in[i][j] != w[j]) {
                match_flag = 0;
                break;
              }
            } else {
              if ((w[j] != '=') && (w[j] != ' ')) {
                match_flag = 0;
                break;
              }
            }
          }
          if (match_flag) {
            search_rep(w, key_in[i], key_out[i]);
          }
        }
      }
    } else {
      if (w[0] == 'X' && w[1] == 'T' && w[2] == 'E' && w[3] == 'N' && w[4] == 'S' && w[5] == 'I' && w[6] == 'O' && w[7] == 'N') {
        in_header = 1;
      }
    }
    w += 80;
  }
  free(keysizes);
  return 0;
}
```