#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 dplus(double, double, double);
double sqrt(double);
double fomega(double a, double omegam, double omegav) {
  double eta, omegak;
  if (omegam == 1.0 && omegav == 0.0)
    return 1.0;
  omegak = 1.0 - omegam - omegav;
  eta = sqrt(omegam / a + omegav * a * a + omegak);
  return (2.5 / dplus(a, omegam, omegav) - 1.5 * omegam / a - omegak) /
         (eta * eta);
}


x86 assembly (clang, -O0):
<fomega>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xebc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    117e <fomega+0x5e>
jp     117e <fomega+0x5e>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117e <fomega+0x5e>
jp     117e <fomega+0x5e>
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1216 <fomega+0xf6>
movsd  0xe7a(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x30(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <dplus@plt>
movaps %xmm0,%xmm1
movsd  0xe2c(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe18(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fomega>:
sub    $0x48,%rsp
movapd %xmm0,%xmm5
movsd  0xed0(%rip),%xmm0
ucomisd %xmm0,%xmm1
jne    1149 <fomega+0x29>
jp     1149 <fomega+0x29>
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jne    1149 <fomega+0x29>
jp     1149 <fomega+0x29>
add    $0x48,%rsp
ret
movsd  0xeaf(%rip),%xmm4
subsd  %xmm1,%xmm4
subsd  %xmm2,%xmm4
movapd %xmm1,%xmm3
divsd  %xmm5,%xmm3
movapd %xmm5,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm5,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm4,0x18(%rsp)
addsd  %xmm4,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
movapd %xmm5,0x30(%rsp)
movapd %xmm1,0x20(%rsp)
jb     1197 <fomega+0x77>
sqrtsd %xmm0,%xmm0
jmp    11b4 <fomega+0x94>
movsd  %xmm2,0x10(%rsp)
call   1040 <sqrt@plt>
movsd  0x10(%rsp),%xmm2
movapd 0x20(%rsp),%xmm1
movapd 0x30(%rsp),%xmm5
movsd  %xmm0,0x8(%rsp)
movapd %xmm5,%xmm0
call   1030 <dplus@plt>
movapd %xmm0,%xmm1
movapd 0x20(%rsp),%xmm2
mulsd  0xe33(%rip),%xmm2
movapd 0xe33(%rip),%xmm0
unpcklpd %xmm2,%xmm0
unpcklpd 0x30(%rsp),%xmm1
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
subsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @fomega(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%10 = load double, double* %6
%11 = fcmp oeq double %10, 1.000000e+00
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load double, double* %7
%14 = fcmp oeq double %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %12
store double 1.000000e+00, double* %4
br label %48
16: ; preds = %12, %3
%17 = load double, double* %6
%18 = fsub double 1.000000e+00, %17
%19 = load double, double* %7
%20 = fsub double %18, %19
store double %20, double* %9
%21 = load double, double* %6
%22 = load double, double* %5
%23 = fdiv double %21, %22
%24 = load double, double* %7
%25 = load double, double* %5
%26 = fmul double %24, %25
%27 = load double, double* %5
%28 = call double @llvm.fmuladd.f64(double %26, double %27, double %23)
%29 = load double, double* %9
%30 = fadd double %28, %29
%31 = call double @sqrt(double %30)
store double %31, double* %8
%32 = load double, double* %5
%33 = load double, double* %6
%34 = load double, double* %7
%35 = call double @dplus(double %32, double %33, double %34)
%36 = fdiv double 2.500000e+00, %35
%37 = load double, double* %6
%38 = fmul double 1.500000e+00, %37
%39 = load double, double* %5
%40 = fdiv double %38, %39
%41 = fsub double %36, %40
%42 = load double, double* %9
%43 = fsub double %41, %42
%44 = load double, double* %8
%45 = load double, double* %8
%46 = fmul double %44, %45
%47 = fdiv double %43, %46
store double %47, double* %4
br label %48
48: ; preds = %16, %15
%49 = load double, double* %4
ret double %49
}

LLVM IR (-O2):
define double @fomega(double %0, double %1, double %2) {
%4 = fcmp oeq double %1, 1.000000e+00
%5 = fcmp oeq double %2, 0.000000e+00
%6 = and i1 %4, %5
br i1 %6, label %27, label %7
7: ; preds = %3
%8 = fsub double 1.000000e+00, %1
%9 = fsub double %8, %2
%10 = fdiv double %1, %0
%11 = fmul double %0, %2
%12 = tail call double @llvm.fmuladd.f64(double %11, double %0, double %10)
%13 = fadd double %9, %12
%14 = tail call double @sqrt(double %13)
%15 = tail call double @dplus(double %0, double %1, double %2)
%16 = fmul double %1, 1.500000e+00
%17 = insertelement <2 x double> <double 2.500000e+00, double poison>, double %16, i64 1
%18 = insertelement <2 x double> poison, double %0, i64 1
%19 = insertelement <2 x double> %18, double %15, i64 0
%20 = fdiv <2 x double> %17, %19
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%22 = fsub <2 x double> %20, %21
%23 = extractelement <2 x double> %22, i64 0
%24 = fsub double %23, %9
%25 = fmul double %14, %14
%26 = fdiv double %24, %25
br label %27
27: ; preds = %3, %7
%28 = phi double [ %26, %7 ], [ 1.000000e+00, %3 ]
ret double %28
}