user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  lea    D10(%rip),%rbp
  push   %rbx
  mov    %rbp,%rdi
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x1c(%rsp),%rsi
  call   <scanf@plt>
  mov    0x1c(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x1c(%rsp)
  test   %eax,%eax
  je     L3
  lea    0x20(%rsp),%rax
  lea    0x24(%rsp),%r15
  mov    %rax,0x8(%rsp)
  nopl   0x0(%rax,%rax,1)
L7:
  mov    0x8(%rsp),%rsi
  mov    %r15,%rdx
  lea    D13(%rip),%rdi
  xor    %eax,%eax
  call   <scanf@plt>
  mov    0x20(%rsp),%edi
  mov    $0x4,%esi
  call   <calloc@plt>
  mov    0x20(%rsp),%edi
  mov    $0x4,%esi
  mov    %rax,%r12
  call   <calloc@plt>
  mov    0x20(%rsp),%edx
  mov    %rax,%rbx
  test   %edx,%edx
  jle    L87
  mov    %r12,%r14
  xor    %r13d,%r13d
  cs nopw 0x0(%rax,%rax,1)
L90:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x1,%r13d
  call   <scanf@plt>
  mov    0x20(%rsp),%edx
  add    $0x4,%r14
  cmp    %r13d,%edx
  jg     L90
L87:
  sub    $0x1,%edx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <mergeSort@plt>
  movslq 0x20(%rsp),%rdx
  cmp    $0x1,%edx
  jle    L9
  mov    $0x1,%eax
  nopw   0x0(%rax,%rax,1)
L0:
  mov    (%r12,%rax,4),%edx
  sub    -0x4(%r12,%rax,4),%edx
  mov    %edx,%esi
  neg    %esi
  cmovns %esi,%edx
  mov    %edx,(%rbx,%rax,4)
  movslq 0x20(%rsp),%rdx
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L0
L9:
  mov    -0x4(%r12,%rdx,4),%eax
  sub    (%r12),%eax
  mov    %rbx,%rdi
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  xor    %esi,%esi
  mov    %eax,(%rbx)
  mov    0x20(%rsp),%eax
  lea    -0x1(%rax),%edx
  call   <mergeSort@plt>
  mov    0x20(%rsp),%eax
  sub    0x24(%rsp),%eax
  test   %eax,%eax
  jle    L55
  lea    (%rbx,%rax,4),%rax
  xor    %esi,%esi
  nopl   (%rax)
L36:
  add    (%rbx),%esi
  add    $0x4,%rbx
  cmp    %rbx,%rax
  jne    L36
L21:
  lea    D12(%rip),%rdi
  call   <printf@plt>
  mov    0x1c(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x1c(%rsp)
  test   %eax,%eax
  jne    L7
L3:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L67
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L55:
  xor    %esi,%esi
  jmp    L21
L67:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D10
type_guessed: string
name: disassemble_data
arguments: data_tag: D13
type_guessed: string
name: disassemble_data
arguments: data_tag: D12
type_guessed: string

tool: D10: %d

tool: D13: %d %d

tool: D12: %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;
}
```