#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 */
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
void rotr(int *a, int *b, int *c) {
  int replacer, n;
  scanf("%d", &n);
  while (n > 0) {
    replacer = *b;
    n--;
    *b = *a;
    *a = *c;
    *c = replacer;
  }
  printf("%d %d %d", *a, *b, *c);
}


x86 assembly (clang, -O0):
<rotr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x20(%rbp)
jle    1186 <rotr+0x66>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1144 <rotr+0x24>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotr>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    119f <rotr+0x7f>
mov    %edx,%eax
test   $0x1,%dl
je     1165 <rotr+0x45>
mov    (%r14),%ecx
lea    -0x1(%rdx),%eax
mov    (%r15),%esi
mov    %esi,(%r14)
mov    (%rbx),%esi
mov    %esi,(%r15)
mov    %ecx,(%rbx)
cmp    $0x1,%edx
je     1195 <rotr+0x75>
add    $0xffffffff,%eax
nopl   (%rax)
mov    (%r14),%ecx
mov    (%r15),%edx
mov    %edx,(%r14)
mov    (%rbx),%edx
mov    %edx,(%r15)
mov    %ecx,(%rbx)
mov    (%r14),%ecx
mov    (%r15),%edx
mov    %edx,(%r14)
mov    (%rbx),%edx
mov    %edx,(%r15)
mov    %ecx,(%rbx)
add    $0xfffffffe,%eax
jb     1170 <rotr+0x50>
movl   $0x0,0xc(%rsp)
jmp    11a1 <rotr+0x81>
mov    (%rbx),%ecx
mov    (%r15),%esi
mov    (%r14),%edx
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
define void @rotr(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
br label %10
10: ; preds = %13, %3
%11 = load i32, i32* %8
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
store i32 %15, i32* %7
%16 = load i32, i32* %8
%17 = add nsw i32 %16, -1
store i32 %17, i32* %8
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = load i32*, i32** %5
store i32 %19, i32* %20
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = load i32*, i32** %4
store i32 %22, i32* %23
%24 = load i32, i32* %7
%25 = load i32*, i32** %6
store i32 %24, i32* %25
br label %10
26: ; preds = %10
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = load i32*, i32** %5
%30 = load i32, i32* %29
%31 = load i32*, i32** %6
%32 = load i32, i32* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %30, i32 %32)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
define void @rotr(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %3
%10 = and i32 %7, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = load i32, i32* %1
%14 = add nsw i32 %7, -1
%15 = load i32, i32* %0
store i32 %15, i32* %1
%16 = load i32, i32* %2
store i32 %16, i32* %0
store i32 %13, i32* %2
br label %17
17: ; preds = %12, %9
%18 = phi i32 [ %7, %9 ], [ %14, %12 ]
%19 = phi i32 [ undef, %9 ], [ %13, %12 ]
%20 = icmp eq i32 %7, 1
br i1 %20, label %34, label %23
21: ; preds = %3
%22 = load i32, i32* %2
br label %36
23: ; preds = %17, %23
%24 = phi i32 [ %29, %23 ], [ %18, %17 ]
%25 = load i32, i32* %1
%26 = load i32, i32* %0
store i32 %26, i32* %1
%27 = load i32, i32* %2
store i32 %27, i32* %0
store i32 %25, i32* %2
%28 = load i32, i32* %1
%29 = add nsw i32 %24, -2
%30 = load i32, i32* %0
store i32 %30, i32* %1
%31 = load i32, i32* %2
store i32 %31, i32* %0
store i32 %28, i32* %2
%32 = add i32 %24, -3
%33 = icmp ult i32 %32, -2
br i1 %33, label %23, label %34
34: ; preds = %23, %17
%35 = phi i32 [ %19, %17 ], [ %28, %23 ]
store i32 0, i32* %4
br label %36
36: ; preds = %21, %34
%37 = phi i32 [ %22, %21 ], [ %35, %34 ]
%38 = load i32, i32* %0
%39 = load i32, i32* %1
%40 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %38, i32 %39, i32 %37)
ret void
}