#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 /*<<< orphan*/ scanf(char *, int *);
main() {
  int numero[21], i = 0, fim = 0;
  do {
    i++;
    if (i <= 20) {
      printf("Digite uma seguencia de numeros: ");
      scanf("%d", &numero[i]);
      if (numero[i] == 0) {
        i--;
        fim = 1;
      }
    } else {
      printf("\nLimite maximo atingido!\n");
      i--;
      fim = 1;
    }
  } while (fim == 0);
  printf("\n-- Invertido --\n");
  do {
    printf("%d\n", numero[i]);
    i--;
  } while (i >= 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x14,-0x64(%rbp)
jg     119d <main+0x7d>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x64(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeae(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x64(%rbp),%rax
cmpl   $0x0,-0x60(%rbp,%rax,4)
jne    1198 <main+0x78>
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
movl   $0x1,-0x68(%rbp)
jmp    11bb <main+0x9b>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
movl   $0x1,-0x68(%rbp)
jmp    11c0 <main+0xa0>
cmpl   $0x0,-0x68(%rbp)
je     113d <main+0x1d>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
cmpl   $0x1,-0x64(%rbp)
jge    11d8 <main+0xb8>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    $0x1,%eax
mov    $0x4,%r12d
lea    0xeb3(%rip),%r14
lea    0xece(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rbx
add    $0xffffffff,%eax
cmp    $0x14,%eax
jae    1191 <main+0x61>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rsp,%r12,1),%rsi
mov    %r15,%rdi
call   1050 <scanf@plt>
lea    0x1(%rbx),%rax
add    $0x4,%r12
cmpl   $0x0,(%rsp,%rbx,4)
jne    1160 <main+0x30>
jmp    119d <main+0x6d>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%r14
mov    -0x4(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
jg     11b0 <main+0x80>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Digite uma seguencia de numeros: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"\0ALimite maximo atingido!\0A\00"
@.str.3 = [18 x i8] c"\0A-- Invertido --\0A\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %30, %0
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 20
br i1 %9, label %10, label %25
10: ; preds = %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [21 x i32], [21 x i32]* %2, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [21 x i32], [21 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %10
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
store i32 1, i32* %4
br label %24
24: ; preds = %21, %10
br label %29
25: ; preds = %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* %3
%28 = add nsw i32 %27, -1
store i32 %28, i32* %3
store i32 1, i32* %4
br label %29
29: ; preds = %25, %24
br label %30
30: ; preds = %29
%31 = load i32, i32* %4
%32 = icmp eq i32 %31, 0
br i1 %32, label %5, label %33
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %43, %33
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [21 x i32], [21 x i32]* %2, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %3
%42 = add nsw i32 %41, -1
store i32 %42, i32* %3
br label %43
43: ; preds = %35
%44 = load i32, i32* %3
%45 = icmp sge i32 %44, 1
br i1 %45, label %35, label %46
46: ; preds = %43
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [34 x i8] c"Digite uma seguencia de numeros: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@str = [25 x i8] c"\0ALimite maximo atingido!\00"
@str.5 = [17 x i8] c"\0A-- Invertido --\00"
define i32 @main() {
%1 = alloca [21 x i32]
%2 = bitcast [21 x i32]* %1 to i8*
br label %3
3: ; preds = %9, %0
%4 = phi i32 [ 0, %0 ], [ %5, %9 ]
%5 = add nuw nsw i32 %4, 1
%6 = icmp ult i32 %4, 20
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %16
9: ; preds = %3
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%11 = zext i32 %5 to i64
%12 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %12
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %3
16: ; preds = %9, %7
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.5, i64 0, i64 0))
%18 = zext i32 %4 to i64
br label %19
19: ; preds = %19, %16
%20 = phi i64 [ %24, %19 ], [ %18, %16 ]
%21 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%24 = add nsw i64 %20, -1
%25 = icmp sgt i64 %20, 1
br i1 %25, label %19, label %26
26: ; preds = %19
ret i32 0
}