#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 survive(int, int, int);
double life_chance(int w1, int b1, int r1, int w2, int b2, int r2, int w3,
                   int b3, int r3) {
  return (survive(w1, b1, r1) + survive(w2, b2, r2) + survive(w3, b3, r3)) /
         3.0;
}


x86 assembly (clang, -O0):
<life_chance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <survive@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <survive@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x10(%rbp),%edi
mov    0x18(%rbp),%esi
mov    0x20(%rbp),%edx
call   1030 <survive@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe77(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<life_chance>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%ebp
mov    %ecx,%ebx
mov    0x40(%rsp),%r15d
mov    0x48(%rsp),%r12d
mov    0x50(%rsp),%r13d
call   1030 <survive@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <survive@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %r15d,%edi
mov    %r12d,%esi
mov    %r13d,%edx
call   1030 <survive@plt>
addsd  (%rsp),%xmm0
divsd  0xe93(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @life_chance(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%19 = load i32, i32* %10
%20 = load i32, i32* %11
%21 = load i32, i32* %12
%22 = call double @survive(i32 %19, i32 %20, i32 %21)
%23 = load i32, i32* %13
%24 = load i32, i32* %14
%25 = load i32, i32* %15
%26 = call double @survive(i32 %23, i32 %24, i32 %25)
%27 = fadd double %22, %26
%28 = load i32, i32* %16
%29 = load i32, i32* %17
%30 = load i32, i32* %18
%31 = call double @survive(i32 %28, i32 %29, i32 %30)
%32 = fadd double %27, %31
%33 = fdiv double %32, 3.000000e+00
ret double %33
}

LLVM IR (-O2):
define double @life_chance(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = tail call double @survive(i32 %0, i32 %1, i32 %2)
%11 = tail call double @survive(i32 %3, i32 %4, i32 %5)
%12 = fadd double %10, %11
%13 = tail call double @survive(i32 %6, i32 %7, i32 %8)
%14 = fadd double %12, %13
%15 = fdiv double %14, 3.000000e+00
ret double %15
}