#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*/ printf(char *, double, double);
double *read_file(long *);
int /*<<< orphan*/ sort(double *, long);
int main(int argc, char **argv) {
  double *array;
  long i, array_length;
  array = read_file(&array_length);
  sort(array, array_length);
  for (i = 0; i < array_length; i++) {
    printf("%f %f\n", array[i], (double)i / (array_length - 1));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
call   1050 <read_file@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <sort@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    11b7 <main+0x87>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
cvtsi2sd %rax,%xmm2
divsd  %xmm2,%xmm1
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1168 <main+0x38>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
call   1050 <read_file@plt>
mov    %rax,%r15
mov    0x8(%rsp),%rsi
mov    %rax,%rdi
call   1040 <sort@plt>
mov    0x8(%rsp),%rax
test   %rax,%rax
jle    11a4 <main+0x74>
xor    %ebx,%ebx
lea    0xe9a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rbx,%xmm1
add    $0xffffffffffffffff,%rax
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
divsd  %xmm2,%xmm1
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
mov    0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%f %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double*
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call double* @read_file(i64* %8)
store double* %9, double** %6
%10 = load double*, double** %6
%11 = load i64, i64* %8
%12 = call i32 @sort(double* %10, i64 %11)
store i64 0, i64* %7
br label %13
13: ; preds = %29, %2
%14 = load i64, i64* %7
%15 = load i64, i64* %8
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load double*, double** %6
%19 = load i64, i64* %7
%20 = getelementptr inbounds double, double* %18, i64 %19
%21 = load double, double* %20
%22 = load i64, i64* %7
%23 = sitofp i64 %22 to double
%24 = load i64, i64* %8
%25 = sub nsw i64 %24, 1
%26 = sitofp i64 %25 to double
%27 = fdiv double %23, %26
%28 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %21, double %27)
br label %29
29: ; preds = %17
%30 = load i64, i64* %7
%31 = add nsw i64 %30, 1
store i64 %31, i64* %7
br label %13
32: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%f %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = call double* @read_file(i64* %3)
%6 = load i64, i64* %3
%7 = call i32 @sort(double* %5, i64 %6)
%8 = load i64, i64* %3
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %2, %10
%11 = phi i64 [ %21, %10 ], [ %8, %2 ]
%12 = phi i64 [ %20, %10 ], [ 0, %2 ]
%13 = getelementptr inbounds double, double* %5, i64 %12
%14 = load double, double* %13
%15 = sitofp i64 %12 to double
%16 = add nsw i64 %11, -1
%17 = sitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %14, double %18)
%20 = add nuw nsw i64 %12, 1
%21 = load i64, i64* %3
%22 = icmp slt i64 %20, %21
br i1 %22, label %10, label %23
23: ; preds = %10, %2
ret i32 0
}