#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 rotateZ_d(long nrpoints, double angle, double *x, double *y, double *z) {
  long n;
  double x2, y2;
  angle *= M_PI / 180.0;
  for (n = 0; n < nrpoints; n++) {
    x2 = x[n] * cos(angle);
    y2 = x[n] * sin(angle);
    x2 -= y[n] * sin(angle);
    y2 += y[n] * cos(angle);
    x[n] = x2;
    y[n] = y2;
  }
}


x86 assembly (clang, -O0):
<rotateZ_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2ea4(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xeb0(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    1286 <rotateZ_d+0x166>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1166 <rotateZ_d+0x46>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateZ_d>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %rdi,%rdi
jle    1215 <rotateZ_d+0xf5>
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
mov    0x2ea4(%rip),%rax
movsd  (%rax),%xmm1
divsd  0xeb0(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  (%r12,%rbx,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r12,%rbx,8),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x18(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  %xmm1,(%r12,%rbx,8)
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <rotateZ_d+0x40>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @rotateZ_d(i64 %0, double %1, double* nocapture %2, double* nocapture %3, double* nocapture readnone %4) {
%6 = load double, double* @M_PI
%7 = fdiv double %6, 1.800000e+02
%8 = fmul double %7, %1
%9 = icmp sgt i64 %0, 0
br i1 %9, label %10, label %29
10: ; preds = %5, %10
%11 = phi i64 [ %27, %10 ], [ 0, %5 ]
%12 = getelementptr inbounds double, double* %2, i64 %11
%13 = load double, double* %12
%14 = tail call double @cos(double %8)
%15 = fmul double %13, %14
%16 = load double, double* %12
%17 = tail call double @sin(double %8)
%18 = fmul double %16, %17
%19 = getelementptr inbounds double, double* %3, i64 %11
%20 = load double, double* %19
%21 = tail call double @sin(double %8)
%22 = fneg double %20
%23 = tail call double @llvm.fmuladd.f64(double %22, double %21, double %15)
%24 = load double, double* %19
%25 = tail call double @cos(double %8)
%26 = tail call double @llvm.fmuladd.f64(double %24, double %25, double %18)
store double %23, double* %12
store double %26, double* %19
%27 = add nuw nsw i64 %11, 1
%28 = icmp eq i64 %27, %0
br i1 %28, label %29, label %10
29: ; preds = %10, %5
ret void
}