#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 iaArr[10], iLen, i, iTemp;
  int *iptr1, *iptr2;
  printf("\nEnter the no of elements in the 1st array\n");
  scanf("%d", &iLen);
  iptr1 = iaArr;
  iptr2 = (iaArr + iLen - 1);
  printf("\nEnter elements of the Array\n");
  for (i = 0; i < iLen; i++)
    scanf("%d", (iptr1 + i));
  printf("\nElements of the Array before reversing\n");
  for (i = 0; i < iLen; i++)
    printf("%d\t", *(iptr1 + i));
  while (iptr1 < iptr2) {
    iTemp = *iptr1;
    *iptr1 = *iptr2;
    *iptr2 = iTemp;
    iptr1++;
    iptr2--;
  }
  iptr1 = iaArr;
  printf("\nElements of the Array after reversing\n");
  for (i = 0; i < iLen; i++)
    printf("%d\t", *(iptr1 + i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1040 <scanf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x50(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11b6 <main+0x96>
mov    -0x48(%rbp),%rsi
movslq -0x38(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe89(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1181 <main+0x61>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11fe <main+0xde>
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11cb <main+0xab>
jmp    1203 <main+0xe3>
mov    -0x48(%rbp),%rax
cmp    -0x50(%rbp),%rax
jae    124c <main+0x12c>
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x50(%rbp),%rax
mov    (%rax),%ecx
mov    -0x48(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%ecx
mov    -0x50(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x50(%rbp)
jmp    1203 <main+0xe3>
lea    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    129c <main+0x17c>
mov    -0x48(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1269 <main+0x149>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0xc(%rsp),%r15
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    119d <main+0x6d>
lea    0x10(%rsp),%r12
xor    %ebx,%ebx
lea    0xe82(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jl     1180 <main+0x50>
lea    (%rsp,%r15,4),%r15
add    $0x10,%r15
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    11ec <main+0xbc>
lea    0xe44(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
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     11d0 <main+0xa0>
add    $0xfffffffffffffffc,%r15
lea    0x10(%rsp),%rax
cmp    %r15,%rax
jae    121c <main+0xec>
lea    0x14(%rsp),%rax
nop
mov    -0x4(%rax),%ecx
mov    (%r15),%edx
mov    %edx,-0x4(%rax)
mov    %ecx,(%r15)
add    $0xfffffffffffffffc,%r15
lea    0x4(%rax),%rcx
cmp    %r15,%rax
mov    %rcx,%rax
jb     1200 <main+0xd0>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    125c <main+0x12c>
lea    0xdcd(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
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     1240 <main+0x110>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [44 x i8] c"\0AEnter the no of elements in the 1st array\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [30 x i8] c"\0AEnter elements of the Array\0A\00"
@.str.3 = [41 x i8] c"\0AElements of the Array before reversing\0A\00"
@.str.4 = [4 x i8] c"%d\09\00"
@.str.5 = [40 x i8] c"\0AElements of the Array after reversing\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 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 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %10, i32** %6
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = getelementptr inbounds i32, i32* %14, i64 -1
store i32* %15, i32** %7
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %17
17: ; preds = %27, %0
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i32*, i32** %6
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
br label %27
27: ; preds = %21
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %17
30: ; preds = %17
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %32
32: ; preds = %43, %30
%33 = load i32, i32* %4
%34 = load i32, i32* %3
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %46
36: ; preds = %32
%37 = load i32*, i32** %6
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %36
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %32
46: ; preds = %32
br label %47
47: ; preds = %51, %46
%48 = load i32*, i32** %6
%49 = load i32*, i32** %7
%50 = icmp ult i32* %48, %49
br i1 %50, label %51, label %63
51: ; preds = %47
%52 = load i32*, i32** %6
%53 = load i32, i32* %52
store i32 %53, i32* %5
%54 = load i32*, i32** %7
%55 = load i32, i32* %54
%56 = load i32*, i32** %6
store i32 %55, i32* %56
%57 = load i32, i32* %5
%58 = load i32*, i32** %7
store i32 %57, i32* %58
%59 = load i32*, i32** %6
%60 = getelementptr inbounds i32, i32* %59, i32 1
store i32* %60, i32** %6
%61 = load i32*, i32** %7
%62 = getelementptr inbounds i32, i32* %61, i32 -1
store i32* %62, i32** %7
br label %47
63: ; preds = %47
%64 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %64, i32** %6
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %4
br label %66
66: ; preds = %77, %63
%67 = load i32, i32* %4
%68 = load i32, i32* %3
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %80
70: ; preds = %66
%71 = load i32*, i32** %6
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i32, i32* %71, i64 %73
%75 = load i32, i32* %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %75)
br label %77
77: ; preds = %70
%78 = load i32, i32* %4
%79 = add nsw i32 %78, 1
store i32 %79, i32* %4
br label %66
80: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\09\00"
@str = [43 x i8] c"\0AEnter the no of elements in the 1st array\00"
@str.6 = [29 x i8] c"\0AEnter elements of the Array\00"
@str.7 = [40 x i8] c"\0AElements of the Array before reversing\00"
@str.8 = [39 x i8] c"\0AElements of the Array after reversing\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 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 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %9
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.6, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %0, %14
%15 = phi i64 [ %18, %14 ], [ 0, %0 ]
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = add nuw nsw i64 %15, 1
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %14, label %22
22: ; preds = %14, %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.7, i64 0, i64 0))
%24 = load i32, i32* %2
%25 = icmp sgt i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %29, %22
%27 = getelementptr inbounds i32, i32* %10, i64 -1
%28 = icmp ult i32* %7, %27
br i1 %28, label %38, label %46
29: ; preds = %22, %29
%30 = phi i64 [ %34, %29 ], [ 0, %22 ]
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%34 = add nuw nsw i64 %30, 1
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %29, label %26
38: ; preds = %26, %38
%39 = phi i32* [ %44, %38 ], [ %27, %26 ]
%40 = phi i32* [ %43, %38 ], [ %7, %26 ]
%41 = load i32, i32* %40
%42 = load i32, i32* %39
store i32 %42, i32* %40
store i32 %41, i32* %39
%43 = getelementptr inbounds i32, i32* %40, i64 1
%44 = getelementptr inbounds i32, i32* %39, i64 -1
%45 = icmp ult i32* %43, %44
br i1 %45, label %38, label %46
46: ; preds = %38, %26
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.8, i64 0, i64 0))
%48 = load i32, i32* %2
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %59
50: ; preds = %46, %50
%51 = phi i64 [ %55, %50 ], [ 0, %46 ]
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %53)
%55 = add nuw nsw i64 %51, 1
%56 = load i32, i32* %2
%57 = sext i32 %56 to i64
%58 = icmp slt i64 %55, %57
br i1 %58, label %50, label %59
59: ; preds = %50, %46
ret i32 0
}