#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, float);
float read_float(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  float homo_dom, hetro, homo_rec, total;
  float homo_dom_p, _hetro_p, hetro_p, _homo_rec_p, homo_rec_p;
  if (argc != 4) {
    fprintf(stderr, "invalid number of arguments provided\n");
    return 1;
  }
  homo_dom = read_float(argv[1]);
  hetro = read_float(argv[2]);
  homo_rec = read_float(argv[3]);
  total = homo_dom + hetro + homo_rec;
  homo_dom_p = homo_dom / total;
  _hetro_p = hetro / 2 / total;
  hetro_p = _hetro_p + (_hetro_p * (homo_dom / (total - 1))) +
            (_hetro_p * ((hetro - 1) / 2 / (total - 1)));
  _homo_rec_p = homo_rec / total;
  homo_rec_p = (_homo_rec_p * (homo_dom / (total - 1))) +
               (_homo_rec_p * (hetro / 2 / (total - 1)));
  printf("%.6f\n", homo_dom_p + hetro_p + homo_rec_p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1171 <main+0x41>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12e1 <main+0x1b1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <read_float@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <read_float@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <read_float@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xe2d(%rip),%xmm1
divss  %xmm1,%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x20(%rbp),%xmm3
movss  0xdff(%rip),%xmm4
subss  %xmm4,%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movss  0xddd(%rip),%xmm3
subss  %xmm3,%xmm2
movss  0xdd5(%rip),%xmm3
divss  %xmm3,%xmm2
movss  -0x20(%rbp),%xmm3
movss  0xdc0(%rip),%xmm4
subss  %xmm4,%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movss  -0x20(%rbp),%xmm1
movss  0xd85(%rip),%xmm3
subss  %xmm3,%xmm1
divss  %xmm1,%xmm2
movss  -0x30(%rbp),%xmm1
movss  -0x18(%rbp),%xmm3
movss  0xd6f(%rip),%xmm4
divss  %xmm4,%xmm3
movss  -0x20(%rbp),%xmm4
movss  0xd5a(%rip),%xmm5
subss  %xmm5,%xmm4
divss  %xmm4,%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
addss  -0x34(%rbp),%xmm0
lea    0xd59(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
cmp    $0x4,%edi
jne    1202 <main+0xd2>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <read_float@plt>
movss  %xmm0,0xc(%rsp)
mov    0x10(%rbx),%rdi
call   1030 <read_float@plt>
movaps %xmm0,0x10(%rsp)
mov    0x18(%rbx),%rdi
call   1030 <read_float@plt>
movss  0xc(%rsp),%xmm2
movaps %xmm2,%xmm1
movaps 0x10(%rsp),%xmm5
addss  %xmm5,%xmm1
addss  %xmm0,%xmm1
movaps %xmm2,%xmm8
movaps %xmm2,%xmm7
divss  %xmm1,%xmm8
movss  0xe6f(%rip),%xmm2
movaps %xmm5,%xmm4
mulss  %xmm2,%xmm4
unpcklps %xmm4,%xmm0
divss  %xmm1,%xmm4
unpcklps %xmm1,%xmm5
addps  0xe67(%rip),%xmm5
movaps %xmm5,%xmm3
shufps $0x55,%xmm5,%xmm3
divss  %xmm3,%xmm7
movaps %xmm4,%xmm6
mulss  %xmm7,%xmm6
addss  %xmm4,%xmm6
mulss  %xmm5,%xmm2
divss  %xmm3,%xmm2
mulss  %xmm4,%xmm2
addss  %xmm6,%xmm2
addss  %xmm8,%xmm2
movss  %xmm1,%xmm5
divps  %xmm5,%xmm0
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm7,%xmm0
addss  %xmm1,%xmm0
addss  %xmm2,%xmm0
lea    0xe4d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    121c <main+0xec>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xe0e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"invalid number of arguments provided\0A\00"
@.str.1 = [6 x i8] c"%.6f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 4
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %82
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call float @read_float(i8* %23)
store float %24, float* %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call float @read_float(i8* %27)
store float %28, float* %7
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call float @read_float(i8* %31)
store float %32, float* %8
%33 = load float, float* %6
%34 = load float, float* %7
%35 = fadd float %33, %34
%36 = load float, float* %8
%37 = fadd float %35, %36
store float %37, float* %9
%38 = load float, float* %6
%39 = load float, float* %9
%40 = fdiv float %38, %39
store float %40, float* %10
%41 = load float, float* %7
%42 = fdiv float %41, 2.000000e+00
%43 = load float, float* %9
%44 = fdiv float %42, %43
store float %44, float* %11
%45 = load float, float* %11
%46 = load float, float* %11
%47 = load float, float* %6
%48 = load float, float* %9
%49 = fsub float %48, 1.000000e+00
%50 = fdiv float %47, %49
%51 = call float @llvm.fmuladd.f32(float %46, float %50, float %45)
%52 = load float, float* %11
%53 = load float, float* %7
%54 = fsub float %53, 1.000000e+00
%55 = fdiv float %54, 2.000000e+00
%56 = load float, float* %9
%57 = fsub float %56, 1.000000e+00
%58 = fdiv float %55, %57
%59 = call float @llvm.fmuladd.f32(float %52, float %58, float %51)
store float %59, float* %12
%60 = load float, float* %8
%61 = load float, float* %9
%62 = fdiv float %60, %61
store float %62, float* %13
%63 = load float, float* %13
%64 = load float, float* %6
%65 = load float, float* %9
%66 = fsub float %65, 1.000000e+00
%67 = fdiv float %64, %66
%68 = load float, float* %13
%69 = load float, float* %7
%70 = fdiv float %69, 2.000000e+00
%71 = load float, float* %9
%72 = fsub float %71, 1.000000e+00
%73 = fdiv float %70, %72
%74 = fmul float %68, %73
%75 = call float @llvm.fmuladd.f32(float %63, float %67, float %74)
store float %75, float* %14
%76 = load float, float* %10
%77 = load float, float* %12
%78 = fadd float %76, %77
%79 = load float, float* %14
%80 = fadd float %78, %79
%81 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float %80)
store i32 0, i32* %3
br label %82
82: ; preds = %20, %17
%83 = load i32, i32* %3
ret i32 %83
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"invalid number of arguments provided\0A\00"
@.str.1 = [6 x i8] c"%.6f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %44
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call float @read_float(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call float @read_float(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call float @read_float(i8* %15)
%17 = fadd float %10, %13
%18 = fadd float %17, %16
%19 = fdiv float %10, %18
%20 = fmul float %13, 5.000000e-01
%21 = fdiv float %20, %18
%22 = insertelement <2 x float> poison, float %13, i64 0
%23 = insertelement <2 x float> %22, float %18, i64 1
%24 = fadd <2 x float> %23, <float -1.000000e+00, float -1.000000e+00>
%25 = extractelement <2 x float> %24, i64 1
%26 = fdiv float %10, %25
%27 = tail call float @llvm.fmuladd.f32(float %21, float %26, float %21)
%28 = extractelement <2 x float> %24, i64 0
%29 = fmul float %28, 5.000000e-01
%30 = fdiv float %29, %25
%31 = tail call float @llvm.fmuladd.f32(float %21, float %30, float %27)
%32 = insertelement <2 x float> poison, float %16, i64 0
%33 = insertelement <2 x float> %32, float %20, i64 1
%34 = insertelement <2 x float> %24, float %18, i64 0
%35 = fdiv <2 x float> %33, %34
%36 = extractelement <2 x float> %35, i64 0
%37 = shufflevector <2 x float> %35, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%38 = fmul <2 x float> %35, %37
%39 = extractelement <2 x float> %38, i64 0
%40 = tail call float @llvm.fmuladd.f32(float %36, float %26, float %39)
%41 = fadd float %19, %31
%42 = fadd float %40, %41
%43 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float %42)
br label %44
44: ; preds = %7, %4
%45 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %45
}