#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(void) {
  int a[10];
  int *p;
  int i;
  printf("enter %d numbers: ", 10);
  for (p = a; p < a + 10; p++) {
    scanf("%d", p);
  }
  printf("In reverse order: \n");
  for (p = a + 10 - 1; p >= a; p--) {
    printf("%d\n", *p);
  }
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
add    $0x28,%rcx
cmp    %rcx,%rax
jae    1180 <main+0x60>
mov    -0x38(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    114a <main+0x2a>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
add    $0x28,%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
cmp    %rcx,%rax
jb     11d4 <main+0xb4>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x38(%rbp)
jmp    119e <main+0x7e>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xec0(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
lea    0x28(%rsp),%r15
lea    0xeb8(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x4,%rbx
cmp    %r15,%rbx
jb     1160 <main+0x30>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
lea    0x24(%rsp),%rbx
lea    0xe8a(%rip),%r14
mov    %rsp,%r15
nop
mov    (%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xfffffffffffffffc,%rbx
cmp    %r15,%rbx
jae    1190 <main+0x60>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"enter %d numbers: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"In reverse order: \0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 10)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %6, i32** %3
br label %7
7: ; preds = %15, %0
%8 = load i32*, i32** %3
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%10 = getelementptr inbounds i32, i32* %9, i64 10
%11 = icmp ult i32* %8, %10
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = load i32*, i32** %3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
br label %15
15: ; preds = %12
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %3
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%21 = getelementptr inbounds i32, i32* %20, i64 10
%22 = getelementptr inbounds i32, i32* %21, i64 -1
store i32* %22, i32** %3
br label %23
23: ; preds = %31, %18
%24 = load i32*, i32** %3
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%26 = icmp uge i32* %24, %25
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i32*, i32** %3
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %27
%32 = load i32*, i32** %3
%33 = getelementptr inbounds i32, i32* %32, i32 -1
store i32* %33, i32** %3
br label %23
34: ; preds = %23
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"enter %d numbers: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [19 x i8] c"In reverse order: \00"
@str.5 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 10
br label %6
6: ; preds = %0, %6
%7 = phi i32* [ %4, %0 ], [ %9, %6 ]
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = icmp ult i32* %9, %5
br i1 %10, label %6, label %11
11: ; preds = %6
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
br label %14
14: ; preds = %11, %14
%15 = phi i32* [ %13, %11 ], [ %18, %14 ]
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds i32, i32* %15, i64 -1
%19 = icmp ult i32* %18, %4
br i1 %19, label %20, label %14
20: ; preds = %14
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}