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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    D15(%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,0x10(%rsp)
  mov    %rax,%rbp
  mov    0x20(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    0x20(%rsp),%eax
  test   %eax,%eax
  jle    L69
  nopl   0x0(%rax,%rax,1)
L125:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  mov    0x20(%rsp),%eax
  cmp    %ebx,%eax
  jg     L125
  test   %eax,%eax
  jle    L69
  mov    %r15,%rbp
  xor    %ebx,%ebx
  nopl   0x0(%rax,%rax,1)
L92:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  add    $0x1,%ebx
  add    $0x4,%rbp
  call   <scanf@plt>
  cmp    %ebx,0x20(%rsp)
  jg     L92
L69:
  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    L41
  mov    (%rax),%rdx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L127:
  movl   $0x0,(%rdx,%rax,4)
  mov    0x20(%rsp),%esi
  add    $0x1,%rax
  cmp    %eax,%esi
  jg     L127
L41:
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  jle    L13
  mov    0x18(%rsp),%rdi
  movq   $0x1,(%rsp)
  add    $0x8,%rdi
  mov    %rdi,0x8(%rsp)
  nopl   (%rax)
L51:
  mov    (%rsp),%rdi
  mov    %edi,%ebp
  test   %esi,%esi
  jle    L58
  mov    (%r12,%rdi,8),%rbx
  xor    %r13d,%r13d
  xor    %r14d,%r14d
  xor    %edi,%edi
  jmp    L128
  nopl   0x0(%rax,%rax,1)
L32:
  mov    (%rsp),%rax
  mov    (%r12,%rax,8),%rbx
  mov    (%rbx,%r13,1),%edi
  add    $0x4,%r13
L128:
  mov    %ebp,%eax
  mov    (%r15,%r13,1),%ecx
  xor    %esi,%esi
  cltd
  idiv   %ecx
  cmp    %ecx,%ebp
  jl     L1
  movslq %edx,%rdx
  mov    0x10(%rsp),%rsi
  mov    (%r12,%rdx,8),%rdx
  mov    (%rsi,%r13,1),%esi
  add    -0x4(%rdx,%r13,1),%esi
L1:
  mov    0x8(%rsp),%rdx
  add    %r13,%rbx
  add    $0x1,%r14d
  mov    (%rdx),%rcx
  mov    %eax,%edx
  add    %r13,%rcx
  call   <max@plt>
  mov    %eax,(%rbx)
  mov    0x20(%rsp),%esi
  cmp    %r14d,%esi
  jg     L32
  mov    0x24(%rsp),%eax
L58:
  addq   $0x1,(%rsp)
  mov    (%rsp),%rdi
  addq   $0x8,0x8(%rsp)
  cmp    %edi,%eax
  jge    L51
L13:
  mov    %r12,%rdx
  lea    0x1(%rax),%edi
  lea    D9(%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    D18(%rip),%rdi
  call   <printf@plt>
  mov    0x20(%rsp),%edi
  mov    0x24(%rsp),%esi
  mov    %rbx,%r8
  mov    %r12,%rcx
  mov    %r15,%rdx
  call   <print_picked@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L55
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L55:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D15
data_type: string
name: unpack_data
arguments: label: D9
data_type: string
name: unpack_data
arguments: label: D18
data_type: string

tool: D15: %d

tool: 

tool: D18: 
Picked: 

assistant: ```c
int main() {
  int i, j, x, y;
  int n, b;
  int c;
  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];
      c = i / ws[j];
      y = (i - ws[j] < 0) ? 0 : vs[j] + zs[i - c * ws[j]][j - 1];
      zs[i][j] = max(x, y, c, &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("");
}
```