#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*/ inverteVETOR(int *, int);
int /*<<< orphan*/ leVETOR(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int vetor[80], n = 0, c;
  do {
    printf("Introduza o n de inteiros a ler: ");
    scanf("%d", &n);
  } while (n < 1 || n >= 80);
  leVETOR(vetor, n);
  inverteVETOR(vetor, n);
  printf("%d\n\n", n / 2);
  for (c = 0; c < n; ++c)
    printf("%d\n", vetor[c]);
  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,-0x159(%rbp)
jl     11a2 <main+0x62>
cmpl   $0x50,-0x154(%rbp)
setge  %al
mov    %al,-0x159(%rbp)
mov    -0x159(%rbp),%al
test   $0x1,%al
jne    115c <main+0x1c>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
call   1050 <leVETOR@plt>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
call   1040 <inverteVETOR@plt>
mov    -0x154(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x158(%rbp)
mov    -0x158(%rbp),%eax
cmp    -0x154(%rbp),%eax
jge    123e <main+0xfe>
movslq -0x158(%rbp),%rax
mov    -0x150(%rbp,%rax,4),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    11fc <main+0xbc>
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   1050 <leVETOR@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <inverteVETOR@plt>
mov    0xc(%rsp),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11fc <main+0xbc>
lea    0xe57(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11e0 <main+0xa0>
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 = [5 x i8] c"%d\0A\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %14, %0
%6 = call i32 (i8*, ...) @printf(i8* 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* %3)
br label %8
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 1
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 80
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ true, %8 ], [ %13, %11 ]
br i1 %15, label %5, label %16
16: ; preds = %14
%17 = getelementptr inbounds [80 x i32], [80 x i32]* %2, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 @leVETOR(i32* %17, i32 %18)
%20 = getelementptr inbounds [80 x i32], [80 x i32]* %2, i64 0, i64 0
%21 = load i32, i32* %3
%22 = call i32 @inverteVETOR(i32* %20, i32 %21)
%23 = load i32, i32* %3
%24 = sdiv i32 %23, 2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %24)
store i32 0, i32* %4
br label %26
26: ; preds = %36, %16
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %39
30: ; preds = %26
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [80 x i32], [80 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %26
39: ; preds = %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 = [5 x i8] c"%d\0A\0A\00"
@.str.3 = [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 @inverteVETOR(i32* %12, i32 %14)
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 2
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %2
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %11, %21
%22 = phi i64 [ %26, %21 ], [ 0, %11 ]
%23 = getelementptr inbounds [80 x i32], [80 x i32]* %1, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = add nuw nsw i64 %22, 1
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = icmp slt i64 %26, %28
br i1 %29, label %21, label %30
30: ; preds = %21, %11
ret i32 0
}