#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 *, char const *, ...);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void helpAndExit(const char *progname, int status) {
  FILE *stream = stderr;
  if (status == EXIT_SUCCESS)
    stream = stdout;
  fprintf(stream,
          "Usage: %s [-c [state]] [-s [id]] [-x [id]] [-g [id]] [-w [id]] [-d "
          "[id]]\n",
          progname);
  fprintf(stream, "\t%-10s%-50s\n", "-c", "Creates a new event flag");
  fprintf(stream, "\t%-10s%-50s\n", "-s", "Sets an event flag");
  fprintf(stream, "\t%-10s%-50s\n", "-x", "Clears an event flag");
  fprintf(stream, "\t%-10s%-50s\n", "-g",
          "Gets the current value of an event flag");
  fprintf(stream, "\t%-10s%-50s\n", "-w", "Waits for an event flag to be set");
  fprintf(stream, "\t%-10s%-50s\n", "-d", "Deletes an event flag");
  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
lea    0xecc(%rip),%rsi
lea    0xed2(%rip),%rdx
lea    0xece(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xeac(%rip),%rsi
lea    0xece(%rip),%rdx
lea    0xeca(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe8c(%rip),%rsi
lea    0xec4(%rip),%rdx
lea    0xec0(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe6c(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xeb8(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe4c(%rip),%rsi
lea    0xec7(%rip),%rdx
lea    0xec3(%rip),%rcx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe2c(%rip),%rsi
lea    0xecc(%rip),%rdx
lea    0xec8(%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,%rdx
mov    0x2e9f(%rip),%rax
cmp    %esi,(%rax)
jne    113e <helpAndExit+0x1e>
mov    0x2e9c(%rip),%rax
jmp    1145 <helpAndExit+0x25>
mov    0x2e9b(%rip),%rax
mov    (%rax),%rbx
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xeea(%rip),%rbp
lea    0xef0(%rip),%rdx
lea    0xeec(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xef1(%rip),%rdx
lea    0xeed(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xeec(%rip),%rdx
lea    0xee8(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xee9(%rip),%rdx
lea    0xee5(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xef9(%rip),%rdx
lea    0xef5(%rip),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf03(%rip),%rdx
lea    0xeff(%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 = [74 x i8] c"Usage: %s [-c [state]] [-s [id]] [-x [id]] [-g [id]] [-w [id]] [-d [id]]\0A\00"
@.str.1 = [13 x i8] c"\09%-10s%-50s\0A\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [25 x i8] c"Creates a new event flag\00"
@.str.4 = [3 x i8] c"-s\00"
@.str.5 = [19 x i8] c"Sets an event flag\00"
@.str.6 = [3 x i8] c"-x\00"
@.str.7 = [21 x i8] c"Clears an event flag\00"
@.str.8 = [3 x i8] c"-g\00"
@.str.9 = [40 x i8] c"Gets the current value of an event flag\00"
@.str.10 = [3 x i8] c"-w\00"
@.str.11 = [34 x i8] c"Waits for an event flag to be set\00"
@.str.12 = [3 x i8] c"-d\00"
@.str.13 = [22 x i8] c"Deletes an event flag\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*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %5
%17 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32*, i32** %5
%19 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%20 = load i32*, i32** %5
%21 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%22 = load i32*, i32** %5
%23 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%24 = load i32*, i32** %5
%25 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
%26 = load i32*, i32** %5
%27 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
%28 = load i32, i32* %4
%29 = call i32 @exit(i32 %28)
unreachable
}

LLVM IR (-O2):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [74 x i8] c"Usage: %s [-c [state]] [-s [id]] [-x [id]] [-g [id]] [-w [id]] [-d [id]]\0A\00"
@.str.1 = [13 x i8] c"\09%-10s%-50s\0A\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [25 x i8] c"Creates a new event flag\00"
@.str.4 = [3 x i8] c"-s\00"
@.str.5 = [19 x i8] c"Sets an event flag\00"
@.str.6 = [3 x i8] c"-x\00"
@.str.7 = [21 x i8] c"Clears an event flag\00"
@.str.8 = [3 x i8] c"-g\00"
@.str.9 = [40 x i8] c"Gets the current value of an event flag\00"
@.str.10 = [3 x i8] c"-w\00"
@.str.11 = [34 x i8] c"Waits for an event flag to be set\00"
@.str.12 = [3 x i8] c"-d\00"
@.str.13 = [22 x i8] c"Deletes an event flag\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*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0))
%13 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
%14 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
%15 = tail call i32 @exit(i32 %1)
unreachable
}