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

```asm
<caf_shash_rs>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  movl   $0x5c6b7,-0x18(%rbp)
  movl   $0xf8c9,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x14(%rbp)
  movq   $0x0,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L33
  cmpl   $0x0,-0x3c(%rbp)
  jle    L33
  mov    -0x3c(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jle    L18
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L116
L70:
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  add    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x18(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  addq   $0x4,-0x10(%rbp)
  addl   $0x1,-0x1c(%rbp)
L116:
  mov    -0x1c(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L70
  mov    -0x3c(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  test   %eax,%eax
  jle    L114
  shll   $0x2,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x3c(%rbp),%eax
  cltd
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  mov    %eax,%edx
  mov    -0x3c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L54
L68:
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x18(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  addq   $0x1,-0x8(%rbp)
  addl   $0x1,-0x1c(%rbp)
L54:
  mov    -0x1c(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L68
  jmp    L114
L18:
  movl   $0x0,-0x1c(%rbp)
  jmp    L80
L93:
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  add    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  imul   -0x18(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  addq   $0x1,-0x8(%rbp)
  addl   $0x1,-0x1c(%rbp)
L80:
  mov    -0x1c(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L93
L114:
  mov    -0x20(%rbp),%eax
  jmp    L11
L33:
  mov    $0x0,%eax
L11:
  pop    %rbp
  ret
```

assistant: ```c
u_int32_t caf_shash_rs(const char *str, const u_int len) {
  u_int32_t b = 378551;
  u_int32_t a = 63689;
  u_int32_t hash = 0;
  u_int32_t i = 0;
  u_int32_t i32b = 0;
  u_int32_t *i32p = (u_int32_t *)NULL;
  char *ptr = (char *)str;
  if (ptr != (const char *)NULL && len > 0) {
    i32b = len / 4;
    if (i32b > 0) {
      i32p = (u_int32_t *)ptr;
      for (i = 0; i < i32b; i32p++, i++) {
        hash = hash * a + (*i32p);
        a = a * b;
      }
      if ((len % 4) > 0) {
        i32b *= 4;
        ptr = (char *)((size_t)i32b + (size_t)ptr);
        for (i = (len - (len % 4)); i < len; ptr++, i++) {
          hash = hash * a + (*ptr);
          a = a * b;
        }
      }
    } else {
      for (i = 0; i < len; ptr++, i++) {
        hash = hash * a + (*ptr);
        a = a * b;
      }
    }
    return hash;
  }
  return 0;
}
```