#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int sayi_sayisi, i, j;
  int sayilar[100];
  int tmp = 0;
  float ortalama;
  printf("Kac sayi:");
  scanf("%d", &sayi_sayisi);
  for (i = 1; i <= sayi_sayisi; i++) {
    printf("Sayi girin: ");
    scanf("%d", &sayilar[i]);
  }
  printf("Girilen sayilar:\n");
  for (i = 1; i <= sayi_sayisi; i++) {
    printf("%d\n", sayilar[i]);
    tmp += sayilar[i];
  }
  ortalama = (float)tmp / sayi_sayisi;
  printf("Ortalama:%f\n", ortalama);
  printf("Bar graph:\n");
  for (i = 1; i <= sayi_sayisi; i++) {
    for (j = 1; j <= sayilar[i]; j++) {
      printf("*");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a7 <main+0x87>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe76(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <main+0x41>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1206 <main+0xe6>
movslq -0xc(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
add    -0x1a4(%rbp),%eax
mov    %eax,-0x1a4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bc <main+0x9c>
cvtsi2ssl -0x1a4(%rbp),%xmm0
ff
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1a8(%rbp)
ff
movss  -0x1a8(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xdfe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12ad <main+0x18d>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x1a0(%rbp,%rcx,4),%eax
jg     1291 <main+0x171>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1261 <main+0x141>
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    124e <main+0x12e>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a0,%rsp
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11b7 <main+0x77>
lea    0x14(%rsp),%r12
lea    0xe8c(%rip),%r14
lea    0xe82(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
movslq 0xc(%rsp),%rax
add    $0x1,%rbx
add    $0x4,%r12
cmp    %rax,%rbx
jl     1190 <main+0x50>
lea    0xe6d(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1206 <main+0xc6>
lea    0xe48(%rip),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    0x14(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    0x14(%rsp,%rbx,4),%ebp
movslq 0xc(%rsp),%rax
add    $0x1,%rbx
cmp    %rax,%rbx
jl     11e0 <main+0xa0>
cvtsi2ss %ebp,%xmm0
jmp    1209 <main+0xc9>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe02(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe12(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    1285 <main+0x145>
mov    $0x1,%ebx
jmp    125b <main+0x11b>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%rax
movslq 0xc(%rsp),%rcx
cmp    %rcx,%rbx
mov    %rax,%rbx
jge    1285 <main+0x145>
cmpl   $0x0,0x10(%rsp,%rbx,4)
jle    1240 <main+0x100>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x10(%rsp,%rbx,4),%ebp
jl     1270 <main+0x130>
jmp    1240 <main+0x100>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"Kac sayi:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"Sayi girin: \00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [13 x i8] c"Ortalama:%f\0A\00"
@str = [17 x i8] c"Girilen sayilar:\00"
@str.9 = [11 x i8] c"Bar graph:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %18, label %9
9: ; preds = %0, %9
%10 = phi i64 [ %14, %9 ], [ 1, %0 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %10
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %10, 1
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %10, %16
br i1 %17, label %9, label %18
18: ; preds = %9, %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%20 = load i32, i32* %1
%21 = icmp slt i32 %20, 1
br i1 %21, label %36, label %22
22: ; preds = %18, %22
%23 = phi i64 [ %30, %22 ], [ 1, %18 ]
%24 = phi i32 [ %29, %22 ], [ 0, %18 ]
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %23
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %25
%29 = add nsw i32 %28, %24
%30 = add nuw nsw i64 %23, 1
%31 = load i32, i32* %1
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %23, %32
br i1 %33, label %22, label %34
34: ; preds = %22
%35 = sitofp i32 %29 to float
br label %36
36: ; preds = %34, %18
%37 = phi float [ 0.000000e+00, %18 ], [ %35, %34 ]
%38 = phi i32 [ %20, %18 ], [ %31, %34 ]
%39 = sitofp i32 %38 to float
%40 = fdiv float %37, %39
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), double %41)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.9, i64 0, i64 0))
%44 = load i32, i32* %1
%45 = icmp slt i32 %44, 1
br i1 %45, label %63, label %46
46: ; preds = %36, %57
%47 = phi i64 [ %59, %57 ], [ 1, %36 ]
%48 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp slt i32 %49, 1
br i1 %50, label %57, label %51
51: ; preds = %46, %51
%52 = phi i32 [ %54, %51 ], [ 1, %46 ]
%53 = call i32 @putchar(i32 42)
%54 = add nuw nsw i32 %52, 1
%55 = load i32, i32* %48
%56 = icmp slt i32 %52, %55
br i1 %56, label %51, label %57
57: ; preds = %51, %46
%58 = call i32 @putchar(i32 10)
%59 = add nuw nsw i64 %47, 1
%60 = load i32, i32* %1
%61 = sext i32 %60 to i64
%62 = icmp slt i64 %47, %61
br i1 %62, label %46, label %63
63: ; preds = %57, %36
ret i32 0
}