user: What is the c source code of the assembly code below?

```asm
<is_input_valid>:
  endbr64
  test   %esi,%esi
  jle    L261
  mov    %rdi,%rcx
  movslq %esi,%r9
  xor    %eax,%eax
  xor    %r10d,%r10d
  xor    %r11d,%r11d
  xor    %edi,%edi
  xor    %r8d,%r8d
  sub    $0x1,%esi
L45:
  movzbl (%rcx,%rax,1),%edx
  cmp    $0x3e,%dl
  je     L170
  cmp    $0x3c,%dl
  je     L338
  push   %rbx
L108:
  cmp    $0x7c,%dl
  je     L212
  cmp    %eax,%esi
  je     L336
L169:
  add    $0x1,%rax
  cmp    %r9,%rax
  je     L138
  movzbl (%rcx,%rax,1),%edx
  cmp    $0x3e,%dl
  je     L235
  cmp    $0x3c,%dl
  jne    L108
  add    $0x1,%edi
  jmp    L169
  xchg   %ax,%ax
L338:
  add    $0x1,%edi
L315:
  add    $0x1,%rax
  cmp    %r9,%rax
  jne    L45
L261:
  mov    $0x1,%r8d
  jmp    L250
  nopl   0x0(%rax)
L235:
  test   %rax,%rax
  jne    L242
L163:
  xor    %r8d,%r8d
L153:
  mov    %r8d,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax)
L212:
  add    $0x1,%r8d
  cmp    $0x1,%r10d
  setg   %dl
  cmp    $0x1,%r8d
  je     L285
  or     %r11d,%edi
  jne    L163
  test   %dl,%dl
  jne    L163
  xor    %r10d,%r10d
  xor    %r11d,%r11d
  xor    %edi,%edi
  jmp    L169
  nopl   0x0(%rax)
L170:
  test   %rax,%rax
  jne    L223
  xor    %r8d,%r8d
L250:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L336:
  cmp    $0x1,%r10d
  setg   %bl
  cmp    $0x1,%r11d
  setg   %dl
  test   %r8d,%r8d
  je     L140
  or     %bl,%dl
  jne    L163
  test   %edi,%edi
  je     L169
  jmp    L163
  nopl   0x0(%rax)
L140:
  cmp    $0x1,%edi
  jg     L153
  or     %bl,%dl
  je     L169
  jmp    L153
  nop
L285:
  cmp    $0x1,%edi
  setg   %dil
  or     %dl,%dil
  jne    L163
  test   %r11d,%r11d
  jne    L163
  xor    %r10d,%r10d
  xor    %edi,%edi
  jmp    L169
L138:
  mov    $0x1,%r8d
  jmp    L153
L223:
  cmpb   $0x32,-0x1(%rcx,%rax,1)
  je     L280
  add    $0x1,%r11d
  jmp    L315
L242:
  cmpb   $0x32,-0x1(%rcx,%rax,1)
  je     L127
  add    $0x1,%r11d
  jmp    L169
L280:
  add    $0x1,%r10d
  jmp    L315
L127:
  add    $0x1,%r10d
  jmp    L169
```

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