#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*/ merge(int *, int *, int *, int, int *, int);
int /*<<< orphan*/ printIntArray(int *, int);
int main(void) {
  int x[10] = {1, 3, 5, 6, 7};
  int y[10] = {2, 3, 4};
  int z[10 + 10];
  int nz;
  merge(z, &nz, x, 5, y, 3);
  printIntArray(z, nz);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x5,-0x28(%rbp)
movl   $0x6,-0x24(%rbp)
movl   $0x7,-0x20(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0x2,-0x60(%rbp)
movl   $0x3,-0x5c(%rbp)
movl   $0x4,-0x58(%rbp)
lea    -0xb0(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x60(%rbp),%r8
lea    -0xb4(%rbp),%rsi
mov    $0x5,%ecx
mov    $0x3,%r9d
call   1040 <merge@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xb4(%rbp),%esi
call   1050 <printIntArray@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xc0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movq   $0x0,0x60(%rsp)
movaps 0xec0(%rip),%xmm1
movaps %xmm1,0x40(%rsp)
movl   $0x7,0x50(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movabs $0x300000002,%rax
mov    %rax,0x10(%rsp)
movl   $0x4,0x18(%rsp)
lea    0x70(%rsp),%rbx
lea    0xc(%rsp),%rsi
lea    0x40(%rsp),%rdx
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
mov    $0x5,%ecx
mov    $0x3,%r9d
call   1030 <merge@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printIntArray@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = bitcast [10 x i32]* %1 to i8*
%6 = bitcast i8* %5 to [10 x i32]*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 0
store i32 1, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 1
store i32 3, i32* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 2
store i32 5, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 3
store i32 6, i32* %10
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i32 0, i32 4
store i32 7, i32* %11
%12 = bitcast [10 x i32]* %2 to i8*
%13 = bitcast i8* %12 to [10 x i32]*
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 0
store i32 2, i32* %14
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 1
store i32 3, i32* %15
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 2
store i32 4, i32* %16
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%20 = call i32 @merge(i32* %17, i32* %4, i32* %18, i32 5, i32* %19, i32 3)
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%22 = load i32, i32* %4
%23 = call i32 @printIntArray(i32* %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = bitcast [10 x i32]* %1 to i8*
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%7 = bitcast i32* %6 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%9 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 3, i32 5, i32 6>, <4 x i32>* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 7, i32* %10
%11 = bitcast [10 x i32]* %2 to i8*
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 2, i32* %12
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 1
store i32 3, i32* %13
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
store i32 4, i32* %14
%15 = bitcast [20 x i32]* %3 to i8*
%16 = bitcast i32* %4 to i8*
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
%18 = call i32 @merge(i32* %17, i32* %4, i32* %8, i32 5, i32* %12, i32 3)
%19 = load i32, i32* %4
%20 = call i32 @printIntArray(i32* %17, i32 %19)
ret i32 0
}