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


x86 assembly (clang, -O0):
<twiddles_base_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x10,-0x1c(%rbp)
jge    11e3 <twiddles_base_32+0xb3>
movsd  -0x8(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <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  0xe65(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %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    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114d <twiddles_base_32+0x1d>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
movsd  0xe0c(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
cvttsd2si %xmm1,%esi
call   1040 <twiddles_base_16@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<twiddles_base_32>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x8(%rsp)
mov    %rdi,%rbx
movsd  0xeb9(%rip),%xmm1
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
xorpd  %xmm1,%xmm1
mov    $0x1,%ebp
movsd  %xmm1,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
call   1050 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rbx)
movsd  (%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
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
call   1050 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%rbx)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rbx)
movsd  0x20(%rsp),%xmm1
add    $0x10,%rbx
addsd  0xe16(%rip),%xmm1
add    $0x2,%ebp
cmp    $0x11,%ebp
jne    1160 <twiddles_base_32+0x30>
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%esi
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <twiddles_base_16@plt>

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

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