user: 请将以下的汇编代码转换成C语言代码：

```asm
<mesh_3d_ugly_opts>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%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)
  cmpl   $0x0,0x38(%rbp)
  je     L34
  movl   $0x0,-0x8(%rbp)
  jmp    L98
L17:
  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    0x38(%rbp),%eax
  mov    %eax,(%rcx)
L98:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L17
  movl   $0x0,-0x8(%rbp)
  jmp    L74
L6:
  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    0x38(%rbp),%eax
  mov    %eax,(%rcx)
L74:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L6
L34:
  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   <mesh3dcdt@plt>
  add    $0x30,%rsp
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,0x38(%rbp)
  je     L75
  movl   $0x0,-0x8(%rbp)
  jmp    L77
L47:
  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    0x38(%rbp),%edx
  add    %ecx,%edx
  mov    %edx,(%rax)
L77:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L47
  movl   $0x0,-0x8(%rbp)
  jmp    L15
L89:
  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    0x38(%rbp),%edx
  add    %ecx,%edx
  mov    %edx,(%rax)
L15:
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  shl    $0x2,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L89
L75:
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int mesh_3d_ugly_opts(int *pnV, double *vertex, int *pnF, int *face, int *facecolor, int *pnT, int *tetra, int *tetracolor, int nnV, int nnF, int nnT, int indexshift) {
  int i, ret;
  if (indexshift) {
    for (i = 0; i < 3 * *pnF; face[i++] -= indexshift)
      ;
    for (i = 0; i < 4 * *pnT; tetra[i++] -= indexshift)
      ;
  }
  ret = mesh3dcdt(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;
}
```