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

```asm
<print_x25>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  movzbl (%rsi),%r12d
  mov    %r12d,%r13d
  and    $0x30,%r13d
  mov    %rsi,%rdi
  call   <get_lci@plt>
  mov    %eax,%edx
  movzbl 0x2(%rbp),%ecx
  movzbl %cl,%r8d
  test   $0x1,%cl
  jne    L87
  mov    %r8d,%edi
  sar    %edi
  cmp    $0x20,%r13b
  je     L251
  and    $0x7,%edi
  and    $0x10,%ecx
  sar    $0x5,%r8d
L19:
  test   $0x40,%r12b
  lea    D159(%rip),%rsi
  lea    D154(%rip),%rax
  cmove  %rax,%rsi
  test   %r12b,%r12b
  lea    D186(%rip),%rax
  lea    D154(%rip),%r9
  cmovns %r9,%rax
  test   %ecx,%ecx
  push   %rsi
  push   %rax
  lea    D80(%rip),%r9
  lea    D154(%rip),%rax
  cmove  %rax,%r9
  mov    %edi,%ecx
  mov    %rbx,%rsi
  lea    D48(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  add    $0x10,%rsp
L335:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L251:
  movzbl 0x3(%rbp),%ecx
  movzbl %cl,%r8d
  and    $0x1,%ecx
  sar    %r8d
  jmp    L19
L87:
  cmp    $0x25,%cl
  ja     L244
  ja     L15
  movzbl %cl,%ecx
  lea    D140(%rip),%rsi
  movslq (%rsi,%rcx,4),%rax
  add    %rsi,%rax
  notrack jmp *%rax
L73:
  add    $0x57,%ecx
  mov    $0x1,%eax
  shl    %cl,%rax
  movabs $0x100000001,%rcx
  test   %rcx,%rax
  jne    L203
  movabs $0x1000000010000000,%rcx
  test   %rcx,%rax
  jne    L393
  movabs $0x100000001000000,%rcx
  test   %rcx,%rax
  jne    L255
L15:
  mov    %r8d,%ecx
  mov    %rbx,%rsi
  lea    D69(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
L244:
  cmp    $0xe5,%cl
  ja     L311
  cmp    $0xa8,%cl
  ja     L73
  cmp    $0x65,%cl
  jbe    L139
  sub    $0x69,%ecx
  cmp    $0x3c,%cl
  ja     L15
  mov    $0x1,%eax
  shl    %cl,%rax
  movabs $0x100000001,%rcx
  test   %rcx,%rax
  jne    L203
  movabs $0x1000000010000000,%rcx
  test   %rcx,%rax
  jne    L393
  movabs $0x100000001000000,%rcx
  test   %rcx,%rax
  je     L15
  jmp    L255
L139:
  cmp    $0x28,%cl
  jbe    L15
  sub    $0x29,%ecx
  mov    $0x1,%eax
  shl    %cl,%rax
  movabs $0x100000001,%rcx
  test   %rcx,%rax
  jne    L203
  movabs $0x1000000010000000,%rcx
  test   %rcx,%rax
  jne    L393
  movabs $0x100000001000000,%rcx
  test   %rcx,%rax
  je     L15
  jmp    L255
L311:
  cmp    $0xfb,%cl
  je     L32
  cmp    $0xff,%cl
  jne    L342
  mov    %rbx,%rsi
  lea    D196(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
L342:
  cmp    $0xe9,%cl
  jne    L15
L203:
  mov    %r8d,%ecx
  sar    $0x5,%ecx
  mov    %rbx,%rsi
  lea    D163(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
  cmp    $0x20,%r13b
  je     L310
L255:
  mov    %r8d,%ecx
  sar    $0x5,%ecx
  mov    %rbx,%rsi
  lea    D44(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
L310:
  movzbl 0x3(%rbp),%ecx
  shr    %cl
  movzbl %cl,%ecx
  mov    %rbx,%rsi
  lea    D44(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
  cmp    $0x20,%r13b
  je     L37
L393:
  mov    %r8d,%ecx
  sar    $0x5,%ecx
  mov    %rbx,%rsi
  lea    D180(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
L37:
  movzbl 0x3(%rbp),%ecx
  shr    %cl
  movzbl %cl,%ecx
  mov    %rbx,%rsi
  lea    D97(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
  cmp    $0x20,%r13b
  jne    L203
  movzbl 0x3(%rbp),%ecx
  shr    %cl
  movzbl %cl,%ecx
  mov    %rbx,%rsi
  lea    D163(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
  mov    %rbx,%rsi
  lea    D88(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
  mov    %rbx,%rsi
  lea    D95(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
  mov    %rbx,%rsi
  lea    D166(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
  mov    %rbx,%rsi
  lea    D175(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
L32:
  mov    %rbx,%rsi
  lea    D119(%rip),%rdi
  mov    $0x0,%eax
  call   <printd@plt>
  jmp    L335
```

