#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*/ arrayPrint(int *, int);
int /*<<< orphan*/ merge(int *, int *, int, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int a[] = {1, 2, 3, 4, 0, 0};
  int b[] = {5, 6};
  int aSize = sizeof(a) / sizeof(int);
  int bSize = sizeof(b) / sizeof(int);
  printf("array A: ");
  arrayPrint(a, aSize - bSize);
  printf("array B: ");
  arrayPrint(b, bSize);
  merge(a, b, aSize - bSize, bSize);
  printf("array A after merging: ");
  arrayPrint(a, aSize);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x6,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
sub    -0x30(%rbp),%esi
call   1030 <arrayPrint@plt>
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
lea    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%esi
call   1030 <arrayPrint@plt>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
sub    -0x30(%rbp),%edx
mov    -0x30(%rbp),%ecx
call   1050 <merge@plt>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1030 <arrayPrint@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0xed2(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x600000005,%rax
mov    %rax,0x8(%rsp)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <arrayPrint@plt>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <arrayPrint@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1050 <merge@plt>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
call   1030 <arrayPrint@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.a = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 0, i32 0]
@__const.main.b = [2 x i32] [i32 5, i32 6]
@.str = [10 x i8] c"array A: \00"
@.str.1 = [10 x i8] c"array B: \00"
@.str.2 = [24 x i8] c"array A after merging: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [6 x i32]* %2 to i8*
%7 = bitcast [2 x i32]* %3 to i8*
store i32 6, i32* %4
store i32 2, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = sub nsw i32 %10, %11
%13 = call i32 @arrayPrint(i32* %9, i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%16 = load i32, i32* %5
%17 = call i32 @arrayPrint(i32* %15, i32 %16)
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = sub nsw i32 %20, %21
%23 = load i32, i32* %5
%24 = call i32 @merge(i32* %18, i32* %19, i32 %22, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%27 = load i32, i32* %4
%28 = call i32 @arrayPrint(i32* %26, i32 %27)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 0, i32 0]
@.str = [10 x i8] c"array A: \00"
@.str.1 = [10 x i8] c"array B: \00"
@.str.2 = [24 x i8] c"array A after merging: \00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca i64
%3 = bitcast [6 x i32]* %1 to i8*
%4 = bitcast i64* %2 to i8*
store i64 25769803781, i64* %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%7 = call i32 @arrayPrint(i32* %6, i32 4)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = bitcast i64* %2 to i32*
%10 = call i32 @arrayPrint(i32* %9, i32 2)
%11 = call i32 @merge(i32* %6, i32* %9, i32 4, i32 2)
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @arrayPrint(i32* %6, i32 6)
ret i32 0
}