#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 cos(int);
void fe_create_hamming(double *in, int in_len) {
  int i;
  if (in_len > 1) {
#pragma novector
    for (i = 0; i < in_len; i++)
      in[i] = 0.54 - 0.46 * cos(2 * 3.1415926535897932385 * i /
                                ((double)in_len - 1.0));
  }
  return;
}


x86 assembly (clang, -O0):
<fe_create_hamming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    11a3 <fe_create_hamming+0x93>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119e <fe_create_hamming+0x8e>
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xecf(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xeb6(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movsd  0xe8d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe89(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <fe_create_hamming+0x20>
jmp    11a3 <fe_create_hamming+0x93>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fe_create_hamming>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%esi
jl     1213 <fe_create_hamming+0x103>
mov    %rdi,%r14
cvtsi2sd %esi,%xmm1
addsd  0xed0(%rip),%xmm1
mov    %esi,%r15d
mov    %r15d,%r12d
and    $0xfffffffe,%r12d
xor    %eax,%eax
movsd  %xmm1,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0xea6(%rip),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movsd  0xe95(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe91(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe65(%rip),%xmm0
divsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movsd  (%rsp),%xmm1
mulsd  0xe52(%rip),%xmm0
addsd  0xe52(%rip),%xmm0
movsd  %xmm0,0x8(%r14,%rbx,8)
lea    0x2(%rbx),%rax
cmp    %r12,%rax
jne    1150 <fe_create_hamming+0x40>
test   $0x1,%r15b
je     1213 <fe_create_hamming+0x103>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe19(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
mulsd  0xe0c(%rip),%xmm0
addsd  0xe0c(%rip),%xmm0
movsd  %xmm0,0x10(%r14,%rbx,8)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @fe_create_hamming(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %32
8: ; preds = %2
store i32 0, i32* %5
br label %9
9: ; preds = %28, %8
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to double
%16 = fmul double 0x401921FB54442D18, %15
%17 = load i32, i32* %4
%18 = sitofp i32 %17 to double
%19 = fsub double %18, 1.000000e+00
%20 = fdiv double %16, %19
%21 = fptosi double %20 to i32
%22 = call double @cos(i32 %21)
%23 = call double @llvm.fmuladd.f64(double -4.600000e-01, double %22, double 5.400000e-01)
%24 = load double*, double** %3
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %23, double* %27
br label %28
28: ; preds = %13
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %9
31: ; preds = %9
br label %32
32: ; preds = %31, %2
ret void
}

LLVM IR (-O2):
define void @fe_create_hamming(double* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %44
4: ; preds = %2
%5 = sitofp i32 %1 to double
%6 = fadd double %5, -1.000000e+00
%7 = zext i32 %1 to i64
%8 = and i64 %7, 1
%9 = and i64 %7, 4294967294
br label %10
10: ; preds = %10, %4
%11 = phi i64 [ 0, %4 ], [ %30, %10 ]
%12 = phi i64 [ 0, %4 ], [ %31, %10 ]
%13 = trunc i64 %11 to i32
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 0x401921FB54442D18
%16 = fdiv double %15, %6
%17 = fptosi double %16 to i32
%18 = tail call double @cos(i32 %17)
%19 = tail call double @llvm.fmuladd.f64(double %18, double -4.600000e-01, double 5.400000e-01)
%20 = getelementptr inbounds double, double* %0, i64 %11
store double %19, double* %20
%21 = or i64 %11, 1
%22 = trunc i64 %21 to i32
%23 = sitofp i32 %22 to double
%24 = fmul double %23, 0x401921FB54442D18
%25 = fdiv double %24, %6
%26 = fptosi double %25 to i32
%27 = tail call double @cos(i32 %26)
%28 = tail call double @llvm.fmuladd.f64(double %27, double -4.600000e-01, double 5.400000e-01)
%29 = getelementptr inbounds double, double* %0, i64 %21
store double %28, double* %29
%30 = add nuw nsw i64 %11, 2
%31 = add i64 %12, 2
%32 = icmp eq i64 %31, %9
br i1 %32, label %33, label %10
33: ; preds = %10
%34 = icmp eq i64 %8, 0
br i1 %34, label %44, label %35
35: ; preds = %33
%36 = trunc i64 %30 to i32
%37 = sitofp i32 %36 to double
%38 = fmul double %37, 0x401921FB54442D18
%39 = fdiv double %38, %6
%40 = fptosi double %39 to i32
%41 = tail call double @cos(i32 %40)
%42 = tail call double @llvm.fmuladd.f64(double %41, double -4.600000e-01, double 5.400000e-01)
%43 = getelementptr inbounds double, double* %0, i64 %30
store double %42, double* %43
br label %44
44: ; preds = %35, %33, %2
ret void
}