#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 cos(double);
void fftCosInit(long M, float *Utbl) {
  unsigned long fftN = ((unsigned long)1 << (M));
  unsigned long i1;
  Utbl[0] = 1.0;
  for (i1 = 1; i1 < fftN / 4; i1++)
    Utbl[i1] =
        cos((2.0 * 3.141592653589793238462643383279502884197 * i1) / fftN);
  Utbl[fftN / 4] = 0.0;
}


x86 assembly (clang, -O0):
<fftCosInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0xec4(%rip),%xmm0
movss  %xmm0,(%rax)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
shr    $0x2,%rcx
cmp    %rcx,%rax
jae    11cf <fftCosInit+0xbf>
movq   -0x20(%rbp),%xmm0
movaps 0xea7(%rip),%xmm3
punpckldq %xmm3,%xmm0
movapd 0xeab(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movq   -0x18(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1148 <fftCosInit+0x38>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
shr    $0x2,%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fftCosInit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %rdi,%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    $0x1,%ebx
movl   $0x3f800000,(%rsi)
mov    %rax,%r14
shr    $0x2,%r14
cmp    $0x3,%rdi
jb     1277 <fftCosInit+0x167>
movq   %rax,%xmm0
punpckldq 0xeab(%rip),%xmm0
subpd  0xeb3(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
cmp    $0x3,%r14
mov    $0x2,%r12d
cmovae %r14,%r12
add    $0xffffffffffffffff,%r12
cmp    $0x3,%rcx
je     1235 <fftCosInit+0x125>
mov    %r12,%r13
and    $0xfffffffffffffffe,%r13
mov    $0x1,%ebx
movapd %xmm1,(%rsp)
cs nopw 0x0(%rax,%rax,1)
movq   %rbx,%xmm1
movdqa 0xe53(%rip),%xmm0
punpckldq %xmm0,%xmm1
movapd 0xe57(%rip),%xmm0
subpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe4f(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  (%rsp),%xmm0
call   1030 <cos@plt>
movss  %xmm0,(%r15,%rbx,4)
lea    0x1(%rbx),%rbp
movq   %rbp,%xmm1
punpckldq 0xe0a(%rip),%xmm1
subpd  0xe12(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe0e(%rip),%xmm0
divsd  (%rsp),%xmm0
call   1030 <cos@plt>
movss  %xmm0,0x4(%r15,%rbx,4)
add    $0x2,%rbx
cmp    %r13,%rbp
jne    11a0 <fftCosInit+0x90>
movapd (%rsp),%xmm1
test   $0x1,%r12b
je     1277 <fftCosInit+0x167>
movapd %xmm1,%xmm2
movq   %rbx,%xmm1
punpckldq 0xdb4(%rip),%xmm1
subpd  0xdbc(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xdb8(%rip),%xmm0
divsd  %xmm2,%xmm0
call   1030 <cos@plt>
movss  %xmm0,(%r15,%rbx,4)
movl   $0x0,(%r15,%r14,4)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fftCosInit(i64 %0, float* %1) {
%3 = alloca i64
%4 = alloca float*
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store float* %1, float** %4
%7 = load i64, i64* %3
%8 = shl i64 1, %7
store i64 %8, i64* %5
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
store float 1.000000e+00, float* %10
store i64 1, i64* %6
br label %11
11: ; preds = %27, %2
%12 = load i64, i64* %6
%13 = load i64, i64* %5
%14 = udiv i64 %13, 4
%15 = icmp ult i64 %12, %14
br i1 %15, label %16, label %30
16: ; preds = %11
%17 = load i64, i64* %6
%18 = uitofp i64 %17 to double
%19 = fmul double 0x401921FB54442D18, %18
%20 = load i64, i64* %5
%21 = uitofp i64 %20 to double
%22 = fdiv double %19, %21
%23 = call float @cos(double %22)
%24 = load float*, float** %4
%25 = load i64, i64* %6
%26 = getelementptr inbounds float, float* %24, i64 %25
store float %23, float* %26
br label %27
27: ; preds = %16
%28 = load i64, i64* %6
%29 = add i64 %28, 1
store i64 %29, i64* %6
br label %11
30: ; preds = %11
%31 = load float*, float** %4
%32 = load i64, i64* %5
%33 = udiv i64 %32, 4
%34 = getelementptr inbounds float, float* %31, i64 %33
store float 0.000000e+00, float* %34
ret void
}

LLVM IR (-O2):
define void @fftCosInit(i64 %0, float* nocapture writeonly %1) {
%3 = shl nuw i64 1, %0
store float 1.000000e+00, float* %1
%4 = lshr i64 %3, 2
%5 = icmp ugt i64 %0, 2
br i1 %5, label %6, label %40
6: ; preds = %2
%7 = uitofp i64 %3 to double
%8 = call i64 @llvm.umax.i64(i64 %4, i64 2)
%9 = add nsw i64 %8, -1
%10 = and i64 %9, 1
%11 = icmp eq i64 %0, 3
br i1 %11, label %31, label %12
12: ; preds = %6
%13 = and i64 %9, -2
br label %14
14: ; preds = %14, %12
%15 = phi i64 [ 1, %12 ], [ %28, %14 ]
%16 = phi i64 [ 0, %12 ], [ %29, %14 ]
%17 = uitofp i64 %15 to double
%18 = fmul double %17, 0x401921FB54442D18
%19 = fdiv double %18, %7
%20 = tail call float @cos(double %19)
%21 = getelementptr inbounds float, float* %1, i64 %15
store float %20, float* %21
%22 = add nuw nsw i64 %15, 1
%23 = uitofp i64 %22 to double
%24 = fmul double %23, 0x401921FB54442D18
%25 = fdiv double %24, %7
%26 = tail call float @cos(double %25)
%27 = getelementptr inbounds float, float* %1, i64 %22
store float %26, float* %27
%28 = add nuw nsw i64 %15, 2
%29 = add i64 %16, 2
%30 = icmp eq i64 %29, %13
br i1 %30, label %31, label %14
31: ; preds = %14, %6
%32 = phi i64 [ 1, %6 ], [ %28, %14 ]
%33 = icmp eq i64 %10, 0
br i1 %33, label %40, label %34
34: ; preds = %31
%35 = uitofp i64 %32 to double
%36 = fmul double %35, 0x401921FB54442D18
%37 = fdiv double %36, %7
%38 = tail call float @cos(double %37)
%39 = getelementptr inbounds float, float* %1, i64 %32
store float %38, float* %39
br label %40
40: ; preds = %34, %31, %2
%41 = getelementptr inbounds float, float* %1, i64 %4
store float 0.000000e+00, float* %41
ret void
}