#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 rotate_point(float angle, float point[2]) {
  float cos_, sin_;
  float new[2];
  cos_ = cosf(angle);
  sin_ = sinf(angle);
  new[0] = point[0] * cos_ - point[1] * sin_;
  new[1] = point[0] * sin_ + point[1] * cos_;
  point[0] = new[0];
  point[1] = new[1];
}


x86 assembly (clang, -O0):
<rotate_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cosf@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x14(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x18(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x18(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rotate_point(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca [2 x float]
store float %0, float* %3
store float* %1, float** %4
%8 = load float, float* %3
%9 = call float @cosf(float %8)
store float %9, float* %5
%10 = load float, float* %3
%11 = call float @sinf(float %10)
store float %11, float* %6
%12 = load float*, float** %4
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = load float, float* %5
%16 = load float*, float** %4
%17 = getelementptr inbounds float, float* %16, i64 1
%18 = load float, float* %17
%19 = load float, float* %6
%20 = fmul float %18, %19
%21 = fneg float %20
%22 = call float @llvm.fmuladd.f32(float %14, float %15, float %21)
%23 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 0
store float %22, float* %23
%24 = load float*, float** %4
%25 = getelementptr inbounds float, float* %24, i64 0
%26 = load float, float* %25
%27 = load float, float* %6
%28 = load float*, float** %4
%29 = getelementptr inbounds float, float* %28, i64 1
%30 = load float, float* %29
%31 = load float, float* %5
%32 = fmul float %30, %31
%33 = call float @llvm.fmuladd.f32(float %26, float %27, float %32)
%34 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 1
store float %33, float* %34
%35 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 0
%36 = load float, float* %35
%37 = load float*, float** %4
%38 = getelementptr inbounds float, float* %37, i64 0
store float %36, float* %38
%39 = getelementptr inbounds [2 x float], [2 x float]* %7, i64 0, i64 1
%40 = load float, float* %39
%41 = load float*, float** %4
%42 = getelementptr inbounds float, float* %41, i64 1
store float %40, float* %42
ret void
}

LLVM IR (-O2):
define void @rotate_point(float %0, float* nocapture %1) {
%3 = tail call float @cosf(float %0)
%4 = tail call float @sinf(float %0)
%5 = load float, float* %1
%6 = getelementptr inbounds float, float* %1, i64 1
%7 = load float, float* %6
%8 = fneg float %7
%9 = fmul float %4, %8
%10 = tail call float @llvm.fmuladd.f32(float %5, float %3, float %9)
%11 = fmul float %3, %7
%12 = tail call float @llvm.fmuladd.f32(float %5, float %4, float %11)
store float %10, float* %1
store float %12, float* %6
ret void
}