#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 /*<<< orphan*/ swap(int *, int *);
main() {
  int a[5] = {1, 4, 8, 4, 3};
  int i, j;
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++) {
      swap(&a[i], &a[j]);
    }
  }
  for (i = 0; i < 5; i++) {
    printf("%d ", a[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11b4 <main+0x94>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11a1 <main+0x81>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
movslq -0x28(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
call   1040 <swap@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1166 <main+0x46>
jmp    11a6 <main+0x86>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1155 <main+0x35>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11e7 <main+0xc7>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bb <main+0x9b>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0xedd(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xec2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r14
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r12,%rsi
call   1040 <swap@plt>
lea    0x4(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <swap@plt>
lea    0x8(%rsp),%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <swap@plt>
lea    0xc(%rsp),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <swap@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <swap@plt>
mov    %r15,%rdi
mov    %r15,%rsi
call   1040 <swap@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <swap@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <swap@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <swap@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <swap@plt>
mov    %r13,%rdi
mov    %r13,%rsi
call   1040 <swap@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <swap@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <swap@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <swap@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <swap@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1040 <swap@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <swap@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <swap@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <swap@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <swap@plt>
mov    %r14,%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
mov    (%rsp),%esi
lea    0xd9e(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 4, i32 8, i32 4, i32 3]
@.str = [4 x i8] c"%d \00"
define i32 @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 = call i32 @swap(i32* %3, i32* %3)
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%6 = call i32 @swap(i32* %3, i32* %5)
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%8 = call i32 @swap(i32* %3, i32* %7)
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%10 = call i32 @swap(i32* %3, i32* %9)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%12 = call i32 @swap(i32* %3, i32* %11)
%13 = call i32 @swap(i32* %5, i32* %3)
%14 = call i32 @swap(i32* %5, i32* %5)
%15 = call i32 @swap(i32* %5, i32* %7)
%16 = call i32 @swap(i32* %5, i32* %9)
%17 = call i32 @swap(i32* %5, i32* %11)
%18 = call i32 @swap(i32* %7, i32* %3)
%19 = call i32 @swap(i32* %7, i32* %5)
%20 = call i32 @swap(i32* %7, i32* %7)
%21 = call i32 @swap(i32* %7, i32* %9)
%22 = call i32 @swap(i32* %7, i32* %11)
%23 = call i32 @swap(i32* %9, i32* %3)
%24 = call i32 @swap(i32* %9, i32* %5)
%25 = call i32 @swap(i32* %9, i32* %7)
%26 = call i32 @swap(i32* %9, i32* %9)
%27 = call i32 @swap(i32* %9, i32* %11)
%28 = call i32 @swap(i32* %11, i32* %3)
%29 = call i32 @swap(i32* %11, i32* %5)
%30 = call i32 @swap(i32* %11, i32* %7)
%31 = call i32 @swap(i32* %11, i32* %9)
%32 = call i32 @swap(i32* %11, i32* %11)
%33 = load i32, i32* %3
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %7
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %9
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %11
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
ret i32 0
}