#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 */
double probability(int, int);
double five_f2(int a, int b, int c) {
  double ab, ac, bc, cb;
  ab = probability(a, b);
  ac = probability(a, c);
  bc = probability(b, c);
  cb = 1.0 - bc;
  return (2 * (ab * ac) + bc * ab + cb * ac);
}


x86 assembly (clang, -O0):
<five_f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <probability@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <probability@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <probability@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xea7(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<five_f2>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <probability@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <probability@plt>
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <probability@plt>
movsd  0xeb5(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm2
movsd  (%rsp),%xmm4
mulsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm2
addsd  %xmm2,%xmm0
mulsd  %xmm4,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @five_f2(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call double @probability(i32 %11, i32 %12)
store double %13, double* %7
%14 = load i32, i32* %4
%15 = load i32, i32* %6
%16 = call double @probability(i32 %14, i32 %15)
store double %16, double* %8
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call double @probability(i32 %17, i32 %18)
store double %19, double* %9
%20 = load double, double* %9
%21 = fsub double 1.000000e+00, %20
store double %21, double* %10
%22 = load double, double* %7
%23 = load double, double* %8
%24 = fmul double %22, %23
%25 = load double, double* %9
%26 = load double, double* %7
%27 = fmul double %25, %26
%28 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %24, double %27)
%29 = load double, double* %10
%30 = load double, double* %8
%31 = call double @llvm.fmuladd.f64(double %29, double %30, double %28)
ret double %31
}

LLVM IR (-O2):
define double @five_f2(i32 %0, i32 %1, i32 %2) {
%4 = tail call double @probability(i32 %0, i32 %1)
%5 = tail call double @probability(i32 %0, i32 %2)
%6 = tail call double @probability(i32 %1, i32 %2)
%7 = fsub double 1.000000e+00, %6
%8 = fmul double %4, %5
%9 = fmul double %4, %6
%10 = tail call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double %9)
%11 = tail call double @llvm.fmuladd.f64(double %7, double %5, double %10)
ret double %11
}