#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 gsw_saar(double, double, double);
double gsw_sp_from_sa_baltic(double, double, double);
double gsw_sp_from_sstar(double sstar, double p, double lon, double lat) {
  double saar, sp_baltic;
  saar = gsw_saar(p, lon, lat);
  if (saar == 9e15)
    return (saar);
  sp_baltic = gsw_sp_from_sa_baltic(sstar, lon, lat);
  if (sp_baltic < 1810)
    return (sp_baltic);
  return ((35.e0 / 35.16504e0) * sstar / (1 - 0.35e0 * saar));
}


x86 assembly (clang, -O0):
<gsw_sp_from_sstar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1040 <gsw_saar@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1181 <gsw_sp_from_sstar+0x61>
jp     1181 <gsw_sp_from_sstar+0x61>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ef <gsw_sp_from_sstar+0xcf>
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <gsw_sp_from_sa_baltic@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xe66(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    11bc <gsw_sp_from_sstar+0x9c>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ef <gsw_sp_from_sstar+0xcf>
movsd  0xe5c(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xe3a(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe36(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsw_sp_from_sstar>:
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
movsd  %xmm2,0x18(%rsp)
movaps %xmm2,%xmm1
movsd  %xmm3,0x20(%rsp)
movaps %xmm3,%xmm2
call   1040 <gsw_saar@plt>
movapd %xmm0,%xmm1
movsd  0xeaf(%rip),%xmm0
ucomisd %xmm0,%xmm1
jne    115e <gsw_sp_from_sstar+0x3e>
jp     115e <gsw_sp_from_sstar+0x3e>
add    $0x28,%rsp
ret
movsd  0x8(%rsp),%xmm0
movsd  %xmm1,0x10(%rsp)
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
call   1030 <gsw_sp_from_sa_baltic@plt>
movsd  0xe85(%rip),%xmm1
ucomisd %xmm0,%xmm1
movsd  0x10(%rsp),%xmm1
ja     1159 <gsw_sp_from_sstar+0x39>
movsd  0x8(%rsp),%xmm0
mulsd  0xe73(%rip),%xmm0
mulsd  0xe73(%rip),%xmm1
addsd  0xe73(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @gsw_sp_from_sstar(double %0, double %1, double %2, double %3) {
%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* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%12 = load double, double* %7
%13 = load double, double* %8
%14 = load double, double* %9
%15 = call double @gsw_saar(double %12, double %13, double %14)
store double %15, double* %10
%16 = load double, double* %10
%17 = fcmp oeq double %16, 9.000000e+15
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = load double, double* %10
store double %19, double* %5
br label %35
20: ; preds = %4
%21 = load double, double* %6
%22 = load double, double* %8
%23 = load double, double* %9
%24 = call double @gsw_sp_from_sa_baltic(double %21, double %22, double %23)
store double %24, double* %11
%25 = load double, double* %11
%26 = fcmp olt double %25, 1.810000e+03
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = load double, double* %11
store double %28, double* %5
br label %35
29: ; preds = %20
%30 = load double, double* %6
%31 = fmul double 0x3FEFD98D710110B2, %30
%32 = load double, double* %10
%33 = call double @llvm.fmuladd.f64(double -3.500000e-01, double %32, double 1.000000e+00)
%34 = fdiv double %31, %33
store double %34, double* %5
br label %35
35: ; preds = %29, %27, %18
%36 = load double, double* %5
ret double %36
}

LLVM IR (-O2):
define double @gsw_sp_from_sstar(double %0, double %1, double %2, double %3) {
%5 = tail call double @gsw_saar(double %1, double %2, double %3)
%6 = fcmp oeq double %5, 9.000000e+15
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call double @gsw_sp_from_sa_baltic(double %0, double %2, double %3)
%9 = fcmp olt double %8, 1.810000e+03
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = fmul double %0, 0x3FEFD98D710110B2
%12 = tail call double @llvm.fmuladd.f64(double %5, double -3.500000e-01, double 1.000000e+00)
%13 = fdiv double %11, %12
br label %14
14: ; preds = %7, %4, %10
%15 = phi double [ %13, %10 ], [ 9.000000e+15, %4 ], [ %8, %7 ]
ret double %15
}