#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;
      }
      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    12bd <makewt+0x17d>
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    12b8 <makewt+0x178>
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    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x18(%rbp),%rdx
call   1050 <bitrv2@plt>
jmp    12bd <makewt+0x17d>
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     1253 <makewt+0x113>
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     1253 <makewt+0x113>
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>
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 %102
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 %101
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* %4
%98 = load i32*, i32** %5
%99 = getelementptr inbounds i32, i32* %98, i64 2
%100 = load double*, double** %6
br label %101
101: ; preds = %96, %19
br label %102
102: ; preds = %101, %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 %41
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 %41
21: ; preds = %6
%22 = zext i32 %0 to i64
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 2, %21 ], [ %37, %23 ]
%25 = trunc i64 %24 to i32
%26 = sitofp i32 %25 to double
%27 = fmul double %10, %26
%28 = tail call double @cos(double %27)
%29 = tail call double @sin(double %27)
%30 = getelementptr inbounds double, double* %2, i64 %24
store double %28, double* %30
%31 = or i64 %24, 1
%32 = getelementptr inbounds double, double* %2, i64 %31
store double %29, double* %32
%33 = sub nsw i64 %22, %24
%34 = getelementptr inbounds double, double* %2, i64 %33
store double %29, double* %34
%35 = add nsw i64 %33, 1
%36 = getelementptr inbounds double, double* %2, i64 %35
store double %28, double* %36
%37 = add nuw nsw i64 %24, 2
%38 = icmp ult i64 %37, %15
br i1 %38, label %23, label %39
39: ; preds = %23
%40 = getelementptr inbounds i32, i32* %1, i64 2
tail call void @bitrv2(i32 %0, i32* %40, double* %2)
br label %41
41: ; preds = %6, %39, %3
ret void
}