user: Please show me the C implementation that matches the assembly code listed below:

```asm
<DrawSector>:
  endbr64
  push   %r15
  mov    %r9d,%eax
  pxor   %xmm3,%xmm3
  mov    %esi,%r15d
  push   %r14
  sub    %ecx,%eax
  mov    %rdi,%r14
  pxor   %xmm5,%xmm5
  push   %r13
  cvtsi2sd %eax,%xmm3
  mov    %r8d,%eax
  mov    %edx,%r13d
  push   %r12
  pxor   %xmm2,%xmm2
  pxor   %xmm4,%xmm4
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %r8d,%ebx
  movapd %xmm3,%xmm1
  sub    $0x48,%rsp
  mov    0x80(%rsp),%edi
  mov    0x88(%rsp),%esi
  mov    %r9d,0x18(%rsp)
  mov    0x90(%rsp),%edx
  movsd  %xmm3,0x38(%rsp)
  sub    %edi,%eax
  mov    %edi,0x1c(%rsp)
  cvtsi2sd %eax,%xmm5
  mov    %esi,%eax
  mov    %esi,0x20(%rsp)
  sub    %ecx,%eax
  mov    %edx,0x24(%rsp)
  cvtsi2sd %eax,%xmm2
  mov    %r8d,%eax
  sub    %edx,%eax
  cvtsi2sd %eax,%xmm4
  movapd %xmm5,%xmm0
  movsd  %xmm5,0x30(%rsp)
  movsd  %xmm2,0x28(%rsp)
  movsd  %xmm4,0x8(%rsp)
  call   <atan2@plt>
  movsd  0x28(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm4
  movsd  %xmm0,0x10(%rsp)
  movapd %xmm2,%xmm1
  movapd %xmm4,%xmm0
  call   <atan2@plt>
  movsd  0x10(%rsp),%xmm7
  movsd  D5(%rip),%xmm6
  movapd %xmm0,%xmm1
  movsd  0x38(%rsp),%xmm3
  movsd  0x30(%rsp),%xmm5
  movapd %xmm7,%xmm0
  movsd  0x8(%rsp),%xmm4
  movsd  0x28(%rsp),%xmm2
  mulsd  %xmm6,%xmm0
  mulsd  %xmm5,%xmm5
  mulsd  %xmm3,%xmm3
  cvttsd2si %xmm0,%r11d
  movapd %xmm1,%xmm0
  subsd  %xmm7,%xmm0
  addsd  %xmm5,%xmm3
  pxor   %xmm5,%xmm5
  mulsd  %xmm6,%xmm0
  cvttsd2si %xmm0,%r12d
  test   %r12d,%r12d
  lea    0x5a00(%r12),%eax
  cmovs  %eax,%r12d
  ucomisd %xmm3,%xmm5
  ja     L4
  sqrtsd %xmm3,%xmm3
L11:
  mulsd  %xmm2,%xmm2
  mulsd  %xmm4,%xmm4
  addsd  %xmm4,%xmm2
  ucomisd %xmm2,%xmm5
  ja     L18
  sqrtsd %xmm2,%xmm2
L35:
  cvttsd2si %xmm2,%eax
  movsd  %xmm1,0x38(%rsp)
  sub    $0x8,%rsp
  mov    %ebp,%ecx
  cvttsd2si %xmm3,%r10d
  mov    %ebx,%r8d
  mov    %r13d,%edx
  mov    %r15d,%esi
  mov    %r14,%rdi
  mov    %eax,0x10(%rsp)
  push   %r12
  lea    (%r10,%r10,1),%r9d
  sub    %r10d,%ecx
  sub    %r10d,%r8d
  push   %r11
  mov    %r11d,0x48(%rsp)
  push   %r9
  mov    %r10d,0x48(%rsp)
  call   <XDrawArc@plt>
  mov    0x28(%rsp),%eax
  add    $0x18,%rsp
  mov    %ebp,%ecx
  push   %r12
  mov    0x40(%rsp),%r11d
  mov    %ebx,%r8d
  mov    %r13d,%edx
  lea    (%rax,%rax,1),%r9d
  mov    %r15d,%esi
  mov    %r14,%rdi
  sub    %eax,%ecx
  push   %r11
  sub    %eax,%r8d
  push   %r9
  mov    %eax,0x28(%rsp)
  call   <XDrawArc@plt>
  movsd  0x58(%rsp),%xmm1
  add    $0x20,%rsp
  movapd %xmm1,%xmm0
  movsd  %xmm1,0x30(%rsp)
  call   <cos@plt>
  mov    0x28(%rsp),%r10d
  movsd  0x30(%rsp),%xmm1
  imul   %r10d,%eax
  movapd %xmm1,%xmm0
  lea    (%rax,%rbp,1),%r12d
  call   <sin@plt>
  mov    0x28(%rsp),%r10d
  mov    %ebx,%r8d
  mov    %r12d,%ecx
  sub    $0x8,%rsp
  mov    %r13d,%edx
  mov    %r14,%rdi
  mov    0x2c(%rsp),%esi
  imul   %r10d,%eax
  push   %rsi
  mov    0x30(%rsp),%r9d
  mov    %r15d,%esi
  sub    %eax,%r8d
  call   <XDrawLine@plt>
  movsd  0x20(%rsp),%xmm0
  call   <cos@plt>
  imul   0x18(%rsp),%eax
  movsd  0x20(%rsp),%xmm0
  lea    (%rax,%rbp,1),%r12d
  call   <sin@plt>
  imul   0x18(%rsp),%eax
  mov    %r12d,%ecx
  mov    %r13d,%edx
  mov    0x2c(%rsp),%edi
  mov    0x28(%rsp),%r9d
  mov    %r15d,%esi
  mov    %edi,0x90(%rsp)
  sub    %eax,%ebx
  add    $0x58,%rsp
  mov    %r14,%rdi
  mov    %ebx,%r8d
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10f0 <XDrawLine@plt>
L4:
  movapd %xmm3,%xmm0
  mov    %r11d,0x38(%rsp)
  movsd  %xmm1,0x30(%rsp)
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm2,0x8(%rsp)
  call   <sqrt@plt>
  mov    0x38(%rsp),%r11d
  pxor   %xmm5,%xmm5
  movsd  0x30(%rsp),%xmm1
  movsd  0x28(%rsp),%xmm4
  movsd  0x8(%rsp),%xmm2
  movapd %xmm0,%xmm3
  jmp    L11
L18:
  movapd %xmm2,%xmm0
  mov    %r11d,0x28(%rsp)
  movsd  %xmm3,0x30(%rsp)
  movsd  %xmm1,0x8(%rsp)
  call   <sqrt@plt>
  movsd  0x30(%rsp),%xmm3
  mov    0x28(%rsp),%r11d
  movsd  0x8(%rsp),%xmm1
  movapd %xmm0,%xmm2
  jmp    L35
```

