user: Converte this assembly snippet into its equivalent C code:

```asm
<solveKnapsack>:
  endbr64
  push   %rbp
  mov    %ecx,%r9d
  mov    %rsp,%rbp
  push   %r15
  mov    %rdx,%r15
  movslq %edi,%rdx
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x68,%rsp
  mov    %rsi,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    0x1(%rcx),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    %rcx,-0x70(%rbp)
  lea    0x0(,%rdx,4),%rcx
  imul   %rcx,%rax
  mov    %rcx,-0x88(%rbp)
  mov    %rsp,%rcx
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L239
L214:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L214
L239:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L109
L198:
  mov    -0x70(%rbp),%r13
  mov    %rsp,%r12
  shr    $0x2,%r13
  test   %r9d,%r9d
  js     L33
  mov    -0x68(%rbp),%rax
  movslq %r9d,%rsi
  mov    %rsi,-0x90(%rbp)
  mov    (%rax),%ecx
  xor    %eax,%eax
  jmp    L64
L259:
  mov    %rdx,%rax
L64:
  xor    %edx,%edx
  cmp    %eax,%ecx
  jg     L168
  mov    (%r15),%edx
L168:
  mov    %edx,(%r12,%rax,4)
  lea    0x1(%rax),%rdx
  cmp    %rsi,%rax
  jne    L259
L147:
  cmp    $0x1,%edi
  jle    L21
  mov    -0x70(%rbp),%rax
  xor    %r11d,%r11d
  mov    %r13,-0x80(%rbp)
  mov    %r12,%rdx
  mov    %r12,-0x60(%rbp)
  mov    %r15,%r10
  mov    %r11,%r13
  lea    (%r12,%rax,1),%r8
  mov    -0x68(%rbp),%rax
  mov    %r8,%r15
  lea    0x4(%rax),%rcx
  lea    -0x1(%rdi),%eax
  mov    %eax,-0x50(%rbp)
  mov    %rcx,%r12
  mov    %rax,-0x78(%rbp)
  cs nopw 0x0(%rax,%rax,1)
L90:
  xor    %ebx,%ebx
  test   %r9d,%r9d
  js     L6
  movslq %r13d,%r14
  imul   -0x80(%rbp),%r14
  mov    %r14,-0x58(%rbp)
  mov    %r13,%r14
  mov    %r12,%r13
  mov    %rdx,%r12
  jmp    L4
  xchg   %ax,%ax
L236:
  mov    %edi,(%r15,%rbx,4)
  add    $0x1,%rbx
  cmp    %ebx,%r9d
  jl     L179
L4:
  mov    0x0(%r13),%eax
  mov    (%r12,%rbx,4),%edi
  cmp    %ebx,%eax
  jg     L236
  mov    %ebx,%esi
  mov    -0x60(%rbp),%rcx
  mov    %r9d,-0x4c(%rbp)
  sub    %eax,%esi
  mov    %r10,-0x48(%rbp)
  movslq %esi,%rax
  add    -0x58(%rbp),%rax
  mov    0x4(%r10,%r14,4),%esi
  add    (%rcx,%rax,4),%esi
  call   <max@plt>
  mov    -0x4c(%rbp),%r9d
  mov    -0x48(%rbp),%r10
  mov    %eax,%edi
  mov    %edi,(%r15,%rbx,4)
  add    $0x1,%rbx
  cmp    %ebx,%r9d
  jge    L4
L179:
  mov    %r12,%rdx
  mov    %r13,%r12
  mov    %r14,%r13
L6:
  mov    -0x70(%rbp),%rax
  add    $0x1,%r13
  add    $0x4,%r12
  add    %rax,%r15
  add    %rax,%rdx
  cmp    -0x78(%rbp),%r13
  jne    L90
  mov    -0x80(%rbp),%r13
  mov    -0x60(%rbp),%r12
L141:
  movslq -0x50(%rbp),%rax
  mov    -0x90(%rbp),%rcx
  mov    -0x88(%rbp),%rdi
  mov    %rax,%r15
  imul   %r13,%rax
  sub    $0x4,%rdi
  imul   %r13,%rdi
  add    %rcx,%rax
  mov    (%r12,%rax,4),%edx
  mov    %rcx,%rax
  add    %r12,%rdi
  mov    %edx,-0x48(%rbp)
  nopw   0x0(%rax,%rax,1)
L106:
  mov    %eax,%r14d
  sub    $0x1,%rax
  mov    %edx,%ecx
  mov    (%rdi,%rax,4),%edx
  cmp    %ecx,%edx
  je     L106
  lea    D7(%rip),%rbx
  test   %r14d,%r14d
  jle    L215
  mov    %r12,%rax
  mov    %r14d,%r12d
  mov    %rax,%r14
  nopl   (%rax)
L251:
  movslq %r12d,%r8
  jmp    L160
  nopl   (%rax)
L212:
  mov    %rdi,%rdx
  movslq %r15d,%rax
  imul   %r13,%rdx
  imul   %r13,%rax
  add    %r8,%rdx
  add    %r8,%rax
  mov    (%r14,%rax,4),%eax
  cmp    %eax,(%r14,%rdx,4)
  jne    L159
L160:
  mov    %r15d,%esi
  sub    $0x1,%r15d
  movslq %esi,%rdi
  test   %esi,%esi
  jg     L212
L159:
  mov    -0x68(%rbp),%rax
  sub    (%rax,%rdi,4),%r12d
  jns    L14
L215:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L227
  mov    -0x48(%rbp),%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nop
L14:
  add    $0x1,%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  test   %r12d,%r12d
  jg     L251
  jmp    L215
  nopw   0x0(%rax,%rax,1)
L109:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L198
L21:
  lea    -0x1(%rdi),%eax
  mov    %eax,-0x50(%rbp)
  jmp    L141
L33:
  movslq %r9d,%rax
  mov    %rax,-0x90(%rbp)
  jmp    L147
L227:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D7
type_guessed: string

tool: D7: %d


assistant: ```c
int solveKnapsack(int nbObjects, int weights[], int values[], int maxValue) {
  int M[nbObjects][maxValue + 1];
  int i, j;
  for (j = 0; j <= maxValue; j++) {
    if (weights[0] > j)
      M[0][j] = 0;
    else
      M[0][j] = values[0];
  }
  for (i = 1; i < nbObjects; i++) {
    for (j = 0; j <= maxValue; j++) {
      if (weights[i] > j)
        M[i][j] = M[i - 1][j];
      else
        M[i][j] = max(M[i - 1][j], M[i - 1][j - weights[i]] + values[i]);
    }
  }
  i = nbObjects - 1, j = maxValue;
  while (M[i][j] == M[i][j - 1])
    j--;
  while (j > 0) {
    while ((i > 0) && (M[i][j] == M[i - 1][j]))
      i--;
    j -= weights[i];
    if (j >= 0)
      printf("%d\n", i + 1);
    i--;
  }
  return M[nbObjects - 1][maxValue];
}
```