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

```asm
<checkpri>:
  endbr64
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  cmp    $0x1,%esi
  je     L47
  cmp    $0x4,%esi
  je     L195
  cmp    $0x10,%esi
  je     L239
L256:
  cmp    $0x2,%r12d
  jg     L78
L50:
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L47:
  lea    D53(%rip),%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L49
  test   %r12d,%r12d
  je     L16
  lea    D18(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
L265:
  lea    D37(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  cmp    $0x1,%r12d
  jne    L192
  test   %rax,%rax
  jne    L177
L192:
  cmp    $0x12,%ebx
  ja     L256
  mov    $0xfffffffffffbeff7,%rax
  bt     %rbx,%rax
  jb     L256
  nopl   0x0(%rax)
L78:
  mov    $0xffffffff,%r12d
  jmp    L50
L49:
  lea    D18(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L265
  test   %r12d,%r12d
  jne    L265
L132:
  xor    %r12d,%r12d
  cmp    $0xc,%ebx
  setne  %r12b
  neg    %r12d
  jmp    L50
  nopl   0x0(%rax,%rax,1)
L195:
  lea    D47(%rip),%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L180
  test   %r12d,%r12d
  je     L316
L180:
  lea    D6(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L97
  cmp    $0x1,%r12d
  je     L270
L97:
  cmp    $0x1,%ebx
  je     L78
  cmp    $0xe,%ebx
  jne    L256
  jmp    L78
  nopl   0x0(%rax,%rax,1)
L239:
  lea    D0(%rip),%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L130
  test   %r12d,%r12d
  je     L119
  lea    D82(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
L307:
  lea    -0xc(%rbx),%edx
  cmp    $0x1,%edx
  ja     L256
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L16:
  xor    %r12d,%r12d
  cmp    $0x3,%ebx
  setne  %r12b
  neg    %r12d
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L130:
  lea    D82(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L307
  test   %r12d,%r12d
  je     L132
  jmp    L307
  nopw   0x0(%rax,%rax,1)
L316:
  xor    %r12d,%r12d
  cmp    $0x1,%ebx
  setne  %r12b
  neg    %r12d
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L119:
  xor    %r12d,%r12d
  cmp    $0xd,%ebx
  setne  %r12b
  neg    %r12d
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L270:
  cmp    $0xe,%ebx
  jne    L78
L240:
  mov    $0x1,%r12d
  jmp    L50
  nopl   0x0(%rax)
L177:
  cmp    $0x12,%ebx
  jne    L78
  jmp    L240
```

tool_calls: name: retrieve_data
arguments: data_label: D53
type_infered: string
name: retrieve_data
arguments: data_label: D18
type_infered: string
name: retrieve_data
arguments: data_label: D37
type_infered: string
name: retrieve_data
arguments: data_label: D47
type_infered: string
name: retrieve_data
arguments: data_label: D6
type_infered: string
name: retrieve_data
arguments: data_label: D0
type_infered: string
name: retrieve_data
arguments: data_label: D82
type_infered: string

tool: D53: -GL1W

tool: D18: -GL1X

tool: D37: -GL2X

tool: D47: -RL1C

tool: D6: -RL2C

tool: D0: -JL1Z

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