#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 M_PI;
double cos(double);
double sin(double);
void rotate_traces(double *T, double *P, float alpha, int npts, double *H) {
  double co, si;
  int j;
  co = cos(M_PI * (double)alpha / 180.);
  si = sin(M_PI * (double)alpha / 180.);
  for (j = 0; j < npts; j++)
    H[j] = -co * T[j] - si * P[j];
}


x86 assembly (clang, -O0):
<rotate_traces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ea5(%rip),%rax
movsd  (%rax),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
mov    0x2e77(%rip),%rax
movsd  (%rax),%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe76(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1220 <rotate_traces+0x100>
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x30(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119f <rotate_traces+0x7f>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate_traces>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rcx,%r14
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%rbx
mov    0x2eaa(%rip),%r12
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%r12),%xmm0
mulsd  %xmm1,%xmm0
divsd  0xea6(%rip),%xmm0
call   1040 <cos@plt>
movapd %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  (%r12),%xmm0
divsd  0xe87(%rip),%xmm0
call   1030 <sin@plt>
movapd 0x10(%rsp),%xmm7
test   %ebp,%ebp
jle    1377 <rotate_traces+0x257>
movapd 0xe7c(%rip),%xmm1
xorpd  %xmm1,%xmm7
xorpd  %xmm1,%xmm0
mov    %ebp,%eax
cmp    $0x4,%ebp
jae    122b <rotate_traces+0x10b>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
je     11d4 <rotate_traces+0xb4>
movsd  (%r15,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  (%rbx,%rcx,8),%xmm2
mulsd  %xmm7,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r14,%rcx,8)
or     $0x1,%rcx
add    %rax,%rdx
je     1377 <rotate_traces+0x257>
nopl   (%rax)
movsd  (%r15,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  (%rbx,%rcx,8),%xmm2
mulsd  %xmm7,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r14,%rcx,8)
movsd  0x8(%r15,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rbx,%rcx,8),%xmm2
mulsd  %xmm7,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%r14,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    11e0 <rotate_traces+0xc0>
jmp    1377 <rotate_traces+0x257>
lea    (%r14,%rax,8),%rcx
lea    (%rbx,%rax,8),%rdx
cmp    %r14,%rdx
seta   %dil
lea    (%r15,%rax,8),%rdx
cmp    %rbx,%rcx
seta   %r8b
cmp    %r14,%rdx
seta   %dl
cmp    %r15,%rcx
seta   %sil
xor    %ecx,%ecx
test   %r8b,%dil
jne    11a9 <rotate_traces+0x89>
and    %sil,%dl
jne    11a9 <rotate_traces+0x89>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
movapd %xmm7,%xmm1
unpcklpd %xmm7,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1384 <rotate_traces+0x264>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
nopl   0x0(%rax)
movupd (%rbx,%rdx,8),%xmm3
movupd 0x10(%rbx,%rdx,8),%xmm4
movupd (%r15,%rdx,8),%xmm5
movupd 0x10(%r15,%rdx,8),%xmm6
mulpd  %xmm2,%xmm5
mulpd  %xmm2,%xmm6
mulpd  %xmm1,%xmm3
addpd  %xmm5,%xmm3
mulpd  %xmm1,%xmm4
addpd  %xmm6,%xmm4
movupd %xmm3,(%r14,%rdx,8)
movupd %xmm4,0x10(%r14,%rdx,8)
movupd 0x20(%rbx,%rdx,8),%xmm3
movupd 0x30(%rbx,%rdx,8),%xmm4
movupd 0x20(%r15,%rdx,8),%xmm5
movupd 0x30(%r15,%rdx,8),%xmm6
mulpd  %xmm2,%xmm5
mulpd  %xmm2,%xmm6
mulpd  %xmm1,%xmm3
addpd  %xmm5,%xmm3
mulpd  %xmm1,%xmm4
addpd  %xmm6,%xmm4
movupd %xmm3,0x20(%r14,%rdx,8)
movupd %xmm4,0x30(%r14,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    12a0 <rotate_traces+0x180>
test   $0x1,%sil
je     136e <rotate_traces+0x24e>
movupd (%rbx,%rdx,8),%xmm3
movupd 0x10(%rbx,%rdx,8),%xmm4
movupd (%r15,%rdx,8),%xmm5
movupd 0x10(%r15,%rdx,8),%xmm6
mulpd  %xmm2,%xmm5
mulpd  %xmm2,%xmm6
mulpd  %xmm1,%xmm3
addpd  %xmm5,%xmm3
mulpd  %xmm1,%xmm4
addpd  %xmm6,%xmm4
movupd %xmm3,(%r14,%rdx,8)
movupd %xmm4,0x10(%r14,%rdx,8)
cmp    %rax,%rcx
jne    11a9 <rotate_traces+0x89>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    1331 <rotate_traces+0x211>
jmp    136e <rotate_traces+0x24e>

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @rotate_traces(double* %0, double* %1, float %2, i32 %3, double* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca float
%9 = alloca i32
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store float %2, float* %8
store i32 %3, i32* %9
store double* %4, double** %10
%14 = load double, double* @M_PI
%15 = load float, float* %8
%16 = fpext float %15 to double
%17 = fmul double %14, %16
%18 = fdiv double %17, 1.800000e+02
%19 = call double @cos(double %18)
store double %19, double* %11
%20 = load double, double* @M_PI
%21 = load float, float* %8
%22 = fpext float %21 to double
%23 = fmul double %20, %22
%24 = fdiv double %23, 1.800000e+02
%25 = call double @sin(double %24)
store double %25, double* %12
store i32 0, i32* %13
br label %26
26: ; preds = %51, %5
%27 = load i32, i32* %13
%28 = load i32, i32* %9
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %54
30: ; preds = %26
%31 = load double, double* %11
%32 = fneg double %31
%33 = load double*, double** %6
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double, double* %12
%39 = load double*, double** %7
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = fmul double %38, %43
%45 = fneg double %44
%46 = call double @llvm.fmuladd.f64(double %32, double %37, double %45)
%47 = load double*, double** %10
%48 = load i32, i32* %13
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
store double %46, double* %50
br label %51
51: ; preds = %30
%52 = load i32, i32* %13
%53 = add nsw i32 %52, 1
store i32 %53, i32* %13
br label %26
54: ; preds = %26
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @rotate_traces(double* nocapture %0, double* nocapture %1, float %2, i32 %3, double* nocapture writeonly %4) {
%6 = load double, double* @M_PI
%7 = fpext float %2 to double
%8 = fmul double %6, %7
%9 = fdiv double %8, 1.800000e+02
%10 = tail call double @cos(double %9)
%11 = load double, double* @M_PI
%12 = fmul double %11, %7
%13 = fdiv double %12, 1.800000e+02
%14 = tail call double @sin(double %13)
%15 = icmp sgt i32 %3, 0
br i1 %15, label %16, label %159
16: ; preds = %5
%17 = fneg double %10
%18 = fneg double %14
%19 = zext i32 %3 to i64
%20 = icmp ult i32 %3, 4
br i1 %20, label %122, label %21
21: ; preds = %16
%22 = getelementptr double, double* %4, i64 %19
%23 = getelementptr double, double* %0, i64 %19
%24 = getelementptr double, double* %1, i64 %19
%25 = icmp ugt double* %23, %4
%26 = icmp ugt double* %22, %0
%27 = and i1 %25, %26
%28 = icmp ugt double* %24, %4
%29 = icmp ugt double* %22, %1
%30 = and i1 %28, %29
%31 = or i1 %27, %30
br i1 %31, label %122, label %32
32: ; preds = %21
%33 = and i64 %19, 4294967292
%34 = insertelement <2 x double> poison, double %18, i64 0
%35 = shufflevector <2 x double> %34, <2 x double> poison, <2 x i32> zeroinitializer
%36 = insertelement <2 x double> poison, double %18, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = insertelement <2 x double> poison, double %17, i64 0
%39 = shufflevector <2 x double> %38, <2 x double> poison, <2 x i32> zeroinitializer
%40 = insertelement <2 x double> poison, double %17, i64 0
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> zeroinitializer
%42 = add nsw i64 %33, -4
%43 = lshr exact i64 %42, 2
%44 = add nuw nsw i64 %43, 1
%45 = and i64 %44, 1
%46 = icmp eq i64 %42, 0
br i1 %46, label %96, label %47
47: ; preds = %32
%48 = and i64 %44, 9223372036854775806
br label %49
49: ; preds = %49, %47
%50 = phi i64 [ 0, %47 ], [ %93, %49 ]
%51 = phi i64 [ 0, %47 ], [ %94, %49 ]
%52 = getelementptr inbounds double, double* %0, i64 %50
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = getelementptr inbounds double, double* %52, i64 2
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = getelementptr inbounds double, double* %1, i64 %50
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = getelementptr inbounds double, double* %58, i64 2
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = fmul <2 x double> %60, %35
%65 = fmul <2 x double> %63, %37
%66 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %54, <2 x double> %64)
%67 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %41, <2 x double> %57, <2 x double> %65)
%68 = getelementptr inbounds double, double* %4, i64 %50
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> %66, <2 x double>* %69
%70 = getelementptr inbounds double, double* %68, i64 2
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> %67, <2 x double>* %71
%72 = or i64 %50, 4
%73 = getelementptr inbounds double, double* %0, i64 %72
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = getelementptr inbounds double, double* %73, i64 2
%77 = bitcast double* %76 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = getelementptr inbounds double, double* %1, i64 %72
%80 = bitcast double* %79 to <2 x double>*
%81 = load <2 x double>, <2 x double>* %80
%82 = getelementptr inbounds double, double* %79, i64 2
%83 = bitcast double* %82 to <2 x double>*
%84 = load <2 x double>, <2 x double>* %83
%85 = fmul <2 x double> %81, %35
%86 = fmul <2 x double> %84, %37
%87 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %75, <2 x double> %85)
%88 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %41, <2 x double> %78, <2 x double> %86)
%89 = getelementptr inbounds double, double* %4, i64 %72
%90 = bitcast double* %89 to <2 x double>*
store <2 x double> %87, <2 x double>* %90
%91 = getelementptr inbounds double, double* %89, i64 2
%92 = bitcast double* %91 to <2 x double>*
store <2 x double> %88, <2 x double>* %92
%93 = add nuw i64 %50, 8
%94 = add i64 %51, 2
%95 = icmp eq i64 %94, %48
br i1 %95, label %96, label %49
96: ; preds = %49, %32
%97 = phi i64 [ 0, %32 ], [ %93, %49 ]
%98 = icmp eq i64 %45, 0
br i1 %98, label %120, label %99
99: ; preds = %96
%100 = getelementptr inbounds double, double* %0, i64 %97
%101 = bitcast double* %100 to <2 x double>*
%102 = load <2 x double>, <2 x double>* %101
%103 = getelementptr inbounds double, double* %100, i64 2
%104 = bitcast double* %103 to <2 x double>*
%105 = load <2 x double>, <2 x double>* %104
%106 = getelementptr inbounds double, double* %1, i64 %97
%107 = bitcast double* %106 to <2 x double>*
%108 = load <2 x double>, <2 x double>* %107
%109 = getelementptr inbounds double, double* %106, i64 2
%110 = bitcast double* %109 to <2 x double>*
%111 = load <2 x double>, <2 x double>* %110
%112 = fmul <2 x double> %108, %35
%113 = fmul <2 x double> %111, %37
%114 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %102, <2 x double> %112)
%115 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %41, <2 x double> %105, <2 x double> %113)
%116 = getelementptr inbounds double, double* %4, i64 %97
%117 = bitcast double* %116 to <2 x double>*
store <2 x double> %114, <2 x double>* %117
%118 = getelementptr inbounds double, double* %116, i64 2
%119 = bitcast double* %118 to <2 x double>*
store <2 x double> %115, <2 x double>* %119
br label %120
120: ; preds = %96, %99
%121 = icmp eq i64 %33, %19
br i1 %121, label %159, label %122
122: ; preds = %21, %16, %120
%123 = phi i64 [ 0, %21 ], [ 0, %16 ], [ %33, %120 ]
%124 = xor i64 %123, -1
%125 = and i64 %19, 1
%126 = icmp eq i64 %125, 0
br i1 %126, label %136, label %127
127: ; preds = %122
%128 = getelementptr inbounds double, double* %0, i64 %123
%129 = load double, double* %128
%130 = getelementptr inbounds double, double* %1, i64 %123
%131 = load double, double* %130
%132 = fmul double %131, %18
%133 = tail call double @llvm.fmuladd.f64(double %17, double %129, double %132)
%134 = getelementptr inbounds double, double* %4, i64 %123
store double %133, double* %134
%135 = or i64 %123, 1
br label %136
136: ; preds = %127, %122
%137 = phi i64 [ %123, %122 ], [ %135, %127 ]
%138 = sub nsw i64 0, %19
%139 = icmp eq i64 %124, %138
br i1 %139, label %159, label %140
140: ; preds = %136, %140
%141 = phi i64 [ %157, %140 ], [ %137, %136 ]
%142 = getelementptr inbounds double, double* %0, i64 %141
%143 = load double, double* %142
%144 = getelementptr inbounds double, double* %1, i64 %141
%145 = load double, double* %144
%146 = fmul double %145, %18
%147 = tail call double @llvm.fmuladd.f64(double %17, double %143, double %146)
%148 = getelementptr inbounds double, double* %4, i64 %141
store double %147, double* %148
%149 = add nuw nsw i64 %141, 1
%150 = getelementptr inbounds double, double* %0, i64 %149
%151 = load double, double* %150
%152 = getelementptr inbounds double, double* %1, i64 %149
%153 = load double, double* %152
%154 = fmul double %153, %18
%155 = tail call double @llvm.fmuladd.f64(double %17, double %151, double %154)
%156 = getelementptr inbounds double, double* %4, i64 %149
store double %155, double* %156
%157 = add nuw nsw i64 %141, 2
%158 = icmp eq i64 %157, %19
br i1 %158, label %159, label %140
159: ; preds = %136, %140, %120, %5
ret void
}