user: Converte this assembly snippet into its equivalent C code:

```asm
<SensorSetMode_HV7131RP>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x3,%dil
  je     L62
  ja     L83
  cmp    $0x1,%dil
  je     L31
  cmp    $0x2,%dil
  jne    L17
  mov    $0xb8,%esi
  mov    $0x70,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x1,%esi
  mov    $0x7a,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x86,%esi
  mov    $0x7b,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xa0,%esi
  mov    $0x7c,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x7,%esi
  mov    $0x7d,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xa1,%esi
  mov    $0x7e,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x20,%esi
  mov    $0x7f,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L112
L33:
  mov    $0xb9,%esi
  mov    $0x70,%edi
  add    $0x18,%rsp
  jmp    1080 <VIM_SIF_I2cWriteByte@plt>
  nopl   0x0(%rax)
L83:
  cmp    $0x4,%dil
  jne    L17
  mov    $0xb8,%esi
  mov    $0x70,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  lea    0x5(%rsp),%rsi
  mov    $0x7a,%edi
  call   <VIM_SIF_I2cReadByte@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x7b,%edi
  call   <VIM_SIF_I2cReadByte@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x7c,%edi
  call   <VIM_SIF_I2cReadByte@plt>
  movzbl 0x5(%rsp),%eax
  movzbl 0x6(%rsp),%edx
  shl    $0x10,%eax
  shl    $0x8,%edx
  or     %edx,%eax
  movzbl 0x7(%rsp),%edx
  or     %edx,%eax
  cmp    $0x1d4c0,%eax
  je     L48
  mov    $0xf,%esi
  mov    $0x7d,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x42,%esi
  mov    $0x7e,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x40,%esi
  mov    $0x7f,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xb9,%esi
  mov    $0x70,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  cs nopw 0x0(%rax,%rax,1)
L17:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L112
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L31:
  mov    $0xb8,%esi
  mov    $0x70,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x1,%esi
  mov    $0x7a,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xd4,%esi
  mov    $0x7b,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xc0,%esi
  mov    $0x7c,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x9,%esi
  mov    $0x7d,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x27,%esi
  mov    $0x7e,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xc0,%esi
  mov    $0x7f,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  je     L33
L112:
  call   <__stack_chk_fail@plt>
  nopw   0x0(%rax,%rax,1)
L62:
  mov    $0xb8,%esi
  mov    $0x70,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  lea    0x5(%rsp),%rsi
  mov    $0x7a,%edi
  call   <VIM_SIF_I2cReadByte@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x7b,%edi
  call   <VIM_SIF_I2cReadByte@plt>
  lea    0x7(%rsp),%rsi
  mov    $0x7c,%edi
  call   <VIM_SIF_I2cReadByte@plt>
  movzbl 0x5(%rsp),%eax
  movzbl 0x6(%rsp),%edx
  shl    $0x10,%eax
  shl    $0x8,%edx
  or     %edx,%eax
  movzbl 0x7(%rsp),%edx
  or     %edx,%eax
  cmp    $0x1d4c0,%eax
  je     L58
  mov    $0x7,%esi
  mov    $0x7d,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xa1,%esi
  mov    $0x7e,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x20,%esi
  mov    $0x7f,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
L64:
  mov    $0xb9,%esi
  mov    $0x70,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  jmp    L17
  nopl   (%rax)
L48:
  mov    $0x12,%esi
  mov    $0x7d,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x4f,%esi
  mov    $0x7e,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x80,%esi
  mov    $0x7f,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  jmp    L64
  nopw   0x0(%rax,%rax,1)
L58:
  mov    $0x9,%esi
  mov    $0x7d,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0x27,%esi
  mov    $0x7e,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  mov    $0xc0,%esi
  mov    $0x7f,%edi
  call   <VIM_SIF_I2cWriteByte@plt>
  jmp    L64
```

assistant: ```c
void SensorSetMode_HV7131RP(unsigned char val) {
  unsigned char uTemp1, uTemp2, uTemp3;
  unsigned long uTemp;
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteByte(0x70, 0xb8);
    VIM_SIF_I2cWriteByte(0x7a, 0x01);
    VIM_SIF_I2cWriteByte(0x7b, 0xd4);
    VIM_SIF_I2cWriteByte(0x7c, 0xc0);
    VIM_SIF_I2cWriteByte(0x7d, 0x09);
    VIM_SIF_I2cWriteByte(0x7e, 0x27);
    VIM_SIF_I2cWriteByte(0x7f, 0xc0);
    VIM_SIF_I2cWriteByte(0x70, 0xb9);
    break;
  case 2:
    VIM_SIF_I2cWriteByte(0x70, 0xb8);
    VIM_SIF_I2cWriteByte(0x7a, 0x01);
    VIM_SIF_I2cWriteByte(0x7b, 0x86);
    VIM_SIF_I2cWriteByte(0x7c, 0xa0);
    VIM_SIF_I2cWriteByte(0x7d, 0x07);
    VIM_SIF_I2cWriteByte(0x7e, 0xa1);
    VIM_SIF_I2cWriteByte(0x7f, 0x20);
    VIM_SIF_I2cWriteByte(0x70, 0xb9);
    break;
  case 4:
    VIM_SIF_I2cWriteByte(0x70, 0xb8);
    VIM_SIF_I2cReadByte(0x7a, &uTemp1);
    VIM_SIF_I2cReadByte(0x7b, &uTemp2);
    VIM_SIF_I2cReadByte(0x7c, &uTemp3);
    uTemp = (unsigned long)((uTemp1 << 16) | (uTemp2 << 8) | (uTemp3));
    if (uTemp == 0x01d4c0) {
      VIM_SIF_I2cWriteByte(0x7d, 0x12);
      VIM_SIF_I2cWriteByte(0x7e, 0x4f);
      VIM_SIF_I2cWriteByte(0x7f, 0x80);
    } else {
      VIM_SIF_I2cWriteByte(0x7d, 0x0f);
      VIM_SIF_I2cWriteByte(0x7e, 0x42);
      VIM_SIF_I2cWriteByte(0x7f, 0x40);
    }
    VIM_SIF_I2cWriteByte(0x70, 0xb9);
    break;
  case 3:
    VIM_SIF_I2cWriteByte(0x70, 0xb8);
    VIM_SIF_I2cReadByte(0x7a, &uTemp1);
    VIM_SIF_I2cReadByte(0x7b, &uTemp2);
    VIM_SIF_I2cReadByte(0x7c, &uTemp3);
    uTemp = (unsigned long)((uTemp1 << 16) | (uTemp2 << 8) | (uTemp3));
    if (uTemp == 0x01d4c0) {
      VIM_SIF_I2cWriteByte(0x7d, 0x09);
      VIM_SIF_I2cWriteByte(0x7e, 0x27);
      VIM_SIF_I2cWriteByte(0x7f, 0xc0);
    } else {
      VIM_SIF_I2cWriteByte(0x7d, 0x07);
      VIM_SIF_I2cWriteByte(0x7e, 0xa1);
      VIM_SIF_I2cWriteByte(0x7f, 0x20);
    }
    VIM_SIF_I2cWriteByte(0x70, 0xb9);
    break;
  default:
    break;
  }
}
```