user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<FS460_set_input_mode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x1,-0x24(%rbp)
  je     L354
  cmpl   $0x2,-0x24(%rbp)
  je     L354
  mov    $0x1000,%eax
  jmp    L401
L354:
  lea    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x3c,%edi
  call   <sio_read_reg@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L365
  mov    -0x1c(%rbp),%eax
  jmp    L401
L365:
  lea    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x3e,%edi
  call   <sio_read_reg@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L234
  mov    -0x1c(%rbp),%eax
  jmp    L401
L234:
  cmpl   $0x3,-0x28(%rbp)
  je     L339
  cmpl   $0x3,-0x28(%rbp)
  jg     L331
  cmpl   $0x2,-0x28(%rbp)
  je     L360
  cmpl   $0x2,-0x28(%rbp)
  jg     L331
  cmpl   $0x0,-0x28(%rbp)
  je     L149
  cmpl   $0x1,-0x28(%rbp)
  je     L91
  jmp    L331
L149:
  cmpl   $0x1,-0x24(%rbp)
  je     L271
  cmpl   $0x2,-0x24(%rbp)
  je     L150
  jmp    L331
L271:
  mov    -0x18(%rbp),%rax
  and    $0xfb,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xfb,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xef,%ah
  mov    %rax,-0x10(%rbp)
  nop
  jmp    L331
L150:
  mov    -0x18(%rbp),%rax
  and    $0xf7,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xf7,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xdf,%ah
  mov    %rax,-0x10(%rbp)
  jmp    L331
L91:
  cmpl   $0x1,-0x24(%rbp)
  je     L190
  cmpl   $0x2,-0x24(%rbp)
  je     L3
  jmp    L331
L190:
  mov    -0x18(%rbp),%rax
  and    $0xfb,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xfffffffffffffff7,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x10,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xfb,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x10,%ah
  mov    %rax,-0x10(%rbp)
  nop
  jmp    L331
L3:
  mov    -0x18(%rbp),%rax
  and    $0xf7,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xfffffffffffffffb,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x20,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xf7,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x20,%ah
  mov    %rax,-0x10(%rbp)
  jmp    L331
L360:
  cmpl   $0x1,-0x24(%rbp)
  je     L153
  cmpl   $0x2,-0x24(%rbp)
  je     L199
  jmp    L331
L153:
  lea    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x2,%edi
  call   <FS460_get_input_mode@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L35
  mov    -0x1c(%rbp),%eax
  jmp    L401
L35:
  mov    -0x20(%rbp),%eax
  cmp    $0x2,%eax
  jne    L423
  mov    $0x1125,%eax
  jmp    L401
L423:
  mov    -0x18(%rbp),%rax
  or     $0x4,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xfffffffffffffffe,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xffffffffffffffef,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x4,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x10,%ah
  mov    %rax,-0x10(%rbp)
  jmp    L229
L199:
  lea    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <FS460_get_input_mode@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L45
  mov    -0x1c(%rbp),%eax
  jmp    L401
L45:
  mov    -0x20(%rbp),%eax
  cmp    $0x2,%eax
  jne    L273
  mov    $0x1125,%eax
  jmp    L401
L273:
  mov    -0x18(%rbp),%rax
  or     $0x8,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xfffffffffffffffe,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xffffffffffffffdf,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x8,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x20,%ah
  mov    %rax,-0x10(%rbp)
  nop
L229:
  jmp    L331
L339:
  cmpl   $0x1,-0x24(%rbp)
  je     L173
  cmpl   $0x2,-0x24(%rbp)
  je     L72
  jmp    L303
L173:
  mov    -0x18(%rbp),%rax
  and    $0xfb,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x8,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x10,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x4,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x10,%ah
  mov    %rax,-0x10(%rbp)
  jmp    L303
L72:
  mov    -0x18(%rbp),%rax
  and    $0xf7,%ah
  mov    %rax,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x4,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x20,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x8,%ah
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x20,%ah
  mov    %rax,-0x10(%rbp)
  nop
L303:
  nop
L331:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x3c,%edi
  call   <sio_write_reg@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L430
  mov    -0x1c(%rbp),%eax
  jmp    L401
L430:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x3e,%edi
  call   <sio_write_reg@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L29
  mov    -0x1c(%rbp),%eax
  jmp    L401
L29:
  mov    $0x0,%eax
L401:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L89
  call   <__stack_chk_fail@plt>
L89:
  leave
  ret
```

assistant: ```c
int FS460_set_input_mode(int input, int mode) {
  int err;
  unsigned long mux1, mux2;
  if ((1 != input) && (2 != input))
    return 0x1000;
  err = sio_read_reg(0x3C, &mux1);
  if (err)
    return err;
  err = sio_read_reg(0x3E, &mux2);
  if (err)
    return err;
  switch (mode) {
  case 0: {
    switch (input) {
    case 1: {
      mux1 &= ~(1 << 10);
      mux2 &= ~(1 << 10);
      mux2 &= ~(1 << 12);
    } break;
    case 2: {
      mux1 &= ~(1 << 11);
      mux2 &= ~(1 << 11);
      mux2 &= ~(1 << 13);
    }
    }
  } break;
  case 1: {
    switch (input) {
    case 1: {
      mux1 &= ~(1 << 10);
      mux2 &= ~(1 << 3);
      mux2 |= (1 << 4);
      mux2 &= ~(1 << 10);
      mux2 |= (1 << 12);
    } break;
    case 2: {
      mux1 &= ~(1 << 11);
      mux2 &= ~(1 << 2);
      mux2 |= (1 << 5);
      mux2 &= ~(1 << 11);
      mux2 |= (1 << 13);
    }
    }
  } break;
  case 2: {
    int i;
    switch (input) {
    case 1: {
      err = FS460_get_input_mode(2, &i);
      if (err)
        return err;
      if (2 == i)
        return 0x1125;
      mux1 |= (1 << 10);
      mux2 &= ~(1 << 0);
      mux2 &= ~(1 << 4);
      mux2 |= (1 << 10);
      mux2 |= (1 << 12);
    } break;
    case 2: {
      err = FS460_get_input_mode(1, &i);
      if (err)
        return err;
      if (2 == i)
        return 0x1125;
      mux1 |= (1 << 11);
      mux2 &= ~(1 << 0);
      mux2 &= ~(1 << 5);
      mux2 |= (1 << 11);
      mux2 |= (1 << 13);
    } break;
    }
  } break;
  case 3: {
    switch (input) {
    case 1: {
      mux1 &= ~(1 << 10);
      mux2 |= (1 << 0);
      mux2 |= (1 << 3);
      mux2 |= (1 << 4);
      mux2 |= (1 << 10);
      mux2 |= (1 << 12);
    } break;
    case 2: {
      mux1 &= ~(1 << 11);
      mux2 |= (1 << 0);
      mux2 |= (1 << 2);
      mux2 |= (1 << 5);
      mux2 |= (1 << 11);
      mux2 |= (1 << 13);
    } break;
    }
  } break;
  }
  err = sio_write_reg(0x3C, mux1);
  if (err)
    return err;
  err = sio_write_reg(0x3E, mux2);
  if (err)
    return err;
  return 0;
}
```