#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 input[5], i, tmp, count, j;
  printf("How many number would you like to input? \n> ");
  scanf("%d", &count);
  printf("Enter the number: \n");
  for (i = 0; i < count; i++) {
    printf("> ");
    scanf("%d", &input[i]);
  }
  j = i - 1;
  i = 0;
  while (i < j) {
    tmp = input[i];
    input[i] = input[j];
    input[j] = tmp;
    i++;
    j--;
  }
  printf("The reserved number is: \n");
  for (size_t i = 0; i < count; i++) {
    printf(">> %d\n", input[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11a5 <main+0x85>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe9b(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1162 <main+0x42>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    11fe <main+0xde>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x28(%rbp)
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x28(%rbp),%ecx
movslq -0x30(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    11b5 <main+0x95>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cmp    %rcx,%rax
jae    124c <main+0x12c>
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1214 <main+0xf4>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    11f0 <main+0xc0>
lea    0x10(%rsp),%r12
lea    0xead(%rip),%r14
lea    0xea9(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
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     1190 <main+0x60>
cmp    $0x2,%ebx
jl     11f0 <main+0xc0>
add    $0xfffffffffffffffe,%rbx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x10(%rsp,%rax,4),%ecx
mov    0x14(%rsp,%rbx,4),%edx
mov    %edx,0x10(%rsp,%rax,4)
mov    %ecx,0x14(%rsp,%rbx,4)
add    $0x1,%rax
lea    -0x1(%rbx),%rcx
cmp    %rbx,%rax
mov    %rcx,%rbx
jl     11d0 <main+0xa0>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
je     122c <main+0xfc>
lea    0xe26(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
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
jb     1210 <main+0xe0>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"How many number would you like to input? \0A> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Enter the number: \0A\00"
@.str.3 = [3 x i8] c"> \00"
@.str.4 = [26 x i8] c"The reserved number is: \0A\00"
@.str.5 = [7 x i8] c">> %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 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* %5)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %11
24: ; preds = %11
%25 = load i32, i32* %3
%26 = sub nsw i32 %25, 1
store i32 %26, i32* %6
store i32 0, i32* %3
br label %27
27: ; preds = %31, %24
%28 = load i32, i32* %3
%29 = load i32, i32* %6
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %51
31: ; preds = %27
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %33
%35 = load i32, i32* %34
store i32 %35, i32* %4
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %41
store i32 %39, i32* %42
%43 = load i32, i32* %4
%44 = load i32, i32* %6
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %45
store i32 %43, i32* %46
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
%49 = load i32, i32* %6
%50 = add nsw i32 %49, -1
store i32 %50, i32* %6
br label %27
51: ; preds = %27
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
store i64 0, i64* %7
br label %53
53: ; preds = %63, %51
%54 = load i64, i64* %7
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = icmp ult i64 %54, %56
br i1 %57, label %58, label %66
58: ; preds = %53
%59 = load i64, i64* %7
%60 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %59
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %58
%64 = load i64, i64* %7
%65 = add i64 %64, 1
store i64 %65, i64* %7
br label %53
66: ; preds = %53
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"How many number would you like to input? \0A> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"> \00"
@.str.5 = [7 x i8] c">> %d\0A\00"
@str = [19 x i8] c"Enter the number: \00"
@str.6 = [25 x i8] c"The reserved number is: \00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 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* %2)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %16, label %35
10: ; preds = %16
%11 = trunc i64 %21 to i32
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = and i64 %21, 4294967295
%15 = add nsw i64 %14, -1
br label %25
16: ; preds = %0, %16
%17 = phi i64 [ %21, %16 ], [ 0, %0 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %17
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = add nuw nsw i64 %17, 1
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %16, label %10
25: ; preds = %13, %25
%26 = phi i64 [ 0, %13 ], [ %32, %25 ]
%27 = phi i64 [ %15, %13 ], [ %33, %25 ]
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %26
%29 = load i32, i32* %28
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %27
%31 = load i32, i32* %30
store i32 %31, i32* %28
store i32 %29, i32* %30
%32 = add nuw nsw i64 %26, 1
%33 = add nsw i64 %27, -1
%34 = icmp slt i64 %32, %33
br i1 %34, label %25, label %35
35: ; preds = %25, %0, %10
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0))
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %40, %35
ret i32 0
40: ; preds = %35, %40
%41 = phi i64 [ %45, %40 ], [ 0, %35 ]
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %43)
%45 = add nuw i64 %41, 1
%46 = load i32, i32* %2
%47 = sext i32 %46 to i64
%48 = icmp ult i64 %45, %47
br i1 %48, label %40, label %39
}