user: Demonstrate the C code that generates the assembly output below:

```asm
<Q_replace>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %ecx,-0x5c(%rbp)
  mov    -0x48(%rbp),%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L163
  mov    $0x0,%eax
  jmp    L82
L163:
  movl   $0x0,-0x40(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x3c(%rbp)
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x38(%rbp)
  mov    -0x38(%rbp),%eax
  sub    -0x3c(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jle    L12
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  add    %rax,-0x58(%rbp)
L88:
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  add    %rax,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L126
  mov    -0x40(%rbp),%eax
  jmp    L82
L126:
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L158
L63:
  mov    -0x30(%rbp),%rdx
  lea    -0x1(%rdx),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x18(%rbp),%rax
  lea    -0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L158:
  mov    -0x30(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jae    L63
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L157
L30:
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L157:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L30
  mov    -0x48(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x20(%rbp)
  addl   $0x1,-0x40(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L88
  mov    -0x40(%rbp),%eax
  jmp    L82
L12:
  cmpl   $0x0,-0x34(%rbp)
  jns    L44
L51:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  nop
L55:
  mov    -0x30(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x18(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L55
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L100
L175:
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L100:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L175
  mov    -0x48(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x20(%rbp)
  addl   $0x1,-0x40(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L51
  mov    -0x40(%rbp),%eax
  jmp    L82
L44:
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L93
L103:
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L93:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L103
  mov    -0x48(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x20(%rbp)
  addl   $0x1,-0x40(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L44
  mov    -0x40(%rbp),%eax
L82:
  leave
  ret
```

assistant: ```c
int Q_replace(const char *str1, const char *str2, char *src, int max_len) {
  int len1, len2, d, count;
  const char *s0, *s1, *s2, *max;
  char *match, *dst;
  match = strstr(src, str1);
  if (!match)
    return 0;
  count = 0;
  len1 = strlen(str1);
  len2 = strlen(str2);
  d = len2 - len1;
  if (d > 0) {
    max = src + max_len;
    src += strlen(src);
    do {
      s1 = src;
      src += d;
      if (src >= max)
        return count;
      dst = src;
      s0 = match + len1;
      while (s1 >= s0)
        *dst-- = *s1--;
      s2 = str2;
      while (*s2) {
        *match++ = *s2++;
      }
      match = strstr(match, str1);
      count++;
    } while (match);
    return count;
  } else if (d < 0) {
    do {
      s1 = match + len1;
      dst = match + len2;
      while ((*dst++ = *s1++) != '\0')
        ;
      s2 = str2;
      while (*s2) {
        *match++ = *s2++;
      }
      match = strstr(match, str1);
      count++;
    } while (match);
    return count;
  } else
    do {
      s2 = str2;
      while (*s2) {
        *match++ = *s2++;
      }
      match = strstr(match, str1);
      count++;
    } while (match);
  return count;
}
```