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

```asm
<merge>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    -0x40(%rbp),%eax
  sub    -0x3c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x44(%rbp),%eax
  sub    -0x40(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L79
L13:
  mov    -0x3c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x24(%rbp),%eax
  cltq
  add    %rdx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x24(%rbp)
L79:
  mov    -0x24(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L13
  movl   $0x0,-0x24(%rbp)
  jmp    L14
L88:
  mov    -0x40(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x24(%rbp),%eax
  cltq
  add    %rdx,%rax
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x24(%rbp)
L14:
  mov    -0x24(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L88
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L22
L115:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jg     L73
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x24(%rbp)
  jmp    L52
L73:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x20(%rbp)
L52:
  addl   $0x1,-0x1c(%rbp)
L22:
  mov    -0x24(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jge    L9
  mov    -0x20(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L115
  jmp    L9
L19:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x24(%rbp)
  addl   $0x1,-0x1c(%rbp)
L9:
  mov    -0x24(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L19
  jmp    L67
L114:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x20(%rbp)
  addl   $0x1,-0x1c(%rbp)
L67:
  mov    -0x20(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L114
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void merge(int *a, int l, int m, int r) {
  int i, j, k;
  int len1 = m - l + 1;
  int len2 = r - m;
  int *a1;
  a1 = (int *)malloc(len1 * sizeof(int));
  int *a2;
  a2 = (int *)malloc(len2 * sizeof(int));
  for (i = 0; i < len1; i++) {
    *(a1 + i) = *(a + l + i);
  }
  for (i = 0; i < len2; i++) {
    *(a2 + i) = *(a + m + 1 + i);
  }
  i = 0;
  j = 0;
  k = l;
  while (i < len1 && j < len2) {
    if (*(a1 + i) <= *(a2 + j)) {
      *(a + k) = *(a1 + i);
      i++;
    } else {
      *(a + k) = *(a2 + j);
      j++;
    }
    k++;
  }
  while (i < len1) {
    *(a + k) = *(a1 + i);
    i++;
    k++;
  }
  while (j < len2) {
    *(a + k) = *(a2 + j);
    j++;
    k++;
  }
  free(a1);
  free(a2);
}
```