#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 *, ...);
int rand();
int /*<<< orphan*/ sort(float *);
int main() {
  float A[10];
  int i = 0;
  for (i; i < 10; i++)
    A[i] = (float)((int)(rand() * 1000) / 100);
  for (i = 0; i < 10; i++)
    printf("%f ", A[i]);
  printf("\n");
  sort(A);
  for (i = 0; i < 10; i++)
    printf("%f ", A[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1181 <main+0x51>
mov    $0x0,%al
call   1050 <rand@plt>
imul   $0x3e8,%eax,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movslq -0x34(%rbp),%rax
movss  %xmm0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1146 <main+0x16>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11bc <main+0x8c>
movslq -0x34(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe59(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1188 <main+0x58>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <sort@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    120e <main+0xde>
movslq -0x34(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe07(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11da <main+0xaa>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4c(%rsp)
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x48(%rsp)
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x44(%rsp)
movss  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x40(%rsp)
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x3c(%rsp)
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x38(%rsp)
movss  %xmm0,0x14(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x34(%rsp)
movss  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x30(%rsp)
movss  %xmm0,0x1c(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x2c(%rsp)
movss  %xmm0,0x20(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x28(%rsp)
movss  %xmm0,0x24(%rsp)
movss  0x4c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd78(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x48(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x44(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x40(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x3c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x38(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x34(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x30(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x2c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x28(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
call   1050 <sort@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x18(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x20(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x24(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f \00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = load i32, i32* %3
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = call i32 (...) @rand()
%10 = mul nsw i32 %9, 1000
%11 = sdiv i32 %10, 100
%12 = sitofp i32 %11 to float
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %14
store float %12, float* %15
br label %16
16: ; preds = %8
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %5
19: ; preds = %5
store i32 0, i32* %3
br label %20
20: ; preds = %30, %19
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %25
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %28)
br label %30
30: ; preds = %23
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %20
33: ; preds = %20
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 0
%36 = call i32 @sort(float* %35)
store i32 0, i32* %3
br label %37
37: ; preds = %47, %33
%38 = load i32, i32* %3
%39 = icmp slt i32 %38, 10
br i1 %39, label %40, label %50
40: ; preds = %37
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %42
%44 = load float, float* %43
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %45)
br label %47
47: ; preds = %40
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %37
50: ; preds = %37
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f \00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = bitcast [10 x float]* %1 to i8*
%3 = tail call i32 (...) @rand()
%4 = mul nsw i32 %3, 10
%5 = sitofp i32 %4 to float
%6 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
store float %5, float* %6
%7 = tail call i32 (...) @rand()
%8 = mul nsw i32 %7, 10
%9 = sitofp i32 %8 to float
%10 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 1
store float %9, float* %10
%11 = tail call i32 (...) @rand()
%12 = mul nsw i32 %11, 10
%13 = sitofp i32 %12 to float
%14 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 2
store float %13, float* %14
%15 = tail call i32 (...) @rand()
%16 = mul nsw i32 %15, 10
%17 = sitofp i32 %16 to float
%18 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 3
store float %17, float* %18
%19 = tail call i32 (...) @rand()
%20 = mul nsw i32 %19, 10
%21 = sitofp i32 %20 to float
%22 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 4
store float %21, float* %22
%23 = tail call i32 (...) @rand()
%24 = mul nsw i32 %23, 10
%25 = sitofp i32 %24 to float
%26 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 5
store float %25, float* %26
%27 = tail call i32 (...) @rand()
%28 = mul nsw i32 %27, 10
%29 = sitofp i32 %28 to float
%30 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 6
store float %29, float* %30
%31 = tail call i32 (...) @rand()
%32 = mul nsw i32 %31, 10
%33 = sitofp i32 %32 to float
%34 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 7
store float %33, float* %34
%35 = tail call i32 (...) @rand()
%36 = mul nsw i32 %35, 10
%37 = sitofp i32 %36 to float
%38 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 8
store float %37, float* %38
%39 = tail call i32 (...) @rand()
%40 = mul nsw i32 %39, 10
%41 = sitofp i32 %40 to float
%42 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 9
store float %41, float* %42
%43 = fpext float %5 to double
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %43)
%45 = fpext float %9 to double
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %45)
%47 = fpext float %13 to double
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %47)
%49 = fpext float %17 to double
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %49)
%51 = fpext float %21 to double
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %51)
%53 = fpext float %25 to double
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %53)
%55 = fpext float %29 to double
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %55)
%57 = fpext float %33 to double
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %57)
%59 = fpext float %37 to double
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %59)
%61 = fpext float %41 to double
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %61)
%63 = tail call i32 @putchar(i32 10)
%64 = call i32 @sort(float* %6)
%65 = load float, float* %6
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %66)
%68 = load float, float* %10
%69 = fpext float %68 to double
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %69)
%71 = load float, float* %14
%72 = fpext float %71 to double
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %72)
%74 = load float, float* %18
%75 = fpext float %74 to double
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %75)
%77 = load float, float* %22
%78 = fpext float %77 to double
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %78)
%80 = load float, float* %26
%81 = fpext float %80 to double
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %81)
%83 = load float, float* %30
%84 = fpext float %83 to double
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %84)
%86 = load float, float* %34
%87 = fpext float %86 to double
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %87)
%89 = load float, float* %38
%90 = fpext float %89 to double
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %90)
%92 = load float, float* %42
%93 = fpext float %92 to double
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %93)
%95 = call i32 @putchar(i32 10)
ret i32 0
}