tool_calls: name: unpack_data
arguments: tag: D5
type_guessed: byte[8]

tool: {"D5": [0x00,0x00,0x00,0x00,0x00,0xa4,0xac,0x40]}

assistant: ```c
void DrawSector(Display *display, Window window, GC gc, int xcen, int ycen, int x1, int y1, int x2, int y2) {
  static double rtod = 3.66692988883e+03;
  double r1, phi1, r2, phi2, dx1, dy1, dx2, dy2;
  int ir1, ir2, ip1, ip2, xc, yc;
  dx1 = (double)(x1 - xcen);
  dy1 = (double)(ycen - y1);
  dx2 = (double)(x2 - xcen);
  dy2 = (double)(ycen - y2);
  phi1 = atan2(dy1, dx1);
  phi2 = atan2(dy2, dx2);
  ip1 = (int)rtod * phi1;
  ip2 = (int)rtod * (phi2 - phi1);
  if (ip2 < 0)
    ip2 += 23040;
  r1 = sqrt(dx1 * dx1 + dy1 * dy1);
  r2 = sqrt(dx2 * dx2 + dy2 * dy2);
  ir1 = (int)r1;
  ir2 = (int)r2;
  XDrawArc(display, window, gc, (xcen - ir1), (ycen - ir1), (2 * ir1), (2 * ir1), ip1, ip2);
  XDrawArc(display, window, gc, (xcen - ir2), (ycen - ir2), (2 * ir2), (2 * ir2), ip1, ip2);
  xc = xcen + (int)r1 * cos(phi2);
  yc = ycen - (int)r1 * sin(phi2);
  XDrawLine(display, window, gc, xc, yc, x2, y2);
  xc = xcen + (int)r2 * cos(phi1);
  yc = ycen - (int)r2 * sin(phi1);
  XDrawLine(display, window, gc, xc, yc, x1, y1);
}
```