#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 atan2(double, double);
double cos(double);
double hypot(double, double);
double sin(double);
void RotateAndScaleCoords(int *x, int *y, double angle, double scale) {
  double r, theta;
  r = hypot((double)*x, (double)*y);
  theta = atan2((double)*y, (double)*x);
  *x = (int)(r * scale * cos(theta + angle) + 0.5);
  *y = (int)(r * scale * sin(theta + angle) + 0.5);
}


x86 assembly (clang, -O0):
<RotateAndScaleCoords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
call   1050 <hypot@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm0
mov    -0x8(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
call   1030 <atan2@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe40(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe00(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RotateAndScaleCoords>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
cvtsi2sdl (%rdi),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%rsi),%xmm1
call   1050 <hypot@plt>
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%r14),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%rbx),%xmm1
call   1030 <atan2@plt>
movapd %xmm0,%xmm1
movsd  (%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
call   1060 <cos@plt>
mulsd  (%rsp),%xmm0
addsd  0xe45(%rip),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,(%rbx)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
addsd  0xe27(%rip),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @RotateAndScaleCoords(i32* %0, i32* %1, double %2, double %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32* %0, i32** %5
store i32* %1, i32** %6
store double %2, double* %7
store double %3, double* %8
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = sitofp i32 %12 to double
%14 = load i32*, i32** %6
%15 = load i32, i32* %14
%16 = sitofp i32 %15 to double
%17 = call double @hypot(double %13, double %16)
store double %17, double* %9
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = sitofp i32 %19 to double
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = sitofp i32 %22 to double
%24 = call double @atan2(double %20, double %23)
store double %24, double* %10
%25 = load double, double* %9
%26 = load double, double* %8
%27 = fmul double %25, %26
%28 = load double, double* %10
%29 = load double, double* %7
%30 = fadd double %28, %29
%31 = call double @cos(double %30)
%32 = call double @llvm.fmuladd.f64(double %27, double %31, double 5.000000e-01)
%33 = fptosi double %32 to i32
%34 = load i32*, i32** %5
store i32 %33, i32* %34
%35 = load double, double* %9
%36 = load double, double* %8
%37 = fmul double %35, %36
%38 = load double, double* %10
%39 = load double, double* %7
%40 = fadd double %38, %39
%41 = call double @sin(double %40)
%42 = call double @llvm.fmuladd.f64(double %37, double %41, double 5.000000e-01)
%43 = fptosi double %42 to i32
%44 = load i32*, i32** %6
store i32 %43, i32* %44
ret void
}

LLVM IR (-O2):
define void @RotateAndScaleCoords(i32* nocapture %0, i32* nocapture %1, double %2, double %3) {
%5 = load i32, i32* %0
%6 = sitofp i32 %5 to double
%7 = load i32, i32* %1
%8 = sitofp i32 %7 to double
%9 = tail call double @hypot(double %6, double %8)
%10 = load i32, i32* %1
%11 = sitofp i32 %10 to double
%12 = load i32, i32* %0
%13 = sitofp i32 %12 to double
%14 = tail call double @atan2(double %11, double %13)
%15 = fmul double %9, %3
%16 = fadd double %14, %2
%17 = tail call double @cos(double %16)
%18 = tail call double @llvm.fmuladd.f64(double %15, double %17, double 5.000000e-01)
%19 = fptosi double %18 to i32
store i32 %19, i32* %0
%20 = tail call double @sin(double %16)
%21 = tail call double @llvm.fmuladd.f64(double %15, double %20, double 5.000000e-01)
%22 = fptosi double %21 to i32
store i32 %22, i32* %1
ret void
}