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

```asm
<check_valid>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  lea    D50(%rip),%rsi
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L11
  mov    $0x5,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  je     L37
L11:
  lea    D33(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L13
  mov    $0x5,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  je     L74
L13:
  lea    D24(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L41
  mov    $0x6,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  je     L74
L41:
  lea    D22(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  jne    L78
  mov    $0x9,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  je     L74
L78:
  lea    D53(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  je     L129
L23:
  lea    D5(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcasecmp@plt>
  test   %rax,%rax
  je     L85
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
  nop
L129:
  mov    $0xb,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  jne    L23
L74:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L37:
  mov    $0x6,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  jne    L11
  mov    $0x9,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  jne    L11
  mov    $0xb,%esi
  mov    %r12,%rdi
  call   <is_length_valid@plt>
  test   %eax,%eax
  jne    L11
  jmp    L74
  nopl   0x0(%rax)
L85:
  mov    %r12,%rdi
  mov    $0x8,%esi
  call   <is_length_valid@plt>
  test   %eax,%eax
  setne  %al
  add    $0x8,%rsp
  movzbl %al,%eax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: read_data
arguments: data_tag: D50
datatype: string
name: read_data
arguments: data_tag: D33
datatype: string
name: read_data
arguments: data_tag: D24
datatype: string
name: read_data
arguments: data_tag: D22
datatype: string
name: read_data
arguments: data_tag: D53
datatype: string
name: read_data
arguments: data_tag: D5
datatype: string

tool: D50: POSTNET

tool: D33: POSTNET-5

tool: D24: POSTNET-6

tool: D22: POSTNET-9

tool: D53: POSTNET-11

tool: D5: CEPNET

assistant: ```c
int check_valid(const char *type, const char *code) {
  if ((strcasecmp(type, "POSTNET") == 0))
    if (!is_length_valid(code, 5) && !is_length_valid(code, 6) && !is_length_valid(code, 9) && !is_length_valid(code, 11))
      return 0;
  if ((strcasecmp(type, "POSTNET-5") == 0))
    if (!is_length_valid(code, 5))
      return 0;
  if ((strcasecmp(type, "POSTNET-6") == 0))
    if (!is_length_valid(code, 6))
      return 0;
  if ((strcasecmp(type, "POSTNET-9") == 0))
    if (!is_length_valid(code, 9))
      return 0;
  if ((strcasecmp(type, "POSTNET-11") == 0))
    if (!is_length_valid(code, 11))
      return 0;
  if ((strcasecmp(type, "CEPNET") == 0))
    if (!is_length_valid(code, 8))
      return 0;
  return 1;
}
```