#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 / 2.0;
  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
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe7f(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%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,0x14(%rsp)
cvtss2sd %xmm3,%xmm5
mulsd  0xeca(%rip),%xmm5
cvtss2sd %xmm2,%xmm2
movaps %xmm2,%xmm4
subsd  %xmm5,%xmm4
xorps  %xmm3,%xmm3
cvtsd2ss %xmm4,%xmm3
movss  %xmm3,0xc(%rsp)
movss  %xmm0,0x10(%rsp)
addsd  %xmm2,%xmm5
xorps  %xmm0,%xmm0
cvtsd2ss %xmm5,%xmm0
call   1030 <min@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
call   1040 <max@plt>
movss  0x8(%rsp),%xmm1
subss  %xmm0,%xmm1
divss  0x14(%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 = fpext float %18 to double
%20 = load float, float* %8
%21 = fpext float %20 to double
%22 = fdiv double %21, 2.000000e+00
%23 = fadd double %19, %22
%24 = fptrunc double %23 to float
store float %24, float* %10
%25 = load float, float* %10
%26 = load float, float* %6
%27 = call float @min(float %25, float %26)
%28 = load float, float* %9
%29 = fpext float %28 to double
%30 = load float, float* %5
%31 = call float @max(double %29, float %30)
%32 = fsub float %27, %31
%33 = load float, float* %8
%34 = fdiv float %32, %33
%35 = call float @max(double 0.000000e+00, float %34)
ret float %35
}

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 double %7, %5
%11 = fptrunc double %10 to float
%12 = tail call float @min(float %11, float %1)
%13 = fpext float %9 to double
%14 = tail call float @max(double %13, float %0)
%15 = fsub float %12, %14
%16 = fdiv float %15, %3
%17 = tail call float @max(double 0.000000e+00, float %16)
ret float %17
}