#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_sa_from_sstar(double sstar, double p, double lon, double lat) {
  double saar;
  saar = gsw_saar(p, lon, lat);
  if (saar == 9e15)
    return (saar);
  return (sstar * (1e0 + saar) / (1e0 - 0.35e0 * saar));
}


x86 assembly (clang, -O0):
<gsw_sa_from_sstar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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   1030 <gsw_saar@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xeae(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1171 <gsw_sa_from_sstar+0x61>
jp     1171 <gsw_sa_from_sstar+0x61>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ad <gsw_sa_from_sstar+0x9d>
movsd  -0x10(%rbp),%xmm0
movsd  0xe92(%rip),%xmm1
addsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xe74(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe70(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsw_sa_from_sstar>:
push   %rax
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
call   1030 <gsw_saar@plt>
movapd %xmm0,%xmm1
movsd  0xecf(%rip),%xmm0
ucomisd %xmm0,%xmm1
jne    113b <gsw_sa_from_sstar+0x2b>
jp     113b <gsw_sa_from_sstar+0x2b>
pop    %rax
ret
movsd  0xec5(%rip),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
mulsd  (%rsp),%xmm0
mulsd  0xeb8(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @gsw_sa_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 %12, label %7
7: ; preds = %4
%8 = fadd double %5, 1.000000e+00
%9 = fmul double %8, %0
%10 = tail call double @llvm.fmuladd.f64(double %5, double -3.500000e-01, double 1.000000e+00)
%11 = fdiv double %9, %10
br label %12
12: ; preds = %4, %7
%13 = phi double [ %11, %7 ], [ 9.000000e+15, %4 ]
ret double %13
}