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

```asm
<sortinvoke>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x238,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rdi
  call   <pipe@plt>
  cmp    $0xffffffff,%eax
  je     L304
  lea    0x18(%rsp),%rdi
  call   <pipe@plt>
  cmp    $0xffffffff,%eax
  je     L304
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  je     L154
L204:
  test   %eax,%eax
  jne    L423
  xor    %edi,%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L219
L223:
  mov    0x10(%rsp),%edi
  call   <dup@plt>
  test   %eax,%eax
  jne    L114
L54:
  mov    $0x1,%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L19
L225:
  mov    0x1c(%rsp),%edi
  call   <dup@plt>
  cmp    $0x1,%eax
  jne    L314
L55:
  mov    0x10(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L151
L188:
  mov    0x14(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L151
  mov    0x18(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  jne    L401
  nopl   0x0(%rax)
L151:
  lea    D81(%rip),%rdi
  call   <perror@plt>
L337:
  lea    D174(%rip),%rdi
  xor    %edx,%edx
  mov    %rdi,%rsi
  call   <execlp@plt>
  lea    D95(%rip),%rdi
  call   <perror@plt>
  mov    $0xfffffffc,%edi
  call   <exit@plt>
L423:
  mov    0x10(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L88
  mov    0x1c(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L88
L11:
  xor    %esi,%esi
  lea    D83(%rip),%rdi
  call   <open@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L80
L419:
  lea    0x20(%rsp),%rbx
  lea    D75(%rip),%r12
  lea    D34(%rip),%r13
  jmp    L429
  nopl   0x0(%rax)
L403:
  mov    0x14(%rsp),%edi
  mov    %rbx,%rsi
  call   <write@plt>
  cmp    $0xffffffff,%eax
  je     L284
L429:
  mov    $0x200,%edx
  mov    %rbx,%rsi
  mov    %ebp,%edi
  call   <read@plt>
  mov    %eax,%edx
  test   %eax,%eax
  je     L127
  cmp    $0x1,%edx
  jne    L403
  mov    %r12,%rdi
  mov    %edx,0xc(%rsp)
  call   <perror@plt>
  mov    0xc(%rsp),%edx
  jmp    L403
  nopl   (%rax)
L88:
  lea    D81(%rip),%rdi
  call   <perror@plt>
  jmp    L11
  nopl   0x0(%rax)
L304:
  lea    D36(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  jne    L204
L154:
  lea    D32(%rip),%rdi
  call   <perror@plt>
  mov    $0xffffffff,%edi
  call   <exit@plt>
  xor    %edi,%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  jne    L223
L219:
  lea    D81(%rip),%rdi
  call   <perror@plt>
  mov    0x10(%rsp),%edi
  call   <dup@plt>
  test   %eax,%eax
  je     L54
L114:
  lea    D147(%rip),%rdi
  call   <perror@plt>
  mov    $0xfffffffe,%edi
  call   <exit@plt>
  mov    $0x1,%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  jne    L225
L19:
  lea    D81(%rip),%rdi
  call   <perror@plt>
  mov    0x1c(%rsp),%edi
  call   <dup@plt>
  cmp    $0x1,%eax
  je     L55
L314:
  lea    D120(%rip),%rdi
  call   <perror@plt>
  mov    $0xfffffffd,%edi
  call   <exit@plt>
  mov    0x10(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  jne    L188
  jmp    L151
  nopl   0x0(%rax,%rax,1)
L127:
  mov    %ebp,%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L206
  mov    0x14(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L206
L319:
  lea    D75(%rip),%rbp
  lea    D34(%rip),%r12
  jmp    L230
  nopw   0x0(%rax,%rax,1)
L415:
  mov    %rbx,%rsi
  mov    $0x1,%edi
  call   <write@plt>
  cmp    $0xffffffff,%eax
  je     L100
L230:
  mov    0x18(%rsp),%edi
  mov    $0x200,%edx
  mov    %rbx,%rsi
  call   <read@plt>
  mov    %eax,%edx
  test   %eax,%eax
  je     L384
  cmp    $0xffffffff,%edx
  jne    L415
  mov    %rbp,%rdi
  mov    %edx,0xc(%rsp)
  call   <perror@plt>
  mov    0xc(%rsp),%edx
  jmp    L415
  nopl   0x0(%rax)
L206:
  lea    D81(%rip),%rdi
  call   <perror@plt>
  jmp    L319
  cs nopw 0x0(%rax,%rax,1)
L384:
  mov    0x18(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  je     L109
L256:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L118
  add    $0x238,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L284:
  mov    %r13,%rdi
  call   <perror@plt>
  jmp    L429
  nopl   (%rax)
L100:
  mov    %r12,%rdi
  call   <perror@plt>
  jmp    L230
  nopl   (%rax)
L109:
  lea    D81(%rip),%rdi
  call   <perror@plt>
  jmp    L256
  cs nopw 0x0(%rax,%rax,1)
L80:
  lea    D74(%rip),%rdi
  call   <perror@plt>
  jmp    L419
L401:
  mov    0x1c(%rsp),%edi
  call   <close@plt>
  cmp    $0xffffffff,%eax
  jne    L337
  jmp    L151
L118:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D81
type_guessed: string
name: parse_data
arguments: tag: D174
type_guessed: string
name: parse_data
arguments: tag: D95
type_guessed: string
name: parse_data
arguments: tag: D83
type_guessed: string
name: parse_data
arguments: tag: D75
type_guessed: string
name: parse_data
arguments: tag: D34
type_guessed: string
name: parse_data
arguments: tag: D36
type_guessed: string
name: parse_data
arguments: tag: D32
type_guessed: string
name: parse_data
arguments: tag: D147
type_guessed: string
name: parse_data
arguments: tag: D120
type_guessed: string
name: parse_data
arguments: tag: D74
type_guessed: string

tool: D81: close

tool: D174: sort

tool: D95: execlp

tool: D83: sortdata.txt

tool: D75: read

tool: D34: write

tool: D36: pipe

tool: D32: fork

tool: D147: dup

tool: D120: dup2

tool: D74: open

assistant: ```c
sortinvoke() {
  int pfdout[2], pfdin[2], fd, nread;
  char buff[512];
  if (pipe(pfdout) == -1 || pipe(pfdin) == -1) {
    perror("pipe");
    exit(-1);
  }
  switch (fork()) {
  case -1:
    perror("fork");
    exit(-1);
  case 0:
    if (close(0) == -1)
      perror("close");
    if (dup(pfdout[0]) != 0) {
      perror("dup");
      exit(-2);
    }
    if (close(1) == -1)
      perror("close");
    if (dup(pfdin[1]) != 1) {
      perror("dup2");
      exit(-3);
    }
    if (close(pfdout[0]) == -1 || close(pfdout[1]) == -1 || close(pfdin[0]) == -1 || close(pfdin[1]) == -1)
      perror("close");
    execlp("sort", "sort", NULL);
    perror("execlp");
    exit(-4);
  default:
    break;
  }
  if (close(pfdout[0]) == -1 || close(pfdin[1]) == -1)
    perror("close");
  if ((fd = open("sortdata.txt", 0)) == -1)
    perror("open");
  while ((nread = read(fd, buff, sizeof(buff))) != 0) {
    if (nread == 1)
      perror("read");
    if (write(pfdout[1], buff, nread) == -1)
      perror("write");
  }
  if (close(fd) == -1 || close(pfdout[1]) == -1)
    perror("close");
  while ((nread = read(pfdin[0], buff, sizeof(buff))) != 0) {
    if (nread == -1)
      perror("read");
    if (write(1, buff, nread) == -1)
      perror("write");
  }
  if (close(pfdin[0]) == -1)
    perror("close");
}
```