#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
int /*<<< orphan*/ system(char *);
int main() {
  system("clear");
  char yazi[100];
  int ascii_array[128];
  int i;
  memset(ascii_array, 0, 128 * sizeof(int));
  printf("yazi girin: ");
  fgets(yazi, 100, stdin);
  yazi[strlen(yazi) - 1] = '\0';
  printf("\n");
  for (i = 0; yazi[i] != '\0'; i++) {
    if (yazi[i] >= 0 && yazi[i] <= 127) {
      ascii_array[yazi[i]]++;
    } else {
      printf("HATA!!! Sizin yaziniz ASCII 128 disi karakter iceriyor.\n");
      return 0;
    }
  }
  for (i = 0; i < 128; i++) {
    if (ascii_array[i] != 0) {
      printf("%c: %d tane\n", i, ascii_array[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
call   1040 <system@plt>
lea    -0x270(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1060 <memset@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2e4e(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1070 <fgets@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x70(%rbp,%rax,1)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x274(%rbp)
movslq -0x274(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1266 <main+0x116>
movslq -0x274(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
jl     1233 <main+0xe3>
movslq -0x274(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7f,%eax
jg     1233 <main+0xe3>
movslq -0x274(%rbp),%rax
movsbq -0x70(%rbp,%rax,1),%rax
mov    -0x270(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x270(%rbp,%rax,4)
jmp    124d <main+0xfd>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d7 <main+0x187>
jmp    1252 <main+0x102>
mov    -0x274(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x274(%rbp)
jmp    11d1 <main+0x81>
movl   $0x0,-0x274(%rbp)
cmpl   $0x80,-0x274(%rbp)
jge    12d0 <main+0x180>
movslq -0x274(%rbp),%rax
cmpl   $0x0,-0x270(%rbp,%rax,4)
je     12b7 <main+0x167>
mov    -0x274(%rbp),%esi
movslq -0x274(%rbp),%rax
mov    -0x270(%rbp,%rax,4),%edx
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12bc <main+0x16c>
mov    -0x274(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x274(%rbp)
jmp    1270 <main+0x120>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x278,%rsp
lea    0xe7f(%rip),%rdi
call   1060 <system@plt>
lea    0x70(%rsp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1080 <memset@plt>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1090 <fgets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%al
test   %al,%al
je     1207 <main+0x97>
lea    0x1(%rsp),%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %al,%al
js     1243 <main+0xd3>
movzbl %al,%eax
addl   $0x1,0x70(%rsp,%rax,4)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    11f0 <main+0x80>
lea    0xe05(%rip),%r14
xor    %ebx,%ebx
jmp    122d <main+0xbd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0x80,%rbx
je     124f <main+0xdf>
mov    0x70(%rsp,%rbx,4),%edx
test   %edx,%edx
je     1220 <main+0xb0>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1220 <main+0xb0>
lea    0xdd6(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x278,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [13 x i8] c"yazi girin: \00"
@stdin = global i32 0
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [57 x i8] c"HATA!!! Sizin yaziniz ASCII 128 disi karakter iceriyor.\0A\00"
@.str.4 = [13 x i8] c"%c: %d tane\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [128 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [128 x i32], [128 x i32]* %3, i64 0, i64 0
%7 = call i32 @memset(i32* %6, i32 0, i32 512)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 100, i32 %10)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %15
store i8 0, i8* %16
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %18
18: ; preds = %51, %0
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %54
25: ; preds = %18
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sge i32 %30, 0
br i1 %31, label %32, label %48
32: ; preds = %25
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp sle i32 %37, 127
br i1 %38, label %39, label %48
39: ; preds = %32
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i64
%45 = getelementptr inbounds [128 x i32], [128 x i32]* %3, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = add nsw i32 %46, 1
store i32 %47, i32* %45
br label %50
48: ; preds = %32, %25
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %76
50: ; preds = %39
br label %51
51: ; preds = %50
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %18
54: ; preds = %18
store i32 0, i32* %4
br label %55
55: ; preds = %72, %54
%56 = load i32, i32* %4
%57 = icmp slt i32 %56, 128
br i1 %57, label %58, label %75
58: ; preds = %55
%59 = load i32, i32* %4
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [128 x i32], [128 x i32]* %3, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %71
64: ; preds = %58
%65 = load i32, i32* %4
%66 = load i32, i32* %4
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [128 x i32], [128 x i32]* %3, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %65, i32 %69)
br label %71
71: ; preds = %64, %58
br label %72
72: ; preds = %71
%73 = load i32, i32* %4
%74 = add nsw i32 %73, 1
store i32 %74, i32* %4
br label %55
75: ; preds = %55
store i32 0, i32* %1
br label %76
76: ; preds = %75, %48
%77 = load i32, i32* %1
ret i32 %77
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [13 x i8] c"yazi girin: \00"
@stdin = global i32 0
@.str.4 = [13 x i8] c"%c: %d tane\0A\00"
@str = [56 x i8] c"HATA!!! Sizin yaziniz ASCII 128 disi karakter iceriyor.\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [128 x i32]
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = bitcast [128 x i32]* %2 to i8*
%6 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 0
%7 = call i32 @memset(i32* %6, i32 0, i32 512)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %4, i32 100, i32 %9)
%11 = call i32 @strlen(i8* %4)
%12 = add nsw i32 %11, -1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %13
store i8 0, i8* %14
%15 = call i32 @putchar(i32 10)
%16 = load i8, i8* %4
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %23, %0
br label %34
19: ; preds = %0, %23
%20 = phi i64 [ %28, %23 ], [ 0, %0 ]
%21 = phi i8 [ %30, %23 ], [ %16, %0 ]
%22 = icmp sgt i8 %21, -1
br i1 %22, label %23, label %32
23: ; preds = %19
%24 = zext i8 %21 to i64
%25 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = add nsw i32 %26, 1
store i32 %27, i32* %25
%28 = add nuw i64 %20, 1
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %18, label %19
32: ; preds = %19
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
br label %45
34: ; preds = %18, %42
%35 = phi i64 [ %43, %42 ], [ 0, %18 ]
%36 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp eq i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %34
%40 = trunc i64 %35 to i32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %40, i32 %37)
br label %42
42: ; preds = %34, %39
%43 = add nuw nsw i64 %35, 1
%44 = icmp eq i64 %43, 128
br i1 %44, label %45, label %34
45: ; preds = %42, %32
ret i32 0
}