#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_enthalpy_sso_0_p(double);
double sin(double);
double sqrt(double);
double gsw_z_from_p(double p, double lat) {
  double pi = 3.141592653589793e0;
  double gamma, deg2rad, x, sin2, b, c, a;
  gamma = 2.26e-7;
  deg2rad = pi / 180e0;
  x = sin(lat * deg2rad);
  sin2 = x * x;
  b = 9.780327e0 * (1e0 + (5.2792e-3 + (2.32e-5 * sin2)) * sin2);
  a = -0.5e0 * gamma * b;
  c = gsw_enthalpy_sso_0_p(p);
  return (-2e0 * c / (b + sqrt(b * b - 4e0 * a * c)));
}


x86 assembly (clang, -O0):
<gsw_z_from_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xefe(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xecf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  0xe86(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe5d(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe49(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe30(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <gsw_enthalpy_sso_0_p@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  0xe02(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  0xdd4(%rip),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsw_z_from_p>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
mulsd  0xebf(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <sin@plt>
mulsd  %xmm0,%xmm0
movsd  0xeb2(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeae(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xeaa(%rip),%xmm1
mulsd  0xeaa(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xea4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <gsw_enthalpy_sso_0_p@plt>
movsd  0xe90(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0x10(%rsp),%xmm1
mulsd  0xe86(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11d4 <gsw_z_from_p+0xa4>
sqrtsd %xmm0,%xmm0
jmp    11e3 <gsw_z_from_p+0xb3>
movsd  %xmm2,(%rsp)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm2
addsd  0x8(%rsp),%xmm0
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @gsw_z_from_p(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0x400921FB54442D18, double* %5
store double 2.260000e-07, double* %6
%13 = load double, double* %5
%14 = fdiv double %13, 1.800000e+02
store double %14, double* %7
%15 = load double, double* %4
%16 = load double, double* %7
%17 = fmul double %15, %16
%18 = call double @sin(double %17)
store double %18, double* %8
%19 = load double, double* %8
%20 = load double, double* %8
%21 = fmul double %19, %20
store double %21, double* %9
%22 = load double, double* %9
%23 = call double @llvm.fmuladd.f64(double 2.320000e-05, double %22, double 5.279200e-03)
%24 = load double, double* %9
%25 = call double @llvm.fmuladd.f64(double %23, double %24, double 1.000000e+00)
%26 = fmul double 0x40238F8705425F20, %25
store double %26, double* %10
%27 = load double, double* %6
%28 = fmul double -5.000000e-01, %27
%29 = load double, double* %10
%30 = fmul double %28, %29
store double %30, double* %12
%31 = load double, double* %3
%32 = call double @gsw_enthalpy_sso_0_p(double %31)
store double %32, double* %11
%33 = load double, double* %11
%34 = fmul double -2.000000e+00, %33
%35 = load double, double* %10
%36 = load double, double* %10
%37 = load double, double* %10
%38 = load double, double* %12
%39 = fmul double 4.000000e+00, %38
%40 = load double, double* %11
%41 = fmul double %39, %40
%42 = fneg double %41
%43 = call double @llvm.fmuladd.f64(double %36, double %37, double %42)
%44 = call double @sqrt(double %43)
%45 = fadd double %35, %44
%46 = fdiv double %34, %45
ret double %46
}

LLVM IR (-O2):
define double @gsw_z_from_p(double %0, double %1) {
%3 = fmul double %1, 0x3F91DF46A2529D39
%4 = tail call double @sin(double %3)
%5 = fmul double %4, %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double 2.320000e-05, double 5.279200e-03)
%7 = tail call double @llvm.fmuladd.f64(double %6, double %5, double 1.000000e+00)
%8 = fmul double %7, 0x40238F8705425F20
%9 = fmul double %8, -1.130000e-07
%10 = tail call double @gsw_enthalpy_sso_0_p(double %0)
%11 = fmul double %10, -2.000000e+00
%12 = fmul double %9, -4.000000e+00
%13 = fmul double %10, %12
%14 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %13)
%15 = tail call double @sqrt(double %14)
%16 = fadd double %15, %8
%17 = fdiv double %11, %16
ret double %17
}