#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);
int main() {
  int arr[5];
  arr[0] = 1;
  arr[1] = 2;
  arr[2] = 3;
  arr[3] = 4;
  arr[4] = 5;
  for (int i = 0; i < 5 - 1; i++) {
    for (int g = i + 1; g < 5; g++) {
      int temp = arr[i];
      arr[i] = arr[g];
      arr[g] = temp;
    }
  }
  for (int i = 0; i < 5; i++) {
    printf("%d\n", arr[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x2,-0x1c(%rbp)
movl   $0x3,-0x18(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x5,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    11ad <main+0x9d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    119a <main+0x8a>
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    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    115c <main+0x4c>
jmp    119f <main+0x8f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1149 <main+0x39>
movl   $0x0,-0x30(%rbp)
cmpl   $0x5,-0x30(%rbp)
jge    11e0 <main+0xd0>
movslq -0x30(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b4 <main+0xa4>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 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
store i32 0, i32* %1
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32 1, i32* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
store i32 2, i32* %8
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
store i32 3, i32* %9
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
store i32 4, i32* %10
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 4
store i32 5, i32* %11
store i32 0, i32* %3
br label %12
12: ; preds = %41, %0
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %44
15: ; preds = %12
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %18
18: ; preds = %37, %15
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 5
br i1 %20, label %21, label %40
21: ; preds = %18
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %23
%25 = load i32, i32* %24
store i32 %25, i32* %5
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %31
store i32 %29, i32* %32
%33 = load i32, i32* %5
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %35
store i32 %33, i32* %36
br label %37
37: ; preds = %21
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %18
40: ; preds = %18
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %12
44: ; preds = %12
store i32 0, i32* %6
br label %45
45: ; preds = %54, %44
%46 = load i32, i32* %6
%47 = icmp slt i32 %46, 5
br i1 %47, label %48, label %57
48: ; preds = %45
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %48
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %45
57: ; preds = %45
ret i32 0
}

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