#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_xinterp1(double *, double *, int, double);
double gsw_sa_from_sp_baltic(double sp, double lon, double lat) {
  double xx_left, xx_right, return_value;
  double xb_left[3] = {12.6, 7.0, 26.0}, yb_left[3] = {50.0, 59.0, 69.0},
         xb_right[2] = {45.0, 26.0}, yb_right[2] = {50.0, 69.0};
  if (xb_left[1] < lon && lon < xb_right[0] && yb_left[0] < lat &&
      lat < yb_left[2]) {
    xx_left = gsw_xinterp1(yb_left, xb_left, 3, lat);
    xx_right = gsw_xinterp1(yb_right, xb_right, 2, lat);
    if (xx_left <= lon && lon <= xx_right)
      return_value = ((35.16504 - 0.087) / 35.0) * sp + 0.087;
    else
      return_value = 9e15;
  } else
    return_value = 9e15;
  return (return_value);
}


x86 assembly (clang, -O0):
<gsw_sa_from_sp_baltic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    0xeef(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeec(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xee9(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xeeb(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xee8(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xeed(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xeea(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xee7(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xee1(%rip),%rax
mov    %rax,-0x88(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <gsw_sa_from_sp_baltic+0x17a>
movsd  -0x10(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <gsw_sa_from_sp_baltic+0x17a>
movsd  -0x70(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <gsw_sa_from_sp_baltic+0x17a>
movsd  -0x18(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <gsw_sa_from_sp_baltic+0x17a>
lea    -0x70(%rbp),%rdi
lea    -0x50(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
mov    $0x3,%edx
call   1030 <gsw_xinterp1@plt>
movsd  %xmm0,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0x80(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edx
call   1030 <gsw_xinterp1@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1278 <gsw_sa_from_sp_baltic+0x168>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1278 <gsw_sa_from_sp_baltic+0x168>
movsd  -0x8(%rbp),%xmm0
movsd  0xdaa(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1285 <gsw_sa_from_sp_baltic+0x175>
movsd  0xd80(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1297 <gsw_sa_from_sp_baltic+0x187>
movsd  0xd6e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsw_sa_from_sp_baltic>:
sub    $0x98,%rsp
movapd %xmm0,%xmm4
mov    0xf2e(%rip),%rax
mov    %rax,0x90(%rsp)
movaps 0xf0f(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
mov    0xf30(%rip),%rax
mov    %rax,0x70(%rsp)
movaps 0xf14(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xf28(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movapd 0xf2b(%rip),%xmm0
movapd %xmm0,0x40(%rsp)
movsd  0xe8d(%rip),%xmm3
ucomisd 0xe8d(%rip),%xmm1
jbe    1258 <gsw_sa_from_sp_baltic+0x148>
movsd  0xe87(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1258 <gsw_sa_from_sp_baltic+0x148>
ucomisd 0xe7d(%rip),%xmm2
jbe    1258 <gsw_sa_from_sp_baltic+0x148>
movsd  0xe77(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    1258 <gsw_sa_from_sp_baltic+0x148>
lea    0x60(%rsp),%rdi
lea    0x80(%rsp),%rsi
mov    $0x3,%edx
movapd %xmm2,%xmm0
movapd %xmm1,0x30(%rsp)
movapd %xmm4,0x20(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1030 <gsw_xinterp1@plt>
movapd %xmm0,0x10(%rsp)
lea    0x40(%rsp),%rdi
lea    0x50(%rsp),%rsi
mov    $0x2,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <gsw_xinterp1@plt>
movapd 0x10(%rsp),%xmm3
movapd 0x20(%rsp),%xmm1
mulsd  0xe14(%rip),%xmm1
addsd  0xe14(%rip),%xmm1
movapd %xmm1,%xmm4
movapd 0x30(%rsp),%xmm2
cmpnlesd %xmm2,%xmm3
cmpnlesd %xmm0,%xmm2
movsd  0xdc8(%rip),%xmm0
movapd %xmm2,%xmm1
andpd  %xmm0,%xmm1
andnpd %xmm4,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm3,%xmm1
andnpd %xmm2,%xmm1
andpd  %xmm0,%xmm3
orpd   %xmm1,%xmm3
movapd %xmm3,%xmm0
add    $0x98,%rsp
ret

LLVM IR (-O0):
@__const.gsw_sa_from_sp_baltic.xb_left = [3 x double] [double 1.260000e+01, double 7.000000e+00, double 2.600000e+01]
@__const.gsw_sa_from_sp_baltic.yb_left = [3 x double] [double 5.000000e+01, double 5.900000e+01, double 6.900000e+01]
@__const.gsw_sa_from_sp_baltic.xb_right = [2 x double] [double 4.500000e+01, double 2.600000e+01]
@__const.gsw_sa_from_sp_baltic.yb_right = [2 x double] [double 5.000000e+01, double 6.900000e+01]
define double @gsw_sa_from_sp_baltic(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 [3 x double]
%11 = alloca [3 x double]
%12 = alloca [2 x double]
%13 = alloca [2 x double]
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%14 = bitcast [3 x double]* %10 to i8*
%15 = bitcast [3 x double]* %11 to i8*
%16 = bitcast [2 x double]* %12 to i8*
%17 = bitcast [2 x double]* %13 to i8*
%18 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
%19 = load double, double* %18
%20 = load double, double* %5
%21 = fcmp olt double %19, %20
br i1 %21, label %22, label %58
22: ; preds = %3
%23 = load double, double* %5
%24 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%25 = load double, double* %24
%26 = fcmp olt double %23, %25
br i1 %26, label %27, label %58
27: ; preds = %22
%28 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%29 = load double, double* %28
%30 = load double, double* %6
%31 = fcmp olt double %29, %30
br i1 %31, label %32, label %58
32: ; preds = %27
%33 = load double, double* %6
%34 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
%35 = load double, double* %34
%36 = fcmp olt double %33, %35
br i1 %36, label %37, label %58
37: ; preds = %32
%38 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%39 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%40 = load double, double* %6
%41 = call double @gsw_xinterp1(double* %38, double* %39, i32 3, double %40)
store double %41, double* %7
%42 = getelementptr inbounds [2 x double], [2 x double]* %13, i64 0, i64 0
%43 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%44 = load double, double* %6
%45 = call double @gsw_xinterp1(double* %42, double* %43, i32 2, double %44)
store double %45, double* %8
%46 = load double, double* %7
%47 = load double, double* %5
%48 = fcmp ole double %46, %47
br i1 %48, label %49, label %56
49: ; preds = %37
%50 = load double, double* %5
%51 = load double, double* %8
%52 = fcmp ole double %50, %51
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = load double, double* %4
%55 = call double @llvm.fmuladd.f64(double 0x3FF00922065EFC2D, double %54, double 0x3FB645A1CAC08312)
store double %55, double* %9
br label %57
56: ; preds = %49, %37
store double 9.000000e+15, double* %9
br label %57
57: ; preds = %56, %53
br label %59
58: ; preds = %32, %27, %22, %3
store double 9.000000e+15, double* %9
br label %59
59: ; preds = %58, %57
%60 = load double, double* %9
ret double %60
}

LLVM IR (-O2):
@__const.gsw_sa_from_sp_baltic.xb_left = [3 x double] [double 1.260000e+01, double 7.000000e+00, double 2.600000e+01]
@__const.gsw_sa_from_sp_baltic.yb_left = [3 x double] [double 5.000000e+01, double 5.900000e+01, double 6.900000e+01]
@__const.gsw_sa_from_sp_baltic.xb_right = [2 x double] [double 4.500000e+01, double 2.600000e+01]
@__const.gsw_sa_from_sp_baltic.yb_right = [2 x double] [double 5.000000e+01, double 6.900000e+01]
define double @gsw_sa_from_sp_baltic(double %0, double %1, double %2) {
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = alloca [2 x double]
%7 = alloca [2 x double]
%8 = bitcast [3 x double]* %4 to i8*
%9 = bitcast [3 x double]* %5 to i8*
%10 = bitcast [2 x double]* %6 to i8*
%11 = bitcast [2 x double]* %7 to i8*
%12 = fcmp ogt double %1, 7.000000e+00
br i1 %12, label %13, label %31
13: ; preds = %3
%14 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%15 = fcmp olt double %1, 4.500000e+01
br i1 %15, label %16, label %31
16: ; preds = %13
%17 = fcmp ogt double %2, 5.000000e+01
%18 = fcmp olt double %2, 6.900000e+01
%19 = and i1 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%22 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%23 = call double @gsw_xinterp1(double* %21, double* %22, i32 3, double %2)
%24 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
%25 = call double @gsw_xinterp1(double* %24, double* %14, i32 2, double %2)
%26 = fcmp ugt double %23, %1
%27 = fcmp ult double %25, %1
%28 = select i1 %26, i1 true, i1 %27
%29 = call double @llvm.fmuladd.f64(double %0, double 0x3FF00922065EFC2D, double 0x3FB645A1CAC08312)
%30 = select i1 %28, double 9.000000e+15, double %29
br label %31
31: ; preds = %20, %3, %13, %16
%32 = phi double [ 9.000000e+15, %16 ], [ 9.000000e+15, %13 ], [ 9.000000e+15, %3 ], [ %30, %20 ]
ret double %32
}