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

```asm
<fit_ellipse>:
  endbr64
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x2b8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x2a8(%rsp)
  xor    %eax,%eax
  test   %edx,%edx
  jle    L36
  test   %r12,%r12
  je     L99
L55:
  test   %rbx,%rbx
  je     L49
L116:
  test   %rbp,%rbp
  je     L124
L29:
  lea    0x180(%rsp),%r10
  xor    %eax,%eax
  mov    %r12,%r8
  xor    %r9d,%r9d
  mov    $0x24,%ecx
  mov    %r10,%rdi
  shl    $0x2,%r13d
  xor    %r11d,%r11d
  rep stos %rax,%es:(%rdi)
  lea    -0x1(%r13),%eax
  lea    (%rax,%rax,2),%rax
  shl    $0x4,%rax
  lea    0x30(%r12,%rax,1),%rcx
  cs nopw 0x0(%rax,%rax,1)
L65:
  mov    %r11,%rdx
  xor    %edi,%edi
  neg    %rdx
  nopl   0x0(%rax,%rax,1)
L5:
  test   %r13d,%r13d
  jle    L6
  lea    (%rdi,%r9,1),%esi
  mov    %r8,%rax
  movslq %esi,%rsi
  movsd  0x180(%rsp,%rsi,8),%xmm1
  nopl   0x0(%rax,%rax,1)
L60:
  movsd  (%rax),%xmm0
  mulsd  (%rax,%rdx,8),%xmm0
  add    $0x30,%rax
  addsd  %xmm0,%xmm1
  cmp    %rcx,%rax
  jne    L60
  movsd  %xmm1,0x180(%rsp,%rsi,8)
L6:
  add    $0x1,%edi
  add    $0x1,%rdx
  cmp    $0x6,%edi
  jne    L5
  add    $0x1,%r11
  add    $0x8,%r8
  add    $0x8,%rcx
  add    $0x6,%r9d
  cmp    $0x6,%r11
  jne    L65
  movb   $0x56,0x2e(%rsp)
  lea    0x2f(%rsp),%rsi
  lea    0x2e(%rsp),%rdi
  mov    %r10,%rcx
  movb   $0x55,0x2f(%rsp)
  lea    0x30(%rsp),%rdx
  sub    $0x8,%rsp
  movl   $0x6,0x38(%rsp)
  movl   $0x6,0x3c(%rsp)
  movl   $0x18,0x40(%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  (%rbx),%xmm5
  movsd  0x18(%rbx),%xmm8
  mov    %rbp,%rsi
  movsd  0x1a8(%rsp),%xmm7
  movsd  0x8(%rbx),%xmm4
  movapd %xmm5,%xmm1
  movapd %xmm5,%xmm0
  movapd %xmm5,%xmm6
  movsd  0x1a0(%rsp),%xmm10
  mulsd  %xmm8,%xmm1
  movapd %xmm8,%xmm14
  movsd  0x20(%rbx),%xmm3
  movsd  0x1b8(%rsp),%xmm9
  mulsd  %xmm5,%xmm0
  movapd %xmm5,%xmm15
  movapd %xmm8,%xmm13
  mulsd  %xmm4,%xmm6
  movapd %xmm8,%xmm11
  movapd %xmm5,%xmm12
  mulsd  %xmm4,%xmm14
  mulsd  %xmm3,%xmm15
  mulsd  %xmm7,%xmm1
  mulsd  %xmm10,%xmm0
  mulsd  %xmm3,%xmm13
  movapd %xmm6,%xmm2
  mulsd  %xmm10,%xmm2
  mulsd  %xmm7,%xmm14
  mulsd  %xmm7,%xmm15
  addsd  %xmm1,%xmm0
  mulsd  %xmm9,%xmm13
  movapd %xmm2,%xmm6
  movsd  %xmm2,0x30(%rsp)
  movsd  0x28(%rbx),%xmm2
  addsd  %xmm1,%xmm0
  movapd %xmm8,%xmm1
  addsd  %xmm14,%xmm6
  mulsd  %xmm8,%xmm1
  mulsd  %xmm2,%xmm12
  mulsd  %xmm9,%xmm1
  mulsd  %xmm7,%xmm12
  addsd  %xmm1,%xmm0
  movapd %xmm5,%xmm1
  mulsd  0x1b0(%rsp),%xmm5
  movsd  %xmm0,0x90(%rsp)
  movapd %xmm6,%xmm0
  movapd %xmm8,%xmm6
  addsd  %xmm15,%xmm0
  mulsd  %xmm2,%xmm6
  mulsd  0x1c0(%rsp),%xmm8
  addsd  %xmm13,%xmm0
  mulsd  %xmm9,%xmm6
  movsd  %xmm0,0x98(%rsp)
  movsd  0x10(%rbx),%xmm0
  movsd  %xmm8,0x28(%rsp)
  mulsd  %xmm0,%xmm1
  mulsd  %xmm0,%xmm11
  movsd  %xmm6,0x38(%rsp)
  mulsd  %xmm10,%xmm1
  mulsd  %xmm7,%xmm11
  movapd %xmm1,%xmm8
  addsd  %xmm12,%xmm1
  addsd  %xmm11,%xmm8
  addsd  %xmm5,%xmm1
  addsd  %xmm12,%xmm8
  addsd  %xmm11,%xmm1
  addsd  0x38(%rsp),%xmm1
  addsd  %xmm6,%xmm8
  movsd  0x30(%rsp),%xmm6
  addsd  0x28(%rsp),%xmm1
  addsd  %xmm15,%xmm6
  movsd  %xmm1,0xc0(%rsp)
  addsd  %xmm5,%xmm8
  addsd  0x28(%rsp),%xmm8
  movapd %xmm0,%xmm5
  mulsd  %xmm2,%xmm5
  addsd  %xmm14,%xmm6
  movapd %xmm4,%xmm14
  movsd  %xmm8,0xa0(%rsp)
  movapd %xmm4,%xmm8
  mulsd  %xmm3,%xmm8
  addsd  %xmm13,%xmm6
  mulsd  %xmm0,%xmm14
  movapd %xmm4,%xmm13
  mulsd  %xmm4,%xmm13
  mulsd  %xmm7,%xmm5
  movsd  %xmm6,0xa8(%rsp)
  mulsd  %xmm7,%xmm8
  movapd %xmm13,%xmm6
  movapd %xmm3,%xmm13
  mulsd  %xmm10,%xmm6
  mulsd  %xmm0,%xmm13
  addsd  %xmm8,%xmm6
  mulsd  %xmm7,%xmm13
  addsd  %xmm8,%xmm6
  movapd %xmm3,%xmm8
  mulsd  %xmm3,%xmm8
  mulsd  %xmm9,%xmm8
  addsd  %xmm8,%xmm6
  movapd %xmm3,%xmm8
  mulsd  %xmm2,%xmm8
  mulsd  0x1c0(%rsp),%xmm3
  movsd  %xmm6,0xb0(%rsp)
  movapd %xmm14,%xmm6
  movapd %xmm4,%xmm14
  mulsd  %xmm2,%xmm14
  mulsd  %xmm10,%xmm6
  mulsd  0x1b0(%rsp),%xmm4
  mulsd  %xmm9,%xmm8
  mulsd  %xmm7,%xmm14
  movapd %xmm6,%xmm15
  addsd  %xmm13,%xmm15
  addsd  %xmm14,%xmm6
  addsd  %xmm14,%xmm15
  movapd %xmm6,%xmm1
  addsd  %xmm8,%xmm15
  addsd  %xmm4,%xmm1
  addsd  %xmm4,%xmm15
  movsd  0x1b0(%rsp),%xmm4
  addsd  %xmm13,%xmm1
  mulsd  %xmm0,%xmm4
  mulsd  %xmm0,%xmm0
  addsd  %xmm3,%xmm15
  addsd  %xmm8,%xmm1
  movsd  %xmm15,0xb8(%rsp)
  addsd  %xmm3,%xmm1
  movsd  0x1c0(%rsp),%xmm3
  mulsd  %xmm2,%xmm3
  movsd  %xmm1,0xc8(%rsp)
  movapd %xmm0,%xmm1
  mulsd  %xmm10,%xmm1
  mulsd  %xmm2,%xmm2
  addsd  %xmm5,%xmm1
  mulsd  %xmm9,%xmm2
  addsd  %xmm4,%xmm1
  addsd  %xmm5,%xmm1
  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
  call   <ellipse2param@plt>
  mov    0x2a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L123
  add    $0x2b8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L36:
  lea    D34(%rip),%rdi
  call   <error@plt>
  test   %r12,%r12
  jne    L55
L99:
  lea    D19(%rip),%rdi
  call   <error@plt>
  test   %rbx,%rbx
  jne    L116
L49:
  lea    D10(%rip),%rdi
  call   <error@plt>
  test   %rbp,%rbp
  jne    L29
L124:
  lea    D5(%rip),%rdi
  call   <error@plt>
  jmp    L29
L123:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D34
type: string
name: retrieve_data
arguments: tag: D19
type: string
name: retrieve_data
arguments: tag: D10
type: string
name: retrieve_data
arguments: tag: D5
type: string

tool: D34: fit_ellipse: invalid size.

tool: D19: fit_ellipse: invalid buffer.

tool: D10: fit_ellipse: invalid normalization matrix.

tool: D5: 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);
}
```