#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 six_f3(int a, int b, int c, int d) {
  double ab, ac, ad, bc, bd, cb, cd, db, dc;
  ab = probability(a, b);
  ac = probability(a, c);
  ad = probability(a, d);
  bc = probability(b, c);
  bd = probability(b, d);
  cd = probability(c, d);
  cb = 1.0 - bc;
  db = 1.0 - bd;
  dc = 1.0 - cd;
  return (ab * ac * (cd + bd) + ac * ad * (db + cb) + ab * ad * (dc + bc));
}


x86 assembly (clang, -O0):
<six_f3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%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    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <probability@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <probability@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <probability@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <probability@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  0xe74(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe62(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe50(%rip),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
addsd  -0x38(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm3
addsd  -0x40(%rbp),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
addsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<six_f3>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <probability@plt>
movsd  %xmm0,0x20(%rsp)
mov    %ebp,%edi
mov    %r15d,%esi
call   1030 <probability@plt>
movsd  %xmm0,0x18(%rsp)
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <probability@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%edi
mov    %r15d,%esi
call   1030 <probability@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <probability@plt>
movsd  %xmm0,(%rsp)
mov    %r15d,%edi
mov    %r14d,%esi
call   1030 <probability@plt>
movsd  0xe7f(%rip),%xmm1
movapd %xmm1,%xmm2
movsd  0x8(%rsp),%xmm6
subsd  %xmm6,%xmm2
movapd %xmm1,%xmm3
movsd  (%rsp),%xmm7
subsd  %xmm7,%xmm3
addsd  %xmm2,%xmm3
subsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm4
movapd %xmm4,%xmm2
movsd  0x18(%rsp),%xmm5
mulsd  %xmm5,%xmm2
addsd  %xmm7,%xmm0
mulsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm5
mulsd  %xmm3,%xmm5
addsd  %xmm5,%xmm0
mulsd  %xmm2,%xmm4
addsd  %xmm6,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm1,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @six_f3(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = call double @probability(i32 %18, i32 %19)
store double %20, double* %9
%21 = load i32, i32* %5
%22 = load i32, i32* %7
%23 = call double @probability(i32 %21, i32 %22)
store double %23, double* %10
%24 = load i32, i32* %5
%25 = load i32, i32* %8
%26 = call double @probability(i32 %24, i32 %25)
store double %26, double* %11
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = call double @probability(i32 %27, i32 %28)
store double %29, double* %12
%30 = load i32, i32* %6
%31 = load i32, i32* %8
%32 = call double @probability(i32 %30, i32 %31)
store double %32, double* %13
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = call double @probability(i32 %33, i32 %34)
store double %35, double* %15
%36 = load double, double* %12
%37 = fsub double 1.000000e+00, %36
store double %37, double* %14
%38 = load double, double* %13
%39 = fsub double 1.000000e+00, %38
store double %39, double* %16
%40 = load double, double* %15
%41 = fsub double 1.000000e+00, %40
store double %41, double* %17
%42 = load double, double* %9
%43 = load double, double* %10
%44 = fmul double %42, %43
%45 = load double, double* %15
%46 = load double, double* %13
%47 = fadd double %45, %46
%48 = load double, double* %10
%49 = load double, double* %11
%50 = fmul double %48, %49
%51 = load double, double* %16
%52 = load double, double* %14
%53 = fadd double %51, %52
%54 = fmul double %50, %53
%55 = call double @llvm.fmuladd.f64(double %44, double %47, double %54)
%56 = load double, double* %9
%57 = load double, double* %11
%58 = fmul double %56, %57
%59 = load double, double* %17
%60 = load double, double* %12
%61 = fadd double %59, %60
%62 = call double @llvm.fmuladd.f64(double %58, double %61, double %55)
ret double %62
}

LLVM IR (-O2):
define double @six_f3(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call double @probability(i32 %0, i32 %1)
%6 = tail call double @probability(i32 %0, i32 %2)
%7 = tail call double @probability(i32 %0, i32 %3)
%8 = tail call double @probability(i32 %1, i32 %2)
%9 = tail call double @probability(i32 %1, i32 %3)
%10 = tail call double @probability(i32 %2, i32 %3)
%11 = fsub double 1.000000e+00, %8
%12 = fsub double 1.000000e+00, %9
%13 = fsub double 1.000000e+00, %10
%14 = fmul double %5, %6
%15 = fadd double %9, %10
%16 = fmul double %6, %7
%17 = fadd double %11, %12
%18 = fmul double %16, %17
%19 = tail call double @llvm.fmuladd.f64(double %14, double %15, double %18)
%20 = fmul double %5, %7
%21 = fadd double %8, %13
%22 = tail call double @llvm.fmuladd.f64(double %20, double %21, double %19)
ret double %22
}