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

```asm
<residue_idx>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8,-0x58(%rbp)
  mov    %r9,-0x60(%rbp)
  mov    -0x38(%rbp),%rax
  mov    $0xc,%ecx
  mov    $0x0,%edx
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <cmatrix@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <lvector@plt>
  mov    %rax,-0x10(%rbp)
  movq   $0x1,-0x28(%rbp)
  jmp    L68
L45:
  cmpq   $0x0,-0x48(%rbp)
  je     L118
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  movzbl 0x2(%rax),%eax
  jmp    L11
L118:
  mov    $0x20,%eax
L11:
  mov    %al,-0x29(%rbp)
  movsbl -0x29(%rbp),%edi
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rsi
  mov    -0x28(%rbp),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%r8
  mov    -0x18(%rbp),%rax
  add    %r8,%rax
  mov    (%rax),%rax
  mov    %edi,%r9d
  mov    %rsi,%r8
  lea    D0(%rip),%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  addq   $0x1,-0x28(%rbp)
L68:
  mov    -0x28(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jle    L45
  movq   $0x1,-0x28(%rbp)
  jmp    L64
L123:
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  setne  %cl
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  movzbl %cl,%eax
  mov    %rax,(%rdx)
  addq   $0x1,-0x28(%rbp)
L64:
  mov    -0x28(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jl     L123
  mov    -0x38(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movq   $0x1,(%rax)
  movq   $0x0,-0x20(%rbp)
  movq   $0x1,-0x28(%rbp)
  jmp    L99
L27:
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L28
  addq   $0x1,-0x20(%rbp)
L28:
  addq   $0x1,-0x28(%rbp)
L99:
  mov    -0x28(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jle    L27
  mov    -0x20(%rbp),%rax
  mov    $0x2,%ecx
  mov    $0x1,%edx
  mov    %rax,%rsi
  mov    $0x1,%edi
  call   <lmatrix@plt>
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x1,-0x28(%rbp)
  jmp    L131
L80:
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L19
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    0x10(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rax,(%rdx)
L19:
  addq   $0x1,-0x28(%rbp)
L131:
  mov    -0x28(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jle    L80
  movq   $0x2,-0x28(%rbp)
  jmp    L35
L82:
  mov    -0x28(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  add    $0x10,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  add    $0x8,%rax
  add    $0x1,%rdx
  mov    %rdx,(%rax)
  addq   $0x1,-0x28(%rbp)
L35:
  mov    -0x28(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jle    L82
  mov    -0x8(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  add    $0x8,%rax
  movq   $0x1,(%rax)
  mov    -0x60(%rbp),%rax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    $0xc,%r8d
  mov    $0x0,%ecx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <free_cmatrix@plt>
  mov    -0x38(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <free_lvector@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D0
type_infered: string

tool: D0: %3s%c%4ld%c

assistant: ```c
long **residue_idx(long num, long *ResSeq, char **Miscs, char *ChainID, char **ResName, long *num_residue) {
  char iCode;
  char **bidx;
  long i, n, **seidx, *temp;
  bidx = cmatrix(1, num, 0, 12);
  temp = lvector(1, num);
  for (i = 1; i <= num; i++) {
    iCode = (Miscs == NULL) ? ' ' : Miscs[i][2];
    sprintf(bidx[i], "%3s%c%4ld%c", ResName[i], ChainID[i], ResSeq[i], iCode);
  }
  for (i = 1; i < num; i++)
    temp[i] = strcmp(bidx[i + 1], bidx[i]) ? 1 : 0;
  temp[num] = 1;
  n = 0;
  for (i = 1; i <= num; i++)
    if (temp[i])
      ++n;
  seidx = lmatrix(1, n, 1, 2);
  n = 0;
  for (i = 1; i <= num; i++)
    if (temp[i])
      seidx[++n][2] = i;
  for (i = 2; i <= n; i++)
    seidx[i][1] = seidx[i - 1][2] + 1;
  seidx[1][1] = 1;
  *num_residue = n;
  free_cmatrix(bidx, 1, num, 0, 12);
  free_lvector(temp, 1, num);
  return seidx;
}
```