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

```asm
<do_csum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    $0x0,%eax
  call   <barrier@plt>
  cmpl   $0x0,-0x2c(%rbp)
  jle    L60
  mov    -0x28(%rbp),%rax
  and    $0x1,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L31
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  cltq
  mov    %rax,-0x18(%rbp)
  subl   $0x1,-0x2c(%rbp)
  addq   $0x1,-0x28(%rbp)
L31:
  mov    -0x2c(%rbp),%eax
  sar    %eax
  mov    %eax,-0x20(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  je     L46
  mov    -0x28(%rbp),%rax
  and    $0x2,%eax
  test   %rax,%rax
  je     L28
  mov    -0x28(%rbp),%rax
  movzwl (%rax),%eax
  movzwl %ax,%eax
  add    %rax,-0x18(%rbp)
  subl   $0x1,-0x20(%rbp)
  subl   $0x2,-0x2c(%rbp)
  addq   $0x2,-0x28(%rbp)
L28:
  sarl   -0x20(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  je     L15
  movq   $0x0,-0x10(%rbp)
L54:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  subl   $0x1,-0x20(%rbp)
  addq   $0x4,-0x28(%rbp)
  mov    -0x10(%rbp),%rax
  add    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  add    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  seta   %al
  movzbl %al,%eax
  mov    %rax,-0x10(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  jne    L54
  mov    -0x10(%rbp),%rax
  add    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzwl %ax,%edx
  mov    -0x18(%rbp),%rax
  shr    $0x10,%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
L15:
  mov    -0x2c(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L46
  mov    -0x28(%rbp),%rax
  movzwl (%rax),%eax
  movzwl %ax,%eax
  add    %rax,-0x18(%rbp)
  addq   $0x2,-0x28(%rbp)
L46:
  mov    -0x2c(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L30
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    %rax,-0x18(%rbp)
L30:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <from32to16@plt>
  mov    %rax,-0x18(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L81
  mov    -0x18(%rbp),%rax
  shr    $0x8,%rax
  movzbl %al,%edx
  mov    -0x18(%rbp),%rax
  shl    $0x8,%rax
  movzwl %ax,%eax
  or     %rdx,%rax
  mov    %rax,-0x18(%rbp)
  jmp    L107
L60:
  nop
  jmp    L107
L81:
  nop
L107:
  mov    -0x18(%rbp),%rax
  leave
  ret
```

assistant: ```c
extern unsigned long do_csum(const unsigned char *buff, int len) {
  int odd, count;
  unsigned long result = 0;
  barrier();
  if (len <= 0)
    goto out;
  odd = 1 & (unsigned long)buff;
  if (odd) {
    result = *buff << 8;
    len--;
    buff++;
  }
  count = len >> 1;
  if (count) {
    if (2 & (unsigned long)buff) {
      result += *(unsigned short *)buff;
      count--;
      len -= 2;
      buff += 2;
    }
    count >>= 1;
    if (count) {
      unsigned long carry = 0;
      do {
        unsigned long w = *(unsigned long *)buff;
        count--;
        buff += 4;
        result += carry;
        result += w;
        carry = (w > result);
      } while (count);
      result += carry;
      result = (result & 0xffff) + (result >> 16);
    }
    if (len & 2) {
      result += *(unsigned short *)buff;
      buff += 2;
    }
  }
  if (len & 1)
    result += *buff;
  result = from32to16(result);
  if (odd)
    result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
out:
  return result;
  barrier();
}
```