user: 请从给定的汇编指令推导出C源代码:

```asm
<local_ths>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xa0,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %rdx,-0x88(%rbp)
  mov    %ecx,-0x8c(%rbp)
  mov    %r8d,-0x90(%rbp)
  mov    $0x1,%eax
  sub    -0x90(%rbp),%eax
  mov    %eax,-0x64(%rbp)
  jmp    L54
L43:
  mov    -0x64(%rbp),%edx
  mov    -0x8c(%rbp),%eax
  add    %edx,%eax
  sub    $0x1,%eax
  cltd
  idivl  -0x8c(%rbp)
  mov    %edx,-0x60(%rbp)
  mov    -0x60(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x58(%rbp)
  mov    -0x60(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x50(%rbp)
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x48(%rbp)
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x40(%rbp)
  mov    -0x64(%rbp),%eax
  add    $0x1,%eax
  cltd
  idivl  -0x8c(%rbp)
  mov    %edx,-0x5c(%rbp)
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  movsd  -0x38(%rbp),%xmm0
  subsd  -0x58(%rbp),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x30(%rbp),%xmm0
  subsd  -0x50(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movsd  -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x20(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x48(%rbp),%xmm0
  subsd  -0x58(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x28(%rbp),%xmm1
  movsd  -0x40(%rbp),%xmm0
  subsd  -0x50(%rbp),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  divsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x40(%rbp),%xmm0
  subsd  -0x50(%rbp),%xmm0
  mulsd  -0x28(%rbp),%xmm0
  movsd  -0x48(%rbp),%xmm1
  subsd  -0x58(%rbp),%xmm1
  mulsd  -0x20(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  divsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  pxor   %xmm0,%xmm0
  ucomisd -0x28(%rbp),%xmm0
  jp     L48
  pxor   %xmm0,%xmm0
  ucomisd -0x28(%rbp),%xmm0
  jne    L48
  pxor   %xmm0,%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jp     L48
  pxor   %xmm0,%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jne    L48
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L66
L48:
  movsd  -0x8(%rbp),%xmm0
  mov    -0x10(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fit_arc@plt>
  movsd  %xmm0,-0x98(%rbp)
  movsd  -0x28(%rbp),%xmm0
  mov    -0x20(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <atan2@plt>
  mov    -0x64(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  addsd  -0x98(%rbp),%xmm0
  movsd  %xmm0,(%rax)
L66:
  addl   $0x1,-0x64(%rbp)
L54:
  mov    -0x8c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x90(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x64(%rbp)
  jl     L43
  nop
  nop
  leave
  ret
```

assistant: ```c
void local_ths(const double xs[], const double ys[], double ths[], int n, int closed) {
  int i;
  for (i = 1 - closed; i < n - 1 + closed; i++) {
    int im1 = (i + n - 1) % n;
    double x0 = xs[im1];
    double y0 = ys[im1];
    double x1 = xs[i];
    double y1 = ys[i];
    int ip1 = (i + 1) % n;
    double x2 = xs[ip1];
    double y2 = ys[ip1];
    double dx = x2 - x0;
    double dy = y2 - y0;
    double ir2 = dx * dx + dy * dy;
    double x = ((x1 - x0) * dx + (y1 - y0) * dy) / ir2;
    double y = ((y1 - y0) * dx - (x1 - x0) * dy) / ir2;
    if (dx == 0.0 && dy == 0.0)
      ths[i] = 0.0;
    else
      ths[i] = fit_arc(x, y) + atan2(dy, dx);
  }
}
```