#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*/ fprintf(int /*<<< orphan*/, char *, long);
int /*<<< orphan*/ stdout;
void printPrimes(unsigned char *primearr) {
  long i;
  for (i = 3; i < 4294967295; i += 2) {
    if (!(primearr[i >> 3] & (1 << (i & (8 - 1))))) {
      fprintf(stdout, "%ld is prime.\n", i);
    } else {
      fprintf(stdout, "%ld is not prime.\n", i);
    }
  }
}


x86 assembly (clang, -O0):
<printPrimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x3,-0x10(%rbp)
mov    $0xffffffff,%eax
cmp    %rax,-0x10(%rbp)
jge    11ac <printPrimes+0x9c>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sar    $0x3,%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
and    $0x7,%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    117d <printPrimes+0x6d>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe8d(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1196 <printPrimes+0x86>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe7e(%rip),%rsi
call   1030 <fprintf@plt>
jmp    119b <printPrimes+0x8b>
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <printPrimes+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPrimes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x3,%ebx
mov    0x2eb6(%rip),%r15
lea    0xecf(%rip),%r12
lea    0xed7(%rip),%r13
mov    $0xfffffffd,%ebp
nopl   (%rax)
mov    %rbx,%rax
shr    $0x3,%rax
movzbl (%r14,%rax,1),%eax
mov    %ebx,%ecx
and    $0x7,%cl
movzbl %cl,%ecx
bt     %ecx,%eax
mov    (%r15),%edi
mov    %r13,%rsi
cmovae %r12,%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
lea    0x2(%rbx),%rax
cmp    %rbp,%rbx
mov    %rax,%rbx
jb     1140 <printPrimes+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [15 x i8] c"%ld is prime.\0A\00"
@.str.1 = [19 x i8] c"%ld is not prime.\0A\00"
define void @printPrimes(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
store i64 3, i64* %3
br label %4
4: ; preds = %29, %1
%5 = load i64, i64* %3
%6 = icmp slt i64 %5, 4294967295
br i1 %6, label %7, label %32
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i64, i64* %3
%10 = ashr i64 %9, 3
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = load i64, i64* %3
%15 = and i64 %14, 7
%16 = trunc i64 %15 to i32
%17 = shl i32 1, %16
%18 = and i32 %13, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %7
%21 = load i32, i32* @stdout
%22 = load i64, i64* %3
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %22)
br label %28
24: ; preds = %7
%25 = load i32, i32* @stdout
%26 = load i64, i64* %3
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64 %26)
br label %28
28: ; preds = %24, %20
br label %29
29: ; preds = %28
%30 = load i64, i64* %3
%31 = add nsw i64 %30, 2
store i64 %31, i64* %3
br label %4
32: ; preds = %4
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [15 x i8] c"%ld is prime.\0A\00"
@.str.1 = [19 x i8] c"%ld is not prime.\0A\00"
define void @printPrimes(i8* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 3, %1 ], [ %16, %2 ]
%4 = lshr i64 %3, 3
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = trunc i64 %3 to i32
%9 = and i32 %8, 7
%10 = shl nuw nsw i32 1, %9
%11 = and i32 %10, %7
%12 = icmp eq i32 %11, 0
%13 = load i32, i32* @stdout
%14 = select i1 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0)
%15 = tail call i32 @fprintf(i32 %13, i8* %14, i64 %3)
%16 = add nuw nsw i64 %3, 2
%17 = icmp ult i64 %3, 4294967293
br i1 %17, label %2, label %18
18: ; preds = %2
ret void
}