#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 main(void) {
  int i;
  float sum;
  float average = 0;
  float numbers[10];
  for (i = 0; i < 10; ++i) {
    numbers[i] = i + (float)(i + 1) / 10;
    printf("%2f ", numbers[i]);
    sum += numbers[i];
  }
  average = sum / 10;
  printf("The average is %2f \n", average);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1199 <main+0x89>
cvtsi2ssl -0x8(%rbp),%xmm0
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm1
movss  0xeb1(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x40(%rbp,%rax,4)
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <main+0x1e>
movss  -0xc(%rbp),%xmm0
movss  0xe5a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf14(%rip),%rbx
movss  0xee0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xed4(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xec8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xebc(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xeb0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xea4(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xe98(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xe8c(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xe80(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xe74(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
movss  0xe61(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%2f \00"
@.str.1 = [21 x i8] c"The average is %2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca [10 x float]
store i32 0, i32* %1
store float 0.000000e+00, float* %4
store i32 0, i32* %2
br label %6
6: ; preds = %31, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %34
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to float
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
%14 = sitofp i32 %13 to float
%15 = fdiv float %14, 1.000000e+01
%16 = fadd float %11, %15
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x float], [10 x float]* %5, i64 0, i64 %18
store float %16, float* %19
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x float], [10 x float]* %5, i64 0, i64 %21
%23 = load float, float* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %23)
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x float], [10 x float]* %5, i64 0, i64 %26
%28 = load float, float* %27
%29 = load float, float* %3
%30 = fadd float %29, %28
store float %30, float* %3
br label %31
31: ; preds = %9
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %6
34: ; preds = %6
%35 = load float, float* %3
%36 = fdiv float %35, 1.000000e+01
store float %36, float* %4
%37 = load float, float* %4
%38 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), float %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%2f \00"
@.str.1 = [21 x i8] c"The average is %2f \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x3FB99999A0000000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x3FF3333340000000)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x4002666660000000)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x400B333340000000)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 4.500000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x4016666660000000)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x401ACCCCC0000000)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x401F333340000000)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 0x4021CCCCC0000000)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float 1.000000e+01)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), float 0x7FF8000000000000)
ret i32 0
}