#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 */
typedef double temperature;
typedef double pressure;

/* Variables and functions */
double _sal(double, double);
int /*<<< orphan*/ fabs(double);
double sqrt(int /*<<< orphan*/);
double salinity(double conductivity, double temperature, double pressure) {
  double corrected_temperature, rt;
  corrected_temperature = temperature - 15.0;
  if (conductivity <= 5e-4)
    return 0.0;
  rt =
      conductivity /
      (((((1.0031e-9 * (temperature)-6.9698e-7) * (temperature) + 1.104259e-4) *
             (temperature) +
         2.00564e-2) *
            (temperature) +
        0.6766097) *
       (1.0 +
        (((3.989e-15 * (pressure)-6.370e-10) * (pressure) + 2.070e-5) *
         (pressure)) /
            (((4.464e-4 * (temperature) + 3.426e-2) * (temperature) + 1.0) +
             (-3.107E-3 * (temperature) + 0.4215) * conductivity)));
  rt = sqrt(fabs(rt));
  return _sal(rt, corrected_temperature);
}


x86 assembly (clang, -O0):
<salinity>:
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  0xeb4(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe9b(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     117d <salinity+0x4d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b8 <salinity+0x188>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xed9(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xed5(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xeb0(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe93(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe76(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x20(%rbp),%xmm3
movsd  0xe55(%rip),%xmm2
mulsd  %xmm2,%xmm3
movsd  0xe51(%rip),%xmm2
addsd  %xmm2,%xmm3
movsd  -0x20(%rbp),%xmm2
mulsd  %xmm2,%xmm3
movsd  0xe2c(%rip),%xmm2
addsd  %xmm2,%xmm3
mulsd  -0x20(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  0xe06(%rip),%xmm2
mulsd  %xmm2,%xmm4
movsd  0xe02(%rip),%xmm2
addsd  %xmm2,%xmm4
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm4
movsd  0xdcd(%rip),%xmm2
addsd  %xmm2,%xmm4
movsd  -0x18(%rbp),%xmm2
movsd  0xdc4(%rip),%xmm5
mulsd  %xmm5,%xmm2
movsd  0xdc0(%rip),%xmm5
addsd  %xmm5,%xmm2
movsd  -0x10(%rbp),%xmm5
mulsd  %xmm5,%xmm2
addsd  %xmm4,%xmm2
divsd  %xmm2,%xmm3
movsd  0xd93(%rip),%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <_sal@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<salinity>:
push   %rax
movsd  0xec7(%rip),%xmm3
ucomisd %xmm0,%xmm3
jae    1213 <salinity+0xe3>
movsd  0xec5(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  0xec1(%rip),%xmm3
movsd  0xea9(%rip),%xmm4
mulsd  %xmm1,%xmm3
addsd  0xeb5(%rip),%xmm3
addsd  %xmm1,%xmm4
movsd  %xmm4,(%rsp)
mulsd  %xmm1,%xmm3
addsd  0xea8(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  0xea4(%rip),%xmm3
movsd  0xea4(%rip),%xmm4
mulsd  %xmm2,%xmm4
addsd  0xea0(%rip),%xmm4
mulsd  %xmm2,%xmm4
addsd  0xe9c(%rip),%xmm4
mulsd  %xmm2,%xmm4
movsd  0xe98(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xe94(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  0xe90(%rip),%xmm5
addsd  %xmm5,%xmm2
mulsd  0xe8c(%rip),%xmm1
addsd  0xe8c(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm3,%xmm4
divsd  %xmm4,%xmm0
call   1030 <fabs@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm1
pop    %rax
jmp    1040 <_sal@plt>
xorpd  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @salinity(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 = fsub double %10, 1.500000e+01
store double %11, double* %8
%12 = load double, double* %5
%13 = fcmp ole double %12, 5.000000e-04
br i1 %13, label %14, label %15
14: ; preds = %3
store double 0.000000e+00, double* %4
br label %49
15: ; preds = %3
%16 = load double, double* %5
%17 = load double, double* %6
%18 = call double @llvm.fmuladd.f64(double 1.003100e-09, double %17, double -6.969800e-07)
%19 = load double, double* %6
%20 = call double @llvm.fmuladd.f64(double %18, double %19, double 0x3F1CF28E843B034E)
%21 = load double, double* %6
%22 = call double @llvm.fmuladd.f64(double %20, double %21, double 2.005640e-02)
%23 = load double, double* %6
%24 = call double @llvm.fmuladd.f64(double %22, double %23, double 0x3FE5A6C962B500FE)
%25 = load double, double* %7
%26 = call double @llvm.fmuladd.f64(double 3.989000e-15, double %25, double -6.370000e-10)
%27 = load double, double* %7
%28 = call double @llvm.fmuladd.f64(double %26, double %27, double 2.070000e-05)
%29 = load double, double* %7
%30 = fmul double %28, %29
%31 = load double, double* %6
%32 = call double @llvm.fmuladd.f64(double 4.464000e-04, double %31, double 3.426000e-02)
%33 = load double, double* %6
%34 = call double @llvm.fmuladd.f64(double %32, double %33, double 1.000000e+00)
%35 = load double, double* %6
%36 = call double @llvm.fmuladd.f64(double -3.107000e-03, double %35, double 4.215000e-01)
%37 = load double, double* %5
%38 = call double @llvm.fmuladd.f64(double %36, double %37, double %34)
%39 = fdiv double %30, %38
%40 = fadd double 1.000000e+00, %39
%41 = fmul double %24, %40
%42 = fdiv double %16, %41
store double %42, double* %9
%43 = load double, double* %9
%44 = call i32 @fabs(double %43)
%45 = call double @sqrt(i32 %44)
store double %45, double* %9
%46 = load double, double* %9
%47 = load double, double* %8
%48 = call double @_sal(double %46, double %47)
store double %48, double* %4
br label %49
49: ; preds = %15, %14
%50 = load double, double* %4
ret double %50
}

LLVM IR (-O2):
define double @salinity(double %0, double %1, double %2) {
%4 = fcmp ugt double %0, 5.000000e-04
br i1 %4, label %5, label %25
5: ; preds = %3
%6 = fadd double %1, -1.500000e+01
%7 = tail call double @llvm.fmuladd.f64(double %1, double 1.003100e-09, double -6.969800e-07)
%8 = tail call double @llvm.fmuladd.f64(double %7, double %1, double 0x3F1CF28E843B034E)
%9 = tail call double @llvm.fmuladd.f64(double %8, double %1, double 2.005640e-02)
%10 = tail call double @llvm.fmuladd.f64(double %9, double %1, double 0x3FE5A6C962B500FE)
%11 = tail call double @llvm.fmuladd.f64(double %2, double 3.989000e-15, double -6.370000e-10)
%12 = tail call double @llvm.fmuladd.f64(double %11, double %2, double 2.070000e-05)
%13 = fmul double %12, %2
%14 = tail call double @llvm.fmuladd.f64(double %1, double 4.464000e-04, double 3.426000e-02)
%15 = tail call double @llvm.fmuladd.f64(double %14, double %1, double 1.000000e+00)
%16 = tail call double @llvm.fmuladd.f64(double %1, double -3.107000e-03, double 4.215000e-01)
%17 = tail call double @llvm.fmuladd.f64(double %16, double %0, double %15)
%18 = fdiv double %13, %17
%19 = fadd double %18, 1.000000e+00
%20 = fmul double %10, %19
%21 = fdiv double %0, %20
%22 = tail call i32 @fabs(double %21)
%23 = tail call double @sqrt(i32 %22)
%24 = tail call double @_sal(double %23, double %6)
br label %25
25: ; preds = %3, %5
%26 = phi double [ %24, %5 ], [ 0.000000e+00, %3 ]
ret double %26
}