#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_help(char *pname) {
  printf("Chaos controller next-gen  by agentOfChaos  "
         "informaniac99<AT>gmail<DOT>com\n\n");
  printf("Usage: %s -p [target pid] [list of space-separated numbers]...\n\n",
         pname);
  printf("When the program is launched (with proper permissions), it will "
         "attempt to\n");
  printf("attach the target pid and set a breakpoint in its code (just like "
         "debuggers do).\n");
  printf("Now, every time the target calls rand(), the function will return "
         "the numbers\n");
  printf("chosen by you (instad of random ones), isn't that cool?\n");
  printf("The numbers will be returned in order with each subsequent call, the "
         "list will\n");
  printf("be looped over if needed.\n\n");
  printf("options:\n");
  printf("-h  --help\t\tShow this message. Duh.\n");
  printf("-m  --monitor\t\tInject actual random values, echoing them on "
         "screen.\n");
  printf("-p  --pid\t\t[mandatory] target process'id.\n");
  printf("-s  --silent\t\tDo not print status messages.\n");
  printf("-v  --verbose\t\tEnables verbose mode.\n");
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x100e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1039(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x107b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1089(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1085(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x109c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x10d3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x10f0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x110f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
push   %rbx
mov    %rdi,%rbx
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf45(%rip),%rdi
call   1030 <puts@plt>
lea    0xf84(%rip),%rdi
call   1030 <puts@plt>
lea    0xfc9(%rip),%rdi
call   1030 <puts@plt>
lea    0x100b(%rip),%rdi
call   1030 <puts@plt>
lea    0x1037(%rip),%rdi
call   1030 <puts@plt>
lea    0x107a(%rip),%rdi
call   1030 <puts@plt>
lea    0x1089(%rip),%rdi
call   1030 <puts@plt>
lea    0x1086(%rip),%rdi
call   1030 <puts@plt>
lea    0x109e(%rip),%rdi
call   1030 <puts@plt>
lea    0x10d6(%rip),%rdi
call   1030 <puts@plt>
lea    0x10f4(%rip),%rdi
call   1030 <puts@plt>
lea    0x1114(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [77 x i8] c"Chaos controller next-gen by agentOfChaos informaniac99<AT>gmail<DOT>com\0A\0A\00"
@.str.1 = [65 x i8] c"Usage: %s -p [target pid] [list of space-separated numbers]...\0A\0A\00"
@.str.2 = [76 x i8] c"When the program is launched (with proper permissions), it will attempt to\0A\00"
@.str.3 = [82 x i8] c"attach the target pid and set a breakpoint in its code (just like debuggers do).\0A\00"
@.str.4 = [79 x i8] c"Now, every time the target calls rand(), the function will return the numbers\0A\00"
@.str.5 = [57 x i8] c"chosen by you (instad of random ones), isn't that cool?\0A\00"
@.str.6 = [80 x i8] c"The numbers will be returned in order with each subsequent call, the list will\0A\00"
@.str.7 = [28 x i8] c"be looped over if needed.\0A\0A\00"
@.str.8 = [10 x i8] c"options:\0A\00"
@.str.9 = [37 x i8] c"-h --help\09\09Show this message. Duh.\0A\00"
@.str.10 = [69 x i8] c"-m --monitor\09\09Inject actual random values, echoing them on screen.\0A\00"
@.str.11 = [43 x i8] c"-p --pid\09\09[mandatory] target process'id.\0A\00"
@.str.12 = [45 x i8] c"-s --silent\09\09Do not print status messages.\0A\00"
@.str.13 = [38 x i8] c"-v --verbose\09\09Enables verbose mode.\0A\00"
define void @print_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [65 x i8] c"Usage: %s -p [target pid] [list of space-separated numbers]...\0A\0A\00"
@str = [76 x i8] c"Chaos controller next-gen by agentOfChaos informaniac99<AT>gmail<DOT>com\0A\00"
@str.14 = [75 x i8] c"When the program is launched (with proper permissions), it will attempt to\00"
@str.15 = [81 x i8] c"attach the target pid and set a breakpoint in its code (just like debuggers do).\00"
@str.16 = [78 x i8] c"Now, every time the target calls rand(), the function will return the numbers\00"
@str.17 = [56 x i8] c"chosen by you (instad of random ones), isn't that cool?\00"
@str.18 = [79 x i8] c"The numbers will be returned in order with each subsequent call, the list will\00"
@str.19 = [27 x i8] c"be looped over if needed.\0A\00"
@str.20 = [9 x i8] c"options:\00"
@str.21 = [36 x i8] c"-h --help\09\09Show this message. Duh.\00"
@str.22 = [68 x i8] c"-m --monitor\09\09Inject actual random values, echoing them on screen.\00"
@str.23 = [42 x i8] c"-p --pid\09\09[mandatory] target process'id.\00"
@str.24 = [44 x i8] c"-s --silent\09\09Do not print status messages.\00"
@str.25 = [37 x i8] c"-v --verbose\09\09Enables verbose mode.\00"
define void @print_help(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.14, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.15, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.16, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.17, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str.18, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.19, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.20, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.22, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.23, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.24, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.25, i64 0, i64 0))
ret void
}