#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 *, char *, char *);
void usage(char *name) {
  char *ptr;
  ptr = (name ? name : "chpax");
  printf("%s %s .::. Manage PaX flags for binaries\n"
         "Usage: %s OPTIONS FILE1 FILE2 FILEN ...\n"
         "  -P\tenforce paging based non-executable pages\n"
         "  -p\tdo not enforce paging based non-executable pages\n"
         "  -E\temulate trampolines\n"
         "  -e\tdo not emulate trampolines\n"
         "  -M\trestrict mprotect()\n"
         "  -m\tdo not restrict mprotect()\n"
         "  -R\trandomize mmap() base [ELF only]\n"
         "  -r\tdo not randomize mmap() base [ELF only]\n"
         "  -X\trandomize ET_EXEC base [ELF only]\n"
         "  -x\tdo not randomize ET_EXEC base [ELF only]\n"
         "  -S\tenforce segmentation based non-executable pages\n"
         "  -s\tdo not enforce segmentation based non-executable pages\n"
         "  -v\tview current flag mask \n"
         "  -z\tzero flag mask (next flags still apply)\n\n"
         "The flags only have effect when running the patched Linux kernel.\n",
         ptr, "0.7", ptr);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1144 <usage+0x24>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1154 <usage+0x34>
lea    0xeb5(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1154 <usage+0x34>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rcx
lea    0xe9b(%rip),%rdi
lea    0x1163(%rip),%rdx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
test   %rdi,%rdi
lea    0xed5(%rip),%rcx
cmovne %rdi,%rcx
lea    0xed0(%rip),%rdi
lea    0x1198(%rip),%rdx
mov    %rcx,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"chpax\00"
@.str.1 = [719 x i8] c"%s %s .::. Manage PaX flags for binaries\0AUsage: %s OPTIONS FILE1 FILE2 FILEN ...\0A -P\09enforce paging based non-executable pages\0A -p\09do not enforce paging based non-executable pages\0A -E\09emulate trampolines\0A -e\09do not emulate trampolines\0A -M\09restrict mprotect()\0A -m\09do not restrict mprotect()\0A -R\09randomize mmap() base [ELF only]\0A -r\09do not randomize mmap() base [ELF only]\0A -X\09randomize ET_EXEC base [ELF only]\0A -x\09do not randomize ET_EXEC base [ELF only]\0A -S\09enforce segmentation based non-executable pages\0A -s\09do not enforce segmentation based non-executable pages\0A -v\09view current flag mask \0A -z\09zero flag mask (next flags still apply)\0A\0AThe flags only have effect when running the patched Linux kernel.\0A\00"
@.str.2 = [4 x i8] c"0.7\00"
define void @usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i8*, i8** %2
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %6
%10 = phi i8* [ %7, %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %8 ]
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 @printf(i8* getelementptr inbounds ([719 x i8], [719 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [6 x i8] c"chpax\00"
@.str.1 = [719 x i8] c"%s %s .::. Manage PaX flags for binaries\0AUsage: %s OPTIONS FILE1 FILE2 FILEN ...\0A -P\09enforce paging based non-executable pages\0A -p\09do not enforce paging based non-executable pages\0A -E\09emulate trampolines\0A -e\09do not emulate trampolines\0A -M\09restrict mprotect()\0A -m\09do not restrict mprotect()\0A -R\09randomize mmap() base [ELF only]\0A -r\09do not randomize mmap() base [ELF only]\0A -X\09randomize ET_EXEC base [ELF only]\0A -x\09do not randomize ET_EXEC base [ELF only]\0A -S\09enforce segmentation based non-executable pages\0A -s\09do not enforce segmentation based non-executable pages\0A -v\09view current flag mask \0A -z\09zero flag mask (next flags still apply)\0A\0AThe flags only have effect when running the patched Linux kernel.\0A\00"
@.str.2 = [4 x i8] c"0.7\00"
define void @usage(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([719 x i8], [719 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%5 = tail call i32 @exit(i32 1)
unreachable
}