#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 */
scalar_t__ Util_in_range(double const, double const, double const);
double const pow(double const, int);
double bump(const double x, const double range) {
  const double steepness = 1 / (range / 2);
  const double max_val = (steepness * pow((range / 2), 2)) / 2;
  if (Util_in_range(0, (range / 4), x)) {
    return steepness * pow(x, 2);
  } else if (Util_in_range((range / 4), (3 * range / 4), x)) {
    return -steepness * pow(x - (range / 2), 2) + max_val;
  } else if (Util_in_range((3 * range / 4), range, x)) {
    return steepness * pow(x - range, 2);
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<bump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xec9(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xec5(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe9d(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe7b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xe5d(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm2
xorps  %xmm0,%xmm0
call   1030 <Util_in_range@plt>
cmp    $0x0,%rax
je     11ed <bump+0xcd>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12fd <bump+0x1dd>
movsd  -0x18(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe12(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xded(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  -0x10(%rbp),%xmm2
call   1030 <Util_in_range@plt>
cmp    $0x0,%rax
je     128f <bump+0x16f>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xdaa(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12fd <bump+0x1dd>
movsd  0xd81(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd5c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
call   1030 <Util_in_range@plt>
cmp    $0x0,%rax
je     12f5 <bump+0x1d5>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12fd <bump+0x1dd>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bump>:
sub    $0x38,%rsp
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  0xec4(%rip),%xmm0
movsd  0xec4(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xea4(%rip),%xmm1
mulsd  0x18(%rsp),%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm1,0x20(%rsp)
movsd  0x8(%rsp),%xmm2
call   1030 <Util_in_range@plt>
test   %rax,%rax
je     11a8 <bump+0x88>
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
jmp    121a <bump+0xfa>
movsd  0xe68(%rip),%xmm1
mulsd  0x18(%rsp),%xmm1
mulsd  0xe52(%rip),%xmm1
movsd  0x20(%rsp),%xmm0
movsd  %xmm1,0x20(%rsp)
movsd  0x8(%rsp),%xmm2
call   1030 <Util_in_range@plt>
test   %rax,%rax
je     1223 <bump+0x103>
movsd  0x28(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  0xe12(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <Util_in_range@plt>
test   %rax,%rax
je     1250 <bump+0x130>
movsd  0x8(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
jmp    1192 <bump+0x72>
xorps  %xmm0,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @bump(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
%8 = load double, double* %5
%9 = fdiv double %8, 2.000000e+00
%10 = fdiv double 1.000000e+00, %9
store double %10, double* %6
%11 = load double, double* %6
%12 = load double, double* %5
%13 = fdiv double %12, 2.000000e+00
%14 = call double @pow(double %13, i32 2)
%15 = fmul double %11, %14
%16 = fdiv double %15, 2.000000e+00
store double %16, double* %7
%17 = load double, double* %5
%18 = fdiv double %17, 4.000000e+00
%19 = load double, double* %4
%20 = call i64 @Util_in_range(double 0.000000e+00, double %18, double %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load double, double* %6
%24 = load double, double* %4
%25 = call double @pow(double %24, i32 2)
%26 = fmul double %23, %25
store double %26, double* %3
br label %62
27: ; preds = %2
%28 = load double, double* %5
%29 = fdiv double %28, 4.000000e+00
%30 = load double, double* %5
%31 = fmul double 3.000000e+00, %30
%32 = fdiv double %31, 4.000000e+00
%33 = load double, double* %4
%34 = call i64 @Util_in_range(double %29, double %32, double %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %46
36: ; preds = %27
%37 = load double, double* %6
%38 = fneg double %37
%39 = load double, double* %4
%40 = load double, double* %5
%41 = fdiv double %40, 2.000000e+00
%42 = fsub double %39, %41
%43 = call double @pow(double %42, i32 2)
%44 = load double, double* %7
%45 = call double @llvm.fmuladd.f64(double %38, double %43, double %44)
store double %45, double* %3
br label %62
46: ; preds = %27
%47 = load double, double* %5
%48 = fmul double 3.000000e+00, %47
%49 = fdiv double %48, 4.000000e+00
%50 = load double, double* %5
%51 = load double, double* %4
%52 = call i64 @Util_in_range(double %49, double %50, double %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %61
54: ; preds = %46
%55 = load double, double* %6
%56 = load double, double* %4
%57 = load double, double* %5
%58 = fsub double %56, %57
%59 = call double @pow(double %58, i32 2)
%60 = fmul double %55, %59
store double %60, double* %3
br label %62
61: ; preds = %46
store double 0.000000e+00, double* %3
br label %62
62: ; preds = %61, %54, %36, %22
%63 = load double, double* %3
ret double %63
}

LLVM IR (-O2):
define double @bump(double %0, double %1) {
%3 = fmul double %1, 5.000000e-01
%4 = fdiv double 1.000000e+00, %3
%5 = tail call double @pow(double %3, i32 2)
%6 = fmul double %4, %5
%7 = fmul double %6, 5.000000e-01
%8 = fmul double %1, 2.500000e-01
%9 = tail call i64 @Util_in_range(double 0.000000e+00, double %8, double %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = tail call double @pow(double %0, i32 2)
%13 = fmul double %4, %12
br label %31
14: ; preds = %2
%15 = fmul double %1, 3.000000e+00
%16 = fmul double %15, 2.500000e-01
%17 = tail call i64 @Util_in_range(double %8, double %16, double %0)
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %14
%20 = fneg double %4
%21 = fsub double %0, %3
%22 = tail call double @pow(double %21, i32 2)
%23 = tail call double @llvm.fmuladd.f64(double %20, double %22, double %7)
br label %31
24: ; preds = %14
%25 = tail call i64 @Util_in_range(double %16, double %1, double %0)
%26 = icmp eq i64 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = fsub double %0, %1
%29 = tail call double @pow(double %28, i32 2)
%30 = fmul double %4, %29
br label %31
31: ; preds = %24, %27, %19, %11
%32 = phi double [ %13, %11 ], [ %23, %19 ], [ %30, %27 ], [ 0.000000e+00, %24 ]
ret double %32
}