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

```asm
<find_surface_point>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xe8,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    %rcx,%r15
  mov    %r8,%rbx
  mov    %r9,%rbp
  mov    0x120(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mov    0x128(%rsp),%rax
  mov    %rax,0x40(%rsp)
  mov    0x130(%rsp),%rax
  mov    %rax,(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  cmpl   $0x1,0x138(%rsp)
  je     L416
L296:
  mov    $0x0,%eax
L174:
  movsd  (%r14,%rax,1),%xmm0
  subsd  0x0(%r13,%rax,1),%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,1)
  add    $0x8,%rax
  cmp    $0x18,%rax
  jne    L174
  movsd  0x0(%rbp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  movsd  0x8(%rbp),%xmm2
  movsd  0x10(%rbp),%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L43
  sqrtsd %xmm0,%xmm0
L488:
  movapd %xmm0,%xmm1
  andpd  D158(%rip),%xmm1
  comisd D166(%rip),%xmm1
  jbe    L312
  movsd  0x8(%rsp),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%rbp)
  movsd  0x8(%rbp),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rbp)
  movsd  0x10(%rbp),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbp)
L312:
  movsd  (%rbx),%xmm2
  movsd  0x8(%rbx),%xmm0
  mulsd  0x8(%rbp),%xmm0
  movapd %xmm2,%xmm1
  mulsd  0x0(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x10(%rbx),%xmm1
  mulsd  0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  ja     L422
L476:
  cmpl   $0x1,0x138(%rsp)
  je     L410
L244:
  cmpl   $0x0,0x140(%rsp)
  jne    L267
  movsd  (%rbx),%xmm0
  mov    (%rsp),%rax
  movsd  %xmm0,(%rax)
  movsd  0x8(%rbx),%xmm0
  movsd  %xmm0,0x8(%rax)
  movsd  0x10(%rbx),%xmm0
  movsd  %xmm0,0x10(%rax)
L267:
  movsd  (%rbx),%xmm4
  movsd  (%r14),%xmm7
  movsd  0x8(%rbx),%xmm3
  movsd  0x8(%r14),%xmm6
  movsd  0x10(%rbx),%xmm2
  movsd  0x10(%r14),%xmm5
  movsd  0x0(%r13),%xmm0
  subsd  %xmm7,%xmm0
  mulsd  %xmm4,%xmm0
  movsd  0x8(%r13),%xmm1
  subsd  %xmm6,%xmm1
  mulsd  %xmm3,%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x10(%r13),%xmm1
  subsd  %xmm5,%xmm1
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  andpd  D158(%rip),%xmm1
  mov    $0x0,%eax
  comisd D166(%rip),%xmm1
  jbe    L284
  movsd  0x18(%rbx),%xmm1
  xorpd  D95(%rip),%xmm1
  mulsd  %xmm7,%xmm4
  subsd  %xmm4,%xmm1
  mulsd  %xmm6,%xmm3
  subsd  %xmm3,%xmm1
  mulsd  %xmm5,%xmm2
  subsd  %xmm2,%xmm1
  divsd  %xmm0,%xmm1
  mov    $0x0,%eax
  comisd D168(%rip),%xmm1
  jbe    L284
  mov    $0x0,%eax
L206:
  movsd  (%r14,%rax,1),%xmm2
  movsd  0x0(%r13,%rax,1),%xmm0
  subsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%r15,%rax,1)
  add    $0x8,%rax
  cmp    $0x18,%rax
  jne    L206
  mov    %r12,%r13
  mov    %r12,%rbx
  mov    $0x0,%ebp
  mov    $0x1,%eax
  jmp    L236
L416:
  movsd  0x8(%rdi),%xmm3
  movsd  0x10(%rdi),%xmm2
  movsd  0x20(%rdi),%xmm0
  subsd  %xmm3,%xmm0
  movsd  0x40(%rdi),%xmm1
  subsd  %xmm2,%xmm1
  movapd %xmm0,%xmm4
  mulsd  %xmm1,%xmm4
  movsd  0x38(%rdi),%xmm0
  subsd  %xmm3,%xmm0
  movsd  0x28(%rdi),%xmm1
  subsd  %xmm2,%xmm1
  mulsd  %xmm1,%xmm0
  subsd  %xmm0,%xmm4
  movapd %xmm4,%xmm7
  movsd  %xmm4,0x8(%rsp)
  movsd  %xmm4,(%rbx)
  movsd  (%rdi),%xmm4
  movsd  0x10(%rdi),%xmm3
  movsd  0x18(%rdi),%xmm0
  subsd  %xmm4,%xmm0
  movsd  0x40(%rdi),%xmm1
  subsd  %xmm3,%xmm1
  mulsd  %xmm1,%xmm0
  movsd  0x30(%rdi),%xmm2
  subsd  %xmm4,%xmm2
  movsd  0x28(%rdi),%xmm1
  subsd  %xmm3,%xmm1
  mulsd  %xmm1,%xmm2
  subsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%r8)
  movsd  (%rdi),%xmm3
  movsd  0x8(%rdi),%xmm4
  movsd  0x18(%rdi),%xmm1
  subsd  %xmm3,%xmm1
  movsd  0x38(%rdi),%xmm0
  subsd  %xmm4,%xmm0
  mulsd  %xmm0,%xmm1
  movsd  0x30(%rdi),%xmm0
  subsd  %xmm3,%xmm0
  movsd  0x20(%rdi),%xmm3
  subsd  %xmm4,%xmm3
  mulsd  %xmm3,%xmm0
  subsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%r8)
  movapd %xmm7,%xmm0
  mulsd  %xmm7,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L240
  sqrtsd %xmm0,%xmm0
L138:
  movapd %xmm0,%xmm1
  andpd  D158(%rip),%xmm1
  comisd D166(%rip),%xmm1
  jbe    L296
  movsd  0x8(%rsp),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rbx)
  movsd  0x8(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rbx)
  movsd  0x10(%rbx),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rbx)
  jmp    L296
L240:
  call   <sqrt@plt>
  jmp    L138
L43:
  call   <sqrt@plt>
  jmp    L488
L422:
  movq   D95(%rip),%xmm1
  xorpd  %xmm1,%xmm2
  movsd  %xmm2,(%rbx)
  movsd  0x8(%rbx),%xmm0
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%rbx)
  movsd  0x10(%rbx),%xmm0
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,0x10(%rbx)
  jmp    L476
L410:
  movsd  (%rbx),%xmm0
  xorpd  D95(%rip),%xmm0
  mulsd  (%r12),%xmm0
  movsd  0x8(%rbx),%xmm1
  mulsd  0x8(%r12),%xmm1
  subsd  %xmm1,%xmm0
  movsd  0x10(%rbx),%xmm1
  mulsd  0x10(%r12),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,0x18(%rbx)
  jmp    L244
L354:
  cltq
  lea    (%rax,%rax,2),%rax
  lea    0x0(%r13,%rax,8),%rax
  movsd  (%rax),%xmm1
  movapd %xmm1,%xmm7
  subsd  %xmm2,%xmm7
  movsd  %xmm7,0x10(%rsp)
  movsd  0x8(%r15),%xmm4
  movsd  %xmm4,0x50(%rsp)
  movsd  0x8(%rdx),%xmm1
  movapd %xmm4,%xmm2
  subsd  %xmm1,%xmm2
  movsd  0x8(%rax),%xmm3
  movapd %xmm3,%xmm5
  subsd  %xmm1,%xmm5
  movsd  %xmm5,0x20(%rsp)
  movsd  0x10(%r15),%xmm6
  movsd  %xmm6,0x58(%rsp)
  movsd  0x10(%rdx),%xmm3
  subsd  %xmm3,%xmm6
  movapd %xmm6,%xmm1
  movsd  0x10(%rax),%xmm4
  movapd %xmm4,%xmm6
  subsd  %xmm3,%xmm6
  movsd  %xmm6,0x28(%rsp)
  mulsd  %xmm0,%xmm7
  movapd %xmm7,%xmm3
  movapd %xmm5,%xmm4
  mulsd  %xmm2,%xmm4
  addsd  %xmm4,%xmm3
  mulsd  %xmm1,%xmm6
  addsd  %xmm6,%xmm3
  movsd  %xmm3,0x30(%rsp)
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm7
  movsd  %xmm0,0x8(%rsp)
  pxor   %xmm0,%xmm0
  ucomisd %xmm7,%xmm0
  ja     L362
  sqrtsd %xmm7,%xmm7
  movsd  %xmm7,0x18(%rsp)
L72:
  movsd  0x10(%rsp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  0x20(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x28(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm5
  movsd  %xmm0,0x10(%rsp)
  pxor   %xmm0,%xmm0
  ucomisd %xmm5,%xmm0
  ja     L275
  sqrtsd %xmm5,%xmm5
  movapd %xmm5,%xmm0
L118:
  movsd  0x18(%rsp),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  0x30(%rsp),%xmm0
  divsd  %xmm1,%xmm0
  mulsd  %xmm0,%xmm0
  movsd  D179(%rip),%xmm1
  subsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  ucomisd %xmm1,%xmm0
  ja     L70
  sqrtsd %xmm1,%xmm1
  movsd  %xmm1,0x18(%rsp)
L15:
  pxor   %xmm0,%xmm0
  movsd  0x10(%rsp),%xmm7
  ucomisd %xmm7,%xmm0
  ja     L293
  sqrtsd %xmm7,%xmm7
  movsd  %xmm7,0x10(%rsp)
L406:
  pxor   %xmm0,%xmm0
  movsd  0x8(%rsp),%xmm3
  ucomisd %xmm3,%xmm0
  ja     L235
  sqrtsd %xmm3,%xmm3
  movapd %xmm3,%xmm0
L330:
  mulsd  0x10(%rsp),%xmm0
  mulsd  0x18(%rsp),%xmm0
  mulsd  D79(%rip),%xmm0
  movsd  %xmm0,0x60(%rsp,%rbp,8)
  cmp    $0x2,%rbp
  je     L221
  lea    0x2(%r14),%eax
  cmp    $0x1,%r14d
  mov    $0x0,%edx
  cmove  %edx,%eax
  add    $0x1,%rbp
  add    $0x18,%rbx
L236:
  mov    %ebp,%r14d
  movsd  (%r15),%xmm5
  movsd  %xmm5,0x48(%rsp)
  mov    %rbx,%rdx
  movsd  (%rbx),%xmm2
  movapd %xmm5,%xmm0
  subsd  %xmm2,%xmm0
  movapd %xmm0,%xmm1
  andpd  D158(%rip),%xmm1
  movsd  D166(%rip),%xmm5
  comisd %xmm1,%xmm5
  jbe    L354
  movsd  0x8(%r15),%xmm1
  subsd  0x8(%rbx),%xmm1
  andpd  D158(%rip),%xmm1
  comisd %xmm1,%xmm5
  jbe    L354
  movsd  0x10(%r15),%xmm1
  subsd  0x10(%rbx),%xmm1
  andpd  D158(%rip),%xmm1
  comisd %xmm1,%xmm5
  jbe    L354
  mov    0x38(%rsp),%rax
  movsd  (%rax,%rbp,8),%xmm0
  mov    0x40(%rsp),%rax
  movsd  %xmm0,(%rax)
  mov    $0x1,%eax
  cmpl   $0x1,0x140(%rsp)
  jne    L284
  lea    0x0(%rbp,%rbp,2),%eax
  cltq
  mov    (%rsp),%rdi
  movsd  (%rdi,%rax,8),%xmm2
  add    $0x1,%rax
  movsd  (%rdi,%rax,8),%xmm1
  movsd  0x8(%rdi,%rax,8),%xmm0
  movsd  %xmm2,(%rdi)
  movsd  %xmm1,0x8(%rdi)
  movsd  %xmm0,0x10(%rdi)
  mov    0x140(%rsp),%eax
  jmp    L284
L362:
  movsd  0x8(%rsp),%xmm0
  call   <sqrt@plt>
  movsd  %xmm0,0x18(%rsp)
  jmp    L72
L275:
  movsd  0x10(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L118
L70:
  movapd %xmm1,%xmm0
  call   <sqrt@plt>
  movsd  %xmm0,0x18(%rsp)
  jmp    L15
L293:
  movsd  0x10(%rsp),%xmm0
  call   <sqrt@plt>
  movsd  %xmm0,0x10(%rsp)
  jmp    L406
L235:
  movsd  0x8(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L330
L221:
  mov    %r13,%rax
  mov    %r12,%r13
  movsd  (%rax),%xmm1
  movsd  0x30(%rax),%xmm0
  subsd  %xmm1,%xmm0
  movsd  0x18(%rax),%xmm2
  movapd %xmm2,%xmm5
  subsd  %xmm1,%xmm5
  movsd  %xmm5,0x10(%rsp)
  movsd  0x8(%rax),%xmm1
  movsd  0x38(%rax),%xmm2
  subsd  %xmm1,%xmm2
  movsd  0x20(%rax),%xmm3
  movapd %xmm3,%xmm6
  subsd  %xmm1,%xmm6
  movsd  %xmm6,0x20(%rsp)
  movsd  0x10(%rax),%xmm3
  movsd  0x40(%rax),%xmm1
  subsd  %xmm3,%xmm1
  movsd  0x28(%rax),%xmm4
  subsd  %xmm3,%xmm4
  movapd %xmm4,%xmm7
  movsd  %xmm4,0x28(%rsp)
  movapd %xmm5,%xmm3
  mulsd  %xmm0,%xmm3
  movapd %xmm6,%xmm4
  mulsd  %xmm2,%xmm4
  addsd  %xmm4,%xmm3
  movapd %xmm7,%xmm4
  mulsd  %xmm1,%xmm4
  addsd  %xmm4,%xmm3
  movq   %xmm3,%rbx
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm4
  movsd  %xmm0,0x8(%rsp)
  pxor   %xmm0,%xmm0
  ucomisd %xmm4,%xmm0
  ja     L324
  sqrtsd %xmm4,%xmm4
  movsd  %xmm4,0x18(%rsp)
L141:
  movsd  0x10(%rsp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  0x20(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x28(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm5
  movsd  %xmm0,0x10(%rsp)
  pxor   %xmm0,%xmm0
  ucomisd %xmm5,%xmm0
  ja     L248
  sqrtsd %xmm5,%xmm5
  movapd %xmm5,%xmm0
L207:
  movsd  0x18(%rsp),%xmm1
  mulsd  %xmm0,%xmm1
  movq   %rbx,%xmm0
  divsd  %xmm1,%xmm0
  mulsd  %xmm0,%xmm0
  movsd  D179(%rip),%xmm1
  subsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  ucomisd %xmm1,%xmm0
  ja     L394
  sqrtsd %xmm1,%xmm1
  movsd  %xmm1,0x18(%rsp)
L63:
  pxor   %xmm0,%xmm0
  movsd  0x10(%rsp),%xmm7
  ucomisd %xmm7,%xmm0
  ja     L399
  sqrtsd %xmm7,%xmm7
  movsd  %xmm7,0x10(%rsp)
L92:
  pxor   %xmm0,%xmm0
  movsd  0x8(%rsp),%xmm4
  ucomisd %xmm4,%xmm0
  ja     L391
  sqrtsd %xmm4,%xmm4
  movapd %xmm4,%xmm0
L208:
  mulsd  0x10(%rsp),%xmm0
  mulsd  0x18(%rsp),%xmm0
  mulsd  D79(%rip),%xmm0
  subsd  0x60(%rsp),%xmm0
  subsd  0x68(%rsp),%xmm0
  subsd  0x70(%rsp),%xmm0
  andpd  D158(%rip),%xmm0
  movsd  D166(%rip),%xmm1
  mov    $0x0,%eax
  comisd %xmm0,%xmm1
  jbe    L284
  lea    0x80(%rsp),%rbx
  lea    0x98(%rsp),%rbp
L171:
  movsd  0x48(%rsp),%xmm0
  subsd  0x0(%r13),%xmm0
  movsd  0x50(%rsp),%xmm2
  subsd  0x8(%r13),%xmm2
  movsd  0x58(%rsp),%xmm1
  subsd  0x10(%r13),%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm5,%xmm5
  ucomisd %xmm0,%xmm5
  ja     L120
  sqrtsd %xmm0,%xmm0
L378:
  movsd  %xmm0,(%rbx)
  add    $0x18,%r13
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L171
  movsd  0x80(%rsp),%xmm1
  movsd  0x88(%rsp),%xmm2
  movsd  0x90(%rsp),%xmm3
  movsd  D179(%rip),%xmm4
  movapd %xmm4,%xmm0
  divsd  %xmm1,%xmm0
  movapd %xmm4,%xmm5
  divsd  %xmm2,%xmm5
  addsd  %xmm5,%xmm0
  divsd  %xmm3,%xmm4
  addsd  %xmm4,%xmm0
  mulsd  %xmm0,%xmm1
  mulsd  %xmm0,%xmm2
  mulsd  %xmm0,%xmm3
  mov    0x38(%rsp),%rax
  movsd  (%rax),%xmm0
  divsd  %xmm1,%xmm0
  movsd  0x8(%rax),%xmm4
  divsd  %xmm2,%xmm4
  addsd  %xmm4,%xmm0
  movsd  0x10(%rax),%xmm4
  divsd  %xmm3,%xmm4
  addsd  %xmm4,%xmm0
  mov    0x40(%rsp),%rax
  movsd  %xmm0,(%rax)
  mov    $0x1,%eax
  cmpl   $0x1,0x140(%rsp)
  je     L241
L284:
  mov    0xd8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L504
  add    $0xe8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L324:
  movsd  0x8(%rsp),%xmm0
  call   <sqrt@plt>
  movsd  %xmm0,0x18(%rsp)
  jmp    L141
L248:
  movsd  0x10(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L207
L394:
  movapd %xmm1,%xmm0
  call   <sqrt@plt>
  movsd  %xmm0,0x18(%rsp)
  jmp    L63
L399:
  movsd  0x10(%rsp),%xmm0
  call   <sqrt@plt>
  movsd  %xmm0,0x10(%rsp)
  jmp    L92
L391:
  movsd  0x8(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L208
L120:
  call   <sqrt@plt>
  jmp    L378
L241:
  mov    $0x0,%eax
  mov    (%rsp),%rdx
L170:
  movsd  (%rdx,%rax,1),%xmm0
  divsd  %xmm1,%xmm0
  movsd  0x18(%rdx,%rax,1),%xmm4
  divsd  %xmm2,%xmm4
  addsd  %xmm4,%xmm0
  movsd  0x30(%rdx,%rax,1),%xmm4
  divsd  %xmm3,%xmm4
  addsd  %xmm4,%xmm0
  movsd  %xmm0,0xa0(%rsp,%rax,1)
  add    $0x8,%rax
  cmp    $0x18,%rax
  jne    L170
  movsd  0xa0(%rsp),%xmm0
  mov    (%rsp),%rax
  movsd  %xmm0,(%rax)
  movsd  0xa8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rax)
  movsd  0xb0(%rsp),%xmm0
  movsd  %xmm0,0x10(%rax)
  mov    0x140(%rsp),%eax
  jmp    L284
L504:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D158
type: qword[2]
name: retrieve_data
arguments: label: D166
type: f64[2]
name: retrieve_data
arguments: label: D95
type: f32[4]
name: retrieve_data
arguments: label: D168
type: byte[16]
name: retrieve_data
arguments: label: D179
type: f64
name: retrieve_data
arguments: label: D79
type: f32[2]

tool: {"D158": [0x7fffffffffffffff,0x0000000000000000]}

tool: {"D166": [1e-8,-1e-8]}

tool: {"D95": [0.0,-0.0,0.0,0.0]}

tool: {"D168": [0x3a,0x8c,0x30,0xe2,0x8e,0x79,0x45,0xbe,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

tool: D179: 1

tool: {"D79": [0.0,1.75]}

assistant: ```c
int find_surface_point(double fp[3][3], double point_o[3], double view_point_d[3], double point[3], double n_f[4], double v_f[9], double c_value[3], double *value, double normal[9], int normal_flag, int smooth_shading) {
  int i, j, n1, n2, flag_inside;
  double s[3], sina, cosa, ss, t, dis[3], dist, n_norm, v_norm, nv_sign;
  double tmp_p[7];
  flag_inside = 0;
  if (normal_flag == 1) {
    n_f[0] = (fp[1][1] - fp[0][1]) * (fp[2][2] - fp[0][2]) - (fp[2][1] - fp[0][1]) * (fp[1][2] - fp[0][2]);
    n_f[1] = -(fp[1][0] - fp[0][0]) * (fp[2][2] - fp[0][2]) + (fp[2][0] - fp[0][0]) * (fp[1][2] - fp[0][2]);
    n_f[2] = (fp[1][0] - fp[0][0]) * (fp[2][1] - fp[0][1]) - (fp[2][0] - fp[0][0]) * (fp[1][1] - fp[0][1]);
    n_norm = sqrt(n_f[0] * n_f[0] + n_f[1] * n_f[1] + n_f[2] * n_f[2]);
    if (fabs(n_norm) > 0.00000001) {
      for (j = 0; j < 3; j++)
        n_f[j] /= n_norm;
    }
  }
  for (i = 0; i < 3; i++)
    v_f[i] = view_point_d[i] - point_o[i];
  v_norm = sqrt(v_f[0] * v_f[0] + v_f[1] * v_f[1] + v_f[2] * v_f[2]);
  if (fabs(v_norm) > 0.00000001) {
    for (i = 0; i < 3; i++)
      v_f[i] /= v_norm;
  }
  nv_sign = n_f[0] * v_f[0] + n_f[1] * v_f[1] + n_f[2] * v_f[2];
  if (nv_sign < 0.0) {
    for (i = 0; i < 3; i++)
      n_f[i] = -n_f[i];
  }
  if (normal_flag == 1)
    n_f[3] = -n_f[0] * fp[0][0] - n_f[1] * fp[0][1] - n_f[2] * fp[0][2];
  if (smooth_shading == 0)
    for (i = 0; i < 3; i++)
      normal[i] = n_f[i];
  if (fabs(n_f[0] * (point_o[0] - view_point_d[0]) + n_f[1] * (point_o[1] - view_point_d[1]) + n_f[2] * (point_o[2] - view_point_d[2])) > 0.00000001) {
    t = (-n_f[3] - n_f[0] * view_point_d[0] - n_f[1] * view_point_d[1] - n_f[2] * view_point_d[2]) / (n_f[0] * (point_o[0] - view_point_d[0]) + n_f[1] * (point_o[1] - view_point_d[1]) + n_f[2] * (point_o[2] - view_point_d[2]));
    if (t > -0.00000001) {
      for (j = 0; j < 3; j++)
        point[j] = view_point_d[j] + t * (point_o[j] - view_point_d[j]);
      for (j = 0; j < 3; j++) {
        n1 = j;
        n2 = j + 1;
        if (n2 == 3)
          n2 = 0;
        if ((fabs(point[0] - fp[n1][0]) < 0.00000001) && (fabs(point[1] - fp[n1][1]) < 0.00000001) && (fabs(point[2] - fp[n1][2]) < 0.00000001)) {
          flag_inside = 1;
          *value = c_value[n1];
          if (smooth_shading == 1) {
            tmp_p[0] = normal[n1 * 3 + 0];
            tmp_p[1] = normal[n1 * 3 + 1];
            tmp_p[2] = normal[n1 * 3 + 2];
            normal[0] = tmp_p[0];
            normal[1] = tmp_p[1];
            normal[2] = tmp_p[2];
          }
          break;
        }
        cosa = ((point[0] - fp[n1][0]) * (fp[n2][0] - fp[n1][0]) + (point[1] - fp[n1][1]) * (fp[n2][1] - fp[n1][1]) + (point[2] - fp[n1][2]) * (fp[n2][2] - fp[n1][2])) / (sqrt((point[0] - fp[n1][0]) * (point[0] - fp[n1][0]) + (point[1] - fp[n1][1]) * (point[1] - fp[n1][1]) + (point[2] - fp[n1][2]) * (point[2] - fp[n1][2])) * sqrt((fp[n2][0] - fp[n1][0]) * (fp[n2][0] - fp[n1][0]) + (fp[n2][1] - fp[n1][1]) * (fp[n2][1] - fp[n1][1]) + (fp[n2][2] - fp[n1][2]) * (fp[n2][2] - fp[n1][2])));
        sina = sqrt(1 - cosa * cosa);
        s[j] = sqrt((fp[n2][0] - fp[n1][0]) * (fp[n2][0] - fp[n1][0]) + (fp[n2][1] - fp[n1][1]) * (fp[n2][1] - fp[n1][1]) + (fp[n2][2] - fp[n1][2]) * (fp[n2][2] - fp[n1][2])) * sqrt((point[0] - fp[n1][0]) * (point[0] - fp[n1][0]) + (point[1] - fp[n1][1]) * (point[1] - fp[n1][1]) + (point[2] - fp[n1][2]) * (point[2] - fp[n1][2])) * sina / 2.0;
      }
      if (flag_inside == 0) {
        cosa = ((fp[2][0] - fp[0][0]) * (fp[1][0] - fp[0][0]) + (fp[2][1] - fp[0][1]) * (fp[1][1] - fp[0][1]) + (fp[2][2] - fp[0][2]) * (fp[1][2] - fp[0][2])) / (sqrt((fp[2][0] - fp[0][0]) * (fp[2][0] - fp[0][0]) + (fp[2][1] - fp[0][1]) * (fp[2][1] - fp[0][1]) + (fp[2][2] - fp[0][2]) * (fp[2][2] - fp[0][2])) * sqrt((fp[1][0] - fp[0][0]) * (fp[1][0] - fp[0][0]) + (fp[1][1] - fp[0][1]) * (fp[1][1] - fp[0][1]) + (fp[1][2] - fp[0][2]) * (fp[1][2] - fp[0][2])));
        sina = sqrt(1 - cosa * cosa);
        ss = sqrt((fp[1][0] - fp[0][0]) * (fp[1][0] - fp[0][0]) + (fp[1][1] - fp[0][1]) * (fp[1][1] - fp[0][1]) + (fp[1][2] - fp[0][2]) * (fp[1][2] - fp[0][2])) * sqrt((fp[2][0] - fp[0][0]) * (fp[2][0] - fp[0][0]) + (fp[2][1] - fp[0][1]) * (fp[2][1] - fp[0][1]) + (fp[2][2] - fp[0][2]) * (fp[2][2] - fp[0][2])) * sina / 2.0;
        if (fabs(ss - s[0] - s[1] - s[2]) < 0.00000001) {
          flag_inside = 1;
          for (j = 0; j < 3; j++)
            dis[j] = sqrt((point[0] - fp[j][0]) * (point[0] - fp[j][0]) + (point[1] - fp[j][1]) * (point[1] - fp[j][1]) + (point[2] - fp[j][2]) * (point[2] - fp[j][2]));
          dist = 1.0 / dis[0] + 1.0 / dis[1] + 1.0 / dis[2];
          *value = c_value[0] / (dis[0] * dist) + c_value[1] / (dis[1] * dist) + c_value[2] / (dis[2] * dist);
          if (smooth_shading == 1) {
            for (j = 0; j < 3; j++) {
              tmp_p[j] = normal[0 * 3 + j] / (dis[0] * dist) + normal[1 * 3 + j] / (dis[1] * dist) + normal[2 * 3 + j] / (dis[2] * dist);
            }
            for (j = 0; j < 3; j++)
              normal[j] = tmp_p[j];
          }
        }
      }
    }
  }
  return (flag_inside);
}
```