#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;
float cos(float);
float sin(float);
void rotateY(long nrpoints, float angle, float *x, float *y, float *z) {
  long n;
  float 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>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2ea4(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xeb0(%rip),%xmm0
divsd  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    1288 <rotateY+0x168>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x48(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x44(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm2
movss  -0x40(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm2
movss  -0x3c(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x34(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x38(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1172 <rotateY+0x52>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotateY>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %rdi,%rdi
jle    1221 <rotateY+0x101>
mov    %rcx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
mov    0x2ea4(%rip),%rax
movsd  (%rax),%xmm1
divsd  0xeb0(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  (%r12,%rbx,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movss  (%r12,%rbx,4),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movss  (%r14,%rbx,4),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movss  (%r14,%rbx,4),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x10(%rsp),%xmm0
subss  0x8(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  %xmm1,(%r12,%rbx,4)
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <rotateY+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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