#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
char *strrchr(char *, char);
void usage(char *cmd) {
  char *cp = strrchr(cmd, '/');
  if (cp != NULL) {
    cmd = cp + 1;
  }
  fprintf(stderr, "Server Usage: %s -s tty -k key\n\tto start server.\n\n",
          cmd);
  printf("Client Usage: %s -k key [-p priority] page#/callbk#...\n"
         "\tto queue a page request\n\n",
         cmd);
  printf("\t-s tty\t\tDefault /dev/tty/n"
         "\t-k key\t\tIPC key for server\n"
         "\t-p priority\tDefault priority=20\n"
         "\t\t\t(range 1 to 100)\n");
  puts("\t%s -k 23456 -p5416-555-1212/416-555-5555x4687\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1175 <usage+0x35>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe77(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf3d(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x2f,%esi
call   1050 <strrchr@plt>
lea    0x1(%rax),%rbx
test   %rax,%rax
cmove  %r14,%rbx
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
mov    %rbx,%rdx
call   1060 <fprintf@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
lea    0xeed(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"Server Usage: %s -s tty -k key\0A\09to start server.\0A\0A\00"
@.str.1 = [82 x i8] c"Client Usage: %s -k key [-p priority] page#/callbk#...\0A\09to queue a page request\0A\0A\00"
@.str.2 = [109 x i8] c"\09-s tty\09\09Default /dev/tty/n\09-k key\09\09IPC key for server\0A\09-p priority\09Default priority=20\0A\09\09\09(range 1 to 100)\0A\00"
@.str.3 = [48 x i8] c"\09%s -k 23456 -p5416-555-1212/416-555-5555x4687\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %2
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %2
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"Server Usage: %s -s tty -k key\0A\09to start server.\0A\0A\00"
@.str.1 = [82 x i8] c"Client Usage: %s -k key [-p priority] page#/callbk#...\0A\09to queue a page request\0A\0A\00"
@.str.3 = [48 x i8] c"\09%s -k 23456 -p5416-555-1212/416-555-5555x4687\0A\00"
@str = [108 x i8] c"\09-s tty\09\09Default /dev/tty/n\09-k key\09\09IPC key for server\0A\09-p priority\09Default priority=20\0A\09\09\09(range 1 to 100)\00"
define void @usage(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
ret void
}