#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*/ insert(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int a[10];
  int i, n, pos, x, j, z;
  printf("Enter Size Of an array: ");
  scanf("%d", &n);
  printf("Enter Elements of an array: ");
  for (i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  insert(a, n);
  printf("\nArray after Insertion of elements at 2nd & 5th Position\n");
  for (i = 0; i < n; i++) {
    printf("\t%d\t", *(a + i));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11a0 <main+0x70>
lea    -0x30(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8c(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    116b <main+0x3b>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1050 <insert@plt>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11f1 <main+0xc1>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c1 <main+0x91>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11ad <main+0x6d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe8d(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r15
cmp    %rsi,%rbx
jl     1190 <main+0x50>
lea    0x10(%rsp),%rdi
call   1060 <insert@plt>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    11fc <main+0xbc>
lea    0xe68(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11e0 <main+0xa0>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter Size Of an array: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Enter Elements of an array: \00"
@.str.3 = [58 x i8] c"\0AArray after Insertion of elements at 2nd & 5th Position\0A\00"
@.str.4 = [5 x i8] c"\09%d\09\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %11
24: ; preds = %11
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%26 = load i32, i32* %3
%27 = call i32 @insert(i32* %25, i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %29
29: ; preds = %40, %24
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %43
33: ; preds = %29
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %29
43: ; preds = %29
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter Size Of an array: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Enter Elements of an array: \00"
@.str.4 = [5 x i8] c"\09%d\09\00"
@str = [57 x i8] c"\0AArray after Insertion of elements at 2nd & 5th Position\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = phi i32 [ %8, %0 ], [ %15, %10 ]
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%21 = call i32 @insert(i32* %20, i32 %19)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %34
25: ; preds = %18, %25
%26 = phi i64 [ %30, %25 ], [ 0, %18 ]
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = add nuw nsw i64 %26, 1
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %25, label %34
34: ; preds = %25, %18
ret void
}