#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 res[3], float src[3], float ang) {
  float t[2], sint, cost;
  ang *= 3.14159265358979323846 / 180.0;
  sint = sinf(ang);
  cost = cosf(ang);
  res[2] = src[2];
  t[0] = src[0] * cost - src[1] * sint;
  t[1] = src[0] * sint + src[1] * cost;
  res[0] = t[0];
  res[1] = t[1];
}


x86 assembly (clang, -O0):
<vec3_RotateZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeba(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x24(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x20(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x20(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_RotateZ>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
cvtss2sd %xmm0,%xmm0
mulsd  0xeca(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
call   1030 <sinf@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1040 <cosf@plt>
movss  0x8(%rbx),%xmm1
movss  %xmm1,0x8(%r14)
movss  (%rbx),%xmm1
movss  0x4(%rbx),%xmm2
movss  0x4(%rsp),%xmm5
movaps %xmm5,%xmm3
mulss  %xmm2,%xmm3
movaps %xmm1,%xmm4
mulss  %xmm0,%xmm4
subss  %xmm3,%xmm4
mulss  %xmm2,%xmm0
mulss  %xmm5,%xmm1
addss  %xmm0,%xmm1
movss  %xmm4,(%r14)
movss  %xmm1,0x4(%r14)
add    $0x8,%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 [2 x 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* %6
%11 = fpext float %10 to double
%12 = fmul double %11, 0x3F91DF46A2529D39
%13 = fptrunc double %12 to float
store float %13, float* %6
%14 = load float, float* %6
%15 = call float @sinf(float %14)
store float %15, float* %8
%16 = load float, float* %6
%17 = call float @cosf(float %16)
store float %17, float* %9
%18 = load float*, float** %5
%19 = getelementptr inbounds float, float* %18, i64 2
%20 = load float, float* %19
%21 = load float*, float** %4
%22 = getelementptr inbounds float, float* %21, i64 2
store float %20, float* %22
%23 = load float*, float** %5
%24 = getelementptr inbounds float, float* %23, i64 0
%25 = load float, float* %24
%26 = load float, float* %9
%27 = load float*, float** %5
%28 = getelementptr inbounds float, float* %27, i64 1
%29 = load float, float* %28
%30 = load float, float* %8
%31 = fmul float %29, %30
%32 = fneg float %31
%33 = call float @llvm.fmuladd.f32(float %25, float %26, float %32)
%34 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 0
store float %33, float* %34
%35 = load float*, float** %5
%36 = getelementptr inbounds float, float* %35, i64 0
%37 = load float, float* %36
%38 = load float, float* %8
%39 = load float*, float** %5
%40 = getelementptr inbounds float, float* %39, i64 1
%41 = load float, float* %40
%42 = load float, float* %9
%43 = fmul float %41, %42
%44 = call float @llvm.fmuladd.f32(float %37, float %38, float %43)
%45 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 1
store float %44, float* %45
%46 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 0
%47 = load float, float* %46
%48 = load float*, float** %4
%49 = getelementptr inbounds float, float* %48, i64 0
store float %47, float* %49
%50 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 1
%51 = load float, float* %50
%52 = load float*, float** %4
%53 = getelementptr inbounds float, float* %52, i64 1
store float %51, float* %53
ret void
}

LLVM IR (-O2):
define void @vec3_RotateZ(float* nocapture writeonly %0, float* nocapture %1, float %2) {
%4 = fpext float %2 to double
%5 = fmul double %4, 0x3F91DF46A2529D39
%6 = fptrunc double %5 to float
%7 = tail call float @sinf(float %6)
%8 = tail call float @cosf(float %6)
%9 = getelementptr inbounds float, float* %1, i64 2
%10 = load float, float* %9
%11 = getelementptr inbounds float, float* %0, i64 2
store float %10, float* %11
%12 = load float, float* %1
%13 = getelementptr inbounds float, float* %1, i64 1
%14 = load float, float* %13
%15 = fneg float %14
%16 = fmul float %7, %15
%17 = tail call float @llvm.fmuladd.f32(float %12, float %8, float %16)
%18 = fmul float %8, %14
%19 = tail call float @llvm.fmuladd.f32(float %12, float %7, float %18)
store float %17, float* %0
%20 = getelementptr inbounds float, float* %0, i64 1
store float %19, float* %20
ret void
}