#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*/ EX_USAGE;
int /*<<< orphan*/ fatal(int /*<<< orphan*/, char *, char const *,
                         char const *);
char *getprogname();
int /*<<< orphan*/ warn(char *, char const *);
void usage(const char *msg) {
  const char *progname;
  if (msg != NULL)
    warn("%s\n", msg);
  progname = getprogname();
  fatal(EX_USAGE,
        "usage: %s [-vz] [-c seconds] [-f opcodefile] [-o outputfile] command\n"
        "       %s [-vz] [-c seconds] [-f opcodefile] [-o outputfile] -p pid\n",
        progname, progname);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1157 <usage+0x27>
mov    -0x8(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1030 <warn@plt>
mov    $0x0,%al
call   1040 <getprogname@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe8a(%rip),%rsi
call   1050 <fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
test   %rdi,%rdi
je     1145 <usage+0x15>
mov    %rdi,%rsi
lea    0xec0(%rip),%rdi
call   1030 <warn@plt>
xor    %eax,%eax
call   1040 <getprogname@plt>
mov    0x2e95(%rip),%rcx
mov    (%rcx),%edi
lea    0xea8(%rip),%rsi
mov    %rax,%rdx
mov    %rax,%rcx
pop    %rax
jmp    1050 <fatal@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@EX_USAGE = global i32 0
@.str.1 = [138 x i8] c"usage: %s [-vz] [-c seconds] [-f opcodefile] [-o outputfile] command\0A %s [-vz] [-c seconds] [-f opcodefile] [-o outputfile] -p pid\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @warn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %1
%10 = call i8* (...) @getprogname()
store i8* %10, i8** %3
%11 = load i32, i32* @EX_USAGE
%12 = load i8*, i8** %3
%13 = load i8*, i8** %3
%14 = call i32 @fatal(i32 %11, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@EX_USAGE = global i32 0
@.str.1 = [138 x i8] c"usage: %s [-vz] [-c seconds] [-f opcodefile] [-o outputfile] command\0A %s [-vz] [-c seconds] [-f opcodefile] [-o outputfile] -p pid\0A\00"
define void @usage(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @warn(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %5
5: ; preds = %3, %1
%6 = tail call i8* (...) @getprogname()
%7 = load i32, i32* @EX_USAGE
%8 = tail call i32 @fatal(i32 %7, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %6)
ret void
}