#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*/ primes(unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int /*<<< orphan*/ show(char *, int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main() {
  unsigned int n;
  printf("The sieve will find all primes in the range 0 - N,\nwhere N is the "
         "natural number you will supply.\n\nSupply it N: ");
  scanf("%u", &n);
  show("%u\t", primes(n));
  printf("\n\n\n");
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1070 <primes@plt>
mov    %eax,%esi
lea    0xee8(%rip),%rdi
call   1050 <show@plt>
lea    0xee0(%rip),%rdi
call   1040 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
lea    0xefd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
call   1080 <primes@plt>
lea    0xee6(%rip),%rdi
mov    %eax,%esi
call   1060 <show@plt>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xed0(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [113 x i8] c"The sieve will find all primes in the range 0 - N,\0Awhere N is the natural number you will supply.\0A\0ASupply it N: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [4 x i8] c"%u\09\00"
@.str.3 = [4 x i8] c"\0A\0A\0A\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @primes(i32 %5)
%7 = call i32 @show(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [113 x i8] c"The sieve will find all primes in the range 0 - N,\0Awhere N is the natural number you will supply.\0A\0ASupply it N: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [4 x i8] c"%u\09\00"
@.str.4 = [6 x i8] c"PAUSE\00"
@str = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @primes(i32 %5)
%7 = call i32 @show(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%9 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}