void point_rotate(double *x, double *y, int rot, double page_width_pts,
                  double page_height_pts) {
  double x0, y0;
  x0 = (*x);
  y0 = (*y);
  switch (rot) {
  case 1:
    (*y) = x0;
    (*x) = page_height_pts - y0;
    break;
  case 2:
    (*x) = page_width_pts - x0;
    (*y) = page_height_pts - y0;
    break;
  case 3:
    (*y) = page_width_pts - x0;
    (*x) = y0;
    break;
  }
}


x86 assembly (clang, -O0):
<point_rotate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x1,%eax
je     1169 <point_rotate+0x69>
jmp    1147 <point_rotate+0x47>
mov    -0x3c(%rbp),%eax
sub    $0x2,%eax
je     118d <point_rotate+0x8d>
jmp    1158 <point_rotate+0x58>
mov    -0x3c(%rbp),%eax
sub    $0x3,%eax
je     11b6 <point_rotate+0xb6>
jmp    11d5 <point_rotate+0xd5>
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11d5 <point_rotate+0xd5>
movsd  -0x20(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    11d5 <point_rotate+0xd5>
movsd  -0x20(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<point_rotate>:
movsd  (%rdi),%xmm3
movsd  (%rsi),%xmm2
cmp    $0x3,%edx
je     1124 <point_rotate+0x24>
cmp    $0x2,%edx
je     1131 <point_rotate+0x31>
cmp    $0x1,%edx
jne    1130 <point_rotate+0x30>
movsd  %xmm3,(%rsi)
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rdi)
ret
subsd  %xmm3,%xmm0
movsd  %xmm0,(%rsi)
movsd  %xmm2,(%rdi)
ret
subsd  %xmm3,%xmm0
movsd  %xmm0,(%rdi)
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rsi)
ret

LLVM IR (-O0):
define void @point_rotate(double* %0, double* %1, i32 %2, double %3, double %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store double %3, double* %9
store double %4, double* %10
%13 = load double*, double** %6
%14 = load double, double* %13
store double %14, double* %11
%15 = load double*, double** %7
%16 = load double, double* %15
store double %16, double* %12
%17 = load i32, i32* %8
switch i32 %17, label %41 [
i32 1, label %18
i32 2, label %25
i32 3, label %34
]
18: ; preds = %5
%19 = load double, double* %11
%20 = load double*, double** %7
store double %19, double* %20
%21 = load double, double* %10
%22 = load double, double* %12
%23 = fsub double %21, %22
%24 = load double*, double** %6
store double %23, double* %24
br label %41
25: ; preds = %5
%26 = load double, double* %9
%27 = load double, double* %11
%28 = fsub double %26, %27
%29 = load double*, double** %6
store double %28, double* %29
%30 = load double, double* %10
%31 = load double, double* %12
%32 = fsub double %30, %31
%33 = load double*, double** %7
store double %32, double* %33
br label %41
34: ; preds = %5
%35 = load double, double* %9
%36 = load double, double* %11
%37 = fsub double %35, %36
%38 = load double*, double** %7
store double %37, double* %38
%39 = load double, double* %12
%40 = load double*, double** %6
store double %39, double* %40
br label %41
41: ; preds = %5, %34, %25, %18
ret void
}

LLVM IR (-O2):
define void @point_rotate(double* nocapture %0, double* nocapture %1, i32 %2, double %3, double %4) {
%6 = load double, double* %0
%7 = load double, double* %1
switch i32 %2, label %15 [
i32 1, label %8
i32 2, label %10
i32 3, label %13
]
8: ; preds = %5
store double %6, double* %1
%9 = fsub double %4, %7
store double %9, double* %0
br label %15
10: ; preds = %5
%11 = fsub double %3, %6
store double %11, double* %0
%12 = fsub double %4, %7
store double %12, double* %1
br label %15
13: ; preds = %5
%14 = fsub double %3, %6
store double %14, double* %1
store double %7, double* %0
br label %15
15: ; preds = %5, %13, %10, %8
ret void
}