#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*/ get_random3f(float *);
int /*<<< orphan*/ inline_normalize3f(float *);
void scatter3f(float *v, float weight) {
  float r[3];
  get_random3f(r);
  {
    (r)[0] = (r)[0] * (weight);
    (r)[1] = (r)[1] * (weight);
    (r)[2] = (r)[2] * (weight);
  };
  {
    (v)[0] = (r)[0] + (v)[0];
    (v)[1] = (r)[1] + (v)[1];
    (v)[2] = (r)[2] + (v)[2];
  };
  inline_normalize3f(v);
}


x86 assembly (clang, -O0):
<scatter3f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <get_random3f@plt>
movss  -0x18(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <inline_normalize3f@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scatter3f>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
mov    %rsp,%rdi
call   1030 <get_random3f@plt>
movss  (%rsp),%xmm0
movss  0xc(%rsp),%xmm2
mulss  %xmm2,%xmm0
movss  %xmm0,(%rsp)
movss  0x4(%rsp),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0x4(%rsp)
mulss  0x8(%rsp),%xmm2
movss  %xmm2,0x8(%rsp)
addss  (%rbx),%xmm0
movss  %xmm0,(%rbx)
addss  0x4(%rbx),%xmm1
movss  %xmm1,0x4(%rbx)
addss  0x8(%rbx),%xmm2
movss  %xmm2,0x8(%rbx)
mov    %rbx,%rdi
call   1040 <inline_normalize3f@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @scatter3f(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
%5 = alloca [3 x float]
store float* %0, float** %3
store float %1, float* %4
%6 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%7 = call i32 @get_random3f(float* %6)
%8 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%9 = load float, float* %8
%10 = load float, float* %4
%11 = fmul float %9, %10
%12 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
store float %11, float* %12
%13 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
%14 = load float, float* %13
%15 = load float, float* %4
%16 = fmul float %14, %15
%17 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
store float %16, float* %17
%18 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
%19 = load float, float* %18
%20 = load float, float* %4
%21 = fmul float %19, %20
%22 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
store float %21, float* %22
%23 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%24 = load float, float* %23
%25 = load float*, float** %3
%26 = getelementptr inbounds float, float* %25, i64 0
%27 = load float, float* %26
%28 = fadd float %24, %27
%29 = load float*, float** %3
%30 = getelementptr inbounds float, float* %29, i64 0
store float %28, float* %30
%31 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
%32 = load float, float* %31
%33 = load float*, float** %3
%34 = getelementptr inbounds float, float* %33, i64 1
%35 = load float, float* %34
%36 = fadd float %32, %35
%37 = load float*, float** %3
%38 = getelementptr inbounds float, float* %37, i64 1
store float %36, float* %38
%39 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
%40 = load float, float* %39
%41 = load float*, float** %3
%42 = getelementptr inbounds float, float* %41, i64 2
%43 = load float, float* %42
%44 = fadd float %40, %43
%45 = load float*, float** %3
%46 = getelementptr inbounds float, float* %45, i64 2
store float %44, float* %46
%47 = load float*, float** %3
%48 = call i32 @inline_normalize3f(float* %47)
ret void
}

LLVM IR (-O2):
define void @scatter3f(float* %0, float %1) {
%3 = alloca [3 x float]
%4 = bitcast [3 x float]* %3 to i8*
%5 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%6 = call i32 @get_random3f(float* %5)
%7 = load float, float* %5
%8 = fmul float %7, %1
store float %8, float* %5
%9 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 1
%10 = load float, float* %9
%11 = fmul float %10, %1
store float %11, float* %9
%12 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 2
%13 = load float, float* %12
%14 = fmul float %13, %1
store float %14, float* %12
%15 = load float, float* %0
%16 = fadd float %8, %15
store float %16, float* %0
%17 = getelementptr inbounds float, float* %0, i64 1
%18 = load float, float* %17
%19 = fadd float %11, %18
store float %19, float* %17
%20 = getelementptr inbounds float, float* %0, i64 2
%21 = load float, float* %20
%22 = fadd float %14, %21
store float %22, float* %20
%23 = call i32 @inline_normalize3f(float* %0)
ret void
}