#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 */
typedef int /*<<< orphan*/ B;
typedef int /*<<< orphan*/ A;

/* Variables and functions */
int /*<<< orphan*/ mergeInPlace(int *, int *, int, int);
int /*<<< orphan*/ printArray(int *, int);
int main(int argc, char *argv[]) {
  int A[10] = {1, 2, 3, 4, 5, 0, 0, 0, 0, 0};
  int B[5] = {1, 2, 3, 4, 5};
  int a = 5;
  int b = sizeof(B) / sizeof(int);
  printArray(A, a);
  printArray(B, b);
  mergeInPlace(A, B, a, b);
  printArray(A, (sizeof(A) / sizeof(int)));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0x1,-0x40(%rbp)
movl   $0x2,-0x3c(%rbp)
movl   $0x3,-0x38(%rbp)
movl   $0x4,-0x34(%rbp)
movl   $0x5,-0x30(%rbp)
mov    0xe87(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe84(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe82(%rip),%eax
mov    %eax,-0x50(%rbp)
movl   $0x5,-0x64(%rbp)
movl   $0x5,-0x68(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1050 <printArray@plt>
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%esi
call   1050 <printArray@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x64(%rbp),%edx
mov    -0x68(%rbp),%ecx
call   1040 <mergeInPlace@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x40(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x5,0x30(%rsp)
mov    0xece(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   1040 <printArray@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <printArray@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
mov    $0x5,%ecx
call   1030 <mergeInPlace@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1040 <printArray@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@__const.main.B = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = alloca [5 x i32]
%5 = bitcast [10 x i32]* %3 to i8*
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%7 = bitcast i32* %6 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%9 = bitcast [10 x i32]* %3 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
store i32 5, i32* %10
%11 = bitcast [5 x i32]* %4 to i8*
%12 = call i32 @printArray(i32* %8, i32 5)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%14 = call i32 @printArray(i32* %13, i32 5)
%15 = call i32 @mergeInPlace(i32* %8, i32* %13, i32 5, i32 5)
%16 = call i32 @printArray(i32* %8, i32 10)
ret i32 0
}