#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 */
double RAND_MAX;
int /*<<< orphan*/ merge_sort(double *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printArray(double *, int /*<<< orphan*/, int);
double rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main(void) {
  double srcdata[100];
  int idx, jdx;
  srand(time(NULL));
  for (idx = 0; idx < 100; idx++) {
    srcdata[idx] = rand() * 1.0 / RAND_MAX;
  }
  printArray(srcdata, 0, 100 - 1);
  merge_sort(srcdata, 0, 100 - 1);
  printArray(srcdata, 0, 100 - 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x324(%rbp)
cmpl   $0x64,-0x324(%rbp)
jge    11c4 <main+0x74>
mov    $0x0,%al
call   1070 <rand@plt>
movsd  0xe6f(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e4c(%rip),%rax
divsd  (%rax),%xmm0
movslq -0x324(%rbp),%rax
movsd  %xmm0,-0x320(%rbp,%rax,8)
ff ff
mov    -0x324(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x324(%rbp)
jmp    1175 <main+0x25>
lea    -0x320(%rbp),%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1060 <printArray@plt>
lea    -0x320(%rbp),%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1050 <merge_sort@plt>
lea    -0x320(%rbp),%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1060 <printArray@plt>
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x328,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    0x2e79(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
divsd  (%r14),%xmm0
movsd  %xmm0,(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1180 <main+0x30>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1060 <printArray@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1050 <merge_sort@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1060 <printArray@plt>
add    $0x328,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define void @main() {
%1 = alloca [100 x double]
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
store i32 0, i32* %2
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = call double (...) @rand()
%11 = fmul double %10, 1.000000e+00
%12 = load double, double* @RAND_MAX
%13 = fdiv double %11, %12
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %15
store double %13, double* %16
br label %17
17: ; preds = %9
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %6
20: ; preds = %6
%21 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 0
%22 = call i32 @printArray(double* %21, i32 0, i32 99)
%23 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 0
%24 = call i32 @merge_sort(double* %23, i32 0, i32 99)
%25 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 0
%26 = call i32 @printArray(double* %25, i32 0, i32 99)
ret void
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define void @main() {
%1 = alloca [100 x double]
%2 = bitcast [100 x double]* %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 double (...) @rand()
%8 = load double, double* @RAND_MAX
%9 = fdiv double %7, %8
%10 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %6
store double %9, double* %10
%11 = add nuw nsw i64 %6, 1
%12 = icmp eq i64 %11, 100
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 0
%15 = call i32 @printArray(double* %14, i32 0, i32 99)
%16 = call i32 @merge_sort(double* %14, i32 0, i32 99)
%17 = call i32 @printArray(double* %14, i32 0, i32 99)
ret void
}