user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    D0(%rip),%r12
  push   %rbp
  mov    %r12,%rdi
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x20(%rsp),%rsi
  call   <scanf@plt>
  mov    0x20(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    0x20(%rsp),%eax
  mov    %r15,%rbp
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  mov    0x20(%rsp),%eax
  test   %eax,%eax
  jle    L126
  nopl   0x0(%rax,%rax,1)
L4:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  mov    0x20(%rsp),%eax
  cmp    %ebx,%eax
  jg     L4
  test   %eax,%eax
  jle    L126
  mov    0x10(%rsp),%rbp
  xor    %ebx,%ebx
  nopl   (%rax)
L63:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  cmp    %ebx,0x20(%rsp)
  jg     L63
L126:
  mov    %r12,%rdi
  lea    0x24(%rsp),%rsi
  call   <scanf@plt>
  mov    0x24(%rsp),%eax
  mov    0x20(%rsp),%esi
  lea    0x1(%rax),%edi
  call   <build_matrix@plt>
  mov    0x20(%rsp),%esi
  mov    %rax,0x18(%rsp)
  mov    0x24(%rsp),%eax
  lea    0x1(%rax),%edi
  call   <build_matrix@plt>
  mov    0x20(%rsp),%esi
  mov    %rax,%r12
  test   %esi,%esi
  jle    L51
  mov    (%rax),%rdx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L10:
  movl   $0x0,(%rdx,%rax,4)
  mov    0x20(%rsp),%esi
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L10
L51:
  mov    0x18(%rsp),%rdi
  mov    0x24(%rsp),%eax
  mov    $0x2,%r13d
  add    $0x8,%rdi
  mov    %rdi,0x8(%rsp)
  test   %eax,%eax
  jle    L46
  lea    -0x1(%r13),%ecx
  mov    %ecx,0x4(%rsp)
  test   %esi,%esi
  jle    L46
  nopl   0x0(%rax,%rax,1)
L98:
  mov    -0x8(%r12,%r13,8),%rbx
  xor    %r14d,%r14d
  xor    %ebp,%ebp
  xor    %edi,%edi
  jmp    L26
  xchg   %ax,%ax
L56:
  mov    0x8(%rsp),%rcx
  cltq
  mov    (%r15,%r14,1),%esi
  add    $0x1,%ebp
  mov    (%r12,%rax,8),%rax
  mov    (%rcx),%rdx
  add    -0x4(%rax,%r14,1),%esi
  add    %r14,%rdx
  call   <max@plt>
  mov    %eax,(%rbx)
  mov    0x20(%rsp),%esi
  cmp    %esi,%ebp
  jge    L112
L123:
  mov    -0x8(%r12,%r13,8),%rbx
  mov    (%rbx,%r14,1),%edi
  add    $0x4,%r14
L26:
  mov    0x10(%rsp),%rcx
  mov    0x4(%rsp),%eax
  add    %r14,%rbx
  sub    (%rcx,%r14,1),%eax
  jns    L56
  mov    0x8(%rsp),%rax
  xor    %esi,%esi
  add    $0x1,%ebp
  mov    (%rax),%rdx
  add    %r14,%rdx
  call   <max@plt>
  mov    %eax,(%rbx)
  mov    0x20(%rsp),%esi
  cmp    %ebp,%esi
  jg     L123
L112:
  mov    0x24(%rsp),%eax
  cmp    %r13d,%eax
  jl     L46
  add    $0x1,%r13
  addq   $0x8,0x8(%rsp)
  lea    -0x1(%r13),%ecx
  mov    %ecx,0x4(%rsp)
  test   %esi,%esi
  jg     L98
L46:
  mov    %r12,%rdx
  lea    0x1(%rax),%edi
  lea    D28(%rip),%rbp
  call   <print_matrix@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%rbx
  mov    0x24(%rsp),%eax
  mov    0x20(%rsp),%esi
  mov    %rbx,%rdx
  lea    0x1(%rax),%edi
  call   <print_matrix@plt>
  lea    D14(%rip),%rdi
  call   <printf@plt>
  mov    0x20(%rsp),%edi
  mov    0x24(%rsp),%esi
  mov    %rbx,%r8
  mov    0x10(%rsp),%rdx
  mov    %r12,%rcx
  call   <print_picked@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L108
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L108:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D0
data_type: string
name: read_data
arguments: data_label: D28
data_type: string
name: read_data
arguments: data_label: D14
data_type: string

tool: D0: %d

tool: 

tool: D14: 
Picked: 

assistant: ```c
int main() {
  int i, j, x, y;
  int n, b;
  int *vs;
  int *ws;
  int **ps;
  int **zs;
  scanf("%d", &n);
  vs = (int *)malloc(sizeof(int) * n);
  ws = (int *)malloc(sizeof(int) * n);
  for (i = 0; i < n; i++)
    scanf("%d", &vs[i]);
  for (i = 0; i < n; i++)
    scanf("%d", &ws[i]);
  scanf("%d", &b);
  ps = build_matrix(b + 1, n);
  zs = build_matrix(b + 1, n);
  for (i = 0; i < n; i++)
    zs[0][i] = 0;
  for (i = 1; i <= b; i++)
    for (j = 0; j < n; j++) {
      x = (j - 1 < 0) ? 0 : zs[i][j - 1];
      y = (i - ws[j] < 0) ? 0 : vs[j] + zs[i - ws[j]][j - 1];
      zs[i][j] = max(x, y, &ps[i][j]);
    }
  print_matrix(b + 1, n, zs);
  puts("");
  print_matrix(b + 1, n, ps);
  printf("\nPicked: ");
  print_picked(n, b, ws, zs, ps);
  puts("");
}
```