#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 *);
int main() {
  int i, cant, num;
pregunta:
  printf("¿Cuántos valores desea que el programa lea?: ");
  scanf("%d", &cant);
  printf("\n");
  if (cant == 0) {
    printf("¿Usted no quiere introducir ningún elemento?.\n");
    printf("\n");
    goto pregunta;
  } else {
    int valor[cant];
    for (i = 0; i <= cant - 1; i++) {
      printf("Introduzca el valor número %d: ", i + 1);
      scanf("%d", &num);
      valor[i] = num;
    }
    printf("\n");
    for (i = cant - 1; i >= 0; i--) {
      printf("%d\t", valor[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1186 <main+0x66>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1205 <main+0xe5>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%edx
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b4 <main+0x94>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     124d <main+0x12d>
mov    -0x28(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    121c <main+0xfc>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jne    11d8 <main+0x98>
lea    0xed1(%rip),%r14
lea    0xe72(%rip),%r15
lea    0xe9b(%rip),%r12
lea    -0x2c(%rbp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
je     11a0 <main+0x60>
mov    %rsp,-0x38(%rbp)
mov    %eax,%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    1244 <main+0x104>
lea    0xe30(%rip),%r15
lea    -0x30(%rbp),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rbx),%r14
lea    0xe18(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,0x0(%r13,%rbx,4)
movslq -0x2c(%rbp),%rax
mov    %r14,%rbx
cmp    %rax,%r14
jl     1210 <main+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%ebx
test   %ebx,%ebx
jle    127c <main+0x13c>
add    $0x1,%rbx
lea    0xdf4(%rip),%r14
lea    -0x2(%rbx),%eax
mov    0x0(%r13,%rax,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1260 <main+0x120>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [48 x i8] c"\C2\BFCu\C3\A1ntos valores desea que el programa lea?: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [49 x i8] c"\C2\BFUsted no quiere introducir ning\C3\BAn elemento?.\0A\00"
@.str.4 = [33 x i8] c"Introduzca el valor n\C3\BAmero %d: \00"
@.str.5 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 0, i32* %1
br label %7
7: ; preds = %13, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %7
16: ; preds = %7
%17 = load i32, i32* %3
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %5
%20 = alloca i32, i64 %18
store i64 %18, i64* %6
store i32 0, i32* %2
br label %21
21: ; preds = %35, %16
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 1
%25 = icmp sle i32 %22, %24
br i1 %25, label %26, label %38
26: ; preds = %21
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%31 = load i32, i32* %4
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %20, i64 %33
store i32 %31, i32* %34
br label %35
35: ; preds = %26
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %21
38: ; preds = %21
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = load i32, i32* %3
%41 = sub nsw i32 %40, 1
store i32 %41, i32* %2
br label %42
42: ; preds = %51, %38
%43 = load i32, i32* %2
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = load i32, i32* %2
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %20, i64 %47
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %45
%52 = load i32, i32* %2
%53 = add nsw i32 %52, -1
store i32 %53, i32* %2
br label %42
54: ; preds = %42
%55 = load i8*, i8** %5
br label %56
56: ; preds = %54
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"\C2\BFCu\C3\A1ntos valores desea que el programa lea?: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [33 x i8] c"Introduzca el valor n\C3\BAmero %d: \00"
@.str.5 = [4 x i8] c"%d\09\00"
@str = [48 x i8] c"\C2\BFUsted no quiere introducir ning\C3\BAn elemento?.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 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* %1)
%7 = call i32 @putchar(i32 10)
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %0, %10
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%12 = call i32 @putchar(i32 10)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%15 = call i32 @putchar(i32 10)
%16 = load i32, i32* %1
%17 = icmp eq i32 %16, 0
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = phi i32 [ %8, %0 ], [ %16, %10 ]
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
%22 = alloca i32, i64 %20
%23 = load i32, i32* %1
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %18, %25
%26 = phi i64 [ %27, %25 ], [ 0, %18 ]
%27 = add nuw nsw i64 %26, 1
%28 = trunc i64 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%31 = load i32, i32* %2
%32 = getelementptr inbounds i32, i32* %22, i64 %26
store i32 %31, i32* %32
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %27, %34
br i1 %35, label %25, label %36
36: ; preds = %25, %18
%37 = call i32 @putchar(i32 10)
%38 = load i32, i32* %1
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = zext i32 %38 to i64
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ %41, %40 ], [ %44, %42 ]
%44 = add nsw i64 %43, -1
%45 = and i64 %44, 4294967295
%46 = getelementptr inbounds i32, i32* %22, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = icmp ugt i64 %43, 1
br i1 %49, label %42, label %50
50: ; preds = %42, %36
ret i32 0
}