#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*/ printf(char *, ...);
void print_primes(unsigned int **list, unsigned int *N, double *time) {
  unsigned int i, count;
  i = count = 0;
  printf("Your lucky numbers are: ");
  for (; i <= *N; ++i)
    if ((*list)[i] == 0) {
      printf("%u ", i);
      ++count;
    }
  printf("\n\nJust found %u prime numbers, in %lf seconds!\n", count, *time);
}


x86 assembly (clang, -O0):
<print_primes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
ja     1190 <print_primes+0x80>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x1c(%rbp),%ecx
cmpl   $0x0,(%rax,%rcx,4)
jne    117d <print_primes+0x6d>
mov    -0x1c(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1182 <print_primes+0x72>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <print_primes+0x30>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe7b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_primes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%r12
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    1148 <print_primes+0x38>
add    $0x1,%ebp
cmp    (%r15),%ebp
ja     1165 <print_primes+0x55>
mov    (%rbx),%rax
mov    %ebp,%ecx
cmpl   $0x0,(%rax,%rcx,4)
jne    1140 <print_primes+0x30>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r13d
jmp    1140 <print_primes+0x30>
movsd  (%r14),%xmm0
lea    0xeac(%rip),%rdi
mov    %r13d,%esi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Your lucky numbers are: \00"
@.str.1 = [4 x i8] c"%u \00"
@.str.2 = [48 x i8] c"\0A\0AJust found %u prime numbers, in %lf seconds!\0A\00"
define void @print_primes(i32** %0, i32* %1, double* %2) {
%4 = alloca i32**
%5 = alloca i32*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store i32** %0, i32*** %4
store i32* %1, i32** %5
store double* %2, double** %6
store i32 0, i32* %8
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %29, %3
%11 = load i32, i32* %7
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = icmp ule i32 %11, %13
br i1 %14, label %15, label %32
15: ; preds = %10
%16 = load i32**, i32*** %4
%17 = load i32*, i32** %16
%18 = load i32, i32* %7
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %15
%24 = load i32, i32* %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %8
%27 = add i32 %26, 1
store i32 %27, i32* %8
br label %28
28: ; preds = %23, %15
br label %29
29: ; preds = %28
%30 = load i32, i32* %7
%31 = add i32 %30, 1
store i32 %31, i32* %7
br label %10
32: ; preds = %10
%33 = load i32, i32* %8
%34 = load double*, double** %6
%35 = load double, double* %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 %33, double %35)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Your lucky numbers are: \00"
@.str.1 = [4 x i8] c"%u \00"
@.str.2 = [48 x i8] c"\0A\0AJust found %u prime numbers, in %lf seconds!\0A\00"
define void @print_primes(i32** nocapture %0, i32* nocapture %1, double* nocapture %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %16
%6 = phi i32 [ 0, %3 ], [ %17, %16 ]
%7 = phi i32 [ 0, %3 ], [ %18, %16 ]
%8 = load i32*, i32** %0
%9 = zext i32 %7 to i64
%10 = getelementptr inbounds i32, i32* %8, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%15 = add i32 %6, 1
br label %16
16: ; preds = %5, %13
%17 = phi i32 [ %15, %13 ], [ %6, %5 ]
%18 = add i32 %7, 1
%19 = load i32, i32* %1
%20 = icmp ugt i32 %18, %19
br i1 %20, label %21, label %5
21: ; preds = %16
%22 = load double, double* %2
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i32 %17, double %22)
ret void
}