user: What would the C source look like for the assembly code provided here:

```asm
<realtek_mst_i2c_spi_send_command>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %rcx,-0x38(%rbp)
  mov    %r8,-0x40(%rbp)
  movl   $0x1,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  cmpl   $0x4,-0x2c(%rbp)
  ja     L65
  cmpl   $0x3,-0x30(%rbp)
  ja     L65
  cmpl   $0x0,-0x2c(%rbp)
  jne    L89
L65:
  mov    $0xffffffff,%eax
  jmp    L4
L89:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <get_fd_from_context@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jns    L140
  mov    $0xffffffff,%eax
  jmp    L4
L140:
  subl   $0x1,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x30(%rbp),%eax
  add    %eax,%eax
  or     %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    $0xd8,%eax
  jg     L125
  cmp    $0xd7,%eax
  jge    L288
  cmp    $0xc7,%eax
  je     L280
  cmp    $0xc7,%eax
  jg     L125
  cmp    $0x60,%eax
  je     L288
  cmp    $0x60,%eax
  jg     L125
  cmp    $0x52,%eax
  je     L288
  cmp    $0x52,%eax
  jg     L125
  cmp    $0x20,%eax
  je     L288
  cmp    $0x20,%eax
  jg     L125
  cmp    $0x1,%eax
  je     L35
  cmp    $0x6,%eax
  jne    L125
  mov    $0x0,%eax
  jmp    L4
L35:
  orl    $0x20,-0x8(%rbp)
  orl    $0x40,-0x8(%rbp)
  jmp    L46
L280:
  mov    -0x10(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x2,%eax
  mov    %eax,-0x10(%rbp)
L288:
  orl    $0x20,-0x8(%rbp)
  orl    $0x80,-0x8(%rbp)
  jmp    L46
L125:
  orl    $0x40,-0x8(%rbp)
L46:
  mov    -0x8(%rbp),%eax
  movzbl %al,%edx
  mov    -0x4(%rbp),%eax
  mov    $0x60,%esi
  mov    %eax,%edi
  call   <realtek_mst_i2c_spi_write_register@plt>
  or     %eax,-0xc(%rbp)
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x4(%rbp),%eax
  mov    $0x61,%esi
  mov    %eax,%edi
  call   <realtek_mst_i2c_spi_write_register@plt>
  or     %eax,-0xc(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L227
L229:
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x14(%rbp),%eax
  add    $0x64,%eax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <realtek_mst_i2c_spi_write_register@plt>
  or     %eax,-0xc(%rbp)
  addl   $0x1,-0x14(%rbp)
L227:
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jb     L229
  mov    -0x8(%rbp),%eax
  or     $0x1,%eax
  movzbl %al,%edx
  mov    -0x4(%rbp),%eax
  mov    $0x60,%esi
  mov    %eax,%edi
  call   <realtek_mst_i2c_spi_write_register@plt>
  or     %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L268
  mov    -0xc(%rbp),%eax
  jmp    L4
L268:
  mov    -0x10(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %edx,%r8d
  mov    $0x0,%ecx
  mov    $0x1,%edx
  mov    $0x60,%esi
  mov    %eax,%edi
  call   <realtek_mst_i2c_spi_wait_command_done@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L249
  mov    -0xc(%rbp),%eax
  jmp    L4
L249:
  movl   $0x0,-0x14(%rbp)
  jmp    L215
L260:
  mov    -0x14(%rbp),%edx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x14(%rbp),%eax
  add    $0x67,%eax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <realtek_mst_i2c_spi_read_register@plt>
  or     %eax,-0xc(%rbp)
  addl   $0x1,-0x14(%rbp)
L215:
  mov    -0x14(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jb     L260
  mov    -0xc(%rbp),%eax
L4:
  leave
  ret
```

assistant: ```c
int realtek_mst_i2c_spi_send_command(const struct flashrom_flashctx *flash, unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr) {
  unsigned i;
  int max_timeout_mul = 1;
  int ret = 0;
  if (writecnt > 4 || readcnt > 3 || writecnt == 0) {
    return -1;
  }
  int fd = get_fd_from_context(flash);
  if (fd < 0)
    return -1;
  writecnt--;
  uint8_t ctrl_reg_val = (writecnt << 3) | (readcnt << 1);
  switch (writearr[0]) {
  case 0x06:
    return 0;
  case 0x01:
    ctrl_reg_val |= (1 << 5);
    ctrl_reg_val |= (2 << 5);
    break;
  case 0xc7:
    max_timeout_mul *= 20;
  case 0x60:
  case 0x52:
  case 0xd8:
  case 0xd7:
  case 0x20:
    ctrl_reg_val |= (1 << 5);
    ctrl_reg_val |= (4 << 5);
    break;
  default:
    ctrl_reg_val |= (2 << 5);
  }
  ret |= realtek_mst_i2c_spi_write_register(fd, 0x60, ctrl_reg_val);
  ret |= realtek_mst_i2c_spi_write_register(fd, 0x61, writearr[0]);
  for (i = 0; i < writecnt; ++i)
    ret |= realtek_mst_i2c_spi_write_register(fd, 0x64 + i, writearr[i + 1]);
  ret |= realtek_mst_i2c_spi_write_register(fd, 0x60, ctrl_reg_val | 0x1);
  if (ret)
    return ret;
  ret = realtek_mst_i2c_spi_wait_command_done(fd, 0x60, 0x01, 0, max_timeout_mul);
  if (ret)
    return ret;
  for (i = 0; i < readcnt; ++i)
    ret |= realtek_mst_i2c_spi_read_register(fd, 0x67 + i, &readarr[i]);
  return ret;
}
```