#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 */
struct utsname {
  char *release;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int uname(struct utsname *);
void usage(char *prog, int rc) {
  printf(("\n%s [-v] [-w] [-V] [-h] [-u] [-c cmd ] [-x pid] [-u user] "
          "[-A|-L|-d] [-C WHEN]\n"
          "\t[-b bufsize] [-R] [-r N:URI] [-o FILE [-D] [-S size[,N]]] MODULE "
          "[module-options]\n"),
         prog);
  printf(
      ("-v              Increase verbosity.\n"
       "-V              Print version number and exit.\n"
       "-h              Print this help text and exit.\n"
       "-w              Suppress warnings.\n"
       "-u              Load uprobes.ko\n"
       "-c cmd          Command \'cmd\' will be run and staprun will\n"
       "                exit when it does.  The '_stp_target' variable\n"
       "                will contain the pid for the command.\n"
       "-x pid          Sets the '_stp_target' variable to pid.\n"
       "-o FILE         Send output to FILE. This supports strftime(3)\n"
       "                formats for FILE.\n"
       "-b buffer size  The systemtap module specifies a buffer size.\n"
       "                Setting one here will override that value.  The\n"
       "                value should be an integer between 1 and 4095 \n"
       "                which be assumed to be the buffer size in MB.\n"
       "                That value will be per-cpu in bulk mode.\n"
       "-L              Load module and start probes, then detach.\n"
       "-A              Attach to loaded systemtap module.\n"
       "-C WHEN         Enable colored errors. WHEN must be either 'auto',\n"
       "                'never', or 'always'. Set to 'auto' by default.\n"
       "-d              Delete a module.  Only detached or unused modules\n"
       "                the user has permission to access will be deleted. Use "
       "\"*\"\n"
       "                (quoted) to delete all unused modules.\n"
       "-R              Have staprun create a new name for the module before\n"
       "                inserting it. This allows the same module to be "
       "inserted\n"
       "                more than once.\n"
       "-r N:URI        Pass N:URI data to tapset functions "
       "remote_id()/remote_uri().\n"
       "-D              Run in background. This requires '-o' option.\n"
       "-S size[,N]     Switches output file to next file when the size\n"
       "                of file reaches the specified size. The value\n"
       "                should be an integer greater than 1 which is\n"
       "                assumed to be the maximum file size in MB.\n"
       "                When the number of output files reaches N, it\n"
       "                switches to the first output file. You can omit\n"
       "                the second argument.\n"
       "-T timeout      Specifies upper limit on amount of time reader thread\n"
       "                will wait for new full trace buffer. Value should be "
       "an\n"
       "                integer >= 1, which is timeout value in ms. Default "
       "200ms.\n"
       "\n"
       "MODULE can be either a module name or a module path.  If a\n"
       "module name is used, it is searched in the following directory:\n"));
  {
    struct utsname utsbuf;
    int rc = uname(&utsbuf);
    if (!rc)
      printf("/lib/modules/%s/systemtap\n", utsbuf.release);
    else
      printf("/lib/modules/`uname -r`/systemtap\n");
  }
  exit(rc);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1040 <uname@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    118c <usage+0x5c>
mov    -0x18(%rbp),%rsi
lea    0x1843(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119a <usage+0x6a>
lea    0x184b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %rdi,%rsi
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf5f(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rdi
call   1050 <uname@plt>
test   %eax,%eax
jne    118c <usage+0x4c>
mov    0x8(%rsp),%rsi
lea    0xf25(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
call   1060 <exit@plt>
lea    0x184a(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.utsname = type { i8* }
@.str = [163 x i8] c"\0A%s [-v] [-w] [-V] [-h] [-u] [-c cmd ] [-x pid] [-u user] [-A|-L|-d] [-C WHEN]\0A\09[-b bufsize] [-R] [-r N:URI] [-o FILE [-D] [-S size[,N]]] MODULE [module-options]\0A\00"
@.str.1 = [2336 x i8] c"-v Increase verbosity.\0A-V Print version number and exit.\0A-h Print this help text and exit.\0A-w Suppress warnings.\0A-u Load uprobes.ko\0A-c cmd Command 'cmd' will be run and staprun will\0A exit when it does. The '_stp_target' variable\0A will contain the pid for the command.\0A-x pid Sets the '_stp_target' variable to pid.\0A-o FILE Send output to FILE. This supports strftime(3)\0A formats for FILE.\0A-b buffer size The systemtap module specifies a buffer size.\0A Setting one here will override that value. The\0A value should be an integer between 1 and 4095 \0A which be assumed to be the buffer size in MB.\0A That value will be per-cpu in bulk mode.\0A-L Load module and start probes, then detach.\0A-A Attach to loaded systemtap module.\0A-C WHEN Enable colored errors. WHEN must be either 'auto',\0A 'never', or 'always'. Set to 'auto' by default.\0A-d Delete a module. Only detached or unused modules\0A the user has permission to access will be deleted. Use \22*\22\0A (quoted) to delete all unused modules.\0A-R Have staprun create a new name for the module before\0A inserting it. This allows the same module to be inserted\0A more than once.\0A-r N:URI Pass N:URI data to tapset functions remote_id()/remote_uri().\0A-D Run in background. This requires '-o' option.\0A-S size[,N] Switches output file to next file when the size\0A of file reaches the specified size. The value\0A should be an integer greater than 1 which is\0A assumed to be the maximum file size in MB.\0A When the number of output files reaches N, it\0A switches to the first output file. You can omit\0A the second argument.\0A-T timeout Specifies upper limit on amount of time reader thread\0A will wait for new full trace buffer. Value should be an\0A integer >= 1, which is timeout value in ms. Default 200ms.\0A\0AMODULE can be either a module name or a module path. If a\0Amodule name is used, it is searched in the following directory:\0A\00"
@.str.2 = [27 x i8] c"/lib/modules/%s/systemtap\0A\00"
@.str.3 = [35 x i8] c"/lib/modules/`uname -r`/systemtap\0A\00"
define void @usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.utsname
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2336 x i8], [2336 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @uname(%struct.utsname* %5)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %2
%14 = getelementptr inbounds %struct.utsname, %struct.utsname* %5, i32 0, i32 0
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %15)
br label %19
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = load i32, i32* %4
%21 = call i32 @exit(i32 %20)
unreachable
}

LLVM IR (-O2):
%struct.utsname = type { i8* }
@.str = [163 x i8] c"\0A%s [-v] [-w] [-V] [-h] [-u] [-c cmd ] [-x pid] [-u user] [-A|-L|-d] [-C WHEN]\0A\09[-b bufsize] [-R] [-r N:URI] [-o FILE [-D] [-S size[,N]]] MODULE [module-options]\0A\00"
@.str.2 = [27 x i8] c"/lib/modules/%s/systemtap\0A\00"
@str = [2335 x i8] c"-v Increase verbosity.\0A-V Print version number and exit.\0A-h Print this help text and exit.\0A-w Suppress warnings.\0A-u Load uprobes.ko\0A-c cmd Command 'cmd' will be run and staprun will\0A exit when it does. The '_stp_target' variable\0A will contain the pid for the command.\0A-x pid Sets the '_stp_target' variable to pid.\0A-o FILE Send output to FILE. This supports strftime(3)\0A formats for FILE.\0A-b buffer size The systemtap module specifies a buffer size.\0A Setting one here will override that value. The\0A value should be an integer between 1 and 4095 \0A which be assumed to be the buffer size in MB.\0A That value will be per-cpu in bulk mode.\0A-L Load module and start probes, then detach.\0A-A Attach to loaded systemtap module.\0A-C WHEN Enable colored errors. WHEN must be either 'auto',\0A 'never', or 'always'. Set to 'auto' by default.\0A-d Delete a module. Only detached or unused modules\0A the user has permission to access will be deleted. Use \22*\22\0A (quoted) to delete all unused modules.\0A-R Have staprun create a new name for the module before\0A inserting it. This allows the same module to be inserted\0A more than once.\0A-r N:URI Pass N:URI data to tapset functions remote_id()/remote_uri().\0A-D Run in background. This requires '-o' option.\0A-S size[,N] Switches output file to next file when the size\0A of file reaches the specified size. The value\0A should be an integer greater than 1 which is\0A assumed to be the maximum file size in MB.\0A When the number of output files reaches N, it\0A switches to the first output file. You can omit\0A the second argument.\0A-T timeout Specifies upper limit on amount of time reader thread\0A will wait for new full trace buffer. Value should be an\0A integer >= 1, which is timeout value in ms. Default 200ms.\0A\0AMODULE can be either a module name or a module path. If a\0Amodule name is used, it is searched in the following directory:\00"
@str.4 = [34 x i8] c"/lib/modules/`uname -r`/systemtap\00"
define void @usage(i8* %0, i32 %1) {
%3 = alloca %struct.utsname
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2335 x i8], [2335 x i8]* @str, i64 0, i64 0))
%6 = bitcast %struct.utsname* %3 to i8*
%7 = call i32 @uname(%struct.utsname* %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = getelementptr inbounds %struct.utsname, %struct.utsname* %3, i64 0, i32 0
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.4, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = tail call i32 @exit(i32 %1)
unreachable
}