#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_sp_from_sa_baltic(double sa, 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.0 / (35.16504 - 0.087)) * (sa - 0.087);
    else
      return_value = 9e15;
  } else
    return_value = 9e15;
  return (return_value);
}


x86 assembly (clang, -O0):
<gsw_sp_from_sa_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_sp_from_sa_baltic+0x17a>
movsd  -0x10(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <gsw_sp_from_sa_baltic+0x17a>
movsd  -0x70(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <gsw_sp_from_sa_baltic+0x17a>
movsd  -0x18(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128a <gsw_sp_from_sa_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_sp_from_sa_baltic+0x168>
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1278 <gsw_sp_from_sa_baltic+0x168>
movsd  -0x8(%rbp),%xmm1
movsd  0xdb2(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xd9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1285 <gsw_sp_from_sa_baltic+0x175>
movsd  0xd80(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1297 <gsw_sp_from_sa_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_sp_from_sa_baltic>:
sub    $0x78,%rsp
mov    0xf35(%rip),%rax
mov    %rax,0x70(%rsp)
movaps 0xf19(%rip),%xmm3
movaps %xmm3,0x60(%rsp)
mov    0xf3d(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xf21(%rip),%xmm3
movaps %xmm3,0x40(%rsp)
movaps 0xf35(%rip),%xmm3
movaps %xmm3,0x30(%rsp)
movapd 0xf38(%rip),%xmm3
movapd %xmm3,0x20(%rsp)
movsd  0xe9a(%rip),%xmm4
ucomisd 0xe9a(%rip),%xmm1
jbe    122a <gsw_sp_from_sa_baltic+0x11a>
movsd  0xe94(%rip),%xmm3
ucomisd %xmm1,%xmm3
jbe    122a <gsw_sp_from_sa_baltic+0x11a>
ucomisd 0xe8a(%rip),%xmm2
jbe    122a <gsw_sp_from_sa_baltic+0x11a>
movsd  0xe84(%rip),%xmm3
ucomisd %xmm2,%xmm3
jbe    122a <gsw_sp_from_sa_baltic+0x11a>
movsd  %xmm0,(%rsp)
lea    0x40(%rsp),%rdi
lea    0x60(%rsp),%rsi
mov    $0x3,%edx
movapd %xmm2,%xmm0
movsd  %xmm1,0x18(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1030 <gsw_xinterp1@plt>
movsd  %xmm0,0x10(%rsp)
lea    0x20(%rsp),%rdi
lea    0x30(%rsp),%rsi
mov    $0x2,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <gsw_xinterp1@plt>
movsd  0x18(%rsp),%xmm1
ucomisd 0x10(%rsp),%xmm1
jb     1222 <gsw_sp_from_sa_baltic+0x112>
ucomisd %xmm1,%xmm0
movsd  0xdf7(%rip),%xmm4
jb     122a <gsw_sp_from_sa_baltic+0x11a>
movsd  (%rsp),%xmm4
addsd  0xe10(%rip),%xmm4
mulsd  0xe10(%rip),%xmm4
jmp    122a <gsw_sp_from_sa_baltic+0x11a>
movsd  0xdd6(%rip),%xmm4
movapd %xmm4,%xmm0
add    $0x78,%rsp
ret

LLVM IR (-O0):
@__const.gsw_sp_from_sa_baltic.xb_left = [3 x double] [double 1.260000e+01, double 7.000000e+00, double 2.600000e+01]
@__const.gsw_sp_from_sa_baltic.yb_left = [3 x double] [double 5.000000e+01, double 5.900000e+01, double 6.900000e+01]
@__const.gsw_sp_from_sa_baltic.xb_right = [2 x double] [double 4.500000e+01, double 2.600000e+01]
@__const.gsw_sp_from_sa_baltic.yb_right = [2 x double] [double 5.000000e+01, double 6.900000e+01]
define double @gsw_sp_from_sa_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 %59
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 %59
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 %59
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 %59
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 %57
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 %57
53: ; preds = %49
%54 = load double, double* %4
%55 = fsub double %54, 0x3FB645A1CAC08312
%56 = fmul double 0x3FEFEDC65A70E9C3, %55
store double %56, double* %9
br label %58
57: ; preds = %49, %37
store double 9.000000e+15, double* %9
br label %58
58: ; preds = %57, %53
br label %60
59: ; preds = %32, %27, %22, %3
store double 9.000000e+15, double* %9
br label %60
60: ; preds = %59, %58
%61 = load double, double* %9
ret double %61
}

LLVM IR (-O2):
@__const.gsw_sp_from_sa_baltic.xb_left = [3 x double] [double 1.260000e+01, double 7.000000e+00, double 2.600000e+01]
@__const.gsw_sp_from_sa_baltic.yb_left = [3 x double] [double 5.000000e+01, double 5.900000e+01, double 6.900000e+01]
@__const.gsw_sp_from_sa_baltic.xb_right = [2 x double] [double 4.500000e+01, double 2.600000e+01]
@__const.gsw_sp_from_sa_baltic.yb_right = [2 x double] [double 5.000000e+01, double 6.900000e+01]
define double @gsw_sp_from_sa_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 %32
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 %32
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 %32
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
br i1 %28, label %32, label %29
29: ; preds = %20
%30 = fadd double %0, 0xBFB645A1CAC08312
%31 = fmul double %30, 0x3FEFEDC65A70E9C3
br label %32
32: ; preds = %3, %13, %16, %20, %29
%33 = phi double [ %31, %29 ], [ 9.000000e+15, %20 ], [ 9.000000e+15, %16 ], [ 9.000000e+15, %13 ], [ 9.000000e+15, %3 ]
ret double %33
}