user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<solve2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %edi,%r15d
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %esi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    0x1(%rsi),%eax
  mov    %rsp,%rsi
  mov    %eax,-0x54(%rbp)
  cltq
  lea    0x0(,%rax,4),%rbx
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  mov    %rbx,-0x48(%rbp)
  sub    %rax,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L62
L46:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L46
L62:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L121
L93:
  mov    -0x54(%rbp),%eax
  mov    %rsp,%r12
  xor    %esi,%esi
  mov    %rcx,-0x50(%rbp)
  mov    %r12,%rdi
  lea    0x0(,%rax,8),%edx
  call   <memset@plt>
  mov    -0x48(%rbp),%rax
  mov    -0x58(%rbp),%edx
  mov    -0x50(%rbp),%rcx
  shr    $0x2,%rax
  test   %edx,%edx
  mov    %rax,-0x68(%rbp)
  js     L100
  mov    (%r14),%esi
  movslq -0x58(%rbp),%rbx
  xor    %eax,%eax
  jmp    L68
  nopl   0x0(%rax)
L50:
  mov    %rdx,%rax
L68:
  xor    %edx,%edx
  cmp    %eax,%esi
  jg     L159
  mov    (%rcx),%edx
L159:
  mov    %edx,(%r12,%rax,4)
  lea    0x1(%rax),%rdx
  cmp    %rbx,%rax
  jne    L50
L59:
  mov    -0x54(%rbp),%esi
  mov    %r12,%rdi
  mov    %rcx,-0x50(%rbp)
  call   <pvector@plt>
  cmp    $0x1,%r15d
  jle    L133
  mov    -0x50(%rbp),%rcx
  lea    -0x2(%r15),%eax
  lea    0x4(%r14),%r8
  mov    $0x1,%r15d
  lea    0x8(%rcx,%rax,4),%rax
  lea    0x4(%rcx),%r13
  mov    %rax,-0x60(%rbp)
L7:
  mov    -0x58(%rbp),%eax
  movslq %r15d,%r14
  xor    $0x1,%r15d
  test   %eax,%eax
  js     L129
  mov    -0x48(%rbp),%rax
  movslq %r15d,%r11
  mov    (%r8),%r10d
  mov    %rax,%r9
  imul   %r14,%rax
  mov    %r10d,%ecx
  imul   %r11,%r9
  neg    %ecx
  imul   -0x68(%rbp),%r11
  mov    %rax,%rdi
  xor    %eax,%eax
  add    %r12,%r9
  add    %r12,%rdi
  jmp    L29
  nopw   0x0(%rax,%rax,1)
L52:
  mov    %rdx,%rax
L29:
  mov    (%r9,%rax,4),%edx
  cmp    %eax,%r10d
  jg     L84
  movslq %ecx,%rsi
  add    %r11,%rsi
  mov    (%r12,%rsi,4),%esi
  add    0x0(%r13),%esi
  cmp    %esi,%edx
  cmovl  %esi,%edx
L84:
  mov    %edx,(%rdi,%rax,4)
  add    $0x1,%ecx
  lea    0x1(%rax),%rdx
  cmp    %rax,%rbx
  jne    L52
L129:
  mov    -0x48(%rbp),%rdi
  mov    -0x54(%rbp),%esi
  mov    %r8,-0x50(%rbp)
  add    $0x4,%r13
  imul   %r14,%rdi
  add    %r12,%rdi
  call   <pvector@plt>
  mov    -0x50(%rbp),%r8
  add    $0x4,%r8
  cmp    -0x60(%rbp),%r13
  jne    L7
L92:
  imul   -0x68(%rbp),%r14
  add    %r14,%rbx
  mov    (%r12,%rbx,4),%eax
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  jne    L78
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L121:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L93
L133:
  xor    %r14d,%r14d
  jmp    L92
L100:
  movslq -0x58(%rbp),%rbx
  jmp    L59
L78:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int solve2(int n, int c, int weight[n], int profit[n]) {
  int i, j;
  int total[2][c + 1];
  int curr = 0;
  memset(total, 0, sizeof total);
  for (j = 0; j <= c; j++) {
    if (weight[0] > j) {
      total[curr][j] = 0;
    } else {
      total[curr][j] = profit[0];
    }
  }
  pvector(total[curr], c + 1);
  curr = !curr;
  for (i = 1; i < n; i++) {
    for (j = 0; j <= c; j++) {
      if ((j < weight[i]) || (total[!curr][j] >= total[!curr][j - weight[i]] + profit[i])) {
        total[curr][j] = total[!curr][j];
      } else {
        total[curr][j] = total[!curr][j - weight[i]] + profit[i];
      }
    }
    pvector(total[curr], c + 1);
    curr = !curr;
  }
  return total[!curr][c];
}
```