#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ glmMakeVector3f(float *, float const *, float const *);
int /*<<< orphan*/ glmNormalizeVector3f(float *);
void glmComputeTriangleTangentsf(float sTangent[3], float tTangent[3],
                                 const float c1[3], const float c2[3],
                                 const float c3[3], const float t1[2],
                                 const float t2[2], const float t3[2]) {
  float side1[3], side2[3];
  float deltaT1, deltaT2, deltaS1, deltaS2;
  glmMakeVector3f(side1, c1, c2);
  glmMakeVector3f(side2, c1, c3);
  deltaT1 = t2[1] - t1[1];
  deltaT2 = t3[1] - t1[1];
  sTangent[0] = deltaT2 * side1[0] - deltaT1 * side2[0];
  sTangent[1] = deltaT2 * side1[1] - deltaT1 * side2[1];
  sTangent[2] = deltaT2 * side1[2] - deltaT1 * side2[2];
  glmNormalizeVector3f(sTangent);
  deltaS1 = t2[0] - t1[0];
  deltaS2 = t3[0] - t1[0];
  tTangent[0] = deltaS2 * side1[0] - deltaS1 * side2[0];
  tTangent[1] = deltaS2 * side1[1] - deltaS1 * side2[1];
  tTangent[2] = deltaS2 * side1[2] - deltaS1 * side2[2];
  glmNormalizeVector3f(tTangent);
}


