#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 */
int exp(float);
float kernel_gradient(float r, float h) {
  float q = r / h;
  float alpha = 1. / (5.56832799683 * h * h * h);
  if (q >= 2.) {
    return 0;
  } else {
    return -2. * alpha * r * exp(-q * q) / (h * h);
  }
}


x86 assembly (clang, -O0):
<kernel_gradient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xece(%rip),%xmm1
mulsd  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xea0(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     119d <kernel_gradient+0x8d>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1208 <kernel_gradient+0xf8>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe6a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_gradient>:
sub    $0x18,%rsp
movaps %xmm0,%xmm2
divss  %xmm1,%xmm2
xorps  %xmm3,%xmm3
ucomiss 0xedb(%rip),%xmm2
jae    11ac <kernel_gradient+0x9c>
cvtss2sd %xmm1,%xmm4
movss  %xmm1,0xc(%rsp)
movsd  0xecb(%rip),%xmm3
mulsd  %xmm4,%xmm3
mulsd  %xmm4,%xmm3
mulsd  %xmm4,%xmm3
movsd  0xebf(%rip),%xmm1
divsd  %xmm3,%xmm1
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xeb3(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movaps 0xea6(%rip),%xmm0
xorps  %xmm2,%xmm0
mulss  %xmm2,%xmm0
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
xorps  %xmm3,%xmm3
cvtsd2ss %xmm0,%xmm3
movaps %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @kernel_gradient(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
%8 = load float, float* %4
%9 = load float, float* %5
%10 = fdiv float %8, %9
store float %10, float* %6
%11 = load float, float* %5
%12 = fpext float %11 to double
%13 = fmul double 0x401645F7C63F24E8, %12
%14 = load float, float* %5
%15 = fpext float %14 to double
%16 = fmul double %13, %15
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = fmul double %16, %18
%20 = fdiv double 1.000000e+00, %19
%21 = fptrunc double %20 to float
store float %21, float* %7
%22 = load float, float* %6
%23 = fpext float %22 to double
%24 = fcmp oge double %23, 2.000000e+00
br i1 %24, label %25, label %26
25: ; preds = %2
store float 0.000000e+00, float* %3
br label %46
26: ; preds = %2
%27 = load float, float* %7
%28 = fpext float %27 to double
%29 = fmul double -2.000000e+00, %28
%30 = load float, float* %4
%31 = fpext float %30 to double
%32 = fmul double %29, %31
%33 = load float, float* %6
%34 = fneg float %33
%35 = load float, float* %6
%36 = fmul float %34, %35
%37 = call i32 @exp(float %36)
%38 = sitofp i32 %37 to double
%39 = fmul double %32, %38
%40 = load float, float* %5
%41 = load float, float* %5
%42 = fmul float %40, %41
%43 = fpext float %42 to double
%44 = fdiv double %39, %43
%45 = fptrunc double %44 to float
store float %45, float* %3
br label %46
46: ; preds = %26, %25
%47 = load float, float* %3
ret float %47
}

LLVM IR (-O2):
define float @kernel_gradient(float %0, float %1) {
%3 = fdiv float %0, %1
%4 = fpext float %1 to double
%5 = fcmp ult float %3, 2.000000e+00
br i1 %5, label %6, label %25
6: ; preds = %2
%7 = fmul double %4, 0x401645F7C63F24E8
%8 = fmul double %7, %4
%9 = fmul double %8, %4
%10 = fdiv double 1.000000e+00, %9
%11 = fptrunc double %10 to float
%12 = fpext float %11 to double
%13 = fmul double %12, -2.000000e+00
%14 = fpext float %0 to double
%15 = fmul double %13, %14
%16 = fneg float %3
%17 = fmul float %3, %16
%18 = tail call i32 @exp(float %17)
%19 = sitofp i32 %18 to double
%20 = fmul double %15, %19
%21 = fmul float %1, %1
%22 = fpext float %21 to double
%23 = fdiv double %20, %22
%24 = fptrunc double %23 to float
br label %25
25: ; preds = %2, %6
%26 = phi float [ %24, %6 ], [ 0.000000e+00, %2 ]
ret float %26
}