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

```asm
<tri_tri_intersect>:
  endbr64
  push   %r15
  mov    %rsi,%r11
  mov    %rcx,%rax
  mov    %rdi,%r10
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  movq   0x4(%rdi),%xmm2
  movq   0x4(%r11),%xmm3
  mov    %fs:0x28,%rdx
  mov    %rdx,0x48(%rsp)
  xor    %edx,%edx
  movq   0x4(%r13),%xmm1
  movss  (%rsi),%xmm0
  movaps %xmm2,%xmm4
  movaps %xmm3,%xmm5
  movss  (%rdi),%xmm7
  movaps %xmm2,%xmm6
  shufps $0xe5,%xmm4,%xmm4
  movaps %xmm4,%xmm15
  shufps $0xe5,%xmm5,%xmm5
  movd   %xmm5,%ebx
  movss  %xmm4,0x28(%rsp)
  movss  0x8(%r11),%xmm4
  movss  0x8(%rdi),%xmm5
  movd   %xmm0,%esi
  movlps %xmm1,0x8(%rsp)
  mov    0x0(%r13),%edi
  mov    0xc(%rsp),%ecx
  movd   %xmm3,%r14d
  unpcklps %xmm0,%xmm4
  movaps %xmm1,%xmm0
  subps  %xmm2,%xmm3
  movss  %xmm2,0x2c(%rsp)
  subps  %xmm2,%xmm0
  movd   %xmm1,%edx
  movd   %ecx,%xmm2
  movss  (%r8),%xmm11
  movd   %edi,%xmm1
  unpcklps %xmm7,%xmm5
  movss  %xmm7,0x20(%rsp)
  unpcklps %xmm1,%xmm2
  subps  %xmm5,%xmm4
  subps  %xmm5,%xmm2
  movaps %xmm0,%xmm5
  mulps  %xmm4,%xmm5
  shufps $0xe5,%xmm4,%xmm4
  mulss  %xmm4,%xmm0
  movaps %xmm2,%xmm1
  shufps $0xe5,%xmm2,%xmm2
  movss  0x4(%rax),%xmm4
  mulps  %xmm3,%xmm1
  mulss  %xmm3,%xmm2
  movss  %xmm4,0x1c(%rsp)
  subps  %xmm5,%xmm1
  subss  %xmm2,%xmm0
  mulss  %xmm1,%xmm7
  movaps %xmm1,%xmm5
  movaps %xmm1,%xmm14
  movlps %xmm1,0x38(%rsp)
  shufps $0xe5,%xmm5,%xmm5
  mulss  %xmm5,%xmm6
  movaps %xmm15,%xmm1
  movss  0x8(%rax),%xmm15
  mulss  %xmm5,%xmm4
  movaps %xmm5,%xmm13
  movss  %xmm0,0x40(%rsp)
  mulss  %xmm0,%xmm1
  movaps %xmm7,%xmm8
  movss  (%rax),%xmm7
  addss  %xmm6,%xmm8
  movss  0x4(%r8),%xmm6
  movaps %xmm7,%xmm2
  movss  %xmm7,0x18(%rsp)
  movaps %xmm11,%xmm7
  mulss  %xmm14,%xmm2
  movaps %xmm6,%xmm3
  mulss  %xmm14,%xmm7
  addss  %xmm1,%xmm8
  mulss  %xmm5,%xmm3
  addss  %xmm2,%xmm4
  movaps %xmm0,%xmm2
  mulss  %xmm15,%xmm2
  addss  %xmm7,%xmm3
  movaps %xmm0,%xmm7
  addss  %xmm2,%xmm4
  movss  0x8(%r8),%xmm2
  mulss  %xmm2,%xmm7
  subss  %xmm8,%xmm4
  addss  %xmm7,%xmm3
  subss  %xmm8,%xmm3
  movss  %xmm3,0x8(%rsp)
  movss  (%r9),%xmm5
  movss  0x4(%r9),%xmm7
  movsd  D4(%rip),%xmm12
  movss  0x8(%r9),%xmm10
  movaps %xmm5,%xmm9
  movaps %xmm7,%xmm3
  mulss  %xmm14,%xmm9
  movss  %xmm10,0x24(%rsp)
  mulss  %xmm13,%xmm3
  addss  %xmm9,%xmm3
  movaps %xmm10,%xmm9
  movss  D3(%rip),%xmm10
  mulss  %xmm0,%xmm9
  addss  %xmm9,%xmm3
  pxor   %xmm9,%xmm9
  subss  %xmm8,%xmm3
  movaps %xmm4,%xmm8
  andps  %xmm10,%xmm8
  cvtss2sd %xmm8,%xmm8
  comisd %xmm8,%xmm12
  movss  %xmm3,0x14(%rsp)
  jbe    L52
  movaps %xmm9,%xmm4
L52:
  movss  0x8(%rsp),%xmm8
  andps  %xmm10,%xmm8
  cvtss2sd %xmm8,%xmm8
  comisd %xmm8,%xmm12
  jbe    L116
  movss  %xmm9,0x8(%rsp)
L116:
  movss  0x14(%rsp),%xmm8
  andps  %xmm10,%xmm8
  cvtss2sd %xmm8,%xmm8
  comisd %xmm8,%xmm12
  jbe    L279
  movss  %xmm9,0x14(%rsp)
L279:
  movss  0x8(%rsp),%xmm8
  movss  0x14(%rsp),%xmm1
  mulss  %xmm4,%xmm8
  mulss  %xmm4,%xmm1
  comiss %xmm9,%xmm8
  movd   %xmm8,%r15d
  movd   %xmm1,%ebp
  jbe    L143
  xor    %r12d,%r12d
  comiss %xmm9,%xmm1
  ja     L210
L143:
  movaps %xmm11,%xmm1
  movss  0x18(%rsp),%xmm3
  subss  %xmm15,%xmm2
  movss  0x1c(%rsp),%xmm11
  movss  0x24(%rsp),%xmm8
  subss  %xmm11,%xmm6
  subss  %xmm3,%xmm1
  subss  %xmm3,%xmm5
  subss  %xmm11,%xmm7
  movaps %xmm2,%xmm3
  subss  %xmm15,%xmm8
  movaps %xmm6,%xmm11
  mulss  %xmm7,%xmm3
  mulss  %xmm8,%xmm11
  mulss  %xmm5,%xmm2
  mulss  %xmm1,%xmm8
  mulss  %xmm5,%xmm6
  movd   %esi,%xmm5
  mulss  %xmm1,%xmm7
  movss  0x18(%rsp),%xmm1
  subss  %xmm3,%xmm11
  movd   %edi,%xmm3
  subss  %xmm8,%xmm2
  movss  0x20(%rsp),%xmm8
  mulss  %xmm11,%xmm1
  subss  %xmm6,%xmm7
  movss  0x1c(%rsp),%xmm6
  mulss  %xmm11,%xmm8
  mulss  %xmm11,%xmm5
  mulss  %xmm2,%xmm6
  mulss  %xmm7,%xmm15
  mulss  %xmm11,%xmm3
  addss  %xmm1,%xmm6
  movss  0x2c(%rsp),%xmm1
  mulss  %xmm2,%xmm1
  addss  %xmm15,%xmm6
  movd   %ecx,%xmm15
  mulss  %xmm7,%xmm15
  addss  %xmm1,%xmm8
  movss  0x28(%rsp),%xmm1
  mulss  %xmm7,%xmm1
  addss  %xmm1,%xmm8
  movd   %r14d,%xmm1
  mulss  %xmm2,%xmm1
  subss  %xmm6,%xmm8
  addss  %xmm5,%xmm1
  movd   %ebx,%xmm5
  mulss  %xmm7,%xmm5
  addss  %xmm1,%xmm5
  movd   %edx,%xmm1
  mulss  %xmm2,%xmm1
  subss  %xmm6,%xmm5
  addss  %xmm3,%xmm1
  addss  %xmm15,%xmm1
  subss  %xmm6,%xmm1
  movaps %xmm8,%xmm6
  andps  %xmm10,%xmm6
  cvtss2sd %xmm6,%xmm6
  comisd %xmm6,%xmm12
  jbe    L152
  movaps %xmm9,%xmm8
L152:
  movaps %xmm5,%xmm6
  andps  %xmm10,%xmm6
  cvtss2sd %xmm6,%xmm6
  comisd %xmm6,%xmm12
  jbe    L250
  movaps %xmm9,%xmm5
L250:
  movaps %xmm1,%xmm6
  andps  %xmm10,%xmm6
  cvtss2sd %xmm6,%xmm6
  comisd %xmm6,%xmm12
  jbe    L117
  movaps %xmm9,%xmm1
L117:
  movaps %xmm8,%xmm15
  movaps %xmm8,%xmm12
  mulss  %xmm5,%xmm15
  mulss  %xmm1,%xmm12
  comiss %xmm9,%xmm15
  jbe    L205
  xor    %r12d,%r12d
  comiss %xmm9,%xmm12
  ja     L210
L205:
  movaps %xmm7,%xmm6
  movaps %xmm0,%xmm3
  xor    %ecx,%ecx
  mulss  %xmm2,%xmm3
  mulss  %xmm11,%xmm0
  mulss  %xmm13,%xmm6
  mulss  %xmm14,%xmm7
  mulss  %xmm14,%xmm2
  mulss  %xmm13,%xmm11
  subss  %xmm3,%xmm6
  subss  %xmm7,%xmm0
  andps  %xmm10,%xmm6
  subss  %xmm11,%xmm2
  andps  %xmm10,%xmm0
  comiss %xmm6,%xmm0
  andps  %xmm10,%xmm2
  jbe    L225
  movaps %xmm0,%xmm6
  mov    $0x4,%ecx
L225:
  ucomiss %xmm6,%xmm2
  mov    $0x8,%edi
  cmova  %rdi,%rcx
  comiss %xmm9,%xmm15
  movss  (%r10,%rcx,1),%xmm10
  movss  (%r11,%rcx,1),%xmm7
  movss  0x0(%r13,%rcx,1),%xmm6
  movss  (%rax,%rcx,1),%xmm11
  movss  (%r8,%rcx,1),%xmm2
  movss  (%r9,%rcx,1),%xmm0
  jbe    L188
  subss  %xmm6,%xmm7
  subss  %xmm6,%xmm10
  mulss  %xmm1,%xmm7
  movaps %xmm10,%xmm12
  movaps %xmm1,%xmm10
  mulss  %xmm1,%xmm12
  subss  %xmm5,%xmm1
  subss  %xmm8,%xmm10
  divss  %xmm1,%xmm7
  divss  %xmm10,%xmm12
  movaps %xmm7,%xmm5
  addss  %xmm6,%xmm5
  movaps %xmm5,%xmm1
  addss  %xmm6,%xmm12
L171:
  movd   %r15d,%xmm7
  comiss %xmm9,%xmm7
  jbe    L337
L27:
  movaps %xmm11,%xmm5
  movss  0x14(%rsp),%xmm7
  subss  %xmm0,%xmm2
  subss  %xmm0,%xmm5
  movaps %xmm7,%xmm3
  subss  %xmm4,%xmm3
  mulss  %xmm7,%xmm2
  mulss  %xmm7,%xmm5
  divss  %xmm3,%xmm5
  movaps %xmm7,%xmm3
  subss  0x8(%rsp),%xmm3
  divss  %xmm3,%xmm2
  addss  %xmm0,%xmm5
  addss  %xmm2,%xmm0
L265:
  comiss %xmm1,%xmm12
  jbe    L300
  movaps %xmm12,%xmm2
  movaps %xmm1,%xmm12
  movaps %xmm2,%xmm1
L300:
  comiss %xmm0,%xmm5
  jbe    L30
  movaps %xmm5,%xmm2
  movaps %xmm0,%xmm5
  movaps %xmm2,%xmm0
L30:
  xor    %r12d,%r12d
  comiss %xmm1,%xmm5
  ja     L210
  xor    %r12d,%r12d
  comiss %xmm0,%xmm12
  setbe  %r12b
L210:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L160
  add    $0x58,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L188:
  comiss %xmm9,%xmm12
  jbe    L153
L231:
  subss  %xmm7,%xmm6
  movaps %xmm10,%xmm12
  movaps %xmm5,%xmm10
  subss  %xmm7,%xmm12
  subss  %xmm8,%xmm10
  mulss  %xmm5,%xmm6
  mulss  %xmm5,%xmm12
  subss  %xmm1,%xmm5
  divss  %xmm5,%xmm6
  divss  %xmm10,%xmm12
  movaps %xmm6,%xmm1
  addss  %xmm7,%xmm1
  addss  %xmm7,%xmm12
  movd   %r15d,%xmm7
  comiss %xmm9,%xmm7
  ja     L27
L337:
  movd   %ebp,%xmm7
  comiss %xmm9,%xmm7
  jbe    L275
L396:
  movaps %xmm11,%xmm5
  subss  %xmm2,%xmm0
  movss  0x8(%rsp),%xmm7
  subss  %xmm2,%xmm5
  movaps %xmm7,%xmm6
  mulss  %xmm7,%xmm0
  subss  %xmm4,%xmm6
  mulss  %xmm7,%xmm5
  subss  0x14(%rsp),%xmm7
  divss  %xmm7,%xmm0
  divss  %xmm6,%xmm5
  addss  %xmm2,%xmm0
  addss  %xmm2,%xmm5
  jmp    L265
  nopl   0x0(%rax,%rax,1)
L153:
  movaps %xmm5,%xmm12
  mulss  %xmm1,%xmm12
  comiss %xmm9,%xmm12
  jbe    L283
L75:
  subss  %xmm10,%xmm7
  movaps %xmm7,%xmm12
  movaps %xmm8,%xmm7
  subss  %xmm5,%xmm7
  mulss  %xmm8,%xmm12
  movaps %xmm6,%xmm5
  subss  %xmm10,%xmm5
  mulss  %xmm8,%xmm5
  subss  %xmm1,%xmm8
  divss  %xmm7,%xmm12
  divss  %xmm8,%xmm5
  addss  %xmm10,%xmm12
  movaps %xmm5,%xmm1
  addss  %xmm10,%xmm1
  jmp    L171
  nopw   0x0(%rax,%rax,1)
L275:
  movss  0x8(%rsp),%xmm5
  mulss  0x14(%rsp),%xmm5
  comiss %xmm9,%xmm5
  jbe    L24
L54:
  movaps %xmm2,%xmm5
  subss  %xmm11,%xmm0
  movaps %xmm4,%xmm2
  subss  %xmm11,%xmm5
  subss  0x8(%rsp),%xmm2
  mulss  %xmm4,%xmm0
  mulss  %xmm4,%xmm5
  subss  0x14(%rsp),%xmm4
  divss  %xmm4,%xmm0
  divss  %xmm2,%xmm5
  addss  %xmm11,%xmm0
  addss  %xmm11,%xmm5
  jmp    L265
  nopl   0x0(%rax)
L283:
  ucomiss %xmm9,%xmm8
  jp     L75
  jne    L75
  ucomiss %xmm9,%xmm5
  jp     L231
  jne    L231
  ucomiss %xmm9,%xmm1
  jp     L73
  je     L70
L73:
  subss  %xmm6,%xmm7
  subss  %xmm6,%xmm10
  movaps %xmm1,%xmm12
  subss  %xmm8,%xmm12
  mulss  %xmm1,%xmm7
  mulss  %xmm1,%xmm10
  subss  %xmm5,%xmm1
  divss  %xmm1,%xmm7
  divss  %xmm12,%xmm10
  addss  %xmm6,%xmm7
  movaps %xmm7,%xmm1
  movaps %xmm10,%xmm12
  addss  %xmm6,%xmm12
  jmp    L171
  nopl   0x0(%rax)
L24:
  ucomiss %xmm9,%xmm4
  jp     L54
  jne    L54
  movss  0x8(%rsp),%xmm7
  ucomiss %xmm9,%xmm7
  jp     L396
  jne    L396
  movss  0x14(%rsp),%xmm5
  ucomiss %xmm9,%xmm5
  jp     L338
  je     L70
L338:
  subss  %xmm0,%xmm11
  movss  0x14(%rsp),%xmm6
  subss  %xmm0,%xmm2
  movaps %xmm6,%xmm5
  movaps %xmm6,%xmm3
  subss  0x8(%rsp),%xmm3
  mulss  %xmm6,%xmm11
  subss  %xmm4,%xmm5
  mulss  %xmm6,%xmm2
  divss  %xmm5,%xmm11
  divss  %xmm3,%xmm2
  movaps %xmm11,%xmm5
  addss  %xmm0,%xmm5
  addss  %xmm2,%xmm0
  jmp    L265
L70:
  lea    0x38(%rsp),%rdi
  sub    $0x8,%rsp
  mov    %r11,%rdx
  mov    %r13,%rcx
  push   %r9
  mov    %r10,%rsi
  mov    %r8,%r9
  mov    %rax,%r8
  xor    %eax,%eax
  call   <coplanar_tri_tri@plt>
  mov    %eax,%r12d
  pop    %rax
  pop    %rdx
  jmp    L210
L160:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D4
datatype: f64
name: unpack_data
arguments: label: D3
datatype: dword

tool: D4: 1e-06

tool: D3: 2147483647

assistant: ```c
int tri_tri_intersect(float V0[3], float V1[3], float V2[3], float U0[3], float U1[3], float U2[3]) {
  float E1[3], E2[3];
  float N1[3], N2[3], d1, d2;
  float du0, du1, du2, dv0, dv1, dv2;
  float D[3];
  float isect1[2], isect2[2];
  float du0du1, du0du2, dv0dv1, dv0dv2;
  short index;
  float vp0, vp1, vp2;
  float up0, up1, up2;
  float b, c, max;
  E1[0] = V1[0] - V0[0];
  E1[1] = V1[1] - V0[1];
  E1[2] = V1[2] - V0[2];
  ;
  E2[0] = V2[0] - V0[0];
  E2[1] = V2[1] - V0[1];
  E2[2] = V2[2] - V0[2];
  ;
  N1[0] = E1[1] * E2[2] - E1[2] * E2[1];
  N1[1] = E1[2] * E2[0] - E1[0] * E2[2];
  N1[2] = E1[0] * E2[1] - E1[1] * E2[0];
  ;
  d1 = -(N1[0] * V0[0] + N1[1] * V0[1] + N1[2] * V0[2]);
  du0 = (N1[0] * U0[0] + N1[1] * U0[1] + N1[2] * U0[2]) + d1;
  du1 = (N1[0] * U1[0] + N1[1] * U1[1] + N1[2] * U1[2]) + d1;
  du2 = (N1[0] * U2[0] + N1[1] * U2[1] + N1[2] * U2[2]) + d1;
  if (fabs(du0) < 0.000001)
    du0 = 0.0;
  if (fabs(du1) < 0.000001)
    du1 = 0.0;
  if (fabs(du2) < 0.000001)
    du2 = 0.0;
  du0du1 = du0 * du1;
  du0du2 = du0 * du2;
  if (du0du1 > 0.0f && du0du2 > 0.0f)
    return 0;
  E1[0] = U1[0] - U0[0];
  E1[1] = U1[1] - U0[1];
  E1[2] = U1[2] - U0[2];
  ;
  E2[0] = U2[0] - U0[0];
  E2[1] = U2[1] - U0[1];
  E2[2] = U2[2] - U0[2];
  ;
  N2[0] = E1[1] * E2[2] - E1[2] * E2[1];
  N2[1] = E1[2] * E2[0] - E1[0] * E2[2];
  N2[2] = E1[0] * E2[1] - E1[1] * E2[0];
  ;
  d2 = -(N2[0] * U0[0] + N2[1] * U0[1] + N2[2] * U0[2]);
  dv0 = (N2[0] * V0[0] + N2[1] * V0[1] + N2[2] * V0[2]) + d2;
  dv1 = (N2[0] * V1[0] + N2[1] * V1[1] + N2[2] * V1[2]) + d2;
  dv2 = (N2[0] * V2[0] + N2[1] * V2[1] + N2[2] * V2[2]) + d2;
  if (fabs(dv0) < 0.000001)
    dv0 = 0.0;
  if (fabs(dv1) < 0.000001)
    dv1 = 0.0;
  if (fabs(dv2) < 0.000001)
    dv2 = 0.0;
  dv0dv1 = dv0 * dv1;
  dv0dv2 = dv0 * dv2;
  if (dv0dv1 > 0.0f && dv0dv2 > 0.0f)
    return 0;
  D[0] = N1[1] * N2[2] - N1[2] * N2[1];
  D[1] = N1[2] * N2[0] - N1[0] * N2[2];
  D[2] = N1[0] * N2[1] - N1[1] * N2[0];
  ;
  max = fabs(D[0]);
  index = 0;
  b = fabs(D[1]);
  c = fabs(D[2]);
  if (b > max)
    max = b, index = 1;
  if (c > max)
    max = c, index = 2;
  vp0 = V0[index];
  vp1 = V1[index];
  vp2 = V2[index];
  up0 = U0[index];
  up1 = U1[index];
  up2 = U2[index];
  if (dv0dv1 > 0.0f) {
    isect1[0] = vp2 + (vp0 - vp2) * dv2 / (dv2 - dv0);
    isect1[1] = vp2 + (vp1 - vp2) * dv2 / (dv2 - dv1);
    ;
  } else if (dv0dv2 > 0.0f) {
    isect1[0] = vp1 + (vp0 - vp1) * dv1 / (dv1 - dv0);
    isect1[1] = vp1 + (vp2 - vp1) * dv1 / (dv1 - dv2);
    ;
  } else if (dv1 * dv2 > 0.0f || dv0 != 0.0f) {
    isect1[0] = vp0 + (vp1 - vp0) * dv0 / (dv0 - dv1);
    isect1[1] = vp0 + (vp2 - vp0) * dv0 / (dv0 - dv2);
    ;
  } else if (dv1 != 0.0f) {
    isect1[0] = vp1 + (vp0 - vp1) * dv1 / (dv1 - dv0);
    isect1[1] = vp1 + (vp2 - vp1) * dv1 / (dv1 - dv2);
    ;
  } else if (dv2 != 0.0f) {
    isect1[0] = vp2 + (vp0 - vp2) * dv2 / (dv2 - dv0);
    isect1[1] = vp2 + (vp1 - vp2) * dv2 / (dv2 - dv1);
    ;
  } else {
    return coplanar_tri_tri(N1, V0, V1, V2, U0, U1, U2);
  };
  if (du0du1 > 0.0f) {
    isect2[0] = up2 + (up0 - up2) * du2 / (du2 - du0);
    isect2[1] = up2 + (up1 - up2) * du2 / (du2 - du1);
    ;
  } else if (du0du2 > 0.0f) {
    isect2[0] = up1 + (up0 - up1) * du1 / (du1 - du0);
    isect2[1] = up1 + (up2 - up1) * du1 / (du1 - du2);
    ;
  } else if (du1 * du2 > 0.0f || du0 != 0.0f) {
    isect2[0] = up0 + (up1 - up0) * du0 / (du0 - du1);
    isect2[1] = up0 + (up2 - up0) * du0 / (du0 - du2);
    ;
  } else if (du1 != 0.0f) {
    isect2[0] = up1 + (up0 - up1) * du1 / (du1 - du0);
    isect2[1] = up1 + (up2 - up1) * du1 / (du1 - du2);
    ;
  } else if (du2 != 0.0f) {
    isect2[0] = up2 + (up0 - up2) * du2 / (du2 - du0);
    isect2[1] = up2 + (up1 - up2) * du2 / (du2 - du1);
    ;
  } else {
    return coplanar_tri_tri(N1, V0, V1, V2, U0, U1, U2);
  };
  if (isect1[0] > isect1[1]) {
    float c;
    c = isect1[0];
    isect1[0] = isect1[1];
    isect1[1] = c;
  };
  if (isect2[0] > isect2[1]) {
    float c;
    c = isect2[0];
    isect2[0] = isect2[1];
    isect2[1] = c;
  };
  if (isect1[1] < isect2[0] || isect2[1] < isect1[0])
    return 0;
  return 1;
}
```