#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 *, char const *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *arg0, const char *errmsg) {
  if (errmsg)
    fprintf(stderr, "Error: %s\nUsage: %s PROMPT\n", errmsg, arg0);
  else
    fprintf(stderr, "Usage: %s PROMPT\n", arg0);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115f <usage+0x3f>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    117a <usage+0x5a>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rcx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
test   %rsi,%rsi
jne    1145 <usage+0x25>
lea    0xed1(%rip),%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1156 <usage+0x36>
mov    %rsi,%rdx
lea    0xeb1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Error: %s\0AUsage: %s PROMPT\0A\00"
@.str.1 = [18 x i8] c"Usage: %s PROMPT\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = load i8*, i8** %3
%11 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
br label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %3
%15 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %12, %7
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Error: %s\0AUsage: %s PROMPT\0A\00"
@.str.1 = [18 x i8] c"Usage: %s PROMPT\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
%4 = load i32, i32* @stderr
br i1 %3, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
br label %9
7: ; preds = %2
%8 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %7, %5
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
}