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

```asm
<intmsort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    -0x78(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x80(%rbp),%rax
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x70(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  movq   $0x1,-0x50(%rbp)
  movq   $0x0,-0x48(%rbp)
  jmp    L2
L66:
  mov    -0x80(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x70(%rbp),%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x58(%rbp)
  jmp    L47
L49:
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  cmp    %rax,%rdx
  cmovbe %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  sub    %rax,-0x40(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x50(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  cmp    %rax,%rdx
  cmovbe %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  sub    %rax,-0x40(%rbp)
  mov    -0x58(%rbp),%rdi
  mov    -0x8(%rbp),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rsi
  mov    -0x20(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <intmerge@plt>
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rax,-0x60(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  add    %rax,-0x58(%rbp)
L47:
  cmpq   $0x0,-0x40(%rbp)
  jne    L49
  mov    -0x70(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x70(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  addq   $0x1,-0x48(%rbp)
  shlq   -0x50(%rbp)
L2:
  mov    -0x50(%rbp),%rax
  cmp    -0x80(%rbp),%rax
  jbe    L66
  mov    -0x48(%rbp),%rax
  and    $0x1,%eax
  test   %rax,%rax
  je     L59
  mov    -0x80(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L16
L5:
  mov    -0x40(%rbp),%rax
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x40(%rbp),%rdx
  shl    $0x2,%rdx
  lea    -0x4(%rdx),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  subq   $0x1,-0x40(%rbp)
L16:
  cmpq   $0x0,-0x40(%rbp)
  jne    L5
L59:
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void intmsort(int *arr_, size_t n) {
  int *arr = arr_;
  int *workarray = malloc(sizeof(int) * n);
  int *current_ = arr;
  int *work_ = workarray;
  int *swap, *first, *second, *cur, *work;
  size_t sub_array_size = 1;
  size_t counter = 0;
  size_t m, len1, len2;
  while (sub_array_size <= n) {
    m = n;
    cur = current_;
    work = work_;
    while (m) {
      first = cur;
      len1 = (m < sub_array_size) ? m : sub_array_size;
      m -= len1;
      second = cur + len1;
      len2 = (m < sub_array_size) ? m : sub_array_size;
      m -= len2;
      intmerge(first, len1, second, len2, work);
      cur += (len1 + len2);
      work += (len1 + len2);
    }
    swap = current_;
    current_ = work_;
    work_ = swap;
    counter++;
    sub_array_size *= 2;
  }
  if (counter % 2) {
    m = n;
    while (m) {
      arr[m - 1] = workarray[m - 1];
      m--;
    }
  }
  free(workarray);
}
```