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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x30(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  jmp    L68
L5:
  lea    -0x28(%rbp),%rdx
  lea    -0x2c(%rbp),%rax
  mov    %rax,%rsi
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  movl   $0x0,-0x20(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L20
L85:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  addl   $0x1,-0x24(%rbp)
L20:
  mov    -0x2c(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jl     L85
  mov    -0x2c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <mergeSort@plt>
  movl   $0x1,-0x24(%rbp)
  jmp    L73
L86:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  lea    -0x4(%rdx),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    %eax,%ecx
  neg    %ecx
  cmovns %ecx,%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x24(%rbp)
L73:
  mov    -0x2c(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jl     L86
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,%edx
  neg    %edx
  cmovs  %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x2c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <mergeSort@plt>
  mov    -0x2c(%rbp),%eax
  mov    -0x28(%rbp),%edx
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L26
L0:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %eax,-0x20(%rbp)
  addl   $0x1,-0x24(%rbp)
L26:
  mov    -0x24(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L0
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L68:
  mov    -0x30(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x30(%rbp)
  test   %eax,%eax
  jne    L5
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D13
data_type: string
name: parse_data
arguments: label: D11
data_type: string
name: parse_data
arguments: label: D5
data_type: string

tool: D13: %d

tool: D11: %d %d

tool: D5: %d


assistant: ```c
int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    int n, k;
    scanf("%d %d", &n, &k);
    int i;
    int range = 0;
    int *size = calloc(n, sizeof(int));
    int *sorted = calloc(n, sizeof(int));
    for (i = 0; i < n; i++) {
      scanf("%d", &size[i]);
    }
    mergeSort(size, 0, n - 1);
    for (i = 1; i < n; i++) {
      sorted[i] = abs(size[i] - size[i - 1]);
    }
    sorted[0] = abs(size[n - 1] - size[0]);
    mergeSort(sorted, 0, n - 1);
    int temp = n - k;
    for (i = 0; i < temp; i++) {
      range += sorted[i];
    }
    printf("%d\n", range);
  }
  return 0;
}
```