#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*/ eliminateMults(char *, long, char, char *);
int /*<<< orphan*/ searchForZero(char **, long *, char *, char *);
int /*<<< orphan*/ setToOne(char *, char);
void findPrimes(char *start, char *endsqrt, char *end) {
  char *current = start;
  char ind = 0;
  long pointind = 0;
  setToOne(current, ind);
  ind++;
  setToOne(current, ind);
  ind++;
  while (ind != -1) {
    eliminateMults(start, pointind, ind, end);
    searchForZero(&current, &pointind, &ind, endsqrt);
  }
}


x86 assembly (clang, -O0):
<findPrimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0x21(%rbp),%esi
call   1040 <setToOne@plt>
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rdi
movsbl -0x21(%rbp),%esi
call   1040 <setToOne@plt>
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0xffffffff,%eax
je     11c0 <findPrimes+0x90>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x21(%rbp),%al
mov    -0x18(%rbp),%rcx
movsbl %al,%edx
call   1030 <eliminateMults@plt>
mov    -0x10(%rbp),%rcx
lea    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x21(%rbp),%rdx
call   1050 <searchForZero@plt>
jmp    1182 <findPrimes+0x52>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findPrimes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rdi,0x10(%rsp)
movq   $0x0,0x8(%rsp)
xor    %esi,%esi
call   1040 <setToOne@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <setToOne@plt>
movb   $0x2,0x7(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    %r14,%rcx
call   1030 <eliminateMults@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x7(%rsp),%rdx
mov    %r15,%rcx
call   1050 <searchForZero@plt>
mov    0x7(%rsp),%al
cmp    $0xff,%al
je     11dd <findPrimes+0xad>
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x7(%rsp),%rbp
xchg   %ax,%ax
mov    0x8(%rsp),%rsi
movsbl %al,%edx
mov    %rbx,%rdi
mov    %r14,%rcx
call   1030 <eliminateMults@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
call   1050 <searchForZero@plt>
movzbl 0x7(%rsp),%eax
cmp    $0xff,%al
jne    11b0 <findPrimes+0x80>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @findPrimes(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8
%9 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%10 = load i8*, i8** %4
store i8* %10, i8** %7
store i8 0, i8* %8
store i64 0, i64* %9
%11 = load i8*, i8** %7
%12 = load i8, i8* %8
%13 = call i32 @setToOne(i8* %11, i8 signext %12)
%14 = load i8, i8* %8
%15 = add i8 %14, 1
store i8 %15, i8* %8
%16 = load i8*, i8** %7
%17 = load i8, i8* %8
%18 = call i32 @setToOne(i8* %16, i8 signext %17)
%19 = load i8, i8* %8
%20 = add i8 %19, 1
store i8 %20, i8* %8
br label %21
21: ; preds = %25, %3
%22 = load i8, i8* %8
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %33
25: ; preds = %21
%26 = load i8*, i8** %4
%27 = load i64, i64* %9
%28 = load i8, i8* %8
%29 = load i8*, i8** %6
%30 = call i32 @eliminateMults(i8* %26, i64 %27, i8 signext %28, i8* %29)
%31 = load i8*, i8** %5
%32 = call i32 @searchForZero(i8** %7, i64* %9, i8* %8, i8* %31)
br label %21
33: ; preds = %21
ret void
}

LLVM IR (-O2):
define void @findPrimes(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i64
%7 = bitcast i8** %4 to i8*
store i8* %0, i8** %4
%8 = bitcast i64* %6 to i8*
store i64 0, i64* %6
%9 = tail call i32 @setToOne(i8* %0, i8 signext 0)
%10 = tail call i32 @setToOne(i8* %0, i8 signext 1)
store i8 2, i8* %5
%11 = call i32 @eliminateMults(i8* %0, i64 0, i8 signext 2, i8* %2)
%12 = call i32 @searchForZero(i8** %4, i64* %6, i8* %5, i8* %1)
%13 = load i8, i8* %5
%14 = icmp eq i8 %13, -1
br i1 %14, label %22, label %15
15: ; preds = %3, %15
%16 = phi i8 [ %20, %15 ], [ %13, %3 ]
%17 = load i64, i64* %6
%18 = call i32 @eliminateMults(i8* %0, i64 %17, i8 signext %16, i8* %2)
%19 = call i32 @searchForZero(i8** %4, i64* %6, i8* %5, i8* %1)
%20 = load i8, i8* %5
%21 = icmp eq i8 %20, -1
br i1 %21, label %22, label %15
22: ; preds = %15, %3
ret void
}