#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 sqrtf(float);
void vec4_rev(float rev[4], float src[4]) {
  float module = (sqrtf((src)[0] * (src)[0] + (src)[1] * (src)[1] +
                        (src)[2] * (src)[2] + (src)[3] * (src)[3]));
  rev[3] = src[3] / module;
  rev[0] = -src[0] / module;
  rev[1] = -src[1] / module;
  rev[2] = -src[2] / module;
}


x86 assembly (clang, -O0):
<vec4_rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
divss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec4_rev>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movss  (%rsi),%xmm0
movss  0x4(%rsi),%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  0x8(%rsi),%xmm1
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0xc(%rsi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1157 <vec4_rev+0x47>
sqrtss %xmm0,%xmm0
jmp    115c <vec4_rev+0x4c>
call   1030 <sqrtf@plt>
movss  0xc(%rbx),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0xc(%r14)
movss  (%rbx),%xmm1
movaps 0xe8a(%rip),%xmm2
xorps  %xmm2,%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,(%r14)
movss  0x4(%rbx),%xmm1
xorps  %xmm2,%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%r14)
movss  0x8(%rbx),%xmm1
xorps  %xmm2,%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @vec4_rev(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %4
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = load float*, float** %4
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = fmul float %14, %17
%19 = call float @llvm.fmuladd.f32(float %8, float %11, float %18)
%20 = load float*, float** %4
%21 = getelementptr inbounds float, float* %20, i64 2
%22 = load float, float* %21
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 2
%25 = load float, float* %24
%26 = call float @llvm.fmuladd.f32(float %22, float %25, float %19)
%27 = load float*, float** %4
%28 = getelementptr inbounds float, float* %27, i64 3
%29 = load float, float* %28
%30 = load float*, float** %4
%31 = getelementptr inbounds float, float* %30, i64 3
%32 = load float, float* %31
%33 = call float @llvm.fmuladd.f32(float %29, float %32, float %26)
%34 = call float @sqrtf(float %33)
store float %34, float* %5
%35 = load float*, float** %4
%36 = getelementptr inbounds float, float* %35, i64 3
%37 = load float, float* %36
%38 = load float, float* %5
%39 = fdiv float %37, %38
%40 = load float*, float** %3
%41 = getelementptr inbounds float, float* %40, i64 3
store float %39, float* %41
%42 = load float*, float** %4
%43 = getelementptr inbounds float, float* %42, i64 0
%44 = load float, float* %43
%45 = fneg float %44
%46 = load float, float* %5
%47 = fdiv float %45, %46
%48 = load float*, float** %3
%49 = getelementptr inbounds float, float* %48, i64 0
store float %47, float* %49
%50 = load float*, float** %4
%51 = getelementptr inbounds float, float* %50, i64 1
%52 = load float, float* %51
%53 = fneg float %52
%54 = load float, float* %5
%55 = fdiv float %53, %54
%56 = load float*, float** %3
%57 = getelementptr inbounds float, float* %56, i64 1
store float %55, float* %57
%58 = load float*, float** %4
%59 = getelementptr inbounds float, float* %58, i64 2
%60 = load float, float* %59
%61 = fneg float %60
%62 = load float, float* %5
%63 = fdiv float %61, %62
%64 = load float*, float** %3
%65 = getelementptr inbounds float, float* %64, i64 2
store float %63, float* %65
ret void
}

LLVM IR (-O2):
define void @vec4_rev(float* nocapture writeonly %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = fmul float %5, %5
%7 = tail call float @llvm.fmuladd.f32(float %3, float %3, float %6)
%8 = getelementptr inbounds float, float* %1, i64 2
%9 = load float, float* %8
%10 = tail call float @llvm.fmuladd.f32(float %9, float %9, float %7)
%11 = getelementptr inbounds float, float* %1, i64 3
%12 = load float, float* %11
%13 = tail call float @llvm.fmuladd.f32(float %12, float %12, float %10)
%14 = tail call float @sqrtf(float %13)
%15 = load float, float* %11
%16 = fdiv float %15, %14
%17 = getelementptr inbounds float, float* %0, i64 3
store float %16, float* %17
%18 = load float, float* %1
%19 = fneg float %18
%20 = fdiv float %19, %14
store float %20, float* %0
%21 = load float, float* %4
%22 = fneg float %21
%23 = fdiv float %22, %14
%24 = getelementptr inbounds float, float* %0, i64 1
store float %23, float* %24
%25 = load float, float* %8
%26 = fneg float %25
%27 = fdiv float %26, %14
%28 = getelementptr inbounds float, float* %0, i64 2
store float %27, float* %28
ret void
}