#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);
void MSort(int SR[], int TR1[], int s, int t) {
  int m;
  int TR2[10 + 1];
  if (s == t) {
    TR1[s] = SR[s];
  } else {
    m = (s + t) / 2;
    MSort(SR, TR2, s, m);
    MSort(SR, TR2, m + 1, t);
    Merge(TR2, TR1, s, m, t);
  }
}


x86 assembly (clang, -O0):
<MSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    115d <MSort+0x3d>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11ae <MSort+0x8e>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <MSort@plt>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1030 <MSort@plt>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1040 <Merge@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MSort>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,%r13d
mov    %rsi,%r14
mov    %rdi,%r12
cmp    %ecx,%edx
jne    1148 <MSort+0x28>
movslq %r13d,%rax
mov    (%r12,%rax,4),%ecx
mov    %ecx,(%r14,%rax,4)
jmp    118f <MSort+0x6f>
mov    %ecx,%r15d
lea    (%r15,%r13,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %rsp,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
call   1030 <MSort@plt>
lea    0x1(%rbx),%edx
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r15d,%ecx
call   1030 <MSort@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
call   1040 <Merge@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @MSort(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [11 x i32]
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %4
%15 = load i32*, i32** %5
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = load i32*, i32** %6
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
br label %44
24: ; preds = %4
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = add nsw i32 %25, %26
%28 = sdiv i32 %27, 2
store i32 %28, i32* %9
%29 = load i32*, i32** %5
%30 = getelementptr inbounds [11 x i32], [11 x i32]* %10, i64 0, i64 0
%31 = load i32, i32* %7
%32 = load i32, i32* %9
%33 = load i32*, i32** %5
%34 = getelementptr inbounds [11 x i32], [11 x i32]* %10, i64 0, i64 0
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %8
%38 = getelementptr inbounds [11 x i32], [11 x i32]* %10, i64 0, i64 0
%39 = load i32*, i32** %6
%40 = load i32, i32* %7
%41 = load i32, i32* %9
%42 = load i32, i32* %8
%43 = call i32 @Merge(i32* %38, i32* %39, i32 %40, i32 %41, i32 %42)
br label %44
44: ; preds = %24, %14
ret void
}

LLVM IR (-O2):
define void @MSort(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca [11 x i32]
%6 = bitcast [11 x i32]* %5 to i8*
%7 = icmp eq i32 %2, %3
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %1, i64 %9
store i32 %11, i32* %12
br label %19
13: ; preds = %4
%14 = add nsw i32 %3, %2
%15 = sdiv i32 %14, 2
%16 = getelementptr inbounds [11 x i32], [11 x i32]* %5, i64 0, i64 0
%17 = add nsw i32 %15, 1
%18 = call i32 @Merge(i32* %16, i32* %1, i32 %2, i32 %15, i32 %3)
br label %19
19: ; preds = %13, %8
ret void
}