#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() {
  int i, n, arr[50], position;
  printf("Enter the size of array\n");
  scanf("%d", &n);
  printf("Enter the elements of array\n");
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  printf("Enter the location of an element you wish to delete\n");
  scanf("%d", &position);
  if (position >= n + 1)
    printf("Deletion not possible.\n");
  else {
    for (i = position - 1; i < n - 1; i++)
      arr[i] = arr[i + 1];
    printf("Resultant array is\n");
    for (i = 0; i < n - 1; i++) {
      printf("%d", arr[i]);
      if (i < n - 1)
        printf(",");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119d <main+0x7d>
movslq -0x8(%rbp),%rax
lea    -0xe0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <main+0x45>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe67(%rip),%rdi
lea    -0xe4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xe4(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jl     11e5 <main+0xc5>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a0 <main+0x180>
mov    -0xe4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    122a <main+0x10a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0xe0(%rbp,%rax,4),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0xe0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f1 <main+0xd1>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    129b <main+0x17b>
movslq -0x8(%rbp),%rax
mov    -0xe0(%rbp,%rax,4),%esi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1288 <main+0x168>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128d <main+0x16d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    123f <main+0x11f>
jmp    12a0 <main+0x180>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xe0,%rsp
lea    0xeb0(%rip),%rdi
call   1040 <puts@plt>
lea    0xea1(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0x8(%rsp)
jle    11ad <main+0x6d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe76(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1190 <main+0x50>
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
lea    0xe40(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%eax
cmp    %eax,%esi
jle    11e7 <main+0xa7>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
jmp    131a <main+0x1da>
jge    12b3 <main+0x173>
add    $0xffffffff,%eax
lea    -0x1(%rsi),%ecx
movslq %ecx,%rcx
cmp    %eax,%esi
cmovg  %esi,%eax
mov    %eax,%edx
sub    %esi,%edx
cmp    $0x7,%edx
jb     12a0 <main+0x160>
add    $0x1,%rdx
mov    %rdx,%r8
and    $0xfffffffffffffff8,%r8
lea    -0x8(%r8),%rsi
mov    %rsi,%r9
shr    $0x3,%r9
add    $0x1,%r9
test   %rsi,%rsi
je     1329 <main+0x1e9>
mov    %r9,%rdi
and    $0xfffffffffffffffe,%rdi
lea    (%rsp,%rcx,4),%rsi
add    $0x44,%rsi
xor    %ebx,%ebx
nopl   0x0(%rax)
movups -0x30(%rsi,%rbx,4),%xmm0
movups -0x20(%rsi,%rbx,4),%xmm1
movups -0x10(%rsi,%rbx,4),%xmm2
movups (%rsi,%rbx,4),%xmm3
movups %xmm0,-0x34(%rsi,%rbx,4)
movups %xmm1,-0x24(%rsi,%rbx,4)
movups %xmm2,-0x14(%rsi,%rbx,4)
movups %xmm3,-0x4(%rsi,%rbx,4)
add    $0x10,%rbx
add    $0xfffffffffffffffe,%rdi
jne    1240 <main+0x100>
test   $0x1,%r9b
je     128e <main+0x14e>
add    %rcx,%rbx
movups 0x14(%rsp,%rbx,4),%xmm0
movups 0x24(%rsp,%rbx,4),%xmm1
movups %xmm0,0x10(%rsp,%rbx,4)
movups %xmm1,0x20(%rsp,%rbx,4)
cmp    %r8,%rdx
je     12b3 <main+0x173>
add    %r8,%rcx
cs nopw 0x0(%rax,%rax,1)
mov    0x14(%rsp,%rcx,4),%edx
mov    %edx,0x10(%rsp,%rcx,4)
lea    0x1(%rcx),%rdx
mov    %rdx,%rcx
cmp    %edx,%eax
jne    12a0 <main+0x160>
lea    0xdb1(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x2,0x8(%rsp)
jl     131a <main+0x1da>
lea    0xd33(%rip),%r14
xor    %ebx,%ebx
jmp    12e9 <main+0x1a9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rax,%rbx
jge    131a <main+0x1da>
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x8(%rsp),%rax
add    $0xffffffffffffffff,%rax
cmp    %rax,%rbx
jge    12e0 <main+0x1a0>
mov    $0x2c,%edi
call   1030 <putchar@plt>
movslq 0x8(%rsp),%rax
add    $0xffffffffffffffff,%rax
jmp    12e0 <main+0x1a0>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
test   $0x1,%r9b
jne    1277 <main+0x137>
jmp    128e <main+0x14e>

LLVM IR (-O0):
@.str = [25 x i8] c"Enter the size of array\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Enter the elements of array\0A\00"
@.str.3 = [53 x i8] c"Enter the location of an element you wish to delete\0A\00"
@.str.4 = [24 x i8] c"Deletion not possible.\0A\00"
@.str.5 = [20 x i8] c"Resultant array is\0A\00"
@.str.6 = [2 x i8] c",\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [50 x i32]
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 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 ([29 x i8], [29 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 [50 x i32], [50 x i32]* %4, 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 ([53 x i8], [53 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* %5)
%24 = load i32, i32* %5
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
%27 = icmp sge i32 %24, %26
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %74
30: ; preds = %21
%31 = load i32, i32* %5
%32 = sub nsw i32 %31, 1
store i32 %32, i32* %2
br label %33
33: ; preds = %47, %30
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = sub nsw i32 %35, 1
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %50
38: ; preds = %33
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [50 x i32], [50 x i32]* %4, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [50 x i32], [50 x i32]* %4, i64 0, i64 %45
store i32 %43, i32* %46
br label %47
47: ; preds = %38
%48 = load i32, i32* %2
%49 = add nsw i32 %48, 1
store i32 %49, i32* %2
br label %33
50: ; preds = %33
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %2
br label %52
52: ; preds = %70, %50
%53 = load i32, i32* %2
%54 = load i32, i32* %3
%55 = sub nsw i32 %54, 1
%56 = icmp slt i32 %53, %55
br i1 %56, label %57, label %73
57: ; preds = %52
%58 = load i32, i32* %2
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [50 x i32], [50 x i32]* %4, i64 0, i64 %59
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %2
%64 = load i32, i32* %3
%65 = sub nsw i32 %64, 1
%66 = icmp slt i32 %63, %65
br i1 %66, label %67, label %69
67: ; preds = %57
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %69
69: ; preds = %67, %57
br label %70
70: ; preds = %69
%71 = load i32, i32* %2
%72 = add nsw i32 %71, 1
store i32 %72, i32* %2
br label %52
73: ; preds = %52
br label %74
74: ; preds = %73, %28
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [24 x i8] c"Enter the size of array\00"
@str.7 = [28 x i8] c"Enter the elements of array\00"
@str.8 = [52 x i8] c"Enter the location of an element you wish to delete\00"
@str.9 = [19 x i8] c"Resultant array is\00"
@str.10 = [23 x i8] c"Deletion not possible.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i32]
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast [50 x i32]* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 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* %1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
%10 = load i32, i32* %1
%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 [50 x i32], [50 x i32]* %2, 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* %1
%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 ([52 x i8], [52 x i8]* @str.8, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%23 = load i32, i32* %3
%24 = load i32, i32* %1
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.10, i64 0, i64 0))
br label %130
28: ; preds = %20
%29 = icmp slt i32 %23, %24
br i1 %29, label %30, label %108
30: ; preds = %28
%31 = add nsw i32 %24, -1
%32 = add i32 %23, -1
%33 = sext i32 %32 to i64
%34 = call i32 @llvm.smax.i32(i32 %23, i32 %31)
%35 = sub i32 %34, %23
%36 = zext i32 %35 to i64
%37 = add nuw nsw i64 %36, 1
%38 = icmp ult i32 %35, 7
br i1 %38, label %98, label %39
39: ; preds = %30
%40 = and i64 %37, 8589934584
%41 = add nsw i64 %40, %33
%42 = add nsw i64 %40, -8
%43 = lshr exact i64 %42, 3
%44 = add nuw nsw i64 %43, 1
%45 = and i64 %44, 1
%46 = icmp eq i64 %42, 0
br i1 %46, label %80, label %47
47: ; preds = %39
%48 = and i64 %44, 4611686018427387902
br label %49
49: ; preds = %49, %47
%50 = phi i64 [ 0, %47 ], [ %77, %49 ]
%51 = phi i64 [ 0, %47 ], [ %78, %49 ]
%52 = add i64 %50, %33
%53 = add nsw i64 %52, 1
%54 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %53
%55 = bitcast i32* %54 to <4 x i32>*
%56 = load <4 x i32>, <4 x i32>* %55
%57 = getelementptr inbounds i32, i32* %54, i64 4
%58 = bitcast i32* %57 to <4 x i32>*
%59 = load <4 x i32>, <4 x i32>* %58
%60 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %52
%61 = bitcast i32* %60 to <4 x i32>*
store <4 x i32> %56, <4 x i32>* %61
%62 = getelementptr inbounds i32, i32* %60, i64 4
%63 = bitcast i32* %62 to <4 x i32>*
store <4 x i32> %59, <4 x i32>* %63
%64 = or i64 %50, 8
%65 = add i64 %64, %33
%66 = add nsw i64 %65, 1
%67 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %66
%68 = bitcast i32* %67 to <4 x i32>*
%69 = load <4 x i32>, <4 x i32>* %68
%70 = getelementptr inbounds i32, i32* %67, i64 4
%71 = bitcast i32* %70 to <4 x i32>*
%72 = load <4 x i32>, <4 x i32>* %71
%73 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %65
%74 = bitcast i32* %73 to <4 x i32>*
store <4 x i32> %69, <4 x i32>* %74
%75 = getelementptr inbounds i32, i32* %73, i64 4
%76 = bitcast i32* %75 to <4 x i32>*
store <4 x i32> %72, <4 x i32>* %76
%77 = add nuw i64 %50, 16
%78 = add i64 %51, 2
%79 = icmp eq i64 %78, %48
br i1 %79, label %80, label %49
80: ; preds = %49, %39
%81 = phi i64 [ 0, %39 ], [ %77, %49 ]
%82 = icmp eq i64 %45, 0
br i1 %82, label %96, label %83
83: ; preds = %80
%84 = add i64 %81, %33
%85 = add nsw i64 %84, 1
%86 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %85
%87 = bitcast i32* %86 to <4 x i32>*
%88 = load <4 x i32>, <4 x i32>* %87
%89 = getelementptr inbounds i32, i32* %86, i64 4
%90 = bitcast i32* %89 to <4 x i32>*
%91 = load <4 x i32>, <4 x i32>* %90
%92 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %84
%93 = bitcast i32* %92 to <4 x i32>*
store <4 x i32> %88, <4 x i32>* %93
%94 = getelementptr inbounds i32, i32* %92, i64 4
%95 = bitcast i32* %94 to <4 x i32>*
store <4 x i32> %91, <4 x i32>* %95
br label %96
96: ; preds = %80, %83
%97 = icmp eq i64 %37, %40
br i1 %97, label %108, label %98
98: ; preds = %30, %96
%99 = phi i64 [ %33, %30 ], [ %41, %96 ]
br label %100
100: ; preds = %98, %100
%101 = phi i64 [ %102, %100 ], [ %99, %98 ]
%102 = add nsw i64 %101, 1
%103 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %102
%104 = load i32, i32* %103
%105 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %101
store i32 %104, i32* %105
%106 = trunc i64 %102 to i32
%107 = icmp eq i32 %34, %106
br i1 %107, label %108, label %100
108: ; preds = %100, %96, %28
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
%110 = load i32, i32* %1
%111 = icmp sgt i32 %110, 1
br i1 %111, label %112, label %130
112: ; preds = %108, %126
%113 = phi i64 [ %128, %126 ], [ 0, %108 ]
%114 = getelementptr inbounds [50 x i32], [50 x i32]* %2, i64 0, i64 %113
%115 = load i32, i32* %114
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %1
%118 = add nsw i32 %117, -1
%119 = sext i32 %118 to i64
%120 = icmp slt i64 %113, %119
br i1 %120, label %121, label %126
121: ; preds = %112
%122 = call i32 @putchar(i32 44)
%123 = load i32, i32* %1
%124 = add nsw i32 %123, -1
%125 = sext i32 %124 to i64
br label %126
126: ; preds = %112, %121
%127 = phi i64 [ %119, %112 ], [ %125, %121 ]
%128 = add nuw nsw i64 %113, 1
%129 = icmp slt i64 %128, %127
br i1 %129, label %112, label %130
130: ; preds = %126, %108, %26
ret i32 0
}