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

```asm
<run_task>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r13
  mov    %rdx,%r12
  mov    %rcx,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rdx,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0xa(%rbx,%rax,1),%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L66
  mov    %rax,%rbx
  mov    %rbp,%rcx
  mov    %r12,%rdx
  lea    D41(%rip),%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    D19(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L17
  call   <fclose@plt>
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  je     L63
  test   %eax,%eax
  jne    L34
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <exec_command@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <free@plt>
  mov    %ebp,%esi
  lea    D21(%rip),%rdi
  call   <log_debug@plt>
  mov    %ebp,%edi
  call   <exit@plt>
L53:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%eax
L30:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L42
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L66:
  mov    %rbp,%rsi
  lea    D42(%rip),%rdi
  mov    $0x0,%eax
  call   <log_error@plt>
  mov    $0x1,%eax
  jmp    L30
L17:
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  lea    D59(%rip),%rdi
  mov    $0x0,%eax
  call   <log_error@plt>
  mov    $0x2,%eax
  jmp    L30
L63:
  mov    %r13,%rsi
  lea    D2(%rip),%rdi
  mov    $0x0,%eax
  call   <log_error@plt>
  mov    $0x1,%eax
  jmp    L30
L34:
  lea    0x4(%rsp),%rsi
  mov    $0x0,%edx
  mov    %eax,%edi
  call   <waitpid@plt>
  mov    0x4(%rsp),%edi
  call   <WIFEXITED@plt>
  test   %eax,%eax
  jne    L48
  movl   $0x1,(%r14)
  jmp    L53
L48:
  mov    0x4(%rsp),%edi
  call   <WEXITSTATUS@plt>
  mov    %eax,%esi
  mov    %eax,(%r14)
  lea    D66(%rip),%rdi
  call   <log_debug@plt>
  jmp    L53
L42:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D41
datatype: string
name: unpack_data
arguments: data_tag: D19
datatype: string
name: unpack_data
arguments: data_tag: D21
datatype: string
name: unpack_data
arguments: data_tag: D42
datatype: string
name: unpack_data
arguments: data_tag: D59
datatype: string
name: unpack_data
arguments: data_tag: D2
datatype: string
name: unpack_data
arguments: data_tag: D66
datatype: string

tool: D41: %s/%s_console

tool: D19: w

tool: D21: forked process exits with status %d

tool: D42: Task %s could not allocate memory. Task aborted.

tool: D59: Task %s could not create or modify the file %s. Task aborted

tool: D2: Fork failure : command "%s" not runned

tool: D66: parent process get status %d

assistant: ```c
int run_task(const char *tache, const char *commande, char *logdir, int *resultat) {
  int err;
  char *ficconsole;
  FILE *fconsole = NULL;
  pid_t pid;
  ficconsole = malloc(sizeof(char) * (strlen(logdir) + strlen(tache) + 10));
  if (ficconsole == NULL) {
    log_error("Task %s could not allocate memory. Task aborted.", tache);
    return 1;
  }
  sprintf(ficconsole, "%s/%s_console", logdir, tache);
  fconsole = fopen(ficconsole, "w");
  if (fconsole == NULL) {
    log_error("Task %s could not create or modify the file %s. Task aborted", tache, ficconsole);
    return 2;
  }
  fclose(fconsole);
  pid = fork();
  if (pid == -1) {
    log_error("Fork failure : command \"%s\" not runned", commande);
    return 1;
  }
  if (pid == 0) {
    int err = exec_command(ficconsole, commande);
    free(ficconsole);
    log_debug("forked process exits with status %d", err);
    exit(err);
  } else {
    int wstatus;
    waitpid(pid, &wstatus, 0);
    if (!WIFEXITED(wstatus)) {
      *resultat = 1;
    } else {
      *resultat = WEXITSTATUS(wstatus);
      log_debug("parent process get status %d", *resultat);
    }
  }
  free(ficconsole);
  return 0;
}
```