#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 /*<<< orphan*/);
void main() {
  int i, a[5], *p = a;
  void reverse(int *);
  for (i = 0; i < 5; i++) {
    printf("Enter the %d integer:", i);
    scanf("%d", p++);
  }
  printf("reverse array:\n");
  reverse(p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    118d <main+0x5d>
mov    -0x4(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <main+0x17>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <reverse@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xead(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rbx
lea    0x4(%rbx),%r12d
lea    0xea9(%rip),%r15
mov    %r15,%rdi
mov    %ebx,%esi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rbx),%ebp
mov    %r15,%rdi
mov    %r12d,%esi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rbx),%r12d
mov    %r15,%rdi
mov    %ebp,%esi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x10,%ebx
mov    %r15,%rdi
mov    %r12d,%esi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x14(%rsp),%rbp
mov    %r15,%rdi
mov    %ebx,%esi
call   1060 <scanf@plt>
lea    0xe26(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1030 <reverse@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the %d integer:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"reverse array:\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32* %4, i32** %3
store i32 0, i32* %1
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i32 1
store i32* %12, i32** %3
%13 = ptrtoint i32* %11 to i32
%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 = %8
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
br label %5
18: ; preds = %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32*, i32** %3
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter the %d integer:\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [15 x i8] c"reverse array:\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%5 = ptrtoint [5 x i32]* %1 to i64
%6 = trunc i64 %5 to i32
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%10 = ptrtoint i32* %4 to i64
%11 = trunc i64 %10 to i32
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 2)
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%15 = ptrtoint i32* %9 to i64
%16 = trunc i64 %15 to i32
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 3)
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%20 = ptrtoint i32* %14 to i64
%21 = trunc i64 %20 to i32
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 4)
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 5
%25 = ptrtoint i32* %19 to i64
%26 = trunc i64 %25 to i32
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}