#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, double);
double soil_conductivity(double moist, double Wu, double soil_dens_min,
                         double bulk_dens_min, double quartz,
                         double soil_density, double bulk_density,
                         double organic) {
  double Ke;
  double Ki = 2.2;
  double Kw = 0.57;
  double Ksat;
  double Kdry;
  double Kdry_org = 0.05;
  double Kdry_min;
  double Ks;
  double Ks_org = 0.25;
  double Ks_min;
  double Sr;
  double K;
  double porosity;
  Kdry_min =
      (0.135 * bulk_dens_min + 64.7) / (soil_dens_min - 0.947 * bulk_dens_min);
  Kdry = (1 - organic) * Kdry_min + organic * Kdry_org;
  if (moist > 0.) {
    porosity = 1.0 - bulk_density / soil_density;
    Sr = moist / porosity;
    if (quartz < .2)
      Ks_min = pow(7.7, quartz) * pow(3.0, 1.0 - quartz);
    else
      Ks_min = pow(7.7, quartz) * pow(2.2, 1.0 - quartz);
    Ks = (1 - organic) * Ks_min + organic * Ks_org;
    if (Wu == moist) {
      Ksat = pow(Ks, 1.0 - porosity) * pow(Kw, porosity);
      Ke = 0.7 * log10(Sr) + 1.0;
    } else {
      Ksat = pow(Ks, 1.0 - porosity) * pow(Ki, porosity - Wu) * pow(Kw, Wu);
      Ke = Sr;
    }
    K = (Ksat - Kdry) * Ke + Kdry;
    if (K < Kdry)
      K = Kdry;
  } else
    K = Kdry;
  return (K);
}


