#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 *);
int main() {
  int x = 0, y = 0, z = 0;
  int n = 0, i = 0, j = 0;
  printf("Type first number: ");
  scanf("%d", &x);
  printf("Type second number: ");
  scanf("%d", &y);
  printf("Type third number: ");
  scanf("%d", &z);
  printf("How much times to execute function: ");
  scanf("%d", &n);
  j = n - 1;
  for (i = 0; i <= j; i++) {
    rotr(&x, &y, &z);
    if (i == j) {
      printf("%d", x);
      printf("%d", y);
      printf("%d\n", z);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3c(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     1260 <main+0x130>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1050 <rotr@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    124d <main+0x11d>
mov    -0x8(%rbp),%esi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1252 <main+0x122>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11f1 <main+0xc1>
xor    %eax,%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
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x14(%rsp)
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea1(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%ebp
test   %ebp,%ebp
jle    1244 <main+0x114>
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xe25(%rip),%rbx
lea    0xe6f(%rip),%r13
jmp    1205 <main+0xd5>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     1244 <main+0x114>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <rotr@plt>
cmp    $0x1,%ebp
jne    1200 <main+0xd0>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1200 <main+0xd0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Type first number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"Type second number: \00"
@.str.3 = [20 x i8] c"Type third number: \00"
@.str.4 = [37 x i8] c"How much times to execute function: \00"
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
%19 = icmp sgt i32 %17, 0
br i1 %19, label %20, label %34
20: ; preds = %0, %31
%21 = phi i32 [ %32, %31 ], [ 0, %0 ]
%22 = call i32 @rotr(i32* %1, i32* %2, i32* %3)
%23 = icmp eq i32 %21, %18
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = load i32, i32* %1
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %2
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %20, %24
%32 = add nuw nsw i32 %21, 1
%33 = icmp eq i32 %32, %17
br i1 %33, label %34, label %20
34: ; preds = %31, %0
ret i32 0
}