#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 n, ar[n], i, tmp, tmpy;
  printf("Enter the length of array: ");
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &ar[i]);
  tmp = ar[0];
  tmpy = ar[1];
  for (i = 0; i < n - 1; i++) {
    tmpy = ar[i + 1];
    ar[i] = ar[i + 1];
  }
  ar[n - 1] = tmp;
  printf("\n");
  for (i = 0; i < n; i++)
    printf("%d ", ar[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x90>
mov    -0x30(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117b <main+0x5b>
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
mov    %ecx,-0x20(%rbp)
mov    0x4(%rax),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    120b <main+0xeb>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%ecx
mov    %ecx,-0x24(%rbp)
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%edx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1266 <main+0x146>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1233 <main+0x113>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsp,%r15
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11bb <main+0x7b>
mov    %rsp,%r12
xor    %ebx,%ebx
lea    0xe9f(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rdx
add    $0x4,%r12
cmp    %rdx,%rbx
jl     1180 <main+0x40>
mov    (%rsp),%ebx
cmp    $0x2,%edx
jl     11bb <main+0x7b>
add    $0xffffffff,%edx
lea    0x4(%rsp),%rsi
shl    $0x2,%rdx
mov    %rsp,%rdi
call   1060 <memmove@plt>
jmp    11bb <main+0x7b>
mov    %ebx,(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x4(%rsp)
jle    11fb <main+0xbb>
lea    0xe49(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     11e0 <main+0xa0>
mov    %r15,%rsp
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"Enter the length of array: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [0 x i32]
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i8* @llvm.stacksave()
%5 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
%6 = bitcast [0 x i32]* %1 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %0, %11
%12 = phi i64 [ %15, %11 ], [ 0, %0 ]
%13 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = add nuw nsw i64 %12, 1
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %15, %17
br i1 %18, label %11, label %19
19: ; preds = %11
%20 = load i32, i32* %5
%21 = icmp sgt i32 %16, 1
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = add nsw i32 %16, -1
%24 = getelementptr [0 x i32], [0 x i32]* %1, i64 0, i64 1
%25 = bitcast i32* %24 to i8*
%26 = zext i32 %23 to i64
%27 = shl nuw nsw i64 %26, 2
br label %28
28: ; preds = %0, %22, %19
%29 = phi i32 [ %20, %22 ], [ %20, %19 ], [ undef, %0 ]
%30 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
store i32 %29, i32* %30
%31 = call i32 @putchar(i32 10)
%32 = load i32, i32* %2
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %28
%35 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
br label %36
36: ; preds = %34, %36
%37 = phi i64 [ 0, %34 ], [ %40, %36 ]
%38 = load i32, i32* %35
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = add nuw nsw i64 %37, 1
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %40, %42
br i1 %43, label %36, label %44
44: ; preds = %36, %28
ret i32 0
}