#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*/ printf(char *, ...);
char *strrchr(char const *, char);
void usage(const char *name) {
  printf("Usage: %s [options] <disk>\n",
         strrchr(name, '/') ? strrchr(name, '/') + 1 : name);
  printf("\n"
         "Selection:\n"
         "        --primary       select table from disk begin\n"
         "        --backup        select table from disk end\n"
         "General options:\n"
         "    -d  --dump          Dump gpt and partition informations\n"
         "Gpt options:\n"
         "        --validate      validates gpt header\n"
         "        --invalidate    invalidates gpt header (writes zeros in "
         "crc32 checksum section)\n"
         "    -f  --force         action will be forced, use with caution!\n"
         "                        This could lead to a broken system!\n"
         "    -r  --repair        gpt validate should try to repair an "
         "invalidated gpt table\n"
         "    -m  --move          move gpt table to it's default position or "
         "to another given by address parameter\n"
         "    -a                  absolute address in bytes"
         "Partition options:\n"
         "\n"
         "Others:\n"
         "   -h   --help          display this help message\n"
         "        --verbose       activate verbose logging\n"
         "\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   1040 <strrchr@plt>
cmp    $0x0,%rax
je     115f <usage+0x3f>
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1167 <usage+0x47>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1050 <strrchr@plt>
lea    0x1(%rax),%rsi
test   %rax,%rax
cmove  %rbx,%rsi
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Usage: %s [options] <disk>\0A\00"
@.str.1 = [830 x i8] c"\0ASelection:\0A --primary select table from disk begin\0A --backup select table from disk end\0AGeneral options:\0A -d --dump Dump gpt and partition informations\0AGpt options:\0A --validate validates gpt header\0A --invalidate invalidates gpt header (writes zeros in crc32 checksum section)\0A -f --force action will be forced, use with caution!\0A This could lead to a broken system!\0A -r --repair gpt validate should try to repair an invalidated gpt table\0A -m --move move gpt table to it's default position or to another given by address parameter\0A -a absolute address in bytesPartition options:\0A\0AOthers:\0A -h --help display this help message\0A --verbose activate verbose logging\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strrchr(i8* %3, i8 signext 47)
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i8* @strrchr(i8* %7, i8 signext 47)
%9 = getelementptr inbounds i8, i8* %8, i64 1
br label %12
10: ; preds = %1
%11 = load i8*, i8** %2
br label %12
12: ; preds = %10, %6
%13 = phi i8* [ %9, %6 ], [ %11, %10 ]
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([830 x i8], [830 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Usage: %s [options] <disk>\0A\00"
@str = [829 x i8] c"\0ASelection:\0A --primary select table from disk begin\0A --backup select table from disk end\0AGeneral options:\0A -d --dump Dump gpt and partition informations\0AGpt options:\0A --validate validates gpt header\0A --invalidate invalidates gpt header (writes zeros in crc32 checksum section)\0A -f --force action will be forced, use with caution!\0A This could lead to a broken system!\0A -r --repair gpt validate should try to repair an invalidated gpt table\0A -m --move move gpt table to it's default position or to another given by address parameter\0A -a absolute address in bytesPartition options:\0A\0AOthers:\0A -h --help display this help message\0A --verbose activate verbose logging\0A\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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([829 x i8], [829 x i8]* @str, i64 0, i64 0))
ret void
}