#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 */
double cos(double);
double sin(double);
void rotation_math(double inputX, double inputY, double theta, double originX,
                   double originY, double *X, double *Y) {
  *X = cos(theta * 0.0174532925199) * (inputX - originX) -
       sin(theta * 0.0174532925199) * (inputY - originY) + originX;
  *Y = sin(theta * 0.0174532925199) * (inputX - originX) +
       cos(theta * 0.0174532925199) * (inputY - originY) + originY;
}


x86 assembly (clang, -O0):
<rotation_math>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
movsd  0xeaf(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe89(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm3
subsd  -0x28(%rbp),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xe30(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe0a(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x48(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm3
subsd  -0x28(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotation_math>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
movapd %xmm2,%xmm0
mulsd  0xeaf(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x18(%rsp),%xmm1
subsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm1,%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,(%rbx)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
addsd  0x28(%rsp),%xmm1
movsd  %xmm1,(%r14)
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @rotation_math(double %0, double %1, double %2, double %3, double %4, double* %5, double* %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double*
%14 = alloca double*
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double* %5, double** %13
store double* %6, double** %14
%15 = load double, double* %10
%16 = fmul double %15, 0x3F91DF46A2526C7A
%17 = call double @cos(double %16)
%18 = load double, double* %8
%19 = load double, double* %11
%20 = fsub double %18, %19
%21 = load double, double* %10
%22 = fmul double %21, 0x3F91DF46A2526C7A
%23 = call double @sin(double %22)
%24 = load double, double* %9
%25 = load double, double* %12
%26 = fsub double %24, %25
%27 = fmul double %23, %26
%28 = fneg double %27
%29 = call double @llvm.fmuladd.f64(double %17, double %20, double %28)
%30 = load double, double* %11
%31 = fadd double %29, %30
%32 = load double*, double** %13
store double %31, double* %32
%33 = load double, double* %10
%34 = fmul double %33, 0x3F91DF46A2526C7A
%35 = call double @sin(double %34)
%36 = load double, double* %8
%37 = load double, double* %11
%38 = fsub double %36, %37
%39 = load double, double* %10
%40 = fmul double %39, 0x3F91DF46A2526C7A
%41 = call double @cos(double %40)
%42 = load double, double* %9
%43 = load double, double* %12
%44 = fsub double %42, %43
%45 = fmul double %41, %44
%46 = call double @llvm.fmuladd.f64(double %35, double %38, double %45)
%47 = load double, double* %12
%48 = fadd double %46, %47
%49 = load double*, double** %14
store double %48, double* %49
ret void
}

LLVM IR (-O2):
define void @rotation_math(double %0, double %1, double %2, double %3, double %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = fmul double %2, 0x3F91DF46A2526C7A
%9 = tail call double @cos(double %8)
%10 = fsub double %0, %3
%11 = tail call double @sin(double %8)
%12 = fsub double %1, %4
%13 = fneg double %11
%14 = fmul double %12, %13
%15 = tail call double @llvm.fmuladd.f64(double %9, double %10, double %14)
%16 = fadd double %15, %3
store double %16, double* %5
%17 = tail call double @sin(double %8)
%18 = tail call double @cos(double %8)
%19 = fmul double %12, %18
%20 = tail call double @llvm.fmuladd.f64(double %17, double %10, double %19)
%21 = fadd double %20, %4
store double %21, double* %6
ret void
}