#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);
float stub1(float, float);
float rotate_function(void *orig_plot_fn, float radians_rot, float x, float y) {
  float (*plot_fn)(float, float) = orig_plot_fn;
  return (*plot_fn)((x * cos(radians_rot) - y * sin(radians_rot)),
                    (x * sin(radians_rot) + y * cos(radians_rot)));
}


x86 assembly (clang, -O0):
<rotate_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,-0x44(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  -0x48(%rbp),%xmm1
movss  -0x44(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x40(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movss  -0x3c(%rbp),%xmm2
movss  -0x38(%rbp),%xmm1
movss  -0x34(%rbp),%xmm3
mov    -0x30(%rbp),%rax
movaps %xmm0,%xmm4
movss  -0x24(%rbp),%xmm0
mulss  %xmm4,%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
call   *%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate_function>:
push   %rbx
sub    $0x20,%rsp
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0x18(%rsp)
movss  %xmm0,0x10(%rsp)
mov    %rdi,%rbx
call   1040 <cos@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulss  0x14(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
mulss  0x18(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x1c(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
movss  0x14(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  0x1c(%rsp),%xmm0
mulss  0x18(%rsp),%xmm0
addss  %xmm1,%xmm0
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
jmp    *%rax

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

LLVM IR (-O2):
define float @rotate_function(i8* nocapture %0, float %1, float %2, float %3) {
%5 = bitcast i8* %0 to float (float, float)*
%6 = tail call float @cos(float %1)
%7 = tail call float @sin(float %1)
%8 = fneg float %7
%9 = fmul float %8, %3
%10 = tail call float @llvm.fmuladd.f32(float %2, float %6, float %9)
%11 = tail call float @sin(float %1)
%12 = tail call float @cos(float %1)
%13 = fmul float %12, %3
%14 = tail call float @llvm.fmuladd.f32(float %2, float %11, float %13)
%15 = tail call float %5(float %10, float %14)
ret float %15
}