#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *,
                           char *, char *, int);
int /*<<< orphan*/ stderr;
__attribute__((noreturn)) void usage(char *name) {
  fprintf(stderr,
          "Usage:\n\n"
          "%s -e [options] [-- /path/to/command [arg0 [arg1] ...]\n"
          "%s -c [options] [\"shell command\"]\n"
          "%s <-k|-r> [options]\n"
          "%s -s <key> [options]\n"
          "%s <hostname> [\"shell command\"] "
          "(equivalent to -h <hostname> -c command)\n\n"
          "Command descriptions:\n"
          "  -e              execute a program via execve()\n"
          "  -c              execute shell command via \"/bin/sh -c\" "
          "(e.g. 'cat <file> | grep test')\n"
          "  -k              write last %d bytes of the kernel "
          "ring buffer on stderr\n"
          "  -r              reboot\n"
          "  -s <key>        sysrq request <key>\n\n"
          "Execve command options (for -e or -c):\n"
          "  -x (avoid!)     simple/plain rexec mode. No crypto after "
          "authentication!\n"
          "                  stdin will be disabled\n\n"
          "General options:\n"
          "  -h <hostname>   target hostname/ipv4/ipv6\n"
          "  -p <port>       target port\n"
          "  -t              use the alternative (test mode) key\n\n"
          "If no command is specified, an interactive shell is run.\n\n",
          name, name, name, name, name, (32768 - 12 - 20));
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x8(%rbp),%r9
mov    -0x8(%rbp),%rax
lea    0xeb0(%rip),%rsi
mov    %rax,(%rsp)
movl   $0x7fe0,0x8(%rsp)
call   1030 <fprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rcx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    %rcx,%rdx
mov    %rcx,%r8
mov    %rcx,%r9
push   $0x7fe0
push   %rcx
call   1030 <fprintf@plt>
add    $0x10,%rsp
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [873 x i8] c"Usage:\0A\0A%s -e [options] [-- /path/to/command [arg0 [arg1] ...]\0A%s -c [options] [\22shell command\22]\0A%s <-k|-r> [options]\0A%s -s <key> [options]\0A%s <hostname> [\22shell command\22] (equivalent to -h <hostname> -c command)\0A\0ACommand descriptions:\0A -e execute a program via execve()\0A -c execute shell command via \22/bin/sh -c\22 (e.g. 'cat <file> | grep test')\0A -k write last %d bytes of the kernel ring buffer on stderr\0A -r reboot\0A -s <key> sysrq request <key>\0A\0AExecve command options (for -e or -c):\0A -x (avoid!) simple/plain rexec mode. No crypto after authentication!\0A stdin will be disabled\0A\0AGeneral options:\0A -h <hostname> target hostname/ipv4/ipv6\0A -p <port> target port\0A -t use the alternative (test mode) key\0A\0AIf no command is specified, an interactive shell is run.\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([873 x i8], [873 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5, i8* %6, i8* %7, i8* %8, i32 32736)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [873 x i8] c"Usage:\0A\0A%s -e [options] [-- /path/to/command [arg0 [arg1] ...]\0A%s -c [options] [\22shell command\22]\0A%s <-k|-r> [options]\0A%s -s <key> [options]\0A%s <hostname> [\22shell command\22] (equivalent to -h <hostname> -c command)\0A\0ACommand descriptions:\0A -e execute a program via execve()\0A -c execute shell command via \22/bin/sh -c\22 (e.g. 'cat <file> | grep test')\0A -k write last %d bytes of the kernel ring buffer on stderr\0A -r reboot\0A -s <key> sysrq request <key>\0A\0AExecve command options (for -e or -c):\0A -x (avoid!) simple/plain rexec mode. No crypto after authentication!\0A stdin will be disabled\0A\0AGeneral options:\0A -h <hostname> target hostname/ipv4/ipv6\0A -p <port> target port\0A -t use the alternative (test mode) key\0A\0AIf no command is specified, an interactive shell is run.\0A\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([873 x i8], [873 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0, i8* %0, i8* %0, i8* %0, i32 32736)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}