x86 assembly (clang, -O0):
<soil_conductivity>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%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  0xedd(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
movsd  0xe79(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe75(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movsd  0xe4f(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xe2e(%rip),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    146f <soil_conductivity+0x34f>
movsd  -0x38(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
movsd  0xde9(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
divsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xe00(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    129b <soil_conductivity+0x17b>
movsd  -0x28(%rbp),%xmm1
movsd  0xdf0(%rip),%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0xd93(%rip),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0xdd6(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    12e6 <soil_conductivity+0x1c6>
movsd  -0x28(%rbp),%xmm1
movsd  0xda0(%rip),%xmm0
call   1030 <pow@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xd43(%rip),%xmm1
subsd  -0x28(%rbp),%xmm1
movsd  0xd6e(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xd12(%rip),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x40(%rbp),%xmm1
mulsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    13a2 <soil_conductivity+0x282>
jp     13a2 <soil_conductivity+0x282>
movsd  -0x80(%rbp),%xmm0
movsd  0xcc8(%rip),%xmm1
subsd  -0xa8(%rbp),%xmm1
ff
call   1030 <pow@plt>
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  -0xa8(%rbp),%xmm1
ff
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
call   1040 <log10@plt>
movsd  0xcd0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc6c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1422 <soil_conductivity+0x302>
movsd  -0x80(%rbp),%xmm0
movsd  0xc51(%rip),%xmm1
subsd  -0xa8(%rbp),%xmm1
ff
call   1030 <pow@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  -0xa8(%rbp),%xmm1
ff
subsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    146a <soil_conductivity+0x34a>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    147c <soil_conductivity+0x35c>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<soil_conductivity>:
push   %rbx
sub    $0x50,%rsp
movapd %xmm0,%xmm8
unpcklpd %xmm3,%xmm3
movapd 0xeca(%rip),%xmm0
unpcklpd %xmm2,%xmm0
mulpd  0xece(%rip),%xmm3
addpd  %xmm0,%xmm3
movapd %xmm3,%xmm0
unpckhpd %xmm3,%xmm0
divsd  %xmm0,%xmm3
movsd  0xed5(%rip),%xmm9
movapd %xmm9,%xmm2
subsd  %xmm7,%xmm2
movsd  0xecc(%rip),%xmm0
mulsd  %xmm7,%xmm0
mulsd  %xmm2,%xmm3
addsd  %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm8
jbe    12ff <soil_conductivity+0x1df>
movapd %xmm3,0x40(%rsp)
divsd  %xmm5,%xmm6
movapd %xmm9,%xmm3
subsd  %xmm6,%xmm3
movsd  %xmm3,0x8(%rsp)
movapd %xmm8,%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe89(%rip),%xmm0
xor    %ebx,%ebx
ucomisd %xmm4,%xmm0
seta   %bl
movsd  0xe80(%rip),%xmm0
movsd  %xmm1,0x18(%rsp)
movapd %xmm4,%xmm1
movsd  %xmm8,0x38(%rsp)
movsd  %xmm7,0x30(%rsp)
movsd  %xmm4,0x20(%rsp)
movsd  %xmm2,(%rsp)
call   1030 <pow@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xe33(%rip),%xmm1
subsd  0x20(%rsp),%xmm1
lea    0xe16(%rip),%rax
movsd  (%rax,%rbx,8),%xmm0
call   1030 <pow@plt>
movsd  0x30(%rsp),%xmm1
mulsd  0xe2e(%rip),%xmm1
mulsd  0x28(%rsp),%xmm0
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xdf7(%rip),%xmm1
subsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x18(%rsp),%xmm2
movsd  %xmm0,(%rsp)
ucomisd 0x38(%rsp),%xmm2
jne    129c <soil_conductivity+0x17c>
jp     129c <soil_conductivity+0x17c>
movsd  0xdff(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <log10@plt>
movsd  (%rsp),%xmm3
mulsd  0xdd6(%rip),%xmm0
addsd  0xd96(%rip),%xmm0
jmp    12e3 <soil_conductivity+0x1c3>
movsd  0x8(%rsp),%xmm1
subsd  %xmm2,%xmm1
movsd  0xdaa(%rip),%xmm0
call   1030 <pow@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0xd97(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
call   1030 <pow@plt>
movsd  (%rsp),%xmm3
mulsd  %xmm0,%xmm3
movsd  0x10(%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
subsd  %xmm1,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
ucomisd %xmm3,%xmm1
jbe    12ff <soil_conductivity+0x1df>
movapd %xmm1,%xmm3
movapd %xmm3,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @soil_conductivity(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
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = 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
store double 2.200000e+00, double* %18
store double 5.700000e-01, double* %19
store double 5.000000e-02, double* %22
store double 2.500000e-01, double* %25
%30 = load double, double* %12
%31 = call double @llvm.fmuladd.f64(double 1.350000e-01, double %30, double 6.470000e+01)
%32 = load double, double* %11
%33 = load double, double* %12
%34 = call double @llvm.fmuladd.f64(double -9.470000e-01, double %33, double %32)
%35 = fdiv double %31, %34
store double %35, double* %23
%36 = load double, double* %16
%37 = fsub double 1.000000e+00, %36
%38 = load double, double* %23
%39 = load double, double* %16
%40 = load double, double* %22
%41 = fmul double %39, %40
%42 = call double @llvm.fmuladd.f64(double %37, double %38, double %41)
store double %42, double* %21
%43 = load double, double* %9
%44 = fcmp ogt double %43, 0.000000e+00
br i1 %44, label %45, label %121
45: ; preds = %8
%46 = load double, double* %15
%47 = load double, double* %14
%48 = fdiv double %46, %47
%49 = fsub double 1.000000e+00, %48
store double %49, double* %29
%50 = load double, double* %9
%51 = load double, double* %29
%52 = fdiv double %50, %51
store double %52, double* %27
%53 = load double, double* %13
%54 = fcmp olt double %53, 2.000000e-01
br i1 %54, label %55, label %62
55: ; preds = %45
%56 = load double, double* %13
%57 = call double @pow(double 7.700000e+00, double %56)
%58 = load double, double* %13
%59 = fsub double 1.000000e+00, %58
%60 = call double @pow(double 3.000000e+00, double %59)
%61 = fmul double %57, %60
store double %61, double* %26
br label %69
62: ; preds = %45
%63 = load double, double* %13
%64 = call double @pow(double 7.700000e+00, double %63)
%65 = load double, double* %13
%66 = fsub double 1.000000e+00, %65
%67 = call double @pow(double 2.200000e+00, double %66)
%68 = fmul double %64, %67
store double %68, double* %26
br label %69
69: ; preds = %62, %55
%70 = load double, double* %16
%71 = fsub double 1.000000e+00, %70
%72 = load double, double* %26
%73 = load double, double* %16
%74 = load double, double* %25
%75 = fmul double %73, %74
%76 = call double @llvm.fmuladd.f64(double %71, double %72, double %75)
store double %76, double* %24
%77 = load double, double* %10
%78 = load double, double* %9
%79 = fcmp oeq double %77, %78
br i1 %79, label %80, label %92
80: ; preds = %69
%81 = load double, double* %24
%82 = load double, double* %29
%83 = fsub double 1.000000e+00, %82
%84 = call double @pow(double %81, double %83)
%85 = load double, double* %19
%86 = load double, double* %29
%87 = call double @pow(double %85, double %86)
%88 = fmul double %84, %87
store double %88, double* %20
%89 = load double, double* %27
%90 = call double @log10(double %89)
%91 = call double @llvm.fmuladd.f64(double 0x3FE6666666666666, double %90, double 1.000000e+00)
store double %91, double* %17
br label %108
92: ; preds = %69
%93 = load double, double* %24
%94 = load double, double* %29
%95 = fsub double 1.000000e+00, %94
%96 = call double @pow(double %93, double %95)
%97 = load double, double* %18
%98 = load double, double* %29
%99 = load double, double* %10
%100 = fsub double %98, %99
%101 = call double @pow(double %97, double %100)
%102 = fmul double %96, %101
%103 = load double, double* %19
%104 = load double, double* %10
%105 = call double @pow(double %103, double %104)
%106 = fmul double %102, %105
store double %106, double* %20
%107 = load double, double* %27
store double %107, double* %17
br label %108
108: ; preds = %92, %80
%109 = load double, double* %20
%110 = load double, double* %21
%111 = fsub double %109, %110
%112 = load double, double* %17
%113 = load double, double* %21
%114 = call double @llvm.fmuladd.f64(double %111, double %112, double %113)
store double %114, double* %28
%115 = load double, double* %28
%116 = load double, double* %21
%117 = fcmp olt double %115, %116
br i1 %117, label %118, label %120
118: ; preds = %108
%119 = load double, double* %21
store double %119, double* %28
br label %120
120: ; preds = %118, %108
br label %123
121: ; preds = %8
%122 = load double, double* %21
store double %122, double* %28
br label %123
123: ; preds = %121, %120
%124 = load double, double* %28
ret double %124
}

LLVM IR (-O2):
define double @soil_conductivity(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) {
%9 = insertelement <2 x double> poison, double %3, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = insertelement <2 x double> <double 6.470000e+01, double poison>, double %2, i64 1
%12 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %10, <2 x double> <double 1.350000e-01, double -9.470000e-01>, <2 x double> %11)
%13 = extractelement <2 x double> %12, i64 0
%14 = extractelement <2 x double> %12, i64 1
%15 = fdiv double %13, %14
%16 = fsub double 1.000000e+00, %7
%17 = fmul double %7, 5.000000e-02
%18 = tail call double @llvm.fmuladd.f64(double %16, double %15, double %17)
%19 = fcmp ogt double %0, 0.000000e+00
br i1 %19, label %20, label %53
20: ; preds = %8
%21 = fdiv double %6, %5
%22 = fsub double 1.000000e+00, %21
%23 = fdiv double %0, %22
%24 = fcmp olt double %4, 2.000000e-01
%25 = tail call double @pow(double 7.700000e+00, double %4)
%26 = fsub double 1.000000e+00, %4
%27 = select i1 %24, double 3.000000e+00, double 2.200000e+00
%28 = tail call double @pow(double %27, double %26)
%29 = fmul double %25, %28
%30 = fmul double %7, 2.500000e-01
%31 = tail call double @llvm.fmuladd.f64(double %16, double %29, double %30)
%32 = fcmp oeq double %1, %0
%33 = fsub double 1.000000e+00, %22
%34 = tail call double @pow(double %31, double %33)
br i1 %32, label %35, label %40
35: ; preds = %20
%36 = tail call double @pow(double 5.700000e-01, double %22)
%37 = fmul double %34, %36
%38 = tail call double @log10(double %23)
%39 = tail call double @llvm.fmuladd.f64(double %38, double 0x3FE6666666666666, double 1.000000e+00)
br label %46
40: ; preds = %20
%41 = fsub double %22, %1
%42 = tail call double @pow(double 2.200000e+00, double %41)
%43 = fmul double %34, %42
%44 = tail call double @pow(double 5.700000e-01, double %1)
%45 = fmul double %43, %44
br label %46
46: ; preds = %40, %35
%47 = phi double [ %37, %35 ], [ %45, %40 ]
%48 = phi double [ %39, %35 ], [ %23, %40 ]
%49 = fsub double %47, %18
%50 = tail call double @llvm.fmuladd.f64(double %49, double %48, double %18)
%51 = fcmp olt double %50, %18
br i1 %51, label %52, label %53
52: ; preds = %46
br label %53
53: ; preds = %8, %46, %52
%54 = phi double [ %18, %52 ], [ %50, %46 ], [ %18, %8 ]
ret double %54
}