#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*/ printf(char *, int);
int main() {
  int nums1[10] = {1, 2, 3, 0, 0, 0}, m = 3;
  int nums2[10] = {2, 5, 6}, n = 3;
  merge(nums1, 6, m, nums2, 3, n);
  for (int i = 0; i < m + n; i++) {
    printf("%d\n", nums1[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0x3,-0x28(%rbp)
movl   $0x3,-0x34(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x2,-0x60(%rbp)
movl   $0x5,-0x5c(%rbp)
movl   $0x6,-0x58(%rbp)
movl   $0x3,-0x64(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
lea    -0x60(%rbp),%rcx
mov    -0x64(%rbp),%r9d
mov    $0x6,%esi
mov    $0x3,%r8d
call   1050 <merge@plt>
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    -0x34(%rbp),%ecx
add    -0x64(%rbp),%ecx
cmp    %ecx,%eax
jge    11f0 <main+0xc0>
movslq -0x68(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11bd <main+0x8d>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movabs $0x200000001,%rax
mov    %rax,(%rsp)
movl   $0x3,0x8(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movq   $0x0,0x50(%rsp)
movabs $0x500000002,%rax
mov    %rax,0x30(%rsp)
movl   $0x6,0x38(%rsp)
mov    %rsp,%rdi
lea    0x30(%rsp),%rcx
mov    $0x6,%esi
mov    $0x3,%edx
mov    $0x3,%r8d
mov    $0x3,%r9d
call   1040 <merge@plt>
mov    (%rsp),%esi
lea    0xe59(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [10 x i32]* %2 to i8*
%8 = bitcast i8* %7 to [10 x i32]*
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i32 0, i32 0
store i32 1, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i32 0, i32 1
store i32 2, i32* %10
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i32 0, i32 2
store i32 3, i32* %11
store i32 3, i32* %3
%12 = bitcast [10 x i32]* %4 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 5, i32* %15
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %13, i32 0, i32 2
store i32 6, i32* %16
store i32 3, i32* %5
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%18 = load i32, i32* %3
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%20 = load i32, i32* %5
%21 = call i32 @merge(i32* %17, i32 6, i32 %18, i32* %19, i32 3, i32 %20)
store i32 0, i32* %6
br label %22
22: ; preds = %34, %0
%23 = load i32, i32* %6
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = add nsw i32 %24, %25
%27 = icmp slt i32 %23, %26
br i1 %27, label %28, label %37
28: ; preds = %22
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %22
37: ; preds = %22
%38 = load i32, i32* %1
ret i32 %38
}

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