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


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0xffffffffffffffe7,%rbx
nopl   (%rax)
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,0xc8(%rsp,%rbx,4)
mov    %eax,0x64(%rsp,%rbx,4)
inc    %rbx
jne    1170 <main+0x20>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <printarray@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1060 <mergesort_itr@plt>
cltq
imul   $0x64,%rax,%rax
lea    (%rsp,%rax,1),%rdi
call   1050 <printarray@plt>
add    $0xd0,%rsp
pop    %rbx
ret

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

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