#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 exp(double);
double sqrt(double);
double canopytran(double absorptivity, double Kextinct, double LAI,
                  double clumpfactor, double rhonothor, double rhosoil) {
  double subtrm, numer, denom, tauval;
  subtrm = sqrt(absorptivity) * Kextinct * LAI * clumpfactor;
  numer = (rhonothor * rhonothor - 1.0) * exp(-subtrm);
  denom = (rhonothor * rhosoil - 1.0) +
          rhonothor * (rhonothor - rhosoil) * exp(-2.0 * subtrm);
  tauval = numer / denom;
  return (tauval);
}


x86 assembly (clang, -O0):
<canopytran>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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  -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe0c(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<canopytran>:
sub    $0x38,%rsp
movsd  %xmm5,0x30(%rsp)
movsd  %xmm4,0x10(%rsp)
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm0
jb     1140 <canopytran+0x20>
sqrtsd %xmm0,%xmm0
jmp    1169 <canopytran+0x49>
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1040 <sqrt@plt>
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  0xe79(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm1
movapd %xmm0,0x20(%rsp)
movapd 0xe71(%rip),%xmm0
xorpd  %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm2
movsd  0x30(%rsp),%xmm0
mulsd  %xmm0,%xmm2
addsd  0xe30(%rip),%xmm2
movsd  %xmm2,0x18(%rsp)
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
mulsd  0xe12(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @canopytran(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
%15 = alloca double
%16 = 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
%17 = load double, double* %7
%18 = call double @sqrt(double %17)
%19 = load double, double* %8
%20 = fmul double %18, %19
%21 = load double, double* %9
%22 = fmul double %20, %21
%23 = load double, double* %10
%24 = fmul double %22, %23
store double %24, double* %13
%25 = load double, double* %11
%26 = load double, double* %11
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double -1.000000e+00)
%28 = load double, double* %13
%29 = fneg double %28
%30 = call double @exp(double %29)
%31 = fmul double %27, %30
store double %31, double* %14
%32 = load double, double* %11
%33 = load double, double* %12
%34 = call double @llvm.fmuladd.f64(double %32, double %33, double -1.000000e+00)
%35 = load double, double* %11
%36 = load double, double* %11
%37 = load double, double* %12
%38 = fsub double %36, %37
%39 = fmul double %35, %38
%40 = load double, double* %13
%41 = fmul double -2.000000e+00, %40
%42 = call double @exp(double %41)
%43 = call double @llvm.fmuladd.f64(double %39, double %42, double %34)
store double %43, double* %15
%44 = load double, double* %14
%45 = load double, double* %15
%46 = fdiv double %44, %45
store double %46, double* %16
%47 = load double, double* %16
ret double %47
}

LLVM IR (-O2):
define double @canopytran(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = tail call double @sqrt(double %0)
%8 = fmul double %7, %1
%9 = fmul double %8, %2
%10 = fmul double %9, %3
%11 = tail call double @llvm.fmuladd.f64(double %4, double %4, double -1.000000e+00)
%12 = fneg double %10
%13 = tail call double @exp(double %12)
%14 = fmul double %11, %13
%15 = tail call double @llvm.fmuladd.f64(double %4, double %5, double -1.000000e+00)
%16 = fsub double %4, %5
%17 = fmul double %16, %4
%18 = fmul double %10, -2.000000e+00
%19 = tail call double @exp(double %18)
%20 = tail call double @llvm.fmuladd.f64(double %17, double %19, double %15)
%21 = fdiv double %14, %20
ret double %21
}