user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<residue_idx>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  xor    %edx,%edx
  push   %r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,0x10(%rsp)
  mov    %rdi,%rsi
  mov    $0x1,%edi
  mov    %rcx,(%rsp)
  mov    $0xc,%ecx
  mov    %r9,0x8(%rsp)
  call   <cmatrix@plt>
  mov    %r12,%rsi
  mov    $0x1,%edi
  mov    %rax,%r14
  call   <lvector@plt>
  mov    %rax,%rbp
  test   %r12,%r12
  jle    L21
  mov    %rax,0x18(%rsp)
  mov    %r13,%rbp
  mov    0x10(%rsp),%r13
  mov    $0x1,%ebx
  nopl   0x0(%rax,%rax,1)
L60:
  mov    $0x20,%r9d
  test   %r15,%r15
  je     L47
  mov    (%r15,%rbx,8),%rax
  movsbl 0x2(%rax),%r9d
L47:
  mov    (%rsp),%rax
  mov    (%r14,%rbx,8),%rdi
  lea    D5(%rip),%rsi
  mov    0x0(%rbp,%rbx,8),%rdx
  mov    0x0(%r13,%rbx,8),%r8
  movsbl (%rax,%rbx,1),%ecx
  add    $0x1,%rbx
  call   <sprintf@plt>
  cmp    %rbx,%r12
  jge    L60
  mov    0x18(%rsp),%rbp
  lea    0x0(%rbp,%r12,8),%r13
  cmp    $0x1,%r12
  je     L50
  mov    $0x1,%ebx
  nopl   0x0(%rax)
L44:
  mov    (%r14,%rbx,8),%rsi
  mov    0x8(%r14,%rbx,8),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  mov    %rax,0x0(%rbp,%rbx,8)
  add    $0x1,%rbx
  cmp    %rbx,%r12
  jne    L44
L50:
  movq   $0x1,0x0(%r13)
  xor    %esi,%esi
  mov    $0x1,%eax
  nopl   0x0(%rax)
L77:
  cmpq   $0x1,0x0(%rbp,%rax,8)
  sbb    $0xffffffffffffffff,%rsi
  add    $0x1,%rax
  cmp    %rax,%r12
  jge    L77
  mov    $0x2,%ecx
  mov    $0x1,%edx
  mov    $0x1,%edi
  call   <lmatrix@plt>
  xor    %esi,%esi
  mov    %rax,%r13
  mov    $0x1,%eax
  nopl   0x0(%rax)
L29:
  cmpq   $0x0,0x0(%rbp,%rax,8)
  je     L90
  add    $0x1,%rsi
  mov    0x0(%r13,%rsi,8),%rdx
  mov    %rax,0x10(%rdx)
L90:
  add    $0x1,%rax
  cmp    %rax,%r12
  jge    L29
  cmp    $0x1,%rsi
  jle    L5
  lea    0x8(%r13),%rax
  lea    0x0(%r13,%rsi,8),%rdi
  nopl   (%rax)
L70:
  mov    (%rax),%rdx
  mov    0x8(%rax),%rcx
  add    $0x8,%rax
  mov    0x10(%rdx),%rdx
  add    $0x1,%rdx
  mov    %rdx,0x8(%rcx)
  cmp    %rax,%rdi
  jne    L70
L5:
  mov    0x8(%r13),%rax
  mov    %r12,%rdx
  mov    %r14,%rdi
  mov    $0xc,%r8d
  xor    %ecx,%ecx
  movq   $0x1,0x8(%rax)
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    $0x1,%esi
  call   <free_cmatrix@plt>
  mov    %r12,%rdx
  mov    %rbp,%rdi
  mov    $0x1,%esi
  call   <free_lvector@plt>
  add    $0x28,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L21:
  movq   $0x1,(%rax,%r12,8)
  xor    %esi,%esi
  mov    $0x2,%ecx
  mov    $0x1,%edx
  mov    $0x1,%edi
  call   <lmatrix@plt>
  xor    %esi,%esi
  mov    %rax,%r13
  jmp    L5
```

tool_calls: name: retrieve_data
arguments: data_label: D5
type_guessed: string

tool: D5: %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;
}
```