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

```asm
<merge_sort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbp
  mov    %rdi,0x18(%rsp)
  mov    %esi,%r15d
  lea    0x0(,%rsi,4),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  movl   $0x1,0x14(%rsp)
  cmp    $0x1,%r15d
  jg     L99
  jmp    L34
L188:
  add    $0x1,%eax
  mov    %edi,%edx
L184:
  mov    %ebx,%r8d
  mov    %edx,-0x4(%r13,%rbx,4)
  add    $0x1,%rbx
  cmp    %r12d,%ecx
  jge    L30
  cmp    %esi,%eax
  jge    L30
L134:
  movslq %ecx,%rdx
  mov    0x0(%rbp,%rdx,4),%edx
  movslq %eax,%rdi
  mov    0x0(%rbp,%rdi,4),%edi
  cmp    %edi,%edx
  jge    L188
  add    $0x1,%ecx
  jmp    L184
L56:
  mov    %r12d,%eax
  mov    %r14d,%ecx
  mov    %r14d,%r8d
L30:
  cmp    %ecx,%r12d
  jle    L31
  movslq %ecx,%rdx
  movslq %r8d,%rdi
  sub    %rdx,%rdi
  lea    0x0(%r13,%rdi,4),%r9
L47:
  mov    0x0(%rbp,%rdx,4),%edi
  mov    %edi,(%r9,%rdx,4)
  add    $0x1,%rdx
  cmp    %edx,%r12d
  jg     L47
  add    %r8d,%r12d
  mov    %r12d,%r8d
  sub    %ecx,%r8d
L31:
  cmp    %eax,%esi
  jle    L177
  cltq
  movslq %r8d,%r8
  sub    %rax,%r8
  lea    0x0(%r13,%r8,4),%rcx
L114:
  mov    0x0(%rbp,%rax,4),%edx
  mov    %edx,(%rcx,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L114
L177:
  add    0xc(%rsp),%r14d
  cmp    %r14d,%r15d
  jle    L96
L139:
  mov    %r14d,%ebx
  mov    0x10(%rsp),%eax
  lea    (%rax,%r14,1),%edi
  mov    %r15d,%esi
  call   <min@plt>
  mov    %eax,%r12d
  mov    0xc(%rsp),%eax
  lea    (%rax,%r14,1),%edi
  mov    %r15d,%esi
  call   <min@plt>
  mov    %eax,%esi
  cmp    %r14d,%r12d
  jle    L56
  cmp    %eax,%r12d
  jge    L56
  add    $0x1,%ebx
  movslq %ebx,%rbx
  mov    %r12d,%eax
  mov    %r14d,%ecx
  jmp    L134
L96:
  shll   0x14(%rsp)
  mov    0x14(%rsp),%eax
  cmp    %eax,%r15d
  jle    L176
  mov    %rbp,%rax
  mov    %r13,%rbp
  mov    %rax,%r13
L99:
  mov    0x14(%rsp),%eax
  mov    %eax,0x10(%rsp)
  add    %eax,%eax
  mov    %eax,0xc(%rsp)
  mov    $0x0,%r14d
  jmp    L139
L176:
  mov    %r15d,%eax
  mov    $0x0,%edx
  cmp    %r13,0x18(%rsp)
  je     L182
L95:
  mov    0x0(%r13,%rdx,4),%ecx
  mov    %ecx,0x0(%rbp,%rdx,4)
  add    $0x1,%rdx
  cmp    %rdx,%rax
  jne    L95
L34:
  mov    %r13,%rdi
  call   <free@plt>
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L182:
  mov    %rbp,%r13
  jmp    L34
```

assistant: ```c
void merge_sort(int arr[], int len) {
  int *a = arr;
  int *b = (int *)malloc(len * sizeof(int));
  int seg, start;
  for (seg = 1; seg < len; seg += seg) {
    for (start = 0; start < len; start += (seg + seg)) {
      int low = start, mid = min(start + seg, len), high = min(start + seg + seg, len);
      int k = low;
      int start1 = low, end1 = mid;
      int start2 = mid, end2 = high;
      while (start1 < end1 && start2 < end2)
        b[k++] = a[start1] < a[start2] ? a[start1++] : a[start2++];
      while (start1 < end1)
        b[k++] = a[start1++];
      while (start2 < end2)
        b[k++] = a[start2++];
    }
    int *temp = a;
    a = b;
    b = temp;
  }
  if (a != arr) {
    int i;
    for (i = 0; i < len; i++)
      b[i] = a[i];
    b = a;
  }
  free(b);
}
```