#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 *);
void main() {
  int i, n, a[100];
  printf("\n\nLeer N valores en un arreglo e imprimirlo en orden inverso:\n");
  printf("---------------------------------------------------------------------"
         "---\n");
  printf("Numero de elementos (N) :");
  scanf("%d", &n);
  printf("Ingrese %d elementos en el arreglo :\n", n);
  for (i = 0; i < n; i++) {
    printf("element - %d : ", i);
    scanf("%d", &a[i]);
  }
  printf("\nArreglo original : \n");
  for (i = 0; i < n; i++) {
    printf("% 5d", a[i]);
  }
  printf("\n\nLos valores en orden inverso son :\n");
  for (i = n - 1; i >= 0; i--) {
    printf("% 5d", a[i]);
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf47(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xf37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c6 <main+0xa6>
mov    -0x4(%rbp),%esi
lea    0xf39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x4(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xef0(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117d <main+0x5d>
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120e <main+0xee>
movslq -0x4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11db <main+0xbb>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1256 <main+0x136>
movslq -0x4(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1225 <main+0x105>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xf13(%rip),%rdi
call   1030 <puts@plt>
lea    0xf45(%rip),%rdi
call   1030 <puts@plt>
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d9 <main+0xa9>
lea    0x10(%rsp),%r12
lea    0xea9(%rip),%r14
lea    0xe79(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jl     11b0 <main+0x80>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    121c <main+0xec>
lea    0xe60(%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   1040 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     1200 <main+0xd0>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
jle    125b <main+0x12b>
add    $0x1,%rbx
lea    0xe18(%rip),%r14
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
mov    0x10(%rsp,%rax,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1240 <main+0x110>
lea    0xddf(%rip),%rdi
call   1030 <puts@plt>
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [63 x i8] c"\0A\0ALeer N valores en un arreglo e imprimirlo en orden inverso:\0A\00"
@.str.1 = [74 x i8] c"------------------------------------------------------------------------\0A\00"
@.str.2 = [26 x i8] c"Numero de elementos (N) :\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [38 x i8] c"Ingrese %d elementos en el arreglo :\0A\00"
@.str.5 = [16 x i8] c"element - %d : \00"
@.str.6 = [22 x i8] c"\0AArreglo original : \0A\00"
@.str.7 = [5 x i8] c"% 5d\00"
@.str.8 = [38 x i8] c"\0A\0ALos valores en orden inverso son :\0A\00"
@.str.9 = [3 x i8] c"\0A\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %8)
store i32 0, i32* %1
br label %10
10: ; preds = %21, %0
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %1
%23 = add nsw i32 %22, 1
store i32 %23, i32* %1
br label %10
24: ; preds = %10
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %1
br label %26
26: ; preds = %36, %24
%27 = load i32, i32* %1
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %39
30: ; preds = %26
%31 = load i32, i32* %1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %1
%38 = add nsw i32 %37, 1
store i32 %38, i32* %1
br label %26
39: ; preds = %26
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0))
%41 = load i32, i32* %2
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %1
br label %43
43: ; preds = %52, %39
%44 = load i32, i32* %1
%45 = icmp sge i32 %44, 0
br i1 %45, label %46, label %55
46: ; preds = %43
%47 = load i32, i32* %1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %46
%53 = load i32, i32* %1
%54 = add nsw i32 %53, -1
store i32 %54, i32* %1
br label %43
55: ; preds = %43
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [26 x i8] c"Numero de elementos (N) :\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [38 x i8] c"Ingrese %d elementos en el arreglo :\0A\00"
@.str.5 = [16 x i8] c"element - %d : \00"
@.str.7 = [5 x i8] c"% 5d\00"
@str = [62 x i8] c"\0A\0ALeer N valores en un arreglo e imprimirlo en orden inverso:\00"
@str.10 = [73 x i8] c"------------------------------------------------------------------------\00"
@str.11 = [21 x i8] c"\0AArreglo original : \00"
@str.12 = [37 x i8] c"\0A\0ALos valores en orden inverso son :\00"
@str.13 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %0, %13
%14 = phi i64 [ %19, %13 ], [ 0, %0 ]
%15 = trunc i64 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %14
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %17)
%19 = add nuw nsw i64 %14, 1
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %19, %21
br i1 %22, label %13, label %23
23: ; preds = %13, %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.11, i64 0, i64 0))
%25 = load i32, i32* %1
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %23, %27
%28 = phi i64 [ %32, %27 ], [ 0, %23 ]
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %30)
%32 = add nuw nsw i64 %28, 1
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %32, %34
br i1 %35, label %27, label %36
36: ; preds = %27, %23
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.12, i64 0, i64 0))
%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 [100 x i32], [100 x i32]* %2, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %47)
%49 = icmp ugt i64 %43, 1
br i1 %49, label %42, label %50
50: ; preds = %42, %36
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
ret void
}