#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*/ NA_display(size_t *, int);
int NA_merge_and_sort_sorted_arrays(size_t *, size_t *, int, int, size_t *);
int /*<<< orphan*/ NA_merge_sorted_arrays(size_t *, size_t *, int, int,
                                          size_t *);
int NA_rm_duplicate(size_t *, int);
int /*<<< orphan*/ NA_sort_bubble(size_t *, int);
int NumericsArrays_merge_test1() {
  int info = 0;
  int n1 = 3;
  size_t arr1[] = {1, 1, 1};
  int n2 = 3;
  size_t arr2[] = {1, 1, 1};
  int n3 = 6;
  size_t arr3[] = {99, 99, 99, 99, 99, 99};
  NA_merge_sorted_arrays(arr1, arr2, n1, n2, arr3);
  NA_display(arr3, n3);
  int n_rm = NA_rm_duplicate(arr3, n3);
  NA_display(arr3, n_rm);
  NA_sort_bubble(arr3, n_rm);
  NA_display(arr3, n_rm);
  int n = NA_merge_and_sort_sorted_arrays(arr1, arr2, n1, n2, arr3);
  NA_display(arr3, n);
  return info;
}


x86 assembly (clang, -O0):
<NumericsArrays_merge_test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    0xe80(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe7d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe7a(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x3,-0x24(%rbp)
mov    0xe78(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe72(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0x6,-0x44(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1070 <memset@plt>
movq   $0x63,-0x80(%rbp)
movq   $0x63,-0x78(%rbp)
movq   $0x63,-0x70(%rbp)
movq   $0x63,-0x68(%rbp)
movq   $0x63,-0x60(%rbp)
movq   $0x63,-0x58(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    -0x80(%rbp),%r8
call   1060 <NA_merge_sorted_arrays@plt>
lea    -0x80(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1040 <NA_display@plt>
lea    -0x80(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1080 <NA_rm_duplicate@plt>
mov    %eax,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
call   1040 <NA_display@plt>
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
call   1030 <NA_sort_bubble@plt>
lea    -0x80(%rbp),%rdi
mov    -0x84(%rbp),%esi
call   1040 <NA_display@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    -0x80(%rbp),%r8
call   1050 <NA_merge_and_sort_sorted_arrays@plt>
mov    %eax,-0x88(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x88(%rbp),%esi
call   1040 <NA_display@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NumericsArrays_merge_test1>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    0xebf(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rax,0x10(%rsp)
movaps %xmm0,(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
lea    0x20(%rsp),%r14
mov    %rsp,%r15
lea    0x40(%rsp),%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x3,%edx
mov    $0x3,%ecx
mov    %rbx,%r8
call   1060 <NA_merge_sorted_arrays@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <NA_display@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1070 <NA_rm_duplicate@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <NA_display@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <NA_sort_bubble@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <NA_display@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x3,%edx
mov    $0x3,%ecx
mov    %rbx,%r8
call   1050 <NA_merge_and_sort_sorted_arrays@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <NA_display@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.NumericsArrays_merge_test1.arr1 = [3 x i64] [i64 1, i64 1, i64 1]
@__const.NumericsArrays_merge_test1.arr2 = [3 x i64] [i64 1, i64 1, i64 1]
define i32 @NumericsArrays_merge_test1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i64]
%4 = alloca i32
%5 = alloca [3 x i64]
%6 = alloca i32
%7 = alloca [6 x i64]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
%10 = bitcast [3 x i64]* %3 to i8*
store i32 3, i32* %4
%11 = bitcast [3 x i64]* %5 to i8*
store i32 6, i32* %6
%12 = bitcast [6 x i64]* %7 to i8*
%13 = bitcast i8* %12 to [6 x i64]*
%14 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i32 0, i32 0
store i64 99, i64* %14
%15 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i32 0, i32 1
store i64 99, i64* %15
%16 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i32 0, i32 2
store i64 99, i64* %16
%17 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i32 0, i32 3
store i64 99, i64* %17
%18 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i32 0, i32 4
store i64 99, i64* %18
%19 = getelementptr inbounds [6 x i64], [6 x i64]* %13, i32 0, i32 5
store i64 99, i64* %19
%20 = getelementptr inbounds [3 x i64], [3 x i64]* %3, i64 0, i64 0
%21 = getelementptr inbounds [3 x i64], [3 x i64]* %5, i64 0, i64 0
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%25 = call i32 @NA_merge_sorted_arrays(i64* %20, i64* %21, i32 %22, i32 %23, i64* %24)
%26 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%27 = load i32, i32* %6
%28 = call i32 @NA_display(i64* %26, i32 %27)
%29 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%30 = load i32, i32* %6
%31 = call i32 @NA_rm_duplicate(i64* %29, i32 %30)
store i32 %31, i32* %8
%32 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%33 = load i32, i32* %8
%34 = call i32 @NA_display(i64* %32, i32 %33)
%35 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%36 = load i32, i32* %8
%37 = call i32 @NA_sort_bubble(i64* %35, i32 %36)
%38 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%39 = load i32, i32* %8
%40 = call i32 @NA_display(i64* %38, i32 %39)
%41 = getelementptr inbounds [3 x i64], [3 x i64]* %3, i64 0, i64 0
%42 = getelementptr inbounds [3 x i64], [3 x i64]* %5, i64 0, i64 0
%43 = load i32, i32* %2
%44 = load i32, i32* %4
%45 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%46 = call i32 @NA_merge_and_sort_sorted_arrays(i64* %41, i64* %42, i32 %43, i32 %44, i64* %45)
store i32 %46, i32* %9
%47 = getelementptr inbounds [6 x i64], [6 x i64]* %7, i64 0, i64 0
%48 = load i32, i32* %9
%49 = call i32 @NA_display(i64* %47, i32 %48)
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@__const.NumericsArrays_merge_test1.arr2 = [3 x i64] [i64 1, i64 1, i64 1]
define i32 @NumericsArrays_merge_test1() {
%1 = alloca [3 x i64]
%2 = alloca [3 x i64]
%3 = alloca [6 x i64]
%4 = bitcast [3 x i64]* %1 to i8*
%5 = bitcast [3 x i64]* %2 to i8*
%6 = bitcast [6 x i64]* %3 to i8*
%7 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 0
%8 = bitcast [6 x i64]* %3 to <2 x i64>*
store <2 x i64> <i64 99, i64 99>, <2 x i64>* %8
%9 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 2
%10 = bitcast i64* %9 to <2 x i64>*
store <2 x i64> <i64 99, i64 99>, <2 x i64>* %10
%11 = getelementptr inbounds [6 x i64], [6 x i64]* %3, i64 0, i64 4
%12 = bitcast i64* %11 to <2 x i64>*
store <2 x i64> <i64 99, i64 99>, <2 x i64>* %12
%13 = getelementptr inbounds [3 x i64], [3 x i64]* %1, i64 0, i64 0
%14 = getelementptr inbounds [3 x i64], [3 x i64]* %2, i64 0, i64 0
%15 = call i32 @NA_merge_sorted_arrays(i64* %13, i64* %14, i32 3, i32 3, i64* %7)
%16 = call i32 @NA_display(i64* %7, i32 6)
%17 = call i32 @NA_rm_duplicate(i64* %7, i32 6)
%18 = call i32 @NA_display(i64* %7, i32 %17)
%19 = call i32 @NA_sort_bubble(i64* %7, i32 %17)
%20 = call i32 @NA_display(i64* %7, i32 %17)
%21 = call i32 @NA_merge_and_sort_sorted_arrays(i64* %13, i64* %14, i32 3, i32 3, i64* %7)
%22 = call i32 @NA_display(i64* %7, i32 %21)
ret i32 0
}