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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    11ae <main+0x7e>
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1050 <rotr@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1183 <main+0x53>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%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    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x18(%rsp),%rsi
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d0 <main+0x90>
lea    0x18(%rsp),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <rotr@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
cmp    $0x1,%eax
jg     11b0 <main+0x70>
mov    0x18(%rsp),%rsi
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
lea    0xe28(%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"%d %d %d %d\00"
@.str.2 = [11 x i8] c"%d %d %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%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), i32** %2, i32* %3, i32* %4, i32* %5)
%8 = load i32*, i32** %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %8, i32 %9, i32 %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 (i32**, i32*, i32*, ...) bitcast (i32 (...)* @rotr to i32 (i32**, i32*, i32*, ...)*)(i32** %2, i32* %3, i32* %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 i32*, i32** %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %20, i32 %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [11 x i8] c"%d %d %d \0A\00"
@str = [48 x i8] c"Enter 3 numbers and number of times to rotate: \00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32** %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %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), i32** %1, i32* %2, i32* %3, i32* %4)
%11 = load i32*, i32** %1
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %11, i32 %12, i32 %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 (i32**, i32*, i32*, ...) bitcast (i32 (...)* @rotr to i32 (i32**, i32*, i32*, ...)*)(i32** %1, i32* %2, i32* %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 i32*, i32** %1
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %23, i32 %24, i32 %25)
ret i32 0
}