#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 */
float max(double, float);
float min(float, float);
float ieFilteredPulse(float edge0, float edge1, float x, float w) {
  float x0 = x - w / 2.0;
  float x1 = x + w;
  return max(0.0, (min(x1, edge1) - max(x0, edge0)) / w);
}


x86 assembly (clang, -O0):
<ieFilteredPulse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xeaa(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <min@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
call   1040 <max@plt>
movss  -0x1c(%rbp),%xmm1
subss  %xmm0,%xmm1
divss  -0x10(%rbp),%xmm1
xorps  %xmm0,%xmm0
call   1040 <max@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieFilteredPulse>:
sub    $0x18,%rsp
movss  %xmm3,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
cvtss2sd %xmm3,%xmm4
mulsd  0xebd(%rip),%xmm4
addsd  %xmm0,%xmm4
xorps  %xmm0,%xmm0
cvtsd2ss %xmm4,%xmm0
movss  %xmm0,0xc(%rsp)
addss  %xmm3,%xmm2
movaps %xmm2,%xmm0
call   1030 <min@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
call   1040 <max@plt>
movss  0x8(%rsp),%xmm1
subss  %xmm0,%xmm1
divss  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
add    $0x18,%rsp
jmp    1040 <max@plt>

LLVM IR (-O0):
define float @ieFilteredPulse(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%11 = load float, float* %7
%12 = fpext float %11 to double
%13 = load float, float* %8
%14 = fpext float %13 to double
%15 = fdiv double %14, 2.000000e+00
%16 = fsub double %12, %15
%17 = fptrunc double %16 to float
store float %17, float* %9
%18 = load float, float* %7
%19 = load float, float* %8
%20 = fadd float %18, %19
store float %20, float* %10
%21 = load float, float* %10
%22 = load float, float* %6
%23 = call float @min(float %21, float %22)
%24 = load float, float* %9
%25 = fpext float %24 to double
%26 = load float, float* %5
%27 = call float @max(double %25, float %26)
%28 = fsub float %23, %27
%29 = load float, float* %8
%30 = fdiv float %28, %29
%31 = call float @max(double 0.000000e+00, float %30)
ret float %31
}

LLVM IR (-O2):
define float @ieFilteredPulse(float %0, float %1, float %2, float %3) {
%5 = fpext float %2 to double
%6 = fpext float %3 to double
%7 = fmul double %6, 5.000000e-01
%8 = fsub double %5, %7
%9 = fptrunc double %8 to float
%10 = fadd float %2, %3
%11 = tail call float @min(float %10, float %1)
%12 = fpext float %9 to double
%13 = tail call float @max(double %12, float %0)
%14 = fsub float %11, %13
%15 = fdiv float %14, %3
%16 = tail call float @max(double 0.000000e+00, float %15)
ret float %16
}