user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<CalculateTangentSpace>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %esi,0x74(%rsp)
  mov    %r8,0x78(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%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     L46
  test   %r8,%r8
  je     L46
  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    L59
  lea    -0x1(%rbx),%eax
  mov    (%rsp),%rcx
  lea    0xb0(%rsp),%r15
  mov    0x8(%rsp),%r9
  lea    (%rax,%rax,2),%rax
  mov    %r15,0x60(%rsp)
  lea    0xbc(%rsp),%r13
  lea    0xc(%r14,%rax,4),%rax
  mov    %rax,0x40(%rsp)
  lea    0x8c(%rsp),%rax
  mov    %rax,0x48(%rsp)
  lea    0x98(%rsp),%rax
  mov    %rax,0x50(%rsp)
  lea    0xa4(%rsp),%rax
  mov    %rax,0x58(%rsp)
L35:
  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>
  mov    0x30(%rsp),%r15
  mov    %r13,%rdx
  movss  0xb4(%rsp),%xmm0
  movss  0xa8(%rsp),%xmm1
  movss  0xa4(%rsp),%xmm2
  movss  0xb0(%rsp),%xmm3
  lea    (%r15,%r12,1),%rdi
  movss  0x98(%rsp),%xmm4
  mulss  %xmm0,%xmm2
  mov    %rdi,%rsi
  mulss  %xmm1,%xmm3
  mulss  %xmm1,%xmm4
  subss  %xmm3,%xmm2
  movss  D3(%rip),%xmm3
  divss  %xmm2,%xmm3
  movss  0x8c(%rsp),%xmm2
  mulss  %xmm0,%xmm2
  subss  %xmm4,%xmm2
  movss  0x9c(%rsp),%xmm4
  mulss  %xmm1,%xmm4
  mulss  0xa0(%rsp),%xmm1
  mulss  %xmm3,%xmm2
  movss  %xmm2,0xbc(%rsp)
  movss  0x90(%rsp),%xmm2
  mulss  %xmm0,%xmm2
  mulss  0x94(%rsp),%xmm0
  subss  %xmm4,%xmm2
  subss  %xmm1,%xmm0
  mulss  %xmm3,%xmm2
  mulss  %xmm3,%xmm0
  movss  %xmm2,0xc0(%rsp)
  movss  %xmm0,0xc4(%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    L35
L59:
  mov    0x74(%rsp),%eax
  test   %eax,%eax
  jle    L53
  mov    0x68(%rsp),%rcx
  mov    0x30(%rsp),%r14
  shl    $0x4,%rax
  lea    0xb0(%rsp),%r15
  mov    0x78(%rsp),%rbp
  mov    0x38(%rsp),%rbx
  lea    0xbc(%rsp),%r13
  add    %rcx,%rax
  mov    %rax,(%rsp)
  mov    %r14,%rax
  mov    %rbp,%r12
  mov    %rcx,%r14
  mov    %rax,%rbp
  nopl   0x0(%rax)
L11:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <dot3d@plt>
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <scale3d@plt>
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   <sub3d@plt>
  mov    %r14,%rdi
  mov    %r15,%rsi
  add    $0x10,%r14
  call   <normalize3d@plt>
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %r15,%rdi
  call   <cross3d@plt>
  mov    %rbx,%rsi
  mov    %r15,%rdi
  add    $0xc,%r12
  call   <dot3d@plt>
  pxor   %xmm5,%xmm5
  add    $0xc,%rbp
  movss  D27(%rip),%xmm1
  cmpltss %xmm5,%xmm0
  movss  D3(%rip),%xmm7
  add    $0xc,%rbx
  andps  %xmm0,%xmm1
  andnps %xmm7,%xmm0
  orps   %xmm0,%xmm1
  movss  %xmm1,-0x4(%r14)
  cmp    %r14,(%rsp)
  jne    L11
L53:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  mov    0x68(%rsp),%rax
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L46:
  movq   $0x0,0x68(%rsp)
  jmp    L53
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D3
type: f32
name: extract_symbolic_data
arguments: label: D27
type: byte[4]

tool: D3: 1

tool: {"D27": [0x00,0x00,0x80,0xbf]}

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;
}
```