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


x86 assembly (clang, -O0):
<reverse_odd_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <print_array@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <reverse_array@plt>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <print_array@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_odd_array>:
push   %rbx
sub    $0x20,%rsp
mov    0xed5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <print_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <reverse_array@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <print_array@plt>
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.reverse_odd_array.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [17 x i8] c"\0AStart reverse: \00"
@.str.1 = [17 x i8] c"\0AAfter reverse: \00"
define void @reverse_odd_array() {
%1 = alloca [5 x i32]
%2 = bitcast [5 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 [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @print_array(i32* %4, i32 5)
%6 = call i32 @reverse_array(i32* %4, i32 5)
%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 5)
ret void
}