#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*/ a;

/* Variables and functions */
int /*<<< orphan*/ merge(int *, int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[] = {3,   10,   6,   15, 22,  1,   40, 8,   21,  7,  8,  45, 31,
             37,  20,   9,   18, 2,   23,  67, 29,  200, 24, 34, 56, 12,
             5,   88,   44,  32, 46,  64,  31, 87,  364, 31, 66, 31, 564,
             6,   6654, 546, 8,  132, 58,  56, 9,   56,  32, 54, 12, 64,
             132, 32,   956, 98, 36,  546, 13, 978, 3,   31, 46};
  int len = sizeof(a) / sizeof(a[0]);
  int temp[len];
  merge(a, temp, 0, len - 1);
  for (int i = 0; i < len; i++)
    printf("%d ", temp[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rsi
lea    -0x100(%rbp),%rdi
mov    $0xfc,%edx
call   1040 <memcpy@plt>
movl   $0x3f,-0x104(%rbp)
mov    -0x104(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x110(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x128(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x118(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x104(%rbp),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
call   1050 <merge@plt>
movl   $0x0,-0x11c(%rbp)
mov    -0x11c(%rbp),%eax
cmp    -0x104(%rbp),%eax
jge    11fb <main+0xcb>
mov    -0x128(%rbp),%rax
movslq -0x11c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xf1a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    11b8 <main+0x88>
movl   $0x0,-0x4(%rbp)
mov    -0x110(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
lea    0xebd(%rip),%rsi
lea    0x100(%rsp),%r15
mov    $0xfc,%edx
mov    %r15,%rdi
call   1040 <memcpy@plt>
mov    %rsp,%r14
mov    %rsp,%rsi
xor    %ebx,%ebx
mov    %r15,%rdi
xor    %edx,%edx
mov    $0x3e,%ecx
call   1050 <merge@plt>
lea    0xf86(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x3f,%rbx
jne    1180 <main+0x50>
mov    %r14,%rsp
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.a = [63 x i32] [i32 3, i32 10, i32 6, i32 15, i32 22, i32 1, i32 40, i32 8, i32 21, i32 7, i32 8, i32 45, i32 31, i32 37, i32 20, i32 9, i32 18, i32 2, i32 23, i32 67, i32 29, i32 200, i32 24, i32 34, i32 56, i32 12, i32 5, i32 88, i32 44, i32 32, i32 46, i32 64, i32 31, i32 87, i32 364, i32 31, i32 66, i32 31, i32 564, i32 6, i32 6654, i32 546, i32 8, i32 132, i32 58, i32 56, i32 9, i32 56, i32 32, i32 54, i32 12, i32 64, i32 132, i32 32, i32 956, i32 98, i32 36, i32 546, i32 13, i32 978, i32 3, i32 31, i32 46]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [63 x i32]
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [63 x i32]* %2 to i8*
store i32 63, i32* %3
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %4
%11 = alloca i32, i64 %9
store i64 %9, i64* %5
%12 = getelementptr inbounds [63 x i32], [63 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = call i32 @merge(i32* %12, i32* %11, i32 0, i32 %14)
store i32 0, i32* %6
br label %16
16: ; preds = %26, %0
%17 = load i32, i32* %6
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %11, i64 %22
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %20
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %16
29: ; preds = %16
store i32 0, i32* %1
%30 = load i8*, i8** %4
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@__const.main.a = [63 x i32] [i32 3, i32 10, i32 6, i32 15, i32 22, i32 1, i32 40, i32 8, i32 21, i32 7, i32 8, i32 45, i32 31, i32 37, i32 20, i32 9, i32 18, i32 2, i32 23, i32 67, i32 29, i32 200, i32 24, i32 34, i32 56, i32 12, i32 5, i32 88, i32 44, i32 32, i32 46, i32 64, i32 31, i32 87, i32 364, i32 31, i32 66, i32 31, i32 564, i32 6, i32 6654, i32 546, i32 8, i32 132, i32 58, i32 56, i32 9, i32 56, i32 32, i32 54, i32 12, i32 64, i32 132, i32 32, i32 956, i32 98, i32 36, i32 546, i32 13, i32 978, i32 3, i32 31, i32 46]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [63 x i32]
%2 = bitcast [63 x i32]* %1 to i8*
%3 = tail call i8* @llvm.stacksave()
%4 = alloca [63 x i32]
%5 = getelementptr inbounds [63 x i32], [63 x i32]* %4, i64 0, i64 0
%6 = getelementptr inbounds [63 x i32], [63 x i32]* %1, i64 0, i64 0
%7 = call i32 @merge(i32* %6, i32* %5, i32 0, i32 62)
br label %9
8: ; preds = %9
ret i32 0
9: ; preds = %0, %9
%10 = phi i64 [ 0, %0 ], [ %14, %9 ]
%11 = getelementptr inbounds [63 x i32], [63 x i32]* %4, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, 63
br i1 %15, label %8, label %9
}