user: Please show me the C implementation that matches the assembly code listed below:

```asm
<split_n_sort>:
  endbr64
  cmp    $0x1,%rsi
  je     L43
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %esi,%ebx
  shr    $0x1f,%ebx
  add    %esi,%ebx
  sar    %ebx
  cmp    $0x2,%rsi
  je     L38
  test   $0x1,%sil
  je     L26
  lea    0x1(%rbx),%r13d
  movslq %r13d,%rsi
  call   <split_n_sort>
  movslq %ebx,%rsi
  lea    0x4(%rbp,%rsi,4),%r14
  mov    %r14,%rdi
  call   <split_n_sort>
  lea    0x0(,%r13,4),%r12d
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %rax,0x8(%rsp)
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    0x0(,%rbx,4),%r15d
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    %r15d,%edx
  mov    %r14,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %rbp,%r8
  mov    %ebx,%ecx
  mov    %r12,%rdx
  mov    %r13d,%esi
  mov    0x8(%rsp),%rdi
  call   <merge@plt>
L11:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L38:
  movslq %ebx,%r15
  lea    0x0(,%rbx,4),%r14d
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    %r14d,%edx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  lea    0x0(%rbp,%r15,4),%rsi
  mov    %r14d,%edx
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %rbp,%r8
  mov    %ebx,%ecx
  mov    %r13,%rdx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <merge@plt>
  jmp    L11
L26:
  movslq %ebx,%r12
  mov    %r12,%rsi
  call   <split_n_sort>
  lea    0x0(%rbp,%r12,4),%r15
  mov    %r12,%rsi
  mov    %r15,%rdi
  call   <split_n_sort>
  lea    0x0(,%rbx,4),%r14d
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    %r14d,%edx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    %r14d,%edx
  mov    %r15,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %rbp,%r8
  mov    %ebx,%ecx
  mov    %r13,%rdx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <merge@plt>
  jmp    L11
L43:
  ret
```

assistant: ```c
void split_n_sort(int array[], size_t count) {
  if (count == 1)
    return;
  int c2 = (int)count / 2;
  if (count == 2) {
    int *t1 = malloc(c2 * sizeof(*array));
    memcpy(t1, array, c2 * sizeof(*array));
    int *t2 = malloc(c2 * sizeof(*array));
    memcpy(t2, array + c2, c2 * sizeof(*array));
    merge(t1, c2, t2, c2, array);
  } else {
    if (count % 2) {
      split_n_sort(array, c2 + 1);
      split_n_sort(array + c2 + 1, c2);
      int *t1 = malloc((c2 + 1) * sizeof(*array));
      memcpy(t1, array, (c2 + 1) * sizeof(*array));
      int *t2 = malloc(c2 * sizeof(*array));
      memcpy(t2, array + c2 + 1, c2 * sizeof(*array));
      merge(t1, c2 + 1, t2, c2, array);
    } else {
      split_n_sort(array, c2);
      split_n_sort(array + c2, c2);
      int *t1 = malloc(c2 * sizeof(*array));
      memcpy(t1, array, c2 * sizeof(*array));
      int *t2 = malloc(c2 * sizeof(*array));
      memcpy(t2, array + c2, c2 * sizeof(*array));
      merge(t1, c2, t2, c2, array);
    }
  }
  return;
}
```