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

```asm
<fit_ellipse>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x2b8,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbx
  mov    %edx,%r13d
  mov    %rcx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x2a8(%rsp)
  xor    %eax,%eax
  test   %edx,%edx
  jle    L43
L82:
  test   %r12,%r12
  je     L37
L49:
  test   %rbx,%rbx
  je     L123
L56:
  test   %rbp,%rbp
  je     L94
L23:
  lea    0x180(%rsp),%rax
  lea    0x2a0(%rsp),%rdx
L87:
  movq   $0x0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L87
  lea    0x0(,%r13,4),%r10d
  mov    %r12,%r9
  lea    -0x1(%r10),%eax
  lea    (%rax,%rax,2),%rax
  shl    $0x4,%rax
  lea    0x30(%r12,%rax,1),%rcx
  mov    $0x0,%r8d
  mov    $0x0,%r11d
L8:
  mov    %r11,%rdx
  neg    %rdx
  mov    $0x0,%edi
L46:
  test   %r10d,%r10d
  jle    L9
  lea    (%rdi,%r8,1),%esi
  movslq %esi,%rax
  movsd  0x180(%rsp,%rax,8),%xmm1
  mov    %r9,%rax
L42:
  movsd  (%rax),%xmm0
  mulsd  (%rax,%rdx,8),%xmm0
  addsd  %xmm0,%xmm1
  add    $0x30,%rax
  cmp    %rcx,%rax
  jne    L42
  movslq %esi,%rsi
  movsd  %xmm1,0x180(%rsp,%rsi,8)
L9:
  add    $0x1,%edi
  add    $0x1,%rdx
  cmp    $0x6,%edi
  jne    L46
  add    $0x1,%r11
  add    $0x8,%r9
  add    $0x8,%rcx
  add    $0x6,%r8d
  cmp    $0x6,%r11
  jne    L8
  movb   $0x56,0x2e(%rsp)
  movb   $0x55,0x2f(%rsp)
  movl   $0x6,0x30(%rsp)
  movl   $0x6,0x34(%rsp)
  movl   $0x18,0x38(%rsp)
  lea    0x180(%rsp),%rcx
  lea    0x30(%rsp),%rdx
  lea    0x2f(%rsp),%rsi
  lea    0x2e(%rsp),%rdi
  sub    $0x8,%rsp
  lea    0x44(%rsp),%rax
  push   %rax
  lea    0x48(%rsp),%rax
  push   %rax
  lea    0xd8(%rsp),%rax
  push   %rax
  lea    0x60(%rsp),%r9
  lea    0x54(%rsp),%r8
  call   <dsyev_@plt>
  movsd  0x1a0(%rsp),%xmm10
  movsd  0x1a8(%rsp),%xmm7
  movsd  0x1b8(%rsp),%xmm9
  movsd  (%rbx),%xmm5
  movsd  0x18(%rbx),%xmm8
  movapd %xmm5,%xmm1
  mulsd  %xmm8,%xmm1
  mulsd  %xmm7,%xmm1
  movapd %xmm5,%xmm0
  mulsd  %xmm5,%xmm0
  mulsd  %xmm10,%xmm0
  addsd  %xmm1,%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm8,%xmm1
  mulsd  %xmm8,%xmm1
  mulsd  %xmm9,%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0x90(%rsp)
  movsd  0x8(%rbx),%xmm4
  movapd %xmm5,%xmm6
  mulsd  %xmm4,%xmm6
  movapd %xmm6,%xmm2
  mulsd  %xmm10,%xmm2
  movapd %xmm8,%xmm14
  mulsd  %xmm4,%xmm14
  mulsd  %xmm7,%xmm14
  movsd  0x20(%rbx),%xmm3
  movapd %xmm5,%xmm15
  mulsd  %xmm3,%xmm15
  mulsd  %xmm7,%xmm15
  movapd %xmm8,%xmm13
  mulsd  %xmm3,%xmm13
  mulsd  %xmm9,%xmm13
  movsd  %xmm2,0x30(%rsp)
  movapd %xmm2,%xmm6
  addsd  %xmm14,%xmm6
  movapd %xmm6,%xmm0
  addsd  %xmm15,%xmm0
  addsd  %xmm13,%xmm0
  movsd  %xmm0,0x98(%rsp)
  movsd  0x10(%rbx),%xmm0
  movapd %xmm5,%xmm1
  mulsd  %xmm0,%xmm1
  mulsd  %xmm10,%xmm1
  movapd %xmm8,%xmm11
  mulsd  %xmm0,%xmm11
  mulsd  %xmm7,%xmm11
  movsd  0x28(%rbx),%xmm2
  movapd %xmm5,%xmm12
  mulsd  %xmm2,%xmm12
  mulsd  %xmm7,%xmm12
  movapd %xmm8,%xmm6
  mulsd  %xmm2,%xmm6
  mulsd  %xmm9,%xmm6
  mulsd  0x1b0(%rsp),%xmm5
  mulsd  0x1c0(%rsp),%xmm8
  movsd  %xmm8,0x28(%rsp)
  movapd %xmm1,%xmm8
  addsd  %xmm11,%xmm8
  addsd  %xmm12,%xmm8
  movsd  %xmm6,0x38(%rsp)
  addsd  %xmm6,%xmm8
  addsd  %xmm5,%xmm8
  addsd  0x28(%rsp),%xmm8
  movsd  %xmm8,0xa0(%rsp)
  movsd  0x30(%rsp),%xmm6
  addsd  %xmm15,%xmm6
  addsd  %xmm14,%xmm6
  addsd  %xmm13,%xmm6
  movsd  %xmm6,0xa8(%rsp)
  movapd %xmm4,%xmm8
  mulsd  %xmm3,%xmm8
  mulsd  %xmm7,%xmm8
  movapd %xmm4,%xmm13
  mulsd  %xmm4,%xmm13
  movapd %xmm13,%xmm6
  mulsd  %xmm10,%xmm6
  addsd  %xmm8,%xmm6
  addsd  %xmm8,%xmm6
  movapd %xmm3,%xmm8
  mulsd  %xmm3,%xmm8
  mulsd  %xmm9,%xmm8
  addsd  %xmm8,%xmm6
  movsd  %xmm6,0xb0(%rsp)
  movapd %xmm4,%xmm14
  mulsd  %xmm0,%xmm14
  movapd %xmm14,%xmm6
  mulsd  %xmm10,%xmm6
  movapd %xmm3,%xmm13
  mulsd  %xmm0,%xmm13
  mulsd  %xmm7,%xmm13
  movapd %xmm4,%xmm14
  mulsd  %xmm2,%xmm14
  mulsd  %xmm7,%xmm14
  movapd %xmm3,%xmm8
  mulsd  %xmm2,%xmm8
  mulsd  %xmm9,%xmm8
  mulsd  0x1b0(%rsp),%xmm4
  mulsd  0x1c0(%rsp),%xmm3
  movapd %xmm6,%xmm15
  addsd  %xmm13,%xmm15
  addsd  %xmm14,%xmm15
  addsd  %xmm8,%xmm15
  addsd  %xmm4,%xmm15
  addsd  %xmm3,%xmm15
  movsd  %xmm15,0xb8(%rsp)
  addsd  %xmm12,%xmm1
  addsd  %xmm5,%xmm1
  addsd  %xmm11,%xmm1
  addsd  0x38(%rsp),%xmm1
  addsd  0x28(%rsp),%xmm1
  movsd  %xmm1,0xc0(%rsp)
  addsd  %xmm14,%xmm6
  movapd %xmm6,%xmm1
  addsd  %xmm4,%xmm1
  addsd  %xmm13,%xmm1
  addsd  %xmm8,%xmm1
  addsd  %xmm3,%xmm1
  movsd  %xmm1,0xc8(%rsp)
  movapd %xmm0,%xmm5
  mulsd  %xmm2,%xmm5
  mulsd  %xmm7,%xmm5
  movapd %xmm0,%xmm4
  mulsd  0x1b0(%rsp),%xmm4
  movapd %xmm2,%xmm3
  mulsd  0x1c0(%rsp),%xmm3
  mulsd  %xmm0,%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm10,%xmm1
  addsd  %xmm5,%xmm1
  addsd  %xmm4,%xmm1
  addsd  %xmm5,%xmm1
  mulsd  %xmm2,%xmm2
  mulsd  %xmm9,%xmm2
  addsd  %xmm2,%xmm1
  movapd %xmm1,%xmm0
  addsd  %xmm3,%xmm0
  addsd  %xmm4,%xmm0
  addsd  %xmm3,%xmm0
  addsd  0x1c8(%rsp),%xmm0
  movsd  %xmm0,0xd0(%rsp)
  add    $0x20,%rsp
  lea    0x70(%rsp),%rdi
  mov    %rbp,%rsi
  call   <ellipse2param@plt>
  mov    0x2a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L86
  add    $0x2b8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L43:
  lea    D39(%rip),%rdi
  call   <error@plt>
  jmp    L82
L37:
  lea    D8(%rip),%rdi
  call   <error@plt>
  jmp    L49
L123:
  lea    D10(%rip),%rdi
  call   <error@plt>
  jmp    L56
L94:
  lea    D14(%rip),%rdi
  call   <error@plt>
  jmp    L23
L86:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D39
datatype: string
name: extract_symbolic_data
arguments: label: D8
datatype: string
name: extract_symbolic_data
arguments: label: D10
datatype: string
name: extract_symbolic_data
arguments: label: D14
datatype: string

tool: D39: fit_ellipse: invalid size.

tool: D8: fit_ellipse: invalid buffer.

tool: D10: fit_ellipse: invalid normalization matrix.

tool: D14: fit_ellipse: param must be non null.

assistant: ```c
void fit_ellipse(double *eq, double *vgg, int pts_size, double *param) {
  int i, j, k;
  double A[36];
  if (pts_size <= 0)
    error("fit_ellipse: invalid size.");
  if (eq == NULL)
    error("fit_ellipse: invalid buffer.");
  if (vgg == NULL)
    error("fit_ellipse: invalid normalization matrix.");
  if (param == NULL)
    error("fit_ellipse: param must be non null.");
  for (i = 0; i < 36; i++)
    A[i] = 0.0;
  for (i = 0; i < 6; i++)
    for (j = 0; j < 6; j++)
      for (k = 0; k < 4 * pts_size; k++)
        A[i * 6 + j] += eq[k * 6 + i] * eq[k * 6 + j];
  char JOBZ = 'V';
  char UPLO = 'U';
  int M = 6;
  int LDA = M;
  int LWORK = 4 * 6;
  int INFO;
  double W[6];
  double WORK[LWORK];
  dsyev_(&JOBZ, &UPLO, &M, A, &LDA, W, WORK, &LWORK, &INFO);
  double s[9];
  s[0] = A[0];
  s[1] = s[3] = A[1];
  s[2] = s[6] = A[2];
  s[4] = A[3];
  s[5] = s[7] = A[4];
  s[8] = A[5];
  double C[9];
  C[0] = vgg[0] * vgg[0] * s[0] + vgg[0] * vgg[3] * s[3] + vgg[0] * vgg[3] * s[1] + vgg[3] * vgg[3] * s[4];
  C[1] = vgg[0] * vgg[1] * s[0] + vgg[1] * vgg[3] * s[3] + vgg[0] * vgg[4] * s[1] + vgg[3] * vgg[4] * s[4];
  C[2] = vgg[0] * vgg[2] * s[0] + vgg[2] * vgg[3] * s[3] + vgg[0] * vgg[5] * s[1] + vgg[3] * vgg[5] * s[4] + vgg[0] * s[2] + vgg[3] * s[5];
  C[3] = vgg[0] * vgg[1] * s[0] + vgg[0] * vgg[4] * s[3] + vgg[1] * vgg[3] * s[1] + vgg[3] * vgg[4] * s[4];
  C[4] = vgg[1] * vgg[1] * s[0] + vgg[1] * vgg[4] * s[3] + vgg[1] * vgg[4] * s[1] + vgg[4] * vgg[4] * s[4];
  C[5] = vgg[1] * vgg[2] * s[0] + vgg[2] * vgg[4] * s[3] + vgg[1] * vgg[5] * s[1] + vgg[4] * vgg[5] * s[4] + vgg[1] * s[2] + vgg[4] * s[5];
  C[6] = vgg[0] * vgg[2] * s[0] + vgg[0] * vgg[5] * s[3] + vgg[0] * s[6] + vgg[2] * vgg[3] * s[1] + vgg[3] * vgg[5] * s[4] + vgg[3] * s[7];
  C[7] = vgg[1] * vgg[2] * s[0] + vgg[1] * vgg[5] * s[3] + vgg[1] * s[6] + vgg[2] * vgg[4] * s[1] + vgg[4] * vgg[5] * s[4] + vgg[4] * s[7];
  C[8] = vgg[2] * vgg[2] * s[0] + vgg[2] * vgg[5] * s[3] + vgg[2] * s[6] + vgg[2] * vgg[5] * s[1] + vgg[5] * vgg[5] * s[4] + vgg[5] * s[7] + vgg[2] * s[2] + vgg[5] * s[5] + s[8];
  ellipse2param(C, param);
}
```