x86 assembly (clang, -O0):
<glmComputeTriangleTangentsf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x3c(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <glmMakeVector3f@plt>
lea    -0x48(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <glmMakeVector3f@plt>
mov    0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x30(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    0x18(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x30(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x50(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  -0x48(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x50(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  -0x44(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x50(%rbp),%xmm0
movss  -0x34(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  -0x40(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <glmNormalizeVector3f@plt>
mov    0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x30(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x54(%rbp)
mov    0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x30(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x58(%rbp),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  -0x48(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x58(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  -0x44(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x58(%rbp),%xmm0
movss  -0x34(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  -0x40(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rdi
call   1040 <glmNormalizeVector3f@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeTriangleTangentsf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r14
mov    %r8,%r12
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r13
mov    0x50(%rsp),%rbp
lea    0xc(%rsp),%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <glmMakeVector3f@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1030 <glmMakeVector3f@plt>
movss  0x4(%rbp),%xmm0
movss  0x4(%r14),%xmm1
subss  %xmm1,%xmm0
mov    0x58(%rsp),%rbx
movss  0x4(%rbx),%xmm2
subss  %xmm1,%xmm2
movss  (%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  0xc(%rsp),%xmm3
mulss  %xmm2,%xmm3
subss  %xmm1,%xmm3
movss  %xmm3,0x0(%r13)
movss  0x4(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  0x10(%rsp),%xmm3
mulss  %xmm2,%xmm3
subss  %xmm1,%xmm3
movss  %xmm3,0x4(%r13)
mulss  0x8(%rsp),%xmm0
mulss  0x14(%rsp),%xmm2
subss  %xmm0,%xmm2
movss  %xmm2,0x8(%r13)
mov    %r13,%rdi
call   1040 <glmNormalizeVector3f@plt>
movss  0x0(%rbp),%xmm0
movss  (%r14),%xmm1
subss  %xmm1,%xmm0
movss  (%rbx),%xmm2
subss  %xmm1,%xmm2
movss  (%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  0xc(%rsp),%xmm3
mulss  %xmm2,%xmm3
subss  %xmm1,%xmm3
movss  %xmm3,(%r15)
movss  0x4(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  0x10(%rsp),%xmm3
mulss  %xmm2,%xmm3
subss  %xmm1,%xmm3
movss  %xmm3,0x4(%r15)
mulss  0x8(%rsp),%xmm0
mulss  0x14(%rsp),%xmm2
subss  %xmm0,%xmm2
movss  %xmm2,0x8(%r15)
mov    %r15,%rdi
call   1040 <glmNormalizeVector3f@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @glmComputeTriangleTangentsf(float* %0, float* %1, float* %2, float* %3, float* %4, float* %5, float* %6, float* %7) {
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca float*
%16 = alloca float*
%17 = alloca [3 x float]
%18 = alloca [3 x float]
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca float
store float* %0, float** %9
store float* %1, float** %10
store float* %2, float** %11
store float* %3, float** %12
store float* %4, float** %13
store float* %5, float** %14
store float* %6, float** %15
store float* %7, float** %16
%23 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%24 = load float*, float** %11
%25 = load float*, float** %12
%26 = call i32 @glmMakeVector3f(float* %23, float* %24, float* %25)
%27 = getelementptr inbounds [3 x float], [3 x float]* %18, i64 0, i64 0
%28 = load float*, float** %11
%29 = load float*, float** %13
%30 = call i32 @glmMakeVector3f(float* %27, float* %28, float* %29)
%31 = load float*, float** %15
%32 = getelementptr inbounds float, float* %31, i64 1
%33 = load float, float* %32
%34 = load float*, float** %14
%35 = getelementptr inbounds float, float* %34, i64 1
%36 = load float, float* %35
%37 = fsub float %33, %36
store float %37, float* %19
%38 = load float*, float** %16
%39 = getelementptr inbounds float, float* %38, i64 1
%40 = load float, float* %39
%41 = load float*, float** %14
%42 = getelementptr inbounds float, float* %41, i64 1
%43 = load float, float* %42
%44 = fsub float %40, %43
store float %44, float* %20
%45 = load float, float* %20
%46 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%47 = load float, float* %46
%48 = load float, float* %19
%49 = getelementptr inbounds [3 x float], [3 x float]* %18, i64 0, i64 0
%50 = load float, float* %49
%51 = fmul float %48, %50
%52 = fneg float %51
%53 = call float @llvm.fmuladd.f32(float %45, float %47, float %52)
%54 = load float*, float** %9
%55 = getelementptr inbounds float, float* %54, i64 0
store float %53, float* %55
%56 = load float, float* %20
%57 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
%58 = load float, float* %57
%59 = load float, float* %19
%60 = getelementptr inbounds [3 x float], [3 x float]* %18, i64 0, i64 1
%61 = load float, float* %60
%62 = fmul float %59, %61
%63 = fneg float %62
%64 = call float @llvm.fmuladd.f32(float %56, float %58, float %63)
%65 = load float*, float** %9
%66 = getelementptr inbounds float, float* %65, i64 1
store float %64, float* %66
%67 = load float, float* %20
%68 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
%69 = load float, float* %68
%70 = load float, float* %19
%71 = getelementptr inbounds [3 x float], [3 x float]* %18, i64 0, i64 2
%72 = load float, float* %71
%73 = fmul float %70, %72
%74 = fneg float %73
%75 = call float @llvm.fmuladd.f32(float %67, float %69, float %74)
%76 = load float*, float** %9
%77 = getelementptr inbounds float, float* %76, i64 2
store float %75, float* %77
%78 = load float*, float** %9
%79 = call i32 @glmNormalizeVector3f(float* %78)
%80 = load float*, float** %15
%81 = getelementptr inbounds float, float* %80, i64 0
%82 = load float, float* %81
%83 = load float*, float** %14
%84 = getelementptr inbounds float, float* %83, i64 0
%85 = load float, float* %84
%86 = fsub float %82, %85
store float %86, float* %21
%87 = load float*, float** %16
%88 = getelementptr inbounds float, float* %87, i64 0
%89 = load float, float* %88
%90 = load float*, float** %14
%91 = getelementptr inbounds float, float* %90, i64 0
%92 = load float, float* %91
%93 = fsub float %89, %92
store float %93, float* %22
%94 = load float, float* %22
%95 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
%96 = load float, float* %95
%97 = load float, float* %21
%98 = getelementptr inbounds [3 x float], [3 x float]* %18, i64 0, i64 0
%99 = load float, float* %98
%100 = fmul float %97, %99
%101 = fneg float %100
%102 = call float @llvm.fmuladd.f32(float %94, float %96, float %101)
%103 = load float*, float** %10
%104 = getelementptr inbounds float, float* %103, i64 0
store float %102, float* %104
%105 = load float, float* %22
%106 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 1
%107 = load float, float* %106
%108 = load float, float* %21
%109 = getelementptr inbounds [3 x float], [3 x float]* %18, i64 0, i64 1
%110 = load float, float* %109
%111 = fmul float %108, %110
%112 = fneg float %111
%113 = call float @llvm.fmuladd.f32(float %105, float %107, float %112)
%114 = load float*, float** %10
%115 = getelementptr inbounds float, float* %114, i64 1
store float %113, float* %115
%116 = load float, float* %22
%117 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 2
%118 = load float, float* %117
%119 = load float, float* %21
%120 = getelementptr inbounds [3 x float], [3 x float]* %18, i64 0, i64 2
%121 = load float, float* %120
%122 = fmul float %119, %121
%123 = fneg float %122
%124 = call float @llvm.fmuladd.f32(float %116, float %118, float %123)
%125 = load float*, float** %10
%126 = getelementptr inbounds float, float* %125, i64 2
store float %124, float* %126
%127 = load float*, float** %10
%128 = call i32 @glmNormalizeVector3f(float* %127)
ret void
}

LLVM IR (-O2):
define void @glmComputeTriangleTangentsf(float* %0, float* %1, float* %2, float* %3, float* %4, float* nocapture %5, float* nocapture %6, float* nocapture %7) {
%9 = alloca [3 x float]
%10 = alloca [3 x float]
%11 = bitcast [3 x float]* %9 to i8*
%12 = bitcast [3 x float]* %10 to i8*
%13 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%14 = call i32 @glmMakeVector3f(float* %13, float* %2, float* %3)
%15 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%16 = call i32 @glmMakeVector3f(float* %15, float* %2, float* %4)
%17 = getelementptr inbounds float, float* %6, i64 1
%18 = load float, float* %17
%19 = getelementptr inbounds float, float* %5, i64 1
%20 = load float, float* %19
%21 = fsub float %18, %20
%22 = getelementptr inbounds float, float* %7, i64 1
%23 = load float, float* %22
%24 = fsub float %23, %20
%25 = load float, float* %13
%26 = load float, float* %15
%27 = fneg float %21
%28 = fmul float %26, %27
%29 = call float @llvm.fmuladd.f32(float %24, float %25, float %28)
store float %29, float* %0
%30 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
%31 = load float, float* %30
%32 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 1
%33 = load float, float* %32
%34 = fmul float %33, %27
%35 = call float @llvm.fmuladd.f32(float %24, float %31, float %34)
%36 = getelementptr inbounds float, float* %0, i64 1
store float %35, float* %36
%37 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
%38 = load float, float* %37
%39 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 2
%40 = load float, float* %39
%41 = fmul float %40, %27
%42 = call float @llvm.fmuladd.f32(float %24, float %38, float %41)
%43 = getelementptr inbounds float, float* %0, i64 2
store float %42, float* %43
%44 = call i32 @glmNormalizeVector3f(float* %0)
%45 = load float, float* %6
%46 = load float, float* %5
%47 = fsub float %45, %46
%48 = load float, float* %7
%49 = fsub float %48, %46
%50 = load float, float* %13
%51 = load float, float* %15
%52 = fneg float %47
%53 = fmul float %51, %52
%54 = call float @llvm.fmuladd.f32(float %49, float %50, float %53)
store float %54, float* %1
%55 = load float, float* %30
%56 = load float, float* %32
%57 = fmul float %56, %52
%58 = call float @llvm.fmuladd.f32(float %49, float %55, float %57)
%59 = getelementptr inbounds float, float* %1, i64 1
store float %58, float* %59
%60 = load float, float* %37
%61 = load float, float* %39
%62 = fmul float %61, %52
%63 = call float @llvm.fmuladd.f32(float %49, float %60, float %62)
%64 = getelementptr inbounds float, float* %1, i64 2
store float %63, float* %64
%65 = call i32 @glmNormalizeVector3f(float* %1)
ret void
}