#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*/ nums2;
typedef int /*<<< orphan*/ nums1;

/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int i;
  int nums1[] = {1, 3, 5, 7, 9, 0, 0, 0, 0, 0};
  int nums2[] = {2, 4, 6, 8, 10};
  int size1 = 5;
  int size2 = sizeof(nums2) / sizeof(*nums2);
  merge(nums1, size1, nums2, size2);
  for (i = 0; i < sizeof(nums1) / sizeof(*nums1); i++) {
    printf("%d ", nums1[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x40(%rbp)
movl   $0x3,-0x3c(%rbp)
movl   $0x5,-0x38(%rbp)
movl   $0x7,-0x34(%rbp)
movl   $0x9,-0x30(%rbp)
mov    0xe80(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe7d(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe7b(%rip),%eax
mov    %eax,-0x50(%rbp)
movl   $0x5,-0x64(%rbp)
movl   $0x5,-0x68(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x64(%rbp),%esi
lea    -0x60(%rbp),%rdx
mov    -0x68(%rbp),%ecx
call   1050 <merge@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0xa,%rax
jae    11f2 <main+0xc2>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c0 <main+0x90>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x9,0x10(%rsp)
mov    0xec1(%rip),%eax
mov    %eax,0x40(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rdi
lea    0x30(%rsp),%rdx
mov    $0x5,%esi
mov    $0x5,%ecx
call   1050 <merge@plt>
mov    (%rsp),%esi
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.nums2 = [5 x i32] [i32 2, i32 4, i32 6, i32 8, i32 10]
@.str = [4 x i8] c"%d \00"
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 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
%12 = bitcast [10 x i32]* %3 to <4 x i32>*
store <4 x i32> <i32 1, i32 3, i32 5, i32 7>, <4 x i32>* %12
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
store i32 9, i32* %13
%14 = bitcast [5 x i32]* %4 to i8*
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%16 = call i32 @merge(i32* %8, i32 5, i32* %15, i32 5)
%17 = load i32, i32* %8
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %9
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %10
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %11
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %13
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = call i32 @putchar(i32 10)
ret i32 0
}