user: What is the c source code of the assembly code below:

```asm
<stockmaximize>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  lea    D20(%rip),%rdi
  call   <scanf@plt>
  mov    (%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,(%rsp)
  test   %eax,%eax
  je     L123
  lea    0x4(%rsp),%r15
  lea    D20(%rip),%r14
  jmp    L81
L129:
  lea    0x1(%rdi),%edx
L16:
  mov    %ecx,%eax
  cmp    %ecx,%edx
  cmovge %edx,%eax
  add    $0x1,%rcx
  cmp    %r8d,%eax
  jge    L15
L52:
  mov    -0x4(%r12,%rcx,4),%edi
  cmp    %edx,%edi
  jl     L16
  movslq %edi,%r10
  mov    %edi,%eax
  sub    %edx,%eax
  imul   0x0(%r13,%r10,4),%eax
  add    %eax,%esi
  cmp    %edx,%edi
  jle    L129
  movslq %edx,%r10
  lea    0x0(%r13,%r10,4),%rax
  mov    %edi,%r11d
  sub    %edx,%r11d
  lea    -0x1(%r11),%edx
  add    %r10,%rdx
  lea    (%r9,%rdx,4),%rdx
L116:
  sub    (%rax),%esi
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L116
  jmp    L129
L8:
  mov    $0x0,%esi
L15:
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    (%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,(%rsp)
  test   %eax,%eax
  je     L123
L81:
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    0x4(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    0x4(%rsp),%edx
  test   %edx,%edx
  jle    L20
  mov    %r13,%rbp
  mov    $0x0,%ebx
L50:
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  mov    %ebx,(%r12,%rbx,4)
  mov    0x4(%rsp),%edx
  add    $0x1,%rbx
  add    $0x4,%rbp
  cmp    %ebx,%edx
  jg     L50
L20:
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <quicksort_index_descending@plt>
  mov    0x4(%rsp),%r8d
  test   %r8d,%r8d
  jle    L8
  mov    $0x1,%ecx
  mov    $0x0,%edx
  mov    $0x0,%esi
  lea    0x4(%r13),%r9
  jmp    L52
L123:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L121
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L121:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D20
type: string
name: read_data
arguments: data_label: D2
type: string

tool: D20: %d

tool: D2: %u


assistant: ```c
int stockmaximize(void) {
  int numTestCases;
  scanf("%d", &numTestCases);
  while (numTestCases--) {
    int numDays;
    scanf("%d", &numDays);
    int *prices = malloc(sizeof(int) * numDays);
    int *sortedPriceIndexes = malloc(sizeof(int) * numDays);
    uint bestPrice = 0;
    int lastIndex = 0;
    for (int i = 0; i < numDays; i++) {
      scanf("%d", prices + i);
      sortedPriceIndexes[i] = i;
    }
    quicksort_index_descending(prices, sortedPriceIndexes, numDays);
    for (int i = 0; i < numDays && lastIndex < numDays; i++) {
      if (sortedPriceIndexes[i] >= lastIndex) {
        bestPrice += prices[sortedPriceIndexes[i]] * (sortedPriceIndexes[i] - lastIndex);
        for (int j = lastIndex; j < sortedPriceIndexes[i]; j++) {
          bestPrice -= prices[j];
        }
        lastIndex = sortedPriceIndexes[i] + 1;
      }
    }
    printf("%u\n", bestPrice);
    free(prices);
    free(sortedPriceIndexes);
  }
  return 0;
}
```