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

```asm
<NURBSsurfaceEval>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    0x120(%rsp),%edx
  mov    %esi,0x20(%rsp)
  mov    %ecx,0x24(%rsp)
  mov    %r8d,0x98(%rsp)
  mov    %r9,0x18(%rsp)
  test   %edx,%edx
  jle    L194
  mov    %edi,%r14d
  lea    0x0(,%rcx,4),%r11d
  mov    0x118(%rsp),%r12
  mov    0x128(%rsp),%rbx
  movslq %r14d,%rax
  lea    (%r9,%rax,8),%r10
  movslq %ecx,%rax
  lea    (%r9,%rax,8),%rax
  mov    %rax,0x10(%rsp)
  movslq %esi,%rax
  mov    0x110(%rsp),%rsi
  mov    %rax,%rdi
  lea    (%rsi,%rax,8),%r15
  movslq %r8d,%rax
  lea    (%rsi,%rax,8),%rax
  mov    %rax,0x8(%rsp)
  lea    -0x1(%r8),%eax
  imul   %r11d,%eax
  mov    %eax,%esi
  mov    %eax,0x9c(%rsp)
  lea    (%rax,%r11,1),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x20(%r13,%rax,1),%rcx
  mov    %rcx,0x78(%rsp)
  lea    -0x8(%r13,%rax,1),%rcx
  mov    %rcx,0x80(%rsp)
  lea    -0x18(%r13,%rax,1),%rcx
  lea    -0x10(%r13,%rax,1),%rax
  mov    %rax,0x90(%rsp)
  movslq %r11d,%rax
  shl    $0x3,%rax
  mov    %rcx,0x88(%rsp)
  lea    -0x20(%r13,%rax,1),%rcx
  mov    %rax,0xc0(%rsp)
  mov    %rcx,0x50(%rsp)
  lea    -0x8(%r13,%rax,1),%rcx
  mov    %rcx,0x58(%rsp)
  lea    -0x18(%r13,%rax,1),%rcx
  lea    -0x10(%r13,%rax,1),%rax
  mov    %rax,0x68(%rsp)
  movslq %esi,%rax
  shl    $0x3,%rax
  mov    %rcx,0x60(%rsp)
  lea    0x0(%r13,%rax,1),%rsi
  mov    %rsi,0x28(%rsp)
  lea    0x18(%r13,%rax,1),%rsi
  mov    %rsi,0x30(%rsp)
  lea    0x8(%r13,%rax,1),%rsi
  lea    0x10(%r13,%rax,1),%rax
  mov    %rax,0x40(%rsp)
  lea    -0x1(%rdx),%eax
  shl    $0x4,%rax
  mov    %rsi,0x38(%rsp)
  lea    0x10(%r12,%rax,1),%rax
  mov    %rax,(%rsp)
  mov    %edi,%eax
  mov    0x158(%rsp),%rdi
  lea    0x8(%rdi,%rax,8),%rax
  mov    0x140(%rsp),%rdi
  mov    %rax,0x48(%rsp)
  mov    %r14d,%eax
  mov    %rax,0xc8(%rsp)
  lea    0x8(%rdi,%rax,8),%rbp
  shl    $0x2,%rax
  mov    %rax,0xa0(%rsp)
  lea    0x20(%r13),%rax
  mov    %rax,0x70(%rsp)
  mov    %r15,%rax
  mov    %r10,%r15
  mov    %rax,%r10
  jmp    L166
  cs nopw 0x0(%rax,%rax,1)
L246:
  movsd  0x8(%r12),%xmm0
  movsd  (%r10),%xmm1
  comisd %xmm0,%xmm1
  jb     L241
  movsd  0x0(%r13),%xmm0
  divsd  0x18(%r13),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  0x8(%r13),%xmm0
  divsd  0x18(%r13),%xmm0
  movsd  %xmm0,0x8(%rbx)
  movsd  0x10(%r13),%xmm1
  divsd  0x18(%r13),%xmm1
L66:
  movsd  %xmm1,0x10(%rbx)
  add    $0x10,%r12
  add    $0x18,%rbx
  cmp    (%rsp),%r12
  je     L194
L166:
  movsd  (%r12),%xmm0
  movsd  (%r15),%xmm1
  comisd %xmm0,%xmm1
  jae    L246
  mov    0x10(%rsp),%rax
  comisd (%rax),%xmm0
  jb     L60
  movsd  0x8(%r12),%xmm0
  movsd  (%r10),%xmm1
  comisd %xmm0,%xmm1
  jb     L32
  mov    0x50(%rsp),%rax
  mov    0x60(%rsp),%rsi
  movsd  (%rax),%xmm0
  mov    0x58(%rsp),%rax
  divsd  (%rax),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%rsi),%xmm0
  divsd  (%rax),%xmm0
  mov    0x68(%rsp),%rsi
  movsd  %xmm0,0x8(%rbx)
  movsd  (%rsi),%xmm1
  divsd  (%rax),%xmm1
  jmp    L66
  nopw   0x0(%rax,%rax,1)
L241:
  mov    0x8(%rsp),%rax
  comisd (%rax),%xmm0
  jb     L162
  mov    0x28(%rsp),%rax
  mov    0x38(%rsp),%rsi
  movsd  (%rax),%xmm0
  mov    0x30(%rsp),%rax
  divsd  (%rax),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%rsi),%xmm0
  divsd  (%rax),%xmm0
  mov    0x40(%rsp),%rsi
  movsd  %xmm0,0x8(%rbx)
  movsd  (%rsi),%xmm1
  divsd  (%rax),%xmm1
  jmp    L66
  nopl   0x0(%rax)
L60:
  movq   $0x0,(%rbx)
  movq   $0x0,0x8(%rbx)
  movq   $0x0,0x10(%rbx)
  movsd  0x8(%r12),%xmm0
  movsd  (%r10),%xmm1
  comisd %xmm0,%xmm1
  jae    L201
  mov    0x8(%rsp),%rax
  movsd  (%r12),%xmm1
  comisd (%rax),%xmm0
  jb     L135
  mov    0x18(%rsp),%rdx
  mov    0x24(%rsp),%edi
  movapd %xmm1,%xmm0
  mov    %r14d,%esi
  mov    %r11d,0xb0(%rsp)
  mov    %r10,0xa8(%rsp)
  call   <FindSpan@plt>
  mov    0x18(%rsp),%rdx
  mov    %r14d,%esi
  mov    0x138(%rsp),%r9
  mov    0x130(%rsp),%r8
  mov    0x140(%rsp),%rcx
  mov    %eax,%edi
  mov    %eax,0xb8(%rsp)
  movsd  (%r12),%xmm0
  call   <BasisFuns@plt>
  mov    0xb8(%rsp),%edi
  mov    0x9c(%rsp),%eax
  mov    0xa8(%rsp),%r10
  mov    0xb0(%rsp),%r11d
  sub    %r14d,%edi
  test   %r14d,%r14d
  lea    (%rax,%rdi,4),%edx
  js     L216
  movslq %edx,%rdx
  mov    0x70(%rsp),%rdi
  movsd  (%rbx),%xmm3
  pxor   %xmm4,%xmm4
  lea    0x0(%r13,%rdx,8),%rax
  movsd  0x8(%rbx),%xmm2
  movsd  0x10(%rbx),%xmm1
  add    0xa0(%rsp),%rdx
  lea    (%rdi,%rdx,8),%rcx
  mov    0x140(%rsp),%rdx
  nopl   0x0(%rax,%rax,1)
L230:
  movsd  (%rdx),%xmm0
  mulsd  (%rax),%xmm0
  add    $0x20,%rax
  add    $0x8,%rdx
  addsd  %xmm0,%xmm3
  movsd  %xmm3,(%rbx)
  movsd  -0x8(%rdx),%xmm0
  mulsd  -0x18(%rax),%xmm0
  addsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rbx)
  movsd  -0x8(%rdx),%xmm0
  mulsd  -0x10(%rax),%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbx)
  movsd  -0x8(%rdx),%xmm0
  mulsd  -0x8(%rax),%xmm0
  addsd  %xmm0,%xmm4
  cmp    %rax,%rcx
  jne    L230
L111:
  divsd  %xmm4,%xmm3
  divsd  %xmm4,%xmm2
  movsd  %xmm3,(%rbx)
  divsd  %xmm4,%xmm1
  movsd  %xmm2,0x8(%rbx)
  jmp    L66
  nopl   0x0(%rax,%rax,1)
L32:
  mov    0x8(%rsp),%rax
  comisd (%rax),%xmm0
  jb     L16
  mov    0x78(%rsp),%rax
  mov    0x88(%rsp),%rdi
  movsd  (%rax),%xmm0
  mov    0x80(%rsp),%rax
  divsd  (%rax),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%rdi),%xmm0
  divsd  (%rax),%xmm0
  mov    0x90(%rsp),%rdi
  movsd  %xmm0,0x8(%rbx)
  movsd  (%rdi),%xmm1
  divsd  (%rax),%xmm1
  jmp    L66
  nopw   0x0(%rax,%rax,1)
L194:
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L135:
  mov    0x18(%rsp),%rdx
  mov    0x24(%rsp),%edi
  movapd %xmm1,%xmm0
  mov    %r14d,%esi
  mov    %r11d,0xbc(%rsp)
  mov    %r10,0xb0(%rsp)
  call   <FindSpan@plt>
  mov    0x138(%rsp),%r9
  mov    0x18(%rsp),%rdx
  mov    %r14d,%esi
  mov    0x130(%rsp),%r8
  mov    0x140(%rsp),%rcx
  mov    %eax,%edi
  mov    %eax,0xb8(%rsp)
  movsd  (%r12),%xmm0
  call   <BasisFuns@plt>
  movsd  0x8(%r12),%xmm0
  mov    0x20(%rsp),%esi
  mov    0x110(%rsp),%rdx
  mov    0x98(%rsp),%edi
  call   <FindSpan@plt>
  mov    0x20(%rsp),%esi
  movsd  0x8(%r12),%xmm0
  mov    0x150(%rsp),%r9
  mov    0x148(%rsp),%r8
  mov    %eax,%edi
  mov    %eax,0xa8(%rsp)
  mov    0x158(%rsp),%rcx
  mov    0x110(%rsp),%rdx
  call   <BasisFuns@plt>
  mov    0x20(%rsp),%esi
  mov    0xa8(%rsp),%edi
  mov    0xbc(%rsp),%r11d
  mov    0xb8(%rsp),%eax
  sub    %esi,%edi
  mov    0xb0(%rsp),%r10
  imul   %r11d,%edi
  sub    %r14d,%eax
  test   %esi,%esi
  lea    (%rdi,%rax,4),%edi
  js     L216
  movsd  (%rbx),%xmm3
  movsd  0x8(%rbx),%xmm2
  xor    %esi,%esi
  pxor   %xmm4,%xmm4
  mov    0x158(%rsp),%rcx
  movsd  0x10(%rbx),%xmm1
  movslq %edi,%rdi
  mov    0x48(%rsp),%r8
  mov    0x140(%rsp),%r9
  nopl   0x0(%rax,%rax,1)
L175:
  test   %r14d,%r14d
  js     L315
  movslq %esi,%rax
  mov    %r9,%rdx
  add    %rdi,%rax
  lea    0x0(%r13,%rax,8),%rax
  nopl   0x0(%rax,%rax,1)
L157:
  movsd  (%rcx),%xmm0
  mulsd  (%rdx),%xmm0
  add    $0x8,%rdx
  add    $0x20,%rax
  movsd  -0x20(%rax),%xmm5
  mulsd  %xmm0,%xmm5
  addsd  %xmm5,%xmm3
  movsd  %xmm3,(%rbx)
  movsd  -0x18(%rax),%xmm5
  mulsd  %xmm0,%xmm5
  addsd  %xmm5,%xmm2
  movsd  %xmm2,0x8(%rbx)
  movsd  -0x10(%rax),%xmm5
  mulsd  %xmm0,%xmm5
  addsd  %xmm5,%xmm1
  movsd  %xmm1,0x10(%rbx)
  mulsd  -0x8(%rax),%xmm0
  addsd  %xmm0,%xmm4
  cmp    %rdx,%rbp
  jne    L157
L315:
  add    $0x8,%rcx
  add    %r11d,%esi
  cmp    %rcx,%r8
  jne    L175
  jmp    L111
L162:
  movq   $0x0,(%rbx)
  mov    0x110(%rsp),%rdx
  movq   $0x0,0x8(%rbx)
  mov    0x20(%rsp),%esi
  movq   $0x0,0x10(%rbx)
  mov    0x98(%rsp),%edi
  movsd  0x8(%r12),%xmm0
  mov    %r11d,0xb0(%rsp)
  mov    %r10,0xa8(%rsp)
  call   <FindSpan@plt>
  movsd  0x8(%r12),%xmm0
  mov    0x150(%rsp),%r9
  mov    0x148(%rsp),%r8
  mov    0x158(%rsp),%rcx
  mov    %eax,%edi
  mov    %eax,0xb8(%rsp)
  mov    0x110(%rsp),%rdx
  mov    0x20(%rsp),%esi
  call   <BasisFuns@plt>
  mov    0x20(%rsp),%eax
  mov    0xb8(%rsp),%edi
  mov    0xa8(%rsp),%r10
  mov    0xb0(%rsp),%r11d
  sub    %eax,%edi
  test   %eax,%eax
  js     L216
  imul   %r11d,%edi
  movsd  (%rbx),%xmm3
  movsd  0x8(%rbx),%xmm2
  pxor   %xmm4,%xmm4
  movsd  0x10(%rbx),%xmm1
  mov    0xc0(%rsp),%rcx
  mov    0x48(%rsp),%rsi
  movslq %edi,%rax
  lea    0x0(%r13,%rax,8),%rdx
  mov    0x158(%rsp),%rax
  nopl   0x0(%rax,%rax,1)
L215:
  movsd  (%rax),%xmm0
  mulsd  (%rdx),%xmm0
  add    $0x8,%rax
  addsd  %xmm0,%xmm3
  movsd  %xmm3,(%rbx)
  movsd  -0x8(%rax),%xmm0
  mulsd  0x8(%rdx),%xmm0
  addsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rbx)
  movsd  -0x8(%rax),%xmm0
  mulsd  0x10(%rdx),%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbx)
  movsd  -0x8(%rax),%xmm0
  mulsd  0x18(%rdx),%xmm0
  add    %rcx,%rdx
  addsd  %xmm0,%xmm4
  cmp    %rsi,%rax
  jne    L215
  jmp    L111
L201:
  mov    0x18(%rsp),%rdx
  movsd  (%r12),%xmm0
  mov    %r14d,%esi
  mov    %r11d,0xb0(%rsp)
  mov    0x24(%rsp),%edi
  mov    %r10,0xa8(%rsp)
  call   <FindSpan@plt>
  mov    0x138(%rsp),%r9
  mov    0x18(%rsp),%rdx
  mov    %r14d,%esi
  mov    0x130(%rsp),%r8
  mov    0x140(%rsp),%rcx
  mov    %eax,%edi
  mov    %eax,0xb8(%rsp)
  movsd  (%r12),%xmm0
  call   <BasisFuns@plt>
  mov    0xb8(%rsp),%edi
  mov    0xa8(%rsp),%r10
  mov    0xb0(%rsp),%r11d
  sub    %r14d,%edi
  test   %r14d,%r14d
  js     L216
  movslq %edi,%rcx
  movsd  (%rbx),%xmm3
  movsd  0x8(%rbx),%xmm2
  pxor   %xmm4,%xmm4
  lea    0x0(,%rdi,4),%eax
  add    0xc8(%rsp),%rcx
  movsd  0x10(%rbx),%xmm1
  cltq
  mov    0x140(%rsp),%rdx
  shl    $0x5,%rcx
  add    0x70(%rsp),%rcx
  lea    0x0(%r13,%rax,8),%rax
  nop
L266:
  movsd  (%rdx),%xmm0
  mulsd  (%rax),%xmm0
  add    $0x20,%rax
  add    $0x8,%rdx
  addsd  %xmm0,%xmm3
  movsd  %xmm3,(%rbx)
  movsd  -0x8(%rdx),%xmm0
  mulsd  -0x18(%rax),%xmm0
  addsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rbx)
  movsd  -0x8(%rdx),%xmm0
  mulsd  -0x10(%rax),%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbx)
  movsd  -0x8(%rdx),%xmm0
  mulsd  -0x8(%rax),%xmm0
  addsd  %xmm0,%xmm4
  cmp    %rax,%rcx
  jne    L266
  jmp    L111
L216:
  movsd  (%rbx),%xmm3
  movsd  0x8(%rbx),%xmm2
  pxor   %xmm4,%xmm4
  movsd  0x10(%rbx),%xmm1
  jmp    L111
L16:
  movq   $0x0,(%rbx)
  mov    0x110(%rsp),%rdx
  movq   $0x0,0x8(%rbx)
  mov    0x20(%rsp),%esi
  movq   $0x0,0x10(%rbx)
  mov    0x98(%rsp),%edi
  movsd  0x8(%r12),%xmm0
  mov    %r11d,0xb0(%rsp)
  mov    %r10,0xa8(%rsp)
  call   <FindSpan@plt>
  mov    0x20(%rsp),%esi
  movsd  0x8(%r12),%xmm0
  mov    0x150(%rsp),%r9
  mov    0x148(%rsp),%r8
  mov    %eax,%edi
  mov    %eax,0xb8(%rsp)
  mov    0x158(%rsp),%rcx
  mov    0x110(%rsp),%rdx
  call   <BasisFuns@plt>
  mov    0x20(%rsp),%esi
  mov    0xb8(%rsp),%eax
  mov    0xb0(%rsp),%r11d
  mov    0xa8(%rsp),%r10
  sub    %esi,%eax
  add    $0x1,%eax
  imul   %r11d,%eax
  test   %esi,%esi
  js     L216
  cltq
  movsd  (%rbx),%xmm3
  movsd  0x8(%rbx),%xmm2
  pxor   %xmm4,%xmm4
  lea    0x0(%r13,%rax,8),%rdx
  movsd  0x10(%rbx),%xmm1
  mov    0x158(%rsp),%rax
  mov    0xc0(%rsp),%rcx
  mov    0x48(%rsp),%rsi
  cs nopw 0x0(%rax,%rax,1)
L105:
  movsd  (%rax),%xmm0
  mulsd  -0x20(%rdx),%xmm0
  add    $0x8,%rax
  addsd  %xmm0,%xmm3
  movsd  %xmm3,(%rbx)
  movsd  -0x8(%rax),%xmm0
  mulsd  -0x18(%rdx),%xmm0
  addsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rbx)
  movsd  -0x8(%rax),%xmm0
  mulsd  -0x10(%rdx),%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbx)
  movsd  -0x8(%rax),%xmm0
  mulsd  -0x8(%rdx),%xmm0
  add    %rcx,%rdx
  addsd  %xmm0,%xmm4
  cmp    %rax,%rsi
  jne    L105
  jmp    L111
```

