#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, int, int);
int main() {
  int n, a, b, c;
  scanf("%d %d %d %d", a, b, c, n);
  for (n = 0; n >= 0; 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    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xead(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     119d <main+0x6d>
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <rotr@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    115f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <rotr@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %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 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 undef, i32 undef, i32 undef, i32 undef)
%8 = call i32 @rotr(i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
ret i32 0
}