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


x86 assembly (clang, -O0):
<rotateY_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 <rotateY_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
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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    -0x28(%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
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%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    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1166 <rotateY_d+0x46>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateY_d>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %rdi,%rdi
jle    1211 <rotateY_d+0xf1>
mov    %rcx,%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,0x20(%rsp)
movsd  (%r12,%rbx,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x18(%rsp),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x18(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movsd  %xmm1,(%r12,%rbx,8)
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <rotateY_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 @rotateY_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 = fneg double %33
%35 = load double, double* %7
%36 = call double @sin(double %35)
%37 = fmul double %34, %36
store double %37, double* %13
%38 = load double*, double** %10
%39 = load i64, i64* %11
%40 = getelementptr inbounds double, double* %38, i64 %39
%41 = load double, double* %40
%42 = load double, double* %7
%43 = call double @sin(double %42)
%44 = load double, double* %12
%45 = call double @llvm.fmuladd.f64(double %41, double %43, double %44)
store double %45, double* %12
%46 = load double*, double** %10
%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** %10
%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 @rotateY_d(i64 %0, double %1, double* nocapture %2, double* nocapture readnone %3, double* nocapture %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 = fneg double %16
%18 = tail call double @sin(double %8)
%19 = fmul double %18, %17
%20 = getelementptr inbounds double, double* %4, i64 %11
%21 = load double, double* %20
%22 = tail call double @sin(double %8)
%23 = tail call double @llvm.fmuladd.f64(double %21, double %22, double %15)
%24 = load double, double* %20
%25 = tail call double @cos(double %8)
%26 = tail call double @llvm.fmuladd.f64(double %24, double %25, double %19)
store double %23, double* %12
store double %26, double* %20
%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
}