#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 spins, i, l, m, *ptr, *ptr2, *ptr3;
  printf("Vuvedi chislo\n");
  scanf("%d", &i);
  printf("Vuvedi chislo\n");
  scanf("%d", &l);
  printf("Vuvedi chislo\n");
  scanf("%d", &m);
  printf("Times to spin");
  scanf("%d", &spins);
  ptr = &i;
  ptr2 = &l;
  ptr3 = &m;
  while (1 <= spins) {
    rotr(ptr, ptr2, ptr3);
    spins--;
  }
  printf("1=%x\n2=%d\n3=%d", *ptr, *ptr2, *ptr3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
jg     11fc <main+0xcc>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1050 <rotr@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    11cf <main+0x9f>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xebb(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11ec <main+0xac>
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <rotr@plt>
mov    (%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,(%rsp)
cmp    $0x1,%eax
jg     11d0 <main+0x90>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"Times to spin\00"
@.str.3 = [15 x i8] c"1=%x\0A2=%d\0A3=%d\00"
@str.5 = [14 x i8] c"Vuvedi chislo\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 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %0, %19
%20 = call i32 @rotr(i32* %2, i32* %3, i32* %4)
%21 = load i32, i32* %1
%22 = add nsw i32 %21, -1
store i32 %22, i32* %1
%23 = icmp sgt i32 %21, 1
br i1 %23, label %19, label %24
24: ; preds = %19, %0
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
ret i32 0
}