#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 vec3_rotateY(float *dst, float *b, float c) {
  float p[3], r[3];
  p[0] = dst[0] - b[0];
  p[1] = dst[1] - b[1];
  p[2] = dst[2] - b[2];
  r[0] = p[2] * sinf(c) + p[0] * cosf(c);
  r[1] = p[1];
  r[2] = p[2] * cosf(c) - p[0] * sinf(c);
  dst[0] = r[0] + b[0];
  dst[1] = r[1] + b[1];
  dst[2] = r[2] + b[2];
}


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

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

LLVM IR (-O0):
define void @vec3_rotateY(float* %0, float* %1, float %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float
%7 = alloca [3 x float]
%8 = alloca [3 x float]
store float* %0, float** %4
store float* %1, float** %5
store float %2, float* %6
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = load float*, float** %5
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = fsub float %11, %14
%16 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
store float %15, float* %16
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 1
%19 = load float, float* %18
%20 = load float*, float** %5
%21 = getelementptr inbounds float, float* %20, i64 1
%22 = load float, float* %21
%23 = fsub float %19, %22
%24 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
store float %23, float* %24
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = load float*, float** %5
%29 = getelementptr inbounds float, float* %28, i64 2
%30 = load float, float* %29
%31 = fsub float %27, %30
%32 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
store float %31, float* %32
%33 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
%34 = load float, float* %33
%35 = load float, float* %6
%36 = call float @sinf(float %35)
%37 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%38 = load float, float* %37
%39 = load float, float* %6
%40 = call float @cosf(float %39)
%41 = fmul float %38, %40
%42 = call float @llvm.fmuladd.f32(float %34, float %36, float %41)
%43 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
store float %42, float* %43
%44 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
%45 = load float, float* %44
%46 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 1
store float %45, float* %46
%47 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
%48 = load float, float* %47
%49 = load float, float* %6
%50 = call float @cosf(float %49)
%51 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%52 = load float, float* %51
%53 = load float, float* %6
%54 = call float @sinf(float %53)
%55 = fmul float %52, %54
%56 = fneg float %55
%57 = call float @llvm.fmuladd.f32(float %48, float %50, float %56)
%58 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 2
store float %57, float* %58
%59 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
%60 = load float, float* %59
%61 = load float*, float** %5
%62 = getelementptr inbounds float, float* %61, i64 0
%63 = load float, float* %62
%64 = fadd float %60, %63
%65 = load float*, float** %4
%66 = getelementptr inbounds float, float* %65, i64 0
store float %64, float* %66
%67 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 1
%68 = load float, float* %67
%69 = load float*, float** %5
%70 = getelementptr inbounds float, float* %69, i64 1
%71 = load float, float* %70
%72 = fadd float %68, %71
%73 = load float*, float** %4
%74 = getelementptr inbounds float, float* %73, i64 1
store float %72, float* %74
%75 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 2
%76 = load float, float* %75
%77 = load float*, float** %5
%78 = getelementptr inbounds float, float* %77, i64 2
%79 = load float, float* %78
%80 = fadd float %76, %79
%81 = load float*, float** %4
%82 = getelementptr inbounds float, float* %81, i64 2
store float %80, float* %82
ret void
}

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