#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() {
  int i;
  float kareler[6];
  for (i = 0; i < 6; i++) {
    kareler[i] = i * i;
  }
  for (i = 0; i < 6; i++) {
    printf("%f\n", kareler[i]);
  }
  float toplam = 0;
  for (i = 0; i < 6; i++)
    toplam += kareler[i];
  float ortalama = toplam / 6.0;
  printf("toplam: %f\n", toplam);
  printf("ortalama: %f\n", ortalama);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    1153 <main+0x43>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movslq -0x8(%rbp),%rax
movss  %xmm0,-0x20(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    1188 <main+0x78>
movslq -0x8(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115a <main+0x4a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    11c3 <main+0xb3>
movslq -0x8(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1197 <main+0x87>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe2c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf1a(%rip),%rbx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xed5(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xec9(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xebd(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xeb1(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xea5(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
movss  0xe92(%rip),%xmm0
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
movss  0xe82(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [12 x i8] c"toplam: %f\0A\00"
@.str.2 = [14 x i8] c"ortalama: %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 0.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 1.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 4.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 9.000000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 1.600000e+01)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 2.500000e+01)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float 5.500000e+01)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), float 0x4022555560000000)
ret i32 0
}