#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 ur_dot(float const *, float const *);
void ur_reflect(const float *a, const float *b, float *result) {
  float dot2 = ur_dot(a, b) * 2.0f;
  result[0] = a[0] - (b[0] * dot2);
  result[1] = a[1] - (b[1] * dot2);
  result[2] = a[2] - (b[2] * dot2);
}


x86 assembly (clang, -O0):
<ur_reflect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ur_dot@plt>
movss  0xec7(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x1c(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  -0x1c(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  -0x1c(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ur_reflect>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <ur_dot@plt>
addss  %xmm0,%xmm0
movss  (%rbx),%xmm1
movss  (%r15),%xmm2
mulss  %xmm0,%xmm2
subss  %xmm2,%xmm1
movss  %xmm1,(%r14)
movss  0x4(%rbx),%xmm1
movss  0x4(%r15),%xmm2
mulss  %xmm0,%xmm2
subss  %xmm2,%xmm1
movss  %xmm1,0x4(%r14)
movss  0x8(%rbx),%xmm1
mulss  0x8(%r15),%xmm0
subss  %xmm0,%xmm1
movss  %xmm1,0x8(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ur_reflect(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%8 = load float*, float** %4
%9 = load float*, float** %5
%10 = call float @ur_dot(float* %8, float* %9)
%11 = fmul float %10, 2.000000e+00
store float %11, float* %7
%12 = load float*, float** %4
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = load float*, float** %5
%16 = getelementptr inbounds float, float* %15, i64 0
%17 = load float, float* %16
%18 = load float, float* %7
%19 = fneg float %17
%20 = call float @llvm.fmuladd.f32(float %19, float %18, float %14)
%21 = load float*, float** %6
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 1
%25 = load float, float* %24
%26 = load float*, float** %5
%27 = getelementptr inbounds float, float* %26, i64 1
%28 = load float, float* %27
%29 = load float, float* %7
%30 = fneg float %28
%31 = call float @llvm.fmuladd.f32(float %30, float %29, float %25)
%32 = load float*, float** %6
%33 = getelementptr inbounds float, float* %32, i64 1
store float %31, float* %33
%34 = load float*, float** %4
%35 = getelementptr inbounds float, float* %34, i64 2
%36 = load float, float* %35
%37 = load float*, float** %5
%38 = getelementptr inbounds float, float* %37, i64 2
%39 = load float, float* %38
%40 = load float, float* %7
%41 = fneg float %39
%42 = call float @llvm.fmuladd.f32(float %41, float %40, float %36)
%43 = load float*, float** %6
%44 = getelementptr inbounds float, float* %43, i64 2
store float %42, float* %44
ret void
}

LLVM IR (-O2):
define void @ur_reflect(float* %0, float* %1, float* nocapture writeonly %2) {
%4 = tail call float @ur_dot(float* %0, float* %1)
%5 = fmul float %4, 2.000000e+00
%6 = load float, float* %0
%7 = load float, float* %1
%8 = fneg float %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float %5, float %6)
store float %9, float* %2
%10 = getelementptr inbounds float, float* %0, i64 1
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %1, i64 1
%13 = load float, float* %12
%14 = fneg float %13
%15 = tail call float @llvm.fmuladd.f32(float %14, float %5, float %11)
%16 = getelementptr inbounds float, float* %2, i64 1
store float %15, float* %16
%17 = getelementptr inbounds float, float* %0, i64 2
%18 = load float, float* %17
%19 = getelementptr inbounds float, float* %1, i64 2
%20 = load float, float* %19
%21 = fneg float %20
%22 = tail call float @llvm.fmuladd.f32(float %21, float %5, float %18)
%23 = getelementptr inbounds float, float* %2, i64 2
store float %22, float* %23
ret void
}