#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 *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "cherictl [-qw] [-a addr] [-p path_to_socket|port] "
      "[-c cable] [-D JTAG device#] [-r regnum] [-v value]\n"
      "    [-f filename] command\n"
      "\tbreakpoint\tset breakpoint at adddr (-w to wait on it)\n"
      "\tboot\ttell miniboot to proceed to the next kernel/loader\n"
      "\tcleanup\tclean up external processes and files\n"
      "\tc0regs\tlist CP0 registers\n"
      "\tc2regs\tlist capability registers\n"
      "\tconsole\tconnect to BERI PISM UART at filename\n"
      "\tdrain\tdrain debug socket\n"
      "\tdumpatse\tdump all atse(4) MAC control registers in one go\n"
      "\tdumpfifo\tdump fifo status and meta data\n"
      "\tdumppic\tdump PIC status\n"
      "\tlbu\tload unsigned byte from addr\n"
      "\tld\tload double word from addr\n"
      "\tlh\tload half word from addr\n"
      "\tlhu\tload unsigned half word from addr\n"
      "\tloadbin\tload binary file into cheri memory (deprecated)\n"
      "\tloaddram\tload binary file into DE4 memory\n"
      "\tloadsof\tload SOF format FPGA image to FPGA\n"
      "\tlwu\tload unsigned word from addr\n"
      "\tpause\tpause execution\n"
      "\tpc\tprint PC\n"
      "\tregs\tlist general-purpose registers\n"
      "\treset\treset the processor\n"
      "\tresume\tresume execution fully pipelined\n"
      "\tsb\tstore byte value at addr\n"
      "\tsd\tstore double word value at addr\n"
      "\tsetpc\tset PC to addr\n"
      "\tsetreg\tstore value in general-purpose regnum\n"
      "\tsettracefilter\tset a filter for trace records from "
      "stream_trace_filter.config\n"
      "\tsh\tstore half word value at addr\n"
      "\tstep\tsingle-step execution\n"
      "\tstreamtrace\treceive a stream of trace data, use -w for long stream\n"
      "\tsw\tstore word value at addr\n"
      "\tunpipeline\tresume execution unpipelined\n"
      "\tmemtrace\ttrace the execution of some number of instructions\n");
  printf("\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1040 <fprintf@plt>
lea    0x146e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [1472 x i8] c"cherictl [-qw] [-a addr] [-p path_to_socket|port] [-c cable] [-D JTAG device#] [-r regnum] [-v value]\0A [-f filename] command\0A\09breakpoint\09set breakpoint at adddr (-w to wait on it)\0A\09boot\09tell miniboot to proceed to the next kernel/loader\0A\09cleanup\09clean up external processes and files\0A\09c0regs\09list CP0 registers\0A\09c2regs\09list capability registers\0A\09console\09connect to BERI PISM UART at filename\0A\09drain\09drain debug socket\0A\09dumpatse\09dump all atse(4) MAC control registers in one go\0A\09dumpfifo\09dump fifo status and meta data\0A\09dumppic\09dump PIC status\0A\09lbu\09load unsigned byte from addr\0A\09ld\09load double word from addr\0A\09lh\09load half word from addr\0A\09lhu\09load unsigned half word from addr\0A\09loadbin\09load binary file into cheri memory (deprecated)\0A\09loaddram\09load binary file into DE4 memory\0A\09loadsof\09load SOF format FPGA image to FPGA\0A\09lwu\09load unsigned word from addr\0A\09pause\09pause execution\0A\09pc\09print PC\0A\09regs\09list general-purpose registers\0A\09reset\09reset the processor\0A\09resume\09resume execution fully pipelined\0A\09sb\09store byte value at addr\0A\09sd\09store double word value at addr\0A\09setpc\09set PC to addr\0A\09setreg\09store value in general-purpose regnum\0A\09settracefilter\09set a filter for trace records from stream_trace_filter.config\0A\09sh\09store half word value at addr\0A\09step\09single-step execution\0A\09streamtrace\09receive a stream of trace data, use -w for long stream\0A\09sw\09store word value at addr\0A\09unpipeline\09resume execution unpipelined\0A\09memtrace\09trace the execution of some number of instructions\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([1472 x i8], [1472 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @EXIT_FAILURE
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [1472 x i8] c"cherictl [-qw] [-a addr] [-p path_to_socket|port] [-c cable] [-D JTAG device#] [-r regnum] [-v value]\0A [-f filename] command\0A\09breakpoint\09set breakpoint at adddr (-w to wait on it)\0A\09boot\09tell miniboot to proceed to the next kernel/loader\0A\09cleanup\09clean up external processes and files\0A\09c0regs\09list CP0 registers\0A\09c2regs\09list capability registers\0A\09console\09connect to BERI PISM UART at filename\0A\09drain\09drain debug socket\0A\09dumpatse\09dump all atse(4) MAC control registers in one go\0A\09dumpfifo\09dump fifo status and meta data\0A\09dumppic\09dump PIC status\0A\09lbu\09load unsigned byte from addr\0A\09ld\09load double word from addr\0A\09lh\09load half word from addr\0A\09lhu\09load unsigned half word from addr\0A\09loadbin\09load binary file into cheri memory (deprecated)\0A\09loaddram\09load binary file into DE4 memory\0A\09loadsof\09load SOF format FPGA image to FPGA\0A\09lwu\09load unsigned word from addr\0A\09pause\09pause execution\0A\09pc\09print PC\0A\09regs\09list general-purpose registers\0A\09reset\09reset the processor\0A\09resume\09resume execution fully pipelined\0A\09sb\09store byte value at addr\0A\09sd\09store double word value at addr\0A\09setpc\09set PC to addr\0A\09setreg\09store value in general-purpose regnum\0A\09settracefilter\09set a filter for trace records from stream_trace_filter.config\0A\09sh\09store half word value at addr\0A\09step\09single-step execution\0A\09streamtrace\09receive a stream of trace data, use -w for long stream\0A\09sw\09store word value at addr\0A\09unpipeline\09resume execution unpipelined\0A\09memtrace\09trace the execution of some number of instructions\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([1472 x i8], [1472 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}