#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 main() {
  int LA[] = {1, 3, 5, 7, 8};
  int item = 10, k = 3, n = 5;
  int i = 0, j = n;
  printf("The original array of elements are :\n");
  for (i = 0; i < n; i++) {
    printf("LA[%d] = %d \n", i, LA[i]);
  }
  n = n + 1;
  while (j >= k) {
    LA[j + 1] = LA[j];
    j = j - 1;
  }
  LA[k] = item;
  printf("The array elements after insertion:\n");
  for (i = 0; i < n; i++) {
    printf("LA[%d] = %d \n", i, LA[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0xa,-0x24(%rbp)
movl   $0x3,-0x28(%rbp)
movl   $0x5,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11a8 <main+0x98>
mov    -0x30(%rbp),%esi
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1175 <main+0x65>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jl     11df <main+0xcf>
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b1 <main+0xa1>
mov    -0x24(%rbp),%ecx
movslq -0x28(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1232 <main+0x122>
mov    -0x30(%rbp),%esi
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11ff <main+0xef>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x800000007,%rax
mov    %rax,0x8(%rsp)
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x7,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rax
mov    %rax,0xc(%rsp)
mov    0x10(%rsp),%eax
mov    %eax,0x14(%rsp)
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [14 x i8] c"LA[%d] = %d \0A\00"
@str = [37 x i8] c"The original array of elements are :\00"
@str.3 = [36 x i8] c"The array elements after insertion:\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 34359738375, i64* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 3)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 7)
%8 = getelementptr inbounds i8, i8* %2, i64 4
%9 = bitcast i8* %8 to i32*
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 8)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 3)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 5)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 10)
%16 = load i32, i32* %9
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 poison)
ret i32 0
}