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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    D11(%rip),%rbx
  mov    %rbx,%rdi
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rsi
  lea    0x8(%rsp),%r13
  call   <scanf@plt>
  mov    0x10(%rsp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,0x10(%rsp)
  test   %rax,%rax
  je     L259
  nopw   0x0(%rax,%rax,1)
L155:
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  mov    0x8(%rsp),%rax
  lea    0x0(,%rax,8),%rdi
  call   <malloc@plt>
  mov    0x8(%rsp),%rdi
  mov    %rax,%rbp
  test   %rdi,%rdi
  jle    L272
  mov    %rax,%r14
  mov    %rax,%r12
  xor    %r15d,%r15d
  nop
L230:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  add    $0x1,%r15
  add    $0x8,%r12
  call   <scanf@plt>
  mov    0x8(%rsp),%rdi
  cmp    %r15,%rdi
  jg     L230
  test   %rdi,%rdi
  jle    L272
  xor    %r8d,%r8d
  cmp    %rdi,%r8
  jge    L191
  nopw   0x0(%rax,%rax,1)
L66:
  mov    %r14,%rax
  mov    %r8,%rdx
  jmp    L174
  nopl   0x0(%rax,%rax,1)
L31:
  mov    %rcx,(%r14)
  add    $0x1,%rdx
  add    $0x8,%rax
  mov    %rsi,-0x8(%rax)
  mov    0x8(%rsp),%rdi
  cmp    %rdx,%rdi
  jle    L191
L174:
  mov    (%r14),%rsi
L9:
  mov    (%rax),%rcx
  cmp    %rcx,%rsi
  jg     L31
  add    $0x1,%rdx
  add    $0x8,%rax
  cmp    %rdi,%rdx
  jl     L9
L191:
  add    $0x1,%r8
  add    $0x8,%r14
  cmp    %rdi,%r8
  jl     L66
L272:
  mov    0x0(%rbp),%rsi
  test   $0x1,%dil
  je     L88
  cmp    $0x1,%rdi
  jne    L113
L129:
  lea    D13(%rip),%rdi
  call   <printf@plt>
  mov    0x10(%rsp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,0x10(%rsp)
  test   %rax,%rax
  jne    L155
L259:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L153
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L113:
  mov    0x8(%rbp),%rcx
  cmp    $0x4,%rdi
  jle    L42
  lea    -0x5(%rdi),%r8
  cmp    $0x3,%r8
  jbe    L69
  shr    $0x2,%r8
  lea    0x20(%rbp),%rax
  pxor   %xmm1,%xmm1
  mov    %r8,%rdx
  shl    $0x5,%rdx
  add    %rax,%rdx
  nopl   0x0(%rax)
L273:
  movdqu (%rax),%xmm0
  movdqu 0x10(%rax),%xmm2
  add    $0x20,%rax
  punpcklqdq %xmm2,%xmm0
  paddq  %xmm0,%xmm1
  cmp    %rax,%rdx
  jne    L273
  movdqa %xmm1,%xmm0
  lea    0x4(,%r8,4),%rdx
  psrldq $0x8,%xmm0
  paddq  %xmm0,%xmm1
  movq   %xmm1,%rax
  add    %rcx,%rax
L251:
  lea    0x0(,%rdx,8),%r8
  add    0x0(%rbp,%rdx,8),%rax
  add    $0x2,%rdx
  cmp    %rdi,%rdx
  jge    L231
  add    0x10(%rbp,%r8,1),%rax
L231:
  sub    $0x1,%rdi
  mov    %rdi,%rdx
  shr    $0x3f,%rdx
  add    %rdi,%rdx
  sar    %rdx
  imul   %rdx,%rsi
  sub    $0x1,%rdx
  imul   %rcx,%rdx
  add    %rsi,%rax
  add    0x10(%rbp),%rax
  lea    (%rax,%rdx,2),%rsi
  jmp    L129
L88:
  cmp    $0x1,%rdi
  jle    L100
  lea    -0x2(%rdi),%rax
  cmp    $0x3,%rax
  jbe    L261
  shr    $0x2,%rax
  pxor   %xmm1,%xmm1
  mov    %rax,%rcx
  lea    0x8(%rbp),%rax
  mov    %rcx,%rdx
  shl    $0x5,%rdx
  add    %rax,%rdx
L79:
  movdqu (%rax),%xmm0
  movdqu 0x10(%rax),%xmm3
  add    $0x20,%rax
  punpcklqdq %xmm3,%xmm0
  paddq  %xmm0,%xmm1
  cmp    %rdx,%rax
  jne    L79
  movdqa %xmm1,%xmm0
  lea    0x1(,%rcx,4),%rdx
  psrldq $0x8,%xmm0
  paddq  %xmm0,%xmm1
  movq   %xmm1,%rax
L276:
  lea    0x0(,%rdx,8),%rcx
  add    0x0(%rbp,%rdx,8),%rax
  add    $0x2,%rdx
  cmp    %rdi,%rdx
  jge    L62
  add    0x10(%rbp,%rcx,1),%rax
L62:
  mov    %rdi,%rdx
  shr    $0x3f,%rdx
  add    %rdi,%rdx
  sar    %rdx
  sub    $0x1,%rdx
  imul   %rdx,%rsi
  imul   0x8(%rbp),%rdx
  add    %rsi,%rax
  lea    (%rax,%rdx,2),%rsi
  jmp    L129
L42:
  mov    %rcx,%rax
  jmp    L231
L100:
  xor    %eax,%eax
  jmp    L62
L69:
  mov    %rcx,%rax
  mov    $0x4,%edx
  jmp    L251
L261:
  xor    %eax,%eax
  mov    $0x1,%edx
  jmp    L276
L153:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D11
datatype: string
name: parse_data
arguments: data_label: D13
datatype: string

tool: D11: %lld

tool: D13: %lld


assistant: ```c
int main() {
  long long int i, n, j, k, l, *a, T, sum = 0;
  scanf("%lld", &T);
  while (T--) {
    scanf("%lld", &n);
    a = (long long int *)malloc(n * sizeof(long long int));
    for (i = 0; i < n; i++) {
      scanf("%lld", &a[i]);
    }
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        if (a[i] > a[j]) {
          l = a[i];
          a[i] = a[j];
          a[j] = l;
        }
      }
    }
    sum = 0;
    if (n % 2 == 0) {
      for (i = 1; i < n; i = i + 2) {
        sum = sum + a[i];
      }
      sum = sum + a[0] * (n / 2 - 1) + a[1] * 2 * (n / 2 - 1);
    } else if ((n % 2 != 0) && (n != 1)) {
      sum = a[1];
      for (i = 4; i < n; i = i + 2) {
        sum = sum + a[i];
      }
      sum = sum + a[0] * ((n - 1) / 2) + a[2] + a[1] * 2 * ((n - 1) / 2 - 1);
    } else {
      sum = a[0];
    }
    printf("%lld\n", sum);
  }
  return 0;
}
```