#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 */
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void __attribute__((__noreturn__)) show_usage(int rc) {
  FILE *out = rc == EXIT_SUCCESS ? stdout : stderr;
  fprintf(
      out,
      ("\nchrt - manipulate real-time attributes of a process\n"
       "\nSet policy:\n"
       "  chrt [options] <policy> <priority> {<pid> | <command> [<arg> ...]}\n"
       "\nGet policy:\n"
       "  chrt [options] {<pid> | <command> [<arg> ...]}\n"));
  fprintf(out, ("\nScheduling policies:\n"
                "  -b | --batch         set policy to SCHED_BATCH\n"
                "  -f | --fifo          set policy to SCHED_FIFO\n"
                "  -i | --idle          set policy to SCHED_IDLE\n"
                "  -o | --other         set policy to SCHED_OTHER\n"
                "  -r | --rr            set policy to SCHED_RR (default)\n"));
  fprintf(out,
          ("\nScheduling flags:\n"
           "  -R | --reset-on-fork set SCHED_RESET_ON_FORK for FIFO or RR\n"));
  fprintf(out, ("\nOptions:\n"
                "  -h | --help          display this help\n"
                "  -m | --max           show min and max valid priorities\n"
                "  -p | --pid           operate on existing given pid\n"
                "  -v | --verbose       display status information\n"
                "  -V | --version       output version information\n\n"));
  exit(rc);
}


x86 assembly (clang, -O0):
<show_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%eax
jne    1150 <show_usage+0x30>
mov    0x2e94(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    115e <show_usage+0x3e>
mov    0x2e89(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xf45(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0x1046(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0x1088(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<show_usage>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    0x2ea4(%rip),%rax
cmp    %edi,(%rax)
jne    1139 <show_usage+0x19>
mov    0x2ea1(%rip),%rax
jmp    1140 <show_usage+0x20>
mov    0x2ea0(%rip),%rax
mov    (%rax),%rbx
lea    0xeb6(%rip),%rdi
mov    $0xc5,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf63(%rip),%rdi
mov    $0x110,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0x105b(%rip),%rdi
mov    $0x51,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0x1094(%rip),%rdi
mov    $0x106,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %ebp,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@stderr = global i32* null
@.str = [198 x i8] c"\0Achrt - manipulate real-time attributes of a process\0A\0ASet policy:\0A chrt [options] <policy> <priority> {<pid> | <command> [<arg> ...]}\0A\0AGet policy:\0A chrt [options] {<pid> | <command> [<arg> ...]}\0A\00"
@.str.1 = [273 x i8] c"\0AScheduling policies:\0A -b | --batch set policy to SCHED_BATCH\0A -f | --fifo set policy to SCHED_FIFO\0A -i | --idle set policy to SCHED_IDLE\0A -o | --other set policy to SCHED_OTHER\0A -r | --rr set policy to SCHED_RR (default)\0A\00"
@.str.2 = [82 x i8] c"\0AScheduling flags:\0A -R | --reset-on-fork set SCHED_RESET_ON_FORK for FIFO or RR\0A\00"
@.str.3 = [263 x i8] c"\0AOptions:\0A -h | --help display this help\0A -m | --max show min and max valid priorities\0A -p | --pid operate on existing given pid\0A -v | --verbose display status information\0A -V | --version output version information\0A\0A\00"
define void @show_usage(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @EXIT_SUCCESS
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32*, i32** @stdout
br label %11
9: ; preds = %1
%10 = load i32*, i32** @stderr
br label %11
11: ; preds = %9, %7
%12 = phi i32* [ %8, %7 ], [ %10, %9 ]
store i32* %12, i32** %3
%13 = load i32*, i32** %3
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str, i64 0, i64 0))
%15 = load i32*, i32** %3
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([273 x i8], [273 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32*, i32** %3
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32*, i32** %3
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([263 x i8], [263 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32, i32* %2
%22 = call i32 @exit(i32 %21)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@stderr = global i32* null
@.str = [198 x i8] c"\0Achrt - manipulate real-time attributes of a process\0A\0ASet policy:\0A chrt [options] <policy> <priority> {<pid> | <command> [<arg> ...]}\0A\0AGet policy:\0A chrt [options] {<pid> | <command> [<arg> ...]}\0A\00"
@.str.1 = [273 x i8] c"\0AScheduling policies:\0A -b | --batch set policy to SCHED_BATCH\0A -f | --fifo set policy to SCHED_FIFO\0A -i | --idle set policy to SCHED_IDLE\0A -o | --other set policy to SCHED_OTHER\0A -r | --rr set policy to SCHED_RR (default)\0A\00"
@.str.2 = [82 x i8] c"\0AScheduling flags:\0A -R | --reset-on-fork set SCHED_RESET_ON_FORK for FIFO or RR\0A\00"
@.str.3 = [263 x i8] c"\0AOptions:\0A -h | --help display this help\0A -m | --max show min and max valid priorities\0A -p | --pid operate on existing given pid\0A -v | --verbose display status information\0A -V | --version output version information\0A\0A\00"
define void @show_usage(i32 %0) {
%2 = load i32, i32* @EXIT_SUCCESS
%3 = icmp eq i32 %2, %0
%4 = load i32*, i32** @stdout
%5 = load i32*, i32** @stderr
%6 = select i1 %3, i32* %4, i32* %5
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str, i64 0, i64 0), i64 197, i64 1, i32* %6)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([273 x i8], [273 x i8]* @.str.1, i64 0, i64 0), i64 272, i64 1, i32* %6)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.2, i64 0, i64 0), i64 81, i64 1, i32* %6)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([263 x i8], [263 x i8]* @.str.3, i64 0, i64 0), i64 262, i64 1, i32* %6)
%11 = tail call i32 @exit(i32 %0)
unreachable
}