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

```asm
<util_runcmd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    %ecx,-0x38(%rbp)
  mov    %r8d,-0x3c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x10(%rbp)
  call   <fork@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0xffffffff,-0xc(%rbp)
  je     L92
  cmpl   $0x0,-0xc(%rbp)
  je     L145
  jmp    L201
L92:
  movl   $0x17,-0x10(%rbp)
  jmp    L120
L145:
  mov    -0x34(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <_redirect_fd@plt>
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  je     L71
  mov    $0x1,%edi
  call   <exit@plt>
L71:
  mov    -0x38(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <_redirect_fd@plt>
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  je     L131
  mov    $0x1,%edi
  call   <exit@plt>
L131:
  mov    -0x3c(%rbp),%eax
  mov    $0x2,%esi
  mov    %eax,%edi
  call   <_redirect_fd@plt>
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  je     L123
  mov    $0x1,%edi
  call   <exit@plt>
L123:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x28(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <execvp@plt>
  test   %eax,%eax
  jns    L142
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L142
L201:
  lea    -0x14(%rbp),%rcx
  mov    -0xc(%rbp),%eax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <util_waitpid@plt>
  test   %eax,%eax
  jns    L153
  movl   $0x9,-0x10(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L152
  mov    D2(%rip),%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L152
L153:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <WIFEXITED@plt>
  test   %eax,%eax
  je     L0
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <WEXITSTATUS@plt>
  test   %eax,%eax
  je     L0
  movl   $0x6,-0x10(%rbp)
  jmp    L144
L0:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <WIFSIGNALED@plt>
  test   %eax,%eax
  je     L207
  movl   $0x7,-0x10(%rbp)
  jmp    L144
L207:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <WIFSTOPPED@plt>
  test   %eax,%eax
  je     L144
  movl   $0x8,-0x10(%rbp)
L144:
  cmpq   $0x0,-0x30(%rbp)
  je     L152
  mov    -0x14(%rbp),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L152
L142:
  nop
  jmp    L120
L152:
  nop
L120:
  mov    -0x10(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
int util_runcmd(char **argv, int *wstat, int ifd, int ofd, int efd) {
  pid_t pid;
  int res = 0;
  int s;
  switch ((pid = fork())) {
  case -1:
    res = 23;
    break;
  case 0:
    if ((res = _redirect_fd(ifd, 0)) != 0)
      exit(1);
    if ((res = _redirect_fd(ofd, 1)) != 0)
      exit(1);
    if ((res = _redirect_fd(efd, 2)) != 0)
      exit(1);
    if (execvp(argv[0], argv) < 0) {
      exit(1);
    }
    break;
  default:
    if (util_waitpid(pid, &s, 0) < 0) {
      res = 9;
      if (wstat)
        *wstat = errno;
    } else {
      if (WIFEXITED(s) && WEXITSTATUS(s) != 0)
        res = 6;
      else if (WIFSIGNALED(s))
        res = 7;
      else if (WIFSTOPPED(s))
        res = 8;
      if (wstat)
        *wstat = s;
    }
    break;
  }
  return res;
}
```