user: Please show me the C implementation that matches the assembly code listed below:

```asm
<funcMochila>:
  endbr64
  push   %rbp
  mov    %rsi,%r9
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdx,-0x80(%rbp)
  lea    0x1(%rdi),%edx
  mov    %ecx,-0x48(%rbp)
  movslq %edx,%rdx
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    0x0(,%rdx,4),%rax
  mov    %rax,-0x88(%rbp)
  lea    0x1(%rcx),%eax
  mov    %rsp,%rcx
  cltq
  imul   %rdx,%rax
  lea    0xf(,%rax,4),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L143
L191:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L191
L143:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L176
L72:
  mov    -0x88(%rbp),%rax
  mov    %rsp,%r15
  shr    $0x2,%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x48(%rbp),%eax
  test   %eax,%eax
  js     L145
  mov    $0xffffffffffffffff,%rdx
  xor    %r10d,%r10d
  mov    %r15,-0x68(%rbp)
  mov    %r13d,%ecx
  mov    %r15,-0x78(%rbp)
  mov    %rdx,%r13
  mov    %r10,%r15
  xchg   %ax,%ax
L148:
  mov    %r15d,-0x8c(%rbp)
  xor    %ebx,%ebx
  test   %ecx,%ecx
  js     L47
  test   %r15d,%r15d
  mov    -0x60(%rbp),%rax
  mov    %r13,%r11
  movslq %r13d,%r14
  sete   %r8b
  sub    %r15,%r11
  mov    %r15,-0x70(%rbp)
  mov    -0x68(%rbp),%r12
  imul   %rax,%r14
  xor    %ebx,%ebx
  imul   %rax,%r11
  mov    %r14,-0x58(%rbp)
  mov    %r8d,%r14d
  mov    %r11,%r15
  jmp    L199
  nop
L43:
  mov    (%r9,%r13,4),%eax
  mov    (%r12,%r15,4),%esi
  cmp    %ebx,%eax
  jle    L80
L89:
  add    $0x1,%ebx
  mov    %esi,(%r12)
  add    $0x4,%r12
  cmp    %ebx,%ecx
  jl     L74
L199:
  test   %ebx,%ebx
  je     L34
  test   %r14b,%r14b
  je     L43
L34:
  xor    %esi,%esi
  add    $0x1,%ebx
  add    $0x4,%r12
  mov    %esi,-0x4(%r12)
  cmp    %ebx,%ecx
  jge    L199
L74:
  mov    -0x70(%rbp),%r15
L47:
  mov    -0x88(%rbp),%rdx
  add    $0x1,%r15
  add    %rdx,-0x68(%rbp)
  add    $0x1,%r13
  cmp    %r15d,-0x48(%rbp)
  jge    L148
  mov    -0x8c(%rbp),%r11d
  mov    -0x78(%rbp),%r15
  mov    %ecx,%r13d
L98:
  mov    -0x60(%rbp),%r14
  movslq -0x48(%rbp),%rdx
  movslq %r13d,%rax
  mov    %r9,-0x50(%rbp)
  lea    D19(%rip),%rdi
  mov    %r11d,-0x44(%rbp)
  sub    $0x1,%ebx
  imul   %r14,%rdx
  add    %rdx,%rax
  mov    (%r15,%rax,4),%esi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D27(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movslq -0x44(%rbp),%rdx
  mov    %r14,%rax
  movslq %ebx,%rcx
  mov    -0x50(%rbp),%r9
  imul   %rdx,%rax
  lea    (%r9,%rdx,4),%r13
  add    %rcx,%rax
  mov    (%r15,%rax,4),%eax
  test   %eax,%eax
  je     L178
  mov    %edx,%esi
  jmp    L194
  nop
L75:
  lea    D15(%rip),%rdi
  xor    %eax,%eax
  sub    $0x4,%r13
  call   <printf@plt>
  sub    0x0(%r13),%ebx
  movslq %ebx,%rcx
  add    %rcx,%r12
  mov    (%r15,%r12,4),%eax
  test   %eax,%eax
  je     L178
L13:
  mov    %r14d,%esi
L194:
  lea    -0x1(%rsi),%r14d
  movslq %r14d,%r12
  imul   -0x60(%rbp),%r12
  lea    (%rcx,%r12,1),%rdx
  cmp    %eax,(%r15,%rdx,4)
  jne    L75
  sub    $0x4,%r13
  jmp    L13
  nopl   0x0(%rax,%rax,1)
L80:
  mov    -0x80(%rbp),%rdx
  mov    %ebx,%edi
  mov    %r9,-0x50(%rbp)
  sub    %eax,%edi
  mov    %ecx,-0x44(%rbp)
  movslq %edi,%rax
  mov    (%rdx,%r13,4),%edi
  mov    -0x78(%rbp),%rdx
  add    -0x58(%rbp),%rax
  add    (%rdx,%rax,4),%edi
  call   <max@plt>
  mov    -0x44(%rbp),%ecx
  mov    -0x50(%rbp),%r9
  mov    %eax,%esi
  jmp    L89
  nopl   0x0(%rax)
L178:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L182
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L176:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L72
L145:
  mov    $0xffffffff,%r11d
  jmp    L98
L182:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D19
datatype: string
name: parse_data
arguments: tag: D27
datatype: string
name: parse_data
arguments: tag: D15
datatype: string

tool: D19: valor : %d 


tool: D27: posicoes escolhidas : 

tool: D15:  %d 

assistant: ```c
void funcMochila(int W, int wt[], int val[], int n) {
  int i, w;
  int K[n + 1][W + 1];
  for (i = 0; i <= n; i++) {
    for (w = 0; w <= W; w++) {
      if (i == 0 || w == 0)
        K[i][w] = 0;
      else if (wt[i - 1] <= w)
        K[i][w] = max(val[i - 1] + K[i - 1][w - wt[i - 1]], K[i - 1][w]);
      else
        K[i][w] = K[i - 1][w];
    }
  }
  i--;
  w--;
  printf("valor : %d \n", K[n][W]);
  printf("posicoes escolhidas : ");
  while (K[i][w]) {
    if (K[i][w] == K[i - 1][w])
      i--;
    else {
      printf(" %d ", i);
      i--;
      w = w - wt[i];
    }
  }
}
```