#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 gridcell_wspd(double r, double pcent, double pedge, double rmaxw) {
  double cc;
  cc = -((pedge - pcent) / 1.22) * (rmaxw / (r * r)) * exp(-rmaxw / r);
  return (sqrt(0.000061618 * 0.000061618 - 4.0 / r * cc) - 0.000061618) /
         (2.0 / r);
}


x86 assembly (clang, -O0):
<gridcell_wspd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xed2(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe54(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe1f(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  0xe06(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdf2(%rip),%xmm1
divsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gridcell_wspd>:
sub    $0x28,%rsp
subsd  %xmm1,%xmm2
movapd %xmm0,%xmm4
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm0,%xmm4
unpcklpd %xmm3,%xmm2
movapd 0xebe(%rip),%xmm1
unpcklpd %xmm4,%xmm1
divpd  %xmm1,%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm1,0x10(%rsp)
xorpd  0xeac(%rip),%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0xe9d(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe93(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11a5 <gridcell_wspd+0x85>
sqrtsd %xmm0,%xmm0
jmp    11aa <gridcell_wspd+0x8a>
call   1040 <sqrt@plt>
addsd  0xe7e(%rip),%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  0x8(%rsp),%xmm1
divsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @gridcell_wspd(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %7
%11 = load double, double* %6
%12 = fsub double %10, %11
%13 = fdiv double %12, 1.220000e+00
%14 = fneg double %13
%15 = load double, double* %8
%16 = load double, double* %5
%17 = load double, double* %5
%18 = fmul double %16, %17
%19 = fdiv double %15, %18
%20 = fmul double %14, %19
%21 = load double, double* %8
%22 = fneg double %21
%23 = load double, double* %5
%24 = fdiv double %22, %23
%25 = call double @exp(double %24)
%26 = fmul double %20, %25
store double %26, double* %9
%27 = load double, double* %5
%28 = fdiv double 4.000000e+00, %27
%29 = load double, double* %9
%30 = fneg double %28
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double 0x3E304E99FA4CBCFF)
%32 = call double @sqrt(double %31)
%33 = fsub double %32, 6.161800e-05
%34 = load double, double* %5
%35 = fdiv double 2.000000e+00, %34
%36 = fdiv double %33, %35
ret double %36
}

LLVM IR (-O2):
define double @gridcell_wspd(double %0, double %1, double %2, double %3) {
%5 = fsub double %2, %1
%6 = fmul double %0, %0
%7 = insertelement <2 x double> poison, double %3, i64 1
%8 = insertelement <2 x double> %7, double %5, i64 0
%9 = insertelement <2 x double> <double -1.220000e+00, double poison>, double %6, i64 1
%10 = fdiv <2 x double> %8, %9
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%12 = fmul <2 x double> %10, %11
%13 = extractelement <2 x double> %12, i64 0
%14 = fneg double %3
%15 = fdiv double %14, %0
%16 = tail call double @exp(double %15)
%17 = fmul double %13, %16
%18 = fdiv double -4.000000e+00, %0
%19 = tail call double @llvm.fmuladd.f64(double %18, double %17, double 0x3E304E99FA4CBCFF)
%20 = tail call double @sqrt(double %19)
%21 = fadd double %20, -6.161800e-05
%22 = fdiv double 2.000000e+00, %0
%23 = fdiv double %21, %22
ret double %23
}