#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*/ exit(int /*<<< orphan*/);
int *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void enter(int **arr, int *size) {
  printf("\nEnter size of the array : ");
  scanf("%d", size);
  *arr = malloc(sizeof(int) * (*size));
  if (!arr) {
    printf("\nMem Allocation Failure!");
    exit(0);
  }
  printf("\nEnter Elements of the array : ");
  for (int i = 0; i < *size; i++) {
    scanf("%d", (*arr + i));
  }
}


x86 assembly (clang, -O0):
<enter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x8(%rbp)
jne    11a6 <enter+0x66>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11f4 <enter+0xb4>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe3b(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b9 <enter+0x79>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enter>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    (%r12),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,(%r14)
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,(%r12)
jle    11af <enter+0x7f>
xor    %r13d,%r13d
lea    0xe96(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14),%rsi
add    %r13,%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq (%r12),%rax
add    $0x4,%r13
cmp    %rax,%rbx
jl     1190 <enter+0x60>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\0AEnter size of the array : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"\0AMem Allocation Failure!\00"
@.str.3 = [32 x i8] c"\0AEnter Elements of the array : \00"
define void @enter(i32** %0, i32* %1) {
%3 = alloca i32**
%4 = alloca i32*
%5 = alloca i32
store i32** %0, i32*** %3
store i32* %1, i32** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = mul i64 4, %11
%13 = trunc i64 %12 to i32
%14 = call i32* @malloc(i32 %13)
%15 = load i32**, i32*** %3
store i32* %14, i32** %15
%16 = load i32**, i32*** %3
%17 = icmp ne i32** %16, null
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %23
23: ; preds = %35, %21
%24 = load i32, i32* %5
%25 = load i32*, i32** %4
%26 = load i32, i32* %25
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %38
28: ; preds = %23
%29 = load i32**, i32*** %3
%30 = load i32*, i32** %29
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %33)
br label %35
35: ; preds = %28
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %23
38: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"\0AEnter size of the array : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [32 x i8] c"\0AEnter Elements of the array : \00"
define void @enter(i32** nocapture %0, i32* %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = shl i32 %5, 2
%7 = tail call i32* @malloc(i32 %6)
store i32* %7, i32** %0
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %12, %2
ret void
12: ; preds = %2, %12
%13 = phi i64 [ %17, %12 ], [ 0, %2 ]
%14 = load i32*, i32** %0
%15 = getelementptr inbounds i32, i32* %14, i64 %13
%16 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = add nuw nsw i64 %13, 1
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %12, label %11
}