#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 */
scalar_t__ exp(double);
int /*<<< orphan*/ kaiser(float *, int, float);
double log(double);
float sin(double);
void designfir(float *g, float fc) {
  int i;
  float xi, omega, att, beta;
  float w[20 / 2];
  for (i = 0; i < 20 / 2; i++) {
    xi = (float)(i + 0.5);
    omega = (float)(3.14159265 * xi);
    g[i] = (float)(sin((double)omega * fc) / omega);
  }
  att = 40.;
  beta = (float)(exp(log((double)0.58417 * (att - 20.96)) * 0.4) +
                 0.07886 * (att - 20.96));
  kaiser(w, 20 / 2, beta);
  for (i = 0; i < 20 / 2; i++)
    g[i] = g[i] * w[i];
}


x86 assembly (clang, -O0):
<designfir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11d5 <designfir+0x95>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe93(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
divss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1158 <designfir+0x18>
movss  0xe53(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe15(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe19(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1060 <log@plt>
movsd  0xe00(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <exp@plt>
cvtsi2sd %rax,%xmm1
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdd9(%rip),%xmm2
subsd  %xmm2,%xmm0
movsd  0xdc5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
movss  -0x20(%rbp),%xmm0
mov    $0xa,%esi
call   1030 <kaiser@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    12a2 <designfir+0x162>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x10(%rbp),%rax
mulss  -0x50(%rbp,%rax,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1266 <designfir+0x126>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<designfir>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xeb6(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
divss  0xf05(%rip),%xmm0
movss  %xmm0,(%rbx)
movsd  0xea1(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xeea(%rip),%xmm0
movss  %xmm0,0x4(%rbx)
movsd  0xe89(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xece(%rip),%xmm0
movss  %xmm0,0x8(%rbx)
movsd  0xe71(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xeb2(%rip),%xmm0
movss  %xmm0,0xc(%rbx)
movsd  0xe59(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xe96(%rip),%xmm0
movss  %xmm0,0x10(%rbx)
movsd  0xe41(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xe7a(%rip),%xmm0
movss  %xmm0,0x14(%rbx)
movsd  0xe29(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xe5e(%rip),%xmm0
movss  %xmm0,0x18(%rbx)
movsd  0xe11(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xe42(%rip),%xmm0
movss  %xmm0,0x1c(%rbx)
movsd  0xdf9(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
divss  0xe26(%rip),%xmm0
movss  %xmm0,0x20(%rbx)
movsd  0x8(%rsp),%xmm0
mulsd  0xddb(%rip),%xmm0
call   1040 <sin@plt>
divss  0xe0a(%rip),%xmm0
movss  %xmm0,0x24(%rbx)
movsd  0xdc9(%rip),%xmm0
call   1050 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0xdbc(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0x10(%rsp),%rdi
mov    $0xa,%esi
call   1030 <kaiser@plt>
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm1
mulps  0x10(%rsp),%xmm0
movups %xmm0,(%rbx)
mulps  0x20(%rsp),%xmm1
movups %xmm1,0x10(%rbx)
movss  0x20(%rbx),%xmm0
mulss  0x30(%rsp),%xmm0
movss  %xmm0,0x20(%rbx)
movss  0x24(%rbx),%xmm0
mulss  0x34(%rsp),%xmm0
movss  %xmm0,0x24(%rbx)
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @designfir(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca [10 x float]
store float* %0, float** %3
store float %1, float* %4
store i32 0, i32* %5
br label %11
11: ; preds = %35, %2
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %38
14: ; preds = %11
%15 = load i32, i32* %5
%16 = sitofp i32 %15 to double
%17 = fadd double %16, 5.000000e-01
%18 = fptrunc double %17 to float
store float %18, float* %6
%19 = load float, float* %6
%20 = fpext float %19 to double
%21 = fmul double 0x400921FB53C8D4F1, %20
%22 = fptrunc double %21 to float
store float %22, float* %7
%23 = load float, float* %7
%24 = fpext float %23 to double
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = fmul double %24, %26
%28 = call float @sin(double %27)
%29 = load float, float* %7
%30 = fdiv float %28, %29
%31 = load float*, float** %3
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds float, float* %31, i64 %33
store float %30, float* %34
br label %35
35: ; preds = %14
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %11
38: ; preds = %11
store float 4.000000e+01, float* %8
%39 = load float, float* %8
%40 = fpext float %39 to double
%41 = fsub double %40, 2.096000e+01
%42 = fmul double 5.841700e-01, %41
%43 = call double @log(double %42)
%44 = fmul double %43, 4.000000e-01
%45 = call i64 @exp(double %44)
%46 = sitofp i64 %45 to double
%47 = load float, float* %8
%48 = fpext float %47 to double
%49 = fsub double %48, 2.096000e+01
%50 = call double @llvm.fmuladd.f64(double 0x3FB4302B40F66A55, double %49, double %46)
%51 = fptrunc double %50 to float
store float %51, float* %9
%52 = getelementptr inbounds [10 x float], [10 x float]* %10, i64 0, i64 0
%53 = load float, float* %9
%54 = call i32 @kaiser(float* %52, i32 10, float %53)
store i32 0, i32* %5
br label %55
55: ; preds = %73, %38
%56 = load i32, i32* %5
%57 = icmp slt i32 %56, 10
br i1 %57, label %58, label %76
58: ; preds = %55
%59 = load float*, float** %3
%60 = load i32, i32* %5
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %59, i64 %61
%63 = load float, float* %62
%64 = load i32, i32* %5
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [10 x float], [10 x float]* %10, i64 0, i64 %65
%67 = load float, float* %66
%68 = fmul float %63, %67
%69 = load float*, float** %3
%70 = load i32, i32* %5
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds float, float* %69, i64 %71
store float %68, float* %72
br label %73
73: ; preds = %58
%74 = load i32, i32* %5
%75 = add nsw i32 %74, 1
store i32 %75, i32* %5
br label %55
76: ; preds = %55
ret void
}

LLVM IR (-O2):
define void @designfir(float* nocapture %0, float %1) {
%3 = alloca [10 x float]
%4 = bitcast [10 x float]* %3 to i8*
%5 = fpext float %1 to double
%6 = fmul double %5, 0x3FF921FB60000000
%7 = tail call float @sin(double %6)
%8 = fdiv float %7, 0x3FF921FB60000000
store float %8, float* %0
%9 = fmul double %5, 0x4012D97C80000000
%10 = tail call float @sin(double %9)
%11 = fdiv float %10, 0x4012D97C80000000
%12 = getelementptr inbounds float, float* %0, i64 1
store float %11, float* %12
%13 = fmul double %5, 0x401F6A7A20000000
%14 = tail call float @sin(double %13)
%15 = fdiv float %14, 0x401F6A7A20000000
%16 = getelementptr inbounds float, float* %0, i64 2
store float %15, float* %16
%17 = fmul double %5, 0x4025FDBBE0000000
%18 = tail call float @sin(double %17)
%19 = fdiv float %18, 0x4025FDBBE0000000
%20 = getelementptr inbounds float, float* %0, i64 3
store float %19, float* %20
%21 = fmul double %5, 0x402C463AC0000000
%22 = tail call float @sin(double %21)
%23 = fdiv float %22, 0x402C463AC0000000
%24 = getelementptr inbounds float, float* %0, i64 4
store float %23, float* %24
%25 = fmul double %5, 0x4031475CC0000000
%26 = tail call float @sin(double %25)
%27 = fdiv float %26, 0x4031475CC0000000
%28 = getelementptr inbounds float, float* %0, i64 5
store float %27, float* %28
%29 = fmul double %5, 0x40346B9C40000000
%30 = tail call float @sin(double %29)
%31 = fdiv float %30, 0x40346B9C40000000
%32 = getelementptr inbounds float, float* %0, i64 6
store float %31, float* %32
%33 = fmul double %5, 0x40378FDBA0000000
%34 = tail call float @sin(double %33)
%35 = fdiv float %34, 0x40378FDBA0000000
%36 = getelementptr inbounds float, float* %0, i64 7
store float %35, float* %36
%37 = fmul double %5, 0x403AB41B00000000
%38 = tail call float @sin(double %37)
%39 = fdiv float %38, 0x403AB41B00000000
%40 = getelementptr inbounds float, float* %0, i64 8
store float %39, float* %40
%41 = fmul double %5, 0x403DD85A80000000
%42 = tail call float @sin(double %41)
%43 = fdiv float %42, 0x403DD85A80000000
%44 = getelementptr inbounds float, float* %0, i64 9
store float %43, float* %44
%45 = tail call i64 @exp(double 0x3FEED5BDDF4A4AB4)
%46 = sitofp i64 %45 to double
%47 = fadd double %46, 0x3FF8061EFDF208C6
%48 = fptrunc double %47 to float
%49 = getelementptr inbounds [10 x float], [10 x float]* %3, i64 0, i64 0
%50 = call i32 @kaiser(float* %49, i32 10, float %48)
%51 = bitcast float* %0 to <4 x float>*
%52 = load <4 x float>, <4 x float>* %51
%53 = bitcast [10 x float]* %3 to <4 x float>*
%54 = load <4 x float>, <4 x float>* %53
%55 = fmul <4 x float> %52, %54
%56 = bitcast float* %0 to <4 x float>*
store <4 x float> %55, <4 x float>* %56
%57 = getelementptr inbounds [10 x float], [10 x float]* %3, i64 0, i64 4
%58 = bitcast float* %24 to <4 x float>*
%59 = load <4 x float>, <4 x float>* %58
%60 = bitcast float* %57 to <4 x float>*
%61 = load <4 x float>, <4 x float>* %60
%62 = fmul <4 x float> %59, %61
%63 = bitcast float* %24 to <4 x float>*
store <4 x float> %62, <4 x float>* %63
%64 = load float, float* %40
%65 = getelementptr inbounds [10 x float], [10 x float]* %3, i64 0, i64 8
%66 = load float, float* %65
%67 = fmul float %64, %66
store float %67, float* %40
%68 = load float, float* %44
%69 = getelementptr inbounds [10 x float], [10 x float]* %3, i64 0, i64 9
%70 = load float, float* %69
%71 = fmul float %68, %70
store float %71, float* %44
ret void
}