#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 pow(int /*<<< orphan*/, int);
int /*<<< orphan*/ sin(double);
float *twiddles_step_32(double, float *, int);
float *twiddles_step_64(double two_pi, float *out, double theta) {
  int i;
  for (i = 0; i < 32; i++) {
    *out++ = (2 * pow(sin((theta) / 2), 2));
    *out++ = (sin(theta));
  }
  return twiddles_step_32(two_pi, out, 2 * theta);
}


x86 assembly (clang, -O0):
<twiddles_step_64>:
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   $0x20,-0x1c(%rbp)
jge    11c2 <twiddles_step_64+0x92>
movsd  -0x18(%rbp),%xmm0
movsd  0xe9c(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
call   1040 <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_step_64+0x1d>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
movsd  0xe2d(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
cvttsd2si %xmm1,%esi
call   1030 <twiddles_step_32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<twiddles_step_64>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movsd  %xmm0,0x10(%rsp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm1,(%rsp)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%r14,%rbx,1)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%r14,%rbx,1)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%r14,%rbx,1)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%r14,%rbx,1)
add    $0x10,%rbx
cmp    $0x100,%ebx
jne    1160 <twiddles_step_64+0x30>
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%esi
add    %rbx,%r14
movsd  0x10(%rsp),%xmm0
mov    %r14,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1030 <twiddles_step_32@plt>

LLVM IR (-O0):
define float* @twiddles_step_64(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 = %25, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 32
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = load double, double* %6
%13 = fdiv double %12, 2.000000e+00
%14 = call i32 @sin(double %13)
%15 = call i32 @pow(i32 %14, i32 2)
%16 = mul nsw i32 2, %15
%17 = sitofp i32 %16 to float
%18 = load float*, float** %5
%19 = getelementptr inbounds float, float* %18, i32 1
store float* %19, float** %5
store float %17, float* %18
%20 = load double, double* %6
%21 = call i32 @sin(double %20)
%22 = sitofp i32 %21 to float
%23 = load float*, float** %5
%24 = getelementptr inbounds float, float* %23, i32 1
store float* %24, float** %5
store float %22, float* %23
br label %25
25: ; preds = %11
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %8
28: ; preds = %8
%29 = load double, double* %4
%30 = load float*, float** %5
%31 = load double, double* %6
%32 = fmul double 2.000000e+00, %31
%33 = fptosi double %32 to i32
%34 = call float* @twiddles_step_32(double %29, float* %30, i32 %33)
ret float* %34
}

LLVM IR (-O2):
define float* @twiddles_step_64(double %0, float* %1, double %2) {
%4 = fmul double %2, 5.000000e-01
br label %5
5: ; preds = %5, %3
%6 = phi i32 [ 0, %3 ], [ %24, %5 ]
%7 = phi float* [ %1, %3 ], [ %23, %5 ]
%8 = tail call i32 @sin(double %4)
%9 = tail call i32 @pow(i32 %8, i32 2)
%10 = shl nsw i32 %9, 1
%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 %2)
%14 = sitofp i32 %13 to float
%15 = getelementptr inbounds float, float* %7, i64 2
store float %14, float* %12
%16 = tail call i32 @sin(double %4)
%17 = tail call i32 @pow(i32 %16, i32 2)
%18 = shl nsw i32 %17, 1
%19 = sitofp i32 %18 to float
%20 = getelementptr inbounds float, float* %7, i64 3
store float %19, float* %15
%21 = tail call i32 @sin(double %2)
%22 = sitofp i32 %21 to float
%23 = getelementptr inbounds float, float* %7, i64 4
store float %22, float* %20
%24 = add nuw nsw i32 %6, 2
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %5
26: ; preds = %5
%27 = fmul double %2, 2.000000e+00
%28 = fptosi double %27 to i32
%29 = tail call float* @twiddles_step_32(double %0, float* %23, i32 %28)
ret float* %29
}