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


x86 assembly (clang, -O0):
<CE_TCCP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
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  -0x40(%rbp),%xmm0
call   1070 <CE_Activity@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x50(%rbp),%xmm5
mov    $0x7,%edi
call   1040 <CE_MP_pH@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x50(%rbp),%xmm5
call   1050 <CE_pHM_HCO3@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x50(%rbp),%xmm5
call   1060 <CE_pHM_CO3@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  0xde1(%rip),%xmm0
subsd  -0x48(%rbp),%xmm0
cvttsd2si %xmm0,%esi
mov    $0xa,%edi
call   1080 <pow@plt>
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movsd  0xd88(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movsd  -0x68(%rbp),%xmm2
movsd  0xd6f(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  0xd5a(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x28(%rbp),%xmm5
movsd  -0x30(%rbp),%xmm6
movsd  -0x38(%rbp),%xmm7
movsd  -0x50(%rbp),%xmm9
movsd  -0x78(%rbp),%xmm8
xor    %edi,%edi
movsd  %xmm9,(%rsp)
movsd  %xmm8,0x8(%rsp)
call   1030 <finddCa@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CE_TCCP>:
sub    $0x78,%rsp
movsd  %xmm7,0x60(%rsp)
movsd  %xmm6,0x70(%rsp)
movsd  %xmm5,0x18(%rsp)
movsd  %xmm4,0x30(%rsp)
movsd  %xmm3,0x28(%rsp)
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x68(%rsp)
movaps %xmm7,%xmm0
call   1070 <CE_Activity@plt>
movaps %xmm0,%xmm5
movsd  %xmm0,0x38(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
mov    $0x7,%edi
call   1040 <CE_MP_pH@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
movsd  0x38(%rsp),%xmm5
call   1050 <CE_pHM_HCO3@plt>
movsd  %xmm0,0x58(%rsp)
movsd  0x40(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
movsd  0x38(%rsp),%xmm5
call   1060 <CE_pHM_CO3@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0xdcd(%rip),%xmm0
subsd  0x40(%rsp),%xmm0
cvttsd2si %xmm0,%esi
mov    $0xa,%edi
call   1080 <pow@plt>
movsd  0x38(%rsp),%xmm2
divsd  %xmm2,%xmm0
movapd %xmm2,%xmm1
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm6
movapd %xmm6,%xmm2
divsd  %xmm1,%xmm2
movsd  0xd91(%rip),%xmm1
movsd  0x58(%rsp),%xmm4
mulsd  %xmm1,%xmm4
movsd  0x50(%rsp),%xmm5
addsd  %xmm5,%xmm5
addsd  %xmm4,%xmm5
mulsd  %xmm1,%xmm0
addsd  %xmm5,%xmm0
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  0x60(%rsp),%xmm0
subsd  %xmm2,%xmm0
movsd  %xmm3,(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %edi,%edi
movsd  0x40(%rsp),%xmm0
movsd  0x68(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x48(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x30(%rsp),%xmm5
movsd  0x70(%rsp),%xmm7
call   1030 <finddCa@plt>
add    $0x78,%rsp
ret

LLVM IR (-O0):
define double @CE_TCCP(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = alloca double
%10 = alloca double
%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
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
store double %7, double* %16
%24 = load double, double* %16
%25 = call double @CE_Activity(double %24)
store double %25, double* %18
%26 = load double, double* %10
%27 = load double, double* %11
%28 = load double, double* %12
%29 = load double, double* %13
%30 = load double, double* %14
%31 = load double, double* %18
%32 = call double @CE_MP_pH(double %26, double %27, double %28, double %29, double %30, double %31, i32 7)
store double %32, double* %17
%33 = load double, double* %17
%34 = load double, double* %10
%35 = load double, double* %12
%36 = load double, double* %13
%37 = load double, double* %14
%38 = load double, double* %18
%39 = call double @CE_pHM_HCO3(double %33, double %34, double %35, double %36, double %37, double %38)
store double %39, double* %19
%40 = load double, double* %17
%41 = load double, double* %10
%42 = load double, double* %12
%43 = load double, double* %13
%44 = load double, double* %14
%45 = load double, double* %18
%46 = call double @CE_pHM_CO3(double %40, double %41, double %42, double %43, double %44, double %45)
store double %46, double* %20
%47 = load double, double* %17
%48 = fsub double 3.000000e+00, %47
%49 = fptosi double %48 to i32
%50 = call double @pow(i32 10, i32 %49)
%51 = load double, double* %18
%52 = fdiv double %50, %51
store double %52, double* %21
%53 = load double, double* %14
%54 = load double, double* %18
%55 = load double, double* %18
%56 = fmul double %54, %55
%57 = load double, double* %21
%58 = fmul double %56, %57
%59 = fdiv double %53, %58
store double %59, double* %22
%60 = load double, double* %16
%61 = load double, double* %20
%62 = load double, double* %19
%63 = fdiv double %62, 2.000000e+00
%64 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %61, double %63)
%65 = load double, double* %21
%66 = fdiv double %65, 2.000000e+00
%67 = fadd double %64, %66
%68 = load double, double* %22
%69 = fdiv double %68, 2.000000e+00
%70 = fadd double %67, %69
%71 = fsub double %60, %70
store double %71, double* %23
%72 = load double, double* %17
%73 = load double, double* %9
%74 = load double, double* %10
%75 = load double, double* %11
%76 = load double, double* %12
%77 = load double, double* %13
%78 = load double, double* %14
%79 = load double, double* %15
%80 = load double, double* %18
%81 = load double, double* %23
%82 = call double @finddCa(i32 0, double %72, double %73, double %74, double %75, double %76, double %77, double %78, double %79, double %80, double %81)
ret double %82
}

LLVM IR (-O2):
define double @CE_TCCP(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = tail call double @CE_Activity(double %7)
%10 = tail call double @CE_MP_pH(double %1, double %2, double %3, double %4, double %5, double %9, i32 7)
%11 = tail call double @CE_pHM_HCO3(double %10, double %1, double %3, double %4, double %5, double %9)
%12 = tail call double @CE_pHM_CO3(double %10, double %1, double %3, double %4, double %5, double %9)
%13 = fsub double 3.000000e+00, %10
%14 = fptosi double %13 to i32
%15 = tail call double @pow(i32 10, i32 %14)
%16 = fdiv double %15, %9
%17 = fmul double %9, %9
%18 = fmul double %17, %16
%19 = fdiv double %5, %18
%20 = fmul double %11, 5.000000e-01
%21 = tail call double @llvm.fmuladd.f64(double %12, double 2.000000e+00, double %20)
%22 = fmul double %16, 5.000000e-01
%23 = fadd double %21, %22
%24 = fmul double %19, 5.000000e-01
%25 = fadd double %23, %24
%26 = fsub double %7, %25
%27 = tail call double @finddCa(i32 0, double %10, double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %9, double %26)
ret double %27
}