#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[9] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  int temp;
  int i = 0;
  for (i = 0; i < 9 / 2; i++) {
    temp = a[i];
    a[i] = a[9 - i - 1];
    a[9 - i - 1] = temp;
  }
  for (i = 0; i < 9; i++)
    printf("%3d", a[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x4,-0x38(%rbp)
jge    119b <main+0x7b>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
mov    $0x9,%eax
sub    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%ecx
mov    $0x9,%eax
sub    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    114b <main+0x2b>
movl   $0x0,-0x38(%rbp)
cmpl   $0x9,-0x38(%rbp)
jge    11d0 <main+0xb0>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11a2 <main+0x82>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 9)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = tail call i32 @putchar(i32 10)
ret void
}