user: Demonstrate the C code that generates the assembly output below:

```asm
<is_input_valid>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L120
L340:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3e,%al
  jne    L179
  cmpl   $0x0,-0x14(%rbp)
  jg     L136
  mov    $0x0,%eax
  jmp    L171
L136:
  mov    -0x14(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x32,%al
  jne    L281
  addl   $0x1,-0x4(%rbp)
  jmp    L301
L281:
  addl   $0x1,-0x8(%rbp)
  jmp    L301
L179:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3c,%al
  jne    L360
  addl   $0x1,-0xc(%rbp)
  jmp    L301
L360:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x7c,%al
  jne    L199
  addl   $0x1,-0x10(%rbp)
  cmpl   $0x1,-0x10(%rbp)
  jne    L184
  cmpl   $0x0,-0x8(%rbp)
  je     L175
  mov    $0x0,%eax
  jmp    L171
L175:
  cmpl   $0x1,-0xc(%rbp)
  jle    L358
  mov    $0x0,%eax
  jmp    L171
L358:
  cmpl   $0x1,-0x4(%rbp)
  jle    L159
  mov    $0x0,%eax
  jmp    L171
L184:
  cmpl   $0x0,-0x8(%rbp)
  je     L276
  mov    $0x0,%eax
  jmp    L171
L276:
  cmpl   $0x0,-0xc(%rbp)
  je     L386
  mov    $0x0,%eax
  jmp    L171
L386:
  cmpl   $0x1,-0x4(%rbp)
  jle    L159
  mov    $0x0,%eax
  jmp    L171
L159:
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L301
L199:
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x14(%rbp)
  jne    L301
  cmpl   $0x0,-0x10(%rbp)
  je     L308
  cmpl   $0x1,-0x8(%rbp)
  jle    L82
  mov    $0x0,%eax
  jmp    L171
L82:
  cmpl   $0x0,-0xc(%rbp)
  je     L324
  mov    $0x0,%eax
  jmp    L171
L324:
  cmpl   $0x1,-0x4(%rbp)
  jle    L301
  mov    $0x0,%eax
  jmp    L171
L308:
  cmpl   $0x1,-0x8(%rbp)
  jle    L22
  mov    $0x0,%eax
  jmp    L171
L22:
  cmpl   $0x1,-0xc(%rbp)
  jle    L129
  mov    $0x0,%eax
  jmp    L171
L129:
  cmpl   $0x1,-0x4(%rbp)
  jle    L301
  mov    $0x0,%eax
  jmp    L171
L301:
  addl   $0x1,-0x14(%rbp)
L120:
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L340
  mov    $0x1,%eax
L171:
  pop    %rbp
  ret
```

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