#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 */
scalar_t__ IsPrime(int);
int /*<<< orphan*/ MkOdPs();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int n;
  int c = 0;
  MkOdPs();
  printf("MkOdPs done!\n");
  for (n = 1; n <= ((1000000) * 64 - 1); n++)
    if (IsPrime(n))
      c++;
  printf("1 - %d : %d\n", ((1000000) * 64 - 1), c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <MkOdPs@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x3d08fff,-0x8(%rbp)
jg     119d <main+0x6d>
mov    -0x8(%rbp),%edi
call   1050 <IsPrime@plt>
cmp    $0x0,%rax
je     118a <main+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118f <main+0x5f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <main+0x32>
mov    -0xc(%rbp),%edx
lea    0xe67(%rip),%rdi
mov    $0x3d08fff,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <MkOdPs@plt>
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1060 <IsPrime@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
add    $0x1,%ebp
cmp    $0x3d09000,%ebp
jne    1160 <main+0x20>
lea    0xe80(%rip),%rdi
mov    $0x3d08fff,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"MkOdPs done!\0A\00"
@.str.1 = [13 x i8] c"1 - %d : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (...) @MkOdPs()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 63999999
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call i64 @IsPrime(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %9
br label %17
17: ; preds = %16
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %6
20: ; preds = %6
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 63999999, i32 %21)
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"1 - %d : %d\0A\00"
@str = [13 x i8] c"MkOdPs done!\00"
define i32 @main() {
%1 = tail call i32 (...) @MkOdPs()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %9, %3 ]
%5 = phi i32 [ 1, %0 ], [ %10, %3 ]
%6 = tail call i64 @IsPrime(i32 %5)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %4, %8
%10 = add nuw nsw i32 %5, 1
%11 = icmp eq i32 %10, 64000000
br i1 %11, label %12, label %3
12: ; preds = %3
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 63999999, i32 %9)
ret i32 0
}