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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x30(%rsp),%rsi
  lea    D30(%rip),%rdi
  call   <scanf@plt>
  mov    0x30(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    %rax,0x20(%rsp)
  mov    0x30(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  cmpl   $0x0,0x30(%rsp)
  jle    L134
  mov    $0x0,%ebx
  lea    D30(%rip),%r12
L26:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  add    $0x1,%ebx
  mov    0x30(%rsp),%eax
  add    $0x4,%rbp
  cmp    %ebx,%eax
  jg     L26
  test   %eax,%eax
  jle    L134
  mov    0x10(%rsp),%rbp
  mov    $0x0,%ebx
  lea    D30(%rip),%r12
L44:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  add    $0x1,%ebx
  add    $0x4,%rbp
  cmp    %ebx,0x30(%rsp)
  jg     L44
L134:
  lea    0x34(%rsp),%rsi
  lea    D30(%rip),%rdi
  call   <scanf@plt>
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%edi
  mov    0x30(%rsp),%esi
  call   <build_matrix@plt>
  mov    %rax,0x28(%rsp)
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%edi
  mov    0x30(%rsp),%esi
  call   <build_matrix@plt>
  mov    %rax,%rcx
  mov    %rax,0x18(%rsp)
  cmpl   $0x0,0x30(%rsp)
  jle    L147
  mov    $0x0,%eax
L96:
  mov    (%rcx),%rdx
  movl   $0x0,(%rdx,%rax,4)
  add    $0x1,%rax
  cmp    %eax,0x30(%rsp)
  jg     L96
L147:
  mov    0x34(%rsp),%eax
  test   %eax,%eax
  jle    L94
  mov    0x28(%rsp),%rax
  add    $0x8,%rax
  mov    %rax,0x8(%rsp)
  mov    0x18(%rsp),%rax
  lea    0x8(%rax),%r13
  mov    $0x1,%ebp
  mov    $0x0,%r15d
  mov    %r13,%r14
  jmp    L49
L121:
  mov    %r14,(%rsp)
  mov    %rbx,%r13
  add    (%r14),%r13
  mov    0x8(%rsp),%rax
  mov    %rbx,%rcx
  add    (%rax),%rcx
  mov    %r8d,%edx
  call   <max@plt>
  mov    %eax,0x0(%r13)
  add    $0x1,%r12d
  cmp    %r12d,0x30(%rsp)
  jle    L70
  mov    %r15d,%edi
  test   %r12d,%r12d
  jle    L88
  mov    (%rsp),%rax
  mov    (%rax),%rax
  mov    (%rax,%rbx,1),%edi
L88:
  add    $0x4,%rbx
L35:
  mov    0x10(%rsp),%rax
  mov    (%rax,%rbx,1),%ecx
  mov    %ebp,%eax
  cltd
  idiv   %ecx
  mov    %eax,%r8d
  mov    %r15d,%esi
  cmp    %ecx,%ebp
  jl     L121
  mov    %ebp,%eax
  cltd
  idiv   %ecx
  movslq %edx,%rdx
  mov    0x18(%rsp),%rax
  mov    (%rax,%rdx,8),%rax
  mov    0x20(%rsp),%rdx
  mov    (%rdx,%rbx,1),%esi
  add    -0x4(%rax,%rbx,1),%esi
  jmp    L121
L70:
  add    $0x1,%ebp
  mov    0x34(%rsp),%eax
  addq   $0x8,0x8(%rsp)
  add    $0x8,%r14
  cmp    %ebp,%eax
  jl     L94
L49:
  mov    $0x0,%ebx
  mov    $0x0,%r12d
  mov    %r15d,%edi
  cmpl   $0x0,0x30(%rsp)
  jg     L35
  jmp    L70
L94:
  lea    0x1(%rax),%edi
  mov    0x18(%rsp),%r14
  mov    %r14,%rdx
  mov    0x30(%rsp),%esi
  call   <print_matrix@plt>
  lea    D57(%rip),%rbx
  mov    %rbx,%rdi
  call   <puts@plt>
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%edi
  mov    0x28(%rsp),%r15
  mov    %r15,%rdx
  mov    0x30(%rsp),%esi
  call   <print_matrix@plt>
  lea    D59(%rip),%rdi
  call   <printf@plt>
  mov    %r15,%r8
  mov    %r14,%rcx
  mov    0x10(%rsp),%rdx
  mov    0x34(%rsp),%esi
  mov    0x30(%rsp),%edi
  call   <print_picked@plt>
  mov    %rbx,%rdi
  call   <puts@plt>
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  mov    $0x0,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D30
type: string
name: parse_data
arguments: tag: D57
type: string
name: parse_data
arguments: tag: D59
type: string

tool: D30: %d

tool: 

tool: D59: 
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("");
}
```