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


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

LLVM IR (-O0):
define void @vec3_rotateZ(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 0
%34 = load float, float* %33
%35 = load float, float* %6
%36 = call float @cosf(float %35)
%37 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
%38 = load float, float* %37
%39 = load float, float* %6
%40 = call float @sinf(float %39)
%41 = fmul float %38, %40
%42 = fneg float %41
%43 = call float @llvm.fmuladd.f32(float %34, float %36, float %42)
%44 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 0
store float %43, float* %44
%45 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%46 = load float, float* %45
%47 = load float, float* %6
%48 = call float @sinf(float %47)
%49 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
%50 = load float, float* %49
%51 = load float, float* %6
%52 = call float @cosf(float %51)
%53 = fmul float %50, %52
%54 = call float @llvm.fmuladd.f32(float %46, float %48, float %53)
%55 = getelementptr inbounds [3 x float], [3 x float]* %8, i64 0, i64 1
store float %54, float* %55
%56 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
%57 = load float, 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_rotateZ(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 @cosf(float %2)
%18 = tail call float @sinf(float %2)
%19 = fneg float %11
%20 = fmul float %18, %19
%21 = tail call float @llvm.fmuladd.f32(float %6, float %17, float %20)
%22 = tail call float @sinf(float %2)
%23 = tail call float @cosf(float %2)
%24 = fmul float %11, %23
%25 = tail call float @llvm.fmuladd.f32(float %6, float %22, float %24)
%26 = load float, float* %1
%27 = fadd float %21, %26
store float %27, float* %0
%28 = load float, float* %9
%29 = fadd float %25, %28
store float %29, float* %7
%30 = load float, float* %14
%31 = fadd float %16, %30
store float %31, float* %12
ret void
}