user: 请从给定的汇编指令推导出C源代码:

```asm
<knapsack_complete>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,-0x70(%rbp)
  mov    %rsi,-0xa0(%rbp)
  mov    %edx,-0x94(%rbp)
  mov    %ecx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    0x1(%rdx),%edi
  lea    0x1(%rcx),%eax
  mov    %eax,-0x7c(%rbp)
  cltq
  shl    $0x2,%rax
  mov    %rax,%rcx
  mov    %rax,-0x78(%rbp)
  movslq %edi,%rax
  imul   %rcx,%rax
  add    $0xf,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L88:
  cmp    %rdx,%rsp
  je     L118
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L88
L118:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L31
  orq    $0x0,-0x8(%rsp,%rax,1)
L31:
  mov    %rsp,%r13
  movslq -0x94(%rbp),%rax
  shl    $0x2,%rax
  mov    %rax,-0xb0(%rbp)
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffffff0,%rdx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L107:
  cmp    %rcx,%rsp
  je     L12
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L107
L12:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L247
  orq    $0x0,-0x8(%rsp,%rax,1)
L247:
  mov    %rsp,-0xa8(%rbp)
  cmpl   $0x0,-0x7c(%rbp)
  jle    L104
  mov    %r13,%rax
  mov    %r12d,%edx
  lea    0x4(%r13,%rdx,4),%rdx
L227:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L227
L104:
  test   %edi,%edi
  jle    L5
  mov    -0x78(%rbp),%rsi
  shr    $0x2,%rsi
  mov    -0x94(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    $0x0,%eax
L155:
  movslq %eax,%rdx
  imul   %rsi,%rdx
  movl   $0x0,0x0(%r13,%rdx,4)
  add    $0x1,%eax
  cmp    %ecx,%eax
  jne    L155
L5:
  cmp    $0x1,%edi
  jle    L91
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdx
  shr    $0x2,%rdx
  mov    %rdx,-0x90(%rbp)
  mov    %r13,%r14
  lea    0x0(%r13,%rax,1),%rsi
  mov    %rsi,-0x48(%rbp)
  mov    -0xa0(%rbp),%r15
  mov    -0x94(%rbp),%eax
  lea    -0x1(%rax),%eax
  add    $0x2,%rax
  mov    %rax,-0x88(%rbp)
  mov    %rsi,-0x58(%rbp)
  mov    %r13,-0x50(%rbp)
  mov    $0x1,%edi
  lea    -0x1(%r12),%eax
  mov    %eax,-0x80(%rbp)
  mov    %r12d,-0x98(%rbp)
  mov    %r13,-0x68(%rbp)
  mov    %rdi,%r13
  jmp    L164
L198:
  mov    (%r14,%rbx,4),%eax
  mov    -0x48(%rbp),%rcx
  mov    %eax,(%rcx,%rbx,4)
L235:
  add    $0x1,%rbx
  cmp    %rbx,%r12
  je     L108
L256:
  mov    (%r15),%eax
  cmp    %ebx,%eax
  jg     L198
  mov    %ebx,%edx
  sub    %eax,%edx
  movslq %edx,%rax
  add    -0x60(%rbp),%rax
  mov    -0x70(%rbp),%rdi
  mov    -0x4(%rdi,%r13,4),%esi
  mov    -0x68(%rbp),%rdi
  add    (%rdi,%rax,4),%esi
  mov    -0x50(%rbp),%rax
  mov    (%rax,%rbx,4),%edi
  call   <max@plt>
  mov    -0x58(%rbp),%rsi
  mov    %eax,(%rsi,%rbx,4)
  jmp    L235
L108:
  add    $0x1,%r13
  mov    -0x78(%rbp),%rax
  add    %rax,%r14
  add    %rax,-0x48(%rbp)
  add    %rax,-0x50(%rbp)
  add    %rax,-0x58(%rbp)
  add    $0x4,%r15
  cmp    -0x88(%rbp),%r13
  je     L47
L164:
  mov    %r13d,%eax
  cmpl   $0x1,-0x7c(%rbp)
  jle    L108
  mov    -0x80(%rbp),%r12d
  add    $0x2,%r12
  mov    $0x1,%ebx
  cltq
  imul   -0x90(%rbp),%rax
  mov    %rax,-0x60(%rbp)
  jmp    L256
L47:
  mov    -0x98(%rbp),%r12d
  mov    -0x68(%rbp),%r13
L91:
  mov    -0x78(%rbp),%rbx
  shr    $0x2,%rbx
  movslq %r12d,%rax
  mov    -0x94(%rbp),%r14d
  movslq %r14d,%rdx
  imul   %rbx,%rdx
  add    %rdx,%rax
  mov    0x0(%r13,%rax,4),%esi
  lea    D4(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r14d,%r10d
  test   %r14d,%r14d
  jle    L14
  lea    -0x1(%r14),%r9d
  movslq %r9d,%r9
  mov    -0xa0(%rbp),%r8
  add    -0xb0(%rbp),%r8
  mov    -0xa8(%rbp),%r11
  jmp    L115
L105:
  mov    $0x0,%edx
L54:
  mov    %edx,(%r11,%r9,4)
  sub    $0x1,%r9
  sub    $0x4,%r8
  sub    $0x1,%r10d
  je     L167
L115:
  mov    $0x0,%edx
  test   %r12d,%r12d
  jle    L105
  movslq %r10d,%rdi
  imul   %rbx,%rdi
  movslq %r9d,%rsi
  imul   %rbx,%rsi
L97:
  movslq %r12d,%rax
  lea    (%rax,%rdi,1),%rcx
  add    %rsi,%rax
  mov    0x0(%r13,%rax,4),%eax
  cmp    %eax,0x0(%r13,%rcx,4)
  je     L54
  add    $0x1,%edx
  sub    -0x4(%r8),%r12d
  test   %r12d,%r12d
  jg     L97
  jmp    L54
L167:
  mov    -0x94(%rbp),%eax
  lea    0x1(%rax),%r13d
  mov    $0x1,%ebx
  lea    D16(%rip),%r12
  mov    -0xa8(%rbp),%r14
L161:
  mov    -0x4(%r14,%rbx,4),%edx
  mov    %ebx,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%rbx
  cmp    %rbx,%r13
  jne    L161
L14:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L42
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L42:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D4
type_guessed: string
name: read_data
arguments: data_tag: D16
type_guessed: string

tool: D4: 
Max Value:%d



tool: D16: Good %d Get %d


assistant: ```c
void knapsack_complete(int v[], int w[], int length, int W) {
  int i, j, k;
  int cLen = length + 1;
  int cW = W + 1;
  int c[cLen][cW];
  int num[length];
  for (i = 0; i < cW; i++)
    c[0][i] = 0;
  for (i = 0; i < cLen; i++)
    c[i][0] = 0;
  for (i = 1; i < cLen; i++) {
    for (j = 1; j < cW; j++) {
      if (w[i - 1] > j)
        c[i][j] = c[i - 1][j];
      else {
        c[i][j] = max(c[i - 1][j], c[i][j - w[i - 1]] + v[i - 1]);
      }
    }
  }
  printf("\nMax Value:%d\n\n", c[length][W]);
  i = length;
  j = W;
  for (i = length; i > 0; i--) {
    k = 0;
    while (j > 0 && c[i][j] != c[i - 1][j]) {
      k++;
      j -= w[i - 1];
    }
    num[i - 1] = k;
  }
  for (i = 0; i < length; i++)
    printf("Good %d Get %d\n", i + 1, num[i]);
  printf("\n");
}
```