user: Translate the below assembly code into C programming language:

```asm
<checkpri>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  movl   $0x0,-0x4(%rbp)
  cmpl   $0x1,-0x1c(%rbp)
  jne    L473
  mov    -0x18(%rbp),%rax
  lea    D37(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L464
  cmpl   $0x0,-0x24(%rbp)
  jne    L464
  cmpl   $0x3,-0x20(%rbp)
  jne    L297
  mov    $0x0,%eax
  jmp    L340
L297:
  mov    $0xffffffff,%eax
  jmp    L340
L464:
  mov    -0x18(%rbp),%rax
  lea    D36(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L506
  cmpl   $0x0,-0x24(%rbp)
  jne    L506
  cmpl   $0xc,-0x20(%rbp)
  jne    L228
  mov    $0x0,%eax
  jmp    L340
L228:
  mov    $0xffffffff,%eax
  jmp    L340
L506:
  mov    -0x18(%rbp),%rax
  lea    D19(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L306
  cmpl   $0x1,-0x24(%rbp)
  jne    L306
  cmpl   $0x12,-0x20(%rbp)
  jne    L357
  mov    $0x1,%eax
  jmp    L340
L357:
  mov    $0xffffffff,%eax
  jmp    L340
L306:
  cmpl   $0x3,-0x20(%rbp)
  jne    L451
  cmpl   $0x0,-0x4(%rbp)
  jg     L1
  mov    $0xffffffff,%eax
  jmp    L340
L1:
  mov    $0x3,%eax
  jmp    L340
L451:
  cmpl   $0x12,-0x20(%rbp)
  jne    L419
  cmpl   $0x1,-0x4(%rbp)
  jg     L529
  mov    $0xffffffff,%eax
  jmp    L340
L529:
  mov    $0x4,%eax
  jmp    L340
L419:
  cmpl   $0xc,-0x20(%rbp)
  jne    L226
  cmpl   $0x2,-0x4(%rbp)
  jg     L305
  mov    $0xffffffff,%eax
  jmp    L340
L305:
  mov    $0x5,%eax
  jmp    L340
L473:
  cmpl   $0x4,-0x1c(%rbp)
  jne    L337
  mov    -0x18(%rbp),%rax
  lea    D45(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L523
  cmpl   $0x0,-0x24(%rbp)
  jne    L523
  cmpl   $0x1,-0x20(%rbp)
  jne    L15
  mov    $0x0,%eax
  jmp    L340
L15:
  mov    $0xffffffff,%eax
  jmp    L340
L523:
  mov    -0x18(%rbp),%rax
  lea    D30(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L441
  cmpl   $0x1,-0x24(%rbp)
  jne    L441
  cmpl   $0xe,-0x20(%rbp)
  jne    L390
  mov    $0x1,%eax
  jmp    L340
L390:
  mov    $0xffffffff,%eax
  jmp    L340
L441:
  cmpl   $0x1,-0x20(%rbp)
  jne    L93
  cmpl   $0x0,-0x4(%rbp)
  jg     L402
  mov    $0xffffffff,%eax
  jmp    L340
L402:
  mov    $0x3,%eax
  jmp    L340
L93:
  cmpl   $0xe,-0x20(%rbp)
  jne    L226
  cmpl   $0x1,-0x4(%rbp)
  jg     L72
  mov    $0xffffffff,%eax
  jmp    L340
L72:
  mov    $0x4,%eax
  jmp    L340
L337:
  cmpl   $0x10,-0x1c(%rbp)
  jne    L226
  mov    -0x18(%rbp),%rax
  lea    D65(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L229
  cmpl   $0x0,-0x24(%rbp)
  jne    L229
  cmpl   $0xd,-0x20(%rbp)
  jne    L37
  mov    $0x0,%eax
  jmp    L340
L37:
  mov    $0xffffffff,%eax
  jmp    L340
L229:
  mov    -0x18(%rbp),%rax
  lea    D54(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L575
  cmpl   $0x0,-0x24(%rbp)
  jne    L575
  cmpl   $0xc,-0x20(%rbp)
  jne    L283
  mov    $0x0,%eax
  jmp    L340
L283:
  mov    $0xffffffff,%eax
  jmp    L340
L575:
  cmpl   $0xd,-0x20(%rbp)
  jne    L158
  cmpl   $0x0,-0x4(%rbp)
  jg     L170
  mov    $0xffffffff,%eax
  jmp    L340
L170:
  mov    $0x3,%eax
  jmp    L340
L158:
  cmpl   $0xc,-0x20(%rbp)
  jne    L226
  cmpl   $0x1,-0x4(%rbp)
  jg     L642
  mov    $0xffffffff,%eax
  jmp    L340
L642:
  mov    $0x4,%eax
  jmp    L340
L226:
  cmpl   $0x2,-0x24(%rbp)
  jg     L285
  mov    -0x24(%rbp),%eax
  jmp    L340
L285:
  mov    $0xffffffff,%eax
L340:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D37
type: string
name: read_data
arguments: data_tag: D36
type: string
name: read_data
arguments: data_tag: D19
type: string
name: read_data
arguments: data_tag: D45
type: string
name: read_data
arguments: data_tag: D30
type: string
name: read_data
arguments: data_tag: D65
type: string
name: read_data
arguments: data_tag: D54
type: string

tool: D37: -GL1W

tool: D36: -GL1X

tool: D19: -GL2X

tool: D45: -RL1C

tool: D30: -RL2C

tool: D65: -JL1Z

tool: D54: -JL1X

assistant: ```c
int checkpri(const char *opt, int sys, int code, int freq) {
  int nex = 0;
  if (sys == 0x01) {
    if (strstr(opt, "-GL1W") && freq == 0)
      return code == 3 ? 0 : -1;
    if (strstr(opt, "-GL1X") && freq == 0)
      return code == 12 ? 0 : -1;
    if (strstr(opt, "-GL2X") && freq == 1)
      return code == 18 ? 1 : -1;
    if (code == 3)
      return nex < 1 ? -1 : 3;
    if (code == 18)
      return nex < 2 ? -1 : 3 + 1;
    if (code == 12)
      return nex < 3 ? -1 : 3 + 2;
  } else if (sys == 0x04) {
    if (strstr(opt, "-RL1C") && freq == 0)
      return code == 1 ? 0 : -1;
    if (strstr(opt, "-RL2C") && freq == 1)
      return code == 14 ? 1 : -1;
    if (code == 1)
      return nex < 1 ? -1 : 3;
    if (code == 14)
      return nex < 2 ? -1 : 3 + 1;
  } else if (sys == 0x10) {
    if (strstr(opt, "-JL1Z") && freq == 0)
      return code == 13 ? 0 : -1;
    if (strstr(opt, "-JL1X") && freq == 0)
      return code == 12 ? 0 : -1;
    if (code == 13)
      return nex < 1 ? -1 : 3;
    if (code == 12)
      return nex < 2 ? -1 : 3 + 1;
  }
  return freq < 3 ? freq : -1;
}
```