#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, sum = 0, count = 0;
  float avg = 0;
  for (i = 0; i <= 500; i++) {
    if (i % 2 == 1) {
      sum += i;
      count++;
    }
    avg = (float)sum / (float)count;
  }
  printf("1'den 500'e kadar olan %d adet tek sayinin...\n", count);
  printf("Toplami   : %d\n", sum);
  printf("Ortalamasi: %.2f eder.\n", avg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1f4,-0x8(%rbp)
jg     1190 <main+0x80>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    116f <main+0x5f>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113c <main+0x2c>
cvtsi2ssl -0x10(%rbp),%xmm0
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
cvtsi2ssl -0xc(%rbp),%xmm0
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee7(%rip),%xmm5
pxor   %xmm8,%xmm8
mov    $0x1f0,%eax
movdqa 0xee4(%rip),%xmm9
movdqa 0xeeb(%rip),%xmm10
movdqa 0xef2(%rip),%xmm11
pxor   %xmm7,%xmm7
pxor   %xmm4,%xmm4
pxor   %xmm1,%xmm1
pxor   %xmm0,%xmm0
xchg   %ax,%ax
movdqa %xmm5,%xmm6
paddd  %xmm9,%xmm6
movdqa %xmm5,%xmm2
pand   %xmm10,%xmm2
paddd  %xmm2,%xmm7
paddd  %xmm2,%xmm4
pcmpeqd %xmm8,%xmm2
movdqa %xmm2,%xmm3
pandn  %xmm5,%xmm3
paddd  %xmm3,%xmm1
pandn  %xmm6,%xmm2
paddd  %xmm2,%xmm0
paddd  %xmm11,%xmm5
add    $0xfffffff8,%eax
jne    1150 <main+0x40>
paddd  %xmm7,%xmm4
pshufd $0xee,%xmm4,%xmm2
paddd  %xmm4,%xmm2
pshufd $0x55,%xmm2,%xmm3
paddd  %xmm2,%xmm3
movd   %xmm3,%eax
paddd  %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%ecx
add    $0x3e4,%ecx
add    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
movss  %xmm1,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
movss  (%rsp),%xmm0
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
movss  0x4(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"1'den 500'e kadar olan %d adet tek sayinin...\0A\00"
@.str.1 = [16 x i8] c"Toplami : %d\0A\00"
@.str.2 = [24 x i8] c"Ortalamasi: %.2f eder.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store float 0.000000e+00, float* %5
store i32 0, i32* %2
br label %6
6: ; preds = %25, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 500
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = load i32, i32* %2
%11 = srem i32 %10, 2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = add nsw i32 %15, %14
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %19
19: ; preds = %13, %9
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to float
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to float
%24 = fdiv float %21, %23
store float %24, float* %5
br label %25
25: ; preds = %19
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %6
28: ; preds = %6
%29 = load i32, i32* %4
%30 = sitofp i32 %29 to float
%31 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), float %30)
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to float
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), float %33)
%35 = load float, float* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), float %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"1'den 500'e kadar olan %d adet tek sayinin...\0A\00"
@.str.1 = [16 x i8] c"Toplami : %d\0A\00"
@.str.2 = [24 x i8] c"Ortalamasi: %.2f eder.\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %23, %1 ]
%3 = phi <4 x i32> [ zeroinitializer, %0 ], [ %21, %1 ]
%4 = phi <4 x i32> [ zeroinitializer, %0 ], [ %22, %1 ]
%5 = phi <4 x i32> [ zeroinitializer, %0 ], [ %15, %1 ]
%6 = phi <4 x i32> [ zeroinitializer, %0 ], [ %16, %1 ]
%7 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %24, %1 ]
%8 = add <4 x i32> %7, <i32 4, i32 4, i32 4, i32 4>
%9 = and <4 x i32> %7, <i32 1, i32 1, i32 1, i32 1>
%10 = and <4 x i32> %7, <i32 1, i32 1, i32 1, i32 1>
%11 = icmp eq <4 x i32> %9, zeroinitializer
%12 = icmp eq <4 x i32> %10, zeroinitializer
%13 = select <4 x i1> %11, <4 x i32> zeroinitializer, <4 x i32> %7
%14 = select <4 x i1> %12, <4 x i32> zeroinitializer, <4 x i32> %8
%15 = add <4 x i32> %13, %5
%16 = add <4 x i32> %14, %6
%17 = xor <4 x i1> %11, <i1 true, i1 true, i1 true, i1 true>
%18 = xor <4 x i1> %12, <i1 true, i1 true, i1 true, i1 true>
%19 = zext <4 x i1> %17 to <4 x i32>
%20 = zext <4 x i1> %18 to <4 x i32>
%21 = add <4 x i32> %3, %19
%22 = add <4 x i32> %4, %20
%23 = add nuw i32 %2, 8
%24 = add <4 x i32> %7, <i32 8, i32 8, i32 8, i32 8>
%25 = icmp eq i32 %23, 496
br i1 %25, label %26, label %1
26: ; preds = %1
%27 = add <4 x i32> %22, %21
%28 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %27)
%29 = add <4 x i32> %16, %15
%30 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %29)
%31 = add nuw nsw i32 %30, 996
%32 = add nuw nsw i32 %28, 2
%33 = sitofp i32 %31 to float
%34 = sitofp i32 %32 to float
%35 = fdiv float %33, %34
%36 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), float %34)
%37 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), float %33)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), float %35)
ret i32 0
}