#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 */
size_t atanf(float);
int /*<<< orphan*/ bitrv2(size_t, size_t *, float *);
scalar_t__ cos(float);
scalar_t__ sin(float);
void makewt(size_t nw, size_t *ip, float *w) {
  size_t j, nwh;
  float delta, x, y;
  ip[0] = nw;
  ip[1] = 1;
  if (nw > 2) {
    nwh = nw >> 1;
    delta = atanf(1.0f) / nwh;
    w[0] = 1;
    w[1] = 0;
    w[nwh] = (float)cos(delta * nwh);
    w[nwh + 1] = w[nwh];
    if (nwh > 2) {
      for (j = 2; j < nwh; j += 2) {
        x = (float)cos(delta * j);
        y = (float)sin(delta * j);
        w[j] = x;
        w[j + 1] = y;
        w[nw - j] = y;
        w[nw - j + 1] = x;
      }
      bitrv2(nw, ip + 2, w);
    }
  }
}


x86 assembly (clang, -O0):
<makewt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x1,0x8(%rax)
cmpq   $0x2,-0x8(%rbp)
jbe    13dc <makewt+0x29c>
mov    -0x8(%rbp),%rax
shr    %rax
mov    %rax,-0x28(%rbp)
movss  0xe77(%rip),%xmm0
call   1030 <atanf@plt>
mov    -0x28(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x3c(%rbp)
test   %rax,%rax
movss  %xmm0,-0x38(%rbp)
js     11d0 <makewt+0x90>
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x3f800000,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0x4(%rax)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x44(%rbp)
test   %rax,%rax
movss  %xmm0,-0x40(%rbp)
js     1236 <makewt+0xf6>
movss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x48(%rbp),%xmm0
movss  -0x40(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1060 <cos@plt>
cvtsi2ss %rax,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movss  %xmm0,0x4(%rax,%rcx,4)
cmpq   $0x2,-0x28(%rbp)
jbe    13d7 <makewt+0x297>
movq   $0x2,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    13c2 <makewt+0x282>
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x50(%rbp)
test   %rax,%rax
movss  %xmm0,-0x4c(%rbp)
js     12de <makewt+0x19e>
movss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x54(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1060 <cos@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x5c(%rbp)
test   %rax,%rax
movss  %xmm0,-0x58(%rbp)
js     1342 <makewt+0x202>
movss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x60(%rbp),%xmm0
movss  -0x58(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1040 <sin@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x34(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movss  %xmm0,0x4(%rax,%rcx,4)
movss  -0x34(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    -0x20(%rbp),%rcx
movss  %xmm0,0x4(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    1289 <makewt+0x149>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
mov    -0x18(%rbp),%rdx
call   1050 <bitrv2@plt>
jmp    13dc <makewt+0x29c>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makewt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,(%rsi)
movq   $0x1,0x8(%rsi)
cmp    $0x3,%rdi
jb     129c <makewt+0x15c>
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdi,%r12
shr    %r12
movss  0xe86(%rip),%xmm0
call   1030 <atanf@plt>
mov    %rax,%rcx
or     %r12,%rcx
shr    $0x20,%rcx
je     119c <makewt+0x5c>
xor    %edx,%edx
div    %r12
test   %rax,%rax
js     11a6 <makewt+0x66>
cvtsi2ss %rax,%xmm1
jmp    11bb <makewt+0x7b>
xor    %edx,%edx
div    %r12d
test   %rax,%rax
jns    1195 <makewt+0x55>
mov    %rax,%rcx
shr    %rcx
and    $0x1,%eax
or     %rcx,%rax
cvtsi2ss %rax,%xmm1
addss  %xmm1,%xmm1
movss  %xmm1,0xc(%rsp)
movq   $0x3f800000,0x0(%r13)
3f
xorps  %xmm0,%xmm0
cvtsi2ss %r12,%xmm0
mulss  %xmm1,%xmm0
call   1060 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x0(%r13,%r12,4)
movss  %xmm0,0x4(%r13,%r12,4)
cmp    $0x6,%r15
jb     129c <makewt+0x15c>
lea    -0x4(,%r15,4),%rbx
ff
add    %r13,%rbx
mov    $0x2,%ebp
jmp    1278 <makewt+0x138>
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %rbp,%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
call   1060 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  0x14(%rsp),%xmm1
movss  %xmm1,0x0(%r13,%rbp,4)
movss  %xmm0,0x4(%r13,%rbp,4)
movss  %xmm0,-0x4(%rbx)
movss  %xmm1,(%rbx)
add    $0x2,%rbp
add    $0xfffffffffffffff8,%rbx
cmp    %r12,%rbp
jae    12ab <makewt+0x16b>
test   %rbp,%rbp
jns    1210 <makewt+0xd0>
mov    %rbp,%rax
shr    %rax
mov    %ebp,%ecx
and    $0x1,%ecx
or     %rax,%rcx
xorps  %xmm0,%xmm0
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
jmp    1218 <makewt+0xd8>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x10,%r14
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <bitrv2@plt>

LLVM IR (-O0):
define void @makewt(i64 %0, i64* %1, float* %2) {
%4 = alloca i64
%5 = alloca i64*
%6 = alloca float*
%7 = alloca i64
%8 = alloca i64
%9 = alloca float
%10 = alloca float
%11 = alloca float
store i64 %0, i64* %4
store i64* %1, i64** %5
store float* %2, float** %6
%12 = load i64, i64* %4
%13 = load i64*, i64** %5
%14 = getelementptr inbounds i64, i64* %13, i64 0
store i64 %12, i64* %14
%15 = load i64*, i64** %5
%16 = getelementptr inbounds i64, i64* %15, i64 1
store i64 1, i64* %16
%17 = load i64, i64* %4
%18 = icmp ugt i64 %17, 2
br i1 %18, label %19, label %99
19: ; preds = %3
%20 = load i64, i64* %4
%21 = lshr i64 %20, 1
store i64 %21, i64* %8
%22 = call i64 @atanf(float 1.000000e+00)
%23 = load i64, i64* %8
%24 = udiv i64 %22, %23
%25 = uitofp i64 %24 to float
store float %25, float* %9
%26 = load float*, float** %6
%27 = getelementptr inbounds float, float* %26, i64 0
store float 1.000000e+00, float* %27
%28 = load float*, float** %6
%29 = getelementptr inbounds float, float* %28, i64 1
store float 0.000000e+00, float* %29
%30 = load float, float* %9
%31 = load i64, i64* %8
%32 = uitofp i64 %31 to float
%33 = fmul float %30, %32
%34 = call i64 @cos(float %33)
%35 = sitofp i64 %34 to float
%36 = load float*, float** %6
%37 = load i64, i64* %8
%38 = getelementptr inbounds float, float* %36, i64 %37
store float %35, float* %38
%39 = load float*, float** %6
%40 = load i64, i64* %8
%41 = getelementptr inbounds float, float* %39, i64 %40
%42 = load float, float* %41
%43 = load float*, float** %6
%44 = load i64, i64* %8
%45 = add i64 %44, 1
%46 = getelementptr inbounds float, float* %43, i64 %45
store float %42, float* %46
%47 = load i64, i64* %8
%48 = icmp ugt i64 %47, 2
br i1 %48, label %49, label %98
49: ; preds = %19
store i64 2, i64* %7
br label %50
50: ; preds = %89, %49
%51 = load i64, i64* %7
%52 = load i64, i64* %8
%53 = icmp ult i64 %51, %52
br i1 %53, label %54, label %92
54: ; preds = %50
%55 = load float, float* %9
%56 = load i64, i64* %7
%57 = uitofp i64 %56 to float
%58 = fmul float %55, %57
%59 = call i64 @cos(float %58)
%60 = sitofp i64 %59 to float
store float %60, float* %10
%61 = load float, float* %9
%62 = load i64, i64* %7
%63 = uitofp i64 %62 to float
%64 = fmul float %61, %63
%65 = call i64 @sin(float %64)
%66 = sitofp i64 %65 to float
store float %66, float* %11
%67 = load float, float* %10
%68 = load float*, float** %6
%69 = load i64, i64* %7
%70 = getelementptr inbounds float, float* %68, i64 %69
store float %67, float* %70
%71 = load float, float* %11
%72 = load float*, float** %6
%73 = load i64, i64* %7
%74 = add i64 %73, 1
%75 = getelementptr inbounds float, float* %72, i64 %74
store float %71, float* %75
%76 = load float, float* %11
%77 = load float*, float** %6
%78 = load i64, i64* %4
%79 = load i64, i64* %7
%80 = sub i64 %78, %79
%81 = getelementptr inbounds float, float* %77, i64 %80
store float %76, float* %81
%82 = load float, float* %10
%83 = load float*, float** %6
%84 = load i64, i64* %4
%85 = load i64, i64* %7
%86 = sub i64 %84, %85
%87 = add i64 %86, 1
%88 = getelementptr inbounds float, float* %83, i64 %87
store float %82, float* %88
br label %89
89: ; preds = %54
%90 = load i64, i64* %7
%91 = add i64 %90, 2
store i64 %91, i64* %7
br label %50
92: ; preds = %50
%93 = load i64, i64* %4
%94 = load i64*, i64** %5
%95 = getelementptr inbounds i64, i64* %94, i64 2
%96 = load float*, float** %6
%97 = call i32 @bitrv2(i64 %93, i64* %95, float* %96)
br label %98
98: ; preds = %92, %19
br label %99
99: ; preds = %98, %3
ret void
}

LLVM IR (-O2):
define void @makewt(i64 %0, i64* %1, float* %2) {
store i64 %0, i64* %1
%4 = getelementptr inbounds i64, i64* %1, i64 1
store i64 1, i64* %4
%5 = icmp ugt i64 %0, 2
br i1 %5, label %6, label %40
6: ; preds = %3
%7 = lshr i64 %0, 1
%8 = tail call i64 @atanf(float 1.000000e+00)
%9 = udiv i64 %8, %7
%10 = uitofp i64 %9 to float
store float 1.000000e+00, float* %2
%11 = getelementptr inbounds float, float* %2, i64 1
store float 0.000000e+00, float* %11
%12 = uitofp i64 %7 to float
%13 = fmul float %12, %10
%14 = tail call i64 @cos(float %13)
%15 = sitofp i64 %14 to float
%16 = getelementptr inbounds float, float* %2, i64 %7
store float %15, float* %16
%17 = add nuw i64 %7, 1
%18 = getelementptr inbounds float, float* %2, i64 %17
store float %15, float* %18
%19 = icmp ugt i64 %0, 5
br i1 %19, label %20, label %40
20: ; preds = %6, %20
%21 = phi i64 [ %35, %20 ], [ 2, %6 ]
%22 = uitofp i64 %21 to float
%23 = fmul float %10, %22
%24 = tail call i64 @cos(float %23)
%25 = sitofp i64 %24 to float
%26 = tail call i64 @sin(float %23)
%27 = sitofp i64 %26 to float
%28 = getelementptr inbounds float, float* %2, i64 %21
store float %25, float* %28
%29 = or i64 %21, 1
%30 = getelementptr inbounds float, float* %2, i64 %29
store float %27, float* %30
%31 = sub i64 %0, %21
%32 = getelementptr inbounds float, float* %2, i64 %31
store float %27, float* %32
%33 = add i64 %31, 1
%34 = getelementptr inbounds float, float* %2, i64 %33
store float %25, float* %34
%35 = add nuw i64 %21, 2
%36 = icmp ult i64 %35, %7
br i1 %36, label %20, label %37
37: ; preds = %20
%38 = getelementptr inbounds i64, i64* %1, i64 2
%39 = tail call i32 @bitrv2(i64 %0, i64* %38, float* %2)
br label %40
40: ; preds = %6, %37, %3
ret void
}