#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*/ realft(double *, unsigned long, int);
double sin(double);
void sinft(double *y, unsigned long n) {
  unsigned long j, n2 = n + 2;
  double sum, y1, y2;
  double theta, wi = 0.0, wr = 1.0, wpi, wpr, wtemp;
  theta = 3.14159265358979 / (double)n;
  wtemp = sin(0.5 * theta);
  wpr = -2.0 * wtemp * wtemp;
  wpi = sin(theta);
  y--;
  y[1] = 0.0;
  for (j = 2; j <= (n >> 1) + 1; j++) {
    wr = (wtemp = wr) * wpr - wi * wpi + wr;
    wi = wi * wpr + wtemp * wpi + wi;
    y1 = wi * (y[j] + y[n2 - j]);
    y2 = 0.5 * (y[j] - y[n2 - j]);
    y[j] = y1 + y2;
    y[n2 - j] = y1 - y2;
  }
  realft(y, n, 1);
  y[1] *= 0.5;
  sum = y[2] = 0.0;
  for (j = 1; j <= n - 1; j += 2) {
    sum += y[j];
    y[j] = y[j + 1];
    y[j + 1] = sum;
  }
}


x86 assembly (clang, -O0):
<sinft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x48(%rbp)
movabs $0x3ff0000000000000,%rax
mov    %rax,-0x50(%rbp)
movaps 0xec7(%rip),%xmm0
movq   -0x10(%rbp),%xmm1
punpckldq %xmm0,%xmm1
movapd 0xec6(%rip),%xmm0
subpd  %xmm0,%xmm1
movaps %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe8f(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe76(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  0xe57(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x1,%rcx
add    $0x1,%rcx
cmp    %rcx,%rax
ja     1306 <sinft+0x1e6>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    -0x18(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  0xd4e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e7 <sinft+0xc7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <realft@plt>
mov    -0x8(%rbp),%rax
movsd  0xce4(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
ja     13b5 <sinft+0x295>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  0x8(%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  %xmm0,0x8(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    134a <sinft+0x22a>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinft>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movq   %rsi,%xmm0
punpckldq 0xec6(%rip),%xmm0
subpd  0xece(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xeda(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
movsd  0xed0(%rip),%xmm0
mulsd  %xmm2,%xmm0
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <sin@plt>
lea    -0x8(%rbx),%rdi
movq   $0x0,(%rbx)
cmp    $0x2,%r14
jb     124e <sinft+0x12e>
movsd  0xea1(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mov    %r14,%rax
shr    %rax
unpcklpd %xmm1,%xmm1
unpcklpd %xmm0,%xmm0
lea    (%rbx,%r14,8),%rcx
add    $0xfffffffffffffff8,%rcx
movsd  0xe7d(%rip),%xmm3
xor    %edx,%edx
movapd 0xe4a(%rip),%xmm8
movsd  0xe5a(%rip),%xmm4
xchg   %ax,%ax
movapd %xmm3,%xmm5
unpckhpd %xmm3,%xmm5
xorpd  %xmm8,%xmm5
unpcklpd %xmm3,%xmm5
mulpd  %xmm0,%xmm5
movapd %xmm3,%xmm6
mulpd  %xmm1,%xmm6
addpd  %xmm5,%xmm6
addpd  %xmm6,%xmm3
movsd  0x8(%rbx,%rdx,8),%xmm5
movsd  (%rcx),%xmm6
movapd %xmm5,%xmm7
addsd  %xmm6,%xmm7
movapd %xmm3,%xmm2
unpckhpd %xmm3,%xmm2
mulsd  %xmm7,%xmm2
subsd  %xmm6,%xmm5
mulsd  %xmm4,%xmm5
movapd %xmm2,%xmm6
addsd  %xmm5,%xmm6
movsd  %xmm6,0x8(%rbx,%rdx,8)
subsd  %xmm5,%xmm2
movsd  %xmm2,(%rcx)
add    $0x1,%rdx
add    $0xfffffffffffffff8,%rcx
cmp    %rdx,%rax
jne    11e0 <sinft+0xc0>
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <realft@plt>
movsd  (%rbx),%xmm0
mulsd  0xdd1(%rip),%xmm0
movsd  %xmm0,(%rbx)
movq   $0x0,0x8(%rbx)
add    $0xffffffffffffffff,%r14
je     12bf <sinft+0x19f>
xorpd  %xmm0,%xmm0
addsd  (%rbx),%xmm0
movq   $0x0,(%rbx)
movsd  %xmm0,0x8(%rbx)
cmp    $0x3,%r14
jb     12bf <sinft+0x19f>
mov    $0x3,%eax
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm1
addsd  -0x8(%rbx,%rax,8),%xmm0
movsd  %xmm1,-0x8(%rbx,%rax,8)
movsd  %xmm0,(%rbx,%rax,8)
add    $0x2,%rax
cmp    %r14,%rax
jbe    12a0 <sinft+0x180>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @sinft(double* %0, i64 %1) {
%3 = add i64 %1, 2
%4 = uitofp i64 %1 to double
%5 = fdiv double 0x400921FB54442D11, %4
%6 = fmul double %5, 5.000000e-01
%7 = tail call double @sin(double %6)
%8 = tail call double @sin(double %5)
%9 = getelementptr inbounds double, double* %0, i64 -1
store double 0.000000e+00, double* %0
%10 = icmp ult i64 %1, 2
br i1 %10, label %44, label %11
11: ; preds = %2
%12 = fmul double %7, -2.000000e+00
%13 = fmul double %7, %12
%14 = lshr i64 %1, 1
%15 = add nuw i64 %14, 1
%16 = insertelement <2 x double> poison, double %13, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = insertelement <2 x double> poison, double %8, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
br label %20
20: ; preds = %11, %20
%21 = phi i64 [ %42, %20 ], [ 2, %11 ]
%22 = phi <2 x double> [ %29, %20 ], [ <double 1.000000e+00, double 0.000000e+00>, %11 ]
%23 = extractelement <2 x double> %22, i64 1
%24 = fneg double %23
%25 = insertelement <2 x double> poison, double %24, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> %22, <2 x i32> <i32 0, i32 2>
%27 = fmul <2 x double> %19, %26
%28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %17, <2 x double> %27)
%29 = fadd <2 x double> %22, %28
%30 = getelementptr inbounds double, double* %9, i64 %21
%31 = load double, double* %30
%32 = sub i64 %3, %21
%33 = getelementptr inbounds double, double* %9, i64 %32
%34 = load double, double* %33
%35 = fadd double %31, %34
%36 = extractelement <2 x double> %29, i64 1
%37 = fmul double %36, %35
%38 = fsub double %31, %34
%39 = fmul double %38, 5.000000e-01
%40 = fadd double %37, %39
store double %40, double* %30
%41 = fsub double %37, %39
store double %41, double* %33
%42 = add nuw i64 %21, 1
%43 = icmp eq i64 %21, %15
br i1 %43, label %44, label %20
44: ; preds = %20, %2
%45 = tail call i32 @realft(double* %9, i64 %1, i32 1)
%46 = load double, double* %0
%47 = fmul double %46, 5.000000e-01
store double %47, double* %0
%48 = getelementptr inbounds double, double* %0, i64 1
store double 0.000000e+00, double* %48
%49 = add i64 %1, -1
%50 = icmp eq i64 %49, 0
br i1 %50, label %67, label %51
51: ; preds = %44
%52 = load double, double* %0
%53 = fadd double %52, 0.000000e+00
%54 = getelementptr inbounds double, double* %0, i64 1
store double 0.000000e+00, double* %0
store double %53, double* %54
%55 = icmp ult i64 %49, 3
br i1 %55, label %67, label %56
56: ; preds = %51, %56
%57 = phi i64 [ %65, %56 ], [ 3, %51 ]
%58 = phi double [ %63, %56 ], [ %53, %51 ]
%59 = getelementptr inbounds double, double* %0, i64 %57
%60 = load double, double* %59
%61 = getelementptr inbounds double, double* %9, i64 %57
%62 = load double, double* %61
%63 = fadd double %58, %62
%64 = getelementptr inbounds double, double* %0, i64 %57
store double %60, double* %61
store double %63, double* %64
%65 = add nuw i64 %57, 2
%66 = icmp ugt i64 %65, %49
br i1 %66, label %67, label %56
67: ; preds = %56, %51, %44
ret void
}