#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*/ scanf(char *, int *);
int main(void) {
  int a[6] = {1, 2, 3, 4, 5, 6}, n, i, j, temp;
  scanf("%d", &n);
  n = n % 30;
  for (i = 0; i < n; i++) {
    j = i % 5;
    temp = a[j];
    a[j] = a[j + 1];
    a[j + 1] = temp;
  }
  for (i = 0; i < 6; i++)
    printf("%d", a[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec1(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11cb <main+0xab>
mov    -0x28(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x2c(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1175 <main+0x55>
movl   $0x0,-0x28(%rbp)
cmpl   $0x6,-0x28(%rbp)
jge    1200 <main+0xe0>
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11d2 <main+0xb2>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0xecb(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeaf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%r9d
sub    %edx,%r9d
add    %ecx,%r9d
add    %eax,%r9d
mov    %r9d,0xc(%rsp)
test   %r9d,%r9d
jle    12cc <main+0x19c>
xor    %r8d,%r8d
cmp    $0x1,%r9d
je     129f <main+0x16f>
mov    %r9d,0x34(%rsp)
and    $0xfffffffe,%r9d
lea    0x14(%rsp),%r12
mov    $0x2,%r14d
mov    $0x1,%r13d
lea    0x10(%rsp),%rdi
xor    %r8d,%r8d
mov    $0xcccccccd,%r10d
movabs $0xcccccccccccccccd,%r11
cc cc cc
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13d,%eax
imul   %r10,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%eax
mov    %r14d,%ebp
sub    %eax,%ebp
mov    %r13,%rax
mul    %r11
and    $0xfffffffffffffffc,%rdx
lea    (%rdx,%rdx,4),%rcx
mov    %r12,%rbx
sub    %rcx,%rbx
neg    %rcx
mov    %r8,%rax
mul    %r11
and    $0xfffffffffffffffc,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %rdi,%rdx
sub    %rax,%rdx
neg    %rax
mov    %r8d,%esi
imul   %r10,%rsi
shr    $0x22,%rsi
lea    (%rsi,%rsi,4),%esi
mov    %r8d,%r15d
sub    %esi,%r15d
mov    (%rdx),%edx
add    $0x1,%r15d
mov    0x10(%rsp,%r15,4),%esi
mov    %esi,(%rdi,%rax,1)
mov    %edx,0x10(%rsp,%r15,4)
mov    (%rbx),%eax
mov    0x10(%rsp,%rbp,4),%edx
mov    %edx,(%r12,%rcx,1)
mov    %eax,0x10(%rsp,%rbp,4)
add    $0x2,%r8
add    $0x2,%r14d
add    $0x2,%r13
add    $0x8,%r12
add    $0x8,%rdi
add    $0xfffffffe,%r9d
jne    11f0 <main+0xc0>
mov    %r8d,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%r8d
mov    0x34(%rsp),%r9d
test   $0x1,%r9b
je     12ae <main+0x17e>
mov    %r8d,%eax
rolq   $0x20,0x10(%rsp,%rax,4)
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%ebx
mov    0x18(%rsp),%r13d
mov    0x1c(%rsp),%r12d
mov    0x20(%rsp),%r15d
mov    0x24(%rsp),%r14d
jmp    12ee <main+0x1be>
mov    $0x1,%esi
mov    $0x2,%ebx
mov    $0x3,%r13d
mov    $0x4,%r12d
mov    $0x5,%r15d
mov    $0x6,%r14d
lea    0xd23(%rip),%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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