#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 maximoVETOR(int *, int);
int minimoVETOR(int *, int);
int /*<<< orphan*/ printf(char *, ...);
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);
  printf("Maximo elemento: %d\n", maximoVETOR(vetor, n));
  printf("Minimo elemento: %d\n", minimoVETOR(vetor, n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x154(%rbp)
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x154(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x154(%rbp)
mov    %al,-0x155(%rbp)
jl     11b2 <main+0x62>
cmpl   $0x50,-0x154(%rbp)
setge  %al
mov    %al,-0x155(%rbp)
mov    -0x155(%rbp),%al
test   $0x1,%al
jne    116c <main+0x1c>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
call   1050 <leVETOR@plt>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
call   1060 <maximoVETOR@plt>
mov    %eax,%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
call   1030 <minimoVETOR@plt>
mov    %eax,%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <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    0xe95(%rip),%r14
lea    0xeb0(%rip),%r15
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
lea    -0x50(%rsi),%eax
cmp    $0xffffffb1,%eax
jb     1180 <main+0x30>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <leVETOR@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <maximoVETOR@plt>
lea    0xe64(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <minimoVETOR@plt>
lea    0xe5d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <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 = [21 x i8] c"Maximo elemento: %d\0A\00"
@.str.3 = [21 x i8] c"Minimo elemento: %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 @maximoVETOR(i32* %19, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds [80 x i32], [80 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %3
%25 = call i32 @minimoVETOR(i32* %23, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %25)
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 = [21 x i8] c"Maximo elemento: %d\0A\00"
@.str.3 = [21 x i8] c"Minimo elemento: %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 @maximoVETOR(i32* %12, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @minimoVETOR(i32* %12, i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %18)
ret i32 0
}