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

```asm
<mesh_3d_aft_opts>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  mov    %r8,-0x38(%rbp)
  mov    %r9,-0x40(%rbp)
  movsd  %xmm0,-0x48(%rbp)
  cmpl   $0x0,0x38(%rbp)
  je     L22
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    -0x30(%rbp),%rcx
  mov    -0x20(%rbp),%rsi
  mov    %eax,%edi
  call   <chk3dvert@plt>
L22:
  cmpl   $0x0,0x40(%rbp)
  je     L142
  movl   $0x0,-0x8(%rbp)
  jmp    L76
L119:
  mov    -0x8(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x8(%rbp)
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x30(%rbp),%rax
  add    %rax,%rcx
  mov    %edx,%eax
  sub    0x40(%rbp),%eax
  mov    %eax,(%rcx)
L76:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L119
  movl   $0x0,-0x8(%rbp)
  jmp    L35
L69:
  mov    -0x8(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x8(%rbp)
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    0x10(%rbp),%rax
  add    %rax,%rcx
  mov    %edx,%eax
  sub    0x40(%rbp),%eax
  mov    %eax,(%rcx)
L35:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L69
L142:
  movsd  -0x48(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L87
  mov    -0x48(%rbp),%rdi
  mov    -0x40(%rbp),%r9
  mov    -0x38(%rbp),%r10
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  sub    $0x8,%rsp
  mov    0x30(%rbp),%r8d
  push   %r8
  mov    0x28(%rbp),%r8d
  push   %r8
  mov    0x20(%rbp),%r8d
  push   %r8
  push   0x18(%rbp)
  push   0x10(%rbp)
  movq   %rdi,%xmm0
  mov    %r10,%r8
  mov    %rax,%rdi
  call   <mesh3daftss@plt>
  add    $0x30,%rsp
  mov    %eax,-0x4(%rbp)
  jmp    L14
L87:
  cmpq   $0x0,0x48(%rbp)
  je     L98
  mov    -0x40(%rbp),%r9
  mov    -0x38(%rbp),%r8
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  push   0x48(%rbp)
  mov    0x30(%rbp),%edi
  push   %rdi
  mov    0x28(%rbp),%edi
  push   %rdi
  mov    0x20(%rbp),%edi
  push   %rdi
  push   0x18(%rbp)
  push   0x10(%rbp)
  mov    %rax,%rdi
  call   <mesh3daftuser@plt>
  add    $0x30,%rsp
  mov    %eax,-0x4(%rbp)
  jmp    L14
L98:
  mov    -0x40(%rbp),%r9
  mov    -0x38(%rbp),%r8
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  sub    $0x8,%rsp
  mov    0x30(%rbp),%edi
  push   %rdi
  mov    0x28(%rbp),%edi
  push   %rdi
  mov    0x20(%rbp),%edi
  push   %rdi
  push   0x18(%rbp)
  push   0x10(%rbp)
  mov    %rax,%rdi
  call   <mesh3daft@plt>
  add    $0x30,%rsp
  mov    %eax,-0x4(%rbp)
L14:
  cmpl   $0x0,0x40(%rbp)
  je     L99
  movl   $0x0,-0x8(%rbp)
  jmp    L110
L100:
  mov    -0x8(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x8(%rbp)
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%ecx
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    0x40(%rbp),%edx
  add    %ecx,%edx
  mov    %edx,(%rax)
L110:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L100
  movl   $0x0,-0x8(%rbp)
  jmp    L74
L17:
  mov    -0x8(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x8(%rbp)
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%ecx
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    0x10(%rbp),%rax
  add    %rdx,%rax
  mov    0x40(%rbp),%edx
  add    %ecx,%edx
  mov    %edx,(%rax)
L74:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L17
L99:
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int mesh_3d_aft_opts(int *pnV, double *vertex, int *pnF, int *face, int *facecolor, int *pnT, int *tetra, int *tetracolor, int nnV, int nnF, int nnT, double cf, int needcheck, int indexshift, double (*f)(double, double, double)) {
  int i, ret;
  if (needcheck)
    chk3dvert(*pnV, vertex, *pnF, face);
  if (indexshift) {
    for (i = 0; i < 3 * *pnF; face[i++] -= indexshift)
      ;
    for (i = 0; i < 4 * *pnT; tetra[i++] -= indexshift)
      ;
  }
  if (cf > 0.0)
    ret = mesh3daftss(pnV, vertex, pnF, face, facecolor, pnT, tetra, tetracolor, nnV, nnF, nnT, cf);
  else if (f)
    ret = mesh3daftuser(pnV, vertex, pnF, face, facecolor, pnT, tetra, tetracolor, nnV, nnF, nnT, f);
  else
    ret = mesh3daft(pnV, vertex, pnF, face, facecolor, pnT, tetra, tetracolor, nnV, nnF, nnT);
  if (indexshift) {
    for (i = 0; i < 3 * *pnF; face[i++] += indexshift)
      ;
    for (i = 0; i < 4 * *pnT; tetra[i++] += indexshift)
      ;
  }
  return ret;
}
```