user: 这段汇编代码用C语言表示是什么样的：

```asm
<valid_port>:
  endbr64
  push   %rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L90
  movb   $0x0,0x7(%rsp)
  mov    %rdi,%rbp
  call   <strlen@plt>
  cmp    $0x8,%eax
  je     L107
  cmp    $0x9,%eax
  je     L233
L90:
  xor    %eax,%eax
L124:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L144
  add    $0x20,%rsp
  pop    %rbp
  ret
  nopl   (%rax)
L233:
  movzbl 0x0(%rbp),%eax
  cmp    $0x41,%al
  je     L98
  cmp    $0x42,%al
  je     L41
  cmp    $0x30,%al
  jne    L90
  cmpb   $0x32,0x1(%rbp)
  jne    L90
  lea    0x10(%rsp),%rcx
  lea    0xc(%rsp),%rdx
  sub    $0x8,%rsp
  lea    0xf(%rsp),%rax
  lea    0x2(%rbp),%rdi
  push   %rax
  lea    D13(%rip),%rsi
  xor    %eax,%eax
  lea    0x24(%rsp),%r9
  lea    0x18(%rsp),%r8
  call   <sscanf@plt>
  pop    %rdx
  pop    %rcx
  cmp    $0x4,%eax
  jne    L90
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x31,%eax
  jbe    L119
  jmp    L90
  nopw   0x0(%rax,%rax,1)
L107:
  lea    0xc(%rsp),%rcx
  lea    0x8(%rsp),%rdx
  sub    $0x8,%rsp
  mov    %rbp,%rdi
  lea    0xf(%rsp),%rax
  lea    D2(%rip),%rsi
  push   %rax
  xor    %eax,%eax
  lea    0x24(%rsp),%r9
  lea    0x20(%rsp),%r8
  call   <sscanf@plt>
  pop    %r9
  pop    %r10
  cmp    $0x4,%eax
  jne    L90
  cmpl   $0x2,0x8(%rsp)
  jne    L90
  mov    0xc(%rsp),%eax
  cmp    $0x27,%eax
  ja     L90
  movabs $0xffffff7df7dfffff,%rdx
  bt     %rax,%rdx
  jb     L90
  mov    0x10(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x8,%eax
  ja     L90
  mov    0x14(%rsp),%r8d
  xor    %eax,%eax
  test   %r8d,%r8d
  setne  %al
  jmp    L124
  nopw   0x0(%rax,%rax,1)
L98:
  cmpb   $0x42,0x1(%rbp)
  jne    L90
L22:
  lea    0x10(%rsp),%rcx
  lea    0xc(%rsp),%rdx
  sub    $0x8,%rsp
  lea    0xf(%rsp),%rax
  lea    0x2(%rbp),%rdi
  push   %rax
  lea    D13(%rip),%rsi
  xor    %eax,%eax
  lea    0x24(%rsp),%r9
  lea    0x18(%rsp),%r8
  call   <sscanf@plt>
  pop    %rsi
  pop    %rdi
  cmp    $0x4,%eax
  jne    L90
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x2,%eax
  ja     L90
L119:
  mov    0x10(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x13,%eax
  ja     L90
  mov    0x14(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x1f,%eax
  setbe  %al
  movzbl %al,%eax
  jmp    L124
  nopw   0x0(%rax,%rax,1)
L41:
  movzbl 0x1(%rbp),%eax
  sub    $0x41,%eax
  cmp    $0x19,%al
  ja     L90
  jmp    L22
L144:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D13
type: string
name: retrieve_data
arguments: data_label: D2
type: string

tool: D13: %2u%2u%c%2u%c

tool: D2: %2u%2u%2u%2u%c

assistant: ```c
int valid_port(const char *port) {
  unsigned int h, r, p, o;
  char c, t;
  if (!port)
    return 0;
  c = 0;
  switch (strlen(port)) {
  case 8:
    if (sscanf(port, "%2u%2u%2u%2u%c", &h, &r, &p, &o, &c) != 4)
      return 0;
    if (h != 2)
      return 0;
    if (!(r == 21 || r == 27 || r == 33 || r == 39))
      return 0;
    if (p < 1 || p > 9)
      return 0;
    if (o < 1 || p > 32)
      return 0;
    return 1;
  case 9:
    if ((port[0] == 'A' && port[1] == 'B') || (port[0] == 'B' && (port[1] >= 'A' && port[1] <= 'Z'))) {
      if (sscanf(port + 2, "%2u%2u%c%2u%c", &r, &p, &t, &o, &c) != 4)
        return 0;
      if (r < 1 || r > 3)
        return 0;
      if (p < 1 || p > 20)
        return 0;
      if (o < 1 || o > 32)
        return 0;
      return 1;
    } else if (port[0] == '0' && port[1] == '2') {
      if (sscanf(port + 2, "%2u%2u%c%2u%c", &r, &p, &t, &o, &c) != 4)
        return 0;
      if (r < 1 || r > 50)
        return 0;
      if (p < 1 || p > 20)
        return 0;
      if (o < 1 || o > 32)
        return 0;
      return 1;
    } else
      return 0;
  }
  return 0;
}
```