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

```asm
<findMinMoves>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x1c(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  jne    L21
  mov    $0x0,%eax
  jmp    L97
L21:
  mov    -0x2c(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movl   $0x0,(%rax)
  movl   $0x0,-0x18(%rbp)
  jmp    L54
L12:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rsi
  mov    -0x8(%rbp),%rax
  add    %rsi,%rax
  add    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x18(%rbp)
L54:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L12
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltd
  idivl  -0x2c(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  je     L103
  mov    $0xffffffff,%eax
  jmp    L97
L103:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltd
  idivl  -0x2c(%rbp)
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L95
L55:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x14(%rbp),%eax
  imul   -0x18(%rbp),%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x18(%rbp),%eax
  imul   -0x14(%rbp),%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jns    L69
  cmpl   $0x0,-0xc(%rbp)
  jns    L69
  mov    -0x10(%rbp),%eax
  neg    %eax
  sub    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <max@plt>
  mov    %eax,-0x1c(%rbp)
  jmp    L89
L69:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  neg    %edx
  cmovs  %eax,%edx
  mov    -0x10(%rbp),%eax
  mov    %eax,%ecx
  neg    %ecx
  cmovns %ecx,%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <max@plt>
  mov    %eax,%edx
  mov    -0x1c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <max@plt>
  mov    %eax,-0x1c(%rbp)
L89:
  addl   $0x1,-0x18(%rbp)
L95:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L55
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x1c(%rbp),%eax
L97:
  leave
  ret
```

assistant: ```c
int findMinMoves(int *machines, int machinesSize) {
  int *sum, ret = 0, i, left, right, avg;
  if (!machinesSize)
    return 0;
  sum = (int *)malloc((machinesSize + 1) * sizeof(int));
  sum[0] = 0;
  for (i = 0; i < machinesSize; ++i)
    sum[i + 1] = sum[i] + machines[i];
  if (sum[machinesSize] % machinesSize)
    return -1;
  avg = sum[machinesSize] / machinesSize;
  for (i = 0; i < machinesSize; ++i) {
    left = sum[i] - avg * i;
    right = sum[machinesSize] - sum[i + 1] - avg * (machinesSize - 1 - i);
    if (left < 0 && right < 0)
      ret = max(ret, -left - right);
    else
      ret = max(ret, max(abs(left), abs(right)));
  }
  free(sum);
  return ret;
}
```