#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 cos(double);
float TukeyWindow(float window_duration, float transition, float t) {
  if (!(0.0f <= t && t <= window_duration)) {
    return 0.0f;
  } else if (t > window_duration - transition) {
    t = window_duration - t;
  } else if (t >= transition) {
    return 1.0f;
  }
  return (1 - cos(3.14159265358979324 * t / transition)) / 2;
}


x86 assembly (clang, -O0):
<TukeyWindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     114b <TukeyWindow+0x3b>
movss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jae    1158 <TukeyWindow+0x48>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f0 <TukeyWindow+0xe0>
movss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    1184 <TukeyWindow+0x74>
movss  -0x8(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11aa <TukeyWindow+0x9a>
movss  -0x10(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     11a5 <TukeyWindow+0x95>
movss  0xe65(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f0 <TukeyWindow+0xe0>
jmp    11aa <TukeyWindow+0x9a>
jmp    11af <TukeyWindow+0x9f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe48(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TukeyWindow>:
push   %rax
xorps  %xmm3,%xmm3
ucomiss %xmm3,%xmm2
jb     1175 <TukeyWindow+0x65>
ucomiss %xmm2,%xmm0
jb     1175 <TukeyWindow+0x65>
movaps %xmm0,%xmm3
subss  %xmm1,%xmm3
ucomiss %xmm3,%xmm2
jbe    1133 <TukeyWindow+0x23>
subss  %xmm2,%xmm0
movaps %xmm0,%xmm2
jmp    1138 <TukeyWindow+0x28>
ucomiss %xmm1,%xmm2
jae    116d <TukeyWindow+0x5d>
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  0xec1(%rip),%xmm0
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
xorps  %xmm3,%xmm3
cvtsi2ss %eax,%xmm3
jmp    1175 <TukeyWindow+0x65>
movss  0xe8b(%rip),%xmm3
movaps %xmm3,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define float @TukeyWindow(float %0, float %1, float %2) {
%4 = fcmp ult float %2, 0.000000e+00
%5 = fcmp ugt float %2, %0
%6 = or i1 %4, %5
br i1 %6, label %24, label %7
7: ; preds = %3
%8 = fsub float %0, %1
%9 = fcmp olt float %8, %2
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = fsub float %0, %2
br label %14
12: ; preds = %7
%13 = fcmp ult float %2, %1
br i1 %13, label %14, label %24
14: ; preds = %10, %12
%15 = phi float [ %11, %10 ], [ %2, %12 ]
%16 = fpext float %15 to double
%17 = fmul double %16, 0x400921FB54442D18
%18 = fpext float %1 to double
%19 = fdiv double %17, %18
%20 = tail call i32 @cos(double %19)
%21 = sub nsw i32 1, %20
%22 = sdiv i32 %21, 2
%23 = sitofp i32 %22 to float
br label %24
24: ; preds = %12, %3, %14
%25 = phi float [ %23, %14 ], [ 0.000000e+00, %3 ], [ 1.000000e+00, %12 ]
ret float %25
}