user: Translate the below assembly code into C programming language:

```asm
<mgsort>:
  endbr64
  xor    %eax,%eax
  cmp    %r8d,%ecx
  jl     L78
  ret
  nopl   0x0(%rax)
L78:
  lea    -0x1(%rcx,%r8,1),%eax
  push   %r15
  push   %r14
  mov    %eax,%r14d
  push   %r13
  shr    $0x1f,%r14d
  mov    %esi,%r13d
  push   %r12
  add    %eax,%r14d
  mov    %ecx,%r12d
  push   %rbp
  sar    %r14d
  mov    %edx,%ebp
  push   %rbx
  mov    %r8d,%ebx
  sub    $0x38,%rsp
  cmp    %r14d,%ecx
  jl     L38
L75:
  lea    0x1(%r14),%r15d
  cmp    %ebx,%r15d
  jl     L124
L182:
  mov    %ebx,%r8d
  mov    %r14d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  call   <merge@plt>
  sar    $0x3f,%rax
L189:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L38:
  lea    -0x1(%rcx,%r14,1),%eax
  mov    %eax,%r15d
  shr    $0x1f,%r15d
  add    %eax,%r15d
  sar    %r15d
  cmp    %r15d,%ecx
  jl     L264
L125:
  lea    0x1(%r15),%r10d
  cmp    %r10d,%r14d
  jg     L123
L65:
  mov    %r14d,%r8d
  mov    %r15d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %r9,0x10(%rsp)
  mov    %rdi,0x8(%rsp)
  call   <merge@plt>
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%r9
  test   %rax,%rax
  jns    L75
L242:
  mov    $0xffffffff,%eax
  jmp    L189
  nopl   0x0(%rax)
L124:
  lea    -0x1(%r15,%rbx,1),%eax
  mov    %eax,%r10d
  shr    $0x1f,%r10d
  add    %eax,%r10d
  sar    %r10d
  cmp    %r10d,%r15d
  jl     L187
L35:
  lea    0x1(%r10),%r11d
  cmp    %r11d,%ebx
  jg     L158
L114:
  mov    %ebx,%r8d
  mov    %r10d,%ecx
  mov    %r15d,%edx
  mov    %ebp,%esi
  mov    %r9,0x10(%rsp)
  mov    %rdi,0x8(%rsp)
  call   <merge@plt>
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%r9
  test   %rax,%rax
  jns    L182
  jmp    L242
  nopw   0x0(%rax,%rax,1)
L264:
  lea    -0x1(%rcx,%r15,1),%eax
  mov    %r9,0x18(%rsp)
  mov    %eax,%r10d
  mov    %rdi,0x8(%rsp)
  shr    $0x1f,%r10d
  add    %eax,%r10d
  sar    %r10d
  mov    %r10d,%r8d
  mov    %r10d,0x10(%rsp)
  call   <mgsort>
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%r10d
  test   %eax,%eax
  mov    0x18(%rsp),%r9
  js     L242
  lea    0x1(%r10),%ecx
  mov    %r15d,%r8d
  mov    %ebp,%edx
  mov    %r13d,%esi
  mov    %r10d,0x18(%rsp)
  mov    %r9,0x10(%rsp)
  mov    %rdi,0x8(%rsp)
  call   <mgsort>
  test   %eax,%eax
  js     L242
  mov    0x10(%rsp),%r9
  mov    0x8(%rsp),%rdi
  mov    %r15d,%r8d
  mov    %r12d,%edx
  mov    0x18(%rsp),%ecx
  mov    %ebp,%esi
  call   <merge@plt>
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%r9
  test   %rax,%rax
  jns    L125
  jmp    L242
  nopl   0x0(%rax,%rax,1)
L123:
  lea    -0x1(%r10,%r14,1),%eax
  mov    %r10d,%ecx
  mov    %ebp,%edx
  mov    %r13d,%esi
  mov    %eax,%r11d
  mov    %r9,0x20(%rsp)
  shr    $0x1f,%r11d
  mov    %r10d,0x10(%rsp)
  add    %eax,%r11d
  mov    %rdi,0x8(%rsp)
  sar    %r11d
  mov    %r11d,%r8d
  mov    %r11d,0x18(%rsp)
  call   <mgsort>
  test   %eax,%eax
  js     L242
  mov    0x18(%rsp),%r11d
  mov    0x20(%rsp),%r9
  mov    %r14d,%r8d
  mov    %ebp,%edx
  mov    0x8(%rsp),%rdi
  mov    %r13d,%esi
  lea    0x1(%r11),%ecx
  mov    %r11d,0x2c(%rsp)
  mov    %r9,0x18(%rsp)
  call   <mgsort>
  test   %eax,%eax
  js     L242
  mov    0x18(%rsp),%r9
  mov    0x8(%rsp),%rdi
  mov    %r14d,%r8d
  mov    %ebp,%esi
  mov    0x2c(%rsp),%ecx
  mov    0x10(%rsp),%edx
  call   <merge@plt>
  mov    0x8(%rsp),%rdi
  mov    0x18(%rsp),%r9
  test   %rax,%rax
  jns    L65
  jmp    L242
  nopl   0x0(%rax)
L187:
  lea    -0x1(%r15,%r10,1),%eax
  mov    %r15d,%ecx
  mov    %ebp,%edx
  mov    %r13d,%esi
  mov    %eax,%r11d
  mov    %r10d,0x20(%rsp)
  shr    $0x1f,%r11d
  mov    %r9,0x18(%rsp)
  add    %eax,%r11d
  mov    %rdi,0x8(%rsp)
  sar    %r11d
  mov    %r11d,%r8d
  mov    %r11d,0x10(%rsp)
  call   <mgsort>
  test   %eax,%eax
  js     L242
  mov    0x10(%rsp),%r11d
  mov    0x20(%rsp),%r10d
  mov    %ebp,%edx
  mov    %r13d,%esi
  mov    0x18(%rsp),%r9
  mov    0x8(%rsp),%rdi
  lea    0x1(%r11),%ecx
  mov    %r10d,%r8d
  mov    %r11d,0x2c(%rsp)
  mov    %r10d,0x10(%rsp)
  call   <mgsort>
  test   %eax,%eax
  js     L242
  mov    0x18(%rsp),%r9
  mov    0x8(%rsp),%rdi
  mov    %r15d,%edx
  mov    %ebp,%esi
  mov    0x10(%rsp),%r8d
  mov    0x2c(%rsp),%ecx
  call   <merge@plt>
  mov    0x8(%rsp),%rdi
  mov    0x10(%rsp),%r10d
  test   %rax,%rax
  mov    0x18(%rsp),%r9
  jns    L35
  jmp    L242
  nopw   0x0(%rax,%rax,1)
L158:
  lea    -0x1(%r11,%rbx,1),%edx
  mov    %r11d,%ecx
  mov    %r13d,%esi
  mov    %r10d,0x2c(%rsp)
  mov    %edx,%eax
  mov    %r9,0x18(%rsp)
  shr    $0x1f,%eax
  mov    %r11d,0x20(%rsp)
  add    %edx,%eax
  mov    %ebp,%edx
  mov    %rdi,0x10(%rsp)
  sar    %eax
  mov    %eax,%r8d
  mov    %eax,0x8(%rsp)
  call   <mgsort>
  test   %eax,%eax
  js     L242
  mov    0x8(%rsp),%eax
  mov    0x18(%rsp),%r9
  mov    %ebx,%r8d
  mov    %ebp,%edx
  mov    0x10(%rsp),%rdi
  mov    %r13d,%esi
  lea    0x1(%rax),%ecx
  call   <mgsort>
  test   %eax,%eax
  js     L242
  mov    0x10(%rsp),%rdi
  mov    0x18(%rsp),%r9
  mov    %ebx,%r8d
  mov    %ebp,%esi
  mov    0x8(%rsp),%ecx
  mov    0x20(%rsp),%edx
  mov    %rdi,0x8(%rsp)
  call   <merge@plt>
  mov    0x8(%rsp),%rdi
  mov    0x18(%rsp),%r9
  test   %rax,%rax
  mov    0x2c(%rsp),%r10d
  jns    L114
  jmp    L242
```

assistant: ```c
int mgsort(void *data, int size, int esize, int i, int k, int (*compare)(const void *key1, const void *key2)) {
  int j;
  if (i < k) {
    j = (int)(((i + k - 1)) / 2);
    if (mgsort(data, size, esize, i, j, compare) < 0)
      return -1;
    if (mgsort(data, size, esize, j + 1, k, compare) < 0)
      return -1;
    if (merge(data, esize, i, j, k, compare) < 0)
      return -1;
  }
  return 0;
}
```