int main() {
  char p[5];
  printf("Enter any 5 charectered string in the vector");
  scanf("%s", &p);
  printf("Declared array is %s%s%s%s%s", p[0], p[1], p[2], p[3], p[4]);
  p[4] = '\0';
  printf("Array p after deletinf a charechter is %s%s%s%s%s", p[0], p[1], p[2],
         p[3], p[4]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf35(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x9(%rbp),%esi
movsbl -0x8(%rbp),%edx
movsbl -0x7(%rbp),%ecx
movsbl -0x6(%rbp),%r8d
movsbl -0x5(%rbp),%r9d
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0x5(%rbp)
movsbl -0x9(%rbp),%esi
movsbl -0x8(%rbp),%edx
movsbl -0x7(%rbp),%ecx
movsbl -0x6(%rbp),%r8d
movsbl -0x5(%rbp),%r9d
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf43(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsbl 0x3(%rsp),%esi
movsbl 0x4(%rsp),%edx
movsbl 0x5(%rsp),%ecx
movsbl 0x6(%rsp),%r8d
movsbl 0x7(%rsp),%r9d
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x0,0x7(%rsp)
movsbl 0x3(%rsp),%esi
movsbl 0x4(%rsp),%edx
movsbl 0x5(%rsp),%ecx
movsbl 0x6(%rsp),%r8d
lea    0xebe(%rip),%rdi
xor    %r9d,%r9d
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Enter any 5 charectered string in the vector\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [29 x i8] c"Declared array is %s%s%s%s%s\00"
@.str.3 = [50 x i8] c"Array p after deletinf a charechter is %s%s%s%s%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [5 x i8]* %2)
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %10, i32 %13, i32 %16, i32 %19)
%21 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
store i8 0, i8* %21
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32 %27, i32 %30, i32 %33, i32 %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"Enter any 5 charectered string in the vector\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [29 x i8] c"Declared array is %s%s%s%s%s\00"
@.str.3 = [50 x i8] c"Array p after deletinf a charechter is %s%s%s%s%s\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [5 x i8]* %1)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %9, i32 %12, i32 %15, i32 %18)
store i8 0, i8* %16
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = load i8, i8* %7
%23 = sext i8 %22 to i32
%24 = load i8, i8* %10
%25 = sext i8 %24 to i32
%26 = load i8, i8* %13
%27 = sext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %23, i32 %25, i32 %27, i32 0)
ret i32 0
}