assistant: ```c
void NURBSsurfaceEval(int degU, int degV, double *cp, int ncp, int kcp, double *knotU, double *knotV, double *us, int nus, double *ep, double *leftU, double *rightU, double *NU, double *leftV, double *rightV, double *NV) {
  int i, j, jj, spanU, spanV, ind, ind2, fourncp, threejj, myint;
  double wgh, NN;
  fourncp = 4 * ncp;
  for (jj = 0; jj < nus; jj++) {
    threejj = 3 * jj;
    if (us[2 * jj] <= knotU[degU]) {
      if (us[2 * jj + 1] <= knotV[degV]) {
        ep[threejj] = cp[0] / cp[3];
        ep[threejj + 1] = cp[1] / cp[3];
        ep[threejj + 2] = cp[2] / cp[3];
      } else if (us[2 * jj + 1] >= knotV[kcp]) {
        myint = fourncp * (kcp - 1);
        ep[threejj] = cp[myint] / cp[myint + 3];
        ep[threejj + 1] = cp[myint + 1] / cp[myint + 3];
        ep[threejj + 2] = cp[myint + 2] / cp[myint + 3];
      } else {
        ep[threejj] = 0.0;
        ep[threejj + 1] = 0.0;
        ep[threejj + 2] = 0.0;
        wgh = 0.0;
        spanV = FindSpan(kcp, degV, us[2 * jj + 1], knotV);
        BasisFuns(spanV, us[2 * jj + 1], degV, knotV, NV, leftV, rightV);
        ind = spanV - degV;
        for (i = 0; i <= degV; i++) {
          myint = (ind + i) * fourncp;
          ep[threejj] += NV[i] * cp[myint];
          ep[threejj + 1] += NV[i] * cp[myint + 1];
          ep[threejj + 2] += NV[i] * cp[myint + 2];
          wgh += NV[i] * cp[myint + 3];
        }
        ep[threejj] = ep[threejj] / wgh;
        ep[threejj + 1] = ep[threejj + 1] / wgh;
        ep[threejj + 2] = ep[threejj + 2] / wgh;
      }
    } else if (us[2 * jj] >= knotU[ncp]) {
      if (us[2 * jj + 1] <= knotV[degV]) {
        ep[threejj] = cp[fourncp - 4] / cp[fourncp - 1];
        ep[threejj + 1] = cp[fourncp - 3] / cp[fourncp - 1];
        ep[threejj + 2] = cp[fourncp - 2] / cp[fourncp - 1];
      } else if (us[2 * jj + 1] >= knotV[kcp]) {
        myint = fourncp * kcp;
        ep[threejj] = cp[myint - 4] / cp[myint - 1];
        ep[threejj + 1] = cp[myint - 3] / cp[myint - 1];
        ep[threejj + 2] = cp[myint - 2] / cp[myint - 1];
      } else {
        ep[threejj] = 0.0;
        ep[threejj + 1] = 0.0;
        ep[threejj + 2] = 0.0;
        wgh = 0.0;
        spanV = FindSpan(kcp, degV, us[2 * jj + 1], knotV);
        BasisFuns(spanV, us[2 * jj + 1], degV, knotV, NV, leftV, rightV);
        ind = spanV - degV;
        myint = (ind + 1) * fourncp;
        for (i = 0; i <= degV; i++) {
          ep[threejj] += NV[i] * cp[i * fourncp + myint - 4];
          ep[threejj + 1] += NV[i] * cp[i * fourncp + myint - 3];
          ep[threejj + 2] += NV[i] * cp[i * fourncp + myint - 2];
          wgh += NV[i] * cp[i * fourncp + myint - 1];
        }
        ep[threejj] = ep[threejj] / wgh;
        ep[threejj + 1] = ep[threejj + 1] / wgh;
        ep[threejj + 2] = ep[threejj + 2] / wgh;
      }
    } else {
      ep[threejj] = 0.0;
      ep[threejj + 1] = 0.0;
      ep[threejj + 2] = 0.0;
      wgh = 0.0;
      if (us[2 * jj + 1] <= knotV[degV]) {
        spanU = FindSpan(ncp, degU, us[2 * jj], knotU);
        BasisFuns(spanU, us[2 * jj], degU, knotU, NU, leftU, rightU);
        ind = spanU - degU;
        for (i = 0; i <= degU; i++) {
          ep[threejj] += NU[i] * cp[(ind + i) * 4];
          ep[threejj + 1] += NU[i] * cp[(ind + i) * 4 + 1];
          ep[threejj + 2] += NU[i] * cp[(ind + i) * 4 + 2];
          wgh += NU[i] * cp[(ind + i) * 4 + 3];
        }
        ep[threejj] = ep[threejj] / wgh;
        ep[threejj + 1] = ep[threejj + 1] / wgh;
        ep[threejj + 2] = ep[threejj + 2] / wgh;
      } else if (us[2 * jj + 1] >= knotV[kcp]) {
        spanU = FindSpan(ncp, degU, us[2 * jj], knotU);
        BasisFuns(spanU, us[2 * jj], degU, knotU, NU, leftU, rightU);
        ind = spanU - degU;
        myint = ind * 4 + (kcp - 1) * fourncp;
        for (i = 0; i <= degU; i++) {
          ep[threejj] += NU[i] * cp[i * 4 + myint];
          ep[threejj + 1] += NU[i] * cp[i * 4 + myint + 1];
          ep[threejj + 2] += NU[i] * cp[i * 4 + myint + 2];
          wgh += NU[i] * cp[i * 4 + myint + 3];
        }
        ep[threejj] = ep[threejj] / wgh;
        ep[threejj + 1] = ep[threejj + 1] / wgh;
        ep[threejj + 2] = ep[threejj + 2] / wgh;
      } else {
        spanU = FindSpan(ncp, degU, us[2 * jj], knotU);
        BasisFuns(spanU, us[2 * jj], degU, knotU, NU, leftU, rightU);
        spanV = FindSpan(kcp, degV, us[2 * jj + 1], knotV);
        BasisFuns(spanV, us[2 * jj + 1], degV, knotV, NV, leftV, rightV);
        ind = spanU - degU;
        ind2 = spanV - degV;
        myint = ind2 * fourncp + ind * 4;
        for (i = 0; i <= degV; i++) {
          for (j = 0; j <= degU; j++) {
            NN = NV[i] * NU[j];
            ep[threejj] += NN * cp[i * fourncp + j * 4 + myint];
            ep[threejj + 1] += NN * cp[i * fourncp + j * 4 + myint + 1];
            ep[threejj + 2] += NN * cp[i * fourncp + j * 4 + myint + 2];
            wgh += NN * cp[i * fourncp + j * 4 + myint + 3];
          }
        }
        ep[threejj] = ep[threejj] / wgh;
        ep[threejj + 1] = ep[threejj + 1] / wgh;
        ep[threejj + 2] = ep[threejj + 2] / wgh;
      }
    }
  }
}
```