#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 *, float);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  float A[10], mid;
  int i, i2;
  srand(time(NULL));
  for (i = 0; i < 10; i++)
    A[i] = rand() % 10;
  for (i = 0; i < 10; i++)
    printf("%f\n", A[i]);
  for (i = 2; i < 10; i++) {
    mid = 0;
    for (i2 = i; i2 >= 0; i2--)
      mid += A[i2];
    A[i] = mid / (i + 1);
  }
  for (i = 0; i < 10; i++)
    printf("%f\n", A[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    119b <main+0x5b>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movslq -0x38(%rbp),%rax
movss  %xmm0,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1166 <main+0x26>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11d0 <main+0x90>
movslq -0x38(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11a2 <main+0x62>
movl   $0x2,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    1246 <main+0x106>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jl     121b <main+0xdb>
movslq -0x3c(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
addss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ef <main+0xaf>
movss  -0x34(%rbp),%xmm0
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movslq -0x38(%rbp),%rax
movss  %xmm0,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d7 <main+0x97>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    127b <main+0x13b>
movslq -0x38(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
lea    0xd98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    124d <main+0x10d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x2c(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x28(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x24(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x20(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x1c(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x14(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%rsp)
lea    0xcdf(%rip),%rbx
mov    %rbx,%rdi
movss  0x2c(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x28(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x24(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x20(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x1c(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x18(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x14(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x10(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x8(%rsp),%xmm0
call   1030 <printf@plt>
movss  0x28(%rsp),%xmm1
movss  0x24(%rsp),%xmm2
addss  %xmm1,%xmm2
movss  0x2c(%rsp),%xmm0
addss  %xmm0,%xmm2
divss  0xc11(%rip),%xmm2
movss  0x20(%rsp),%xmm3
addss  %xmm2,%xmm3
addss  %xmm1,%xmm3
movaps %xmm1,%xmm5
addss  %xmm0,%xmm3
mulss  0xbf8(%rip),%xmm3
movss  0x1c(%rsp),%xmm1
addss  %xmm3,%xmm1
movaps %xmm3,%xmm4
movaps %xmm2,%xmm3
addss  %xmm2,%xmm1
addss  %xmm5,%xmm1
addss  %xmm0,%xmm1
divss  0xbd8(%rip),%xmm1
movss  0x18(%rsp),%xmm2
addss  %xmm1,%xmm2
movaps %xmm1,%xmm6
addss  %xmm4,%xmm2
addss  %xmm3,%xmm2
movaps %xmm3,%xmm7
addss  %xmm5,%xmm2
addss  %xmm0,%xmm2
divss  0xbb4(%rip),%xmm2
movss  0x14(%rsp),%xmm1
addss  %xmm2,%xmm1
movaps %xmm2,%xmm3
addss  %xmm6,%xmm1
addss  %xmm4,%xmm1
addss  %xmm7,%xmm1
addss  %xmm5,%xmm1
movaps %xmm5,%xmm8
addss  %xmm0,%xmm1
divss  0xb8b(%rip),%xmm1
movss  0x10(%rsp),%xmm2
addss  %xmm1,%xmm2
movaps %xmm1,%xmm5
addss  %xmm3,%xmm2
addss  %xmm6,%xmm2
addss  %xmm4,%xmm2
movaps %xmm4,%xmm9
addss  %xmm7,%xmm2
addss  %xmm8,%xmm2
addss  %xmm0,%xmm2
mulss  0xb5d(%rip),%xmm2
movss  0xc(%rsp),%xmm1
addss  %xmm2,%xmm1
movaps %xmm2,%xmm4
movss  %xmm2,0x10(%rsp)
movss  %xmm5,0x14(%rsp)
addss  %xmm5,%xmm1
addss  %xmm3,%xmm1
movss  %xmm3,0x18(%rsp)
movss  %xmm6,0x1c(%rsp)
addss  %xmm6,%xmm1
movss  %xmm9,0x20(%rsp)
addss  %xmm9,%xmm1
addss  %xmm7,%xmm1
movss  %xmm7,0x24(%rsp)
addss  %xmm8,%xmm1
addss  %xmm0,%xmm1
divss  0xb09(%rip),%xmm1
movss  %xmm1,0xc(%rsp)
movss  0x8(%rsp),%xmm2
addss  %xmm1,%xmm2
addss  %xmm4,%xmm2
addss  %xmm5,%xmm2
addss  %xmm3,%xmm2
addss  %xmm6,%xmm2
addss  %xmm9,%xmm2
addss  %xmm7,%xmm2
addss  %xmm8,%xmm2
addss  %xmm0,%xmm2
divss  0xad3(%rip),%xmm2
movss  %xmm2,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x28(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x24(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x20(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x1c(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x18(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x14(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x10(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x8(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x float]
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %4
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 10
%14 = sitofp i32 %13 to float
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %16
store float %14, float* %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %8
21: ; preds = %8
store i32 0, i32* %4
br label %22
22: ; preds = %31, %21
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 10
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %27
%29 = load float, float* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %29)
br label %31
31: ; preds = %25
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %22
34: ; preds = %22
store i32 2, i32* %4
br label %35
35: ; preds = %62, %34
%36 = load i32, i32* %4
%37 = icmp slt i32 %36, 10
br i1 %37, label %38, label %65
38: ; preds = %35
store float 0.000000e+00, float* %3
%39 = load i32, i32* %4
store i32 %39, i32* %5
br label %40
40: ; preds = %50, %38
%41 = load i32, i32* %5
%42 = icmp sge i32 %41, 0
br i1 %42, label %43, label %53
43: ; preds = %40
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %45
%47 = load float, float* %46
%48 = load float, float* %3
%49 = fadd float %48, %47
store float %49, float* %3
br label %50
50: ; preds = %43
%51 = load i32, i32* %5
%52 = add nsw i32 %51, -1
store i32 %52, i32* %5
br label %40
53: ; preds = %40
%54 = load float, float* %3
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
%57 = sitofp i32 %56 to float
%58 = fdiv float %54, %57
%59 = load i32, i32* %4
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %60
store float %58, float* %61
br label %62
62: ; preds = %53
%63 = load i32, i32* %4
%64 = add nsw i32 %63, 1
store i32 %64, i32* %4
br label %35
65: ; preds = %35
store i32 0, i32* %4
br label %66
66: ; preds = %75, %65
%67 = load i32, i32* %4
%68 = icmp slt i32 %67, 10
br i1 %68, label %69, label %78
69: ; preds = %66
%70 = load i32, i32* %4
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [10 x float], [10 x float]* %2, i64 0, i64 %71
%73 = load float, float* %72
%74 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %73)
br label %75
75: ; preds = %69
%76 = load i32, i32* %4
%77 = add nsw i32 %76, 1
store i32 %77, i32* %4
br label %66
78: ; preds = %66
ret i32 0
}

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