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


x86 assembly (clang, -O0):
<glmComputeImpulse3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <glmDotProduct3d@plt>
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <glmMakeVector3d@plt>
movsd  0xe7a(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <glmDotProduct3d@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x38(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeImpulse3d>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
movaps %xmm2,0x10(%rsp)
mov    %rdx,%rbx
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    %rdx,%rsi
call   1040 <glmDotProduct3d@plt>
cvtss2sd %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  0x28(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0x30(%rsp),%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <glmMakeVector3d@plt>
movapd 0x10(%rsp),%xmm0
addsd  0xe75(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <glmDotProduct3d@plt>
cvtss2sd %xmm0,%xmm0
movapd 0x10(%rsp),%xmm1
xorpd  0xe62(%rip),%xmm1
mulsd  %xmm0,%xmm1
divsd  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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