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

```asm
<wrap>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  lea    0x8(,%rsi,8),%rbx
  sub    $0x68,%rsp
  mov    %edx,0x10(%rsp)
  mov    %rdi,0x30(%rsp)
  mov    %rbx,%rdi
  sub    $0x8,%rbx
  mov    %rcx,0x48(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  call   <malloc@plt>
  mov    %rbx,%rdi
  mov    %rbx,0x40(%rsp)
  mov    %rax,0x38(%rsp)
  call   <malloc@plt>
  lea    -0x1(%rbp),%edx
  mov    %rax,0x18(%rsp)
  mov    %edx,0x14(%rsp)
  test   %rbp,%rbp
  jle    L18
  lea    0x0(,%rbp,4),%r12
  mov    %rax,%r13
  add    %rax,%rbx
  nopl   0x0(%rax)
L43:
  mov    %r12,%rdi
  add    $0x8,%r13
  call   <malloc@plt>
  mov    %rax,-0x8(%r13)
  cmp    %r13,%rbx
  jne    L43
  mov    0x14(%rsp),%eax
  test   %eax,%eax
  js     L55
L75:
  movslq 0x14(%rsp),%rax
  mov    %rbp,0x8(%rsp)
  lea    0x0(,%rax,8),%rdi
  lea    0x1(%rax),%r12
  mov    %rdi,0x20(%rsp)
  nopl   0x0(%rax)
L142:
  mov    0x20(%rsp),%rdi
  mov    0x18(%rsp),%r15
  shl    $0x3,%rax
  xor    %ebx,%ebx
  lea    0x0(,%r12,4),%rdx
  mov    0x30(%rsp),%rbp
  add    %rdi,%r15
  mov    %rdx,0x28(%rsp)
  lea    -0x4(%rdx),%r14
  lea    -0x8(%r15),%r13
  add    %rdi,%rbp
  sub    %rax,%r13
  mov    %r15,%rax
  mov    %rbp,%r15
  mov    %rax,%rbp
  nopl   0x0(%rax)
L160:
  mov    (%r15),%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  lea    0x1(%rax),%ebx
  cmp    0x10(%rsp),%eax
  jg     L196
  mov    0x0(%rbp),%rsi
  xor    %ecx,%ecx
  add    %r14,%rsi
  cmp    %r12,0x8(%rsp)
  cmove  %ecx,%eax
  sub    $0x8,%rbp
  sub    $0x8,%r15
  mov    %eax,(%rsi)
  cmp    %rbp,%r13
  jne    L160
L7:
  subl   $0x1,0x14(%rsp)
  movslq 0x14(%rsp),%rax
  sub    $0x1,%r12
  subq   $0x8,0x20(%rsp)
  cmp    $0xffffffff,%eax
  jne    L142
  mov    0x8(%rsp),%rbp
L118:
  test   %rbp,%rbp
  js     L38
L55:
  mov    0x38(%rsp),%r12
  xor    %ebx,%ebx
  nopl   (%rax)
L173:
  mov    $0x8,%edi
  call   <malloc@plt>
  mov    %rax,(%r12,%rbx,8)
  add    $0x1,%rbx
  movl   $0xffffffff,(%rax)
  cmp    %rbx,%rbp
  jge    L173
L38:
  mov    0x38(%rsp),%rax
  xor    %r12d,%r12d
  lea    0x54(%rsp),%rbx
  mov    (%rax),%rax
  movl   $0x0,(%rax)
  movslq %ebp,%rax
  mov    %rax,%rdi
  cmp    $0x1,%ebp
  jle    L29
  mov    %r12d,0x8(%rsp)
  mov    %rbx,%r15
  mov    %rbp,%r12
  mov    0x38(%rsp),%r14
  mov    0x10(%rsp),%ebp
  mov    0x48(%rsp),%r13
  mov    0x30(%rsp),%rbx
  jmp    L98
  nopw   0x0(%rax,%rax,1)
L0:
  sub    $0x8,%rsp
  mov    %ebp,%ecx
  mov    %r12,%rdx
  mov    %r14,%r9
  push   0x20(%rsp)
  mov    %r15,%r8
  mov    %rbx,%rsi
  xor    %eax,%eax
  call   <f@plt>
  pop    %rdx
  pop    %rcx
L74:
  mov    0x54(%rsp),%eax
  lea    -0x1(%rax),%edi
  movslq %edi,%rax
  movb   $0x1,0x0(%r13,%rax,1)
  cmp    $0x1,%edi
  jle    L128
L98:
  cmp    %r12,%rax
  jne    L0
  sub    $0x8,%rsp
  mov    %rbx,%rsi
  mov    %r14,%r9
  mov    %r15,%r8
  push   0x20(%rsp)
  mov    %ebp,%ecx
  mov    %r12,%rdx
  xor    %eax,%eax
  call   <f@plt>
  mov    %eax,0x18(%rsp)
  pop    %rsi
  pop    %rdi
  jmp    L74
  xchg   %ax,%ax
L196:
  mov    0x0(%rbp),%rax
  mov    0x28(%rsp),%rdx
  movl   $0xffffffff,-0x4(%rax,%rdx,1)
  jmp    L7
  cs nopw 0x0(%rax,%rax,1)
L128:
  mov    %r12,%rbp
  mov    0x8(%rsp),%r12d
L29:
  test   %rbp,%rbp
  jle    L20
  mov    0x18(%rsp),%rax
  mov    0x40(%rsp),%r13
  mov    %rax,%rbx
  add    %rax,%r13
  nopl   0x0(%rax)
L110:
  mov    (%rbx),%rdi
  add    $0x8,%rbx
  call   <free@plt>
  cmp    %r13,%rbx
  jne    L110
  mov    0x18(%rsp),%rdi
  xor    %ebx,%ebx
  call   <free@plt>
  mov    0x38(%rsp),%r13
  nopw   0x0(%rax,%rax,1)
L42:
  mov    0x0(%r13,%rbx,8),%rdi
  add    $0x1,%rbx
  call   <free@plt>
  cmp    %rbp,%rbx
  jle    L42
L21:
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  add    $0x68,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  mov    0x14(%rsp),%r8d
  test   %r8d,%r8d
  jns    L75
  jmp    L118
L20:
  mov    0x18(%rsp),%rdi
  call   <free@plt>
  test   %rbp,%rbp
  jne    L21
  mov    0x38(%rsp),%rax
  mov    (%rax),%rdi
  call   <free@plt>
  jmp    L21
L68:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int wrap(char **words, long words_no, int w, char *allages) {
  int i, j, wij, x, k, cmin, temp_min_i, min;
  int cost = 0, min_i;
  int **costs = malloc((words_no + 1) * sizeof(int *));
  int **line_costs = malloc(words_no * sizeof(int *));
  for (i = 0; i < words_no; i++)
    line_costs[i] = malloc(words_no * sizeof(int));
  for (i = words_no - 1; i >= 0; i--) {
    wij = 0;
    for (j = i; j >= 0; j--) {
      wij = wij + strlen(words[j]) + 1;
      if (wij - 1 > w) {
        line_costs[j][i] = -1;
        break;
      } else if (i + 1 == words_no)
        line_costs[j][i] = 0;
      else
        line_costs[j][i] = wij - 1;
    }
  }
  for (i = 0; i < words_no + 1; i++) {
    costs[i] = malloc(2 * sizeof(int));
    costs[i][0] = -1;
  }
  costs[0][0] = 0;
  i = words_no;
  while (i > 1) {
    if (i == words_no)
      cost = f(i, words, words_no, w, &min_i, costs, line_costs);
    else {
      f(i, words, words_no, w, &min_i, costs, line_costs);
    }
    i = min_i - 1;
    allages[i] = 1;
  }
  for (i = 0; i < words_no; i++)
    free(line_costs[i]);
  free(line_costs);
  for (i = 0; i <= words_no; i++)
    free(costs[i]);
  free(costs);
  return cost;
}
```