user: What is the c source code of the assembly code below?

```asm
<sed_emulator>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x850,%rsp
  mov    %edi,-0x2844(%rbp)
  mov    %rsi,-0x2850(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x810(%rbp),%rax
  mov    %rax,-0x2830(%rbp)
  lea    -0x410(%rbp),%rax
  mov    %rax,-0x2828(%rbp)
  movq   $0x0,-0x2838(%rbp)
  jmp    L17
L86:
  mov    -0x2838(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x2850(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    -0x2838(%rbp),%rdx
  mov    %rax,-0x2810(%rbp,%rdx,8)
  addq   $0x1,-0x2838(%rbp)
L17:
  mov    -0x2844(%rbp),%eax
  cltq
  cmp    %rax,-0x2838(%rbp)
  jb     L86
L83:
  mov    -0x2830(%rbp),%rax
  mov    %rax,%rdi
  call   <gets@plt>
  test   %rax,%rax
  jne    L82
  mov    $0x0,%edi
  call   <exit@plt>
L82:
  movq   $0x0,-0x2838(%rbp)
  jmp    L79
L80:
  mov    -0x2838(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x2850(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L30
  mov    -0x2820(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x2830(%rbp),%rdx
  mov    -0x2828(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x2838(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x2850(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2828(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x2838(%rbp),%rax
  mov    -0x2810(%rbp,%rax,8),%rdx
  mov    -0x2820(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2828(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x2828(%rbp),%rax
  mov    %rax,-0x2818(%rbp)
  mov    -0x2830(%rbp),%rax
  mov    %rax,-0x2828(%rbp)
  mov    -0x2818(%rbp),%rax
  mov    %rax,-0x2830(%rbp)
L6:
  mov    -0x2838(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x2850(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2830(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x2820(%rbp)
  cmpq   $0x0,-0x2820(%rbp)
  jne    L80
  addq   $0x2,-0x2838(%rbp)
L79:
  mov    -0x2844(%rbp),%eax
  cltq
  cmp    %rax,-0x2838(%rbp)
  jb     L6
  mov    -0x2830(%rbp),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L83
L30:
  nop
  jmp    L83
```

tool_calls: name: read_data
arguments: label: D6
data_type: string

tool: D6: /DELETE/

assistant: ```c
void sed_emulator(int narg, char **patterns) {
  char buffer[1024];
  char buffer2[1024];
  size_t i, lengths[1024];
  char *b1 = buffer, *b2 = buffer2;
  for (i = 0; i < narg; i++)
    lengths[i] = strlen(patterns[i]);
  while (1) {
    if (gets(b1) == 0)
      exit(0);
    for (i = 0; i < narg; i += 2) {
      char *b3, *b4;
      while ((b3 = strstr(b1, patterns[i]))) {
        if (strcmp(patterns[i + 1], "/DELETE/") == 0)
          goto GO_ON;
        b3[0] = 0;
        strcpy(b2, b1);
        strcat(b2, patterns[i + 1]);
        strcat(b2, b3 + lengths[i]);
        b4 = b2;
        b2 = b1;
        b1 = b4;
      }
    }
    puts(b1);
  GO_ON:;
  }
}
```