#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 /*<<< orphan*/ rotr(int *, int *, int *);
int /*<<< orphan*/ scanf(char *, int /*<<< orphan*/, int *, int *, int *);
int main() {
  int a, b, c, d;
  do
    scanf("%d %d %d %d", ({
            printf("a b c d:");
            &a;
          }),
          &b, &c, &d);
  while (d <= 0);
  do
    rotr(&a, &b, &c);
  while (--d);
  printf("%d %d %d\n", a, b, c);
  return 420;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,%esi
lea    0xe9e(%rip),%rdi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    113f <main+0xf>
jmp    1182 <main+0x52>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <rotr@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    1182 <main+0x52>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1a4,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x14(%rsp),%r14
lea    0xec2(%rip),%r15
lea    0xeaf(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%rbp
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r14d,%esi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1160 <main+0x30>
lea    0x14(%rsp),%r14
lea    0x10(%rsp),%rbp
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1050 <rotr@plt>
addl   $0xffffffff,0x8(%rsp)
jne    11a0 <main+0x70>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1a4,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [9 x i8] c"a b c d:\00"
@.str.2 = [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 = ptrtoint i32* %1 to i64
%10 = trunc i64 %9 to i32
br label %11
11: ; preds = %11, %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10, i32* %2, i32* %3, i32* %4)
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 1
br i1 %15, label %11, label %16
16: ; preds = %11, %16
%17 = call i32 @rotr(i32* %1, i32* %2, i32* %3)
%18 = load i32, i32* %4
%19 = add nsw i32 %18, -1
store i32 %19, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %16
21: ; preds = %16
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
ret i32 420
}