user: Demonstrate the C code that generates the assembly output below:

```asm
<serial_open>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  mov    D69(%rip),%rax
  mov    (%rax),%esi
  mov    D160(%rip),%rax
  or     (%rax),%esi
  mov    D17(%rip),%rax
  or     (%rax),%esi
  call   <open@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jg     L25
L43:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x30,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L25:
  mov    %rsp,%r13
  xor    %esi,%esi
  mov    $0x20,%edx
  mov    %r13,%rdi
  call   <memset@plt>
  mov    %r13,%rsi
  mov    %r12d,%edi
  call   <tcgetattr@plt>
  test   %rax,%rax
  jne    L21
  mov    %ebp,%esi
  mov    %r13,%rdi
  call   <cfsetospeed@plt>
  test   %rax,%rax
  jne    L21
  mov    %ebp,%esi
  mov    %r13,%rdi
  call   <cfsetispeed@plt>
  test   %rax,%rax
  jne    L21
  mov    D91(%rip),%rax
  mov    D150(%rip),%rdx
  mov    %r12d,%edi
  mov    D5(%rip),%rsi
  mov    D155(%rip),%rcx
  mov    (%rax),%eax
  mov    (%rcx),%ecx
  or     (%rsi),%ecx
  not    %eax
  and    (%rsp),%eax
  or     (%rdx),%eax
  not    %ecx
  mov    D50(%rip),%rdx
  movd   %eax,%xmm0
  mov    0x8(%rsp),%rax
  mov    (%rdx),%edx
  not    %edx
  and    0x4(%rsp),%edx
  and    %ecx,%edx
  mov    D186(%rip),%rcx
  movd   %edx,%xmm1
  mov    D15(%rip),%rdx
  punpckldq %xmm1,%xmm0
  mov    (%rdx),%rdx
  movq   %xmm0,(%rsp)
  pxor   %xmm0,%xmm0
  movaps %xmm0,0x10(%rsp)
  movl   $0x1,(%rax,%rdx,4)
  mov    D86(%rip),%rdx
  mov    (%rdx),%rdx
  movl   $0x5,(%rax,%rdx,4)
  mov    D154(%rip),%rdx
  mov    (%rsp),%eax
  or     (%rdx),%eax
  mov    D12(%rip),%rdx
  or     (%rdx),%eax
  mov    D104(%rip),%rdx
  mov    (%rdx),%edx
  or     (%rcx),%edx
  not    %edx
  and    %edx,%eax
  mov    D114(%rip),%rdx
  mov    (%rdx),%edx
  not    %edx
  and    %edx,%eax
  mov    D107(%rip),%rdx
  mov    D40(%rip),%rcx
  movd   %eax,%xmm0
  mov    D34(%rip),%rax
  mov    (%rdx),%edx
  or     (%rcx),%edx
  mov    D171(%rip),%rcx
  mov    (%rax),%esi
  or     (%rcx),%edx
  not    %edx
  and    0x4(%rsp),%edx
  movd   %edx,%xmm2
  mov    %r13,%rdx
  punpckldq %xmm2,%xmm0
  movq   %xmm0,(%rsp)
  call   <tcsetattr@plt>
  test   %rax,%rax
  je     L43
  nopl   0x0(%rax,%rax,1)
L21:
  mov    $0xffffffff,%r12d
  jmp    L43
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int serial_open(const char *device, speed_t speed) {
  int fd = open(device, O_RDWR | O_NOCTTY | O_SYNC);
  if (fd > 0) {
    struct termios tty;
    memset(&tty, 0, sizeof tty);
    if (tcgetattr(fd, &tty) != 0) {
      return -1;
    }
    if (cfsetospeed(&tty, speed) != 0) {
      return -1;
    }
    if (cfsetispeed(&tty, speed) != 0) {
      return -1;
    }
    tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;
    tty.c_iflag &= ~IGNBRK;
    tty.c_iflag &= ~INLCR;
    tty.c_iflag &= ~ICRNL;
    tty.c_lflag = 0;
    tty.c_oflag = 0;
    tty.c_cc[VMIN] = 1;
    tty.c_cc[VTIME] = 5;
    tty.c_iflag &= ~(IXON | IXOFF | IXANY);
    tty.c_cflag |= (CLOCAL | CREAD);
    tty.c_cflag &= ~(PARENB | PARODD);
    tty.c_cflag &= ~CSTOPB;
    if (tcsetattr(fd, TCSANOW, &tty) != 0) {
      return -1;
    }
  }
  return fd;
}
```