#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 */
char *basename(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void usage(FILE *fp, const char *prog) {
  const char *bn = basename((char *)((char *)prog));
  fprintf(fp,
          "Usage: %s [-v] [-h] [-?] 16|8 data [data [...]]\n"
          "     16 - Perform a CRC-16 computation\n"
          "      8 - Perform a DOW CRC computation (e.g, CRC-8)\n"
          "   data - Hex encoded data to compute the CRC of\n"
          " -h, -? - This usage message\n"
          "     -v - Write version information and then exit\n",
          bn ? bn : prog);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <basename@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115d <usage+0x3d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1165 <usage+0x45>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <basename@plt>
test   %rax,%rax
cmovne %rax,%rbx
lea    0xec0(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [269 x i8] c"Usage: %s [-v] [-h] [-?] 16|8 data [data [...]]\0A 16 - Perform a CRC-16 computation\0A 8 - Perform a DOW CRC computation (e.g, CRC-8)\0A data - Hex encoded data to compute the CRC of\0A -h, -? - This usage message\0A -v - Write version information and then exit\0A\00"
define void @usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i8* @basename(i8* %6)
store i8* %7, i8** %5
%8 = load i32*, i32** %3
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i8*, i8** %5
br label %15
13: ; preds = %2
%14 = load i8*, i8** %4
br label %15
15: ; preds = %13, %11
%16 = phi i8* [ %12, %11 ], [ %14, %13 ]
%17 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([269 x i8], [269 x i8]* @.str, i64 0, i64 0), i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [269 x i8] c"Usage: %s [-v] [-h] [-?] 16|8 data [data [...]]\0A 16 - Perform a CRC-16 computation\0A 8 - Perform a DOW CRC computation (e.g, CRC-8)\0A data - Hex encoded data to compute the CRC of\0A -h, -? - This usage message\0A -v - Write version information and then exit\0A\00"
define void @usage(i32* nocapture %0, i8* %1) {
%3 = tail call i8* @basename(i8* %1)
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* %1, i8* %3
%6 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([269 x i8], [269 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}