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

```asm
<TstActMov_OFILM>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,%eax
  mov    %al,-0x14(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x3,%edi
  call   <MesFil_OFILM@plt>
  cmpb   $0x0,-0x14(%rbp)
  jne    L80
  mov    $0x3ecccccd,%esi
  mov    $0x10d5,%edi
  call   <RamWrite32A_Ofilm@plt>
  mov    $0x0,%esi
  mov    $0x11d5,%edi
  call   <RamWrite32A_Ofilm@plt>
  mov    $0xa,%esi
  mov    $0x5,%edi
  call   <SetSinWavePara_OFILM@plt>
  jmp    L83
L80:
  mov    $0x0,%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>
L83:
  cmpb   $0x0,-0x14(%rbp)
  jne    L44
  mov    $0x33,%esi
  mov    $0x194,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x0,%esi
  mov    $0x195,%edi
  call   <RegWriteA_Ofilm@plt>
  jmp    L68
L44:
  mov    $0xb3,%esi
  mov    $0x194,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x0,%esi
  mov    $0x195,%edi
  call   <RegWriteA_Ofilm@plt>
L68:
  mov    $0x0,%esi
  mov    $0x191,%edi
  call   <RegWriteA_Ofilm@plt>
  mov    $0x0,%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>
  mov    $0x0,%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    -0xa(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x1042,%edi
  call   <RamReadA_Ofilm@plt>
  mov    $0x0,%edi
  call   <RamAccFixMod_OFILM@plt>
  cmpb   $0x0,-0x14(%rbp)
  jne    L98
  mov    $0xa,%esi
  mov    $0x0,%edi
  call   <SetSinWavePara_OFILM@plt>
  jmp    L41
L98:
  mov    $0xb,%esi
  mov    $0x0,%edi
  call   <SetSinWavePara_OFILM@plt>
L41:
  movb   $0x2,-0xb(%rbp)
  movzwl -0xa(%rbp),%eax
  cmp    $0x400,%ax
  jbe    L73
  cmpb   $0x0,-0x14(%rbp)
  jne    L18
  movb   $0x6,-0xb(%rbp)
  jmp    L73
L18:
  movb   $0xa,-0xb(%rbp)
L73:
  movzbl -0xb(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L54
  call   <__stack_chk_fail@plt>
L54:
  leave
  ret
```

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);
}
```