#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 */
typedef int pointind;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int CHAR_BIT;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ searchForZero(char **, long *, char *, char *);
void printPrimes(FILE *primes, char *start, char *end) {
  char ind = 0;
  long pointind = 0;
  searchForZero(&start, &pointind, &ind, end);
  while (ind != -1) {
    fprintf(primes, "%ld\n", CHAR_BIT * (pointind) + ind);
    searchForZero(&start, &pointind, &ind, end);
  }
}


x86 assembly (clang, -O0):
<printPrimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
lea    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x19(%rbp),%rdx
call   1040 <searchForZero@plt>
movsbl -0x19(%rbp),%eax
cmp    $0xffffffff,%eax
je     11a5 <printPrimes+0x85>
mov    -0x8(%rbp),%rdi
mov    0x2e73(%rip),%rax
movslq (%rax),%rax
imul   -0x28(%rbp),%rax
movsbq -0x19(%rbp),%rcx
add    %rcx,%rax
mov    %eax,%edx
lea    0xe7a(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rcx
lea    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x19(%rbp),%rdx
call   1040 <searchForZero@plt>
jmp    1155 <printPrimes+0x35>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPrimes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rsi,0x10(%rsp)
movb   $0x0,0x7(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x7(%rsp),%rdx
mov    %rbx,%rcx
call   1040 <searchForZero@plt>
mov    0x7(%rsp),%al
cmp    $0xff,%al
je     11b8 <printPrimes+0x98>
lea    0xe93(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%r13
lea    0x7(%rsp),%rbp
nopl   0x0(%rax)
mov    0x8(%rsp),%ecx
mov    0x2e55(%rip),%rdx
imul   (%rdx),%ecx
movsbl %al,%edx
add    %ecx,%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <fprintf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1040 <searchForZero@plt>
movzbl 0x7(%rsp),%eax
cmp    $0xff,%al
jne    1180 <printPrimes+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
@CHAR_BIT = global i32 0
define void @printPrimes(i32* nocapture %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i64
store i8* %1, i8** %4
store i8 0, i8* %5
%7 = bitcast i64* %6 to i8*
store i64 0, i64* %6
%8 = call i32 @searchForZero(i8** %4, i64* %6, i8* %5, i8* %2)
%9 = load i8, i8* %5
%10 = icmp eq i8 %9, -1
br i1 %10, label %24, label %11
11: ; preds = %3, %11
%12 = phi i8 [ %22, %11 ], [ %9, %3 ]
%13 = load i32, i32* @CHAR_BIT
%14 = zext i32 %13 to i64
%15 = load i64, i64* %6
%16 = mul i64 %15, %14
%17 = sext i8 %12 to i64
%18 = add i64 %16, %17
%19 = trunc i64 %18 to i32
%20 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i32 @searchForZero(i8** %4, i64* %6, i8* %5, i8* %2)
%22 = load i8, i8* %5
%23 = icmp eq i8 %22, -1
br i1 %23, label %24, label %11
24: ; preds = %11, %3
ret void
}