#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*/ leVETOR(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ quadradoVETOR(int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int vetor[80], n = 0;
  do {
    printf("Introduza o n de inteiros a ler: ");
    scanf("%d", &n);
  } while (n < 1 || n >= 80);
  leVETOR(vetor, n);
  quadradoVETOR(vetor, n);
  printf("%d\n", vetor[n - 1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x154(%rbp)
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x154(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x154(%rbp)
mov    %al,-0x155(%rbp)
jl     11a2 <main+0x62>
cmpl   $0x50,-0x154(%rbp)
setge  %al
mov    %al,-0x155(%rbp)
mov    -0x155(%rbp),%al
test   $0x1,%al
jne    115c <main+0x1c>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
call   1040 <leVETOR@plt>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
call   1050 <quadradoVETOR@plt>
mov    -0x154(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x150(%rbp,%rax,4),%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x150,%rsp
movl   $0x0,0xc(%rsp)
lea    0xea5(%rip),%r14
lea    0xec0(%rip),%r15
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%esi
lea    -0x50(%rsi),%eax
cmp    $0xffffffb1,%eax
jb     1170 <main+0x30>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <leVETOR@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <quadradoVETOR@plt>
movslq 0xc(%rsp),%rax
mov    0xc(%rsp,%rax,4),%esi
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Introduza o n de inteiros a ler: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %13, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %7
7: ; preds = %4
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 1
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 80
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br i1 %14, label %4, label %15
15: ; preds = %13
%16 = getelementptr inbounds [80 x i32], [80 x i32]* %2, i64 0, i64 0
%17 = load i32, i32* %3
%18 = call i32 @leVETOR(i32* %16, i32 %17)
%19 = getelementptr inbounds [80 x i32], [80 x i32]* %2, i64 0, i64 0
%20 = load i32, i32* %3
%21 = call i32 @quadradoVETOR(i32* %19, i32 %20)
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [80 x i32], [80 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Introduza o n de inteiros a ler: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [80 x i32]
%2 = alloca i32
%3 = bitcast [80 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %5, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = add i32 %8, -80
%10 = icmp ult i32 %9, -79
br i1 %10, label %5, label %11
11: ; preds = %5
%12 = getelementptr inbounds [80 x i32], [80 x i32]* %1, i64 0, i64 0
%13 = call i32 @leVETOR(i32* %12, i32 %8)
%14 = load i32, i32* %2
%15 = call i32 @quadradoVETOR(i32* %12, i32 %14)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [80 x i32], [80 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
ret i32 0
}