user: 请将以下的汇编代码转换成C语言代码:

```asm
<run_task>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rdi,%r12
  mov    %rdx,%rdi
  push   %rbp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  lea    0xa(%rbp,%rax,1),%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L93
  mov    %rax,%rbp
  mov    %r12,%rcx
  mov    %r13,%rdx
  mov    %rax,%rdi
  lea    D0(%rip),%rsi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  lea    D3(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L47
  call   <fclose@plt>
  call   <fork@plt>
  mov    %eax,%edi
  cmp    $0xffffffff,%eax
  je     L107
  test   %eax,%eax
  je     L44
  xor    %edx,%edx
  lea    0x4(%rsp),%rsi
  call   <waitpid@plt>
  mov    0x4(%rsp),%edi
  call   <WIFEXITED@plt>
  test   %eax,%eax
  jne    L17
  movl   $0x1,(%rbx)
L83:
  mov    %rbp,%rdi
  call   <free@plt>
  xor    %eax,%eax
L86:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L58
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L44:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <exec_command@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <free@plt>
  mov    %r12d,%esi
  lea    D40(%rip),%rdi
  call   <log_debug@plt>
  mov    %r12d,%edi
  call   <exit@plt>
  jmp    L83
  nop
L93:
  mov    %r12,%rsi
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  call   <log_error@plt>
  mov    $0x1,%eax
  jmp    L86
  nopl   0x0(%rax,%rax,1)
L17:
  mov    0x4(%rsp),%edi
  call   <WEXITSTATUS@plt>
  lea    D19(%rip),%rdi
  mov    %eax,(%rbx)
  mov    %eax,%esi
  call   <log_debug@plt>
  jmp    L83
  xchg   %ax,%ax
L47:
  mov    %rbp,%rdx
  mov    %r12,%rsi
  lea    D29(%rip),%rdi
  xor    %eax,%eax
  call   <log_error@plt>
  mov    $0x2,%eax
  jmp    L86
  xchg   %ax,%ax
L107:
  mov    %r14,%rsi
  lea    D34(%rip),%rdi
  xor    %eax,%eax
  call   <log_error@plt>
  mov    $0x1,%eax
  jmp    L86
L58:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D0
type: string
name: parse_data
arguments: data_tag: D3
type: string
name: parse_data
arguments: data_tag: D40
type: string
name: parse_data
arguments: data_tag: D5
type: string
name: parse_data
arguments: data_tag: D19
type: string
name: parse_data
arguments: data_tag: D29
type: string
name: parse_data
arguments: data_tag: D34
type: string

tool: D0: %s/%s_console

tool: D3: w

tool: D40: forked process exits with status %d

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

tool: D19: parent process get status %d

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

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

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;
}
```