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

```asm
<intersection_area_circle_triangle>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x238,%rsp
  movapd %xmm0,%xmm6
  movsd  %xmm0,0x18(%rsp)
  mov    %rdi,%r14
  mov    %rsi,%r13
  mov    %rdx,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x228(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x40(%rsp)
  movq   $0x0,0x48(%rsp)
  movsd  D243(%rip),%xmm0
  movapd %xmm0,%xmm5
  divsd  %xmm6,%xmm5
  movsd  %xmm5,0x8(%rsp)
  movsd  (%rdi),%xmm1
  movsd  %xmm1,0xd0(%rsp)
  movsd  0x8(%rdi),%xmm0
  movsd  %xmm0,0xd8(%rsp)
  movsd  (%rsi),%xmm4
  movapd %xmm1,%xmm2
  addsd  %xmm4,%xmm2
  movsd  %xmm2,0xe0(%rsp)
  movsd  0x8(%rsi),%xmm3
  movapd %xmm0,%xmm2
  addsd  %xmm3,%xmm2
  movsd  %xmm2,0xe8(%rsp)
  movsd  (%rdx),%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,0xf0(%rsp)
  movsd  0x8(%rdx),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0xf8(%rsp)
  movq   $0x0,0x100(%rsp)
  movq   $0x0,0x108(%rsp)
  movsd  %xmm4,0x110(%rsp)
  movsd  %xmm3,0x118(%rsp)
  movsd  %xmm2,0x120(%rsp)
  movsd  %xmm1,0x128(%rsp)
  mov    $0x0,%ebx
  mov    $0x0,%ebp
  jmp    L224
L496:
  add    $0x1,%rbx
  cmp    $0x3,%rbx
  je     L208
L224:
  mov    %rbx,%rax
  shl    $0x4,%rax
  movsd  0xd0(%rsp,%rax,1),%xmm0
  movsd  0xd8(%rsp,%rax,1),%xmm1
  mov    $0x2,%eax
  call   <pythag2@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x50(%rsp,%rbx,8)
  movsd  D243(%rip),%xmm6
  comisd %xmm0,%xmm6
  jb     L496
  mov    $0x1,%eax
  mov    %ebx,%ecx
  shl    %cl,%eax
  or     %eax,%ebp
  jmp    L496
L208:
  lea    0x40(%rsp),%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <TriangleContainsPoint@plt>
  mov    %eax,%edx
  mov    %ebp,%eax
  or     $0x8,%eax
  test   %edx,%edx
  cmovne %eax,%ebp
  mov    %ebp,%eax
  and    $0x7,%eax
  cmp    $0x7,%eax
  je     L171
  movsd  0x0(%r13),%xmm0
  movsd  %xmm0,0x130(%rsp)
  movsd  0x8(%r13),%xmm2
  movsd  %xmm2,0x138(%rsp)
  movsd  (%r12),%xmm1
  movapd %xmm1,%xmm3
  subsd  %xmm0,%xmm3
  movsd  %xmm3,0x140(%rsp)
  movsd  0x8(%r12),%xmm0
  movapd %xmm0,%xmm3
  subsd  %xmm2,%xmm3
  movsd  %xmm3,0x148(%rsp)
  movq   D19(%rip),%xmm2
  xorpd  %xmm2,%xmm1
  movsd  %xmm1,0x150(%rsp)
  xorpd  %xmm2,%xmm0
  movsd  %xmm0,0x158(%rsp)
  lea    0x130(%rsp),%r12
  lea    0x70(%rsp),%r13
  lea    0x160(%rsp),%r14
  mov    %r12,%rbx
L165:
  movsd  0x8(%rbx),%xmm1
  movsd  (%rbx),%xmm0
  mov    $0x2,%eax
  call   <pythag2@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x0(%r13)
  add    $0x10,%rbx
  add    $0x8,%r13
  cmp    %r14,%rbx
  jne    L165
  movsd  D243(%rip),%xmm2
  movsd  0x18(%rsp),%xmm4
  movapd %xmm4,%xmm0
  mulsd  %xmm4,%xmm0
  divsd  %xmm0,%xmm2
  lea    0xd0(%rsp),%rax
  lea    0x90(%rsp),%rcx
  lea    0x100(%rsp),%rsi
  mov    %r12,%rdx
L476:
  movsd  (%rax),%xmm0
  mulsd  (%rdx),%xmm0
  movsd  0x8(%rax),%xmm1
  mulsd  0x8(%rdx),%xmm1
  addsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%rcx)
  add    $0x10,%rax
  add    $0x10,%rdx
  add    $0x8,%rcx
  cmp    %rsi,%rax
  jne    L476
  lea    0x34(%rsp),%r13
  lea    0x100(%rsp),%r15
  mov    %r15,0x28(%rsp)
  lea    0x160(%rsp),%rax
  mov    %rax,0x20(%rsp)
  mov    %rax,%r14
  mov    $0x0,%ebx
  movl   $0x0,0x8(%rsp)
  jmp    L288
L171:
  lea    0x40(%rsp),%rdi
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    $0x0,%eax
  call   <LeftTurn@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  andpd  D180(%rip),%xmm0
  mulsd  D96(%rip),%xmm0
  movq   %xmm0,%r12
  jmp    L320
L374:
  movl   $0x0,0x0(%r13)
L500:
  add    $0x1,%rbx
  add    $0x4,%r13
  add    $0x10,%r15
  add    $0x10,%r12
  add    $0x20,%r14
  cmp    $0x3,%rbx
  je     L423
L288:
  mov    %ebp,%edx
  mov    %ebx,%ecx
  sar    %cl,%edx
  lea    0x1(%rbx),%ecx
  movslq %ecx,%rax
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  lea    (%rax,%rax,2),%eax
  sub    %eax,%ecx
  mov    %ebp,%eax
  sar    %cl,%eax
  and    $0x1,%eax
  and    $0x1,%edx
  je     L231
  test   %eax,%eax
  jne    L374
L231:
  movsd  0x70(%rsp,%rbx,8),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  D243(%rip),%xmm4
  movapd %xmm4,%xmm3
  divsd  %xmm0,%xmm3
  movsd  0x90(%rsp,%rbx,8),%xmm2
  movsd  0x50(%rsp,%rbx,8),%xmm1
  movapd %xmm2,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm1
  subsd  %xmm4,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  %xmm3,%xmm0
  xorpd  D19(%rip),%xmm2
  mulsd  %xmm3,%xmm2
  movsd  %xmm2,0x10(%rsp)
  cmp    %eax,%edx
  je     L20
  movl   $0x1,0x0(%r13)
  addl   $0x1,0x8(%rsp)
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  ja     L425
  ucomisd %xmm0,%xmm1
  ja     L394
L266:
  sqrtsd %xmm0,%xmm0
L244:
  movsd  0x10(%rsp),%xmm7
  movapd %xmm7,%xmm1
  addsd  %xmm0,%xmm1
  subsd  %xmm0,%xmm7
  movapd %xmm7,%xmm2
  comisd D96(%rip),%xmm1
  jbe    L70
  movapd %xmm1,%xmm3
  subsd  D243(%rip),%xmm3
  andpd  D180(%rip),%xmm3
L261:
  comisd D96(%rip),%xmm2
  jbe    L302
  movapd %xmm2,%xmm0
  subsd  D243(%rip),%xmm0
  andpd  D180(%rip),%xmm0
L3:
  cmpnltsd %xmm3,%xmm0
  andpd  %xmm0,%xmm1
  andnpd %xmm2,%xmm0
  orpd   %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  ja     L449
  comisd D243(%rip),%xmm1
  jbe    L596
  movsd  D243(%rip),%xmm1
L596:
  movapd %xmm1,%xmm0
  mulsd  (%r12),%xmm0
  addsd  (%r15),%xmm0
  movsd  %xmm0,(%r14)
  mulsd  0x8(%r12),%xmm1
  addsd  0x8(%r15),%xmm1
  movsd  %xmm1,0x8(%r14)
  jmp    L500
L425:
  pxor   %xmm0,%xmm0
  jmp    L266
L394:
  call   <sqrt@plt>
  jmp    L244
L70:
  movapd %xmm1,%xmm3
  andpd  D180(%rip),%xmm3
  jmp    L261
L302:
  movapd %xmm2,%xmm0
  andpd  D180(%rip),%xmm0
  jmp    L3
L449:
  pxor   %xmm1,%xmm1
  jmp    L596
L20:
  pxor   %xmm1,%xmm1
  comisd %xmm0,%xmm1
  jb     L562
  movl   $0x0,0x0(%r13)
  jmp    L500
L562:
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L356
  sqrtsd %xmm0,%xmm0
L185:
  movl   $0x0,0x0(%r13)
  movsd  0x10(%rsp),%xmm5
  movapd %xmm5,%xmm1
  subsd  %xmm0,%xmm1
  comisd D167(%rip),%xmm1
  jbe    L500
  movsd  D243(%rip),%xmm2
  comisd %xmm1,%xmm2
  jbe    L500
  addsd  %xmm5,%xmm0
  comisd D167(%rip),%xmm0
  jbe    L500
  comisd %xmm0,%xmm2
  jbe    L500
  movapd %xmm1,%xmm0
  mulsd  (%r12),%xmm0
  addsd  (%r15),%xmm0
  movsd  %xmm0,(%r14)
  mulsd  0x8(%r12),%xmm1
  addsd  0x8(%r15),%xmm1
  movsd  %xmm1,0x8(%r14)
  movsd  %xmm0,0x10(%r14)
  movsd  %xmm1,0x18(%r14)
  movl   $0x2,0x0(%r13)
  addl   $0x2,0x8(%rsp)
  jmp    L500
L356:
  call   <sqrt@plt>
  jmp    L185
L423:
  cmpl   $0x0,0x8(%rsp)
  jne    L388
  mov    D167(%rip),%r12
  test   $0x8,%bpl
  je     L320
  movsd  0x18(%rsp),%xmm5
  movapd %xmm5,%xmm0
  mulsd  D106(%rip),%xmm0
  mulsd  %xmm5,%xmm0
  movq   %xmm0,%r12
L320:
  mov    0x228(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  movq   %r12,%xmm0
  add    $0x238,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L388:
  cmpl   $0x2,0x8(%rsp)
  je     L511
  mov    0x8(%rsp),%eax
  and    $0xfffffffd,%eax
  mov    D225(%rip),%r12
  cmp    $0x4,%eax
  jne    L320
  mov    $0x0,%edi
  mov    $0x0,%ebx
L529:
  lea    0x1c0(%rsp),%r11
  lea    0xb0(%rsp),%r10
  lea    0xb4(%rsp),%r9
  jmp    L98
L511:
  cmpl   $0x1,0x34(%rsp)
  jle    L172
  movl   $0x0,0x8(%rsp)
  jmp    L436
L172:
  cmpl   $0x1,0x38(%rsp)
  jle    L82
L229:
  cmpl   $0x1,0x38(%rsp)
  jg     L157
  cmpl   $0x1,0x3c(%rsp)
  mov    $0x3,%eax
  cmovg  0x8(%rsp),%eax
  mov    %eax,0x8(%rsp)
L436:
  mov    0x8(%rsp),%eax
  lea    0x2(,%rax,4),%edx
  shl    $0x2,%eax
  lea    0x1(%rdx),%esi
  movslq %esi,%rsi
  lea    0x1(%rax),%ecx
  movslq %ecx,%rcx
  movsd  0x160(%rsp,%rsi,8),%xmm1
  movslq %edx,%rdx
  cltq
  movsd  0x160(%rsp,%rdx,8),%xmm0
  subsd  0x160(%rsp,%rax,8),%xmm0
  subsd  0x160(%rsp,%rcx,8),%xmm1
  mov    $0x2,%eax
  call   <pythag2@plt>
  mov    %eax,%edi
  movsd  0x18(%rsp),%xmm0
  mov    $0x1,%eax
  call   <CircularSectorArea@plt>
  pxor   %xmm5,%xmm5
  cvtsi2sd %eax,%xmm5
  movq   %xmm5,%r12
  test   $0x8,%bpl
  je     L320
  movsd  0x18(%rsp),%xmm4
  movapd %xmm4,%xmm0
  mulsd  D106(%rip),%xmm0
  mulsd  %xmm4,%xmm0
  subsd  %xmm5,%xmm0
  movq   %xmm0,%r12
  jmp    L320
L82:
  cmpl   $0x1,0x3c(%rsp)
  jg     L229
  mov    $0x0,%edi
  mov    $0x0,%ebx
  jmp    L529
L157:
  movl   $0x1,0x8(%rsp)
  jmp    L436
L278:
  mov    0x34(%rsp,%rdi,4),%r8d
  test   %r8d,%r8d
  jle    L543
  movslq %ebx,%rsi
  mov    %rsi,%rax
  shl    $0x4,%rax
  add    %r11,%rax
  lea    (%r10,%rsi,4),%rcx
  lea    -0x1(%r8),%edx
  add    %rsi,%rdx
  lea    (%r9,%rdx,4),%rsi
  mov    0x20(%rsp),%rdx
L158:
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  movsd  0x8(%rdx),%xmm0
  movsd  %xmm0,0x8(%rax)
  movl   $0x0,(%rcx)
  add    $0x10,%rdx
  add    $0x10,%rax
  add    $0x4,%rcx
  cmp    %rsi,%rcx
  jne    L158
  add    %r8d,%ebx
L543:
  add    $0x1,%rdi
  addq   $0x10,0x28(%rsp)
  addq   $0x20,0x20(%rsp)
  cmp    $0x3,%rdi
  je     L168
L98:
  bt     %edi,%ebp
  jae    L278
  lea    (%rbx,%rbx,1),%eax
  movslq %eax,%rdx
  mov    0x28(%rsp),%rsi
  movsd  (%rsi),%xmm0
  movsd  %xmm0,0x1c0(%rsp,%rdx,8)
  add    $0x1,%eax
  cltq
  movsd  0x8(%rsi),%xmm0
  movsd  %xmm0,0x1c0(%rsp,%rax,8)
  movslq %ebx,%rax
  movl   $0x1,0xb0(%rsp,%rax,4)
  lea    0x1(%rbx),%ebx
  jmp    L278
L168:
  mov    D225(%rip),%r12
  cmp    $0x2,%ebx
  jle    L320
  lea    0x1c0(%rsp),%rsi
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <polygon_area@plt>
  pxor   %xmm4,%xmm4
  cvtsi2sd %eax,%xmm4
  movq   %xmm4,%r12
  mov    $0x0,%ebp
  lea    -0x1(%rbx),%r13d
  jmp    L85
L530:
  add    $0x1,%rbp
  cmp    %ebp,%ebx
  jle    L320
L85:
  mov    %ebp,%eax
  sub    $0x1,%eax
  cmovs  %r13d,%eax
  movslq %eax,%rdx
  cmpl   $0x0,0xb0(%rsp,%rdx,4)
  jne    L530
  cmpl   $0x0,0xb0(%rsp,%rbp,4)
  jne    L530
  mov    %rbp,%rcx
  shl    $0x4,%rcx
  add    %eax,%eax
  lea    0x1(%rax),%edx
  movslq %edx,%rdx
  movsd  0x1c8(%rsp,%rcx,1),%xmm1
  cltq
  movsd  0x1c0(%rsp,%rcx,1),%xmm0
  subsd  0x1c0(%rsp,%rax,8),%xmm0
  subsd  0x1c0(%rsp,%rdx,8),%xmm1
  mov    $0x2,%eax
  call   <pythag2@plt>
  mov    %eax,%edi
  movsd  0x18(%rsp),%xmm0
  mov    $0x1,%eax
  call   <CircularSectorArea@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movq   %r12,%xmm7
  addsd  %xmm0,%xmm7
  movq   %xmm7,%r12
  jmp    L530
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D243
type_guessed: f64[2]
name: extract_symbolic_data
arguments: label: D19
type_guessed: f32[4]
name: extract_symbolic_data
arguments: label: D180
type_guessed: qword[2]
name: extract_symbolic_data
arguments: label: D96
type_guessed: f64[2]
name: extract_symbolic_data
arguments: label: D167
type_guessed: f32[4]
name: extract_symbolic_data
arguments: label: D106
type_guessed: f64
name: extract_symbolic_data
arguments: label: D225
type_guessed: f32[2]

tool: {"D243": [1.0,-1.0]}

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

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

tool: {"D96": [0.5,3.141592653589793]}

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

tool: D106: 3.141592653589793

tool: {"D225": [0.0,-1.875]}

assistant: ```c
double intersection_area_circle_triangle(double radius, const double tri_org[2], const double tri_u[2], const double tri_v[2]) {
  const double origin[2] = {0, 0};
  int i, j;
  const double iradius = 1. / radius;
  const double iradius2 = 1. / (radius * radius);
  int inside = 0;
  double vert[6];
  vert[2 * 0 + 0] = tri_org[0];
  vert[2 * 0 + 1] = tri_org[1];
  vert[2 * 1 + 0] = (tri_org[0] + tri_u[0]);
  vert[2 * 1 + 1] = (tri_org[1] + tri_u[1]);
  vert[2 * 2 + 0] = (tri_org[0] + tri_v[0]);
  vert[2 * 2 + 1] = (tri_org[1] + tri_v[1]);
  double vert_org[6];
  vert_org[2 * 0 + 0] = 0;
  vert_org[2 * 0 + 1] = 0;
  vert_org[2 * 1 + 0] = tri_u[0];
  vert_org[2 * 1 + 1] = tri_u[1];
  vert_org[2 * 2 + 0] = tri_v[0];
  vert_org[2 * 2 + 1] = tri_v[1];
  double tri_r[3];
  for (i = 0; i < 3; ++i) {
    tri_r[i] = pythag2(vert[2 * i + 0], vert[2 * i + 1]) * iradius;
    if (tri_r[i] <= 1.0) {
      inside |= (1 << i);
    }
  }
  if (TriangleContainsPoint(tri_org, tri_u, tri_v, origin)) {
    inside |= (1 << 3);
  }
  if ((inside & 0x7) == 0x7) {
    return 0.5 * fabs(LeftTurn(origin, tri_u, tri_v));
  }
  double seg[6];
  seg[2 * 0 + 0] = tri_u[0];
  seg[2 * 0 + 1] = tri_u[1];
  seg[2 * 1 + 0] = (tri_v[0] - tri_u[0]);
  seg[2 * 1 + 1] = (tri_v[1] - tri_u[1]);
  seg[2 * 2 + 0] = -tri_v[0];
  seg[2 * 2 + 1] = -tri_v[1];
  double side_length[3];
  for (i = 0; i < 3; ++i) {
    side_length[i] = pythag2(seg[2 * i + 0], seg[2 * i + 1]) * iradius;
  }
  double seg_dot[3];
  for (i = 0; i < 3; ++i) {
    seg_dot[i] = (vert[2 * i + 0] * seg[2 * i + 0] + vert[2 * i + 1] * seg[2 * i + 1]) * iradius2;
  }
  double xp[12];
  int nxp[3];
  int nx = 0;
  for (i = 0; i < 3; ++i) {
    int ip1 = (i + 1) % 3;
    int in0 = (inside & (1 << i)) ? 1 : 0;
    int in1 = (inside & (1 << ip1)) ? 1 : 0;
    if (in0 && in1) {
      nxp[i] = 0;
    } else {
      double isl2 = 1. / (side_length[i] * side_length[i]);
      double disc = (seg_dot[i] * seg_dot[i] * isl2 - (tri_r[i] * tri_r[i] - 1)) * isl2;
      double t0 = -seg_dot[i] * isl2;
      double t, t2, tdist, t2dist;
      if (in0 != in1) {
        nxp[i] = 1;
        nx += 1;
        if (disc < 0) {
          disc = 0;
        }
        disc = sqrt(disc);
        t = t0 + disc;
        t2 = t0 - disc;
        if (t > 0.5) {
          tdist = fabs(t - 1.);
        } else {
          tdist = fabs(t);
        }
        if (t2 > 0.5) {
          t2dist = fabs(t2 - 1.);
        } else {
          t2dist = fabs(t2);
        }
        if (t2dist < tdist) {
          t = t2;
        }
        if (t < 0) {
          t = 0;
        }
        if (t > 1) {
          t = 1;
        }
        xp[2 * 2 * i + 0] = vert_org[2 * i + 0] + t * seg[2 * i + 0];
        xp[2 * 2 * i + 1] = vert_org[2 * i + 1] + t * seg[2 * i + 1];
      } else {
        if (disc <= 0) {
          nxp[i] = 0;
        } else {
          disc = sqrt(disc);
          nxp[i] = 0;
          t = t0 - disc;
          t2 = t0 + disc;
          if (0 < t && t < 1 && 0 < t2 && t2 < 1) {
            xp[2 * (2 * i + 0) + 0] = vert_org[2 * i + 0] + t * seg[2 * i + 0];
            xp[2 * (2 * i + 0) + 1] = vert_org[2 * i + 1] + t * seg[2 * i + 1];
            xp[2 * (2 * i + 1) + 0] = vert_org[2 * i + 0] + t * seg[2 * i + 0];
            xp[2 * (2 * i + 1) + 1] = vert_org[2 * i + 1] + t * seg[2 * i + 1];
            nxp[i] += 2;
            nx += 2;
          }
        }
      }
    }
  }
  if (0 == nx) {
    if ((inside & 0x7) == 0x7) {
      return -1;
    } else {
      if (inside & 0x8) {
        return 3.14159265358979323846 * radius * radius;
      } else {
        return 0;
      }
    }
  } else if (2 == nx) {
    if (nxp[0] < 2 && nxp[1] < 2 && nxp[2] < 2) {
    } else {
      for (i = 0; i < 3; ++i) {
        if (nxp[i] > 1) {
          break;
        }
      }
      double sector_area = CircularSectorArea(radius, pythag2(xp[2 * (2 * i + 1) + 0] - xp[2 * 2 * i + 0], xp[2 * (2 * i + 1) + 1] - xp[2 * 2 * i + 1]));
      if (inside & (1 << 3)) {
        return 3.14159265358979323846 * radius * radius - sector_area;
      } else {
        return sector_area;
      }
    }
  } else if (4 == nx) {
  } else if (6 == nx) {
  } else {
    return -1;
  }
  int vtype[6];
  double vp[12];
  int nv = 0;
  for (i = 0; i < 3; ++i) {
    if (inside & (1 << i)) {
      vp[2 * nv + 0] = vert_org[2 * i + 0];
      vp[2 * nv + 1] = vert_org[2 * i + 1];
      vtype[nv++] = 1;
    }
    for (j = 0; j < nxp[i]; ++j) {
      vp[2 * nv + 0] = xp[2 * (2 * i + j) + 0];
      vp[2 * nv + 1] = xp[2 * (2 * i + j) + 1];
      vtype[nv++] = 0;
    }
  }
  if (nv < 3) {
    return -1;
  }
  double area = polygon_area(nv, vp);
  for (i = 0; i < nv; ++i) {
    int im1 = i - 1;
    if (im1 < 0) {
      im1 = nv - 1;
    }
    if ((0 == vtype[im1]) && (0 == vtype[i])) {
      area += CircularSectorArea(radius, pythag2(vp[2 * i + 0] - vp[2 * im1 + 0], vp[2 * i + 1] - vp[2 * im1 + 1]));
    }
  }
  return area;
}
```