#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 cos(float);
float sin(float);
void apply_rotation(float x, float y, float *rx, float *ry, float alpha) {
  float c = cos(alpha);
  float s = sin(alpha);
  float tx = c * x - s * y;
  float ty = s * x + c * y;
  *rx = tx;
  *ry = ty;
}


x86 assembly (clang, -O0):
<apply_rotation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0x24(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0x20(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x2c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @apply_rotation(float %0, float %1, float* %2, float* %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float*
%9 = alloca float*
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
store float %0, float* %6
store float %1, float* %7
store float* %2, float** %8
store float* %3, float** %9
store float %4, float* %10
%15 = load float, float* %10
%16 = call float @cos(float %15)
store float %16, float* %11
%17 = load float, float* %10
%18 = call float @sin(float %17)
store float %18, float* %12
%19 = load float, float* %11
%20 = load float, float* %6
%21 = load float, float* %12
%22 = load float, float* %7
%23 = fmul float %21, %22
%24 = fneg float %23
%25 = call float @llvm.fmuladd.f32(float %19, float %20, float %24)
store float %25, float* %13
%26 = load float, float* %12
%27 = load float, float* %6
%28 = load float, float* %11
%29 = load float, float* %7
%30 = fmul float %28, %29
%31 = call float @llvm.fmuladd.f32(float %26, float %27, float %30)
store float %31, float* %14
%32 = load float, float* %13
%33 = load float*, float** %8
store float %32, float* %33
%34 = load float, float* %14
%35 = load float*, float** %9
store float %34, float* %35
ret void
}

LLVM IR (-O2):
define void @apply_rotation(float %0, float %1, float* nocapture writeonly %2, float* nocapture writeonly %3, float %4) {
%6 = tail call float @cos(float %4)
%7 = tail call float @sin(float %4)
%8 = fneg float %7
%9 = fmul float %8, %1
%10 = tail call float @llvm.fmuladd.f32(float %6, float %0, float %9)
%11 = fmul float %6, %1
%12 = tail call float @llvm.fmuladd.f32(float %7, float %0, float %11)
store float %10, float* %2
store float %12, float* %3
ret void
}