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

```asm
<approximate_intersection_pt>:
  endbr64
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    0x8(%rdi),%eax
  mov    %rsi,%rbx
  cmp    %eax,(%rdi)
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0xc(%rbp),%eax
  xor    %edi,%edi
  cmp    %eax,0x4(%rbp)
  setne  %dil
  call   <assert@plt>
  mov    0x0(%rbp),%eax
  pxor   %xmm5,%xmm5
  lea    (%rax,%rax,2),%esi
  movslq %esi,%rsi
  lea    0x2(%rsi),%rax
  movsd  (%rbx,%rax,8),%xmm2
  lea    0x0(,%rax,8),%r10
  mov    0x4(%rbp),%eax
  lea    (%rax,%rax,2),%edx
  movslq %edx,%rdx
  lea    0x2(%rdx),%rax
  movsd  (%rbx,%rax,8),%xmm1
  lea    0x0(,%rax,8),%rdi
  mov    0x8(%rbp),%eax
  lea    (%rax,%rax,2),%ecx
  movapd %xmm1,%xmm4
  movslq %ecx,%rcx
  subsd  %xmm2,%xmm4
  lea    0x2(%rcx),%rax
  movsd  (%rbx,%rax,8),%xmm0
  lea    0x0(,%rax,8),%r9
  mov    0xc(%rbp),%eax
  lea    (%rax,%rax,2),%eax
  movapd %xmm0,%xmm6
  cltq
  subsd  %xmm2,%xmm6
  lea    0x2(%rax),%r11
  movsd  (%rbx,%r11,8),%xmm7
  lea    0x0(,%r11,8),%r8
  movapd %xmm7,%xmm3
  subsd  %xmm0,%xmm3
  subsd  %xmm3,%xmm4
  movapd %xmm4,%xmm3
  andpd  D3(%rip),%xmm3
  comisd %xmm5,%xmm3
  jbe    L13
  movapd %xmm6,%xmm3
  movsd  D29(%rip),%xmm5
  movapd %xmm2,%xmm8
  divsd  %xmm4,%xmm3
  subsd  %xmm3,%xmm5
  mulsd  %xmm5,%xmm8
L19:
  movapd %xmm3,%xmm4
  movapd %xmm1,%xmm9
  mulsd  %xmm1,%xmm4
  subsd  %xmm7,%xmm9
  addsd  %xmm8,%xmm4
  movapd %xmm4,%xmm8
  subsd  %xmm4,%xmm0
  subsd  %xmm4,%xmm1
  subsd  %xmm2,%xmm8
  movsd  -0x8(%rbx,%r9,1),%xmm2
  divsd  %xmm6,%xmm0
  divsd  %xmm6,%xmm8
  movsd  -0x8(%rbx,%r10,1),%xmm6
  mulsd  %xmm0,%xmm6
  mulsd  (%rbx,%rsi,8),%xmm0
  divsd  %xmm9,%xmm1
  mulsd  %xmm8,%xmm2
  mulsd  (%rbx,%rcx,8),%xmm8
  addsd  %xmm2,%xmm6
  movapd %xmm4,%xmm2
  subsd  %xmm7,%xmm2
  movsd  -0x8(%rbx,%rdi,1),%xmm7
  addsd  %xmm8,%xmm0
  mulsd  %xmm5,%xmm6
  mulsd  %xmm5,%xmm0
  divsd  %xmm9,%xmm2
  movsd  -0x8(%rbx,%r8,1),%xmm9
  mulsd  %xmm1,%xmm9
  mulsd  (%rbx,%rax,8),%xmm1
  mulsd  %xmm2,%xmm7
  mulsd  (%rbx,%rdx,8),%xmm2
  pop    %rbx
  movsd  %xmm4,0x10(%r12)
  pop    %rbp
  addsd  %xmm9,%xmm7
  addsd  %xmm1,%xmm2
  mulsd  %xmm3,%xmm2
  mulsd  %xmm7,%xmm3
  addsd  %xmm2,%xmm0
  addsd  %xmm3,%xmm6
  movsd  %xmm0,(%r12)
  movsd  %xmm6,0x8(%r12)
  pop    %r12
  ret
  nopl   0x0(%rax)
L13:
  movsd  D29(%rip),%xmm5
  movapd %xmm2,%xmm8
  pxor   %xmm3,%xmm3
  jmp    L19
```

tool_calls: name: parse_data
arguments: data_tag: D3
data_type: qword[2]
name: parse_data
arguments: data_tag: D29
data_type: f64

tool: {"D3": [0x7fffffffffffffff,0x0000000000000000]}

tool: D29: 1

assistant: ```c
void approximate_intersection_pt(int *L, double *c, double *pt) {
  double a;
  double z0, z1, z2, z3;
  double b1, b2;
  double x1, y1;
  double x2, y2;
  double z;
  assert(L[0] != L[2]);
  assert(L[1] != L[3]);
  z0 = c[3 * L[0] + 2];
  z1 = c[3 * L[1] + 2];
  z2 = c[3 * L[2] + 2];
  z3 = c[3 * L[3] + 2];
  if (fabs((z1 - z0) - (z3 - z2)) > 0.0) {
    a = (z2 - z0) / ((z1 - z0) - (z3 - z2));
  } else {
    a = 0;
  }
  z = z0 * (1.0 - a) + z1 * a;
  b1 = (z2 - z) / (z2 - z0);
  b2 = (z - z0) / (z2 - z0);
  x1 = c[3 * L[0] + 0] * b1 + c[3 * L[2] + 0] * b2;
  y1 = c[3 * L[0] + 1] * b1 + c[3 * L[2] + 1] * b2;
  b1 = (z - z3) / (z1 - z3);
  b2 = (z1 - z) / (z1 - z3);
  x2 = c[3 * L[1] + 0] * b1 + c[3 * L[3] + 0] * b2;
  y2 = c[3 * L[1] + 1] * b1 + c[3 * L[3] + 1] * b2;
  pt[0] = x1 * (1.0 - a) + x2 * a;
  pt[1] = y1 * (1.0 - a) + y2 * a;
  pt[2] = z;
}
```