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


x86 assembly (clang, -O0):
<makewt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0x4(%rax)
cmpl   $0x2,-0x4(%rbp)
jle    1340 <makewt+0x200>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsd  0xe7e(%rip),%xmm0
call   1040 <atan@plt>
cltd
idivl  -0x20(%rbp)
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xe60(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1060 <cos@plt>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
cmpl   $0x2,-0x20(%rbp)
jle    133b <makewt+0x1fb>
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12a4 <makewt+0x164>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    1200 <makewt+0xc0>
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jl     1327 <makewt+0x1e7>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    12ad <makewt+0x16d>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
call   1050 <bitrv2@plt>
jmp    1340 <makewt+0x200>
add    $0x40,%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    %edi,(%rsi)
movl   $0x1,0x4(%rsi)
cmp    $0x3,%edi
jl     12a4 <makewt+0x164>
mov    %rdx,%r13
mov    %rsi,%r14
mov    %edi,%r15d
mov    %edi,%r12d
shr    %r12d
movsd  0xe89(%rip),%xmm0
call   1040 <atan@plt>
cltd
idiv   %r12d
cvtsi2sd %eax,%xmm1
movsd  0xe74(%rip),%xmm0
movups %xmm0,0x0(%r13)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
movsd  %xmm1,(%rsp)
mulsd  %xmm1,%xmm0
call   1060 <cos@plt>
movsd  %xmm0,0x0(%r13,%r12,8)
movsd  %xmm0,0x8(%r13,%r12,8)
cmp    $0x6,%r15d
jb     12a4 <makewt+0x164>
mov    %r15d,%eax
lea    -0x8(,%rax,8),%rbp
ff
add    %r13,%rbp
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1060 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x0(%r13,%rbx,8)
movsd  %xmm0,0x8(%r13,%rbx,8)
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,0x0(%rbp)
add    $0x2,%rbx
add    $0xfffffffffffffff0,%rbp
cmp    %r12,%rbx
jb     11e0 <makewt+0xa0>
cmp    $0x8,%r15d
jb     1284 <makewt+0x144>
mov    %r12d,%eax
add    $0x2,%eax
lea    (%r12,%r12,1),%ecx
add    $0xfffffffe,%ecx
lea    (%r12,%r12,1),%edx
add    $0xfffffffc,%edx
nopl   (%rax)
mov    %edx,%esi
movsd  0x0(%r13,%rsi,8),%xmm0
lea    0x1(%rdx),%esi
movsd  0x0(%r13,%rsi,8),%xmm1
mov    %ecx,%esi
movsd  %xmm0,0x0(%r13,%rsi,8)
lea    0x1(%rcx),%esi
movsd  %xmm1,0x0(%r13,%rsi,8)
add    $0xfffffffe,%eax
add    $0xfffffffe,%ecx
add    $0xfffffffc,%edx
cmp    $0x5,%eax
jg     1250 <makewt+0x110>
add    $0x8,%r14
mov    %r15d,%edi
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>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @makewt(i32 %0, i32* %1, double* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 %0, i32* %4
store i32* %1, i32** %5
store double* %2, double** %6
%12 = load i32, i32* %4
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 0
store i32 %12, i32* %14
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 1, i32* %16
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 2
br i1 %18, label %19, label %140
19: ; preds = %3
%20 = load i32, i32* %4
%21 = ashr i32 %20, 1
store i32 %21, i32* %8
%22 = call i32 @atan(double 1.000000e+00)
%23 = load i32, i32* %8
%24 = sdiv i32 %22, %23
%25 = sitofp i32 %24 to double
store double %25, double* %9
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 0
store double 1.000000e+00, double* %27
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 1
store double 0.000000e+00, double* %29
%30 = load double, double* %9
%31 = load i32, i32* %8
%32 = sitofp i32 %31 to double
%33 = fmul double %30, %32
%34 = call double @cos(double %33)
%35 = load double*, double** %6
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
store double %34, double* %38
%39 = load double*, double** %6
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = load double*, double** %6
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %44, i64 %47
store double %43, double* %48
%49 = load i32, i32* %8
%50 = icmp sgt i32 %49, 2
br i1 %50, label %51, label %139
51: ; preds = %19
store i32 2, i32* %7
br label %52
52: ; preds = %93, %51
%53 = load i32, i32* %7
%54 = load i32, i32* %8
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %96
56: ; preds = %52
%57 = load double, double* %9
%58 = load i32, i32* %7
%59 = sitofp i32 %58 to double
%60 = fmul double %57, %59
%61 = call double @cos(double %60)
store double %61, double* %10
%62 = load double, double* %9
%63 = load i32, i32* %7
%64 = sitofp i32 %63 to double
%65 = fmul double %62, %64
%66 = call double @sin(double %65)
store double %66, double* %11
%67 = load double, double* %10
%68 = load double*, double** %6
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %68, i64 %70
store double %67, double* %71
%72 = load double, double* %11
%73 = load double*, double** %6
%74 = load i32, i32* %7
%75 = add nsw i32 %74, 1
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %73, i64 %76
store double %72, double* %77
%78 = load double, double* %11
%79 = load double*, double** %6
%80 = load i32, i32* %4
%81 = load i32, i32* %7
%82 = sub nsw i32 %80, %81
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %79, i64 %83
store double %78, double* %84
%85 = load double, double* %10
%86 = load double*, double** %6
%87 = load i32, i32* %4
%88 = load i32, i32* %7
%89 = sub nsw i32 %87, %88
%90 = add nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %86, i64 %91
store double %85, double* %92
br label %93
93: ; preds = %56
%94 = load i32, i32* %7
%95 = add nsw i32 %94, 2
store i32 %95, i32* %7
br label %52
96: ; preds = %52
%97 = load i32, i32* %8
%98 = sub nsw i32 %97, 2
store i32 %98, i32* %7
br label %99
99: ; preds = %131, %96
%100 = load i32, i32* %7
%101 = icmp sge i32 %100, 2
br i1 %101, label %102, label %134
102: ; preds = %99
%103 = load double*, double** %6
%104 = load i32, i32* %7
%105 = mul nsw i32 2, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %103, i64 %106
%108 = load double, double* %107
store double %108, double* %10
%109 = load double*, double** %6
%110 = load i32, i32* %7
%111 = mul nsw i32 2, %110
%112 = add nsw i32 %111, 1
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %109, i64 %113
%115 = load double, double* %114
store double %115, double* %11
%116 = load double, double* %10
%117 = load double*, double** %6
%118 = load i32, i32* %8
%119 = load i32, i32* %7
%120 = add nsw i32 %118, %119
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %117, i64 %121
store double %116, double* %122
%123 = load double, double* %11
%124 = load double*, double** %6
%125 = load i32, i32* %8
%126 = load i32, i32* %7
%127 = add nsw i32 %125, %126
%128 = add nsw i32 %127, 1
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %124, i64 %129
store double %123, double* %130
br label %131
131: ; preds = %102
%132 = load i32, i32* %7
%133 = sub nsw i32 %132, 2
store i32 %133, i32* %7
br label %99
134: ; preds = %99
%135 = load i32, i32* %4
%136 = load i32*, i32** %5
%137 = getelementptr inbounds i32, i32* %136, i64 2
%138 = load double*, double** %6
br label %139
139: ; preds = %134, %19
br label %140
140: ; preds = %139, %3
ret void
}

LLVM IR (-O2):
define void @makewt(i32 %0, i32* %1, double* %2) {
store i32 %0, i32* %1
%4 = getelementptr inbounds i32, i32* %1, i64 1
store i32 1, i32* %4
%5 = icmp sgt i32 %0, 2
br i1 %5, label %6, label %61
6: ; preds = %3
%7 = lshr i32 %0, 1
%8 = tail call i32 @atan(double 1.000000e+00)
%9 = sdiv i32 %8, %7
%10 = sitofp i32 %9 to double
%11 = bitcast double* %2 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 0.000000e+00>, <2 x double>* %11
%12 = sitofp i32 %7 to double
%13 = fmul double %12, %10
%14 = tail call double @cos(double %13)
%15 = zext i32 %7 to i64
%16 = getelementptr inbounds double, double* %2, i64 %15
store double %14, double* %16
%17 = add nuw nsw i32 %7, 1
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds double, double* %2, i64 %18
store double %14, double* %19
%20 = icmp ugt i32 %0, 5
br i1 %20, label %21, label %61
21: ; preds = %6
%22 = zext i32 %0 to i64
br label %25
23: ; preds = %25
%24 = icmp ugt i32 %0, 7
br i1 %24, label %41, label %59
25: ; preds = %21, %25
%26 = phi i64 [ 2, %21 ], [ %39, %25 ]
%27 = trunc i64 %26 to i32
%28 = sitofp i32 %27 to double
%29 = fmul double %10, %28
%30 = tail call double @cos(double %29)
%31 = tail call double @sin(double %29)
%32 = getelementptr inbounds double, double* %2, i64 %26
store double %30, double* %32
%33 = or i64 %26, 1
%34 = getelementptr inbounds double, double* %2, i64 %33
store double %31, double* %34
%35 = sub nsw i64 %22, %26
%36 = getelementptr inbounds double, double* %2, i64 %35
store double %31, double* %36
%37 = add nsw i64 %35, 1
%38 = getelementptr inbounds double, double* %2, i64 %37
store double %30, double* %38
%39 = add nuw nsw i64 %26, 2
%40 = icmp ult i64 %39, %15
br i1 %40, label %25, label %23
41: ; preds = %23, %41
%42 = phi i32 [ %43, %41 ], [ %7, %23 ]
%43 = add nsw i32 %42, -2
%44 = shl nuw nsw i32 %43, 1
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds double, double* %2, i64 %45
%47 = load double, double* %46
%48 = or i32 %44, 1
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds double, double* %2, i64 %49
%51 = load double, double* %50
%52 = add nsw i32 %43, %7
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds double, double* %2, i64 %53
store double %47, double* %54
%55 = add nsw i32 %52, 1
%56 = zext i32 %55 to i64
%57 = getelementptr inbounds double, double* %2, i64 %56
store double %51, double* %57
%58 = icmp sgt i32 %42, 5
br i1 %58, label %41, label %59
59: ; preds = %41, %23
%60 = getelementptr inbounds i32, i32* %1, i64 2
tail call void @bitrv2(i32 %0, i32* %60, double* %2)
br label %61
61: ; preds = %6, %59, %3
ret void
}