void norm_rgb(double *r, double *g, double *b) {
  double greatest = (((*r) > ((((*g) > (*b)) ? (*g) : (*b))))
                         ? (*r)
                         : ((((*g) > (*b)) ? (*g) : (*b))));
  if (greatest > 0) {
    *r /= greatest;
    *g /= greatest;
    *b /= greatest;
  }
}


x86 assembly (clang, -O0):
<norm_rgb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1145 <norm_rgb+0x45>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1152 <norm_rgb+0x52>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1178 <norm_rgb+0x78>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11b7 <norm_rgb+0xb7>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    11a0 <norm_rgb+0xa0>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11ad <norm_rgb+0xad>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1212 <norm_rgb+0x112>
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm_rgb>:
movsd  (%rdi),%xmm1
movsd  (%rsi),%xmm2
maxsd  (%rdx),%xmm2
movapd %xmm1,%xmm0
maxsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jbe    113e <norm_rgb+0x3e>
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi)
movsd  (%rsi),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
movsd  (%rdx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx)
ret

LLVM IR (-O0):
define void @norm_rgb(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double*, double** %4
%9 = load double, double* %8
%10 = load double*, double** %5
%11 = load double, double* %10
%12 = load double*, double** %6
%13 = load double, double* %12
%14 = fcmp ogt double %11, %13
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load double*, double** %5
%17 = load double, double* %16
br label %21
18: ; preds = %3
%19 = load double*, double** %6
%20 = load double, double* %19
br label %21
21: ; preds = %18, %15
%22 = phi double [ %17, %15 ], [ %20, %18 ]
%23 = fcmp ogt double %9, %22
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load double*, double** %4
%26 = load double, double* %25
br label %41
27: ; preds = %21
%28 = load double*, double** %5
%29 = load double, double* %28
%30 = load double*, double** %6
%31 = load double, double* %30
%32 = fcmp ogt double %29, %31
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = load double*, double** %5
%35 = load double, double* %34
br label %39
36: ; preds = %27
%37 = load double*, double** %6
%38 = load double, double* %37
br label %39
39: ; preds = %36, %33
%40 = phi double [ %35, %33 ], [ %38, %36 ]
br label %41
41: ; preds = %39, %24
%42 = phi double [ %26, %24 ], [ %40, %39 ]
store double %42, double* %7
%43 = load double, double* %7
%44 = fcmp ogt double %43, 0.000000e+00
br i1 %44, label %45, label %58
45: ; preds = %41
%46 = load double, double* %7
%47 = load double*, double** %4
%48 = load double, double* %47
%49 = fdiv double %48, %46
store double %49, double* %47
%50 = load double, double* %7
%51 = load double*, double** %5
%52 = load double, double* %51
%53 = fdiv double %52, %50
store double %53, double* %51
%54 = load double, double* %7
%55 = load double*, double** %6
%56 = load double, double* %55
%57 = fdiv double %56, %54
store double %57, double* %55
br label %58
58: ; preds = %45, %41
ret void
}

LLVM IR (-O2):
define void @norm_rgb(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = load double, double* %2
%7 = fcmp ogt double %5, %6
%8 = select i1 %7, double %5, double %6
%9 = fcmp ogt double %4, %8
%10 = select i1 %9, double %4, double %8
%11 = fcmp ogt double %10, 0.000000e+00
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = fdiv double %4, %10
store double %13, double* %0
%14 = load double, double* %1
%15 = fdiv double %14, %10
store double %15, double* %1
%16 = load double, double* %2
%17 = fdiv double %16, %10
store double %17, double* %2
br label %18
18: ; preds = %12, %3
ret void
}