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

```asm
<TstActMov>:
  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@plt>
  test   %bl,%bl
  jne    L8
  mov    $0x3ecccccd,%esi
  mov    $0x10d5,%edi
  call   <RamWrite32A@plt>
  xor    %esi,%esi
  mov    $0x11d5,%edi
  call   <RamWrite32A@plt>
  mov    $0xa,%esi
  mov    $0x5,%edi
  call   <SetSinWavePara@plt>
  mov    $0x33,%esi
  mov    $0x194,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x195,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x191,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  mov    $0x2,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3f000000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
  xor    %esi,%esi
  mov    $0x198,%edi
  call   <RegWriteA@plt>
  mov    $0x2,%esi
  mov    $0x190,%edi
  call   <BsyWit@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x1042,%edi
  call   <RamReadA@plt>
  xor    %edi,%edi
  call   <RamAccFixMod@plt>
  mov    $0xa,%esi
  xor    %edi,%edi
  call   <SetSinWavePara@plt>
L2:
  cmpw   $0x400,0x6(%rsp)
  mov    $0x2,%eax
  jbe    L37
  cmp    $0x1,%bl
  sbb    %eax,%eax
  and    $0xfffffffc,%eax
  add    $0xa,%eax
L37:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L15
  add    $0x10,%rsp
  pop    %rbx
  ret
  nopw   0x0(%rax,%rax,1)
L8:
  xor    %esi,%esi
  mov    $0x10d5,%edi
  call   <RamWrite32A@plt>
  mov    $0x3ecccccd,%esi
  mov    $0x11d5,%edi
  call   <RamWrite32A@plt>
  mov    $0xb,%esi
  mov    $0x5,%edi
  call   <SetSinWavePara@plt>
  mov    $0xb3,%esi
  mov    $0x194,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x195,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x191,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  mov    $0x2,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3f000000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
  xor    %esi,%esi
  mov    $0x198,%edi
  call   <RegWriteA@plt>
  mov    $0x2,%esi
  mov    $0x190,%edi
  call   <BsyWit@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x1042,%edi
  call   <RamReadA@plt>
  xor    %edi,%edi
  call   <RamAccFixMod@plt>
  mov    $0xb,%esi
  xor    %edi,%edi
  call   <SetSinWavePara@plt>
  jmp    L2
L15:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
unsigned char TstActMov(unsigned char UcDirSel) {
  unsigned char UcRsltSts;
  unsigned short UsMsppVal;
  MesFil(3);
  if (!UcDirSel) {
    RamWrite32A(0x10D5, 0x3ECCCCCD);
    RamWrite32A(0x11D5, 0x000000);
    SetSinWavePara(0x05, 10);
  } else {
    RamWrite32A(0x10D5, 0x000000);
    RamWrite32A(0x11D5, 0x3ECCCCCD);
    SetSinWavePara(0x05, 11);
  }
  if (!UcDirSel) {
    RegWriteA(0x0194, (unsigned char)0x1433);
    RegWriteA(0x0195, (unsigned char)((0x1433 >> 8) & 0x0001));
  } else {
    RegWriteA(0x0194, (unsigned char)0x14B3);
    RegWriteA(0x0195, (unsigned char)((0x14B3 >> 8) & 0x0001));
  }
  RegWriteA(0x0191, 0x00);
  RegWriteA(0x0193, 0x00);
  RegWriteA(0x0192, 0x02);
  RamWrite32A(0x1230, 0x3F000000);
  RegWriteA(0x0198, 0x00);
  BsyWit(0x0190, 0x02);
  RamAccFixMod(0x01);
  RamReadA(0x1042, &UsMsppVal);
  RamAccFixMod(0x00);
  if (!UcDirSel) {
    SetSinWavePara(0x00, 10);
  } else {
    SetSinWavePara(0x00, 11);
  }
  UcRsltSts = 0x02;
  if (UsMsppVal > 0x0400) {
    if (!UcDirSel) {
      UcRsltSts = 0x06;
    } else {
      UcRsltSts = 0x0A;
    }
  }
  return (UcRsltSts);
}
```