user: 请将以下的汇编代码转换成C语言代码:

```asm
<compare>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0xfffffff8,%eax
  mov    %eax,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L88
L125:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <load_u64@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <load_u64@plt>
  xor    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  je     L45
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <tzbytecnt@plt>
  mov    -0xc(%rbp),%edx
  add    %edx,%eax
  jmp    L23
L45:
  addq   $0x20,-0x18(%rbp)
  addq   $0x20,-0x20(%rbp)
  addl   $0x8,-0xc(%rbp)
L88:
  mov    -0xc(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jl     L125
  mov    -0x24(%rbp),%eax
  cltd
  shr    $0x1d,%edx
  add    %edx,%eax
  and    $0x7,%eax
  sub    %edx,%eax
  cmp    $0x7,%eax
  ja     L121
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D5(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D5(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    (%rax),%eax
  cmp    %eax,%ecx
  je     L175
  mov    -0xc(%rbp),%eax
  jmp    L23
L175:
  addl   $0x1,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    (%rax),%eax
  cmp    %eax,%ecx
  je     L34
  mov    -0xc(%rbp),%eax
  jmp    L23
L34:
  addl   $0x1,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    (%rax),%eax
  cmp    %eax,%ecx
  je     L161
  mov    -0xc(%rbp),%eax
  jmp    L23
L161:
  addl   $0x1,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    (%rax),%eax
  cmp    %eax,%ecx
  je     L12
  mov    -0xc(%rbp),%eax
  jmp    L23
L12:
  addl   $0x1,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    (%rax),%eax
  cmp    %eax,%ecx
  je     L11
  mov    -0xc(%rbp),%eax
  jmp    L23
L11:
  addl   $0x1,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%ecx
  mov    -0x20(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    (%rax),%eax
  cmp    %eax,%ecx
  je     L46
  mov    -0xc(%rbp),%eax
  jmp    L23
L46:
  addl   $0x1,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L5
  mov    -0xc(%rbp),%eax
  jmp    L23
L5:
  addl   $0x1,-0xc(%rbp)
L121:
  mov    -0xc(%rbp),%eax
L23:
  leave
  ret
```

assistant: ```c
int compare(uint8_t *str1, uint8_t *str2, uint32_t max_length) {
  uint32_t count;
  uint64_t test;
  uint64_t loop_length;
  loop_length = max_length & ~0x7;
  for (count = 0; count < loop_length; count += 8) {
    test = load_u64(str1);
    test ^= load_u64(str2);
    if (test != 0)
      return count + tzbytecnt(test);
    str1 += 8;
    str2 += 8;
  }
  switch (max_length % 8) {
  case 7:
    if (*str1++ != *str2++)
      return count;
    count++;
  case 6:
    if (*str1++ != *str2++)
      return count;
    count++;
  case 5:
    if (*str1++ != *str2++)
      return count;
    count++;
  case 4:
    if (*str1++ != *str2++)
      return count;
    count++;
  case 3:
    if (*str1++ != *str2++)
      return count;
    count++;
  case 2:
    if (*str1++ != *str2++)
      return count;
    count++;
  case 1:
    if (*str1 != *str2)
      return count;
    count++;
  }
  return count;
}
```