#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 helpAndExit(const char *progname, int status) {
  FILE *stream = stderr;
  if (status == EXIT_SUCCESS)
    stream = stdout;
  fprintf(
      stream,
      "%s - a name/value directory using System V shared memory segments.\n\n",
      progname);
  fprintf(stream, "Usage:\n\t%s [script-file]\n\n", progname);
  fprintf(stream, "Options:\n");
  fprintf(stream, "\t%10s\t%s\n", "-p",
          "creates a persistent shared memory segment");
  fprintf(stream, "\t%10s\t%s\n", "-m [id]",
          "uses a shared memory with the given id");
  fprintf(stream, "\t%10s\t%s. Default: %d\n", "-c [max-nv]",
          "capacity: maximum number of name/value pairs allowed", (1000));
  fprintf(stream, "\t%10s\t%s\n", "-d [id1]+",
          "deletes the shared memory with the given ids");
  fprintf(stream, "\t%10s\t%s\n", "-h", "prints this message and exits");
  exit(status);
}


x86 assembly (clang, -O0):
<helpAndExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
jne    115d <helpAndExit+0x3d>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xec4(%rip),%rsi
lea    0xec7(%rip),%rdx
lea    0xec3(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xea4(%rip),%rsi
lea    0xed5(%rip),%rdx
lea    0xed6(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeeb(%rip),%rsi
lea    0xefb(%rip),%rdx
lea    0xf00(%rip),%rcx
mov    $0x3e8,%r8d
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe5e(%rip),%rsi
lea    0xf16(%rip),%rdx
lea    0xf19(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe3e(%rip),%rsi
lea    0xf2d(%rip),%rdx
lea    0xf29(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<helpAndExit>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    0x2e8f(%rip),%rax
cmp    %esi,(%rax)
jne    114e <helpAndExit+0x1e>
mov    0x2e8c(%rip),%rax
jmp    1155 <helpAndExit+0x25>
mov    0x2e8b(%rip),%rax
mov    (%rax),%rbx
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xed2(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xed9(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xeca(%rip),%rbp
lea    0xecd(%rip),%rdx
lea    0xec9(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xee0(%rip),%rdx
lea    0xee1(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xef4(%rip),%rsi
lea    0xf04(%rip),%rdx
lea    0xf09(%rip),%rcx
mov    %rbx,%rdi
mov    $0x3e8,%r8d
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf27(%rip),%rdx
lea    0xf2a(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf43(%rip),%rdx
lea    0xf3f(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r14d,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [69 x i8] c"%s - a name/value directory using System V shared memory segments.\0A\0A\00"
@.str.1 = [27 x i8] c"Usage:\0A\09%s [script-file]\0A\0A\00"
@.str.2 = [10 x i8] c"Options:\0A\00"
@.str.3 = [10 x i8] c"\09%10s\09%s\0A\00"
@.str.4 = [3 x i8] c"-p\00"
@.str.5 = [43 x i8] c"creates a persistent shared memory segment\00"
@.str.6 = [8 x i8] c"-m [id]\00"
@.str.7 = [39 x i8] c"uses a shared memory with the given id\00"
@.str.8 = [23 x i8] c"\09%10s\09%s. Default: %d\0A\00"
@.str.9 = [12 x i8] c"-c [max-nv]\00"
@.str.10 = [53 x i8] c"capacity: maximum number of name/value pairs allowed\00"
@.str.11 = [10 x i8] c"-d [id1]+\00"
@.str.12 = [45 x i8] c"deletes the shared memory with the given ids\00"
@.str.13 = [3 x i8] c"-h\00"
@.str.14 = [30 x i8] c"prints this message and exits\00"
define void @helpAndExit(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** @stderr
store i32* %6, i32** %5
%7 = load i32, i32* %4
%8 = load i32, i32* @EXIT_SUCCESS
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** @stdout
store i32* %11, i32** %5
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %5
%14 = load i8*, i8** %3
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %5
%17 = load i8*, i8** %3
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32*, i32** %5
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32*, i32** %5
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%23 = load i32*, i32** %5
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%25 = load i32*, i32** %5
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0), i32 1000)
%27 = load i32*, i32** %5
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0))
%29 = load i32*, i32** %5
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0))
%31 = load i32, i32* %4
%32 = call i32 @exit(i32 %31)
unreachable
}

LLVM IR (-O2):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [69 x i8] c"%s - a name/value directory using System V shared memory segments.\0A\0A\00"
@.str.1 = [27 x i8] c"Usage:\0A\09%s [script-file]\0A\0A\00"
@.str.2 = [10 x i8] c"Options:\0A\00"
@.str.3 = [10 x i8] c"\09%10s\09%s\0A\00"
@.str.4 = [3 x i8] c"-p\00"
@.str.5 = [43 x i8] c"creates a persistent shared memory segment\00"
@.str.6 = [8 x i8] c"-m [id]\00"
@.str.7 = [39 x i8] c"uses a shared memory with the given id\00"
@.str.8 = [23 x i8] c"\09%10s\09%s. Default: %d\0A\00"
@.str.9 = [12 x i8] c"-c [max-nv]\00"
@.str.10 = [53 x i8] c"capacity: maximum number of name/value pairs allowed\00"
@.str.11 = [10 x i8] c"-d [id1]+\00"
@.str.12 = [45 x i8] c"deletes the shared memory with the given ids\00"
@.str.13 = [3 x i8] c"-h\00"
@.str.14 = [30 x i8] c"prints this message and exits\00"
define void @helpAndExit(i8* %0, i32 %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp eq i32 %3, %1
%5 = load i32*, i32** @stdout
%6 = load i32*, i32** @stderr
%7 = select i1 %4, i32* %5, i32* %6
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 9, i64 1, i32* %7)
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0), i32 1000)
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0))
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0))
%16 = tail call i32 @exit(i32 %1)
unreachable
}