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

/* Variables and functions */
int /*<<< orphan*/ mergesort(size_t, int *);
int /*<<< orphan*/ print_array(size_t, int *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int v[] = {1, 7, 14, 12, 12, 3, 5, 4, 732, 1000, 1};
  size_t size = sizeof(v) / sizeof(v[0]);
  print_array(size, v);
  printf("\n");
  mergesort(size, v);
  print_array(size, v);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x2c,%edx
call   1050 <memcpy@plt>
movq   $0xb,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <print_array@plt>
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <mergesort@plt>
mov    -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <print_array@plt>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xee0(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    $0xb,%edi
mov    %rbx,%rsi
call   1040 <print_array@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xb,%edi
mov    %rbx,%rsi
call   1050 <mergesort@plt>
mov    $0xb,%edi
mov    %rbx,%rsi
call   1040 <print_array@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.v = [11 x i32] [i32 1, i32 7, i32 14, i32 12, i32 12, i32 3, i32 5, i32 4, i32 732, i32 1000, i32 1]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [11 x i32]
%4 = bitcast [11 x i32]* %3 to i8*
%5 = getelementptr inbounds [11 x i32], [11 x i32]* %3, i64 0, i64 0
%6 = call i32 @print_array(i64 11, i32* %5)
%7 = call i32 @putchar(i32 10)
%8 = call i32 @mergesort(i64 11, i32* %5)
%9 = call i32 @print_array(i64 11, i32* %5)
%10 = call i32 @putchar(i32 10)
ret i32 0
}