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

```asm
<RunGea>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0x2,-0x48(%rbp)
  movb   $0x0,-0x43(%rbp)
  movzbl -0x43(%rbp),%eax
  mov    %al,-0x44(%rbp)
  movzbl -0x44(%rbp),%eax
  mov    %al,-0x45(%rbp)
  movzbl -0x45(%rbp),%eax
  mov    %al,-0x46(%rbp)
  mov    $0x2,%edi
  call   <MesFil@plt>
  movb   $0x0,-0x47(%rbp)
  jmp    L60
L102:
  mov    $0x0,%esi
  mov    $0x194,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x195,%edi
  call   <RegWriteA@plt>
  mov    $0x2,%esi
  mov    $0x1000,%edi
  call   <ClrGyr@plt>
  mov    $0x0,%esi
  mov    $0x144a,%edi
  call   <GenMes@plt>
  movzbl -0x47(%rbp),%edx
  mov    %eax,%ecx
  movslq %edx,%rax
  mov    %cx,-0x40(%rbp,%rax,2)
  mov    $0x0,%esi
  mov    $0x194,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x195,%edi
  call   <RegWriteA@plt>
  mov    $0x2,%esi
  mov    $0x1000,%edi
  call   <ClrGyr@plt>
  mov    $0x0,%esi
  mov    $0x14ca,%edi
  call   <GenMes@plt>
  movzbl -0x47(%rbp),%edx
  mov    %eax,%ecx
  movslq %edx,%rax
  mov    %cx,-0x20(%rbp,%rax,2)
  cmpb   $0x0,-0x47(%rbp)
  je     L12
  movzwl -0x40(%rbp),%eax
  mov    %eax,%edx
  movzbl -0x47(%rbp),%eax
  cltq
  movzwl -0x40(%rbp,%rax,2),%eax
  cmp    %ax,%dx
  jle    L41
  movzwl -0x40(%rbp),%edx
  movzbl -0x47(%rbp),%eax
  cltq
  movzwl -0x40(%rbp,%rax,2),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %ax,-0x42(%rbp)
  jmp    L107
L41:
  movzbl -0x47(%rbp),%eax
  cltq
  movzwl -0x40(%rbp,%rax,2),%eax
  movzwl -0x40(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0x42(%rbp)
L107:
  cmpw   $0x10,-0x42(%rbp)
  jbe    L153
  movzbl -0x44(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x44(%rbp)
L153:
  cmpw   $0x0,-0x42(%rbp)
  jne    L118
  movzbl -0x46(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x46(%rbp)
L118:
  movzwl -0x20(%rbp),%eax
  mov    %eax,%edx
  movzbl -0x47(%rbp),%eax
  cltq
  movzwl -0x20(%rbp,%rax,2),%eax
  cmp    %ax,%dx
  jle    L66
  movzwl -0x20(%rbp),%edx
  movzbl -0x47(%rbp),%eax
  cltq
  movzwl -0x20(%rbp,%rax,2),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %ax,-0x42(%rbp)
  jmp    L11
L66:
  movzbl -0x47(%rbp),%eax
  cltq
  movzwl -0x20(%rbp,%rax,2),%eax
  movzwl -0x20(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0x42(%rbp)
L11:
  cmpw   $0x10,-0x42(%rbp)
  jbe    L136
  movzbl -0x43(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x43(%rbp)
L136:
  cmpw   $0x0,-0x42(%rbp)
  jne    L12
  movzbl -0x45(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x45(%rbp)
L12:
  movzbl -0x47(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x47(%rbp)
L60:
  cmpb   $0x9,-0x47(%rbp)
  jbe    L102
  cmpb   $0x0,-0x44(%rbp)
  je     L141
  orb    $0x6,-0x48(%rbp)
L141:
  cmpb   $0x8,-0x46(%rbp)
  jbe    L101
  orb    $0xa,-0x48(%rbp)
L101:
  cmpb   $0x0,-0x43(%rbp)
  je     L29
  orb    $0x12,-0x48(%rbp)
L29:
  cmpb   $0x8,-0x45(%rbp)
  jbe    L20
  orb    $0x22,-0x48(%rbp)
L20:
  movzbl -0x48(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L80
  call   <__stack_chk_fail@plt>
L80:
  leave
  ret
```

assistant: ```c
unsigned char RunGea(void) {
  unsigned char UcRst, UcCnt, UcXLowCnt, UcYLowCnt, UcXHigCnt, UcYHigCnt;
  unsigned short UsGxoVal[10], UsGyoVal[10], UsDif;
  UcRst = 0x02;
  UcXLowCnt = UcYLowCnt = UcXHigCnt = UcYHigCnt = 0;
  MesFil(2);
  for (UcCnt = 0; UcCnt < 10; UcCnt++) {
    RegWriteA(0x0194, 0x00);
    RegWriteA(0x0195, 0x00);
    ClrGyr(0x1000, 0x02);
    UsGxoVal[UcCnt] = (unsigned short)GenMes(0x144A, 0);
    RegWriteA(0x0194, 0x00);
    RegWriteA(0x0195, 0x00);
    ClrGyr(0x1000, 0x02);
    UsGyoVal[UcCnt] = (unsigned short)GenMes(0x14CA, 0);
    if (UcCnt > 0) {
      if ((short)UsGxoVal[0] > (short)UsGxoVal[UcCnt]) {
        UsDif = (unsigned short)((short)UsGxoVal[0] - (short)UsGxoVal[UcCnt]);
      } else {
        UsDif = (unsigned short)((short)UsGxoVal[UcCnt] - (short)UsGxoVal[0]);
      }
      if (UsDif > 0x0010) {
        UcXHigCnt++;
      }
      if (UsDif < 0x0001) {
        UcXLowCnt++;
      }
      if ((short)UsGyoVal[0] > (short)UsGyoVal[UcCnt]) {
        UsDif = (unsigned short)((short)UsGyoVal[0] - (short)UsGyoVal[UcCnt]);
      } else {
        UsDif = (unsigned short)((short)UsGyoVal[UcCnt] - (short)UsGyoVal[0]);
      }
      if (UsDif > 0x0010) {
        UcYHigCnt++;
      }
      if (UsDif < 0x0001) {
        UcYLowCnt++;
      }
    }
  }
  if (UcXHigCnt >= 1) {
    UcRst = UcRst | 0x06;
  }
  if (UcXLowCnt > 8) {
    UcRst = UcRst | 0x0A;
  }
  if (UcYHigCnt >= 1) {
    UcRst = UcRst | 0x12;
  }
  if (UcYLowCnt > 8) {
    UcRst = UcRst | 0x22;
  }
  return (UcRst);
}
```