#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 CE_Activity(double);
double CE_MP_pH(double, double, double, double, double, double, double);
double CE_pHM_CO3(double, double, double, double, double, double);
double CE_pHM_HCO3(double, double, double, double, double, double);
double pow(double, int);
double fnkCa(double dCa, double pH0, double M, double P, double K1, double K2,
             double Kw, double Ks, double f0, double IB) {
  double pH, HCO3, CO3, H3O, OH, IS, Ca, f;
  M = M - 2 * dCa;
  P = P - dCa;
  IB = IB - 2 * dCa;
  pH = CE_MP_pH(M, P, K1, K2, Kw, f0, pH0);
  HCO3 = CE_pHM_HCO3(pH, M, K1, K2, Kw, f0);
  CO3 = CE_pHM_CO3(pH, M, K1, K2, Kw, f0);
  H3O = pow(10, (3 - pH)) / f0;
  OH = Kw / (f0 * f0 * H3O);
  IS = IB + (2 * CO3 + HCO3 / 2 + H3O / 2 + OH / 2);
  f = CE_Activity(IS);
  pH = CE_MP_pH(M, P, K1, K2, Kw, f, pH0);
  HCO3 = CE_pHM_HCO3(pH, M, K1, K2, Kw, f);
  CO3 = CE_pHM_CO3(pH, M, K1, K2, Kw, f);
  H3O = pow(10, (3 - pH)) / f;
  OH = Kw / (f * f0 * H3O);
  Ca = Ks / (pow(f, 8)) / CO3 + dCa;
  return Ca;
}


