#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*/ glmCopyVector2f(float const *, float *);
float glmDotProduct2f(float const *, float const *);
int /*<<< orphan*/ glmMultVectorByScalar2f(float *, float);
int /*<<< orphan*/ glmSubtractVector2f(float *, float const *, float *);
void glmProjectVector2f(float result[2], const float v[2],
                        const float normal[2]) {
  float temp;
  float tempVector[2];
  temp = glmDotProduct2f(v, normal);
  glmCopyVector2f(normal, tempVector);
  glmMultVectorByScalar2f(tempVector, temp);
  glmSubtractVector2f(result, v, tempVector);
}


x86 assembly (clang, -O0):
<glmProjectVector2f>:
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   1060 <glmDotProduct2f@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1050 <glmCopyVector2f@plt>
lea    -0x24(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
call   1030 <glmMultVectorByScalar2f@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1040 <glmSubtractVector2f@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmProjectVector2f>:
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   1060 <glmDotProduct2f@plt>
movss  %xmm0,0xc(%rsp)
lea    0x10(%rsp),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <glmCopyVector2f@plt>
mov    %r12,%rdi
movss  0xc(%rsp),%xmm0
call   1030 <glmMultVectorByScalar2f@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <glmSubtractVector2f@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @glmProjectVector2f(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca [2 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 @glmDotProduct2f(float* %9, float* %10)
store float %11, float* %7
%12 = load float*, float** %6
%13 = getelementptr inbounds [2 x float], [2 x float]* %8, i64 0, i64 0
%14 = call i32 @glmCopyVector2f(float* %12, float* %13)
%15 = getelementptr inbounds [2 x float], [2 x float]* %8, i64 0, i64 0
%16 = load float, float* %7
%17 = call i32 @glmMultVectorByScalar2f(float* %15, float %16)
%18 = load float*, float** %4
%19 = load float*, float** %5
%20 = getelementptr inbounds [2 x float], [2 x float]* %8, i64 0, i64 0
%21 = call i32 @glmSubtractVector2f(float* %18, float* %19, float* %20)
ret void
}

LLVM IR (-O2):
define void @glmProjectVector2f(float* %0, float* %1, float* %2) {
%4 = alloca [2 x float]
%5 = bitcast [2 x float]* %4 to i8*
%6 = tail call float @glmDotProduct2f(float* %1, float* %2)
%7 = getelementptr inbounds [2 x float], [2 x float]* %4, i64 0, i64 0
%8 = call i32 @glmCopyVector2f(float* %2, float* %7)
%9 = call i32 @glmMultVectorByScalar2f(float* %7, float %6)
%10 = call i32 @glmSubtractVector2f(float* %0, float* %1, float* %7)
ret void
}