#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 help() {
  printf("sieve - thomas.lextrait@gmail.com\n");
  printf("usage: ./sieve [-h|-v|-t] [-f<file>] [-m<max prime>] [-q<max "
         "primes>]\n");
  printf("\t-f\tSpecify a file to save primes to,\n\t\totherwise will use "
         "'primes.txt'.\n");
  printf("\t-m\tSpecify the upper limit for computing primes,\n\t\totherwise "
         "will use %li.\n",
         10000000L);
  printf("\t-q\tSpecify how many prime numbers to look for,\n\t\totherwise "
         "will use %i.\n",
         10000000);
  printf("\t-v\tBe verbose, display each prime as it is found.\n");
  printf("\t-t\tDisplay total time elapsed.\n");
  printf("\t-h\tDisplay this help message.\n");
  printf("\n\tFlags -m and -q can be used together, the program will\n\tstop "
         "as soon as it reaches either condition.\n");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf6f(%rip),%rdi
mov    $0x989680,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfa9(%rip),%rdi
mov    $0x989680,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfe0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1006(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1019(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x102b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xf6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf85(%rip),%rdi
call   1030 <puts@plt>
lea    0xfbf(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
mov    $0x989680,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeee(%rip),%rdi
mov    $0x989680,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xfd6(%rip),%rdi
call   1030 <puts@plt>
lea    0xffd(%rip),%rdi
call   1030 <puts@plt>
lea    0x1011(%rip),%rdi
call   1030 <puts@plt>
lea    0x1024(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"sieve - thomas.lextrait@gmail.com\0A\00"
@.str.1 = [71 x i8] c"usage: ./sieve [-h|-v|-t] [-f<file>] [-m<max prime>] [-q<max primes>]\0A\00"
@.str.2 = [74 x i8] c"\09-f\09Specify a file to save primes to,\0A\09\09otherwise will use 'primes.txt'.\0A\00"
@.str.3 = [77 x i8] c"\09-m\09Specify the upper limit for computing primes,\0A\09\09otherwise will use %li.\0A\00"
@.str.4 = [74 x i8] c"\09-q\09Specify how many prime numbers to look for,\0A\09\09otherwise will use %i.\0A\00"
@.str.5 = [52 x i8] c"\09-v\09Be verbose, display each prime as it is found.\0A\00"
@.str.6 = [33 x i8] c"\09-t\09Display total time elapsed.\0A\00"
@.str.7 = [32 x i8] c"\09-h\09Display this help message.\0A\00"
@.str.8 = [104 x i8] c"\0A\09Flags -m and -q can be used together, the program will\0A\09stop as soon as it reaches either condition.\0A\00"
define void @help() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0), i64 10000000)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0), i32 10000000)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.3 = [77 x i8] c"\09-m\09Specify the upper limit for computing primes,\0A\09\09otherwise will use %li.\0A\00"
@.str.4 = [74 x i8] c"\09-q\09Specify how many prime numbers to look for,\0A\09\09otherwise will use %i.\0A\00"
@str = [34 x i8] c"sieve - thomas.lextrait@gmail.com\00"
@str.9 = [70 x i8] c"usage: ./sieve [-h|-v|-t] [-f<file>] [-m<max prime>] [-q<max primes>]\00"
@str.10 = [73 x i8] c"\09-f\09Specify a file to save primes to,\0A\09\09otherwise will use 'primes.txt'.\00"
@str.11 = [51 x i8] c"\09-v\09Be verbose, display each prime as it is found.\00"
@str.12 = [32 x i8] c"\09-t\09Display total time elapsed.\00"
@str.13 = [31 x i8] c"\09-h\09Display this help message.\00"
@str.14 = [103 x i8] c"\0A\09Flags -m and -q can be used together, the program will\0A\09stop as soon as it reaches either condition.\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.9, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.10, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0), i64 10000000)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0), i32 10000000)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @str.14, i64 0, i64 0))
ret void
}