#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 */
scalar_t__ g();
double f1(double y, double z, double w) {
  double b, c, d, e, f;
  if (g())
    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):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    $0x0,%al
call   1030 <g@plt>
cmp    $0x0,%rax
je     115e <f1+0x4e>
movsd  0xec8(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    117f <f1+0x6f>
movsd  0xe9a(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe63(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
sub    $0x28,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <g@plt>
movsd  0x8(%rsp),%xmm2
xor    %ecx,%ecx
test   %rax,%rax
sete   %al
je     1140 <f1+0x30>
movsd  (%rsp),%xmm2
mov    %al,%cl
lea    0xeb7(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movapd 0x10(%rsp),%xmm3
divsd  %xmm3,%xmm0
divsd  %xmm3,%xmm2
divsd  %xmm3,%xmm2
movapd 0xea8(%rip),%xmm1
unpcklpd %xmm0,%xmm1
unpcklpd %xmm3,%xmm3
divpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define double @f1(double %0, double %1, double %2) {
%4 = tail call i64 (...) @g()
%5 = icmp eq i64 %4, 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, %0
%9 = fdiv double %6, %0
%10 = fdiv double %9, %0
%11 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %8, i64 1
%12 = insertelement <2 x double> poison, double %0, 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
}