user: Converte this assembly snippet into its equivalent C code:

```asm
<frac>:
  endbr64
  movapd %xmm0,%xmm5
  mov    %rdi,%rcx
  mov    %rsi,%rax
  movsd  D72(%rip),%xmm0
  movsd  D94(%rip),%xmm2
  comisd %xmm5,%xmm0
  ja     L24
  movsd  D94(%rip),%xmm2
  comisd D26(%rip),%xmm5
  ja     L24
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  ja     L24
  movl   $0x1,(%rsi)
  cvttsd2si %xmm5,%esi
  mov    %esi,(%rdi)
  add    $0x1,%esi
  mov    $0x1,%r8d
  movsd  D46(%rip),%xmm15
  movapd %xmm15,%xmm9
  movq   D92(%rip),%xmm8
  movsd  D89(%rip),%xmm7
  movapd %xmm15,%xmm6
  movsd  D30(%rip),%xmm12
  movapd %xmm15,%xmm11
  movapd %xmm0,%xmm10
  movapd %xmm0,%xmm13
  movapd %xmm15,%xmm14
  jmp    L125
L41:
  movsd  D46(%rip),%xmm0
L70:
  mulsd  %xmm7,%xmm0
  movapd %xmm2,%xmm4
  mulsd  %xmm0,%xmm4
  comisd %xmm4,%xmm6
  ja     L70
  addsd  %xmm12,%xmm4
  cvttsd2si %xmm4,%edi
  pxor   %xmm2,%xmm2
  cvtsi2sd %edi,%xmm2
  movapd %xmm11,%xmm4
  divsd  %xmm0,%xmm4
  mulsd  %xmm4,%xmm2
  comisd %xmm2,%xmm1
  jae    L24
  ucomisd %xmm10,%xmm3
  jp     L91
  ucomisd %xmm13,%xmm3
  je     L24
L91:
  comisd %xmm14,%xmm3
  ja     L101
  movsd  D46(%rip),%xmm0
  divsd  %xmm3,%xmm0
  movapd %xmm0,%xmm3
L101:
  cvttsd2si %xmm3,%edi
  mov    %edi,%r10d
  imul   %edx,%r10d
  add    %r10d,%esi
  imul   %r9d,%edi
  add    %edi,%r8d
  add    %esi,%edx
  mov    %edx,(%rcx)
  add    %r8d,(%rax)
L125:
  pxor   %xmm0,%xmm0
  cvtsi2sdl (%rax),%xmm0
  mulsd  %xmm5,%xmm0
  mov    (%rcx),%edx
  pxor   %xmm2,%xmm2
  cvtsi2sd %edx,%xmm2
  ucomisd %xmm2,%xmm0
  jp     L58
  pxor   %xmm3,%xmm3
  je     L44
L58:
  pxor   %xmm3,%xmm3
  cvtsi2sd %esi,%xmm3
  pxor   %xmm4,%xmm4
  cvtsi2sd %r8d,%xmm4
  mulsd  %xmm5,%xmm4
  subsd  %xmm4,%xmm3
  subsd  %xmm2,%xmm0
  divsd  %xmm0,%xmm3
  comisd %xmm15,%xmm3
  ja     L44
  mov    %esi,(%rcx)
  mov    (%rax),%edi
  mov    %r8d,(%rax)
  mov    %edx,%esi
  mov    %edi,%r8d
L44:
  mov    (%rcx),%edx
  mov    (%rax),%r9d
  pxor   %xmm0,%xmm0
  cvtsi2sd %edx,%xmm0
  pxor   %xmm2,%xmm2
  cvtsi2sd %r9d,%xmm2
  mulsd  %xmm5,%xmm2
  divsd  %xmm2,%xmm0
  movapd %xmm9,%xmm2
  subsd  %xmm0,%xmm2
  andpd  %xmm8,%xmm2
  comisd %xmm2,%xmm1
  jb     L41
L24:
  movapd %xmm2,%xmm0
  ret
```

tool_calls: name: read_data
arguments: data_label: D72
data_type: byte[8]
name: read_data
arguments: data_label: D94
data_type: f32[2]
name: read_data
arguments: data_label: D26
data_type: byte[16]
name: read_data
arguments: data_label: D46
data_type: f64
name: read_data
arguments: data_label: D92
data_type: qword
name: read_data
arguments: data_label: D89
data_type: f64
name: read_data
arguments: data_label: D30
data_type: f64

tool: {"D72": [0x4c,0xce,0x61,0xe3,0xa7,0x9d,0xf4,0x3d]}

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

tool: {"D26": [0x00,0x00,0x00,0x20,0x5f,0xa0,0x22,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x40]}

tool: D46: 1

tool: D92: 9223372036854775807

tool: D89: 10

tool: D30: 0.5

assistant: ```c
double frac(v, n, d, error)
double v, error;
int *n, *d;
{
  int D, N, t;
  double epsilon, r, m, fabs();
  if (v < 3.0e-10 || v > 4.0e+10 || error < 0.0)
    return (-1.0);
  *d = D = 1;
  *n = (int)v;
  N = (*n) + 1;
  goto three;
one:
  if (r > 1.0)
    goto two;
  r = 1.0 / r;
two:
  N += (*n) * (int)r;
  D += (*d) * (int)r;
  (*n) += N;
  (*d) += D;
three:
  r = 0.0;
  if (v * (*d) == (double)(*n))
    goto four;
  r = (N - v * D) / (v * (*d) - (*n));
  if (r > 1.0)
    goto four;
  t = N;
  N = (*n);
  *n = t;
  t = D;
  D = (*d);
  *d = t;
four:
  epsilon = fabs(1.0 - (*n) / (v * (*d)));
  if (epsilon <= error)
    goto six;
  m = 1.0;
  do {
    m *= 10.0;
  } while (m * epsilon < 1.0);
  epsilon = 1.0 / m * ((int)(0.5 + m * epsilon));
six:
  if (epsilon <= error)
    return (epsilon);
  if (r != 0.0)
    goto one;
}
```