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

```asm
<bindresvport>:
  endbr64
  push   %r14
  mov    %edi,%r14d
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L159
  mov    D19(%rip),%rax
  mov    %rsi,%rbp
  mov    (%rax),%rax
  cmp    %rax,(%rsi)
  jne    L95
L31:
  cmpw   $0x0,D109(%rip)
  je     L72
  mov    D162(%rip),%rax
  mov    (%rax),%r12d
L129:
  movswl D28(%rip),%eax
  lea    -0x1(%r12),%r13d
  sub    %eax,%r12d
  test   %r12d,%r12d
  jle    L94
  movzwl D109(%rip),%edi
  nopl   0x0(%rax)
L149:
  xor    %ebx,%ebx
  jmp    L132
  nopl   0x0(%rax)
L21:
  mov    D71(%rip),%rdx
  mov    D78(%rip),%rcx
  mov    (%rdx),%rsi
  cmp    %rsi,(%rcx)
  jne    L12
  add    $0x1,%ebx
  cmp    %ebx,%r12d
  jle    L0
  movzwl D109(%rip),%edi
L132:
  lea    0x1(%rdi),%eax
  movswl %di,%edi
  mov    %ax,D188(%rip)
  call   <htons@plt>
  mov    %eax,0x8(%rbp)
  movswl D188(%rip),%eax
  cmp    %r13d,%eax
  jle    L126
  movzwl D28(%rip),%eax
  mov    %ax,D188(%rip)
L126:
  mov    $0x10,%edx
  mov    %rbp,%rsi
  mov    %r14d,%edi
  call   <__bind@plt>
  test   %eax,%eax
  js     L21
L12:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L130
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L94:
  mov    $0xffffffff,%eax
  xor    %ebx,%ebx
  nopl   0x0(%rax,%rax,1)
L0:
  cmp    %ebx,%r12d
  jne    L12
  cmpw   $0x200,D28(%rip)
  je     L12
  mov    $0x200,%eax
  mov    $0x257,%r13d
  mov    $0x58,%r12d
  mov    %ax,D188(%rip)
  movswl D188(%rip),%eax
  mov    %eax,%edi
  imul   $0xba3,%eax,%eax
  mov    %edi,%edx
  sar    $0xf,%dx
  sar    $0x12,%eax
  sub    %edx,%eax
  lea    (%rax,%rax,4),%edx
  lea    (%rax,%rdx,2),%eax
  shl    $0x3,%eax
  sub    %eax,%edi
  add    $0x200,%di
  jmp    L149
L72:
  xor    %eax,%eax
  call   <__getpid@plt>
  mov    D162(%rip),%rdx
  mov    (%rdx),%r12d
  cltd
  lea    -0x258(%r12),%ecx
  idiv   %ecx
  add    $0x258,%dx
  mov    %dx,D188(%rip)
  jmp    L129
L159:
  mov    %rsp,%rbp
  mov    $0x10,%esi
  mov    %rbp,%rdi
  call   <__bzero@plt>
  mov    D19(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,(%rsp)
  jmp    L31
L95:
  mov    D188(%rip),%rax
  mov    (%rax),%edi
  call   <__set_errno@plt>
  mov    $0xffffffff,%eax
  jmp    L12
L130:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bindresvport(int sd, struct sockaddr_in *sin) {
  static short port;
  struct sockaddr_in myaddr;
  int i;
  static short startport = 600;
  if (sin == (struct sockaddr_in *)0) {
    sin = &myaddr;
    __bzero(sin, sizeof(*sin));
    sin->sin_family = AF_INET;
  } else if (sin->sin_family != AF_INET) {
    __set_errno(EAFNOSUPPORT);
    return -1;
  }
  if (port == 0) {
    port = (__getpid() % ((IPPORT_RESERVED - 1) - 600 + 1)) + 600;
  }
  int res = -1;
  int nports = (IPPORT_RESERVED - 1) - startport + 1;
  int endport = (IPPORT_RESERVED - 1);
again:
  for (i = 0; i < nports; ++i) {
    sin->sin_port = htons(port++);
    if (port > endport)
      port = startport;
    res = __bind(sd, sin, sizeof(struct sockaddr_in));
    if (res >= 0 || errno != EADDRINUSE)
      break;
  }
  if (i == nports && startport != 512) {
    startport = 512;
    endport = 600 - 1;
    nports = 600 - 512;
    port = 512 + port % (600 - 512);
    goto again;
  }
  return res;
}
```