#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_entropy_part(double, double, double);
double gsw_gibbs(int, int, int, double, double, double);
double gsw_pt_from_t(double sa, double t, double p, double p_ref) {
  int n0, n2, no_iter;
  double cp0, sso, s1, pt, ptm, pt_old, dentropy, dentropy_dt,
      true_entropy_part;
  n0 = 0;
  n2 = 2;
  cp0 = 3991.86795711963e0;
  sso = 35.16504e0;
  s1 = sa * 35e0 / sso;
  pt = t + (p - p_ref) * (8.65483913395442e-6 - s1 * 1.41636299744881e-6 -
                          (p + p_ref) * 7.38286467135737e-9 +
                          t * (-8.38241357039698e-6 + s1 * 2.83933368585534e-8 +
                               t * 1.77803965218656e-8 +
                               (p + p_ref) * 1.71155619208233e-10));
  dentropy_dt = cp0 / ((273.15e0 + pt) * (1e0 - 0.05e0 * (1e0 - sa / sso)));
  true_entropy_part = gsw_entropy_part(sa, t, p);
  for (no_iter = 1; no_iter <= 2; no_iter++) {
    pt_old = pt;
    dentropy = gsw_entropy_part(sa, pt_old, p_ref) - true_entropy_part;
    pt = pt_old - dentropy / dentropy_dt;
    ptm = 0.5e0 * (pt + pt_old);
    dentropy_dt = -gsw_gibbs(n0, n2, n0, sa, ptm, p_ref);
    pt = pt_old - dentropy / dentropy_dt;
  }
  return (pt);
}


