user: Please show me the C implementation that matches the assembly code listed below:

```asm
<FS460_set_input_mux>:
  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
  lea    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x3c,%edi
  call   <sio_read_reg@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L19
  mov    -0x14(%rbp),%eax
  jmp    L126
L19:
  cmpl   $0x1,-0x24(%rbp)
  je     L152
  cmpl   $0x3,-0x24(%rbp)
  je     L136
  mov    $0x1000,%eax
  jmp    L126
L152:
  cmpl   $0x1,-0x28(%rbp)
  je     L160
  cmpl   $0x2,-0x28(%rbp)
  je     L199
  mov    $0x1000,%eax
  jmp    L126
L160:
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <FS460_set_input_mode@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L97
  mov    -0x14(%rbp),%eax
  jmp    L126
L97:
  mov    -0x10(%rbp),%rax
  or     $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x80,%al
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0xffffffffffffffbf,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L65
L199:
  mov    $0x0,%esi
  mov    $0x2,%edi
  call   <FS460_set_input_mode@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L12
  mov    -0x14(%rbp),%eax
  jmp    L126
L12:
  mov    -0x10(%rbp),%rax
  and    $0xfffffffffffffffe,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x80,%al
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  or     $0x40,%rax
  mov    %rax,-0x10(%rbp)
  nop
L65:
  jmp    L2
L136:
  cmpl   $0x1,-0x28(%rbp)
  je     L40
  cmpl   $0x2,-0x28(%rbp)
  je     L93
  mov    $0x1000,%eax
  jmp    L126
L40:
  mov    $0x1,%esi
  mov    $0x1,%edi
  call   <FS460_set_input_mode@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L78
  mov    -0x14(%rbp),%eax
  jmp    L126
L78:
  mov    -0x10(%rbp),%rax
  or     $0x2,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L2
L93:
  mov    $0x1,%esi
  mov    $0x2,%edi
  call   <FS460_set_input_mode@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L135
  mov    -0x14(%rbp),%eax
  jmp    L126
L135:
  mov    -0x10(%rbp),%rax
  and    $0xfffffffffffffffd,%rax
  mov    %rax,-0x10(%rbp)
  nop
L2:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x3c,%edi
  call   <sio_write_reg@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L220
  mov    -0x14(%rbp),%eax
  jmp    L126
L220:
  mov    $0x0,%eax
L126:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L237
  call   <__stack_chk_fail@plt>
L237:
  leave
  ret
```

assistant: ```c
int FS460_set_input_mux(int channel, int input) {
  int err;
  unsigned long mux1;
  err = sio_read_reg(0x3C, &mux1);
  if (err)
    return err;
  switch (channel) {
  default:
    return 0x1000;
  case 1: {
    switch (input) {
    default:
      return 0x1000;
    case 1: {
      err = FS460_set_input_mode(1, 0);
      if (err)
        return err;
      mux1 |= (1 << 0);
      mux1 |= (1 << 7);
      mux1 &= ~(1 << 6);
    } break;
    case 2: {
      err = FS460_set_input_mode(2, 0);
      if (err)
        return err;
      mux1 &= ~(1 << 0);
      mux1 |= (1 << 7);
      mux1 |= (1 << 6);
    } break;
    }
  } break;
  case 3: {
    switch (input) {
    default:
      return 0x1000;
    case 1: {
      err = FS460_set_input_mode(1, 1);
      if (err)
        return err;
      mux1 |= (1 << 1);
    } break;
    case 2: {
      err = FS460_set_input_mode(2, 1);
      if (err)
        return err;
      mux1 &= ~(1 << 1);
    } break;
    }
  }
  }
  err = sio_write_reg(0x3C, mux1);
  if (err)
    return err;
  return 0;
}
```