#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 asal_sayi_bul(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Asal Sayilar\n");
  int sayi;
  int kontrol_sonucu;
  int asal_sayi_adeti = 0;
  for (sayi = 2; sayi <= 1000; sayi++) {
    kontrol_sonucu = asal_sayi_bul(sayi);
    if (kontrol_sonucu == 1) {
      printf("%d\n", sayi);
      asal_sayi_adeti++;
    }
  }
  printf("1 ile %d arasindaki asal sayilarin adeti = %d", 1000,
         asal_sayi_adeti);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     119a <main+0x7a>
mov    -0x8(%rbp),%edi
call   1030 <asal_sayi_bul@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1187 <main+0x67>
mov    -0x8(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118c <main+0x6c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <main+0x2b>
mov    -0x10(%rbp),%edx
lea    0xe6e(%rip),%rdi
mov    $0x3e8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%ebp
lea    0xeb4(%rip),%r14
xor    %ebx,%ebx
jmp    115b <main+0x2b>
add    $0x1,%ebp
cmp    $0x3e9,%ebp
je     1178 <main+0x48>
mov    %ebp,%edi
call   1040 <asal_sayi_bul@plt>
cmp    $0x1,%eax
jne    1150 <main+0x20>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
jmp    1150 <main+0x20>
lea    0xe85(%rip),%rdi
mov    $0x3e8,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Asal Sayilar\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [46 x i8] c"1 ile %d arasindaki asal sayilarin adeti = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
store i32 2, i32* %2
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 1000
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call i32 @asal_sayi_bul(i32 %10)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %19
19: ; preds = %14, %9
br label %20
20: ; preds = %19
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %6
23: ; preds = %6
%24 = load i32, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 1000, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [46 x i8] c"1 ile %d arasindaki asal sayilarin adeti = %d\00"
@str = [13 x i8] c"Asal Sayilar\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %10
%3 = phi i32 [ 0, %0 ], [ %11, %10 ]
%4 = phi i32 [ 2, %0 ], [ %12, %10 ]
%5 = tail call i32 @asal_sayi_bul(i32 %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%9 = add nsw i32 %3, 1
br label %10
10: ; preds = %2, %7
%11 = phi i32 [ %9, %7 ], [ %3, %2 ]
%12 = add nuw nsw i32 %4, 1
%13 = icmp eq i32 %12, 1001
br i1 %13, label %14, label %2
14: ; preds = %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 1000, i32 %11)
ret i32 0
}