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

```asm
<knapsack>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1e8,%rsp
  mov    %edi,%r12d
  mov    %esi,%ebx
  mov    %rcx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x1d8(%rsp)
  xor    %eax,%eax
  lea    0x40(%rsp),%rdi
  mov    $0x32,%ecx
  rep stos %rax,%es:(%rdi)
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  movq   $0x0,0x28(%rsp)
  movq   $0x0,0x30(%rsp)
  test   %r12d,%r12d
  jle    L12
  mov    %rdx,%r10
  lea    0x2(%r12),%r13d
  mov    $0x28,%edi
  mov    $0x0,%esi
  mov    $0x2,%r9d
  lea    0x44(%rsp),%r14
  lea    0x1(%rbx),%eax
  mov    %r12d,0xc(%rsp)
  mov    %eax,%r12d
  jmp    L1
L115:
  mov    (%rax),%ecx
L15:
  lea    (%rax,%rsi,1),%r15
  mov    %ecx,(%r15,%rdi,1)
  add    $0x1,%edx
  add    $0x4,%rax
  cmp    %r8d,%edx
  je     L77
L73:
  test   %edx,%edx
  js     L115
  mov    -0x4(%rax,%r11,4),%ecx
  add    -0x4(%r10,%r9,4),%ecx
  mov    (%rax),%r15d
  cmp    %r15d,%ecx
  cmovl  %r15d,%ecx
  jmp    L15
L77:
  add    $0x1,%r9
  sub    $0x28,%rsi
  add    $0x28,%rdi
  cmp    %r13,%r9
  je     L9
L1:
  test   %ebx,%ebx
  jle    L77
  mov    $0x1,%r11d
  sub    -0x4(%rbp,%r9,4),%r11d
  mov    %r11d,%edx
  mov    %r14,%rax
  sub    %rsi,%rax
  mov    %r12d,%r8d
  sub    -0x4(%rbp,%r9,4),%r8d
  movslq %r11d,%r11
  jmp    L73
L80:
  sub    $0x1,%rax
  test   %eax,%eax
  jle    L89
L7:
  movslq %ebx,%rdx
  movslq %eax,%rcx
  lea    (%rcx,%rcx,4),%rcx
  lea    (%rdx,%rcx,2),%rsi
  lea    -0x1(%rax),%ecx
  movslq %ecx,%rcx
  lea    (%rcx,%rcx,4),%rcx
  lea    (%rdx,%rcx,2),%rdx
  mov    0x40(%rsp,%rdx,4),%edi
  cmp    %edi,0x40(%rsp,%rsi,4)
  je     L80
  movl   $0x1,0x10(%rsp,%rax,4)
  sub    0x0(%rbp,%rax,4),%ebx
  jmp    L80
L89:
  mov    $0x1,%ebx
  lea    D44(%rip),%rbp
L40:
  mov    0x10(%rsp,%rbx,4),%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%rbx
  cmp    %ebx,%r12d
  jge    L40
L45:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x1d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L126
  add    $0x1e8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L9:
  mov    0xc(%rsp),%r12d
  movslq %ebx,%rax
  movslq %r12d,%r13
  lea    0x0(%r13,%r13,4),%rdx
  lea    (%rax,%rdx,2),%rax
  mov    0x40(%rsp,%rax,4),%esi
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D14(%rip),%rdi
  call   <puts@plt>
  mov    %r13,%rax
  jmp    L7
L12:
  movslq %esi,%rbx
  movslq %r12d,%r12
  lea    (%r12,%r12,4),%rax
  lea    (%rbx,%rax,2),%rax
  mov    0x40(%rsp,%rax,4),%esi
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D14(%rip),%rdi
  call   <puts@plt>
  jmp    L45
L126:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D44
data_type: string
name: extract_symbolic_data
arguments: data_label: D31
data_type: string
name: extract_symbolic_data
arguments: data_label: D14
data_type: string

tool: D44: %d	

tool: D31: Max profit : %d


tool: D14: Edges are : 

assistant: ```c
void knapsack(int no, int wt, int pt[10], int weight[10]) {
  int knap[10][10] = {0}, x[10] = {0}, i, j;
  for (i = 1; i <= no; i++)
    for (j = 1; j <= wt; j++) {
      if ((j - weight[i]) < 0)
        knap[i][j] = knap[i - 1][j];
      else
        knap[i][j] = (knap[i - 1][j] > pt[i] + knap[i - 1][j - weight[i]] ? knap[i - 1][j] : pt[i] + knap[i - 1][j - weight[i]]);
    }
  printf("Max profit : %d\n", knap[no][wt]);
  printf("Edges are : \n");
  for (i = no; i >= 1; i--)
    if (knap[i][wt] != knap[i - 1][wt]) {
      x[i] = 1;
      wt -= weight[i];
    }
  for (i = 1; i <= no; i++)
    printf("%d\t", x[i]);
  printf("\n");
}
```