#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void help_menu(const char *pname, int err) {
  FILE *fp = stdout;
  if (err)
    fp = stderr;
  fprintf(fp, "Usage: \n");
  fprintf(fp, "%s [PERMS] [OPTIONS]\n", pname);
  fprintf(fp, "FLAGS:\n");
  fprintf(fp, "\t-b:   block all new USB devices (no wait)\n");
  fprintf(fp, "\t-a:   allow everything\n");
  fprintf(fp, "\t-d:   block \"dangerous\" (same as -n and -n)\n");
  fprintf(fp, "\t-i:   block only usbhid devices (DRIVER==usbhid)\n");
  fprintf(fp, "\t-n:   block only usb_interface (DEVTYPE=usb_interface)\n");
  fprintf(fp, "\n");
  fprintf(fp, "Options:\n");
  fprintf(fp, "\t-h:   help menu\n");
  fprintf(fp, "\t-t:   temp permission change wait time (0 for permanent))\n");
  fprintf(fp, "\t-r:   read current permissions\n");
  exit(err);
}


x86 assembly (clang, -O0):
<help_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1155 <help_menu+0x35>
mov    0x2e92(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeeb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe13(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf00(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xef8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xef8(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xf22(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<help_menu>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbp
test   %esi,%esi
jne    1157 <help_menu+0x17>
mov    0x2e83(%rip),%rax
jmp    115e <help_menu+0x1e>
mov    0x2e82(%rip),%rax
mov    (%rax),%rbx
lea    0xe98(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe79(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe8c(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xe8c(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xea1(%rip),%rdi
mov    $0x32,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xebb(%rip),%rdi
mov    $0x38,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xece(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xebf(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xeb8(%rip),%rdi
mov    $0x3b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
lea    0xedb(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %r14d,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdout = global i32* null
@stderr = global i32* null
@.str = [9 x i8] c"Usage: \0A\00"
@.str.1 = [22 x i8] c"%s [PERMS] [OPTIONS]\0A\00"
@.str.2 = [8 x i8] c"FLAGS:\0A\00"
@.str.3 = [44 x i8] c"\09-b: block all new USB devices (no wait)\0A\00"
@.str.4 = [25 x i8] c"\09-a: allow everything\0A\00"
@.str.5 = [46 x i8] c"\09-d: block \22dangerous\22 (same as -n and -n)\0A\00"
@.str.6 = [51 x i8] c"\09-i: block only usbhid devices (DRIVER==usbhid)\0A\00"
@.str.7 = [57 x i8] c"\09-n: block only usb_interface (DEVTYPE=usb_interface)\0A\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [10 x i8] c"Options:\0A\00"
@.str.10 = [18 x i8] c"\09-h: help menu\0A\00"
@.str.11 = [60 x i8] c"\09-t: temp permission change wait time (0 for permanent))\0A\00"
@.str.12 = [33 x i8] c"\09-r: read current permissions\0A\00"
define void @help_menu(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32*, i32** @stdout
store i32* %6, i32** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32*, i32** @stderr
store i32* %10, i32** %5
br label %11
11: ; preds = %9, %2
%12 = load i32*, i32** %5
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = load i32*, i32** %5
%15 = load i8*, i8** %3
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32*, i32** %5
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32*, i32** %5
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32*, i32** %5
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32*, i32** %5
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
%25 = load i32*, i32** %5
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0))
%27 = load i32*, i32** %5
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0))
%29 = load i32*, i32** %5
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%31 = load i32*, i32** %5
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%33 = load i32*, i32** %5
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0))
%35 = load i32*, i32** %5
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.11, i64 0, i64 0))
%37 = load i32*, i32** %5
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%39 = load i32, i32* %4
%40 = call i32 @exit(i32 %39)
unreachable
}

LLVM IR (-O2):
@stdout = global i32* null
@stderr = global i32* null
@.str = [9 x i8] c"Usage: \0A\00"
@.str.1 = [22 x i8] c"%s [PERMS] [OPTIONS]\0A\00"
@.str.2 = [8 x i8] c"FLAGS:\0A\00"
@.str.3 = [44 x i8] c"\09-b: block all new USB devices (no wait)\0A\00"
@.str.4 = [25 x i8] c"\09-a: allow everything\0A\00"
@.str.5 = [46 x i8] c"\09-d: block \22dangerous\22 (same as -n and -n)\0A\00"
@.str.6 = [51 x i8] c"\09-i: block only usbhid devices (DRIVER==usbhid)\0A\00"
@.str.7 = [57 x i8] c"\09-n: block only usb_interface (DEVTYPE=usb_interface)\0A\00"
@.str.9 = [10 x i8] c"Options:\0A\00"
@.str.10 = [18 x i8] c"\09-h: help menu\0A\00"
@.str.11 = [60 x i8] c"\09-t: temp permission change wait time (0 for permanent))\0A\00"
@.str.12 = [33 x i8] c"\09-r: read current permissions\0A\00"
define void @help_menu(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 8, i64 1, i32* %6)
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %6)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i64 43, i64 1, i32* %6)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 24, i64 1, i32* %6)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i64 45, i64 1, i32* %6)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i64 50, i64 1, i32* %6)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0), i64 56, i64 1, i32* %6)
%15 = tail call i32 @fputc(i32 10, i32* %6)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i64 9, i64 1, i32* %6)
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i64 17, i64 1, i32* %6)
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.11, i64 0, i64 0), i64 59, i64 1, i32* %6)
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0), i64 32, i64 1, i32* %6)
%20 = tail call i32 @exit(i32 %1)
unreachable
}