#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*/ _assert_true(int, char *, char *, int);
int *array_merge(int, int *, int **);
scalar_t__ arrays_match(int, int *, int *);
void test_multiple_copies_of_longer_list(void) {
  int num_arrays = 10;
  int sizes[] = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10};
  int a0[] = {3, 2, 0, 5, 8, 9, 6, 3, 2, 0};
  int *a[] = {a0, a0, a0, a0, a0, a0, a0, a0, a0, a0};
  int expected[] = {7, 0, 2, 3, 5, 6, 8, 9};
  int *result;
  result = array_merge(num_arrays, sizes, a);
  _assert_true((int)(arrays_match(8, result, expected)),
               "arrays_match(8, result, expected)",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/UMM-CSci-3401-F13/"
               "Lab_3_starter/refs/heads/master/array_merge/array_merge_test.c",
               61);
}


x86 assembly (clang, -O0):
<test_multiple_copies_of_longer_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0xa,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xebe(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0xb0(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xa8(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xa0(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x90(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x80(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0xe7b(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0xc8(%rbp)
mov    0xe6f(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xe69(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
call   1050 <array_merge@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
mov    $0x8,%edi
call   1060 <arrays_match@plt>
mov    %eax,%edi
lea    0xe2f(%rip),%rsi
lea    0xe4a(%rip),%rdx
mov    $0x3d,%ecx
call   1040 <_assert_true@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_multiple_copies_of_longer_list>:
sub    $0xd8,%rsp
mov    0xee2(%rip),%rax
mov    %rax,0xa0(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
mov    0xee5(%rip),%rax
mov    %rax,0x70(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
lea    0x50(%rsp),%rax
mov    %rax,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %rax,0x20(%rsp)
mov    %rax,0x28(%rsp)
mov    %rax,0x30(%rsp)
mov    %rax,0x38(%rsp)
mov    %rax,0x40(%rsp)
mov    %rax,0x48(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
lea    0x80(%rsp),%rsi
mov    %rsp,%rdx
mov    $0xa,%edi
call   1040 <array_merge@plt>
lea    0xb0(%rsp),%rdx
mov    $0x8,%edi
mov    %rax,%rsi
call   1050 <arrays_match@plt>
lea    0xe73(%rip),%rsi
lea    0xe8e(%rip),%rdx
mov    %eax,%edi
mov    $0x3d,%ecx
call   1030 <_assert_true@plt>
add    $0xd8,%rsp
ret

LLVM IR (-O0):
@__const.test_multiple_copies_of_longer_list.sizes = [10 x i32] [i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10]
@__const.test_multiple_copies_of_longer_list.a0 = [10 x i32] [i32 3, i32 2, i32 0, i32 5, i32 8, i32 9, i32 6, i32 3, i32 2, i32 0]
@__const.test_multiple_copies_of_longer_list.expected = [8 x i32] [i32 7, i32 0, i32 2, i32 3, i32 5, i32 6, i32 8, i32 9]
@.str = [34 x i8] c"arrays_match(8, result, expected)\00"
@.str.1 = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/UMM-CSci-3401-F13/Lab_3_starter/refs/heads/master/array_merge/array_merge_test.c\00"
define void @test_multiple_copies_of_longer_list() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = alloca [10 x i32*]
%5 = alloca [8 x i32]
%6 = alloca i32*
store i32 10, i32* %1
%7 = bitcast [10 x i32]* %2 to i8*
%8 = bitcast [10 x i32]* %3 to i8*
%9 = getelementptr inbounds [10 x i32*], [10 x i32*]* %4, i64 0, i64 0
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %10, i32** %9
%11 = getelementptr inbounds i32*, i32** %9, i64 1
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %12, i32** %11
%13 = getelementptr inbounds i32*, i32** %11, i64 1
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %14, i32** %13
%15 = getelementptr inbounds i32*, i32** %13, i64 1
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %16, i32** %15
%17 = getelementptr inbounds i32*, i32** %15, i64 1
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %18, i32** %17
%19 = getelementptr inbounds i32*, i32** %17, i64 1
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %20, i32** %19
%21 = getelementptr inbounds i32*, i32** %19, i64 1
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %22, i32** %21
%23 = getelementptr inbounds i32*, i32** %21, i64 1
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %24, i32** %23
%25 = getelementptr inbounds i32*, i32** %23, i64 1
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %26, i32** %25
%27 = getelementptr inbounds i32*, i32** %25, i64 1
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32* %28, i32** %27
%29 = bitcast [8 x i32]* %5 to i8*
%30 = load i32, i32* %1
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%32 = getelementptr inbounds [10 x i32*], [10 x i32*]* %4, i64 0, i64 0
%33 = call i32* @array_merge(i32 %30, i32* %31, i32** %32)
store i32* %33, i32** %6
%34 = load i32*, i32** %6
%35 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%36 = call i64 @arrays_match(i32 8, i32* %34, i32* %35)
%37 = trunc i64 %36 to i32
%38 = call i32 @_assert_true(i32 %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.1, i64 0, i64 0), i32 61)
ret void
}

LLVM IR (-O2):
@__const.test_multiple_copies_of_longer_list.sizes = [10 x i32] [i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10]
@__const.test_multiple_copies_of_longer_list.a0 = [10 x i32] [i32 3, i32 2, i32 0, i32 5, i32 8, i32 9, i32 6, i32 3, i32 2, i32 0]
@__const.test_multiple_copies_of_longer_list.expected = [8 x i32] [i32 7, i32 0, i32 2, i32 3, i32 5, i32 6, i32 8, i32 9]
@.str = [34 x i8] c"arrays_match(8, result, expected)\00"
@.str.1 = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/UMM-CSci-3401-F13/Lab_3_starter/refs/heads/master/array_merge/array_merge_test.c\00"
define void @test_multiple_copies_of_longer_list() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = alloca [10 x i32*]
%4 = alloca [8 x i32]
%5 = bitcast [10 x i32]* %1 to i8*
%6 = bitcast [10 x i32]* %2 to i8*
%7 = bitcast [10 x i32*]* %3 to i8*
%8 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 0
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %9, i32** %8
%10 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 1
store i32* %9, i32** %10
%11 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 2
store i32* %9, i32** %11
%12 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 3
store i32* %9, i32** %12
%13 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 4
store i32* %9, i32** %13
%14 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 5
store i32* %9, i32** %14
%15 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 6
store i32* %9, i32** %15
%16 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 7
store i32* %9, i32** %16
%17 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 8
store i32* %9, i32** %17
%18 = getelementptr inbounds [10 x i32*], [10 x i32*]* %3, i64 0, i64 9
store i32* %9, i32** %18
%19 = bitcast [8 x i32]* %4 to i8*
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%21 = call i32* @array_merge(i32 10, i32* %20, i32** %8)
%22 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%23 = call i64 @arrays_match(i32 8, i32* %21, i32* %22)
%24 = trunc i64 %23 to i32
%25 = call i32 @_assert_true(i32 %24, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.1, i64 0, i64 0), i32 61)
ret void
}