#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 pow(double, int);
double CE_pHCO3_P(double pH, double CO3, double K1, double K2, double Kw,
                  double f) {
  double H3O, t0;
  H3O = pow(10, (3 - pH)) / f;
  K1 = K1 / pow(f, 2);
  K2 = K2 / pow(f, 4);
  Kw = Kw / pow(f, 2);
  t0 = -(-CO3 * K1 * K2 * H3O + CO3 * H3O * H3O * H3O - Kw * K1 * K2 +
         K1 * K2 * H3O * H3O) /
       K1 / K2 / H3O;
  return t0;
}


x86 assembly (clang, -O0):
<CE_pHCO3_P>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%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  0xeca(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xeb1(%rip),%xmm0
call   1030 <pow@plt>
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CE_pHCO3_P>:
sub    $0x78,%rsp
movaps %xmm5,0x10(%rsp)
movaps %xmm4,0x50(%rsp)
movaps %xmm3,(%rsp)
movaps %xmm2,0x60(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  0xecb(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
movsd  0xec3(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,0x30(%rsp)
movaps 0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,0x40(%rsp)
movapd 0x10(%rsp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
movapd (%rsp),%xmm1
unpcklpd 0x30(%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
unpcklpd %xmm2,%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movapd %xmm2,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movapd 0xe69(%rip),%xmm1
movapd 0x50(%rsp),%xmm2
xorpd  %xmm1,%xmm2
movapd 0x60(%rsp),%xmm5
unpcklpd %xmm2,%xmm5
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm5
movapd %xmm5,%xmm0
movsd  0x28(%rsp),%xmm6
mulsd  %xmm6,%xmm0
movapd (%rsp),%xmm3
mulsd  %xmm3,%xmm0
movapd %xmm3,%xmm2
movapd %xmm3,%xmm4
unpckhpd %xmm3,%xmm2
mulsd  %xmm2,%xmm6
mulsd  %xmm2,%xmm6
mulsd  %xmm2,%xmm6
mulsd  %xmm2,%xmm0
subsd  %xmm0,%xmm6
movapd %xmm5,%xmm3
unpckhpd %xmm5,%xmm3
mulsd  %xmm5,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm6,%xmm3
movapd %xmm5,%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
xorpd  %xmm1,%xmm0
divsd  %xmm5,%xmm0
divsd  %xmm4,%xmm0
divsd  %xmm2,%xmm0
add    $0x78,%rsp
ret

LLVM IR (-O0):
define double @CE_pHCO3_P(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%15 = load double, double* %7
%16 = fsub double 3.000000e+00, %15
%17 = fptosi double %16 to i32
%18 = call double @pow(double 1.000000e+01, i32 %17)
%19 = load double, double* %12
%20 = fdiv double %18, %19
store double %20, double* %13
%21 = load double, double* %9
%22 = load double, double* %12
%23 = call double @pow(double %22, i32 2)
%24 = fdiv double %21, %23
store double %24, double* %9
%25 = load double, double* %10
%26 = load double, double* %12
%27 = call double @pow(double %26, i32 4)
%28 = fdiv double %25, %27
store double %28, double* %10
%29 = load double, double* %11
%30 = load double, double* %12
%31 = call double @pow(double %30, i32 2)
%32 = fdiv double %29, %31
store double %32, double* %11
%33 = load double, double* %8
%34 = fneg double %33
%35 = load double, double* %9
%36 = fmul double %34, %35
%37 = load double, double* %10
%38 = fmul double %36, %37
%39 = load double, double* %13
%40 = load double, double* %8
%41 = load double, double* %13
%42 = fmul double %40, %41
%43 = load double, double* %13
%44 = fmul double %42, %43
%45 = load double, double* %13
%46 = fmul double %44, %45
%47 = call double @llvm.fmuladd.f64(double %38, double %39, double %46)
%48 = load double, double* %11
%49 = load double, double* %9
%50 = fmul double %48, %49
%51 = load double, double* %10
%52 = fneg double %50
%53 = call double @llvm.fmuladd.f64(double %52, double %51, double %47)
%54 = load double, double* %9
%55 = load double, double* %10
%56 = fmul double %54, %55
%57 = load double, double* %13
%58 = fmul double %56, %57
%59 = load double, double* %13
%60 = call double @llvm.fmuladd.f64(double %58, double %59, double %53)
%61 = fneg double %60
%62 = load double, double* %9
%63 = fdiv double %61, %62
%64 = load double, double* %10
%65 = fdiv double %63, %64
%66 = load double, double* %13
%67 = fdiv double %65, %66
store double %67, double* %14
%68 = load double, double* %14
ret double %68
}

LLVM IR (-O2):
define double @CE_pHCO3_P(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double 3.000000e+00, %0
%8 = fptosi double %7 to i32
%9 = tail call double @pow(double 1.000000e+01, i32 %8)
%10 = tail call double @pow(double %5, i32 2)
%11 = tail call double @pow(double %5, i32 4)
%12 = insertelement <2 x double> poison, double %3, i64 0
%13 = insertelement <2 x double> %12, double %9, i64 1
%14 = insertelement <2 x double> poison, double %5, i64 1
%15 = insertelement <2 x double> %14, double %11, i64 0
%16 = fdiv <2 x double> %13, %15
%17 = tail call double @pow(double %5, i32 2)
%18 = fneg double %1
%19 = fneg double %4
%20 = insertelement <2 x double> poison, double %2, i64 0
%21 = insertelement <2 x double> %20, double %19, i64 1
%22 = insertelement <2 x double> poison, double %10, i64 0
%23 = insertelement <2 x double> %22, double %17, i64 1
%24 = fdiv <2 x double> %21, %23
%25 = extractelement <2 x double> %24, i64 0
%26 = fmul double %25, %18
%27 = extractelement <2 x double> %16, i64 0
%28 = fmul double %26, %27
%29 = extractelement <2 x double> %16, i64 1
%30 = fmul double %29, %1
%31 = fmul double %29, %30
%32 = fmul double %29, %31
%33 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %32)
%34 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%35 = fmul <2 x double> %24, %34
%36 = extractelement <2 x double> %35, i64 0
%37 = tail call double @llvm.fmuladd.f64(double %36, double %27, double %33)
%38 = fmul <2 x double> %24, %16
%39 = extractelement <2 x double> %38, i64 0
%40 = fmul double %29, %39
%41 = tail call double @llvm.fmuladd.f64(double %40, double %29, double %37)
%42 = fneg double %41
%43 = fdiv double %42, %25
%44 = fdiv double %43, %27
%45 = fdiv double %44, %29
ret double %45
}