user: What would the C source look like for the assembly code provided here?

```asm
<search_and_replace_kw>:
  endbr64
  push   %r15
  xor    %r15d,%r15d
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  movslq %r8d,%rbx
  sub    $0x38,%rsp
  mov    %rdi,0x10(%rsp)
  lea    0x0(,%rbx,4),%edi
  mov    %ebx,0x24(%rsp)
  call   <malloc@plt>
  mov    0x24(%rsp),%edx
  mov    %rax,%r14
  test   %edx,%edx
  jle    L121
L266:
  mov    (%r12,%r15,8),%rdi
  call   <strlen@plt>
  mov    %eax,(%r14,%r15,4)
  add    $0x1,%r15
  cmp    %r15,%rbx
  jne    L266
L121:
  movslq %ebp,%rax
  mov    0x10(%rsp),%r15
  mov    %rax,(%rsp)
  cmp    $0x50,%ebp
  jle    L275
  mov    %r12,0x28(%rsp)
  mov    %r15,%r12
  mov    %r14,%r15
L245:
  mov    0x10(%rsp),%rdx
  mov    %r12,%rdi
L63:
  add    $0x50,%r12
  mov    %r12,%rax
  sub    %rdx,%rax
  add    $0x50,%rax
  cmpb   $0x45,(%rdi)
  jne    L164
  cmpb   $0x4e,0x1(%rdi)
  jne    L164
  cmpb   $0x44,0x2(%rdi)
  jne    L164
  cmpb   $0x20,0x3(%rdi)
  jne    L164
  nopl   0x0(%rax,%rax,1)
L143:
  cmp    %rax,(%rsp)
  jle    L299
  movzbl (%r12),%ecx
  add    $0x50,%r12
  mov    %r12,%rax
  sub    %rdx,%rax
  add    $0x50,%rax
  cmp    $0x58,%cl
  jne    L143
  cmpb   $0x54,-0x4f(%r12)
  jne    L143
  cmpb   $0x45,-0x4e(%r12)
  jne    L143
  cmpb   $0x4e,-0x4d(%r12)
  jne    L143
  cmpb   $0x53,-0x4c(%r12)
  jne    L143
  cmpb   $0x49,-0x4b(%r12)
  jne    L143
  cmpb   $0x4f,-0x4a(%r12)
  jne    L143
  cmpb   $0x4e,-0x49(%r12)
  jne    L143
  cmp    %rax,(%rsp)
  jle    L299
  mov    %r12,%rdi
  jmp    L63
  nopl   0x0(%rax)
L164:
  mov    %rax,0x8(%rsp)
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  jle    L16
  mov    0x28(%rsp),%rbp
  xor    %r14d,%r14d
  mov    %r12,0x18(%rsp)
  mov    %r13,%r12
  mov    %rbx,%r13
  mov    %r14,%rbx
  mov    %rbp,%r14
  mov    %rdi,%rbp
  nopl   0x0(%rax)
L33:
  mov    (%r15,%rbx,4),%ecx
  xor    %eax,%eax
  test   %ecx,%ecx
  jns    L113
  jmp    L279
  nopl   0x0(%rax)
L147:
  mov    (%r14),%rsi
  cmp    %dl,(%rsi,%rax,1)
  jne    L182
L148:
  add    $0x1,%rax
  cmp    %eax,%ecx
  jl     L279
L113:
  movzbl 0x0(%rbp,%rax,1),%edx
  cmp    %eax,%ecx
  jg     L147
  cmp    $0x3d,%dl
  je     L148
  cmp    $0x20,%dl
  je     L148
L182:
  add    $0x1,%rbx
  add    $0x8,%r14
  cmp    %rbx,%r13
  jne    L33
L67:
  mov    %r13,%rbx
  mov    %r12,%r13
  mov    0x18(%rsp),%r12
L16:
  mov    0x8(%rsp),%rdi
  cmp    %rdi,(%rsp)
  jg     L245
L299:
  mov    %r15,%r14
L275:
  mov    %r14,%rdi
  call   <free@plt>
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L279:
  mov    (%r12,%rbx,8),%rdx
  mov    (%r14),%rsi
  mov    %rbp,%rdi
  add    $0x1,%rbx
  add    $0x8,%r14
  call   <search_rep@plt>
  cmp    %rbx,%r13
  jne    L33
  jmp    L67
```

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;
}
```