#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 rots, k, i;
  scanf("%d", &rots);
  for (i = 0; i < rots; i++) {
    k = *a;
    *a = *c;
    *c = *b;
    *b = k;
  }
  printf("%d %d %d", *a, *b, *c);
  return;
}


x86 assembly (clang, -O0):
<rotr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    118f <rotr+0x6f>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114b <rotr+0x2b>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotr>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    119b <rotr+0x7b>
cmp    $0x1,%eax
je     1185 <rotr+0x65>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%edx
mov    (%r14),%esi
mov    %esi,(%r15)
mov    (%rbx),%esi
mov    %esi,(%r14)
mov    %edx,(%rbx)
mov    (%r15),%edx
mov    (%r14),%esi
mov    %esi,(%r15)
mov    (%rbx),%esi
mov    %esi,(%r14)
mov    %edx,(%rbx)
add    $0xfffffffe,%ecx
jne    1160 <rotr+0x40>
test   $0x1,%al
je     119d <rotr+0x7d>
mov    (%r15),%edx
mov    (%r14),%eax
mov    %eax,(%r15)
mov    (%rbx),%eax
mov    %eax,(%r14)
mov    %edx,(%rbx)
jmp    119d <rotr+0x7d>
mov    (%rbx),%edx
mov    (%r15),%esi
mov    (%r14),%ecx
lea    0xe56(%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
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
store i32 0, i32* %9
br label %11
11: ; preds = %26, %3
%12 = load i32, i32* %9
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
store i32 %17, i32* %8
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = load i32*, i32** %4
store i32 %19, i32* %20
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = load i32*, i32** %6
store i32 %22, i32* %23
%24 = load i32, i32* %8
%25 = load i32*, i32** %5
store i32 %24, i32* %25
br label %26
26: ; preds = %15
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
br label %11
29: ; preds = %11
%30 = load i32*, i32** %4
%31 = load i32, i32* %30
%32 = load i32*, i32** %5
%33 = load i32, i32* %32
%34 = load i32*, i32** %6
%35 = load i32, i32* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %33, i32 %35)
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 %14
9: ; preds = %3
%10 = and i32 %7, 1
%11 = icmp eq i32 %7, 1
br i1 %11, label %26, label %12
12: ; preds = %9
%13 = and i32 %7, -2
br label %16
14: ; preds = %3
%15 = load i32, i32* %1
br label %33
16: ; preds = %16, %12
%17 = phi i32 [ 0, %12 ], [ %24, %16 ]
%18 = load i32, i32* %0
%19 = load i32, i32* %2
store i32 %19, i32* %0
%20 = load i32, i32* %1
store i32 %20, i32* %2
store i32 %18, i32* %1
%21 = load i32, i32* %0
%22 = load i32, i32* %2
store i32 %22, i32* %0
%23 = load i32, i32* %1
store i32 %23, i32* %2
store i32 %21, i32* %1
%24 = add i32 %17, 2
%25 = icmp eq i32 %24, %13
br i1 %25, label %26, label %16
26: ; preds = %16, %9
%27 = phi i32 [ undef, %9 ], [ %21, %16 ]
%28 = icmp eq i32 %10, 0
br i1 %28, label %33, label %29
29: ; preds = %26
%30 = load i32, i32* %0
%31 = load i32, i32* %2
store i32 %31, i32* %0
%32 = load i32, i32* %1
store i32 %32, i32* %2
store i32 %30, i32* %1
br label %33
33: ; preds = %29, %26, %14
%34 = phi i32 [ %15, %14 ], [ %27, %26 ], [ %30, %29 ]
%35 = load i32, i32* %0
%36 = load i32, i32* %2
%37 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %34, i32 %36)
ret void
}