#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 cos(double);
double fabs(double);
double raised_cosine_freq(double freq, double alpha) {
  freq = fabs(freq);
  freq -= 0.5 * (1 - alpha);
  if (freq <= 0)
    return 1;
  if (freq >= alpha)
    return 0;
  freq /= alpha;
  freq *= M_PI;
  return 0.5 * (1 + cos(freq));
}


x86 assembly (clang, -O0):
<raised_cosine_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xef2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec9(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xeaf(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     117e <raised_cosine_freq+0x6e>
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e5 <raised_cosine_freq+0xd5>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     119b <raised_cosine_freq+0x8b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e5 <raised_cosine_freq+0xd5>
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e33(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <cos@plt>
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe34(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raised_cosine_freq>:
push   %rax
movapd %xmm0,%xmm3
andpd  0xee3(%rip),%xmm3
movsd  0xeeb(%rip),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
mulsd  0xee3(%rip),%xmm0
addsd  %xmm3,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm0,%xmm3
jae    1173 <raised_cosine_freq+0x63>
ucomisd %xmm1,%xmm0
xorpd  %xmm2,%xmm2
jae    1173 <raised_cosine_freq+0x63>
divsd  %xmm1,%xmm0
mov    0x2e90(%rip),%rax
mulsd  (%rax),%xmm0
call   1030 <cos@plt>
add    $0x1,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
mulsd  0xead(%rip),%xmm2
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @raised_cosine_freq(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = call double @llvm.fabs.f64(double %6)
store double %7, double* %4
%8 = load double, double* %5
%9 = fsub double 1.000000e+00, %8
%10 = load double, double* %4
%11 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %9, double %10)
store double %11, double* %4
%12 = load double, double* %4
%13 = fcmp ole double %12, 0.000000e+00
br i1 %13, label %14, label %15
14: ; preds = %2
store double 1.000000e+00, double* %3
br label %32
15: ; preds = %2
%16 = load double, double* %4
%17 = load double, double* %5
%18 = fcmp oge double %16, %17
br i1 %18, label %19, label %20
19: ; preds = %15
store double 0.000000e+00, double* %3
br label %32
20: ; preds = %15
%21 = load double, double* %5
%22 = load double, double* %4
%23 = fdiv double %22, %21
store double %23, double* %4
%24 = load double, double* @M_PI
%25 = load double, double* %4
%26 = fmul double %25, %24
store double %26, double* %4
%27 = load double, double* %4
%28 = call i32 @cos(double %27)
%29 = add nsw i32 1, %28
%30 = sitofp i32 %29 to double
%31 = fmul double 5.000000e-01, %30
store double %31, double* %3
br label %32
32: ; preds = %20, %19, %14
%33 = load double, double* %3
ret double %33
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @raised_cosine_freq(double %0, double %1) {
%3 = tail call double @llvm.fabs.f64(double %0)
%4 = fsub double 1.000000e+00, %1
%5 = tail call double @llvm.fmuladd.f64(double %4, double -5.000000e-01, double %3)
%6 = fcmp ugt double %5, 0.000000e+00
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = fcmp ult double %5, %1
br i1 %8, label %9, label %17
9: ; preds = %7
%10 = fdiv double %5, %1
%11 = load double, double* @M_PI
%12 = fmul double %10, %11
%13 = tail call i32 @cos(double %12)
%14 = add nsw i32 %13, 1
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 5.000000e-01
br label %17
17: ; preds = %7, %2, %9
%18 = phi double [ %16, %9 ], [ 1.000000e+00, %2 ], [ 0.000000e+00, %7 ]
ret double %18
}