#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 vec2_rotate(float *dst, float *b, float c) {
  float p0 = dst[0] - b[0], p1 = dst[1] - b[1], sinC = sinf(c), cosC = cosf(c);
  dst[0] = p0 * cosC - p1 * sinC + b[0];
  dst[1] = p0 * sinC + p1 * cosC + b[1];
}


x86 assembly (clang, -O0):
<vec2_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
movss  %xmm0,-0x1c(%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)
movss  -0x18(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  -0x20(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x18(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  -0x24(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
add    $0x30,%rsp
pop    %rbp
ret

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

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