#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*/ mergesort_rec(int *, int /*<<< orphan*/, int /*<<< orphan*/,
                                 int, int *);
int printarray(int *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int array1[(25)];
  int array2[(25)];
  int i;
  srand(time(NULL));
  for (i = 0; i < (25); ++i) {
    array1[i] = array2[i] = rand() % 100;
  }
  printarray(array1);
  mergesort_rec(array1, (0), 0, (25) - 1, array2);
  return printarray(array2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0xe4(%rbp)
cmpl   $0x19,-0xe4(%rbp)
jge    11c5 <main+0x75>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq -0xe4(%rbp),%rax
mov    %edx,-0xe0(%rbp,%rax,4)
movslq -0xe4(%rbp),%rax
mov    %edx,-0x70(%rbp,%rax,4)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    117c <main+0x2c>
lea    -0x70(%rbp),%rdi
call   1060 <printarray@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%r8
xor    %edx,%edx
mov    $0x18,%ecx
mov    %edx,%esi
call   1050 <mergesort_rec@plt>
lea    -0xe0(%rbp),%rdi
call   1060 <printarray@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsp,%rbx,4)
mov    %eax,0x70(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x19,%rbx
jne    1170 <main+0x20>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <printarray@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x18,%ecx
mov    %r14,%r8
call   1050 <mergesort_rec@plt>
mov    %r14,%rdi
call   1060 <printarray@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [25 x i32]
%3 = alloca [25 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
store i32 0, i32* %4
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 25
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 100
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [25 x i32], [25 x i32]* %3, i64 0, i64 %14
store i32 %12, i32* %15
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 %17
store i32 %12, i32* %18
br label %19
19: ; preds = %10
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %7
22: ; preds = %7
%23 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 0
%24 = call i32 @printarray(i32* %23)
%25 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 0
%26 = getelementptr inbounds [25 x i32], [25 x i32]* %3, i64 0, i64 0
%27 = call i32 @mergesort_rec(i32* %25, i32 0, i32 0, i32 24, i32* %26)
%28 = getelementptr inbounds [25 x i32], [25 x i32]* %3, i64 0, i64 0
%29 = call i32 @printarray(i32* %28)
ret i32 %29
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [25 x i32]
%2 = alloca [25 x i32]
%3 = bitcast [25 x i32]* %1 to i8*
%4 = bitcast [25 x i32]* %2 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
br label %7
7: ; preds = %0, %7
%8 = phi i64 [ 0, %0 ], [ %13, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 100
%11 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 %8
store i32 %10, i32* %11
%12 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 %8
store i32 %10, i32* %12
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, 25
br i1 %14, label %15, label %7
15: ; preds = %7
%16 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 0
%17 = call i32 @printarray(i32* %16)
%18 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 0
%19 = call i32 @mergesort_rec(i32* %16, i32 0, i32 0, i32 24, i32* %18)
%20 = call i32 @printarray(i32* %18)
ret i32 %20
}