#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 */
double sin(double);
void realtr(double *a, double *b, long half_length, int isn) {
  long nh, j, k;
  double sd, cd, sn, cn, a1r, a1i, a2r, a2i, re, im;
  nh = half_length >> 1;
  sd = 1.57079632679489661923 / half_length;
  cd = 2.0 * sin(sd) * sin(sd);
  sd = sin(sd + sd);
  sn = 0;
  if (isn < 0) {
    cn = 1;
    a[half_length] = a[0];
    b[half_length] = b[0];
  } else {
    cn = -1;
    sd = -sd;
  }
  for (j = 0; j <= nh; j++) {
    k = half_length - j;
    a1r = a[j] + a[k];
    a2r = b[j] + b[k];
    a1i = b[j] - b[k];
    a2i = -a[j] + a[k];
    re = cn * a2r + sn * a2i;
    im = -sn * a2r + cn * a2i;
    b[k] = +im - a1i;
    b[j] = im + a1i;
    a[k] = a1r - re;
    a[j] = a1r + re;
    a1r = cn - (cd * cn + sd * sn);
    sn = (sd * cn - cd * sn) + sn;
    cn = 0.5 / (a1r * a1r + sn * sn) + 0.5;
    sn *= cn;
    cn *= a1r;
  }
}


x86 assembly (clang, -O0):
<realtr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x28(%rbp)
cvtsi2sdq -0x18(%rbp),%xmm1
movsd  0xec4(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    11ee <realtr+0xde>
movsd  0xe5e(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    121c <realtr+0x10c>
movsd  0xe1a(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     145e <realtr+0x34e>
mov    -0x18(%rbp),%rax
sub    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
subsd  -0x68(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0x68(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
subsd  -0x80(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm2
mulsd  -0x50(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x50(%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  -0x60(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc06(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xbfa(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1224 <realtr+0x114>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realtr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
cvtsi2sd %rdx,%xmm1
movsd  0xece(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
call   1030 <sin@plt>
test   %ebp,%ebp
js     117a <realtr+0x6a>
xorpd  0xeb0(%rip),%xmm0
movsd  0xe90(%rip),%xmm3
jmp    1198 <realtr+0x88>
movsd  (%r15),%xmm1
movsd  %xmm1,(%r15,%rbx,8)
movsd  (%r14),%xmm1
movsd  %xmm1,(%r14,%rbx,8)
movsd  0xe78(%rip),%xmm3
test   %rbx,%rbx
movapd 0x10(%rsp),%xmm12
js     12e5 <realtr+0x1d5>
addsd  %xmm12,%xmm12
mov    %rbx,%rax
sar    %rax
mulsd  0x8(%rsp),%xmm12
movapd 0xe5d(%rip),%xmm8
xor    %ecx,%ecx
test   %rax,%rax
cmovle %rcx,%rax
xorpd  %xmm12,%xmm8
add    $0x1,%rax
xorpd  %xmm2,%xmm2
movsd  0xe36(%rip),%xmm9
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r15,%rcx,8),%xmm1
movsd  (%r15,%rbx,8),%xmm6
movapd %xmm1,%xmm10
addsd  %xmm6,%xmm10
movsd  (%r14,%rcx,8),%xmm11
movsd  (%r14,%rbx,8),%xmm5
movapd %xmm11,%xmm7
addsd  %xmm5,%xmm7
subsd  %xmm5,%xmm11
subsd  %xmm1,%xmm6
movapd %xmm3,%xmm1
mulsd  %xmm7,%xmm1
mulsd  %xmm2,%xmm7
movapd %xmm2,%xmm5
mulsd  %xmm8,%xmm5
movapd %xmm0,%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm5,%xmm4
movapd %xmm0,%xmm5
mulsd  %xmm2,%xmm5
addsd  %xmm2,%xmm4
mulsd  %xmm6,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm6
subsd  %xmm7,%xmm6
movapd %xmm6,%xmm2
subsd  %xmm11,%xmm2
movsd  %xmm2,(%r14,%rbx,8)
addsd  %xmm11,%xmm6
movsd  %xmm6,(%r14,%rcx,8)
movapd %xmm10,%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%r15,%rbx,8)
addsd  %xmm10,%xmm1
movsd  %xmm1,(%r15,%rcx,8)
movapd %xmm12,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm5,%xmm1
subsd  %xmm1,%xmm3
movapd %xmm4,%xmm1
mulsd  %xmm4,%xmm1
movapd %xmm3,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm9,%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm9,%xmm1
mulsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm3
add    $0x1,%rcx
add    $0xffffffffffffffff,%rbx
movapd %xmm4,%xmm2
cmp    %rcx,%rax
jne    11f0 <realtr+0xe0>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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