#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 */
typedef int sin_theta;
typedef int cos_theta;

/* Variables and functions */
double cos(double);
int round(int);
double sin(double);
void rotatePoint(int mx, int my, int *px, int *py, double angle) {
  double cos_theta = cos(angle);
  double sin_theta = sin(angle);
  int x2 = round((*px - mx) * (cos_theta) - (*py - my) * (sin_theta));
  int y2 = round((*px - mx) * (sin_theta) + (*py - my) * (cos_theta));
  *px = x2 + mx;
  *py = y2 + my;
}


x86 assembly (clang, -O0):
<rotatePoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  -0x28(%rbp),%xmm2
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
mulsd  -0x30(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <round@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <round@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%ecx
add    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
add    -0x8(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotatePoint>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,(%rsp)
mov    %rcx,%r14
mov    %rdx,%r12
mov    %esi,%r15d
mov    %edi,%ebp
call   1040 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
mov    (%r12),%eax
sub    %ebp,%eax
cvtsi2sd %eax,%xmm2
mov    (%r14),%eax
sub    %r15d,%eax
cvtsi2sd %eax,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm2
subsd  %xmm1,%xmm2
cvttsd2si %xmm2,%edi
call   1050 <round@plt>
mov    %eax,%ebx
mov    (%r12),%eax
sub    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    (%r14),%eax
sub    %r15d,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <round@plt>
add    %ebp,%ebx
mov    %ebx,(%r12)
add    %r15d,%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rotatePoint(i32 %0, i32 %1, i32* %2, i32* %3, double %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store double %4, double* %10
%15 = load double, double* %10
%16 = call double @cos(double %15)
store double %16, double* %11
%17 = load double, double* %10
%18 = call double @sin(double %17)
store double %18, double* %12
%19 = load i32*, i32** %8
%20 = load i32, i32* %19
%21 = load i32, i32* %6
%22 = sub nsw i32 %20, %21
%23 = sitofp i32 %22 to double
%24 = load double, double* %11
%25 = load i32*, i32** %9
%26 = load i32, i32* %25
%27 = load i32, i32* %7
%28 = sub nsw i32 %26, %27
%29 = sitofp i32 %28 to double
%30 = load double, double* %12
%31 = fmul double %29, %30
%32 = fneg double %31
%33 = call double @llvm.fmuladd.f64(double %23, double %24, double %32)
%34 = fptosi double %33 to i32
%35 = call i32 @round(i32 %34)
store i32 %35, i32* %13
%36 = load i32*, i32** %8
%37 = load i32, i32* %36
%38 = load i32, i32* %6
%39 = sub nsw i32 %37, %38
%40 = sitofp i32 %39 to double
%41 = load double, double* %12
%42 = load i32*, i32** %9
%43 = load i32, i32* %42
%44 = load i32, i32* %7
%45 = sub nsw i32 %43, %44
%46 = sitofp i32 %45 to double
%47 = load double, double* %11
%48 = fmul double %46, %47
%49 = call double @llvm.fmuladd.f64(double %40, double %41, double %48)
%50 = fptosi double %49 to i32
%51 = call i32 @round(i32 %50)
store i32 %51, i32* %14
%52 = load i32, i32* %13
%53 = load i32, i32* %6
%54 = add nsw i32 %52, %53
%55 = load i32*, i32** %8
store i32 %54, i32* %55
%56 = load i32, i32* %14
%57 = load i32, i32* %7
%58 = add nsw i32 %56, %57
%59 = load i32*, i32** %9
store i32 %58, i32* %59
ret void
}

LLVM IR (-O2):
define void @rotatePoint(i32 %0, i32 %1, i32* nocapture %2, i32* nocapture %3, double %4) {
%6 = tail call double @cos(double %4)
%7 = tail call double @sin(double %4)
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, %0
%10 = sitofp i32 %9 to double
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, %1
%13 = sitofp i32 %12 to double
%14 = fneg double %7
%15 = fmul double %14, %13
%16 = tail call double @llvm.fmuladd.f64(double %10, double %6, double %15)
%17 = fptosi double %16 to i32
%18 = tail call i32 @round(i32 %17)
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, %0
%21 = sitofp i32 %20 to double
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, %1
%24 = sitofp i32 %23 to double
%25 = fmul double %6, %24
%26 = tail call double @llvm.fmuladd.f64(double %21, double %7, double %25)
%27 = fptosi double %26 to i32
%28 = tail call i32 @round(i32 %27)
%29 = add nsw i32 %18, %0
store i32 %29, i32* %2
%30 = add nsw i32 %28, %1
store i32 %30, i32* %3
ret void
}