#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 log10(double);
double pow(double, int);
int sqrt(double);
double CE_CO2CO3_pH(double CO2, double CO3, double K1, double K2, double Kw,
                    double f) {
  double t0;
  K1 = K1 / pow(f, 2);
  K2 = K2 / pow(f, 4);
  Kw = Kw / pow(f, 2);
  t0 = 1 / CO3 * sqrt(K1 * CO2 * K2 * CO3);
  return 3.0 - log10(t0 * f);
}


x86 assembly (clang, -O0):
<CE_CO2CO3_pH>:
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  -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  0xe2c(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1040 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xdd5(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CE_CO2CO3_pH>:
sub    $0x58,%rsp
movsd  %xmm5,0x8(%rsp)
movaps %xmm3,0x10(%rsp)
movaps %xmm2,0x20(%rsp)
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x38(%rsp)
movaps %xmm5,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd 0x10(%rsp),%xmm1
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movapd %xmm1,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  0xe56(%rip),%xmm0
movsd  0x30(%rsp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
movsd  0x38(%rsp),%xmm2
mulsd  %xmm0,%xmm2
unpckhpd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <log10@plt>
movsd  0xe0d(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x58,%rsp
ret

LLVM IR (-O0):
define double @CE_CO2CO3_pH(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
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
%14 = load double, double* %9
%15 = load double, double* %12
%16 = call double @pow(double %15, i32 2)
%17 = fdiv double %14, %16
store double %17, double* %9
%18 = load double, double* %10
%19 = load double, double* %12
%20 = call double @pow(double %19, i32 4)
%21 = fdiv double %18, %20
store double %21, double* %10
%22 = load double, double* %11
%23 = load double, double* %12
%24 = call double @pow(double %23, i32 2)
%25 = fdiv double %22, %24
store double %25, double* %11
%26 = load double, double* %8
%27 = fdiv double 1.000000e+00, %26
%28 = load double, double* %9
%29 = load double, double* %7
%30 = fmul double %28, %29
%31 = load double, double* %10
%32 = fmul double %30, %31
%33 = load double, double* %8
%34 = fmul double %32, %33
%35 = call i32 @sqrt(double %34)
%36 = sitofp i32 %35 to double
%37 = fmul double %27, %36
store double %37, double* %13
%38 = load double, double* %13
%39 = load double, double* %12
%40 = fmul double %38, %39
%41 = call double @log10(double %40)
%42 = fsub double 3.000000e+00, %41
ret double %42
}

LLVM IR (-O2):
define double @CE_CO2CO3_pH(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = tail call double @pow(double %5, i32 2)
%8 = tail call double @pow(double %5, i32 4)
%9 = insertelement <2 x double> poison, double %2, i64 0
%10 = insertelement <2 x double> %9, double %3, i64 1
%11 = insertelement <2 x double> poison, double %7, i64 0
%12 = insertelement <2 x double> %11, double %8, i64 1
%13 = fdiv <2 x double> %10, %12
%14 = tail call double @pow(double %5, i32 2)
%15 = fdiv double 1.000000e+00, %1
%16 = extractelement <2 x double> %13, i64 0
%17 = fmul double %16, %0
%18 = extractelement <2 x double> %13, i64 1
%19 = fmul double %17, %18
%20 = fmul double %19, %1
%21 = tail call i32 @sqrt(double %20)
%22 = sitofp i32 %21 to double
%23 = fmul double %15, %22
%24 = fmul double %23, %5
%25 = tail call double @log10(double %24)
%26 = fsub double 3.000000e+00, %25
ret double %26
}