x86 assembly (clang, -O0):
<fnkCa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  0x10(%rbp),%xmm5
movsd  -0x10(%rbp),%xmm6
call   1030 <CE_MP_pH@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  0x10(%rbp),%xmm5
call   1040 <CE_pHM_HCO3@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  0x10(%rbp),%xmm5
call   1050 <CE_pHM_CO3@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xdb7(%rip),%xmm0
subsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xd9e(%rip),%xmm0
call   1070 <pow@plt>
divsd  0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0x10(%rbp),%xmm1
mulsd  0x10(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0x18(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  0xd6b(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  0xd52(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
movsd  -0x68(%rbp),%xmm2
movsd  0xd3d(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1060 <CE_Activity@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x80(%rbp),%xmm5
movsd  -0x10(%rbp),%xmm6
call   1030 <CE_MP_pH@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x80(%rbp),%xmm5
call   1040 <CE_pHM_HCO3@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x80(%rbp),%xmm5
call   1050 <CE_pHM_CO3@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xc90(%rip),%xmm0
subsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xc77(%rip),%xmm0
call   1070 <pow@plt>
divsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
mulsd  0x10(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
mov    $0x8,%edi
call   1070 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
divsd  -0x58(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnkCa>:
sub    $0x68,%rsp
movsd  %xmm7,0x60(%rsp)
movaps %xmm6,%xmm8
movsd  %xmm6,0x8(%rsp)
movaps %xmm5,%xmm6
movsd  %xmm5,0x20(%rsp)
movsd  %xmm4,0x18(%rsp)
movaps %xmm1,%xmm7
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x58(%rsp)
movsd  0x70(%rsp),%xmm5
movsd  0xe70(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm1,%xmm2
movsd  %xmm2,0x28(%rsp)
subsd  %xmm0,%xmm3
movsd  %xmm3,0x50(%rsp)
addsd  0x78(%rsp),%xmm1
movsd  %xmm1,0x48(%rsp)
movapd %xmm2,%xmm0
movapd %xmm3,%xmm1
movaps %xmm4,%xmm2
movaps %xmm6,%xmm3
movaps %xmm8,%xmm4
movaps %xmm7,%xmm6
call   1030 <CE_MP_pH@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x70(%rsp),%xmm5
call   1040 <CE_pHM_HCO3@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x70(%rsp),%xmm5
call   1050 <CE_pHM_CO3@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0xdd4(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xdca(%rip),%xmm0
call   1070 <pow@plt>
movsd  0x70(%rsp),%xmm1
divsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
movsd  0x8(%rsp),%xmm1
divsd  %xmm2,%xmm1
movsd  0xda5(%rip),%xmm2
movsd  0x40(%rsp),%xmm3
mulsd  %xmm2,%xmm3
movsd  0x38(%rsp),%xmm4
addsd  %xmm4,%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm2,%xmm0
addsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
addsd  0x48(%rsp),%xmm0
call   1060 <CE_Activity@plt>
movapd %xmm0,%xmm5
movsd  %xmm0,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x30(%rsp),%xmm6
call   1030 <CE_MP_pH@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x10(%rsp),%xmm5
call   1040 <CE_pHM_HCO3@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x10(%rsp),%xmm5
call   1050 <CE_pHM_CO3@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xccf(%rip),%xmm0
subsd  0x30(%rsp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xcc5(%rip),%xmm0
call   1070 <pow@plt>
movsd  0x10(%rsp),%xmm0
mov    $0x8,%edi
call   1070 <pow@plt>
movsd  0x60(%rsp),%xmm1
divsd  %xmm0,%xmm1
divsd  0x8(%rsp),%xmm1
addsd  0x58(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x68,%rsp
ret

LLVM IR (-O0):
define double @fnkCa(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = alloca double
%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
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double %7, double* %18
store double %8, double* %19
store double %9, double* %20
%29 = load double, double* %13
%30 = load double, double* %11
%31 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %30, double %29)
store double %31, double* %13
%32 = load double, double* %14
%33 = load double, double* %11
%34 = fsub double %32, %33
store double %34, double* %14
%35 = load double, double* %20
%36 = load double, double* %11
%37 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %36, double %35)
store double %37, double* %20
%38 = load double, double* %13
%39 = load double, double* %14
%40 = load double, double* %15
%41 = load double, double* %16
%42 = load double, double* %17
%43 = load double, double* %19
%44 = load double, double* %12
%45 = call double @CE_MP_pH(double %38, double %39, double %40, double %41, double %42, double %43, double %44)
store double %45, double* %21
%46 = load double, double* %21
%47 = load double, double* %13
%48 = load double, double* %15
%49 = load double, double* %16
%50 = load double, double* %17
%51 = load double, double* %19
%52 = call double @CE_pHM_HCO3(double %46, double %47, double %48, double %49, double %50, double %51)
store double %52, double* %22
%53 = load double, double* %21
%54 = load double, double* %13
%55 = load double, double* %15
%56 = load double, double* %16
%57 = load double, double* %17
%58 = load double, double* %19
%59 = call double @CE_pHM_CO3(double %53, double %54, double %55, double %56, double %57, double %58)
store double %59, double* %23
%60 = load double, double* %21
%61 = fsub double 3.000000e+00, %60
%62 = fptosi double %61 to i32
%63 = call double @pow(double 1.000000e+01, i32 %62)
%64 = load double, double* %19
%65 = fdiv double %63, %64
store double %65, double* %24
%66 = load double, double* %17
%67 = load double, double* %19
%68 = load double, double* %19
%69 = fmul double %67, %68
%70 = load double, double* %24
%71 = fmul double %69, %70
%72 = fdiv double %66, %71
store double %72, double* %25
%73 = load double, double* %20
%74 = load double, double* %23
%75 = load double, double* %22
%76 = fdiv double %75, 2.000000e+00
%77 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %74, double %76)
%78 = load double, double* %24
%79 = fdiv double %78, 2.000000e+00
%80 = fadd double %77, %79
%81 = load double, double* %25
%82 = fdiv double %81, 2.000000e+00
%83 = fadd double %80, %82
%84 = fadd double %73, %83
store double %84, double* %26
%85 = load double, double* %26
%86 = call double @CE_Activity(double %85)
store double %86, double* %28
%87 = load double, double* %13
%88 = load double, double* %14
%89 = load double, double* %15
%90 = load double, double* %16
%91 = load double, double* %17
%92 = load double, double* %28
%93 = load double, double* %12
%94 = call double @CE_MP_pH(double %87, double %88, double %89, double %90, double %91, double %92, double %93)
store double %94, double* %21
%95 = load double, double* %21
%96 = load double, double* %13
%97 = load double, double* %15
%98 = load double, double* %16
%99 = load double, double* %17
%100 = load double, double* %28
%101 = call double @CE_pHM_HCO3(double %95, double %96, double %97, double %98, double %99, double %100)
store double %101, double* %22
%102 = load double, double* %21
%103 = load double, double* %13
%104 = load double, double* %15
%105 = load double, double* %16
%106 = load double, double* %17
%107 = load double, double* %28
%108 = call double @CE_pHM_CO3(double %102, double %103, double %104, double %105, double %106, double %107)
store double %108, double* %23
%109 = load double, double* %21
%110 = fsub double 3.000000e+00, %109
%111 = fptosi double %110 to i32
%112 = call double @pow(double 1.000000e+01, i32 %111)
%113 = load double, double* %28
%114 = fdiv double %112, %113
store double %114, double* %24
%115 = load double, double* %17
%116 = load double, double* %28
%117 = load double, double* %19
%118 = fmul double %116, %117
%119 = load double, double* %24
%120 = fmul double %118, %119
%121 = fdiv double %115, %120
store double %121, double* %25
%122 = load double, double* %18
%123 = load double, double* %28
%124 = call double @pow(double %123, i32 8)
%125 = fdiv double %122, %124
%126 = load double, double* %23
%127 = fdiv double %125, %126
%128 = load double, double* %11
%129 = fadd double %127, %128
store double %129, double* %27
%130 = load double, double* %27
ret double %130
}

LLVM IR (-O2):
define double @fnkCa(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9) {
%11 = tail call double @llvm.fmuladd.f64(double %0, double -2.000000e+00, double %2)
%12 = fsub double %3, %0
%13 = tail call double @llvm.fmuladd.f64(double %0, double -2.000000e+00, double %9)
%14 = tail call double @CE_MP_pH(double %11, double %12, double %4, double %5, double %6, double %8, double %1)
%15 = tail call double @CE_pHM_HCO3(double %14, double %11, double %4, double %5, double %6, double %8)
%16 = tail call double @CE_pHM_CO3(double %14, double %11, double %4, double %5, double %6, double %8)
%17 = fsub double 3.000000e+00, %14
%18 = fptosi double %17 to i32
%19 = tail call double @pow(double 1.000000e+01, i32 %18)
%20 = fdiv double %19, %8
%21 = fmul double %8, %8
%22 = fmul double %21, %20
%23 = fdiv double %6, %22
%24 = fmul double %15, 5.000000e-01
%25 = tail call double @llvm.fmuladd.f64(double %16, double 2.000000e+00, double %24)
%26 = fmul double %20, 5.000000e-01
%27 = fadd double %25, %26
%28 = fmul double %23, 5.000000e-01
%29 = fadd double %27, %28
%30 = fadd double %13, %29
%31 = tail call double @CE_Activity(double %30)
%32 = tail call double @CE_MP_pH(double %11, double %12, double %4, double %5, double %6, double %31, double %1)
%33 = tail call double @CE_pHM_HCO3(double %32, double %11, double %4, double %5, double %6, double %31)
%34 = tail call double @CE_pHM_CO3(double %32, double %11, double %4, double %5, double %6, double %31)
%35 = fsub double 3.000000e+00, %32
%36 = fptosi double %35 to i32
%37 = tail call double @pow(double 1.000000e+01, i32 %36)
%38 = tail call double @pow(double %31, i32 8)
%39 = fdiv double %7, %38
%40 = fdiv double %39, %34
%41 = fadd double %40, %0
ret double %41
}