#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(int);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
void usage(char **argv) {
  char *arg = argv[0];
  char *p = arg + strlen(arg);
  while (p >= arg && *p != '/')
    p--;
  p++;
  printf("usage: %s [options]\n"
         " -h - Show this help menu\n"
         " -b - Bind on the last cpu. (shortcut for -c <lastcpu>)\n"
         " -r prio - Add an RT task with given prio to stress system\n"
         " -c cpulist - Comma/hyphen separated list of CPUs to run deadline "
         "tasks on\n"
         " -i interval - The shortest deadline for the tasks\n"
         " -p percent - The percent of bandwidth to use (1-90%%)\n"
         " -P percent - The percent of runtime for execution completion\n"
         "              (Default 100%%)\n"
         " -t threads - The number of threads to run as deadline (default 1)\n"
         " -s step(us) - The amount to increase the deadline for each task "
         "(default 500us)\n"
         "\n",
         p);
  exit(-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x21(%rbp)
jb     118b <usage+0x5b>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    119b <usage+0x6b>
jmp    11ac <usage+0x7c>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1168 <usage+0x38>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    (%rdi),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
lea    (%rbx,%rax,1),%rsi
test   %eax,%eax
js     115e <usage+0x2e>
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x2f,(%rsi)
je     115e <usage+0x2e>
add    $0xffffffffffffffff,%rsi
cmp    %rbx,%rsi
jae    1150 <usage+0x20>
add    $0x1,%rsi
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [584 x i8] c"usage: %s [options]\0A -h - Show this help menu\0A -b - Bind on the last cpu. (shortcut for -c <lastcpu>)\0A -r prio - Add an RT task with given prio to stress system\0A -c cpulist - Comma/hyphen separated list of CPUs to run deadline tasks on\0A -i interval - The shortest deadline for the tasks\0A -p percent - The percent of bandwidth to use (1-90%%)\0A -P percent - The percent of runtime for execution completion\0A (Default 100%%)\0A -t threads - The number of threads to run as deadline (default 1)\0A -s step(us) - The amount to increase the deadline for each task (default 500us)\0A\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8*
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = getelementptr inbounds i8*, i8** %5, i64 0
%7 = load i8*, i8** %6
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
store i8* %12, i8** %4
br label %13
13: ; preds = %24, %1
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = icmp uge i8* %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 47
br label %22
22: ; preds = %17, %13
%23 = phi i1 [ false, %13 ], [ %21, %17 ]
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 -1
store i8* %26, i8** %4
br label %13
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %4
%30 = load i8*, i8** %4
%31 = call i32 @printf(i8* getelementptr inbounds ([584 x i8], [584 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [584 x i8] c"usage: %s [options]\0A -h - Show this help menu\0A -b - Bind on the last cpu. (shortcut for -c <lastcpu>)\0A -r prio - Add an RT task with given prio to stress system\0A -c cpulist - Comma/hyphen separated list of CPUs to run deadline tasks on\0A -i interval - The shortest deadline for the tasks\0A -p percent - The percent of bandwidth to use (1-90%%)\0A -P percent - The percent of runtime for execution completion\0A (Default 100%%)\0A -t threads - The number of threads to run as deadline (default 1)\0A -s step(us) - The amount to increase the deadline for each task (default 500us)\0A\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @strlen(i8* %2)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %2, i64 %4
%6 = icmp slt i32 %3, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %11
%8 = phi i8* [ %12, %11 ], [ %5, %1 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 47
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %8, i64 -1
%13 = icmp ult i8* %12, %2
br i1 %13, label %14, label %7
14: ; preds = %7, %11, %1
%15 = phi i8* [ %5, %1 ], [ %12, %11 ], [ %8, %7 ]
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([584 x i8], [584 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 -1)
unreachable
}