#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 usage() {
  printf("Branch predictor Framework ACA2014:\n");
  printf("\n");
  printf(" Global options:\n");
  printf("  -a        Print advanced statistics\n");
  printf("  -b        Print basic statistics\n");
  printf("  -c        Print csv format instead of table\n");
  printf("  -h        Help - Print this text\n");
  printf("  -i <FILE> Tracefile to be read (mandatory)\n");
  printf("  -s        Print score only\n");
  printf("\n");
  printf(" Predictor types:\n");
  printf("  -f        Always false (Predict all branches not taken)\n");
  printf("  -r        Predict random\n");
  printf("  -t        Always true (Predict all branches taken)\n");
  printf("  -1        Assignment 1: Simple\n");
  printf("  -2        Assignment 2: GAg\n");
  printf("  -3        Assignment 3: SAs\n");
  printf("  -4        Assignment 4: Your own\n");
  printf("  -5        Bonus 1: Your own\n");
  printf("  -6        Bonus 2: Your own\n");
  printf("\n");
  printf(" Predictor options:\n");
  printf("  -x        Random seed for random predictor (-r)\n");
  printf("  -k        History length for Assignment 2, 3 (and 4)\n");
  printf("  -n        Number of sets for Assignment 3 (and 4)\n");
  printf("\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0x11da(%rip),%rdi
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2b(%rip),%rdi
call   1030 <printf@plt>
lea    0xf4e(%rip),%rdi
call   1030 <printf@plt>
lea    0xf66(%rip),%rdi
call   1030 <printf@plt>
lea    0xf88(%rip),%rdi
call   1030 <printf@plt>
lea    0x117a(%rip),%rdi
call   1030 <printf@plt>
lea    0xf8e(%rip),%rdi
call   1030 <printf@plt>
lea    0xf95(%rip),%rdi
call   1030 <printf@plt>
lea    0xfc4(%rip),%rdi
call   1030 <printf@plt>
lea    0xfd4(%rip),%rdi
call   1030 <printf@plt>
lea    0xffe(%rip),%rdi
call   1030 <printf@plt>
lea    0x1014(%rip),%rdi
call   1030 <printf@plt>
lea    0x1027(%rip),%rdi
call   1030 <printf@plt>
lea    0x103a(%rip),%rdi
call   1030 <printf@plt>
lea    0x1052(%rip),%rdi
call   1030 <printf@plt>
lea    0x1065(%rip),%rdi
call   1030 <printf@plt>
lea    0x10f6(%rip),%rdi
call   1030 <printf@plt>
lea    0x106c(%rip),%rdi
call   1030 <printf@plt>
lea    0x1075(%rip),%rdi
call   1030 <printf@plt>
lea    0x109c(%rip),%rdi
call   1030 <printf@plt>
lea    0x10c8(%rip),%rdi
call   1030 <printf@plt>
lea    0x10ba(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
lea    0xeeb(%rip),%rdi
call   1040 <puts@plt>
lea    0xf05(%rip),%rdi
call   1040 <puts@plt>
lea    0xf1c(%rip),%rdi
call   1040 <puts@plt>
lea    0xf3e(%rip),%rdi
call   1040 <puts@plt>
lea    0xf55(%rip),%rdi
call   1040 <puts@plt>
lea    0xf76(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf7d(%rip),%rdi
call   1040 <puts@plt>
lea    0xf83(%rip),%rdi
call   1040 <puts@plt>
lea    0xfb1(%rip),%rdi
call   1040 <puts@plt>
lea    0xfc0(%rip),%rdi
call   1040 <puts@plt>
lea    0xfe9(%rip),%rdi
call   1040 <puts@plt>
lea    0xffe(%rip),%rdi
call   1040 <puts@plt>
lea    0x1010(%rip),%rdi
call   1040 <puts@plt>
lea    0x1022(%rip),%rdi
call   1040 <puts@plt>
lea    0x1039(%rip),%rdi
call   1040 <puts@plt>
lea    0x104b(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1053(%rip),%rdi
call   1040 <puts@plt>
lea    0x105b(%rip),%rdi
call   1040 <puts@plt>
lea    0x1081(%rip),%rdi
call   1040 <puts@plt>
lea    0x10ac(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Branch predictor Framework ACA2014:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [18 x i8] c" Global options:\0A\00"
@.str.3 = [39 x i8] c" -a Print advanced statistics\0A\00"
@.str.4 = [36 x i8] c" -b Print basic statistics\0A\00"
@.str.5 = [47 x i8] c" -c Print csv format instead of table\0A\00"
@.str.6 = [36 x i8] c" -h Help - Print this text\0A\00"
@.str.7 = [46 x i8] c" -i <FILE> Tracefile to be read (mandatory)\0A\00"
@.str.8 = [30 x i8] c" -s Print score only\0A\00"
@.str.9 = [19 x i8] c" Predictor types:\0A\00"
@.str.10 = [59 x i8] c" -f Always false (Predict all branches not taken)\0A\00"
@.str.11 = [28 x i8] c" -r Predict random\0A\00"
@.str.12 = [54 x i8] c" -t Always true (Predict all branches taken)\0A\00"
@.str.13 = [34 x i8] c" -1 Assignment 1: Simple\0A\00"
@.str.14 = [31 x i8] c" -2 Assignment 2: GAg\0A\00"
@.str.15 = [31 x i8] c" -3 Assignment 3: SAs\0A\00"
@.str.16 = [36 x i8] c" -4 Assignment 4: Your own\0A\00"
@.str.17 = [31 x i8] c" -5 Bonus 1: Your own\0A\00"
@.str.18 = [31 x i8] c" -6 Bonus 2: Your own\0A\00"
@.str.19 = [21 x i8] c" Predictor options:\0A\00"
@.str.20 = [51 x i8] c" -x Random seed for random predictor (-r)\0A\00"
@.str.21 = [56 x i8] c" -k History length for Assignment 2, 3 (and 4)\0A\00"
@.str.22 = [53 x i8] c" -n Number of sets for Assignment 3 (and 4)\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.10, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.12, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.13, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.16, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.18, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.20, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.21, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.22, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"Branch predictor Framework ACA2014:\00"
@str.23 = [17 x i8] c" Global options:\00"
@str.24 = [38 x i8] c" -a Print advanced statistics\00"
@str.25 = [35 x i8] c" -b Print basic statistics\00"
@str.26 = [46 x i8] c" -c Print csv format instead of table\00"
@str.27 = [35 x i8] c" -h Help - Print this text\00"
@str.28 = [45 x i8] c" -i <FILE> Tracefile to be read (mandatory)\00"
@str.29 = [29 x i8] c" -s Print score only\00"
@str.30 = [18 x i8] c" Predictor types:\00"
@str.31 = [58 x i8] c" -f Always false (Predict all branches not taken)\00"
@str.32 = [27 x i8] c" -r Predict random\00"
@str.33 = [53 x i8] c" -t Always true (Predict all branches taken)\00"
@str.34 = [33 x i8] c" -1 Assignment 1: Simple\00"
@str.35 = [30 x i8] c" -2 Assignment 2: GAg\00"
@str.36 = [30 x i8] c" -3 Assignment 3: SAs\00"
@str.37 = [35 x i8] c" -4 Assignment 4: Your own\00"
@str.38 = [30 x i8] c" -5 Bonus 1: Your own\00"
@str.39 = [30 x i8] c" -6 Bonus 2: Your own\00"
@str.40 = [20 x i8] c" Predictor options:\00"
@str.41 = [50 x i8] c" -x Random seed for random predictor (-r)\00"
@str.42 = [55 x i8] c" -k History length for Assignment 2, 3 (and 4)\00"
@str.43 = [52 x i8] c" -n Number of sets for Assignment 3 (and 4)\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.23, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.24, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.25, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.26, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.27, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.28, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.29, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.30, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.31, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.32, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.33, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.34, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.35, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.36, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.37, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.38, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.39, i64 0, i64 0))
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.40, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.41, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.42, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.43, i64 0, i64 0))
%26 = tail call i32 @putchar(i32 10)
ret void
}