user: Translate the below assembly code into C programming language:

```asm
<maxProfit>:
  endbr64
  xor    %eax,%eax
  cmp    $0x1,%edx
  jle    L31
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %edx,%r14d
  sar    %edx
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  cmp    %edi,%edx
  jge    L80
  lea    -0x2(%r14),%edx
  lea    -0x1(%r14),%ecx
  cmp    $0x2,%edx
  jbe    L193
  mov    %ecx,%edx
  mov    %rsi,%rax
  pxor   %xmm1,%xmm1
  shr    $0x2,%edx
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%rsi,%rdx,1),%rdx
  nopl   0x0(%rax,%rax,1)
L52:
  movdqu 0x4(%rax),%xmm0
  movdqu (%rax),%xmm3
  add    $0x10,%rax
  movdqa %xmm0,%xmm2
  pcmpgtd %xmm3,%xmm0
  psubd  %xmm3,%xmm2
  pand   %xmm2,%xmm0
  paddd  %xmm0,%xmm1
  cmp    %rdx,%rax
  jne    L52
  movdqa %xmm1,%xmm0
  mov    %ecx,%esi
  psrldq $0x8,%xmm0
  and    $0xfffffffc,%esi
  paddd  %xmm0,%xmm1
  lea    0x1(%rsi),%edx
  movdqa %xmm1,%xmm0
  psrldq $0x4,%xmm0
  paddd  %xmm0,%xmm1
  movd   %xmm1,%eax
  cmp    %esi,%ecx
  je     L167
L14:
  movslq %edx,%rsi
  lea    0x1(%rdx),%r8d
  shl    $0x2,%rsi
  lea    (%r15,%rsi,1),%rdi
  cmp    %ecx,%r8d
  jge    L96
  cmp    %edx,%r14d
  jle    L96
  mov    -0x4(%rdi),%r9d
  mov    (%rdi),%edi
  mov    %edi,%r8d
  sub    %r9d,%r8d
  add    %eax,%r8d
  cmp    %edi,%r9d
  cmovl  %r8d,%eax
  mov    0x4(%r15,%rsi,1),%r8d
  mov    %r8d,%r9d
  sub    %edi,%r9d
  add    %eax,%r9d
  cmp    %r8d,%edi
  lea    0x2(%rdx),%edi
  cmovl  %r9d,%eax
  lea    0x3(%rdx),%r9d
  cmp    %r9d,%ecx
  jg     L39
L95:
  movslq %edi,%rdx
  lea    0x0(,%rdx,4),%rsi
  mov    (%r15,%rdx,4),%edx
  mov    -0x4(%r15,%rsi,1),%r8d
  mov    %edx,%ecx
  sub    %r8d,%ecx
  add    %eax,%ecx
  cmp    %r8d,%edx
  cmovg  %ecx,%eax
  lea    0x1(%rdi),%ecx
  cmp    %ecx,%r14d
  jle    L167
  mov    0x4(%r15,%rsi,1),%ecx
  mov    %ecx,%r8d
  sub    %edx,%r8d
  add    %eax,%r8d
  cmp    %ecx,%edx
  cmovl  %r8d,%eax
  add    $0x2,%edi
  cmp    %edi,%r14d
  jle    L167
  mov    0x8(%r15,%rsi,1),%esi
  mov    %esi,%edx
  sub    %ecx,%edx
  add    %eax,%edx
  cmp    %ecx,%esi
  cmovg  %edx,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L80:
  lea    0x0(,%rdi,4),%r12d
  movslq %edi,%r11
  mov    %r12d,%edi
  mov    %r11,0x8(%rsp)
  call   <malloc@plt>
  mov    %r12d,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  xor    %esi,%esi
  mov    %r12d,%edx
  mov    %rax,%rdi
  mov    %rax,%r13
  call   <memset@plt>
  test   %ebx,%ebx
  mov    0x8(%rsp),%r11
  jle    L205
  mov    D3(%rip),%rcx
  mov    %ebx,%edx
  lea    -0x1(%rbx),%esi
  mov    %rbp,%rax
  lea    0x0(%rbp,%rdx,4),%rdx
  cmp    %rcx,%rdx
  lea    0x4(%rcx),%rdi
  setbe  %dl
  cmp    %rdi,%rbp
  setae  %dil
  or     %dil,%dl
  je     L72
  cmp    $0x2,%esi
  jbe    L72
  mov    %ebx,%edx
  movd   (%rcx),%xmm5
  shr    $0x2,%edx
  shl    $0x4,%rdx
  pshufd $0x0,%xmm5,%xmm0
  add    %rbp,%rdx
  nopl   0x0(%rax)
L15:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L15
  mov    %ebx,%eax
  and    $0xfffffffc,%eax
  test   $0x3,%bl
  je     L172
  mov    (%rcx),%esi
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rdi
  mov    %esi,0x0(%rbp,%rdx,4)
  lea    0x1(%rax),%edx
  cmp    %edx,%ebx
  jle    L172
  add    $0x2,%eax
  mov    %esi,0x4(%rbp,%rdi,1)
  cmp    %eax,%ebx
  jle    L172
  mov    (%rcx),%eax
  mov    %eax,0x8(%rbp,%rdi,1)
L172:
  lea    -0x1(%r14),%eax
  lea    0x4(%rbp),%rdi
  mov    %r15,%rsi
  lea    0x4(%r15,%rax,4),%r9
  lea    -0x2(%rbx),%eax
  sub    %r13,%rdi
  lea    0x4(%r13,%rax,4),%r8
  nopw   0x0(%rax,%rax,1)
L209:
  mov    (%rsi),%eax
  mov    0x0(%rbp),%edx
  neg    %eax
  cmp    %edx,%eax
  cmovl  %edx,%eax
  mov    %eax,0x0(%rbp)
  mov    0x0(%r13),%edx
  add    (%rsi),%eax
  cmp    %edx,%eax
  cmovl  %edx,%eax
  mov    %r13,%rdx
  mov    %eax,0x0(%r13)
  cmp    $0x1,%ebx
  je     L24
  cs nopw 0x0(%rax,%rax,1)
L81:
  lea    (%rdi,%rdx,1),%rcx
  mov    (%rdx),%eax
  sub    (%rsi),%eax
  mov    (%rcx),%r10d
  cmp    %r10d,%eax
  cmovl  %r10d,%eax
  add    $0x4,%rdx
  mov    %eax,(%rcx)
  mov    (%rdx),%ecx
  add    (%rsi),%eax
  cmp    %ecx,%eax
  cmovl  %ecx,%eax
  mov    %eax,(%rdx)
  cmp    %r8,%rdx
  jne    L81
L24:
  add    $0x4,%rsi
  cmp    %rsi,%r9
  jne    L209
L205:
  mov    -0x4(%r13,%r11,4),%eax
L167:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L31:
  ret
L39:
  mov    0x8(%r15,%rsi,1),%edi
  mov    %edi,%r9d
  sub    %r8d,%r9d
  add    %eax,%r9d
  cmp    %edi,%r8d
  cmovl  %r9d,%eax
  mov    0xc(%r15,%rsi,1),%r9d
  mov    %r9d,%r8d
  sub    %edi,%r8d
  add    %eax,%r8d
  cmp    %r9d,%edi
  lea    0x4(%rdx),%edi
  cmovl  %r8d,%eax
  lea    0x5(%rdx),%r8d
  cmp    %r8d,%ecx
  jle    L95
  mov    0x10(%r15,%rsi,1),%ecx
  mov    %ecx,%edi
  sub    %r9d,%edi
  add    %eax,%edi
  cmp    %r9d,%ecx
  cmovg  %edi,%eax
  mov    0x14(%r15,%rsi,1),%edi
  mov    %edi,%esi
  sub    %ecx,%esi
  add    %eax,%esi
  cmp    %ecx,%edi
  lea    0x6(%rdx),%edi
  cmovg  %esi,%eax
  jmp    L95
L72:
  lea    0x4(%rbp,%rsi,4),%rsi
  nop
L120:
  mov    (%rcx),%edx
  add    $0x4,%rax
  mov    %edx,-0x4(%rax)
  cmp    %rsi,%rax
  jne    L120
  jmp    L172
L193:
  mov    $0x1,%edx
  jmp    L14
L96:
  mov    %edx,%edi
  jmp    L95
```

assistant: ```c
int maxProfit(int k, int *prices, int size) {
  if (size < 2)
    return 0;
  if (k > size / 2) {
    int profit = 0;
    for (int i = 1; i < size; i++)
      if (prices[i] > prices[i - 1])
        profit += prices[i] - prices[i - 1];
    return profit;
  }
  int *holds = (int *)malloc(sizeof(int) * k);
  int *solds = (int *)malloc(sizeof(int) * k);
  memset(solds, 0, sizeof(int) * k);
  for (int i = 0; i < k; i++)
    holds[i] = INT_MIN;
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < k; j++) {
      holds[j] = (holds[j]) > ((j > 0 ? solds[j - 1] : 0) - prices[i]) ? (holds[j]) : ((j > 0 ? solds[j - 1] : 0) - prices[i]);
      solds[j] = (solds[j]) > (holds[j] + prices[i]) ? (solds[j]) : (holds[j] + prices[i]);
    }
  }
  return solds[k - 1];
}
```