#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*/ glmCopyVector3f(float const *, float *);
float glmDotProduct3f(float const *, float const *);
int /*<<< orphan*/ glmMultVectorByScalar3f(float *, float);
int /*<<< orphan*/ glmSubtractVector3f(float *, float const *, float *);
void glmProjectVector3f(float result[3], const float v[3],
                        const float normal[3]) {
  float temp;
  float tempVector[3];
  temp = glmDotProduct3f(v, normal);
  glmCopyVector3f(normal, tempVector);
  glmMultVectorByScalar3f(tempVector, temp);
  glmSubtractVector3f(result, v, tempVector);
}


x86 assembly (clang, -O0):
<glmProjectVector3f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <glmDotProduct3f@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <glmCopyVector3f@plt>
lea    -0x28(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
call   1030 <glmMultVectorByScalar3f@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <glmSubtractVector3f@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmProjectVector3f>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1050 <glmDotProduct3f@plt>
movss  %xmm0,0x8(%rsp)
lea    0xc(%rsp),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <glmCopyVector3f@plt>
mov    %r12,%rdi
movss  0x8(%rsp),%xmm0
call   1030 <glmMultVectorByScalar3f@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <glmSubtractVector3f@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @glmProjectVector3f(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca [3 x float]
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%9 = load float*, float** %5
%10 = load float*, float** %6
%11 = call float @glmDotProduct3f(float* %9, float* %10)
store float %11, float* %7
%12 = load float*, float** %6
%13 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
%14 = call i32 @glmCopyVector3f(float* %12, float* %13)
%15 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
%16 = load float, float* %7
%17 = call i32 @glmMultVectorByScalar3f(float* %15, float %16)
%18 = load float*, float** %4
%19 = load float*, float** %5
%20 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
%21 = call i32 @glmSubtractVector3f(float* %18, float* %19, float* %20)
ret void
}

LLVM IR (-O2):
define void @glmProjectVector3f(float* %0, float* %1, float* %2) {
%4 = alloca [3 x float]
%5 = bitcast [3 x float]* %4 to i8*
%6 = tail call float @glmDotProduct3f(float* %1, float* %2)
%7 = getelementptr inbounds [3 x float], [3 x float]* %4, i64 0, i64 0
%8 = call i32 @glmCopyVector3f(float* %2, float* %7)
%9 = call i32 @glmMultVectorByScalar3f(float* %7, float %6)
%10 = call i32 @glmSubtractVector3f(float* %0, float* %1, float* %7)
ret void
}