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

```asm
<Knapsack>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x1e8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1d8(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x10(%rsp)
  movq   $0x0,0x30(%rsp)
  movaps %xmm0,0x20(%rsp)
  test   %edi,%edi
  js     L39
  movl   $0x0,0x40(%rsp)
  je     L39
  movl   $0x0,0x68(%rsp)
  cmp    $0x1,%edi
  je     L354
  movl   $0x0,0x90(%rsp)
  cmp    $0x2,%edi
  je     L354
  movl   $0x0,0xb8(%rsp)
  cmp    $0x3,%edi
  je     L354
  movl   $0x0,0xe0(%rsp)
  cmp    $0x4,%edi
  je     L354
  movl   $0x0,0x108(%rsp)
  cmp    $0x5,%edi
  je     L354
  movl   $0x0,0x130(%rsp)
  cmp    $0x6,%edi
  je     L354
  movl   $0x0,0x158(%rsp)
  cmp    $0x7,%edi
  je     L354
  movl   $0x0,0x180(%rsp)
  cmp    $0x8,%edi
  je     L354
  movl   $0x0,0x1a8(%rsp)
L354:
  test   %ebx,%ebx
  js     L478
L121:
  movslq %ebx,%rax
  xor    %esi,%esi
  lea    0x40(%rsp),%rdi
  lea    0x4(,%rax,4),%rdx
  mov    %rax,0x8(%rsp)
  call   <memset@plt>
  test   %ebp,%ebp
  jle    L193
  test   %ebx,%ebx
  jle    L293
  lea    0x4(%r13),%rcx
  lea    0x44(%rsp),%rax
  mov    %ebp,%r13d
  xor    %esi,%esi
  mov    $0x1,%r9d
  mov    $0x2,%r10d
  mov    $0x3,%r11d
  nopl   0x0(%rax,%rax,1)
L446:
  mov    0x4(%r12,%rsi,4),%edx
  mov    %r9d,%r14d
  mov    (%rax),%r8d
  movslq %esi,%rdi
  sub    %edx,%r14d
  js     L338
  movslq %r14d,%r15
  movslq %esi,%r14
  lea    (%r14,%r14,4),%r14
  lea    (%r15,%r14,2),%r14
  mov    0x40(%rsp,%r14,4),%r14d
  add    (%rcx),%r14d
  cmp    %r14d,%r8d
  cmovl  %r14d,%r8d
L338:
  mov    %r8d,0x28(%rax)
  cmp    $0x1,%ebx
  je     L189
  mov    %r10d,%r14d
  mov    0x4(%rax),%r8d
  sub    %edx,%r14d
  js     L279
  movslq %r14d,%r15
  movslq %edi,%r14
  lea    (%r14,%r14,4),%r14
  lea    (%r15,%r14,2),%r14
  mov    0x40(%rsp,%r14,4),%r14d
  add    (%rcx),%r14d
  cmp    %r14d,%r8d
  cmovl  %r14d,%r8d
L279:
  mov    %r8d,0x2c(%rax)
  cmp    $0x2,%ebx
  je     L189
  mov    %r11d,%r14d
  mov    0x8(%rax),%r8d
  sub    %edx,%r14d
  js     L166
  movslq %r14d,%r15
  movslq %edi,%r14
  lea    (%r14,%r14,4),%r14
  lea    (%r15,%r14,2),%r14
  mov    0x40(%rsp,%r14,4),%r14d
  add    (%rcx),%r14d
  cmp    %r14d,%r8d
  cmovl  %r14d,%r8d
L166:
  mov    %r8d,0x30(%rax)
  cmp    $0x3,%ebx
  je     L189
  mov    $0x4,%r8d
  mov    0xc(%rax),%r14d
  sub    %edx,%r8d
  js     L225
  movslq %r8d,%r15
  movslq %edi,%r8
  lea    (%r8,%r8,4),%r8
  lea    (%r15,%r8,2),%r8
  mov    0x40(%rsp,%r8,4),%r8d
  add    (%rcx),%r8d
  cmp    %r8d,%r14d
  cmovl  %r8d,%r14d
L225:
  mov    %r14d,0x34(%rax)
  cmp    $0x4,%ebx
  je     L189
  mov    $0x5,%r8d
  mov    0x10(%rax),%r14d
  sub    %edx,%r8d
  js     L314
  movslq %r8d,%r15
  movslq %edi,%r8
  lea    (%r8,%r8,4),%r8
  lea    (%r15,%r8,2),%r8
  mov    0x40(%rsp,%r8,4),%r8d
  add    (%rcx),%r8d
  cmp    %r8d,%r14d
  cmovl  %r8d,%r14d
L314:
  mov    %r14d,0x38(%rax)
  cmp    $0x5,%ebx
  je     L189
  mov    $0x6,%r8d
  mov    0x14(%rax),%r14d
  sub    %edx,%r8d
  js     L476
  movslq %r8d,%r15
  movslq %edi,%r8
  lea    (%r8,%r8,4),%r8
  lea    (%r15,%r8,2),%r8
  mov    0x40(%rsp,%r8,4),%r8d
  add    (%rcx),%r8d
  cmp    %r8d,%r14d
  cmovl  %r8d,%r14d
L476:
  mov    %r14d,0x3c(%rax)
  cmp    $0x6,%ebx
  je     L189
  mov    $0x7,%r8d
  mov    0x18(%rax),%r14d
  sub    %edx,%r8d
  js     L445
  movslq %r8d,%r15
  movslq %edi,%r8
  lea    (%r8,%r8,4),%r8
  lea    (%r15,%r8,2),%r8
  mov    0x40(%rsp,%r8,4),%r8d
  add    (%rcx),%r8d
  cmp    %r8d,%r14d
  cmovl  %r8d,%r14d
L445:
  mov    %r14d,0x40(%rax)
  cmp    $0x7,%ebx
  je     L189
  mov    $0x8,%r8d
  mov    0x1c(%rax),%r14d
  sub    %edx,%r8d
  js     L470
  movslq %r8d,%r15
  movslq %edi,%r8
  lea    (%r8,%r8,4),%r8
  lea    (%r15,%r8,2),%r8
  mov    0x40(%rsp,%r8,4),%r8d
  add    (%rcx),%r8d
  cmp    %r8d,%r14d
  cmovl  %r8d,%r14d
L470:
  mov    %r14d,0x44(%rax)
  cmp    $0x8,%ebx
  je     L189
  mov    $0x9,%r14d
  mov    0x20(%rax),%r8d
  sub    %edx,%r14d
  js     L224
  movslq %r14d,%r14
  lea    (%rdi,%rdi,4),%rdx
  lea    (%r14,%rdx,2),%rdx
  mov    0x40(%rsp,%rdx,4),%edx
  add    (%rcx),%edx
  cmp    %edx,%r8d
  cmovl  %edx,%r8d
L224:
  mov    %r8d,0x48(%rax)
L189:
  add    $0x1,%rsi
  add    $0x28,%rax
  add    $0x4,%rcx
  cmp    %rsi,%r13
  jne    L446
L293:
  mov    0x8(%rsp),%r15
  movslq %ebp,%r13
  lea    D12(%rip),%rdi
  lea    0x0(%r13,%r13,4),%rax
  lea    (%r15,%rax,2),%rax
  mov    0x40(%rsp,%rax,4),%r14d
  xor    %eax,%eax
  mov    %r14d,%esi
  call   <printf@plt>
  lea    D11(%rip),%rdi
  call   <puts@plt>
  lea    -0x1(%rbp),%edx
  movslq %edx,%rax
  lea    (%rax,%rax,4),%rcx
  lea    (%r15,%rcx,2),%rcx
  cmp    0x40(%rsp,%rcx,4),%r14d
  je     L44
  movl   $0x1,0x10(%rsp,%r13,4)
  sub    (%r12,%r13,4),%ebx
L44:
  test   %edx,%edx
  je     L461
  lea    -0x2(%rbp),%esi
  movslq %ebx,%rcx
  lea    (%rax,%rax,4),%r8
  movslq %esi,%rdx
  lea    (%rdx,%rdx,4),%rdi
  lea    (%rcx,%rdi,2),%rdi
  lea    (%rcx,%r8,2),%rcx
  mov    0x40(%rsp,%rcx,4),%ecx
  cmp    %ecx,0x40(%rsp,%rdi,4)
  je     L8
  movl   $0x1,0x10(%rsp,%rax,4)
  sub    (%r12,%rax,4),%ebx
L8:
  test   %esi,%esi
  je     L461
  movslq %ebx,%rcx
  lea    (%rdx,%rdx,4),%rax
  lea    -0x3(%rbp),%esi
  lea    (%rcx,%rax,2),%rdi
  movslq %esi,%rax
  lea    (%rax,%rax,4),%r8
  lea    (%rcx,%r8,2),%rcx
  mov    0x40(%rsp,%rcx,4),%ecx
  cmp    %ecx,0x40(%rsp,%rdi,4)
  je     L32
  movl   $0x1,0x10(%rsp,%rdx,4)
  sub    (%r12,%rdx,4),%ebx
L32:
  test   %esi,%esi
  je     L461
  movslq %ebx,%rcx
  lea    (%rax,%rax,4),%rdx
  lea    -0x4(%rbp),%esi
  lea    (%rcx,%rdx,2),%rdi
  movslq %esi,%rdx
  lea    (%rdx,%rdx,4),%r8
  lea    (%rcx,%r8,2),%rcx
  mov    0x40(%rsp,%rcx,4),%ecx
  cmp    %ecx,0x40(%rsp,%rdi,4)
  je     L246
  movl   $0x1,0x10(%rsp,%rax,4)
  sub    (%r12,%rax,4),%ebx
L246:
  test   %esi,%esi
  je     L461
  movslq %ebx,%rcx
  lea    (%rdx,%rdx,4),%rax
  lea    -0x5(%rbp),%esi
  lea    (%rcx,%rax,2),%rdi
  movslq %esi,%rax
  lea    (%rax,%rax,4),%r8
  lea    (%rcx,%r8,2),%rcx
  mov    0x40(%rsp,%rcx,4),%ecx
  cmp    %ecx,0x40(%rsp,%rdi,4)
  je     L423
  movl   $0x1,0x10(%rsp,%rdx,4)
  sub    (%r12,%rdx,4),%ebx
L423:
  test   %esi,%esi
  je     L461
  movslq %ebx,%rcx
  lea    (%rax,%rax,4),%rdx
  lea    -0x6(%rbp),%esi
  lea    (%rcx,%rdx,2),%rdi
  movslq %esi,%rdx
  lea    (%rdx,%rdx,4),%r8
  lea    (%rcx,%r8,2),%rcx
  mov    0x40(%rsp,%rcx,4),%ecx
  cmp    %ecx,0x40(%rsp,%rdi,4)
  je     L491
  movl   $0x1,0x10(%rsp,%rax,4)
  sub    (%r12,%rax,4),%ebx
L491:
  test   %esi,%esi
  je     L461
  movslq %ebx,%rcx
  lea    (%rdx,%rdx,4),%rax
  lea    -0x7(%rbp),%esi
  lea    (%rcx,%rax,2),%rdi
  movslq %esi,%rax
  lea    (%rax,%rax,4),%r8
  lea    (%rcx,%r8,2),%rcx
  mov    0x40(%rsp,%rcx,4),%ecx
  cmp    %ecx,0x40(%rsp,%rdi,4)
  je     L291
  movl   $0x1,0x10(%rsp,%rdx,4)
  sub    (%r12,%rdx,4),%ebx
L291:
  test   %esi,%esi
  je     L461
  movslq %ebx,%rdx
  lea    (%rax,%rax,4),%rsi
  lea    -0x8(%rbp),%ecx
  lea    (%rdx,%rsi,2),%rdi
  movslq %ecx,%rsi
  lea    (%rsi,%rsi,4),%rsi
  lea    (%rdx,%rsi,2),%rdx
  mov    0x40(%rsp,%rdx,4),%esi
  cmp    %esi,0x40(%rsp,%rdi,4)
  je     L83
  movl   $0x1,0x10(%rsp,%rax,4)
  sub    (%r12,%rax,4),%ebx
L83:
  cmp    $0x1,%ecx
  jne    L461
  movslq %ebx,%rbx
  mov    0x40(%rsp,%rbx,4),%eax
  cmp    %eax,0x68(%rsp,%rbx,4)
  je     L461
  movl   $0x1,0x14(%rsp)
L461:
  mov    $0x1,%ebx
  lea    0x10(%rsp),%r13
  lea    D28(%rip),%r12
  nopw   0x0(%rax,%rax,1)
L253:
  mov    0x0(%r13,%rbx,4),%esi
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <printf@plt>
  cmp    %ebx,%ebp
  jge    L253
L255:
  mov    0x1d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L521
  add    $0x1e8,%rsp
  mov    $0xa,%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1090 <putchar@plt>
L39:
  test   %ebx,%ebx
  jns    L121
  movslq %ebx,%rax
  mov    %rax,0x8(%rsp)
L193:
  mov    0x8(%rsp),%rdi
  movslq %ebp,%rbp
  lea    0x0(%rbp,%rbp,4),%rax
  lea    (%rdi,%rax,2),%rax
  lea    D12(%rip),%rdi
  mov    0x40(%rsp,%rax,4),%esi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D11(%rip),%rdi
  call   <puts@plt>
  jmp    L255
L478:
  movslq %ebx,%rax
  mov    %rax,0x8(%rsp)
  jmp    L293
L521:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D12
type: string
name: parse_data
arguments: data_label: D11
type: string
name: parse_data
arguments: data_label: D28
type: string

tool: D12: Max Profit : %d 


tool: D11: Edges are :

tool: D28: %d	

assistant: ```c
void Knapsack(int no, int wt, int pt[10], int weight[10]) {
  int knap[10][10], x[10] = {0};
  int i, j;
  for (i = 0; i <= no; i++)
    knap[i][0] = 0;
  for (i = 0; i <= wt; i++)
    knap[0][i] = 0;
  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");
}
```