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

```asm
<TstActMov_OFILM>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  mov    $0x3,%edi
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <MesFil_OFILM@plt>
  test   %bl,%bl
  jne    L15
  mov    $0x3ecccccd,%esi
  mov    $0x10d5,%edi
  call   <RamWrite32A_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x11d5,%edi
  call   <RamWrite32A_Ofilm@plt>
  mov    $0xa,%esi
  mov    $0x5,%edi
  call   <SetSinWavePara_OFILM@plt>
  mov    $0x33,%esi
  mov    $0x194,%edi
  call   <RegWriteA_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x195,%edi
  call   <RegWriteA_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x191,%edi
  call   <RegWriteA_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x193,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x2,%esi
  mov    $0x192,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x3f000000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x198,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x2,%esi
  mov    $0x190,%edi
  call   <BsyWit_OFILM@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod_OFILM@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x1042,%edi
  call   <RamReadA_Ofilm@plt>
  xor    %edi,%edi
  call   <RamAccFixMod_OFILM@plt>
  mov    $0xa,%esi
  xor    %edi,%edi
  call   <SetSinWavePara_OFILM@plt>
L30:
  cmpw   $0x400,0x6(%rsp)
  mov    $0x2,%eax
  jbe    L5
  cmp    $0x1,%bl
  sbb    %eax,%eax
  and    $0xfffffffc,%eax
  add    $0xa,%eax
L5:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L20
  add    $0x10,%rsp
  pop    %rbx
  ret
  nopw   0x0(%rax,%rax,1)
L15:
  xor    %esi,%esi
  mov    $0x10d5,%edi
  call   <RamWrite32A_Ofilm@plt>
  mov    $0x3ecccccd,%esi
  mov    $0x11d5,%edi
  call   <RamWrite32A_Ofilm@plt>
  mov    $0xb,%esi
  mov    $0x5,%edi
  call   <SetSinWavePara_OFILM@plt>
  mov    $0xb3,%esi
  mov    $0x194,%edi
  call   <RegWriteA_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x195,%edi
  call   <RegWriteA_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x191,%edi
  call   <RegWriteA_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x193,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x2,%esi
  mov    $0x192,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x3f000000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A_Ofilm@plt>
  xor    %esi,%esi
  mov    $0x198,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x2,%esi
  mov    $0x190,%edi
  call   <BsyWit_OFILM@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod_OFILM@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x1042,%edi
  call   <RamReadA_Ofilm@plt>
  xor    %edi,%edi
  call   <RamAccFixMod_OFILM@plt>
  mov    $0xb,%esi
  xor    %edi,%edi
  call   <SetSinWavePara_OFILM@plt>
  jmp    L30
L20:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned char TstActMov_OFILM(unsigned char UcDirSel_OFILM) {
  unsigned char UcRsltSts_OFILM;
  unsigned short UsMsppVal_OFILM;
  MesFil_OFILM(3);
  if (!UcDirSel_OFILM) {
    RamWrite32A_Ofilm(0x10D5, 0x3ECCCCCD);
    RamWrite32A_Ofilm(0x11D5, 0x000000);
    SetSinWavePara_OFILM(0x05, 10);
  } else {
    RamWrite32A_Ofilm(0x10D5, 0x000000);
    RamWrite32A_Ofilm(0x11D5, 0x3ECCCCCD);
    SetSinWavePara_OFILM(0x05, 11);
  }
  if (!UcDirSel_OFILM) {
    RegWriteA_Ofilm(0x0194, (unsigned char)0x1433);
    RegWriteA_Ofilm(0x0195, (unsigned char)((0x1433 >> 8) & 0x0001));
  } else {
    RegWriteA_Ofilm(0x0194, (unsigned char)0x14B3);
    RegWriteA_Ofilm(0x0195, (unsigned char)((0x14B3 >> 8) & 0x0001));
  }
  RegWriteA_Ofilm(0x0191, 0x00);
  RegWriteA_Ofilm(0x0193, 0x00);
  RegWriteA_Ofilm(0x0192, 0x02);
  RamWrite32A_Ofilm(0x1230, 0x3F000000);
  RegWriteA_Ofilm(0x0198, 0x00);
  BsyWit_OFILM(0x0190, 0x02);
  RamAccFixMod_OFILM(0x01);
  RamReadA_Ofilm(0x1042, &UsMsppVal_OFILM);
  RamAccFixMod_OFILM(0x00);
  if (!UcDirSel_OFILM) {
    SetSinWavePara_OFILM(0x00, 10);
  } else {
    SetSinWavePara_OFILM(0x00, 11);
  };
  UcRsltSts_OFILM = 0x02;
  if (UsMsppVal_OFILM > 0x0400) {
    if (!UcDirSel_OFILM) {
      UcRsltSts_OFILM = 0x06;
    } else {
      UcRsltSts_OFILM = 0x0A;
    }
  }
  return (UcRsltSts_OFILM);
}
```