user: What would the C source look like for the assembly code provided here:

```asm
<CalculateTangentSpace>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xe8,%rsp
  mov    %esi,0x74(%rsp)
  mov    %r8,0x78(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xd8(%rsp)
  xor    %eax,%eax
  test   %r9,%r9
  mov    %r9,0x8(%rsp)
  setne  %dl
  test   %rcx,%rcx
  mov    %rcx,(%rsp)
  setne  %al
  test   %al,%dl
  je     L45
  test   %r8,%r8
  je     L45
  mov    %esi,%r12d
  mov    %esi,%r15d
  mov    %edi,%ebx
  shl    $0x4,%r12d
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %r12d,%edx
  lea    (%r15,%r15,2),%r12d
  xor    %esi,%esi
  shl    $0x2,%r12d
  mov    %rax,%rdi
  mov    %rax,0x68(%rsp)
  call   <memset@plt>
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %r12d,%edi
  mov    %rax,%rbp
  mov    %rax,0x30(%rsp)
  call   <malloc@plt>
  xor    %esi,%esi
  mov    %r12d,%edx
  mov    %rbp,%rdi
  mov    %rax,%r15
  mov    %rax,0x38(%rsp)
  call   <memset@plt>
  xor    %esi,%esi
  mov    %r12d,%edx
  mov    %r15,%rdi
  call   <memset@plt>
  test   %ebx,%ebx
  jle    L85
  lea    -0x1(%rbx),%eax
  mov    (%rsp),%rcx
  lea    0xb8(%rsp),%r15
  mov    0x8(%rsp),%r9
  lea    (%rax,%rax,2),%rax
  mov    %r15,0x60(%rsp)
  lea    0xc8(%rsp),%r13
  lea    0xc(%r14,%rax,4),%rax
  mov    %rax,0x40(%rsp)
  lea    0x88(%rsp),%rax
  mov    %rax,0x48(%rsp)
  lea    0x98(%rsp),%rax
  mov    %rax,0x50(%rsp)
  lea    0xa8(%rsp),%rax
  mov    %rax,0x58(%rsp)
L63:
  mov    (%r14),%eax
  mov    0x48(%rsp),%rdi
  mov    %r9,0x20(%rsp)
  add    $0xc,%r14
  mov    %rcx,0x8(%rsp)
  lea    (%rax,%rax,2),%r12d
  mov    -0x8(%r14),%eax
  movslq %r12d,%r12
  lea    (%rax,%rax,2),%ebp
  mov    -0x4(%r14),%eax
  shl    $0x2,%r12
  movslq %ebp,%rbp
  lea    (%rcx,%r12,1),%rdx
  lea    (%r9,%r12,1),%r15
  lea    (%rax,%rax,2),%ebx
  shl    $0x2,%rbp
  mov    %rdx,(%rsp)
  movslq %ebx,%rbx
  lea    (%r9,%rbp,1),%r11
  lea    (%rcx,%rbp,1),%rsi
  shl    $0x2,%rbx
  mov    %r11,0x28(%rsp)
  lea    (%r9,%rbx,1),%r10
  lea    (%rcx,%rbx,1),%r8
  mov    %r10,0x18(%rsp)
  mov    %r8,0x10(%rsp)
  call   <sub3d@plt>
  mov    (%rsp),%rdx
  mov    0x10(%rsp),%rsi
  mov    0x50(%rsp),%rdi
  call   <sub3d@plt>
  mov    0x28(%rsp),%rsi
  mov    0x58(%rsp),%rdi
  mov    %r15,%rdx
  call   <sub3d@plt>
  mov    0x18(%rsp),%rsi
  mov    0x60(%rsp),%rdi
  mov    %r15,%rdx
  call   <sub3d@plt>
  movss  D9(%rip),%xmm4
  mov    0x30(%rsp),%r15
  mov    %r13,%rdx
  movss  0xbc(%rsp),%xmm1
  movss  0xac(%rsp),%xmm3
  movss  0xa8(%rsp),%xmm0
  lea    (%r15,%r12,1),%rdi
  movss  0xb8(%rsp),%xmm2
  movq   0x98(%rsp),%xmm5
  mov    %rdi,%rsi
  mulss  %xmm3,%xmm2
  mulss  %xmm1,%xmm0
  mulss  0xa0(%rsp),%xmm3
  mulss  0x90(%rsp),%xmm1
  subss  %xmm2,%xmm0
  movq   0x88(%rsp),%xmm2
  subss  %xmm3,%xmm1
  divss  %xmm0,%xmm4
  movq   0xb8(%rsp),%xmm0
  shufps $0xe5,%xmm0,%xmm0
  mulps  %xmm0,%xmm2
  movq   0xa8(%rsp),%xmm0
  shufps $0xe5,%xmm0,%xmm0
  mulps  %xmm5,%xmm0
  subps  %xmm0,%xmm2
  mulss  %xmm4,%xmm1
  movaps %xmm4,%xmm0
  shufps $0xe0,%xmm0,%xmm0
  mulps  %xmm0,%xmm2
  movss  %xmm1,0xd0(%rsp)
  movlps %xmm2,0xc8(%rsp)
  call   <add3d@plt>
  lea    (%r15,%rbp,1),%rdi
  mov    %r13,%rdx
  mov    %rdi,%rsi
  call   <add3d@plt>
  lea    (%r15,%rbx,1),%rdi
  mov    %r13,%rdx
  mov    %rdi,%rsi
  call   <add3d@plt>
  mov    0x38(%rsp),%r15
  mov    %r13,%rdx
  lea    (%r15,%r12,1),%rdi
  mov    %rdi,%rsi
  call   <add3d@plt>
  lea    (%r15,%rbp,1),%rdi
  mov    %r13,%rdx
  mov    %rdi,%rsi
  call   <add3d@plt>
  lea    (%r15,%rbx,1),%rdi
  mov    %r13,%rdx
  mov    %rdi,%rsi
  call   <add3d@plt>
  cmp    %r14,0x40(%rsp)
  mov    0x8(%rsp),%rcx
  mov    0x20(%rsp),%r9
  jne    L63
L85:
  mov    0x74(%rsp),%eax
  test   %eax,%eax
  jle    L30
  mov    0x68(%rsp),%rcx
  shl    $0x4,%rax
  mov    0x78(%rsp),%r14
  lea    0xb8(%rsp),%r15
  mov    0x30(%rsp),%rbx
  mov    0x38(%rsp),%rbp
  lea    0xc8(%rsp),%r13
  add    %rcx,%rax
  mov    %rcx,%r12
  mov    %rax,(%rsp)
  nopl   0x0(%rax)
L42:
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   <dot3d@plt>
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <scale3d@plt>
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    %r15,%rdi
  call   <sub3d@plt>
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <normalize3d@plt>
  mov    %rbx,%rdx
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <cross3d@plt>
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   <dot3d@plt>
  pxor   %xmm6,%xmm6
  comiss %xmm0,%xmm6
  ja     L57
  add    $0xc,%r14
  add    $0xc,%rbx
  add    $0x10,%r12
  add    $0xc,%rbp
  movl   $0x3f800000,-0x4(%r12)
  cmp    %r12,(%rsp)
  jne    L42
L30:
  mov    0xd8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L13
  mov    0x68(%rsp),%rax
  add    $0xe8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L57:
  add    $0xc,%r14
  add    $0xc,%rbx
  add    $0x10,%r12
  add    $0xc,%rbp
  movl   $0xbf800000,-0x4(%r12)
  cmp    (%rsp),%r12
  jne    L42
  jmp    L30
  nopl   (%rax)
L45:
  movq   $0x0,0x68(%rsp)
  jmp    L30
L13:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D9
data_type: f32

tool: D9: 1

assistant: ```c
float *CalculateTangentSpace(int Triangles, int VertexCount, int *Indices, float *verts, float *normals, float *texs) {
  int i;
  float *tans = 0;
  if (normals && texs && verts) {
    tans = malloc(VertexCount * sizeof(float) * 4);
    memset(tans, 0, VertexCount * sizeof(float) * 4);
    float *tan1 = malloc(VertexCount * sizeof(float) * 3);
    float *tan2 = malloc(VertexCount * sizeof(float) * 3);
    memset(tan1, 0, VertexCount * sizeof(float) * 3);
    memset(tan2, 0, VertexCount * sizeof(float) * 3);
    for (i = 0; i < Triangles; i++) {
      int v1 = Indices[i * 3 + 0];
      int v2 = Indices[i * 3 + 1];
      int v3 = Indices[i * 3 + 2];
      float *t1 = &texs[v1 * 3];
      float *t2 = &texs[v2 * 3];
      float *t3 = &texs[v3 * 3];
      float *p1 = &verts[v1 * 3];
      float *p2 = &verts[v2 * 3];
      float *p3 = &verts[v3 * 3];
      float vec1[3];
      float vec2[3];
      float tex1[3];
      float tex2[3];
      sub3d(vec1, p2, p1);
      sub3d(vec2, p3, p1);
      sub3d(tex1, t2, t1);
      sub3d(tex2, t3, t1);
      float r = 1.0f / (tex1[0] * tex2[1] - tex2[0] * tex1[1]);
      float sdir[3] = {(tex2[1] * vec1[0] - tex1[1] * vec2[0]) * r, (tex2[1] * vec1[1] - tex1[1] * vec2[1]) * r, (tex2[1] * vec1[2] - tex1[1] * vec2[2]) * r};
      float tdir[3] = {(tex1[0] * vec2[0] - tex2[0] * vec1[0]) * r, (tex1[0] * vec2[1] - tex2[0] * vec1[1]) * r, (tex1[0] * vec2[2] - tex2[0] * vec1[2]) * r};
      add3d(&tan1[v1 * 3], &tan1[v1 * 3], sdir);
      add3d(&tan1[v2 * 3], &tan1[v2 * 3], sdir);
      add3d(&tan1[v3 * 3], &tan1[v3 * 3], sdir);
      add3d(&tan2[v1 * 3], &tan2[v1 * 3], sdir);
      add3d(&tan2[v2 * 3], &tan2[v2 * 3], sdir);
      add3d(&tan2[v3 * 3], &tan2[v3 * 3], sdir);
    }
    for (i = 0; i < VertexCount; i++) {
      const float *n = &normals[i * 3];
      const float *t = &tan1[i * 3];
      float tmp[3];
      float tdn[3];
      float thisdot = dot3d(n, t);
      scale3d(tdn, n, thisdot);
      sub3d(tmp, t, tdn);
      normalize3d(&tans[i * 4], tmp);
      cross3d(tmp, n, t);
      tans[i * 4 + 3] = (dot3d(tmp, &tan2[i * 3]) < 0) ? -1 : 1;
    }
  }
  return tans;
}
```