#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(double);
void fe_create_hamming(double *in, int in_len) {
  int i;
  double tmp;
  {
    if (in_len > 1) {
      i = 0;
      while (i < in_len) {
        tmp = cos((((double)2 * 3.14159265358979323846) * (double)i) /
                  ((double)in_len - 1.0));
        *(in + i) = 0.54 - 0.46 * tmp;
        i++;
      }
    }
    return;
  }
}


x86 assembly (clang, -O0):
<fe_create_hamming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    11a9 <fe_create_hamming+0x99>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a4 <fe_create_hamming+0x94>
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
call   1030 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe87(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe83(%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    11a9 <fe_create_hamming+0x99>
add    $0x20,%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     1203 <fe_create_hamming+0xf3>
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
call   1030 <cos@plt>
movsd  0xe99(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe95(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe69(%rip),%xmm0
divsd  (%rsp),%xmm0
call   1030 <cos@plt>
movsd  (%rsp),%xmm1
mulsd  0xe5a(%rip),%xmm0
addsd  0xe5a(%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     1203 <fe_create_hamming+0xf3>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe25(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0xe1c(%rip),%xmm0
addsd  0xe1c(%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
%6 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %32
9: ; preds = %2
store i32 0, i32* %5
br label %10
10: ; preds = %14, %9
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %31
14: ; preds = %10
%15 = load i32, i32* %5
%16 = sitofp i32 %15 to double
%17 = fmul double 0x401921FB54442D18, %16
%18 = load i32, i32* %4
%19 = sitofp i32 %18 to double
%20 = fsub double %19, 1.000000e+00
%21 = fdiv double %17, %20
%22 = call double @cos(double %21)
store double %22, double* %6
%23 = load double, double* %6
%24 = call double @llvm.fmuladd.f64(double -4.600000e-01, double %23, double 5.400000e-01)
%25 = load double*, double** %3
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %25, i64 %27
store double %24, double* %28
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %10
31: ; preds = %10
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 %41
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 ], [ %28, %10 ]
%12 = phi i64 [ 0, %4 ], [ %29, %10 ]
%13 = trunc i64 %11 to i32
%14 = sitofp i32 %13 to double
%15 = fmul double %14, 0x401921FB54442D18
%16 = fdiv double %15, %6
%17 = tail call double @cos(double %16)
%18 = tail call double @llvm.fmuladd.f64(double %17, double -4.600000e-01, double 5.400000e-01)
%19 = getelementptr inbounds double, double* %0, i64 %11
store double %18, double* %19
%20 = or i64 %11, 1
%21 = trunc i64 %20 to i32
%22 = sitofp i32 %21 to double
%23 = fmul double %22, 0x401921FB54442D18
%24 = fdiv double %23, %6
%25 = tail call double @cos(double %24)
%26 = tail call double @llvm.fmuladd.f64(double %25, double -4.600000e-01, double 5.400000e-01)
%27 = getelementptr inbounds double, double* %0, i64 %20
store double %26, double* %27
%28 = add nuw nsw i64 %11, 2
%29 = add i64 %12, 2
%30 = icmp eq i64 %29, %9
br i1 %30, label %31, label %10
31: ; preds = %10
%32 = icmp eq i64 %8, 0
br i1 %32, label %41, label %33
33: ; preds = %31
%34 = trunc i64 %28 to i32
%35 = sitofp i32 %34 to double
%36 = fmul double %35, 0x401921FB54442D18
%37 = fdiv double %36, %6
%38 = tail call double @cos(double %37)
%39 = tail call double @llvm.fmuladd.f64(double %38, double -4.600000e-01, double 5.400000e-01)
%40 = getelementptr inbounds double, double* %0, i64 %28
store double %39, double* %40
br label %41
41: ; preds = %33, %31, %2
ret void
}