#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 getchar();
int /*<<< orphan*/ printf(char *, unsigned int, int, unsigned int);
unsigned int righttrot(unsigned int, int);
int main() {
  unsigned num, k;
  int n, c;
  for (num = 511; num < 30000; num += 511) {
    for (n = 1; n <= 16; n++) {
      k = righttrot(num, n);
      printf("(%u,%d)=%u\n", num, n, k);
    }
    while ((c = getchar()) != '\n')
      ;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1ff,-0x8(%rbp)
cmpl   $0x7530,-0x8(%rbp)
jae    11c7 <main+0x97>
movl   $0x1,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jg     1195 <main+0x65>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <righttrot@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115a <main+0x2a>
jmp    119a <main+0x6a>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xa,%eax
je     11b2 <main+0x82>
jmp    119a <main+0x6a>
jmp    11b7 <main+0x87>
mov    -0x8(%rbp),%eax
add    $0x1ff,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1ff,%ebx
lea    0xec0(%rip),%r14
mov    %ebx,%edi
mov    $0x1,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x2,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x3,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x5,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x6,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x6,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x7,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x7,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x8,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x9,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x9,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0xa,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xa,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0xb,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xb,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0xc,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xc,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0xd,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xd,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0xe,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xe,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0xf,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xf,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x10,%esi
call   1050 <righttrot@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
jne    1310 <main+0x1e0>
lea    0x1ff(%rbx),%eax
cmp    $0x7331,%ebx
mov    %eax,%ebx
jb     1140 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"(%u,%d)=%u\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %38
%2 = phi i32 [ 511, %0 ], [ %39, %38 ]
%3 = tail call i32 @righttrot(i32 %2, i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 1, i32 %3)
%5 = tail call i32 @righttrot(i32 %2, i32 2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 2, i32 %5)
%7 = tail call i32 @righttrot(i32 %2, i32 3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 3, i32 %7)
%9 = tail call i32 @righttrot(i32 %2, i32 4)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 4, i32 %9)
%11 = tail call i32 @righttrot(i32 %2, i32 5)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 5, i32 %11)
%13 = tail call i32 @righttrot(i32 %2, i32 6)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 6, i32 %13)
%15 = tail call i32 @righttrot(i32 %2, i32 7)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 7, i32 %15)
%17 = tail call i32 @righttrot(i32 %2, i32 8)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 8, i32 %17)
%19 = tail call i32 @righttrot(i32 %2, i32 9)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 9, i32 %19)
%21 = tail call i32 @righttrot(i32 %2, i32 10)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 10, i32 %21)
%23 = tail call i32 @righttrot(i32 %2, i32 11)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 11, i32 %23)
%25 = tail call i32 @righttrot(i32 %2, i32 12)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 12, i32 %25)
%27 = tail call i32 @righttrot(i32 %2, i32 13)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 13, i32 %27)
%29 = tail call i32 @righttrot(i32 %2, i32 14)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 14, i32 %29)
%31 = tail call i32 @righttrot(i32 %2, i32 15)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 15, i32 %31)
%33 = tail call i32 @righttrot(i32 %2, i32 16)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 16, i32 %33)
br label %35
35: ; preds = %1, %35
%36 = tail call i32 (...) @getchar()
%37 = icmp eq i32 %36, 10
br i1 %37, label %38, label %35
38: ; preds = %35
%39 = add nuw nsw i32 %2, 511
%40 = icmp ult i32 %2, 29489
br i1 %40, label %1, label %41
41: ; preds = %38
ret i32 0
}