#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 rand();
void loadRandomColor(float color[]) {
  color[0] = (rand() % 256) / 255.0f;
  color[1] = (rand() % 256) / 255.0f;
  color[2] = (rand() % 256) / 255.0f;
}


x86 assembly (clang, -O0):
<loadRandomColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movss  0xec9(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movss  0xea2(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movss  0xe7a(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadRandomColor>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
divss  0xec6(%rip),%xmm0
movss  %xmm0,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0xe99(%rip),%xmm0
movss  %xmm0,0x4(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0xe6b(%rip),%xmm0
movss  %xmm0,0x8(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @loadRandomColor(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 256
%5 = sitofp i32 %4 to float
%6 = fdiv float %5, 2.550000e+02
%7 = load float*, float** %2
%8 = getelementptr inbounds float, float* %7, i64 0
store float %6, float* %8
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 256
%11 = sitofp i32 %10 to float
%12 = fdiv float %11, 2.550000e+02
%13 = load float*, float** %2
%14 = getelementptr inbounds float, float* %13, i64 1
store float %12, float* %14
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 256
%17 = sitofp i32 %16 to float
%18 = fdiv float %17, 2.550000e+02
%19 = load float*, float** %2
%20 = getelementptr inbounds float, float* %19, i64 2
store float %18, float* %20
ret void
}

LLVM IR (-O2):
define void @loadRandomColor(float* nocapture writeonly %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 256
%4 = sitofp i32 %3 to float
%5 = fdiv float %4, 2.550000e+02
store float %5, float* %0
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 256
%8 = sitofp i32 %7 to float
%9 = fdiv float %8, 2.550000e+02
%10 = getelementptr inbounds float, float* %0, i64 1
store float %9, float* %10
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 256
%13 = sitofp i32 %12 to float
%14 = fdiv float %13, 2.550000e+02
%15 = getelementptr inbounds float, float* %0, i64 2
store float %14, float* %15
ret void
}