user: Converte this assembly snippet into its equivalent C code:

```asm
<checkpri>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %esi,%ebp
  mov    %edx,%r13d
  mov    %ecx,%ebx
  cmp    $0x1,%esi
  je     L109
  cmp    $0x4,%esi
  je     L260
  cmp    $0x10,%esi
  je     L198
L273:
  cmp    $0x2,%ebx
  jg     L89
L327:
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L109:
  lea    D26(%rip),%rsi
  call   <strstr@plt>
  test   %ebx,%ebx
  sete   %r14b
  test   %rax,%rax
  je     L64
  test   %r14b,%r14b
  jne    L315
L64:
  lea    D61(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L321
  test   %r14b,%r14b
  jne    L324
L321:
  lea    D54(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  cmp    $0x1,%ebx
  jne    L14
  test   %rax,%rax
  jne    L220
L14:
  cmp    $0x12,%r13d
  ja     L273
  mov    $0x41008,%eax
  bt     %r13,%rax
  jae    L273
  mov    $0xffffffff,%ebx
  jmp    L327
L315:
  cmp    $0x3,%r13d
  setne  %bl
  movzbl %bl,%ebx
  neg    %ebx
  jmp    L327
L324:
  cmp    $0xc,%r13d
  setne  %bl
  movzbl %bl,%ebx
  neg    %ebx
  jmp    L327
L220:
  cmp    $0x12,%r13d
  mov    $0xffffffff,%ebx
  cmove  %ebp,%ebx
  jmp    L327
L260:
  lea    D69(%rip),%rsi
  call   <strstr@plt>
  test   %ebx,%ebx
  jne    L253
  test   %rax,%rax
  jne    L310
L253:
  lea    D4(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  cmp    $0x1,%ebx
  jne    L95
  test   %rax,%rax
  jne    L133
L95:
  cmp    $0xe,%r13d
  je     L209
  cmp    $0x1,%r13d
  jne    L273
L209:
  mov    $0xffffffff,%ebx
  jmp    L327
L310:
  cmp    $0x1,%r13d
  setne  %bl
  movzbl %bl,%ebx
  neg    %ebx
  jmp    L327
L133:
  cmp    $0xe,%r13d
  sete   %bl
  movzbl %bl,%ebx
  lea    -0x1(%rbx,%rbx,1),%ebx
  jmp    L327
L198:
  lea    D16(%rip),%rsi
  call   <strstr@plt>
  test   %ebx,%ebx
  sete   %bpl
  test   %rax,%rax
  je     L62
  test   %bpl,%bpl
  jne    L41
L62:
  lea    D18(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L119
  test   %bpl,%bpl
  jne    L332
L119:
  lea    -0xc(%r13),%edx
  cmp    $0x1,%edx
  ja     L273
  mov    $0xffffffff,%ebx
  jmp    L327
L41:
  cmp    $0xd,%r13d
  setne  %bl
  movzbl %bl,%ebx
  neg    %ebx
  jmp    L327
L332:
  cmp    $0xc,%r13d
  setne  %bl
  movzbl %bl,%ebx
  neg    %ebx
  jmp    L327
L89:
  mov    $0xffffffff,%ebx
  jmp    L327
```

tool_calls: name: read_data
arguments: data_label: D26
type_infered: string
name: read_data
arguments: data_label: D61
type_infered: string
name: read_data
arguments: data_label: D54
type_infered: string
name: read_data
arguments: data_label: D69
type_infered: string
name: read_data
arguments: data_label: D4
type_infered: string
name: read_data
arguments: data_label: D16
type_infered: string
name: read_data
arguments: data_label: D18
type_infered: string

tool: D26: -GL1W

tool: D61: -GL1X

tool: D54: -GL2X

tool: D69: -RL1C

tool: D4: -RL2C

tool: D16: -JL1Z

tool: D18: -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;
}
```