tool_calls: name: retrieve_data
arguments: label: D159
datatype: string
name: retrieve_data
arguments: label: D154
datatype: string
name: retrieve_data
arguments: label: D186
datatype: string
name: retrieve_data
arguments: label: D80
datatype: string
name: retrieve_data
arguments: label: D48
datatype: string
name: retrieve_data
arguments: label: D69
datatype: string
name: retrieve_data
arguments: label: D196
datatype: string
name: retrieve_data
arguments: label: D163
datatype: string
name: retrieve_data
arguments: label: D44
datatype: string
name: retrieve_data
arguments: label: D180
datatype: string
name: retrieve_data
arguments: label: D97
datatype: string
name: retrieve_data
arguments: label: D88
datatype: string
name: retrieve_data
arguments: label: D95
datatype: string
name: retrieve_data
arguments: label: D166
datatype: string
name: retrieve_data
arguments: label: D175
datatype: string
name: retrieve_data
arguments: label: D119
datatype: string

tool: D159: . D

tool: 

tool: D186: , Q

tool: D80: , M

tool: D48: %s lci=%d DATA (ps=%d, pr=%d%s%s%s)

tool: D69: %s lci=%d pti=0x%02x

tool: D196: %s lci=%d RESTART CONFIRMATION

tool: D163: %s lci=%d REJ (pr=%d)

tool: D44: %s lci=%d RR (pr=%d)

tool: D180: %s lci=%d RNR (pr=%d)

tool: D97: %s lci=%d RNR(pr=%d)

tool: D88: %s lci=%d CALL REQUEST

tool: D95: %s lci=%d CALL ACCEPT

tool: D166: %s lci=%d CLEAR REQUEST

tool: D175: %s lci=%d CLEAR CONFIRMATION

tool: D119: %s lci=%d RESTART REQUEST

assistant: ```c
void print_x25(const char *head, const unsigned char *packet, int len) {
  int gfi = *packet;
  int extended = (gfi & 0x30) == 0x20;
  int lci = get_lci(packet);
  int pti = packet[2];
  if (!(pti & 1)) {
    int ps = pti >> 1, pr, m;
    if (extended) {
      pr = packet[3];
      m = pr & 1;
      pr >>= 1;
    } else {
      ps &= 0x7;
      m = pti & 0x10;
      pr = pti >> 5;
    }
    printd("%s lci=%d DATA (ps=%d, pr=%d%s%s%s)", head, lci, ps, pr, m ? ", M" : "", (gfi & 0x80) ? ", Q" : "", (gfi & 0x40) ? ". D" : "");
  } else
    switch (pti) {
    case (0x01 + (0 << 5)):
      if (extended) {
        printd("%s lci=%d RR (pr=%d)", head, lci, packet[3] >> 1);
        break;
      }
    case (0x01 + (1 << 5)):
    case (0x01 + (2 << 5)):
    case (0x01 + (3 << 5)):
    case (0x01 + (4 << 5)):
    case (0x01 + (5 << 5)):
    case (0x01 + (6 << 5)):
    case (0x01 + (7 << 5)):
      printd("%s lci=%d RR (pr=%d)", head, lci, pti >> 5);
      break;
    case (0x05 + (0 << 5)):
      if (extended) {
        printd("%s lci=%d RNR(pr=%d)", head, lci, packet[3] >> 1);
        break;
      }
    case (0x05 + (1 << 5)):
    case (0x05 + (2 << 5)):
    case (0x05 + (3 << 5)):
    case (0x05 + (4 << 5)):
    case (0x05 + (5 << 5)):
    case (0x05 + (6 << 5)):
    case (0x05 + (7 << 5)):
      printd("%s lci=%d RNR (pr=%d)", head, lci, pti >> 5);
      break;
    case (0x09 + (0 << 5)):
      if (extended) {
        printd("%s lci=%d REJ (pr=%d)", head, lci, packet[3] >> 1);
        break;
      }
    case (0x09 + (1 << 5)):
    case (0x09 + (2 << 5)):
    case (0x09 + (3 << 5)):
    case (0x09 + (4 << 5)):
    case (0x09 + (5 << 5)):
    case (0x09 + (6 << 5)):
    case (0x09 + (7 << 5)):
      printd("%s lci=%d REJ (pr=%d)", head, lci, pti >> 5);
      break;
    case 0x0B:
      printd("%s lci=%d CALL REQUEST", head, lci);
      break;
    case 0x0F:
      printd("%s lci=%d CALL ACCEPT", head, lci);
      break;
    case 0x13:
      printd("%s lci=%d CLEAR REQUEST", head, lci);
      break;
    case 0x17:
      printd("%s lci=%d CLEAR CONFIRMATION", head, lci);
      break;
    case 0xFB:
      printd("%s lci=%d RESTART REQUEST", head, lci);
      break;
    case 0xFF:
      printd("%s lci=%d RESTART CONFIRMATION", head, lci);
      break;
    default:
      printd("%s lci=%d pti=0x%02x", head, lci, pti);
    }
}
```