user: 请将以下的汇编代码转换成C语言代码：

```asm
<Serial_Openport>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %edx,-0x50(%rbp)
  mov    %ecx,-0x54(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0xf4240,-0x4c(%rbp)
  je     L414
  cmpl   $0xf4240,-0x4c(%rbp)
  jg     L138
  cmpl   $0xe1000,-0x4c(%rbp)
  je     L331
  cmpl   $0xe1000,-0x4c(%rbp)
  jg     L138
  cmpl   $0x8ca00,-0x4c(%rbp)
  je     L514
  cmpl   $0x8ca00,-0x4c(%rbp)
  jg     L138
  cmpl   $0x7a120,-0x4c(%rbp)
  je     L394
  cmpl   $0x7a120,-0x4c(%rbp)
  jg     L138
  cmpl   $0x70800,-0x4c(%rbp)
  je     L412
  cmpl   $0x70800,-0x4c(%rbp)
  jg     L138
  cmpl   $0x38400,-0x4c(%rbp)
  je     L172
  cmpl   $0x38400,-0x4c(%rbp)
  jg     L138
  cmpl   $0x1c200,-0x4c(%rbp)
  je     L520
  cmpl   $0x1c200,-0x4c(%rbp)
  jg     L138
  cmpl   $0xe100,-0x4c(%rbp)
  je     L598
  cmpl   $0xe100,-0x4c(%rbp)
  jg     L138
  cmpl   $0x9600,-0x4c(%rbp)
  je     L167
  cmpl   $0x9600,-0x4c(%rbp)
  jg     L138
  cmpl   $0x4b00,-0x4c(%rbp)
  je     L129
  cmpl   $0x4b00,-0x4c(%rbp)
  jg     L138
  cmpl   $0x2580,-0x4c(%rbp)
  je     L643
  cmpl   $0x2580,-0x4c(%rbp)
  jg     L138
  cmpl   $0x12c0,-0x4c(%rbp)
  je     L561
  cmpl   $0x12c0,-0x4c(%rbp)
  jg     L138
  cmpl   $0x960,-0x4c(%rbp)
  je     L144
  cmpl   $0x960,-0x4c(%rbp)
  jg     L138
  cmpl   $0x708,-0x4c(%rbp)
  je     L706
  cmpl   $0x708,-0x4c(%rbp)
  jg     L138
  cmpl   $0x4b0,-0x4c(%rbp)
  je     L134
  cmpl   $0x4b0,-0x4c(%rbp)
  jg     L138
  cmpl   $0x258,-0x4c(%rbp)
  je     L359
  cmpl   $0x258,-0x4c(%rbp)
  jg     L138
  cmpl   $0x12c,-0x4c(%rbp)
  je     L622
  cmpl   $0x12c,-0x4c(%rbp)
  jg     L138
  cmpl   $0xc8,-0x4c(%rbp)
  je     L657
  cmpl   $0xc8,-0x4c(%rbp)
  jg     L138
  cmpl   $0x96,-0x4c(%rbp)
  je     L489
  cmpl   $0x96,-0x4c(%rbp)
  jg     L138
  cmpl   $0x86,-0x4c(%rbp)
  je     L17
  cmpl   $0x86,-0x4c(%rbp)
  jg     L138
  cmpl   $0x6e,-0x4c(%rbp)
  je     L301
  cmpl   $0x6e,-0x4c(%rbp)
  jg     L138
  cmpl   $0x32,-0x4c(%rbp)
  je     L220
  cmpl   $0x4b,-0x4c(%rbp)
  je     L291
  jmp    L138
L220:
  mov    D87(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L291:
  mov    D219(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L301:
  mov    D181(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L17:
  mov    D39(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L489:
  mov    D290(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L657:
  mov    D333(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L622:
  mov    D162(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L359:
  mov    D89(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L134:
  mov    D159(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L706:
  mov    D293(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L144:
  mov    D240(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L561:
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L643:
  mov    D128(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L129:
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L167:
  mov    D104(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L598:
  mov    D206(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L520:
  mov    D123(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L172:
  mov    D147(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L412:
  mov    D58(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L394:
  mov    D110(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L514:
  mov    D170(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L331:
  mov    D10(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L414:
  mov    D305(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  jmp    L648
L138:
  mov    D123(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x38(%rbp)
  nop
L648:
  mov    D163(%rip),%rax
  mov    (%rax),%edx
  mov    D284(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L603
  mov    $0xffffffff,%eax
  jmp    L403
L603:
  mov    D132(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x34(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <fcntl@plt>
  lea    -0x30(%rbp),%rax
  mov    $0x28,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D308(%rip),%rax
  mov    (%rax),%eax
  or     -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    D108(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    D292(%rip),%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x30(%rbp)
  mov    D192(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x20(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    D78(%rip),%rax
  mov    (%rax),%rax
  shl    $0x2,%rax
  add    %rax,%rdx
  mov    -0x50(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x28(%rbp),%rdx
  mov    D215(%rip),%rax
  mov    (%rax),%rax
  shl    $0x2,%rax
  add    %rax,%rdx
  mov    -0x54(%rbp),%eax
  mov    %eax,(%rdx)
  mov    D314(%rip),%rax
  mov    (%rax),%ecx
  lea    -0x30(%rbp),%rdx
  mov    -0x34(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <tcsetattr@plt>
  cmp    $0xffffffff,%eax
  jne    L109
  mov    -0x34(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    $0xffffffff,%eax
  jmp    L403
L109:
  mov    -0x34(%rbp),%eax
L403:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L596
  call   <__stack_chk_fail@plt>
L596:
  leave
  ret
```

assistant: ```c
int Serial_Openport(const char *port, int baudrate, int rec_chars, int block_time) {
  struct termios options;
  int baudr;
  int port_id;
  switch (baudrate) {
  case 50:
    baudr = B50;
    break;
  case 75:
    baudr = B75;
    break;
  case 110:
    baudr = B110;
    break;
  case 134:
    baudr = B134;
    break;
  case 150:
    baudr = B150;
    break;
  case 200:
    baudr = B200;
    break;
  case 300:
    baudr = B300;
    break;
  case 600:
    baudr = B600;
    break;
  case 1200:
    baudr = B1200;
    break;
  case 1800:
    baudr = B1800;
    break;
  case 2400:
    baudr = B2400;
    break;
  case 4800:
    baudr = B4800;
    break;
  case 9600:
    baudr = B9600;
    break;
  case 19200:
    baudr = B19200;
    break;
  case 38400:
    baudr = B38400;
    break;
  case 57600:
    baudr = B57600;
    break;
  case 115200:
    baudr = B115200;
    break;
  case 230400:
    baudr = B230400;
    break;
  case 460800:
    baudr = B460800;
    break;
  case 500000:
    baudr = B500000;
    break;
  case 576000:
    baudr = B576000;
    break;
  case 921600:
    baudr = B921600;
    break;
  case 1000000:
    baudr = B1000000;
    break;
  default:
    baudr = B115200;
    break;
  }
  port_id = open(port, O_RDWR | O_NOCTTY);
  if (port_id < 0)
    return (-1);
  fcntl(port_id, F_SETFL, 0);
  memset(&options, 0, sizeof(options));
  options.c_cflag = baudr | CS8 | CLOCAL | CREAD;
  options.c_iflag = IGNPAR;
  options.c_oflag = 0;
  options.c_lflag = 0;
  options.c_cc[VMIN] = rec_chars;
  options.c_cc[VTIME] = block_time;
  if (tcsetattr(port_id, TCSANOW, &options) == -1) {
    close(port_id);
    return (-1);
  }
  return port_id;
}
```