#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 */
double M_PI;
int /*<<< orphan*/ assert(int);
double cos(double);
double wdw_Blackman(int i, int m) {
  assert(i < m);
  return (0.42 - (0.50 * cos(2.0 * M_PI * ((double)i / (double)(m - 1)))) +
          (0.08 * cos(4.0 * M_PI * ((double)i / (double)(m - 1)))));
}


x86 assembly (clang, -O0):
<wdw_Blackman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0xed7(%rip),%xmm0
mov    0x2e98(%rip),%rax
mulsd  (%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0xe98(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe94(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe73(%rip),%xmm0
mov    0x2e4c(%rip),%rax
mulsd  (%rax),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0xe37(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdw_Blackman>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    %esi,%ebp
setl   %dil
call   1030 <assert@plt>
mov    0x2ea8(%rip),%r14
movsd  (%r14),%xmm0
addsd  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm2
add    $0xffffffff,%ebx
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm2,%xmm0
call   1040 <cos@plt>
mulsd  0xe91(%rip),%xmm0
addsd  0xe91(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%r14),%xmm0
mulsd  0xe87(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0xe7c(%rip),%xmm0
addsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @wdw_Blackman(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load double, double* @M_PI
%11 = fmul double 2.000000e+00, %10
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to double
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = sitofp i32 %15 to double
%17 = fdiv double %13, %16
%18 = fmul double %11, %17
%19 = call double @cos(double %18)
%20 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %19, double 4.200000e-01)
%21 = load double, double* @M_PI
%22 = fmul double 4.000000e+00, %21
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to double
%25 = load i32, i32* %4
%26 = sub nsw i32 %25, 1
%27 = sitofp i32 %26 to double
%28 = fdiv double %24, %27
%29 = fmul double %22, %28
%30 = call double @cos(double %29)
%31 = call double @llvm.fmuladd.f64(double 8.000000e-02, double %30, double %20)
ret double %31
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @wdw_Blackman(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = load double, double* @M_PI
%7 = fmul double %6, 2.000000e+00
%8 = sitofp i32 %0 to double
%9 = add nsw i32 %1, -1
%10 = sitofp i32 %9 to double
%11 = fdiv double %8, %10
%12 = fmul double %11, %7
%13 = tail call double @cos(double %12)
%14 = tail call double @llvm.fmuladd.f64(double %13, double -5.000000e-01, double 4.200000e-01)
%15 = load double, double* @M_PI
%16 = fmul double %15, 4.000000e+00
%17 = fmul double %11, %16
%18 = tail call double @cos(double %17)
%19 = tail call double @llvm.fmuladd.f64(double %18, double 8.000000e-02, double %14)
ret double %19
}