#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, n;
  int desk[64] = {10, 11, 12, 18, 14, 15, 23, 22, 2,  3,  27, 21, 6,
                  7,  31, 30, 1,  0,  35, 25, 37, 4,  5,  29, 9,  8,
                  16, 44, 13, 39, 20, 46, 17, 43, 24, 50, 19, 47, 55,
                  54, 34, 58, 59, 26, 38, 28, 63, 62, 33, 32, 56, 57,
                  42, 36, 60, 61, 41, 40, 48, 49, 45, 51, 52, 53};
  scanf("%d", &n);
  --n;
  for (i = 0; i < 64; ++i) {
    printf("%d: %d\n", i + 1, n + 1);
    n = desk[n];
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x100,%edx
call   1040 <memcpy@plt>
lea    0xf9f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jge    11b8 <main+0x88>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
lea    0xf6c(%rip),%rdi
call   1030 <printf@plt>
movslq -0x10(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117a <main+0x4a>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xfd0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
mov    %edx,0xc(%rsp)
mov    $0x1,%ebx
lea    0xfb2(%rip),%r14
lea    0xea8(%rip),%r15
nopl   0x0(%rax,%rax,1)
add    $0x1,%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
movslq 0xc(%rsp),%rax
mov    (%r15,%rax,4),%edx
mov    %edx,0xc(%rsp)
add    $0x1,%ebx
cmp    $0x41,%ebx
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.desk = [64 x i32] [i32 10, i32 11, i32 12, i32 18, i32 14, i32 15, i32 23, i32 22, i32 2, i32 3, i32 27, i32 21, i32 6, i32 7, i32 31, i32 30, i32 1, i32 0, i32 35, i32 25, i32 37, i32 4, i32 5, i32 29, i32 9, i32 8, i32 16, i32 44, i32 13, i32 39, i32 20, i32 46, i32 17, i32 43, i32 24, i32 50, i32 19, i32 47, i32 55, i32 54, i32 34, i32 58, i32 59, i32 26, i32 38, i32 28, i32 63, i32 62, i32 33, i32 32, i32 56, i32 57, i32 42, i32 36, i32 60, i32 61, i32 41, i32 40, i32 48, i32 49, i32 45, i32 51, i32 52, i32 53]
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [64 x i32]
store i32 0, i32* %1
%6 = bitcast [64 x i32]* %5 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
store i32 0, i32* %2
br label %10
10: ; preds = %23, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 64
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %17)
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [64 x i32], [64 x i32]* %5, i64 0, i64 %20
%22 = load i32, i32* %21
store i32 %22, i32* %4
br label %23
23: ; preds = %13
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %10
26: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@__const.main.desk = [64 x i32] [i32 10, i32 11, i32 12, i32 18, i32 14, i32 15, i32 23, i32 22, i32 2, i32 3, i32 27, i32 21, i32 6, i32 7, i32 31, i32 30, i32 1, i32 0, i32 35, i32 25, i32 37, i32 4, i32 5, i32 29, i32 9, i32 8, i32 16, i32 44, i32 13, i32 39, i32 20, i32 46, i32 17, i32 43, i32 24, i32 50, i32 19, i32 47, i32 55, i32 54, i32 34, i32 58, i32 59, i32 26, i32 38, i32 28, i32 63, i32 62, i32 33, i32 32, i32 56, i32 57, i32 42, i32 36, i32 60, i32 61, i32 41, i32 40, i32 48, i32 49, i32 45, i32 51, i32 52, i32 53]
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"%d: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, -1
store i32 %5, i32* %1
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ 0, %0 ], [ %9, %6 ]
%8 = phi i32 [ %5, %0 ], [ %15, %6 ]
%9 = add nuw nsw i32 %7, 1
%10 = add nsw i32 %8, 1
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10)
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [64 x i32], [64 x i32]* @__const.main.desk, i64 0, i64 %13
%15 = load i32, i32* %14
store i32 %15, i32* %1
%16 = icmp eq i32 %9, 64
br i1 %16, label %17, label %6
17: ; preds = %6
ret i32 0
}