#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 *insertionSort(double *, int);
int /*<<< orphan*/ printArray(double *, int);
int /*<<< orphan*/ puts(char *);
int main() {
  int n = 6;
  double arr[] = {6, 4, 2, 7, 9, 8};
  puts("array");
  printArray(arr, n);
  double *f = insertionSort(arr, n);
  puts("result");
  printArray(f, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1040 <memset@plt>
movsd  0xeba(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe51(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <printArray@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <insertionSort@plt>
mov    %rax,-0x48(%rbp)
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
mov    -0x48(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <printArray@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <printArray@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <insertionSort@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <printArray@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"array\00"
@.str.1 = [7 x i8] c"result\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [6 x double]
%4 = alloca double*
store i32 0, i32* %1
store i32 6, i32* %2
%5 = bitcast [6 x double]* %3 to i8*
%6 = bitcast i8* %5 to [6 x double]*
%7 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 0
store double 6.000000e+00, double* %7
%8 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 1
store double 4.000000e+00, double* %8
%9 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 2
store double 2.000000e+00, double* %9
%10 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 3
store double 7.000000e+00, double* %10
%11 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 4
store double 9.000000e+00, double* %11
%12 = getelementptr inbounds [6 x double], [6 x double]* %6, i32 0, i32 5
store double 8.000000e+00, double* %12
%13 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%15 = load i32, i32* %2
%16 = call i32 @printArray(double* %14, i32 %15)
%17 = getelementptr inbounds [6 x double], [6 x double]* %3, i64 0, i64 0
%18 = load i32, i32* %2
%19 = call double* @insertionSort(double* %17, i32 %18)
store double* %19, double** %4
%20 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%21 = load double*, double** %4
%22 = load i32, i32* %2
%23 = call i32 @printArray(double* %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"array\00"
@.str.1 = [7 x i8] c"result\00"
define i32 @main() {
%1 = alloca [6 x double]
%2 = bitcast [6 x double]* %1 to i8*
%3 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 0
%4 = bitcast [6 x double]* %1 to <2 x double>*
store <2 x double> <double 6.000000e+00, double 4.000000e+00>, <2 x double>* %4
%5 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 2
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 7.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds [6 x double], [6 x double]* %1, i64 0, i64 4
%8 = bitcast double* %7 to <2 x double>*
store <2 x double> <double 9.000000e+00, double 8.000000e+00>, <2 x double>* %8
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @printArray(double* %3, i32 6)
%11 = call double* @insertionSort(double* %3, i32 6)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @printArray(double* %11, i32 6)
ret i32 0
}