#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 */
float dizi_toplam(float *);
int /*<<< orphan*/ printf(char *, float);
int main() {
  int i;
  float kareler[6];
  for (i = 0; i < 6; i++)
    kareler[i] = i * i;
  float toplam = dizi_toplam(kareler);
  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    1163 <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    1136 <main+0x16>
lea    -0x20(%rbp),%rdi
call   1030 <dizi_toplam@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
movss  -0x28(%rbp),%xmm0
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x41c8000041800000,%rax
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rdi
call   1030 <dizi_toplam@plt>
movaps %xmm0,%xmm1
divss  0xebc(%rip),%xmm1
movss  %xmm1,0xc(%rsp)
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
movss  0xc(%rsp),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"toplam: %f\0A\00"
@.str.1 = [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
%21 = getelementptr inbounds [6 x float], [6 x float]* %3, i64 0, i64 0
%22 = call float @dizi_toplam(float* %21)
store float %22, float* %4
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = fdiv double %24, 6.000000e+00
%26 = fptrunc double %25 to float
store float %26, float* %5
%27 = load float, float* %4
%28 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), float %27)
%29 = load float, float* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), float %29)
ret i32 0
}

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