#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*/ insertion_sort(double *, int);
int /*<<< orphan*/ printf(char *, ...);
double rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main(void) {
  double srcdata[10];
  int idx, jdx;
  srand(time(NULL));
  for (idx = 0; idx < 10; idx++) {
    srcdata[idx] = rand() * 1.0 / RAND_MAX;
  }
  for (idx = 0; idx < 10; idx++) {
    if (idx % 10 == 0)
      printf("\n\n");
    printf(" %f, ", srcdata[idx]);
  }
  printf("\n");
  insertion_sort(srcdata, 10);
  for (idx = 0; idx < 10; idx++) {
    if (idx % 10 == 0)
      printf("\n\n");
    printf(" %f, ", srcdata[idx]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    11af <main+0x5f>
mov    $0x0,%al
call   1070 <rand@plt>
movsd  0xe78(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e55(%rip),%rax
divsd  (%rax),%xmm0
movslq -0x54(%rbp),%rax
movsd  %xmm0,-0x50(%rbp,%rax,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    116f <main+0x1f>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    1208 <main+0xb8>
mov    -0x54(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11e2 <main+0x92>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x54(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
lea    0xe18(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11b6 <main+0x66>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1060 <insertion_sort@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    127d <main+0x12d>
mov    -0x54(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1257 <main+0x107>
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x54(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
lea    0xda3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    122b <main+0xdb>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xb8,%rsp
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
xor    %eax,%eax
call   1090 <rand@plt>
movaps %xmm0,0x40(%rsp)
mov    0x2e4d(%rip),%rbx
movsd  (%rbx),%xmm0
movapd %xmm0,0x30(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd 0x40(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0x30(%rsp),%xmm0
movhpd (%rbx),%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,0x40(%rsp)
movapd %xmm1,0x50(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd %xmm0,0x30(%rsp)
movsd  (%rbx),%xmm0
movapd %xmm0,0x20(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0x20(%rsp),%xmm0
movhpd (%rbx),%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movapd %xmm1,0x60(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd %xmm0,0x20(%rsp)
movsd  (%rbx),%xmm0
movapd %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0x10(%rsp),%xmm0
movhpd (%rbx),%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd %xmm1,0x70(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rbx),%xmm0
movapd %xmm0,(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd (%rsp),%xmm0
movhpd (%rbx),%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movapd %xmm1,0x80(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd %xmm0,(%rsp)
movsd  (%rbx),%xmm0
movapd %xmm0,0xa0(%rsp)
xor    %eax,%eax
call   1090 <rand@plt>
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xa0(%rsp),%xmm0
movhpd (%rbx),%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movapd %xmm1,0x90(%rsp)
lea    0xd20(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xd0b(%rip),%rbx
mov    %rbx,%rdi
movaps 0x40(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movaps 0x40(%rsp),%xmm0
movhlps %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movaps 0x30(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movaps 0x30(%rsp),%xmm0
movhlps %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movaps 0x20(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movaps 0x20(%rsp),%xmm0
movhlps %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movaps 0x10(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
movaps (%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
movaps (%rsp),%xmm0
movhlps %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x50(%rsp),%rdi
mov    $0xa,%esi
call   1080 <insertion_sort@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
movsd  0x50(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x58(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x60(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x68(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x70(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x78(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x80(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x88(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x90(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x98(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
@.str = [3 x i8] c"\0A\0A\00"
@.str.1 = [6 x i8] c" %f, \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca [10 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, 10
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 [10 x double], [10 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
store i32 0, i32* %2
br label %21
21: ; preds = %36, %20
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 10
br i1 %23, label %24, label %39
24: ; preds = %21
%25 = load i32, i32* %2
%26 = srem i32 %25, 10
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %24
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 %32
%34 = load double, double* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %21
39: ; preds = %21
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%41 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%42 = call i32 @insertion_sort(double* %41, i32 10)
store i32 0, i32* %2
br label %43
43: ; preds = %58, %39
%44 = load i32, i32* %2
%45 = icmp slt i32 %44, 10
br i1 %45, label %46, label %61
46: ; preds = %43
%47 = load i32, i32* %2
%48 = srem i32 %47, 10
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %52
52: ; preds = %50, %46
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 %54
%56 = load double, double* %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %56)
br label %58
58: ; preds = %52
%59 = load i32, i32* %2
%60 = add nsw i32 %59, 1
store i32 %60, i32* %2
br label %43
61: ; preds = %43
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
@.str.1 = [6 x i8] c" %f, \00"
@str.3 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca [10 x double]
%2 = bitcast [10 x double]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call double (...) @rand()
%6 = load double, double* @RAND_MAX
%7 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%8 = tail call double (...) @rand()
%9 = load double, double* @RAND_MAX
%10 = insertelement <2 x double> poison, double %5, i64 0
%11 = insertelement <2 x double> %10, double %8, i64 1
%12 = insertelement <2 x double> poison, double %6, i64 0
%13 = insertelement <2 x double> %12, double %9, i64 1
%14 = fdiv <2 x double> %11, %13
%15 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 1
%16 = bitcast [10 x double]* %1 to <2 x double>*
store <2 x double> %14, <2 x double>* %16
%17 = tail call double (...) @rand()
%18 = load double, double* @RAND_MAX
%19 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 2
%20 = tail call double (...) @rand()
%21 = load double, double* @RAND_MAX
%22 = insertelement <2 x double> poison, double %17, i64 0
%23 = insertelement <2 x double> %22, double %20, i64 1
%24 = insertelement <2 x double> poison, double %18, i64 0
%25 = insertelement <2 x double> %24, double %21, i64 1
%26 = fdiv <2 x double> %23, %25
%27 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 3
%28 = bitcast double* %19 to <2 x double>*
store <2 x double> %26, <2 x double>* %28
%29 = tail call double (...) @rand()
%30 = load double, double* @RAND_MAX
%31 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 4
%32 = tail call double (...) @rand()
%33 = load double, double* @RAND_MAX
%34 = insertelement <2 x double> poison, double %29, i64 0
%35 = insertelement <2 x double> %34, double %32, i64 1
%36 = insertelement <2 x double> poison, double %30, i64 0
%37 = insertelement <2 x double> %36, double %33, i64 1
%38 = fdiv <2 x double> %35, %37
%39 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 5
%40 = bitcast double* %31 to <2 x double>*
store <2 x double> %38, <2 x double>* %40
%41 = tail call double (...) @rand()
%42 = load double, double* @RAND_MAX
%43 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 6
%44 = tail call double (...) @rand()
%45 = load double, double* @RAND_MAX
%46 = insertelement <2 x double> poison, double %41, i64 0
%47 = insertelement <2 x double> %46, double %44, i64 1
%48 = insertelement <2 x double> poison, double %42, i64 0
%49 = insertelement <2 x double> %48, double %45, i64 1
%50 = fdiv <2 x double> %47, %49
%51 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 7
%52 = bitcast double* %43 to <2 x double>*
store <2 x double> %50, <2 x double>* %52
%53 = tail call double (...) @rand()
%54 = load double, double* @RAND_MAX
%55 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 8
%56 = tail call double (...) @rand()
%57 = load double, double* @RAND_MAX
%58 = insertelement <2 x double> poison, double %53, i64 0
%59 = insertelement <2 x double> %58, double %56, i64 1
%60 = insertelement <2 x double> poison, double %54, i64 0
%61 = insertelement <2 x double> %60, double %57, i64 1
%62 = fdiv <2 x double> %59, %61
%63 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 9
%64 = bitcast double* %55 to <2 x double>*
store <2 x double> %62, <2 x double>* %64
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
%66 = extractelement <2 x double> %14, i64 0
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %66)
%68 = extractelement <2 x double> %14, i64 1
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %68)
%70 = extractelement <2 x double> %26, i64 0
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %70)
%72 = extractelement <2 x double> %26, i64 1
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %72)
%74 = extractelement <2 x double> %38, i64 0
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %74)
%76 = extractelement <2 x double> %38, i64 1
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %76)
%78 = extractelement <2 x double> %50, i64 0
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %78)
%80 = extractelement <2 x double> %50, i64 1
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %80)
%82 = extractelement <2 x double> %62, i64 0
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %82)
%84 = extractelement <2 x double> %62, i64 1
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %84)
%86 = tail call i32 @putchar(i32 10)
%87 = call i32 @insertion_sort(double* %7, i32 10)
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
%89 = load double, double* %7
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %89)
%91 = load double, double* %15
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %91)
%93 = load double, double* %19
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %93)
%95 = load double, double* %27
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %95)
%97 = load double, double* %31
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %97)
%99 = load double, double* %39
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %99)
%101 = load double, double* %43
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %101)
%103 = load double, double* %51
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %103)
%105 = load double, double* %55
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %105)
%107 = load double, double* %63
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %107)
%109 = call i32 @putchar(i32 10)
ret void
}