#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 */
float glmDotProduct3f(float const *, float const *);
int /*<<< orphan*/ glmMakeVector3f(float *, float const *, float const *);
float glmComputeImpulse3f(const float v1[3], const float v2[3], float invM1,
                          float invM2, const float normal[3], float e) {
  float d;
  float v[3];
  d = glmDotProduct3f(normal, normal);
  d *= invM1 + invM2;
  glmMakeVector3f(v, v1, v2);
  return -((1.0f + e) * glmDotProduct3f(v, normal)) / d;
}


x86 assembly (clang, -O0):
<glmComputeImpulse3f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movss  %xmm2,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <glmDotProduct3f@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
mulss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
lea    -0x34(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <glmMakeVector3f@plt>
movss  0xe7e(%rip),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
lea    -0x34(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <glmDotProduct3f@plt>
movaps %xmm0,%xmm1
movss  -0x38(%rbp),%xmm0
mulss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeImpulse3f>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
movaps %xmm2,0x10(%rsp)
mov    %rdx,%rbx
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    %rdx,%rsi
call   1040 <glmDotProduct3f@plt>
movss  0x8(%rsp),%xmm1
addss  0xc(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
lea    0x2c(%rsp),%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <glmMakeVector3f@plt>
movaps 0x10(%rsp),%xmm0
addss  0xe7a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <glmDotProduct3f@plt>
movaps 0x10(%rsp),%xmm1
xorps  0xe6e(%rip),%xmm1
mulss  %xmm1,%xmm0
divss  0x8(%rsp),%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @glmComputeImpulse3f(float* %0, float* %1, float %2, float %3, float* %4, float %5) {
%7 = alloca float*
%8 = alloca float*
%9 = alloca float
%10 = alloca float
%11 = alloca float*
%12 = alloca float
%13 = alloca float
%14 = alloca [3 x float]
store float* %0, float** %7
store float* %1, float** %8
store float %2, float* %9
store float %3, float* %10
store float* %4, float** %11
store float %5, float* %12
%15 = load float*, float** %11
%16 = load float*, float** %11
%17 = call float @glmDotProduct3f(float* %15, float* %16)
store float %17, float* %13
%18 = load float, float* %9
%19 = load float, float* %10
%20 = fadd float %18, %19
%21 = load float, float* %13
%22 = fmul float %21, %20
store float %22, float* %13
%23 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%24 = load float*, float** %7
%25 = load float*, float** %8
%26 = call i32 @glmMakeVector3f(float* %23, float* %24, float* %25)
%27 = load float, float* %12
%28 = fadd float 1.000000e+00, %27
%29 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%30 = load float*, float** %11
%31 = call float @glmDotProduct3f(float* %29, float* %30)
%32 = fmul float %28, %31
%33 = fneg float %32
%34 = load float, float* %13
%35 = fdiv float %33, %34
ret float %35
}

LLVM IR (-O2):
define float @glmComputeImpulse3f(float* %0, float* %1, float %2, float %3, float* %4, float %5) {
%7 = alloca [3 x float]
%8 = bitcast [3 x float]* %7 to i8*
%9 = tail call float @glmDotProduct3f(float* %4, float* %4)
%10 = fadd float %2, %3
%11 = fmul float %10, %9
%12 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%13 = call i32 @glmMakeVector3f(float* %12, float* %0, float* %1)
%14 = fadd float %5, 1.000000e+00
%15 = call float @glmDotProduct3f(float* %12, float* %4)
%16 = fneg float %14
%17 = fmul float %15, %16
%18 = fdiv float %17, %11
ret float %18
}