#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 *);
void main() {
  int number[30];
  int i, n, a, j;
  printf("Enter the value of n\n");
  scanf("%d", &n);
  printf("enter the numbers\n");
  for (i = 0; i < n; ++i)
    scanf("%d", &number[i]);
  printf("Enter the position of the element to split the array \n");
  scanf("%d", &a);
  for (i = 0; i < a; ++i) {
    number[n] = number[0];
    for (j = 0; j < n; ++j) {
      number[j] = number[j + 1];
    }
  }
  printf("The resultant array is\n");
  for (i = 0; i < n; ++i) {
    printf("%d\n", number[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x88(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    11a8 <main+0x88>
movslq -0x84(%rbp),%rax
lea    -0x80(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe87(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1164 <main+0x44>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
lea    -0x8c(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jge    1256 <main+0x136>
mov    -0x80(%rbp),%ecx
movslq -0x88(%rbp),%rax
mov    %ecx,-0x80(%rbp,%rax,4)
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    123d <main+0x11d>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x80(%rbp,%rax,4),%ecx
movslq -0x90(%rbp),%rax
mov    %ecx,-0x80(%rbp,%rax,4)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    11fd <main+0xdd>
jmp    1242 <main+0x122>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11d3 <main+0xb3>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    12ad <main+0x18d>
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%esi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    126e <main+0x14e>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    11ad <main+0x6d>
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
lea    0xe71(%rip),%r14
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     1190 <main+0x50>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe40(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%r12d
test   %r12d,%r12d
jle    1264 <main+0x124>
mov    0x8(%rsp),%r13d
movslq %r13d,%rbp
lea    0x14(%rsp),%r14
shl    $0x2,%r13
cmp    $0x1,%r12d
je     1242 <main+0x102>
mov    %r12d,%ebx
and    $0xfffffffe,%ebx
lea    0x10(%rsp),%r15
jmp    120d <main+0xcd>
nopl   0x0(%rax)
mov    0x10(%rsp),%eax
mov    %eax,0x10(%rsp,%rbp,4)
add    $0xfffffffe,%ebx
je     1242 <main+0x102>
mov    0x10(%rsp),%eax
mov    %eax,0x10(%rsp,%rbp,4)
test   %ebp,%ebp
jle    1200 <main+0xc0>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1060 <memmove@plt>
mov    0x10(%rsp),%eax
mov    %eax,0x10(%rsp,%rbp,4)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1060 <memmove@plt>
add    $0xfffffffe,%ebx
jne    120d <main+0xcd>
test   $0x1,%r12b
je     1264 <main+0x124>
mov    0x10(%rsp),%eax
mov    %eax,0x10(%rsp,%rbp,4)
test   %ebp,%ebp
jle    1264 <main+0x124>
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    %r13,%rdx
call   1060 <memmove@plt>
lea    0xdf9(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    129c <main+0x15c>
lea    0xd85(%rip),%rbx
xor    %ebp,%ebp
mov    0x10(%rsp,%rbp,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
cmp    %rax,%rbp
jl     1280 <main+0x140>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"%d\0A\00"
@str = [21 x i8] c"Enter the value of n\00"
@str.6 = [18 x i8] c"enter the numbers\00"
@str.7 = [54 x i8] c"Enter the position of the element to split the array \00"
@str.8 = [23 x i8] c"The resultant array is\00"
define void @main() {
%1 = alloca [30 x i32]
%2 = bitcast [30 x i32]* %1 to i8*
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %0, %12
%13 = phi i64 [ %16, %12 ], [ 0, %0 ]
%14 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %20
20: ; preds = %12, %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.7, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %54
25: ; preds = %20
%26 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 0
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 %28
%30 = icmp sgt i32 %27, 0
%31 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 1
%32 = bitcast i32* %31 to i8*
%33 = zext i32 %27 to i64
%34 = shl nuw nsw i64 %33, 2
%35 = and i32 %23, 1
%36 = icmp eq i32 %23, 1
br i1 %36, label %49, label %37
37: ; preds = %25
%38 = and i32 %23, -2
br label %39
39: ; preds = %46, %37
%40 = phi i32 [ 0, %37 ], [ %47, %46 ]
%41 = load i32, i32* %26
store i32 %41, i32* %29
br i1 %30, label %42, label %44
42: ; preds = %39
%43 = load i32, i32* %26
store i32 %43, i32* %29
br label %46
44: ; preds = %39
%45 = load i32, i32* %26
store i32 %45, i32* %29
br label %46
46: ; preds = %44, %42
%47 = add i32 %40, 2
%48 = icmp eq i32 %47, %38
br i1 %48, label %49, label %39
49: ; preds = %46, %25
%50 = icmp eq i32 %35, 0
br i1 %50, label %54, label %51
51: ; preds = %49
%52 = load i32, i32* %26
store i32 %52, i32* %29
br i1 %30, label %53, label %54
53: ; preds = %51
br label %54
54: ; preds = %49, %53, %51, %20
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.8, i64 0, i64 0))
%56 = load i32, i32* %3
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %67
58: ; preds = %54, %58
%59 = phi i64 [ %63, %58 ], [ 0, %54 ]
%60 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 %59
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %61)
%63 = add nuw nsw i64 %59, 1
%64 = load i32, i32* %3
%65 = sext i32 %64 to i64
%66 = icmp slt i64 %63, %65
br i1 %66, label %58, label %67
67: ; preds = %58, %54
ret void
}