user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x38,%rsp
  mov    %rsi,(%rsp)
  mov    %rdx,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x1028(%rsp)
  xor    %eax,%eax
  cmp    $0x2,%edi
  jle    L31
L48:
  lea    0x20(%rsp),%r12
  mov    $0x1000,%edx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    (%rsp),%rbx
  mov    $0x1000,%edx
  mov    %r12,%rdi
  mov    0x8(%rbx),%rsi
  call   <strncpy@plt>
  mov    0x10(%rbx),%rdi
  mov    %rbx,(%rsp)
  call   <atoi@plt>
  mov    $0x1,%edi
  mov    %eax,%ebp
  call   <dup@plt>
  mov    %eax,0xc(%rsp)
  test   %ebp,%ebp
  jle    L44
  mov    (%rsp),%rax
  xor    %ebx,%ebx
  lea    0x18(%rsp),%r14
  lea    -0x1(%rbp),%r13d
  add    $0x8,%rax
  mov    %rax,(%rsp)
  jmp    L79
  nopl   0x0(%rax,%rax,1)
L87:
  mov    $0x1,%edi
  call   <close@plt>
  mov    $0x1,%esi
  cmp    %ebx,%r13d
  jle    L45
  mov    0x1c(%rsp),%edi
  call   <dup2@plt>
L155:
  mov    (%rsp),%rsi
  mov    %r15,%rdx
  mov    %r12,%rdi
  call   <execve@plt>
  mov    %r12,%rsi
  lea    D29(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  lea    0x1(%rbx),%eax
  cmp    %eax,%ebp
  je     L20
L152:
  mov    %eax,%ebx
L79:
  mov    %r14,%rdi
  call   <pipe@plt>
  test   %eax,%eax
  js     L2
L46:
  xor    %eax,%eax
  call   <fork@plt>
  test   %rax,%rax
  je     L87
  xor    %edi,%edi
  call   <close@plt>
  cmp    %ebx,%r13d
  jg     L134
L93:
  mov    0x18(%rsp),%edi
  call   <close@plt>
  mov    0x1c(%rsp),%edi
  call   <close@plt>
  lea    0x1(%rbx),%eax
  cmp    %eax,%ebp
  jne    L152
L20:
  mov    $0x1,%edi
  xor    %ebp,%ebp
  lea    0x14(%rsp),%r12
  call   <close@plt>
  mov    0xc(%rsp),%edi
  mov    $0x1,%esi
  call   <dup2@plt>
  nopl   0x0(%rax,%rax,1)
L150:
  mov    %r12,%rdi
  call   <wait@plt>
  mov    %ebp,%eax
  add    $0x1,%ebp
  cmp    %ebx,%eax
  jne    L150
L37:
  xor    %edi,%edi
  call   <exit@plt>
  mov    0x1028(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L56
  add    $0x1038,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L2:
  lea    D18(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L46
  nopl   0x0(%rax,%rax,1)
L45:
  mov    0xc(%rsp),%edi
  call   <dup2@plt>
  mov    0x1c(%rsp),%edi
  call   <close@plt>
  jmp    L155
  nop
L134:
  mov    0x18(%rsp),%edi
  xor    %esi,%esi
  call   <dup2@plt>
  jmp    L93
L31:
  lea    D25(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L48
L44:
  mov    $0x1,%edi
  call   <close@plt>
  mov    0xc(%rsp),%edi
  mov    $0x1,%esi
  call   <dup2@plt>
  jmp    L37
L56:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D29
data_type: string
name: extract_symbolic_data
arguments: data_label: D18
data_type: string
name: extract_symbolic_data
arguments: data_label: D25
data_type: string

tool: D29: parent error: %s didn't exec


tool: D18: error creating pipe

tool: D25: usage: pipe-4 executable-file number-of-procs

assistant: ```c
int main(int argc, char **argv, char **envp) {
  pid_t child_id;
  int child_status;
  int pipe_desc[2];
  char read_buffer[4096];
  int err;
  char file_name[4096];
  int proc_count;
  int i;
  int last_stdout;
  if (argc < 3) {
    printf("usage: pipe-4 executable-file number-of-procs\n");
    exit(1);
  }
  memset(file_name, 0, sizeof(file_name));
  strncpy(file_name, argv[1], sizeof(file_name));
  proc_count = atoi(argv[2]);
  last_stdout = dup(1);
  for (i = 0; i < proc_count; i++) {
    err = pipe(pipe_desc);
    if (err < 0) {
      printf("error creating pipe\n");
      exit(1);
    }
    child_id = fork();
    if (child_id == 0) {
      close(1);
      if (i < (proc_count - 1)) {
        dup2(pipe_desc[1], 1);
      } else {
        dup2(last_stdout, 1);
        close(pipe_desc[1]);
      }
      err = execve(file_name, &argv[1], envp);
      printf("parent error: %s didn't exec\n", file_name);
      exit(1);
    } else {
      close(0);
      if (i < (proc_count - 1)) {
        dup2(pipe_desc[0], 0);
      }
      close(pipe_desc[0]);
      close(pipe_desc[1]);
    }
  }
  close(1);
  dup2(last_stdout, 1);
  for (i = 0; i < proc_count; i++) {
    child_id = wait(&child_status);
  }
  exit(0);
}
```