#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*/ array_equal(double *, double *, int);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ merge(double *, double *, double *, int, int);
void test1(void) {
  double a[] = {4, 15, 16};
  double b[] = {8, 23, 42};
  double out[6];
  double expected[6] = {4, 8, 15, 16, 23, 42};
  merge(a, b, out, 3, 3);
  assert(array_equal(out, expected, 6));
  merge(b, a, out, 3, 3);
  assert(array_equal(out, expected, 6));
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movsd  0xe80(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xe68(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xe50(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe38(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe20(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe0b(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x70(%rbp),%rdx
mov    $0x3,%r8d
mov    %r8d,%ecx
call   1060 <merge@plt>
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x6,%edx
call   1050 <array_equal@plt>
mov    %eax,%edi
call   1040 <assert@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x70(%rbp),%rdx
mov    $0x3,%r8d
mov    %r8d,%ecx
call   1060 <merge@plt>
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x6,%edx
call   1050 <array_equal@plt>
mov    %eax,%edi
call   1040 <assert@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    0xefb(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xf03(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe90(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0x20(%rsp),%r14
mov    %rsp,%r15
lea    0x70(%rsp),%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    $0x3,%ecx
mov    $0x3,%r8d
call   1050 <merge@plt>
lea    0x40(%rsp),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x6,%edx
call   1040 <array_equal@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x3,%ecx
mov    $0x3,%r8d
call   1050 <merge@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x6,%edx
call   1040 <array_equal@plt>
mov    %eax,%edi
call   1030 <assert@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.test1.a = [3 x double] [double 4.000000e+00, double 1.500000e+01, double 1.600000e+01]
@__const.test1.b = [3 x double] [double 8.000000e+00, double 2.300000e+01, double 4.200000e+01]
define void @test1() {
%1 = alloca [3 x double]
%2 = alloca [3 x double]
%3 = alloca [6 x double]
%4 = alloca [6 x double]
%5 = bitcast [3 x double]* %1 to i8*
%6 = bitcast [3 x double]* %2 to i8*
%7 = bitcast [6 x double]* %4 to i8*
%8 = bitcast i8* %7 to [6 x double]*
%9 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 0
store double 4.000000e+00, double* %9
%10 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 1
store double 8.000000e+00, double* %10
%11 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 2
store double 1.500000e+01, double* %11
%12 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 3
store double 1.600000e+01, double* %12
%13 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 4
store double 2.300000e+01, double* %13
%14 = getelementptr inbounds [6 x double], [6 x double]* %8, i32 0, i32 5
store double 4.200000e+01, double* %14
%15 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%17 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%18 = call i32 @merge(double* %15, double* %16, double* %17, i32 3, i32 3)
%19 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%20 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%21 = call i32 @array_equal(double* %19, double* %20, i32 6)
%22 = call i32 @assert(i32 %21)
%23 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%24 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%25 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%26 = call i32 @merge(double* %23, double* %24, double* %25, i32 3, i32 3)
%27 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%28 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%29 = call i32 @array_equal(double* %27, double* %28, i32 6)
%30 = call i32 @assert(i32 %29)
ret void
}

LLVM IR (-O2):
@__const.test1.a = [3 x double] [double 4.000000e+00, double 1.500000e+01, double 1.600000e+01]
@__const.test1.b = [3 x double] [double 8.000000e+00, double 2.300000e+01, double 4.200000e+01]
define void @test1() {
%1 = alloca [3 x double]
%2 = alloca [3 x double]
%3 = alloca [6 x double]
%4 = alloca [6 x double]
%5 = bitcast [3 x double]* %1 to i8*
%6 = bitcast [3 x double]* %2 to i8*
%7 = bitcast [6 x double]* %3 to i8*
%8 = bitcast [6 x double]* %4 to i8*
%9 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 0
%10 = bitcast [6 x double]* %4 to <2 x double>*
store <2 x double> <double 4.000000e+00, double 8.000000e+00>, <2 x double>* %10
%11 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 2
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> <double 1.500000e+01, double 1.600000e+01>, <2 x double>* %12
%13 = getelementptr inbounds [6 x double], [6 x double]* %4, i64 0, i64 4
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> <double 2.300000e+01, double 4.200000e+01>, <2 x double>* %14
%15 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%17 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%18 = call i32 @merge(double* %15, double* %16, double* %17, i32 3, i32 3)
%19 = call i32 @array_equal(double* %17, double* %9, i32 6)
%20 = call i32 @assert(i32 %19)
%21 = call i32 @merge(double* %16, double* %15, double* %17, i32 3, i32 3)
%22 = call i32 @array_equal(double* %17, double* %9, i32 6)
%23 = call i32 @assert(i32 %22)
ret void
}