#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*/ rotr(int **, int **, int **);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x, y, z, rotation, n;
  int *a, *b, *c;
  a = &x;
  b = &y;
  c = &z;
  scanf("%d", &x);
  scanf("%d", &y);
  scanf("%d", &z);
  scanf("%d", &rotation);
  for (n = 0; n < rotation; n++) {
    rotr(&a, &b, &c);
  }
  printf("%d %d %d\n", *a, *b, *c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xea2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe92(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe82(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe72(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c9 <main+0x99>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <rotr@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119e <main+0x6e>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0x2c(%rsp),%r14
mov    %r14,0x18(%rsp)
lea    0x28(%rsp),%r15
mov    %r15,0x10(%rsp)
lea    0x24(%rsp),%rbx
mov    %rbx,0x8(%rsp)
lea    0xe9f(%rip),%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %r12,%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11d6 <main+0xa6>
xor    %ebp,%ebp
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
call   1050 <rotr@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11b0 <main+0x80>
mov    0x18(%rsp),%r14
mov    0x10(%rsp),%r15
mov    0x8(%rsp),%rbx
mov    (%r14),%esi
mov    (%r15),%edx
mov    (%rbx),%ecx
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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