x86 assembly (clang, -O0):
<gsw_pt_from_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
movsd  0xf0b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xef6(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xee1(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
movsd  0xe8f(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe8b(%rip),%xmm3
addsd  %xmm3,%xmm2
movsd  -0x18(%rbp),%xmm3
addsd  -0x20(%rbp),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
movsd  0xe4e(%rip),%xmm4
mulsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
movsd  -0x10(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm4
movsd  0xe24(%rip),%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe20(%rip),%xmm5
addsd  %xmm5,%xmm4
movsd  -0x10(%rbp),%xmm5
movsd  0xdff(%rip),%xmm6
mulsd  %xmm6,%xmm5
addsd  %xmm4,%xmm5
movsd  -0x18(%rbp),%xmm4
addsd  -0x20(%rbp),%xmm4
movsd  0xddd(%rip),%xmm6
mulsd  %xmm6,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xdab(%rip),%xmm1
addsd  -0x50(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm3
divsd  -0x40(%rbp),%xmm3
movsd  0xd8c(%rip),%xmm2
subsd  %xmm3,%xmm2
movsd  0xd78(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd74(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1040 <gsw_entropy_part@plt>
movsd  %xmm0,-0x78(%rbp)
movl   $0x1,-0x2c(%rbp)
cmpl   $0x2,-0x2c(%rbp)
jg     1389 <gsw_pt_from_t+0x269>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1040 <gsw_entropy_part@plt>
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
addsd  -0x60(%rbp),%xmm1
movsd  0xd47(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
movsd  -0x8(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <gsw_gibbs@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
divsd  -0x70(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12c5 <gsw_pt_from_t+0x1a5>
movsd  -0x50(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsw_pt_from_t>:
sub    $0x38,%rsp
movsd  0xed4(%rip),%xmm7
mulsd  %xmm0,%xmm7
movsd  0xecf(%rip),%xmm8
divsd  %xmm8,%xmm7
movapd %xmm2,%xmm9
movsd  %xmm3,0x20(%rsp)
subsd  %xmm3,%xmm9
movsd  0xeba(%rip),%xmm5
mulsd  %xmm7,%xmm5
addsd  0xeb6(%rip),%xmm5
movapd %xmm2,%xmm4
addsd  %xmm3,%xmm4
movsd  0xeae(%rip),%xmm6
mulsd  %xmm4,%xmm6
mulsd  0xeaa(%rip),%xmm7
addsd  %xmm5,%xmm6
addsd  0xea6(%rip),%xmm7
movsd  0xea6(%rip),%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm7,%xmm5
mulsd  0xe9e(%rip),%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm6,%xmm4
mulsd  %xmm9,%xmm4
addsd  %xmm1,%xmm4
movsd  %xmm4,0x8(%rsp)
movsd  0xe83(%rip),%xmm3
addsd  %xmm4,%xmm3
movsd  %xmm0,0x18(%rsp)
movapd %xmm0,%xmm4
divsd  %xmm8,%xmm4
movsd  0xe70(%rip),%xmm6
movapd %xmm6,%xmm5
subsd  %xmm4,%xmm5
mulsd  0xe68(%rip),%xmm5
addsd  %xmm6,%xmm5
mulsd  %xmm3,%xmm5
movsd  0xe60(%rip),%xmm3
divsd  %xmm5,%xmm3
movsd  %xmm3,0x28(%rsp)
call   1040 <gsw_entropy_part@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
call   1040 <gsw_entropy_part@plt>
subsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm0,%xmm1
divsd  0x28(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe10(%rip),%xmm1
xor    %edi,%edi
mov    $0x2,%esi
xor    %edx,%edx
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm2
call   1030 <gsw_gibbs@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm2
call   1040 <gsw_entropy_part@plt>
subsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm0,%xmm1
divsd  0x28(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
mulsd  0xd9d(%rip),%xmm1
xor    %edi,%edi
mov    $0x2,%esi
xor    %edx,%edx
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm2
call   1030 <gsw_gibbs@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @gsw_pt_from_t(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
store i32 0, i32* %9
store i32 2, i32* %10
store double 0x40AF2FBC64E02648, double* %12
store double 0x4041952007DD4413, double* %13
%21 = load double, double* %5
%22 = fmul double %21, 3.500000e+01
%23 = load double, double* %13
%24 = fdiv double %22, %23
store double %24, double* %14
%25 = load double, double* %6
%26 = load double, double* %7
%27 = load double, double* %8
%28 = fsub double %26, %27
%29 = load double, double* %14
%30 = fneg double %29
%31 = call double @llvm.fmuladd.f64(double %30, double 0x3EB7C33B95B88255, double 0x3EE22688087541E7)
%32 = load double, double* %7
%33 = load double, double* %8
%34 = fadd double %32, %33
%35 = fneg double %34
%36 = call double @llvm.fmuladd.f64(double %35, double 0x3E3FB58BA9535C76, double %31)
%37 = load double, double* %6
%38 = load double, double* %14
%39 = call double @llvm.fmuladd.f64(double %38, double 0x3E5E7CB3752F16F8, double 0xBEE19446261035E0)
%40 = load double, double* %6
%41 = call double @llvm.fmuladd.f64(double %40, double 0x3E5317702C99FB88, double %39)
%42 = load double, double* %7
%43 = load double, double* %8
%44 = fadd double %42, %43
%45 = call double @llvm.fmuladd.f64(double %44, double 0x3DE78600C409F84E, double %41)
%46 = call double @llvm.fmuladd.f64(double %37, double %45, double %36)
%47 = call double @llvm.fmuladd.f64(double %28, double %46, double %25)
store double %47, double* %15
%48 = load double, double* %12
%49 = load double, double* %15
%50 = fadd double 2.731500e+02, %49
%51 = load double, double* %5
%52 = load double, double* %13
%53 = fdiv double %51, %52
%54 = fsub double 1.000000e+00, %53
%55 = call double @llvm.fmuladd.f64(double -5.000000e-02, double %54, double 1.000000e+00)
%56 = fmul double %50, %55
%57 = fdiv double %48, %56
store double %57, double* %19
%58 = load double, double* %5
%59 = load double, double* %6
%60 = load double, double* %7
%61 = call double @gsw_entropy_part(double %58, double %59, double %60)
store double %61, double* %20
store i32 1, i32* %11
br label %62
62: ; preds = %95, %4
%63 = load i32, i32* %11
%64 = icmp sle i32 %63, 2
br i1 %64, label %65, label %98
65: ; preds = %62
%66 = load double, double* %15
store double %66, double* %17
%67 = load double, double* %5
%68 = load double, double* %17
%69 = load double, double* %8
%70 = call double @gsw_entropy_part(double %67, double %68, double %69)
%71 = load double, double* %20
%72 = fsub double %70, %71
store double %72, double* %18
%73 = load double, double* %17
%74 = load double, double* %18
%75 = load double, double* %19
%76 = fdiv double %74, %75
%77 = fsub double %73, %76
store double %77, double* %15
%78 = load double, double* %15
%79 = load double, double* %17
%80 = fadd double %78, %79
%81 = fmul double 5.000000e-01, %80
store double %81, double* %16
%82 = load i32, i32* %9
%83 = load i32, i32* %10
%84 = load i32, i32* %9
%85 = load double, double* %5
%86 = load double, double* %16
%87 = load double, double* %8
%88 = call double @gsw_gibbs(i32 %82, i32 %83, i32 %84, double %85, double %86, double %87)
%89 = fneg double %88
store double %89, double* %19
%90 = load double, double* %17
%91 = load double, double* %18
%92 = load double, double* %19
%93 = fdiv double %91, %92
%94 = fsub double %90, %93
store double %94, double* %15
br label %95
95: ; preds = %65
%96 = load i32, i32* %11
%97 = add nsw i32 %96, 1
store i32 %97, i32* %11
br label %62
98: ; preds = %62
%99 = load double, double* %15
ret double %99
}

LLVM IR (-O2):
define double @gsw_pt_from_t(double %0, double %1, double %2, double %3) {
%5 = fmul double %0, 3.500000e+01
%6 = fdiv double %5, 0x4041952007DD4413
%7 = fsub double %2, %3
%8 = fneg double %6
%9 = tail call double @llvm.fmuladd.f64(double %8, double 0x3EB7C33B95B88255, double 0x3EE22688087541E7)
%10 = fadd double %2, %3
%11 = fneg double %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double 0x3E3FB58BA9535C76, double %9)
%13 = tail call double @llvm.fmuladd.f64(double %6, double 0x3E5E7CB3752F16F8, double 0xBEE19446261035E0)
%14 = tail call double @llvm.fmuladd.f64(double %1, double 0x3E5317702C99FB88, double %13)
%15 = tail call double @llvm.fmuladd.f64(double %10, double 0x3DE78600C409F84E, double %14)
%16 = tail call double @llvm.fmuladd.f64(double %1, double %15, double %12)
%17 = tail call double @llvm.fmuladd.f64(double %7, double %16, double %1)
%18 = fadd double %17, 2.731500e+02
%19 = fdiv double %0, 0x4041952007DD4413
%20 = fsub double 1.000000e+00, %19
%21 = tail call double @llvm.fmuladd.f64(double %20, double -5.000000e-02, double 1.000000e+00)
%22 = fmul double %21, %18
%23 = fdiv double 0x40AF2FBC64E02648, %22
%24 = tail call double @gsw_entropy_part(double %0, double %1, double %2)
%25 = tail call double @gsw_entropy_part(double %0, double %17, double %3)
%26 = fsub double %25, %24
%27 = fdiv double %26, %23
%28 = fsub double %17, %27
%29 = fadd double %17, %28
%30 = fmul double %29, 5.000000e-01
%31 = tail call double @gsw_gibbs(i32 0, i32 2, i32 0, double %0, double %30, double %3)
%32 = fdiv double %26, %31
%33 = fadd double %17, %32
%34 = tail call double @gsw_entropy_part(double %0, double %33, double %3)
%35 = fsub double %34, %24
%36 = fdiv double %35, %31
%37 = fadd double %33, %36
%38 = fadd double %33, %37
%39 = fmul double %38, 5.000000e-01
%40 = tail call double @gsw_gibbs(i32 0, i32 2, i32 0, double %0, double %39, double %3)
%41 = fdiv double %35, %40
%42 = fadd double %33, %41
ret double %42
}