#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);
int /*<<< orphan*/ scanf(char *, int *);
void fill_array(int *p, int size) {
  int max_size = 100;
  ;
  if (size <= max_size) {
    int n;
    for (int i = 0; i < size; i++) {
      printf("[%d]: ", i + 1);
      scanf("%d", &n);
      p[i] = n;
    }
  }
}


x86 assembly (clang, -O0):
<fill_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x64,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1198 <fill_array+0x78>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1193 <fill_array+0x73>
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <fill_array+0x29>
jmp    1198 <fill_array+0x78>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_array>:
cmp    $0x64,%esi
jg     118d <fill_array+0x6d>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    117f <fill_array+0x5f>
mov    %rdi,%r13
mov    %esi,%ebp
xor    %ebx,%ebx
lea    0xec5(%rip),%r15
lea    0x4(%rsp),%r12
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%r14
lea    0xea5(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,0x0(%r13,%rbx,4)
mov    %r14,%rbx
cmp    %r14,%rbp
jne    1150 <fill_array+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"[%d]: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @fill_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 100, i32* %5
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %30
11: ; preds = %2
store i32 0, i32* %7
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %7
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%21 = load i32, i32* %6
%22 = load i32*, i32** %3
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
br label %26
26: ; preds = %16
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %12
29: ; preds = %12
br label %30
30: ; preds = %29, %2
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"[%d]: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @fill_array(i32* nocapture writeonly %0, i32 %1) {
%3 = alloca i32
%4 = icmp slt i32 %1, 101
br i1 %4, label %5, label %20
5: ; preds = %2
%6 = bitcast i32* %3 to i8*
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = zext i32 %1 to i64
br label %11
10: ; preds = %11, %5
br label %20
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %13, %11 ]
%13 = add nuw nsw i64 %12, 1
%14 = trunc i64 %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = getelementptr inbounds i32, i32* %0, i64 %12
store i32 %17, i32* %18
%19 = icmp eq i64 %13, %9
br i1 %19, label %10, label %11
20: ; preds = %10, %2
ret void
}