#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*/ scanf(char *, int *);
int /*<<< orphan*/ shortArray(int, int *, int);
void preencheVetor(int n, int m) {
  int vet[n];
  int i = 0;
  int num = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &num);
    vet[i] = num;
  }
  shortArray(n, vet, m);
}


x86 assembly (clang, -O0):
<preencheVetor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a2 <preencheVetor+0x82>
lea    0xe83(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%edx
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116a <preencheVetor+0x4a>
mov    -0x28(%rbp),%rsi
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
call   1030 <shortArray@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<preencheVetor>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,-0x34(%rbp)
mov    %edi,%r14d
mov    %rsp,%rbx
lea    0xf(,%r14,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
movl   $0x0,-0x2c(%rbp)
mov    %edi,-0x30(%rbp)
test   %edi,%edi
jle    118b <preencheVetor+0x6b>
xor    %r15d,%r15d
lea    0xe9c(%rip),%r12
lea    -0x2c(%rbp),%r13
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,(%rbx,%r15,4)
add    $0x1,%r15
cmp    %r15,%r14
jne    1170 <preencheVetor+0x50>
mov    -0x30(%rbp),%edi
mov    %rbx,%rsi
mov    -0x34(%rbp),%edx
call   1030 <shortArray@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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