#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 */
char *basename(char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void help(const char *cmd) {
  fprintf(stderr,
          "\nUsage:\nTrace mode:\n\t%s --trace -f|--trace-file <filename>"
          " -o|--output-file <filename> -t|--duration <seconds>"
          " -c|--idle -p|--frequency -w|--wakeup",
          basename(cmd));
  fprintf(stderr,
          "\nReporting mode:\n\t%s --import -f|--trace-file <filename>"
          " -o|--output-file <filename>",
          basename(cmd));
  fprintf(stderr,
          "\n\nExamples:\n1. Run a trace, post-process the results"
          " (default is to show only C-state statistics):\n\tsudo "
          "./%s --trace -f /tmp/mytrace -t 10\n",
          basename(cmd));
  fprintf(stderr,
          "\n2. Run a trace, post-process the results and print all"
          " statistics:\n\tsudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w\n",
          basename(cmd));
  fprintf(stderr,
          "\n3. Run a trace with an external workload, post-process the"
          " results:\n\tsudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w -- "
          "rt-app /tmp/mp3.json\n",
          basename(cmd));
  fprintf(stderr,
          "\n4. Post-process a trace captured earlier:\n\tsudo ./%s"
          " --import -f /tmp/mytrace\n",
          basename(cmd));
  fprintf(stderr,
          "\n5. Run a trace, post-process the results and print all"
          " statistics into a file:\n\tsudo ./%s --trace -f /tmp/mytrace -t 10 "
          "-p -c -w"
          " -o /tmp/myreport\n",
          basename(cmd));
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xeb2(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xf1f(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xf4d(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rdx
lea    0xfb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0x1003(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0x10(%rbp),%edi
mov    %rax,%rdx
lea    0x106c(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <basename@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0x1095(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%ebp
call   1040 <basename@plt>
lea    0xec3(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1040 <basename@plt>
lea    0xf3b(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1040 <basename@plt>
lea    0xf74(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1040 <basename@plt>
lea    0xfe5(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1040 <basename@plt>
lea    0x1040(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1040 <basename@plt>
lea    0x10b4(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1040 <basename@plt>
lea    0x10e8(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [148 x i8] c"\0AUsage:\0ATrace mode:\0A\09%s --trace -f|--trace-file <filename> -o|--output-file <filename> -t|--duration <seconds> -c|--idle -p|--frequency -w|--wakeup\00"
@.str.1 = [85 x i8] c"\0AReporting mode:\0A\09%s --import -f|--trace-file <filename> -o|--output-file <filename>\00"
@.str.2 = [141 x i8] c"\0A\0AExamples:\0A1. Run a trace, post-process the results (default is to show only C-state statistics):\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10\0A\00"
@.str.3 = [119 x i8] c"\0A2. Run a trace, post-process the results and print all statistics:\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w\0A\00"
@.str.4 = [144 x i8] c"\0A3. Run a trace with an external workload, post-process the results:\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w -- rt-app /tmp/mp3.json\0A\00"
@.str.5 = [80 x i8] c"\0A4. Post-process a trace captured earlier:\0A\09sudo ./%s --import -f /tmp/mytrace\0A\00"
@.str.6 = [148 x i8] c"\0A5. Run a trace, post-process the results and print all statistics into a file:\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w -o /tmp/myreport\0A\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i8* @basename(i8* %4)
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %2
%9 = call i8* @basename(i8* %8)
%10 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %2
%13 = call i8* @basename(i8* %12)
%14 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %2
%17 = call i8* @basename(i8* %16)
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %2
%21 = call i8* @basename(i8* %20)
%22 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.4, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %2
%25 = call i8* @basename(i8* %24)
%26 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %2
%29 = call i8* @basename(i8* %28)
%30 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.6, i64 0, i64 0), i8* %29)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [148 x i8] c"\0AUsage:\0ATrace mode:\0A\09%s --trace -f|--trace-file <filename> -o|--output-file <filename> -t|--duration <seconds> -c|--idle -p|--frequency -w|--wakeup\00"
@.str.1 = [85 x i8] c"\0AReporting mode:\0A\09%s --import -f|--trace-file <filename> -o|--output-file <filename>\00"
@.str.2 = [141 x i8] c"\0A\0AExamples:\0A1. Run a trace, post-process the results (default is to show only C-state statistics):\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10\0A\00"
@.str.3 = [119 x i8] c"\0A2. Run a trace, post-process the results and print all statistics:\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w\0A\00"
@.str.4 = [144 x i8] c"\0A3. Run a trace with an external workload, post-process the results:\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w -- rt-app /tmp/mp3.json\0A\00"
@.str.5 = [80 x i8] c"\0A4. Post-process a trace captured earlier:\0A\09sudo ./%s --import -f /tmp/mytrace\0A\00"
@.str.6 = [148 x i8] c"\0A5. Run a trace, post-process the results and print all statistics into a file:\0A\09sudo ./%s --trace -f /tmp/mytrace -t 10 -p -c -w -o /tmp/myreport\0A\00"
define void @help(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i8* @basename(i8* %0)
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stderr
%6 = tail call i8* @basename(i8* %0)
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = tail call i8* @basename(i8* %0)
%10 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @stderr
%12 = tail call i8* @basename(i8* %0)
%13 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @stderr
%15 = tail call i8* @basename(i8* %0)
%16 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @stderr
%18 = tail call i8* @basename(i8* %0)
%19 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @stderr
%21 = tail call i8* @basename(i8* %0)
%22 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.6, i64 0, i64 0), i8* %21)
ret void
}