#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 */
struct Result {
  int dummy;
};
typedef int /*<<< orphan*/ arr2;
typedef int /*<<< orphan*/ arr1;

/* Variables and functions */
struct Result *array_data(int *, int);
int /*<<< orphan*/ free(struct Result *);
int /*<<< orphan*/ print_result(struct Result *);
int /*<<< orphan*/ printf(char *);
int main() {
  int arr1[] = {3, 2, 5, 4, 1};
  int arr2[] = {5, 1, 7, 4, 8, 4};
  struct Result *res1 = array_data(arr1, sizeof(arr1) / sizeof(int));
  struct Result *res2 = array_data(arr2, sizeof(arr2) / sizeof(int));
  printf("arr1:\n");
  print_result(res1);
  printf("\narr2:\n");
  print_result(res2);
  free(res1);
  free(res2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeac(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xeb2(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1060 <array_data@plt>
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x6,%esi
call   1060 <array_data@plt>
mov    %rax,-0x50(%rbp)
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    -0x48(%rbp),%rdi
call   1050 <print_result@plt>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    -0x50(%rbp),%rdi
call   1050 <print_result@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    0xec3(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0xecd(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1060 <array_data@plt>
mov    %rax,%r14
lea    0x20(%rsp),%rdi
mov    $0x6,%esi
call   1060 <array_data@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <print_result@plt>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <print_result@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.Result = type { i32 }
@__const.main.arr1 = [5 x i32] [i32 3, i32 2, i32 5, i32 4, i32 1]
@__const.main.arr2 = [6 x i32] [i32 5, i32 1, i32 7, i32 4, i32 8, i32 4]
@.str = [7 x i8] c"arr1:\0A\00"
@.str.1 = [8 x i8] c"\0Aarr2:\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [6 x i32]
%3 = alloca %struct.Result*
%4 = alloca %struct.Result*
%5 = bitcast [5 x i32]* %1 to i8*
%6 = bitcast [6 x i32]* %2 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%8 = call %struct.Result* @array_data(i32* %7, i32 5)
store %struct.Result* %8, %struct.Result** %3
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%10 = call %struct.Result* @array_data(i32* %9, i32 6)
store %struct.Result* %10, %struct.Result** %4
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = load %struct.Result*, %struct.Result** %3
%13 = call i32 @print_result(%struct.Result* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = load %struct.Result*, %struct.Result** %4
%16 = call i32 @print_result(%struct.Result* %15)
%17 = load %struct.Result*, %struct.Result** %3
%18 = call i32 @free(%struct.Result* %17)
%19 = load %struct.Result*, %struct.Result** %4
%20 = call i32 @free(%struct.Result* %19)
ret i32 0
}

LLVM IR (-O2):
%struct.Result = type { i32 }
@__const.main.arr1 = [5 x i32] [i32 3, i32 2, i32 5, i32 4, i32 1]
@__const.main.arr2 = [6 x i32] [i32 5, i32 1, i32 7, i32 4, i32 8, i32 4]
@str = [6 x i8] c"arr1:\00"
@str.2 = [7 x i8] c"\0Aarr2:\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [6 x i32]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast [6 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = call %struct.Result* @array_data(i32* %5, i32 5)
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%8 = call %struct.Result* @array_data(i32* %7, i32 6)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%10 = call i32 @print_result(%struct.Result* %6)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0))
%12 = call i32 @print_result(%struct.Result* %8)
%13 = call i32 @free(%struct.Result* %6)
%14 = call i32 @free(%struct.Result* %8)
ret i32 0
}