#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*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reverse_array(int *, int);
void reverse_even_array() {
  int a[] = {1, 2, 3, 4};
  printf("\nStart reverse: ");
  print_array(a, 4);
  reverse_array(a, 4);
  printf("\nAfter reverse: ");
  print_array(a, 4);
}


x86 assembly (clang, -O0):
<reverse_even_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <print_array@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1050 <reverse_array@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <print_array@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_even_array>:
push   %rbx
sub    $0x10,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <print_array@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <reverse_array@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <print_array@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.reverse_even_array.a = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [17 x i8] c"\0AStart reverse: \00"
@.str.1 = [17 x i8] c"\0AAfter reverse: \00"
define void @reverse_even_array() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = call i32 @print_array(i32* %4, i32 4)
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%7 = call i32 @reverse_array(i32* %6, i32 4)
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%10 = call i32 @print_array(i32* %9, i32 4)
ret void
}

LLVM IR (-O2):
@__const.reverse_even_array.a = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [17 x i8] c"\0AStart reverse: \00"
@.str.1 = [17 x i8] c"\0AAfter reverse: \00"
define void @reverse_even_array() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = call i32 @print_array(i32* %4, i32 4)
%6 = call i32 @reverse_array(i32* %4, i32 4)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @print_array(i32* %4, i32 4)
ret void
}