#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 *, ...);
void main() {
  int a[5] = {1, 2, 3, 4, 5};
  int i, j, t;
  i = 0;
  j = 5 - 1;
  while (i <= j) {
    t = *(a + i);
    *(a + i) = *(a + j);
    *(a + j) = t;
    i++;
    j--;
  }
  for (i = 0; i < 5; i++) {
    printf("%-4d", *(a + i));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x4,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     118e <main+0x7e>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x2c(%rbp)
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x2c(%rbp),%ecx
movslq -0x28(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1145 <main+0x35>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11c3 <main+0xb3>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1195 <main+0x85>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x5,(%rsp)
movl   $0x1,0x10(%rsp)
mov    $0x1,%ecx
mov    $0x3,%eax
nopl   0x0(%rax)
mov    (%rsp,%rcx,4),%edx
mov    (%rsp,%rax,4),%esi
mov    %esi,(%rsp,%rcx,4)
mov    %edx,(%rsp,%rax,4)
lea    0x1(%rcx),%rdx
add    $0xffffffffffffffff,%rax
cmp    %rax,%rcx
mov    %rdx,%rcx
jb     1150 <main+0x30>
mov    (%rsp),%esi
lea    0xe9e(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x20,%rsp
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [5 x i8] c"%-4d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [5 x i32]* %1 to i8*
store i32 0, i32* %2
store i32 4, i32* %3
br label %6
6: ; preds = %10, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %34
10: ; preds = %6
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
store i32 %15, i32* %4
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
store i32 %20, i32* %24
%25 = load i32, i32* %4
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
store i32 %25, i32* %29
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
%32 = load i32, i32* %3
%33 = add nsw i32 %32, -1
store i32 %33, i32* %3
br label %6
34: ; preds = %6
store i32 0, i32* %2
br label %35
35: ; preds = %45, %34
%36 = load i32, i32* %2
%37 = icmp slt i32 %36, 5
br i1 %37, label %38, label %48
38: ; preds = %35
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %38
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %35
48: ; preds = %35
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [5 x i8] c"%-4d\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
store i32 5, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 3, %0 ], [ %15, %5 ]
%7 = phi i64 [ 1, %0 ], [ %14, %5 ]
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %6
%11 = load i32, i32* %10
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %7
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %6
store i32 %11, i32* %12
store i32 %9, i32* %13
%14 = add nuw nsw i64 %7, 1
%15 = add nsw i64 %6, -1
%16 = icmp ult i64 %7, %15
br i1 %16, label %5, label %17
17: ; preds = %5
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%19 = load i32, i32* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%22 = load i32, i32* %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%25 = load i32, i32* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%28 = load i32, i32* %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%31 = load i32, i32* %30
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = tail call i32 @putchar(i32 10)
ret void
}