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

```asm
<ILibGetHashValueEx>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x10(%rbp)
  cmpl   $0x4,-0x1c(%rbp)
  jg     L9
  lea    -0xc(%rbp),%rax
  mov    $0x4,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  cmpl   $0x0,-0x20(%rbp)
  jne    L54
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%rcx
  lea    -0xc(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L41
L54:
  lea    -0xc(%rbp),%rdx
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <ILibToLower@plt>
L41:
  lea    -0xc(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L85
L9:
  cmpl   $0x0,-0x20(%rbp)
  jne    L8
  mov    -0x18(%rbp),%rcx
  lea    -0xc(%rbp),%rax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L40
L8:
  lea    -0xc(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <ILibToLower@plt>
L40:
  lea    -0xc(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  jne    L64
  mov    -0x1c(%rbp),%eax
  cltq
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0xc(%rbp),%rax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L46
L64:
  mov    -0x1c(%rbp),%eax
  cltq
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0xc(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x4,%esi
  mov    %rcx,%rdi
  call   <ILibToLower@plt>
L46:
  lea    -0xc(%rbp),%rax
  mov    (%rax),%eax
  xor    %eax,-0x10(%rbp)
  cmpl   $0x9,-0x1c(%rbp)
  jle    L85
  cmpl   $0x0,-0x20(%rbp)
  jne    L30
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0xc(%rbp),%rax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L96
L30:
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0xc(%rbp),%rax
  mov    %rax,%rdx
  mov    $0x4,%esi
  mov    %rcx,%rdi
  call   <ILibToLower@plt>
L96:
  lea    -0xc(%rbp),%rax
  mov    (%rax),%eax
  xor    %eax,-0x10(%rbp)
L85:
  mov    -0x10(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L48
  call   <__stack_chk_fail@plt>
L48:
  leave
  ret
```

assistant: ```c
int ILibGetHashValueEx(char *key, int keylength, int caseInSensitiveText) {
  int HashValue = 0;
  char TempValue[4];
  if (keylength <= 4) {
    memset(TempValue, 0, 4);
    if (caseInSensitiveText == 0) {
      memcpy(TempValue, key, keylength);
    } else {
      ILibToLower(key, keylength, TempValue);
    }

    HashValue = *((int *)TempValue);
  } else {
    if (caseInSensitiveText == 0) {
      memcpy(TempValue, key, 4);
    } else {
      ILibToLower(key, 4, TempValue);
    }
    HashValue = *((int *)TempValue);
    if (caseInSensitiveText == 0) {
      memcpy(TempValue, (char *)key + (keylength - 4), 4);
    } else {
      ILibToLower((char *)key + (keylength - 4), 4, TempValue);
    }
    HashValue = HashValue ^ (*((int *)TempValue));
    if (keylength >= 10) {
      if (caseInSensitiveText == 0) {
        memcpy(TempValue, (char *)key + (keylength / 2), 4);
      } else {
        ILibToLower((char *)key + (keylength / 2), 4, TempValue);
      }
      HashValue = HashValue ^ (*((int *)TempValue));
    }
  }
  return (HashValue);
}
```