#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 EX_USAGE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *reason, int exitcode) {
  char *hg_help = "please contact support@example.com for help.";
  if (reason) {
    fprintf(stderr, "*** Error: %s.\n", reason);
  }
  fprintf(stderr, "*** This program has been invoked incorrectly.\n");
  if (hg_help) {
    fprintf(stderr, "*** %s\n", hg_help);
  }
  exit(exitcode ? exitcode : EX_USAGE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1160 <usage+0x40>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     119d <usage+0x7d>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11b2 <usage+0x92>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11be <usage+0x9e>
mov    0x2e2f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
test   %rdi,%rdi
je     1145 <usage+0x25>
mov    %rdi,%rdx
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeef(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%r14
mov    (%r14),%edi
lea    0xee7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xf06(%rip),%rsi
lea    0xe92(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebx,%ebx
jne    1182 <usage+0x62>
mov    0x2e68(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"please contact support@example.com for help.\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"*** Error: %s.\0A\00"
@.str.2 = [48 x i8] c"*** This program has been invoked incorrectly.\0A\00"
@.str.3 = [8 x i8] c"*** %s\0A\00"
@EX_USAGE = global i32 0
define void @usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %3
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %8, %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %5
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %17, %12
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i32, i32* %4
br label %28
26: ; preds = %21
%27 = load i32, i32* @EX_USAGE
br label %28
28: ; preds = %26, %24
%29 = phi i32 [ %25, %24 ], [ %27, %26 ]
%30 = call i32 @exit(i32 %29)
unreachable
}

LLVM IR (-O2):
@.str = [45 x i8] c"please contact support@example.com for help.\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"*** Error: %s.\0A\00"
@.str.2 = [48 x i8] c"*** This program has been invoked incorrectly.\0A\00"
@.str.3 = [8 x i8] c"*** %s\0A\00"
@EX_USAGE = global i32 0
define void @usage(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %4, %2
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %1, 0
%13 = load i32, i32* @EX_USAGE
%14 = select i1 %12, i32 %13, i32 %1
%15 = tail call i32 @exit(i32 %14)
unreachable
}