#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 h();
double f(int x, double z, double w) {
  double b, c, d, e, f;
  double y = h();
  if (x)
    b = 1 / y, c = z / y;
  else
    b = 3 / y, c = w / y;
  d = b / y;
  e = c / y;
  f = 1 / y;
  return d + e + f;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    $0x0,%al
call   1030 <h@plt>
movsd  %xmm0,-0x48(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1161 <f+0x51>
movsd  0xec5(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1182 <f+0x72>
movsd  0xe97(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe60(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <h@plt>
movsd  0x8(%rsp),%xmm3
xor    %eax,%eax
test   %ebx,%ebx
sete   %cl
je     113d <f+0x2d>
movsd  (%rsp),%xmm3
mov    %cl,%al
lea    0xeba(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
divsd  %xmm0,%xmm1
divsd  %xmm0,%xmm3
divsd  %xmm0,%xmm3
movapd 0xeb1(%rip),%xmm2
unpcklpd %xmm1,%xmm2
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @f(i32 %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
store double %2, double* %6
%13 = call double (...) @h()
store double %13, double* %12
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %3
%17 = load double, double* %12
%18 = fdiv double 1.000000e+00, %17
store double %18, double* %7
%19 = load double, double* %5
%20 = load double, double* %12
%21 = fdiv double %19, %20
store double %21, double* %8
br label %28
22: ; preds = %3
%23 = load double, double* %12
%24 = fdiv double 3.000000e+00, %23
store double %24, double* %7
%25 = load double, double* %6
%26 = load double, double* %12
%27 = fdiv double %25, %26
store double %27, double* %8
br label %28
28: ; preds = %22, %16
%29 = load double, double* %7
%30 = load double, double* %12
%31 = fdiv double %29, %30
store double %31, double* %9
%32 = load double, double* %8
%33 = load double, double* %12
%34 = fdiv double %32, %33
store double %34, double* %10
%35 = load double, double* %12
%36 = fdiv double 1.000000e+00, %35
store double %36, double* %11
%37 = load double, double* %9
%38 = load double, double* %10
%39 = fadd double %37, %38
%40 = load double, double* %11
%41 = fadd double %39, %40
ret double %41
}

LLVM IR (-O2):
define double @f(i32 %0, double %1, double %2) {
%4 = tail call double (...) @h()
%5 = icmp eq i32 %0, 0
%6 = select i1 %5, double %2, double %1
%7 = select i1 %5, double 3.000000e+00, double 1.000000e+00
%8 = fdiv double %7, %4
%9 = fdiv double %6, %4
%10 = fdiv double %9, %4
%11 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %8, i64 1
%12 = insertelement <2 x double> poison, double %4, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = fdiv <2 x double> %11, %13
%15 = extractelement <2 x double> %14, i64 1
%16 = fadd double %15, %10
%17 = extractelement <2 x double> %14, i64 0
%18 = fadd double %17, %16
ret double %18
}