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

```asm
<is_input_valid>:
  endbr64
  test   %esi,%esi
  jle    L215
  mov    %rdi,%rcx
  mov    %esi,%r9d
  mov    $0x0,%eax
  mov    $0x0,%r11d
  mov    $0x0,%r10d
  mov    $0x0,%r8d
  mov    $0x0,%edi
  sub    $0x1,%esi
L10:
  movzbl (%rcx,%rax,1),%edx
  cmp    $0x3e,%dl
  je     L4
  cmp    $0x3c,%dl
  je     L377
  push   %rbx
  jmp    L166
L110:
  test   %eax,%eax
  jg     L117
  mov    $0x0,%edi
L199:
  mov    %edi,%eax
  pop    %rbx
  ret
L117:
  cmpb   $0x32,-0x1(%rcx,%rax,1)
  jne    L339
  add    $0x1,%r11d
  jmp    L148
L339:
  add    $0x1,%r10d
  jmp    L148
L57:
  add    $0x1,%r8d
L148:
  add    $0x1,%rax
  cmp    %r9,%rax
  je     L23
  movzbl (%rcx,%rax,1),%edx
  cmp    $0x3e,%dl
  je     L110
  cmp    $0x3c,%dl
  je     L57
L166:
  cmp    $0x7c,%dl
  je     L30
  cmp    %eax,%esi
  jne    L148
  test   %edi,%edi
  je     L95
  test   %r8d,%r8d
  setne  %dl
  cmp    $0x1,%r10d
  setg   %r8b
  or     %r8b,%dl
  jne    L151
  cmp    $0x1,%r11d
  jg     L151
  mov    $0x0,%r8d
  jmp    L148
L30:
  add    $0x1,%edi
  cmp    $0x1,%edi
  je     L141
  or     %r10d,%r8d
  jne    L28
  cmp    $0x1,%r11d
  jg     L28
  mov    $0x0,%r11d
  mov    $0x0,%r10d
  mov    $0x0,%r8d
  jmp    L148
L141:
  cmp    $0x1,%r8d
  setg   %dl
  test   %r10d,%r10d
  setne  %r8b
  or     %r8b,%dl
  jne    L145
  cmp    $0x1,%r11d
  jg     L145
  mov    $0x0,%r11d
  mov    $0x0,%r10d
  mov    $0x0,%r8d
  jmp    L148
L95:
  cmp    $0x1,%r8d
  setg   %dl
  cmp    $0x1,%r10d
  setg   %bl
  or     %bl,%dl
  jne    L199
  cmp    $0x1,%r11d
  jle    L148
  jmp    L199
L23:
  mov    $0x1,%edi
  jmp    L199
L215:
  mov    $0x1,%edi
  jmp    L0
L145:
  mov    $0x0,%edi
  jmp    L199
L28:
  mov    $0x0,%edi
  jmp    L199
L151:
  mov    $0x0,%edi
  jmp    L199
L4:
  test   %eax,%eax
  jg     L254
  mov    $0x0,%edi
L0:
  mov    %edi,%eax
  ret
L254:
  cmpb   $0x32,-0x1(%rcx,%rax,1)
  jne    L167
  add    $0x1,%r11d
  jmp    L176
L167:
  add    $0x1,%r10d
  jmp    L176
L377:
  add    $0x1,%r8d
L176:
  add    $0x1,%rax
  cmp    %r9,%rax
  jne    L10
  mov    $0x1,%edi
  jmp    L0
```

assistant: ```c
int is_input_valid(char *buffer, int len_buffer) {
  int i = 0;
  int num_pipe = 0;
  int num_in = 0;
  int num_out = 0;
  int num_err = 0;
  for (i = 0; i < len_buffer; i++) {
    if (buffer[i] == '>') {
      if (i - 1 < 0) {
        return 0;
      }
      if (buffer[i - 1] == '2') {
        num_err++;
      } else {
        num_out++;
      }
    } else if (buffer[i] == '<') {
      num_in++;
    } else if (buffer[i] == '|') {
      num_pipe++;
      if (num_pipe == 1) {
        if (num_out)
          return 0;
        if (num_in > 1)
          return 0;
        if (num_err > 1)
          return 0;
      } else {
        if (num_out)
          return 0;
        if (num_in)
          return 0;
        if (num_err > 1)
          return 0;
      }
      num_out = 0;
      num_in = 0;
      num_err = 0;
    } else if (i == len_buffer - 1) {
      if (num_pipe) {
        if (num_out > 1)
          return 0;
        if (num_in)
          return 0;
        if (num_err > 1)
          return 0;
      } else {
        if (num_out > 1)
          return 0;
        if (num_in > 1)
          return 0;
        if (num_err > 1)
          return 0;
      }
    }
  }
  return 1;
}
```