#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 /*<<< orphan*/ scanf(char *, int *);
void rotr(int *a, int *b, int *c) {
  int box = 0;
  int cut = 0;
  int i = 1;
  int n;
  int bex;
  int base;
  int boss;
  scanf("%d", &n);
  scanf("%d", &bex);
  scanf("%d", &base);
  scanf("%d", &boss);
  for (i = 1; i <= n; i++) {
    cut = bex;
    box = base;
    bex = boss;
    base = cut;
    boss = box;
  }
  a = &bex;
  b = &base;
  c = &boss;
  printf("%d\n", *a);
  printf("%d\n", *b);
  printf("%d\n", *c);
}


x86 assembly (clang, -O0):
<rotr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
lea    0xeb0(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea0(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe90(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe80(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     11c8 <rotr+0xa8>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1190 <rotr+0x70>
lea    -0x2c(%rbp),%rax
mov    %rax,-0x8(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x34(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotr>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    0x8(%rsp),%esi
test   %ebx,%ebx
jle    11c8 <rotr+0xa8>
mov    (%rsp),%eax
mov    0x4(%rsp),%r8d
lea    -0x1(%rbx),%edx
mov    %ebx,%ecx
and    $0x7,%ecx
cmp    $0x7,%edx
jae    1186 <rotr+0x66>
mov    %esi,%edi
mov    %r8d,%edx
jmp    11a2 <rotr+0x82>
and    $0xfffffff8,%ebx
nopl   0x0(%rax)
mov    %eax,%edx
mov    %r8d,%edi
mov    %esi,%eax
mov    %r8d,%esi
mov    %edx,%r8d
add    $0xfffffff8,%ebx
jne    1190 <rotr+0x70>
mov    %edi,%esi
test   %ecx,%ecx
je     11bd <rotr+0x9d>
nopl   0x0(%rax,%rax,1)
mov    %eax,%esi
mov    %edx,%eax
mov    %edi,%edx
mov    %esi,%edi
add    $0xffffffff,%ecx
jne    11b0 <rotr+0x90>
mov    %esi,0x8(%rsp)
mov    %edx,0x4(%rsp)
mov    %eax,(%rsp)
lea    0xe34(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @rotr(i32* nocapture readnone %0, i32* nocapture readnone %1, i32* nocapture readnone %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, 1
br i1 %18, label %53, label %19
19: ; preds = %3
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = add i32 %16, -1
%23 = and i32 %16, 7
%24 = icmp ult i32 %22, 7
br i1 %24, label %34, label %25
25: ; preds = %19
%26 = and i32 %16, -8
br label %27
27: ; preds = %27, %25
%28 = phi i32 [ %17, %25 ], [ %29, %27 ]
%29 = phi i32 [ %21, %25 ], [ %30, %27 ]
%30 = phi i32 [ %20, %25 ], [ %28, %27 ]
%31 = phi i32 [ 0, %25 ], [ %32, %27 ]
%32 = add i32 %31, 8
%33 = icmp eq i32 %32, %26
br i1 %33, label %34, label %27
34: ; preds = %27, %19
%35 = phi i32 [ undef, %19 ], [ %30, %27 ]
%36 = phi i32 [ undef, %19 ], [ %28, %27 ]
%37 = phi i32 [ undef, %19 ], [ %29, %27 ]
%38 = phi i32 [ %17, %19 ], [ %29, %27 ]
%39 = phi i32 [ %21, %19 ], [ %30, %27 ]
%40 = phi i32 [ %20, %19 ], [ %28, %27 ]
%41 = icmp eq i32 %23, 0
br i1 %41, label %49, label %42
42: ; preds = %34, %42
%43 = phi i32 [ %45, %42 ], [ %38, %34 ]
%44 = phi i32 [ %43, %42 ], [ %39, %34 ]
%45 = phi i32 [ %44, %42 ], [ %40, %34 ]
%46 = phi i32 [ %47, %42 ], [ 0, %34 ]
%47 = add i32 %46, 1
%48 = icmp eq i32 %47, %23
br i1 %48, label %49, label %42
49: ; preds = %42, %34
%50 = phi i32 [ %35, %34 ], [ %43, %42 ]
%51 = phi i32 [ %36, %34 ], [ %44, %42 ]
%52 = phi i32 [ %37, %34 ], [ %45, %42 ]
store i32 %52, i32* %5
store i32 %50, i32* %6
store i32 %51, i32* %7
br label %53
53: ; preds = %49, %3
%54 = phi i32 [ %52, %49 ], [ %17, %3 ]
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %6
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = load i32, i32* %7
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
ret void
}