#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(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void usage() {
  fflush(stdout);
  fprintf(
      stderr,
      "Usage: demmt [OPTION]\n"
      "Decodes binary trace files generated by Valgrind MMT. Reads standard "
      "input\n"
      "or file passed by -l.\n\n"
      "  -l file\tuse \"file\" as input (can be compressed by: xz, bzip2, "
      "gzip)\n"
      "  -q\t\tprint only the most important data (quiet); shortcut for:\n"
      "    \t\t-d all -e pb,shader,macro,tsc,tic,cp,classes=all,buffer-usage,\n"
      "    \t\tnvrm-class-desc\n"
      "  -m chipset\tset chipset version (default: auto-detect based on trace\n"
      "            \tcontent and file name (nvXX...))\n"
      "  -c 0/1\tdisable/enable colors (default: 1 if stdout is a terminal)\n"
      "  -g 0/1\t= -d/-e gpu-addr (default: 0)\n"
      "  -o 0/1\t= -d/-e ioctl-raw (default: 0)\n"
      "  -r 0/1\t= -d/-e macro-rt-verbose (default: 0)\n"
      "  -p 0/1\tdisable/enable pager (default: 1 if stdout is a terminal)\n"
      "  -i 0/1\tdisable/enable log indentation (default: 0)\n"
      "  -a\t\t= -d classes=all\n"
      "  -s file\tin response to sync markers in input file: flush the output\n"
      "         \tstream and reply by writing marker id to specified file "
      "(see:\n"
      "         \tscripts/mmiotrace/mmt-app-demmt-mmiotrace.sh)\n"
      "  -x 0/1/2\tdisable/enable loose/enable strict sandboxing (default: 2\n"
      "          \tif libseccomp is available)\n"
      "\n"
      "  -d msg_type1[,msg_type2[,msg_type3....]] - disable messages\n"
      "  -e msg_type1[,msg_type2[,msg_type3....]] - enable messages\n"
      "     message types:\n"
      "     - write - memory write\n"
      "     - read - memory read\n"
      "     - gpu-addr - gpu address\n"
      "     - mem = read,write\n"
      "     - pb - push buffer\n"
      "     - class=[all,0x...] - class decoder\n"
      "     - tsc - texture sampler control block\n"
      "     - tic - texture image control block\n"
      "     - vp - vertex program\n"
      "     - fp - fragment program\n"
      "     - gp - geometry program\n"
      "     - cp - compute program\n"
      "     - tep\n"
      "     - tcp\n"
      "     - shader = vp,fp,gp,tep,tcp\n"
      "     - macro-rt-verbose - verbose macro interpreter\n"
      "     - macro-rt - macro interpreter \n"
      "     - macro-dis - macro disasm\n"
      "     - macro = macro-rt,macro-dis\n"
      "     - sys_mmap\n"
      "     - sys_mmap_details - prot & flags\n"
      "     - sys_munmap\n"
      "     - sys_mremap\n"
      "     - sys_open\n"
      "     - sys_write\n"
      "     - sys = "
      "sys_mmap,sys_munmap,sys_mremap,sys_open,sys_write,ioctl-desc\n"
      "     - ioctl-raw - raw ioctl data\n"
      "     - ioctl-desc - decoded ioctl\n"
      "     - ioctl = ioctl-raw,ioctl-desc\n"
      "     - nvrm-ioctl=[all,name] name=create,call,host_map,etc...\n"
      "     - nvrm-mthd=[all,0x...] - method call\n"
      "     - nvrm-handle-desc - handle description\n"
      "     - nvrm-class-desc - class description\n"
      "     - nvrm-unk-0-fields - unk zero fields\n"
      "     - nvrm-obj-tree - object tree after create and before destroy "
      "ioctls\n"
      "     - nvrm = "
      "nvrm-ioctl=all,nvrm-mthd=all,nvrm-handle-desc,nvrm-class-desc\n"
      "     - buffer-usage\n"
      "     - msg - textual valgrind message\n"
      "     - info - various informations\n"
      "     - all - everything above\n"
      "\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [2641 x i8] c"Usage: demmt [OPTION]\0ADecodes binary trace files generated by Valgrind MMT. Reads standard input\0Aor file passed by -l.\0A\0A -l file\09use \22file\22 as input (can be compressed by: xz, bzip2, gzip)\0A -q\09\09print only the most important data (quiet); shortcut for:\0A \09\09-d all -e pb,shader,macro,tsc,tic,cp,classes=all,buffer-usage,\0A \09\09nvrm-class-desc\0A -m chipset\09set chipset version (default: auto-detect based on trace\0A \09content and file name (nvXX...))\0A -c 0/1\09disable/enable colors (default: 1 if stdout is a terminal)\0A -g 0/1\09= -d/-e gpu-addr (default: 0)\0A -o 0/1\09= -d/-e ioctl-raw (default: 0)\0A -r 0/1\09= -d/-e macro-rt-verbose (default: 0)\0A -p 0/1\09disable/enable pager (default: 1 if stdout is a terminal)\0A -i 0/1\09disable/enable log indentation (default: 0)\0A -a\09\09= -d classes=all\0A -s file\09in response to sync markers in input file: flush the output\0A \09stream and reply by writing marker id to specified file (see:\0A \09scripts/mmiotrace/mmt-app-demmt-mmiotrace.sh)\0A -x 0/1/2\09disable/enable loose/enable strict sandboxing (default: 2\0A \09if libseccomp is available)\0A\0A -d msg_type1[,msg_type2[,msg_type3....]] - disable messages\0A -e msg_type1[,msg_type2[,msg_type3....]] - enable messages\0A message types:\0A - write - memory write\0A - read - memory read\0A - gpu-addr - gpu address\0A - mem = read,write\0A - pb - push buffer\0A - class=[all,0x...] - class decoder\0A - tsc - texture sampler control block\0A - tic - texture image control block\0A - vp - vertex program\0A - fp - fragment program\0A - gp - geometry program\0A - cp - compute program\0A - tep\0A - tcp\0A - shader = vp,fp,gp,tep,tcp\0A - macro-rt-verbose - verbose macro interpreter\0A - macro-rt - macro interpreter \0A - macro-dis - macro disasm\0A - macro = macro-rt,macro-dis\0A - sys_mmap\0A - sys_mmap_details - prot & flags\0A - sys_munmap\0A - sys_mremap\0A - sys_open\0A - sys_write\0A - sys = sys_mmap,sys_munmap,sys_mremap,sys_open,sys_write,ioctl-desc\0A - ioctl-raw - raw ioctl data\0A - ioctl-desc - decoded ioctl\0A - ioctl = ioctl-raw,ioctl-desc\0A - nvrm-ioctl=[all,name] name=create,call,host_map,etc...\0A - nvrm-mthd=[all,0x...] - method call\0A - nvrm-handle-desc - handle description\0A - nvrm-class-desc - class description\0A - nvrm-unk-0-fields - unk zero fields\0A - nvrm-obj-tree - object tree after create and before destroy ioctls\0A - nvrm = nvrm-ioctl=all,nvrm-mthd=all,nvrm-handle-desc,nvrm-class-desc\0A - buffer-usage\0A - msg - textual valgrind message\0A - info - various informations\0A - all - everything above\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([2641 x i8], [2641 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [2641 x i8] c"Usage: demmt [OPTION]\0ADecodes binary trace files generated by Valgrind MMT. Reads standard input\0Aor file passed by -l.\0A\0A -l file\09use \22file\22 as input (can be compressed by: xz, bzip2, gzip)\0A -q\09\09print only the most important data (quiet); shortcut for:\0A \09\09-d all -e pb,shader,macro,tsc,tic,cp,classes=all,buffer-usage,\0A \09\09nvrm-class-desc\0A -m chipset\09set chipset version (default: auto-detect based on trace\0A \09content and file name (nvXX...))\0A -c 0/1\09disable/enable colors (default: 1 if stdout is a terminal)\0A -g 0/1\09= -d/-e gpu-addr (default: 0)\0A -o 0/1\09= -d/-e ioctl-raw (default: 0)\0A -r 0/1\09= -d/-e macro-rt-verbose (default: 0)\0A -p 0/1\09disable/enable pager (default: 1 if stdout is a terminal)\0A -i 0/1\09disable/enable log indentation (default: 0)\0A -a\09\09= -d classes=all\0A -s file\09in response to sync markers in input file: flush the output\0A \09stream and reply by writing marker id to specified file (see:\0A \09scripts/mmiotrace/mmt-app-demmt-mmiotrace.sh)\0A -x 0/1/2\09disable/enable loose/enable strict sandboxing (default: 2\0A \09if libseccomp is available)\0A\0A -d msg_type1[,msg_type2[,msg_type3....]] - disable messages\0A -e msg_type1[,msg_type2[,msg_type3....]] - enable messages\0A message types:\0A - write - memory write\0A - read - memory read\0A - gpu-addr - gpu address\0A - mem = read,write\0A - pb - push buffer\0A - class=[all,0x...] - class decoder\0A - tsc - texture sampler control block\0A - tic - texture image control block\0A - vp - vertex program\0A - fp - fragment program\0A - gp - geometry program\0A - cp - compute program\0A - tep\0A - tcp\0A - shader = vp,fp,gp,tep,tcp\0A - macro-rt-verbose - verbose macro interpreter\0A - macro-rt - macro interpreter \0A - macro-dis - macro disasm\0A - macro = macro-rt,macro-dis\0A - sys_mmap\0A - sys_mmap_details - prot & flags\0A - sys_munmap\0A - sys_mremap\0A - sys_open\0A - sys_write\0A - sys = sys_mmap,sys_munmap,sys_mremap,sys_open,sys_write,ioctl-desc\0A - ioctl-raw - raw ioctl data\0A - ioctl-desc - decoded ioctl\0A - ioctl = ioctl-raw,ioctl-desc\0A - nvrm-ioctl=[all,name] name=create,call,host_map,etc...\0A - nvrm-mthd=[all,0x...] - method call\0A - nvrm-handle-desc - handle description\0A - nvrm-class-desc - class description\0A - nvrm-unk-0-fields - unk zero fields\0A - nvrm-obj-tree - object tree after create and before destroy ioctls\0A - nvrm = nvrm-ioctl=all,nvrm-mthd=all,nvrm-handle-desc,nvrm-class-desc\0A - buffer-usage\0A - msg - textual valgrind message\0A - info - various informations\0A - all - everything above\0A\0A\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([2641 x i8], [2641 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}