#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*/ Create(int);
int /*<<< orphan*/ Delete(int);
int /*<<< orphan*/ Display();
int /*<<< orphan*/ Insert(int, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int choice, a, b, exit = 0;
  printf("\n1.Create An Array.");
  printf("\n2.Display Elements.");
  printf("\n3.Insert an Element.");
  printf("\n4.Delete an Element.");
  printf("\n5.Exit.");
  while (1) {
    printf("\nEnter your choice :");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      printf("\nEnter number of elements : ");
      scanf("%d", &a);
      Create(a);
      break;
    case 2:
      printf("\nThe Array is as follows : ");
      Display();
      break;
    case 3:
      printf("\nEnter element and position to insert: ");
      scanf("%d %d", &a, &b);
      Insert(a, b);
      break;
    case 4:
      printf("\nEnter position to delete : ");
      scanf("%d", &b);
      Delete(b);
      break;
    case 5:
      exit = 1;
      break;
    default:
      printf("\nWrong Choice.Enter again.\n");
    }
    if (exit == 1) {
      break;
    }
    getchar();
    getchar();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe87(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
lea    0xea2(%rip),%rdi
call   1050 <printf@plt>
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
call   1050 <printf@plt>
lea    0xf16(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x4,%eax
ja     12b5 <main+0x145>
mov    -0x20(%rbp),%rax
lea    0xe00(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1030 <Create@plt>
jmp    12c1 <main+0x151>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <Display@plt>
jmp    12c1 <main+0x151>
lea    0xe6d(%rip),%rdi
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1090 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <Insert@plt>
jmp    12c1 <main+0x151>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5a(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
mov    -0x10(%rbp),%edi
call   1040 <Delete@plt>
jmp    12c1 <main+0x151>
movl   $0x1,-0x14(%rbp)
jmp    12c1 <main+0x151>
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    12d0 <main+0x160>
jmp    12e3 <main+0x173>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
jmp    11c2 <main+0x52>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe7f(%rip),%rdi
call   1060 <printf@plt>
lea    0xe87(%rip),%rdi
call   1060 <printf@plt>
lea    0xe90(%rip),%rdi
call   1060 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1060 <printf@plt>
lea    0xea4(%rip),%rdi
call   1060 <printf@plt>
lea    0xea1(%rip),%r14
lea    0xf13(%rip),%rbx
lea    0x14(%rsp),%r15
lea    0xe1c(%rip),%r12
lea    0x10(%rsp),%rbp
lea    0xc(%rsp),%r13
jmp    120e <main+0x8e>
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <getchar@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     11f0 <main+0x70>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
lea    0xe48(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x10(%rsp),%edi
call   1040 <Create@plt>
jmp    1200 <main+0x80>
lea    0xe41(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
call   1090 <Display@plt>
jmp    1200 <main+0x80>
lea    0xe48(%rip),%rdi
call   1060 <printf@plt>
lea    0xe64(%rip),%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1070 <Insert@plt>
jmp    1200 <main+0x80>
lea    0xe44(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    0xc(%rsp),%edi
call   1050 <Delete@plt>
jmp    1200 <main+0x80>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0A1.Create An Array.\00"
@.str.1 = [21 x i8] c"\0A2.Display Elements.\00"
@.str.2 = [22 x i8] c"\0A3.Insert an Element.\00"
@.str.3 = [22 x i8] c"\0A4.Delete an Element.\00"
@.str.4 = [9 x i8] c"\0A5.Exit.\00"
@.str.5 = [21 x i8] c"\0AEnter your choice :\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [29 x i8] c"\0AEnter number of elements : \00"
@.str.8 = [28 x i8] c"\0AThe Array is as follows : \00"
@.str.9 = [40 x i8] c"\0AEnter element and position to insert: \00"
@.str.10 = [6 x i8] c"%d %d\00"
@.str.11 = [29 x i8] c"\0AEnter position to delete : \00"
@.str.12 = [28 x i8] c"\0AWrong Choice.Enter again.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %11
11: ; preds = %0, %41
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
switch i32 %14, label %35 [
i32 1, label %15
i32 2, label %20
i32 3, label %23
i32 4, label %29
i32 5, label %34
]
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
%19 = call i32 @Create(i32 %18)
br label %37
20: ; preds = %11
%21 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%22 = call i32 (...) @Display()
br label %37
23: ; preds = %11
%24 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%25 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32* %3, i32* %4)
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 @Insert(i32 %26, i32 %27)
br label %37
29: ; preds = %11
%30 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
%31 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%32 = load i32, i32* %4
%33 = call i32 @Delete(i32 %32)
br label %37
34: ; preds = %11
store i32 1, i32* %5
br label %37
35: ; preds = %11
%36 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0))
br label %37
37: ; preds = %35, %34, %29, %23, %20, %15
%38 = load i32, i32* %5
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %41
40: ; preds = %37
br label %44
41: ; preds = %37
%42 = call i32 (...) @getchar()
%43 = call i32 (...) @getchar()
br label %11
44: ; preds = %40
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str = [20 x i8] c"\0A1.Create An Array.\00"
@.str.1 = [21 x i8] c"\0A2.Display Elements.\00"
@.str.2 = [22 x i8] c"\0A3.Insert an Element.\00"
@.str.3 = [22 x i8] c"\0A4.Delete an Element.\00"
@.str.4 = [9 x i8] c"\0A5.Exit.\00"
@.str.5 = [21 x i8] c"\0AEnter your choice :\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [29 x i8] c"\0AEnter number of elements : \00"
@.str.8 = [28 x i8] c"\0AThe Array is as follows : \00"
@.str.9 = [40 x i8] c"\0AEnter element and position to insert: \00"
@.str.10 = [6 x i8] c"%d %d\00"
@.str.11 = [29 x i8] c"\0AEnter position to delete : \00"
@str = [27 x i8] c"\0AWrong Choice.Enter again.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %12
12: ; preds = %37, %0
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
switch i32 %15, label %35 [
i32 1, label %16
i32 2, label %21
i32 3, label %24
i32 4, label %30
i32 5, label %40
]
16: ; preds = %12
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%19 = load i32, i32* %2
%20 = call i32 @Create(i32 %19)
br label %37
21: ; preds = %12
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%23 = call i32 (...) @Display()
br label %37
24: ; preds = %12
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%26 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32* %2, i32* %3)
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = call i32 @Insert(i32 %27, i32 %28)
br label %37
30: ; preds = %12
%31 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
%32 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%33 = load i32, i32* %3
%34 = call i32 @Delete(i32 %33)
br label %37
35: ; preds = %12
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %37
37: ; preds = %16, %21, %24, %30, %35
%38 = call i32 (...) @getchar()
%39 = call i32 (...) @getchar()
br label %12
40: ; preds = %12
ret i32 0
}