#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 */
int /*<<< orphan*/ cos(double);
int /*<<< orphan*/ sin(double);
float *twiddles_base_32(double, float *, int /*<<< orphan*/);
float *twiddles_base_64(double two_pi, float *out) {
  int i;
  for (i = 0; i < 32; i++) {
    *out++ = cos(two_pi / 64 * i);
    *out++ = sin(two_pi / 64 * i);
  }
  return twiddles_base_32(two_pi, out, 0);
}


x86 assembly (clang, -O0):
<twiddles_base_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    11cc <twiddles_base_64+0x9c>
movsd  -0x8(%rbp),%xmm0
movsd  0xea1(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  0xe6b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  %xmm0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1148 <twiddles_base_64+0x18>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1050 <twiddles_base_32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<twiddles_base_64>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
movsd  0xebf(%rip),%xmm1
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
xorpd  %xmm1,%xmm1
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%rbx)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%rbx)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rbx)
movsd  0x20(%rsp),%xmm1
add    $0x10,%rbx
addsd  0xe1e(%rip),%xmm1
add    $0x2,%ebp
cmp    $0x21,%ebp
jne    1160 <twiddles_base_64+0x30>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <twiddles_base_32@plt>

LLVM IR (-O0):
define float* @twiddles_base_64(double %0, float* %1) {
%3 = alloca double
%4 = alloca float*
%5 = alloca i32
store double %0, double* %3
store float* %1, float** %4
store i32 0, i32* %5
br label %6
6: ; preds = %28, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 32
br i1 %8, label %9, label %31
9: ; preds = %6
%10 = load double, double* %3
%11 = fdiv double %10, 6.400000e+01
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to double
%14 = fmul double %11, %13
%15 = call i32 @cos(double %14)
%16 = sitofp i32 %15 to float
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i32 1
store float* %18, float** %4
store float %16, float* %17
%19 = load double, double* %3
%20 = fdiv double %19, 6.400000e+01
%21 = load i32, i32* %5
%22 = sitofp i32 %21 to double
%23 = fmul double %20, %22
%24 = call i32 @sin(double %23)
%25 = sitofp i32 %24 to float
%26 = load float*, float** %4
%27 = getelementptr inbounds float, float* %26, i32 1
store float* %27, float** %4
store float %25, float* %26
br label %28
28: ; preds = %9
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %6
31: ; preds = %6
%32 = load double, double* %3
%33 = load float*, float** %4
%34 = call float* @twiddles_base_32(double %32, float* %33, i32 0)
ret float* %34
}

LLVM IR (-O2):
define float* @twiddles_base_64(double %0, float* %1) {
%3 = fmul double %0, 1.562500e-02
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ 0, %2 ], [ %24, %4 ]
%6 = phi float* [ %1, %2 ], [ %23, %4 ]
%7 = sitofp i32 %5 to double
%8 = fmul double %3, %7
%9 = tail call i32 @cos(double %8)
%10 = sitofp i32 %9 to float
%11 = getelementptr inbounds float, float* %6, i64 1
store float %10, float* %6
%12 = tail call i32 @sin(double %8)
%13 = sitofp i32 %12 to float
%14 = getelementptr inbounds float, float* %6, i64 2
store float %13, float* %11
%15 = or i32 %5, 1
%16 = sitofp i32 %15 to double
%17 = fmul double %3, %16
%18 = tail call i32 @cos(double %17)
%19 = sitofp i32 %18 to float
%20 = getelementptr inbounds float, float* %6, i64 3
store float %19, float* %14
%21 = tail call i32 @sin(double %17)
%22 = sitofp i32 %21 to float
%23 = getelementptr inbounds float, float* %6, i64 4
store float %22, float* %20
%24 = add nuw nsw i32 %5, 2
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %4
26: ; preds = %4
%27 = tail call float* @twiddles_base_32(double %0, float* %23, i32 0)
ret float* %27
}