#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 */
float cosf(float);
float sinf(float);
void rotate_xy(float *pos, float x_rotate, float y_rotate) {
  float x = pos[0] * cosf(y_rotate) + pos[2] * sinf(y_rotate);
  float y = pos[1];
  float z = -pos[0] * sinf(y_rotate) + pos[2] * cosf(y_rotate);
  pos[0] = x;
  pos[1] = y * cosf(x_rotate) - z * sinf(x_rotate);
  pos[2] = y * sinf(x_rotate) + z * cosf(x_rotate);
}


x86 assembly (clang, -O0):
<rotate_xy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sinf@plt>
movss  -0x4c(%rbp),%xmm1
movss  -0x48(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x44(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x3c(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <cosf@plt>
movss  -0x40(%rbp),%xmm1
movss  -0x3c(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x38(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sinf@plt>
movss  -0x34(%rbp),%xmm1
movss  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x2c(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cosf@plt>
movss  -0x28(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x20(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate_xy>:
push   %rbx
sub    $0x20,%rsp
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
movss  (%rdi),%xmm0
movss  %xmm0,0xc(%rsp)
movaps %xmm1,%xmm0
call   1040 <cosf@plt>
movss  %xmm0,0x4(%rsp)
movss  0x8(%rbx),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
mulss  0x14(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  (%rbx),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x4(%rbx),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x8(%rbx),%xmm0
movss  %xmm0,0x18(%rsp)
movss  0x8(%rsp),%xmm0
call   1040 <cosf@plt>
mulss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
mulss  0x14(%rsp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
movss  %xmm0,(%rbx)
movss  0x10(%rsp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,0x4(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sinf@plt>
mulss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rbx)
movss  0x10(%rsp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,0x4(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cosf@plt>
mulss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rbx)
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @rotate_xy(float* %0, float %1, float %2) {
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float* %0, float** %4
store float %1, float* %5
store float %2, float* %6
%10 = load float*, float** %4
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = load float, float* %6
%14 = call float @cosf(float %13)
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 2
%17 = load float, float* %16
%18 = load float, float* %6
%19 = call float @sinf(float %18)
%20 = fmul float %17, %19
%21 = call float @llvm.fmuladd.f32(float %12, float %14, float %20)
store float %21, float* %7
%22 = load float*, float** %4
%23 = getelementptr inbounds float, float* %22, i64 1
%24 = load float, float* %23
store float %24, float* %8
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 0
%27 = load float, float* %26
%28 = fneg float %27
%29 = load float, float* %6
%30 = call float @sinf(float %29)
%31 = load float*, float** %4
%32 = getelementptr inbounds float, float* %31, i64 2
%33 = load float, float* %32
%34 = load float, float* %6
%35 = call float @cosf(float %34)
%36 = fmul float %33, %35
%37 = call float @llvm.fmuladd.f32(float %28, float %30, float %36)
store float %37, float* %9
%38 = load float, float* %7
%39 = load float*, float** %4
%40 = getelementptr inbounds float, float* %39, i64 0
store float %38, float* %40
%41 = load float, float* %8
%42 = load float, float* %5
%43 = call float @cosf(float %42)
%44 = load float, float* %9
%45 = load float, float* %5
%46 = call float @sinf(float %45)
%47 = fmul float %44, %46
%48 = fneg float %47
%49 = call float @llvm.fmuladd.f32(float %41, float %43, float %48)
%50 = load float*, float** %4
%51 = getelementptr inbounds float, float* %50, i64 1
store float %49, float* %51
%52 = load float, float* %8
%53 = load float, float* %5
%54 = call float @sinf(float %53)
%55 = load float, float* %9
%56 = load float, float* %5
%57 = call float @cosf(float %56)
%58 = fmul float %55, %57
%59 = call float @llvm.fmuladd.f32(float %52, float %54, float %58)
%60 = load float*, float** %4
%61 = getelementptr inbounds float, float* %60, i64 2
store float %59, float* %61
ret void
}

LLVM IR (-O2):
define void @rotate_xy(float* nocapture %0, float %1, float %2) {
%4 = load float, float* %0
%5 = tail call float @cosf(float %2)
%6 = getelementptr inbounds float, float* %0, i64 2
%7 = load float, float* %6
%8 = tail call float @sinf(float %2)
%9 = fmul float %7, %8
%10 = tail call float @llvm.fmuladd.f32(float %4, float %5, float %9)
%11 = getelementptr inbounds float, float* %0, i64 1
%12 = load float, float* %11
%13 = load float, float* %0
%14 = fneg float %13
%15 = tail call float @sinf(float %2)
%16 = load float, float* %6
%17 = tail call float @cosf(float %2)
%18 = fmul float %16, %17
%19 = tail call float @llvm.fmuladd.f32(float %14, float %15, float %18)
store float %10, float* %0
%20 = tail call float @cosf(float %1)
%21 = tail call float @sinf(float %1)
%22 = fneg float %19
%23 = fmul float %21, %22
%24 = tail call float @llvm.fmuladd.f32(float %12, float %20, float %23)
store float %24, float* %11
%25 = tail call float @sinf(float %1)
%26 = tail call float @cosf(float %1)
%27 = fmul float %19, %26
%28 = tail call float @llvm.fmuladd.f32(float %12, float %25, float %27)
store float %28, float* %6
ret void
}