#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*/ data3;
typedef int /*<<< orphan*/ data2;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ mergeTwoSortedWithoutExtracSpace(int *, int, int);
int /*<<< orphan*/ mergeTwoSortedWithoutExtracSpace2(int *, int, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int data[] = {1, 3, 6, 8, -5, -2, 3, 8};
  int size = sizeof(data) / sizeof(data[0]);
  mergeTwoSortedWithoutExtracSpace(data, size, 4);
  printf("----------\n");
  int data2[] = {1, 3, 8, 12, -5, -2, 4, 7, 9, 10};
  int size2 = sizeof(data2) / sizeof(data2[0]);
  mergeTwoSortedWithoutExtracSpace2(data2, size2, 4);
  printf("----------\n");
  int data3[] = {1, 3, 8, 12, 16, 18, -5, -2, 4, 9};
  int size3 = sizeof(data3) / sizeof(data3[0]);
  mergeTwoSortedWithoutExtracSpace2(data3, size3, 6);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    $0x4,%edx
call   1060 <mergeTwoSortedWithoutExtracSpace@plt>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
mov    $0x4,%edx
call   1050 <mergeTwoSortedWithoutExtracSpace2@plt>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    0xe77(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x94(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x94(%rbp),%esi
mov    $0x6,%edx
call   1050 <mergeTwoSortedWithoutExtracSpace2@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0x60(%rsp),%rdi
mov    $0x8,%esi
mov    $0x4,%edx
call   1050 <mergeTwoSortedWithoutExtracSpace@plt>
lea    0xf0d(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xec6(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe8e(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
call   1040 <mergeTwoSortedWithoutExtracSpace2@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xeb6(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7e(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
mov    $0x6,%edx
call   1040 <mergeTwoSortedWithoutExtracSpace2@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.data = [8 x i32] [i32 1, i32 3, i32 6, i32 8, i32 -5, i32 -2, i32 3, i32 8]
@.str = [12 x i8] c"----------\0A\00"
@__const.main.data2 = [10 x i32] [i32 1, i32 3, i32 8, i32 12, i32 -5, i32 -2, i32 4, i32 7, i32 9, i32 10]
@__const.main.data3 = [10 x i32] [i32 1, i32 3, i32 8, i32 12, i32 16, i32 18, i32 -5, i32 -2, i32 4, i32 9]
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca [10 x i32]
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 @mergeTwoSortedWithoutExtracSpace(i32* %9, i32 %10, i32 4)
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%13 = bitcast [10 x i32]* %4 to i8*
store i32 10, i32* %5
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%15 = load i32, i32* %5
%16 = call i32 @mergeTwoSortedWithoutExtracSpace2(i32* %14, i32 %15, i32 4)
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%18 = bitcast [10 x i32]* %6 to i8*
store i32 10, i32* %7
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%20 = load i32, i32* %7
%21 = call i32 @mergeTwoSortedWithoutExtracSpace2(i32* %19, i32 %20, i32 6)
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}

LLVM IR (-O2):
@__const.main.data = [8 x i32] [i32 1, i32 3, i32 6, i32 8, i32 -5, i32 -2, i32 3, i32 8]
@__const.main.data2 = [10 x i32] [i32 1, i32 3, i32 8, i32 12, i32 -5, i32 -2, i32 4, i32 7, i32 9, i32 10]
@__const.main.data3 = [10 x i32] [i32 1, i32 3, i32 8, i32 12, i32 16, i32 18, i32 -5, i32 -2, i32 4, i32 9]
@EXIT_SUCCESS = global i32 0
@str.1 = [11 x i8] c"----------\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = bitcast [8 x i32]* %1 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%6 = call i32 @mergeTwoSortedWithoutExtracSpace(i32* %5, i32 8, i32 4)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.1, i64 0, i64 0))
%8 = bitcast [10 x i32]* %2 to i8*
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%10 = call i32 @mergeTwoSortedWithoutExtracSpace2(i32* %9, i32 10, i32 4)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.1, i64 0, i64 0))
%12 = bitcast [10 x i32]* %3 to i8*
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%14 = call i32 @mergeTwoSortedWithoutExtracSpace2(i32* %13, i32 10, i32 6)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}