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

```asm
<copy_search>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %rcx,-0x40(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x28(%rbp),%rax
  lea    D7(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jne    L46
  mov    -0x18(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jne    L46
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    -0x34(%rbp),%edx
  sub    $0x1,%edx
  sub    -0x1c(%rbp),%edx
  cmp    %edx,%eax
  jge    L11
  addq   $0x6,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L1
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L90
L1:
  mov    -0x8(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L54
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L71
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L54
L71:
  addq   $0x1,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x8(%rbp),%rax
  sub    -0x18(%rbp),%rax
  add    %rax,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rdx,%rax
  add    $0x1,%rax
  add    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L90
L54:
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L90
L11:
  mov    -0x28(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
L90:
  mov    -0x34(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  movl   $0x1,-0x20(%rbp)
L46:
  mov    -0x20(%rbp),%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D7
datatype: string

tool: D7: search 

assistant: ```c
int copy_search(char *in, char *out, int sz, char *domain) {
  int found = 0;
  char *s;
  char *t;
  char *d;
  int dl = dl = strlen(domain);
  if (((s = strstr(in, "search ")) == in) && s == in) {
    if (strlen(in) < sz - 1 - dl) {
      s = s + 6;
      t = out;
      d = strstr(s, domain);
      if (!d) {
        strcpy(t, s);
      } else {
        if (isspace(d[-1]) && (d[dl] == '\0' || isspace(d[dl]))) {
          s++;
          strncpy(t, s, d - s);
          t += d - s;
          s += d - s + dl + 1;
          strcpy(t, s);
        } else {
          strcpy(t, s);
        }
      }
    } else {
      strcpy(out, in);
    }
    out[sz - 1] = '\0';
    found = 1;
  }
  return found;
}
```