user: 下面的汇编指令对应的C源代码是什么：

```asm
<forkpty>:
  endbr64
  push   %r13
  mov    %rsi,%r9
  mov    %rcx,%r8
  mov    %rdx,%rcx
  push   %r12
  mov    %r9,%rdx
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rsi
  movl   $0x0,0x14(%rsp)
  movq   $0x0,0xc(%rsp)
  call   <openpty@plt>
  test   %rax,%rax
  js     L42
  mov    D29(%rip),%r13
  xor    %ebx,%ebx
L153:
  mov    0x0(%r13),%esi
  xor    %eax,%eax
  mov    %ebx,%edi
  call   <fcntl@plt>
  test   %eax,%eax
  js     L142
L128:
  add    $0x1,%rbx
  cmp    $0x3,%rbx
  jne    L153
  call   <fork@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L159
L180:
  mov    0xc(%rsp),%ecx
  test   %ecx,%ecx
  jne    L91
  mov    0x10(%rsp),%edx
  test   %edx,%edx
  jne    L138
L107:
  mov    0x14(%rsp),%eax
  test   %eax,%eax
  jne    L33
L46:
  mov    0x8(%rsp),%edi
  call   <close@plt>
  test   %r12d,%r12d
  js     L145
L78:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L178
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L142:
  mov    D17(%rip),%rax
  mov    0x8(%rsp),%edi
  mov    %ebx,%edx
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <fcntl@plt>
  mov    %eax,%edi
  test   %eax,%eax
  js     L119
  cmp    %ebx,%eax
  jne    L177
  movl   $0x1,0xc(%rsp,%rbx,4)
  jmp    L128
  nopl   0x0(%rax)
L177:
  call   <close@plt>
  jmp    L128
  nopw   0x0(%rax,%rax,1)
L91:
  xor    %edi,%edi
  call   <close@plt>
  mov    0x10(%rsp),%edx
  test   %edx,%edx
  je     L107
L138:
  mov    $0x1,%edi
  call   <close@plt>
  mov    0x14(%rsp),%eax
  test   %eax,%eax
  je     L46
L33:
  mov    $0x2,%edi
  call   <close@plt>
  mov    0x8(%rsp),%edi
  call   <close@plt>
  test   %r12d,%r12d
  jns    L78
L145:
  mov    0x0(%rbp),%edi
L189:
  call   <close@plt>
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L159:
  mov    0x0(%rbp),%edi
  call   <close@plt>
  xor    %eax,%eax
  call   <setsid@plt>
  mov    D4(%rip),%rax
  mov    0x8(%rsp),%edi
  xor    %edx,%edx
  mov    (%rax),%esi
  call   <ioctl@plt>
  mov    0x8(%rsp),%edi
  xor    %esi,%esi
  call   <dup2@plt>
  mov    0x8(%rsp),%edi
  mov    $0x1,%esi
  call   <dup2@plt>
  mov    0x8(%rsp),%edi
  mov    $0x2,%esi
  call   <dup2@plt>
  mov    0x8(%rsp),%edi
  cmp    $0x2,%edi
  jle    L78
  jmp    L189
  nopl   0x0(%rax)
L119:
  mov    $0xffffffff,%r12d
  jmp    L180
L42:
  mov    $0xffffffff,%r12d
  jmp    L78
L178:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int forkpty(int *m, char *name, const struct termios *tio, const struct winsize *ws) {
  int s, t, i, istmp[3] = {0};
  pid_t pid;
  if (openpty(m, &s, name, tio, ws) < 0)
    return -1;
  for (i = 0; i < 3; i++) {
    if (fcntl(i, F_GETFL) < 0) {
      t = fcntl(s, F_DUPFD, i);
      if (t < 0)
        break;
      else if (t != i)
        close(t);
      else
        istmp[i] = 1;
    }
  }
  pid = i == 3 ? fork() : -1;
  if (!pid) {
    close(*m);
    setsid();
    ioctl(s, TIOCSCTTY, (char *)0);
    dup2(s, 0);
    dup2(s, 1);
    dup2(s, 2);
    if (s > 2)
      close(s);
    return 0;
  }
  for (i = 0; i < 3; i++)
    if (istmp[i])
      close(i);
  close(s);
  if (pid < 0)
    close(*m);
  return pid;
}
```