#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*/ expecti(int, int);
void test() {
  int array[5];
  array[0] = 1;
  array[1] = 2;
  array[2] = 3;
  array[3] = 4;
  array[4] = 5;
  expecti(array[0], 1);
  expecti(array[1], 2);
  expecti(array[2], 3);
  expecti(array[3], 4);
  expecti(array[4], 5);
  int a1 = array[4];
  int a2 = array[3];
  int a3 = array[2];
  int a4 = array[1];
  int a5 = array[0];
  array[0] = a1;
  array[1] = a2;
  array[2] = a3;
  array[3] = a4;
  array[4] = a5;
  expecti(array[0], 5);
  expecti(array[1], 4);
  expecti(array[2], 3);
  expecti(array[3], 2);
  expecti(array[4], 1);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x1,-0x20(%rbp)
movl   $0x2,-0x1c(%rbp)
movl   $0x3,-0x18(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x5,-0x10(%rbp)
mov    -0x20(%rbp),%edi
mov    $0x1,%esi
call   1030 <expecti@plt>
mov    -0x1c(%rbp),%edi
mov    $0x2,%esi
call   1030 <expecti@plt>
mov    -0x18(%rbp),%edi
mov    $0x3,%esi
call   1030 <expecti@plt>
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1030 <expecti@plt>
mov    -0x10(%rbp),%edi
mov    $0x5,%esi
call   1030 <expecti@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%edi
mov    $0x5,%esi
call   1030 <expecti@plt>
mov    -0x1c(%rbp),%edi
mov    $0x4,%esi
call   1030 <expecti@plt>
mov    -0x18(%rbp),%edi
mov    $0x3,%esi
call   1030 <expecti@plt>
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
call   1030 <expecti@plt>
mov    -0x10(%rbp),%edi
mov    $0x1,%esi
call   1030 <expecti@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <expecti@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1030 <expecti@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <expecti@plt>
mov    $0x4,%edi
mov    $0x4,%esi
call   1030 <expecti@plt>
mov    $0x5,%edi
mov    $0x5,%esi
call   1030 <expecti@plt>
mov    $0x5,%edi
mov    $0x5,%esi
call   1030 <expecti@plt>
mov    $0x4,%edi
mov    $0x4,%esi
call   1030 <expecti@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <expecti@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1030 <expecti@plt>
mov    $0x1,%edi
mov    $0x1,%esi
pop    %rax
jmp    1030 <expecti@plt>

LLVM IR (-O0):
define void @test() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
store i32 1, i32* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
store i32 2, i32* %8
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
store i32 3, i32* %9
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
store i32 4, i32* %10
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
store i32 5, i32* %11
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%13 = load i32, i32* %12
%14 = call i32 @expecti(i32 %13, i32 1)
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%16 = load i32, i32* %15
%17 = call i32 @expecti(i32 %16, i32 2)
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%19 = load i32, i32* %18
%20 = call i32 @expecti(i32 %19, i32 3)
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%22 = load i32, i32* %21
%23 = call i32 @expecti(i32 %22, i32 4)
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%25 = load i32, i32* %24
%26 = call i32 @expecti(i32 %25, i32 5)
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%28 = load i32, i32* %27
store i32 %28, i32* %2
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%30 = load i32, i32* %29
store i32 %30, i32* %3
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%32 = load i32, i32* %31
store i32 %32, i32* %4
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%34 = load i32, i32* %33
store i32 %34, i32* %5
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%36 = load i32, i32* %35
store i32 %36, i32* %6
%37 = load i32, i32* %2
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
store i32 %37, i32* %38
%39 = load i32, i32* %3
%40 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
store i32 %39, i32* %40
%41 = load i32, i32* %4
%42 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
store i32 %41, i32* %42
%43 = load i32, i32* %5
%44 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
store i32 %43, i32* %44
%45 = load i32, i32* %6
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
store i32 %45, i32* %46
%47 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%48 = load i32, i32* %47
%49 = call i32 @expecti(i32 %48, i32 5)
%50 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%51 = load i32, i32* %50
%52 = call i32 @expecti(i32 %51, i32 4)
%53 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%54 = load i32, i32* %53
%55 = call i32 @expecti(i32 %54, i32 3)
%56 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%57 = load i32, i32* %56
%58 = call i32 @expecti(i32 %57, i32 2)
%59 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%60 = load i32, i32* %59
%61 = call i32 @expecti(i32 %60, i32 1)
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 @expecti(i32 1, i32 1)
%2 = tail call i32 @expecti(i32 2, i32 2)
%3 = tail call i32 @expecti(i32 3, i32 3)
%4 = tail call i32 @expecti(i32 4, i32 4)
%5 = tail call i32 @expecti(i32 5, i32 5)
%6 = tail call i32 @expecti(i32 5, i32 5)
%7 = tail call i32 @expecti(i32 4, i32 4)
%8 = tail call i32 @expecti(i32 3, i32 3)
%9 = tail call i32 @expecti(i32 2, i32 2)
%10 = tail call i32 @expecti(i32 1, i32 1)
ret void
}