#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int, char *);
void usage(FILE *ofp, int exitval) {
  fprintf(
      ofp,
      "usage: strace [-CdffhiqrtttTvVxxy] [-I n] [-e expr]...\n              "
      "[-a column] [-o file] [-s strsize] [-P path]...\n              -p "
      "pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\n   or: strace "
      "-c[df] [-I n] [-e expr]... [-O overhead] [-S sortby]\n              -p "
      "pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\n-c -- count "
      "time, calls, and errors for each syscall and report summary\n-C -- like "
      "-c but also print regular output\n-d -- enable debug output to "
      "stderr\n-D -- run tracer process as a detached grandchild, not as "
      "parent\n-f -- follow forks, -ff -- with output into separate files\n-i "
      "-- print instruction pointer at time of syscall\n-q -- suppress "
      "messages about attaching, detaching, etc.\n-r -- print relative "
      "timestamp, -t -- absolute timestamp, -tt -- with usecs\n-T -- print "
      "time spent in each syscall\n-v -- verbose mode: print unabbreviated "
      "argv, stat, termios, etc. args\n-x -- print non-ascii strings in hex, "
      "-xx -- print all strings in hex\n-y -- print paths associated with file "
      "descriptor arguments\n-h -- print help message, -V -- print version\n-a "
      "column -- alignment COLUMN for printing syscall results (default "
      "%d)\n-b execve -- detach on this syscall\n-e expr -- a qualifying "
      "expression: option=[!]all or option=[!]val1[,val2]...\n   options: "
      "trace, abbrev, verbose, raw, signal, read, write\n-I interruptible --\n "
      "  1: no signals are blocked\n   2: fatal signals are blocked while "
      "decoding syscall (default)\n   3: fatal signals are always blocked "
      "(default if '-o FILE PROG')\n   4: fatal signals and SIGTSTP (^Z) are "
      "always blocked\n      (useful to make 'strace -o FILE PROG' not stop on "
      "^Z)\n-o file -- send trace output to FILE instead of stderr\n-O "
      "overhead -- set overhead for tracing syscalls to OVERHEAD usecs\n-p pid "
      "-- trace process with process id PID, may be repeated\n-s strsize -- "
      "limit length of print strings to STRSIZE chars (default %d)\n-S sortby "
      "-- sort syscall counts by: time, calls, name, nothing (default %s)\n-u "
      "username -- run command as username handling setuid and/or setgid\n-E "
      "var=val -- put var=val in the environment for command\n-E var -- remove "
      "var from the environment for command\n-P path -- trace accesses to "
      "path\n-k -- obtain stack traces (using libunwind by default, if "
      "compiled with it)\n-w -- obtain stack trace by walking up the frame "
      "pointer chain\n      rather than using libunwind (FASTER but requires "
      "frame pointers!)\n",
      40, 32, "time");
  exit(exitval);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
mov    $0x20,%ecx
lea    0x1801(%rip),%r8
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %esi,%ebx
lea    0xed6(%rip),%rsi
lea    0x181b(%rip),%r8
mov    $0x28,%edx
mov    $0x20,%ecx
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [2380 x i8] c"usage: strace [-CdffhiqrtttTvVxxy] [-I n] [-e expr]...\0A [-a column] [-o file] [-s strsize] [-P path]...\0A -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\0A or: strace -c[df] [-I n] [-e expr]... [-O overhead] [-S sortby]\0A -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\0A-c -- count time, calls, and errors for each syscall and report summary\0A-C -- like -c but also print regular output\0A-d -- enable debug output to stderr\0A-D -- run tracer process as a detached grandchild, not as parent\0A-f -- follow forks, -ff -- with output into separate files\0A-i -- print instruction pointer at time of syscall\0A-q -- suppress messages about attaching, detaching, etc.\0A-r -- print relative timestamp, -t -- absolute timestamp, -tt -- with usecs\0A-T -- print time spent in each syscall\0A-v -- verbose mode: print unabbreviated argv, stat, termios, etc. args\0A-x -- print non-ascii strings in hex, -xx -- print all strings in hex\0A-y -- print paths associated with file descriptor arguments\0A-h -- print help message, -V -- print version\0A-a column -- alignment COLUMN for printing syscall results (default %d)\0A-b execve -- detach on this syscall\0A-e expr -- a qualifying expression: option=[!]all or option=[!]val1[,val2]...\0A options: trace, abbrev, verbose, raw, signal, read, write\0A-I interruptible --\0A 1: no signals are blocked\0A 2: fatal signals are blocked while decoding syscall (default)\0A 3: fatal signals are always blocked (default if '-o FILE PROG')\0A 4: fatal signals and SIGTSTP (^Z) are always blocked\0A (useful to make 'strace -o FILE PROG' not stop on ^Z)\0A-o file -- send trace output to FILE instead of stderr\0A-O overhead -- set overhead for tracing syscalls to OVERHEAD usecs\0A-p pid -- trace process with process id PID, may be repeated\0A-s strsize -- limit length of print strings to STRSIZE chars (default %d)\0A-S sortby -- sort syscall counts by: time, calls, name, nothing (default %s)\0A-u username -- run command as username handling setuid and/or setgid\0A-E var=val -- put var=val in the environment for command\0A-E var -- remove var from the environment for command\0A-P path -- trace accesses to path\0A-k -- obtain stack traces (using libunwind by default, if compiled with it)\0A-w -- obtain stack trace by walking up the frame pointer chain\0A rather than using libunwind (FASTER but requires frame pointers!)\0A\00"
@.str.1 = [5 x i8] c"time\00"
define void @usage(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([2380 x i8], [2380 x i8]* @.str, i64 0, i64 0), i32 40, i32 32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@.str = [2380 x i8] c"usage: strace [-CdffhiqrtttTvVxxy] [-I n] [-e expr]...\0A [-a column] [-o file] [-s strsize] [-P path]...\0A -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\0A or: strace -c[df] [-I n] [-e expr]... [-O overhead] [-S sortby]\0A -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS]\0A-c -- count time, calls, and errors for each syscall and report summary\0A-C -- like -c but also print regular output\0A-d -- enable debug output to stderr\0A-D -- run tracer process as a detached grandchild, not as parent\0A-f -- follow forks, -ff -- with output into separate files\0A-i -- print instruction pointer at time of syscall\0A-q -- suppress messages about attaching, detaching, etc.\0A-r -- print relative timestamp, -t -- absolute timestamp, -tt -- with usecs\0A-T -- print time spent in each syscall\0A-v -- verbose mode: print unabbreviated argv, stat, termios, etc. args\0A-x -- print non-ascii strings in hex, -xx -- print all strings in hex\0A-y -- print paths associated with file descriptor arguments\0A-h -- print help message, -V -- print version\0A-a column -- alignment COLUMN for printing syscall results (default %d)\0A-b execve -- detach on this syscall\0A-e expr -- a qualifying expression: option=[!]all or option=[!]val1[,val2]...\0A options: trace, abbrev, verbose, raw, signal, read, write\0A-I interruptible --\0A 1: no signals are blocked\0A 2: fatal signals are blocked while decoding syscall (default)\0A 3: fatal signals are always blocked (default if '-o FILE PROG')\0A 4: fatal signals and SIGTSTP (^Z) are always blocked\0A (useful to make 'strace -o FILE PROG' not stop on ^Z)\0A-o file -- send trace output to FILE instead of stderr\0A-O overhead -- set overhead for tracing syscalls to OVERHEAD usecs\0A-p pid -- trace process with process id PID, may be repeated\0A-s strsize -- limit length of print strings to STRSIZE chars (default %d)\0A-S sortby -- sort syscall counts by: time, calls, name, nothing (default %s)\0A-u username -- run command as username handling setuid and/or setgid\0A-E var=val -- put var=val in the environment for command\0A-E var -- remove var from the environment for command\0A-P path -- trace accesses to path\0A-k -- obtain stack traces (using libunwind by default, if compiled with it)\0A-w -- obtain stack trace by walking up the frame pointer chain\0A rather than using libunwind (FASTER but requires frame pointers!)\0A\00"
@.str.1 = [5 x i8] c"time\00"
define void @usage(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([2380 x i8], [2380 x i8]* @.str, i64 0, i64 0), i32 40, i32 32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @exit(i32 %1)
unreachable
}