#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 a, b, c, n;
  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)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11a0 <main+0x70>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <rotr@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%rdi
lea    0x14(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r8
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <scanf@plt>
movl   $0x0,0x8(%rsp)
lea    0xe99(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <rotr@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
test   %eax,%eax
jg     1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
store i32 0, i32* %5
br label %7
7: ; preds = %16, %0
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = call i32 @rotr(i32* %2, i32* %3, i32* %4)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
br label %16
16: ; preds = %10
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %7
19: ; preds = %7
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 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
store i32 0, i32* %4
br label %10
10: ; preds = %0, %10
%11 = call i32 @rotr(i32* %1, i32* %2, i32* %3)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
store i32 %17, i32* %4
%18 = icmp sgt i32 %16, 0
br i1 %18, label %10, label %19
19: ; preds = %10
ret i32 0
}