#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 fabs(double);
void color(double c[3], double p[3]) {
  c[0] = fabs(p[0]) + .4;
  c[1] = fabs(p[1]) * 1 + .4;
  c[2] = fabs(p[2]) * 2 + .4;
}


x86 assembly (clang, -O0):
<color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xec7(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <fabs@plt>
shl    $0x0,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe9e(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
call   1030 <fabs@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe74(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<color>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  (%rsi),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xece(%rip),%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbx),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xeb0(%rip),%xmm0
movsd  %xmm0,0x8(%r14)
movsd  0x10(%rbx),%xmm0
call   1030 <fabs@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe8f(%rip),%xmm0
movsd  %xmm0,0x10(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @color(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = call i32 @fabs(double %7)
%9 = sitofp i32 %8 to double
%10 = fadd double %9, 4.000000e-01
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 0
store double %10, double* %12
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 1
%15 = load double, double* %14
%16 = call i32 @fabs(double %15)
%17 = mul nsw i32 %16, 1
%18 = sitofp i32 %17 to double
%19 = fadd double %18, 4.000000e-01
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 1
store double %19, double* %21
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = call i32 @fabs(double %24)
%26 = mul nsw i32 %25, 2
%27 = sitofp i32 %26 to double
%28 = fadd double %27, 4.000000e-01
%29 = load double*, double** %3
%30 = getelementptr inbounds double, double* %29, i64 2
store double %28, double* %30
ret void
}

LLVM IR (-O2):
define void @color(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = tail call i32 @fabs(double %3)
%5 = sitofp i32 %4 to double
%6 = fadd double %5, 4.000000e-01
store double %6, double* %0
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = tail call i32 @fabs(double %8)
%10 = sitofp i32 %9 to double
%11 = fadd double %10, 4.000000e-01
%12 = getelementptr inbounds double, double* %0, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call i32 @fabs(double %14)
%16 = shl nsw i32 %15, 1
%17 = sitofp i32 %16 to double
%18 = fadd double %17, 4.000000e-01
%19 = getelementptr inbounds double, double* %0, i64 2
store double %18, double* %19
ret void
}