user: What would the C source look like for the assembly code provided here:

```asm
<merge_final>:
  endbr64
  sub    %edi,%esi
  push   %r15
  mov    %edx,%r9d
  mov    %rcx,%r15
  lea    0x1(%rsi),%r11d
  push   %r14
  mov    %r11d,%eax
  push   %r13
  lea    0x2(%rdx),%r13d
  cltd
  push   %r12
  idiv   %r9d
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    D4(%rip),%r14
  mov    %esi,0x4(%rsp)
  mov    $0x4,%esi
  mov    %r11d,0xc(%rsp)
  mov    (%r14),%ebx
  mov    %r9d,0x8(%rsp)
  lea    0x1(%rax),%ebp
  mov    %ebp,%edi
  imul   %r13d,%edi
  call   <calloc@plt>
  mov    %ebp,%edi
  mov    $0x4,%esi
  mov    %rax,%r12
  call   <calloc@plt>
  movslq 0x4(%rsp),%r10
  mov    %rax,%rbp
  test   %r10d,%r10d
  js     L74
  mov    (%r15),%eax
  lea    0x4(%r12),%r8
  mov    %eax,(%r12)
  je     L99
  mov    0xc(%rsp),%r11d
  mov    0x8(%rsp),%r9d
  mov    $0x1,%ecx
  xor    %edi,%edi
  mov    $0x1,%esi
  nopl   0x0(%rax)
L48:
  mov    %ecx,%eax
  cltd
  idiv   %r9d
  test   %edx,%edx
  je     L114
  mov    %r13d,%eax
  mov    (%r15,%rcx,4),%r8d
  add    $0x1,%rcx
  imul   %edi,%eax
  lea    (%rax,%rsi,1),%edx
  add    $0x1,%esi
  add    %esi,%eax
  movslq %edx,%rdx
  cltq
  mov    %r8d,(%r12,%rdx,4)
  lea    (%r12,%rax,4),%r8
  cmp    %rcx,%r11
  jne    L48
  movslq %edi,%rsi
L44:
  mov    (%r14),%eax
  lea    0x4(%r15,%r10,4),%r9
  xor    %edi,%edi
  mov    %eax,(%r8)
  mov    %r15,%r8
  nopl   0x0(%rax)
L49:
  xor    %ecx,%ecx
  xor    %eax,%eax
  jmp    L97
  cs nopw 0x0(%rax,%rax,1)
L117:
  mov    %rdx,%rax
L97:
  mov    0x0(%rbp,%rax,4),%edx
  add    %ecx,%edx
  movslq %edx,%rdx
  mov    (%r12,%rdx,4),%edx
  cmp    %edx,%ebx
  jle    L54
  mov    %eax,%edi
  mov    %edx,%ebx
L54:
  lea    0x1(%rax),%rdx
  add    %r13d,%ecx
  cmp    %rax,%rsi
  jne    L117
  mov    %ebx,(%r8)
  movslq %edi,%rax
  add    $0x4,%r8
  addl   $0x1,0x0(%rbp,%rax,4)
  mov    (%r14),%ebx
  cmp    %r8,%r9
  jne    L49
L89:
  mov    %r12,%rdi
  call   <free@plt>
  add    $0x18,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <free@plt>
  nopl   0x0(%rax)
L114:
  mov    (%r14),%eax
  add    $0x1,%edi
  movslq %edi,%rsi
  mov    %eax,(%r8)
  mov    %r13d,%eax
  imul   %edi,%eax
  movl   $0x0,0x0(%rbp,%rsi,4)
  mov    (%r15,%rcx,4),%r8d
  add    $0x1,%rcx
  movslq %eax,%rdx
  add    $0x1,%eax
  cltq
  mov    %r8d,(%r12,%rdx,4)
  lea    (%r12,%rax,4),%r8
  cmp    %rcx,%r11
  je     L44
  mov    $0x1,%esi
  jmp    L48
L74:
  mov    (%r14),%eax
  mov    %eax,(%r12)
  jmp    L89
L99:
  xor    %esi,%esi
  jmp    L44
```

assistant: ```c
void merge_final(int p, int r, int k, int *arr) {
  int i, j = 0, l = 0, *ptrs, buff = INT_MAX, buffI = 0;
  int *dList, n = k + 2;
  dList = calloc(((r - p + 1) / k + 1) * (k + 2), sizeof(int));
  ptrs = calloc((r - p + 1) / k + 1, sizeof(int));
  for (i = 0; i < (r - p + 1); i++) {
    if (i % k == 0 && (i != 0)) {
      dList[l * n + j] = INT_MAX;
      l++;
      ptrs[l] = 0;
      j = 0;
    }
    dList[l * n + j] = arr[i];
    j++;
  }
  dList[l * n + j] = INT_MAX;
  for (i = 0; i < (r - p + 1); i++) {
    for (j = 0; j <= l; j++) {
      if (dList[j * n + ptrs[j]] < buff) {
        buff = dList[j * n + ptrs[j]];
        buffI = j;
      }
    }
    arr[i] = buff;
    ptrs[buffI]++;
    buff = INT_MAX;
  }
  free(dList);
  free(ptrs);
}
```