int main() {
  void *a, *b, *c;
  int n;
  printf("Enter 3 numbers and number of times to rotate: \n");
  scanf("%p %p %p %d", &a, &b, &c, &n);
  printf("%p %p %p \n", a, b, c);
  while (n > 0) {
    rotr(&a, &b, &c);
    n--;
  }
  printf("%p %p %p \n", a, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x24(%rbp)
jle    11b0 <main+0x80>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1050 <rotr@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1185 <main+0x55>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11d0 <main+0x90>
lea    0x18(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <rotr@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0x1,%eax
jg     11b0 <main+0x70>
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    0x8(%rsp),%rcx
lea    0xe26(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Enter 3 numbers and number of times to rotate: \0A\00"
@.str.1 = [12 x i8] c"%p %p %p %d\00"
@.str.2 = [11 x i8] c"%p %p %p \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2, i8** %3, i8** %4, i32* %5)
%8 = load i8*, i8** %2
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
br label %12
12: ; preds = %15, %0
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = call i32 (i8**, i8**, i8**, ...) bitcast (i32 (...)* @rotr to i32 (i8**, i8**, i8**, ...)*)(i8** %2, i8** %3, i8** %4)
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %12
19: ; preds = %12
%20 = load i8*, i8** %2
%21 = load i8*, i8** %3
%22 = load i8*, i8** %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %20, i8* %21, i8* %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%p %p %p %d\00"
@.str.2 = [11 x i8] c"%p %p %p \0A\00"
@str = [48 x i8] c"Enter 3 numbers and number of times to rotate: \00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = bitcast i8** %1 to i8*
%6 = bitcast i8** %2 to i8*
%7 = bitcast i8** %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %1, i8** %2, i8** %3, i32* %4)
%11 = load i8*, i8** %1
%12 = load i8*, i8** %2
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %11, i8* %12, i8* %13)
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %0, %17
%18 = call i32 (i8**, i8**, i8**, ...) bitcast (i32 (...)* @rotr to i32 (i8**, i8**, i8**, ...)*)(i8** %1, i8** %2, i8** %3)
%19 = load i32, i32* %4
%20 = add nsw i32 %19, -1
store i32 %20, i32* %4
%21 = icmp sgt i32 %19, 1
br i1 %21, label %17, label %22
22: ; preds = %17, %0
%23 = load i8*, i8** %1
%24 = load i8*, i8** %2
%25 = load i8*, i8** %3
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %24, i8* %25)
ret i32 0
}