user: What would the C source look like for the assembly code provided here?

```asm
<redirect>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    (%rdi),%rbx
  test   %rbx,%rbx
  je     L24
  mov    %rdi,%rbp
  xor    %r13d,%r13d
  jmp    L7
  nopl   0x0(%rax)
L189:
  cmp    $0x3e,%dil
  je     L68
  call   <isdigit@plt>
  test   %rax,%rax
  je     L8
  cmpb   $0x3e,0x1(%rbx)
  je     L144
L8:
  mov    0x8(%rbp),%rbx
  add    $0x8,%rbp
  test   %rbx,%rbx
  je     L24
L7:
  movsbl (%rbx),%edi
  cmp    $0x3c,%dil
  jne    L189
  mov    D10(%rip),%rax
  lea    0x1(%rbx),%rdi
  xor    %r14d,%r14d
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <open@plt>
  mov    %eax,%r12d
L6:
  test   %r12d,%r12d
  jne    L214
L88:
  mov    0x0(%rbp),%rdi
  add    $0x8,%rbp
  call   <free@plt>
  movq   $0x0,-0x8(%rbp)
  mov    0x0(%rbp),%rbx
  test   %rbx,%rbx
  jne    L7
L24:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  cs nopw 0x0(%rax,%rax,1)
L68:
  movzbl 0x1(%rbx),%eax
  lea    0x1(%rbx),%r12
  mov    $0x1,%r14d
  cmp    $0x3e,%al
  je     L13
L47:
  cmp    $0x26,%al
  je     L84
L3:
  mov    D56(%rip),%rax
  mov    %r12,%rdi
  mov    $0x1a4,%edx
  mov    (%rax),%esi
  mov    D52(%rip),%rax
  or     (%rax),%esi
  mov    D59(%rip),%rax
  or     (%rax),%esi
  xor    %eax,%eax
  call   <open@plt>
  mov    %eax,%r12d
  test   %r12d,%r12d
  je     L88
L214:
  mov    %r14d,%esi
  mov    %r12d,%edi
  call   <dup2@plt>
  test   %r13d,%r13d
  je     L156
L54:
  mov    $0x1,%r13d
  jmp    L88
  nopw   0x0(%rax,%rax,1)
L13:
  mov    D56(%rip),%rax
  lea    0x2(%rbx),%rdi
  mov    $0x1a4,%edx
  mov    (%rax),%esi
  mov    D52(%rip),%rax
  or     (%rax),%esi
  mov    D65(%rip),%rax
  or     (%rax),%esi
  xor    %eax,%eax
  call   <open@plt>
  mov    %eax,%r12d
  jmp    L6
  nopl   0x0(%rax,%rax,1)
L156:
  mov    %r12d,%edi
  call   <close@plt>
  jmp    L88
  nopl   (%rax)
L144:
  movsbl (%rbx),%r14d
  sub    $0x30,%r14d
  js     L8
  movzbl 0x2(%rbx),%eax
  lea    0x2(%rbx),%r12
  jmp    L47
  nopl   0x0(%rax,%rax,1)
L84:
  movsbl 0x1(%r12),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L3
  cmpb   $0x0,0x2(%r12)
  jne    L3
  movsbl 0x1(%r12),%edi
  sub    $0x30,%edi
  je     L54
  mov    %r14d,%esi
  call   <dup2@plt>
  jmp    L54
```

assistant: ```c
void redirect(char **args) {
  char *s;
  int fd, new_fd, io;
  int noclose = 0;
  for (; (s = *args); args++) {
    io = 1;
    fd = -1;
    if (*s == '<') {
      fd = 0;
      io = 0;
      s++;
    } else if (*s == '>' && s[1] == '>') {
      fd = 1;
      io = 2;
      s += 2;
    } else if (*s == '>') {
      fd = 1;
      s++;
    } else if (isdigit(*s) && s[1] == '>') {
      fd = *s - '0';
      s += 2;
    }
    if (fd >= 0) {
      if (io == 1 && *s == '&' && isdigit(s[1]) && !s[2]) {
        new_fd = s[1] - '0';
        noclose = 1;
      } else {
        if (io == 2) {
          new_fd = open(s, O_CREAT | O_WRONLY | O_APPEND, 0644);
        } else {
          new_fd = io ? open(s, O_CREAT | O_WRONLY | O_TRUNC, 0644) : open(s, O_RDONLY);
        }
      }
      if (new_fd) {
        dup2(new_fd, fd);
        if (!noclose)
          close(new_fd);
      }
      free(*args);
      *args = NULL;
    }
  }
}
```