#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 *);
int *calloc(int, int);
void test_different_sizes(void) {
  int num_arrays = 11;
  int sizes[num_arrays];
  int *a[num_arrays];
  int expected[] = {10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  int *result;
  int i, j;
  for (i = 0; i < num_arrays; ++i) {
    sizes[i] = i;
    a[i] = calloc(i, sizeof(int));
    for (j = 0; j < i; ++j) {
      a[i][j] = j;
    }
  }
  result = array_merge(num_arrays, sizes, a);
  _assert_true((int)(arrays_match(11, result, expected)),
               "arrays_match(11, 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",
               95);
}


x86 assembly (clang, -O0):
<test_different_sizes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0xb,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1242 <test_different_sizes+0xf2>
mov    -0x70(%rbp),%rax
mov    -0x5c(%rbp),%edx
movslq -0x5c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x5c(%rbp),%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x68(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jge    122f <test_different_sizes+0xdf>
mov    -0x68(%rbp),%rax
mov    -0x60(%rbp),%edx
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x60(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    11ff <test_different_sizes+0xaf>
jmp    1234 <test_different_sizes+0xe4>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    11c2 <test_different_sizes+0x72>
mov    -0x68(%rbp),%rdx
mov    -0x70(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1060 <array_merge@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    -0x50(%rbp),%rdx
mov    $0xb,%edi
call   1070 <arrays_match@plt>
mov    %eax,%edi
lea    0xdbb(%rip),%rsi
lea    0xdd7(%rip),%rdx
mov    $0x5f,%ecx
call   1050 <_assert_true@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_different_sizes>:
push   %r14
push   %rbx
sub    $0xb8,%rsp
movups 0xecb(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,(%rsp)
xor    %ebx,%ebx
movabs $0x7ffffffffffffff8,%r14
ff ff 7f
jmp    118e <test_different_sizes+0x4e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0xb,%rbx
je     1232 <test_different_sizes+0xf2>
mov    %ebx,0x30(%rsp,%rbx,4)
mov    %ebx,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,0x60(%rsp,%rbx,8)
test   %rbx,%rbx
je     1180 <test_different_sizes+0x40>
lea    -0x1(%rbx),%rcx
cmp    $0x7,%rcx
jae    11c0 <test_different_sizes+0x80>
xor    %ecx,%ecx
jmp    120d <test_different_sizes+0xcd>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdx
and    %r14,%rdx
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %ecx,(%rax,%rcx,4)
lea    0x1(%rcx),%esi
mov    %esi,0x4(%rax,%rcx,4)
lea    0x2(%rcx),%esi
mov    %esi,0x8(%rax,%rcx,4)
lea    0x3(%rcx),%esi
mov    %esi,0xc(%rax,%rcx,4)
lea    0x4(%rcx),%esi
mov    %esi,0x10(%rax,%rcx,4)
lea    0x5(%rcx),%esi
mov    %esi,0x14(%rax,%rcx,4)
lea    0x6(%rcx),%esi
mov    %esi,0x18(%rax,%rcx,4)
lea    0x7(%rcx),%esi
mov    %esi,0x1c(%rax,%rcx,4)
add    $0x8,%rcx
cmp    %rdx,%rcx
jne    11d0 <test_different_sizes+0x90>
test   $0x7,%bl
je     1180 <test_different_sizes+0x40>
mov    %ebx,%edx
and    $0x7,%edx
nopl   0x0(%rax,%rax,1)
mov    %ecx,(%rax,%rcx,4)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdx
jne    1220 <test_different_sizes+0xe0>
jmp    1180 <test_different_sizes+0x40>
lea    0x30(%rsp),%rsi
lea    0x60(%rsp),%rdx
mov    $0xb,%edi
call   1050 <array_merge@plt>
mov    %rsp,%rdx
mov    $0xb,%edi
mov    %rax,%rsi
call   1060 <arrays_match@plt>
lea    0xdcf(%rip),%rsi
lea    0xdeb(%rip),%rdx
mov    %eax,%edi
mov    $0x5f,%ecx
call   1040 <_assert_true@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_different_sizes.expected = [11 x i32] [i32 10, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@.str = [35 x i8] c"arrays_match(11, 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_different_sizes() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca [11 x i32]
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 11, i32* %1
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %2
%12 = alloca i32, i64 %10
store i64 %10, i64* %3
%13 = load i32, i32* %1
%14 = zext i32 %13 to i64
%15 = alloca i32*, i64 %14
store i64 %14, i64* %4
%16 = bitcast [11 x i32]* %5 to i8*
store i32 0, i32* %7
br label %17
17: ; preds = %48, %0
%18 = load i32, i32* %7
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %51
21: ; preds = %17
%22 = load i32, i32* %7
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %12, i64 %24
store i32 %22, i32* %25
%26 = load i32, i32* %7
%27 = call i32* @calloc(i32 %26, i32 4)
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32*, i32** %15, i64 %29
store i32* %27, i32** %30
store i32 0, i32* %8
br label %31
31: ; preds = %44, %21
%32 = load i32, i32* %8
%33 = load i32, i32* %7
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %47
35: ; preds = %31
%36 = load i32, i32* %8
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32*, i32** %15, i64 %38
%40 = load i32*, i32** %39
%41 = load i32, i32* %8
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
store i32 %36, i32* %43
br label %44
44: ; preds = %35
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %31
47: ; preds = %31
br label %48
48: ; preds = %47
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %17
51: ; preds = %17
%52 = load i32, i32* %1
%53 = call i32* @array_merge(i32 %52, i32* %12, i32** %15)
store i32* %53, i32** %6
%54 = load i32*, i32** %6
%55 = getelementptr inbounds [11 x i32], [11 x i32]* %5, i64 0, i64 0
%56 = call i64 @arrays_match(i32 11, i32* %54, i32* %55)
%57 = trunc i64 %56 to i32
%58 = call i32 @_assert_true(i32 %57, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.1, i64 0, i64 0), i32 95)
%59 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
@__const.test_different_sizes.expected = [11 x i32] [i32 10, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@.str = [35 x i8] c"arrays_match(11, 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_different_sizes() {
%1 = alloca [11 x i32]
%2 = alloca [11 x i32]
%3 = alloca [11 x i32*]
%4 = bitcast [11 x i32]* %1 to i8*
br label %5
5: ; preds = %0, %58
%6 = phi i64 [ 0, %0 ], [ %59, %58 ]
%7 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 %6
%8 = trunc i64 %6 to i32
store i32 %8, i32* %7
%9 = tail call i32* @calloc(i32 %8, i32 4)
%10 = getelementptr inbounds [11 x i32*], [11 x i32*]* %3, i64 0, i64 %6
store i32* %9, i32** %10
%11 = icmp eq i64 %6, 0
br i1 %11, label %58, label %12
12: ; preds = %5
%13 = add nsw i64 %6, -1
%14 = and i64 %6, 7
%15 = icmp ult i64 %13, 7
br i1 %15, label %47, label %16
16: ; preds = %12
%17 = and i64 %6, 9223372036854775800
br label %18
18: ; preds = %18, %16
%19 = phi i64 [ 0, %16 ], [ %44, %18 ]
%20 = phi i64 [ 0, %16 ], [ %45, %18 ]
%21 = getelementptr inbounds i32, i32* %9, i64 %19
%22 = trunc i64 %19 to i32
store i32 %22, i32* %21
%23 = or i64 %19, 1
%24 = getelementptr inbounds i32, i32* %9, i64 %23
%25 = trunc i64 %23 to i32
store i32 %25, i32* %24
%26 = or i64 %19, 2
%27 = getelementptr inbounds i32, i32* %9, i64 %26
%28 = trunc i64 %26 to i32
store i32 %28, i32* %27
%29 = or i64 %19, 3
%30 = getelementptr inbounds i32, i32* %9, i64 %29
%31 = trunc i64 %29 to i32
store i32 %31, i32* %30
%32 = or i64 %19, 4
%33 = getelementptr inbounds i32, i32* %9, i64 %32
%34 = trunc i64 %32 to i32
store i32 %34, i32* %33
%35 = or i64 %19, 5
%36 = getelementptr inbounds i32, i32* %9, i64 %35
%37 = trunc i64 %35 to i32
store i32 %37, i32* %36
%38 = or i64 %19, 6
%39 = getelementptr inbounds i32, i32* %9, i64 %38
%40 = trunc i64 %38 to i32
store i32 %40, i32* %39
%41 = or i64 %19, 7
%42 = getelementptr inbounds i32, i32* %9, i64 %41
%43 = trunc i64 %41 to i32
store i32 %43, i32* %42
%44 = add nuw nsw i64 %19, 8
%45 = add i64 %20, 8
%46 = icmp eq i64 %45, %17
br i1 %46, label %47, label %18
47: ; preds = %18, %12
%48 = phi i64 [ 0, %12 ], [ %44, %18 ]
%49 = icmp eq i64 %14, 0
br i1 %49, label %58, label %50
50: ; preds = %47, %50
%51 = phi i64 [ %55, %50 ], [ %48, %47 ]
%52 = phi i64 [ %56, %50 ], [ 0, %47 ]
%53 = getelementptr inbounds i32, i32* %9, i64 %51
%54 = trunc i64 %51 to i32
store i32 %54, i32* %53
%55 = add nuw nsw i64 %51, 1
%56 = add i64 %52, 1
%57 = icmp eq i64 %56, %14
br i1 %57, label %58, label %50
58: ; preds = %47, %50, %5
%59 = add nuw nsw i64 %6, 1
%60 = icmp eq i64 %59, 11
br i1 %60, label %61, label %5
61: ; preds = %58
%62 = getelementptr inbounds [11 x i32*], [11 x i32*]* %3, i64 0, i64 0
%63 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%64 = call i32* @array_merge(i32 11, i32* %63, i32** %62)
%65 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%66 = call i64 @arrays_match(i32 11, i32* %64, i32* %65)
%67 = trunc i64 %66 to i32
%68 = call i32 @_assert_true(i32 %67, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str.1, i64 0, i64 0), i32 95)
ret void
}