user: 请从给定的汇编指令推导出C源代码：

```asm
<set_serial>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %edi,%ebp
  mov    %esi,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  call   <tcgetattr@plt>
  test   %rax,%rax
  jne    L50
  mov    D64(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x28(%rsp)
  movq   $0x0,0x20(%rsp)
  mov    D51(%rip),%rax
  mov    (%rax),%eax
  mov    D111(%rip),%rdx
  or     (%rdx),%eax
  mov    D130(%rip),%rdx
  or     (%rdx),%eax
  mov    %eax,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  cmp    $0x1c200,%ebx
  je     L98
  cmp    $0xe100,%ebx
  je     L41
  cmp    $0x9600,%ebx
  je     L161
  cmp    $0x4b00,%ebx
  je     L67
  cmp    $0x2580,%ebx
  je     L80
  cmp    $0x12c0,%ebx
  je     L202
  cmp    $0x960,%ebx
  je     L192
  cmp    $0x4b0,%ebx
  je     L30
  cmp    $0x12c,%ebx
  jne    L160
  mov    D61(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L98:
  mov    D102(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
L212:
  lea    0x10(%rsp),%rdx
  mov    D62(%rip),%rax
  mov    (%rax),%esi
  mov    %ebp,%edi
  call   <tcsetattr@plt>
  test   %rax,%rax
  jne    L151
  lea    0xc(%rsp),%rbx
  mov    %rbx,%rdx
  mov    D38(%rip),%rax
  mov    (%rax),%esi
  mov    %ebp,%edi
  call   <ioctl@plt>
  mov    D94(%rip),%rax
  mov    (%rax),%eax
  or     %eax,0xc(%rsp)
  mov    %rbx,%rdx
  mov    D55(%rip),%rax
  mov    (%rax),%esi
  mov    %ebp,%edi
  call   <ioctl@plt>
  mov    $0x0,%eax
L135:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L177
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L41:
  mov    D66(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L161:
  mov    D103(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L67:
  mov    D15(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L80:
  mov    D160(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L202:
  mov    D142(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L192:
  mov    D143(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L30:
  mov    D155(%rip),%r12
  lea    0x10(%rsp),%rbx
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetospeed@plt>
  mov    (%r12),%esi
  mov    %rbx,%rdi
  call   <cfsetispeed@plt>
  jmp    L212
L50:
  mov    $0xffffffff,%eax
  jmp    L135
L160:
  mov    $0xffffffff,%eax
  jmp    L135
L151:
  mov    $0xffffffff,%eax
  jmp    L135
L177:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int set_serial(int fd, int baud) {
  struct termios tios;
  if (tcgetattr(fd, &tios))
    return -1;
  tios.c_iflag = IGNPAR;
  tios.c_oflag = 0;
  tios.c_cflag = (CS8 | CREAD | CLOCAL);
  tios.c_lflag = 0;
  if (baud == 115200) {
    cfsetospeed(&tios, B115200);
    cfsetispeed(&tios, B115200);
  } else if (baud == 57600) {
    cfsetospeed(&tios, B57600);
    cfsetispeed(&tios, B57600);
  } else if (baud == 38400) {
    cfsetospeed(&tios, B38400);
    cfsetispeed(&tios, B38400);
  } else if (baud == 19200) {
    cfsetospeed(&tios, B19200);
    cfsetispeed(&tios, B19200);
  } else if (baud == 9600) {
    cfsetospeed(&tios, B9600);
    cfsetispeed(&tios, B9600);
  } else if (baud == 4800) {
    cfsetospeed(&tios, B4800);
    cfsetispeed(&tios, B4800);
  } else if (baud == 2400) {
    cfsetospeed(&tios, B2400);
    cfsetispeed(&tios, B2400);
  } else if (baud == 1200) {
    cfsetospeed(&tios, B1200);
    cfsetispeed(&tios, B1200);
  } else if (baud == 300) {
    cfsetospeed(&tios, B300);
    cfsetispeed(&tios, B300);
  } else
    return -1;
  if (tcsetattr(fd, TCSANOW, &tios))
    return -1;
  struct serial_struct ss;
  ioctl(fd, TIOCGSERIAL, &ss);
  ss.flags |= ASYNC_LOW_LATENCY;
  ioctl(fd, TIOCSSERIAL, &ss);
  return 0;
}
```